JavaScript animation engine
4.4.0
Julian Garnier8816e4347973
diff --git a/.gitignore b/.gitignoreindex df702bf3..66c08a1f 100644--- a/.gitignore+++ b/.gitignore@@ -1,5 +1,10 @@.DS_Store-*.log-+*.sublime-project+*.sublime-workspace+.npmrc+.prettierignore+.pi/sandbox.json+.pi/allowed-paths.jsonnode_modules+CLAUDE.md\ No newline at end of filediff --git a/README.md b/README.mdindex 9ffc6bb4..d346f398 100644--- a/README.md+++ b/README.md@@ -32,18 +32,16 @@ Help the project become sustainable by sponsoring us on <a target="_blank" href=<tbody><tr><td>- <a target="_blank" href="https://ice.io/?ref=animejs">+ <a target="_blank" href="https://github.com/sponsors/juliangarnier"><picture>- <source media="(prefers-color-scheme: dark)" srcset="./assets/sponsors/ice-open-network-logomark.png?v=200126">- <img align="center" src="./assets/sponsors/ice-open-network-logomark-dark.png?v=200126" width="310">+ <img align="center" src="./assets/sponsors/placeholder-large.png?v=200126" width="310"></picture></a></td><td>- <a target="_blank" href="https://hyperswitch.io/?utm_source=julian&utm_medium=github&utm_campaign=animejs_sponsorship">+ <a target="_blank" href="https://github.com/sponsors/juliangarnier"><picture>- <source media="(prefers-color-scheme: dark)" srcset="./assets/sponsors/juspay-logomark.png?v=200126">- <img align="center" src="./assets/sponsors/juspay-logomark-dark.png?v=200126" width="310">+ <img align="center" src="./assets/sponsors/placeholder-large.png?v=200126" width="310"></picture></a></td>@@ -71,15 +69,14 @@ Help the project become sustainable by sponsoring us on <a target="_blank" href=</picture></a></td>- <td>- <a target="_blank" href="https://inspatialapp.com/?ref=animejs">+ </td>+ <a target="_blank" href="https://github.com/sponsors/juliangarnier"><picture>- <source media="(prefers-color-scheme: dark)" srcset="./assets/sponsors/inspatial-logomark.png?v=200126">- <img align="center" src="./assets/sponsors/inspatial-logomark-dark.png?v=200126" width="141">+ <img align="center" src="./assets/sponsors/placeholder-small.png?v=200126" width="141"></picture></a></td>- <td>+ </td><a target="_blank" href="https://github.com/sponsors/juliangarnier"><picture><img align="center" src="./assets/sponsors/placeholder-small.png?v=200126" width="141">diff --git a/assets/sponsors/ice-open-network-logomark-dark.png b/assets/sponsors/ice-open-network-logomark-dark.pngdeleted file mode 100644index 14df0b27..00000000Binary files a/assets/sponsors/ice-open-network-logomark-dark.png and /dev/null differdiff --git a/assets/sponsors/ice-open-network-logomark.png b/assets/sponsors/ice-open-network-logomark.pngdeleted file mode 100644index 3f8deeb0..00000000Binary files a/assets/sponsors/ice-open-network-logomark.png and /dev/null differdiff --git a/assets/sponsors/inspatial-logomark-dark.png b/assets/sponsors/inspatial-logomark-dark.pngdeleted file mode 100644index f1e32556..00000000Binary files a/assets/sponsors/inspatial-logomark-dark.png and /dev/null differdiff --git a/assets/sponsors/inspatial-logomark.png b/assets/sponsors/inspatial-logomark.pngdeleted file mode 100644index b792c6aa..00000000Binary files a/assets/sponsors/inspatial-logomark.png and /dev/null differdiff --git a/assets/sponsors/juspay-logomark-dark.png b/assets/sponsors/juspay-logomark-dark.pngdeleted file mode 100644index 8b12b058..00000000Binary files a/assets/sponsors/juspay-logomark-dark.png and /dev/null differdiff --git a/assets/sponsors/juspay-logomark.png b/assets/sponsors/juspay-logomark.pngdeleted file mode 100644index 59b5f5e3..00000000Binary files a/assets/sponsors/juspay-logomark.png and /dev/null differdiff --git a/dist/bundles/anime.esm.js b/dist/bundles/anime.esm.jsindex 1ac6ec95..3160ab8d 100644--- a/dist/bundles/anime.esm.js+++ b/dist/bundles/anime.esm.js@@ -1,6 +1,6 @@/*** Anime.js - ESM bundle- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -46,7 +46,8 @@* @callback StaggerFunction* @param {Target} [target]* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [targets]+ * @param {Tween|null} [prevTween]* @param {Timeline} [tl]* @return {T}*/@@ -54,9 +55,9 @@/*** @typedef {Object} StaggerParams* @property {Number|String} [start]- * @property {Number|'first'|'center'|'last'|'random'} [from]+ * @property {Number|'first'|'center'|'last'|'random'|Array.<Number>} [from]* @property {Boolean} [reversed]- * @property {Array.<Number>} [grid]+ * @property {Array.<Number>|Boolean} [grid]* @property {('x'|'y')} [axis]* @property {String|((target: Target, i: Number, length: Number) => Number)} [use]* @property {Number} [total]@@ -117,8 +118,8 @@// A hack to get both ease names suggestions AND allow any strings// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-460346421-/** @typedef {(String & {})|EaseStringParamNames|EasingFunction|Spring} EasingParam */-/** @typedef {(String & {})|EaseStringParamNames|WAAPIEaseStringParamNames|EasingFunction|Spring} WAAPIEasingParam */+/** @typedef {(String & {})|EaseStringParamNames|EasingFunction|Spring|TweakRegister} EasingParam */+/** @typedef {(String & {})|EaseStringParamNames|WAAPIEaseStringParamNames|EasingFunction|Spring|TweakRegister} WAAPIEasingParam */// Spring types@@ -174,6 +175,7 @@* @property {Boolean|ScrollObserver} [autoplay]* @property {Number} [frameRate]* @property {Number} [playbackRate]+ * @property {Number} [priority]*//**@@ -184,9 +186,10 @@/*** @callback FunctionValue- * @param {Target} target - The animated target- * @param {Number} index - The target index- * @param {Number} length - The total number of animated targets+ * @param {Target} [target] - The animated target+ * @param {Number} [index] - The target index+ * @param {TargetsArray} [targets] - The array of all animated targets+ * @param {Tween|null} [prevTween] - The previous sibling tween for the same target and property* @return {Number|String|TweenObjectValue|EasingParam|Array.<Number|String|TweenObjectValue>}*/@@ -355,7 +358,7 @@* - `'label'` - Label: Position animation at a named label position (e.g., `'My Label'`)<br>* - `stagger(String|Nummber)` - Stagger multi-elements animation positions (e.g., 10, 20, 30...)*- * @typedef {TimelinePosition | StaggerFunction<Number|String>} TimelineAnimationPosition+ * @typedef {TimelinePosition | StaggerFunction<Number|String> | TweakRegister} TimelineAnimationPosition*//**@@ -379,7 +382,7 @@* @callback WAAPIFunctionValue* @param {DOMTarget} target - The animated target* @param {Number} index - The target index- * @param {Number} length - The total number of animated targets+ * @param {DOMTargetsArray} targets - The array of all animated targets* @return {WAAPITweenValue|WAAPIEasingParam}*/@@ -626,6 +629,26 @@* @property {Boolean} [debug]*/+/**+ * @typedef {Object} ScrambleTextParams+ * @property {String|function(Target, Number, TargetsArray): String} [text] - the text to transition to, otherwise uses the original text+ * @property {String|function(Target, Number, TargetsArray): String} [chars] - the characters used for scramble; named sets: 'lowercase', 'uppercase', 'numbers', 'symbols', 'braille', 'blocks', 'shades'; range syntax: 'A-Z', 'a-z0-9'; defaults to 'a-zA-Z0-9!%#_'+ * @property {EasingParam} [ease] - the easing applied to the scramble animation+ * @property {Number|'left'|'center'|'right'|'random'|'auto'} [from] - where the reveal wave starts from, 'auto' (default) uses 'left' when text grows and 'right' when it shrinks+ * @property {Boolean} [reversed] - reverses the reveal order, so 'center' reveals from edges inward instead of center outward+ * @property {Boolean|Number|String} [cursor] - characters displayed at the leading edge of the reveal wave; true uses '_', a number is a char code, a string is used directly+ * @property {Number} [perturbation] - adds random timing offsets to each character's start and end, creating a more organic reveal+ * @property {Number} [seed] - a seed for the random number generator to produce reproducible scramble sequences+ * @property {Boolean|String} [override] - controls the starting appearance: false shows original text, true scrambles it (default), '' starts from blank, ' ' replaces characters with spaces, a custom string (supports range syntax like 'A-Z') uses its characters as scramble set+ * @property {Number} [revealRate] - characters per second entering the active zone; higher values make the reveal wave move faster (default: 60)+ * @property {Number} [settleDuration] - time in ms each character spends scrambling before settling into its final glyph (default: 300)+ * @property {Number} [settleRate] - how many times per second scramble characters cycle in the active zone (default: 30)+ * @property {Number|function(Target, Number, TargetsArray): Number} [duration] - if set to a value greater than 0, overrides the computed duration from interval and settle; if unset or 0, duration is calculated automatically from text length and timing parameters+ * @property {Number|function(Target, Number, TargetsArray): Number} [revealDelay] - delay in ms before the reveal wave starts within the scramble animation+ * @property {Number|function(Target, Number, TargetsArray): Number} [delay] - delay in ms before the entire scramble animation starts+ * @property {function(String, Number): void} [onChange] - callback fired each time a character changes during scramble; receives the current scrambled text and the eased progress (0-1)+ */+// SVG types/**@@ -641,7 +664,7 @@// TODO: Do we need to check if we're running inside a worker ?const isBrowser = typeof window !== 'undefined';-/** @typedef {Window & {AnimeJS: Array} & {AnimeJSDevTools: any}|null} AnimeJSWindow+/** @typedef {Window & {AnimeJS: Array}|null} AnimeJSWindow/** @type {AnimeJSWindow} */const win = isBrowser ? /** @type {AnimeJSWindow} */(/** @type {unknown} */(window)) : null;@@ -688,7 +711,6 @@ const isRegisteredTargetSymbol = Symbol();const isDomSymbol = Symbol();const isSvgSymbol = Symbol();const transformsSymbol = Symbol();-const morphPointsSymbol = Symbol();const proxyTargetSymbol = Symbol();// Numbers@@ -712,6 +734,7 @@ const shortTransforms = /*#__PURE__*/ (() => {})();const validTransforms = [+ 'perspective','translateX','translateY','translateZ',@@ -726,9 +749,6 @@ const validTransforms = ['skew','skewX','skewY',- 'matrix',- 'matrix3d',- 'perspective',];const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});@@ -751,12 +771,23 @@ const digitWithExponentRgx = /[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;// export const unitsExecRgx = /^([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)+([a-z]+|%)$/i;const unitsExecRgx = /^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;const lowerCaseRgx = /([a-z])([A-Z])/g;-const transformsExecRgx = /(\w+)(\([^)]+\)+)/g; // Match inline transforms with cacl() values, returns the value wrapped in ()const relativeValuesExecRgx = /(\*=|\+=|-=)/;const cssVariableMatchRgx = /var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/;+/**+ * @typedef {Object} EditorGlobals+ * @property {boolean} showPanel+ * @property {boolean} synced+ * @property {Function} addAnimation+ * @property {Function} addTimeline+ * @property {Function} addTimelineChild+ * @property {Function} resolveStagger+ * @property {Object|null} _head+ * @property {Object|null} _tail+ */+/** @type {DefaultsParams} */const defaults = {id: null,@@ -800,11 +831,11 @@ const globals = {timeScale: 1,/** @type {Number} */tickThreshold: 200,+ /** @type {EditorGlobals|null} */+ editor: null,};-const devTools = isBrowser && win.AnimeJSDevTools;--const globalVersions = { version: '4.3.6', engine: null };+const globalVersions = { version: '4.4.0', engine: null };if (isBrowser) {if (!win.AnimeJS) win.AnimeJS = [];@@ -920,8 +951,6 @@ const _round = Math.round;*/const clamp$1 = (v, min, max) => v < min ? min : v > max ? max : v;-const powCache = {};-/*** Rounds a number to specified decimal places*@@ -929,13 +958,12 @@ const powCache = {};* @param {Number} decimalLength - Number of decimal places* @return {Number}*/-const round$1 = (v, decimalLength) => {- if (decimalLength < 0) return v;- if (!decimalLength) return _round(v);- let p = powCache[decimalLength];- if (!p) p = powCache[decimalLength] = 10 ** decimalLength;- return _round(v * p) / p;-};+ const round$1 = (v, decimalLength) => {+ if (decimalLength < 0) return v;+ if (!decimalLength) return _round(v);+ const p = 10 ** decimalLength;+ return _round(v * p) / p;+ };/*** Snaps a value to nearest increment or array value@@ -1066,28 +1094,143 @@ const addChild = (parent, child, sortMethod, prevProp = '_prev', nextProp = '_ne*/const parseInlineTransforms = (target, propName, animationInlineStyles) => {const inlineTransforms = target.style.transform;- let inlinedStylesPropertyValue;if (inlineTransforms) {const cachedTransforms = target[transformsSymbol];- let t; while (t = transformsExecRgx.exec(inlineTransforms)) {- const inlinePropertyName = t[1];- // const inlinePropertyValue = t[2];- const inlinePropertyValue = t[2].slice(1, -1);- cachedTransforms[inlinePropertyName] = inlinePropertyValue;- if (inlinePropertyName === propName) {- inlinedStylesPropertyValue = inlinePropertyValue;- // Store the new parsed inline styles if animationInlineStyles is provided- if (animationInlineStyles) {- animationInlineStyles[propName] = inlinePropertyValue;+ let pos = 0;+ const len = inlineTransforms.length;+ let fullTranslateValue;+ while (pos < len) {+ // Skip whitespace+ while (pos < len && inlineTransforms.charCodeAt(pos) === 32) pos++;+ if (pos >= len) break;+ // Read function name+ const nameStart = pos;+ while (pos < len && inlineTransforms.charCodeAt(pos) !== 40) pos++;+ if (pos >= len) break;+ const name = inlineTransforms.substring(nameStart, pos);+ // Scan to closing paren, recording top-level comma positions+ let depth = 1;+ const valueStart = pos + 1;+ let c1 = -1, c2 = -1;+ pos++;+ while (pos < len && depth > 0) {+ const c = inlineTransforms.charCodeAt(pos);+ if (c === 40) depth++;+ else if (c === 41) depth--;+ else if (c === 44 && depth === 1) {+ if (c1 === -1) c1 = pos;+ else if (c2 === -1) c2 = pos;+ }+ pos++;+ }+ const valueEnd = pos - 1;+ // Decompose multi-arg functions into individual axis properties+ if (name === 'translate' || name === 'translate3d') {+ if (c1 === -1) {+ cachedTransforms.translateX = inlineTransforms.substring(valueStart, valueEnd).trim();+ } else {+ cachedTransforms.translateX = inlineTransforms.substring(valueStart, c1).trim();+ if (c2 === -1) {+ cachedTransforms.translateY = inlineTransforms.substring(c1 + 1, valueEnd).trim();+ } else {+ cachedTransforms.translateY = inlineTransforms.substring(c1 + 1, c2).trim();+ cachedTransforms.translateZ = inlineTransforms.substring(c2 + 1, valueEnd).trim();+ }}+ fullTranslateValue = inlineTransforms.substring(valueStart, valueEnd);+ } else if (name === 'scale' || name === 'scale3d') {+ if (c1 === -1) {+ cachedTransforms.scale = inlineTransforms.substring(valueStart, valueEnd).trim();+ } else {+ cachedTransforms.scaleX = inlineTransforms.substring(valueStart, c1).trim();+ if (c2 === -1) {+ cachedTransforms.scaleY = inlineTransforms.substring(c1 + 1, valueEnd).trim();+ } else {+ cachedTransforms.scaleY = inlineTransforms.substring(c1 + 1, c2).trim();+ cachedTransforms.scaleZ = inlineTransforms.substring(c2 + 1, valueEnd).trim();+ }+ }+ } else {+ cachedTransforms[name] = inlineTransforms.substring(valueStart, valueEnd);}}+ // Resolve the requested property from the cache+ if (propName === 'translate3d' && fullTranslateValue) {+ if (animationInlineStyles) animationInlineStyles[propName] = fullTranslateValue;+ return fullTranslateValue;+ }+ const cached = cachedTransforms[propName];+ if (!isUnd(cached)) {+ if (animationInlineStyles) animationInlineStyles[propName] = cached;+ return cached;+ }}- return inlineTransforms && !isUnd(inlinedStylesPropertyValue) ? inlinedStylesPropertyValue :+ return propName === 'translate3d' ? '0px, 0px, 0px' :+ propName === 'rotate3d' ? '0, 0, 0, 0deg' :stringStartsWith(propName, 'scale') ? '1' :stringStartsWith(propName, 'rotate') || stringStartsWith(propName, 'skew') ? '0deg' : '0px';};+/**+ * Builds a CSS transform string from the target's cached transform properties.+ * Iterates validTransforms in order (perspective > translate > rotate > scale > skew > matrix).+ * When adjacent axis properties are all present, emits a shorter shorthand (translateX + translateY -> translate(x, y))+ * The index is advanced past consumed properties so they are not emitted twice.+ * Properties without a grouping partner (e.g. translateY alone, scaleZ alone) emit individually.+ *+ * @param {Record<String, String>} props+ * @return {String}+ */+const buildTransformString = (props) => {+ let str = emptyString;+ for (let i = 0, l = validTransforms.length; i < l; i++) {+ const key = validTransforms[i];+ const val = props[key];+ if (val !== undefined) {+ // Group translateX with adjacent translateY / translateZ+ if (key === 'translateX') {+ const next = props.translateY;+ if (next !== undefined) {+ const next2 = props.translateZ;+ if (next2 !== undefined) {+ str += `translate3d(${val},${next},${next2}) `;+ i += 2;+ } else {+ str += `translate(${val},${next}) `;+ i += 1;+ }+ continue;+ }+ }+ // Group scaleX with adjacent scaleY / scaleZ (only when standalone scale is absent)+ if (key === 'scaleX' && props.scale === undefined) {+ const next = props.scaleY;+ if (next !== undefined) {+ const next2 = props.scaleZ;+ if (next2 !== undefined) {+ str += `scale3d(${val},${next},${next2}) `;+ i += 2;+ } else {+ str += `scale(${val},${next}) `;+ i += 1;+ }+ continue;+ }+ }+ // All other properties: emit individually using pre-built fragment string+ str += `${transformsFragmentStrings[key]}${val}) `;+ }+ // Preserve non-animatable rotate3d in correct position (after rotateZ, before scale)+ if (key === 'rotateZ') {+ if (props.rotate3d !== undefined) str += `rotate3d(${props.rotate3d}) `;+ }+ }+ // Preserve non-animatable matrix/matrix3d from inline styles+ if (props.matrix !== undefined) str += `matrix(${props.matrix}) `;+ if (props.matrix3d !== undefined) str += `matrix3d(${props.matrix3d}) `;+ return str;+};+/**@@ -1189,15 +1332,16 @@ const setValue = (targetValue, defaultValue) => {* @param {TweenPropValue} value* @param {Target} target* @param {Number} index- * @param {Number} total- * @param {Object} [store]+ * @param {TargetsArray} targets+ * @param {Object|null} store+ * @param {Tween|null} prevTween* @return {any}*/-const getFunctionValue = (value, target, index, total, store) => {+const getFunctionValue = (value, target, index, targets, store, prevTween) => {let func;if (isFnc(value)) {func = () => {- const computed = /** @type {Function} */(value)(target, index, total);+ const computed = /** @type {Function} */(value)(target, index, targets, prevTween);// Fallback to 0 if the function returns undefined / NaN / null / false / 0return !isNaN(+computed) ? +computed : computed || 0;};@@ -1264,9 +1408,17 @@ const getCSSValue = (target, propName, animationInlineStyles) => {*/const getOriginalAnimatableValue = (target, propName, tweenType, animationInlineStyles) => {const type = !isUnd(tweenType) ? tweenType : getTweenType(target, propName);- return type === tweenTypes.OBJECT ? target[propName] || 0 :- type === tweenTypes.ATTRIBUTE ? /** @type {DOMTarget} */(target).getAttribute(propName) :- type === tweenTypes.TRANSFORM ? parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :+ if (type === tweenTypes.OBJECT) {+ const value = target[propName];+ if (value && animationInlineStyles) animationInlineStyles[propName] = value;+ return value || 0;+ }+ if (type === tweenTypes.ATTRIBUTE) {+ const value = /** @type {DOMTarget} */(target).getAttribute(propName);+ if (value && animationInlineStyles) animationInlineStyles[propName] = value;+ return value;+ }+ return type === tweenTypes.TRANSFORM ? parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :type === tweenTypes.CSS_VAR ? getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles).trimStart() :getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles);};@@ -1368,6 +1520,54 @@ const decomposeTweenValue = (tween, targetObject) => {const decomposedOriginalValue = createDecomposedValueTargetObject();+/**+ * @param {Tween} tween+ * @param {Number} progress+ * @param {Number} precision+ * @return {String}+ */+const composeColorValue = (tween, progress, precision) => {+ const mod = tween._modifier;+ const fn = tween._fromNumbers;+ const tn = tween._toNumbers;+ const r = round$1(clamp$1(/** @type {Number} */(mod(lerp$1(fn[0], tn[0], progress))), 0, 255), 0);+ const g = round$1(clamp$1(/** @type {Number} */(mod(lerp$1(fn[1], tn[1], progress))), 0, 255), 0);+ const b = round$1(clamp$1(/** @type {Number} */(mod(lerp$1(fn[2], tn[2], progress))), 0, 255), 0);+ const a = clamp$1(/** @type {Number} */(mod(round$1(lerp$1(fn[3], tn[3], progress), precision))), 0, 1);+ if (tween._composition !== compositionTypes.none) {+ const ns = tween._numbers;+ ns[0] = r;+ ns[1] = g;+ ns[2] = b;+ ns[3] = a;+ }+ return `rgba(${r},${g},${b},${a})`;+};++/**+ * @param {Tween} tween+ * @param {Number} progress+ * @param {Number} precision+ * @return {String}+ */+const composeComplexValue = (tween, progress, precision) => {+ const mod = tween._modifier;+ const fn = tween._fromNumbers;+ const tn = tween._toNumbers;+ const ts = tween._strings;+ const hasComposition = tween._composition !== compositionTypes.none;+ let v = ts[0];+ for (let j = 0, l = tn.length; j < l; j++) {+ const n = /** @type {Number} */(mod(round$1(lerp$1(fn[j], tn[j], progress), precision)));+ const s = ts[j + 1];+ v += `${s ? n + s : n}`;+ if (hasComposition) {+ tween._numbers[j] = n;+ }+ }+ return v;+};+@@ -1396,7 +1596,6 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {const _hasChildren = tickable._hasChildren;const tickableDelay = tickable._delay;const tickablePrevAbsoluteTime = tickable._currentTime; // TODO: rename ._currentTime to ._absoluteCurrentTime-const tickableEndTime = tickableDelay + iterationDuration;const tickableAbsoluteTime = time - tickableDelay;const tickablePrevTime = clamp$1(tickablePrevAbsoluteTime, -tickableDelay, duration);@@ -1528,30 +1727,9 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {number = /** @type {Number} */(tweenModifier(round$1(lerp$1(tween._fromNumber, tween._toNumber, tweenProgress), tweenPrecision)));value = `${number}${tween._unit}`;} else if (tweenValueType === valueTypes.COLOR) {- const fn = tween._fromNumbers;- const tn = tween._toNumbers;- const r = round$1(clamp$1(/** @type {Number} */(tweenModifier(lerp$1(fn[0], tn[0], tweenProgress))), 0, 255), 0);- const g = round$1(clamp$1(/** @type {Number} */(tweenModifier(lerp$1(fn[1], tn[1], tweenProgress))), 0, 255), 0);- const b = round$1(clamp$1(/** @type {Number} */(tweenModifier(lerp$1(fn[2], tn[2], tweenProgress))), 0, 255), 0);- const a = clamp$1(/** @type {Number} */(tweenModifier(round$1(lerp$1(fn[3], tn[3], tweenProgress), tweenPrecision))), 0, 1);- value = `rgba(${r},${g},${b},${a})`;- if (tweenHasComposition) {- const ns = tween._numbers;- ns[0] = r;- ns[1] = g;- ns[2] = b;- ns[3] = a;- }+ value = composeColorValue(tween, tweenProgress, tweenPrecision);} else if (tweenValueType === valueTypes.COMPLEX) {- value = tween._strings[0];- for (let j = 0, l = tween._toNumbers.length; j < l; j++) {- const n = /** @type {Number} */(tweenModifier(round$1(lerp$1(tween._fromNumbers[j], tween._toNumbers[j], tweenProgress), tweenPrecision)));- const s = tween._strings[j + 1];- value += `${s ? n + s : n}`;- if (tweenHasComposition) {- tween._numbers[j] = n;- }- }+ value = composeComplexValue(tween, tweenProgress, tweenPrecision);}// For additive tweens and Animatables@@ -1594,14 +1772,8 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {}- // NOTE: Possible improvement: Use translate(x,y) / translate3d(x,y,z) syntax- // to reduce memory usage on string compositionif (tweenTransformsNeedUpdate && tween._renderTransforms) {- let str = emptyString;- for (let key in tweenTargetTransformsProperties) {- str += `${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `;- }- tweenStyle.transform = str;+ tweenStyle.transform = buildTransformString(tweenTargetTransformsProperties);tweenTransformsNeedUpdate = 0;}@@ -1658,6 +1830,50 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {return hasRendered;};+// Shared context for extracted forEachChildren callbacks in tick()+// Avoids closure allocation every frame++let renderCtxChildrenTime = 0;+let renderCtxTlFps = 0;+let renderCtxTickTime = 0;+let renderCtxTickMode = 0;+let renderCtxMuteCallbacks = 0;+let renderCtxInternalRender = 0;+let renderCtxChildrenHasRendered = 0;+let renderCtxChildrenHaveCompleted = true;+let loopCtxIsRunningBackwards = false;+let loopCtxIterationDuration = 0;+let loopCtxMuteCallbacks = 0;++/** @param {JSAnimation} child */+const tickLoopChild = (child) => {+ if (!loopCtxIsRunningBackwards) {+ // Force an internal render to trigger the callbacks if the child has not completed on loop+ if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {+ render(child, loopCtxIterationDuration, loopCtxMuteCallbacks, 1, tickModes.FORCE);+ }+ // Reset their began and completed flags to allow retrigering callbacks on the next iteration+ child.began = false;+ child.completed = false;+ } else {+ const childDuration = child.duration;+ const childStartTime = child._offset + child._delay;+ const childEndTime = childStartTime + childDuration;+ // Triggers the onComplete callback on reverse for children on the edges of the timeline+ if (!loopCtxMuteCallbacks && childDuration <= minValue && (!childStartTime || childEndTime === loopCtxIterationDuration)) {+ child.onComplete(child);+ }+ }+};++/** @param {JSAnimation} child */+const tickRenderChild = (child) => {+ const childTime = round$1((renderCtxChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds+ const childTickMode = child._fps < renderCtxTlFps ? child.requestTick(renderCtxTickTime) : renderCtxTickMode;+ renderCtxChildrenHasRendered += render(child, childTime, renderCtxMuteCallbacks, renderCtxInternalRender, childTickMode);+ if (!child.completed && renderCtxChildrenHaveCompleted) renderCtxChildrenHaveCompleted = false;+};+/*** @param {Tickable} tickable* @param {Number} time@@ -1674,45 +1890,30 @@ const tick = (tickable, time, muteCallbacks, internalRender, tickMode) => {const tlIsRunningBackwards = tl.backwards;const tlChildrenTime = internalRender ? time : tl._iterationTime;const tlCildrenTickTime = now();-let tlChildrenHasRendered = 0;let tlChildrenHaveCompleted = true;-// If the timeline has looped forward, we need to manually triggers children skipped callbacksif (!internalRender && tl._currentIteration !== _currentIteration) {const tlIterationDuration = tl.iterationDuration;- forEachChildren(tl, (/** @type {JSAnimation} */child) => {- if (!tlIsRunningBackwards) {- // Force an internal render to trigger the callbacks if the child has not completed on loop- if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {- render(child, tlIterationDuration, muteCallbacks, 1, tickModes.FORCE);- }- // Reset their began and completed flags to allow retrigering callbacks on the next iteration- child.began = false;- child.completed = false;- } else {- const childDuration = child.duration;- const childStartTime = child._offset + child._delay;- const childEndTime = childStartTime + childDuration;- // Triggers the onComplete callback on reverse for children on the edges of the timeline- if (!muteCallbacks && childDuration <= minValue && (!childStartTime || childEndTime === tlIterationDuration)) {- child.onComplete(child);- }- }- });+ loopCtxIsRunningBackwards = tlIsRunningBackwards;+ loopCtxIterationDuration = tlIterationDuration;+ loopCtxMuteCallbacks = muteCallbacks;+ forEachChildren(tl, tickLoopChild);if (!muteCallbacks) tl.onLoop(/** @type {CallbackArgument} */(tl));}-- forEachChildren(tl, (/** @type {JSAnimation} */child) => {- const childTime = round$1((tlChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds- const childTickMode = child._fps < tl._fps ? child.requestTick(tlCildrenTickTime) : tickMode;- tlChildrenHasRendered += render(child, childTime, muteCallbacks, internalRender, childTickMode);- if (!child.completed && tlChildrenHaveCompleted) tlChildrenHaveCompleted = false;- }, tlIsRunningBackwards);-+ renderCtxChildrenTime = tlChildrenTime;+ renderCtxTlFps = tl._fps;+ renderCtxTickTime = tlCildrenTickTime;+ renderCtxTickMode = tickMode;+ renderCtxMuteCallbacks = muteCallbacks;+ renderCtxInternalRender = internalRender;+ renderCtxChildrenHasRendered = 0;+ renderCtxChildrenHaveCompleted = true;+ forEachChildren(tl, tickRenderChild, tlIsRunningBackwards);+ tlChildrenHasRendered = renderCtxChildrenHasRendered;+ tlChildrenHaveCompleted = renderCtxChildrenHaveCompleted;// Renders on timeline are triggered by its children so it needs to be set after rendering the childrenif (!muteCallbacks && tlChildrenHasRendered) tl.onRender(/** @type {CallbackArgument} */(tl));-// Triggers the timeline onComplete() once all chindren all completed and the current time has reached the endif ((tlChildrenHaveCompleted || tlIsRunningBackwards) && tl._currentTime >= tl.duration) {// Make sure the paused flag is false in case it has been skipped in the render function@@ -1766,59 +1967,78 @@ const sanitizePropertyName = (propertyName, target, tweenType) => {/*** @template {Renderable} T* @param {T} renderable+ * @param {Boolean} [inlineStylesOnly]* @return {T}*/-const cleanInlineStyles = renderable => {- // Allow cleanInlineStyles() to be called on timelines+const revertValues = (renderable, inlineStylesOnly = false) => {+ // Allow revertValues() to be called on timelinesif (renderable._hasChildren) {- forEachChildren(renderable, cleanInlineStyles, true);+ forEachChildren(renderable, (/** @type {Renderable} */child) => revertValues(child, inlineStylesOnly), true);} else {const animation = /** @type {JSAnimation} */(renderable);animation.pause();forEachChildren(animation, (/** @type {Tween} */tween) => {const tweenProperty = tween.property;const tweenTarget = tween.target;- if (tweenTarget[isDomSymbol]) {- const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;- const originalInlinedValue = tween._inlineValue;- const tweenHadNoInlineValue = isNil(originalInlinedValue) || originalInlinedValue === emptyString;- if (tween._tweenType === tweenTypes.TRANSFORM) {- const cachedTransforms = tweenTarget[transformsSymbol];- if (tweenHadNoInlineValue) {- delete cachedTransforms[tweenProperty];- } else {- cachedTransforms[tweenProperty] = originalInlinedValue;- }- if (tween._renderTransforms) {- if (!Object.keys(cachedTransforms).length) {- targetStyle.removeProperty('transform');+ const tweenType = tween._tweenType;+ const originalInlinedValue = tween._inlineValue;+ const tweenHadNoInlineValue = isNil(originalInlinedValue) || originalInlinedValue === emptyString;+ if (tweenType === tweenTypes.OBJECT) {+ if (!inlineStylesOnly && !tweenHadNoInlineValue) {+ tweenTarget[tweenProperty] = originalInlinedValue;+ }+ } else if (tweenTarget[isDomSymbol]) {+ if (tweenType === tweenTypes.ATTRIBUTE) {+ if (!inlineStylesOnly) {+ if (tweenHadNoInlineValue) {+ /** @type {DOMTarget} */(tweenTarget).removeAttribute(tweenProperty);} else {- let str = emptyString;- for (let key in cachedTransforms) {- str += transformsFragmentStrings[key] + cachedTransforms[key] + ') ';- }- targetStyle.transform = str;+ /** @type {DOMTarget} */(tweenTarget).setAttribute(tweenProperty, /** @type {String} */(originalInlinedValue));}}} else {- if (tweenHadNoInlineValue) {- targetStyle.removeProperty(toLowerCase(tweenProperty));+ const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;+ if (tweenType === tweenTypes.TRANSFORM) {+ const cachedTransforms = tweenTarget[transformsSymbol];+ if (tweenHadNoInlineValue) {+ delete cachedTransforms[tweenProperty];+ } else {+ cachedTransforms[tweenProperty] = originalInlinedValue;+ }+ if (tween._renderTransforms) {+ if (!Object.keys(cachedTransforms).length) {+ targetStyle.removeProperty('transform');+ } else {+ targetStyle.transform = buildTransformString(cachedTransforms);+ }+ }} else {- targetStyle[tweenProperty] = originalInlinedValue;+ if (tweenHadNoInlineValue) {+ targetStyle.removeProperty(toLowerCase(tweenProperty));+ } else {+ targetStyle[tweenProperty] = originalInlinedValue;+ }}}- if (animation._tail === tween) {- animation.targets.forEach(t => {- if (t.getAttribute && t.getAttribute('style') === emptyString) {- t.removeAttribute('style');- } });- }+ }+ if (tweenTarget[isDomSymbol] && animation._tail === tween) {+ animation.targets.forEach(t => {+ if (t.getAttribute && t.getAttribute('style') === emptyString) {+ t.removeAttribute('style');+ } });}});}return renderable;};+/**+ * @template {Renderable} T+ * @param {T} renderable+ * @return {T}+ */+const cleanInlineStyles = renderable => revertValues(renderable, true);+/*@@ -2503,6 +2723,9 @@ const reviveTimer = timer => {let timerId = 0;+/** @param {Timer} prev @param {Timer} child */+const sortByPriority = (prev, child) => prev._priority > child._priority;+/*** Base class used to create Timers, Animations and Timelines*/@@ -2529,6 +2752,7 @@ class Timer extends Clock {autoplay,frameRate,playbackRate,+ priority,onComplete,onLoop,onPause,@@ -2550,16 +2774,6 @@ class Timer extends Clock {/** @type {Number} */(timerLoop) < 0 ? Infinity :/** @type {Number} */(timerLoop) + 1;- if (devTools) {- const isInfinite = timerIterationCount === Infinity;- const registered = devTools.register(this, parameters, isInfinite);- if (registered && isInfinite) {- const minIterations = alternate ? 2 : 1;- const iterations = parent ? devTools.maxNestedInfiniteLoops : devTools.maxInfiniteLoops;- timerIterationCount = Math.max(iterations, minIterations);- }- }-let offsetPosition = 0;if (parent) {@@ -2643,6 +2857,8 @@ class Timer extends Clock {this._fps = setValue(frameRate, timerDefaults.frameRate);/** @type {Number} */this._speed = setValue(playbackRate, timerDefaults.playbackRate);+ /** @type {Number} */+ this._priority = +setValue(priority, 1);}get cancelled() {@@ -2787,7 +3003,7 @@ class Timer extends Clock {tick(this, minValue, 0, 0, tickModes.FORCE);} else {if (!this._running) {- addChild(engine, this);+ addChild(engine, this, sortByPriority);engine._hasChildren = true;this._running = true;}@@ -3382,7 +3598,7 @@ class JSAnimation extends Timer {* @param {Number} [parentPosition]* @param {Boolean} [fastSet=false]* @param {Number} [index=0]- * @param {Number} [length=0]+ * @param {TargetsArray} [allTargets]*/constructor(targets,@@ -3391,7 +3607,7 @@ class JSAnimation extends Timer {parentPosition,fastSet = false,index = 0,- length = 0+ allTargets) {super(/** @type {TimerParams & AnimationParams} */(parameters), parent, parentPosition);@@ -3442,7 +3658,7 @@ class JSAnimation extends Timer {const target = parsedTargets[targetIndex];const ti = index || targetIndex;- const tl = length || targetsLength;+ const tl = allTargets || parsedTargets;let lastTransformGroupIndex = NaN;let lastTransformGroupLength = NaN;@@ -3518,7 +3734,14 @@ class JSAnimation extends Timer {toFunctionStore.func = null;fromFunctionStore.func = null;- const computedToValue = getFunctionValue(key.to, target, ti, tl, toFunctionStore);+ const computedComposition = getFunctionValue(setValue(key.composition, tComposition), target, ti, tl, null, null);+ const tweenComposition = isNum(computedComposition) ? computedComposition : compositionTypes[computedComposition];+ if (!siblings && tweenComposition !== compositionTypes.none) siblings = getTweenSiblings(target, propName);+ // Timelines pass the last sibling tween if it belongs to the same timeline+ // Standalone animations only pass prevTween when the property has multiple keyframes+ const tailTween = siblings ? siblings._tail : null;+ const prevSiblingTween = parent && tailTween && tailTween.parent.parent === parent ? tailTween : prevTween;+ const computedToValue = getFunctionValue(key.to, target, ti, tl, toFunctionStore, prevSiblingTween);let tweenToValue;// Allows function based values to return an object syntax value ({to: v})@@ -3528,20 +3751,18 @@ class JSAnimation extends Timer {} else {tweenToValue = computedToValue;}- const tweenFromValue = getFunctionValue(key.from, target, ti, tl);+ const tweenFromValue = getFunctionValue(key.from, target, ti, tl, null, prevSiblingTween);const easeToParse = key.ease || tEasing;- const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl);+ const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl, null, prevSiblingTween);const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;// Calculate default individual keyframe duration by dividing the tl of keyframes- const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl) / l : tDuration)), target, ti, tl);+ const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl, null, prevSiblingTween) / l : tDuration)), target, ti, tl, null, prevSiblingTween);// Default delay value should only be applied to the first tween- const tweenDelay = getFunctionValue(setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl);- const computedComposition = getFunctionValue(setValue(key.composition, tComposition), target, ti, tl);- const tweenComposition = isNum(computedComposition) ? computedComposition : compositionTypes[computedComposition];+ const tweenDelay = getFunctionValue(setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl, null, prevSiblingTween);// Modifiers are treated differently and don't accept function based value to prevent having to pass a function wrapperconst tweenModifier = key.modifier || tModifier;const hasFromvalue = !isUnd(tweenFromValue);@@ -3558,7 +3779,6 @@ class JSAnimation extends Timer {let prevSibling = prevTween;if (tweenComposition !== compositionTypes.none) {- if (!siblings) siblings = getTweenSiblings(target, propName);let nextSibling = siblings._head;// Iterate trough all the next siblings until we find a sibling with an equal or inferior start timewhile (nextSibling && !nextSibling._isOverridden && nextSibling._absoluteStartTime <= absoluteStartTime) {@@ -3577,8 +3797,8 @@ class JSAnimation extends Timer {// Decompose valuesif (isFromToValue) {- decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore) : tweenFromValue, fromTargetObject);- decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore) : tweenToValue, toTargetObject);+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore, prevSiblingTween) : tweenFromValue, fromTargetObject);+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore, prevSiblingTween) : tweenToValue, toTargetObject);// Needed to force an inline style registrationconst originalValue = getOriginalAnimatableValue(target, propName, tweenType, inlineStylesStore);if (fromTargetObject.t === valueTypes.NUMBER) {@@ -3732,6 +3952,18 @@ class JSAnimation extends Timer {composeTween(tween, siblings);}+ // Pre-compute the tween end value for function-based value chaining (ie morphTo / scrambleText in keyframe arrays and timelines)+ const vt = tween._valueType;+ if (vt === valueTypes.COMPLEX) {+ tween._value = composeComplexValue(tween, 1, -1);+ } else if (vt === valueTypes.COLOR) {+ tween._value = composeColorValue(tween, 1, -1);+ } else if (vt === valueTypes.UNIT) {+ tween._value = `${tweenModifier(tween._toNumber)}${tween._unit}`;+ } else {+ tween._value = tweenModifier(tween._toNumber);+ }+if (isNaN(firstTweenChangeStartTime)) {firstTweenChangeStartTime = tween._startTime;}@@ -3889,7 +4121,7 @@ class JSAnimation extends Timer {*/revert() {super.revert();- return cleanInlineStyles(this);+ return revertValues(this);}/**@@ -3911,170 +4143,12 @@ class JSAnimation extends Timer {* @param {AnimationParams} parameters* @return {JSAnimation}*/-const animate = (targets, parameters) => new JSAnimation(targets, parameters, null, 0, false).init();------const WAAPIAnimationsLookups = {- _head: null,- _tail: null,-};--/**- * @param {DOMTarget} $el- * @param {String} [property]- * @param {WAAPIAnimation} [parent]- * @return {globalThis.Animation}- */-const removeWAAPIAnimation = ($el, property, parent) => {- let nextLookup = WAAPIAnimationsLookups._head;- let anim;- while (nextLookup) {- const next = nextLookup._next;- const matchTarget = nextLookup.$el === $el;- const matchProperty = !property || nextLookup.property === property;- const matchParent = !parent || nextLookup.parent === parent;- if (matchTarget && matchProperty && matchParent) {- anim = nextLookup.animation;- try { anim.commitStyles(); } catch {} anim.cancel();- removeChild(WAAPIAnimationsLookups, nextLookup);- const lookupParent = nextLookup.parent;- if (lookupParent) {- lookupParent._completed++;- if (lookupParent.animations.length === lookupParent._completed) {- lookupParent.completed = true;- lookupParent.paused = true;- if (!lookupParent.muteCallbacks) {- lookupParent.onComplete(lookupParent);- lookupParent._resolve(lookupParent);- }- }- }- }- nextLookup = next;- }- return anim;-};--/**- * @param {WAAPIAnimation} parent- * @param {DOMTarget} $el- * @param {String} property- * @param {PropertyIndexedKeyframes} keyframes- * @param {KeyframeAnimationOptions} params- * @retun {globalThis.Animation}- */-const addWAAPIAnimation = (parent, $el, property, keyframes, params) => {- const animation = $el.animate(keyframes, params);- const animTotalDuration = params.delay + (+params.duration * params.iterations);- animation.playbackRate = parent._speed;- if (parent.paused) animation.pause();- if (parent.duration < animTotalDuration) {- parent.duration = animTotalDuration;- parent.controlAnimation = animation;- }- parent.animations.push(animation);- removeWAAPIAnimation($el, property);- addChild(WAAPIAnimationsLookups, { parent, animation, $el, property, _next: null, _prev: null });- const handleRemove = () => removeWAAPIAnimation($el, property, parent);- animation.oncancel = handleRemove;- animation.onremove = handleRemove;- if (!parent.persist) {- animation.onfinish = handleRemove;- }- return animation;-};------/**- * @overload- * @param {DOMTargetSelector} targetSelector- * @param {String} propName- * @return {String}- *- * @overload- * @param {JSTargetsParam} targetSelector- * @param {String} propName- * @return {Number|String}- *- * @overload- * @param {DOMTargetsParam} targetSelector- * @param {String} propName- * @param {String} unit- * @return {String}- *- * @overload- * @param {TargetsParam} targetSelector- * @param {String} propName- * @param {Boolean} unit- * @return {Number}- *- * @param {TargetsParam} targetSelector- * @param {String} propName- * @param {String|Boolean} [unit]- */-function get(targetSelector, propName, unit) {- const targets = registerTargets(targetSelector);- if (!targets.length) return;- const [ target ] = targets;- const tweenType = getTweenType(target, propName);- const normalizePropName = sanitizePropertyName(propName, target, tweenType);- let originalValue = getOriginalAnimatableValue(target, normalizePropName);- if (isUnd(unit)) {- return originalValue;- } else {- decomposeRawValue(originalValue, decomposedOriginalValue);- if (decomposedOriginalValue.t === valueTypes.NUMBER || decomposedOriginalValue.t === valueTypes.UNIT) {- if (unit === false) {- return decomposedOriginalValue.n;- } else {- const convertedValue = convertValueUnit(/** @type {DOMTarget} */(target), decomposedOriginalValue, /** @type {String} */(unit), false);- return `${round$1(convertedValue.n, globals.precision)}${convertedValue.u}`;- }- }- }-}--/**- * @param {TargetsParam} targets- * @param {AnimationParams} parameters- * @return {JSAnimation}- */-const set = (targets, parameters) => {- if (isUnd(parameters)) return;- parameters.duration = minValue;- // Do not overrides currently active tweens by default- parameters.composition = setValue(parameters.composition, compositionTypes.none);- // Skip init() and force rendering by playing the animation- return new JSAnimation(targets, parameters, null, 0, true).resume();-};--/**- * @param {TargetsParam} targets- * @param {Renderable|WAAPIAnimation} [renderable]- * @param {String} [propertyName]- * @return {TargetsArray}- */-const remove = (targets, renderable, propertyName) => {- const targetsArray = parseTargets(targets);- for (let i = 0, l = targetsArray.length; i < l; i++) {- removeWAAPIAnimation(- /** @type {DOMTarget} */(targetsArray[i]),- propertyName,- renderable && /** @type {WAAPIAnimation} */(renderable).controlAnimation && /** @type {WAAPIAnimation} */(renderable),- );+const animate = (targets, parameters) => {+ if (globals.editor) {+ return globals.editor.addAnimation(targets, parameters);+ } else {+ return new JSAnimation(targets, parameters, null, 0, false).init();}- removeTargetsFromRenderable(- targetsArray,- /** @type {Renderable} */(renderable),- propertyName- );- return targetsArray;};@@ -4130,6 +4204,8 @@ const parseTimelinePosition = (timeline, timePosition) => {++/*** @param {Timeline} tl* @return {Number}@@ -4151,7 +4227,7 @@ function getTimelineTotalDuration(tl) {* @param {Number} timePosition* @param {TargetsParam} targets* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [allTargets]* @return {Timeline}** @param {TimerParams|AnimationParams} childParams@@ -4159,15 +4235,15 @@ function getTimelineTotalDuration(tl) {* @param {Number} timePosition* @param {TargetsParam} [targets]* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [allTargets]*/-function addTlChild(childParams, tl, timePosition, targets, index, length) {+function addTlChild(childParams, tl, timePosition, targets, index, allTargets) {const isSetter = isNum(childParams.duration) && /** @type {Number} */(childParams.duration) <= minValue;// Offset the tl position with -minValue for 0 duration animations or .set() calls in order to align their end value with the defined positionconst adjustedPosition = isSetter ? timePosition - minValue : timePosition;if (tl.composition) tick(tl, adjustedPosition, 1, 1, tickModes.AUTO);const tlChild = targets ?- new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, length) :+ new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, allTargets) :new Timer(/** @type {TimerParams} */(childParams), tl, adjustedPosition);if (tl.composition) tlChild.init(true);// TODO: Might be better to insert at a position relative to startTime?@@ -4215,7 +4291,7 @@ class Timeline extends Timer {* @overload* @param {TargetsParam} a1* @param {AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]* @return {this}** @overload@@ -4225,7 +4301,7 @@ class Timeline extends Timer {** @param {TargetsParam|TimerParams} a1* @param {TimelinePosition|AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]*/add(a1, a2, a3) {const isAnim = isObj(a2);@@ -4234,9 +4310,11 @@ class Timeline extends Timer {this._hasChildren = true;if (isAnim) {const childParams = /** @type {AnimationParams} */(a2);- // Check for function for children stagger positions- if (isFnc(a3)) {- const staggeredPosition = a3;+ const editorHook = globals.editor && globals.editor.addTimelineChild;+ const isStaggerType = a3 && /** @type {TweakRegister} */(a3).type === 'Stagger' && globals.editor;+ // Check for function or Stagger type children positions+ const staggeredPosition = isFnc(a3) ? a3 : null;+ if (staggeredPosition || isStaggerType) {const parsedTargetsArray = parseTargets(/** @type {TargetsParam} */(a1));// Store initial duration before adding new children that will change the durationconst tlDuration = this.duration;@@ -4247,28 +4325,36 @@ class Timeline extends Timer {let i = 0;/** @type {Number} */const parsedLength = (parsedTargetsArray.length);+ // Call editor hook once for the entire stagger group instead of per target+ const resolvedParams = editorHook ? editorHook(/** @type {TargetsParam} */(a1), childParams, this.id, a3, parsedLength) : null;+ // Resolve stagger AFTER editor hook so tweaked position value (a3.defaultValue) is used+ const staggerFn = staggeredPosition || globals.editor.resolveStagger(/** @type {TweakRegister} */(a3).defaultValue);parsedTargetsArray.forEach((/** @type {Target} */target) => {// Create a new parameter object for each staggered children- const staggeredChildParams = { ...childParams };+ const staggeredChildParams = { ...(resolvedParams || childParams) };// Reset the duration of the timeline iteration before each stagger to prevent wrong start value calculationthis.duration = tlDuration;this.iterationDuration = tlIterationDuration;if (!isUnd(id)) staggeredChildParams.id = id + '-' + i;+ const staggeredTimePosition = parseTimelinePosition(this, staggerFn(target, i, parsedTargetsArray, null, this));addTlChild(staggeredChildParams,this,- parseTimelinePosition(this, staggeredPosition(target, i, parsedLength, this)),+ staggeredTimePosition,target,i,- parsedLength+ parsedTargetsArray,);i++;});} else {+ // Call editor hook before resolving position so tweaked values are applied+ const resolvedChildParams = editorHook ? editorHook(/** @type {TargetsParam} */(a1), childParams, this.id, a3) : childParams;+ const resolvedPosition = a3 && /** @type {*} */(a3).type ? /** @type {*} */(a3).defaultValue : a3;addTlChild(- childParams,+ resolvedChildParams,this,- parseTimelinePosition(this, a3),+ parseTimelinePosition(this, resolvedPosition),/** @type {TargetsParam} */(a1),);}@@ -4390,7 +4476,7 @@ class Timeline extends Timer {revert() {super.revert();forEachChildren(this, (/** @type {JSAnimation|Timer} */child) => child.revert, true);- return cleanInlineStyles(this);+ return revertValues(this);}/**@@ -4410,7 +4496,12 @@ class Timeline extends Timer {* @param {TimelineParams} [parameters]* @return {Timeline}*/-const createTimeline = parameters => new Timeline(parameters).init();+const createTimeline = parameters => {+ if (globals.editor) {+ return /** @type {Timeline} */(/** @type {unknown} */(globals.editor.addTimeline(parameters)));+ }+ return new Timeline(parameters).init();+};@@ -4857,6 +4948,170 @@ const createSpring = (parameters) => {+const WAAPIAnimationsLookups = {+ _head: null,+ _tail: null,+};++/**+ * @param {DOMTarget} $el+ * @param {String} [property]+ * @param {WAAPIAnimation} [parent]+ * @return {globalThis.Animation}+ */+const removeWAAPIAnimation = ($el, property, parent) => {+ let nextLookup = WAAPIAnimationsLookups._head;+ let anim;+ while (nextLookup) {+ const next = nextLookup._next;+ const matchTarget = nextLookup.$el === $el;+ const matchProperty = !property || nextLookup.property === property;+ const matchParent = !parent || nextLookup.parent === parent;+ if (matchTarget && matchProperty && matchParent) {+ anim = nextLookup.animation;+ try { anim.commitStyles(); } catch {} anim.cancel();+ removeChild(WAAPIAnimationsLookups, nextLookup);+ const lookupParent = nextLookup.parent;+ if (lookupParent) {+ lookupParent._completed++;+ if (lookupParent.animations.length === lookupParent._completed) {+ lookupParent.completed = true;+ lookupParent.paused = true;+ if (!lookupParent.muteCallbacks) {+ lookupParent.onComplete(lookupParent);+ lookupParent._resolve(lookupParent);+ }+ }+ }+ }+ nextLookup = next;+ }+ return anim;+};++/**+ * @param {WAAPIAnimation} parent+ * @param {DOMTarget} $el+ * @param {String} property+ * @param {PropertyIndexedKeyframes} keyframes+ * @param {KeyframeAnimationOptions} params+ * @retun {globalThis.Animation}+ */+const addWAAPIAnimation = (parent, $el, property, keyframes, params) => {+ const animation = $el.animate(keyframes, params);+ const animTotalDuration = params.delay + (+params.duration * params.iterations);+ animation.playbackRate = parent._speed;+ if (parent.paused) animation.pause();+ if (parent.duration < animTotalDuration) {+ parent.duration = animTotalDuration;+ parent.controlAnimation = animation;+ }+ parent.animations.push(animation);+ removeWAAPIAnimation($el, property);+ addChild(WAAPIAnimationsLookups, { parent, animation, $el, property, _next: null, _prev: null });+ const handleRemove = () => removeWAAPIAnimation($el, property, parent);+ animation.oncancel = handleRemove;+ animation.onremove = handleRemove;+ if (!parent.persist) {+ animation.onfinish = handleRemove;+ }+ return animation;+};++++++/**+ * @overload+ * @param {DOMTargetSelector} targetSelector+ * @param {String} propName+ * @return {String}+ *+ * @overload+ * @param {JSTargetsParam} targetSelector+ * @param {String} propName+ * @return {Number|String}+ *+ * @overload+ * @param {DOMTargetsParam} targetSelector+ * @param {String} propName+ * @param {String} unit+ * @return {String}+ *+ * @overload+ * @param {TargetsParam} targetSelector+ * @param {String} propName+ * @param {Boolean} unit+ * @return {Number}+ *+ * @param {TargetsParam} targetSelector+ * @param {String} propName+ * @param {String|Boolean} [unit]+ */+function get(targetSelector, propName, unit) {+ const targets = registerTargets(targetSelector);+ if (!targets.length) return;+ const [ target ] = targets;+ const tweenType = getTweenType(target, propName);+ const normalizePropName = sanitizePropertyName(propName, target, tweenType);+ let originalValue = getOriginalAnimatableValue(target, normalizePropName);+ if (isUnd(unit)) {+ return originalValue;+ } else {+ decomposeRawValue(originalValue, decomposedOriginalValue);+ if (decomposedOriginalValue.t === valueTypes.NUMBER || decomposedOriginalValue.t === valueTypes.UNIT) {+ if (unit === false) {+ return decomposedOriginalValue.n;+ } else {+ const convertedValue = convertValueUnit(/** @type {DOMTarget} */(target), decomposedOriginalValue, /** @type {String} */(unit), false);+ return `${round$1(convertedValue.n, globals.precision)}${convertedValue.u}`;+ }+ }+ }+}++/**+ * @param {TargetsParam} targets+ * @param {AnimationParams} parameters+ * @return {JSAnimation}+ */+const set = (targets, parameters) => {+ if (isUnd(parameters)) return;+ parameters.duration = minValue;+ // Do not overrides currently active tweens by default+ parameters.composition = setValue(parameters.composition, compositionTypes.none);+ // Skip init() and force rendering by playing the animation+ return new JSAnimation(targets, parameters, null, 0, true).resume();+};++/**+ * @param {TargetsParam} targets+ * @param {Renderable|WAAPIAnimation} [renderable]+ * @param {String} [propertyName]+ * @return {TargetsArray}+ */+const remove = (targets, renderable, propertyName) => {+ const targetsArray = parseTargets(targets);+ for (let i = 0, l = targetsArray.length; i < l; i++) {+ removeWAAPIAnimation(+ /** @type {DOMTarget} */(targetsArray[i]),+ propertyName,+ renderable && /** @type {WAAPIAnimation} */(renderable).controlAnimation && /** @type {WAAPIAnimation} */(renderable),+ );+ }+ removeTargetsFromRenderable(+ targetsArray,+ /** @type {Renderable} */(renderable),+ propertyName+ );+ return targetsArray;+};+++++/*** @param {Event} e*/@@ -6059,19 +6314,20 @@ const sync = (callback = noop) => {};/**- * @param {(...args: any[]) => Tickable | ((...args: any[]) => void)} constructor+ * @param {(...args: any[]) => Tickable | ((...args: any[]) => void) | void} constructor* @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}*/const keepTime = constructor => {/** @type {Tickable} */let tracked;return (...args) => {- let currentIteration, currentIterationProgress, reversed, alternate;+ let currentIteration, currentIterationProgress, reversed, alternate, startTime;if (tracked) {currentIteration = tracked.currentIteration;currentIterationProgress = tracked.iterationProgress;reversed = tracked.reversed;alternate = tracked._alternate;+ startTime = tracked._startTime;tracked.revert();}const cleanup = constructor(...args);@@ -6079,6 +6335,7 @@ const keepTime = constructor => {if (!isUnd(currentIterationProgress)) {/** @type {Tickable} */(tracked).currentIteration = currentIteration;/** @type {Tickable} */(tracked).iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;+ /** @type {Tickable} */(tracked)._startTime = startTime;}return cleanup || noop;}@@ -7424,12 +7681,12 @@ let transformsPropertiesRegistered = null;* @param {WAAPIKeyframeValue} value* @param {DOMTarget} $el* @param {Number} i- * @param {Number} targetsLength+ * @param {DOMTargetsArray} parsedTargets* @return {String}*/-const normalizeTweenValue = (propName, value, $el, i, targetsLength) => {+const normalizeTweenValue = (propName, value, $el, i, parsedTargets) => {// Do not try to compute strings with getFunctionValue otherwise it will convert CSS variables- let v = isStr(value) ? value : getFunctionValue(/** @type {any} */(value), $el, i, targetsLength);+ let v = isStr(value) ? value : getFunctionValue(/** @type {any} */(value), $el, i, parsedTargets, null, null);if (!isNum(v)) return v;if (commonDefaultPXProperties.includes(propName) || stringStartsWith(propName, 'translate')) return `${v}px`;if (stringStartsWith(propName, 'rotate') || stringStartsWith(propName, 'skew')) return `${v}deg`;@@ -7442,18 +7699,18 @@ const normalizeTweenValue = (propName, value, $el, i, targetsLength) => {* @param {WAAPIKeyframeValue} from* @param {WAAPIKeyframeValue} to* @param {Number} i- * @param {Number} targetsLength+ * @param {DOMTargetsArray} parsedTargets* @return {WAAPITweenValue}*/-const parseIndividualTweenValue = ($el, propName, from, to, i, targetsLength) => {+const parseIndividualTweenValue = ($el, propName, from, to, i, parsedTargets) => {/** @type {WAAPITweenValue} */let tweenValue = '0';- const computedTo = !isUnd(to) ? normalizeTweenValue(propName, to, $el, i, targetsLength) : getComputedStyle($el)[propName];+ const computedTo = !isUnd(to) ? normalizeTweenValue(propName, to, $el, i, parsedTargets) : getComputedStyle($el)[propName];if (!isUnd(from)) {- const computedFrom = normalizeTweenValue(propName, from, $el, i, targetsLength);+ const computedFrom = normalizeTweenValue(propName, from, $el, i, parsedTargets);tweenValue = [computedFrom, computedTo];} else {- tweenValue = isArr(to) ? to.map((/** @type {any} */v) => normalizeTweenValue(propName, v, $el, i, targetsLength)) : computedTo;+ tweenValue = isArr(to) ? to.map((/** @type {any} */v) => normalizeTweenValue(propName, v, $el, i, parsedTargets)) : computedTo;}return tweenValue;};@@ -7492,9 +7749,8 @@ class WAAPIAnimation {}const parsedTargets = registerTargets(targets);- const targetsLength = parsedTargets.length;- if (!targetsLength) {+ if (!parsedTargets.length) {console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);}@@ -7550,7 +7806,7 @@ class WAAPIAnimation {const easeToParse = setValue(params.ease, globals.defaults.ease);- const easeFunctionResult = getFunctionValue(easeToParse, $el, i, targetsLength);+ const easeFunctionResult = getFunctionValue(easeToParse, $el, i, parsedTargets, null, null);const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;const spring = /** @type {Spring} */(easeToParse).ease && easeToParse;@@ -7558,9 +7814,9 @@ class WAAPIAnimation {const easing = parseWAAPIEasing(keyEasing);/** @type {Number} */- const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, targetsLength)) * timeScale;+ const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, parsedTargets, null, null)) * timeScale;/** @type {Number} */- const delay = getFunctionValue(setValue(params.delay, globals.defaults.delay), $el, i, targetsLength) * timeScale;+ const delay = getFunctionValue(setValue(params.delay, globals.defaults.delay), $el, i, parsedTargets, null, null) * timeScale;/** @type {CompositeOperation} */const composite = /** @type {CompositeOperation} */(setValue(params.composition, 'replace'));@@ -7586,19 +7842,19 @@ class WAAPIAnimation {const to = /** @type {WAAPITweenOptions} */(tweenOptions).to;const from = /** @type {WAAPITweenOptions} */(tweenOptions).from;/** @type {Number} */- tweenParams.duration = (tweenOptionsSpring ? /** @type {Spring} */(tweenOptionsSpring).settlingDuration : getFunctionValue(setValue(tweenOptions.duration, duration), $el, i, targetsLength)) * timeScale;+ tweenParams.duration = (tweenOptionsSpring ? /** @type {Spring} */(tweenOptionsSpring).settlingDuration : getFunctionValue(setValue(tweenOptions.duration, duration), $el, i, parsedTargets, null, null)) * timeScale;/** @type {Number} */- tweenParams.delay = getFunctionValue(setValue(tweenOptions.delay, delay), $el, i, targetsLength) * timeScale;+ tweenParams.delay = getFunctionValue(setValue(tweenOptions.delay, delay), $el, i, parsedTargets, null, null) * timeScale;/** @type {CompositeOperation} */tweenParams.composite = /** @type {CompositeOperation} */(setValue(tweenOptions.composition, composite));/** @type {String} */tweenParams.easing = parseWAAPIEasing(tweenOptionsEase);- parsedPropertyValue = parseIndividualTweenValue($el, name, from, to, i, targetsLength);+ parsedPropertyValue = parseIndividualTweenValue($el, name, from, to, i, parsedTargets);if (individualTransformProperty) {keyframes[`--${individualTransformProperty}`] = parsedPropertyValue;cachedTransforms[individualTransformProperty] = parsedPropertyValue;} else {- keyframes[name] = parseIndividualTweenValue($el, name, from, to, i, targetsLength);+ keyframes[name] = parseIndividualTweenValue($el, name, from, to, i, parsedTargets);}addWAAPIAnimation(this, $el, name, keyframes, tweenParams);if (!isUnd(from)) {@@ -7611,8 +7867,8 @@ class WAAPIAnimation {}} else {parsedPropertyValue = isArr(propertyValue) ?- propertyValue.map((/** @type {any} */v) => normalizeTweenValue(name, v, $el, i, targetsLength)) :- normalizeTweenValue(name, /** @type {any} */(propertyValue), $el, i, targetsLength);+ propertyValue.map((/** @type {any} */v) => normalizeTweenValue(name, v, $el, i, parsedTargets)) :+ normalizeTweenValue(name, /** @type {any} */(propertyValue), $el, i, parsedTargets);if (individualTransformProperty) {keyframes[`--${individualTransformProperty}`] = parsedPropertyValue;cachedTransforms[individualTransformProperty] = parsedPropertyValue;@@ -7845,6 +8101,7 @@ const waapi = {/*** @typedef {Object} LayoutSpecificAnimationParams+ * @property {Number|String} [id]* @property {Number|FunctionValue} [delay]* @property {Number|FunctionValue} [duration]* @property {EasingParam|FunctionValue} [ease]@@ -7887,7 +8144,7 @@ const waapi = {* @property {String} id* @property {DOMTarget} $el* @property {Number} index- * @property {Number} total+ * @property {Array<DOMTarget>} targets* @property {Number} delay* @property {Number} duration* @property {EasingParam} ease@@ -8031,7 +8288,7 @@ const createNode = ($el, parentNode, state, recycledNode) => {node.$measure = $el;node.id = dataId;node.index = 0;- node.total = 1;+ node.targets = null;node.delay = 0;node.duration = 0;node.ease = null;@@ -8217,12 +8474,12 @@ const updateNodeProperties = (node, props) => {* @param {LayoutAnimationTimingsParams} params*/const updateNodeTimingParams = (node, params) => {- const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.total);+ const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.targets, null, null);const keyEasing = isFnc(easeFunctionResult) ? easeFunctionResult : params.ease;const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);node.ease = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;- node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.total);- node.delay = getFunctionValue(params.delay, node.$el, node.index, node.total);+ node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.targets, null, null);+ node.delay = getFunctionValue(params.delay, node.$el, node.index, node.targets, null, null);};/**@@ -8595,10 +8852,12 @@ class LayoutSnapshot {const inRootNodeIds = new Set();// Update index and total for inital timing calculation- let index = 0, total = this.nodes.size;+ let index = 0;+ const allNodeTargets = [];+ this.nodes.forEach((node) => { allNodeTargets.push(node.$el); });this.nodes.forEach((node, id) => {node.index = index++;- node.total = total;+ node.targets = allNodeTargets;// Track ids of nodes that belong to the current root to filter detached matchesif (node && node.measuredIsInsideRoot) {inRootNodeIds.add(id);@@ -8710,8 +8969,8 @@ class AutoLayout {this.params = params;/** @type {DOMTarget} */this.root = /** @type {DOMTarget} */(registerTargets(root)[0]);- /** @type {Number} */- this.id = layoutId++;+ /** @type {Number|String} */+ this.id = params.id || layoutId++;/** @type {LayoutChildrenParam} */this.children = params.children || '*';/** @type {Boolean} */@@ -8834,7 +9093,9 @@ class AutoLayout {duration: setValue(params.duration, this.params.duration),};/** @type {TimelineParams} */- const tlParams = {};+ const tlParams = {+ id: this.id+ };const onComplete = setValue(params.onComplete, this.params.onComplete);const onPause = setValue(params.onPause, this.params.onPause);for (let name in defaults) {@@ -8848,7 +9109,8 @@ class AutoLayout {}tlParams.onComplete = () => {const ap = /** @type {ScrollObserver} */(params.autoplay);- const isScrollControled = ap && ap.linked;+ const ed = globals.editor;+ const isScrollControled = (ap && ap.linked) || (ed && ed.showPanel);if (isScrollControled) {if (onComplete) onComplete(this.timeline);return;@@ -9047,41 +9309,39 @@ class AutoLayout {animatedParent = animatedParent.parentNode;}- const animatingTotal = animating.length;-// Root is always animated first in sync with the first child (animating.length is the total of children)if (node === rootNode) {node.index = 0;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, animationTimings);} else if (node.isEntering) {node.index = animatedParent ? animatedParent.index : enteringIndex;- node.total = animatedParent ? animatingTotal : entering.length;+ node.targets = animatedParent ? animating : entering;updateNodeTimingParams(node, enterFromTimings);enteringIndex++;} else if (node.isLeaving) {node.index = animatedParent ? animatedParent.index : leavingIndex;- node.total = animatedParent ? animatingTotal : leaving.length;+ node.targets = animatedParent ? animating : leaving;leavingIndex++;updateNodeTimingParams(node, leaveToTimings);} else if (node.isTarget) {node.index = animatingIndex++;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, animationTimings);} else {node.index = animatedParent ? animatedParent.index : 0;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, swapAtTimings);}// Make sure the old state node has its inex and total values up to date for valid "from" function values calculationoldStateNode.index = node.index;- oldStateNode.total = node.total;+ oldStateNode.targets = node.targets;// Computes all values up front so we can check for changes and we don't have to re-compute them inside the animation propsfor (let prop in nodeProperties) {- nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.total);- oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.total);+ nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.targets, null, null);+ oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.targets, null, null);}// Use a 1px tolerance to detect dimensions changes to prevent width / height animations on barelly visible elements@@ -9307,8 +9567,8 @@ class AutoLayout {}$el.style.transform = oldState.getComputedValue($el, 'transform');if (animatedSwap.includes($el)) {- node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.total);- node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.total);+ node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.targets, null, null);+ node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.targets, null, null);}}this.transformAnimation = waapi.animate(transformed, {@@ -9323,7 +9583,7 @@ class AutoLayout {if (!animatedSwap.includes($el)) return newValue;const oldValue = oldState.getComputedValue($el, 'transform');const node = newState.getNode($el);- return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]+ return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.targets, null, null), newValue]},autoplay: false,// persist: true,@@ -9380,10 +9640,13 @@ const chain = fn => {const result = fn(...args);return new Proxy(noop, {apply: (_, __, [v]) => result(v),- get: (_, prop) => chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {- const nextResult = chainables[prop](...nextArgs);- return (/**@type {Number|String} */v) => nextResult(result(v));- })+ get: (_, prop) => {+ if (!chainables[prop]) return undefined;+ return chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {+ const nextResult = chainables[prop](...nextArgs);+ return (/**@type {Number|String} */v) => nextResult(result(v));+ })+ }});}};@@ -9594,24 +9857,28 @@ const shuffle = items => {* @param {StaggerParams} [params]* @return {StaggerFunction<Number>}*/+/*** @overload* @param {String} val* @param {StaggerParams} [params]* @return {StaggerFunction<String>}*/+/*** @overload* @param {[Number, Number]} val* @param {StaggerParams} [params]* @return {StaggerFunction<Number>}*/+/*** @overload* @param {[String, String]} val* @param {StaggerParams} [params]* @return {StaggerFunction<String>}*/+/*** @param {Number|String|[Number, Number]|[String, String]} val The staggered value or range* @param {StaggerParams} [params] The stagger parameters@@ -9620,6 +9887,7 @@ const shuffle = items => {const stagger = (val, params = {}) => {let values = [];let maxValue = 0;+ let cachedOffset;const from = params.from;const reversed = params.reversed;const ease = params.ease;@@ -9627,12 +9895,14 @@ const stagger = (val, params = {}) => {const hasSpring = hasEasing && !isUnd(/** @type {Spring} */(ease).ease);const staggerEase = hasSpring ? /** @type {Spring} */(ease).ease : hasEasing ? parseEase(ease) : null;const grid = params.grid;+ const autoGrid = grid === true;const axis = params.axis;const customTotal = params.total;const fromFirst = isUnd(from) || from === 0 || from === 'first';const fromCenter = from === 'center';const fromLast = from === 'last';const fromRandom = from === 'random';+ const fromArr = isArr(from);const isRange = isArr(val);const useProp = params.use;const val1 = isRange ? parseNumber(val[0]) : parseNumber(val);@@ -9640,40 +9910,129 @@ const stagger = (val, params = {}) => {const unitMatch = unitsExecRgx.exec((isRange ? val[1] : val) + emptyString);const start = params.start || 0 + (isRange ? val1 : 0);let fromIndex = fromFirst ? 0 : isNum(from) ? from : 0;- return (target, i, t, tl) => {+ return (target, i, t, _, tl) => {const [ registeredTarget ] = registerTargets(target);- const total = isUnd(customTotal) ? t : customTotal;+ const total = isUnd(customTotal) ? t.length : customTotal;const customIndex = !isUnd(useProp) ? isFnc(useProp) ? useProp(registeredTarget, i, total) : getOriginalAnimatableValue(registeredTarget, useProp) : false;const staggerIndex = isNum(customIndex) || isStr(customIndex) && isNum(+customIndex) ? +customIndex : i;if (fromCenter) fromIndex = (total - 1) / 2;if (fromLast) fromIndex = total - 1;if (!values.length) {- for (let index = 0; index < total; index++) {- if (!grid) {- values.push(abs(fromIndex - index));+ if (autoGrid) {+ let hasPositions = true;+ let minPosX = Infinity;+ let minPosY = Infinity;+ let maxPosX = -Infinity;+ let maxPosY = -Infinity;+ const pxArr = [];+ const pyArr = [];+ for (let index = 0; index < total; index++) {+ const el = t[index];+ let px = 0;+ let py = 0;+ let found = false;+ if (el && isFnc(el.getBoundingClientRect)) {+ const rect = el.getBoundingClientRect();+ px = rect.left + rect.width / 2;+ py = rect.top + rect.height / 2;+ found = true;+ } else {+ const obj = /** @type {JSTarget} */(el);+ if (obj && isNum(obj.x) && isNum(obj.y)) {+ px = obj.x;+ py = obj.y;+ found = true;+ }+ }+ if (!found) {+ hasPositions = false;+ break;+ }+ pxArr.push(px);+ pyArr.push(py);+ if (px < minPosX) minPosX = px;+ if (py < minPosY) minPosY = py;+ if (px > maxPosX) maxPosX = px;+ if (py > maxPosY) maxPosY = py;+ }+ if (hasPositions) {+ let fX = pxArr[0];+ let fY = pyArr[0];+ if (fromArr) {+ fX = minPosX + from[0] * (maxPosX - minPosX);+ fY = minPosY + from[1] * (maxPosY - minPosY);+ } else if (fromCenter) {+ fX = (minPosX + maxPosX) / 2;+ fY = (minPosY + maxPosY) / 2;+ } else if (fromLast) {+ fX = pxArr[total - 1];+ fY = pyArr[total - 1];+ } else if (isNum(from)) {+ fX = pxArr[from];+ fY = pyArr[from];+ }+ for (let index = 0; index < total; index++) {+ const distanceX = fX - pxArr[index];+ const distanceY = fY - pyArr[index];+ let value = sqrt(distanceX * distanceX + distanceY * distanceY);+ if (axis === 'x') value = -distanceX;+ if (axis === 'y') value = -distanceY;+ values.push(value);+ }+ let minDist = Infinity;+ for (let index = 0, l = values.length; index < l; index++) {+ const absVal = abs(values[index]);+ if (absVal > 0 && absVal < minDist) minDist = absVal;+ }+ if (minDist > 0 && minDist < Infinity) {+ for (let index = 0, l = values.length; index < l; index++) {+ values[index] = values[index] / minDist;+ }+ }} else {- const fromX = !fromCenter ? fromIndex % grid[0] : (grid[0] - 1) / 2;- const fromY = !fromCenter ? floor(fromIndex / grid[0]) : (grid[1] - 1) / 2;- const toX = index % grid[0];- const toY = floor(index / grid[0]);- const distanceX = fromX - toX;- const distanceY = fromY - toY;- let value = sqrt(distanceX * distanceX + distanceY * distanceY);- if (axis === 'x') value = -distanceX;- if (axis === 'y') value = -distanceY;- values.push(value);+ for (let index = 0; index < total; index++) {+ values.push(abs(fromIndex - index));+ }+ }+ } else {+ for (let index = 0; index < total; index++) {+ if (!grid) {+ values.push(abs(fromIndex - index));+ } else {+ let fromX, fromY;+ if (fromArr) {+ fromX = from[0] * (grid[0] - 1);+ fromY = from[1] * (grid[1] - 1);+ } else if (fromCenter) {+ fromX = (grid[0] - 1) / 2;+ fromY = (grid[1] - 1) / 2;+ } else {+ fromX = fromIndex % grid[0];+ fromY = floor(fromIndex / grid[0]);+ }+ const toX = index % grid[0];+ const toY = floor(index / grid[0]);+ const distanceX = fromX - toX;+ const distanceY = fromY - toY;+ let value = sqrt(distanceX * distanceX + distanceY * distanceY);+ if (axis === 'x') value = -distanceX;+ if (axis === 'y') value = -distanceY;+ values.push(value);+ }}- maxValue = max(...values);}+ maxValue = max(...values);if (staggerEase) values = values.map(val => staggerEase(val / maxValue) * maxValue);if (reversed) values = values.map(val => axis ? (val < 0) ? val * -1 : -val : abs(maxValue - val));if (fromRandom) values = shuffle(values);}const spacing = isRange ? (val2 - val1) / maxValue : val1;- const offset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);+ if (isUnd(cachedOffset)) {+ cachedOffset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);+ }/** @type {String|Number} */- let output = offset + ((spacing * round$1(values[staggerIndex], 2)) || 0);- if (params.modifier) output = params.modifier(output);+ let output = cachedOffset + ((spacing * round$1(values[staggerIndex], 2)) || 0);+ if (params.modifier) output = params.modifier(/** @type {Number} */(output));if (unitMatch) output = `${output}${unitMatch[2]}`;return output;}@@ -9682,11 +10041,13 @@ const stagger = (val, params = {}) => {var index$2 = /*#__PURE__*/Object.freeze({__proto__: null,$: registerTargets,+ addChild: addChild,clamp: clamp,cleanInlineStyles: cleanInlineStyles,createSeededRandom: createSeededRandom,damp: damp,degToRad: degToRad,+ forEachChildren: forEachChildren,get: get,keepTime: keepTime,lerp: lerp,@@ -9697,6 +10058,7 @@ var index$2 = /*#__PURE__*/Object.freeze({random: random,randomPick: randomPick,remove: remove,+ removeChild: removeChild,round: round,roundPad: roundPad,set: set,@@ -9896,7 +10258,7 @@ const createDrawable = (selector, start = 0, end = 0) => {* @param {Number} [precision]* @return {FunctionValue}*/-const morphTo = (path2, precision = .33) => ($path1) => {+const morphTo = (path2, precision = .33) => ($path1, index, total, prevTween) => {const tagName1 = ($path1.tagName || '').toLowerCase();if (!tagName1.match(/^(path|polygon|polyline)$/)) {throw new Error(`Can't morph a <${$path1.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);@@ -9911,7 +10273,7 @@ const morphTo = (path2, precision = .33) => ($path1) => {}const isPath = $path1.tagName === 'path';const separator = isPath ? ' ' : ',';- const previousPoints = $path1[morphPointsSymbol];+ const previousPoints = prevTween ? prevTween._value : null;if (previousPoints) $path1.setAttribute(isPath ? 'd' : 'points', previousPoints);let v1 = '', v2 = '';@@ -9933,8 +10295,6 @@ const morphTo = (path2, precision = .33) => ($path1) => {}}- $path1[morphPointsSymbol] = v2;-return [v1, v2];};@@ -10120,7 +10480,7 @@ const processHTMLTemplate = (htmlTemplate, store, node, $parentFragment, type, d*/class TextSplitter {/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]*/constructor(target, parameters = {}) {@@ -10192,11 +10552,11 @@ class TextSplitter {}/**- * @param {(...args: any[]) => Tickable | (() => void)} effect+ * @param {(...args: any[]) => Tickable | (() => void) | void} effect* @return this*/addEffect(effect) {- if (!isFnc(effect)) return console.warn('Effect must return a function.');+ if (!isFnc(effect)) { console.warn('Effect must return a function.'); return this; }const refreshableEffect = keepTime(effect);this.effects.push(refreshableEffect);if (this.ready) this.effectsCleanups[this.effects.length - 1] = refreshableEffect(this);@@ -10402,7 +10762,7 @@ class TextSplitter {}/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]* @return {TextSplitter}*/@@ -10420,11 +10780,263 @@ const split = (target, parameters) => {return new TextSplitter(target, parameters);};+++/**+ * '-' is the range operator; place it at the start or end of the string to use it as a literal (e.g. '-abc' or 'abc-')+ * @param {String} str+ * @return {String}+ */+const expandCharRanges = (str) => {+ let result = '';+ for (let i = 0, l = str.length; i < l; i++) {+ if (i + 2 < l && str[i + 1] === '-' && str.charCodeAt(i) < str.charCodeAt(i + 2)) {+ const start = str.charCodeAt(i);+ const end = str.charCodeAt(i + 2);+ for (let c = start; c <= end; c++) result += String.fromCharCode(c);+ i += 2;+ } else {+ result += str[i];+ }+ }+ return result;+};++const charSets = {+ lowercase: 'a-z',+ uppercase: 'A-Z',+ numbers: '0-9',+ symbols: '!%#_|*+=',+ braille: '⠀-⣿',+ blocks: '▀-▟',+ shades: '░-▓',+};++const originalTexts = new WeakMap();++/**+ * Returns a function-based tween value that scrambles the target's text content,+ * progressively revealing the original text.+ *+ * @param {ScrambleTextParams} [params]+ * @return {FunctionValue}+ */+const scrambleText = (params = {}) => {+ if (!params) params = {};+ const charsParam = params.chars;+ const easeFn = parseEase(params.ease || 'linear');+ const text = params.text;+ const fromParam = params.from;+ const reversed = params.reversed || false;+ const perturbation = params.perturbation || 0;+ const cursorParam = params.cursor;+ const cursorChars = cursorParam === true ? '_'+ : typeof cursorParam === 'number' ? String.fromCharCode(cursorParam)+ : typeof cursorParam === 'string' ? cursorParam+ : '';+ const cursorLen = cursorChars.length;+ const seed = params.seed || 0;+ const override = params.override !== undefined ? params.override : true;+ const revealRate = params.revealRate || 60;+ const interval = 1000 * globals.timeScale / revealRate;+ const settleDuration = params.settleDuration || 300 * globals.timeScale;+ const settleRate = params.settleRate || 30;+ const durationParam = params.duration;+ const revealDelayParam = params.revealDelay;+ const delayParam = params.delay;+ const onChange = params.onChange || noop;++ return (target, index, targets, prevTween) => {+ const rawChars = typeof charsParam === 'function' ? charsParam(target, index, targets) : (charsParam || 'a-zA-Z0-9!%#_');+ const characters = expandCharRanges(charSets[rawChars] || rawChars);+ const totalChars = characters.length - 1;+ const duration = typeof durationParam === 'function' ? durationParam(target, index, targets) : durationParam;+ const revealDelay = typeof revealDelayParam === 'function' ? revealDelayParam(target, index, targets) : (revealDelayParam || 0);+ const delay = typeof delayParam === 'function' ? delayParam(target, index, targets) : (delayParam || 0);+ const rng = seed ? createSeededRandom(seed) : createSeededRandom();+ if (!originalTexts.has(target)) originalTexts.set(target, target.textContent);+ const startingText = prevTween ? prevTween._value : target.textContent;+ const targetText = text !== undefined+ ? (typeof text === 'function' ? text(target, index, targets) : text)+ : prevTween ? prevTween._value+ : originalTexts.get(target);+ const settledText = targetText === ' ' || targetText === ' ' ? ' ' : targetText;+ const startLength = startingText === ' ' ? 0 : startingText.length;+ const endLength = settledText.length;+ const overrideChars = override === true ? characters+ : typeof override === 'string' && override.length > 0 ? expandCharRanges(charSets[/** @type {String} */(override)] || /** @type {String} */(override))+ : null;+ const totalOverrideChars = overrideChars ? overrideChars.length - 1 : 0;+ // Space override uses so the browser doesn't collapse consecutive spaces in innerHTML+ const overrideChar = override === ' ' ? ' ' : null;+ // When starting from blank, only animate the target text length to avoid padding beyond it+ const animLength = override === '' ? endLength : Math.max(startLength, endLength);+ // Compute total duration from interval spacing and settle time, or use the explicit duration+ const animDuration = duration > 0 ? duration : (animLength - 1) * interval + settleDuration;+ const computedDuration = round$1((animDuration + revealDelay) / globals.timeScale, 0) * globals.timeScale;+ const revealDelayRatio = revealDelay > 0 ? round$1(revealDelay / computedDuration, 12) : 0;+ // Auto-resolve reveal direction: shrinking text reveals from right, growing from left+ const resolvedFrom = fromParam === undefined || fromParam === 'auto' ? (endLength < startLength ? 'right' : 'left') : fromParam;+ const charOrder = new Int32Array(animLength);+ if (resolvedFrom === 'random') {+ for (let i = 0; i < animLength; i++) charOrder[i] = i;+ for (let i = animLength - 1; i > 0; i--) {+ const j = rng(0, i);+ const t = charOrder[i]; charOrder[i] = charOrder[j]; charOrder[j] = t;+ }+ } else {+ const ref = resolvedFrom === 'right' ? (override === '' || !startLength ? animLength : startLength) - 1+ : resolvedFrom === 'center' ? ((override === '' || !startLength ? animLength : startLength) - 1) / 2+ : typeof resolvedFrom === 'number' ? resolvedFrom+ : 0;+ const abs = Math.abs;+ const indices = new Array(animLength);+ for (let i = 0; i < animLength; i++) indices[i] = i;+ indices.sort((a, b) => abs(a - ref) - abs(b - ref));+ for (let i = 0; i < animLength; i++) charOrder[indices[i]] = i;+ }+ if (reversed) {+ const last = animLength - 1;+ for (let i = 0; i < animLength; i++) charOrder[i] = last - charOrder[i];+ }+ // settleRatio is the fraction of the animation each character spends in the active scrambling zone+ const settleRatio = round$1(settleDuration / animDuration, 12);+ // settleSpacing is the time gap between consecutive characters entering the active zone+ const settleSpacing = round$1((1 - settleRatio) / animLength, 12);+ const cursorZone = cursorLen * settleSpacing;+ // stepRatio controls how often scramble characters refresh (based on settleRate)+ const stepRatio = round$1(1000 * globals.timeScale / (settleRate * computedDuration), 12);+ // Pre-compute per-character start and settle times+ const charStarts = new Float32Array(animLength);+ const charEnds = new Float32Array(animLength);+ const scale = perturbation > 0 ? perturbation * settleRatio : 0;+ for (let c = 0; c < animLength; c++) {+ const so = scale > 0 ? (rng(0, 2000) - 1000) / 1000 * scale : 0;+ const eo = scale > 0 ? (rng(0, 2000) - 1000) / 1000 * scale : 0;+ charStarts[c] = charOrder[c] * settleSpacing + so;+ charEnds[c] = Math.ceil((charStarts[c] + settleRatio + eo) / stepRatio) * stepRatio;+ }+ // When text shrinks with non-sequential from modes, delay target settle times past all extras+ if (endLength < animLength && resolvedFrom !== 'left' && resolvedFrom !== 'right' && resolvedFrom !== 'random') {+ let maxExtraEnd = 0;+ for (let c = endLength; c < animLength; c++) {+ if (charEnds[c] > maxExtraEnd) maxExtraEnd = charEnds[c];+ }+ const targets = new Array(endLength);+ for (let c = 0; c < endLength; c++) targets[c] = c;+ targets.sort((a, b) => charOrder[a] - charOrder[b]);+ const targetSpacing = (1 - maxExtraEnd) / endLength;+ for (let i = 0; i < endLength; i++) {+ const revealTime = maxExtraEnd + i * targetSpacing;+ if (revealTime > charEnds[targets[i]]) {+ charEnds[targets[i]] = revealTime;+ }+ }+ }+ // charCache holds the current scramble character for each position, refreshed at settleRate+ const charCache = new Array(animLength);+ for (let c = 0; c < animLength; c++) {+ charCache[c] = characters[rng(0, totalChars)];+ }+ // overrideCache holds scramble characters for the starting text (override: true or custom string)+ const overrideCache = overrideChars ? (overrideChars === characters ? charCache : new Array(animLength)) : null;+ if (overrideCache && overrideCache !== charCache) {+ for (let c = 0; c < animLength; c++) {+ overrideCache[c] = overrideChar || /** @type {String} */(overrideChars)[rng(0, overrideChars.length - 1)];+ }+ }+ // Build the initial display text based on override mode+ let fillStartText = startingText;+ if (!prevTween) {+ if (override === '') {+ fillStartText = '';+ } else if (overrideChars) {+ fillStartText = '';+ for (let c = 0; c < startLength; c++) {+ fillStartText += startingText[c] === ' ' ? ' ' : /** @type {Array<String>} */(overrideCache)[c];+ }+ }+ }++ let lastValue = -1;+ let lastStep = -1;+ let scrambled = '';+ const hasOverride = override !== '';+ const hasOverrideChars = !!overrideChars;+ const hasCursor = cursorLen > 0;++ return {+ from: 0,+ to: 1,+ duration: computedDuration,+ delay: delay,+ ease: 'linear',+ modifier: (v) => {+ if (v === lastValue) return scrambled;+ lastValue = v;+ if (delay > 0 && v <= 0) { scrambled = startingText; return startingText; }+ if (v <= 0) { scrambled = fillStartText; return fillStartText; }+ if (v >= 1) { scrambled = settledText; return settledText; }+ scrambled = '';+ // Only refresh scramble characters when we cross a settleRate step boundary+ const currentStep = (v / stepRatio) | 0;+ const refreshChars = currentStep !== lastStep;+ if (refreshChars) lastStep = currentStep;+ // Subtract delay ratio to get the effective animation progress+ const linear = revealDelayRatio > 0 ? (v - revealDelayRatio) / (1 - revealDelayRatio) : v;+ const t = linear > 0 ? easeFn(linear) : 0;+ for (let c = 0; c < animLength; c++) {+ // Each character has its own start/end window based on its reveal order+ const charStart = charStarts[c];+ const charEnd = charEnds[c];+ // Settled zone: character has finished its transition+ if (t >= charEnd) {+ if (c < endLength) scrambled += settledText[c];+ continue;+ }+ // Pre-transition zone: reveal wave hasn't reached this character yet+ if (t <= 0 || t < charStart) {+ if (hasOverride && c < startLength) {+ if (hasOverrideChars) {+ if (startingText[c] === ' ') {+ scrambled += ' ';+ } else {+ if (refreshChars) /** @type {Array<String>} */(overrideCache)[c] = overrideChar || /** @type {String} */(overrideChars)[rng(0, totalOverrideChars)];+ scrambled += /** @type {Array<String>} */(overrideCache)[c];+ }+ } else {+ // Default (override: false): show the original starting text+ scrambled += startingText[c];+ }+ }+ continue;+ }+ // Active zone: character is between charStart and charEnd+ const isSpace = (c < endLength && settledText[c] === ' ') || (c < startLength && startingText[c] === ' ');+ if (isSpace) {+ scrambled += ' ';+ } else if (hasCursor && t - charStart < cursorZone) {+ // Cursor sub-zone: show cursor character based on position within cursor width+ scrambled += cursorChars[cursorLen - 1 - (((t - charStart) / settleSpacing) | 0)];+ } else {+ // Scramble zone: show cycling random characters+ if (refreshChars) charCache[c] = characters[rng(0, totalChars)];+ scrambled += charCache[c];+ }+ }+ if (refreshChars) onChange(scrambled, t);+ return scrambled;+ }+ }+ }+};+var index = /*#__PURE__*/Object.freeze({__proto__: null,TextSplitter: TextSplitter,+ scrambleText: scrambleText,split: split,splitText: splitText});-export { registerTargets as $, Animatable, AutoLayout, Draggable, JSAnimation, Scope, ScrollObserver, Spring, TextSplitter, Timeline, Timer, WAAPIAnimation, animate, clamp, cleanInlineStyles, createAnimatable, createDraggable, createDrawable, createLayout, createMotionPath, createScope, createSeededRandom, createSpring, createTimeline, createTimer, cubicBezier, damp, degToRad, eases, index$3 as easings, engine, get, irregular, keepTime, lerp, linear, mapRange, morphTo, onScroll, padEnd, padStart, radToDeg, random, randomPick, remove, round, roundPad, scrollContainers, set, shuffle, snap, split, splitText, spring, stagger, steps, index$1 as svg, sync, index as text, index$2 as utils, waapi, wrap };+export { registerTargets as $, Animatable, AutoLayout, Draggable, JSAnimation, Scope, ScrollObserver, Spring, TextSplitter, Timeline, Timer, WAAPIAnimation, addChild, animate, clamp, cleanInlineStyles, createAnimatable, createDraggable, createDrawable, createLayout, createMotionPath, createScope, createSeededRandom, createSpring, createTimeline, createTimer, cubicBezier, damp, degToRad, eases, index$3 as easings, engine, forEachChildren, get, globals, irregular, keepTime, lerp, linear, mapRange, morphTo, onScroll, padEnd, padStart, radToDeg, random, randomPick, remove, removeChild, round, roundPad, scrambleText, scrollContainers, set, shuffle, snap, split, splitText, spring, stagger, steps, index$1 as svg, sync, index as text, index$2 as utils, waapi, wrap };diff --git a/dist/bundles/anime.esm.min.js b/dist/bundles/anime.esm.min.jsindex 658865a5..6f9650e5 100644--- a/dist/bundles/anime.esm.min.js+++ b/dist/bundles/anime.esm.min.js@@ -1,7 +1,7 @@/*** Anime.js - ESM minified bundle- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/-const t="undefined"!=typeof window,e=t?window:null,s=t?document:null,i={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},r={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},n={NONE:0,AUTO:1,FORCE:2},o={replace:0,none:1,blend:2},a=Symbol(),l=Symbol(),h=Symbol(),d=Symbol(),c=Symbol(),u=Symbol(),p=1e-11,m=1e12,f=1e3,g=240,y="",_="var(",v=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),b=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","matrix","matrix3d","perspective"],T=b.reduce((t,e)=>({...t,[e]:e+"("}),{}),x=()=>{},S=/\)\s*[-.\d]/,w=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,E=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,$=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,C=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,N=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,k=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,R=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,D=/([a-z])([A-Z])/g,I=/(\w+)(\([^)]+\)+)/g,O=/(\*=|\+=|-=)/,A=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,L={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:g,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:f,delay:0,loopDelay:0,ease:"out(2)",composition:o.replace,modifier:t=>t,onBegin:x,onBeforeUpdate:x,onUpdate:x,onLoop:x,onPause:x,onComplete:x,onRender:x},B={current:null,root:s},P={defaults:L,precision:4,timeScale:1,tickThreshold:200},F=t&&e.AnimeJSDevTools,M={version:"4.3.6",engine:null};t&&(e.AnimeJS||(e.AnimeJS=[]),e.AnimeJS.push(M));const V=t=>t.replace(D,"$1-$2").toLowerCase(),z=(t,e)=>0===t.indexOf(e),X=Date.now,H=Array.isArray,U=t=>t&&t.constructor===Object,Y=t=>"number"==typeof t&&!isNaN(t),W=t=>"string"==typeof t,q=t=>"function"==typeof t,j=t=>void 0===t,G=t=>j(t)||null===t,Q=e=>t&&e instanceof SVGElement,J=t=>w.test(t),Z=t=>z(t,"rgb"),K=t=>z(t,"hsl"),tt=t=>J(t)||(Z(t)||K(t))&&(")"===t[t.length-1]||!S.test(t)),et=t=>!P.defaults.hasOwnProperty(t),st=["opacity","rotate","overflow","color"],it=(t,e)=>{if(st.includes(e))return!1;if(t.getAttribute(e)||e in t){if("scale"===e){const e=t.parentNode;return e&&"filter"===e.tagName}return!0}},rt=t=>W(t)?parseFloat(t):t,nt=Math.pow,ot=Math.sqrt,at=Math.sin,lt=Math.cos,ht=Math.abs,dt=Math.exp,ct=Math.ceil,ut=Math.floor,pt=Math.asin,mt=Math.max,ft=Math.atan2,gt=Math.PI,yt=Math.round,_t=(t,e,s)=>t<e?e:t>s?s:t,vt={},bt=(t,e)=>{if(e<0)return t;if(!e)return yt(t);let s=vt[e];return s||(s=vt[e]=10**e),yt(t*s)/s},Tt=(t,e)=>H(e)?e.reduce((e,s)=>ht(s-t)<ht(e-t)?s:e):e?yt(t/e)*e:t,xt=(t,e,s)=>t+(e-t)*s,St=t=>t===1/0?m:t===-1/0?-m:t,wt=t=>t<=p?p:St(bt(t,11)),Et=t=>H(t)?[...t]:t,$t=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=j(r)?e[i]:r}return s},Ct=(t,e,s,i="_prev",r="_next")=>{let n=t._head,o=r;for(s&&(n=t._tail,o=i);n;){const t=n[o];e(n),n=t}},Nt=(t,e,s="_prev",i="_next")=>{const r=e[s],n=e[i];r?r[i]=n:t._head=n,n?n[s]=r:t._tail=r,e[s]=null,e[i]=null},kt=(t,e,s,i="_prev",r="_next")=>{let n=t._tail;for(;n&&s&&s(n,e);)n=n[i];const o=n?n[r]:t._head;n?n[r]=e:t._head=e,o?o[i]=e:t._tail=e,e[i]=n,e[r]=o},Rt=(t,e,s)=>{const i=t.style.transform;let r;if(i){const n=t[d];let o;for(;o=I.exec(i);){const t=o[1],i=o[2].slice(1,-1);n[t]=i,t===e&&(r=i,s&&(s[e]=i))}}return i&&!j(r)?r:z(e,"scale")?"1":z(e,"rotate")||z(e,"skew")?"0deg":"0px"},Dt=t=>{const e=E.exec(t)||$.exec(t),s=j(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]},It=t=>{const e=t.length,s=4===e||5===e;return[+("0x"+t[1]+t[s?1:2]),+("0x"+t[s?2:3]+t[s?2:4]),+("0x"+t[s?3:5]+t[s?3:6]),5===e||9===e?+(+("0x"+t[s?4:7]+t[s?4:8])/255).toFixed(3):1]},Ot=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t),At=t=>{const e=C.exec(t)||N.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=j(e[4])?1:+e[4];let o,a,l;if(0===i)o=a=l=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=bt(255*Ot(e,t,s+1/3),0),a=bt(255*Ot(e,t,s),0),l=bt(255*Ot(e,t,s-1/3),0)}return[o,a,l,n]},Lt=t=>Z(t)?Dt(t):J(t)?It(t):K(t)?At(t):[0,0,0,1],Bt=(t,e)=>j(t)?e:t,Pt=(t,e,s,i,r)=>{let n;if(q(t))n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};else{if(!W(t)||!z(t,_))return t;n=()=>{const s=t.match(A),i=s[1],r=s[2];let n=getComputedStyle(e)?.getPropertyValue(i);return n&&n.trim()!==y||!r||(n=r.trim()),n||0}}return r&&(r.func=n),n()},Ft=(t,e)=>t[l]?t[h]&&it(t,e)?i.ATTRIBUTE:b.includes(e)||v.get(e)?i.TRANSFORM:z(e,"--")?i.CSS_VAR:e in t.style?i.CSS:e in t?i.OBJECT:i.ATTRIBUTE:i.OBJECT,Mt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[u]||t).getPropertyValue(e);return"auto"===r?"0":r},Vt=(t,e,s,r)=>{const n=j(s)?Ft(t,e):s;return n===i.OBJECT?t[e]||0:n===i.ATTRIBUTE?t.getAttribute(e):n===i.TRANSFORM?Rt(t,e,r):n===i.CSS_VAR?Mt(t,e,r).trimStart():Mt(t,e,r)},zt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Xt=()=>({t:r.NUMBER,n:0,u:null,o:null,d:null,s:null}),Ht=(t,e)=>{if(e.t=r.NUMBER,e.n=0,e.u=null,e.o=null,e.d=null,e.s=null,!t)return e;const s=+t;if(isNaN(s)){let s=t;"="===s[1]&&(e.o=s[0],s=s.slice(2));const i=!s.includes(" ")&&R.exec(s);if(i)return e.t=r.UNIT,e.n=+i[1],e.u=i[2],e;if(e.o)return e.n=+s,e;if(tt(s))return e.t=r.COLOR,e.d=Lt(s),e;{const t=s.match(k);return e.t=r.COMPLEX,e.d=t?t.map(Number):[],e.s=s.split(k)||[],e}}return e.n=s,e},Ut=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=Et(t._toNumbers),e.s=Et(t._strings),e),Yt=Xt(),Wt=(t,e,s,a,l)=>{const h=t.parent,c=t.duration,u=t.completed,m=t.iterationDuration,f=t.iterationCount,g=t._currentIteration,_=t._loopDelay,v=t._reversed,b=t._alternate,x=t._hasChildren,S=t._delay,w=t._currentTime,E=S+m,$=e-S,C=_t(w,-S,c),N=_t($,-S,c),k=$-w,R=N>0,D=N>=c,I=c<=p,O=l===n.FORCE;let A=0,L=$,B=0;if(f>1){const e=~~(N/(m+(D?0:_)));t._currentIteration=_t(e,0,f),D&&t._currentIteration--,A=t._currentIteration%2,L=N%(m+_)||0}const F=v^(b&&A),M=t._ease;let V=D?F?0:c:F?m-L:L;M&&(V=m*M(V/m)||0);const z=(h?h.backwards:$<w)?!F:!!F;if(t._currentTime=$,t._iterationTime=V,t.backwards=z,R&&!t.began?(t.began=!0,s||h&&(z||!h.began)||t.onBegin(t)):$<=0&&(t.began=!1),s||x||!R||t._currentIteration===g||t.onLoop(t),O||l===n.AUTO&&(e>=S&&e<=E||e<=S&&C>S||e>=E&&C!==c)||V>=E&&C!==c||V<=S&&C>0||e<=C&&C===c&&u||D&&!u&&I){if(R&&(t.computeDeltaTime(C),s||t.onBeforeUpdate(t)),!x){const e=O||(z?-1*k:k)>=P.tickThreshold,n=t._offset+(h?h._offset:0)+S+V;let l,c,u,p,m=t._head,f=0;for(;m;){const t=m._composition,s=m._currentTime,h=m._changeDuration,g=m._absoluteStartTime+m._changeDuration,_=m._nextRep,v=m._prevRep,b=t!==o.none;if((e||(s!==h||n<=g+(_?_._delay:0))&&(0!==s||n>=m._absoluteStartTime))&&(!b||!m._isOverridden&&(!m._isOverlapped||n<=g)&&(!_||_._isOverridden||n<=_._absoluteStartTime)&&(!v||v._isOverridden||n>=v._absoluteStartTime+v._changeDuration+m._delay))){const e=m._currentTime=_t(V-m._startTime,0,h),s=m._ease(e/m._updateDuration),n=m._modifier,g=m._valueType,y=m._tweenType,_=y===i.OBJECT,v=g===r.NUMBER,T=v&&_||0===s||1===s?-1:P.precision;let x,S;if(v)x=S=n(bt(xt(m._fromNumber,m._toNumber,s),T));else if(g===r.UNIT)S=n(bt(xt(m._fromNumber,m._toNumber,s),T)),x=`${S}${m._unit}`;else if(g===r.COLOR){const t=m._fromNumbers,e=m._toNumbers,i=bt(_t(n(xt(t[0],e[0],s)),0,255),0),r=bt(_t(n(xt(t[1],e[1],s)),0,255),0),o=bt(_t(n(xt(t[2],e[2],s)),0,255),0),a=_t(n(bt(xt(t[3],e[3],s),T)),0,1);if(x=`rgba(${i},${r},${o},${a})`,b){const t=m._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=a}}else if(g===r.COMPLEX){x=m._strings[0];for(let t=0,e=m._toNumbers.length;t<e;t++){const e=n(bt(xt(m._fromNumbers[t],m._toNumbers[t],s),T)),i=m._strings[t+1];x+=`${i?e+i:e}`,b&&(m._numbers[t]=e)}}if(b&&(m._number=S),a||t===o.blend)m._value=x;else{const t=m.property;l=m.target,_?l[t]=x:y===i.ATTRIBUTE?l.setAttribute(t,x):(c=l.style,y===i.TRANSFORM?(l!==u&&(u=l,p=l[d]),p[t]=x,f=1):y===i.CSS?c[t]=x:y===i.CSS_VAR&&c.setProperty(t,x)),R&&(B=1)}}if(f&&m._renderTransforms){let t=y;for(let e in p)t+=`${T[e]}${p[e]}) `;c.transform=t,f=0}m=m._next}!s&&B&&t.onRender(t)}!s&&R&&t.onUpdate(t)}return h&&I?!s&&(h.began&&!z&&$>0&&!u||z&&$<=p&&u)&&(t.onComplete(t),t.completed=!z):R&&D?f===1/0?t._startTime+=t.duration:t._currentIteration>=f-1&&(t.paused=!0,u||x||(t.completed=!0,s||h&&(z||!h.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,B},qt=(t,e,s,i,r)=>{const o=t._currentIteration;if(Wt(t,e,s,i,r),t._hasChildren){const a=t,l=a.backwards,h=i?e:a._iterationTime,d=X();let c=0,u=!0;if(!i&&a._currentIteration!==o){const t=a.iterationDuration;Ct(a,e=>{if(l){const i=e.duration,r=e._offset+e._delay;s||!(i<=p)||r&&r+i!==t||e.onComplete(e)}else!e.completed&&!e.backwards&&e._currentTime<e.iterationDuration&&Wt(e,t,s,1,n.FORCE),e.began=!1,e.completed=!1}),s||a.onLoop(a)}Ct(a,t=>{const e=bt((h-t._offset)*t._speed,12),n=t._fps<a._fps?t.requestTick(d):r;c+=Wt(t,e,s,i,n),!t.completed&&u&&(u=!1)},l),!s&&c&&a.onRender(a),(u||l)&&a._currentTime>=a.duration&&(a.paused=!0,a.completed||(a.completed=!0,s||(a.onComplete(a),a._resolve(a))))}},jt={},Gt=(t,e,s)=>{if(s===i.TRANSFORM)return v.get(t)||t;if(s===i.CSS||s===i.ATTRIBUTE&&Q(e)&&t in e.style){const e=jt[t];if(e)return e;{const e=t?V(t):t;return jt[t]=e,e}}return t},Qt=t=>{if(t._hasChildren)Ct(t,Qt,!0);else{const e=t;e.pause(),Ct(e,t=>{const s=t.property,r=t.target;if(r[l]){const n=r.style,o=t._inlineValue,a=G(o)||o===y;if(t._tweenType===i.TRANSFORM){const e=r[d];if(a?delete e[s]:e[s]=o,t._renderTransforms)if(Object.keys(e).length){let t=y;for(let s in e)t+=T[s]+e[s]+") ";n.transform=t}else n.removeProperty("transform")}else a?n.removeProperty(V(s)):n[s]=o;e._tail===t&&e.targets.forEach(t=>{t.getAttribute&&t.getAttribute("style")===y&&t.removeAttribute("style")})}})}return t};class Jt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._lastTickTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=f/g,this._fps=g,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(t){const e=this._frameDuration,s=+t,i=s<p?p:s,r=f/i;i>L.frameRate&&(L.frameRate=i),this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<p?p:e}requestTick(t){const e=this._scheduledTime;if(this._lastTickTime=t,t<e)return n.NONE;const s=this._frameDuration,i=t-e;return this._scheduledTime+=i<s?s:i,n.AUTO}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const Zt={animation:null,update:x},Kt=t=>{let e=Zt.animation;return e||(e={duration:p,computeDeltaTime:x,_offset:0,_delay:0,_head:null,_tail:null},Zt.animation=e,Zt.update=()=>{t.forEach(t=>{for(let e in t){const s=t[e],i=s._head;if(i){const t=i._valueType,e=t===r.COMPLEX||t===r.COLOR?Et(i._fromNumbers):null;let n=i._fromNumber,o=s._tail;for(;o&&o!==i;){if(e)for(let t=0,s=o._numbers.length;t<s;t++)e[t]+=o._numbers[t];else n+=o._number;o=o._prevAdd}i._toNumber=n,i._toNumbers=e}}}),Wt(e,1,1,0,n.FORCE)}),e},te=(()=>t?requestAnimationFrame:setImmediate)(),ee=(()=>t?cancelAnimationFrame:clearImmediate)();class se extends Jt{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=L,this.paused=!0,this.reqId=0}update(){const t=this._currentTime=X();if(this.requestTick(t)){this.computeDeltaTime(t);const e=this._speed,s=this._fps;let i=this._head;for(;i;){const r=i._next;i.paused?(Nt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):qt(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):n.AUTO),i=r}Zt.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(X()),this.reqId=te(re)),this}pause(){if(this.reqId)return this.paused=!0,ne()}resume(){if(this.paused)return this.paused=!1,Ct(this,t=>t.resetTime()),this.wake()}get speed(){return this._speed*(1===P.timeScale?1:f)}set speed(t){this._speed=t*P.timeScale,Ct(this,t=>t.speed=t._speed)}get timeUnit(){return 1===P.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(P.timeScale!==s){P.timeScale=s,P.tickThreshold=200*s;const t=e?.001:f;this.defaults.duration*=t,this._speed*=t}}get precision(){return P.precision}set precision(t){P.precision=t}}const ie=(()=>{const e=new se(X());return t&&(M.engine=e,s.addEventListener("visibilitychange",()=>{e.pauseOnDocumentHidden&&(s.hidden?e.pause():e.resume())})),e})(),re=()=>{ie._head?(ie.reqId=te(re),ie.update()):ie.reqId=0},ne=()=>(ee(ie.reqId),ie.reqId=0,ie),oe={_rep:new WeakMap,_add:new Map},ae=(t,e,s="_rep")=>{const i=oe[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},le=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,he=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=p,t._currentTime=p},de=(t,e)=>{const s=t._composition;if(s===o.replace){const s=t._absoluteStartTime;kt(e,t,le,"_prevRep","_nextRep");const i=t._prevRep;if(i){const e=i.parent,r=i._absoluteStartTime+i._changeDuration;if(t.parent.id!==e.id&&e.iterationCount>1&&r+(e.duration-e.iterationDuration)>s){he(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)he(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration),s=bt(n-e-t,12);i._changeDuration=s,i._currentTime=s,i._isOverlapped=1,s<p&&he(i)}let o=!0;if(Ct(e,t=>{t._isOverlapped||(o=!1)}),o){const t=e.parent;if(t){let s=!0;Ct(t,t=>{t!==e&&Ct(t,t=>{t._isOverlapped||(s=!1)})}),s&&t.cancel()}else e.cancel()}}}else if(s===o.blend){const e=ae(t.target,t.property,"_add"),s=Kt(oe._add);let i=e._head;i||(i={...t},i._composition=o.replace,i._updateDuration=p,i._startTime=0,i._numbers=Et(t._fromNumbers),i._number=0,i._next=null,i._prev=null,kt(e,i),kt(s,i));const r=t._toNumber;if(t._fromNumber=i._fromNumber-r,t._toNumber=0,t._numbers=Et(t._fromNumbers),t._number=0,i._fromNumber=r,t._toNumbers){const e=Et(t._toNumbers);e&&e.forEach((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0}),i._fromNumbers=e}kt(e,t,null,"_prevAdd","_nextAdd")}return t},ce=t=>{const e=t._composition;if(e!==o.none){const s=t.target,i=t.property,r=oe._rep.get(s)[i];if(Nt(r,t,"_prevRep","_nextRep"),e===o.blend){const e=oe._add,r=e.get(s);if(!r)return;const n=r[i],o=Zt.animation;Nt(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){Nt(n,a,"_prevAdd","_nextAdd"),Nt(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},ue=(t,e,s)=>{let r=!1;return Ct(e,n=>{const o=n.target;if(t.includes(o)){const t=n.property,a=n._tweenType,l=Gt(s,o,a);(!l||l&&l===t)&&(n.parent._tail===n&&n._tweenType===i.TRANSFORM&&n._prev&&n._prev._tweenType===i.TRANSFORM&&(n._prev._renderTransforms=1),Nt(e,n),ce(n),r=!0)}},!0),r},pe=(t,e,s)=>{const i=e||ie;let r;if(i._hasChildren){let e=0;Ct(i,n=>{if(!n._hasChildren)if(r=ue(t,n,s),r&&!n._head)n.cancel(),Nt(i,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?pe(t,n,s):n._hasChildren=!1},!0),j(i.iterationDuration)||(i.iterationDuration=e)}else r=ue(t,i,s);r&&!i._head&&(i._hasChildren=!1,i.cancel&&i.cancel())},me=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),fe=t=>t._cancelled?(t._hasChildren?Ct(t,fe):Ct(t,t=>{t._composition!==o.none&&de(t,ae(t.target,t.property))}),t._cancelled=0,t):t;let ge=0;class ye extends Jt{constructor(t={},e=null,s=0){super(0),++ge;const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:l,loopDelay:h,autoplay:d,frameRate:c,playbackRate:u,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:_,onUpdate:v}=t;B.current&&B.current.register(this);const b=e?0:ie._lastTickTime,T=e?e.defaults:P.defaults,S=q(r)||j(r)?T.delay:+r,w=q(n)||j(n)?1/0:+n,E=Bt(l,T.loop),$=Bt(h,T.loopDelay);let C=!0===E||E===1/0||E<0?1/0:E+1;if(F){const s=C===1/0;if(F.register(this,t,s)&&s){const t=a?2:1,s=e?F.maxNestedInfiniteLoops:F.maxInfiniteLoops;C=Math.max(s,t)}}let N=0;e?N=s:(ie.reqId||ie.requestTick(X()),N=(ie._lastTickTime-ie._startTime)*P.timeScale),this.id=j(i)?ge:i,this.parent=e,this.duration=St((w+$)*C-$)||p,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||T.onBegin,this.onBeforeUpdate=_||T.onBeforeUpdate,this.onUpdate=v||T.onUpdate,this.onLoop=f||T.onLoop,this.onPause=g||T.onPause,this.onComplete=m||T.onComplete,this.iterationDuration=w,this.iterationCount=C,this._autoplay=!e&&Bt(d,T.autoplay),this._offset=N,this._delay=S,this._loopDelay=$,this._iterationTime=0,this._currentIteration=0,this._resolve=x,this._running=!1,this._reversed=+Bt(o,T.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Bt(a,T.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=Bt(c,T.frameRate),this._speed=Bt(u,T.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(!0).play()}get currentTime(){return _t(bt(this._currentTime,P.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return _t(bt(this._iterationTime,P.precision),0,this.iterationDuration)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return _t(bt(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return _t(bt(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(t){const e=this.iterationDuration;this.currentTime=e*this._currentIteration+e*t}get currentIteration(){return this._currentIteration}set currentIteration(t){this.currentTime=this.iterationDuration*_t(+t,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(t){t?this.reverse():this.play()}get speed(){return super.speed}set speed(t){super.speed=t,this.resetTime()}reset(t=!1){return fe(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,qt(this,0,1,~~t,n.FORCE),me(this),this._hasChildren&&Ct(this,me),this}init(t=!1){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&qt(this,this.duration,1,~~t,n.FORCE),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!j(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*ie._speed);return this._startTime=X()-(this._currentTime+this._delay)*t,this}pause(){return this.paused||(this.paused=!0,this.onPause(this)),this}resume(){return this.paused?(this.paused=!1,this.duration<=p&&!this._hasChildren?qt(this,p,0,0,n.FORCE):(this._running||(kt(ie,this),ie._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,ie.wake()),this):this}restart(){return this.reset().resume()}seek(t,e=0,s=0){fe(this),this.completed=!1;const i=this.paused;return this.paused=!0,qt(this,t+this._delay,~~e,~~s,n.AUTO),i?this:this.resume()}alternate(){const t=this._reversed,e=this.iterationCount,s=this.iterationDuration,i=e===1/0?ut(m/s):e;return this._reversed=+(!this._alternate||i%2?!t:t),e===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(s*i-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?Ct(this,t=>t.cancel(),!0):Ct(this,ce),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=wt(t);if(e===s)return this;const i=t/e,r=t<=p;return this.duration=r?p:s,this.iterationDuration=r?p:wt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){qt(this,0,1,0,n.AUTO);const t=this._autoplay;return t&&t.linked&&t.linked===this&&t.revert(),this.cancel()}complete(t=0){return this.seek(this.duration,t).cancel()}then(t=x){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=x};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const _e=t=>new ye(t,null,0).init();function ve(t){const e=W(t)?B.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function be(e){if(G(e))return[];if(!t)return H(e)&&e.flat(1/0)||[e];if(H(e)){const t=e.flat(1/0),s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!G(i)){const t=ve(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!G(i)){let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}else{let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}}return s}const s=ve(e);return s?Array.from(s):[e]}function Te(t){const e=be(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[a]){s[a]=!0;const t=Q(s);(s.nodeType||t)&&(s[l]=!0,s[h]=t,s[d]={})}}return e}const xe={deg:1,rad:180/gt,turn:360},Se={},we=(t,e,i,n=!1)=>{const o=e.u,a=e.n;if(e.t===r.UNIT&&o===i)return e;const l=a+o+i,h=Se[l];if(j(h)||n){let r;if(o in xe)r=a*xe[o]/xe[i];else{const e=100,n=t.cloneNode(),l=t.parentNode,h=l&&l!==s?l:s.body;h.appendChild(n);const d=n.style;d.width=e+o;const c=n.offsetWidth||e;d.width=e+i;const u=c/(n.offsetWidth||e);h.removeChild(n),r=u*a}e.n=r,Se[l]=r}else e.n=h;return e.t,e.u=i,e},Ee=t=>t,$e=(t=1.68)=>e=>nt(e,+t),Ce={in:t=>e=>t(e),out:t=>e=>1-t(1-e),inOut:t=>e=>e<.5?t(2*e)/2:1-t(-2*e+2)/2,outIn:t=>e=>e<.5?(1-t(1-2*e))/2:(t(2*e-1)+1)/2},Ne=gt/2,ke=2*gt,Re={[y]:$e,Quad:$e(2),Cubic:$e(3),Quart:$e(4),Quint:$e(5),Sine:t=>1-lt(t*Ne),Circ:t=>1-ot(1-t*t),Expo:t=>t?nt(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=nt(2,--s))-1)/11;);return 1/nt(4,3-s)-7.5625*nt((3*e-2)/22-t,2)},Back:(t=1.7)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=_t(+t,1,10),i=_t(+e,p,2),r=i/ke*pt(1/s),n=ke/i;return t=>0===t||1===t?t:-s*nt(2,-10*(1-t))*at((1-t-r)*n)}},De=(()=>{const t={linear:Ee,none:Ee};for(let e in Ce)for(let s in Re){const i=Re[s],r=Ce[e];t[e+s]=s===y||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),Ie={linear:Ee,none:Ee},Oe=t=>{if(Ie[t])return Ie[t];if(t.indexOf("(")<=-1){const e=Ce[t]||t.includes("Back")||t.includes("Elastic")?De[t]():De[t];return e?Ie[t]=e:Ee}{const e=t.slice(0,-1).split("("),s=De[e[0]];return s?Ie[t]=s(...e[1].split(",")):Ee}},Ae=["steps(","irregular(","linear(","cubicBezier("],Le=t=>{if(W(t))for(let e=0,s=Ae.length;e<s;e++)if(z(t,Ae[e]))return console.warn(`String syntax for \`ease: "${t}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${t}\``),Ee;return q(t)?t:W(t)?Oe(t):Ee},Be=Xt(),Pe=Xt(),Fe={},Me={func:null},Ve={func:null},ze=[null],Xe=[null,null],He={to:null};let Ue,Ye,We=0,qe=0;const je=(t,e)=>{const s={};if(H(t)){const e=[].concat(...t.map(t=>Object.keys(t))).filter(et);for(let i=0,r=e.length;i<r;i++){const r=e[i],n=t.map(t=>{const e={};for(let s in t){const i=t[s];et(s)?s===r&&(e.to=i):e[s]=i}return e});s[r]=n}}else{const i=Bt(e.duration,P.defaults.duration),r=Object.keys(t).map(e=>({o:parseFloat(e)/100,p:t[e]})).sort((t,e)=>t.o-e.o);r.forEach(t=>{const e=t.o,r=t.p;for(let t in r)if(et(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let a=n.length,l=n[a-1];const h={to:r[t]};let d=0;for(let t=0;t<a;t++)d+=n[t].duration;1===a&&(h.from=l.to),r.ease&&(h.ease=r.ease),h.duration=o-(a?d:0),n.push(h)}return t});for(let t in s){const e=s[t];let i;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.ease;s.ease=i||void 0,i=r}e[0].duration||e.shift()}}return s};class Ge extends ye{constructor(t,e,s,n,a=!1,l=0,h=0){super(e,s,n),++qe;const d=Te(t),c=d.length,u=e.keyframes,m=u?$t(je(u,e),e):e,{id:g,delay:y,duration:_,ease:v,playbackEase:b,modifier:T,composition:x,onRender:S}=m,w=s?s.defaults:P.defaults,E=Bt(v,w.ease),$=Bt(b,w.playbackEase),C=$?Le($):null,N=!j(E.ease),k=N?E.ease:Bt(v,C?"linear":w.ease),R=N?E.settlingDuration:Bt(_,w.duration),D=Bt(y,w.delay),I=T||w.modifier,O=j(x)&&c>=f?o.none:j(x)?w.composition:x,A=this._offset+(s?s._offset:0);N&&(E.parent=this);let L=NaN,B=NaN,F=0,M=0;for(let t=0;t<c;t++){const e=d[t],n=l||t,u=h||c;let f=NaN,g=NaN;for(let t in m)if(et(t)){const l=Ft(e,t),h=Gt(t,e,l);let d=m[t];const c=H(d);if(a&&!c&&(Xe[0]=d,Xe[1]=d,d=Xe),c){const t=d.length,e=!U(d[0]);2===t&&e?(He.to=d,ze[0]=He,Ue=ze):t>2&&e?(Ue=[],d.forEach((t,e)=>{e?1===e?(Xe[1]=t,Ue.push(Xe)):Ue.push(t):Xe[0]=t})):Ue=d}else ze[0]=d,Ue=ze;let y=null,_=null,v=NaN,b=0,T=0;for(let t=Ue.length;T<t;T++){const i=Ue[T];U(i)?Ye=i:(He.to=i,Ye=He),Me.func=null,Ve.func=null;const a=Pt(Ye.to,e,n,u,Me);let d;U(a)&&!j(a.to)?(Ye=a,d=a.to):d=a;const c=Pt(Ye.from,e,n,u),m=Ye.ease||k,f=Pt(m,e,n,u),g=q(f)||W(f)?f:m,x=!j(g)&&!j(g.ease),S=x?g.ease:g,w=x?g.settlingDuration:Pt(Bt(Ye.duration,t>1?Pt(R,e,n,u)/t:R),e,n,u),E=Pt(Bt(Ye.delay,T?0:D),e,n,u),$=Pt(Bt(Ye.composition,O),e,n,u),C=Y($)?$:o[$],N=Ye.modifier||I,L=!j(c),B=!j(d),P=H(d),V=P||L&&B,z=_?b+E:E,X=bt(A+z,12);M||!L&&!P||(M=1);let Q=_;if(C!==o.none){y||(y=ae(e,h));let t=y._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=X;)if(Q=t,t=t._nextRep,t&&t._absoluteStartTime>=X)for(;t;)he(t),t=t._nextRep}if(V){Ht(P?Pt(d[0],e,n,u,Ve):c,Be),Ht(P?Pt(d[1],e,n,u,Me):d,Pe);const t=Vt(e,h,l,Fe);Be.t===r.NUMBER&&(Q?Q._valueType===r.UNIT&&(Be.t=r.UNIT,Be.u=Q._unit):(Ht(t,Yt),Yt.t===r.UNIT&&(Be.t=r.UNIT,Be.u=Yt.u)))}else B?Ht(d,Pe):_?Ut(_,Pe):Ht(s&&Q&&Q.parent.parent===s?Q._value:Vt(e,h,l,Fe),Pe),L?Ht(c,Be):_?Ut(_,Be):Ht(s&&Q&&Q.parent.parent===s?Q._value:Vt(e,h,l,Fe),Be);if(Be.o&&(Be.n=zt(Q?Q._toNumber:Ht(Vt(e,h,l,Fe),Yt).n,Be.n,Be.o)),Pe.o&&(Pe.n=zt(Be.n,Pe.n,Pe.o)),Be.t!==Pe.t)if(Be.t===r.COMPLEX||Pe.t===r.COMPLEX){const t=Be.t===r.COMPLEX?Be:Pe,e=Be.t===r.COMPLEX?Pe:Be;e.t=r.COMPLEX,e.s=Et(t.s),e.d=t.d.map(()=>e.n)}else if(Be.t===r.UNIT||Pe.t===r.UNIT){const t=Be.t===r.UNIT?Be:Pe,e=Be.t===r.UNIT?Pe:Be;e.t=r.UNIT,e.u=t.u}else if(Be.t===r.COLOR||Pe.t===r.COLOR){const t=Be.t===r.COLOR?Be:Pe,e=Be.t===r.COLOR?Pe:Be;e.t=r.COLOR,e.s=t.s,e.d=[0,0,0,1]}if(Be.u!==Pe.u){let t=Pe.u?Be:Pe;t=we(e,t,Pe.u?Pe.u:Be.u,!1)}if(Pe.d&&Be.d&&Pe.d.length!==Be.d.length){const t=Be.d.length>Pe.d.length?Be:Pe,e=t===Be?Pe:Be;e.d=t.d.map((t,s)=>j(e.d[s])?0:e.d[s]),e.s=Et(t.s)}const J=bt(+w||p,12);let Z=Fe[h];G(Z)||(Fe[h]=null);const K={parent:this,id:We++,property:h,target:e,_value:null,_toFunc:Me.func,_fromFunc:Ve.func,_ease:Le(S),_fromNumbers:Et(Be.d),_toNumbers:Et(Pe.d),_strings:Et(Pe.s),_fromNumber:Be.n,_toNumber:Pe.n,_numbers:Et(Be.d),_number:Be.n,_unit:Pe.u,_modifier:N,_currentTime:0,_startTime:z,_delay:+E,_updateDuration:J,_changeDuration:J,_absoluteStartTime:X,_tweenType:l,_valueType:Pe.t,_composition:C,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:Z,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};C!==o.none&&de(K,y),isNaN(v)&&(v=K._startTime),b=bt(z+J,12),_=K,F++,kt(this,K)}(isNaN(B)||v<B)&&(B=v),(isNaN(L)||b>L)&&(L=b),l===i.TRANSFORM&&(f=F-T,g=F)}if(!isNaN(f)){let t=0;Ct(this,e=>{t>=f&&t<g&&(e._renderTransforms=1,e._composition===o.blend&&Ct(Zt.animation,t=>{t.id===e.id&&(t._renderTransforms=1)})),t++})}}c||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),B?(Ct(this,t=>{t._startTime-t._delay||(t._delay-=B),t._startTime-=B}),L-=B):B=0,L||(L=p,this.iterationCount=0),this.targets=d,this.id=j(g)?qe:g,this.duration=L===p?p:St((L+this._loopDelay)*this.iterationCount-this._loopDelay)||p,this.onRender=S||w.onRender,this._ease=C,this._delay=B,this.iterationDuration=L,!this._autoplay&&M&&this.onRender(this)}stretch(t){const e=this.duration;if(e===wt(t))return this;const s=t/e;return Ct(this,t=>{t._updateDuration=wt(t._updateDuration*s),t._changeDuration=wt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s}),super.stretch(t)}refresh(){return Ct(this,t=>{const e=t._toFunc,s=t._fromFunc;(e||s)&&(s?(Ht(s(),Be),Be.u!==t._unit&&t.target[l]&&we(t.target,Be,t._unit,!0),t._fromNumbers=Et(Be.d),t._fromNumber=Be.n):e&&(Ht(Vt(t.target,t.property,t._tweenType),Yt),t._fromNumbers=Et(Yt.d),t._fromNumber=Yt.n),e&&(Ht(e(),Pe),t._toNumbers=Et(Pe.d),t._strings=Et(Pe.s),t._toNumber=Pe.o?zt(t._fromNumber,Pe.n,Pe.o):Pe.n))}),this.duration===p&&this.restart(),this}revert(){return super.revert(),Qt(this)}then(t){return super.then(t)}}const Qe=(t,e)=>new Ge(t,e,null,0,!1).init(),Je={_head:null,_tail:null},Ze=(t,e,s)=>{let i,r=Je._head;for(;r;){const n=r._next,o=r.$el===t,a=!e||r.property===e,l=!s||r.parent===s;if(o&&a&&l){i=r.animation;try{i.commitStyles()}catch{}i.cancel(),Nt(Je,r);const t=r.parent;t&&(t._completed++,t.animations.length===t._completed&&(t.completed=!0,t.paused=!0,t.muteCallbacks||(t.onComplete(t),t._resolve(t))))}r=n}return i},Ke=(t,e,s,i,r)=>{const n=e.animate(i,r),o=r.delay+ +r.duration*r.iterations;n.playbackRate=t._speed,t.paused&&n.pause(),t.duration<o&&(t.duration=o,t.controlAnimation=n),t.animations.push(n),Ze(e,s),kt(Je,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>Ze(e,s,t);return n.oncancel=a,n.onremove=a,t.persist||(n.onfinish=a),n};function ts(t,e,s){const i=Te(t);if(!i.length)return;const[n]=i,o=Ft(n,e),a=Gt(e,n,o);let l=Vt(n,a);if(j(s))return l;if(Ht(l,Yt),Yt.t===r.NUMBER||Yt.t===r.UNIT){if(!1===s)return Yt.n;{const t=we(n,Yt,s,!1);return`${bt(t.n,P.precision)}${t.u}`}}}const es=(t,e)=>{if(!j(e))return e.duration=p,e.composition=Bt(e.composition,o.none),new Ge(t,e,null,0,!0).resume()},ss=(t,e,s)=>{const i=be(t);for(let t=0,r=i.length;t<r;t++)Ze(i[t],s,e&&e.controlAnimation&&e);return pe(i,e,s),i},is=(t,e)=>{if(z(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}},rs=(t,e)=>{let s=t.iterationDuration;if(s===p&&(s=0),j(e))return s;if(Y(+e))return+e;const i=e,r=t?t.labels:null,n=!G(r),o=is(t,i),a=!j(o),l=O.exec(i);if(l){const t=l[0],e=i.split(t),h=n&&e[0]?r[e[0]]:s,d=a?o:n?h:s,c=+e[1];return zt(d,c,t[0])}return a?o:n?j(r[i])?s:r[i]:s};function ns(t){return St((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||p}function os(t,e,s,i,r,o){const a=Y(t.duration)&&t.duration<=p?s-p:s;e.composition&&qt(e,a,1,1,n.AUTO);const l=i?new Ge(i,t,e,a,!1,r,o):new ye(t,e,a);return e.composition&&l.init(!0),kt(e,l),Ct(e,t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)}),e.duration=ns(e),e}let as=0;class ls extends ye{constructor(t={}){super(t,null,0),++as,this.id=j(t.id)?as:t.id,this.duration=0,this.labels={};const e=t.defaults,s=P.defaults;this.defaults=e?$t(e,s):s,this.composition=Bt(t.composition,!0),this.onRender=t.onRender||s.onRender;const i=Bt(t.playbackEase,s.playbackEase);this._ease=i?Le(i):null,this.iterationDuration=0}add(t,e,s){const i=U(e),r=U(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(q(s)){const e=s,r=be(t),n=this.duration,o=this.iterationDuration,a=i.id;let l=0;const h=r.length;r.forEach(t=>{const s={...i};this.duration=n,this.iterationDuration=o,j(a)||(s.id=a+"-"+l),os(s,this,rs(this,e(t,l,h,this)),t,l,h),l++})}else os(i,this,rs(this,s),t)}else os(t,this,rs(this,e));return this.composition&&this.init(!0),this}}sync(t,e){if(j(t)||t&&j(t.pause))return this;t.pause();const s=+(t.effect?t.effect.getTiming().duration:t.duration);return j(t)||j(t.persist)||(t.persist=!0),this.add(t,{currentTime:[0,s],duration:s,delay:0,ease:"linear",playbackEase:"linear"},e)}set(t,e,s){return j(e)?this:(e.duration=p,e.composition=o.replace,this.add(t,e,s))}call(t,e){return j(t)||t&&!q(t)?this:this.add({duration:0,delay:0,onComplete:()=>t(this)},e)}label(t,e){return j(t)||t&&!W(t)||(this.labels[t]=rs(this,e)),this}remove(t,e){return pe(be(t),this,e),this}stretch(t){const e=this.duration;if(e===wt(t))return this;const s=t/e,i=this.labels;Ct(this,t=>t.stretch(t.duration*s));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return Ct(this,t=>{t.refresh&&t.refresh()}),this}revert(){return super.revert(),Ct(this,t=>t.revert,!0),Qt(this)}then(t){return super.then(t)}}const hs=t=>new ls(t).init();class ds{constructor(t,e){B.current&&B.current.register(this);const s=()=>{if(this.callbacks.completed)return;let t=!0;for(let e in this.animations)if(!this.animations[e].paused&&t){t=!1;break}t&&this.callbacks.complete()},i={onBegin:()=>{this.callbacks.completed&&this.callbacks.reset(),this.callbacks.play()},onComplete:s,onPause:s},r={v:1,autoplay:!1},n={};if(this.targets=[],this.animations={},this.callbacks=null,!j(t)&&!j(e)){for(let t in e){const s=e[t];et(t)?n[t]=s:z(t,"on")?r[t]=s:i[t]=s}this.callbacks=new Ge({v:0},r);for(let e in n){const s=n[e],r=U(s);let a={},l="+=0";if(r){const t=s.unit;W(t)&&(l+=t)}else a.duration=s;a[e]=r?$t({to:l},s):l;const h=$t(i,a);h.composition=o.replace,h.autoplay=!1;const d=this.animations[e]=new Ge(t,h,null,0,!1).init();this.targets.length||this.targets.push(...d.targets),this[e]=(t,e,s)=>{const i=d._head;if(j(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return Ct(d,e=>{if(H(t))for(let s=0,i=t.length;s<i;s++)j(e._numbers[s])||(e._fromNumbers[s]=e._modifier(e._numbers[s]),e._toNumbers[s]=t[s]);else e._fromNumber=e._modifier(e._number),e._toNumber=t;j(s)||(e._ease=Le(s)),e._currentTime=0}),j(e)||d.stretch(e),d.reset(!0).resume(),this}}}}revert(){for(let t in this.animations)this[t]=x,this.animations[t].revert();return this.animations={},this.targets.length=0,this.callbacks&&this.callbacks.revert(),this}}const cs=(t,e)=>new ds(t,e),us=(t,e)=>(+t).toFixed(e),ps=(t,e,s)=>`${t}`.padStart(e,s),ms=(t,e,s)=>`${t}`.padEnd(e,s),fs=(t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e,gs=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),ys=t=>t*Math.PI/180,_s=t=>180*t/Math.PI,vs=(t,e,s,i)=>i?1===i?e:xt(t,e,1-Math.exp(-i*s*.1)):t;var bs=Object.freeze({__proto__:null,clamp:_t,damp:vs,degToRad:ys,lerp:xt,mapRange:gs,padEnd:ms,padStart:ps,radToDeg:_s,round:bt,roundPad:us,snap:Tt,wrap:fs});const Ts=10*f;class xs{constructor(t={}){const e=!j(t.bounce)||!j(t.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/f,this.maxIterations=this.maxDuration/this.timeStep/f,this.bn=_t(Bt(t.bounce,.5),-1,1),this.pd=_t(Bt(t.duration,628),10*P.timeScale,Ts*P.timeScale),this.m=_t(Bt(t.mass,1),1,Ts),this.s=_t(Bt(t.stiffness,100),p,Ts),this.d=_t(Bt(t.damping,10),p,Ts),this.v=_t(Bt(t.velocity,0),-1e4,Ts),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=t.onComplete||x,e&&this.calculateSDFromBD(),this.compute(),this.ease=t=>{const e=t*this.settlingDuration,s=this.completed,i=this.pd;return e>=i&&!s&&(this.completed=!0,this.onComplete(this.parent)),e<i&&s&&(this.completed=!1),0===t||1===t?t:this.solve(t*this.solverDuration)}}solve(t){const{zeta:e,w0:s,wd:i,b:r}=this;let n=t;return n=e<1?dt(-n*e*s)*(1*lt(i*n)+r*at(i*n)):1===e?(1+r*n)*dt(-n*s):((1+r)*dt((-e*s+i)*n)+(1-r)*dt((-e*s-i)*n))/2,1-n}calculateSDFromBD(){const t=1===P.timeScale?this.pd/f:this.pd;this.m=1,this.v=0,this.s=nt(2*gt/t,2),this.bn>=0?this.d=4*(1-this.bn)*gt/t:this.d=4*gt/(t*(1+this.bn)),this.s=bt(_t(this.s,p,Ts),3),this.d=bt(_t(this.d,p,300),3)}calculateBDFromSD(){const t=2*gt/ot(this.s);this.pd=t*(1===P.timeScale?f:1);const e=this.d/(2*ot(this.s));this.bn=e<=1?1-this.d*t/(4*gt):4*gt/(this.d*t)-1,this.bn=bt(_t(this.bn,-1,1),3),this.pd=bt(_t(this.pd,10*P.timeScale,Ts*P.timeScale),3)}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,l=this.w0=_t(ot(o/r),p,f),h=this.zeta=n/(2*ot(o*r));h<1?(this.wd=l*ot(1-h*h),this.b=(h*l-a)/this.wd):1===h?(this.wd=0,this.b=-a+l):(this.wd=l*ot(h*h-1),this.b=(h*l-a)/this.wd);let d=0,c=0,u=0;for(;c<=t&&u<=e;)ht(1-this.solve(d))<s?c++:c=0,this.solverDuration=d,d+=i,u++;this.settlingDuration=bt(this.solverDuration*f,0)*P.timeScale}get bounce(){return this.bn}set bounce(t){this.bn=_t(Bt(t,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(t){this.pd=_t(Bt(t,1),10*P.timeScale,Ts*P.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=_t(Bt(t,100),p,Ts),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(t){this.d=_t(Bt(t,10),p,Ts),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(t){this.m=_t(Bt(t,1),1,Ts),this.compute()}get velocity(){return this.v}set velocity(t){this.v=_t(Bt(t,0),-1e4,Ts),this.compute()}}const Ss=t=>new xs(t),ws=t=>(console.warn("createSpring() is deprecated use spring() instead"),new xs(t)),Es=t=>{t.cancelable&&t.preventDefault()};class $s{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:x,remove:x}}get x(){return this.el.x||0}set x(t){this.el.x=t}get y(){return this.el.y||0}set y(t){this.el.y=t}get width(){return this.el.width||0}set width(t){this.el.width=t}get height(){return this.el.height||0}set height(t){this.el.height=t}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class Cs{constructor(t){this.$el=t,this.inlineTransforms=[],this.point=new DOMPoint,this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(t,e){return this.point.x=t,this.point.y=e,this.point.matrixTransform(this.inversedMatrix)}traverseUp(t){let e=this.$el.parentElement,i=0;for(;e&&e!==s;)t(e,i),e=e.parentElement,i++}getMatrix(){const t=new DOMMatrix;return this.traverseUp(e=>{const s=getComputedStyle(e).transform;if(s){const e=new DOMMatrix(s);t.preMultiplySelf(e)}}),t}remove(){this.traverseUp((t,e)=>{this.inlineTransforms[e]=t.style.transform,t.style.transform="none"})}revert(){this.traverseUp((t,e)=>{const s=this.inlineTransforms[e];""===s?t.style.removeProperty("transform"):t.style.transform=s})}}const Ns=(t,e)=>t&&q(t)?t(e):t;let ks=0;class Rs{constructor(t,i={}){if(!t)return;B.current&&B.current.register(this);const r=i.x,n=i.y,o=i.trigger,a=i.modifier,l=i.releaseEase,h=l&&Le(l),d=!j(l)&&!j(l.ease),c=U(r)&&!j(r.mapTo)?r.mapTo:"translateX",u=U(n)&&!j(n.mapTo)?n.mapTo:"translateY",p=Ns(i.container,this);this.containerArray=H(p)?p:null,this.$container=p&&!this.containerArray?be(p)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.$target=U(t)?new $s(t):be(t)[0],this.$trigger=be(o||t)[0],this.fixed="fixed"===ts(this.$target,"position"),this.isFinePointer=!0,this.containerPadding=[0,0,0,0],this.containerFriction=0,this.releaseContainerFriction=0,this.snapX=0,this.snapY=0,this.scrollSpeed=0,this.scrollThreshold=0,this.dragSpeed=0,this.dragThreshold=3,this.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=d?l:Ss({mass:Bt(i.releaseMass,1),stiffness:Bt(i.releaseStiffness,80),damping:Bt(i.releaseDamping,20)}),this.releaseYSpring=d?l:Ss({mass:Bt(i.releaseMass,1),stiffness:Bt(i.releaseStiffness,80),damping:Bt(i.releaseDamping,20)}),this.releaseEase=h||De.outQuint,this.hasReleaseSpring=d,this.onGrab=i.onGrab||x,this.onDrag=i.onDrag||x,this.onRelease=i.onRelease||x,this.onUpdate=i.onUpdate||x,this.onSettle=i.onSettle||x,this.onSnap=i.onSnap||x,this.onResize=i.onResize||x,this.onAfterResize=i.onAfterResize||x,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),j(r)||!0===r)f[c]=0;else if(U(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[c]=e}else!1===r&&(f[c]=0,this.disabled[0]=1);if(j(n)||!0===n)f[u]=0;else if(U(n)){const t=n,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===n&&(f[u]=0,this.disabled[1]=1);this.animate=new ds(this.$target,f),this.xProp=c,this.yProp=u,this.destX=0,this.destY=0,this.deltaX=0,this.deltaY=0,this.scroll={x:0,y:0},this.coords=[this.x,this.y,0,0],this.snapped=[0,0],this.pointer=[0,0,0,0,0,0,0,0],this.scrollView=[0,0],this.dragArea=[0,0,0,0],this.containerBounds=[-m,m,m,-m],this.scrollBounds=[0,0,0,0],this.targetBounds=[0,0,0,0],this.window=[0,0],this.velocityStack=[0,0,0],this.velocityStackIndex=0,this.velocityTime=X(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new Cs(this.$target),this.overshootCoords={x:0,y:0},this.overshootTicker=new ye({autoplay:!1,onUpdate:()=>{this.updated=!0,this.manual=!0,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,1),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,1)},onComplete:()=>{this.manual=!1,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,0),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,0)}},null,0).init(),this.updateTicker=new ye({autoplay:!1,onUpdate:()=>this.update()},null,0).init(),this.contained=!j(p),this.manual=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.enabled=!1,this.initialized=!1,this.activeProp=this.disabled[1]?c:u,this.animate.callbacks.onRender=()=>{const t=this.updated,e=!(this.grabbed&&t)&&this.released,s=this.x,i=this.y,r=s-this.coords[2],n=i-this.coords[3];this.deltaX=r,this.deltaY=n,this.coords[2]=s,this.coords[3]=i,t&&(r||n)&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=ft(n,r)):this.updated=!1},this.animate.callbacks.onComplete=()=>{!this.grabbed&&this.released&&(this.released=!1),this.manual||(this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.onSettle(this))},this.resizeTicker=new ye({autoplay:!1,duration:150*P.timeScale,onComplete:()=>{this.onResize(this),this.refresh(),this.onAfterResize(this)}}).init(),this.parameters=i,this.resizeObserver=new ResizeObserver(()=>{this.initialized?this.resizeTicker.restart():this.initialized=!0}),this.enable(),this.refresh(),this.resizeObserver.observe(this.$container),U(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=X(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,a=this.minVelocity,l=this.maxVelocity,h=this.velocityStackIndex;n[h]=bt(_t(ot(t*t+e*e)/r*o,a,l),5);const d=mt(n[0],n[1],n[2]);return this.velocity=d,this.velocityStackIndex=(h+1)%3,d}setX(t,e=!1){if(this.disabled[0])return;const s=bt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=Tt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=bt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=Tt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return bt(this.animate[this.xProp](),P.precision)}set x(t){this.setX(t,!1)}get y(){return bt(this.animate[this.yProp](),P.precision)}set y(t){this.setY(t,!1)}get progressX(){return gs(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(gs(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return gs(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(gs(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=bt(this.useWin?e.scrollX:this.$container.scrollLeft,0),s=bt(this.useWin?e.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,a=this.scrollThreshold;this.scroll.x=t,this.scroll.y=s,this.scrollBounds[0]=s-this.targetBounds[0]+i-a,this.scrollBounds[1]=t-this.targetBounds[1]-r+a,this.scrollBounds[2]=s-this.targetBounds[2]-n+a,this.scrollBounds[3]=t-this.targetBounds[3]+o-a}updateBoundingValues(){const t=this.$container;if(!t)return;const i=this.x,r=this.y,n=this.coords[2],o=this.coords[3];this.coords[2]=0,this.coords[3]=0,this.setX(0,!0),this.setY(0,!0),this.transforms.remove();const a=this.window[0]=e.innerWidth,l=this.window[1]=e.innerHeight,h=this.useWin,d=t.scrollWidth,c=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,y]=this.containerPadding;this.dragArea[0]=h?0:p.left,this.dragArea[1]=h?0:p.top,this.scrollView[0]=h?_t(d,a,d):d,this.scrollView[1]=h?_t(c,l,c):c,this.updateScrollCoords();const{width:_,height:v,left:b,top:T,right:x,bottom:S}=t.getBoundingClientRect();this.dragArea[2]=bt(h?_t(_,a,a):_,0),this.dragArea[3]=bt(h?_t(v,l,l):v,0);const w=ts(t,"overflow"),E="visible"===w,$="hidden"===w;if(this.canScroll=!u&&this.contained&&(t===s.body&&E||!$&&!E)&&(d>this.dragArea[2]+y-f||c>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!H(this.containerArray)),this.contained){const e=this.scroll.x,s=this.scroll.y,i=this.canScroll,r=this.$target.getBoundingClientRect(),n=i?h?0:t.scrollLeft:0,o=i?h?0:t.scrollTop:0,d=i?this.scrollView[0]-n-_:0,c=i?this.scrollView[1]-o-v:0;this.targetBounds[0]=bt(r.top+s-(h?0:T),0),this.targetBounds[1]=bt(r.right+e-(h?a:x),0),this.targetBounds[2]=bt(r.bottom+s-(h?l:S),0),this.targetBounds[3]=bt(r.left+e-(h?0:b),0),this.containerArray?(this.containerBounds[0]=this.containerArray[0]+m,this.containerBounds[1]=this.containerArray[1]-f,this.containerBounds[2]=this.containerArray[2]-g,this.containerBounds[3]=this.containerArray[3]+y):(this.containerBounds[0]=-bt(r.top-(u?_t(T,0,l):T)+o-m,0),this.containerBounds[1]=-bt(r.right-(u?_t(x,0,a):x)-d+f,0),this.containerBounds[2]=-bt(r.bottom-(u?_t(S,0,l):S)-c+g,0),this.containerBounds[3]=-bt(r.left-(u?_t(b,0,a):b)+n-y,0))}this.transforms.revert(),this.coords[2]=n,this.coords[3]=o,this.setX(i,!0),this.setY(r,!0)}isOutOfBounds(t,e,s){if(!this.contained)return 0;const[i,r,n,o]=t,[a,l]=this.disabled,h=!a&&e<o||!a&&e>r,d=!l&&s<i||!l&&s>n;return h&&!d?1:!h&&d?2:h&&d?3:0}refresh(){const t=this.parameters,i=t.x,r=t.y,n=Ns(t.container,this),o=Ns(t.containerPadding,this)||0,a=H(o)?o:[o,o,o,o],l=this.x,h=this.y,d=Ns(t.cursor,this),c={onHover:"grab",onGrab:"grabbing"};if(d){const{onHover:t,onGrab:e}=d;t&&(c.onHover=t),e&&(c.onGrab=e)}const u=Ns(t.dragThreshold,this),p={mouse:3,touch:7};if(Y(u))p.mouse=u,p.touch=u;else if(u){const{mouse:t,touch:e}=u;j(t)||(p.mouse=t),j(e)||(p.touch=e)}this.containerArray=H(n)?n:null,this.$container=n&&!this.containerArray?be(n)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.isFinePointer=matchMedia("(pointer:fine)").matches,this.containerPadding=Bt(a,[0,0,0,0]),this.containerFriction=_t(Bt(Ns(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=_t(Bt(Ns(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=Ns(U(i)&&!j(i.snap)?i.snap:t.snap,this),this.snapY=Ns(U(r)&&!j(r.snap)?r.snap:t.snap,this),this.scrollSpeed=Bt(Ns(t.scrollSpeed,this),1.5),this.scrollThreshold=Bt(Ns(t.scrollThreshold,this),20),this.dragSpeed=Bt(Ns(t.dragSpeed,this),1),this.dragThreshold=this.isFinePointer?p.mouse:p.touch,this.minVelocity=Bt(Ns(t.minVelocity,this),0),this.maxVelocity=Bt(Ns(t.maxVelocity,this),50),this.velocityMultiplier=Bt(Ns(t.velocityMultiplier,this),1),this.cursor=!1!==d&&c,this.updateBoundingValues();const[m,f,g,y]=this.containerBounds;this.setX(_t(l,y,f),!0),this.setY(_t(h,m,g),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],a=this.dragArea[3],l=this.scroll.x,h=this.scroll.y,d=this.$container.scrollWidth,c=this.$container.scrollHeight,u=this.useWin?_t(d,this.window[0],d):d,p=this.useWin?_t(c,this.window[1],c):c,m=r-u,f=n-p;this.dragged&&m>0&&(this.coords[0]-=m,this.scrollView[0]=u),this.dragged&&f>0&&(this.coords[1]-=f,this.scrollView[1]=p);const g=10*this.scrollSpeed,y=this.scrollThreshold,[_,v]=this.coords,[b,T,x,S]=this.scrollBounds,w=bt(_t((v-b+t)/y,-1,0)*g,0),E=bt(_t((_-T-e)/y,0,1)*g,0),$=bt(_t((v-x-s)/y,0,1)*g,0),C=bt(_t((_-S+i)/y,-1,0)*g,0);if(w||$||C||E){const[t,e]=this.disabled;let s=l,i=h;t||(s=bt(_t(l+(C||E),0,r-o),0),this.coords[0]-=l-s),e||(i=bt(_t(h+(w||$),0,n-a),0),this.coords[1]-=h-i),this.useWin?this.$scrollContainer.scrollBy(-(l-s),-(h-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,a,l,h]=this.pointer;this.coords[0]+=(r-l)*this.dragSpeed,this.coords[1]+=(n-h)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[d,c]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(d>e?e+(d-e)*m:d<i?i+(d-i)*m:d,!1),this.setY(c>s?s+(c-s)*m:c<t?t+(c-t)*m:c,!1),this.computeVelocity(r-l,n-h),this.angle=ft(n-a,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return pe([this],null,"x"),pe([this],null,"y"),pe([this],null,"progressX"),pe([this],null,"progressY"),pe([this.scroll]),pe([this.overshootCoords]),this}scrollInView(t,e=0,s=De.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,a=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[l,h,d,c]=o,u=bt(_t(r-l,-m,0),0),p=bt(_t(i-h,0,m),0),f=bt(_t(r-d,0,m),0),g=bt(_t(i-c,-m,0),0);new Ge(n,{x:bt(n.x+(g?g-e:p?p+e:0),0),y:bt(n.y+(u?u-e:f?f+e:0),0),duration:j(t)?350*P.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then(()=>{this.canScroll=a})}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=es(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=De.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,a,l]=this.containerPadding,h=this.scroll.y-this.targetBounds[0]+n+e,d=this.scroll.x-this.targetBounds[1]-o-e,c=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+l+e,p=this.isOutOfBounds([h,d,c,u],i,r);if(p){const[e,n]=this.disabled,o=_t(Tt(i,this.snapX),u,d),a=_t(Tt(r,this.snapY),h,c),l=j(t)?350*P.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,l,s),n||2!==p&&3!==p||this.animate[this.yProp](a,l,s)}return this}handleDown(t){const e=t.target;if(this.grabbed||"range"===e.type)return;t.stopPropagation(),this.grabbed=!0,this.released=!1,this.stop(),this.updateBoundingValues();const i=t.changedTouches,r=i?i[0].clientX:t.clientX,n=i?i[0].clientY:t.clientY,{x:o,y:a}=this.transforms.normalizePoint(r,n),[l,h,d,c]=this.containerBounds,u=(1-this.containerFriction)*this.dragSpeed,p=this.x,m=this.y;this.coords[0]=this.coords[2]=u?p>h?h+(p-h)/u:p<c?c+(p-c)/u:p:p,this.coords[1]=this.coords[3]=u?m>d?d+(m-d)/u:m<l?l+(m-l)/u:m:m,this.pointer[0]=o,this.pointer[1]=a,this.pointer[2]=o,this.pointer[3]=a,this.pointer[4]=o,this.pointer[5]=a,this.pointer[6]=o,this.pointer[7]=a,this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null);const f=ts(this.$target,"zIndex",!1);ks=(f>ks?f:ks)+1,this.targetStyles=es(this.$target,{zIndex:ks}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=es(s.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,De.out(3)),this.onGrab(this),s.addEventListener("touchmove",this),s.addEventListener("touchend",this),s.addEventListener("touchcancel",this),s.addEventListener("mousemove",this),s.addEventListener("mouseup",this),s.addEventListener("selectstart",this)}handleMove(t){if(!this.grabbed)return;const e=t.changedTouches,s=e?e[0].clientX:t.clientX,i=e?e[0].clientY:t.clientY,{x:r,y:n}=this.transforms.normalizePoint(s,i),o=r-this.pointer[6],a=n-this.pointer[7];let l=t.target,h=!1,d=!1,c=!1;for(;e&&l&&l!==this.$trigger;){const t=ts(l,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=l;if(e>s){c=!0,h=t<=3,d=t>=e-s-3;break}}l=l.parentElement}c&&(!h&&!d||h&&a<0||d&&a>0)?(this.pointer[0]=r,this.pointer[1]=n,this.pointer[2]=r,this.pointer[3]=n,this.pointer[4]=r,this.pointer[5]=n,this.pointer[6]=r,this.pointer[7]=n):(Es(t),this.triggerStyles||(this.triggerStyles=es(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",Es,{passive:!1}),this.$trigger.addEventListener("touchmove",Es,{passive:!1}),this.$trigger.addEventListener("touchend",Es),(this.dragged||!this.disabled[0]&&ht(o)>this.dragThreshold||!this.disabled[1]&&ht(a)>this.dragThreshold)&&(this.updateTicker.resume(),this.pointer[2]=this.pointer[0],this.pointer[3]=this.pointer[1],this.pointer[0]=r,this.pointer[1]=n,this.dragged=!0,this.released=!1,this.onDrag(this)))}handleUp(){if(!this.grabbed)return;this.updateTicker.pause(),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null);const[t,e]=this.disabled,[i,r,n,a,l,h]=this.pointer,[d,c,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,y=this.releaseYSpring,_=this.releaseEase,v=this.hasReleaseSpring,b=this.overshootCoords,T=this.x,x=this.y,S=this.computeVelocity(i-l,r-h),w=this.angle=ft(r-a,i-n),E=150*S,$=(1-this.releaseContainerFriction)*this.dragSpeed,C=T+lt(w)*E,N=x+at(w)*E,k=C>c?c+(C-c)*$:C<p?p+(C-p)*$:C,R=N>u?u+(N-u)*$:N<d?d+(N-d)*$:N,D=this.destX=_t(bt(Tt(k,this.snapX),5),p,c),I=this.destY=_t(bt(Tt(R,this.snapY),5),d,u),O=this.isOutOfBounds(this.containerBounds,C,N);let A=0,L=0,B=_,F=_,M=0;if(b.x=T,b.y=x,!t){const t=D===c?T>c?-1:1:T<p?-1:1,s=bt(T-D,0);g.velocity=e&&v?s?E*t/ht(s):0:S;const{ease:i,settlingDuration:r,restDuration:n}=g;A=T===D?0:v?r:r-n*P.timeScale,v&&(B=i),A>M&&(M=A)}if(!e){const e=I===u?x>u?-1:1:x<d?-1:1,s=bt(x-I,0);y.velocity=t&&v?s?E*e/ht(s):0:S;const{ease:i,settlingDuration:r,restDuration:n}=y;L=x===I?0:v?r:r-n*P.timeScale,v&&(F=i),L>M&&(M=L)}if(!v&&O&&$&&(A||L)){const t=o.blend;new Ge(b,{x:{to:k,duration:.65*A},y:{to:R,duration:.65*L},ease:_,composition:t}).init(),new Ge(b,{x:{to:D,duration:A},y:{to:I,duration:L},ease:_,composition:t}).init(),this.overshootTicker.stretch(mt(A,L)).restart()}else t||this.animate[this.xProp](D,A,B),e||this.animate[this.yProp](I,L,F);this.scrollInView(M,this.scrollThreshold,_);let V=!1;D!==m&&(this.snapped[0]=D,this.snapX&&(V=!0)),I!==f&&this.snapY&&(this.snapped[1]=I,this.snapY&&(V=!0)),V&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",Es),this.$trigger.removeEventListener("touchmove",Es),this.$trigger.removeEventListener("touchend",Es),s.removeEventListener("touchmove",this),s.removeEventListener("touchend",this),s.removeEventListener("touchcancel",this),s.removeEventListener("mousemove",this),s.removeEventListener("mouseup",this),s.removeEventListener("selectstart",this)}reset(){return this.stop(),this.resizeTicker.pause(),this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.setX(0,!0),this.setY(0,!0),this.coords[0]=0,this.coords[1]=0,this.pointer[0]=0,this.pointer[1]=0,this.pointer[2]=0,this.pointer[3]=0,this.pointer[4]=0,this.pointer[5]=0,this.pointer[6]=0,this.pointer[7]=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this}enable(){return this.enabled||(this.enabled=!0,this.$target.classList.remove("is-disabled"),this.touchActionStyles=es(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"}),this.$trigger.addEventListener("touchstart",this,{passive:!0}),this.$trigger.addEventListener("mousedown",this,{passive:!0}),this.$trigger.addEventListener("mouseenter",this)),this}disable(){return this.enabled=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.touchActionStyles.revert(),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null),this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null),this.$target.classList.add("is-disabled"),this.$trigger.removeEventListener("touchstart",this),this.$trigger.removeEventListener("mousedown",this),this.$trigger.removeEventListener("mouseenter",this),s.removeEventListener("touchmove",this),s.removeEventListener("touchend",this),s.removeEventListener("touchcancel",this),s.removeEventListener("mousemove",this),s.removeEventListener("mouseup",this),s.removeEventListener("selectstart",this),this}revert(){return this.reset(),this.disable(),this.$target.classList.remove("is-disabled"),this.updateTicker.revert(),this.overshootTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),this.resizeObserver.disconnect(),this}handleEvent(t){switch(t.type){case"mousedown":case"touchstart":this.handleDown(t);break;case"mousemove":case"touchmove":this.handleMove(t);break;case"mouseup":case"touchend":case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":Es(t)}}}const Ds=(t,e)=>new Rs(t,e),Is=(t=x)=>new ye({duration:1*P.timeScale,onComplete:t},null,0).resume(),Os=t=>{let e;return(...s)=>{let i,r,n,o;e&&(i=e.currentIteration,r=e.iterationProgress,n=e.reversed,o=e._alternate,e.revert());const a=t(...s);return a&&!q(a)&&a.revert&&(e=a),j(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r),a||x}};class As{constructor(t={}){B.current&&B.current.register(this);const i=t.root;let r=s;i&&(r=i.current||i.nativeElement||be(i)[0]||s);const n=t.defaults,o=P.defaults,a=t.mediaQueries;if(this.defaults=n?$t(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],this.constructorsOnce=[],this.revertConstructorsOnce=[],this.revertiblesOnce=[],this.once=!1,this.onceIndex=0,this.methods={},this.matches={},this.mediaQueryLists={},this.data={},a)for(let t in a){const s=e.matchMedia(a[t]);this.mediaQueryLists[t]=s,s.addEventListener("change",this)}}register(t){(this.once?this.revertiblesOnce:this.revertibles).push(t)}execute(t){let e=B.current,s=B.root,i=P.defaults;B.current=this,B.root=this.root,P.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return B.current=e,B.root=s,P.defaults=i,n}refresh(){return this.onceIndex=0,this.execute(()=>{let t=this.revertibles.length,e=this.revertConstructors.length;for(;t--;)this.revertibles[t].revert();for(;e--;)this.revertConstructors[e](this);this.revertibles.length=0,this.revertConstructors.length=0,this.constructors.forEach(t=>{const e=t(this);q(e)&&this.revertConstructors.push(e)})}),this}add(t,e){if(this.once=!1,q(t)){const e=t;this.constructors.push(e),this.execute(()=>{const t=e(this);q(t)&&this.revertConstructors.push(t)})}else this.methods[t]=(...t)=>this.execute(()=>e(...t));return this}addOnce(t){if(this.once=!0,q(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute(()=>{const t=s(this);q(t)&&this.revertConstructorsOnce.push(t)})}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(q(s))return s(this);const i=Os(t);let r;return this.constructorsOnce[e]=i,this.execute(()=>{r=i(this)}),r}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.revertiblesOnce,i=this.revertConstructorsOnce,r=this.mediaQueryLists;let n=t.length,o=e.length,a=s.length,l=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;a--;)s[a].revert();for(;l--;)i[l](this);for(let t in r)r[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,s.length=0,i.length=0,this.constructorsOnce.length=0,this.onceIndex=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const Ls=t=>new As(t),Bs=()=>{const t=s.createElement("div");s.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return s.body.removeChild(t),e},Ps=(t,e)=>t&&q(t)?t(e):t,Fs=new Map;class Ms{constructor(t){this.element=t,this.useWin=this.element===s.body,this.winWidth=0,this.winHeight=0,this.width=0,this.height=0,this.left=0,this.top=0,this.scale=1,this.zIndex=0,this.scrollX=0,this.scrollY=0,this.prevScrollX=0,this.prevScrollY=0,this.scrollWidth=0,this.scrollHeight=0,this.velocity=0,this.backwardX=!1,this.backwardY=!1,this.scrollTicker=new ye({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;Ct(this,t=>t.handleScroll(),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new ye({autoplay:!1,frameRate:30,onUpdate:t=>{const e=t.deltaTime,s=this.prevScrollX,i=this.prevScrollY,r=this.scrollX,n=this.scrollY,o=s-r,a=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),a&&(this.backwardY=i>n),this.velocity=bt(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new ye({autoplay:!1,duration:250*P.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new ye({autoplay:!1,duration:500*P.timeScale,onBegin:()=>{this.scrollTicker.resume()},onComplete:()=>{this.scrollTicker.pause()}}).init(),this._head=null,this._tail=null,this.updateScrollCoords(),this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll(),this.resizeObserver=new ResizeObserver(()=>this.resizeTicker.restart()),this.resizeObserver.observe(this.element),(this.useWin?e:this.element).addEventListener("scroll",this,!1)}updateScrollCoords(){const t=this.useWin,s=this.element;this.scrollX=bt(t?e.scrollX:s.scrollLeft,0),this.scrollY=bt(t?e.scrollY:s.scrollTop,0)}updateWindowBounds(){this.winWidth=e.innerWidth,this.winHeight=Bs()}updateBounds(){const t=getComputedStyle(this.element),e=this.element;let s,i;if(this.scrollWidth=e.scrollWidth+parseFloat(t.marginLeft)+parseFloat(t.marginRight),this.scrollHeight=e.scrollHeight+parseFloat(t.marginTop)+parseFloat(t.marginBottom),this.updateWindowBounds(),this.useWin)s=this.winWidth,i=this.winHeight;else{const t=e.getBoundingClientRect();s=e.clientWidth,i=e.clientHeight,this.top=t.top,this.left=t.left,this.scale=t.width?s/t.width:t.height?i/t.height:1}this.width=s,this.height=i}refreshScrollObservers(){Ct(this,t=>{t._debug&&t.removeDebug()}),this.updateBounds(),Ct(this,t=>{t.refresh(),t.onResize(t),t._debug&&t.debug()})}refresh(){this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll()}handleScroll(){this.updateScrollCoords(),this.wakeTicker.restart()}handleEvent(t){"scroll"===t.type&&this.handleScroll()}revert(){this.scrollTicker.cancel(),this.dataTimer.cancel(),this.resizeTicker.cancel(),this.wakeTicker.cancel(),this.resizeObserver.disconnect(),(this.useWin?e:this.element).removeEventListener("scroll",this),Fs.delete(this.element)}}const Vs=t=>{const e=t&&be(t)[0]||s.body;let i=Fs.get(e);return i||(i=new Ms(e),Fs.set(e,i)),i},zs=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,a="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:l,u:h}=Ht(a,Yt);let d=l;return"%"===h?d=l/100*s:h&&(d=we(t,Yt,"px",!0).n),o&&i<0&&(d+=i),n&&r>0&&(d+=r),d},Xs=(t,e,s,i,r)=>{let n;if(W(e)){const o=O.exec(e);if(o){const a=o[0],l=a[0],h=e.split(a),d="min"===h[0],c="max"===h[0],u=zs(t,h[0],s,i,r),p=zs(t,h[1],s,i,r);if(d){const e=zt(zs(t,"min",s),p,l);n=e<u?u:e}else if(c){const e=zt(zs(t,"max",s),p,l);n=e>u?u:e}else n=zt(u,p,l)}else n=zs(t,e,s,i,r)}else n=e;return bt(n,0)},Hs=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[l]){e=i;break}}return e};let Us=0;const Ys=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Ws{constructor(t={}){B.current&&B.current.register(this);const e=Bt(t.sync,"play pause"),i=e?Le(e):null,r=e&&("linear"===e||e===Ee),n=e&&!(i===Ee&&!r),o=e&&(Y(e)||!0===e||r),a=e&&W(e)&&!n&&!o,l=a?e.split(" ").map(t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null}):null,h=a&&l.length>2;this.index=Us++,this.id=j(t.id)?this.index:t.id,this.container=Vs(t.container),this.target=null,this.linked=null,this.repeat=null,this.horizontal=null,this.enter=null,this.leave=null,this.sync=n||o||!!l,this.syncEase=n?i:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=l&&!h&&l[0]?l[0]:x,this.onSyncLeave=l&&!h&&l[1]?l[1]:x,this.onSyncEnterForward=l&&h&&l[0]?l[0]:x,this.onSyncLeaveForward=l&&h&&l[1]?l[1]:x,this.onSyncEnterBackward=l&&h&&l[2]?l[2]:x,this.onSyncLeaveBackward=l&&h&&l[3]?l[3]:x,this.onEnter=t.onEnter||x,this.onLeave=t.onLeave||x,this.onEnterForward=t.onEnterForward||x,this.onLeaveForward=t.onLeaveForward||x,this.onEnterBackward=t.onEnterBackward||x,this.onLeaveBackward=t.onLeaveBackward||x,this.onUpdate=t.onUpdate||x,this.onResize=t.onResize||x,this.onSyncComplete=t.onSyncComplete||x,this.reverted=!1,this.ready=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offset=0,this.offsetStart=0,this.offsetEnd=0,this.distance=0,this.prevProgress=0,this.thresholds=["start","end","end","start"],this.coords=[0,0,0,0],this.debugStyles=null,this.$debug=null,this._params=t,this._debug=Bt(t.debug,!1),this._next=null,this._prev=null,kt(this.container,this),Is(()=>{if(!this.reverted){if(!this.target){const e=be(t.target)[0];this.target=e||s.body,this.refresh()}this._debug&&this.debug()}})}link(t){if(t&&(t.pause(),this.linked=t,j(t)||j(t.persist)||(t.persist=!0),!this._params.target)){let e;j(t.targets)?Ct(t,t=>{t.targets&&!e&&(e=Hs(t))}):e=Hs(t),this.target=e||s.body,this.refresh()}return this}get velocity(){return this.container.velocity}get backward(){return this.horizontal?this.container.backwardX:this.container.backwardY}get scroll(){return this.horizontal?this.container.scrollX:this.container.scrollY}get progress(){const t=(this.scroll-this.offsetStart)/this.distance;return t===1/0||isNaN(t)?0:bt(_t(t,0,1),6)}refresh(){this.ready=!0,this.reverted=!1;const t=this._params;return this.repeat=Bt(Ps(t.repeat,this),!0),this.horizontal="x"===Bt(Ps(t.axis,this),"y"),this.enter=Bt(Ps(t.enter,this),"end start"),this.leave=Bt(Ps(t.leave,this),"start end"),this.updateBounds(),this.handleScroll(),this}removeDebug(){return this.$debug&&(this.$debug.parentNode.removeChild(this.$debug),this.$debug=null),this.debugStyles&&(this.debugStyles.revert(),this.$debug=null),this}debug(){this.removeDebug();const t=this.container,e=this.horizontal,i=t.element.querySelector(":scope > .animejs-onscroll-debug"),r=s.createElement("div"),n=s.createElement("div"),o=s.createElement("div"),a=Ys[this.index%Ys.length],l=t.useWin,h=l?t.winWidth:t.width,d=l?t.winHeight:t.height,c=t.scrollWidth,u=t.scrollHeight,p=this.container.width>360?320:260,m=e?0:10,f=e?10:0,g=e?24:p/2,y=e?g:15,_=e?60:g,v=e?_:y,b=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",x=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,S=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${S("absolute",m,f,e?c:p,e?p:u)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${e?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `,n.style.cssText=`${S("sticky",0,0,e?h:g,e?g:d)}`,i||(n.style.cssText+=`background:\n ${x("#FFFF")}${T(g-10)} / 100px 100px ${b},\n ${x("#FFF8")}${T(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${S("relative",0,0,e?c:g,e?g:u)}`,i||(o.style.cssText+=`background:\n ${x("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${x("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const w=[" enter: "," leave: "];this.coords.forEach((t,i)=>{const r=i>1,l=(r?0:this.offset)+t,m=i%2,f=l<v,g=l>(r?e?h:d:e?c:u)-v,b=(r?m&&!f:!m&&!f)||g,T=s.createElement("div"),x=s.createElement("div"),E=e?b?"right":"left":b?"bottom":"top",$=b?(e?_:y)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;x.innerHTML=`${this.id}${w[m]}${this.thresholds[i]}`,T.style.cssText=`${S("absolute",0,0,_,y)}\n display: flex;\n flex-direction: ${e?"column":"row"};\n justify-content: flex-${r?"start":"end"};\n align-items: flex-${b?"end":"start"};\n border-${E}: 2px solid ${a};\n `,x.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${y};\n margin-${e?b?"right":"left":b?"bottom":"top"}: -2px;\n padding: 1px;\n font-family: ui-monospace, monospace;\n font-size: 10px;\n letter-spacing: -.025em;\n line-height: 9px;\n font-weight: 600;\n text-align: ${e&&b||!e&&!r?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${m?a:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":a};\n border: 2px solid ${m?a:"transparent"};\n border-${e?b?"top-left":"top-right":b?"top-left":"bottom-left"}-radius: 5px;\n border-${e?b?"bottom-left":"bottom-right":b?"top-right":"bottom-right"}-radius: 5px;\n `,T.appendChild(x);let C=l-$+(e?1:0);T.style[e?"left":"top"]=`${C}px`,(r?n:o).appendChild(T)}),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),i||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===ts(t.element,"position")&&(this.debugStyles=es(t.element,{position:"relative "}))}updateBounds(){let t;this._debug&&this.removeDebug();const e=this.target,i=this.container,r=this.horizontal,n=this.linked;let o,a=e;for(n&&(o=n.currentTime,n.seek(0,!0));a&&a!==i.element&&a!==s.body;){const e="sticky"===ts(a,"position")&&es(a,{position:"static"});a=a.parentElement,e&&(t||(t=[]),t.push(e))}const l=e.getBoundingClientRect(),h=i.scale,d=(r?l.left+i.scrollX-i.left:l.top+i.scrollY-i.top)*h,c=(r?l.width:l.height)*h,u=r?i.width:i.height,p=(r?i.scrollWidth:i.scrollHeight)-u,m=this.enter,f=this.leave;let g="start",y="end",_="end",v="start";if(W(m)){const t=m.split(" ");_=t[0],g=t.length>1?t[1]:g}else if(U(m)){const t=m;j(t.container)||(_=t.container),j(t.target)||(g=t.target)}else Y(m)&&(_=m);if(W(f)){const t=f.split(" ");v=t[0],y=t.length>1?t[1]:y}else if(U(f)){const t=f;j(t.container)||(v=t.container),j(t.target)||(y=t.target)}else Y(f)&&(v=f);const b=Xs(e,g,c),T=Xs(e,y,c),x=b+d-u,S=T+d-p,w=Xs(e,_,u,x,S),E=Xs(e,v,u,x,S),$=b+d-w,C=T+d-E,N=C-$;this.offset=d,this.offsetStart=$,this.offsetEnd=C,this.distance=N<=0?0:N,this.thresholds=[g,y,_,v],this.coords=[b,T,w,E],t&&t.forEach(t=>t.revert()),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){if(!this.ready)return;const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,a=this.scroll,l=a<=this.offsetStart,h=a>=this.offsetEnd,d=!l&&!h,c=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&c,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(l&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&Y(i)){if(i<1){const t=1e-4,s=e<g&&1===g?t:e>g&&!g?-t:0;g=bt(xt(e,g,xt(.01,.2,i))+s,6)}}else s&&(g=s(g));m=g!==this.prevProgress,f=1===e,m&&!f&&i&&e&&o.wakeTicker.restart()}if(p){const t=n?o.scrollY:o.scrollX;p.style[n?"top":"left"]=t+10+"px"}(d&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(d&&(this.isInView=!0),this.forceEnter&&this.hasEntered?d&&(this.forceEnter=!1):(p&&d&&(p.style.zIndex=""+this.container.zIndex++),this.onSyncEnter(this),this.onEnter(this),this.backward?(this.onSyncEnterBackward(this),this.onEnterBackward(this)):(this.onSyncEnterForward(this),this.onEnterForward(this)),this.hasEntered=!0,u&&(this.forceEnter=!0))),(d||!d&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!d&&this.isInView&&(this.isInView=!1,this.onSyncLeave(this),this.onLeave(this),this.backward?(this.onSyncLeaveBackward(this),this.onLeaveBackward(this)):(this.onSyncLeaveForward(this),this.onLeaveForward(this)),e&&!i&&(f=!0)),g>=1&&this.began&&!this.completed&&(e&&f||!e)&&(e&&this.onSyncComplete(this),this.completed=!0,(!this.repeat&&!t||!this.repeat&&t&&t.completed)&&this.revert()),g<1&&this.completed&&(this.completed=!1),this.prevProgress=g}revert(){if(this.reverted)return;const t=this.container;return Nt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this.ready=!1,this}}const qs=(t={})=>new Ws(t),js=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,Gs=(t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=js(r,e,s)-t,i>0?o=r:n=r}while(ht(i)>1e-7&&++a<100);return r},Qs=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?Ee:r=>0===r||1===r?r:js(Gs(r,t,s),e,i),Js=(t=10,e)=>{const s=e?ct:ut;return e=>s(_t(e,0,1)*t)*(1/t)},Zs=(...t)=>{const e=t.length;if(!e)return Ee;const s=e-1,i=t[0],r=t[s],n=[0],o=[rt(i)];for(let e=1;e<s;e++){const i=t[e],r=W(i)?i.trim().split(" "):[i],a=r[0],l=r[1];n.push(j(l)?e/s:rt(l)/100),o.push(rt(a))}return o.push(rt(r)),n.push(1),function(t){for(let e=1,s=n.length;e<s;e++){const s=n[e];if(t<=s){const i=n[e-1],r=o[e-1];return r+(o[e]-r)*(t-i)/(s-i)}}return o[o.length-1]}},Ks=(t=10,e=1)=>{const s=[0],i=t-1;for(let t=1;t<i;t++){const r=s[t-1],n=t/i,o=n*(1-e)+(n+((t+1)/i-n)*Math.random())*e;s.push(_t(o,r,1))}return s.push(1),Zs(...s)};var ti=Object.freeze({__proto__:null,Spring:xs,createSpring:ws,cubicBezier:Qs,eases:De,irregular:Ks,linear:Zs,spring:Ss,steps:Js});const ei=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(bt(t(i/e),4));return`linear(${s.join(", ")})`},si={},ii=t=>{let e=si[t];if(e)return e;if(e="linear",W(t)){if(z(t,"linear")||z(t,"cubic-")||z(t,"steps")||z(t,"ease"))e=t;else if(z(t,"cubicB"))e=V(t);else{const s=Oe(t);q(s)&&(e=s===Ee?"linear":ei(s))}si[t]=e}else if(q(t)){const s=ei(t);s&&(e=s)}else t.ease&&(e=ei(t.ease));return e},ri=["x","y","z"],ni=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...ri],oi=(()=>[...ri,...b.filter(t=>["X","Y","Z"].some(e=>t.endsWith(e)))])();let ai=null;const li=(t,e,s,i,r)=>{let n=W(e)?e:Pt(e,s,i,r);return Y(n)?ni.includes(t)||z(t,"translate")?`${n}px`:z(t,"rotate")||z(t,"skew")?`${n}deg`:`${n}`:n},hi=(t,e,s,i,r,n)=>{let o="0";const a=j(i)?getComputedStyle(t)[e]:li(e,i,t,r,n);return o=j(s)?H(i)?i.map(s=>li(e,s,t,r,n)):a:[li(e,s,t,r,n),a],o};class di{constructor(e,s){B.current&&B.current.register(this),G(ai)&&(!t||!j(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(b.forEach(t=>{const e=z(t,"skew"),s=z(t,"scale"),i=z(t,"rotate"),r=z(t,"translate"),n=i||e,o=n?"<angle>":s?"<number>":r?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:o,inherits:!1,initialValue:r?"0px":n?"0deg":s?"1":"0"})}catch{}}),ai=!0):ai=!1);const i=Te(e),r=i.length;r||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const n=Bt(s.autoplay,P.defaults.autoplay),o=!(!n||!n.link)&&n,a=s.alternate&&!0===s.alternate,l=s.reversed&&!0===s.reversed,h=Bt(s.loop,P.defaults.loop),c=!0===h||h===1/0?1/0:Y(h)?h+1:1,u=a?l?"alternate-reverse":"alternate":l?"reverse":"normal",p=1===P.timeScale?1:f;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||P.defaults.onComplete,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!n||!1!==o,this.reversed=l,this.persist=Bt(s.persist,P.defaults.persist),this.autoplay=n,this._speed=Bt(s.playbackRate,P.defaults.playbackRate),this._resolve=x,this._completed=0,this._inlineStyles=[],i.forEach((t,e)=>{const i=t[d],n=oi.some(t=>s.hasOwnProperty(t)),o=t.style,a=this._inlineStyles[e]={},l=Bt(s.ease,P.defaults.ease),h=Pt(l,t,e,r),m=q(h)||W(h)?h:l,f=l.ease&&l,g=ii(m),_=(f?f.settlingDuration:Pt(Bt(s.duration,P.defaults.duration),t,e,r))*p,x=Pt(Bt(s.delay,P.defaults.delay),t,e,r)*p,S=Bt(s.composition,"replace");for(let l in s){if(!et(l))continue;const h={},d={iterations:c,direction:u,fill:"both",easing:g,duration:_,delay:x,composite:S},m=s[l],f=!!n&&(b.includes(l)?l:v.get(l)),y=f?"transform":l;let T;if(a[y]||(a[y]=o[y]),U(m)){const s=m,n=Bt(s.ease,g),a=n.ease&&n,c=s.to,u=s.from;if(d.duration=(a?a.settlingDuration:Pt(Bt(s.duration,_),t,e,r))*p,d.delay=Pt(Bt(s.delay,x),t,e,r)*p,d.composite=Bt(s.composition,S),d.easing=ii(n),T=hi(t,l,u,c,e,r),f?(h[`--${f}`]=T,i[f]=T):h[l]=hi(t,l,u,c,e,r),Ke(this,t,l,h,d),!j(u))if(f){const t=`--${f}`;o.setProperty(t,h[t][0])}else o[l]=h[l][0]}else T=H(m)?m.map(s=>li(l,s,t,e,r)):li(l,m,t,e,r),f?(h[`--${f}`]=T,i[f]=T):h[l]=T,Ke(this,t,l,h,d)}if(n){let t=y;for(let e in i)t+=`${T[e]}var(--${e})) `;o.transform=t}}),o&&this.autoplay.link(this)}forEach(t){try{const e=W(t)?e=>e[t]():t;this.animations.forEach(e)}catch{}return this}get speed(){return this._speed}set speed(t){this._speed=+t,this.forEach(e=>e.playbackRate=t)}get currentTime(){const t=this.controlAnimation,e=P.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===P.timeScale?1:f);this.forEach(t=>{!this.persist&&e>=this.duration&&t.play(),t.currentTime=e})}get progress(){return this.currentTime/this.duration}set progress(t){this.forEach(e=>e.currentTime=t*this.duration||0)}resume(){return this.paused?(this.paused=!1,this.forEach("play")):this}pause(){return this.paused?this:(this.paused=!0,this.forEach("pause"))}alternate(){return this.reversed=!this.reversed,this.forEach("reverse"),this.paused&&this.forEach("pause"),this}play(){return this.reversed&&this.alternate(),this.resume()}reverse(){return this.reversed||this.alternate(),this.resume()}seek(t,e=!1){return e&&(this.muteCallbacks=!0),t<this.duration&&(this.completed=!1),this.currentTime=t,this.muteCallbacks=!1,this.paused&&this.pause(),this}restart(){return this.completed=!1,this.seek(0,!0).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){return this.muteCallbacks=!0,this.commitStyles().forEach("cancel"),this.animations.length=0,requestAnimationFrame(()=>{this.targets.forEach(t=>{"none"===t.style.transform&&t.style.removeProperty("transform")})}),this}revert(){return this.cancel().targets.forEach((t,e)=>{const s=t.style,i=this._inlineStyles[e];for(let e in i){const r=i[e];j(r)||r===y?s.removeProperty(V(e)):t.style[e]=r}t.getAttribute("style")===y&&t.removeAttribute("style")}),this}then(t=x){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=x};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const ci={animate:(t,e)=>new di(t,e),convertEase:ei};let ui=0,pi=0;const mi=(t,e)=>!(!t||!e)&&(t===e||t.contains(e)),fi=t=>{if(!t)return null;const e=t.style,s=e.transition||"";return e.setProperty("transition","none","important"),s},gi=(t,e)=>{if(!t)return;const s=t.style;e?s.transition=e:s.removeProperty("transition")},yi=t=>{const e=t.layout.transitionMuteStore,s=t.$el,i=t.$measure;s&&!e.has(s)&&e.set(s,fi(s)),i&&!e.has(i)&&e.set(i,fi(i))},_i=t=>{t.forEach((t,e)=>gi(e,t)),t.clear()},vi={display:"none",visibility:"hidden",opacity:"0",transform:"none",position:"static"},bi=t=>{if(!t)return;const e=t.parentNode;e&&(e._head===t&&(e._head=t._next),e._tail===t&&(e._tail=t._prev),t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t._prev=null,t._next=null,t.parentNode=null)},Ti=(t,e,s,i)=>{let r=t.dataset.layoutId;r||(r=t.dataset.layoutId="node-"+pi++);const n=i||{};return n.$el=t,n.$measure=t,n.id=r,n.index=0,n.total=1,n.delay=0,n.duration=0,n.ease=null,n.state=s,n.layout=s.layout,n.parentNode=e||null,n.isTarget=!1,n.isEntering=!1,n.isLeaving=!1,n.isInlined=!1,n.hasTransform=!1,n.inlineStyles=[],n.inlineTransforms=null,n.inlineTransition=null,n.branchAdded=!1,n.branchRemoved=!1,n.branchNotRendered=!1,n.sizeChanged=!1,n.hasVisibilitySwap=!1,n.hasDisplayNone=!1,n.hasVisibilityHidden=!1,n.measuredInlineTransform=null,n.measuredInlineTransition=null,n.measuredDisplay=null,n.measuredVisibility=null,n.measuredPosition=null,n.measuredHasDisplayNone=!1,n.measuredHasVisibilityHidden=!1,n.measuredIsVisible=!1,n.measuredIsRemoved=!1,n.measuredIsInsideRoot=!1,n.properties={transform:"none",x:0,y:0,left:0,top:0,clientLeft:0,clientTop:0,width:0,height:0},n.layout.properties.forEach(t=>n.properties[t]=0),n._head=null,n._tail=null,n._prev=null,n._next=null,n},xi=(t,e,s,i)=>{const r=t.$el,n=t.layout.root,o=n===r,a=t.properties,l=t.state.rootNode,h=t.parentNode,d=s.transform,c=r.style.transform,u=!!h&&h.measuredIsRemoved,p=s.position;o&&(t.layout.absoluteCoords="fixed"===p||"absolute"===p),t.$measure=e,t.inlineTransforms=c,t.hasTransform=d&&"none"!==d,t.measuredIsInsideRoot=mi(n,e),t.measuredInlineTransform=null,t.measuredDisplay=s.display,t.measuredVisibility=s.visibility,t.measuredPosition=p,t.measuredHasDisplayNone="none"===s.display,t.measuredHasVisibilityHidden="hidden"===s.visibility,t.measuredIsVisible=!(t.measuredHasDisplayNone||t.measuredHasVisibilityHidden),t.measuredIsRemoved=t.measuredHasDisplayNone||t.measuredHasVisibilityHidden||u;let m=!1,f=r.previousSibling;for(;f&&(f.nodeType===Node.COMMENT_NODE||f.nodeType===Node.TEXT_NODE&&!f.textContent.trim());)f=f.previousSibling;if(f&&f.nodeType===Node.TEXT_NODE)m=!0;else{for(f=r.nextSibling;f&&(f.nodeType===Node.COMMENT_NODE||f.nodeType===Node.TEXT_NODE&&!f.textContent.trim());)f=f.nextSibling;m=null!==f&&f.nodeType===Node.TEXT_NODE}if(t.isInlined=m,t.hasTransform&&!i){const s=t.layout.transitionMuteStore;s.get(r)||(t.inlineTransition=fi(r)),e===r?r.style.transform="none":(s.get(e)||(t.measuredInlineTransition=fi(e)),t.measuredInlineTransform=e.style.transform,e.style.transform="none")}let g,y,_=0,v=0,b=0,T=0;if(!i){const t=e.getBoundingClientRect();_=t.left,v=t.top,b=t.width,T=t.height}for(let t in a){const e="transform"===t?d:s[t]||s.getPropertyValue&&s.getPropertyValue(t);j(e)||(a[t]=e)}if(a.left=_,a.top=v,a.clientLeft=i?0:e.clientLeft,a.clientTop=i?0:e.clientTop,o)t.layout.absoluteCoords?(g=_,y=v):(g=0,y=0);else{const e=h||l,s=e.properties.left,i=e.properties.top,r=e.properties.clientLeft,n=e.properties.clientTop;if(t.layout.absoluteCoords)g=_-s-r,y=v-i-n;else if(e===l){const t=l.properties.left,e=l.properties.top;g=_-t-l.properties.clientLeft,y=v-e-l.properties.clientTop}else g=_-s-r,y=v-i-n}return a.x=g,a.y=y,a.width=b,a.height=T,t},Si=(t,e)=>{if(e)for(let s in e)t.properties[s]=e[s]},wi=(t,e)=>{const s=Pt(e.ease,t.$el,t.index,t.total),i=q(s)?s:e.ease,r=!j(i)&&!j(i.ease);t.ease=r?i.ease:i,t.duration=r?i.settlingDuration:Pt(e.duration,t.$el,t.index,t.total),t.delay=Pt(e.delay,t.$el,t.index,t.total)},Ei=t=>{const e=t.$el.style,s=t.inlineStyles;s.length=0,t.layout.recordedProperties.forEach(t=>{s.push(t,e[t]||"")})},$i=t=>{const e=t.$el.style,s=t.inlineStyles;for(let t=0,i=s.length;t<i;t+=2){const i=s[t],r=s[t+1];r&&""!==r?e[i]=r:(e[i]="",e.removeProperty(i))}},Ci=t=>{const e=t.inlineTransforms,s=t.$el.style;!t.hasTransform||!e||t.hasTransform&&"none"===s.transform||e&&"none"===e?s.removeProperty("transform"):e&&(s.transform=e);const i=t.$measure;if(t.hasTransform&&i!==t.$el){const e=i.style,s=t.measuredInlineTransform;s&&""!==s?e.transform=s:e.removeProperty("transform")}t.measuredInlineTransform=null,null!==t.inlineTransition&&(gi(t.$el,t.inlineTransition),t.inlineTransition=null),i!==t.$el&&null!==t.measuredInlineTransition&&(gi(i,t.measuredInlineTransition),t.measuredInlineTransition=null)},Ni=t=>{(t.measuredIsRemoved||t.hasVisibilitySwap)&&(t.$el.style.removeProperty("display"),t.$el.style.removeProperty("visibility"),t.hasVisibilitySwap&&(t.$measure.style.removeProperty("display"),t.$measure.style.removeProperty("visibility"))),t.layout.pendingRemoval.delete(t.$el)},ki=(t,e,s)=>(e.properties={...t.properties},e.state=s,e.isTarget=t.isTarget,e.hasTransform=t.hasTransform,e.inlineTransforms=t.inlineTransforms,e.measuredIsVisible=t.measuredIsVisible,e.measuredDisplay=t.measuredDisplay,e.measuredIsRemoved=t.measuredIsRemoved,e.measuredHasDisplayNone=t.measuredHasDisplayNone,e.measuredHasVisibilityHidden=t.measuredHasVisibilityHidden,e.hasDisplayNone=t.hasDisplayNone,e.isInlined=t.isInlined,e.hasVisibilityHidden=t.hasVisibilityHidden,e);class Ri{constructor(t){this.layout=t,this.rootNode=null,this.rootNodes=new Set,this.nodes=new Map,this.scrollX=0,this.scrollY=0}revert(){return this.forEachNode(t=>{this.layout.pendingRemoval.delete(t.$el),t.$el.removeAttribute("data-layout-id"),t.$measure.removeAttribute("data-layout-id")}),this.rootNode=null,this.rootNodes.clear(),this.nodes.clear(),this}getNode(t){if(t&&t.dataset)return this.nodes.get(t.dataset.layoutId)}getComputedValue(t,e){const s=this.getNode(t);if(s)return s.properties[e]}forEach(t,e){let s=t,i=0;for(;s;)if(e(s,i++),s._head)s=s._head;else if(s._next)s=s._next;else{for(;s&&!s._next;)s=s.parentNode;s&&(s=s._next)}}forEachRootNode(t){this.forEach(this.rootNode,t)}forEachNode(t){for(const e of this.rootNodes)this.forEach(e,t)}registerElement(t,e){if(!t||1!==t.nodeType)return null;this.layout.transitionMuteStore.has(t)||this.layout.transitionMuteStore.set(t,fi(t));const s=[t,e],i=this.layout.root;let r=null;for(;s.length;){const t=s.pop(),e=s.pop();if(!e||1!==e.nodeType||Q(e))continue;const n=!!t&&t.measuredIsRemoved,o=n?vi:getComputedStyle(e),a=!!n||"none"===o.display,l=!!n||"hidden"===o.visibility,h=!a&&!l,d=e.dataset.layoutId,c=mi(i,e);let u=d?this.nodes.get(d):null;if(u&&u.$el!==e){const a=mi(i,u.$el),l=u.measuredIsVisible;if(a||!c&&(c||l||!h)){if(a&&!l&&h){xi(u,e,o,n);let t=e.lastElementChild;for(;t;)s.push(t,u),t=t.previousElementSibling;r||(r=u);continue}{let i=e.lastElementChild;for(;i;)s.push(i,t),i=i.previousElementSibling;r||(r=u);continue}}bi(u),u=Ti(e,t,this,u)}else u=Ti(e,t,this,u);u.branchAdded=!1,u.branchRemoved=!1,u.branchNotRendered=!1,u.isTarget=!1,u.sizeChanged=!1,u.hasVisibilityHidden=l,u.hasDisplayNone=a,u.hasVisibilitySwap=l&&!u.measuredHasVisibilityHidden||a&&!u.measuredHasDisplayNone,this.nodes.set(u.id,u),u.parentNode=t||null,u._prev=null,u._next=null,t?(this.rootNodes.delete(u),t._head?(t._tail._next=u,u._prev=t._tail,t._tail=u):(t._head=u,t._tail=u)):this.rootNodes.add(u),xi(u,u.$el,o,n);let p=e.lastElementChild;for(;p;)s.push(p,u),p=p.previousElementSibling;r||(r=u)}return r}ensureDetachedNode(t,e){if(!t||t===this.layout.root)return null;const s=t.dataset.layoutId,i=s?this.nodes.get(s):null;if(i&&i.$el===t)return i;let r=null,n=t.parentElement;for(;n&&n!==this.layout.root;){if(e.has(n)){r=this.ensureDetachedNode(n,e);break}n=n.parentElement}return this.registerElement(t,r)}record(){const t=this.layout,e=t.children,s=t.root,i=H(e)?e:[e],r=[],n="*"===e?s:B.root,o=[];let a=s.parentElement;for(;a&&1===a.nodeType;){const t=getComputedStyle(a);if(t.transform&&"none"!==t.transform){const t=a.style.transform||"",e=fi(a);o.push(a,t,e),a.style.transform="none"}a=a.parentElement}for(let t=0,e=i.length;t<e;t++){const e=i[t];r[t]=W(e)?n.querySelectorAll(e):e}const l=Te(r);this.nodes.clear(),this.rootNodes.clear();const h=this.registerElement(s,null);h.isTarget=!0,this.rootNode=h;const d=new Set;let c=0,u=this.nodes.size;this.nodes.forEach((t,e)=>{t.index=c++,t.total=u,t&&t.measuredIsInsideRoot&&d.add(e)});const p=new Set,m=[];for(let t=0,e=l.length;t<e;t++){const e=l[t];if(e&&1===e.nodeType&&e!==s){if(!mi(s,e)){const t=e.dataset.layoutId;if(!t||!d.has(t))continue}p.has(e)||(p.add(e),m.push(e))}}for(let t=0,e=m.length;t<e;t++)this.ensureDetachedNode(m[t],p);for(let t=0,e=l.length;t<e;t++){const e=l[t],s=this.getNode(e);if(s){let t=s;for(;t&&!t.isTarget;)t.isTarget=!0,t=t.parentNode}}this.scrollX=window.scrollX,this.scrollY=window.scrollY,this.forEachNode(Ci);for(let t=0,e=o.length;t<e;t+=3){const e=o[t],s=o[t+1],i=o[t+2];s&&""!==s?e.style.transform=s:e.style.removeProperty("transform"),gi(e,i)}return this}}function Di(t){const e={},s={};for(let i in t){const r=t[i];"duration"===i||"delay"===i||"ease"===i?s[i]=r:e[i]=r}return[e,s]}class Ii{constructor(t,e={}){B.current&&B.current.register(this);const s=Di(e.swapAt),i=Di(e.enterFrom),r=Di(e.leaveTo),n=e.properties;if(e.duration=Bt(e.duration,350),e.delay=Bt(e.delay,0),e.ease=Bt(e.ease,"inOut(3.5)"),this.params=e,this.root=Te(t)[0],this.id=ui++,this.children=e.children||"*",this.absoluteCoords=!1,this.swapAtParams=$t(e.swapAt||{opacity:0},{ease:"inOut(1.75)"}),this.enterFromParams=e.enterFrom||{opacity:0},this.leaveToParams=e.leaveTo||{opacity:0},this.properties=new Set(["opacity","fontSize","color","backgroundColor","borderRadius","border","filter","clipPath"]),s[0])for(let t in s[0])this.properties.add(t);if(i[0])for(let t in i[0])this.properties.add(t);if(r[0])for(let t in r[0])this.properties.add(t);if(n)for(let t=0,e=n.length;t<e;t++)this.properties.add(n[t]);this.recordedProperties=new Set(["display","visibility","translate","position","left","top","marginLeft","marginTop","width","height","maxWidth","maxHeight","minWidth","minHeight"]),this.properties.forEach(t=>this.recordedProperties.add(t)),this.pendingRemoval=new WeakSet,this.transitionMuteStore=new Map,this.oldState=new Ri(this),this.newState=new Ri(this),this.timeline=null,this.transformAnimation=null,this.animating=[],this.swapping=[],this.leaving=[],this.entering=[],this.oldState.record(),_i(this.transitionMuteStore)}revert(){return this.root.classList.remove("is-animated"),this.timeline&&(this.timeline.complete(),this.timeline=null),this.transformAnimation&&(this.transformAnimation.complete(),this.transformAnimation=null),this.animating.length=this.swapping.length=this.leaving.length=this.entering.length=0,this.oldState.revert(),this.newState.revert(),requestAnimationFrame(()=>_i(this.transitionMuteStore)),this}record(){return this.transformAnimation&&(this.transformAnimation.cancel(),this.transformAnimation=null),this.oldState.record(),this.timeline&&(this.timeline.cancel(),this.timeline=null),this.newState.forEachRootNode($i),this}animate(t={}){const e={ease:Bt(t.ease,this.params.ease),delay:Bt(t.delay,this.params.delay),duration:Bt(t.duration,this.params.duration)},s={},i=Bt(t.onComplete,this.params.onComplete),r=Bt(t.onPause,this.params.onPause);for(let e in L)"ease"!==e&&"duration"!==e&&"delay"!==e&&(j(t[e])?j(this.params[e])||(s[e]=this.params[e]):s[e]=t[e]);s.onComplete=()=>{const e=t.autoplay;if(e&&e.linked)i&&i(this.timeline);else{this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(t=>{Ni(t),$i(t)});for(let t=0,e=S.length;t<e;t++){const e=S[t];e.style.transform=f.getComputedValue(e,"transform")}this.root.classList.contains("is-animated")&&(this.root.classList.remove("is-animated"),i&&i(this.timeline)),requestAnimationFrame(()=>{this.root.classList.contains("is-animated")||_i(this.transitionMuteStore)})}},s.onPause=()=>{const e=t.autoplay;if(e&&e.linked)return i&&i(this.timeline),void(r&&r(this.timeline));this.root.classList.contains("is-animated")&&(this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(Ni),this.root.classList.remove("is-animated"),i&&i(this.timeline),r&&r(this.timeline))},s.composition=!1;const n=$t($t(t.swapAt||{},this.swapAtParams),e),o=$t($t(t.enterFrom||{},this.enterFromParams),e),a=$t($t(t.leaveTo||{},this.leaveToParams),e),[l,h]=Di(n),[d,c]=Di(o),[u,p]=Di(a),m=this.oldState,f=this.newState,g=this.animating,y=this.swapping,_=this.entering,v=this.leaving,b=this.pendingRemoval;g.length=y.length=_.length=v.length=0,m.forEachRootNode(yi),f.record(),f.forEachRootNode(Ei);const T=[],x=[],S=[],w=[],E=f.rootNode,$=E.$el;f.forEachRootNode(t=>{const e=t.$el,s=t.id,i=t.parentNode,r=!!i&&i.branchAdded,n=!!i&&i.branchRemoved,o=!!i&&i.branchNotRendered;let a=m.nodes.get(s);const l=!a;l?(a=ki(t,{},m),m.nodes.set(s,a),a.measuredIsRemoved=!0):a.measuredIsRemoved&&!t.measuredIsRemoved&&(ki(t,a,m),a.measuredIsRemoved=!0);const h=a.parentNode,c=(h?h.id:null)!==(i?i.id:null),p=a.$el!==t.$el,y=a.measuredIsRemoved,x=t.measuredIsRemoved;if(!a.measuredIsRemoved&&!x&&!l&&(c||p)){const t=a.properties.left,e=a.properties.top,s=i||f.rootNode,r=s.id?m.nodes.get(s.id):null,n=r?r.properties.left:s.properties.left,o=r?r.properties.top:s.properties.top,l=r?r.properties.clientLeft:s.properties.clientLeft,h=r?r.properties.clientTop:s.properties.clientTop;a.properties.x=t-n-l,a.properties.y=e-o-h}t.hasVisibilitySwap&&(t.hasVisibilityHidden&&(t.$el.style.visibility="visible",t.$measure.style.visibility="hidden"),t.hasDisplayNone&&(t.$el.style.display=a.measuredDisplay||t.measuredDisplay||"",t.$measure.style.visibility="hidden"));const S=b.has(e),w=a.measuredIsVisible,$=t.measuredIsVisible,C=!w&&$&&!o,N=!x&&(y||S)&&!r,k=x&&!y&&!n,R=k||x&&S&&!n;t.branchAdded=r||N,t.branchRemoved=n||R,t.branchNotRendered=o||x,x&&w&&(t.$el.style.display=a.measuredDisplay,t.$el.style.visibility="visible",ki(a,t,f)),k?(t.isTarget&&(v.push(e),t.isLeaving=!0),b.add(e)):!x&&S&&b.delete(e),N&&!o||C?(Si(a,d),t.isTarget&&(_.push(e),t.isEntering=!0)):R&&!o&&Si(t,u),t===E||!t.isTarget||t.isEntering||t.isLeaving||g.push(e),T.push(e)});let C=0,N=0,k=0;f.forEachRootNode(t=>{const s=t.$el,i=t.parentNode,r=m.nodes.get(t.id),n=t.properties,o=r.properties;let a=i!==E&&i;for(;a&&!a.isTarget&&a!==E;)a=a.parentNode;const d=g.length;t===E?(t.index=0,t.total=d,wi(t,e)):t.isEntering?(t.index=a?a.index:C,t.total=a?d:_.length,wi(t,c),C++):t.isLeaving?(t.index=a?a.index:N,t.total=a?d:v.length,N++,wi(t,p)):t.isTarget?(t.index=k++,t.total=d,wi(t,e)):(t.index=a?a.index:0,t.total=d,wi(t,h)),r.index=t.index,r.total=t.total;for(let e in n)n[e]=Pt(n[e],s,t.index,t.total),o[e]=Pt(o[e],s,r.index,r.total);const u=Math.abs(n.width-o.width)>1,f=Math.abs(n.height-o.height)>1;if(t.sizeChanged=u||f,t.isTarget&&(!t.measuredIsRemoved&&r.measuredIsVisible||t.measuredIsRemoved&&t.measuredIsVisible)){"none"===n.transform&&"none"===o.transform||(t.hasTransform=!0,S.push(s));for(let t in n)if("transform"!==t&&n[t]!==o[t]){x.push(s);break}}t.isTarget||(y.push(s),t.sizeChanged&&i&&i.isTarget&&i.sizeChanged&&(l.transform&&(t.hasTransform=!0,S.push(s)),w.push(s)))});const R={delay:t=>f.getNode(t).delay,duration:t=>f.getNode(t).duration,ease:t=>f.getNode(t).ease};if(s.defaults=R,this.timeline=hs(s),!x.length&&!S.length&&!y.length)return _i(this.transitionMuteStore),this.timeline.complete();if(T.length){this.root.classList.add("is-animated");for(let t=0,e=T.length;t<e;t++){const e=T[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties;r.isInlined||("grid"!==i.measuredDisplay&&"grid"!==r.measuredDisplay||e.style.setProperty("display","block","important"),(e!==$||this.absoluteCoords)&&(e.style.position=this.absoluteCoords?"fixed":"absolute",e.style.left="0px",e.style.top="0px",e.style.marginLeft="0px",e.style.marginTop="0px",e.style.translate=`${n.x}px ${n.y}px`),e===$&&"static"===r.measuredPosition&&(e.style.position="relative",e.style.left="0px",e.style.top="0px")),e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none"}m.scrollX===window.scrollX&&m.scrollY===window.scrollY||requestAnimationFrame(()=>window.scrollTo(m.scrollX,m.scrollY));for(let t=0,e=x.length;t<e;t++){const e=x[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties,o=r.properties;let a=!1;const l={composition:"none"};n.width!==o.width&&(l.width=[n.width,o.width],a=!0),n.height!==o.height&&(l.height=[n.height,o.height],a=!0),r.hasTransform||r.isInlined||(l.translate=[`${n.x}px ${n.y}px`,`${o.x}px ${o.y}px`],a=!0),this.properties.forEach(t=>{const e=n[t],s=o[t];"transform"!==t&&e!==s&&(l[t]=[e,s],a=!0)}),a&&this.timeline.add(e,l,0)}}if(y.length){for(let t=0,e=y.length;t<e;t++){const e=y[t],s=m.getNode(e),i=s.properties;e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",s.isInlined||(e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${m.getComputedValue(e,t)}`)})}for(let t=0,e=y.length;t<e;t++){const e=y[t],s=f.getNode(e),i=s.properties;this.timeline.call(()=>{e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",s.isInlined||(e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${f.getComputedValue(e,t)}`)})},s.delay+s.duration/2)}if(w.length){const t=Le(f.nodes.get(w[0].dataset.layoutId).ease),e=e=>1-t(1-e),s={};if(l)for(let t in l)"transform"!==t&&(s[t]=[{from:e=>m.getComputedValue(e,t),to:l[t]},{from:l[t],to:e=>f.getComputedValue(e,t),ease:e}]);this.timeline.add(w,s,0)}}const D=S.length;if(D){for(let t=0;t<D;t++){const e=S[t],s=f.getNode(e);s.isInlined||(e.style.translate=`${m.getComputedValue(e,"x")}px ${m.getComputedValue(e,"y")}px`),e.style.transform=m.getComputedValue(e,"transform"),w.includes(e)&&(s.ease=Pt(n.ease,e,s.index,s.total),s.duration=Pt(n.duration,e,s.index,s.total))}this.transformAnimation=ci.animate(S,{translate:t=>f.getNode(t).isInlined?"0px 0px":`${f.getComputedValue(t,"x")}px ${f.getComputedValue(t,"y")}px`,transform:t=>{const e=f.getComputedValue(t,"transform");if(!w.includes(t))return e;const s=m.getComputedValue(t,"transform"),i=f.getNode(t);return[s,Pt(l.transform,t,i.index,i.total),e]},autoplay:!1,...R}),this.timeline.sync(this.transformAnimation,0)}return this.timeline.init()}update(t,e={}){return this.record(),t(this),this.animate(e)}}const Oi=(t,e)=>new Ii(t,e),Ai=bs,Li={},Bi=(t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s),Pi=t=>(...e)=>{const s=t(...e);return new Proxy(x,{apply:(t,e,[i])=>s(i),get:(t,e)=>Pi((...t)=>{const i=Li[e](...t);return t=>i(s(t))})})},Fi=(t,e,s=0)=>{const i=(...t)=>(t.length<e.length?Pi(Bi(e,s)):e)(...t);return Li[t]||(Li[t]=i),i},Mi=Fi("roundPad",Ai.roundPad),Vi=Fi("padStart",Ai.padStart),zi=Fi("padEnd",Ai.padEnd),Xi=Fi("wrap",Ai.wrap),Hi=Fi("mapRange",Ai.mapRange),Ui=Fi("degToRad",Ai.degToRad),Yi=Fi("radToDeg",Ai.radToDeg),Wi=Fi("snap",Ai.snap),qi=Fi("clamp",Ai.clamp),ji=Fi("round",Ai.round),Gi=Fi("lerp",Ai.lerp,1),Qi=Fi("damp",Ai.damp,1),Ji=(t=0,e=1,s=0)=>{const i=10**s;return Math.floor((Math.random()*(e-t+1/i)+t)*i)/i};let Zi=0;const Ki=(t,e=0,s=1,i=0)=>{let r=void 0===t?Zi++:t;return(t=e,n=s,o=i)=>{r+=1831565813,r=Math.imul(r^r>>>15,1|r),r^=r+Math.imul(r^r>>>7,61|r);const a=10**o;return Math.floor((((r^r>>>14)>>>0)/4294967296*(n-t+1/a)+t)*a)/a}},tr=t=>t[Ji(0,t.length-1)],er=t=>{let e,s,i=t.length;for(;i;)s=Ji(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},sr=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,a=!j(o),l=a&&!j(o.ease)?o.ease:a?Le(o):null,h=e.grid,d=e.axis,c=e.total,u=j(r)||0===r||"first"===r,p="center"===r,m="last"===r,f="random"===r,g=H(t),_=e.use,v=rt(g?t[0]:t),b=g?rt(t[1]):0,T=R.exec((g?t[1]:t)+y),x=e.start||0+(g?v:0);let S=u?0:Y(r)?r:0;return(t,r,o,a)=>{const[u]=Te(t),y=j(c)?o:c,w=!j(_)&&(q(_)?_(u,r,y):Vt(u,_)),E=Y(w)||W(w)&&Y(+w)?+w:r;if(p&&(S=(y-1)/2),m&&(S=y-1),!s.length){for(let t=0;t<y;t++){if(h){const e=p?(h[0]-1)/2:S%h[0],i=p?(h[1]-1)/2:ut(S/h[0]),r=e-t%h[0],n=i-ut(t/h[0]);let o=ot(r*r+n*n);"x"===d&&(o=-r),"y"===d&&(o=-n),s.push(o)}else s.push(ht(S-t));i=mt(...s)}l&&(s=s.map(t=>l(t/i)*i)),n&&(s=s.map(t=>d?t<0?-1*t:-t:ht(i-t))),f&&(s=er(s))}const $=g?(b-v)/i:v;let C=(a?rs(a,j(e.start)?a.iterationDuration:x):x)+($*bt(s[E],2)||0);return e.modifier&&(C=e.modifier(C)),T&&(C=`${C}${T[2]}`),C}};var ir=Object.freeze({__proto__:null,$:Te,clamp:qi,cleanInlineStyles:Qt,createSeededRandom:Ki,damp:Qi,degToRad:Ui,get:ts,keepTime:Os,lerp:Gi,mapRange:Hi,padEnd:zi,padStart:Vi,radToDeg:Yi,random:Ji,randomPick:tr,remove:ss,round:ji,roundPad:Mi,set:es,shuffle:er,snap:Wi,stagger:sr,sync:Is,wrap:Xi});const rr=t=>{const e=be(t)[0];return e&&Q(e)?e:console.warn(`${t} is not a valid SVGGeometryElement`)},nr=(t,e,s,i,r)=>{const n=s+i,o=r?Math.max(0,Math.min(n,e)):(n%e+e)%e;return t.getPointAtLength(o)},or=(t,e,s=0)=>i=>{const r=+t.getTotalLength(),n=i[h],o=t.getCTM(),a=0===s;return{from:0,to:r,modifier:i=>{const l=i+s*r;if("a"===e){const e=nr(t,r,l,-1,a),s=nr(t,r,l,1,a);return 180*ft(s.y-e.y,s.x-e.x)/gt}{const s=nr(t,r,l,0,a);return"x"===e?n||!o?s.x:s.x*o.a+s.y*o.c+o.e:n||!o?s.y:s.x*o.b+s.y*o.d+o.f}}}},ar=(t,e=0)=>{const s=rr(t);if(s)return{translateX:or(s,"x",e),translateY:or(s,"y",e),rotate:or(s,"a",e)}},lr=t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(ot(s.a*s.a+s.b*s.b)+ot(s.c*s.c+s.d*s.d))/2)}return e},hr=(t,e,s)=>{const i=f,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let a=n;const l=new Proxy(t,{get(t,e){const s=t[e];return e===u?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],l=+s[1],h=lr(o),d=-1e3*r*h,c=l*i*h+d,u=i*h+(0===r&&1===l||1===r&&0===l?0:10*h)-c;if("butt"!==n){const e=r===l?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${d}`),t.setAttribute("stroke-dasharray",`${c} ${u}`)}return Reflect.apply(s,t,e)}:q(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),l.setAttribute("draw",`${e} ${s}`)),l},dr=(t,e=0,s=0)=>be(t).map(t=>hr(t,e,s)),cr=(t,e=.33)=>s=>{if(!(s.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${s.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const i=rr(t);if(!i)throw new Error("Can't morph to an invalid target. 'path2' must resolve to an existing <path>, <polygon> or <polyline> SVG element.");if(!(i.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${i.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const r="path"===s.tagName,n=r?" ":",",o=s[c];o&&s.setAttribute(r?"d":"points",o);let a="",l="";if(e){const t=s.getTotalLength(),o=i.getTotalLength(),h=Math.max(Math.ceil(t*e),Math.ceil(o*e));for(let e=0;e<h;e++){const d=e/(h-1),c=s.getPointAtLength(t*d),u=i.getPointAtLength(o*d),p=r?0===e?"M":"L":"";a+=p+bt(c.x,3)+n+c.y+" ",l+=p+bt(u.x,3)+n+u.y+" "}}else a=s.getAttribute(r?"d":"points"),l=i.getAttribute(r?"d":"points");return s[c]=l,[a,l]};var ur=Object.freeze({__proto__:null,createDrawable:dr,createMotionPath:ar,morphTo:cr});const pr="undefined"!=typeof Intl&&Intl.Segmenter,mr=/\{value\}/g,fr=/\{i\}/g,gr=/(\s+)/,yr=/^\s+$/,_r="line",vr="word",br="char",Tr="data-line";let xr=null,Sr=null,wr=null;const Er=t=>t.isWordLike||" "===t.segment||Y(+t.segment),$r=t=>t.setAttribute("aria-hidden","true"),Cr=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],Nr={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},kr=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&kr(e)}},Rr=(t,e,s)=>{const i=t.getAttribute(Tr);if(null!==i&&+i!==e||"BR"===t.tagName){s.add(t);const e=t.previousSibling,i=t.nextSibling;e&&3===e.nodeType&&yr.test(e.textContent)&&s.add(e),i&&3===i.nodeType&&yr.test(i.textContent)&&s.add(i)}let r=t.childElementCount;for(;r--;)Rr(t.children[r],e,s);return s},Dr=(t,e={})=>{let s="";const i=W(e.class)?` class="${e.class}"`:"",r=Bt(e.clone,!1),n=Bt(e.wrap,!1),o=n?!0===n?"clip":n:!!r&&"clip";return n&&(s+=`<span${o?` style="overflow:${o};"`:""}>`),s+=`<span${i}${r?' style="position:relative;"':""} data-${t}="{i}">`,r?(s+="<span>{value}</span>",s+=`<span inert style="position:absolute;top:${"top"===r?"-100%":"bottom"===r?"100%":"0"};left:${"left"===r?"-100%":"right"===r?"100%":"0"};white-space:nowrap;">{value}</span>`):s+="{value}",s+="</span>",n&&(s+="</span>"),s},Ir=(t,e,s,i,r,n,o,a,l)=>{const h=r===_r,d=r===br,c=`_${r}_`,u=q(t)?t(s):t,p=h?"block":"inline-block";wr.innerHTML=u.replace(mr,`<i class="${c}"></i>`).replace(fr,`${d?l:h?o:a}`);const m=wr.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,y=m.querySelectorAll(`i.${c}`),_=y.length;if(_){f.style.display=p,g.style.display=p,g.setAttribute(Tr,`${o}`),h||(g.setAttribute("data-word",`${a}`),d&&g.setAttribute("data-char",`${l}`));let t=_;for(;t--;){const e=y[t],i=e.parentElement;i.style.display=p,h?i.innerHTML=s.innerHTML:i.replaceChild(s.cloneNode(!0),e)}e.push(g),i.appendChild(m)}else console.warn('The expression "{value}" is missing from the provided template.');return n&&(f.style.outline=`1px dotted ${Nr[r]}`),f};class Or{constructor(e,i={}){xr||(xr=pr?new pr([],{granularity:vr}):{segment:t=>{const e=[],s=t.split(gr);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!yr.test(i)})}return e}}),Sr||(Sr=pr?new pr([],{granularity:"grapheme"}):{segment:t=>[...t].map(t=>({segment:t}))}),!wr&&t&&(wr=s.createElement("template")),B.current&&B.current.register(this);const{words:r,chars:n,lines:o,accessible:a,includeSpaces:l,debug:h}=i,d=(e=H(e)?e[0]:e)&&e.nodeType?e:(ve(e)||[])[0],c=!0===o?{}:o,u=!0===r||j(r)?{}:r,p=!0===n?{}:n;this.debug=Bt(h,!1),this.includeSpaces=Bt(l,!1),this.accessible=Bt(a,!0),this.linesOnly=c&&!u&&!p,this.lineTemplate=U(c)?Dr(_r,c):c,this.wordTemplate=U(u)||this.linesOnly?Dr(vr,u):u,this.charTemplate=U(p)?Dr(br,p):p,this.$target=d,this.html=d&&d.innerHTML,this.lines=[],this.words=[],this.chars=[],this.effects=[],this.effectsCleanups=[],this.cache=null,this.ready=!1,this.width=0,this.resizeTimeout=null;const m=()=>this.html&&(c||u||p)&&this.split();this.resizeObserver=new ResizeObserver(()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{const t=d.offsetWidth;t!==this.width&&(this.width=t,m())},150)}),this.lineTemplate&&!this.ready?s.fonts.ready.then(m):m(),d?this.resizeObserver.observe(d):console.warn("No Text Splitter target found.")}addEffect(t){if(!q(t))return console.warn("Effect must return a function.");const e=Os(t);return this.effects.push(e),this.ready&&(this.effectsCleanups[this.effects.length-1]=e(this)),this}revert(){return clearTimeout(this.resizeTimeout),this.lines.length=this.words.length=this.chars.length=0,this.resizeObserver.disconnect(),this.effectsCleanups.forEach(t=>q(t)?t(this):t.revert&&t.revert()),this.$target.innerHTML=this.html,this}splitNode(t){const e=this.wordTemplate,i=this.charTemplate,r=this.includeSpaces,n=this.debug,o=t.nodeType;if(3===o){const o=t.nodeValue;if(o.trim()){const a=[],l=this.words,h=this.chars,d=xr.segment(o),c=s.createDocumentFragment();let u=null;for(const t of d){const e=t.segment,s=Er(t);if(!u||s&&u&&Er(u))a.push(e);else{const t=a.length-1,s=a[t];gr.test(s)||gr.test(e)?a.push(e):a[t]+=e}u=t}for(let t=0,o=a.length;t<o;t++){const o=a[t];if(o.trim()){const d=a[t+1],u=r&&d&&!d.trim(),p=o,m=i?Sr.segment(p):null,f=i?s.createDocumentFragment():s.createTextNode(u?o+" ":o);if(i){const t=[...m];for(let e=0,r=t.length;e<r;e++){const o=t[e],a=e===r-1&&u?o.segment+" ":o.segment,d=s.createTextNode(a);Ir(i,h,d,f,br,n,-1,l.length,h.length)}}e?Ir(e,l,f,c,vr,n,-1,l.length,h.length):i?c.appendChild(f):c.appendChild(s.createTextNode(o)),u&&t++}else{if(t&&r)continue;c.appendChild(s.createTextNode(o))}}t.parentNode.replaceChild(c,t)}}else if(1===o){const e=[...t.childNodes];for(let t=0,s=e.length;t<s;t++)this.splitNode(e[t])}}split(t=!1){const e=this.$target,i=!!this.cache&&!t,r=this.lineTemplate,n=this.wordTemplate,o=this.charTemplate,a="loading"!==s.fonts.status,l=r&&a;this.ready=!r||a,(l||t)&&this.effectsCleanups.forEach(t=>q(t)&&t(this)),i||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),l&&(i&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=Cr(e,vr))),o&&(l||n)&&(this.chars=Cr(e,br));const h=this.words.length?this.words:this.chars;let d,c=0;for(let t=0,e=h.length;t<e;t++){const e=h[t],{top:s,height:i}=e.getBoundingClientRect();!j(d)&&s-d>.5*i&&c++,e.setAttribute(Tr,`${c}`);const r=e.querySelectorAll(`[${Tr}]`);let n=r.length;for(;n--;)r[n].setAttribute(Tr,`${c}`);d=s}if(l){const t=s.createDocumentFragment(),i=new Set,a=[];for(let t=0;t<c+1;t++){const s=e.cloneNode(!0);Rr(s,t,new Set).forEach(t=>{const e=t.parentNode;e&&(1===t.nodeType&&i.add(e),e.removeChild(t))}),a.push(s)}i.forEach(kr);for(let e=0,s=a.length;e<s;e++)Ir(r,this.lines,a[e],t,_r,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=Cr(e,vr)),o&&(this.chars=Cr(e,br))}if(this.linesOnly){const t=this.words;let e=t.length;for(;e--;){const s=t[e];s.replaceWith(s.textContent)}t.length=0}if(this.accessible&&(l||!i)){const t=s.createElement("span");t.style.cssText="position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;",t.innerHTML=this.html,e.insertBefore(t,e.firstChild),this.lines.forEach($r),this.words.forEach($r),this.chars.forEach($r)}return this.width=e.offsetWidth,(l||t)&&this.effects.forEach((t,e)=>this.effectsCleanups[e]=t(this)),this}refresh(){this.split(!0)}}const Ar=(t,e)=>new Or(t,e),Lr=(t,e)=>(console.warn("text.split() is deprecated, import splitText() directly, or text.splitText()"),new Or(t,e));var Br=Object.freeze({__proto__:null,TextSplitter:Or,split:Lr,splitText:Ar});export{Te as $,ds as Animatable,Ii as AutoLayout,Rs as Draggable,Ge as JSAnimation,As as Scope,Ws as ScrollObserver,xs as Spring,Or as TextSplitter,ls as Timeline,ye as Timer,di as WAAPIAnimation,Qe as animate,qi as clamp,Qt as cleanInlineStyles,cs as createAnimatable,Ds as createDraggable,dr as createDrawable,Oi as createLayout,ar as createMotionPath,Ls as createScope,Ki as createSeededRandom,ws as createSpring,hs as createTimeline,_e as createTimer,Qs as cubicBezier,Qi as damp,Ui as degToRad,De as eases,ti as easings,ie as engine,ts as get,Ks as irregular,Os as keepTime,Gi as lerp,Zs as linear,Hi as mapRange,cr as morphTo,qs as onScroll,zi as padEnd,Vi as padStart,Yi as radToDeg,Ji as random,tr as randomPick,ss as remove,ji as round,Mi as roundPad,Fs as scrollContainers,es as set,er as shuffle,Wi as snap,Lr as split,Ar as splitText,Ss as spring,sr as stagger,Js as steps,ur as svg,Is as sync,Br as text,ir as utils,ci as waapi,Xi as wrap};+const t="undefined"!=typeof window,e=t?window:null,s=t?document:null,i={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},r={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},n={NONE:0,AUTO:1,FORCE:2},o={replace:0,none:1,blend:2},a=Symbol(),l=Symbol(),h=Symbol(),d=Symbol(),c=Symbol(),u=1e-11,p=1e12,m=1e3,f=240,g="",y="var(",v=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),_=["perspective","translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY"],b=_.reduce((t,e)=>({...t,[e]:e+"("}),{}),T=()=>{},x=/\)\s*[-.\d]/,S=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,w=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,C=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,$=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,E=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,N=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,k=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,R=/([a-z])([A-Z])/g,A=/(\*=|\+=|-=)/,D=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,O={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:f,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:m,delay:0,loopDelay:0,ease:"out(2)",composition:o.replace,modifier:t=>t,onBegin:T,onBeforeUpdate:T,onUpdate:T,onLoop:T,onPause:T,onComplete:T,onRender:T},I={current:null,root:s},L={defaults:O,precision:4,timeScale:1,tickThreshold:200,editor:null},B={version:"4.4.0",engine:null};t&&(e.AnimeJS||(e.AnimeJS=[]),e.AnimeJS.push(B));const M=t=>t.replace(R,"$1-$2").toLowerCase(),P=(t,e)=>0===t.indexOf(e),F=Date.now,V=Array.isArray,X=t=>t&&t.constructor===Object,z=t=>"number"==typeof t&&!isNaN(t),H=t=>"string"==typeof t,Y=t=>"function"==typeof t,U=t=>void 0===t,W=t=>U(t)||null===t,q=e=>t&&e instanceof SVGElement,j=t=>S.test(t),G=t=>P(t,"rgb"),Z=t=>P(t,"hsl"),Q=t=>j(t)||(G(t)||Z(t))&&(")"===t[t.length-1]||!x.test(t)),J=t=>!L.defaults.hasOwnProperty(t),K=["opacity","rotate","overflow","color"],tt=(t,e)=>{if(K.includes(e))return!1;if(t.getAttribute(e)||e in t){if("scale"===e){const e=t.parentNode;return e&&"filter"===e.tagName}return!0}},et=t=>H(t)?parseFloat(t):t,st=Math.pow,it=Math.sqrt,rt=Math.sin,nt=Math.cos,ot=Math.abs,at=Math.exp,lt=Math.ceil,ht=Math.floor,dt=Math.asin,ct=Math.max,ut=Math.atan2,pt=Math.PI,mt=Math.round,ft=(t,e,s)=>t<e?e:t>s?s:t,gt=(t,e)=>{if(e<0)return t;if(!e)return mt(t);const s=10**e;return mt(t*s)/s},yt=(t,e)=>V(e)?e.reduce((e,s)=>ot(s-t)<ot(e-t)?s:e):e?mt(t/e)*e:t,vt=(t,e,s)=>t+(e-t)*s,_t=t=>t===1/0?p:t===-1/0?-p:t,bt=t=>t<=u?u:_t(gt(t,11)),Tt=t=>V(t)?[...t]:t,xt=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=U(r)?e[i]:r}return s},St=(t,e,s,i="_prev",r="_next")=>{let n=t._head,o=r;for(s&&(n=t._tail,o=i);n;){const t=n[o];e(n),n=t}},wt=(t,e,s="_prev",i="_next")=>{const r=e[s],n=e[i];r?r[i]=n:t._head=n,n?n[s]=r:t._tail=r,e[s]=null,e[i]=null},Ct=(t,e,s,i="_prev",r="_next")=>{let n=t._tail;for(;n&&s&&s(n,e);)n=n[i];const o=n?n[r]:t._head;n?n[r]=e:t._head=e,o?o[i]=e:t._tail=e,e[i]=n,e[r]=o},$t=(t,e,s)=>{const i=t.style.transform;if(i){const r=t[d];let n=0;const o=i.length;let a;for(;n<o;){for(;n<o&&32===i.charCodeAt(n);)n++;if(n>=o)break;const t=n;for(;n<o&&40!==i.charCodeAt(n);)n++;if(n>=o)break;const e=i.substring(t,n);let s=1;const l=n+1;let h=-1,d=-1;for(n++;n<o&&s>0;){const t=i.charCodeAt(n);40===t?s++:41===t?s--:44===t&&1===s&&(-1===h?h=n:-1===d&&(d=n)),n++}const c=n-1;"translate"===e||"translate3d"===e?(-1===h?r.translateX=i.substring(l,c).trim():(r.translateX=i.substring(l,h).trim(),-1===d?r.translateY=i.substring(h+1,c).trim():(r.translateY=i.substring(h+1,d).trim(),r.translateZ=i.substring(d+1,c).trim())),a=i.substring(l,c)):"scale"===e||"scale3d"===e?-1===h?r.scale=i.substring(l,c).trim():(r.scaleX=i.substring(l,h).trim(),-1===d?r.scaleY=i.substring(h+1,c).trim():(r.scaleY=i.substring(h+1,d).trim(),r.scaleZ=i.substring(d+1,c).trim())):r[e]=i.substring(l,c)}if("translate3d"===e&&a)return s&&(s[e]=a),a;const l=r[e];if(!U(l))return s&&(s[e]=l),l}return"translate3d"===e?"0px, 0px, 0px":"rotate3d"===e?"0, 0, 0, 0deg":P(e,"scale")?"1":P(e,"rotate")||P(e,"skew")?"0deg":"0px"},Et=t=>{let e=g;for(let s=0,i=_.length;s<i;s++){const i=_[s],r=t[i];if(void 0!==r){if("translateX"===i){const i=t.translateY;if(void 0!==i){const n=t.translateZ;void 0!==n?(e+=`translate3d(${r},${i},${n}) `,s+=2):(e+=`translate(${r},${i}) `,s+=1);continue}}if("scaleX"===i&&void 0===t.scale){const i=t.scaleY;if(void 0!==i){const n=t.scaleZ;void 0!==n?(e+=`scale3d(${r},${i},${n}) `,s+=2):(e+=`scale(${r},${i}) `,s+=1);continue}}e+=`${b[i]}${r}) `}"rotateZ"===i&&void 0!==t.rotate3d&&(e+=`rotate3d(${t.rotate3d}) `)}return void 0!==t.matrix&&(e+=`matrix(${t.matrix}) `),void 0!==t.matrix3d&&(e+=`matrix3d(${t.matrix3d}) `),e},Nt=t=>{const e=w.exec(t)||C.exec(t),s=U(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]},kt=t=>{const e=t.length,s=4===e||5===e;return[+("0x"+t[1]+t[s?1:2]),+("0x"+t[s?2:3]+t[s?2:4]),+("0x"+t[s?3:5]+t[s?3:6]),5===e||9===e?+(+("0x"+t[s?4:7]+t[s?4:8])/255).toFixed(3):1]},Rt=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t),At=t=>{const e=$.exec(t)||E.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=U(e[4])?1:+e[4];let o,a,l;if(0===i)o=a=l=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=gt(255*Rt(e,t,s+1/3),0),a=gt(255*Rt(e,t,s),0),l=gt(255*Rt(e,t,s-1/3),0)}return[o,a,l,n]},Dt=t=>G(t)?Nt(t):j(t)?kt(t):Z(t)?At(t):[0,0,0,1],Ot=(t,e)=>U(t)?e:t,It=(t,e,s,i,r,n)=>{let o;if(Y(t))o=()=>{const r=t(e,s,i,n);return isNaN(+r)?r||0:+r};else{if(!H(t)||!P(t,y))return t;o=()=>{const s=t.match(D),i=s[1],r=s[2];let n=getComputedStyle(e)?.getPropertyValue(i);return n&&n.trim()!==g||!r||(n=r.trim()),n||0}}return r&&(r.func=o),o()},Lt=(t,e)=>t[l]?t[h]&&tt(t,e)?i.ATTRIBUTE:_.includes(e)||v.get(e)?i.TRANSFORM:P(e,"--")?i.CSS_VAR:e in t.style?i.CSS:e in t?i.OBJECT:i.ATTRIBUTE:i.OBJECT,Bt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[c]||t).getPropertyValue(e);return"auto"===r?"0":r},Mt=(t,e,s,r)=>{const n=U(s)?Lt(t,e):s;if(n===i.OBJECT){const s=t[e];return s&&r&&(r[e]=s),s||0}if(n===i.ATTRIBUTE){const s=t.getAttribute(e);return s&&r&&(r[e]=s),s}return n===i.TRANSFORM?$t(t,e,r):n===i.CSS_VAR?Bt(t,e,r).trimStart():Bt(t,e,r)},Pt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Ft=()=>({t:r.NUMBER,n:0,u:null,o:null,d:null,s:null}),Vt=(t,e)=>{if(e.t=r.NUMBER,e.n=0,e.u=null,e.o=null,e.d=null,e.s=null,!t)return e;const s=+t;if(isNaN(s)){let s=t;"="===s[1]&&(e.o=s[0],s=s.slice(2));const i=!s.includes(" ")&&k.exec(s);if(i)return e.t=r.UNIT,e.n=+i[1],e.u=i[2],e;if(e.o)return e.n=+s,e;if(Q(s))return e.t=r.COLOR,e.d=Dt(s),e;{const t=s.match(N);return e.t=r.COMPLEX,e.d=t?t.map(Number):[],e.s=s.split(N)||[],e}}return e.n=s,e},Xt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=Tt(t._toNumbers),e.s=Tt(t._strings),e),zt=Ft(),Ht=(t,e,s)=>{const i=t._modifier,r=t._fromNumbers,n=t._toNumbers,a=gt(ft(i(vt(r[0],n[0],e)),0,255),0),l=gt(ft(i(vt(r[1],n[1],e)),0,255),0),h=gt(ft(i(vt(r[2],n[2],e)),0,255),0),d=ft(i(gt(vt(r[3],n[3],e),s)),0,1);if(t._composition!==o.none){const e=t._numbers;e[0]=a,e[1]=l,e[2]=h,e[3]=d}return`rgba(${a},${l},${h},${d})`},Yt=(t,e,s)=>{const i=t._modifier,r=t._fromNumbers,n=t._toNumbers,a=t._strings,l=t._composition!==o.none;let h=a[0];for(let o=0,d=n.length;o<d;o++){const d=i(gt(vt(r[o],n[o],e),s)),c=a[o+1];h+=`${c?d+c:d}`,l&&(t._numbers[o]=d)}return h},Ut=(t,e,s,a,l)=>{const h=t.parent,c=t.duration,p=t.completed,m=t.iterationDuration,f=t.iterationCount,g=t._currentIteration,y=t._loopDelay,v=t._reversed,_=t._alternate,b=t._hasChildren,T=t._delay,x=t._currentTime,S=T+m,w=e-T,C=ft(x,-T,c),$=ft(w,-T,c),E=w-x,N=$>0,k=$>=c,R=c<=u,A=l===n.FORCE;let D=0,O=w,I=0;if(f>1){const e=~~($/(m+(k?0:y)));t._currentIteration=ft(e,0,f),k&&t._currentIteration--,D=t._currentIteration%2,O=$%(m+y)||0}const B=v^(_&&D),M=t._ease;let P=k?B?0:c:B?m-O:O;M&&(P=m*M(P/m)||0);const F=(h?h.backwards:w<x)?!B:!!B;if(t._currentTime=w,t._iterationTime=P,t.backwards=F,N&&!t.began?(t.began=!0,s||h&&(F||!h.began)||t.onBegin(t)):w<=0&&(t.began=!1),s||b||!N||t._currentIteration===g||t.onLoop(t),A||l===n.AUTO&&(e>=T&&e<=S||e<=T&&C>T||e>=S&&C!==c)||P>=S&&C!==c||P<=T&&C>0||e<=C&&C===c&&p||k&&!p&&R){if(N&&(t.computeDeltaTime(C),s||t.onBeforeUpdate(t)),!b){const e=A||(F?-1*E:E)>=L.tickThreshold,n=t._offset+(h?h._offset:0)+T+P;let l,c,u,p,m=t._head,f=0;for(;m;){const t=m._composition,s=m._currentTime,h=m._changeDuration,g=m._absoluteStartTime+m._changeDuration,y=m._nextRep,v=m._prevRep,_=t!==o.none;if((e||(s!==h||n<=g+(y?y._delay:0))&&(0!==s||n>=m._absoluteStartTime))&&(!_||!m._isOverridden&&(!m._isOverlapped||n<=g)&&(!y||y._isOverridden||n<=y._absoluteStartTime)&&(!v||v._isOverridden||n>=v._absoluteStartTime+v._changeDuration+m._delay))){const e=m._currentTime=ft(P-m._startTime,0,h),s=m._ease(e/m._updateDuration),n=m._modifier,g=m._valueType,y=m._tweenType,v=y===i.OBJECT,b=g===r.NUMBER,T=b&&v||0===s||1===s?-1:L.precision;let x,S;if(b?x=S=n(gt(vt(m._fromNumber,m._toNumber,s),T)):g===r.UNIT?(S=n(gt(vt(m._fromNumber,m._toNumber,s),T)),x=`${S}${m._unit}`):g===r.COLOR?x=Ht(m,s,T):g===r.COMPLEX&&(x=Yt(m,s,T)),_&&(m._number=S),a||t===o.blend)m._value=x;else{const t=m.property;l=m.target,v?l[t]=x:y===i.ATTRIBUTE?l.setAttribute(t,x):(c=l.style,y===i.TRANSFORM?(l!==u&&(u=l,p=l[d]),p[t]=x,f=1):y===i.CSS?c[t]=x:y===i.CSS_VAR&&c.setProperty(t,x)),N&&(I=1)}}f&&m._renderTransforms&&(c.transform=Et(p),f=0),m=m._next}!s&&I&&t.onRender(t)}!s&&N&&t.onUpdate(t)}return h&&R?!s&&(h.began&&!F&&w>0&&!p||F&&w<=u&&p)&&(t.onComplete(t),t.completed=!F):N&&k?f===1/0?t._startTime+=t.duration:t._currentIteration>=f-1&&(t.paused=!0,p||b||(t.completed=!0,s||h&&(F||!h.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,I};let Wt=0,qt=0,jt=0,Gt=0,Zt=0,Qt=0,Jt=0,Kt=!0,te=!1,ee=0,se=0;const ie=t=>{if(te){const e=t.duration,s=t._offset+t._delay;se||!(e<=u)||s&&s+e!==ee||t.onComplete(t)}else!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&Ut(t,ee,se,1,n.FORCE),t.began=!1,t.completed=!1},re=t=>{const e=gt((Wt-t._offset)*t._speed,12),s=t._fps<qt?t.requestTick(jt):Gt;Jt+=Ut(t,e,Zt,Qt,s),!t.completed&&Kt&&(Kt=!1)},ne=(t,e,s,i,r)=>{const n=t._currentIteration;if(Ut(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,l=i?e:o._iterationTime,h=F();let d=0,c=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;te=a,ee=t,se=s,St(o,ie),s||o.onLoop(o)}Wt=l,qt=o._fps,jt=h,Gt=r,Zt=s,Qt=i,Jt=0,Kt=!0,St(o,re,a),d=Jt,c=Kt,!s&&d&&o.onRender(o),(c||a)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},oe={},ae=(t,e,s)=>{if(s===i.TRANSFORM)return v.get(t)||t;if(s===i.CSS||s===i.ATTRIBUTE&&q(e)&&t in e.style){const e=oe[t];if(e)return e;{const e=t?M(t):t;return oe[t]=e,e}}return t},le=(t,e=!1)=>{if(t._hasChildren)St(t,t=>le(t,e),!0);else{const s=t;s.pause(),St(s,t=>{const r=t.property,n=t.target,o=t._tweenType,a=t._inlineValue,h=W(a)||a===g;if(o===i.OBJECT)e||h||(n[r]=a);else if(n[l])if(o===i.ATTRIBUTE)e||(h?n.removeAttribute(r):n.setAttribute(r,a));else{const e=n.style;if(o===i.TRANSFORM){const s=n[d];h?delete s[r]:s[r]=a,t._renderTransforms&&(Object.keys(s).length?e.transform=Et(s):e.removeProperty("transform"))}else h?e.removeProperty(M(r)):e[r]=a}n[l]&&s._tail===t&&s.targets.forEach(t=>{t.getAttribute&&t.getAttribute("style")===g&&t.removeAttribute("style")})})}return t},he=t=>le(t,!0);class de{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._lastTickTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=m/f,this._fps=f,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(t){const e=this._frameDuration,s=+t,i=s<u?u:s,r=m/i;i>O.frameRate&&(O.frameRate=i),this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<u?u:e}requestTick(t){const e=this._scheduledTime;if(this._lastTickTime=t,t<e)return n.NONE;const s=this._frameDuration,i=t-e;return this._scheduledTime+=i<s?s:i,n.AUTO}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const ce={animation:null,update:T},ue=t=>{let e=ce.animation;return e||(e={duration:u,computeDeltaTime:T,_offset:0,_delay:0,_head:null,_tail:null},ce.animation=e,ce.update=()=>{t.forEach(t=>{for(let e in t){const s=t[e],i=s._head;if(i){const t=i._valueType,e=t===r.COMPLEX||t===r.COLOR?Tt(i._fromNumbers):null;let n=i._fromNumber,o=s._tail;for(;o&&o!==i;){if(e)for(let t=0,s=o._numbers.length;t<s;t++)e[t]+=o._numbers[t];else n+=o._number;o=o._prevAdd}i._toNumber=n,i._toNumbers=e}}}),Ut(e,1,1,0,n.FORCE)}),e},pe=(()=>t?requestAnimationFrame:setImmediate)(),me=(()=>t?cancelAnimationFrame:clearImmediate)();class fe extends de{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=O,this.paused=!0,this.reqId=0}update(){const t=this._currentTime=F();if(this.requestTick(t)){this.computeDeltaTime(t);const e=this._speed,s=this._fps;let i=this._head;for(;i;){const r=i._next;i.paused?(wt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):ne(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):n.AUTO),i=r}ce.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(F()),this.reqId=pe(ye)),this}pause(){if(this.reqId)return this.paused=!0,ve()}resume(){if(this.paused)return this.paused=!1,St(this,t=>t.resetTime()),this.wake()}get speed(){return this._speed*(1===L.timeScale?1:m)}set speed(t){this._speed=t*L.timeScale,St(this,t=>t.speed=t._speed)}get timeUnit(){return 1===L.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(L.timeScale!==s){L.timeScale=s,L.tickThreshold=200*s;const t=e?.001:m;this.defaults.duration*=t,this._speed*=t}}get precision(){return L.precision}set precision(t){L.precision=t}}const ge=(()=>{const e=new fe(F());return t&&(B.engine=e,s.addEventListener("visibilitychange",()=>{e.pauseOnDocumentHidden&&(s.hidden?e.pause():e.resume())})),e})(),ye=()=>{ge._head?(ge.reqId=pe(ye),ge.update()):ge.reqId=0},ve=()=>(me(ge.reqId),ge.reqId=0,ge),_e={_rep:new WeakMap,_add:new Map},be=(t,e,s="_rep")=>{const i=_e[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},Te=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,xe=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=u,t._currentTime=u},Se=(t,e)=>{const s=t._composition;if(s===o.replace){const s=t._absoluteStartTime;Ct(e,t,Te,"_prevRep","_nextRep");const i=t._prevRep;if(i){const e=i.parent,r=i._absoluteStartTime+i._changeDuration;if(t.parent.id!==e.id&&e.iterationCount>1&&r+(e.duration-e.iterationDuration)>s){xe(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)xe(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration),s=gt(n-e-t,12);i._changeDuration=s,i._currentTime=s,i._isOverlapped=1,s<u&&xe(i)}let o=!0;if(St(e,t=>{t._isOverlapped||(o=!1)}),o){const t=e.parent;if(t){let s=!0;St(t,t=>{t!==e&&St(t,t=>{t._isOverlapped||(s=!1)})}),s&&t.cancel()}else e.cancel()}}}else if(s===o.blend){const e=be(t.target,t.property,"_add"),s=ue(_e._add);let i=e._head;i||(i={...t},i._composition=o.replace,i._updateDuration=u,i._startTime=0,i._numbers=Tt(t._fromNumbers),i._number=0,i._next=null,i._prev=null,Ct(e,i),Ct(s,i));const r=t._toNumber;if(t._fromNumber=i._fromNumber-r,t._toNumber=0,t._numbers=Tt(t._fromNumbers),t._number=0,i._fromNumber=r,t._toNumbers){const e=Tt(t._toNumbers);e&&e.forEach((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0}),i._fromNumbers=e}Ct(e,t,null,"_prevAdd","_nextAdd")}return t},we=t=>{const e=t._composition;if(e!==o.none){const s=t.target,i=t.property,r=_e._rep.get(s)[i];if(wt(r,t,"_prevRep","_nextRep"),e===o.blend){const e=_e._add,r=e.get(s);if(!r)return;const n=r[i],o=ce.animation;wt(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){wt(n,a,"_prevAdd","_nextAdd"),wt(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},Ce=(t,e,s)=>{let r=!1;return St(e,n=>{const o=n.target;if(t.includes(o)){const t=n.property,a=n._tweenType,l=ae(s,o,a);(!l||l&&l===t)&&(n.parent._tail===n&&n._tweenType===i.TRANSFORM&&n._prev&&n._prev._tweenType===i.TRANSFORM&&(n._prev._renderTransforms=1),wt(e,n),we(n),r=!0)}},!0),r},$e=(t,e,s)=>{const i=e||ge;let r;if(i._hasChildren){let e=0;St(i,n=>{if(!n._hasChildren)if(r=Ce(t,n,s),r&&!n._head)n.cancel(),wt(i,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?$e(t,n,s):n._hasChildren=!1},!0),U(i.iterationDuration)||(i.iterationDuration=e)}else r=Ce(t,i,s);r&&!i._head&&(i._hasChildren=!1,i.cancel&&i.cancel())},Ee=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),Ne=t=>t._cancelled?(t._hasChildren?St(t,Ne):St(t,t=>{t._composition!==o.none&&Se(t,be(t.target,t.property))}),t._cancelled=0,t):t;let ke=0;const Re=(t,e)=>t._priority>e._priority;class Ae extends de{constructor(t={},e=null,s=0){super(0),++ke;const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:l,loopDelay:h,autoplay:d,frameRate:c,playbackRate:p,priority:m,onComplete:f,onLoop:g,onPause:y,onBegin:v,onBeforeUpdate:_,onUpdate:b}=t;I.current&&I.current.register(this);const x=e?0:ge._lastTickTime,S=e?e.defaults:L.defaults,w=Y(r)||U(r)?S.delay:+r,C=Y(n)||U(n)?1/0:+n,$=Ot(l,S.loop),E=Ot(h,S.loopDelay);let N=!0===$||$===1/0||$<0?1/0:$+1,k=0;e?k=s:(ge.reqId||ge.requestTick(F()),k=(ge._lastTickTime-ge._startTime)*L.timeScale),this.id=U(i)?ke:i,this.parent=e,this.duration=_t((C+E)*N-E)||u,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=v||S.onBegin,this.onBeforeUpdate=_||S.onBeforeUpdate,this.onUpdate=b||S.onUpdate,this.onLoop=g||S.onLoop,this.onPause=y||S.onPause,this.onComplete=f||S.onComplete,this.iterationDuration=C,this.iterationCount=N,this._autoplay=!e&&Ot(d,S.autoplay),this._offset=k,this._delay=w,this._loopDelay=E,this._iterationTime=0,this._currentIteration=0,this._resolve=T,this._running=!1,this._reversed=+Ot(o,S.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Ot(a,S.alternate),this._prev=null,this._next=null,this._lastTickTime=x,this._startTime=x,this._lastTime=x,this._fps=Ot(c,S.frameRate),this._speed=Ot(p,S.playbackRate),this._priority=+Ot(m,1)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(!0).play()}get currentTime(){return ft(gt(this._currentTime,L.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return ft(gt(this._iterationTime,L.precision),0,this.iterationDuration)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return ft(gt(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return ft(gt(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(t){const e=this.iterationDuration;this.currentTime=e*this._currentIteration+e*t}get currentIteration(){return this._currentIteration}set currentIteration(t){this.currentTime=this.iterationDuration*ft(+t,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(t){t?this.reverse():this.play()}get speed(){return super.speed}set speed(t){super.speed=t,this.resetTime()}reset(t=!1){return Ne(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,ne(this,0,1,~~t,n.FORCE),Ee(this),this._hasChildren&&St(this,Ee),this}init(t=!1){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&ne(this,this.duration,1,~~t,n.FORCE),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!U(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*ge._speed);return this._startTime=F()-(this._currentTime+this._delay)*t,this}pause(){return this.paused||(this.paused=!0,this.onPause(this)),this}resume(){return this.paused?(this.paused=!1,this.duration<=u&&!this._hasChildren?ne(this,u,0,0,n.FORCE):(this._running||(Ct(ge,this,Re),ge._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,ge.wake()),this):this}restart(){return this.reset().resume()}seek(t,e=0,s=0){Ne(this),this.completed=!1;const i=this.paused;return this.paused=!0,ne(this,t+this._delay,~~e,~~s,n.AUTO),i?this:this.resume()}alternate(){const t=this._reversed,e=this.iterationCount,s=this.iterationDuration,i=e===1/0?ht(p/s):e;return this._reversed=+(!this._alternate||i%2?!t:t),e===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(s*i-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?St(this,t=>t.cancel(),!0):St(this,we),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=bt(t);if(e===s)return this;const i=t/e,r=t<=u;return this.duration=r?u:s,this.iterationDuration=r?u:bt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){ne(this,0,1,0,n.AUTO);const t=this._autoplay;return t&&t.linked&&t.linked===this&&t.revert(),this.cancel()}complete(t=0){return this.seek(this.duration,t).cancel()}then(t=T){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=T};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const De=t=>new Ae(t,null,0).init();function Oe(t){const e=H(t)?I.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function Ie(e){if(W(e))return[];if(!t)return V(e)&&e.flat(1/0)||[e];if(V(e)){const t=e.flat(1/0),s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!W(i)){const t=Oe(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!W(i)){let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}else{let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}}return s}const s=Oe(e);return s?Array.from(s):[e]}function Le(t){const e=Ie(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[a]){s[a]=!0;const t=q(s);(s.nodeType||t)&&(s[l]=!0,s[h]=t,s[d]={})}}return e}const Be={deg:1,rad:180/pt,turn:360},Me={},Pe=(t,e,i,n=!1)=>{const o=e.u,a=e.n;if(e.t===r.UNIT&&o===i)return e;const l=a+o+i,h=Me[l];if(U(h)||n){let r;if(o in Be)r=a*Be[o]/Be[i];else{const e=100,n=t.cloneNode(),l=t.parentNode,h=l&&l!==s?l:s.body;h.appendChild(n);const d=n.style;d.width=e+o;const c=n.offsetWidth||e;d.width=e+i;const u=c/(n.offsetWidth||e);h.removeChild(n),r=u*a}e.n=r,Me[l]=r}else e.n=h;return e.t,e.u=i,e},Fe=t=>t,Ve=(t=1.68)=>e=>st(e,+t),Xe={in:t=>e=>t(e),out:t=>e=>1-t(1-e),inOut:t=>e=>e<.5?t(2*e)/2:1-t(-2*e+2)/2,outIn:t=>e=>e<.5?(1-t(1-2*e))/2:(t(2*e-1)+1)/2},ze=pt/2,He=2*pt,Ye={[g]:Ve,Quad:Ve(2),Cubic:Ve(3),Quart:Ve(4),Quint:Ve(5),Sine:t=>1-nt(t*ze),Circ:t=>1-it(1-t*t),Expo:t=>t?st(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=st(2,--s))-1)/11;);return 1/st(4,3-s)-7.5625*st((3*e-2)/22-t,2)},Back:(t=1.7)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=ft(+t,1,10),i=ft(+e,u,2),r=i/He*dt(1/s),n=He/i;return t=>0===t||1===t?t:-s*st(2,-10*(1-t))*rt((1-t-r)*n)}},Ue=(()=>{const t={linear:Fe,none:Fe};for(let e in Xe)for(let s in Ye){const i=Ye[s],r=Xe[e];t[e+s]=s===g||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),We={linear:Fe,none:Fe},qe=t=>{if(We[t])return We[t];if(t.indexOf("(")<=-1){const e=Xe[t]||t.includes("Back")||t.includes("Elastic")?Ue[t]():Ue[t];return e?We[t]=e:Fe}{const e=t.slice(0,-1).split("("),s=Ue[e[0]];return s?We[t]=s(...e[1].split(",")):Fe}},je=["steps(","irregular(","linear(","cubicBezier("],Ge=t=>{if(H(t))for(let e=0,s=je.length;e<s;e++)if(P(t,je[e]))return console.warn(`String syntax for \`ease: "${t}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${t}\``),Fe;return Y(t)?t:H(t)?qe(t):Fe},Ze=Ft(),Qe=Ft(),Je={},Ke={func:null},ts={func:null},es=[null],ss=[null,null],is={to:null};let rs,ns,os=0,as=0;const ls=(t,e)=>{const s={};if(V(t)){const e=[].concat(...t.map(t=>Object.keys(t))).filter(J);for(let i=0,r=e.length;i<r;i++){const r=e[i],n=t.map(t=>{const e={};for(let s in t){const i=t[s];J(s)?s===r&&(e.to=i):e[s]=i}return e});s[r]=n}}else{const i=Ot(e.duration,L.defaults.duration),r=Object.keys(t).map(e=>({o:parseFloat(e)/100,p:t[e]})).sort((t,e)=>t.o-e.o);r.forEach(t=>{const e=t.o,r=t.p;for(let t in r)if(J(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let a=n.length,l=n[a-1];const h={to:r[t]};let d=0;for(let t=0;t<a;t++)d+=n[t].duration;1===a&&(h.from=l.to),r.ease&&(h.ease=r.ease),h.duration=o-(a?d:0),n.push(h)}return t});for(let t in s){const e=s[t];let i;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.ease;s.ease=i||void 0,i=r}e[0].duration||e.shift()}}return s};class hs extends Ae{constructor(t,e,s,n,a=!1,l=0,h){super(e,s,n),++as;const d=Le(t),c=d.length,p=e.keyframes,f=p?xt(ls(p,e),e):e,{id:g,delay:y,duration:v,ease:_,playbackEase:b,modifier:T,composition:x,onRender:S}=f,w=s?s.defaults:L.defaults,C=Ot(_,w.ease),$=Ot(b,w.playbackEase),E=$?Ge($):null,N=!U(C.ease),k=N?C.ease:Ot(_,E?"linear":w.ease),R=N?C.settlingDuration:Ot(v,w.duration),A=Ot(y,w.delay),D=T||w.modifier,O=U(x)&&c>=m?o.none:U(x)?w.composition:x,I=this._offset+(s?s._offset:0);N&&(C.parent=this);let B=NaN,M=NaN,P=0,F=0;for(let t=0;t<c;t++){const e=d[t],n=l||t,c=h||d;let p=NaN,m=NaN;for(let t in f)if(J(t)){const l=Lt(e,t),h=ae(t,e,l);let d=f[t];const g=V(d);if(a&&!g&&(ss[0]=d,ss[1]=d,d=ss),g){const t=d.length,e=!X(d[0]);2===t&&e?(is.to=d,es[0]=is,rs=es):t>2&&e?(rs=[],d.forEach((t,e)=>{e?1===e?(ss[1]=t,rs.push(ss)):rs.push(t):ss[0]=t})):rs=d}else es[0]=d,rs=es;let y=null,v=null,_=NaN,b=0,T=0;for(let t=rs.length;T<t;T++){const i=rs[T];X(i)?ns=i:(is.to=i,ns=is),Ke.func=null,ts.func=null;const a=It(Ot(ns.composition,O),e,n,c,null,null),d=z(a)?a:o[a];y||d===o.none||(y=be(e,h));const p=y?y._tail:null,m=s&&p&&p.parent.parent===s?p:v,f=It(ns.to,e,n,c,Ke,m);let g;X(f)&&!U(f.to)?(ns=f,g=f.to):g=f;const x=It(ns.from,e,n,c,null,m),S=ns.ease||k,w=It(S,e,n,c,null,m),C=Y(w)||H(w)?w:S,$=!U(C)&&!U(C.ease),E=$?C.ease:C,N=$?C.settlingDuration:It(Ot(ns.duration,t>1?It(R,e,n,c,null,m)/t:R),e,n,c,null,m),L=It(Ot(ns.delay,T?0:A),e,n,c,null,m),B=ns.modifier||D,M=!U(x),q=!U(g),j=V(g),G=j||M&&q,Z=v?b+L:L,Q=gt(I+Z,12);F||!M&&!j||(F=1);let J=v;if(d!==o.none){let t=y._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=Q;)if(J=t,t=t._nextRep,t&&t._absoluteStartTime>=Q)for(;t;)xe(t),t=t._nextRep}if(G){Vt(j?It(g[0],e,n,c,ts,m):x,Ze),Vt(j?It(g[1],e,n,c,Ke,m):g,Qe);const t=Mt(e,h,l,Je);Ze.t===r.NUMBER&&(J?J._valueType===r.UNIT&&(Ze.t=r.UNIT,Ze.u=J._unit):(Vt(t,zt),zt.t===r.UNIT&&(Ze.t=r.UNIT,Ze.u=zt.u)))}else q?Vt(g,Qe):v?Xt(v,Qe):Vt(s&&J&&J.parent.parent===s?J._value:Mt(e,h,l,Je),Qe),M?Vt(x,Ze):v?Xt(v,Ze):Vt(s&&J&&J.parent.parent===s?J._value:Mt(e,h,l,Je),Ze);if(Ze.o&&(Ze.n=Pt(J?J._toNumber:Vt(Mt(e,h,l,Je),zt).n,Ze.n,Ze.o)),Qe.o&&(Qe.n=Pt(Ze.n,Qe.n,Qe.o)),Ze.t!==Qe.t)if(Ze.t===r.COMPLEX||Qe.t===r.COMPLEX){const t=Ze.t===r.COMPLEX?Ze:Qe,e=Ze.t===r.COMPLEX?Qe:Ze;e.t=r.COMPLEX,e.s=Tt(t.s),e.d=t.d.map(()=>e.n)}else if(Ze.t===r.UNIT||Qe.t===r.UNIT){const t=Ze.t===r.UNIT?Ze:Qe,e=Ze.t===r.UNIT?Qe:Ze;e.t=r.UNIT,e.u=t.u}else if(Ze.t===r.COLOR||Qe.t===r.COLOR){const t=Ze.t===r.COLOR?Ze:Qe,e=Ze.t===r.COLOR?Qe:Ze;e.t=r.COLOR,e.s=t.s,e.d=[0,0,0,1]}if(Ze.u!==Qe.u){let t=Qe.u?Ze:Qe;t=Pe(e,t,Qe.u?Qe.u:Ze.u,!1)}if(Qe.d&&Ze.d&&Qe.d.length!==Ze.d.length){const t=Ze.d.length>Qe.d.length?Ze:Qe,e=t===Ze?Qe:Ze;e.d=t.d.map((t,s)=>U(e.d[s])?0:e.d[s]),e.s=Tt(t.s)}const K=gt(+N||u,12);let tt=Je[h];W(tt)||(Je[h]=null);const et={parent:this,id:os++,property:h,target:e,_value:null,_toFunc:Ke.func,_fromFunc:ts.func,_ease:Ge(E),_fromNumbers:Tt(Ze.d),_toNumbers:Tt(Qe.d),_strings:Tt(Qe.s),_fromNumber:Ze.n,_toNumber:Qe.n,_numbers:Tt(Ze.d),_number:Ze.n,_unit:Qe.u,_modifier:B,_currentTime:0,_startTime:Z,_delay:+L,_updateDuration:K,_changeDuration:K,_absoluteStartTime:Q,_tweenType:l,_valueType:Qe.t,_composition:d,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:tt,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};d!==o.none&&Se(et,y);const st=et._valueType;et._value=st===r.COMPLEX?Yt(et,1,-1):st===r.COLOR?Ht(et,1,-1):st===r.UNIT?`${B(et._toNumber)}${et._unit}`:B(et._toNumber),isNaN(_)&&(_=et._startTime),b=gt(Z+K,12),v=et,P++,Ct(this,et)}(isNaN(M)||_<M)&&(M=_),(isNaN(B)||b>B)&&(B=b),l===i.TRANSFORM&&(p=P-T,m=P)}if(!isNaN(p)){let t=0;St(this,e=>{t>=p&&t<m&&(e._renderTransforms=1,e._composition===o.blend&&St(ce.animation,t=>{t.id===e.id&&(t._renderTransforms=1)})),t++})}}c||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),M?(St(this,t=>{t._startTime-t._delay||(t._delay-=M),t._startTime-=M}),B-=M):M=0,B||(B=u,this.iterationCount=0),this.targets=d,this.id=U(g)?as:g,this.duration=B===u?u:_t((B+this._loopDelay)*this.iterationCount-this._loopDelay)||u,this.onRender=S||w.onRender,this._ease=E,this._delay=M,this.iterationDuration=B,!this._autoplay&&F&&this.onRender(this)}stretch(t){const e=this.duration;if(e===bt(t))return this;const s=t/e;return St(this,t=>{t._updateDuration=bt(t._updateDuration*s),t._changeDuration=bt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s}),super.stretch(t)}refresh(){return St(this,t=>{const e=t._toFunc,s=t._fromFunc;(e||s)&&(s?(Vt(s(),Ze),Ze.u!==t._unit&&t.target[l]&&Pe(t.target,Ze,t._unit,!0),t._fromNumbers=Tt(Ze.d),t._fromNumber=Ze.n):e&&(Vt(Mt(t.target,t.property,t._tweenType),zt),t._fromNumbers=Tt(zt.d),t._fromNumber=zt.n),e&&(Vt(e(),Qe),t._toNumbers=Tt(Qe.d),t._strings=Tt(Qe.s),t._toNumber=Qe.o?Pt(t._fromNumber,Qe.n,Qe.o):Qe.n))}),this.duration===u&&this.restart(),this}revert(){return super.revert(),le(this)}then(t){return super.then(t)}}const ds=(t,e)=>L.editor?L.editor.addAnimation(t,e):new hs(t,e,null,0,!1).init(),cs=(t,e)=>{if(P(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}},us=(t,e)=>{let s=t.iterationDuration;if(s===u&&(s=0),U(e))return s;if(z(+e))return+e;const i=e,r=t?t.labels:null,n=!W(r),o=cs(t,i),a=!U(o),l=A.exec(i);if(l){const t=l[0],e=i.split(t),h=n&&e[0]?r[e[0]]:s,d=a?o:n?h:s,c=+e[1];return Pt(d,c,t[0])}return a?o:n?U(r[i])?s:r[i]:s};function ps(t){return _t((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||u}function ms(t,e,s,i,r,o){const a=z(t.duration)&&t.duration<=u?s-u:s;e.composition&&ne(e,a,1,1,n.AUTO);const l=i?new hs(i,t,e,a,!1,r,o):new Ae(t,e,a);return e.composition&&l.init(!0),Ct(e,l),St(e,t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)}),e.duration=ps(e),e}let fs=0;class gs extends Ae{constructor(t={}){super(t,null,0),++fs,this.id=U(t.id)?fs:t.id,this.duration=0,this.labels={};const e=t.defaults,s=L.defaults;this.defaults=e?xt(e,s):s,this.composition=Ot(t.composition,!0),this.onRender=t.onRender||s.onRender;const i=Ot(t.playbackEase,s.playbackEase);this._ease=i?Ge(i):null,this.iterationDuration=0}add(t,e,s){const i=X(e),r=X(t);if(i||r){if(this._hasChildren=!0,i){const i=e,r=L.editor&&L.editor.addTimelineChild,n=s&&"Stagger"===s.type&&L.editor,o=Y(s)?s:null;if(o||n){const e=Ie(t),n=this.duration,a=this.iterationDuration,l=i.id;let h=0;const d=e.length,c=r?r(t,i,this.id,s,d):null,u=o||L.editor.resolveStagger(s.defaultValue);e.forEach(t=>{const s={...c||i};this.duration=n,this.iterationDuration=a,U(l)||(s.id=l+"-"+h),ms(s,this,us(this,u(t,h,e,null,this)),t,h,e),h++})}else{const e=r?r(t,i,this.id,s):i,n=s&&s.type?s.defaultValue:s;ms(e,this,us(this,n),t)}}else ms(t,this,us(this,e));return this.composition&&this.init(!0),this}}sync(t,e){if(U(t)||t&&U(t.pause))return this;t.pause();const s=+(t.effect?t.effect.getTiming().duration:t.duration);return U(t)||U(t.persist)||(t.persist=!0),this.add(t,{currentTime:[0,s],duration:s,delay:0,ease:"linear",playbackEase:"linear"},e)}set(t,e,s){return U(e)?this:(e.duration=u,e.composition=o.replace,this.add(t,e,s))}call(t,e){return U(t)||t&&!Y(t)?this:this.add({duration:0,delay:0,onComplete:()=>t(this)},e)}label(t,e){return U(t)||t&&!H(t)||(this.labels[t]=us(this,e)),this}remove(t,e){return $e(Ie(t),this,e),this}stretch(t){const e=this.duration;if(e===bt(t))return this;const s=t/e,i=this.labels;St(this,t=>t.stretch(t.duration*s));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return St(this,t=>{t.refresh&&t.refresh()}),this}revert(){return super.revert(),St(this,t=>t.revert,!0),le(this)}then(t){return super.then(t)}}const ys=t=>L.editor?L.editor.addTimeline(t):new gs(t).init();class vs{constructor(t,e){I.current&&I.current.register(this);const s=()=>{if(this.callbacks.completed)return;let t=!0;for(let e in this.animations)if(!this.animations[e].paused&&t){t=!1;break}t&&this.callbacks.complete()},i={onBegin:()=>{this.callbacks.completed&&this.callbacks.reset(),this.callbacks.play()},onComplete:s,onPause:s},r={v:1,autoplay:!1},n={};if(this.targets=[],this.animations={},this.callbacks=null,!U(t)&&!U(e)){for(let t in e){const s=e[t];J(t)?n[t]=s:P(t,"on")?r[t]=s:i[t]=s}this.callbacks=new hs({v:0},r);for(let e in n){const s=n[e],r=X(s);let a={},l="+=0";if(r){const t=s.unit;H(t)&&(l+=t)}else a.duration=s;a[e]=r?xt({to:l},s):l;const h=xt(i,a);h.composition=o.replace,h.autoplay=!1;const d=this.animations[e]=new hs(t,h,null,0,!1).init();this.targets.length||this.targets.push(...d.targets),this[e]=(t,e,s)=>{const i=d._head;if(U(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return St(d,e=>{if(V(t))for(let s=0,i=t.length;s<i;s++)U(e._numbers[s])||(e._fromNumbers[s]=e._modifier(e._numbers[s]),e._toNumbers[s]=t[s]);else e._fromNumber=e._modifier(e._number),e._toNumber=t;U(s)||(e._ease=Ge(s)),e._currentTime=0}),U(e)||d.stretch(e),d.reset(!0).resume(),this}}}}revert(){for(let t in this.animations)this[t]=T,this.animations[t].revert();return this.animations={},this.targets.length=0,this.callbacks&&this.callbacks.revert(),this}}const _s=(t,e)=>new vs(t,e),bs=(t,e)=>(+t).toFixed(e),Ts=(t,e,s)=>`${t}`.padStart(e,s),xs=(t,e,s)=>`${t}`.padEnd(e,s),Ss=(t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e,ws=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),Cs=t=>t*Math.PI/180,$s=t=>180*t/Math.PI,Es=(t,e,s,i)=>i?1===i?e:vt(t,e,1-Math.exp(-i*s*.1)):t;var Ns=Object.freeze({__proto__:null,clamp:ft,damp:Es,degToRad:Cs,lerp:vt,mapRange:ws,padEnd:xs,padStart:Ts,radToDeg:$s,round:gt,roundPad:bs,snap:yt,wrap:Ss});const ks=10*m;class Rs{constructor(t={}){const e=!U(t.bounce)||!U(t.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/m,this.maxIterations=this.maxDuration/this.timeStep/m,this.bn=ft(Ot(t.bounce,.5),-1,1),this.pd=ft(Ot(t.duration,628),10*L.timeScale,ks*L.timeScale),this.m=ft(Ot(t.mass,1),1,ks),this.s=ft(Ot(t.stiffness,100),u,ks),this.d=ft(Ot(t.damping,10),u,ks),this.v=ft(Ot(t.velocity,0),-1e4,ks),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=t.onComplete||T,e&&this.calculateSDFromBD(),this.compute(),this.ease=t=>{const e=t*this.settlingDuration,s=this.completed,i=this.pd;return e>=i&&!s&&(this.completed=!0,this.onComplete(this.parent)),e<i&&s&&(this.completed=!1),0===t||1===t?t:this.solve(t*this.solverDuration)}}solve(t){const{zeta:e,w0:s,wd:i,b:r}=this;let n=t;return n=e<1?at(-n*e*s)*(1*nt(i*n)+r*rt(i*n)):1===e?(1+r*n)*at(-n*s):((1+r)*at((-e*s+i)*n)+(1-r)*at((-e*s-i)*n))/2,1-n}calculateSDFromBD(){const t=1===L.timeScale?this.pd/m:this.pd;this.m=1,this.v=0,this.s=st(2*pt/t,2),this.bn>=0?this.d=4*(1-this.bn)*pt/t:this.d=4*pt/(t*(1+this.bn)),this.s=gt(ft(this.s,u,ks),3),this.d=gt(ft(this.d,u,300),3)}calculateBDFromSD(){const t=2*pt/it(this.s);this.pd=t*(1===L.timeScale?m:1);const e=this.d/(2*it(this.s));this.bn=e<=1?1-this.d*t/(4*pt):4*pt/(this.d*t)-1,this.bn=gt(ft(this.bn,-1,1),3),this.pd=gt(ft(this.pd,10*L.timeScale,ks*L.timeScale),3)}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,l=this.w0=ft(it(o/r),u,m),h=this.zeta=n/(2*it(o*r));h<1?(this.wd=l*it(1-h*h),this.b=(h*l-a)/this.wd):1===h?(this.wd=0,this.b=-a+l):(this.wd=l*it(h*h-1),this.b=(h*l-a)/this.wd);let d=0,c=0,p=0;for(;c<=t&&p<=e;)ot(1-this.solve(d))<s?c++:c=0,this.solverDuration=d,d+=i,p++;this.settlingDuration=gt(this.solverDuration*m,0)*L.timeScale}get bounce(){return this.bn}set bounce(t){this.bn=ft(Ot(t,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(t){this.pd=ft(Ot(t,1),10*L.timeScale,ks*L.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=ft(Ot(t,100),u,ks),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(t){this.d=ft(Ot(t,10),u,ks),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(t){this.m=ft(Ot(t,1),1,ks),this.compute()}get velocity(){return this.v}set velocity(t){this.v=ft(Ot(t,0),-1e4,ks),this.compute()}}const As=t=>new Rs(t),Ds=t=>(console.warn("createSpring() is deprecated use spring() instead"),new Rs(t)),Os={_head:null,_tail:null},Is=(t,e,s)=>{let i,r=Os._head;for(;r;){const n=r._next,o=r.$el===t,a=!e||r.property===e,l=!s||r.parent===s;if(o&&a&&l){i=r.animation;try{i.commitStyles()}catch{}i.cancel(),wt(Os,r);const t=r.parent;t&&(t._completed++,t.animations.length===t._completed&&(t.completed=!0,t.paused=!0,t.muteCallbacks||(t.onComplete(t),t._resolve(t))))}r=n}return i},Ls=(t,e,s,i,r)=>{const n=e.animate(i,r),o=r.delay+ +r.duration*r.iterations;n.playbackRate=t._speed,t.paused&&n.pause(),t.duration<o&&(t.duration=o,t.controlAnimation=n),t.animations.push(n),Is(e,s),Ct(Os,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>Is(e,s,t);return n.oncancel=a,n.onremove=a,t.persist||(n.onfinish=a),n};function Bs(t,e,s){const i=Le(t);if(!i.length)return;const[n]=i,o=Lt(n,e),a=ae(e,n,o);let l=Mt(n,a);if(U(s))return l;if(Vt(l,zt),zt.t===r.NUMBER||zt.t===r.UNIT){if(!1===s)return zt.n;{const t=Pe(n,zt,s,!1);return`${gt(t.n,L.precision)}${t.u}`}}}const Ms=(t,e)=>{if(!U(e))return e.duration=u,e.composition=Ot(e.composition,o.none),new hs(t,e,null,0,!0).resume()},Ps=(t,e,s)=>{const i=Ie(t);for(let t=0,r=i.length;t<r;t++)Is(i[t],s,e&&e.controlAnimation&&e);return $e(i,e,s),i},Fs=t=>{t.cancelable&&t.preventDefault()};class Vs{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:T,remove:T}}get x(){return this.el.x||0}set x(t){this.el.x=t}get y(){return this.el.y||0}set y(t){this.el.y=t}get width(){return this.el.width||0}set width(t){this.el.width=t}get height(){return this.el.height||0}set height(t){this.el.height=t}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class Xs{constructor(t){this.$el=t,this.inlineTransforms=[],this.point=new DOMPoint,this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(t,e){return this.point.x=t,this.point.y=e,this.point.matrixTransform(this.inversedMatrix)}traverseUp(t){let e=this.$el.parentElement,i=0;for(;e&&e!==s;)t(e,i),e=e.parentElement,i++}getMatrix(){const t=new DOMMatrix;return this.traverseUp(e=>{const s=getComputedStyle(e).transform;if(s){const e=new DOMMatrix(s);t.preMultiplySelf(e)}}),t}remove(){this.traverseUp((t,e)=>{this.inlineTransforms[e]=t.style.transform,t.style.transform="none"})}revert(){this.traverseUp((t,e)=>{const s=this.inlineTransforms[e];""===s?t.style.removeProperty("transform"):t.style.transform=s})}}const zs=(t,e)=>t&&Y(t)?t(e):t;let Hs=0;class Ys{constructor(t,i={}){if(!t)return;I.current&&I.current.register(this);const r=i.x,n=i.y,o=i.trigger,a=i.modifier,l=i.releaseEase,h=l&&Ge(l),d=!U(l)&&!U(l.ease),c=X(r)&&!U(r.mapTo)?r.mapTo:"translateX",u=X(n)&&!U(n.mapTo)?n.mapTo:"translateY",m=zs(i.container,this);this.containerArray=V(m)?m:null,this.$container=m&&!this.containerArray?Ie(m)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.$target=X(t)?new Vs(t):Ie(t)[0],this.$trigger=Ie(o||t)[0],this.fixed="fixed"===Bs(this.$target,"position"),this.isFinePointer=!0,this.containerPadding=[0,0,0,0],this.containerFriction=0,this.releaseContainerFriction=0,this.snapX=0,this.snapY=0,this.scrollSpeed=0,this.scrollThreshold=0,this.dragSpeed=0,this.dragThreshold=3,this.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=d?l:As({mass:Ot(i.releaseMass,1),stiffness:Ot(i.releaseStiffness,80),damping:Ot(i.releaseDamping,20)}),this.releaseYSpring=d?l:As({mass:Ot(i.releaseMass,1),stiffness:Ot(i.releaseStiffness,80),damping:Ot(i.releaseDamping,20)}),this.releaseEase=h||Ue.outQuint,this.hasReleaseSpring=d,this.onGrab=i.onGrab||T,this.onDrag=i.onDrag||T,this.onRelease=i.onRelease||T,this.onUpdate=i.onUpdate||T,this.onSettle=i.onSettle||T,this.onSnap=i.onSnap||T,this.onResize=i.onResize||T,this.onAfterResize=i.onAfterResize||T,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),U(r)||!0===r)f[c]=0;else if(X(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[c]=e}else!1===r&&(f[c]=0,this.disabled[0]=1);if(U(n)||!0===n)f[u]=0;else if(X(n)){const t=n,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===n&&(f[u]=0,this.disabled[1]=1);this.animate=new vs(this.$target,f),this.xProp=c,this.yProp=u,this.destX=0,this.destY=0,this.deltaX=0,this.deltaY=0,this.scroll={x:0,y:0},this.coords=[this.x,this.y,0,0],this.snapped=[0,0],this.pointer=[0,0,0,0,0,0,0,0],this.scrollView=[0,0],this.dragArea=[0,0,0,0],this.containerBounds=[-p,p,p,-p],this.scrollBounds=[0,0,0,0],this.targetBounds=[0,0,0,0],this.window=[0,0],this.velocityStack=[0,0,0],this.velocityStackIndex=0,this.velocityTime=F(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new Xs(this.$target),this.overshootCoords={x:0,y:0},this.overshootTicker=new Ae({autoplay:!1,onUpdate:()=>{this.updated=!0,this.manual=!0,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,1),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,1)},onComplete:()=>{this.manual=!1,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,0),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,0)}},null,0).init(),this.updateTicker=new Ae({autoplay:!1,onUpdate:()=>this.update()},null,0).init(),this.contained=!U(m),this.manual=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.enabled=!1,this.initialized=!1,this.activeProp=this.disabled[1]?c:u,this.animate.callbacks.onRender=()=>{const t=this.updated,e=!(this.grabbed&&t)&&this.released,s=this.x,i=this.y,r=s-this.coords[2],n=i-this.coords[3];this.deltaX=r,this.deltaY=n,this.coords[2]=s,this.coords[3]=i,t&&(r||n)&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=ut(n,r)):this.updated=!1},this.animate.callbacks.onComplete=()=>{!this.grabbed&&this.released&&(this.released=!1),this.manual||(this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.onSettle(this))},this.resizeTicker=new Ae({autoplay:!1,duration:150*L.timeScale,onComplete:()=>{this.onResize(this),this.refresh(),this.onAfterResize(this)}}).init(),this.parameters=i,this.resizeObserver=new ResizeObserver(()=>{this.initialized?this.resizeTicker.restart():this.initialized=!0}),this.enable(),this.refresh(),this.resizeObserver.observe(this.$container),X(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=F(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,a=this.minVelocity,l=this.maxVelocity,h=this.velocityStackIndex;n[h]=gt(ft(it(t*t+e*e)/r*o,a,l),5);const d=ct(n[0],n[1],n[2]);return this.velocity=d,this.velocityStackIndex=(h+1)%3,d}setX(t,e=!1){if(this.disabled[0])return;const s=gt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=yt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=gt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=yt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return gt(this.animate[this.xProp](),L.precision)}set x(t){this.setX(t,!1)}get y(){return gt(this.animate[this.yProp](),L.precision)}set y(t){this.setY(t,!1)}get progressX(){return ws(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(ws(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return ws(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(ws(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=gt(this.useWin?e.scrollX:this.$container.scrollLeft,0),s=gt(this.useWin?e.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,a=this.scrollThreshold;this.scroll.x=t,this.scroll.y=s,this.scrollBounds[0]=s-this.targetBounds[0]+i-a,this.scrollBounds[1]=t-this.targetBounds[1]-r+a,this.scrollBounds[2]=s-this.targetBounds[2]-n+a,this.scrollBounds[3]=t-this.targetBounds[3]+o-a}updateBoundingValues(){const t=this.$container;if(!t)return;const i=this.x,r=this.y,n=this.coords[2],o=this.coords[3];this.coords[2]=0,this.coords[3]=0,this.setX(0,!0),this.setY(0,!0),this.transforms.remove();const a=this.window[0]=e.innerWidth,l=this.window[1]=e.innerHeight,h=this.useWin,d=t.scrollWidth,c=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,y]=this.containerPadding;this.dragArea[0]=h?0:p.left,this.dragArea[1]=h?0:p.top,this.scrollView[0]=h?ft(d,a,d):d,this.scrollView[1]=h?ft(c,l,c):c,this.updateScrollCoords();const{width:v,height:_,left:b,top:T,right:x,bottom:S}=t.getBoundingClientRect();this.dragArea[2]=gt(h?ft(v,a,a):v,0),this.dragArea[3]=gt(h?ft(_,l,l):_,0);const w=Bs(t,"overflow"),C="visible"===w,$="hidden"===w;if(this.canScroll=!u&&this.contained&&(t===s.body&&C||!$&&!C)&&(d>this.dragArea[2]+y-f||c>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!V(this.containerArray)),this.contained){const e=this.scroll.x,s=this.scroll.y,i=this.canScroll,r=this.$target.getBoundingClientRect(),n=i?h?0:t.scrollLeft:0,o=i?h?0:t.scrollTop:0,d=i?this.scrollView[0]-n-v:0,c=i?this.scrollView[1]-o-_:0;this.targetBounds[0]=gt(r.top+s-(h?0:T),0),this.targetBounds[1]=gt(r.right+e-(h?a:x),0),this.targetBounds[2]=gt(r.bottom+s-(h?l:S),0),this.targetBounds[3]=gt(r.left+e-(h?0:b),0),this.containerArray?(this.containerBounds[0]=this.containerArray[0]+m,this.containerBounds[1]=this.containerArray[1]-f,this.containerBounds[2]=this.containerArray[2]-g,this.containerBounds[3]=this.containerArray[3]+y):(this.containerBounds[0]=-gt(r.top-(u?ft(T,0,l):T)+o-m,0),this.containerBounds[1]=-gt(r.right-(u?ft(x,0,a):x)-d+f,0),this.containerBounds[2]=-gt(r.bottom-(u?ft(S,0,l):S)-c+g,0),this.containerBounds[3]=-gt(r.left-(u?ft(b,0,a):b)+n-y,0))}this.transforms.revert(),this.coords[2]=n,this.coords[3]=o,this.setX(i,!0),this.setY(r,!0)}isOutOfBounds(t,e,s){if(!this.contained)return 0;const[i,r,n,o]=t,[a,l]=this.disabled,h=!a&&e<o||!a&&e>r,d=!l&&s<i||!l&&s>n;return h&&!d?1:!h&&d?2:h&&d?3:0}refresh(){const t=this.parameters,i=t.x,r=t.y,n=zs(t.container,this),o=zs(t.containerPadding,this)||0,a=V(o)?o:[o,o,o,o],l=this.x,h=this.y,d=zs(t.cursor,this),c={onHover:"grab",onGrab:"grabbing"};if(d){const{onHover:t,onGrab:e}=d;t&&(c.onHover=t),e&&(c.onGrab=e)}const u=zs(t.dragThreshold,this),p={mouse:3,touch:7};if(z(u))p.mouse=u,p.touch=u;else if(u){const{mouse:t,touch:e}=u;U(t)||(p.mouse=t),U(e)||(p.touch=e)}this.containerArray=V(n)?n:null,this.$container=n&&!this.containerArray?Ie(n)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.isFinePointer=matchMedia("(pointer:fine)").matches,this.containerPadding=Ot(a,[0,0,0,0]),this.containerFriction=ft(Ot(zs(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=ft(Ot(zs(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=zs(X(i)&&!U(i.snap)?i.snap:t.snap,this),this.snapY=zs(X(r)&&!U(r.snap)?r.snap:t.snap,this),this.scrollSpeed=Ot(zs(t.scrollSpeed,this),1.5),this.scrollThreshold=Ot(zs(t.scrollThreshold,this),20),this.dragSpeed=Ot(zs(t.dragSpeed,this),1),this.dragThreshold=this.isFinePointer?p.mouse:p.touch,this.minVelocity=Ot(zs(t.minVelocity,this),0),this.maxVelocity=Ot(zs(t.maxVelocity,this),50),this.velocityMultiplier=Ot(zs(t.velocityMultiplier,this),1),this.cursor=!1!==d&&c,this.updateBoundingValues();const[m,f,g,y]=this.containerBounds;this.setX(ft(l,y,f),!0),this.setY(ft(h,m,g),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],a=this.dragArea[3],l=this.scroll.x,h=this.scroll.y,d=this.$container.scrollWidth,c=this.$container.scrollHeight,u=this.useWin?ft(d,this.window[0],d):d,p=this.useWin?ft(c,this.window[1],c):c,m=r-u,f=n-p;this.dragged&&m>0&&(this.coords[0]-=m,this.scrollView[0]=u),this.dragged&&f>0&&(this.coords[1]-=f,this.scrollView[1]=p);const g=10*this.scrollSpeed,y=this.scrollThreshold,[v,_]=this.coords,[b,T,x,S]=this.scrollBounds,w=gt(ft((_-b+t)/y,-1,0)*g,0),C=gt(ft((v-T-e)/y,0,1)*g,0),$=gt(ft((_-x-s)/y,0,1)*g,0),E=gt(ft((v-S+i)/y,-1,0)*g,0);if(w||$||E||C){const[t,e]=this.disabled;let s=l,i=h;t||(s=gt(ft(l+(E||C),0,r-o),0),this.coords[0]-=l-s),e||(i=gt(ft(h+(w||$),0,n-a),0),this.coords[1]-=h-i),this.useWin?this.$scrollContainer.scrollBy(-(l-s),-(h-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,a,l,h]=this.pointer;this.coords[0]+=(r-l)*this.dragSpeed,this.coords[1]+=(n-h)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[d,c]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(d>e?e+(d-e)*m:d<i?i+(d-i)*m:d,!1),this.setY(c>s?s+(c-s)*m:c<t?t+(c-t)*m:c,!1),this.computeVelocity(r-l,n-h),this.angle=ut(n-a,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return $e([this],null,"x"),$e([this],null,"y"),$e([this],null,"progressX"),$e([this],null,"progressY"),$e([this.scroll]),$e([this.overshootCoords]),this}scrollInView(t,e=0,s=Ue.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,a=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[l,h,d,c]=o,u=gt(ft(r-l,-p,0),0),m=gt(ft(i-h,0,p),0),f=gt(ft(r-d,0,p),0),g=gt(ft(i-c,-p,0),0);new hs(n,{x:gt(n.x+(g?g-e:m?m+e:0),0),y:gt(n.y+(u?u-e:f?f+e:0),0),duration:U(t)?350*L.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then(()=>{this.canScroll=a})}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=Ms(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=Ue.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,a,l]=this.containerPadding,h=this.scroll.y-this.targetBounds[0]+n+e,d=this.scroll.x-this.targetBounds[1]-o-e,c=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+l+e,p=this.isOutOfBounds([h,d,c,u],i,r);if(p){const[e,n]=this.disabled,o=ft(yt(i,this.snapX),u,d),a=ft(yt(r,this.snapY),h,c),l=U(t)?350*L.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,l,s),n||2!==p&&3!==p||this.animate[this.yProp](a,l,s)}return this}handleDown(t){const e=t.target;if(this.grabbed||"range"===e.type)return;t.stopPropagation(),this.grabbed=!0,this.released=!1,this.stop(),this.updateBoundingValues();const i=t.changedTouches,r=i?i[0].clientX:t.clientX,n=i?i[0].clientY:t.clientY,{x:o,y:a}=this.transforms.normalizePoint(r,n),[l,h,d,c]=this.containerBounds,u=(1-this.containerFriction)*this.dragSpeed,p=this.x,m=this.y;this.coords[0]=this.coords[2]=u?p>h?h+(p-h)/u:p<c?c+(p-c)/u:p:p,this.coords[1]=this.coords[3]=u?m>d?d+(m-d)/u:m<l?l+(m-l)/u:m:m,this.pointer[0]=o,this.pointer[1]=a,this.pointer[2]=o,this.pointer[3]=a,this.pointer[4]=o,this.pointer[5]=a,this.pointer[6]=o,this.pointer[7]=a,this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null);const f=Bs(this.$target,"zIndex",!1);Hs=(f>Hs?f:Hs)+1,this.targetStyles=Ms(this.$target,{zIndex:Hs}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=Ms(s.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,Ue.out(3)),this.onGrab(this),s.addEventListener("touchmove",this),s.addEventListener("touchend",this),s.addEventListener("touchcancel",this),s.addEventListener("mousemove",this),s.addEventListener("mouseup",this),s.addEventListener("selectstart",this)}handleMove(t){if(!this.grabbed)return;const e=t.changedTouches,s=e?e[0].clientX:t.clientX,i=e?e[0].clientY:t.clientY,{x:r,y:n}=this.transforms.normalizePoint(s,i),o=r-this.pointer[6],a=n-this.pointer[7];let l=t.target,h=!1,d=!1,c=!1;for(;e&&l&&l!==this.$trigger;){const t=Bs(l,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=l;if(e>s){c=!0,h=t<=3,d=t>=e-s-3;break}}l=l.parentElement}c&&(!h&&!d||h&&a<0||d&&a>0)?(this.pointer[0]=r,this.pointer[1]=n,this.pointer[2]=r,this.pointer[3]=n,this.pointer[4]=r,this.pointer[5]=n,this.pointer[6]=r,this.pointer[7]=n):(Fs(t),this.triggerStyles||(this.triggerStyles=Ms(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",Fs,{passive:!1}),this.$trigger.addEventListener("touchmove",Fs,{passive:!1}),this.$trigger.addEventListener("touchend",Fs),(this.dragged||!this.disabled[0]&&ot(o)>this.dragThreshold||!this.disabled[1]&&ot(a)>this.dragThreshold)&&(this.updateTicker.resume(),this.pointer[2]=this.pointer[0],this.pointer[3]=this.pointer[1],this.pointer[0]=r,this.pointer[1]=n,this.dragged=!0,this.released=!1,this.onDrag(this)))}handleUp(){if(!this.grabbed)return;this.updateTicker.pause(),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null);const[t,e]=this.disabled,[i,r,n,a,l,h]=this.pointer,[d,c,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,y=this.releaseYSpring,v=this.releaseEase,_=this.hasReleaseSpring,b=this.overshootCoords,T=this.x,x=this.y,S=this.computeVelocity(i-l,r-h),w=this.angle=ut(r-a,i-n),C=150*S,$=(1-this.releaseContainerFriction)*this.dragSpeed,E=T+nt(w)*C,N=x+rt(w)*C,k=E>c?c+(E-c)*$:E<p?p+(E-p)*$:E,R=N>u?u+(N-u)*$:N<d?d+(N-d)*$:N,A=this.destX=ft(gt(yt(k,this.snapX),5),p,c),D=this.destY=ft(gt(yt(R,this.snapY),5),d,u),O=this.isOutOfBounds(this.containerBounds,E,N);let I=0,B=0,M=v,P=v,F=0;if(b.x=T,b.y=x,!t){const t=A===c?T>c?-1:1:T<p?-1:1,s=gt(T-A,0);g.velocity=e&&_?s?C*t/ot(s):0:S;const{ease:i,settlingDuration:r,restDuration:n}=g;I=T===A?0:_?r:r-n*L.timeScale,_&&(M=i),I>F&&(F=I)}if(!e){const e=D===u?x>u?-1:1:x<d?-1:1,s=gt(x-D,0);y.velocity=t&&_?s?C*e/ot(s):0:S;const{ease:i,settlingDuration:r,restDuration:n}=y;B=x===D?0:_?r:r-n*L.timeScale,_&&(P=i),B>F&&(F=B)}if(!_&&O&&$&&(I||B)){const t=o.blend;new hs(b,{x:{to:k,duration:.65*I},y:{to:R,duration:.65*B},ease:v,composition:t}).init(),new hs(b,{x:{to:A,duration:I},y:{to:D,duration:B},ease:v,composition:t}).init(),this.overshootTicker.stretch(ct(I,B)).restart()}else t||this.animate[this.xProp](A,I,M),e||this.animate[this.yProp](D,B,P);this.scrollInView(F,this.scrollThreshold,v);let V=!1;A!==m&&(this.snapped[0]=A,this.snapX&&(V=!0)),D!==f&&this.snapY&&(this.snapped[1]=D,this.snapY&&(V=!0)),V&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",Fs),this.$trigger.removeEventListener("touchmove",Fs),this.$trigger.removeEventListener("touchend",Fs),s.removeEventListener("touchmove",this),s.removeEventListener("touchend",this),s.removeEventListener("touchcancel",this),s.removeEventListener("mousemove",this),s.removeEventListener("mouseup",this),s.removeEventListener("selectstart",this)}reset(){return this.stop(),this.resizeTicker.pause(),this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.setX(0,!0),this.setY(0,!0),this.coords[0]=0,this.coords[1]=0,this.pointer[0]=0,this.pointer[1]=0,this.pointer[2]=0,this.pointer[3]=0,this.pointer[4]=0,this.pointer[5]=0,this.pointer[6]=0,this.pointer[7]=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this}enable(){return this.enabled||(this.enabled=!0,this.$target.classList.remove("is-disabled"),this.touchActionStyles=Ms(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"}),this.$trigger.addEventListener("touchstart",this,{passive:!0}),this.$trigger.addEventListener("mousedown",this,{passive:!0}),this.$trigger.addEventListener("mouseenter",this)),this}disable(){return this.enabled=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.touchActionStyles.revert(),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null),this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null),this.$target.classList.add("is-disabled"),this.$trigger.removeEventListener("touchstart",this),this.$trigger.removeEventListener("mousedown",this),this.$trigger.removeEventListener("mouseenter",this),s.removeEventListener("touchmove",this),s.removeEventListener("touchend",this),s.removeEventListener("touchcancel",this),s.removeEventListener("mousemove",this),s.removeEventListener("mouseup",this),s.removeEventListener("selectstart",this),this}revert(){return this.reset(),this.disable(),this.$target.classList.remove("is-disabled"),this.updateTicker.revert(),this.overshootTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),this.resizeObserver.disconnect(),this}handleEvent(t){switch(t.type){case"mousedown":case"touchstart":this.handleDown(t);break;case"mousemove":case"touchmove":this.handleMove(t);break;case"mouseup":case"touchend":case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":Fs(t)}}}const Us=(t,e)=>new Ys(t,e),Ws=(t=T)=>new Ae({duration:1*L.timeScale,onComplete:t},null,0).resume(),qs=t=>{let e;return(...s)=>{let i,r,n,o,a;e&&(i=e.currentIteration,r=e.iterationProgress,n=e.reversed,o=e._alternate,a=e._startTime,e.revert());const l=t(...s);return l&&!Y(l)&&l.revert&&(e=l),U(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r,e._startTime=a),l||T}};class js{constructor(t={}){I.current&&I.current.register(this);const i=t.root;let r=s;i&&(r=i.current||i.nativeElement||Ie(i)[0]||s);const n=t.defaults,o=L.defaults,a=t.mediaQueries;if(this.defaults=n?xt(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],this.constructorsOnce=[],this.revertConstructorsOnce=[],this.revertiblesOnce=[],this.once=!1,this.onceIndex=0,this.methods={},this.matches={},this.mediaQueryLists={},this.data={},a)for(let t in a){const s=e.matchMedia(a[t]);this.mediaQueryLists[t]=s,s.addEventListener("change",this)}}register(t){(this.once?this.revertiblesOnce:this.revertibles).push(t)}execute(t){let e=I.current,s=I.root,i=L.defaults;I.current=this,I.root=this.root,L.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return I.current=e,I.root=s,L.defaults=i,n}refresh(){return this.onceIndex=0,this.execute(()=>{let t=this.revertibles.length,e=this.revertConstructors.length;for(;t--;)this.revertibles[t].revert();for(;e--;)this.revertConstructors[e](this);this.revertibles.length=0,this.revertConstructors.length=0,this.constructors.forEach(t=>{const e=t(this);Y(e)&&this.revertConstructors.push(e)})}),this}add(t,e){if(this.once=!1,Y(t)){const e=t;this.constructors.push(e),this.execute(()=>{const t=e(this);Y(t)&&this.revertConstructors.push(t)})}else this.methods[t]=(...t)=>this.execute(()=>e(...t));return this}addOnce(t){if(this.once=!0,Y(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute(()=>{const t=s(this);Y(t)&&this.revertConstructorsOnce.push(t)})}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(Y(s))return s(this);const i=qs(t);let r;return this.constructorsOnce[e]=i,this.execute(()=>{r=i(this)}),r}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.revertiblesOnce,i=this.revertConstructorsOnce,r=this.mediaQueryLists;let n=t.length,o=e.length,a=s.length,l=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;a--;)s[a].revert();for(;l--;)i[l](this);for(let t in r)r[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,s.length=0,i.length=0,this.constructorsOnce.length=0,this.onceIndex=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const Gs=t=>new js(t),Zs=()=>{const t=s.createElement("div");s.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return s.body.removeChild(t),e},Qs=(t,e)=>t&&Y(t)?t(e):t,Js=new Map;class Ks{constructor(t){this.element=t,this.useWin=this.element===s.body,this.winWidth=0,this.winHeight=0,this.width=0,this.height=0,this.left=0,this.top=0,this.scale=1,this.zIndex=0,this.scrollX=0,this.scrollY=0,this.prevScrollX=0,this.prevScrollY=0,this.scrollWidth=0,this.scrollHeight=0,this.velocity=0,this.backwardX=!1,this.backwardY=!1,this.scrollTicker=new Ae({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;St(this,t=>t.handleScroll(),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new Ae({autoplay:!1,frameRate:30,onUpdate:t=>{const e=t.deltaTime,s=this.prevScrollX,i=this.prevScrollY,r=this.scrollX,n=this.scrollY,o=s-r,a=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),a&&(this.backwardY=i>n),this.velocity=gt(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new Ae({autoplay:!1,duration:250*L.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new Ae({autoplay:!1,duration:500*L.timeScale,onBegin:()=>{this.scrollTicker.resume()},onComplete:()=>{this.scrollTicker.pause()}}).init(),this._head=null,this._tail=null,this.updateScrollCoords(),this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll(),this.resizeObserver=new ResizeObserver(()=>this.resizeTicker.restart()),this.resizeObserver.observe(this.element),(this.useWin?e:this.element).addEventListener("scroll",this,!1)}updateScrollCoords(){const t=this.useWin,s=this.element;this.scrollX=gt(t?e.scrollX:s.scrollLeft,0),this.scrollY=gt(t?e.scrollY:s.scrollTop,0)}updateWindowBounds(){this.winWidth=e.innerWidth,this.winHeight=Zs()}updateBounds(){const t=getComputedStyle(this.element),e=this.element;let s,i;if(this.scrollWidth=e.scrollWidth+parseFloat(t.marginLeft)+parseFloat(t.marginRight),this.scrollHeight=e.scrollHeight+parseFloat(t.marginTop)+parseFloat(t.marginBottom),this.updateWindowBounds(),this.useWin)s=this.winWidth,i=this.winHeight;else{const t=e.getBoundingClientRect();s=e.clientWidth,i=e.clientHeight,this.top=t.top,this.left=t.left,this.scale=t.width?s/t.width:t.height?i/t.height:1}this.width=s,this.height=i}refreshScrollObservers(){St(this,t=>{t._debug&&t.removeDebug()}),this.updateBounds(),St(this,t=>{t.refresh(),t.onResize(t),t._debug&&t.debug()})}refresh(){this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll()}handleScroll(){this.updateScrollCoords(),this.wakeTicker.restart()}handleEvent(t){"scroll"===t.type&&this.handleScroll()}revert(){this.scrollTicker.cancel(),this.dataTimer.cancel(),this.resizeTicker.cancel(),this.wakeTicker.cancel(),this.resizeObserver.disconnect(),(this.useWin?e:this.element).removeEventListener("scroll",this),Js.delete(this.element)}}const ti=t=>{const e=t&&Ie(t)[0]||s.body;let i=Js.get(e);return i||(i=new Ks(e),Js.set(e,i)),i},ei=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,a="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:l,u:h}=Vt(a,zt);let d=l;return"%"===h?d=l/100*s:h&&(d=Pe(t,zt,"px",!0).n),o&&i<0&&(d+=i),n&&r>0&&(d+=r),d},si=(t,e,s,i,r)=>{let n;if(H(e)){const o=A.exec(e);if(o){const a=o[0],l=a[0],h=e.split(a),d="min"===h[0],c="max"===h[0],u=ei(t,h[0],s,i,r),p=ei(t,h[1],s,i,r);if(d){const e=Pt(ei(t,"min",s),p,l);n=e<u?u:e}else if(c){const e=Pt(ei(t,"max",s),p,l);n=e>u?u:e}else n=Pt(u,p,l)}else n=ei(t,e,s,i,r)}else n=e;return gt(n,0)},ii=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[l]){e=i;break}}return e};let ri=0;const ni=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class oi{constructor(t={}){I.current&&I.current.register(this);const e=Ot(t.sync,"play pause"),i=e?Ge(e):null,r=e&&("linear"===e||e===Fe),n=e&&!(i===Fe&&!r),o=e&&(z(e)||!0===e||r),a=e&&H(e)&&!n&&!o,l=a?e.split(" ").map(t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null}):null,h=a&&l.length>2;this.index=ri++,this.id=U(t.id)?this.index:t.id,this.container=ti(t.container),this.target=null,this.linked=null,this.repeat=null,this.horizontal=null,this.enter=null,this.leave=null,this.sync=n||o||!!l,this.syncEase=n?i:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=l&&!h&&l[0]?l[0]:T,this.onSyncLeave=l&&!h&&l[1]?l[1]:T,this.onSyncEnterForward=l&&h&&l[0]?l[0]:T,this.onSyncLeaveForward=l&&h&&l[1]?l[1]:T,this.onSyncEnterBackward=l&&h&&l[2]?l[2]:T,this.onSyncLeaveBackward=l&&h&&l[3]?l[3]:T,this.onEnter=t.onEnter||T,this.onLeave=t.onLeave||T,this.onEnterForward=t.onEnterForward||T,this.onLeaveForward=t.onLeaveForward||T,this.onEnterBackward=t.onEnterBackward||T,this.onLeaveBackward=t.onLeaveBackward||T,this.onUpdate=t.onUpdate||T,this.onResize=t.onResize||T,this.onSyncComplete=t.onSyncComplete||T,this.reverted=!1,this.ready=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offset=0,this.offsetStart=0,this.offsetEnd=0,this.distance=0,this.prevProgress=0,this.thresholds=["start","end","end","start"],this.coords=[0,0,0,0],this.debugStyles=null,this.$debug=null,this._params=t,this._debug=Ot(t.debug,!1),this._next=null,this._prev=null,Ct(this.container,this),Ws(()=>{if(!this.reverted){if(!this.target){const e=Ie(t.target)[0];this.target=e||s.body,this.refresh()}this._debug&&this.debug()}})}link(t){if(t&&(t.pause(),this.linked=t,U(t)||U(t.persist)||(t.persist=!0),!this._params.target)){let e;U(t.targets)?St(t,t=>{t.targets&&!e&&(e=ii(t))}):e=ii(t),this.target=e||s.body,this.refresh()}return this}get velocity(){return this.container.velocity}get backward(){return this.horizontal?this.container.backwardX:this.container.backwardY}get scroll(){return this.horizontal?this.container.scrollX:this.container.scrollY}get progress(){const t=(this.scroll-this.offsetStart)/this.distance;return t===1/0||isNaN(t)?0:gt(ft(t,0,1),6)}refresh(){this.ready=!0,this.reverted=!1;const t=this._params;return this.repeat=Ot(Qs(t.repeat,this),!0),this.horizontal="x"===Ot(Qs(t.axis,this),"y"),this.enter=Ot(Qs(t.enter,this),"end start"),this.leave=Ot(Qs(t.leave,this),"start end"),this.updateBounds(),this.handleScroll(),this}removeDebug(){return this.$debug&&(this.$debug.parentNode.removeChild(this.$debug),this.$debug=null),this.debugStyles&&(this.debugStyles.revert(),this.$debug=null),this}debug(){this.removeDebug();const t=this.container,e=this.horizontal,i=t.element.querySelector(":scope > .animejs-onscroll-debug"),r=s.createElement("div"),n=s.createElement("div"),o=s.createElement("div"),a=ni[this.index%ni.length],l=t.useWin,h=l?t.winWidth:t.width,d=l?t.winHeight:t.height,c=t.scrollWidth,u=t.scrollHeight,p=this.container.width>360?320:260,m=e?0:10,f=e?10:0,g=e?24:p/2,y=e?g:15,v=e?60:g,_=e?v:y,b=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",x=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,S=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${S("absolute",m,f,e?c:p,e?p:u)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${e?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `,n.style.cssText=`${S("sticky",0,0,e?h:g,e?g:d)}`,i||(n.style.cssText+=`background:\n ${x("#FFFF")}${T(g-10)} / 100px 100px ${b},\n ${x("#FFF8")}${T(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${S("relative",0,0,e?c:g,e?g:u)}`,i||(o.style.cssText+=`background:\n ${x("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${x("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const w=[" enter: "," leave: "];this.coords.forEach((t,i)=>{const r=i>1,l=(r?0:this.offset)+t,m=i%2,f=l<_,g=l>(r?e?h:d:e?c:u)-_,b=(r?m&&!f:!m&&!f)||g,T=s.createElement("div"),x=s.createElement("div"),C=e?b?"right":"left":b?"bottom":"top",$=b?(e?v:y)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;x.innerHTML=`${this.id}${w[m]}${this.thresholds[i]}`,T.style.cssText=`${S("absolute",0,0,v,y)}\n display: flex;\n flex-direction: ${e?"column":"row"};\n justify-content: flex-${r?"start":"end"};\n align-items: flex-${b?"end":"start"};\n border-${C}: 2px solid ${a};\n `,x.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${y};\n margin-${e?b?"right":"left":b?"bottom":"top"}: -2px;\n padding: 1px;\n font-family: ui-monospace, monospace;\n font-size: 10px;\n letter-spacing: -.025em;\n line-height: 9px;\n font-weight: 600;\n text-align: ${e&&b||!e&&!r?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${m?a:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":a};\n border: 2px solid ${m?a:"transparent"};\n border-${e?b?"top-left":"top-right":b?"top-left":"bottom-left"}-radius: 5px;\n border-${e?b?"bottom-left":"bottom-right":b?"top-right":"bottom-right"}-radius: 5px;\n `,T.appendChild(x);let E=l-$+(e?1:0);T.style[e?"left":"top"]=`${E}px`,(r?n:o).appendChild(T)}),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),i||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===Bs(t.element,"position")&&(this.debugStyles=Ms(t.element,{position:"relative "}))}updateBounds(){let t;this._debug&&this.removeDebug();const e=this.target,i=this.container,r=this.horizontal,n=this.linked;let o,a=e;for(n&&(o=n.currentTime,n.seek(0,!0));a&&a!==i.element&&a!==s.body;){const e="sticky"===Bs(a,"position")&&Ms(a,{position:"static"});a=a.parentElement,e&&(t||(t=[]),t.push(e))}const l=e.getBoundingClientRect(),h=i.scale,d=(r?l.left+i.scrollX-i.left:l.top+i.scrollY-i.top)*h,c=(r?l.width:l.height)*h,u=r?i.width:i.height,p=(r?i.scrollWidth:i.scrollHeight)-u,m=this.enter,f=this.leave;let g="start",y="end",v="end",_="start";if(H(m)){const t=m.split(" ");v=t[0],g=t.length>1?t[1]:g}else if(X(m)){const t=m;U(t.container)||(v=t.container),U(t.target)||(g=t.target)}else z(m)&&(v=m);if(H(f)){const t=f.split(" ");_=t[0],y=t.length>1?t[1]:y}else if(X(f)){const t=f;U(t.container)||(_=t.container),U(t.target)||(y=t.target)}else z(f)&&(_=f);const b=si(e,g,c),T=si(e,y,c),x=b+d-u,S=T+d-p,w=si(e,v,u,x,S),C=si(e,_,u,x,S),$=b+d-w,E=T+d-C,N=E-$;this.offset=d,this.offsetStart=$,this.offsetEnd=E,this.distance=N<=0?0:N,this.thresholds=[g,y,v,_],this.coords=[b,T,w,C],t&&t.forEach(t=>t.revert()),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){if(!this.ready)return;const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,a=this.scroll,l=a<=this.offsetStart,h=a>=this.offsetEnd,d=!l&&!h,c=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&c,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(l&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&z(i)){if(i<1){const t=1e-4,s=e<g&&1===g?t:e>g&&!g?-t:0;g=gt(vt(e,g,vt(.01,.2,i))+s,6)}}else s&&(g=s(g));m=g!==this.prevProgress,f=1===e,m&&!f&&i&&e&&o.wakeTicker.restart()}if(p){const t=n?o.scrollY:o.scrollX;p.style[n?"top":"left"]=t+10+"px"}(d&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(d&&(this.isInView=!0),this.forceEnter&&this.hasEntered?d&&(this.forceEnter=!1):(p&&d&&(p.style.zIndex=""+this.container.zIndex++),this.onSyncEnter(this),this.onEnter(this),this.backward?(this.onSyncEnterBackward(this),this.onEnterBackward(this)):(this.onSyncEnterForward(this),this.onEnterForward(this)),this.hasEntered=!0,u&&(this.forceEnter=!0))),(d||!d&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!d&&this.isInView&&(this.isInView=!1,this.onSyncLeave(this),this.onLeave(this),this.backward?(this.onSyncLeaveBackward(this),this.onLeaveBackward(this)):(this.onSyncLeaveForward(this),this.onLeaveForward(this)),e&&!i&&(f=!0)),g>=1&&this.began&&!this.completed&&(e&&f||!e)&&(e&&this.onSyncComplete(this),this.completed=!0,(!this.repeat&&!t||!this.repeat&&t&&t.completed)&&this.revert()),g<1&&this.completed&&(this.completed=!1),this.prevProgress=g}revert(){if(this.reverted)return;const t=this.container;return wt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this.ready=!1,this}}const ai=(t={})=>new oi(t),li=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,hi=(t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=li(r,e,s)-t,i>0?o=r:n=r}while(ot(i)>1e-7&&++a<100);return r},di=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?Fe:r=>0===r||1===r?r:li(hi(r,t,s),e,i),ci=(t=10,e)=>{const s=e?lt:ht;return e=>s(ft(e,0,1)*t)*(1/t)},ui=(...t)=>{const e=t.length;if(!e)return Fe;const s=e-1,i=t[0],r=t[s],n=[0],o=[et(i)];for(let e=1;e<s;e++){const i=t[e],r=H(i)?i.trim().split(" "):[i],a=r[0],l=r[1];n.push(U(l)?e/s:et(l)/100),o.push(et(a))}return o.push(et(r)),n.push(1),function(t){for(let e=1,s=n.length;e<s;e++){const s=n[e];if(t<=s){const i=n[e-1],r=o[e-1];return r+(o[e]-r)*(t-i)/(s-i)}}return o[o.length-1]}},pi=(t=10,e=1)=>{const s=[0],i=t-1;for(let t=1;t<i;t++){const r=s[t-1],n=t/i,o=n*(1-e)+(n+((t+1)/i-n)*Math.random())*e;s.push(ft(o,r,1))}return s.push(1),ui(...s)};var mi=Object.freeze({__proto__:null,Spring:Rs,createSpring:Ds,cubicBezier:di,eases:Ue,irregular:pi,linear:ui,spring:As,steps:ci});const fi=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(gt(t(i/e),4));return`linear(${s.join(", ")})`},gi={},yi=t=>{let e=gi[t];if(e)return e;if(e="linear",H(t)){if(P(t,"linear")||P(t,"cubic-")||P(t,"steps")||P(t,"ease"))e=t;else if(P(t,"cubicB"))e=M(t);else{const s=qe(t);Y(s)&&(e=s===Fe?"linear":fi(s))}gi[t]=e}else if(Y(t)){const s=fi(t);s&&(e=s)}else t.ease&&(e=fi(t.ease));return e},vi=["x","y","z"],_i=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...vi],bi=(()=>[...vi,..._.filter(t=>["X","Y","Z"].some(e=>t.endsWith(e)))])();let Ti=null;const xi=(t,e,s,i,r)=>{let n=H(e)?e:It(e,s,i,r,null,null);return z(n)?_i.includes(t)||P(t,"translate")?`${n}px`:P(t,"rotate")||P(t,"skew")?`${n}deg`:`${n}`:n},Si=(t,e,s,i,r,n)=>{let o="0";const a=U(i)?getComputedStyle(t)[e]:xi(e,i,t,r,n);return o=U(s)?V(i)?i.map(s=>xi(e,s,t,r,n)):a:[xi(e,s,t,r,n),a],o};class wi{constructor(e,s){I.current&&I.current.register(this),W(Ti)&&(!t||!U(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(_.forEach(t=>{const e=P(t,"skew"),s=P(t,"scale"),i=P(t,"rotate"),r=P(t,"translate"),n=i||e,o=n?"<angle>":s?"<number>":r?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:o,inherits:!1,initialValue:r?"0px":n?"0deg":s?"1":"0"})}catch{}}),Ti=!0):Ti=!1);const i=Le(e);i.length||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const r=Ot(s.autoplay,L.defaults.autoplay),n=!(!r||!r.link)&&r,o=s.alternate&&!0===s.alternate,a=s.reversed&&!0===s.reversed,l=Ot(s.loop,L.defaults.loop),h=!0===l||l===1/0?1/0:z(l)?l+1:1,c=o?a?"alternate-reverse":"alternate":a?"reverse":"normal",u=1===L.timeScale?1:m;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||L.defaults.onComplete,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!r||!1!==n,this.reversed=a,this.persist=Ot(s.persist,L.defaults.persist),this.autoplay=r,this._speed=Ot(s.playbackRate,L.defaults.playbackRate),this._resolve=T,this._completed=0,this._inlineStyles=[],i.forEach((t,e)=>{const r=t[d],n=bi.some(t=>s.hasOwnProperty(t)),o=t.style,a=this._inlineStyles[e]={},l=Ot(s.ease,L.defaults.ease),p=It(l,t,e,i,null,null),m=Y(p)||H(p)?p:l,f=l.ease&&l,y=yi(m),T=(f?f.settlingDuration:It(Ot(s.duration,L.defaults.duration),t,e,i,null,null))*u,x=It(Ot(s.delay,L.defaults.delay),t,e,i,null,null)*u,S=Ot(s.composition,"replace");for(let l in s){if(!J(l))continue;const d={},p={iterations:h,direction:c,fill:"both",easing:y,duration:T,delay:x,composite:S},m=s[l],f=!!n&&(_.includes(l)?l:v.get(l)),g=f?"transform":l;let b;if(a[g]||(a[g]=o[g]),X(m)){const s=m,n=Ot(s.ease,y),a=n.ease&&n,h=s.to,c=s.from;if(p.duration=(a?a.settlingDuration:It(Ot(s.duration,T),t,e,i,null,null))*u,p.delay=It(Ot(s.delay,x),t,e,i,null,null)*u,p.composite=Ot(s.composition,S),p.easing=yi(n),b=Si(t,l,c,h,e,i),f?(d[`--${f}`]=b,r[f]=b):d[l]=Si(t,l,c,h,e,i),Ls(this,t,l,d,p),!U(c))if(f){const t=`--${f}`;o.setProperty(t,d[t][0])}else o[l]=d[l][0]}else b=V(m)?m.map(s=>xi(l,s,t,e,i)):xi(l,m,t,e,i),f?(d[`--${f}`]=b,r[f]=b):d[l]=b,Ls(this,t,l,d,p)}if(n){let t=g;for(let e in r)t+=`${b[e]}var(--${e})) `;o.transform=t}}),n&&this.autoplay.link(this)}forEach(t){try{const e=H(t)?e=>e[t]():t;this.animations.forEach(e)}catch{}return this}get speed(){return this._speed}set speed(t){this._speed=+t,this.forEach(e=>e.playbackRate=t)}get currentTime(){const t=this.controlAnimation,e=L.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===L.timeScale?1:m);this.forEach(t=>{!this.persist&&e>=this.duration&&t.play(),t.currentTime=e})}get progress(){return this.currentTime/this.duration}set progress(t){this.forEach(e=>e.currentTime=t*this.duration||0)}resume(){return this.paused?(this.paused=!1,this.forEach("play")):this}pause(){return this.paused?this:(this.paused=!0,this.forEach("pause"))}alternate(){return this.reversed=!this.reversed,this.forEach("reverse"),this.paused&&this.forEach("pause"),this}play(){return this.reversed&&this.alternate(),this.resume()}reverse(){return this.reversed||this.alternate(),this.resume()}seek(t,e=!1){return e&&(this.muteCallbacks=!0),t<this.duration&&(this.completed=!1),this.currentTime=t,this.muteCallbacks=!1,this.paused&&this.pause(),this}restart(){return this.completed=!1,this.seek(0,!0).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){return this.muteCallbacks=!0,this.commitStyles().forEach("cancel"),this.animations.length=0,requestAnimationFrame(()=>{this.targets.forEach(t=>{"none"===t.style.transform&&t.style.removeProperty("transform")})}),this}revert(){return this.cancel().targets.forEach((t,e)=>{const s=t.style,i=this._inlineStyles[e];for(let e in i){const r=i[e];U(r)||r===g?s.removeProperty(M(e)):t.style[e]=r}t.getAttribute("style")===g&&t.removeAttribute("style")}),this}then(t=T){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=T};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const Ci={animate:(t,e)=>new wi(t,e),convertEase:fi};let $i=0,Ei=0;const Ni=(t,e)=>!(!t||!e)&&(t===e||t.contains(e)),ki=t=>{if(!t)return null;const e=t.style,s=e.transition||"";return e.setProperty("transition","none","important"),s},Ri=(t,e)=>{if(!t)return;const s=t.style;e?s.transition=e:s.removeProperty("transition")},Ai=t=>{const e=t.layout.transitionMuteStore,s=t.$el,i=t.$measure;s&&!e.has(s)&&e.set(s,ki(s)),i&&!e.has(i)&&e.set(i,ki(i))},Di=t=>{t.forEach((t,e)=>Ri(e,t)),t.clear()},Oi={display:"none",visibility:"hidden",opacity:"0",transform:"none",position:"static"},Ii=t=>{if(!t)return;const e=t.parentNode;e&&(e._head===t&&(e._head=t._next),e._tail===t&&(e._tail=t._prev),t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t._prev=null,t._next=null,t.parentNode=null)},Li=(t,e,s,i)=>{let r=t.dataset.layoutId;r||(r=t.dataset.layoutId="node-"+Ei++);const n=i||{};return n.$el=t,n.$measure=t,n.id=r,n.index=0,n.targets=null,n.delay=0,n.duration=0,n.ease=null,n.state=s,n.layout=s.layout,n.parentNode=e||null,n.isTarget=!1,n.isEntering=!1,n.isLeaving=!1,n.isInlined=!1,n.hasTransform=!1,n.inlineStyles=[],n.inlineTransforms=null,n.inlineTransition=null,n.branchAdded=!1,n.branchRemoved=!1,n.branchNotRendered=!1,n.sizeChanged=!1,n.hasVisibilitySwap=!1,n.hasDisplayNone=!1,n.hasVisibilityHidden=!1,n.measuredInlineTransform=null,n.measuredInlineTransition=null,n.measuredDisplay=null,n.measuredVisibility=null,n.measuredPosition=null,n.measuredHasDisplayNone=!1,n.measuredHasVisibilityHidden=!1,n.measuredIsVisible=!1,n.measuredIsRemoved=!1,n.measuredIsInsideRoot=!1,n.properties={transform:"none",x:0,y:0,left:0,top:0,clientLeft:0,clientTop:0,width:0,height:0},n.layout.properties.forEach(t=>n.properties[t]=0),n._head=null,n._tail=null,n._prev=null,n._next=null,n},Bi=(t,e,s,i)=>{const r=t.$el,n=t.layout.root,o=n===r,a=t.properties,l=t.state.rootNode,h=t.parentNode,d=s.transform,c=r.style.transform,u=!!h&&h.measuredIsRemoved,p=s.position;o&&(t.layout.absoluteCoords="fixed"===p||"absolute"===p),t.$measure=e,t.inlineTransforms=c,t.hasTransform=d&&"none"!==d,t.measuredIsInsideRoot=Ni(n,e),t.measuredInlineTransform=null,t.measuredDisplay=s.display,t.measuredVisibility=s.visibility,t.measuredPosition=p,t.measuredHasDisplayNone="none"===s.display,t.measuredHasVisibilityHidden="hidden"===s.visibility,t.measuredIsVisible=!(t.measuredHasDisplayNone||t.measuredHasVisibilityHidden),t.measuredIsRemoved=t.measuredHasDisplayNone||t.measuredHasVisibilityHidden||u;let m=!1,f=r.previousSibling;for(;f&&(f.nodeType===Node.COMMENT_NODE||f.nodeType===Node.TEXT_NODE&&!f.textContent.trim());)f=f.previousSibling;if(f&&f.nodeType===Node.TEXT_NODE)m=!0;else{for(f=r.nextSibling;f&&(f.nodeType===Node.COMMENT_NODE||f.nodeType===Node.TEXT_NODE&&!f.textContent.trim());)f=f.nextSibling;m=null!==f&&f.nodeType===Node.TEXT_NODE}if(t.isInlined=m,t.hasTransform&&!i){const s=t.layout.transitionMuteStore;s.get(r)||(t.inlineTransition=ki(r)),e===r?r.style.transform="none":(s.get(e)||(t.measuredInlineTransition=ki(e)),t.measuredInlineTransform=e.style.transform,e.style.transform="none")}let g,y,v=0,_=0,b=0,T=0;if(!i){const t=e.getBoundingClientRect();v=t.left,_=t.top,b=t.width,T=t.height}for(let t in a){const e="transform"===t?d:s[t]||s.getPropertyValue&&s.getPropertyValue(t);U(e)||(a[t]=e)}if(a.left=v,a.top=_,a.clientLeft=i?0:e.clientLeft,a.clientTop=i?0:e.clientTop,o)t.layout.absoluteCoords?(g=v,y=_):(g=0,y=0);else{const e=h||l,s=e.properties.left,i=e.properties.top,r=e.properties.clientLeft,n=e.properties.clientTop;if(t.layout.absoluteCoords)g=v-s-r,y=_-i-n;else if(e===l){const t=l.properties.left,e=l.properties.top;g=v-t-l.properties.clientLeft,y=_-e-l.properties.clientTop}else g=v-s-r,y=_-i-n}return a.x=g,a.y=y,a.width=b,a.height=T,t},Mi=(t,e)=>{if(e)for(let s in e)t.properties[s]=e[s]},Pi=(t,e)=>{const s=It(e.ease,t.$el,t.index,t.targets,null,null),i=Y(s)?s:e.ease,r=!U(i)&&!U(i.ease);t.ease=r?i.ease:i,t.duration=r?i.settlingDuration:It(e.duration,t.$el,t.index,t.targets,null,null),t.delay=It(e.delay,t.$el,t.index,t.targets,null,null)},Fi=t=>{const e=t.$el.style,s=t.inlineStyles;s.length=0,t.layout.recordedProperties.forEach(t=>{s.push(t,e[t]||"")})},Vi=t=>{const e=t.$el.style,s=t.inlineStyles;for(let t=0,i=s.length;t<i;t+=2){const i=s[t],r=s[t+1];r&&""!==r?e[i]=r:(e[i]="",e.removeProperty(i))}},Xi=t=>{const e=t.inlineTransforms,s=t.$el.style;!t.hasTransform||!e||t.hasTransform&&"none"===s.transform||e&&"none"===e?s.removeProperty("transform"):e&&(s.transform=e);const i=t.$measure;if(t.hasTransform&&i!==t.$el){const e=i.style,s=t.measuredInlineTransform;s&&""!==s?e.transform=s:e.removeProperty("transform")}t.measuredInlineTransform=null,null!==t.inlineTransition&&(Ri(t.$el,t.inlineTransition),t.inlineTransition=null),i!==t.$el&&null!==t.measuredInlineTransition&&(Ri(i,t.measuredInlineTransition),t.measuredInlineTransition=null)},zi=t=>{(t.measuredIsRemoved||t.hasVisibilitySwap)&&(t.$el.style.removeProperty("display"),t.$el.style.removeProperty("visibility"),t.hasVisibilitySwap&&(t.$measure.style.removeProperty("display"),t.$measure.style.removeProperty("visibility"))),t.layout.pendingRemoval.delete(t.$el)},Hi=(t,e,s)=>(e.properties={...t.properties},e.state=s,e.isTarget=t.isTarget,e.hasTransform=t.hasTransform,e.inlineTransforms=t.inlineTransforms,e.measuredIsVisible=t.measuredIsVisible,e.measuredDisplay=t.measuredDisplay,e.measuredIsRemoved=t.measuredIsRemoved,e.measuredHasDisplayNone=t.measuredHasDisplayNone,e.measuredHasVisibilityHidden=t.measuredHasVisibilityHidden,e.hasDisplayNone=t.hasDisplayNone,e.isInlined=t.isInlined,e.hasVisibilityHidden=t.hasVisibilityHidden,e);class Yi{constructor(t){this.layout=t,this.rootNode=null,this.rootNodes=new Set,this.nodes=new Map,this.scrollX=0,this.scrollY=0}revert(){return this.forEachNode(t=>{this.layout.pendingRemoval.delete(t.$el),t.$el.removeAttribute("data-layout-id"),t.$measure.removeAttribute("data-layout-id")}),this.rootNode=null,this.rootNodes.clear(),this.nodes.clear(),this}getNode(t){if(t&&t.dataset)return this.nodes.get(t.dataset.layoutId)}getComputedValue(t,e){const s=this.getNode(t);if(s)return s.properties[e]}forEach(t,e){let s=t,i=0;for(;s;)if(e(s,i++),s._head)s=s._head;else if(s._next)s=s._next;else{for(;s&&!s._next;)s=s.parentNode;s&&(s=s._next)}}forEachRootNode(t){this.forEach(this.rootNode,t)}forEachNode(t){for(const e of this.rootNodes)this.forEach(e,t)}registerElement(t,e){if(!t||1!==t.nodeType)return null;this.layout.transitionMuteStore.has(t)||this.layout.transitionMuteStore.set(t,ki(t));const s=[t,e],i=this.layout.root;let r=null;for(;s.length;){const t=s.pop(),e=s.pop();if(!e||1!==e.nodeType||q(e))continue;const n=!!t&&t.measuredIsRemoved,o=n?Oi:getComputedStyle(e),a=!!n||"none"===o.display,l=!!n||"hidden"===o.visibility,h=!a&&!l,d=e.dataset.layoutId,c=Ni(i,e);let u=d?this.nodes.get(d):null;if(u&&u.$el!==e){const a=Ni(i,u.$el),l=u.measuredIsVisible;if(a||!c&&(c||l||!h)){if(a&&!l&&h){Bi(u,e,o,n);let t=e.lastElementChild;for(;t;)s.push(t,u),t=t.previousElementSibling;r||(r=u);continue}{let i=e.lastElementChild;for(;i;)s.push(i,t),i=i.previousElementSibling;r||(r=u);continue}}Ii(u),u=Li(e,t,this,u)}else u=Li(e,t,this,u);u.branchAdded=!1,u.branchRemoved=!1,u.branchNotRendered=!1,u.isTarget=!1,u.sizeChanged=!1,u.hasVisibilityHidden=l,u.hasDisplayNone=a,u.hasVisibilitySwap=l&&!u.measuredHasVisibilityHidden||a&&!u.measuredHasDisplayNone,this.nodes.set(u.id,u),u.parentNode=t||null,u._prev=null,u._next=null,t?(this.rootNodes.delete(u),t._head?(t._tail._next=u,u._prev=t._tail,t._tail=u):(t._head=u,t._tail=u)):this.rootNodes.add(u),Bi(u,u.$el,o,n);let p=e.lastElementChild;for(;p;)s.push(p,u),p=p.previousElementSibling;r||(r=u)}return r}ensureDetachedNode(t,e){if(!t||t===this.layout.root)return null;const s=t.dataset.layoutId,i=s?this.nodes.get(s):null;if(i&&i.$el===t)return i;let r=null,n=t.parentElement;for(;n&&n!==this.layout.root;){if(e.has(n)){r=this.ensureDetachedNode(n,e);break}n=n.parentElement}return this.registerElement(t,r)}record(){const t=this.layout,e=t.children,s=t.root,i=V(e)?e:[e],r=[],n="*"===e?s:I.root,o=[];let a=s.parentElement;for(;a&&1===a.nodeType;){const t=getComputedStyle(a);if(t.transform&&"none"!==t.transform){const t=a.style.transform||"",e=ki(a);o.push(a,t,e),a.style.transform="none"}a=a.parentElement}for(let t=0,e=i.length;t<e;t++){const e=i[t];r[t]=H(e)?n.querySelectorAll(e):e}const l=Le(r);this.nodes.clear(),this.rootNodes.clear();const h=this.registerElement(s,null);h.isTarget=!0,this.rootNode=h;const d=new Set;let c=0;const u=[];this.nodes.forEach(t=>{u.push(t.$el)}),this.nodes.forEach((t,e)=>{t.index=c++,t.targets=u,t&&t.measuredIsInsideRoot&&d.add(e)});const p=new Set,m=[];for(let t=0,e=l.length;t<e;t++){const e=l[t];if(e&&1===e.nodeType&&e!==s){if(!Ni(s,e)){const t=e.dataset.layoutId;if(!t||!d.has(t))continue}p.has(e)||(p.add(e),m.push(e))}}for(let t=0,e=m.length;t<e;t++)this.ensureDetachedNode(m[t],p);for(let t=0,e=l.length;t<e;t++){const e=l[t],s=this.getNode(e);if(s){let t=s;for(;t&&!t.isTarget;)t.isTarget=!0,t=t.parentNode}}this.scrollX=window.scrollX,this.scrollY=window.scrollY,this.forEachNode(Xi);for(let t=0,e=o.length;t<e;t+=3){const e=o[t],s=o[t+1],i=o[t+2];s&&""!==s?e.style.transform=s:e.style.removeProperty("transform"),Ri(e,i)}return this}}function Ui(t){const e={},s={};for(let i in t){const r=t[i];"duration"===i||"delay"===i||"ease"===i?s[i]=r:e[i]=r}return[e,s]}class Wi{constructor(t,e={}){I.current&&I.current.register(this);const s=Ui(e.swapAt),i=Ui(e.enterFrom),r=Ui(e.leaveTo),n=e.properties;if(e.duration=Ot(e.duration,350),e.delay=Ot(e.delay,0),e.ease=Ot(e.ease,"inOut(3.5)"),this.params=e,this.root=Le(t)[0],this.id=e.id||$i++,this.children=e.children||"*",this.absoluteCoords=!1,this.swapAtParams=xt(e.swapAt||{opacity:0},{ease:"inOut(1.75)"}),this.enterFromParams=e.enterFrom||{opacity:0},this.leaveToParams=e.leaveTo||{opacity:0},this.properties=new Set(["opacity","fontSize","color","backgroundColor","borderRadius","border","filter","clipPath"]),s[0])for(let t in s[0])this.properties.add(t);if(i[0])for(let t in i[0])this.properties.add(t);if(r[0])for(let t in r[0])this.properties.add(t);if(n)for(let t=0,e=n.length;t<e;t++)this.properties.add(n[t]);this.recordedProperties=new Set(["display","visibility","translate","position","left","top","marginLeft","marginTop","width","height","maxWidth","maxHeight","minWidth","minHeight"]),this.properties.forEach(t=>this.recordedProperties.add(t)),this.pendingRemoval=new WeakSet,this.transitionMuteStore=new Map,this.oldState=new Yi(this),this.newState=new Yi(this),this.timeline=null,this.transformAnimation=null,this.animating=[],this.swapping=[],this.leaving=[],this.entering=[],this.oldState.record(),Di(this.transitionMuteStore)}revert(){return this.root.classList.remove("is-animated"),this.timeline&&(this.timeline.complete(),this.timeline=null),this.transformAnimation&&(this.transformAnimation.complete(),this.transformAnimation=null),this.animating.length=this.swapping.length=this.leaving.length=this.entering.length=0,this.oldState.revert(),this.newState.revert(),requestAnimationFrame(()=>Di(this.transitionMuteStore)),this}record(){return this.transformAnimation&&(this.transformAnimation.cancel(),this.transformAnimation=null),this.oldState.record(),this.timeline&&(this.timeline.cancel(),this.timeline=null),this.newState.forEachRootNode(Vi),this}animate(t={}){const e={ease:Ot(t.ease,this.params.ease),delay:Ot(t.delay,this.params.delay),duration:Ot(t.duration,this.params.duration)},s={id:this.id},i=Ot(t.onComplete,this.params.onComplete),r=Ot(t.onPause,this.params.onPause);for(let e in O)"ease"!==e&&"duration"!==e&&"delay"!==e&&(U(t[e])?U(this.params[e])||(s[e]=this.params[e]):s[e]=t[e]);s.onComplete=()=>{const e=t.autoplay,s=L.editor;if(e&&e.linked||s&&s.showPanel)i&&i(this.timeline);else{this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(t=>{zi(t),Vi(t)});for(let t=0,e=S.length;t<e;t++){const e=S[t];e.style.transform=f.getComputedValue(e,"transform")}this.root.classList.contains("is-animated")&&(this.root.classList.remove("is-animated"),i&&i(this.timeline)),requestAnimationFrame(()=>{this.root.classList.contains("is-animated")||Di(this.transitionMuteStore)})}},s.onPause=()=>{const e=t.autoplay;if(e&&e.linked)return i&&i(this.timeline),void(r&&r(this.timeline));this.root.classList.contains("is-animated")&&(this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(zi),this.root.classList.remove("is-animated"),i&&i(this.timeline),r&&r(this.timeline))},s.composition=!1;const n=xt(xt(t.swapAt||{},this.swapAtParams),e),o=xt(xt(t.enterFrom||{},this.enterFromParams),e),a=xt(xt(t.leaveTo||{},this.leaveToParams),e),[l,h]=Ui(n),[d,c]=Ui(o),[u,p]=Ui(a),m=this.oldState,f=this.newState,g=this.animating,y=this.swapping,v=this.entering,_=this.leaving,b=this.pendingRemoval;g.length=y.length=v.length=_.length=0,m.forEachRootNode(Ai),f.record(),f.forEachRootNode(Fi);const T=[],x=[],S=[],w=[],C=f.rootNode,$=C.$el;f.forEachRootNode(t=>{const e=t.$el,s=t.id,i=t.parentNode,r=!!i&&i.branchAdded,n=!!i&&i.branchRemoved,o=!!i&&i.branchNotRendered;let a=m.nodes.get(s);const l=!a;l?(a=Hi(t,{},m),m.nodes.set(s,a),a.measuredIsRemoved=!0):a.measuredIsRemoved&&!t.measuredIsRemoved&&(Hi(t,a,m),a.measuredIsRemoved=!0);const h=a.parentNode,c=(h?h.id:null)!==(i?i.id:null),p=a.$el!==t.$el,y=a.measuredIsRemoved,x=t.measuredIsRemoved;if(!a.measuredIsRemoved&&!x&&!l&&(c||p)){const t=a.properties.left,e=a.properties.top,s=i||f.rootNode,r=s.id?m.nodes.get(s.id):null,n=r?r.properties.left:s.properties.left,o=r?r.properties.top:s.properties.top,l=r?r.properties.clientLeft:s.properties.clientLeft,h=r?r.properties.clientTop:s.properties.clientTop;a.properties.x=t-n-l,a.properties.y=e-o-h}t.hasVisibilitySwap&&(t.hasVisibilityHidden&&(t.$el.style.visibility="visible",t.$measure.style.visibility="hidden"),t.hasDisplayNone&&(t.$el.style.display=a.measuredDisplay||t.measuredDisplay||"",t.$measure.style.visibility="hidden"));const S=b.has(e),w=a.measuredIsVisible,$=t.measuredIsVisible,E=!w&&$&&!o,N=!x&&(y||S)&&!r,k=x&&!y&&!n,R=k||x&&S&&!n;t.branchAdded=r||N,t.branchRemoved=n||R,t.branchNotRendered=o||x,x&&w&&(t.$el.style.display=a.measuredDisplay,t.$el.style.visibility="visible",Hi(a,t,f)),k?(t.isTarget&&(_.push(e),t.isLeaving=!0),b.add(e)):!x&&S&&b.delete(e),N&&!o||E?(Mi(a,d),t.isTarget&&(v.push(e),t.isEntering=!0)):R&&!o&&Mi(t,u),t===C||!t.isTarget||t.isEntering||t.isLeaving||g.push(e),T.push(e)});let E=0,N=0,k=0;f.forEachRootNode(t=>{const s=t.$el,i=t.parentNode,r=m.nodes.get(t.id),n=t.properties,o=r.properties;let a=i!==C&&i;for(;a&&!a.isTarget&&a!==C;)a=a.parentNode;t===C?(t.index=0,t.targets=g,Pi(t,e)):t.isEntering?(t.index=a?a.index:E,t.targets=a?g:v,Pi(t,c),E++):t.isLeaving?(t.index=a?a.index:N,t.targets=a?g:_,N++,Pi(t,p)):t.isTarget?(t.index=k++,t.targets=g,Pi(t,e)):(t.index=a?a.index:0,t.targets=g,Pi(t,h)),r.index=t.index,r.targets=t.targets;for(let e in n)n[e]=It(n[e],s,t.index,t.targets,null,null),o[e]=It(o[e],s,r.index,r.targets,null,null);const d=Math.abs(n.width-o.width)>1,u=Math.abs(n.height-o.height)>1;if(t.sizeChanged=d||u,t.isTarget&&(!t.measuredIsRemoved&&r.measuredIsVisible||t.measuredIsRemoved&&t.measuredIsVisible)){"none"===n.transform&&"none"===o.transform||(t.hasTransform=!0,S.push(s));for(let t in n)if("transform"!==t&&n[t]!==o[t]){x.push(s);break}}t.isTarget||(y.push(s),t.sizeChanged&&i&&i.isTarget&&i.sizeChanged&&(l.transform&&(t.hasTransform=!0,S.push(s)),w.push(s)))});const R={delay:t=>f.getNode(t).delay,duration:t=>f.getNode(t).duration,ease:t=>f.getNode(t).ease};if(s.defaults=R,this.timeline=ys(s),!x.length&&!S.length&&!y.length)return Di(this.transitionMuteStore),this.timeline.complete();if(T.length){this.root.classList.add("is-animated");for(let t=0,e=T.length;t<e;t++){const e=T[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties;r.isInlined||("grid"!==i.measuredDisplay&&"grid"!==r.measuredDisplay||e.style.setProperty("display","block","important"),(e!==$||this.absoluteCoords)&&(e.style.position=this.absoluteCoords?"fixed":"absolute",e.style.left="0px",e.style.top="0px",e.style.marginLeft="0px",e.style.marginTop="0px",e.style.translate=`${n.x}px ${n.y}px`),e===$&&"static"===r.measuredPosition&&(e.style.position="relative",e.style.left="0px",e.style.top="0px")),e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none"}m.scrollX===window.scrollX&&m.scrollY===window.scrollY||requestAnimationFrame(()=>window.scrollTo(m.scrollX,m.scrollY));for(let t=0,e=x.length;t<e;t++){const e=x[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties,o=r.properties;let a=!1;const l={composition:"none"};n.width!==o.width&&(l.width=[n.width,o.width],a=!0),n.height!==o.height&&(l.height=[n.height,o.height],a=!0),r.hasTransform||r.isInlined||(l.translate=[`${n.x}px ${n.y}px`,`${o.x}px ${o.y}px`],a=!0),this.properties.forEach(t=>{const e=n[t],s=o[t];"transform"!==t&&e!==s&&(l[t]=[e,s],a=!0)}),a&&this.timeline.add(e,l,0)}}if(y.length){for(let t=0,e=y.length;t<e;t++){const e=y[t],s=m.getNode(e),i=s.properties;e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",s.isInlined||(e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${m.getComputedValue(e,t)}`)})}for(let t=0,e=y.length;t<e;t++){const e=y[t],s=f.getNode(e),i=s.properties;this.timeline.call(()=>{e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",s.isInlined||(e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${f.getComputedValue(e,t)}`)})},s.delay+s.duration/2)}if(w.length){const t=Ge(f.nodes.get(w[0].dataset.layoutId).ease),e=e=>1-t(1-e),s={};if(l)for(let t in l)"transform"!==t&&(s[t]=[{from:e=>m.getComputedValue(e,t),to:l[t]},{from:l[t],to:e=>f.getComputedValue(e,t),ease:e}]);this.timeline.add(w,s,0)}}const A=S.length;if(A){for(let t=0;t<A;t++){const e=S[t],s=f.getNode(e);s.isInlined||(e.style.translate=`${m.getComputedValue(e,"x")}px ${m.getComputedValue(e,"y")}px`),e.style.transform=m.getComputedValue(e,"transform"),w.includes(e)&&(s.ease=It(n.ease,e,s.index,s.targets,null,null),s.duration=It(n.duration,e,s.index,s.targets,null,null))}this.transformAnimation=Ci.animate(S,{translate:t=>f.getNode(t).isInlined?"0px 0px":`${f.getComputedValue(t,"x")}px ${f.getComputedValue(t,"y")}px`,transform:t=>{const e=f.getComputedValue(t,"transform");if(!w.includes(t))return e;const s=m.getComputedValue(t,"transform"),i=f.getNode(t);return[s,It(l.transform,t,i.index,i.targets,null,null),e]},autoplay:!1,...R}),this.timeline.sync(this.transformAnimation,0)}return this.timeline.init()}update(t,e={}){return this.record(),t(this),this.animate(e)}}const qi=(t,e)=>new Wi(t,e),ji=Ns,Gi={},Zi=(t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s),Qi=t=>(...e)=>{const s=t(...e);return new Proxy(T,{apply:(t,e,[i])=>s(i),get:(t,e)=>{if(Gi[e])return Qi((...t)=>{const i=Gi[e](...t);return t=>i(s(t))})}})},Ji=(t,e,s=0)=>{const i=(...t)=>(t.length<e.length?Qi(Zi(e,s)):e)(...t);return Gi[t]||(Gi[t]=i),i},Ki=Ji("roundPad",ji.roundPad),tr=Ji("padStart",ji.padStart),er=Ji("padEnd",ji.padEnd),sr=Ji("wrap",ji.wrap),ir=Ji("mapRange",ji.mapRange),rr=Ji("degToRad",ji.degToRad),nr=Ji("radToDeg",ji.radToDeg),or=Ji("snap",ji.snap),ar=Ji("clamp",ji.clamp),lr=Ji("round",ji.round),hr=Ji("lerp",ji.lerp,1),dr=Ji("damp",ji.damp,1),cr=(t=0,e=1,s=0)=>{const i=10**s;return Math.floor((Math.random()*(e-t+1/i)+t)*i)/i};let ur=0;const pr=(t,e=0,s=1,i=0)=>{let r=void 0===t?ur++:t;return(t=e,n=s,o=i)=>{r+=1831565813,r=Math.imul(r^r>>>15,1|r),r^=r+Math.imul(r^r>>>7,61|r);const a=10**o;return Math.floor((((r^r>>>14)>>>0)/4294967296*(n-t+1/a)+t)*a)/a}},mr=t=>t[cr(0,t.length-1)],fr=t=>{let e,s,i=t.length;for(;i;)s=cr(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},gr=(t,e={})=>{let s,i=[],r=0;const n=e.from,o=e.reversed,a=e.ease,l=!U(a),h=l&&!U(a.ease)?a.ease:l?Ge(a):null,d=e.grid,c=!0===d,u=e.axis,p=e.total,m=U(n)||0===n||"first"===n,f="center"===n,y="last"===n,v="random"===n,_=V(n),b=V(t),T=e.use,x=et(b?t[0]:t),S=b?et(t[1]):0,w=k.exec((b?t[1]:t)+g),C=e.start||0+(b?x:0);let $=m?0:z(n)?n:0;return(t,a,l,m,g)=>{const[E]=Le(t),N=U(p)?l.length:p,k=!U(T)&&(Y(T)?T(E,a,N):Mt(E,T)),R=z(k)||H(k)&&z(+k)?+k:a;if(f&&($=(N-1)/2),y&&($=N-1),!i.length){if(c){let t=!0,e=1/0,s=1/0,r=-1/0,o=-1/0;const a=[],h=[];for(let i=0;i<N;i++){const n=l[i];let d=0,c=0,u=!1;if(n&&Y(n.getBoundingClientRect)){const t=n.getBoundingClientRect();d=t.left+t.width/2,c=t.top+t.height/2,u=!0}else{const t=n;t&&z(t.x)&&z(t.y)&&(d=t.x,c=t.y,u=!0)}if(!u){t=!1;break}a.push(d),h.push(c),d<e&&(e=d),c<s&&(s=c),d>r&&(r=d),c>o&&(o=c)}if(t){let t=a[0],l=h[0];_?(t=e+n[0]*(r-e),l=s+n[1]*(o-s)):f?(t=(e+r)/2,l=(s+o)/2):y?(t=a[N-1],l=h[N-1]):z(n)&&(t=a[n],l=h[n]);for(let e=0;e<N;e++){const s=t-a[e],r=l-h[e];let n=it(s*s+r*r);"x"===u&&(n=-s),"y"===u&&(n=-r),i.push(n)}let d=1/0;for(let t=0,e=i.length;t<e;t++){const e=ot(i[t]);e>0&&e<d&&(d=e)}if(d>0&&d<1/0)for(let t=0,e=i.length;t<e;t++)i[t]=i[t]/d}else for(let t=0;t<N;t++)i.push(ot($-t))}else for(let t=0;t<N;t++)if(d){let e,s;_?(e=n[0]*(d[0]-1),s=n[1]*(d[1]-1)):f?(e=(d[0]-1)/2,s=(d[1]-1)/2):(e=$%d[0],s=ht($/d[0]));const r=e-t%d[0],o=s-ht(t/d[0]);let a=it(r*r+o*o);"x"===u&&(a=-r),"y"===u&&(a=-o),i.push(a)}else i.push(ot($-t));r=ct(...i),h&&(i=i.map(t=>h(t/r)*r)),o&&(i=i.map(t=>u?t<0?-1*t:-t:ot(r-t))),v&&(i=fr(i))}const A=b?(S-x)/r:x;U(s)&&(s=g?us(g,U(e.start)?g.iterationDuration:C):C);let D=s+(A*gt(i[R],2)||0);return e.modifier&&(D=e.modifier(D)),w&&(D=`${D}${w[2]}`),D}};var yr=Object.freeze({__proto__:null,$:Le,addChild:Ct,clamp:ar,cleanInlineStyles:he,createSeededRandom:pr,damp:dr,degToRad:rr,forEachChildren:St,get:Bs,keepTime:qs,lerp:hr,mapRange:ir,padEnd:er,padStart:tr,radToDeg:nr,random:cr,randomPick:mr,remove:Ps,removeChild:wt,round:lr,roundPad:Ki,set:Ms,shuffle:fr,snap:or,stagger:gr,sync:Ws,wrap:sr});const vr=t=>{const e=Ie(t)[0];return e&&q(e)?e:console.warn(`${t} is not a valid SVGGeometryElement`)},_r=(t,e,s,i,r)=>{const n=s+i,o=r?Math.max(0,Math.min(n,e)):(n%e+e)%e;return t.getPointAtLength(o)},br=(t,e,s=0)=>i=>{const r=+t.getTotalLength(),n=i[h],o=t.getCTM(),a=0===s;return{from:0,to:r,modifier:i=>{const l=i+s*r;if("a"===e){const e=_r(t,r,l,-1,a),s=_r(t,r,l,1,a);return 180*ut(s.y-e.y,s.x-e.x)/pt}{const s=_r(t,r,l,0,a);return"x"===e?n||!o?s.x:s.x*o.a+s.y*o.c+o.e:n||!o?s.y:s.x*o.b+s.y*o.d+o.f}}}},Tr=(t,e=0)=>{const s=vr(t);if(s)return{translateX:br(s,"x",e),translateY:br(s,"y",e),rotate:br(s,"a",e)}},xr=t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(it(s.a*s.a+s.b*s.b)+it(s.c*s.c+s.d*s.d))/2)}return e},Sr=(t,e,s)=>{const i=m,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let a=n;const l=new Proxy(t,{get(t,e){const s=t[e];return e===c?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],l=+s[1],h=xr(o),d=-1e3*r*h,c=l*i*h+d,u=i*h+(0===r&&1===l||1===r&&0===l?0:10*h)-c;if("butt"!==n){const e=r===l?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${d}`),t.setAttribute("stroke-dasharray",`${c} ${u}`)}return Reflect.apply(s,t,e)}:Y(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),l.setAttribute("draw",`${e} ${s}`)),l},wr=(t,e=0,s=0)=>Ie(t).map(t=>Sr(t,e,s)),Cr=(t,e=.33)=>(s,i,r,n)=>{if(!(s.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${s.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const o=vr(t);if(!o)throw new Error("Can't morph to an invalid target. 'path2' must resolve to an existing <path>, <polygon> or <polyline> SVG element.");if(!(o.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${o.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const a="path"===s.tagName,l=a?" ":",",h=n?n._value:null;h&&s.setAttribute(a?"d":"points",h);let d="",c="";if(e){const t=s.getTotalLength(),i=o.getTotalLength(),r=Math.max(Math.ceil(t*e),Math.ceil(i*e));for(let e=0;e<r;e++){const n=e/(r-1),h=s.getPointAtLength(t*n),u=o.getPointAtLength(i*n),p=a?0===e?"M":"L":"";d+=p+gt(h.x,3)+l+h.y+" ",c+=p+gt(u.x,3)+l+u.y+" "}}else d=s.getAttribute(a?"d":"points"),c=o.getAttribute(a?"d":"points");return[d,c]};var $r=Object.freeze({__proto__:null,createDrawable:wr,createMotionPath:Tr,morphTo:Cr});const Er="undefined"!=typeof Intl&&Intl.Segmenter,Nr=/\{value\}/g,kr=/\{i\}/g,Rr=/(\s+)/,Ar=/^\s+$/,Dr="line",Or="word",Ir="char",Lr="data-line";let Br=null,Mr=null,Pr=null;const Fr=t=>t.isWordLike||" "===t.segment||z(+t.segment),Vr=t=>t.setAttribute("aria-hidden","true"),Xr=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],zr={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},Hr=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&Hr(e)}},Yr=(t,e,s)=>{const i=t.getAttribute(Lr);if(null!==i&&+i!==e||"BR"===t.tagName){s.add(t);const e=t.previousSibling,i=t.nextSibling;e&&3===e.nodeType&&Ar.test(e.textContent)&&s.add(e),i&&3===i.nodeType&&Ar.test(i.textContent)&&s.add(i)}let r=t.childElementCount;for(;r--;)Yr(t.children[r],e,s);return s},Ur=(t,e={})=>{let s="";const i=H(e.class)?` class="${e.class}"`:"",r=Ot(e.clone,!1),n=Ot(e.wrap,!1),o=n?!0===n?"clip":n:!!r&&"clip";return n&&(s+=`<span${o?` style="overflow:${o};"`:""}>`),s+=`<span${i}${r?' style="position:relative;"':""} data-${t}="{i}">`,r?(s+="<span>{value}</span>",s+=`<span inert style="position:absolute;top:${"top"===r?"-100%":"bottom"===r?"100%":"0"};left:${"left"===r?"-100%":"right"===r?"100%":"0"};white-space:nowrap;">{value}</span>`):s+="{value}",s+="</span>",n&&(s+="</span>"),s},Wr=(t,e,s,i,r,n,o,a,l)=>{const h=r===Dr,d=r===Ir,c=`_${r}_`,u=Y(t)?t(s):t,p=h?"block":"inline-block";Pr.innerHTML=u.replace(Nr,`<i class="${c}"></i>`).replace(kr,`${d?l:h?o:a}`);const m=Pr.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,y=m.querySelectorAll(`i.${c}`),v=y.length;if(v){f.style.display=p,g.style.display=p,g.setAttribute(Lr,`${o}`),h||(g.setAttribute("data-word",`${a}`),d&&g.setAttribute("data-char",`${l}`));let t=v;for(;t--;){const e=y[t],i=e.parentElement;i.style.display=p,h?i.innerHTML=s.innerHTML:i.replaceChild(s.cloneNode(!0),e)}e.push(g),i.appendChild(m)}else console.warn('The expression "{value}" is missing from the provided template.');return n&&(f.style.outline=`1px dotted ${zr[r]}`),f};class qr{constructor(e,i={}){Br||(Br=Er?new Er([],{granularity:Or}):{segment:t=>{const e=[],s=t.split(Rr);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!Ar.test(i)})}return e}}),Mr||(Mr=Er?new Er([],{granularity:"grapheme"}):{segment:t=>[...t].map(t=>({segment:t}))}),!Pr&&t&&(Pr=s.createElement("template")),I.current&&I.current.register(this);const{words:r,chars:n,lines:o,accessible:a,includeSpaces:l,debug:h}=i,d=(e=V(e)?e[0]:e)&&e.nodeType?e:(Oe(e)||[])[0],c=!0===o?{}:o,u=!0===r||U(r)?{}:r,p=!0===n?{}:n;this.debug=Ot(h,!1),this.includeSpaces=Ot(l,!1),this.accessible=Ot(a,!0),this.linesOnly=c&&!u&&!p,this.lineTemplate=X(c)?Ur(Dr,c):c,this.wordTemplate=X(u)||this.linesOnly?Ur(Or,u):u,this.charTemplate=X(p)?Ur(Ir,p):p,this.$target=d,this.html=d&&d.innerHTML,this.lines=[],this.words=[],this.chars=[],this.effects=[],this.effectsCleanups=[],this.cache=null,this.ready=!1,this.width=0,this.resizeTimeout=null;const m=()=>this.html&&(c||u||p)&&this.split();this.resizeObserver=new ResizeObserver(()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{const t=d.offsetWidth;t!==this.width&&(this.width=t,m())},150)}),this.lineTemplate&&!this.ready?s.fonts.ready.then(m):m(),d?this.resizeObserver.observe(d):console.warn("No Text Splitter target found.")}addEffect(t){if(!Y(t))return console.warn("Effect must return a function."),this;const e=qs(t);return this.effects.push(e),this.ready&&(this.effectsCleanups[this.effects.length-1]=e(this)),this}revert(){return clearTimeout(this.resizeTimeout),this.lines.length=this.words.length=this.chars.length=0,this.resizeObserver.disconnect(),this.effectsCleanups.forEach(t=>Y(t)?t(this):t.revert&&t.revert()),this.$target.innerHTML=this.html,this}splitNode(t){const e=this.wordTemplate,i=this.charTemplate,r=this.includeSpaces,n=this.debug,o=t.nodeType;if(3===o){const o=t.nodeValue;if(o.trim()){const a=[],l=this.words,h=this.chars,d=Br.segment(o),c=s.createDocumentFragment();let u=null;for(const t of d){const e=t.segment,s=Fr(t);if(!u||s&&u&&Fr(u))a.push(e);else{const t=a.length-1,s=a[t];Rr.test(s)||Rr.test(e)?a.push(e):a[t]+=e}u=t}for(let t=0,o=a.length;t<o;t++){const o=a[t];if(o.trim()){const d=a[t+1],u=r&&d&&!d.trim(),p=o,m=i?Mr.segment(p):null,f=i?s.createDocumentFragment():s.createTextNode(u?o+" ":o);if(i){const t=[...m];for(let e=0,r=t.length;e<r;e++){const o=t[e],a=e===r-1&&u?o.segment+" ":o.segment,d=s.createTextNode(a);Wr(i,h,d,f,Ir,n,-1,l.length,h.length)}}e?Wr(e,l,f,c,Or,n,-1,l.length,h.length):i?c.appendChild(f):c.appendChild(s.createTextNode(o)),u&&t++}else{if(t&&r)continue;c.appendChild(s.createTextNode(o))}}t.parentNode.replaceChild(c,t)}}else if(1===o){const e=[...t.childNodes];for(let t=0,s=e.length;t<s;t++)this.splitNode(e[t])}}split(t=!1){const e=this.$target,i=!!this.cache&&!t,r=this.lineTemplate,n=this.wordTemplate,o=this.charTemplate,a="loading"!==s.fonts.status,l=r&&a;this.ready=!r||a,(l||t)&&this.effectsCleanups.forEach(t=>Y(t)&&t(this)),i||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),l&&(i&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=Xr(e,Or))),o&&(l||n)&&(this.chars=Xr(e,Ir));const h=this.words.length?this.words:this.chars;let d,c=0;for(let t=0,e=h.length;t<e;t++){const e=h[t],{top:s,height:i}=e.getBoundingClientRect();!U(d)&&s-d>.5*i&&c++,e.setAttribute(Lr,`${c}`);const r=e.querySelectorAll(`[${Lr}]`);let n=r.length;for(;n--;)r[n].setAttribute(Lr,`${c}`);d=s}if(l){const t=s.createDocumentFragment(),i=new Set,a=[];for(let t=0;t<c+1;t++){const s=e.cloneNode(!0);Yr(s,t,new Set).forEach(t=>{const e=t.parentNode;e&&(1===t.nodeType&&i.add(e),e.removeChild(t))}),a.push(s)}i.forEach(Hr);for(let e=0,s=a.length;e<s;e++)Wr(r,this.lines,a[e],t,Dr,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=Xr(e,Or)),o&&(this.chars=Xr(e,Ir))}if(this.linesOnly){const t=this.words;let e=t.length;for(;e--;){const s=t[e];s.replaceWith(s.textContent)}t.length=0}if(this.accessible&&(l||!i)){const t=s.createElement("span");t.style.cssText="position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;",t.innerHTML=this.html,e.insertBefore(t,e.firstChild),this.lines.forEach(Vr),this.words.forEach(Vr),this.chars.forEach(Vr)}return this.width=e.offsetWidth,(l||t)&&this.effects.forEach((t,e)=>this.effectsCleanups[e]=t(this)),this}refresh(){this.split(!0)}}const jr=(t,e)=>new qr(t,e),Gr=(t,e)=>(console.warn("text.split() is deprecated, import splitText() directly, or text.splitText()"),new qr(t,e)),Zr=t=>{let e="";for(let s=0,i=t.length;s<i;s++)if(s+2<i&&"-"===t[s+1]&&t.charCodeAt(s)<t.charCodeAt(s+2)){const i=t.charCodeAt(s),r=t.charCodeAt(s+2);for(let t=i;t<=r;t++)e+=String.fromCharCode(t);s+=2}else e+=t[s];return e},Qr={lowercase:"a-z",uppercase:"A-Z",numbers:"0-9",symbols:"!%#_|*+=",braille:"⠀-⣿",blocks:"▀-▟",shades:"░-▓"},Jr=new WeakMap,Kr=(t={})=>{t||(t={});const e=t.chars,s=Ge(t.ease||"linear"),i=t.text,r=t.from,n=t.reversed||!1,o=t.perturbation||0,a=t.cursor,l=!0===a?"_":"number"==typeof a?String.fromCharCode(a):"string"==typeof a?a:"",h=l.length,d=t.seed||0,c=void 0===t.override||t.override,u=t.revealRate||60,p=1e3*L.timeScale/u,m=t.settleDuration||300*L.timeScale,f=t.settleRate||30,g=t.duration,y=t.revealDelay,v=t.delay,_=t.onChange||T;return(t,a,u,b)=>{const T="function"==typeof e?e(t,a,u):e||"a-zA-Z0-9!%#_",x=Zr(Qr[T]||T),S=x.length-1,w="function"==typeof g?g(t,a,u):g,C="function"==typeof y?y(t,a,u):y||0,$="function"==typeof v?v(t,a,u):v||0,E=d?pr(d):pr();Jr.has(t)||Jr.set(t,t.textContent);const N=b?b._value:t.textContent,k=void 0!==i?"function"==typeof i?i(t,a,u):i:b?b._value:Jr.get(t),R=" "===k||" "===k?" ":k,A=" "===N?0:N.length,D=R.length,O=!0===c?x:"string"==typeof c&&c.length>0?Zr(Qr[c]||c):null,I=O?O.length-1:0,B=" "===c?" ":null,M=""===c?D:Math.max(A,D),P=w>0?w:(M-1)*p+m,F=gt((P+C)/L.timeScale,0)*L.timeScale,V=C>0?gt(C/F,12):0,X=void 0===r||"auto"===r?D<A?"right":"left":r,z=new Int32Array(M);if("random"===X){for(let t=0;t<M;t++)z[t]=t;for(let t=M-1;t>0;t--){const e=E(0,t),s=z[t];z[t]=z[e],z[e]=s}}else{const t="right"===X?(""!==c&&A?A:M)-1:"center"===X?((""!==c&&A?A:M)-1)/2:"number"==typeof X?X:0,e=Math.abs,s=new Array(M);for(let t=0;t<M;t++)s[t]=t;s.sort((s,i)=>e(s-t)-e(i-t));for(let t=0;t<M;t++)z[s[t]]=t}if(n){const t=M-1;for(let e=0;e<M;e++)z[e]=t-z[e]}const H=gt(m/P,12),Y=gt((1-H)/M,12),U=h*Y,W=gt(1e3*L.timeScale/(f*F),12),q=new Float32Array(M),j=new Float32Array(M),G=o>0?o*H:0;for(let t=0;t<M;t++){const e=G>0?(E(0,2e3)-1e3)/1e3*G:0,s=G>0?(E(0,2e3)-1e3)/1e3*G:0;q[t]=z[t]*Y+e,j[t]=Math.ceil((q[t]+H+s)/W)*W}if(D<M&&"left"!==X&&"right"!==X&&"random"!==X){let t=0;for(let e=D;e<M;e++)j[e]>t&&(t=j[e]);const e=new Array(D);for(let t=0;t<D;t++)e[t]=t;e.sort((t,e)=>z[t]-z[e]);const s=(1-t)/D;for(let i=0;i<D;i++){const r=t+i*s;r>j[e[i]]&&(j[e[i]]=r)}}const Z=new Array(M);for(let t=0;t<M;t++)Z[t]=x[E(0,S)];const Q=O?O===x?Z:new Array(M):null;if(Q&&Q!==Z)for(let t=0;t<M;t++)Q[t]=B||O[E(0,O.length-1)];let J=N;if(!b)if(""===c)J="";else if(O){J="";for(let t=0;t<A;t++)J+=" "===N[t]?" ":Q[t]}let K=-1,tt=-1,et="";const st=""!==c,it=!!O,rt=h>0;return{from:0,to:1,duration:F,delay:$,ease:"linear",modifier:t=>{if(t===K)return et;if(K=t,$>0&&t<=0)return et=N,N;if(t<=0)return et=J,J;if(t>=1)return et=R,R;et="";const e=t/W|0,i=e!==tt;i&&(tt=e);const r=V>0?(t-V)/(1-V):t,n=r>0?s(r):0;for(let t=0;t<M;t++){const e=q[t];n>=j[t]?t<D&&(et+=R[t]):n<=0||n<e?st&&t<A&&(it?" "===N[t]?et+=" ":(i&&(Q[t]=B||O[E(0,I)]),et+=Q[t]):et+=N[t]):t<D&&" "===R[t]||t<A&&" "===N[t]?et+=" ":rt&&n-e<U?et+=l[h-1-((n-e)/Y|0)]:(i&&(Z[t]=x[E(0,S)]),et+=Z[t])}return i&&_(et,n),et}}}};var tn=Object.freeze({__proto__:null,TextSplitter:qr,scrambleText:Kr,split:Gr,splitText:jr});export{Le as $,vs as Animatable,Wi as AutoLayout,Ys as Draggable,hs as JSAnimation,js as Scope,oi as ScrollObserver,Rs as Spring,qr as TextSplitter,gs as Timeline,Ae as Timer,wi as WAAPIAnimation,Ct as addChild,ds as animate,ar as clamp,he as cleanInlineStyles,_s as createAnimatable,Us as createDraggable,wr as createDrawable,qi as createLayout,Tr as createMotionPath,Gs as createScope,pr as createSeededRandom,Ds as createSpring,ys as createTimeline,De as createTimer,di as cubicBezier,dr as damp,rr as degToRad,Ue as eases,mi as easings,ge as engine,St as forEachChildren,Bs as get,L as globals,pi as irregular,qs as keepTime,hr as lerp,ui as linear,ir as mapRange,Cr as morphTo,ai as onScroll,er as padEnd,tr as padStart,nr as radToDeg,cr as random,mr as randomPick,Ps as remove,wt as removeChild,lr as round,Ki as roundPad,Kr as scrambleText,Js as scrollContainers,Ms as set,fr as shuffle,or as snap,Gr as split,jr as splitText,As as spring,gr as stagger,ci as steps,$r as svg,Ws as sync,tn as text,yr as utils,Ci as waapi,sr as wrap};diff --git a/dist/bundles/anime.umd.js b/dist/bundles/anime.umd.jsindex a2891673..4d5a39d3 100644--- a/dist/bundles/anime.umd.js+++ b/dist/bundles/anime.umd.js@@ -1,6 +1,6 @@/*** Anime.js - UMD bundle- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -46,7 +46,8 @@* @callback StaggerFunction* @param {Target} [target]* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [targets]+ * @param {Tween|null} [prevTween]* @param {Timeline} [tl]* @return {T}*/@@ -54,9 +55,9 @@/*** @typedef {Object} StaggerParams* @property {Number|String} [start]- * @property {Number|'first'|'center'|'last'|'random'} [from]+ * @property {Number|'first'|'center'|'last'|'random'|Array.<Number>} [from]* @property {Boolean} [reversed]- * @property {Array.<Number>} [grid]+ * @property {Array.<Number>|Boolean} [grid]* @property {('x'|'y')} [axis]* @property {String|((target: Target, i: Number, length: Number) => Number)} [use]* @property {Number} [total]@@ -117,8 +118,8 @@// A hack to get both ease names suggestions AND allow any strings// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-460346421-/** @typedef {(String & {})|EaseStringParamNames|EasingFunction|Spring} EasingParam */-/** @typedef {(String & {})|EaseStringParamNames|WAAPIEaseStringParamNames|EasingFunction|Spring} WAAPIEasingParam */+/** @typedef {(String & {})|EaseStringParamNames|EasingFunction|Spring|TweakRegister} EasingParam */+/** @typedef {(String & {})|EaseStringParamNames|WAAPIEaseStringParamNames|EasingFunction|Spring|TweakRegister} WAAPIEasingParam */// Spring types@@ -174,6 +175,7 @@* @property {Boolean|ScrollObserver} [autoplay]* @property {Number} [frameRate]* @property {Number} [playbackRate]+ * @property {Number} [priority]*//**@@ -184,9 +186,10 @@/*** @callback FunctionValue- * @param {Target} target - The animated target- * @param {Number} index - The target index- * @param {Number} length - The total number of animated targets+ * @param {Target} [target] - The animated target+ * @param {Number} [index] - The target index+ * @param {TargetsArray} [targets] - The array of all animated targets+ * @param {Tween|null} [prevTween] - The previous sibling tween for the same target and property* @return {Number|String|TweenObjectValue|EasingParam|Array.<Number|String|TweenObjectValue>}*/@@ -355,7 +358,7 @@* - `'label'` - Label: Position animation at a named label position (e.g., `'My Label'`)<br>* - `stagger(String|Nummber)` - Stagger multi-elements animation positions (e.g., 10, 20, 30...)*- * @typedef {TimelinePosition | StaggerFunction<Number|String>} TimelineAnimationPosition+ * @typedef {TimelinePosition | StaggerFunction<Number|String> | TweakRegister} TimelineAnimationPosition*//**@@ -379,7 +382,7 @@* @callback WAAPIFunctionValue* @param {DOMTarget} target - The animated target* @param {Number} index - The target index- * @param {Number} length - The total number of animated targets+ * @param {DOMTargetsArray} targets - The array of all animated targets* @return {WAAPITweenValue|WAAPIEasingParam}*/@@ -626,6 +629,26 @@* @property {Boolean} [debug]*/+/**+ * @typedef {Object} ScrambleTextParams+ * @property {String|function(Target, Number, TargetsArray): String} [text] - the text to transition to, otherwise uses the original text+ * @property {String|function(Target, Number, TargetsArray): String} [chars] - the characters used for scramble; named sets: 'lowercase', 'uppercase', 'numbers', 'symbols', 'braille', 'blocks', 'shades'; range syntax: 'A-Z', 'a-z0-9'; defaults to 'a-zA-Z0-9!%#_'+ * @property {EasingParam} [ease] - the easing applied to the scramble animation+ * @property {Number|'left'|'center'|'right'|'random'|'auto'} [from] - where the reveal wave starts from, 'auto' (default) uses 'left' when text grows and 'right' when it shrinks+ * @property {Boolean} [reversed] - reverses the reveal order, so 'center' reveals from edges inward instead of center outward+ * @property {Boolean|Number|String} [cursor] - characters displayed at the leading edge of the reveal wave; true uses '_', a number is a char code, a string is used directly+ * @property {Number} [perturbation] - adds random timing offsets to each character's start and end, creating a more organic reveal+ * @property {Number} [seed] - a seed for the random number generator to produce reproducible scramble sequences+ * @property {Boolean|String} [override] - controls the starting appearance: false shows original text, true scrambles it (default), '' starts from blank, ' ' replaces characters with spaces, a custom string (supports range syntax like 'A-Z') uses its characters as scramble set+ * @property {Number} [revealRate] - characters per second entering the active zone; higher values make the reveal wave move faster (default: 60)+ * @property {Number} [settleDuration] - time in ms each character spends scrambling before settling into its final glyph (default: 300)+ * @property {Number} [settleRate] - how many times per second scramble characters cycle in the active zone (default: 30)+ * @property {Number|function(Target, Number, TargetsArray): Number} [duration] - if set to a value greater than 0, overrides the computed duration from interval and settle; if unset or 0, duration is calculated automatically from text length and timing parameters+ * @property {Number|function(Target, Number, TargetsArray): Number} [revealDelay] - delay in ms before the reveal wave starts within the scramble animation+ * @property {Number|function(Target, Number, TargetsArray): Number} [delay] - delay in ms before the entire scramble animation starts+ * @property {function(String, Number): void} [onChange] - callback fired each time a character changes during scramble; receives the current scrambled text and the eased progress (0-1)+ */+// SVG types/**@@ -647,7 +670,7 @@// TODO: Do we need to check if we're running inside a worker ?const isBrowser = typeof window !== 'undefined';- /** @typedef {Window & {AnimeJS: Array} & {AnimeJSDevTools: any}|null} AnimeJSWindow+ /** @typedef {Window & {AnimeJS: Array}|null} AnimeJSWindow/** @type {AnimeJSWindow} */const win = isBrowser ? /** @type {AnimeJSWindow} */(/** @type {unknown} */(window)) : null;@@ -694,7 +717,6 @@const isDomSymbol = Symbol();const isSvgSymbol = Symbol();const transformsSymbol = Symbol();- const morphPointsSymbol = Symbol();const proxyTargetSymbol = Symbol();// Numbers@@ -718,6 +740,7 @@})();const validTransforms = [+ 'perspective','translateX','translateY','translateZ',@@ -732,9 +755,6 @@'skew','skewX','skewY',- 'matrix',- 'matrix3d',- 'perspective',];const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});@@ -757,12 +777,23 @@// export const unitsExecRgx = /^([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)+([a-z]+|%)$/i;const unitsExecRgx = /^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;const lowerCaseRgx = /([a-z])([A-Z])/g;- const transformsExecRgx = /(\w+)(\([^)]+\)+)/g; // Match inline transforms with cacl() values, returns the value wrapped in ()const relativeValuesExecRgx = /(\*=|\+=|-=)/;const cssVariableMatchRgx = /var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/;+ /**+ * @typedef {Object} EditorGlobals+ * @property {boolean} showPanel+ * @property {boolean} synced+ * @property {Function} addAnimation+ * @property {Function} addTimeline+ * @property {Function} addTimelineChild+ * @property {Function} resolveStagger+ * @property {Object|null} _head+ * @property {Object|null} _tail+ */+/** @type {DefaultsParams} */const defaults = {id: null,@@ -806,11 +837,11 @@timeScale: 1,/** @type {Number} */tickThreshold: 200,+ /** @type {EditorGlobals|null} */+ editor: null,};- const devTools = isBrowser && win.AnimeJSDevTools;-- const globalVersions = { version: '4.3.6', engine: null };+ const globalVersions = { version: '4.4.0', engine: null };if (isBrowser) {if (!win.AnimeJS) win.AnimeJS = [];@@ -926,8 +957,6 @@*/const clamp$1 = (v, min, max) => v < min ? min : v > max ? max : v;- const powCache = {};-/*** Rounds a number to specified decimal places*@@ -935,13 +964,12 @@* @param {Number} decimalLength - Number of decimal places* @return {Number}*/- const round$1 = (v, decimalLength) => {- if (decimalLength < 0) return v;- if (!decimalLength) return _round(v);- let p = powCache[decimalLength];- if (!p) p = powCache[decimalLength] = 10 ** decimalLength;- return _round(v * p) / p;- };+ const round$1 = (v, decimalLength) => {+ if (decimalLength < 0) return v;+ if (!decimalLength) return _round(v);+ const p = 10 ** decimalLength;+ return _round(v * p) / p;+ };/*** Snaps a value to nearest increment or array value@@ -1072,28 +1100,143 @@*/const parseInlineTransforms = (target, propName, animationInlineStyles) => {const inlineTransforms = target.style.transform;- let inlinedStylesPropertyValue;if (inlineTransforms) {const cachedTransforms = target[transformsSymbol];- let t; while (t = transformsExecRgx.exec(inlineTransforms)) {- const inlinePropertyName = t[1];- // const inlinePropertyValue = t[2];- const inlinePropertyValue = t[2].slice(1, -1);- cachedTransforms[inlinePropertyName] = inlinePropertyValue;- if (inlinePropertyName === propName) {- inlinedStylesPropertyValue = inlinePropertyValue;- // Store the new parsed inline styles if animationInlineStyles is provided- if (animationInlineStyles) {- animationInlineStyles[propName] = inlinePropertyValue;+ let pos = 0;+ const len = inlineTransforms.length;+ let fullTranslateValue;+ while (pos < len) {+ // Skip whitespace+ while (pos < len && inlineTransforms.charCodeAt(pos) === 32) pos++;+ if (pos >= len) break;+ // Read function name+ const nameStart = pos;+ while (pos < len && inlineTransforms.charCodeAt(pos) !== 40) pos++;+ if (pos >= len) break;+ const name = inlineTransforms.substring(nameStart, pos);+ // Scan to closing paren, recording top-level comma positions+ let depth = 1;+ const valueStart = pos + 1;+ let c1 = -1, c2 = -1;+ pos++;+ while (pos < len && depth > 0) {+ const c = inlineTransforms.charCodeAt(pos);+ if (c === 40) depth++;+ else if (c === 41) depth--;+ else if (c === 44 && depth === 1) {+ if (c1 === -1) c1 = pos;+ else if (c2 === -1) c2 = pos;+ }+ pos++;+ }+ const valueEnd = pos - 1;+ // Decompose multi-arg functions into individual axis properties+ if (name === 'translate' || name === 'translate3d') {+ if (c1 === -1) {+ cachedTransforms.translateX = inlineTransforms.substring(valueStart, valueEnd).trim();+ } else {+ cachedTransforms.translateX = inlineTransforms.substring(valueStart, c1).trim();+ if (c2 === -1) {+ cachedTransforms.translateY = inlineTransforms.substring(c1 + 1, valueEnd).trim();+ } else {+ cachedTransforms.translateY = inlineTransforms.substring(c1 + 1, c2).trim();+ cachedTransforms.translateZ = inlineTransforms.substring(c2 + 1, valueEnd).trim();+ }}+ fullTranslateValue = inlineTransforms.substring(valueStart, valueEnd);+ } else if (name === 'scale' || name === 'scale3d') {+ if (c1 === -1) {+ cachedTransforms.scale = inlineTransforms.substring(valueStart, valueEnd).trim();+ } else {+ cachedTransforms.scaleX = inlineTransforms.substring(valueStart, c1).trim();+ if (c2 === -1) {+ cachedTransforms.scaleY = inlineTransforms.substring(c1 + 1, valueEnd).trim();+ } else {+ cachedTransforms.scaleY = inlineTransforms.substring(c1 + 1, c2).trim();+ cachedTransforms.scaleZ = inlineTransforms.substring(c2 + 1, valueEnd).trim();+ }+ }+ } else {+ cachedTransforms[name] = inlineTransforms.substring(valueStart, valueEnd);}}+ // Resolve the requested property from the cache+ if (propName === 'translate3d' && fullTranslateValue) {+ if (animationInlineStyles) animationInlineStyles[propName] = fullTranslateValue;+ return fullTranslateValue;+ }+ const cached = cachedTransforms[propName];+ if (!isUnd(cached)) {+ if (animationInlineStyles) animationInlineStyles[propName] = cached;+ return cached;+ }}- return inlineTransforms && !isUnd(inlinedStylesPropertyValue) ? inlinedStylesPropertyValue :+ return propName === 'translate3d' ? '0px, 0px, 0px' :+ propName === 'rotate3d' ? '0, 0, 0, 0deg' :stringStartsWith(propName, 'scale') ? '1' :stringStartsWith(propName, 'rotate') || stringStartsWith(propName, 'skew') ? '0deg' : '0px';};+ /**+ * Builds a CSS transform string from the target's cached transform properties.+ * Iterates validTransforms in order (perspective > translate > rotate > scale > skew > matrix).+ * When adjacent axis properties are all present, emits a shorter shorthand (translateX + translateY -> translate(x, y))+ * The index is advanced past consumed properties so they are not emitted twice.+ * Properties without a grouping partner (e.g. translateY alone, scaleZ alone) emit individually.+ *+ * @param {Record<String, String>} props+ * @return {String}+ */+ const buildTransformString = (props) => {+ let str = emptyString;+ for (let i = 0, l = validTransforms.length; i < l; i++) {+ const key = validTransforms[i];+ const val = props[key];+ if (val !== undefined) {+ // Group translateX with adjacent translateY / translateZ+ if (key === 'translateX') {+ const next = props.translateY;+ if (next !== undefined) {+ const next2 = props.translateZ;+ if (next2 !== undefined) {+ str += `translate3d(${val},${next},${next2}) `;+ i += 2;+ } else {+ str += `translate(${val},${next}) `;+ i += 1;+ }+ continue;+ }+ }+ // Group scaleX with adjacent scaleY / scaleZ (only when standalone scale is absent)+ if (key === 'scaleX' && props.scale === undefined) {+ const next = props.scaleY;+ if (next !== undefined) {+ const next2 = props.scaleZ;+ if (next2 !== undefined) {+ str += `scale3d(${val},${next},${next2}) `;+ i += 2;+ } else {+ str += `scale(${val},${next}) `;+ i += 1;+ }+ continue;+ }+ }+ // All other properties: emit individually using pre-built fragment string+ str += `${transformsFragmentStrings[key]}${val}) `;+ }+ // Preserve non-animatable rotate3d in correct position (after rotateZ, before scale)+ if (key === 'rotateZ') {+ if (props.rotate3d !== undefined) str += `rotate3d(${props.rotate3d}) `;+ }+ }+ // Preserve non-animatable matrix/matrix3d from inline styles+ if (props.matrix !== undefined) str += `matrix(${props.matrix}) `;+ if (props.matrix3d !== undefined) str += `matrix3d(${props.matrix3d}) `;+ return str;+ };+/**@@ -1195,15 +1338,16 @@* @param {TweenPropValue} value* @param {Target} target* @param {Number} index- * @param {Number} total- * @param {Object} [store]+ * @param {TargetsArray} targets+ * @param {Object|null} store+ * @param {Tween|null} prevTween* @return {any}*/- const getFunctionValue = (value, target, index, total, store) => {+ const getFunctionValue = (value, target, index, targets, store, prevTween) => {let func;if (isFnc(value)) {func = () => {- const computed = /** @type {Function} */(value)(target, index, total);+ const computed = /** @type {Function} */(value)(target, index, targets, prevTween);// Fallback to 0 if the function returns undefined / NaN / null / false / 0return !isNaN(+computed) ? +computed : computed || 0;};@@ -1270,9 +1414,17 @@*/const getOriginalAnimatableValue = (target, propName, tweenType, animationInlineStyles) => {const type = !isUnd(tweenType) ? tweenType : getTweenType(target, propName);- return type === tweenTypes.OBJECT ? target[propName] || 0 :- type === tweenTypes.ATTRIBUTE ? /** @type {DOMTarget} */(target).getAttribute(propName) :- type === tweenTypes.TRANSFORM ? parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :+ if (type === tweenTypes.OBJECT) {+ const value = target[propName];+ if (value && animationInlineStyles) animationInlineStyles[propName] = value;+ return value || 0;+ }+ if (type === tweenTypes.ATTRIBUTE) {+ const value = /** @type {DOMTarget} */(target).getAttribute(propName);+ if (value && animationInlineStyles) animationInlineStyles[propName] = value;+ return value;+ }+ return type === tweenTypes.TRANSFORM ? parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :type === tweenTypes.CSS_VAR ? getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles).trimStart() :getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles);};@@ -1374,6 +1526,54 @@const decomposedOriginalValue = createDecomposedValueTargetObject();+ /**+ * @param {Tween} tween+ * @param {Number} progress+ * @param {Number} precision+ * @return {String}+ */+ const composeColorValue = (tween, progress, precision) => {+ const mod = tween._modifier;+ const fn = tween._fromNumbers;+ const tn = tween._toNumbers;+ const r = round$1(clamp$1(/** @type {Number} */(mod(lerp$1(fn[0], tn[0], progress))), 0, 255), 0);+ const g = round$1(clamp$1(/** @type {Number} */(mod(lerp$1(fn[1], tn[1], progress))), 0, 255), 0);+ const b = round$1(clamp$1(/** @type {Number} */(mod(lerp$1(fn[2], tn[2], progress))), 0, 255), 0);+ const a = clamp$1(/** @type {Number} */(mod(round$1(lerp$1(fn[3], tn[3], progress), precision))), 0, 1);+ if (tween._composition !== compositionTypes.none) {+ const ns = tween._numbers;+ ns[0] = r;+ ns[1] = g;+ ns[2] = b;+ ns[3] = a;+ }+ return `rgba(${r},${g},${b},${a})`;+ };++ /**+ * @param {Tween} tween+ * @param {Number} progress+ * @param {Number} precision+ * @return {String}+ */+ const composeComplexValue = (tween, progress, precision) => {+ const mod = tween._modifier;+ const fn = tween._fromNumbers;+ const tn = tween._toNumbers;+ const ts = tween._strings;+ const hasComposition = tween._composition !== compositionTypes.none;+ let v = ts[0];+ for (let j = 0, l = tn.length; j < l; j++) {+ const n = /** @type {Number} */(mod(round$1(lerp$1(fn[j], tn[j], progress), precision)));+ const s = ts[j + 1];+ v += `${s ? n + s : n}`;+ if (hasComposition) {+ tween._numbers[j] = n;+ }+ }+ return v;+ };+@@ -1402,7 +1602,6 @@const _hasChildren = tickable._hasChildren;const tickableDelay = tickable._delay;const tickablePrevAbsoluteTime = tickable._currentTime; // TODO: rename ._currentTime to ._absoluteCurrentTime-const tickableEndTime = tickableDelay + iterationDuration;const tickableAbsoluteTime = time - tickableDelay;const tickablePrevTime = clamp$1(tickablePrevAbsoluteTime, -tickableDelay, duration);@@ -1534,30 +1733,9 @@number = /** @type {Number} */(tweenModifier(round$1(lerp$1(tween._fromNumber, tween._toNumber, tweenProgress), tweenPrecision)));value = `${number}${tween._unit}`;} else if (tweenValueType === valueTypes.COLOR) {- const fn = tween._fromNumbers;- const tn = tween._toNumbers;- const r = round$1(clamp$1(/** @type {Number} */(tweenModifier(lerp$1(fn[0], tn[0], tweenProgress))), 0, 255), 0);- const g = round$1(clamp$1(/** @type {Number} */(tweenModifier(lerp$1(fn[1], tn[1], tweenProgress))), 0, 255), 0);- const b = round$1(clamp$1(/** @type {Number} */(tweenModifier(lerp$1(fn[2], tn[2], tweenProgress))), 0, 255), 0);- const a = clamp$1(/** @type {Number} */(tweenModifier(round$1(lerp$1(fn[3], tn[3], tweenProgress), tweenPrecision))), 0, 1);- value = `rgba(${r},${g},${b},${a})`;- if (tweenHasComposition) {- const ns = tween._numbers;- ns[0] = r;- ns[1] = g;- ns[2] = b;- ns[3] = a;- }+ value = composeColorValue(tween, tweenProgress, tweenPrecision);} else if (tweenValueType === valueTypes.COMPLEX) {- value = tween._strings[0];- for (let j = 0, l = tween._toNumbers.length; j < l; j++) {- const n = /** @type {Number} */(tweenModifier(round$1(lerp$1(tween._fromNumbers[j], tween._toNumbers[j], tweenProgress), tweenPrecision)));- const s = tween._strings[j + 1];- value += `${s ? n + s : n}`;- if (tweenHasComposition) {- tween._numbers[j] = n;- }- }+ value = composeComplexValue(tween, tweenProgress, tweenPrecision);}// For additive tweens and Animatables@@ -1600,14 +1778,8 @@}- // NOTE: Possible improvement: Use translate(x,y) / translate3d(x,y,z) syntax- // to reduce memory usage on string compositionif (tweenTransformsNeedUpdate && tween._renderTransforms) {- let str = emptyString;- for (let key in tweenTargetTransformsProperties) {- str += `${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `;- }- tweenStyle.transform = str;+ tweenStyle.transform = buildTransformString(tweenTargetTransformsProperties);tweenTransformsNeedUpdate = 0;}@@ -1664,6 +1836,50 @@return hasRendered;};+ // Shared context for extracted forEachChildren callbacks in tick()+ // Avoids closure allocation every frame++ let renderCtxChildrenTime = 0;+ let renderCtxTlFps = 0;+ let renderCtxTickTime = 0;+ let renderCtxTickMode = 0;+ let renderCtxMuteCallbacks = 0;+ let renderCtxInternalRender = 0;+ let renderCtxChildrenHasRendered = 0;+ let renderCtxChildrenHaveCompleted = true;+ let loopCtxIsRunningBackwards = false;+ let loopCtxIterationDuration = 0;+ let loopCtxMuteCallbacks = 0;++ /** @param {JSAnimation} child */+ const tickLoopChild = (child) => {+ if (!loopCtxIsRunningBackwards) {+ // Force an internal render to trigger the callbacks if the child has not completed on loop+ if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {+ render(child, loopCtxIterationDuration, loopCtxMuteCallbacks, 1, tickModes.FORCE);+ }+ // Reset their began and completed flags to allow retrigering callbacks on the next iteration+ child.began = false;+ child.completed = false;+ } else {+ const childDuration = child.duration;+ const childStartTime = child._offset + child._delay;+ const childEndTime = childStartTime + childDuration;+ // Triggers the onComplete callback on reverse for children on the edges of the timeline+ if (!loopCtxMuteCallbacks && childDuration <= minValue && (!childStartTime || childEndTime === loopCtxIterationDuration)) {+ child.onComplete(child);+ }+ }+ };++ /** @param {JSAnimation} child */+ const tickRenderChild = (child) => {+ const childTime = round$1((renderCtxChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds+ const childTickMode = child._fps < renderCtxTlFps ? child.requestTick(renderCtxTickTime) : renderCtxTickMode;+ renderCtxChildrenHasRendered += render(child, childTime, renderCtxMuteCallbacks, renderCtxInternalRender, childTickMode);+ if (!child.completed && renderCtxChildrenHaveCompleted) renderCtxChildrenHaveCompleted = false;+ };+/*** @param {Tickable} tickable* @param {Number} time@@ -1680,45 +1896,30 @@const tlIsRunningBackwards = tl.backwards;const tlChildrenTime = internalRender ? time : tl._iterationTime;const tlCildrenTickTime = now();-let tlChildrenHasRendered = 0;let tlChildrenHaveCompleted = true;-// If the timeline has looped forward, we need to manually triggers children skipped callbacksif (!internalRender && tl._currentIteration !== _currentIteration) {const tlIterationDuration = tl.iterationDuration;- forEachChildren(tl, (/** @type {JSAnimation} */child) => {- if (!tlIsRunningBackwards) {- // Force an internal render to trigger the callbacks if the child has not completed on loop- if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {- render(child, tlIterationDuration, muteCallbacks, 1, tickModes.FORCE);- }- // Reset their began and completed flags to allow retrigering callbacks on the next iteration- child.began = false;- child.completed = false;- } else {- const childDuration = child.duration;- const childStartTime = child._offset + child._delay;- const childEndTime = childStartTime + childDuration;- // Triggers the onComplete callback on reverse for children on the edges of the timeline- if (!muteCallbacks && childDuration <= minValue && (!childStartTime || childEndTime === tlIterationDuration)) {- child.onComplete(child);- }- }- });+ loopCtxIsRunningBackwards = tlIsRunningBackwards;+ loopCtxIterationDuration = tlIterationDuration;+ loopCtxMuteCallbacks = muteCallbacks;+ forEachChildren(tl, tickLoopChild);if (!muteCallbacks) tl.onLoop(/** @type {CallbackArgument} */(tl));}-- forEachChildren(tl, (/** @type {JSAnimation} */child) => {- const childTime = round$1((tlChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds- const childTickMode = child._fps < tl._fps ? child.requestTick(tlCildrenTickTime) : tickMode;- tlChildrenHasRendered += render(child, childTime, muteCallbacks, internalRender, childTickMode);- if (!child.completed && tlChildrenHaveCompleted) tlChildrenHaveCompleted = false;- }, tlIsRunningBackwards);-+ renderCtxChildrenTime = tlChildrenTime;+ renderCtxTlFps = tl._fps;+ renderCtxTickTime = tlCildrenTickTime;+ renderCtxTickMode = tickMode;+ renderCtxMuteCallbacks = muteCallbacks;+ renderCtxInternalRender = internalRender;+ renderCtxChildrenHasRendered = 0;+ renderCtxChildrenHaveCompleted = true;+ forEachChildren(tl, tickRenderChild, tlIsRunningBackwards);+ tlChildrenHasRendered = renderCtxChildrenHasRendered;+ tlChildrenHaveCompleted = renderCtxChildrenHaveCompleted;// Renders on timeline are triggered by its children so it needs to be set after rendering the childrenif (!muteCallbacks && tlChildrenHasRendered) tl.onRender(/** @type {CallbackArgument} */(tl));-// Triggers the timeline onComplete() once all chindren all completed and the current time has reached the endif ((tlChildrenHaveCompleted || tlIsRunningBackwards) && tl._currentTime >= tl.duration) {// Make sure the paused flag is false in case it has been skipped in the render function@@ -1772,59 +1973,78 @@/*** @template {Renderable} T* @param {T} renderable+ * @param {Boolean} [inlineStylesOnly]* @return {T}*/- const cleanInlineStyles = renderable => {- // Allow cleanInlineStyles() to be called on timelines+ const revertValues = (renderable, inlineStylesOnly = false) => {+ // Allow revertValues() to be called on timelinesif (renderable._hasChildren) {- forEachChildren(renderable, cleanInlineStyles, true);+ forEachChildren(renderable, (/** @type {Renderable} */child) => revertValues(child, inlineStylesOnly), true);} else {const animation = /** @type {JSAnimation} */(renderable);animation.pause();forEachChildren(animation, (/** @type {Tween} */tween) => {const tweenProperty = tween.property;const tweenTarget = tween.target;- if (tweenTarget[isDomSymbol]) {- const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;- const originalInlinedValue = tween._inlineValue;- const tweenHadNoInlineValue = isNil(originalInlinedValue) || originalInlinedValue === emptyString;- if (tween._tweenType === tweenTypes.TRANSFORM) {- const cachedTransforms = tweenTarget[transformsSymbol];- if (tweenHadNoInlineValue) {- delete cachedTransforms[tweenProperty];- } else {- cachedTransforms[tweenProperty] = originalInlinedValue;- }- if (tween._renderTransforms) {- if (!Object.keys(cachedTransforms).length) {- targetStyle.removeProperty('transform');+ const tweenType = tween._tweenType;+ const originalInlinedValue = tween._inlineValue;+ const tweenHadNoInlineValue = isNil(originalInlinedValue) || originalInlinedValue === emptyString;+ if (tweenType === tweenTypes.OBJECT) {+ if (!inlineStylesOnly && !tweenHadNoInlineValue) {+ tweenTarget[tweenProperty] = originalInlinedValue;+ }+ } else if (tweenTarget[isDomSymbol]) {+ if (tweenType === tweenTypes.ATTRIBUTE) {+ if (!inlineStylesOnly) {+ if (tweenHadNoInlineValue) {+ /** @type {DOMTarget} */(tweenTarget).removeAttribute(tweenProperty);} else {- let str = emptyString;- for (let key in cachedTransforms) {- str += transformsFragmentStrings[key] + cachedTransforms[key] + ') ';- }- targetStyle.transform = str;+ /** @type {DOMTarget} */(tweenTarget).setAttribute(tweenProperty, /** @type {String} */(originalInlinedValue));}}} else {- if (tweenHadNoInlineValue) {- targetStyle.removeProperty(toLowerCase(tweenProperty));+ const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;+ if (tweenType === tweenTypes.TRANSFORM) {+ const cachedTransforms = tweenTarget[transformsSymbol];+ if (tweenHadNoInlineValue) {+ delete cachedTransforms[tweenProperty];+ } else {+ cachedTransforms[tweenProperty] = originalInlinedValue;+ }+ if (tween._renderTransforms) {+ if (!Object.keys(cachedTransforms).length) {+ targetStyle.removeProperty('transform');+ } else {+ targetStyle.transform = buildTransformString(cachedTransforms);+ }+ }} else {- targetStyle[tweenProperty] = originalInlinedValue;+ if (tweenHadNoInlineValue) {+ targetStyle.removeProperty(toLowerCase(tweenProperty));+ } else {+ targetStyle[tweenProperty] = originalInlinedValue;+ }}}- if (animation._tail === tween) {- animation.targets.forEach(t => {- if (t.getAttribute && t.getAttribute('style') === emptyString) {- t.removeAttribute('style');- } });- }+ }+ if (tweenTarget[isDomSymbol] && animation._tail === tween) {+ animation.targets.forEach(t => {+ if (t.getAttribute && t.getAttribute('style') === emptyString) {+ t.removeAttribute('style');+ } });}});}return renderable;};+ /**+ * @template {Renderable} T+ * @param {T} renderable+ * @return {T}+ */+ const cleanInlineStyles = renderable => revertValues(renderable, true);+/*@@ -2509,6 +2729,9 @@let timerId = 0;+ /** @param {Timer} prev @param {Timer} child */+ const sortByPriority = (prev, child) => prev._priority > child._priority;+/*** Base class used to create Timers, Animations and Timelines*/@@ -2535,6 +2758,7 @@autoplay,frameRate,playbackRate,+ priority,onComplete,onLoop,onPause,@@ -2556,16 +2780,6 @@/** @type {Number} */(timerLoop) < 0 ? Infinity :/** @type {Number} */(timerLoop) + 1;- if (devTools) {- const isInfinite = timerIterationCount === Infinity;- const registered = devTools.register(this, parameters, isInfinite);- if (registered && isInfinite) {- const minIterations = alternate ? 2 : 1;- const iterations = parent ? devTools.maxNestedInfiniteLoops : devTools.maxInfiniteLoops;- timerIterationCount = Math.max(iterations, minIterations);- }- }-let offsetPosition = 0;if (parent) {@@ -2649,6 +2863,8 @@this._fps = setValue(frameRate, timerDefaults.frameRate);/** @type {Number} */this._speed = setValue(playbackRate, timerDefaults.playbackRate);+ /** @type {Number} */+ this._priority = +setValue(priority, 1);}get cancelled() {@@ -2793,7 +3009,7 @@tick(this, minValue, 0, 0, tickModes.FORCE);} else {if (!this._running) {- addChild(engine, this);+ addChild(engine, this, sortByPriority);engine._hasChildren = true;this._running = true;}@@ -3388,7 +3604,7 @@* @param {Number} [parentPosition]* @param {Boolean} [fastSet=false]* @param {Number} [index=0]- * @param {Number} [length=0]+ * @param {TargetsArray} [allTargets]*/constructor(targets,@@ -3397,7 +3613,7 @@parentPosition,fastSet = false,index = 0,- length = 0+ allTargets) {super(/** @type {TimerParams & AnimationParams} */(parameters), parent, parentPosition);@@ -3448,7 +3664,7 @@const target = parsedTargets[targetIndex];const ti = index || targetIndex;- const tl = length || targetsLength;+ const tl = allTargets || parsedTargets;let lastTransformGroupIndex = NaN;let lastTransformGroupLength = NaN;@@ -3524,7 +3740,14 @@toFunctionStore.func = null;fromFunctionStore.func = null;- const computedToValue = getFunctionValue(key.to, target, ti, tl, toFunctionStore);+ const computedComposition = getFunctionValue(setValue(key.composition, tComposition), target, ti, tl, null, null);+ const tweenComposition = isNum(computedComposition) ? computedComposition : compositionTypes[computedComposition];+ if (!siblings && tweenComposition !== compositionTypes.none) siblings = getTweenSiblings(target, propName);+ // Timelines pass the last sibling tween if it belongs to the same timeline+ // Standalone animations only pass prevTween when the property has multiple keyframes+ const tailTween = siblings ? siblings._tail : null;+ const prevSiblingTween = parent && tailTween && tailTween.parent.parent === parent ? tailTween : prevTween;+ const computedToValue = getFunctionValue(key.to, target, ti, tl, toFunctionStore, prevSiblingTween);let tweenToValue;// Allows function based values to return an object syntax value ({to: v})@@ -3534,20 +3757,18 @@} else {tweenToValue = computedToValue;}- const tweenFromValue = getFunctionValue(key.from, target, ti, tl);+ const tweenFromValue = getFunctionValue(key.from, target, ti, tl, null, prevSiblingTween);const easeToParse = key.ease || tEasing;- const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl);+ const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl, null, prevSiblingTween);const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;// Calculate default individual keyframe duration by dividing the tl of keyframes- const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl) / l : tDuration)), target, ti, tl);+ const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl, null, prevSiblingTween) / l : tDuration)), target, ti, tl, null, prevSiblingTween);// Default delay value should only be applied to the first tween- const tweenDelay = getFunctionValue(setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl);- const computedComposition = getFunctionValue(setValue(key.composition, tComposition), target, ti, tl);- const tweenComposition = isNum(computedComposition) ? computedComposition : compositionTypes[computedComposition];+ const tweenDelay = getFunctionValue(setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl, null, prevSiblingTween);// Modifiers are treated differently and don't accept function based value to prevent having to pass a function wrapperconst tweenModifier = key.modifier || tModifier;const hasFromvalue = !isUnd(tweenFromValue);@@ -3564,7 +3785,6 @@let prevSibling = prevTween;if (tweenComposition !== compositionTypes.none) {- if (!siblings) siblings = getTweenSiblings(target, propName);let nextSibling = siblings._head;// Iterate trough all the next siblings until we find a sibling with an equal or inferior start timewhile (nextSibling && !nextSibling._isOverridden && nextSibling._absoluteStartTime <= absoluteStartTime) {@@ -3583,8 +3803,8 @@// Decompose valuesif (isFromToValue) {- decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore) : tweenFromValue, fromTargetObject);- decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore) : tweenToValue, toTargetObject);+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore, prevSiblingTween) : tweenFromValue, fromTargetObject);+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore, prevSiblingTween) : tweenToValue, toTargetObject);// Needed to force an inline style registrationconst originalValue = getOriginalAnimatableValue(target, propName, tweenType, inlineStylesStore);if (fromTargetObject.t === valueTypes.NUMBER) {@@ -3738,6 +3958,18 @@composeTween(tween, siblings);}+ // Pre-compute the tween end value for function-based value chaining (ie morphTo / scrambleText in keyframe arrays and timelines)+ const vt = tween._valueType;+ if (vt === valueTypes.COMPLEX) {+ tween._value = composeComplexValue(tween, 1, -1);+ } else if (vt === valueTypes.COLOR) {+ tween._value = composeColorValue(tween, 1, -1);+ } else if (vt === valueTypes.UNIT) {+ tween._value = `${tweenModifier(tween._toNumber)}${tween._unit}`;+ } else {+ tween._value = tweenModifier(tween._toNumber);+ }+if (isNaN(firstTweenChangeStartTime)) {firstTweenChangeStartTime = tween._startTime;}@@ -3895,7 +4127,7 @@*/revert() {super.revert();- return cleanInlineStyles(this);+ return revertValues(this);}/**@@ -3916,171 +4148,13 @@* @param {TargetsParam} targets* @param {AnimationParams} parameters* @return {JSAnimation}- */- const animate = (targets, parameters) => new JSAnimation(targets, parameters, null, 0, false).init();------ const WAAPIAnimationsLookups = {- _head: null,- _tail: null,- };-- /**- * @param {DOMTarget} $el- * @param {String} [property]- * @param {WAAPIAnimation} [parent]- * @return {globalThis.Animation}- */- const removeWAAPIAnimation = ($el, property, parent) => {- let nextLookup = WAAPIAnimationsLookups._head;- let anim;- while (nextLookup) {- const next = nextLookup._next;- const matchTarget = nextLookup.$el === $el;- const matchProperty = !property || nextLookup.property === property;- const matchParent = !parent || nextLookup.parent === parent;- if (matchTarget && matchProperty && matchParent) {- anim = nextLookup.animation;- try { anim.commitStyles(); } catch {} anim.cancel();- removeChild(WAAPIAnimationsLookups, nextLookup);- const lookupParent = nextLookup.parent;- if (lookupParent) {- lookupParent._completed++;- if (lookupParent.animations.length === lookupParent._completed) {- lookupParent.completed = true;- lookupParent.paused = true;- if (!lookupParent.muteCallbacks) {- lookupParent.onComplete(lookupParent);- lookupParent._resolve(lookupParent);- }- }- }- }- nextLookup = next;- }- return anim;- };-- /**- * @param {WAAPIAnimation} parent- * @param {DOMTarget} $el- * @param {String} property- * @param {PropertyIndexedKeyframes} keyframes- * @param {KeyframeAnimationOptions} params- * @retun {globalThis.Animation}- */- const addWAAPIAnimation = (parent, $el, property, keyframes, params) => {- const animation = $el.animate(keyframes, params);- const animTotalDuration = params.delay + (+params.duration * params.iterations);- animation.playbackRate = parent._speed;- if (parent.paused) animation.pause();- if (parent.duration < animTotalDuration) {- parent.duration = animTotalDuration;- parent.controlAnimation = animation;- }- parent.animations.push(animation);- removeWAAPIAnimation($el, property);- addChild(WAAPIAnimationsLookups, { parent, animation, $el, property, _next: null, _prev: null });- const handleRemove = () => removeWAAPIAnimation($el, property, parent);- animation.oncancel = handleRemove;- animation.onremove = handleRemove;- if (!parent.persist) {- animation.onfinish = handleRemove;- }- return animation;- };------ /**- * @overload- * @param {DOMTargetSelector} targetSelector- * @param {String} propName- * @return {String}- *- * @overload- * @param {JSTargetsParam} targetSelector- * @param {String} propName- * @return {Number|String}- *- * @overload- * @param {DOMTargetsParam} targetSelector- * @param {String} propName- * @param {String} unit- * @return {String}- *- * @overload- * @param {TargetsParam} targetSelector- * @param {String} propName- * @param {Boolean} unit- * @return {Number}- *- * @param {TargetsParam} targetSelector- * @param {String} propName- * @param {String|Boolean} [unit]- */- function get(targetSelector, propName, unit) {- const targets = registerTargets(targetSelector);- if (!targets.length) return;- const [ target ] = targets;- const tweenType = getTweenType(target, propName);- const normalizePropName = sanitizePropertyName(propName, target, tweenType);- let originalValue = getOriginalAnimatableValue(target, normalizePropName);- if (isUnd(unit)) {- return originalValue;- } else {- decomposeRawValue(originalValue, decomposedOriginalValue);- if (decomposedOriginalValue.t === valueTypes.NUMBER || decomposedOriginalValue.t === valueTypes.UNIT) {- if (unit === false) {- return decomposedOriginalValue.n;- } else {- const convertedValue = convertValueUnit(/** @type {DOMTarget} */(target), decomposedOriginalValue, /** @type {String} */(unit), false);- return `${round$1(convertedValue.n, globals.precision)}${convertedValue.u}`;- }- }- }- }-- /**- * @param {TargetsParam} targets- * @param {AnimationParams} parameters- * @return {JSAnimation}- */- const set = (targets, parameters) => {- if (isUnd(parameters)) return;- parameters.duration = minValue;- // Do not overrides currently active tweens by default- parameters.composition = setValue(parameters.composition, compositionTypes.none);- // Skip init() and force rendering by playing the animation- return new JSAnimation(targets, parameters, null, 0, true).resume();- };-- /**- * @param {TargetsParam} targets- * @param {Renderable|WAAPIAnimation} [renderable]- * @param {String} [propertyName]- * @return {TargetsArray}- */- const remove = (targets, renderable, propertyName) => {- const targetsArray = parseTargets(targets);- for (let i = 0, l = targetsArray.length; i < l; i++) {- removeWAAPIAnimation(- /** @type {DOMTarget} */(targetsArray[i]),- propertyName,- renderable && /** @type {WAAPIAnimation} */(renderable).controlAnimation && /** @type {WAAPIAnimation} */(renderable),- );+ */+ const animate = (targets, parameters) => {+ if (globals.editor) {+ return globals.editor.addAnimation(targets, parameters);+ } else {+ return new JSAnimation(targets, parameters, null, 0, false).init();}- removeTargetsFromRenderable(- targetsArray,- /** @type {Renderable} */(renderable),- propertyName- );- return targetsArray;};@@ -4136,6 +4210,8 @@++/*** @param {Timeline} tl* @return {Number}@@ -4157,7 +4233,7 @@* @param {Number} timePosition* @param {TargetsParam} targets* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [allTargets]* @return {Timeline}** @param {TimerParams|AnimationParams} childParams@@ -4165,15 +4241,15 @@* @param {Number} timePosition* @param {TargetsParam} [targets]* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [allTargets]*/- function addTlChild(childParams, tl, timePosition, targets, index, length) {+ function addTlChild(childParams, tl, timePosition, targets, index, allTargets) {const isSetter = isNum(childParams.duration) && /** @type {Number} */(childParams.duration) <= minValue;// Offset the tl position with -minValue for 0 duration animations or .set() calls in order to align their end value with the defined positionconst adjustedPosition = isSetter ? timePosition - minValue : timePosition;if (tl.composition) tick(tl, adjustedPosition, 1, 1, tickModes.AUTO);const tlChild = targets ?- new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, length) :+ new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, allTargets) :new Timer(/** @type {TimerParams} */(childParams), tl, adjustedPosition);if (tl.composition) tlChild.init(true);// TODO: Might be better to insert at a position relative to startTime?@@ -4221,7 +4297,7 @@* @overload* @param {TargetsParam} a1* @param {AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]* @return {this}** @overload@@ -4231,7 +4307,7 @@** @param {TargetsParam|TimerParams} a1* @param {TimelinePosition|AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]*/add(a1, a2, a3) {const isAnim = isObj(a2);@@ -4240,9 +4316,11 @@this._hasChildren = true;if (isAnim) {const childParams = /** @type {AnimationParams} */(a2);- // Check for function for children stagger positions- if (isFnc(a3)) {- const staggeredPosition = a3;+ const editorHook = globals.editor && globals.editor.addTimelineChild;+ const isStaggerType = a3 && /** @type {TweakRegister} */(a3).type === 'Stagger' && globals.editor;+ // Check for function or Stagger type children positions+ const staggeredPosition = isFnc(a3) ? a3 : null;+ if (staggeredPosition || isStaggerType) {const parsedTargetsArray = parseTargets(/** @type {TargetsParam} */(a1));// Store initial duration before adding new children that will change the durationconst tlDuration = this.duration;@@ -4253,28 +4331,36 @@let i = 0;/** @type {Number} */const parsedLength = (parsedTargetsArray.length);+ // Call editor hook once for the entire stagger group instead of per target+ const resolvedParams = editorHook ? editorHook(/** @type {TargetsParam} */(a1), childParams, this.id, a3, parsedLength) : null;+ // Resolve stagger AFTER editor hook so tweaked position value (a3.defaultValue) is used+ const staggerFn = staggeredPosition || globals.editor.resolveStagger(/** @type {TweakRegister} */(a3).defaultValue);parsedTargetsArray.forEach((/** @type {Target} */target) => {// Create a new parameter object for each staggered children- const staggeredChildParams = { ...childParams };+ const staggeredChildParams = { ...(resolvedParams || childParams) };// Reset the duration of the timeline iteration before each stagger to prevent wrong start value calculationthis.duration = tlDuration;this.iterationDuration = tlIterationDuration;if (!isUnd(id)) staggeredChildParams.id = id + '-' + i;+ const staggeredTimePosition = parseTimelinePosition(this, staggerFn(target, i, parsedTargetsArray, null, this));addTlChild(staggeredChildParams,this,- parseTimelinePosition(this, staggeredPosition(target, i, parsedLength, this)),+ staggeredTimePosition,target,i,- parsedLength+ parsedTargetsArray,);i++;});} else {+ // Call editor hook before resolving position so tweaked values are applied+ const resolvedChildParams = editorHook ? editorHook(/** @type {TargetsParam} */(a1), childParams, this.id, a3) : childParams;+ const resolvedPosition = a3 && /** @type {*} */(a3).type ? /** @type {*} */(a3).defaultValue : a3;addTlChild(- childParams,+ resolvedChildParams,this,- parseTimelinePosition(this, a3),+ parseTimelinePosition(this, resolvedPosition),/** @type {TargetsParam} */(a1),);}@@ -4396,7 +4482,7 @@revert() {super.revert();forEachChildren(this, (/** @type {JSAnimation|Timer} */child) => child.revert, true);- return cleanInlineStyles(this);+ return revertValues(this);}/**@@ -4416,7 +4502,12 @@* @param {TimelineParams} [parameters]* @return {Timeline}*/- const createTimeline = parameters => new Timeline(parameters).init();+ const createTimeline = parameters => {+ if (globals.editor) {+ return /** @type {Timeline} */(/** @type {unknown} */(globals.editor.addTimeline(parameters)));+ }+ return new Timeline(parameters).init();+ };@@ -4863,6 +4954,170 @@+ const WAAPIAnimationsLookups = {+ _head: null,+ _tail: null,+ };++ /**+ * @param {DOMTarget} $el+ * @param {String} [property]+ * @param {WAAPIAnimation} [parent]+ * @return {globalThis.Animation}+ */+ const removeWAAPIAnimation = ($el, property, parent) => {+ let nextLookup = WAAPIAnimationsLookups._head;+ let anim;+ while (nextLookup) {+ const next = nextLookup._next;+ const matchTarget = nextLookup.$el === $el;+ const matchProperty = !property || nextLookup.property === property;+ const matchParent = !parent || nextLookup.parent === parent;+ if (matchTarget && matchProperty && matchParent) {+ anim = nextLookup.animation;+ try { anim.commitStyles(); } catch {} anim.cancel();+ removeChild(WAAPIAnimationsLookups, nextLookup);+ const lookupParent = nextLookup.parent;+ if (lookupParent) {+ lookupParent._completed++;+ if (lookupParent.animations.length === lookupParent._completed) {+ lookupParent.completed = true;+ lookupParent.paused = true;+ if (!lookupParent.muteCallbacks) {+ lookupParent.onComplete(lookupParent);+ lookupParent._resolve(lookupParent);+ }+ }+ }+ }+ nextLookup = next;+ }+ return anim;+ };++ /**+ * @param {WAAPIAnimation} parent+ * @param {DOMTarget} $el+ * @param {String} property+ * @param {PropertyIndexedKeyframes} keyframes+ * @param {KeyframeAnimationOptions} params+ * @retun {globalThis.Animation}+ */+ const addWAAPIAnimation = (parent, $el, property, keyframes, params) => {+ const animation = $el.animate(keyframes, params);+ const animTotalDuration = params.delay + (+params.duration * params.iterations);+ animation.playbackRate = parent._speed;+ if (parent.paused) animation.pause();+ if (parent.duration < animTotalDuration) {+ parent.duration = animTotalDuration;+ parent.controlAnimation = animation;+ }+ parent.animations.push(animation);+ removeWAAPIAnimation($el, property);+ addChild(WAAPIAnimationsLookups, { parent, animation, $el, property, _next: null, _prev: null });+ const handleRemove = () => removeWAAPIAnimation($el, property, parent);+ animation.oncancel = handleRemove;+ animation.onremove = handleRemove;+ if (!parent.persist) {+ animation.onfinish = handleRemove;+ }+ return animation;+ };++++++ /**+ * @overload+ * @param {DOMTargetSelector} targetSelector+ * @param {String} propName+ * @return {String}+ *+ * @overload+ * @param {JSTargetsParam} targetSelector+ * @param {String} propName+ * @return {Number|String}+ *+ * @overload+ * @param {DOMTargetsParam} targetSelector+ * @param {String} propName+ * @param {String} unit+ * @return {String}+ *+ * @overload+ * @param {TargetsParam} targetSelector+ * @param {String} propName+ * @param {Boolean} unit+ * @return {Number}+ *+ * @param {TargetsParam} targetSelector+ * @param {String} propName+ * @param {String|Boolean} [unit]+ */+ function get(targetSelector, propName, unit) {+ const targets = registerTargets(targetSelector);+ if (!targets.length) return;+ const [ target ] = targets;+ const tweenType = getTweenType(target, propName);+ const normalizePropName = sanitizePropertyName(propName, target, tweenType);+ let originalValue = getOriginalAnimatableValue(target, normalizePropName);+ if (isUnd(unit)) {+ return originalValue;+ } else {+ decomposeRawValue(originalValue, decomposedOriginalValue);+ if (decomposedOriginalValue.t === valueTypes.NUMBER || decomposedOriginalValue.t === valueTypes.UNIT) {+ if (unit === false) {+ return decomposedOriginalValue.n;+ } else {+ const convertedValue = convertValueUnit(/** @type {DOMTarget} */(target), decomposedOriginalValue, /** @type {String} */(unit), false);+ return `${round$1(convertedValue.n, globals.precision)}${convertedValue.u}`;+ }+ }+ }+ }++ /**+ * @param {TargetsParam} targets+ * @param {AnimationParams} parameters+ * @return {JSAnimation}+ */+ const set = (targets, parameters) => {+ if (isUnd(parameters)) return;+ parameters.duration = minValue;+ // Do not overrides currently active tweens by default+ parameters.composition = setValue(parameters.composition, compositionTypes.none);+ // Skip init() and force rendering by playing the animation+ return new JSAnimation(targets, parameters, null, 0, true).resume();+ };++ /**+ * @param {TargetsParam} targets+ * @param {Renderable|WAAPIAnimation} [renderable]+ * @param {String} [propertyName]+ * @return {TargetsArray}+ */+ const remove = (targets, renderable, propertyName) => {+ const targetsArray = parseTargets(targets);+ for (let i = 0, l = targetsArray.length; i < l; i++) {+ removeWAAPIAnimation(+ /** @type {DOMTarget} */(targetsArray[i]),+ propertyName,+ renderable && /** @type {WAAPIAnimation} */(renderable).controlAnimation && /** @type {WAAPIAnimation} */(renderable),+ );+ }+ removeTargetsFromRenderable(+ targetsArray,+ /** @type {Renderable} */(renderable),+ propertyName+ );+ return targetsArray;+ };+++++/*** @param {Event} e*/@@ -6065,19 +6320,20 @@};/**- * @param {(...args: any[]) => Tickable | ((...args: any[]) => void)} constructor+ * @param {(...args: any[]) => Tickable | ((...args: any[]) => void) | void} constructor* @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}*/const keepTime = constructor => {/** @type {Tickable} */let tracked;return (...args) => {- let currentIteration, currentIterationProgress, reversed, alternate;+ let currentIteration, currentIterationProgress, reversed, alternate, startTime;if (tracked) {currentIteration = tracked.currentIteration;currentIterationProgress = tracked.iterationProgress;reversed = tracked.reversed;alternate = tracked._alternate;+ startTime = tracked._startTime;tracked.revert();}const cleanup = constructor(...args);@@ -6085,6 +6341,7 @@if (!isUnd(currentIterationProgress)) {/** @type {Tickable} */(tracked).currentIteration = currentIteration;/** @type {Tickable} */(tracked).iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;+ /** @type {Tickable} */(tracked)._startTime = startTime;}return cleanup || noop;}@@ -7430,12 +7687,12 @@* @param {WAAPIKeyframeValue} value* @param {DOMTarget} $el* @param {Number} i- * @param {Number} targetsLength+ * @param {DOMTargetsArray} parsedTargets* @return {String}*/- const normalizeTweenValue = (propName, value, $el, i, targetsLength) => {+ const normalizeTweenValue = (propName, value, $el, i, parsedTargets) => {// Do not try to compute strings with getFunctionValue otherwise it will convert CSS variables- let v = isStr(value) ? value : getFunctionValue(/** @type {any} */(value), $el, i, targetsLength);+ let v = isStr(value) ? value : getFunctionValue(/** @type {any} */(value), $el, i, parsedTargets, null, null);if (!isNum(v)) return v;if (commonDefaultPXProperties.includes(propName) || stringStartsWith(propName, 'translate')) return `${v}px`;if (stringStartsWith(propName, 'rotate') || stringStartsWith(propName, 'skew')) return `${v}deg`;@@ -7448,18 +7705,18 @@* @param {WAAPIKeyframeValue} from* @param {WAAPIKeyframeValue} to* @param {Number} i- * @param {Number} targetsLength+ * @param {DOMTargetsArray} parsedTargets* @return {WAAPITweenValue}*/- const parseIndividualTweenValue = ($el, propName, from, to, i, targetsLength) => {+ const parseIndividualTweenValue = ($el, propName, from, to, i, parsedTargets) => {/** @type {WAAPITweenValue} */let tweenValue = '0';- const computedTo = !isUnd(to) ? normalizeTweenValue(propName, to, $el, i, targetsLength) : getComputedStyle($el)[propName];+ const computedTo = !isUnd(to) ? normalizeTweenValue(propName, to, $el, i, parsedTargets) : getComputedStyle($el)[propName];if (!isUnd(from)) {- const computedFrom = normalizeTweenValue(propName, from, $el, i, targetsLength);+ const computedFrom = normalizeTweenValue(propName, from, $el, i, parsedTargets);tweenValue = [computedFrom, computedTo];} else {- tweenValue = isArr(to) ? to.map((/** @type {any} */v) => normalizeTweenValue(propName, v, $el, i, targetsLength)) : computedTo;+ tweenValue = isArr(to) ? to.map((/** @type {any} */v) => normalizeTweenValue(propName, v, $el, i, parsedTargets)) : computedTo;}return tweenValue;};@@ -7498,9 +7755,8 @@}const parsedTargets = registerTargets(targets);- const targetsLength = parsedTargets.length;- if (!targetsLength) {+ if (!parsedTargets.length) {console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);}@@ -7556,7 +7812,7 @@const easeToParse = setValue(params.ease, globals.defaults.ease);- const easeFunctionResult = getFunctionValue(easeToParse, $el, i, targetsLength);+ const easeFunctionResult = getFunctionValue(easeToParse, $el, i, parsedTargets, null, null);const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;const spring = /** @type {Spring} */(easeToParse).ease && easeToParse;@@ -7564,9 +7820,9 @@const easing = parseWAAPIEasing(keyEasing);/** @type {Number} */- const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, targetsLength)) * timeScale;+ const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, parsedTargets, null, null)) * timeScale;/** @type {Number} */- const delay = getFunctionValue(setValue(params.delay, globals.defaults.delay), $el, i, targetsLength) * timeScale;+ const delay = getFunctionValue(setValue(params.delay, globals.defaults.delay), $el, i, parsedTargets, null, null) * timeScale;/** @type {CompositeOperation} */const composite = /** @type {CompositeOperation} */(setValue(params.composition, 'replace'));@@ -7592,19 +7848,19 @@const to = /** @type {WAAPITweenOptions} */(tweenOptions).to;const from = /** @type {WAAPITweenOptions} */(tweenOptions).from;/** @type {Number} */- tweenParams.duration = (tweenOptionsSpring ? /** @type {Spring} */(tweenOptionsSpring).settlingDuration : getFunctionValue(setValue(tweenOptions.duration, duration), $el, i, targetsLength)) * timeScale;+ tweenParams.duration = (tweenOptionsSpring ? /** @type {Spring} */(tweenOptionsSpring).settlingDuration : getFunctionValue(setValue(tweenOptions.duration, duration), $el, i, parsedTargets, null, null)) * timeScale;/** @type {Number} */- tweenParams.delay = getFunctionValue(setValue(tweenOptions.delay, delay), $el, i, targetsLength) * timeScale;+ tweenParams.delay = getFunctionValue(setValue(tweenOptions.delay, delay), $el, i, parsedTargets, null, null) * timeScale;/** @type {CompositeOperation} */tweenParams.composite = /** @type {CompositeOperation} */(setValue(tweenOptions.composition, composite));/** @type {String} */tweenParams.easing = parseWAAPIEasing(tweenOptionsEase);- parsedPropertyValue = parseIndividualTweenValue($el, name, from, to, i, targetsLength);+ parsedPropertyValue = parseIndividualTweenValue($el, name, from, to, i, parsedTargets);if (individualTransformProperty) {keyframes[`--${individualTransformProperty}`] = parsedPropertyValue;cachedTransforms[individualTransformProperty] = parsedPropertyValue;} else {- keyframes[name] = parseIndividualTweenValue($el, name, from, to, i, targetsLength);+ keyframes[name] = parseIndividualTweenValue($el, name, from, to, i, parsedTargets);}addWAAPIAnimation(this, $el, name, keyframes, tweenParams);if (!isUnd(from)) {@@ -7617,8 +7873,8 @@}} else {parsedPropertyValue = isArr(propertyValue) ?- propertyValue.map((/** @type {any} */v) => normalizeTweenValue(name, v, $el, i, targetsLength)) :- normalizeTweenValue(name, /** @type {any} */(propertyValue), $el, i, targetsLength);+ propertyValue.map((/** @type {any} */v) => normalizeTweenValue(name, v, $el, i, parsedTargets)) :+ normalizeTweenValue(name, /** @type {any} */(propertyValue), $el, i, parsedTargets);if (individualTransformProperty) {keyframes[`--${individualTransformProperty}`] = parsedPropertyValue;cachedTransforms[individualTransformProperty] = parsedPropertyValue;@@ -7851,6 +8107,7 @@/*** @typedef {Object} LayoutSpecificAnimationParams+ * @property {Number|String} [id]* @property {Number|FunctionValue} [delay]* @property {Number|FunctionValue} [duration]* @property {EasingParam|FunctionValue} [ease]@@ -7893,7 +8150,7 @@* @property {String} id* @property {DOMTarget} $el* @property {Number} index- * @property {Number} total+ * @property {Array<DOMTarget>} targets* @property {Number} delay* @property {Number} duration* @property {EasingParam} ease@@ -8037,7 +8294,7 @@node.$measure = $el;node.id = dataId;node.index = 0;- node.total = 1;+ node.targets = null;node.delay = 0;node.duration = 0;node.ease = null;@@ -8223,12 +8480,12 @@* @param {LayoutAnimationTimingsParams} params*/const updateNodeTimingParams = (node, params) => {- const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.total);+ const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.targets, null, null);const keyEasing = isFnc(easeFunctionResult) ? easeFunctionResult : params.ease;const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);node.ease = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;- node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.total);- node.delay = getFunctionValue(params.delay, node.$el, node.index, node.total);+ node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.targets, null, null);+ node.delay = getFunctionValue(params.delay, node.$el, node.index, node.targets, null, null);};/**@@ -8601,10 +8858,12 @@const inRootNodeIds = new Set();// Update index and total for inital timing calculation- let index = 0, total = this.nodes.size;+ let index = 0;+ const allNodeTargets = [];+ this.nodes.forEach((node) => { allNodeTargets.push(node.$el); });this.nodes.forEach((node, id) => {node.index = index++;- node.total = total;+ node.targets = allNodeTargets;// Track ids of nodes that belong to the current root to filter detached matchesif (node && node.measuredIsInsideRoot) {inRootNodeIds.add(id);@@ -8716,8 +8975,8 @@this.params = params;/** @type {DOMTarget} */this.root = /** @type {DOMTarget} */(registerTargets(root)[0]);- /** @type {Number} */- this.id = layoutId++;+ /** @type {Number|String} */+ this.id = params.id || layoutId++;/** @type {LayoutChildrenParam} */this.children = params.children || '*';/** @type {Boolean} */@@ -8840,7 +9099,9 @@duration: setValue(params.duration, this.params.duration),};/** @type {TimelineParams} */- const tlParams = {};+ const tlParams = {+ id: this.id+ };const onComplete = setValue(params.onComplete, this.params.onComplete);const onPause = setValue(params.onPause, this.params.onPause);for (let name in defaults) {@@ -8854,7 +9115,8 @@}tlParams.onComplete = () => {const ap = /** @type {ScrollObserver} */(params.autoplay);- const isScrollControled = ap && ap.linked;+ const ed = globals.editor;+ const isScrollControled = (ap && ap.linked) || (ed && ed.showPanel);if (isScrollControled) {if (onComplete) onComplete(this.timeline);return;@@ -9053,41 +9315,39 @@animatedParent = animatedParent.parentNode;}- const animatingTotal = animating.length;-// Root is always animated first in sync with the first child (animating.length is the total of children)if (node === rootNode) {node.index = 0;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, animationTimings);} else if (node.isEntering) {node.index = animatedParent ? animatedParent.index : enteringIndex;- node.total = animatedParent ? animatingTotal : entering.length;+ node.targets = animatedParent ? animating : entering;updateNodeTimingParams(node, enterFromTimings);enteringIndex++;} else if (node.isLeaving) {node.index = animatedParent ? animatedParent.index : leavingIndex;- node.total = animatedParent ? animatingTotal : leaving.length;+ node.targets = animatedParent ? animating : leaving;leavingIndex++;updateNodeTimingParams(node, leaveToTimings);} else if (node.isTarget) {node.index = animatingIndex++;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, animationTimings);} else {node.index = animatedParent ? animatedParent.index : 0;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, swapAtTimings);}// Make sure the old state node has its inex and total values up to date for valid "from" function values calculationoldStateNode.index = node.index;- oldStateNode.total = node.total;+ oldStateNode.targets = node.targets;// Computes all values up front so we can check for changes and we don't have to re-compute them inside the animation propsfor (let prop in nodeProperties) {- nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.total);- oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.total);+ nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.targets, null, null);+ oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.targets, null, null);}// Use a 1px tolerance to detect dimensions changes to prevent width / height animations on barelly visible elements@@ -9313,8 +9573,8 @@}$el.style.transform = oldState.getComputedValue($el, 'transform');if (animatedSwap.includes($el)) {- node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.total);- node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.total);+ node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.targets, null, null);+ node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.targets, null, null);}}this.transformAnimation = waapi.animate(transformed, {@@ -9329,7 +9589,7 @@if (!animatedSwap.includes($el)) return newValue;const oldValue = oldState.getComputedValue($el, 'transform');const node = newState.getNode($el);- return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]+ return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.targets, null, null), newValue]},autoplay: false,// persist: true,@@ -9386,10 +9646,13 @@const result = fn(...args);return new Proxy(noop, {apply: (_, __, [v]) => result(v),- get: (_, prop) => chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {- const nextResult = chainables[prop](...nextArgs);- return (/**@type {Number|String} */v) => nextResult(result(v));- })+ get: (_, prop) => {+ if (!chainables[prop]) return undefined;+ return chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {+ const nextResult = chainables[prop](...nextArgs);+ return (/**@type {Number|String} */v) => nextResult(result(v));+ })+ }});}};@@ -9600,24 +9863,28 @@* @param {StaggerParams} [params]* @return {StaggerFunction<Number>}*/+/*** @overload* @param {String} val* @param {StaggerParams} [params]* @return {StaggerFunction<String>}*/+/*** @overload* @param {[Number, Number]} val* @param {StaggerParams} [params]* @return {StaggerFunction<Number>}*/+/*** @overload* @param {[String, String]} val* @param {StaggerParams} [params]* @return {StaggerFunction<String>}*/+/*** @param {Number|String|[Number, Number]|[String, String]} val The staggered value or range* @param {StaggerParams} [params] The stagger parameters@@ -9626,6 +9893,7 @@const stagger = (val, params = {}) => {let values = [];let maxValue = 0;+ let cachedOffset;const from = params.from;const reversed = params.reversed;const ease = params.ease;@@ -9633,12 +9901,14 @@const hasSpring = hasEasing && !isUnd(/** @type {Spring} */(ease).ease);const staggerEase = hasSpring ? /** @type {Spring} */(ease).ease : hasEasing ? parseEase(ease) : null;const grid = params.grid;+ const autoGrid = grid === true;const axis = params.axis;const customTotal = params.total;const fromFirst = isUnd(from) || from === 0 || from === 'first';const fromCenter = from === 'center';const fromLast = from === 'last';const fromRandom = from === 'random';+ const fromArr = isArr(from);const isRange = isArr(val);const useProp = params.use;const val1 = isRange ? parseNumber(val[0]) : parseNumber(val);@@ -9646,40 +9916,129 @@const unitMatch = unitsExecRgx.exec((isRange ? val[1] : val) + emptyString);const start = params.start || 0 + (isRange ? val1 : 0);let fromIndex = fromFirst ? 0 : isNum(from) ? from : 0;- return (target, i, t, tl) => {+ return (target, i, t, _, tl) => {const [ registeredTarget ] = registerTargets(target);- const total = isUnd(customTotal) ? t : customTotal;+ const total = isUnd(customTotal) ? t.length : customTotal;const customIndex = !isUnd(useProp) ? isFnc(useProp) ? useProp(registeredTarget, i, total) : getOriginalAnimatableValue(registeredTarget, useProp) : false;const staggerIndex = isNum(customIndex) || isStr(customIndex) && isNum(+customIndex) ? +customIndex : i;if (fromCenter) fromIndex = (total - 1) / 2;if (fromLast) fromIndex = total - 1;if (!values.length) {- for (let index = 0; index < total; index++) {- if (!grid) {- values.push(abs(fromIndex - index));+ if (autoGrid) {+ let hasPositions = true;+ let minPosX = Infinity;+ let minPosY = Infinity;+ let maxPosX = -Infinity;+ let maxPosY = -Infinity;+ const pxArr = [];+ const pyArr = [];+ for (let index = 0; index < total; index++) {+ const el = t[index];+ let px = 0;+ let py = 0;+ let found = false;+ if (el && isFnc(el.getBoundingClientRect)) {+ const rect = el.getBoundingClientRect();+ px = rect.left + rect.width / 2;+ py = rect.top + rect.height / 2;+ found = true;+ } else {+ const obj = /** @type {JSTarget} */(el);+ if (obj && isNum(obj.x) && isNum(obj.y)) {+ px = obj.x;+ py = obj.y;+ found = true;+ }+ }+ if (!found) {+ hasPositions = false;+ break;+ }+ pxArr.push(px);+ pyArr.push(py);+ if (px < minPosX) minPosX = px;+ if (py < minPosY) minPosY = py;+ if (px > maxPosX) maxPosX = px;+ if (py > maxPosY) maxPosY = py;+ }+ if (hasPositions) {+ let fX = pxArr[0];+ let fY = pyArr[0];+ if (fromArr) {+ fX = minPosX + from[0] * (maxPosX - minPosX);+ fY = minPosY + from[1] * (maxPosY - minPosY);+ } else if (fromCenter) {+ fX = (minPosX + maxPosX) / 2;+ fY = (minPosY + maxPosY) / 2;+ } else if (fromLast) {+ fX = pxArr[total - 1];+ fY = pyArr[total - 1];+ } else if (isNum(from)) {+ fX = pxArr[from];+ fY = pyArr[from];+ }+ for (let index = 0; index < total; index++) {+ const distanceX = fX - pxArr[index];+ const distanceY = fY - pyArr[index];+ let value = sqrt(distanceX * distanceX + distanceY * distanceY);+ if (axis === 'x') value = -distanceX;+ if (axis === 'y') value = -distanceY;+ values.push(value);+ }+ let minDist = Infinity;+ for (let index = 0, l = values.length; index < l; index++) {+ const absVal = abs(values[index]);+ if (absVal > 0 && absVal < minDist) minDist = absVal;+ }+ if (minDist > 0 && minDist < Infinity) {+ for (let index = 0, l = values.length; index < l; index++) {+ values[index] = values[index] / minDist;+ }+ }} else {- const fromX = !fromCenter ? fromIndex % grid[0] : (grid[0] - 1) / 2;- const fromY = !fromCenter ? floor(fromIndex / grid[0]) : (grid[1] - 1) / 2;- const toX = index % grid[0];- const toY = floor(index / grid[0]);- const distanceX = fromX - toX;- const distanceY = fromY - toY;- let value = sqrt(distanceX * distanceX + distanceY * distanceY);- if (axis === 'x') value = -distanceX;- if (axis === 'y') value = -distanceY;- values.push(value);+ for (let index = 0; index < total; index++) {+ values.push(abs(fromIndex - index));+ }+ }+ } else {+ for (let index = 0; index < total; index++) {+ if (!grid) {+ values.push(abs(fromIndex - index));+ } else {+ let fromX, fromY;+ if (fromArr) {+ fromX = from[0] * (grid[0] - 1);+ fromY = from[1] * (grid[1] - 1);+ } else if (fromCenter) {+ fromX = (grid[0] - 1) / 2;+ fromY = (grid[1] - 1) / 2;+ } else {+ fromX = fromIndex % grid[0];+ fromY = floor(fromIndex / grid[0]);+ }+ const toX = index % grid[0];+ const toY = floor(index / grid[0]);+ const distanceX = fromX - toX;+ const distanceY = fromY - toY;+ let value = sqrt(distanceX * distanceX + distanceY * distanceY);+ if (axis === 'x') value = -distanceX;+ if (axis === 'y') value = -distanceY;+ values.push(value);+ }}- maxValue = max(...values);}+ maxValue = max(...values);if (staggerEase) values = values.map(val => staggerEase(val / maxValue) * maxValue);if (reversed) values = values.map(val => axis ? (val < 0) ? val * -1 : -val : abs(maxValue - val));if (fromRandom) values = shuffle(values);}const spacing = isRange ? (val2 - val1) / maxValue : val1;- const offset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);+ if (isUnd(cachedOffset)) {+ cachedOffset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);+ }/** @type {String|Number} */- let output = offset + ((spacing * round$1(values[staggerIndex], 2)) || 0);- if (params.modifier) output = params.modifier(output);+ let output = cachedOffset + ((spacing * round$1(values[staggerIndex], 2)) || 0);+ if (params.modifier) output = params.modifier(/** @type {Number} */(output));if (unitMatch) output = `${output}${unitMatch[2]}`;return output;}@@ -9688,11 +10047,13 @@var index$2 = /*#__PURE__*/Object.freeze({__proto__: null,$: registerTargets,+ addChild: addChild,clamp: clamp,cleanInlineStyles: cleanInlineStyles,createSeededRandom: createSeededRandom,damp: damp,degToRad: degToRad,+ forEachChildren: forEachChildren,get: get,keepTime: keepTime,lerp: lerp,@@ -9703,6 +10064,7 @@random: random,randomPick: randomPick,remove: remove,+ removeChild: removeChild,round: round,roundPad: roundPad,set: set,@@ -9902,7 +10264,7 @@* @param {Number} [precision]* @return {FunctionValue}*/- const morphTo = (path2, precision = .33) => ($path1) => {+ const morphTo = (path2, precision = .33) => ($path1, index, total, prevTween) => {const tagName1 = ($path1.tagName || '').toLowerCase();if (!tagName1.match(/^(path|polygon|polyline)$/)) {throw new Error(`Can't morph a <${$path1.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);@@ -9917,7 +10279,7 @@}const isPath = $path1.tagName === 'path';const separator = isPath ? ' ' : ',';- const previousPoints = $path1[morphPointsSymbol];+ const previousPoints = prevTween ? prevTween._value : null;if (previousPoints) $path1.setAttribute(isPath ? 'd' : 'points', previousPoints);let v1 = '', v2 = '';@@ -9939,8 +10301,6 @@}}- $path1[morphPointsSymbol] = v2;-return [v1, v2];};@@ -10126,7 +10486,7 @@*/class TextSplitter {/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]*/constructor(target, parameters = {}) {@@ -10198,11 +10558,11 @@}/**- * @param {(...args: any[]) => Tickable | (() => void)} effect+ * @param {(...args: any[]) => Tickable | (() => void) | void} effect* @return this*/addEffect(effect) {- if (!isFnc(effect)) return console.warn('Effect must return a function.');+ if (!isFnc(effect)) { console.warn('Effect must return a function.'); return this; }const refreshableEffect = keepTime(effect);this.effects.push(refreshableEffect);if (this.ready) this.effectsCleanups[this.effects.length - 1] = refreshableEffect(this);@@ -10408,7 +10768,7 @@}/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]* @return {TextSplitter}*/@@ -10426,9 +10786,261 @@return new TextSplitter(target, parameters);};+++ /**+ * '-' is the range operator; place it at the start or end of the string to use it as a literal (e.g. '-abc' or 'abc-')+ * @param {String} str+ * @return {String}+ */+ const expandCharRanges = (str) => {+ let result = '';+ for (let i = 0, l = str.length; i < l; i++) {+ if (i + 2 < l && str[i + 1] === '-' && str.charCodeAt(i) < str.charCodeAt(i + 2)) {+ const start = str.charCodeAt(i);+ const end = str.charCodeAt(i + 2);+ for (let c = start; c <= end; c++) result += String.fromCharCode(c);+ i += 2;+ } else {+ result += str[i];+ }+ }+ return result;+ };++ const charSets = {+ lowercase: 'a-z',+ uppercase: 'A-Z',+ numbers: '0-9',+ symbols: '!%#_|*+=',+ braille: '⠀-⣿',+ blocks: '▀-▟',+ shades: '░-▓',+ };++ const originalTexts = new WeakMap();++ /**+ * Returns a function-based tween value that scrambles the target's text content,+ * progressively revealing the original text.+ *+ * @param {ScrambleTextParams} [params]+ * @return {FunctionValue}+ */+ const scrambleText = (params = {}) => {+ if (!params) params = {};+ const charsParam = params.chars;+ const easeFn = parseEase(params.ease || 'linear');+ const text = params.text;+ const fromParam = params.from;+ const reversed = params.reversed || false;+ const perturbation = params.perturbation || 0;+ const cursorParam = params.cursor;+ const cursorChars = cursorParam === true ? '_'+ : typeof cursorParam === 'number' ? String.fromCharCode(cursorParam)+ : typeof cursorParam === 'string' ? cursorParam+ : '';+ const cursorLen = cursorChars.length;+ const seed = params.seed || 0;+ const override = params.override !== undefined ? params.override : true;+ const revealRate = params.revealRate || 60;+ const interval = 1000 * globals.timeScale / revealRate;+ const settleDuration = params.settleDuration || 300 * globals.timeScale;+ const settleRate = params.settleRate || 30;+ const durationParam = params.duration;+ const revealDelayParam = params.revealDelay;+ const delayParam = params.delay;+ const onChange = params.onChange || noop;++ return (target, index, targets, prevTween) => {+ const rawChars = typeof charsParam === 'function' ? charsParam(target, index, targets) : (charsParam || 'a-zA-Z0-9!%#_');+ const characters = expandCharRanges(charSets[rawChars] || rawChars);+ const totalChars = characters.length - 1;+ const duration = typeof durationParam === 'function' ? durationParam(target, index, targets) : durationParam;+ const revealDelay = typeof revealDelayParam === 'function' ? revealDelayParam(target, index, targets) : (revealDelayParam || 0);+ const delay = typeof delayParam === 'function' ? delayParam(target, index, targets) : (delayParam || 0);+ const rng = seed ? createSeededRandom(seed) : createSeededRandom();+ if (!originalTexts.has(target)) originalTexts.set(target, target.textContent);+ const startingText = prevTween ? prevTween._value : target.textContent;+ const targetText = text !== undefined+ ? (typeof text === 'function' ? text(target, index, targets) : text)+ : prevTween ? prevTween._value+ : originalTexts.get(target);+ const settledText = targetText === ' ' || targetText === ' ' ? ' ' : targetText;+ const startLength = startingText === ' ' ? 0 : startingText.length;+ const endLength = settledText.length;+ const overrideChars = override === true ? characters+ : typeof override === 'string' && override.length > 0 ? expandCharRanges(charSets[/** @type {String} */(override)] || /** @type {String} */(override))+ : null;+ const totalOverrideChars = overrideChars ? overrideChars.length - 1 : 0;+ // Space override uses so the browser doesn't collapse consecutive spaces in innerHTML+ const overrideChar = override === ' ' ? ' ' : null;+ // When starting from blank, only animate the target text length to avoid padding beyond it+ const animLength = override === '' ? endLength : Math.max(startLength, endLength);+ // Compute total duration from interval spacing and settle time, or use the explicit duration+ const animDuration = duration > 0 ? duration : (animLength - 1) * interval + settleDuration;+ const computedDuration = round$1((animDuration + revealDelay) / globals.timeScale, 0) * globals.timeScale;+ const revealDelayRatio = revealDelay > 0 ? round$1(revealDelay / computedDuration, 12) : 0;+ // Auto-resolve reveal direction: shrinking text reveals from right, growing from left+ const resolvedFrom = fromParam === undefined || fromParam === 'auto' ? (endLength < startLength ? 'right' : 'left') : fromParam;+ const charOrder = new Int32Array(animLength);+ if (resolvedFrom === 'random') {+ for (let i = 0; i < animLength; i++) charOrder[i] = i;+ for (let i = animLength - 1; i > 0; i--) {+ const j = rng(0, i);+ const t = charOrder[i]; charOrder[i] = charOrder[j]; charOrder[j] = t;+ }+ } else {+ const ref = resolvedFrom === 'right' ? (override === '' || !startLength ? animLength : startLength) - 1+ : resolvedFrom === 'center' ? ((override === '' || !startLength ? animLength : startLength) - 1) / 2+ : typeof resolvedFrom === 'number' ? resolvedFrom+ : 0;+ const abs = Math.abs;+ const indices = new Array(animLength);+ for (let i = 0; i < animLength; i++) indices[i] = i;+ indices.sort((a, b) => abs(a - ref) - abs(b - ref));+ for (let i = 0; i < animLength; i++) charOrder[indices[i]] = i;+ }+ if (reversed) {+ const last = animLength - 1;+ for (let i = 0; i < animLength; i++) charOrder[i] = last - charOrder[i];+ }+ // settleRatio is the fraction of the animation each character spends in the active scrambling zone+ const settleRatio = round$1(settleDuration / animDuration, 12);+ // settleSpacing is the time gap between consecutive characters entering the active zone+ const settleSpacing = round$1((1 - settleRatio) / animLength, 12);+ const cursorZone = cursorLen * settleSpacing;+ // stepRatio controls how often scramble characters refresh (based on settleRate)+ const stepRatio = round$1(1000 * globals.timeScale / (settleRate * computedDuration), 12);+ // Pre-compute per-character start and settle times+ const charStarts = new Float32Array(animLength);+ const charEnds = new Float32Array(animLength);+ const scale = perturbation > 0 ? perturbation * settleRatio : 0;+ for (let c = 0; c < animLength; c++) {+ const so = scale > 0 ? (rng(0, 2000) - 1000) / 1000 * scale : 0;+ const eo = scale > 0 ? (rng(0, 2000) - 1000) / 1000 * scale : 0;+ charStarts[c] = charOrder[c] * settleSpacing + so;+ charEnds[c] = Math.ceil((charStarts[c] + settleRatio + eo) / stepRatio) * stepRatio;+ }+ // When text shrinks with non-sequential from modes, delay target settle times past all extras+ if (endLength < animLength && resolvedFrom !== 'left' && resolvedFrom !== 'right' && resolvedFrom !== 'random') {+ let maxExtraEnd = 0;+ for (let c = endLength; c < animLength; c++) {+ if (charEnds[c] > maxExtraEnd) maxExtraEnd = charEnds[c];+ }+ const targets = new Array(endLength);+ for (let c = 0; c < endLength; c++) targets[c] = c;+ targets.sort((a, b) => charOrder[a] - charOrder[b]);+ const targetSpacing = (1 - maxExtraEnd) / endLength;+ for (let i = 0; i < endLength; i++) {+ const revealTime = maxExtraEnd + i * targetSpacing;+ if (revealTime > charEnds[targets[i]]) {+ charEnds[targets[i]] = revealTime;+ }+ }+ }+ // charCache holds the current scramble character for each position, refreshed at settleRate+ const charCache = new Array(animLength);+ for (let c = 0; c < animLength; c++) {+ charCache[c] = characters[rng(0, totalChars)];+ }+ // overrideCache holds scramble characters for the starting text (override: true or custom string)+ const overrideCache = overrideChars ? (overrideChars === characters ? charCache : new Array(animLength)) : null;+ if (overrideCache && overrideCache !== charCache) {+ for (let c = 0; c < animLength; c++) {+ overrideCache[c] = overrideChar || /** @type {String} */(overrideChars)[rng(0, overrideChars.length - 1)];+ }+ }+ // Build the initial display text based on override mode+ let fillStartText = startingText;+ if (!prevTween) {+ if (override === '') {+ fillStartText = '';+ } else if (overrideChars) {+ fillStartText = '';+ for (let c = 0; c < startLength; c++) {+ fillStartText += startingText[c] === ' ' ? ' ' : /** @type {Array<String>} */(overrideCache)[c];+ }+ }+ }++ let lastValue = -1;+ let lastStep = -1;+ let scrambled = '';+ const hasOverride = override !== '';+ const hasOverrideChars = !!overrideChars;+ const hasCursor = cursorLen > 0;++ return {+ from: 0,+ to: 1,+ duration: computedDuration,+ delay: delay,+ ease: 'linear',+ modifier: (v) => {+ if (v === lastValue) return scrambled;+ lastValue = v;+ if (delay > 0 && v <= 0) { scrambled = startingText; return startingText; }+ if (v <= 0) { scrambled = fillStartText; return fillStartText; }+ if (v >= 1) { scrambled = settledText; return settledText; }+ scrambled = '';+ // Only refresh scramble characters when we cross a settleRate step boundary+ const currentStep = (v / stepRatio) | 0;+ const refreshChars = currentStep !== lastStep;+ if (refreshChars) lastStep = currentStep;+ // Subtract delay ratio to get the effective animation progress+ const linear = revealDelayRatio > 0 ? (v - revealDelayRatio) / (1 - revealDelayRatio) : v;+ const t = linear > 0 ? easeFn(linear) : 0;+ for (let c = 0; c < animLength; c++) {+ // Each character has its own start/end window based on its reveal order+ const charStart = charStarts[c];+ const charEnd = charEnds[c];+ // Settled zone: character has finished its transition+ if (t >= charEnd) {+ if (c < endLength) scrambled += settledText[c];+ continue;+ }+ // Pre-transition zone: reveal wave hasn't reached this character yet+ if (t <= 0 || t < charStart) {+ if (hasOverride && c < startLength) {+ if (hasOverrideChars) {+ if (startingText[c] === ' ') {+ scrambled += ' ';+ } else {+ if (refreshChars) /** @type {Array<String>} */(overrideCache)[c] = overrideChar || /** @type {String} */(overrideChars)[rng(0, totalOverrideChars)];+ scrambled += /** @type {Array<String>} */(overrideCache)[c];+ }+ } else {+ // Default (override: false): show the original starting text+ scrambled += startingText[c];+ }+ }+ continue;+ }+ // Active zone: character is between charStart and charEnd+ const isSpace = (c < endLength && settledText[c] === ' ') || (c < startLength && startingText[c] === ' ');+ if (isSpace) {+ scrambled += ' ';+ } else if (hasCursor && t - charStart < cursorZone) {+ // Cursor sub-zone: show cursor character based on position within cursor width+ scrambled += cursorChars[cursorLen - 1 - (((t - charStart) / settleSpacing) | 0)];+ } else {+ // Scramble zone: show cycling random characters+ if (refreshChars) charCache[c] = characters[rng(0, totalChars)];+ scrambled += charCache[c];+ }+ }+ if (refreshChars) onChange(scrambled, t);+ return scrambled;+ }+ }+ }+ };+var index = /*#__PURE__*/Object.freeze({__proto__: null,TextSplitter: TextSplitter,+ scrambleText: scrambleText,split: split,splitText: splitText});@@ -10445,6 +11057,7 @@exports.Timeline = Timeline;exports.Timer = Timer;exports.WAAPIAnimation = WAAPIAnimation;+ exports.addChild = addChild;exports.animate = animate;exports.clamp = clamp;exports.cleanInlineStyles = cleanInlineStyles;@@ -10464,7 +11077,9 @@exports.eases = eases;exports.easings = index$3;exports.engine = engine;+ exports.forEachChildren = forEachChildren;exports.get = get;+ exports.globals = globals;exports.irregular = irregular;exports.keepTime = keepTime;exports.lerp = lerp;@@ -10478,8 +11093,10 @@exports.random = random;exports.randomPick = randomPick;exports.remove = remove;+ exports.removeChild = removeChild;exports.round = round;exports.roundPad = roundPad;+ exports.scrambleText = scrambleText;exports.scrollContainers = scrollContainers;exports.set = set;exports.shuffle = shuffle;diff --git a/dist/bundles/anime.umd.min.js b/dist/bundles/anime.umd.min.jsindex 9c05a917..51a23c6f 100644--- a/dist/bundles/anime.umd.min.js+++ b/dist/bundles/anime.umd.min.js@@ -1,7 +1,7 @@/*** Anime.js - UMD minified bundle- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).anime={})}(this,function(t){"use strict";const e="undefined"!=typeof window,s=e?window:null,i=e?document:null,r={replace:0,none:1,blend:2},n=Symbol(),o=Symbol(),a=Symbol(),l=Symbol(),h=Symbol(),d=Symbol(),c=1e-11,u=1e12,p=1e3,m="",f=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),g=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","matrix","matrix3d","perspective"],y=g.reduce((t,e)=>({...t,[e]:e+"("}),{}),v=()=>{},_=/\)\s*[-.\d]/,b=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,T=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,x=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,w=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,S=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,$=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,E=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,k=/([a-z])([A-Z])/g,C=/(\w+)(\([^)]+\)+)/g,N=/(\*=|\+=|-=)/,D=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,I={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:p,delay:0,loopDelay:0,ease:"out(2)",composition:r.replace,modifier:t=>t,onBegin:v,onBeforeUpdate:v,onUpdate:v,onLoop:v,onPause:v,onComplete:v,onRender:v},L={current:null,root:i},A={defaults:I,precision:4,timeScale:1,tickThreshold:200},R=e&&s.AnimeJSDevTools,B={version:"4.3.6",engine:null};e&&(s.AnimeJS||(s.AnimeJS=[]),s.AnimeJS.push(B));const P=t=>t.replace(k,"$1-$2").toLowerCase(),F=(t,e)=>0===t.indexOf(e),M=Date.now,V=Array.isArray,O=t=>t&&t.constructor===Object,z=t=>"number"==typeof t&&!isNaN(t),H=t=>"string"==typeof t,X=t=>"function"==typeof t,Y=t=>void 0===t,W=t=>Y(t)||null===t,U=t=>e&&t instanceof SVGElement,q=t=>b.test(t),j=t=>F(t,"rgb"),G=t=>F(t,"hsl"),Q=t=>!A.defaults.hasOwnProperty(t),Z=["opacity","rotate","overflow","color"],J=t=>H(t)?parseFloat(t):t,K=Math.pow,tt=Math.sqrt,et=Math.sin,st=Math.cos,it=Math.abs,rt=Math.exp,nt=Math.ceil,ot=Math.floor,at=Math.asin,lt=Math.max,ht=Math.atan2,dt=Math.PI,ct=Math.round,ut=(t,e,s)=>t<e?e:t>s?s:t,pt={},mt=(t,e)=>{if(e<0)return t;if(!e)return ct(t);let s=pt[e];return s||(s=pt[e]=10**e),ct(t*s)/s},ft=(t,e)=>V(e)?e.reduce((e,s)=>it(s-t)<it(e-t)?s:e):e?ct(t/e)*e:t,gt=(t,e,s)=>t+(e-t)*s,yt=t=>t===1/0?u:t===-1/0?-u:t,vt=t=>t<=c?c:yt(mt(t,11)),_t=t=>V(t)?[...t]:t,bt=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=Y(r)?e[i]:r}return s},Tt=(t,e,s,i="_prev",r="_next")=>{let n=t._head,o=r;for(s&&(n=t._tail,o=i);n;){const t=n[o];e(n),n=t}},xt=(t,e,s="_prev",i="_next")=>{const r=e[s],n=e[i];r?r[i]=n:t._head=n,n?n[s]=r:t._tail=r,e[s]=null,e[i]=null},wt=(t,e,s,i="_prev",r="_next")=>{let n=t._tail;for(;n&&s&&s(n,e);)n=n[i];const o=n?n[r]:t._head;n?n[r]=e:t._head=e,o?o[i]=e:t._tail=e,e[i]=n,e[r]=o},St=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t),$t=(t,e)=>Y(t)?e:t,Et=(t,e,s,i,r)=>{let n;if(X(t))n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};else{if(!H(t)||!F(t,"var("))return t;n=()=>{const s=t.match(D),i=s[1],r=s[2];let n=getComputedStyle(e)?.getPropertyValue(i);return n&&n.trim()!==m||!r||(n=r.trim()),n||0}}return r&&(r.func=n),n()},kt=(t,e)=>t[o]?t[a]&&((t,e)=>{if(Z.includes(e))return!1;if(t.getAttribute(e)||e in t){if("scale"===e){const e=t.parentNode;return e&&"filter"===e.tagName}return!0}})(t,e)?1:g.includes(e)||f.get(e)?3:F(e,"--")?4:e in t.style?2:e in t?0:1:0,Ct=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[d]||t).getPropertyValue(e);return"auto"===r?"0":r},Nt=(t,e,s,i)=>{const r=Y(s)?kt(t,e):s;return 0===r?t[e]||0:1===r?t.getAttribute(e):3===r?((t,e,s)=>{const i=t.style.transform;let r;if(i){const n=t[l];let o;for(;o=C.exec(i);){const t=o[1],i=o[2].slice(1,-1);n[t]=i,t===e&&(r=i,s&&(s[e]=i))}}return i&&!Y(r)?r:F(e,"scale")?"1":F(e,"rotate")||F(e,"skew")?"0deg":"0px"})(t,e,i):4===r?Ct(t,e,i).trimStart():Ct(t,e,i)},Dt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,It=(t,e)=>{if(e.t=0,e.n=0,e.u=null,e.o=null,e.d=null,e.s=null,!t)return e;const s=+t;if(isNaN(s)){let s=t;"="===s[1]&&(e.o=s[0],s=s.slice(2));const n=!s.includes(" ")&&E.exec(s);if(n)return e.t=1,e.n=+n[1],e.u=n[2],e;if(e.o)return e.n=+s,e;if(q(r=s)||(j(r)||G(r))&&(")"===r[r.length-1]||!_.test(r)))return e.t=2,e.d=j(i=s)?(t=>{const e=T.exec(t)||x.exec(t),s=Y(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):q(i)?(t=>{const e=t.length,s=4===e||5===e;return[+("0x"+t[1]+t[s?1:2]),+("0x"+t[s?2:3]+t[s?2:4]),+("0x"+t[s?3:5]+t[s?3:6]),5===e||9===e?+(+("0x"+t[s?4:7]+t[s?4:8])/255).toFixed(3):1]})(i):G(i)?(t=>{const e=w.exec(t)||S.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=Y(e[4])?1:+e[4];let o,a,l;if(0===i)o=a=l=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=mt(255*St(e,t,s+1/3),0),a=mt(255*St(e,t,s),0),l=mt(255*St(e,t,s-1/3),0)}return[o,a,l,n]})(i):[0,0,0,1],e;{const t=s.match($);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split($)||[],e}}var i,r;return e.n=s,e},Lt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=_t(t._toNumbers),e.s=_t(t._strings),e),At={t:0,n:0,u:null,o:null,d:null,s:null},Rt=(t,e,s,i,n)=>{const o=t.parent,a=t.duration,h=t.completed,d=t.iterationDuration,u=t.iterationCount,p=t._currentIteration,f=t._loopDelay,g=t._reversed,v=t._alternate,_=t._hasChildren,b=t._delay,T=t._currentTime,x=b+d,w=e-b,S=ut(T,-b,a),$=ut(w,-b,a),E=w-T,k=$>0,C=$>=a,N=a<=c,D=2===n;let I=0,L=w,R=0;if(u>1){const e=~~($/(d+(C?0:f)));t._currentIteration=ut(e,0,u),C&&t._currentIteration--,I=t._currentIteration%2,L=$%(d+f)||0}const B=g^(v&&I),P=t._ease;let F=C?B?0:a:B?d-L:L;P&&(F=d*P(F/d)||0);const M=(o?o.backwards:w<T)?!B:!!B;if(t._currentTime=w,t._iterationTime=F,t.backwards=M,k&&!t.began?(t.began=!0,s||o&&(M||!o.began)||t.onBegin(t)):w<=0&&(t.began=!1),s||_||!k||t._currentIteration===p||t.onLoop(t),D||1===n&&(e>=b&&e<=x||e<=b&&S>b||e>=x&&S!==a)||F>=x&&S!==a||F<=b&&S>0||e<=S&&S===a&&h||C&&!h&&N){if(k&&(t.computeDeltaTime(S),s||t.onBeforeUpdate(t)),!_){const e=D||(M?-1*E:E)>=A.tickThreshold,n=t._offset+(o?o._offset:0)+b+F;let a,h,d,c,u=t._head,p=0;for(;u;){const t=u._composition,s=u._currentTime,o=u._changeDuration,f=u._absoluteStartTime+u._changeDuration,g=u._nextRep,v=u._prevRep,_=t!==r.none;if((e||(s!==o||n<=f+(g?g._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!_||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!g||g._isOverridden||n<=g._absoluteStartTime)&&(!v||v._isOverridden||n>=v._absoluteStartTime+v._changeDuration+u._delay))){const e=u._currentTime=ut(F-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,m=u._valueType,f=u._tweenType,g=0===f,y=0===m,v=y&&g||0===s||1===s?-1:A.precision;let b,T;if(y)b=T=n(mt(gt(u._fromNumber,u._toNumber,s),v));else if(1===m)T=n(mt(gt(u._fromNumber,u._toNumber,s),v)),b=`${T}${u._unit}`;else if(2===m){const t=u._fromNumbers,e=u._toNumbers,i=mt(ut(n(gt(t[0],e[0],s)),0,255),0),r=mt(ut(n(gt(t[1],e[1],s)),0,255),0),o=mt(ut(n(gt(t[2],e[2],s)),0,255),0),a=ut(n(mt(gt(t[3],e[3],s),v)),0,1);if(b=`rgba(${i},${r},${o},${a})`,_){const t=u._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=a}}else if(3===m){b=u._strings[0];for(let t=0,e=u._toNumbers.length;t<e;t++){const e=n(mt(gt(u._fromNumbers[t],u._toNumbers[t],s),v)),i=u._strings[t+1];b+=`${i?e+i:e}`,_&&(u._numbers[t]=e)}}if(_&&(u._number=T),i||t===r.blend)u._value=b;else{const t=u.property;a=u.target,g?a[t]=b:1===f?a.setAttribute(t,b):(h=a.style,3===f?(a!==d&&(d=a,c=a[l]),c[t]=b,p=1):2===f?h[t]=b:4===f&&h.setProperty(t,b)),k&&(R=1)}}if(p&&u._renderTransforms){let t=m;for(let e in c)t+=`${y[e]}${c[e]}) `;h.transform=t,p=0}u=u._next}!s&&R&&t.onRender(t)}!s&&k&&t.onUpdate(t)}return o&&N?!s&&(o.began&&!M&&w>0&&!h||M&&w<=c&&h)&&(t.onComplete(t),t.completed=!M):k&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,h||_||(t.completed=!0,s||o&&(M||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,R},Bt=(t,e,s,i,r)=>{const n=t._currentIteration;if(Rt(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,l=i?e:o._iterationTime,h=M();let d=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;Tt(o,e=>{if(a){const i=e.duration,r=e._offset+e._delay;s||!(i<=c)||r&&r+i!==t||e.onComplete(e)}else!e.completed&&!e.backwards&&e._currentTime<e.iterationDuration&&Rt(e,t,s,1,2),e.began=!1,e.completed=!1}),s||o.onLoop(o)}Tt(o,t=>{const e=mt((l-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(h):r;d+=Rt(t,e,s,i,n),!t.completed&&u&&(u=!1)},a),!s&&d&&o.onRender(o),(u||a)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},Pt={},Ft=(t,e,s)=>{if(3===s)return f.get(t)||t;if(2===s||1===s&&U(e)&&t in e.style){const e=Pt[t];if(e)return e;{const e=t?P(t):t;return Pt[t]=e,e}}return t},Mt=t=>{if(t._hasChildren)Tt(t,Mt,!0);else{const e=t;e.pause(),Tt(e,t=>{const s=t.property,i=t.target;if(i[o]){const r=i.style,n=t._inlineValue,o=W(n)||n===m;if(3===t._tweenType){const e=i[l];if(o?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=m;for(let s in e)t+=y[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else o?r.removeProperty(P(s)):r[s]=n;e._tail===t&&e.targets.forEach(t=>{t.getAttribute&&t.getAttribute("style")===m&&t.removeAttribute("style")})}})}return t};class Vt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._lastTickTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=p/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(t){const e=this._frameDuration,s=+t,i=s<c?c:s,r=p/i;i>I.frameRate&&(I.frameRate=i),this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<c?c:e}requestTick(t){const e=this._scheduledTime;if(this._lastTickTime=t,t<e)return 0;const s=this._frameDuration,i=t-e;return this._scheduledTime+=i<s?s:i,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const Ot={animation:null,update:v},zt=(()=>e?requestAnimationFrame:setImmediate)(),Ht=(()=>e?cancelAnimationFrame:clearImmediate)();class Xt extends Vt{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=I,this.paused=!0,this.reqId=0}update(){const t=this._currentTime=M();if(this.requestTick(t)){this.computeDeltaTime(t);const e=this._speed,s=this._fps;let i=this._head;for(;i;){const r=i._next;i.paused?(xt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):Bt(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}Ot.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(M()),this.reqId=zt(Wt)),this}pause(){if(this.reqId)return this.paused=!0,Ut()}resume(){if(this.paused)return this.paused=!1,Tt(this,t=>t.resetTime()),this.wake()}get speed(){return this._speed*(1===A.timeScale?1:p)}set speed(t){this._speed=t*A.timeScale,Tt(this,t=>t.speed=t._speed)}get timeUnit(){return 1===A.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(A.timeScale!==s){A.timeScale=s,A.tickThreshold=200*s;const t=e?.001:p;this.defaults.duration*=t,this._speed*=t}}get precision(){return A.precision}set precision(t){A.precision=t}}const Yt=(()=>{const t=new Xt(M());return e&&(B.engine=t,i.addEventListener("visibilitychange",()=>{t.pauseOnDocumentHidden&&(i.hidden?t.pause():t.resume())})),t})(),Wt=()=>{Yt._head?(Yt.reqId=zt(Wt),Yt.update()):Yt.reqId=0},Ut=()=>(Ht(Yt.reqId),Yt.reqId=0,Yt),qt={_rep:new WeakMap,_add:new Map},jt=(t,e,s="_rep")=>{const i=qt[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},Gt=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,Qt=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=c,t._currentTime=c},Zt=(t,e)=>{const s=t._composition;if(s===r.replace){const s=t._absoluteStartTime;wt(e,t,Gt,"_prevRep","_nextRep");const i=t._prevRep;if(i){const e=i.parent,r=i._absoluteStartTime+i._changeDuration;if(t.parent.id!==e.id&&e.iterationCount>1&&r+(e.duration-e.iterationDuration)>s){Qt(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)Qt(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration),s=mt(n-e-t,12);i._changeDuration=s,i._currentTime=s,i._isOverlapped=1,s<c&&Qt(i)}let o=!0;if(Tt(e,t=>{t._isOverlapped||(o=!1)}),o){const t=e.parent;if(t){let s=!0;Tt(t,t=>{t!==e&&Tt(t,t=>{t._isOverlapped||(s=!1)})}),s&&t.cancel()}else e.cancel()}}}else if(s===r.blend){const e=jt(t.target,t.property,"_add"),s=(t=>{let e=Ot.animation;return e||(e={duration:c,computeDeltaTime:v,_offset:0,_delay:0,_head:null,_tail:null},Ot.animation=e,Ot.update=()=>{t.forEach(t=>{for(let e in t){const s=t[e],i=s._head;if(i){const t=i._valueType,e=3===t||2===t?_t(i._fromNumbers):null;let r=i._fromNumber,n=s._tail;for(;n&&n!==i;){if(e)for(let t=0,s=n._numbers.length;t<s;t++)e[t]+=n._numbers[t];else r+=n._number;n=n._prevAdd}i._toNumber=r,i._toNumbers=e}}}),Rt(e,1,1,0,2)}),e})(qt._add);let i=e._head;i||(i={...t},i._composition=r.replace,i._updateDuration=c,i._startTime=0,i._numbers=_t(t._fromNumbers),i._number=0,i._next=null,i._prev=null,wt(e,i),wt(s,i));const n=t._toNumber;if(t._fromNumber=i._fromNumber-n,t._toNumber=0,t._numbers=_t(t._fromNumbers),t._number=0,i._fromNumber=n,t._toNumbers){const e=_t(t._toNumbers);e&&e.forEach((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0}),i._fromNumbers=e}wt(e,t,null,"_prevAdd","_nextAdd")}return t},Jt=t=>{const e=t._composition;if(e!==r.none){const s=t.target,i=t.property,n=qt._rep.get(s)[i];if(xt(n,t,"_prevRep","_nextRep"),e===r.blend){const e=qt._add,r=e.get(s);if(!r)return;const n=r[i],o=Ot.animation;xt(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){xt(n,a,"_prevAdd","_nextAdd"),xt(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},Kt=(t,e,s)=>{let i=!1;return Tt(e,r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,a=Ft(s,n,o);(!a||a&&a===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),xt(e,r),Jt(r),i=!0)}},!0),i},te=(t,e,s)=>{const i=e||Yt;let r;if(i._hasChildren){let e=0;Tt(i,n=>{if(!n._hasChildren)if(r=Kt(t,n,s),r&&!n._head)n.cancel(),xt(i,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?te(t,n,s):n._hasChildren=!1},!0),Y(i.iterationDuration)||(i.iterationDuration=e)}else r=Kt(t,i,s);r&&!i._head&&(i._hasChildren=!1,i.cancel&&i.cancel())},ee=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),se=t=>t._cancelled?(t._hasChildren?Tt(t,se):Tt(t,t=>{t._composition!==r.none&&Zt(t,jt(t.target,t.property))}),t._cancelled=0,t):t;let ie=0;class re extends Vt{constructor(t={},e=null,s=0){super(0),++ie;const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:l,loopDelay:h,autoplay:d,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:_,onUpdate:b}=t;L.current&&L.current.register(this);const T=e?0:Yt._lastTickTime,x=e?e.defaults:A.defaults,w=X(r)||Y(r)?x.delay:+r,S=X(n)||Y(n)?1/0:+n,$=$t(l,x.loop),E=$t(h,x.loopDelay);let k=!0===$||$===1/0||$<0?1/0:$+1;if(R){const s=k===1/0;if(R.register(this,t,s)&&s){const t=a?2:1,s=e?R.maxNestedInfiniteLoops:R.maxInfiniteLoops;k=Math.max(s,t)}}let C=0;e?C=s:(Yt.reqId||Yt.requestTick(M()),C=(Yt._lastTickTime-Yt._startTime)*A.timeScale),this.id=Y(i)?ie:i,this.parent=e,this.duration=yt((S+E)*k-E)||c,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||x.onBegin,this.onBeforeUpdate=_||x.onBeforeUpdate,this.onUpdate=b||x.onUpdate,this.onLoop=f||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=S,this.iterationCount=k,this._autoplay=!e&&$t(d,x.autoplay),this._offset=C,this._delay=w,this._loopDelay=E,this._iterationTime=0,this._currentIteration=0,this._resolve=v,this._running=!1,this._reversed=+$t(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=$t(a,x.alternate),this._prev=null,this._next=null,this._lastTickTime=T,this._startTime=T,this._lastTime=T,this._fps=$t(u,x.frameRate),this._speed=$t(p,x.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(!0).play()}get currentTime(){return ut(mt(this._currentTime,A.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return ut(mt(this._iterationTime,A.precision),0,this.iterationDuration)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return ut(mt(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return ut(mt(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(t){const e=this.iterationDuration;this.currentTime=e*this._currentIteration+e*t}get currentIteration(){return this._currentIteration}set currentIteration(t){this.currentTime=this.iterationDuration*ut(+t,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(t){t?this.reverse():this.play()}get speed(){return super.speed}set speed(t){super.speed=t,this.resetTime()}reset(t=!1){return se(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,Bt(this,0,1,~~t,2),ee(this),this._hasChildren&&Tt(this,ee),this}init(t=!1){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&Bt(this,this.duration,1,~~t,2),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!Y(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*Yt._speed);return this._startTime=M()-(this._currentTime+this._delay)*t,this}pause(){return this.paused||(this.paused=!0,this.onPause(this)),this}resume(){return this.paused?(this.paused=!1,this.duration<=c&&!this._hasChildren?Bt(this,c,0,0,2):(this._running||(wt(Yt,this),Yt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,Yt.wake()),this):this}restart(){return this.reset().resume()}seek(t,e=0,s=0){se(this),this.completed=!1;const i=this.paused;return this.paused=!0,Bt(this,t+this._delay,~~e,~~s,1),i?this:this.resume()}alternate(){const t=this._reversed,e=this.iterationCount,s=this.iterationDuration,i=e===1/0?ot(u/s):e;return this._reversed=+(!this._alternate||i%2?!t:t),e===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(s*i-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?Tt(this,t=>t.cancel(),!0):Tt(this,Jt),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=vt(t);if(e===s)return this;const i=t/e,r=t<=c;return this.duration=r?c:s,this.iterationDuration=r?c:vt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){Bt(this,0,1,0,1);const t=this._autoplay;return t&&t.linked&&t.linked===this&&t.revert(),this.cancel()}complete(t=0){return this.seek(this.duration,t).cancel()}then(t=v){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=v};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}function ne(t){const e=H(t)?L.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function oe(t){if(W(t))return[];if(!e)return V(t)&&t.flat(1/0)||[t];if(V(t)){const e=t.flat(1/0),s=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!W(i)){const t=ne(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!W(i)){let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}else{let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}}return s}const s=ne(t);return s?Array.from(s):[t]}function ae(t){const e=oe(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[n]){s[n]=!0;const t=U(s);(s.nodeType||t)&&(s[o]=!0,s[a]=t,s[l]={})}}return e}const le={deg:1,rad:180/dt,turn:360},he={},de=(t,e,s,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===s)return e;const a=o+n+s,l=he[a];if(Y(l)||r){let r;if(n in le)r=o*le[n]/le[s];else{const e=100,a=t.cloneNode(),l=t.parentNode,h=l&&l!==i?l:i.body;h.appendChild(a);const d=a.style;d.width=e+n;const c=a.offsetWidth||e;d.width=e+s;const u=c/(a.offsetWidth||e);h.removeChild(a),r=u*o}e.n=r,he[a]=r}else e.n=l;return e.t,e.u=s,e},ce=t=>t,ue=(t=1.68)=>e=>K(e,+t),pe={in:t=>e=>t(e),out:t=>e=>1-t(1-e),inOut:t=>e=>e<.5?t(2*e)/2:1-t(-2*e+2)/2,outIn:t=>e=>e<.5?(1-t(1-2*e))/2:(t(2*e-1)+1)/2},me=dt/2,fe=2*dt,ge={[m]:ue,Quad:ue(2),Cubic:ue(3),Quart:ue(4),Quint:ue(5),Sine:t=>1-st(t*me),Circ:t=>1-tt(1-t*t),Expo:t=>t?K(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=K(2,--s))-1)/11;);return 1/K(4,3-s)-7.5625*K((3*e-2)/22-t,2)},Back:(t=1.7)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=ut(+t,1,10),i=ut(+e,c,2),r=i/fe*at(1/s),n=fe/i;return t=>0===t||1===t?t:-s*K(2,-10*(1-t))*et((1-t-r)*n)}},ye=(()=>{const t={linear:ce,none:ce};for(let e in pe)for(let s in ge){const i=ge[s],r=pe[e];t[e+s]=s===m||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),ve={linear:ce,none:ce},_e=t=>{if(ve[t])return ve[t];if(t.indexOf("(")<=-1){const e=pe[t]||t.includes("Back")||t.includes("Elastic")?ye[t]():ye[t];return e?ve[t]=e:ce}{const e=t.slice(0,-1).split("("),s=ye[e[0]];return s?ve[t]=s(...e[1].split(",")):ce}},be=["steps(","irregular(","linear(","cubicBezier("],Te=t=>{if(H(t))for(let e=0,s=be.length;e<s;e++)if(F(t,be[e]))return console.warn(`String syntax for \`ease: "${t}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${t}\``),ce;return X(t)?t:H(t)?_e(t):ce},xe={t:0,n:0,u:null,o:null,d:null,s:null},we={t:0,n:0,u:null,o:null,d:null,s:null},Se={},$e={func:null},Ee={func:null},ke=[null],Ce=[null,null],Ne={to:null};let De,Ie,Le=0,Ae=0;class Re extends re{constructor(t,e,s,i,n=!1,o=0,a=0){super(e,s,i),++Ae;const l=ae(t),h=l.length,d=e.keyframes,u=d?bt(((t,e)=>{const s={};if(V(t)){const e=[].concat(...t.map(t=>Object.keys(t))).filter(Q);for(let i=0,r=e.length;i<r;i++){const r=e[i],n=t.map(t=>{const e={};for(let s in t){const i=t[s];Q(s)?s===r&&(e.to=i):e[s]=i}return e});s[r]=n}}else{const i=$t(e.duration,A.defaults.duration),r=Object.keys(t).map(e=>({o:parseFloat(e)/100,p:t[e]})).sort((t,e)=>t.o-e.o);r.forEach(t=>{const e=t.o,r=t.p;for(let t in r)if(Q(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let a=n.length,l=n[a-1];const h={to:r[t]};let d=0;for(let t=0;t<a;t++)d+=n[t].duration;1===a&&(h.from=l.to),r.ease&&(h.ease=r.ease),h.duration=o-(a?d:0),n.push(h)}return t});for(let t in s){const e=s[t];let i;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.ease;s.ease=i||void 0,i=r}e[0].duration||e.shift()}}return s})(d,e),e):e,{id:m,delay:f,duration:g,ease:y,playbackEase:v,modifier:_,composition:b,onRender:T}=u,x=s?s.defaults:A.defaults,w=$t(y,x.ease),S=$t(v,x.playbackEase),$=S?Te(S):null,E=!Y(w.ease),k=E?w.ease:$t(y,$?"linear":x.ease),C=E?w.settlingDuration:$t(g,x.duration),N=$t(f,x.delay),D=_||x.modifier,I=Y(b)&&h>=p?r.none:Y(b)?x.composition:b,L=this._offset+(s?s._offset:0);E&&(w.parent=this);let R=NaN,B=NaN,P=0,F=0;for(let t=0;t<h;t++){const e=l[t],i=o||t,d=a||h;let p=NaN,m=NaN;for(let t in u)if(Q(t)){const o=kt(e,t),a=Ft(t,e,o);let l=u[t];const h=V(l);if(n&&!h&&(Ce[0]=l,Ce[1]=l,l=Ce),h){const t=l.length,e=!O(l[0]);2===t&&e?(Ne.to=l,ke[0]=Ne,De=ke):t>2&&e?(De=[],l.forEach((t,e)=>{e?1===e?(Ce[1]=t,De.push(Ce)):De.push(t):Ce[0]=t})):De=l}else ke[0]=l,De=ke;let f=null,g=null,y=NaN,v=0,_=0;for(let t=De.length;_<t;_++){const n=De[_];O(n)?Ie=n:(Ne.to=n,Ie=Ne),$e.func=null,Ee.func=null;const l=Et(Ie.to,e,i,d,$e);let h;O(l)&&!Y(l.to)?(Ie=l,h=l.to):h=l;const u=Et(Ie.from,e,i,d),p=Ie.ease||k,m=Et(p,e,i,d),b=X(m)||H(m)?m:p,T=!Y(b)&&!Y(b.ease),x=T?b.ease:b,w=T?b.settlingDuration:Et($t(Ie.duration,t>1?Et(C,e,i,d)/t:C),e,i,d),S=Et($t(Ie.delay,_?0:N),e,i,d),$=Et($t(Ie.composition,I),e,i,d),E=z($)?$:r[$],A=Ie.modifier||D,R=!Y(u),B=!Y(h),M=V(h),U=M||R&&B,q=g?v+S:S,j=mt(L+q,12);F||!R&&!M||(F=1);let G=g;if(E!==r.none){f||(f=jt(e,a));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=j;)if(G=t,t=t._nextRep,t&&t._absoluteStartTime>=j)for(;t;)Qt(t),t=t._nextRep}if(U){It(M?Et(h[0],e,i,d,Ee):u,xe),It(M?Et(h[1],e,i,d,$e):h,we);const t=Nt(e,a,o,Se);0===xe.t&&(G?1===G._valueType&&(xe.t=1,xe.u=G._unit):(It(t,At),1===At.t&&(xe.t=1,xe.u=At.u)))}else B?It(h,we):g?Lt(g,we):It(s&&G&&G.parent.parent===s?G._value:Nt(e,a,o,Se),we),R?It(u,xe):g?Lt(g,xe):It(s&&G&&G.parent.parent===s?G._value:Nt(e,a,o,Se),xe);if(xe.o&&(xe.n=Dt(G?G._toNumber:It(Nt(e,a,o,Se),At).n,xe.n,xe.o)),we.o&&(we.n=Dt(xe.n,we.n,we.o)),xe.t!==we.t)if(3===xe.t||3===we.t){const t=3===xe.t?xe:we,e=3===xe.t?we:xe;e.t=3,e.s=_t(t.s),e.d=t.d.map(()=>e.n)}else if(1===xe.t||1===we.t){const t=1===xe.t?xe:we,e=1===xe.t?we:xe;e.t=1,e.u=t.u}else if(2===xe.t||2===we.t){const t=2===xe.t?xe:we,e=2===xe.t?we:xe;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(xe.u!==we.u){let t=we.u?xe:we;t=de(e,t,we.u?we.u:xe.u,!1)}if(we.d&&xe.d&&we.d.length!==xe.d.length){const t=xe.d.length>we.d.length?xe:we,e=t===xe?we:xe;e.d=t.d.map((t,s)=>Y(e.d[s])?0:e.d[s]),e.s=_t(t.s)}const Q=mt(+w||c,12);let Z=Se[a];W(Z)||(Se[a]=null);const J={parent:this,id:Le++,property:a,target:e,_value:null,_toFunc:$e.func,_fromFunc:Ee.func,_ease:Te(x),_fromNumbers:_t(xe.d),_toNumbers:_t(we.d),_strings:_t(we.s),_fromNumber:xe.n,_toNumber:we.n,_numbers:_t(xe.d),_number:xe.n,_unit:we.u,_modifier:A,_currentTime:0,_startTime:q,_delay:+S,_updateDuration:Q,_changeDuration:Q,_absoluteStartTime:j,_tweenType:o,_valueType:we.t,_composition:E,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:Z,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};E!==r.none&&Zt(J,f),isNaN(y)&&(y=J._startTime),v=mt(q+Q,12),g=J,P++,wt(this,J)}(isNaN(B)||y<B)&&(B=y),(isNaN(R)||v>R)&&(R=v),3===o&&(p=P-_,m=P)}if(!isNaN(p)){let t=0;Tt(this,e=>{t>=p&&t<m&&(e._renderTransforms=1,e._composition===r.blend&&Tt(Ot.animation,t=>{t.id===e.id&&(t._renderTransforms=1)})),t++})}}h||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),B?(Tt(this,t=>{t._startTime-t._delay||(t._delay-=B),t._startTime-=B}),R-=B):B=0,R||(R=c,this.iterationCount=0),this.targets=l,this.id=Y(m)?Ae:m,this.duration=R===c?c:yt((R+this._loopDelay)*this.iterationCount-this._loopDelay)||c,this.onRender=T||x.onRender,this._ease=$,this._delay=B,this.iterationDuration=R,!this._autoplay&&F&&this.onRender(this)}stretch(t){const e=this.duration;if(e===vt(t))return this;const s=t/e;return Tt(this,t=>{t._updateDuration=vt(t._updateDuration*s),t._changeDuration=vt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s}),super.stretch(t)}refresh(){return Tt(this,t=>{const e=t._toFunc,s=t._fromFunc;(e||s)&&(s?(It(s(),xe),xe.u!==t._unit&&t.target[o]&&de(t.target,xe,t._unit,!0),t._fromNumbers=_t(xe.d),t._fromNumber=xe.n):e&&(It(Nt(t.target,t.property,t._tweenType),At),t._fromNumbers=_t(At.d),t._fromNumber=At.n),e&&(It(e(),we),t._toNumbers=_t(we.d),t._strings=_t(we.s),t._toNumber=we.o?Dt(t._fromNumber,we.n,we.o):we.n))}),this.duration===c&&this.restart(),this}revert(){return super.revert(),Mt(this)}then(t){return super.then(t)}}const Be={_head:null,_tail:null},Pe=(t,e,s)=>{let i,r=Be._head;for(;r;){const n=r._next,o=r.$el===t,a=!e||r.property===e,l=!s||r.parent===s;if(o&&a&&l){i=r.animation;try{i.commitStyles()}catch{}i.cancel(),xt(Be,r);const t=r.parent;t&&(t._completed++,t.animations.length===t._completed&&(t.completed=!0,t.paused=!0,t.muteCallbacks||(t.onComplete(t),t._resolve(t))))}r=n}return i},Fe=(t,e,s,i,r)=>{const n=e.animate(i,r),o=r.delay+ +r.duration*r.iterations;n.playbackRate=t._speed,t.paused&&n.pause(),t.duration<o&&(t.duration=o,t.controlAnimation=n),t.animations.push(n),Pe(e,s),wt(Be,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>Pe(e,s,t);return n.oncancel=a,n.onremove=a,t.persist||(n.onfinish=a),n};function Me(t,e,s){const i=ae(t);if(!i.length)return;const[r]=i,n=kt(r,e),o=Ft(e,r,n);let a=Nt(r,o);if(Y(s))return a;if(It(a,At),0===At.t||1===At.t){if(!1===s)return At.n;{const t=de(r,At,s,!1);return`${mt(t.n,A.precision)}${t.u}`}}}const Ve=(t,e)=>{if(!Y(e))return e.duration=c,e.composition=$t(e.composition,r.none),new Re(t,e,null,0,!0).resume()},Oe=(t,e,s)=>{const i=oe(t);for(let t=0,r=i.length;t<r;t++)Pe(i[t],s,e&&e.controlAnimation&&e);return te(i,e,s),i},ze=(t,e)=>{let s=t.iterationDuration;if(s===c&&(s=0),Y(e))return s;if(z(+e))return+e;const i=e,r=t?t.labels:null,n=!W(r),o=((t,e)=>{if(F(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),a=!Y(o),l=N.exec(i);if(l){const t=l[0],e=i.split(t),h=n&&e[0]?r[e[0]]:s,d=a?o:n?h:s,c=+e[1];return Dt(d,c,t[0])}return a?o:n?Y(r[i])?s:r[i]:s};function He(t,e,s,i,r,n){const o=z(t.duration)&&t.duration<=c?s-c:s;e.composition&&Bt(e,o,1,1,1);const a=i?new Re(i,t,e,o,!1,r,n):new re(t,e,o);return e.composition&&a.init(!0),wt(e,a),Tt(e,t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)}),e.duration=function(t){return yt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||c}(e),e}let Xe=0;class Ye extends re{constructor(t={}){super(t,null,0),++Xe,this.id=Y(t.id)?Xe:t.id,this.duration=0,this.labels={};const e=t.defaults,s=A.defaults;this.defaults=e?bt(e,s):s,this.composition=$t(t.composition,!0),this.onRender=t.onRender||s.onRender;const i=$t(t.playbackEase,s.playbackEase);this._ease=i?Te(i):null,this.iterationDuration=0}add(t,e,s){const i=O(e),r=O(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(X(s)){const e=s,r=oe(t),n=this.duration,o=this.iterationDuration,a=i.id;let l=0;const h=r.length;r.forEach(t=>{const s={...i};this.duration=n,this.iterationDuration=o,Y(a)||(s.id=a+"-"+l),He(s,this,ze(this,e(t,l,h,this)),t,l,h),l++})}else He(i,this,ze(this,s),t)}else He(t,this,ze(this,e));return this.composition&&this.init(!0),this}}sync(t,e){if(Y(t)||t&&Y(t.pause))return this;t.pause();const s=+(t.effect?t.effect.getTiming().duration:t.duration);return Y(t)||Y(t.persist)||(t.persist=!0),this.add(t,{currentTime:[0,s],duration:s,delay:0,ease:"linear",playbackEase:"linear"},e)}set(t,e,s){return Y(e)?this:(e.duration=c,e.composition=r.replace,this.add(t,e,s))}call(t,e){return Y(t)||t&&!X(t)?this:this.add({duration:0,delay:0,onComplete:()=>t(this)},e)}label(t,e){return Y(t)||t&&!H(t)||(this.labels[t]=ze(this,e)),this}remove(t,e){return te(oe(t),this,e),this}stretch(t){const e=this.duration;if(e===vt(t))return this;const s=t/e,i=this.labels;Tt(this,t=>t.stretch(t.duration*s));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return Tt(this,t=>{t.refresh&&t.refresh()}),this}revert(){return super.revert(),Tt(this,t=>t.revert,!0),Mt(this)}then(t){return super.then(t)}}const We=t=>new Ye(t).init();class Ue{constructor(t,e){L.current&&L.current.register(this);const s=()=>{if(this.callbacks.completed)return;let t=!0;for(let e in this.animations)if(!this.animations[e].paused&&t){t=!1;break}t&&this.callbacks.complete()},i={onBegin:()=>{this.callbacks.completed&&this.callbacks.reset(),this.callbacks.play()},onComplete:s,onPause:s},n={v:1,autoplay:!1},o={};if(this.targets=[],this.animations={},this.callbacks=null,!Y(t)&&!Y(e)){for(let t in e){const s=e[t];Q(t)?o[t]=s:F(t,"on")?n[t]=s:i[t]=s}this.callbacks=new Re({v:0},n);for(let e in o){const s=o[e],n=O(s);let a={},l="+=0";if(n){const t=s.unit;H(t)&&(l+=t)}else a.duration=s;a[e]=n?bt({to:l},s):l;const h=bt(i,a);h.composition=r.replace,h.autoplay=!1;const d=this.animations[e]=new Re(t,h,null,0,!1).init();this.targets.length||this.targets.push(...d.targets),this[e]=(t,e,s)=>{const i=d._head;if(Y(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return Tt(d,e=>{if(V(t))for(let s=0,i=t.length;s<i;s++)Y(e._numbers[s])||(e._fromNumbers[s]=e._modifier(e._numbers[s]),e._toNumbers[s]=t[s]);else e._fromNumber=e._modifier(e._number),e._toNumber=t;Y(s)||(e._ease=Te(s)),e._currentTime=0}),Y(e)||d.stretch(e),d.reset(!0).resume(),this}}}}revert(){for(let t in this.animations)this[t]=v,this.animations[t].revert();return this.animations={},this.targets.length=0,this.callbacks&&this.callbacks.revert(),this}}const qe=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i);var je=Object.freeze({__proto__:null,clamp:ut,damp:(t,e,s,i)=>i?1===i?e:gt(t,e,1-Math.exp(-i*s*.1)):t,degToRad:t=>t*Math.PI/180,lerp:gt,mapRange:qe,padEnd:(t,e,s)=>`${t}`.padEnd(e,s),padStart:(t,e,s)=>`${t}`.padStart(e,s),radToDeg:t=>180*t/Math.PI,round:mt,roundPad:(t,e)=>(+t).toFixed(e),snap:ft,wrap:(t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e});const Ge=10*p;class Qe{constructor(t={}){const e=!Y(t.bounce)||!Y(t.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/p,this.maxIterations=this.maxDuration/this.timeStep/p,this.bn=ut($t(t.bounce,.5),-1,1),this.pd=ut($t(t.duration,628),10*A.timeScale,Ge*A.timeScale),this.m=ut($t(t.mass,1),1,Ge),this.s=ut($t(t.stiffness,100),c,Ge),this.d=ut($t(t.damping,10),c,Ge),this.v=ut($t(t.velocity,0),-1e4,Ge),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=t.onComplete||v,e&&this.calculateSDFromBD(),this.compute(),this.ease=t=>{const e=t*this.settlingDuration,s=this.completed,i=this.pd;return e>=i&&!s&&(this.completed=!0,this.onComplete(this.parent)),e<i&&s&&(this.completed=!1),0===t||1===t?t:this.solve(t*this.solverDuration)}}solve(t){const{zeta:e,w0:s,wd:i,b:r}=this;let n=t;return n=e<1?rt(-n*e*s)*(1*st(i*n)+r*et(i*n)):1===e?(1+r*n)*rt(-n*s):((1+r)*rt((-e*s+i)*n)+(1-r)*rt((-e*s-i)*n))/2,1-n}calculateSDFromBD(){const t=1===A.timeScale?this.pd/p:this.pd;this.m=1,this.v=0,this.s=K(2*dt/t,2),this.bn>=0?this.d=4*(1-this.bn)*dt/t:this.d=4*dt/(t*(1+this.bn)),this.s=mt(ut(this.s,c,Ge),3),this.d=mt(ut(this.d,c,300),3)}calculateBDFromSD(){const t=2*dt/tt(this.s);this.pd=t*(1===A.timeScale?p:1);const e=this.d/(2*tt(this.s));this.bn=e<=1?1-this.d*t/(4*dt):4*dt/(this.d*t)-1,this.bn=mt(ut(this.bn,-1,1),3),this.pd=mt(ut(this.pd,10*A.timeScale,Ge*A.timeScale),3)}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,l=this.w0=ut(tt(o/r),c,p),h=this.zeta=n/(2*tt(o*r));h<1?(this.wd=l*tt(1-h*h),this.b=(h*l-a)/this.wd):1===h?(this.wd=0,this.b=-a+l):(this.wd=l*tt(h*h-1),this.b=(h*l-a)/this.wd);let d=0,u=0,m=0;for(;u<=t&&m<=e;)it(1-this.solve(d))<s?u++:u=0,this.solverDuration=d,d+=i,m++;this.settlingDuration=mt(this.solverDuration*p,0)*A.timeScale}get bounce(){return this.bn}set bounce(t){this.bn=ut($t(t,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(t){this.pd=ut($t(t,1),10*A.timeScale,Ge*A.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=ut($t(t,100),c,Ge),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(t){this.d=ut($t(t,10),c,Ge),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(t){this.m=ut($t(t,1),1,Ge),this.compute()}get velocity(){return this.v}set velocity(t){this.v=ut($t(t,0),-1e4,Ge),this.compute()}}const Ze=t=>new Qe(t),Je=t=>(console.warn("createSpring() is deprecated use spring() instead"),new Qe(t)),Ke=t=>{t.cancelable&&t.preventDefault()};class ts{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:v,remove:v}}get x(){return this.el.x||0}set x(t){this.el.x=t}get y(){return this.el.y||0}set y(t){this.el.y=t}get width(){return this.el.width||0}set width(t){this.el.width=t}get height(){return this.el.height||0}set height(t){this.el.height=t}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class es{constructor(t){this.$el=t,this.inlineTransforms=[],this.point=new DOMPoint,this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(t,e){return this.point.x=t,this.point.y=e,this.point.matrixTransform(this.inversedMatrix)}traverseUp(t){let e=this.$el.parentElement,s=0;for(;e&&e!==i;)t(e,s),e=e.parentElement,s++}getMatrix(){const t=new DOMMatrix;return this.traverseUp(e=>{const s=getComputedStyle(e).transform;if(s){const e=new DOMMatrix(s);t.preMultiplySelf(e)}}),t}remove(){this.traverseUp((t,e)=>{this.inlineTransforms[e]=t.style.transform,t.style.transform="none"})}revert(){this.traverseUp((t,e)=>{const s=this.inlineTransforms[e];""===s?t.style.removeProperty("transform"):t.style.transform=s})}}const ss=(t,e)=>t&&X(t)?t(e):t;let is=0;class rs{constructor(t,e={}){if(!t)return;L.current&&L.current.register(this);const r=e.x,n=e.y,o=e.trigger,a=e.modifier,l=e.releaseEase,h=l&&Te(l),d=!Y(l)&&!Y(l.ease),c=O(r)&&!Y(r.mapTo)?r.mapTo:"translateX",p=O(n)&&!Y(n.mapTo)?n.mapTo:"translateY",m=ss(e.container,this);this.containerArray=V(m)?m:null,this.$container=m&&!this.containerArray?oe(m)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.$target=O(t)?new ts(t):oe(t)[0],this.$trigger=oe(o||t)[0],this.fixed="fixed"===Me(this.$target,"position"),this.isFinePointer=!0,this.containerPadding=[0,0,0,0],this.containerFriction=0,this.releaseContainerFriction=0,this.snapX=0,this.snapY=0,this.scrollSpeed=0,this.scrollThreshold=0,this.dragSpeed=0,this.dragThreshold=3,this.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=d?l:Ze({mass:$t(e.releaseMass,1),stiffness:$t(e.releaseStiffness,80),damping:$t(e.releaseDamping,20)}),this.releaseYSpring=d?l:Ze({mass:$t(e.releaseMass,1),stiffness:$t(e.releaseStiffness,80),damping:$t(e.releaseDamping,20)}),this.releaseEase=h||ye.outQuint,this.hasReleaseSpring=d,this.onGrab=e.onGrab||v,this.onDrag=e.onDrag||v,this.onRelease=e.onRelease||v,this.onUpdate=e.onUpdate||v,this.onSettle=e.onSettle||v,this.onSnap=e.onSnap||v,this.onResize=e.onResize||v,this.onAfterResize=e.onAfterResize||v,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),Y(r)||!0===r)f[c]=0;else if(O(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[c]=e}else!1===r&&(f[c]=0,this.disabled[0]=1);if(Y(n)||!0===n)f[p]=0;else if(O(n)){const t=n,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[p]=e}else!1===n&&(f[p]=0,this.disabled[1]=1);this.animate=new Ue(this.$target,f),this.xProp=c,this.yProp=p,this.destX=0,this.destY=0,this.deltaX=0,this.deltaY=0,this.scroll={x:0,y:0},this.coords=[this.x,this.y,0,0],this.snapped=[0,0],this.pointer=[0,0,0,0,0,0,0,0],this.scrollView=[0,0],this.dragArea=[0,0,0,0],this.containerBounds=[-u,u,u,-u],this.scrollBounds=[0,0,0,0],this.targetBounds=[0,0,0,0],this.window=[0,0],this.velocityStack=[0,0,0],this.velocityStackIndex=0,this.velocityTime=M(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new es(this.$target),this.overshootCoords={x:0,y:0},this.overshootTicker=new re({autoplay:!1,onUpdate:()=>{this.updated=!0,this.manual=!0,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,1),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,1)},onComplete:()=>{this.manual=!1,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,0),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,0)}},null,0).init(),this.updateTicker=new re({autoplay:!1,onUpdate:()=>this.update()},null,0).init(),this.contained=!Y(m),this.manual=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.enabled=!1,this.initialized=!1,this.activeProp=this.disabled[1]?c:p,this.animate.callbacks.onRender=()=>{const t=this.updated,e=!(this.grabbed&&t)&&this.released,s=this.x,i=this.y,r=s-this.coords[2],n=i-this.coords[3];this.deltaX=r,this.deltaY=n,this.coords[2]=s,this.coords[3]=i,t&&(r||n)&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=ht(n,r)):this.updated=!1},this.animate.callbacks.onComplete=()=>{!this.grabbed&&this.released&&(this.released=!1),this.manual||(this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.onSettle(this))},this.resizeTicker=new re({autoplay:!1,duration:150*A.timeScale,onComplete:()=>{this.onResize(this),this.refresh(),this.onAfterResize(this)}}).init(),this.parameters=e,this.resizeObserver=new ResizeObserver(()=>{this.initialized?this.resizeTicker.restart():this.initialized=!0}),this.enable(),this.refresh(),this.resizeObserver.observe(this.$container),O(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=M(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,a=this.minVelocity,l=this.maxVelocity,h=this.velocityStackIndex;n[h]=mt(ut(tt(t*t+e*e)/r*o,a,l),5);const d=lt(n[0],n[1],n[2]);return this.velocity=d,this.velocityStackIndex=(h+1)%3,d}setX(t,e=!1){if(this.disabled[0])return;const s=mt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=ft(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=mt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=ft(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return mt(this.animate[this.xProp](),A.precision)}set x(t){this.setX(t,!1)}get y(){return mt(this.animate[this.yProp](),A.precision)}set y(t){this.setY(t,!1)}get progressX(){return qe(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(qe(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return qe(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(qe(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=mt(this.useWin?s.scrollX:this.$container.scrollLeft,0),e=mt(this.useWin?s.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,a=this.scrollThreshold;this.scroll.x=t,this.scroll.y=e,this.scrollBounds[0]=e-this.targetBounds[0]+i-a,this.scrollBounds[1]=t-this.targetBounds[1]-r+a,this.scrollBounds[2]=e-this.targetBounds[2]-n+a,this.scrollBounds[3]=t-this.targetBounds[3]+o-a}updateBoundingValues(){const t=this.$container;if(!t)return;const e=this.x,r=this.y,n=this.coords[2],o=this.coords[3];this.coords[2]=0,this.coords[3]=0,this.setX(0,!0),this.setY(0,!0),this.transforms.remove();const a=this.window[0]=s.innerWidth,l=this.window[1]=s.innerHeight,h=this.useWin,d=t.scrollWidth,c=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,y]=this.containerPadding;this.dragArea[0]=h?0:p.left,this.dragArea[1]=h?0:p.top,this.scrollView[0]=h?ut(d,a,d):d,this.scrollView[1]=h?ut(c,l,c):c,this.updateScrollCoords();const{width:v,height:_,left:b,top:T,right:x,bottom:w}=t.getBoundingClientRect();this.dragArea[2]=mt(h?ut(v,a,a):v,0),this.dragArea[3]=mt(h?ut(_,l,l):_,0);const S=Me(t,"overflow"),$="visible"===S,E="hidden"===S;if(this.canScroll=!u&&this.contained&&(t===i.body&&$||!E&&!$)&&(d>this.dragArea[2]+y-f||c>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!V(this.containerArray)),this.contained){const e=this.scroll.x,s=this.scroll.y,i=this.canScroll,r=this.$target.getBoundingClientRect(),n=i?h?0:t.scrollLeft:0,o=i?h?0:t.scrollTop:0,d=i?this.scrollView[0]-n-v:0,c=i?this.scrollView[1]-o-_:0;this.targetBounds[0]=mt(r.top+s-(h?0:T),0),this.targetBounds[1]=mt(r.right+e-(h?a:x),0),this.targetBounds[2]=mt(r.bottom+s-(h?l:w),0),this.targetBounds[3]=mt(r.left+e-(h?0:b),0),this.containerArray?(this.containerBounds[0]=this.containerArray[0]+m,this.containerBounds[1]=this.containerArray[1]-f,this.containerBounds[2]=this.containerArray[2]-g,this.containerBounds[3]=this.containerArray[3]+y):(this.containerBounds[0]=-mt(r.top-(u?ut(T,0,l):T)+o-m,0),this.containerBounds[1]=-mt(r.right-(u?ut(x,0,a):x)-d+f,0),this.containerBounds[2]=-mt(r.bottom-(u?ut(w,0,l):w)-c+g,0),this.containerBounds[3]=-mt(r.left-(u?ut(b,0,a):b)+n-y,0))}this.transforms.revert(),this.coords[2]=n,this.coords[3]=o,this.setX(e,!0),this.setY(r,!0)}isOutOfBounds(t,e,s){if(!this.contained)return 0;const[i,r,n,o]=t,[a,l]=this.disabled,h=!a&&e<o||!a&&e>r,d=!l&&s<i||!l&&s>n;return h&&!d?1:!h&&d?2:h&&d?3:0}refresh(){const t=this.parameters,e=t.x,r=t.y,n=ss(t.container,this),o=ss(t.containerPadding,this)||0,a=V(o)?o:[o,o,o,o],l=this.x,h=this.y,d=ss(t.cursor,this),c={onHover:"grab",onGrab:"grabbing"};if(d){const{onHover:t,onGrab:e}=d;t&&(c.onHover=t),e&&(c.onGrab=e)}const u=ss(t.dragThreshold,this),p={mouse:3,touch:7};if(z(u))p.mouse=u,p.touch=u;else if(u){const{mouse:t,touch:e}=u;Y(t)||(p.mouse=t),Y(e)||(p.touch=e)}this.containerArray=V(n)?n:null,this.$container=n&&!this.containerArray?oe(n)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.isFinePointer=matchMedia("(pointer:fine)").matches,this.containerPadding=$t(a,[0,0,0,0]),this.containerFriction=ut($t(ss(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=ut($t(ss(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=ss(O(e)&&!Y(e.snap)?e.snap:t.snap,this),this.snapY=ss(O(r)&&!Y(r.snap)?r.snap:t.snap,this),this.scrollSpeed=$t(ss(t.scrollSpeed,this),1.5),this.scrollThreshold=$t(ss(t.scrollThreshold,this),20),this.dragSpeed=$t(ss(t.dragSpeed,this),1),this.dragThreshold=this.isFinePointer?p.mouse:p.touch,this.minVelocity=$t(ss(t.minVelocity,this),0),this.maxVelocity=$t(ss(t.maxVelocity,this),50),this.velocityMultiplier=$t(ss(t.velocityMultiplier,this),1),this.cursor=!1!==d&&c,this.updateBoundingValues();const[m,f,g,y]=this.containerBounds;this.setX(ut(l,y,f),!0),this.setY(ut(h,m,g),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],a=this.dragArea[3],l=this.scroll.x,h=this.scroll.y,d=this.$container.scrollWidth,c=this.$container.scrollHeight,u=this.useWin?ut(d,this.window[0],d):d,p=this.useWin?ut(c,this.window[1],c):c,m=r-u,f=n-p;this.dragged&&m>0&&(this.coords[0]-=m,this.scrollView[0]=u),this.dragged&&f>0&&(this.coords[1]-=f,this.scrollView[1]=p);const g=10*this.scrollSpeed,y=this.scrollThreshold,[v,_]=this.coords,[b,T,x,w]=this.scrollBounds,S=mt(ut((_-b+t)/y,-1,0)*g,0),$=mt(ut((v-T-e)/y,0,1)*g,0),E=mt(ut((_-x-s)/y,0,1)*g,0),k=mt(ut((v-w+i)/y,-1,0)*g,0);if(S||E||k||$){const[t,e]=this.disabled;let s=l,i=h;t||(s=mt(ut(l+(k||$),0,r-o),0),this.coords[0]-=l-s),e||(i=mt(ut(h+(S||E),0,n-a),0),this.coords[1]-=h-i),this.useWin?this.$scrollContainer.scrollBy(-(l-s),-(h-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,a,l,h]=this.pointer;this.coords[0]+=(r-l)*this.dragSpeed,this.coords[1]+=(n-h)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[d,c]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(d>e?e+(d-e)*m:d<i?i+(d-i)*m:d,!1),this.setY(c>s?s+(c-s)*m:c<t?t+(c-t)*m:c,!1),this.computeVelocity(r-l,n-h),this.angle=ht(n-a,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return te([this],null,"x"),te([this],null,"y"),te([this],null,"progressX"),te([this],null,"progressY"),te([this.scroll]),te([this.overshootCoords]),this}scrollInView(t,e=0,s=ye.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,a=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[l,h,d,c]=o,p=mt(ut(r-l,-u,0),0),m=mt(ut(i-h,0,u),0),f=mt(ut(r-d,0,u),0),g=mt(ut(i-c,-u,0),0);new Re(n,{x:mt(n.x+(g?g-e:m?m+e:0),0),y:mt(n.y+(p?p-e:f?f+e:0),0),duration:Y(t)?350*A.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then(()=>{this.canScroll=a})}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=Ve(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=ye.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,a,l]=this.containerPadding,h=this.scroll.y-this.targetBounds[0]+n+e,d=this.scroll.x-this.targetBounds[1]-o-e,c=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+l+e,p=this.isOutOfBounds([h,d,c,u],i,r);if(p){const[e,n]=this.disabled,o=ut(ft(i,this.snapX),u,d),a=ut(ft(r,this.snapY),h,c),l=Y(t)?350*A.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,l,s),n||2!==p&&3!==p||this.animate[this.yProp](a,l,s)}return this}handleDown(t){const e=t.target;if(this.grabbed||"range"===e.type)return;t.stopPropagation(),this.grabbed=!0,this.released=!1,this.stop(),this.updateBoundingValues();const s=t.changedTouches,r=s?s[0].clientX:t.clientX,n=s?s[0].clientY:t.clientY,{x:o,y:a}=this.transforms.normalizePoint(r,n),[l,h,d,c]=this.containerBounds,u=(1-this.containerFriction)*this.dragSpeed,p=this.x,m=this.y;this.coords[0]=this.coords[2]=u?p>h?h+(p-h)/u:p<c?c+(p-c)/u:p:p,this.coords[1]=this.coords[3]=u?m>d?d+(m-d)/u:m<l?l+(m-l)/u:m:m,this.pointer[0]=o,this.pointer[1]=a,this.pointer[2]=o,this.pointer[3]=a,this.pointer[4]=o,this.pointer[5]=a,this.pointer[6]=o,this.pointer[7]=a,this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null);const f=Me(this.$target,"zIndex",!1);is=(f>is?f:is)+1,this.targetStyles=Ve(this.$target,{zIndex:is}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=Ve(i.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,ye.out(3)),this.onGrab(this),i.addEventListener("touchmove",this),i.addEventListener("touchend",this),i.addEventListener("touchcancel",this),i.addEventListener("mousemove",this),i.addEventListener("mouseup",this),i.addEventListener("selectstart",this)}handleMove(t){if(!this.grabbed)return;const e=t.changedTouches,s=e?e[0].clientX:t.clientX,i=e?e[0].clientY:t.clientY,{x:r,y:n}=this.transforms.normalizePoint(s,i),o=r-this.pointer[6],a=n-this.pointer[7];let l=t.target,h=!1,d=!1,c=!1;for(;e&&l&&l!==this.$trigger;){const t=Me(l,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=l;if(e>s){c=!0,h=t<=3,d=t>=e-s-3;break}}l=l.parentElement}c&&(!h&&!d||h&&a<0||d&&a>0)?(this.pointer[0]=r,this.pointer[1]=n,this.pointer[2]=r,this.pointer[3]=n,this.pointer[4]=r,this.pointer[5]=n,this.pointer[6]=r,this.pointer[7]=n):(Ke(t),this.triggerStyles||(this.triggerStyles=Ve(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",Ke,{passive:!1}),this.$trigger.addEventListener("touchmove",Ke,{passive:!1}),this.$trigger.addEventListener("touchend",Ke),(this.dragged||!this.disabled[0]&&it(o)>this.dragThreshold||!this.disabled[1]&&it(a)>this.dragThreshold)&&(this.updateTicker.resume(),this.pointer[2]=this.pointer[0],this.pointer[3]=this.pointer[1],this.pointer[0]=r,this.pointer[1]=n,this.dragged=!0,this.released=!1,this.onDrag(this)))}handleUp(){if(!this.grabbed)return;this.updateTicker.pause(),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null);const[t,e]=this.disabled,[s,n,o,a,l,h]=this.pointer,[d,c,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,y=this.releaseYSpring,v=this.releaseEase,_=this.hasReleaseSpring,b=this.overshootCoords,T=this.x,x=this.y,w=this.computeVelocity(s-l,n-h),S=this.angle=ht(n-a,s-o),$=150*w,E=(1-this.releaseContainerFriction)*this.dragSpeed,k=T+st(S)*$,C=x+et(S)*$,N=k>c?c+(k-c)*E:k<p?p+(k-p)*E:k,D=C>u?u+(C-u)*E:C<d?d+(C-d)*E:C,I=this.destX=ut(mt(ft(N,this.snapX),5),p,c),L=this.destY=ut(mt(ft(D,this.snapY),5),d,u),R=this.isOutOfBounds(this.containerBounds,k,C);let B=0,P=0,F=v,M=v,V=0;if(b.x=T,b.y=x,!t){const t=I===c?T>c?-1:1:T<p?-1:1,s=mt(T-I,0);g.velocity=e&&_?s?$*t/it(s):0:w;const{ease:i,settlingDuration:r,restDuration:n}=g;B=T===I?0:_?r:r-n*A.timeScale,_&&(F=i),B>V&&(V=B)}if(!e){const e=L===u?x>u?-1:1:x<d?-1:1,s=mt(x-L,0);y.velocity=t&&_?s?$*e/it(s):0:w;const{ease:i,settlingDuration:r,restDuration:n}=y;P=x===L?0:_?r:r-n*A.timeScale,_&&(M=i),P>V&&(V=P)}if(!_&&R&&E&&(B||P)){const t=r.blend;new Re(b,{x:{to:N,duration:.65*B},y:{to:D,duration:.65*P},ease:v,composition:t}).init(),new Re(b,{x:{to:I,duration:B},y:{to:L,duration:P},ease:v,composition:t}).init(),this.overshootTicker.stretch(lt(B,P)).restart()}else t||this.animate[this.xProp](I,B,F),e||this.animate[this.yProp](L,P,M);this.scrollInView(V,this.scrollThreshold,v);let O=!1;I!==m&&(this.snapped[0]=I,this.snapX&&(O=!0)),L!==f&&this.snapY&&(this.snapped[1]=L,this.snapY&&(O=!0)),O&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",Ke),this.$trigger.removeEventListener("touchmove",Ke),this.$trigger.removeEventListener("touchend",Ke),i.removeEventListener("touchmove",this),i.removeEventListener("touchend",this),i.removeEventListener("touchcancel",this),i.removeEventListener("mousemove",this),i.removeEventListener("mouseup",this),i.removeEventListener("selectstart",this)}reset(){return this.stop(),this.resizeTicker.pause(),this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.setX(0,!0),this.setY(0,!0),this.coords[0]=0,this.coords[1]=0,this.pointer[0]=0,this.pointer[1]=0,this.pointer[2]=0,this.pointer[3]=0,this.pointer[4]=0,this.pointer[5]=0,this.pointer[6]=0,this.pointer[7]=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this}enable(){return this.enabled||(this.enabled=!0,this.$target.classList.remove("is-disabled"),this.touchActionStyles=Ve(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"}),this.$trigger.addEventListener("touchstart",this,{passive:!0}),this.$trigger.addEventListener("mousedown",this,{passive:!0}),this.$trigger.addEventListener("mouseenter",this)),this}disable(){return this.enabled=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.touchActionStyles.revert(),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null),this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null),this.$target.classList.add("is-disabled"),this.$trigger.removeEventListener("touchstart",this),this.$trigger.removeEventListener("mousedown",this),this.$trigger.removeEventListener("mouseenter",this),i.removeEventListener("touchmove",this),i.removeEventListener("touchend",this),i.removeEventListener("touchcancel",this),i.removeEventListener("mousemove",this),i.removeEventListener("mouseup",this),i.removeEventListener("selectstart",this),this}revert(){return this.reset(),this.disable(),this.$target.classList.remove("is-disabled"),this.updateTicker.revert(),this.overshootTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),this.resizeObserver.disconnect(),this}handleEvent(t){switch(t.type){case"mousedown":case"touchstart":this.handleDown(t);break;case"mousemove":case"touchmove":this.handleMove(t);break;case"mouseup":case"touchend":case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":Ke(t)}}}const ns=(t=v)=>new re({duration:1*A.timeScale,onComplete:t},null,0).resume(),os=t=>{let e;return(...s)=>{let i,r,n,o;e&&(i=e.currentIteration,r=e.iterationProgress,n=e.reversed,o=e._alternate,e.revert());const a=t(...s);return a&&!X(a)&&a.revert&&(e=a),Y(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r),a||v}};class as{constructor(t={}){L.current&&L.current.register(this);const e=t.root;let r=i;e&&(r=e.current||e.nativeElement||oe(e)[0]||i);const n=t.defaults,o=A.defaults,a=t.mediaQueries;if(this.defaults=n?bt(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],this.constructorsOnce=[],this.revertConstructorsOnce=[],this.revertiblesOnce=[],this.once=!1,this.onceIndex=0,this.methods={},this.matches={},this.mediaQueryLists={},this.data={},a)for(let t in a){const e=s.matchMedia(a[t]);this.mediaQueryLists[t]=e,e.addEventListener("change",this)}}register(t){(this.once?this.revertiblesOnce:this.revertibles).push(t)}execute(t){let e=L.current,s=L.root,i=A.defaults;L.current=this,L.root=this.root,A.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return L.current=e,L.root=s,A.defaults=i,n}refresh(){return this.onceIndex=0,this.execute(()=>{let t=this.revertibles.length,e=this.revertConstructors.length;for(;t--;)this.revertibles[t].revert();for(;e--;)this.revertConstructors[e](this);this.revertibles.length=0,this.revertConstructors.length=0,this.constructors.forEach(t=>{const e=t(this);X(e)&&this.revertConstructors.push(e)})}),this}add(t,e){if(this.once=!1,X(t)){const e=t;this.constructors.push(e),this.execute(()=>{const t=e(this);X(t)&&this.revertConstructors.push(t)})}else this.methods[t]=(...t)=>this.execute(()=>e(...t));return this}addOnce(t){if(this.once=!0,X(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute(()=>{const t=s(this);X(t)&&this.revertConstructorsOnce.push(t)})}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(X(s))return s(this);const i=os(t);let r;return this.constructorsOnce[e]=i,this.execute(()=>{r=i(this)}),r}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.revertiblesOnce,i=this.revertConstructorsOnce,r=this.mediaQueryLists;let n=t.length,o=e.length,a=s.length,l=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;a--;)s[a].revert();for(;l--;)i[l](this);for(let t in r)r[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,s.length=0,i.length=0,this.constructorsOnce.length=0,this.onceIndex=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const ls=(t,e)=>t&&X(t)?t(e):t,hs=new Map;class ds{constructor(t){this.element=t,this.useWin=this.element===i.body,this.winWidth=0,this.winHeight=0,this.width=0,this.height=0,this.left=0,this.top=0,this.scale=1,this.zIndex=0,this.scrollX=0,this.scrollY=0,this.prevScrollX=0,this.prevScrollY=0,this.scrollWidth=0,this.scrollHeight=0,this.velocity=0,this.backwardX=!1,this.backwardY=!1,this.scrollTicker=new re({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;Tt(this,t=>t.handleScroll(),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new re({autoplay:!1,frameRate:30,onUpdate:t=>{const e=t.deltaTime,s=this.prevScrollX,i=this.prevScrollY,r=this.scrollX,n=this.scrollY,o=s-r,a=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),a&&(this.backwardY=i>n),this.velocity=mt(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new re({autoplay:!1,duration:250*A.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new re({autoplay:!1,duration:500*A.timeScale,onBegin:()=>{this.scrollTicker.resume()},onComplete:()=>{this.scrollTicker.pause()}}).init(),this._head=null,this._tail=null,this.updateScrollCoords(),this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll(),this.resizeObserver=new ResizeObserver(()=>this.resizeTicker.restart()),this.resizeObserver.observe(this.element),(this.useWin?s:this.element).addEventListener("scroll",this,!1)}updateScrollCoords(){const t=this.useWin,e=this.element;this.scrollX=mt(t?s.scrollX:e.scrollLeft,0),this.scrollY=mt(t?s.scrollY:e.scrollTop,0)}updateWindowBounds(){this.winWidth=s.innerWidth,this.winHeight=(()=>{const t=i.createElement("div");i.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return i.body.removeChild(t),e})()}updateBounds(){const t=getComputedStyle(this.element),e=this.element;let s,i;if(this.scrollWidth=e.scrollWidth+parseFloat(t.marginLeft)+parseFloat(t.marginRight),this.scrollHeight=e.scrollHeight+parseFloat(t.marginTop)+parseFloat(t.marginBottom),this.updateWindowBounds(),this.useWin)s=this.winWidth,i=this.winHeight;else{const t=e.getBoundingClientRect();s=e.clientWidth,i=e.clientHeight,this.top=t.top,this.left=t.left,this.scale=t.width?s/t.width:t.height?i/t.height:1}this.width=s,this.height=i}refreshScrollObservers(){Tt(this,t=>{t._debug&&t.removeDebug()}),this.updateBounds(),Tt(this,t=>{t.refresh(),t.onResize(t),t._debug&&t.debug()})}refresh(){this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll()}handleScroll(){this.updateScrollCoords(),this.wakeTicker.restart()}handleEvent(t){"scroll"===t.type&&this.handleScroll()}revert(){this.scrollTicker.cancel(),this.dataTimer.cancel(),this.resizeTicker.cancel(),this.wakeTicker.cancel(),this.resizeObserver.disconnect(),(this.useWin?s:this.element).removeEventListener("scroll",this),hs.delete(this.element)}}const cs=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,a="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:l,u:h}=It(a,At);let d=l;return"%"===h?d=l/100*s:h&&(d=de(t,At,"px",!0).n),o&&i<0&&(d+=i),n&&r>0&&(d+=r),d},us=(t,e,s,i,r)=>{let n;if(H(e)){const o=N.exec(e);if(o){const a=o[0],l=a[0],h=e.split(a),d="min"===h[0],c="max"===h[0],u=cs(t,h[0],s,i,r),p=cs(t,h[1],s,i,r);if(d){const e=Dt(cs(t,"min",s),p,l);n=e<u?u:e}else if(c){const e=Dt(cs(t,"max",s),p,l);n=e>u?u:e}else n=Dt(u,p,l)}else n=cs(t,e,s,i,r)}else n=e;return mt(n,0)},ps=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[o]){e=i;break}}return e};let ms=0;const fs=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class gs{constructor(t={}){L.current&&L.current.register(this);const e=$t(t.sync,"play pause"),s=e?Te(e):null,r=e&&("linear"===e||e===ce),n=e&&!(s===ce&&!r),o=e&&(z(e)||!0===e||r),a=e&&H(e)&&!n&&!o,l=a?e.split(" ").map(t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null}):null,h=a&&l.length>2;this.index=ms++,this.id=Y(t.id)?this.index:t.id,this.container=(t=>{const e=t&&oe(t)[0]||i.body;let s=hs.get(e);return s||(s=new ds(e),hs.set(e,s)),s})(t.container),this.target=null,this.linked=null,this.repeat=null,this.horizontal=null,this.enter=null,this.leave=null,this.sync=n||o||!!l,this.syncEase=n?s:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=l&&!h&&l[0]?l[0]:v,this.onSyncLeave=l&&!h&&l[1]?l[1]:v,this.onSyncEnterForward=l&&h&&l[0]?l[0]:v,this.onSyncLeaveForward=l&&h&&l[1]?l[1]:v,this.onSyncEnterBackward=l&&h&&l[2]?l[2]:v,this.onSyncLeaveBackward=l&&h&&l[3]?l[3]:v,this.onEnter=t.onEnter||v,this.onLeave=t.onLeave||v,this.onEnterForward=t.onEnterForward||v,this.onLeaveForward=t.onLeaveForward||v,this.onEnterBackward=t.onEnterBackward||v,this.onLeaveBackward=t.onLeaveBackward||v,this.onUpdate=t.onUpdate||v,this.onResize=t.onResize||v,this.onSyncComplete=t.onSyncComplete||v,this.reverted=!1,this.ready=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offset=0,this.offsetStart=0,this.offsetEnd=0,this.distance=0,this.prevProgress=0,this.thresholds=["start","end","end","start"],this.coords=[0,0,0,0],this.debugStyles=null,this.$debug=null,this._params=t,this._debug=$t(t.debug,!1),this._next=null,this._prev=null,wt(this.container,this),ns(()=>{if(!this.reverted){if(!this.target){const e=oe(t.target)[0];this.target=e||i.body,this.refresh()}this._debug&&this.debug()}})}link(t){if(t&&(t.pause(),this.linked=t,Y(t)||Y(t.persist)||(t.persist=!0),!this._params.target)){let e;Y(t.targets)?Tt(t,t=>{t.targets&&!e&&(e=ps(t))}):e=ps(t),this.target=e||i.body,this.refresh()}return this}get velocity(){return this.container.velocity}get backward(){return this.horizontal?this.container.backwardX:this.container.backwardY}get scroll(){return this.horizontal?this.container.scrollX:this.container.scrollY}get progress(){const t=(this.scroll-this.offsetStart)/this.distance;return t===1/0||isNaN(t)?0:mt(ut(t,0,1),6)}refresh(){this.ready=!0,this.reverted=!1;const t=this._params;return this.repeat=$t(ls(t.repeat,this),!0),this.horizontal="x"===$t(ls(t.axis,this),"y"),this.enter=$t(ls(t.enter,this),"end start"),this.leave=$t(ls(t.leave,this),"start end"),this.updateBounds(),this.handleScroll(),this}removeDebug(){return this.$debug&&(this.$debug.parentNode.removeChild(this.$debug),this.$debug=null),this.debugStyles&&(this.debugStyles.revert(),this.$debug=null),this}debug(){this.removeDebug();const t=this.container,e=this.horizontal,s=t.element.querySelector(":scope > .animejs-onscroll-debug"),r=i.createElement("div"),n=i.createElement("div"),o=i.createElement("div"),a=fs[this.index%fs.length],l=t.useWin,h=l?t.winWidth:t.width,d=l?t.winHeight:t.height,c=t.scrollWidth,u=t.scrollHeight,p=this.container.width>360?320:260,m=e?0:10,f=e?10:0,g=e?24:p/2,y=e?g:15,v=e?60:g,_=e?v:y,b=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",x=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,w=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${w("absolute",m,f,e?c:p,e?p:u)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${e?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `,n.style.cssText=`${w("sticky",0,0,e?h:g,e?g:d)}`,s||(n.style.cssText+=`background:\n ${x("#FFFF")}${T(g-10)} / 100px 100px ${b},\n ${x("#FFF8")}${T(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${w("relative",0,0,e?c:g,e?g:u)}`,s||(o.style.cssText+=`background:\n ${x("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${x("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const S=[" enter: "," leave: "];this.coords.forEach((t,s)=>{const r=s>1,l=(r?0:this.offset)+t,m=s%2,f=l<_,g=l>(r?e?h:d:e?c:u)-_,b=(r?m&&!f:!m&&!f)||g,T=i.createElement("div"),x=i.createElement("div"),$=e?b?"right":"left":b?"bottom":"top",E=b?(e?v:y)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;x.innerHTML=`${this.id}${S[m]}${this.thresholds[s]}`,T.style.cssText=`${w("absolute",0,0,v,y)}\n display: flex;\n flex-direction: ${e?"column":"row"};\n justify-content: flex-${r?"start":"end"};\n align-items: flex-${b?"end":"start"};\n border-${$}: 2px solid ${a};\n `,x.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${y};\n margin-${e?b?"right":"left":b?"bottom":"top"}: -2px;\n padding: 1px;\n font-family: ui-monospace, monospace;\n font-size: 10px;\n letter-spacing: -.025em;\n line-height: 9px;\n font-weight: 600;\n text-align: ${e&&b||!e&&!r?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${m?a:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":a};\n border: 2px solid ${m?a:"transparent"};\n border-${e?b?"top-left":"top-right":b?"top-left":"bottom-left"}-radius: 5px;\n border-${e?b?"bottom-left":"bottom-right":b?"top-right":"bottom-right"}-radius: 5px;\n `,T.appendChild(x);let k=l-E+(e?1:0);T.style[e?"left":"top"]=`${k}px`,(r?n:o).appendChild(T)}),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),s||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===Me(t.element,"position")&&(this.debugStyles=Ve(t.element,{position:"relative "}))}updateBounds(){let t;this._debug&&this.removeDebug();const e=this.target,s=this.container,r=this.horizontal,n=this.linked;let o,a=e;for(n&&(o=n.currentTime,n.seek(0,!0));a&&a!==s.element&&a!==i.body;){const e="sticky"===Me(a,"position")&&Ve(a,{position:"static"});a=a.parentElement,e&&(t||(t=[]),t.push(e))}const l=e.getBoundingClientRect(),h=s.scale,d=(r?l.left+s.scrollX-s.left:l.top+s.scrollY-s.top)*h,c=(r?l.width:l.height)*h,u=r?s.width:s.height,p=(r?s.scrollWidth:s.scrollHeight)-u,m=this.enter,f=this.leave;let g="start",y="end",v="end",_="start";if(H(m)){const t=m.split(" ");v=t[0],g=t.length>1?t[1]:g}else if(O(m)){const t=m;Y(t.container)||(v=t.container),Y(t.target)||(g=t.target)}else z(m)&&(v=m);if(H(f)){const t=f.split(" ");_=t[0],y=t.length>1?t[1]:y}else if(O(f)){const t=f;Y(t.container)||(_=t.container),Y(t.target)||(y=t.target)}else z(f)&&(_=f);const b=us(e,g,c),T=us(e,y,c),x=b+d-u,w=T+d-p,S=us(e,v,u,x,w),$=us(e,_,u,x,w),E=b+d-S,k=T+d-$,C=k-E;this.offset=d,this.offsetStart=E,this.offsetEnd=k,this.distance=C<=0?0:C,this.thresholds=[g,y,v,_],this.coords=[b,T,S,$],t&&t.forEach(t=>t.revert()),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){if(!this.ready)return;const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,a=this.scroll,l=a<=this.offsetStart,h=a>=this.offsetEnd,d=!l&&!h,c=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&c,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(l&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&z(i)){if(i<1){const t=1e-4,s=e<g&&1===g?t:e>g&&!g?-t:0;g=mt(gt(e,g,gt(.01,.2,i))+s,6)}}else s&&(g=s(g));m=g!==this.prevProgress,f=1===e,m&&!f&&i&&e&&o.wakeTicker.restart()}if(p){const t=n?o.scrollY:o.scrollX;p.style[n?"top":"left"]=t+10+"px"}(d&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(d&&(this.isInView=!0),this.forceEnter&&this.hasEntered?d&&(this.forceEnter=!1):(p&&d&&(p.style.zIndex=""+this.container.zIndex++),this.onSyncEnter(this),this.onEnter(this),this.backward?(this.onSyncEnterBackward(this),this.onEnterBackward(this)):(this.onSyncEnterForward(this),this.onEnterForward(this)),this.hasEntered=!0,u&&(this.forceEnter=!0))),(d||!d&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!d&&this.isInView&&(this.isInView=!1,this.onSyncLeave(this),this.onLeave(this),this.backward?(this.onSyncLeaveBackward(this),this.onLeaveBackward(this)):(this.onSyncLeaveForward(this),this.onLeaveForward(this)),e&&!i&&(f=!0)),g>=1&&this.began&&!this.completed&&(e&&f||!e)&&(e&&this.onSyncComplete(this),this.completed=!0,(!this.repeat&&!t||!this.repeat&&t&&t.completed)&&this.revert()),g<1&&this.completed&&(this.completed=!1),this.prevProgress=g}revert(){if(this.reverted)return;const t=this.container;return xt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this.ready=!1,this}}const ys=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,vs=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?ce:r=>0===r||1===r?r:ys(((t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=ys(r,e,s)-t,i>0?o=r:n=r}while(it(i)>1e-7&&++a<100);return r})(r,t,s),e,i),_s=(t=10,e)=>{const s=e?nt:ot;return e=>s(ut(e,0,1)*t)*(1/t)},bs=(...t)=>{const e=t.length;if(!e)return ce;const s=e-1,i=t[0],r=t[s],n=[0],o=[J(i)];for(let e=1;e<s;e++){const i=t[e],r=H(i)?i.trim().split(" "):[i],a=r[0],l=r[1];n.push(Y(l)?e/s:J(l)/100),o.push(J(a))}return o.push(J(r)),n.push(1),function(t){for(let e=1,s=n.length;e<s;e++){const s=n[e];if(t<=s){const i=n[e-1],r=o[e-1];return r+(o[e]-r)*(t-i)/(s-i)}}return o[o.length-1]}},Ts=(t=10,e=1)=>{const s=[0],i=t-1;for(let t=1;t<i;t++){const r=s[t-1],n=t/i,o=n*(1-e)+(n+((t+1)/i-n)*Math.random())*e;s.push(ut(o,r,1))}return s.push(1),bs(...s)};var xs=Object.freeze({__proto__:null,Spring:Qe,createSpring:Je,cubicBezier:vs,eases:ye,irregular:Ts,linear:bs,spring:Ze,steps:_s});const ws=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(mt(t(i/e),4));return`linear(${s.join(", ")})`},Ss={},$s=t=>{let e=Ss[t];if(e)return e;if(e="linear",H(t)){if(F(t,"linear")||F(t,"cubic-")||F(t,"steps")||F(t,"ease"))e=t;else if(F(t,"cubicB"))e=P(t);else{const s=_e(t);X(s)&&(e=s===ce?"linear":ws(s))}Ss[t]=e}else if(X(t)){const s=ws(t);s&&(e=s)}else t.ease&&(e=ws(t.ease));return e},Es=["x","y","z"],ks=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...Es],Cs=(()=>[...Es,...g.filter(t=>["X","Y","Z"].some(e=>t.endsWith(e)))])();let Ns=null;const Ds=(t,e,s,i,r)=>{let n=H(e)?e:Et(e,s,i,r);return z(n)?ks.includes(t)||F(t,"translate")?`${n}px`:F(t,"rotate")||F(t,"skew")?`${n}deg`:`${n}`:n},Is=(t,e,s,i,r,n)=>{let o="0";const a=Y(i)?getComputedStyle(t)[e]:Ds(e,i,t,r,n);return o=Y(s)?V(i)?i.map(s=>Ds(e,s,t,r,n)):a:[Ds(e,s,t,r,n),a],o};class Ls{constructor(t,s){L.current&&L.current.register(this),W(Ns)&&(!e||!Y(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(g.forEach(t=>{const e=F(t,"skew"),s=F(t,"scale"),i=F(t,"rotate"),r=F(t,"translate"),n=i||e,o=n?"<angle>":s?"<number>":r?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:o,inherits:!1,initialValue:r?"0px":n?"0deg":s?"1":"0"})}catch{}}),Ns=!0):Ns=!1);const i=ae(t),r=i.length;r||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const n=$t(s.autoplay,A.defaults.autoplay),o=!(!n||!n.link)&&n,a=s.alternate&&!0===s.alternate,h=s.reversed&&!0===s.reversed,d=$t(s.loop,A.defaults.loop),c=!0===d||d===1/0?1/0:z(d)?d+1:1,u=a?h?"alternate-reverse":"alternate":h?"reverse":"normal",_=1===A.timeScale?1:p;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||A.defaults.onComplete,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!n||!1!==o,this.reversed=h,this.persist=$t(s.persist,A.defaults.persist),this.autoplay=n,this._speed=$t(s.playbackRate,A.defaults.playbackRate),this._resolve=v,this._completed=0,this._inlineStyles=[],i.forEach((t,e)=>{const i=t[l],n=Cs.some(t=>s.hasOwnProperty(t)),o=t.style,a=this._inlineStyles[e]={},h=$t(s.ease,A.defaults.ease),d=Et(h,t,e,r),p=X(d)||H(d)?d:h,v=h.ease&&h,b=$s(p),T=(v?v.settlingDuration:Et($t(s.duration,A.defaults.duration),t,e,r))*_,x=Et($t(s.delay,A.defaults.delay),t,e,r)*_,w=$t(s.composition,"replace");for(let l in s){if(!Q(l))continue;const h={},d={iterations:c,direction:u,fill:"both",easing:b,duration:T,delay:x,composite:w},p=s[l],m=!!n&&(g.includes(l)?l:f.get(l)),y=m?"transform":l;let v;if(a[y]||(a[y]=o[y]),O(p)){const s=p,n=$t(s.ease,b),a=n.ease&&n,c=s.to,u=s.from;if(d.duration=(a?a.settlingDuration:Et($t(s.duration,T),t,e,r))*_,d.delay=Et($t(s.delay,x),t,e,r)*_,d.composite=$t(s.composition,w),d.easing=$s(n),v=Is(t,l,u,c,e,r),m?(h[`--${m}`]=v,i[m]=v):h[l]=Is(t,l,u,c,e,r),Fe(this,t,l,h,d),!Y(u))if(m){const t=`--${m}`;o.setProperty(t,h[t][0])}else o[l]=h[l][0]}else v=V(p)?p.map(s=>Ds(l,s,t,e,r)):Ds(l,p,t,e,r),m?(h[`--${m}`]=v,i[m]=v):h[l]=v,Fe(this,t,l,h,d)}if(n){let t=m;for(let e in i)t+=`${y[e]}var(--${e})) `;o.transform=t}}),o&&this.autoplay.link(this)}forEach(t){try{const e=H(t)?e=>e[t]():t;this.animations.forEach(e)}catch{}return this}get speed(){return this._speed}set speed(t){this._speed=+t,this.forEach(e=>e.playbackRate=t)}get currentTime(){const t=this.controlAnimation,e=A.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===A.timeScale?1:p);this.forEach(t=>{!this.persist&&e>=this.duration&&t.play(),t.currentTime=e})}get progress(){return this.currentTime/this.duration}set progress(t){this.forEach(e=>e.currentTime=t*this.duration||0)}resume(){return this.paused?(this.paused=!1,this.forEach("play")):this}pause(){return this.paused?this:(this.paused=!0,this.forEach("pause"))}alternate(){return this.reversed=!this.reversed,this.forEach("reverse"),this.paused&&this.forEach("pause"),this}play(){return this.reversed&&this.alternate(),this.resume()}reverse(){return this.reversed||this.alternate(),this.resume()}seek(t,e=!1){return e&&(this.muteCallbacks=!0),t<this.duration&&(this.completed=!1),this.currentTime=t,this.muteCallbacks=!1,this.paused&&this.pause(),this}restart(){return this.completed=!1,this.seek(0,!0).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){return this.muteCallbacks=!0,this.commitStyles().forEach("cancel"),this.animations.length=0,requestAnimationFrame(()=>{this.targets.forEach(t=>{"none"===t.style.transform&&t.style.removeProperty("transform")})}),this}revert(){return this.cancel().targets.forEach((t,e)=>{const s=t.style,i=this._inlineStyles[e];for(let e in i){const r=i[e];Y(r)||r===m?s.removeProperty(P(e)):t.style[e]=r}t.getAttribute("style")===m&&t.removeAttribute("style")}),this}then(t=v){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=v};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const As={animate:(t,e)=>new Ls(t,e),convertEase:ws};let Rs=0,Bs=0;const Ps=(t,e)=>!(!t||!e)&&(t===e||t.contains(e)),Fs=t=>{if(!t)return null;const e=t.style,s=e.transition||"";return e.setProperty("transition","none","important"),s},Ms=(t,e)=>{if(!t)return;const s=t.style;e?s.transition=e:s.removeProperty("transition")},Vs=t=>{const e=t.layout.transitionMuteStore,s=t.$el,i=t.$measure;s&&!e.has(s)&&e.set(s,Fs(s)),i&&!e.has(i)&&e.set(i,Fs(i))},Os=t=>{t.forEach((t,e)=>Ms(e,t)),t.clear()},zs={display:"none",visibility:"hidden",opacity:"0",transform:"none",position:"static"},Hs=t=>{if(!t)return;const e=t.parentNode;e&&(e._head===t&&(e._head=t._next),e._tail===t&&(e._tail=t._prev),t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t._prev=null,t._next=null,t.parentNode=null)},Xs=(t,e,s,i)=>{let r=t.dataset.layoutId;r||(r=t.dataset.layoutId="node-"+Bs++);const n=i||{};return n.$el=t,n.$measure=t,n.id=r,n.index=0,n.total=1,n.delay=0,n.duration=0,n.ease=null,n.state=s,n.layout=s.layout,n.parentNode=e||null,n.isTarget=!1,n.isEntering=!1,n.isLeaving=!1,n.isInlined=!1,n.hasTransform=!1,n.inlineStyles=[],n.inlineTransforms=null,n.inlineTransition=null,n.branchAdded=!1,n.branchRemoved=!1,n.branchNotRendered=!1,n.sizeChanged=!1,n.hasVisibilitySwap=!1,n.hasDisplayNone=!1,n.hasVisibilityHidden=!1,n.measuredInlineTransform=null,n.measuredInlineTransition=null,n.measuredDisplay=null,n.measuredVisibility=null,n.measuredPosition=null,n.measuredHasDisplayNone=!1,n.measuredHasVisibilityHidden=!1,n.measuredIsVisible=!1,n.measuredIsRemoved=!1,n.measuredIsInsideRoot=!1,n.properties={transform:"none",x:0,y:0,left:0,top:0,clientLeft:0,clientTop:0,width:0,height:0},n.layout.properties.forEach(t=>n.properties[t]=0),n._head=null,n._tail=null,n._prev=null,n._next=null,n},Ys=(t,e,s,i)=>{const r=t.$el,n=t.layout.root,o=n===r,a=t.properties,l=t.state.rootNode,h=t.parentNode,d=s.transform,c=r.style.transform,u=!!h&&h.measuredIsRemoved,p=s.position;o&&(t.layout.absoluteCoords="fixed"===p||"absolute"===p),t.$measure=e,t.inlineTransforms=c,t.hasTransform=d&&"none"!==d,t.measuredIsInsideRoot=Ps(n,e),t.measuredInlineTransform=null,t.measuredDisplay=s.display,t.measuredVisibility=s.visibility,t.measuredPosition=p,t.measuredHasDisplayNone="none"===s.display,t.measuredHasVisibilityHidden="hidden"===s.visibility,t.measuredIsVisible=!(t.measuredHasDisplayNone||t.measuredHasVisibilityHidden),t.measuredIsRemoved=t.measuredHasDisplayNone||t.measuredHasVisibilityHidden||u;let m=!1,f=r.previousSibling;for(;f&&(f.nodeType===Node.COMMENT_NODE||f.nodeType===Node.TEXT_NODE&&!f.textContent.trim());)f=f.previousSibling;if(f&&f.nodeType===Node.TEXT_NODE)m=!0;else{for(f=r.nextSibling;f&&(f.nodeType===Node.COMMENT_NODE||f.nodeType===Node.TEXT_NODE&&!f.textContent.trim());)f=f.nextSibling;m=null!==f&&f.nodeType===Node.TEXT_NODE}if(t.isInlined=m,t.hasTransform&&!i){const s=t.layout.transitionMuteStore;s.get(r)||(t.inlineTransition=Fs(r)),e===r?r.style.transform="none":(s.get(e)||(t.measuredInlineTransition=Fs(e)),t.measuredInlineTransform=e.style.transform,e.style.transform="none")}let g,y,v=0,_=0,b=0,T=0;if(!i){const t=e.getBoundingClientRect();v=t.left,_=t.top,b=t.width,T=t.height}for(let t in a){const e="transform"===t?d:s[t]||s.getPropertyValue&&s.getPropertyValue(t);Y(e)||(a[t]=e)}if(a.left=v,a.top=_,a.clientLeft=i?0:e.clientLeft,a.clientTop=i?0:e.clientTop,o)t.layout.absoluteCoords?(g=v,y=_):(g=0,y=0);else{const e=h||l,s=e.properties.left,i=e.properties.top,r=e.properties.clientLeft,n=e.properties.clientTop;if(t.layout.absoluteCoords)g=v-s-r,y=_-i-n;else if(e===l){const t=l.properties.left,e=l.properties.top;g=v-t-l.properties.clientLeft,y=_-e-l.properties.clientTop}else g=v-s-r,y=_-i-n}return a.x=g,a.y=y,a.width=b,a.height=T,t},Ws=(t,e)=>{if(e)for(let s in e)t.properties[s]=e[s]},Us=(t,e)=>{const s=Et(e.ease,t.$el,t.index,t.total),i=X(s)?s:e.ease,r=!Y(i)&&!Y(i.ease);t.ease=r?i.ease:i,t.duration=r?i.settlingDuration:Et(e.duration,t.$el,t.index,t.total),t.delay=Et(e.delay,t.$el,t.index,t.total)},qs=t=>{const e=t.$el.style,s=t.inlineStyles;s.length=0,t.layout.recordedProperties.forEach(t=>{s.push(t,e[t]||"")})},js=t=>{const e=t.$el.style,s=t.inlineStyles;for(let t=0,i=s.length;t<i;t+=2){const i=s[t],r=s[t+1];r&&""!==r?e[i]=r:(e[i]="",e.removeProperty(i))}},Gs=t=>{const e=t.inlineTransforms,s=t.$el.style;!t.hasTransform||!e||t.hasTransform&&"none"===s.transform||e&&"none"===e?s.removeProperty("transform"):e&&(s.transform=e);const i=t.$measure;if(t.hasTransform&&i!==t.$el){const e=i.style,s=t.measuredInlineTransform;s&&""!==s?e.transform=s:e.removeProperty("transform")}t.measuredInlineTransform=null,null!==t.inlineTransition&&(Ms(t.$el,t.inlineTransition),t.inlineTransition=null),i!==t.$el&&null!==t.measuredInlineTransition&&(Ms(i,t.measuredInlineTransition),t.measuredInlineTransition=null)},Qs=t=>{(t.measuredIsRemoved||t.hasVisibilitySwap)&&(t.$el.style.removeProperty("display"),t.$el.style.removeProperty("visibility"),t.hasVisibilitySwap&&(t.$measure.style.removeProperty("display"),t.$measure.style.removeProperty("visibility"))),t.layout.pendingRemoval.delete(t.$el)},Zs=(t,e,s)=>(e.properties={...t.properties},e.state=s,e.isTarget=t.isTarget,e.hasTransform=t.hasTransform,e.inlineTransforms=t.inlineTransforms,e.measuredIsVisible=t.measuredIsVisible,e.measuredDisplay=t.measuredDisplay,e.measuredIsRemoved=t.measuredIsRemoved,e.measuredHasDisplayNone=t.measuredHasDisplayNone,e.measuredHasVisibilityHidden=t.measuredHasVisibilityHidden,e.hasDisplayNone=t.hasDisplayNone,e.isInlined=t.isInlined,e.hasVisibilityHidden=t.hasVisibilityHidden,e);class Js{constructor(t){this.layout=t,this.rootNode=null,this.rootNodes=new Set,this.nodes=new Map,this.scrollX=0,this.scrollY=0}revert(){return this.forEachNode(t=>{this.layout.pendingRemoval.delete(t.$el),t.$el.removeAttribute("data-layout-id"),t.$measure.removeAttribute("data-layout-id")}),this.rootNode=null,this.rootNodes.clear(),this.nodes.clear(),this}getNode(t){if(t&&t.dataset)return this.nodes.get(t.dataset.layoutId)}getComputedValue(t,e){const s=this.getNode(t);if(s)return s.properties[e]}forEach(t,e){let s=t,i=0;for(;s;)if(e(s,i++),s._head)s=s._head;else if(s._next)s=s._next;else{for(;s&&!s._next;)s=s.parentNode;s&&(s=s._next)}}forEachRootNode(t){this.forEach(this.rootNode,t)}forEachNode(t){for(const e of this.rootNodes)this.forEach(e,t)}registerElement(t,e){if(!t||1!==t.nodeType)return null;this.layout.transitionMuteStore.has(t)||this.layout.transitionMuteStore.set(t,Fs(t));const s=[t,e],i=this.layout.root;let r=null;for(;s.length;){const t=s.pop(),e=s.pop();if(!e||1!==e.nodeType||U(e))continue;const n=!!t&&t.measuredIsRemoved,o=n?zs:getComputedStyle(e),a=!!n||"none"===o.display,l=!!n||"hidden"===o.visibility,h=!a&&!l,d=e.dataset.layoutId,c=Ps(i,e);let u=d?this.nodes.get(d):null;if(u&&u.$el!==e){const a=Ps(i,u.$el),l=u.measuredIsVisible;if(a||!c&&(c||l||!h)){if(a&&!l&&h){Ys(u,e,o,n);let t=e.lastElementChild;for(;t;)s.push(t,u),t=t.previousElementSibling;r||(r=u);continue}{let i=e.lastElementChild;for(;i;)s.push(i,t),i=i.previousElementSibling;r||(r=u);continue}}Hs(u),u=Xs(e,t,this,u)}else u=Xs(e,t,this,u);u.branchAdded=!1,u.branchRemoved=!1,u.branchNotRendered=!1,u.isTarget=!1,u.sizeChanged=!1,u.hasVisibilityHidden=l,u.hasDisplayNone=a,u.hasVisibilitySwap=l&&!u.measuredHasVisibilityHidden||a&&!u.measuredHasDisplayNone,this.nodes.set(u.id,u),u.parentNode=t||null,u._prev=null,u._next=null,t?(this.rootNodes.delete(u),t._head?(t._tail._next=u,u._prev=t._tail,t._tail=u):(t._head=u,t._tail=u)):this.rootNodes.add(u),Ys(u,u.$el,o,n);let p=e.lastElementChild;for(;p;)s.push(p,u),p=p.previousElementSibling;r||(r=u)}return r}ensureDetachedNode(t,e){if(!t||t===this.layout.root)return null;const s=t.dataset.layoutId,i=s?this.nodes.get(s):null;if(i&&i.$el===t)return i;let r=null,n=t.parentElement;for(;n&&n!==this.layout.root;){if(e.has(n)){r=this.ensureDetachedNode(n,e);break}n=n.parentElement}return this.registerElement(t,r)}record(){const t=this.layout,e=t.children,s=t.root,i=V(e)?e:[e],r=[],n="*"===e?s:L.root,o=[];let a=s.parentElement;for(;a&&1===a.nodeType;){const t=getComputedStyle(a);if(t.transform&&"none"!==t.transform){const t=a.style.transform||"",e=Fs(a);o.push(a,t,e),a.style.transform="none"}a=a.parentElement}for(let t=0,e=i.length;t<e;t++){const e=i[t];r[t]=H(e)?n.querySelectorAll(e):e}const l=ae(r);this.nodes.clear(),this.rootNodes.clear();const h=this.registerElement(s,null);h.isTarget=!0,this.rootNode=h;const d=new Set;let c=0,u=this.nodes.size;this.nodes.forEach((t,e)=>{t.index=c++,t.total=u,t&&t.measuredIsInsideRoot&&d.add(e)});const p=new Set,m=[];for(let t=0,e=l.length;t<e;t++){const e=l[t];if(e&&1===e.nodeType&&e!==s){if(!Ps(s,e)){const t=e.dataset.layoutId;if(!t||!d.has(t))continue}p.has(e)||(p.add(e),m.push(e))}}for(let t=0,e=m.length;t<e;t++)this.ensureDetachedNode(m[t],p);for(let t=0,e=l.length;t<e;t++){const e=l[t],s=this.getNode(e);if(s){let t=s;for(;t&&!t.isTarget;)t.isTarget=!0,t=t.parentNode}}this.scrollX=window.scrollX,this.scrollY=window.scrollY,this.forEachNode(Gs);for(let t=0,e=o.length;t<e;t+=3){const e=o[t],s=o[t+1],i=o[t+2];s&&""!==s?e.style.transform=s:e.style.removeProperty("transform"),Ms(e,i)}return this}}function Ks(t){const e={},s={};for(let i in t){const r=t[i];"duration"===i||"delay"===i||"ease"===i?s[i]=r:e[i]=r}return[e,s]}class ti{constructor(t,e={}){L.current&&L.current.register(this);const s=Ks(e.swapAt),i=Ks(e.enterFrom),r=Ks(e.leaveTo),n=e.properties;if(e.duration=$t(e.duration,350),e.delay=$t(e.delay,0),e.ease=$t(e.ease,"inOut(3.5)"),this.params=e,this.root=ae(t)[0],this.id=Rs++,this.children=e.children||"*",this.absoluteCoords=!1,this.swapAtParams=bt(e.swapAt||{opacity:0},{ease:"inOut(1.75)"}),this.enterFromParams=e.enterFrom||{opacity:0},this.leaveToParams=e.leaveTo||{opacity:0},this.properties=new Set(["opacity","fontSize","color","backgroundColor","borderRadius","border","filter","clipPath"]),s[0])for(let t in s[0])this.properties.add(t);if(i[0])for(let t in i[0])this.properties.add(t);if(r[0])for(let t in r[0])this.properties.add(t);if(n)for(let t=0,e=n.length;t<e;t++)this.properties.add(n[t]);this.recordedProperties=new Set(["display","visibility","translate","position","left","top","marginLeft","marginTop","width","height","maxWidth","maxHeight","minWidth","minHeight"]),this.properties.forEach(t=>this.recordedProperties.add(t)),this.pendingRemoval=new WeakSet,this.transitionMuteStore=new Map,this.oldState=new Js(this),this.newState=new Js(this),this.timeline=null,this.transformAnimation=null,this.animating=[],this.swapping=[],this.leaving=[],this.entering=[],this.oldState.record(),Os(this.transitionMuteStore)}revert(){return this.root.classList.remove("is-animated"),this.timeline&&(this.timeline.complete(),this.timeline=null),this.transformAnimation&&(this.transformAnimation.complete(),this.transformAnimation=null),this.animating.length=this.swapping.length=this.leaving.length=this.entering.length=0,this.oldState.revert(),this.newState.revert(),requestAnimationFrame(()=>Os(this.transitionMuteStore)),this}record(){return this.transformAnimation&&(this.transformAnimation.cancel(),this.transformAnimation=null),this.oldState.record(),this.timeline&&(this.timeline.cancel(),this.timeline=null),this.newState.forEachRootNode(js),this}animate(t={}){const e={ease:$t(t.ease,this.params.ease),delay:$t(t.delay,this.params.delay),duration:$t(t.duration,this.params.duration)},s={},i=$t(t.onComplete,this.params.onComplete),r=$t(t.onPause,this.params.onPause);for(let e in I)"ease"!==e&&"duration"!==e&&"delay"!==e&&(Y(t[e])?Y(this.params[e])||(s[e]=this.params[e]):s[e]=t[e]);s.onComplete=()=>{const e=t.autoplay;if(e&&e.linked)i&&i(this.timeline);else{this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(t=>{Qs(t),js(t)});for(let t=0,e=w.length;t<e;t++){const e=w[t];e.style.transform=f.getComputedValue(e,"transform")}this.root.classList.contains("is-animated")&&(this.root.classList.remove("is-animated"),i&&i(this.timeline)),requestAnimationFrame(()=>{this.root.classList.contains("is-animated")||Os(this.transitionMuteStore)})}},s.onPause=()=>{const e=t.autoplay;if(e&&e.linked)return i&&i(this.timeline),void(r&&r(this.timeline));this.root.classList.contains("is-animated")&&(this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(Qs),this.root.classList.remove("is-animated"),i&&i(this.timeline),r&&r(this.timeline))},s.composition=!1;const n=bt(bt(t.swapAt||{},this.swapAtParams),e),o=bt(bt(t.enterFrom||{},this.enterFromParams),e),a=bt(bt(t.leaveTo||{},this.leaveToParams),e),[l,h]=Ks(n),[d,c]=Ks(o),[u,p]=Ks(a),m=this.oldState,f=this.newState,g=this.animating,y=this.swapping,v=this.entering,_=this.leaving,b=this.pendingRemoval;g.length=y.length=v.length=_.length=0,m.forEachRootNode(Vs),f.record(),f.forEachRootNode(qs);const T=[],x=[],w=[],S=[],$=f.rootNode,E=$.$el;f.forEachRootNode(t=>{const e=t.$el,s=t.id,i=t.parentNode,r=!!i&&i.branchAdded,n=!!i&&i.branchRemoved,o=!!i&&i.branchNotRendered;let a=m.nodes.get(s);const l=!a;l?(a=Zs(t,{},m),m.nodes.set(s,a),a.measuredIsRemoved=!0):a.measuredIsRemoved&&!t.measuredIsRemoved&&(Zs(t,a,m),a.measuredIsRemoved=!0);const h=a.parentNode,c=(h?h.id:null)!==(i?i.id:null),p=a.$el!==t.$el,y=a.measuredIsRemoved,x=t.measuredIsRemoved;if(!a.measuredIsRemoved&&!x&&!l&&(c||p)){const t=a.properties.left,e=a.properties.top,s=i||f.rootNode,r=s.id?m.nodes.get(s.id):null,n=r?r.properties.left:s.properties.left,o=r?r.properties.top:s.properties.top,l=r?r.properties.clientLeft:s.properties.clientLeft,h=r?r.properties.clientTop:s.properties.clientTop;a.properties.x=t-n-l,a.properties.y=e-o-h}t.hasVisibilitySwap&&(t.hasVisibilityHidden&&(t.$el.style.visibility="visible",t.$measure.style.visibility="hidden"),t.hasDisplayNone&&(t.$el.style.display=a.measuredDisplay||t.measuredDisplay||"",t.$measure.style.visibility="hidden"));const w=b.has(e),S=a.measuredIsVisible,E=t.measuredIsVisible,k=!S&&E&&!o,C=!x&&(y||w)&&!r,N=x&&!y&&!n,D=N||x&&w&&!n;t.branchAdded=r||C,t.branchRemoved=n||D,t.branchNotRendered=o||x,x&&S&&(t.$el.style.display=a.measuredDisplay,t.$el.style.visibility="visible",Zs(a,t,f)),N?(t.isTarget&&(_.push(e),t.isLeaving=!0),b.add(e)):!x&&w&&b.delete(e),C&&!o||k?(Ws(a,d),t.isTarget&&(v.push(e),t.isEntering=!0)):D&&!o&&Ws(t,u),t===$||!t.isTarget||t.isEntering||t.isLeaving||g.push(e),T.push(e)});let k=0,C=0,N=0;f.forEachRootNode(t=>{const s=t.$el,i=t.parentNode,r=m.nodes.get(t.id),n=t.properties,o=r.properties;let a=i!==$&&i;for(;a&&!a.isTarget&&a!==$;)a=a.parentNode;const d=g.length;t===$?(t.index=0,t.total=d,Us(t,e)):t.isEntering?(t.index=a?a.index:k,t.total=a?d:v.length,Us(t,c),k++):t.isLeaving?(t.index=a?a.index:C,t.total=a?d:_.length,C++,Us(t,p)):t.isTarget?(t.index=N++,t.total=d,Us(t,e)):(t.index=a?a.index:0,t.total=d,Us(t,h)),r.index=t.index,r.total=t.total;for(let e in n)n[e]=Et(n[e],s,t.index,t.total),o[e]=Et(o[e],s,r.index,r.total);const u=Math.abs(n.width-o.width)>1,f=Math.abs(n.height-o.height)>1;if(t.sizeChanged=u||f,t.isTarget&&(!t.measuredIsRemoved&&r.measuredIsVisible||t.measuredIsRemoved&&t.measuredIsVisible)){"none"===n.transform&&"none"===o.transform||(t.hasTransform=!0,w.push(s));for(let t in n)if("transform"!==t&&n[t]!==o[t]){x.push(s);break}}t.isTarget||(y.push(s),t.sizeChanged&&i&&i.isTarget&&i.sizeChanged&&(l.transform&&(t.hasTransform=!0,w.push(s)),S.push(s)))});const D={delay:t=>f.getNode(t).delay,duration:t=>f.getNode(t).duration,ease:t=>f.getNode(t).ease};if(s.defaults=D,this.timeline=We(s),!x.length&&!w.length&&!y.length)return Os(this.transitionMuteStore),this.timeline.complete();if(T.length){this.root.classList.add("is-animated");for(let t=0,e=T.length;t<e;t++){const e=T[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties;r.isInlined||("grid"!==i.measuredDisplay&&"grid"!==r.measuredDisplay||e.style.setProperty("display","block","important"),(e!==E||this.absoluteCoords)&&(e.style.position=this.absoluteCoords?"fixed":"absolute",e.style.left="0px",e.style.top="0px",e.style.marginLeft="0px",e.style.marginTop="0px",e.style.translate=`${n.x}px ${n.y}px`),e===E&&"static"===r.measuredPosition&&(e.style.position="relative",e.style.left="0px",e.style.top="0px")),e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none"}m.scrollX===window.scrollX&&m.scrollY===window.scrollY||requestAnimationFrame(()=>window.scrollTo(m.scrollX,m.scrollY));for(let t=0,e=x.length;t<e;t++){const e=x[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties,o=r.properties;let a=!1;const l={composition:"none"};n.width!==o.width&&(l.width=[n.width,o.width],a=!0),n.height!==o.height&&(l.height=[n.height,o.height],a=!0),r.hasTransform||r.isInlined||(l.translate=[`${n.x}px ${n.y}px`,`${o.x}px ${o.y}px`],a=!0),this.properties.forEach(t=>{const e=n[t],s=o[t];"transform"!==t&&e!==s&&(l[t]=[e,s],a=!0)}),a&&this.timeline.add(e,l,0)}}if(y.length){for(let t=0,e=y.length;t<e;t++){const e=y[t],s=m.getNode(e),i=s.properties;e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",s.isInlined||(e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${m.getComputedValue(e,t)}`)})}for(let t=0,e=y.length;t<e;t++){const e=y[t],s=f.getNode(e),i=s.properties;this.timeline.call(()=>{e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",s.isInlined||(e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${f.getComputedValue(e,t)}`)})},s.delay+s.duration/2)}if(S.length){const t=Te(f.nodes.get(S[0].dataset.layoutId).ease),e=e=>1-t(1-e),s={};if(l)for(let t in l)"transform"!==t&&(s[t]=[{from:e=>m.getComputedValue(e,t),to:l[t]},{from:l[t],to:e=>f.getComputedValue(e,t),ease:e}]);this.timeline.add(S,s,0)}}const L=w.length;if(L){for(let t=0;t<L;t++){const e=w[t],s=f.getNode(e);s.isInlined||(e.style.translate=`${m.getComputedValue(e,"x")}px ${m.getComputedValue(e,"y")}px`),e.style.transform=m.getComputedValue(e,"transform"),S.includes(e)&&(s.ease=Et(n.ease,e,s.index,s.total),s.duration=Et(n.duration,e,s.index,s.total))}this.transformAnimation=As.animate(w,{translate:t=>f.getNode(t).isInlined?"0px 0px":`${f.getComputedValue(t,"x")}px ${f.getComputedValue(t,"y")}px`,transform:t=>{const e=f.getComputedValue(t,"transform");if(!S.includes(t))return e;const s=m.getComputedValue(t,"transform"),i=f.getNode(t);return[s,Et(l.transform,t,i.index,i.total),e]},autoplay:!1,...D}),this.timeline.sync(this.transformAnimation,0)}return this.timeline.init()}update(t,e={}){return this.record(),t(this),this.animate(e)}}const ei=je,si={},ii=t=>(...e)=>{const s=t(...e);return new Proxy(v,{apply:(t,e,[i])=>s(i),get:(t,e)=>ii((...t)=>{const i=si[e](...t);return t=>i(s(t))})})},ri=(t,e,s=0)=>{const i=(...t)=>(t.length<e.length?ii(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(e,s)):e)(...t);return si[t]||(si[t]=i),i},ni=ri("roundPad",ei.roundPad),oi=ri("padStart",ei.padStart),ai=ri("padEnd",ei.padEnd),li=ri("wrap",ei.wrap),hi=ri("mapRange",ei.mapRange),di=ri("degToRad",ei.degToRad),ci=ri("radToDeg",ei.radToDeg),ui=ri("snap",ei.snap),pi=ri("clamp",ei.clamp),mi=ri("round",ei.round),fi=ri("lerp",ei.lerp,1),gi=ri("damp",ei.damp,1),yi=(t=0,e=1,s=0)=>{const i=10**s;return Math.floor((Math.random()*(e-t+1/i)+t)*i)/i};let vi=0;const _i=(t,e=0,s=1,i=0)=>{let r=void 0===t?vi++:t;return(t=e,n=s,o=i)=>{r+=1831565813,r=Math.imul(r^r>>>15,1|r),r^=r+Math.imul(r^r>>>7,61|r);const a=10**o;return Math.floor((((r^r>>>14)>>>0)/4294967296*(n-t+1/a)+t)*a)/a}},bi=t=>t[yi(0,t.length-1)],Ti=t=>{let e,s,i=t.length;for(;i;)s=yi(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},xi=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,a=!Y(o),l=a&&!Y(o.ease)?o.ease:a?Te(o):null,h=e.grid,d=e.axis,c=e.total,u=Y(r)||0===r||"first"===r,p="center"===r,f="last"===r,g="random"===r,y=V(t),v=e.use,_=J(y?t[0]:t),b=y?J(t[1]):0,T=E.exec((y?t[1]:t)+m),x=e.start||0+(y?_:0);let w=u?0:z(r)?r:0;return(t,r,o,a)=>{const[u]=ae(t),m=Y(c)?o:c,S=!Y(v)&&(X(v)?v(u,r,m):Nt(u,v)),$=z(S)||H(S)&&z(+S)?+S:r;if(p&&(w=(m-1)/2),f&&(w=m-1),!s.length){for(let t=0;t<m;t++){if(h){const e=p?(h[0]-1)/2:w%h[0],i=p?(h[1]-1)/2:ot(w/h[0]),r=e-t%h[0],n=i-ot(t/h[0]);let o=tt(r*r+n*n);"x"===d&&(o=-r),"y"===d&&(o=-n),s.push(o)}else s.push(it(w-t));i=lt(...s)}l&&(s=s.map(t=>l(t/i)*i)),n&&(s=s.map(t=>d?t<0?-1*t:-t:it(i-t))),g&&(s=Ti(s))}const E=y?(b-_)/i:_;let k=(a?ze(a,Y(e.start)?a.iterationDuration:x):x)+(E*mt(s[$],2)||0);return e.modifier&&(k=e.modifier(k)),T&&(k=`${k}${T[2]}`),k}};var wi=Object.freeze({__proto__:null,$:ae,clamp:pi,cleanInlineStyles:Mt,createSeededRandom:_i,damp:gi,degToRad:di,get:Me,keepTime:os,lerp:fi,mapRange:hi,padEnd:ai,padStart:oi,radToDeg:ci,random:yi,randomPick:bi,remove:Oe,round:mi,roundPad:ni,set:Ve,shuffle:Ti,snap:ui,stagger:xi,sync:ns,wrap:li});const Si=t=>{const e=oe(t)[0];return e&&U(e)?e:console.warn(`${t} is not a valid SVGGeometryElement`)},$i=(t,e,s,i,r)=>{const n=s+i,o=r?Math.max(0,Math.min(n,e)):(n%e+e)%e;return t.getPointAtLength(o)},Ei=(t,e,s=0)=>i=>{const r=+t.getTotalLength(),n=i[a],o=t.getCTM(),l=0===s;return{from:0,to:r,modifier:i=>{const a=i+s*r;if("a"===e){const e=$i(t,r,a,-1,l),s=$i(t,r,a,1,l);return 180*ht(s.y-e.y,s.x-e.x)/dt}{const s=$i(t,r,a,0,l);return"x"===e?n||!o?s.x:s.x*o.a+s.y*o.c+o.e:n||!o?s.y:s.x*o.b+s.y*o.d+o.f}}}},ki=(t,e=0)=>{const s=Si(t);if(s)return{translateX:Ei(s,"x",e),translateY:Ei(s,"y",e),rotate:Ei(s,"a",e)}},Ci=(t,e=0,s=0)=>oe(t).map(t=>((t,e,s)=>{const i=p,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let a=n;const l=new Proxy(t,{get(t,e){const s=t[e];return e===d?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],l=+s[1],h=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(tt(s.a*s.a+s.b*s.b)+tt(s.c*s.c+s.d*s.d))/2)}return e})(o),d=-1e3*r*h,c=l*i*h+d,u=i*h+(0===r&&1===l||1===r&&0===l?0:10*h)-c;if("butt"!==n){const e=r===l?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${d}`),t.setAttribute("stroke-dasharray",`${c} ${u}`)}return Reflect.apply(s,t,e)}:X(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),l.setAttribute("draw",`${e} ${s}`)),l})(t,e,s)),Ni=(t,e=.33)=>s=>{if(!(s.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${s.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const i=Si(t);if(!i)throw new Error("Can't morph to an invalid target. 'path2' must resolve to an existing <path>, <polygon> or <polyline> SVG element.");if(!(i.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${i.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const r="path"===s.tagName,n=r?" ":",",o=s[h];o&&s.setAttribute(r?"d":"points",o);let a="",l="";if(e){const t=s.getTotalLength(),o=i.getTotalLength(),h=Math.max(Math.ceil(t*e),Math.ceil(o*e));for(let e=0;e<h;e++){const d=e/(h-1),c=s.getPointAtLength(t*d),u=i.getPointAtLength(o*d),p=r?0===e?"M":"L":"";a+=p+mt(c.x,3)+n+c.y+" ",l+=p+mt(u.x,3)+n+u.y+" "}}else a=s.getAttribute(r?"d":"points"),l=i.getAttribute(r?"d":"points");return s[h]=l,[a,l]};var Di=Object.freeze({__proto__:null,createDrawable:Ci,createMotionPath:ki,morphTo:Ni});const Ii="undefined"!=typeof Intl&&Intl.Segmenter,Li=/\{value\}/g,Ai=/\{i\}/g,Ri=/(\s+)/,Bi=/^\s+$/,Pi="line",Fi="word",Mi="char",Vi="data-line";let Oi=null,zi=null,Hi=null;const Xi=t=>t.isWordLike||" "===t.segment||z(+t.segment),Yi=t=>t.setAttribute("aria-hidden","true"),Wi=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],Ui={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},qi=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&qi(e)}},ji=(t,e,s)=>{const i=t.getAttribute(Vi);if(null!==i&&+i!==e||"BR"===t.tagName){s.add(t);const e=t.previousSibling,i=t.nextSibling;e&&3===e.nodeType&&Bi.test(e.textContent)&&s.add(e),i&&3===i.nodeType&&Bi.test(i.textContent)&&s.add(i)}let r=t.childElementCount;for(;r--;)ji(t.children[r],e,s);return s},Gi=(t,e={})=>{let s="";const i=H(e.class)?` class="${e.class}"`:"",r=$t(e.clone,!1),n=$t(e.wrap,!1),o=n?!0===n?"clip":n:!!r&&"clip";return n&&(s+=`<span${o?` style="overflow:${o};"`:""}>`),s+=`<span${i}${r?' style="position:relative;"':""} data-${t}="{i}">`,r?(s+="<span>{value}</span>",s+=`<span inert style="position:absolute;top:${"top"===r?"-100%":"bottom"===r?"100%":"0"};left:${"left"===r?"-100%":"right"===r?"100%":"0"};white-space:nowrap;">{value}</span>`):s+="{value}",s+="</span>",n&&(s+="</span>"),s},Qi=(t,e,s,i,r,n,o,a,l)=>{const h=r===Pi,d=r===Mi,c=`_${r}_`,u=X(t)?t(s):t,p=h?"block":"inline-block";Hi.innerHTML=u.replace(Li,`<i class="${c}"></i>`).replace(Ai,`${d?l:h?o:a}`);const m=Hi.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,y=m.querySelectorAll(`i.${c}`),v=y.length;if(v){f.style.display=p,g.style.display=p,g.setAttribute(Vi,`${o}`),h||(g.setAttribute("data-word",`${a}`),d&&g.setAttribute("data-char",`${l}`));let t=v;for(;t--;){const e=y[t],i=e.parentElement;i.style.display=p,h?i.innerHTML=s.innerHTML:i.replaceChild(s.cloneNode(!0),e)}e.push(g),i.appendChild(m)}else console.warn('The expression "{value}" is missing from the provided template.');return n&&(f.style.outline=`1px dotted ${Ui[r]}`),f};class Zi{constructor(t,s={}){Oi||(Oi=Ii?new Ii([],{granularity:Fi}):{segment:t=>{const e=[],s=t.split(Ri);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!Bi.test(i)})}return e}}),zi||(zi=Ii?new Ii([],{granularity:"grapheme"}):{segment:t=>[...t].map(t=>({segment:t}))}),!Hi&&e&&(Hi=i.createElement("template")),L.current&&L.current.register(this);const{words:r,chars:n,lines:o,accessible:a,includeSpaces:l,debug:h}=s,d=(t=V(t)?t[0]:t)&&t.nodeType?t:(ne(t)||[])[0],c=!0===o?{}:o,u=!0===r||Y(r)?{}:r,p=!0===n?{}:n;this.debug=$t(h,!1),this.includeSpaces=$t(l,!1),this.accessible=$t(a,!0),this.linesOnly=c&&!u&&!p,this.lineTemplate=O(c)?Gi(Pi,c):c,this.wordTemplate=O(u)||this.linesOnly?Gi(Fi,u):u,this.charTemplate=O(p)?Gi(Mi,p):p,this.$target=d,this.html=d&&d.innerHTML,this.lines=[],this.words=[],this.chars=[],this.effects=[],this.effectsCleanups=[],this.cache=null,this.ready=!1,this.width=0,this.resizeTimeout=null;const m=()=>this.html&&(c||u||p)&&this.split();this.resizeObserver=new ResizeObserver(()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{const t=d.offsetWidth;t!==this.width&&(this.width=t,m())},150)}),this.lineTemplate&&!this.ready?i.fonts.ready.then(m):m(),d?this.resizeObserver.observe(d):console.warn("No Text Splitter target found.")}addEffect(t){if(!X(t))return console.warn("Effect must return a function.");const e=os(t);return this.effects.push(e),this.ready&&(this.effectsCleanups[this.effects.length-1]=e(this)),this}revert(){return clearTimeout(this.resizeTimeout),this.lines.length=this.words.length=this.chars.length=0,this.resizeObserver.disconnect(),this.effectsCleanups.forEach(t=>X(t)?t(this):t.revert&&t.revert()),this.$target.innerHTML=this.html,this}splitNode(t){const e=this.wordTemplate,s=this.charTemplate,r=this.includeSpaces,n=this.debug,o=t.nodeType;if(3===o){const o=t.nodeValue;if(o.trim()){const a=[],l=this.words,h=this.chars,d=Oi.segment(o),c=i.createDocumentFragment();let u=null;for(const t of d){const e=t.segment,s=Xi(t);if(!u||s&&u&&Xi(u))a.push(e);else{const t=a.length-1,s=a[t];Ri.test(s)||Ri.test(e)?a.push(e):a[t]+=e}u=t}for(let t=0,o=a.length;t<o;t++){const o=a[t];if(o.trim()){const d=a[t+1],u=r&&d&&!d.trim(),p=o,m=s?zi.segment(p):null,f=s?i.createDocumentFragment():i.createTextNode(u?o+" ":o);if(s){const t=[...m];for(let e=0,r=t.length;e<r;e++){const o=t[e],a=e===r-1&&u?o.segment+" ":o.segment,d=i.createTextNode(a);Qi(s,h,d,f,Mi,n,-1,l.length,h.length)}}e?Qi(e,l,f,c,Fi,n,-1,l.length,h.length):s?c.appendChild(f):c.appendChild(i.createTextNode(o)),u&&t++}else{if(t&&r)continue;c.appendChild(i.createTextNode(o))}}t.parentNode.replaceChild(c,t)}}else if(1===o){const e=[...t.childNodes];for(let t=0,s=e.length;t<s;t++)this.splitNode(e[t])}}split(t=!1){const e=this.$target,s=!!this.cache&&!t,r=this.lineTemplate,n=this.wordTemplate,o=this.charTemplate,a="loading"!==i.fonts.status,l=r&&a;this.ready=!r||a,(l||t)&&this.effectsCleanups.forEach(t=>X(t)&&t(this)),s||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),l&&(s&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=Wi(e,Fi))),o&&(l||n)&&(this.chars=Wi(e,Mi));const h=this.words.length?this.words:this.chars;let d,c=0;for(let t=0,e=h.length;t<e;t++){const e=h[t],{top:s,height:i}=e.getBoundingClientRect();!Y(d)&&s-d>.5*i&&c++,e.setAttribute(Vi,`${c}`);const r=e.querySelectorAll(`[${Vi}]`);let n=r.length;for(;n--;)r[n].setAttribute(Vi,`${c}`);d=s}if(l){const t=i.createDocumentFragment(),s=new Set,a=[];for(let t=0;t<c+1;t++){const i=e.cloneNode(!0);ji(i,t,new Set).forEach(t=>{const e=t.parentNode;e&&(1===t.nodeType&&s.add(e),e.removeChild(t))}),a.push(i)}s.forEach(qi);for(let e=0,s=a.length;e<s;e++)Qi(r,this.lines,a[e],t,Pi,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=Wi(e,Fi)),o&&(this.chars=Wi(e,Mi))}if(this.linesOnly){const t=this.words;let e=t.length;for(;e--;){const s=t[e];s.replaceWith(s.textContent)}t.length=0}if(this.accessible&&(l||!s)){const t=i.createElement("span");t.style.cssText="position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;",t.innerHTML=this.html,e.insertBefore(t,e.firstChild),this.lines.forEach(Yi),this.words.forEach(Yi),this.chars.forEach(Yi)}return this.width=e.offsetWidth,(l||t)&&this.effects.forEach((t,e)=>this.effectsCleanups[e]=t(this)),this}refresh(){this.split(!0)}}const Ji=(t,e)=>new Zi(t,e),Ki=(t,e)=>(console.warn("text.split() is deprecated, import splitText() directly, or text.splitText()"),new Zi(t,e));var tr=Object.freeze({__proto__:null,TextSplitter:Zi,split:Ki,splitText:Ji});t.$=ae,t.Animatable=Ue,t.AutoLayout=ti,t.Draggable=rs,t.JSAnimation=Re,t.Scope=as,t.ScrollObserver=gs,t.Spring=Qe,t.TextSplitter=Zi,t.Timeline=Ye,t.Timer=re,t.WAAPIAnimation=Ls,t.animate=(t,e)=>new Re(t,e,null,0,!1).init(),t.clamp=pi,t.cleanInlineStyles=Mt,t.createAnimatable=(t,e)=>new Ue(t,e),t.createDraggable=(t,e)=>new rs(t,e),t.createDrawable=Ci,t.createLayout=(t,e)=>new ti(t,e),t.createMotionPath=ki,t.createScope=t=>new as(t),t.createSeededRandom=_i,t.createSpring=Je,t.createTimeline=We,t.createTimer=t=>new re(t,null,0).init(),t.cubicBezier=vs,t.damp=gi,t.degToRad=di,t.eases=ye,t.easings=xs,t.engine=Yt,t.get=Me,t.irregular=Ts,t.keepTime=os,t.lerp=fi,t.linear=bs,t.mapRange=hi,t.morphTo=Ni,t.onScroll=(t={})=>new gs(t),t.padEnd=ai,t.padStart=oi,t.radToDeg=ci,t.random=yi,t.randomPick=bi,t.remove=Oe,t.round=mi,t.roundPad=ni,t.scrollContainers=hs,t.set=Ve,t.shuffle=Ti,t.snap=ui,t.split=Ki,t.splitText=Ji,t.spring=Ze,t.stagger=xi,t.steps=_s,t.svg=Di,t.sync=ns,t.text=tr,t.utils=wi,t.waapi=As,t.wrap=li});+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).anime={})}(this,function(t){"use strict";const e="undefined"!=typeof window,s=e?window:null,i=e?document:null,r={replace:0,none:1,blend:2},n=Symbol(),o=Symbol(),a=Symbol(),l=Symbol(),h=Symbol(),d=1e-11,c=1e12,u=1e3,p="",m=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),f=["perspective","translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY"],g=f.reduce((t,e)=>({...t,[e]:e+"("}),{}),y=()=>{},v=/\)\s*[-.\d]/,b=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,_=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,T=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,x=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,w=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,S=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,$=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,C=/([a-z])([A-Z])/g,E=/(\*=|\+=|-=)/,k=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,N={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:u,delay:0,loopDelay:0,ease:"out(2)",composition:r.replace,modifier:t=>t,onBegin:y,onBeforeUpdate:y,onUpdate:y,onLoop:y,onPause:y,onComplete:y,onRender:y},D={current:null,root:i},A={defaults:N,precision:4,timeScale:1,tickThreshold:200,editor:null},I={version:"4.4.0",engine:null};e&&(s.AnimeJS||(s.AnimeJS=[]),s.AnimeJS.push(I));const R=t=>t.replace(C,"$1-$2").toLowerCase(),L=(t,e)=>0===t.indexOf(e),B=Date.now,P=Array.isArray,F=t=>t&&t.constructor===Object,M=t=>"number"==typeof t&&!isNaN(t),V=t=>"string"==typeof t,O=t=>"function"==typeof t,z=t=>void 0===t,H=t=>z(t)||null===t,X=t=>e&&t instanceof SVGElement,Y=t=>b.test(t),W=t=>L(t,"rgb"),U=t=>L(t,"hsl"),q=t=>!A.defaults.hasOwnProperty(t),j=["opacity","rotate","overflow","color"],G=t=>V(t)?parseFloat(t):t,Z=Math.pow,Q=Math.sqrt,J=Math.sin,K=Math.cos,tt=Math.abs,et=Math.exp,st=Math.ceil,it=Math.floor,rt=Math.asin,nt=Math.max,ot=Math.atan2,at=Math.PI,lt=Math.round,ht=(t,e,s)=>t<e?e:t>s?s:t,dt=(t,e)=>{if(e<0)return t;if(!e)return lt(t);const s=10**e;return lt(t*s)/s},ct=(t,e)=>P(e)?e.reduce((e,s)=>tt(s-t)<tt(e-t)?s:e):e?lt(t/e)*e:t,ut=(t,e,s)=>t+(e-t)*s,pt=t=>t===1/0?c:t===-1/0?-c:t,mt=t=>t<=d?d:pt(dt(t,11)),ft=t=>P(t)?[...t]:t,gt=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=z(r)?e[i]:r}return s},yt=(t,e,s,i="_prev",r="_next")=>{let n=t._head,o=r;for(s&&(n=t._tail,o=i);n;){const t=n[o];e(n),n=t}},vt=(t,e,s="_prev",i="_next")=>{const r=e[s],n=e[i];r?r[i]=n:t._head=n,n?n[s]=r:t._tail=r,e[s]=null,e[i]=null},bt=(t,e,s,i="_prev",r="_next")=>{let n=t._tail;for(;n&&s&&s(n,e);)n=n[i];const o=n?n[r]:t._head;n?n[r]=e:t._head=e,o?o[i]=e:t._tail=e,e[i]=n,e[r]=o},_t=t=>{let e=p;for(let s=0,i=f.length;s<i;s++){const i=f[s],r=t[i];if(void 0!==r){if("translateX"===i){const i=t.translateY;if(void 0!==i){const n=t.translateZ;void 0!==n?(e+=`translate3d(${r},${i},${n}) `,s+=2):(e+=`translate(${r},${i}) `,s+=1);continue}}if("scaleX"===i&&void 0===t.scale){const i=t.scaleY;if(void 0!==i){const n=t.scaleZ;void 0!==n?(e+=`scale3d(${r},${i},${n}) `,s+=2):(e+=`scale(${r},${i}) `,s+=1);continue}}e+=`${g[i]}${r}) `}"rotateZ"===i&&void 0!==t.rotate3d&&(e+=`rotate3d(${t.rotate3d}) `)}return void 0!==t.matrix&&(e+=`matrix(${t.matrix}) `),void 0!==t.matrix3d&&(e+=`matrix3d(${t.matrix3d}) `),e},Tt=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t),xt=(t,e)=>z(t)?e:t,wt=(t,e,s,i,r,n)=>{let o;if(O(t))o=()=>{const r=t(e,s,i,n);return isNaN(+r)?r||0:+r};else{if(!V(t)||!L(t,"var("))return t;o=()=>{const s=t.match(k),i=s[1],r=s[2];let n=getComputedStyle(e)?.getPropertyValue(i);return n&&n.trim()!==p||!r||(n=r.trim()),n||0}}return r&&(r.func=o),o()},St=(t,e)=>t[o]?t[a]&&((t,e)=>{if(j.includes(e))return!1;if(t.getAttribute(e)||e in t){if("scale"===e){const e=t.parentNode;return e&&"filter"===e.tagName}return!0}})(t,e)?1:f.includes(e)||m.get(e)?3:L(e,"--")?4:e in t.style?2:e in t?0:1:0,$t=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[h]||t).getPropertyValue(e);return"auto"===r?"0":r},Ct=(t,e,s,i)=>{const r=z(s)?St(t,e):s;if(0===r){const s=t[e];return s&&i&&(i[e]=s),s||0}if(1===r){const s=t.getAttribute(e);return s&&i&&(i[e]=s),s}return 3===r?((t,e,s)=>{const i=t.style.transform;if(i){const r=t[l];let n=0;const o=i.length;let a;for(;n<o;){for(;n<o&&32===i.charCodeAt(n);)n++;if(n>=o)break;const t=n;for(;n<o&&40!==i.charCodeAt(n);)n++;if(n>=o)break;const e=i.substring(t,n);let s=1;const l=n+1;let h=-1,d=-1;for(n++;n<o&&s>0;){const t=i.charCodeAt(n);40===t?s++:41===t?s--:44===t&&1===s&&(-1===h?h=n:-1===d&&(d=n)),n++}const c=n-1;"translate"===e||"translate3d"===e?(-1===h?r.translateX=i.substring(l,c).trim():(r.translateX=i.substring(l,h).trim(),-1===d?r.translateY=i.substring(h+1,c).trim():(r.translateY=i.substring(h+1,d).trim(),r.translateZ=i.substring(d+1,c).trim())),a=i.substring(l,c)):"scale"===e||"scale3d"===e?-1===h?r.scale=i.substring(l,c).trim():(r.scaleX=i.substring(l,h).trim(),-1===d?r.scaleY=i.substring(h+1,c).trim():(r.scaleY=i.substring(h+1,d).trim(),r.scaleZ=i.substring(d+1,c).trim())):r[e]=i.substring(l,c)}if("translate3d"===e&&a)return s&&(s[e]=a),a;const h=r[e];if(!z(h))return s&&(s[e]=h),h}return"translate3d"===e?"0px, 0px, 0px":"rotate3d"===e?"0, 0, 0, 0deg":L(e,"scale")?"1":L(e,"rotate")||L(e,"skew")?"0deg":"0px"})(t,e,i):4===r?$t(t,e,i).trimStart():$t(t,e,i)},Et=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,kt=(t,e)=>{if(e.t=0,e.n=0,e.u=null,e.o=null,e.d=null,e.s=null,!t)return e;const s=+t;if(isNaN(s)){let s=t;"="===s[1]&&(e.o=s[0],s=s.slice(2));const n=!s.includes(" ")&&$.exec(s);if(n)return e.t=1,e.n=+n[1],e.u=n[2],e;if(e.o)return e.n=+s,e;if(Y(r=s)||(W(r)||U(r))&&(")"===r[r.length-1]||!v.test(r)))return e.t=2,e.d=W(i=s)?(t=>{const e=_.exec(t)||T.exec(t),s=z(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):Y(i)?(t=>{const e=t.length,s=4===e||5===e;return[+("0x"+t[1]+t[s?1:2]),+("0x"+t[s?2:3]+t[s?2:4]),+("0x"+t[s?3:5]+t[s?3:6]),5===e||9===e?+(+("0x"+t[s?4:7]+t[s?4:8])/255).toFixed(3):1]})(i):U(i)?(t=>{const e=x.exec(t)||w.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=z(e[4])?1:+e[4];let o,a,l;if(0===i)o=a=l=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=dt(255*Tt(e,t,s+1/3),0),a=dt(255*Tt(e,t,s),0),l=dt(255*Tt(e,t,s-1/3),0)}return[o,a,l,n]})(i):[0,0,0,1],e;{const t=s.match(S);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(S)||[],e}}var i,r;return e.n=s,e},Nt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=ft(t._toNumbers),e.s=ft(t._strings),e),Dt={t:0,n:0,u:null,o:null,d:null,s:null},At=(t,e,s)=>{const i=t._modifier,n=t._fromNumbers,o=t._toNumbers,a=dt(ht(i(ut(n[0],o[0],e)),0,255),0),l=dt(ht(i(ut(n[1],o[1],e)),0,255),0),h=dt(ht(i(ut(n[2],o[2],e)),0,255),0),d=ht(i(dt(ut(n[3],o[3],e),s)),0,1);if(t._composition!==r.none){const e=t._numbers;e[0]=a,e[1]=l,e[2]=h,e[3]=d}return`rgba(${a},${l},${h},${d})`},It=(t,e,s)=>{const i=t._modifier,n=t._fromNumbers,o=t._toNumbers,a=t._strings,l=t._composition!==r.none;let h=a[0];for(let r=0,d=o.length;r<d;r++){const d=i(dt(ut(n[r],o[r],e),s)),c=a[r+1];h+=`${c?d+c:d}`,l&&(t._numbers[r]=d)}return h},Rt=(t,e,s,i,n)=>{const o=t.parent,a=t.duration,h=t.completed,c=t.iterationDuration,u=t.iterationCount,p=t._currentIteration,m=t._loopDelay,f=t._reversed,g=t._alternate,y=t._hasChildren,v=t._delay,b=t._currentTime,_=v+c,T=e-v,x=ht(b,-v,a),w=ht(T,-v,a),S=T-b,$=w>0,C=w>=a,E=a<=d,k=2===n;let N=0,D=T,I=0;if(u>1){const e=~~(w/(c+(C?0:m)));t._currentIteration=ht(e,0,u),C&&t._currentIteration--,N=t._currentIteration%2,D=w%(c+m)||0}const R=f^(g&&N),L=t._ease;let B=C?R?0:a:R?c-D:D;L&&(B=c*L(B/c)||0);const P=(o?o.backwards:T<b)?!R:!!R;if(t._currentTime=T,t._iterationTime=B,t.backwards=P,$&&!t.began?(t.began=!0,s||o&&(P||!o.began)||t.onBegin(t)):T<=0&&(t.began=!1),s||y||!$||t._currentIteration===p||t.onLoop(t),k||1===n&&(e>=v&&e<=_||e<=v&&x>v||e>=_&&x!==a)||B>=_&&x!==a||B<=v&&x>0||e<=x&&x===a&&h||C&&!h&&E){if($&&(t.computeDeltaTime(x),s||t.onBeforeUpdate(t)),!y){const e=k||(P?-1*S:S)>=A.tickThreshold,n=t._offset+(o?o._offset:0)+v+B;let a,h,d,c,u=t._head,p=0;for(;u;){const t=u._composition,s=u._currentTime,o=u._changeDuration,m=u._absoluteStartTime+u._changeDuration,f=u._nextRep,g=u._prevRep,y=t!==r.none;if((e||(s!==o||n<=m+(f?f._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!y||!u._isOverridden&&(!u._isOverlapped||n<=m)&&(!f||f._isOverridden||n<=f._absoluteStartTime)&&(!g||g._isOverridden||n>=g._absoluteStartTime+g._changeDuration+u._delay))){const e=u._currentTime=ht(B-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,m=u._valueType,f=u._tweenType,g=0===f,v=0===m,b=v&&g||0===s||1===s?-1:A.precision;let _,T;if(v?_=T=n(dt(ut(u._fromNumber,u._toNumber,s),b)):1===m?(T=n(dt(ut(u._fromNumber,u._toNumber,s),b)),_=`${T}${u._unit}`):2===m?_=At(u,s,b):3===m&&(_=It(u,s,b)),y&&(u._number=T),i||t===r.blend)u._value=_;else{const t=u.property;a=u.target,g?a[t]=_:1===f?a.setAttribute(t,_):(h=a.style,3===f?(a!==d&&(d=a,c=a[l]),c[t]=_,p=1):2===f?h[t]=_:4===f&&h.setProperty(t,_)),$&&(I=1)}}p&&u._renderTransforms&&(h.transform=_t(c),p=0),u=u._next}!s&&I&&t.onRender(t)}!s&&$&&t.onUpdate(t)}return o&&E?!s&&(o.began&&!P&&T>0&&!h||P&&T<=d&&h)&&(t.onComplete(t),t.completed=!P):$&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,h||y||(t.completed=!0,s||o&&(P||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,I};let Lt=0,Bt=0,Pt=0,Ft=0,Mt=0,Vt=0,Ot=0,zt=!0,Ht=!1,Xt=0,Yt=0;const Wt=t=>{if(Ht){const e=t.duration,s=t._offset+t._delay;Yt||!(e<=d)||s&&s+e!==Xt||t.onComplete(t)}else!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&Rt(t,Xt,Yt,1,2),t.began=!1,t.completed=!1},Ut=t=>{const e=dt((Lt-t._offset)*t._speed,12),s=t._fps<Bt?t.requestTick(Pt):Ft;Ot+=Rt(t,e,Mt,Vt,s),!t.completed&&zt&&(zt=!1)},qt=(t,e,s,i,r)=>{const n=t._currentIteration;if(Rt(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,l=i?e:o._iterationTime,h=B();let d=0,c=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;Ht=a,Xt=t,Yt=s,yt(o,Wt),s||o.onLoop(o)}Lt=l,Bt=o._fps,Pt=h,Ft=r,Mt=s,Vt=i,Ot=0,zt=!0,yt(o,Ut,a),d=Ot,c=zt,!s&&d&&o.onRender(o),(c||a)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},jt={},Gt=(t,e,s)=>{if(3===s)return m.get(t)||t;if(2===s||1===s&&X(e)&&t in e.style){const e=jt[t];if(e)return e;{const e=t?R(t):t;return jt[t]=e,e}}return t},Zt=(t,e=!1)=>{if(t._hasChildren)yt(t,t=>Zt(t,e),!0);else{const s=t;s.pause(),yt(s,t=>{const i=t.property,r=t.target,n=t._tweenType,a=t._inlineValue,h=H(a)||a===p;if(0===n)e||h||(r[i]=a);else if(r[o])if(1===n)e||(h?r.removeAttribute(i):r.setAttribute(i,a));else{const e=r.style;if(3===n){const s=r[l];h?delete s[i]:s[i]=a,t._renderTransforms&&(Object.keys(s).length?e.transform=_t(s):e.removeProperty("transform"))}else h?e.removeProperty(R(i)):e[i]=a}r[o]&&s._tail===t&&s.targets.forEach(t=>{t.getAttribute&&t.getAttribute("style")===p&&t.removeAttribute("style")})})}return t},Qt=t=>Zt(t,!0);class Jt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._lastTickTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=u/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(t){const e=this._frameDuration,s=+t,i=s<d?d:s,r=u/i;i>N.frameRate&&(N.frameRate=i),this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<d?d:e}requestTick(t){const e=this._scheduledTime;if(this._lastTickTime=t,t<e)return 0;const s=this._frameDuration,i=t-e;return this._scheduledTime+=i<s?s:i,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const Kt={animation:null,update:y},te=(()=>e?requestAnimationFrame:setImmediate)(),ee=(()=>e?cancelAnimationFrame:clearImmediate)();class se extends Jt{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=N,this.paused=!0,this.reqId=0}update(){const t=this._currentTime=B();if(this.requestTick(t)){this.computeDeltaTime(t);const e=this._speed,s=this._fps;let i=this._head;for(;i;){const r=i._next;i.paused?(vt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):qt(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}Kt.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(B()),this.reqId=te(re)),this}pause(){if(this.reqId)return this.paused=!0,ne()}resume(){if(this.paused)return this.paused=!1,yt(this,t=>t.resetTime()),this.wake()}get speed(){return this._speed*(1===A.timeScale?1:u)}set speed(t){this._speed=t*A.timeScale,yt(this,t=>t.speed=t._speed)}get timeUnit(){return 1===A.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(A.timeScale!==s){A.timeScale=s,A.tickThreshold=200*s;const t=e?.001:u;this.defaults.duration*=t,this._speed*=t}}get precision(){return A.precision}set precision(t){A.precision=t}}const ie=(()=>{const t=new se(B());return e&&(I.engine=t,i.addEventListener("visibilitychange",()=>{t.pauseOnDocumentHidden&&(i.hidden?t.pause():t.resume())})),t})(),re=()=>{ie._head?(ie.reqId=te(re),ie.update()):ie.reqId=0},ne=()=>(ee(ie.reqId),ie.reqId=0,ie),oe={_rep:new WeakMap,_add:new Map},ae=(t,e,s="_rep")=>{const i=oe[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},le=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,he=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=d,t._currentTime=d},de=(t,e)=>{const s=t._composition;if(s===r.replace){const s=t._absoluteStartTime;bt(e,t,le,"_prevRep","_nextRep");const i=t._prevRep;if(i){const e=i.parent,r=i._absoluteStartTime+i._changeDuration;if(t.parent.id!==e.id&&e.iterationCount>1&&r+(e.duration-e.iterationDuration)>s){he(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)he(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration),s=dt(n-e-t,12);i._changeDuration=s,i._currentTime=s,i._isOverlapped=1,s<d&&he(i)}let o=!0;if(yt(e,t=>{t._isOverlapped||(o=!1)}),o){const t=e.parent;if(t){let s=!0;yt(t,t=>{t!==e&&yt(t,t=>{t._isOverlapped||(s=!1)})}),s&&t.cancel()}else e.cancel()}}}else if(s===r.blend){const e=ae(t.target,t.property,"_add"),s=(t=>{let e=Kt.animation;return e||(e={duration:d,computeDeltaTime:y,_offset:0,_delay:0,_head:null,_tail:null},Kt.animation=e,Kt.update=()=>{t.forEach(t=>{for(let e in t){const s=t[e],i=s._head;if(i){const t=i._valueType,e=3===t||2===t?ft(i._fromNumbers):null;let r=i._fromNumber,n=s._tail;for(;n&&n!==i;){if(e)for(let t=0,s=n._numbers.length;t<s;t++)e[t]+=n._numbers[t];else r+=n._number;n=n._prevAdd}i._toNumber=r,i._toNumbers=e}}}),Rt(e,1,1,0,2)}),e})(oe._add);let i=e._head;i||(i={...t},i._composition=r.replace,i._updateDuration=d,i._startTime=0,i._numbers=ft(t._fromNumbers),i._number=0,i._next=null,i._prev=null,bt(e,i),bt(s,i));const n=t._toNumber;if(t._fromNumber=i._fromNumber-n,t._toNumber=0,t._numbers=ft(t._fromNumbers),t._number=0,i._fromNumber=n,t._toNumbers){const e=ft(t._toNumbers);e&&e.forEach((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0}),i._fromNumbers=e}bt(e,t,null,"_prevAdd","_nextAdd")}return t},ce=t=>{const e=t._composition;if(e!==r.none){const s=t.target,i=t.property,n=oe._rep.get(s)[i];if(vt(n,t,"_prevRep","_nextRep"),e===r.blend){const e=oe._add,r=e.get(s);if(!r)return;const n=r[i],o=Kt.animation;vt(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){vt(n,a,"_prevAdd","_nextAdd"),vt(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},ue=(t,e,s)=>{let i=!1;return yt(e,r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,a=Gt(s,n,o);(!a||a&&a===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),vt(e,r),ce(r),i=!0)}},!0),i},pe=(t,e,s)=>{const i=e||ie;let r;if(i._hasChildren){let e=0;yt(i,n=>{if(!n._hasChildren)if(r=ue(t,n,s),r&&!n._head)n.cancel(),vt(i,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?pe(t,n,s):n._hasChildren=!1},!0),z(i.iterationDuration)||(i.iterationDuration=e)}else r=ue(t,i,s);r&&!i._head&&(i._hasChildren=!1,i.cancel&&i.cancel())},me=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),fe=t=>t._cancelled?(t._hasChildren?yt(t,fe):yt(t,t=>{t._composition!==r.none&&de(t,ae(t.target,t.property))}),t._cancelled=0,t):t;let ge=0;const ye=(t,e)=>t._priority>e._priority;class ve extends Jt{constructor(t={},e=null,s=0){super(0),++ge;const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:l,loopDelay:h,autoplay:c,frameRate:u,playbackRate:p,priority:m,onComplete:f,onLoop:g,onPause:v,onBegin:b,onBeforeUpdate:_,onUpdate:T}=t;D.current&&D.current.register(this);const x=e?0:ie._lastTickTime,w=e?e.defaults:A.defaults,S=O(r)||z(r)?w.delay:+r,$=O(n)||z(n)?1/0:+n,C=xt(l,w.loop),E=xt(h,w.loopDelay);let k=!0===C||C===1/0||C<0?1/0:C+1,N=0;e?N=s:(ie.reqId||ie.requestTick(B()),N=(ie._lastTickTime-ie._startTime)*A.timeScale),this.id=z(i)?ge:i,this.parent=e,this.duration=pt(($+E)*k-E)||d,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=b||w.onBegin,this.onBeforeUpdate=_||w.onBeforeUpdate,this.onUpdate=T||w.onUpdate,this.onLoop=g||w.onLoop,this.onPause=v||w.onPause,this.onComplete=f||w.onComplete,this.iterationDuration=$,this.iterationCount=k,this._autoplay=!e&&xt(c,w.autoplay),this._offset=N,this._delay=S,this._loopDelay=E,this._iterationTime=0,this._currentIteration=0,this._resolve=y,this._running=!1,this._reversed=+xt(o,w.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=xt(a,w.alternate),this._prev=null,this._next=null,this._lastTickTime=x,this._startTime=x,this._lastTime=x,this._fps=xt(u,w.frameRate),this._speed=xt(p,w.playbackRate),this._priority=+xt(m,1)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(!0).play()}get currentTime(){return ht(dt(this._currentTime,A.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return ht(dt(this._iterationTime,A.precision),0,this.iterationDuration)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return ht(dt(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return ht(dt(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(t){const e=this.iterationDuration;this.currentTime=e*this._currentIteration+e*t}get currentIteration(){return this._currentIteration}set currentIteration(t){this.currentTime=this.iterationDuration*ht(+t,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(t){t?this.reverse():this.play()}get speed(){return super.speed}set speed(t){super.speed=t,this.resetTime()}reset(t=!1){return fe(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,qt(this,0,1,~~t,2),me(this),this._hasChildren&&yt(this,me),this}init(t=!1){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&qt(this,this.duration,1,~~t,2),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!z(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*ie._speed);return this._startTime=B()-(this._currentTime+this._delay)*t,this}pause(){return this.paused||(this.paused=!0,this.onPause(this)),this}resume(){return this.paused?(this.paused=!1,this.duration<=d&&!this._hasChildren?qt(this,d,0,0,2):(this._running||(bt(ie,this,ye),ie._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,ie.wake()),this):this}restart(){return this.reset().resume()}seek(t,e=0,s=0){fe(this),this.completed=!1;const i=this.paused;return this.paused=!0,qt(this,t+this._delay,~~e,~~s,1),i?this:this.resume()}alternate(){const t=this._reversed,e=this.iterationCount,s=this.iterationDuration,i=e===1/0?it(c/s):e;return this._reversed=+(!this._alternate||i%2?!t:t),e===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(s*i-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?yt(this,t=>t.cancel(),!0):yt(this,ce),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=mt(t);if(e===s)return this;const i=t/e,r=t<=d;return this.duration=r?d:s,this.iterationDuration=r?d:mt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){qt(this,0,1,0,1);const t=this._autoplay;return t&&t.linked&&t.linked===this&&t.revert(),this.cancel()}complete(t=0){return this.seek(this.duration,t).cancel()}then(t=y){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=y};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}function be(t){const e=V(t)?D.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function _e(t){if(H(t))return[];if(!e)return P(t)&&t.flat(1/0)||[t];if(P(t)){const e=t.flat(1/0),s=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!H(i)){const t=be(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!H(i)){let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}else{let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}}return s}const s=be(t);return s?Array.from(s):[t]}function Te(t){const e=_e(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[n]){s[n]=!0;const t=X(s);(s.nodeType||t)&&(s[o]=!0,s[a]=t,s[l]={})}}return e}const xe={deg:1,rad:180/at,turn:360},we={},Se=(t,e,s,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===s)return e;const a=o+n+s,l=we[a];if(z(l)||r){let r;if(n in xe)r=o*xe[n]/xe[s];else{const e=100,a=t.cloneNode(),l=t.parentNode,h=l&&l!==i?l:i.body;h.appendChild(a);const d=a.style;d.width=e+n;const c=a.offsetWidth||e;d.width=e+s;const u=c/(a.offsetWidth||e);h.removeChild(a),r=u*o}e.n=r,we[a]=r}else e.n=l;return e.t,e.u=s,e},$e=t=>t,Ce=(t=1.68)=>e=>Z(e,+t),Ee={in:t=>e=>t(e),out:t=>e=>1-t(1-e),inOut:t=>e=>e<.5?t(2*e)/2:1-t(-2*e+2)/2,outIn:t=>e=>e<.5?(1-t(1-2*e))/2:(t(2*e-1)+1)/2},ke=at/2,Ne=2*at,De={[p]:Ce,Quad:Ce(2),Cubic:Ce(3),Quart:Ce(4),Quint:Ce(5),Sine:t=>1-K(t*ke),Circ:t=>1-Q(1-t*t),Expo:t=>t?Z(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=Z(2,--s))-1)/11;);return 1/Z(4,3-s)-7.5625*Z((3*e-2)/22-t,2)},Back:(t=1.7)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=ht(+t,1,10),i=ht(+e,d,2),r=i/Ne*rt(1/s),n=Ne/i;return t=>0===t||1===t?t:-s*Z(2,-10*(1-t))*J((1-t-r)*n)}},Ae=(()=>{const t={linear:$e,none:$e};for(let e in Ee)for(let s in De){const i=De[s],r=Ee[e];t[e+s]=s===p||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),Ie={linear:$e,none:$e},Re=t=>{if(Ie[t])return Ie[t];if(t.indexOf("(")<=-1){const e=Ee[t]||t.includes("Back")||t.includes("Elastic")?Ae[t]():Ae[t];return e?Ie[t]=e:$e}{const e=t.slice(0,-1).split("("),s=Ae[e[0]];return s?Ie[t]=s(...e[1].split(",")):$e}},Le=["steps(","irregular(","linear(","cubicBezier("],Be=t=>{if(V(t))for(let e=0,s=Le.length;e<s;e++)if(L(t,Le[e]))return console.warn(`String syntax for \`ease: "${t}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${t}\``),$e;return O(t)?t:V(t)?Re(t):$e},Pe={t:0,n:0,u:null,o:null,d:null,s:null},Fe={t:0,n:0,u:null,o:null,d:null,s:null},Me={},Ve={func:null},Oe={func:null},ze=[null],He=[null,null],Xe={to:null};let Ye,We,Ue=0,qe=0;class je extends ve{constructor(t,e,s,i,n=!1,o=0,a){super(e,s,i),++qe;const l=Te(t),h=l.length,c=e.keyframes,p=c?gt(((t,e)=>{const s={};if(P(t)){const e=[].concat(...t.map(t=>Object.keys(t))).filter(q);for(let i=0,r=e.length;i<r;i++){const r=e[i],n=t.map(t=>{const e={};for(let s in t){const i=t[s];q(s)?s===r&&(e.to=i):e[s]=i}return e});s[r]=n}}else{const i=xt(e.duration,A.defaults.duration),r=Object.keys(t).map(e=>({o:parseFloat(e)/100,p:t[e]})).sort((t,e)=>t.o-e.o);r.forEach(t=>{const e=t.o,r=t.p;for(let t in r)if(q(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let a=n.length,l=n[a-1];const h={to:r[t]};let d=0;for(let t=0;t<a;t++)d+=n[t].duration;1===a&&(h.from=l.to),r.ease&&(h.ease=r.ease),h.duration=o-(a?d:0),n.push(h)}return t});for(let t in s){const e=s[t];let i;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.ease;s.ease=i||void 0,i=r}e[0].duration||e.shift()}}return s})(c,e),e):e,{id:m,delay:f,duration:g,ease:y,playbackEase:v,modifier:b,composition:_,onRender:T}=p,x=s?s.defaults:A.defaults,w=xt(y,x.ease),S=xt(v,x.playbackEase),$=S?Be(S):null,C=!z(w.ease),E=C?w.ease:xt(y,$?"linear":x.ease),k=C?w.settlingDuration:xt(g,x.duration),N=xt(f,x.delay),D=b||x.modifier,I=z(_)&&h>=u?r.none:z(_)?x.composition:_,R=this._offset+(s?s._offset:0);C&&(w.parent=this);let L=NaN,B=NaN,X=0,Y=0;for(let t=0;t<h;t++){const e=l[t],i=o||t,h=a||l;let c=NaN,u=NaN;for(let t in p)if(q(t)){const o=St(e,t),a=Gt(t,e,o);let l=p[t];const m=P(l);if(n&&!m&&(He[0]=l,He[1]=l,l=He),m){const t=l.length,e=!F(l[0]);2===t&&e?(Xe.to=l,ze[0]=Xe,Ye=ze):t>2&&e?(Ye=[],l.forEach((t,e)=>{e?1===e?(He[1]=t,Ye.push(He)):Ye.push(t):He[0]=t})):Ye=l}else ze[0]=l,Ye=ze;let f=null,g=null,y=NaN,v=0,b=0;for(let t=Ye.length;b<t;b++){const n=Ye[b];F(n)?We=n:(Xe.to=n,We=Xe),Ve.func=null,Oe.func=null;const l=wt(xt(We.composition,I),e,i,h,null,null),c=M(l)?l:r[l];f||c===r.none||(f=ae(e,a));const u=f?f._tail:null,p=s&&u&&u.parent.parent===s?u:g,m=wt(We.to,e,i,h,Ve,p);let _;F(m)&&!z(m.to)?(We=m,_=m.to):_=m;const T=wt(We.from,e,i,h,null,p),x=We.ease||E,w=wt(x,e,i,h,null,p),S=O(w)||V(w)?w:x,$=!z(S)&&!z(S.ease),C=$?S.ease:S,A=$?S.settlingDuration:wt(xt(We.duration,t>1?wt(k,e,i,h,null,p)/t:k),e,i,h,null,p),L=wt(xt(We.delay,b?0:N),e,i,h,null,p),B=We.modifier||D,W=!z(T),U=!z(_),q=P(_),j=q||W&&U,G=g?v+L:L,Z=dt(R+G,12);Y||!W&&!q||(Y=1);let Q=g;if(c!==r.none){let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=Z;)if(Q=t,t=t._nextRep,t&&t._absoluteStartTime>=Z)for(;t;)he(t),t=t._nextRep}if(j){kt(q?wt(_[0],e,i,h,Oe,p):T,Pe),kt(q?wt(_[1],e,i,h,Ve,p):_,Fe);const t=Ct(e,a,o,Me);0===Pe.t&&(Q?1===Q._valueType&&(Pe.t=1,Pe.u=Q._unit):(kt(t,Dt),1===Dt.t&&(Pe.t=1,Pe.u=Dt.u)))}else U?kt(_,Fe):g?Nt(g,Fe):kt(s&&Q&&Q.parent.parent===s?Q._value:Ct(e,a,o,Me),Fe),W?kt(T,Pe):g?Nt(g,Pe):kt(s&&Q&&Q.parent.parent===s?Q._value:Ct(e,a,o,Me),Pe);if(Pe.o&&(Pe.n=Et(Q?Q._toNumber:kt(Ct(e,a,o,Me),Dt).n,Pe.n,Pe.o)),Fe.o&&(Fe.n=Et(Pe.n,Fe.n,Fe.o)),Pe.t!==Fe.t)if(3===Pe.t||3===Fe.t){const t=3===Pe.t?Pe:Fe,e=3===Pe.t?Fe:Pe;e.t=3,e.s=ft(t.s),e.d=t.d.map(()=>e.n)}else if(1===Pe.t||1===Fe.t){const t=1===Pe.t?Pe:Fe,e=1===Pe.t?Fe:Pe;e.t=1,e.u=t.u}else if(2===Pe.t||2===Fe.t){const t=2===Pe.t?Pe:Fe,e=2===Pe.t?Fe:Pe;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(Pe.u!==Fe.u){let t=Fe.u?Pe:Fe;t=Se(e,t,Fe.u?Fe.u:Pe.u,!1)}if(Fe.d&&Pe.d&&Fe.d.length!==Pe.d.length){const t=Pe.d.length>Fe.d.length?Pe:Fe,e=t===Pe?Fe:Pe;e.d=t.d.map((t,s)=>z(e.d[s])?0:e.d[s]),e.s=ft(t.s)}const J=dt(+A||d,12);let K=Me[a];H(K)||(Me[a]=null);const tt={parent:this,id:Ue++,property:a,target:e,_value:null,_toFunc:Ve.func,_fromFunc:Oe.func,_ease:Be(C),_fromNumbers:ft(Pe.d),_toNumbers:ft(Fe.d),_strings:ft(Fe.s),_fromNumber:Pe.n,_toNumber:Fe.n,_numbers:ft(Pe.d),_number:Pe.n,_unit:Fe.u,_modifier:B,_currentTime:0,_startTime:G,_delay:+L,_updateDuration:J,_changeDuration:J,_absoluteStartTime:Z,_tweenType:o,_valueType:Fe.t,_composition:c,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:K,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};c!==r.none&&de(tt,f);const et=tt._valueType;tt._value=3===et?It(tt,1,-1):2===et?At(tt,1,-1):1===et?`${B(tt._toNumber)}${tt._unit}`:B(tt._toNumber),isNaN(y)&&(y=tt._startTime),v=dt(G+J,12),g=tt,X++,bt(this,tt)}(isNaN(B)||y<B)&&(B=y),(isNaN(L)||v>L)&&(L=v),3===o&&(c=X-b,u=X)}if(!isNaN(c)){let t=0;yt(this,e=>{t>=c&&t<u&&(e._renderTransforms=1,e._composition===r.blend&&yt(Kt.animation,t=>{t.id===e.id&&(t._renderTransforms=1)})),t++})}}h||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),B?(yt(this,t=>{t._startTime-t._delay||(t._delay-=B),t._startTime-=B}),L-=B):B=0,L||(L=d,this.iterationCount=0),this.targets=l,this.id=z(m)?qe:m,this.duration=L===d?d:pt((L+this._loopDelay)*this.iterationCount-this._loopDelay)||d,this.onRender=T||x.onRender,this._ease=$,this._delay=B,this.iterationDuration=L,!this._autoplay&&Y&&this.onRender(this)}stretch(t){const e=this.duration;if(e===mt(t))return this;const s=t/e;return yt(this,t=>{t._updateDuration=mt(t._updateDuration*s),t._changeDuration=mt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s}),super.stretch(t)}refresh(){return yt(this,t=>{const e=t._toFunc,s=t._fromFunc;(e||s)&&(s?(kt(s(),Pe),Pe.u!==t._unit&&t.target[o]&&Se(t.target,Pe,t._unit,!0),t._fromNumbers=ft(Pe.d),t._fromNumber=Pe.n):e&&(kt(Ct(t.target,t.property,t._tweenType),Dt),t._fromNumbers=ft(Dt.d),t._fromNumber=Dt.n),e&&(kt(e(),Fe),t._toNumbers=ft(Fe.d),t._strings=ft(Fe.s),t._toNumber=Fe.o?Et(t._fromNumber,Fe.n,Fe.o):Fe.n))}),this.duration===d&&this.restart(),this}revert(){return super.revert(),Zt(this)}then(t){return super.then(t)}}const Ge=(t,e)=>{let s=t.iterationDuration;if(s===d&&(s=0),z(e))return s;if(M(+e))return+e;const i=e,r=t?t.labels:null,n=!H(r),o=((t,e)=>{if(L(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),a=!z(o),l=E.exec(i);if(l){const t=l[0],e=i.split(t),h=n&&e[0]?r[e[0]]:s,d=a?o:n?h:s,c=+e[1];return Et(d,c,t[0])}return a?o:n?z(r[i])?s:r[i]:s};function Ze(t,e,s,i,r,n){const o=M(t.duration)&&t.duration<=d?s-d:s;e.composition&&qt(e,o,1,1,1);const a=i?new je(i,t,e,o,!1,r,n):new ve(t,e,o);return e.composition&&a.init(!0),bt(e,a),yt(e,t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)}),e.duration=function(t){return pt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||d}(e),e}let Qe=0;class Je extends ve{constructor(t={}){super(t,null,0),++Qe,this.id=z(t.id)?Qe:t.id,this.duration=0,this.labels={};const e=t.defaults,s=A.defaults;this.defaults=e?gt(e,s):s,this.composition=xt(t.composition,!0),this.onRender=t.onRender||s.onRender;const i=xt(t.playbackEase,s.playbackEase);this._ease=i?Be(i):null,this.iterationDuration=0}add(t,e,s){const i=F(e),r=F(t);if(i||r){if(this._hasChildren=!0,i){const i=e,r=A.editor&&A.editor.addTimelineChild,n=s&&"Stagger"===s.type&&A.editor,o=O(s)?s:null;if(o||n){const e=_e(t),n=this.duration,a=this.iterationDuration,l=i.id;let h=0;const d=e.length,c=r?r(t,i,this.id,s,d):null,u=o||A.editor.resolveStagger(s.defaultValue);e.forEach(t=>{const s={...c||i};this.duration=n,this.iterationDuration=a,z(l)||(s.id=l+"-"+h),Ze(s,this,Ge(this,u(t,h,e,null,this)),t,h,e),h++})}else{const e=r?r(t,i,this.id,s):i,n=s&&s.type?s.defaultValue:s;Ze(e,this,Ge(this,n),t)}}else Ze(t,this,Ge(this,e));return this.composition&&this.init(!0),this}}sync(t,e){if(z(t)||t&&z(t.pause))return this;t.pause();const s=+(t.effect?t.effect.getTiming().duration:t.duration);return z(t)||z(t.persist)||(t.persist=!0),this.add(t,{currentTime:[0,s],duration:s,delay:0,ease:"linear",playbackEase:"linear"},e)}set(t,e,s){return z(e)?this:(e.duration=d,e.composition=r.replace,this.add(t,e,s))}call(t,e){return z(t)||t&&!O(t)?this:this.add({duration:0,delay:0,onComplete:()=>t(this)},e)}label(t,e){return z(t)||t&&!V(t)||(this.labels[t]=Ge(this,e)),this}remove(t,e){return pe(_e(t),this,e),this}stretch(t){const e=this.duration;if(e===mt(t))return this;const s=t/e,i=this.labels;yt(this,t=>t.stretch(t.duration*s));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return yt(this,t=>{t.refresh&&t.refresh()}),this}revert(){return super.revert(),yt(this,t=>t.revert,!0),Zt(this)}then(t){return super.then(t)}}const Ke=t=>A.editor?A.editor.addTimeline(t):new Je(t).init();class ts{constructor(t,e){D.current&&D.current.register(this);const s=()=>{if(this.callbacks.completed)return;let t=!0;for(let e in this.animations)if(!this.animations[e].paused&&t){t=!1;break}t&&this.callbacks.complete()},i={onBegin:()=>{this.callbacks.completed&&this.callbacks.reset(),this.callbacks.play()},onComplete:s,onPause:s},n={v:1,autoplay:!1},o={};if(this.targets=[],this.animations={},this.callbacks=null,!z(t)&&!z(e)){for(let t in e){const s=e[t];q(t)?o[t]=s:L(t,"on")?n[t]=s:i[t]=s}this.callbacks=new je({v:0},n);for(let e in o){const s=o[e],n=F(s);let a={},l="+=0";if(n){const t=s.unit;V(t)&&(l+=t)}else a.duration=s;a[e]=n?gt({to:l},s):l;const h=gt(i,a);h.composition=r.replace,h.autoplay=!1;const d=this.animations[e]=new je(t,h,null,0,!1).init();this.targets.length||this.targets.push(...d.targets),this[e]=(t,e,s)=>{const i=d._head;if(z(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return yt(d,e=>{if(P(t))for(let s=0,i=t.length;s<i;s++)z(e._numbers[s])||(e._fromNumbers[s]=e._modifier(e._numbers[s]),e._toNumbers[s]=t[s]);else e._fromNumber=e._modifier(e._number),e._toNumber=t;z(s)||(e._ease=Be(s)),e._currentTime=0}),z(e)||d.stretch(e),d.reset(!0).resume(),this}}}}revert(){for(let t in this.animations)this[t]=y,this.animations[t].revert();return this.animations={},this.targets.length=0,this.callbacks&&this.callbacks.revert(),this}}const es=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i);var ss=Object.freeze({__proto__:null,clamp:ht,damp:(t,e,s,i)=>i?1===i?e:ut(t,e,1-Math.exp(-i*s*.1)):t,degToRad:t=>t*Math.PI/180,lerp:ut,mapRange:es,padEnd:(t,e,s)=>`${t}`.padEnd(e,s),padStart:(t,e,s)=>`${t}`.padStart(e,s),radToDeg:t=>180*t/Math.PI,round:dt,roundPad:(t,e)=>(+t).toFixed(e),snap:ct,wrap:(t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e});const is=10*u;class rs{constructor(t={}){const e=!z(t.bounce)||!z(t.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/u,this.maxIterations=this.maxDuration/this.timeStep/u,this.bn=ht(xt(t.bounce,.5),-1,1),this.pd=ht(xt(t.duration,628),10*A.timeScale,is*A.timeScale),this.m=ht(xt(t.mass,1),1,is),this.s=ht(xt(t.stiffness,100),d,is),this.d=ht(xt(t.damping,10),d,is),this.v=ht(xt(t.velocity,0),-1e4,is),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=t.onComplete||y,e&&this.calculateSDFromBD(),this.compute(),this.ease=t=>{const e=t*this.settlingDuration,s=this.completed,i=this.pd;return e>=i&&!s&&(this.completed=!0,this.onComplete(this.parent)),e<i&&s&&(this.completed=!1),0===t||1===t?t:this.solve(t*this.solverDuration)}}solve(t){const{zeta:e,w0:s,wd:i,b:r}=this;let n=t;return n=e<1?et(-n*e*s)*(1*K(i*n)+r*J(i*n)):1===e?(1+r*n)*et(-n*s):((1+r)*et((-e*s+i)*n)+(1-r)*et((-e*s-i)*n))/2,1-n}calculateSDFromBD(){const t=1===A.timeScale?this.pd/u:this.pd;this.m=1,this.v=0,this.s=Z(2*at/t,2),this.bn>=0?this.d=4*(1-this.bn)*at/t:this.d=4*at/(t*(1+this.bn)),this.s=dt(ht(this.s,d,is),3),this.d=dt(ht(this.d,d,300),3)}calculateBDFromSD(){const t=2*at/Q(this.s);this.pd=t*(1===A.timeScale?u:1);const e=this.d/(2*Q(this.s));this.bn=e<=1?1-this.d*t/(4*at):4*at/(this.d*t)-1,this.bn=dt(ht(this.bn,-1,1),3),this.pd=dt(ht(this.pd,10*A.timeScale,is*A.timeScale),3)}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,l=this.w0=ht(Q(o/r),d,u),h=this.zeta=n/(2*Q(o*r));h<1?(this.wd=l*Q(1-h*h),this.b=(h*l-a)/this.wd):1===h?(this.wd=0,this.b=-a+l):(this.wd=l*Q(h*h-1),this.b=(h*l-a)/this.wd);let c=0,p=0,m=0;for(;p<=t&&m<=e;)tt(1-this.solve(c))<s?p++:p=0,this.solverDuration=c,c+=i,m++;this.settlingDuration=dt(this.solverDuration*u,0)*A.timeScale}get bounce(){return this.bn}set bounce(t){this.bn=ht(xt(t,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(t){this.pd=ht(xt(t,1),10*A.timeScale,is*A.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=ht(xt(t,100),d,is),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(t){this.d=ht(xt(t,10),d,is),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(t){this.m=ht(xt(t,1),1,is),this.compute()}get velocity(){return this.v}set velocity(t){this.v=ht(xt(t,0),-1e4,is),this.compute()}}const ns=t=>new rs(t),os=t=>(console.warn("createSpring() is deprecated use spring() instead"),new rs(t)),as={_head:null,_tail:null},ls=(t,e,s)=>{let i,r=as._head;for(;r;){const n=r._next,o=r.$el===t,a=!e||r.property===e,l=!s||r.parent===s;if(o&&a&&l){i=r.animation;try{i.commitStyles()}catch{}i.cancel(),vt(as,r);const t=r.parent;t&&(t._completed++,t.animations.length===t._completed&&(t.completed=!0,t.paused=!0,t.muteCallbacks||(t.onComplete(t),t._resolve(t))))}r=n}return i},hs=(t,e,s,i,r)=>{const n=e.animate(i,r),o=r.delay+ +r.duration*r.iterations;n.playbackRate=t._speed,t.paused&&n.pause(),t.duration<o&&(t.duration=o,t.controlAnimation=n),t.animations.push(n),ls(e,s),bt(as,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>ls(e,s,t);return n.oncancel=a,n.onremove=a,t.persist||(n.onfinish=a),n};function ds(t,e,s){const i=Te(t);if(!i.length)return;const[r]=i,n=St(r,e),o=Gt(e,r,n);let a=Ct(r,o);if(z(s))return a;if(kt(a,Dt),0===Dt.t||1===Dt.t){if(!1===s)return Dt.n;{const t=Se(r,Dt,s,!1);return`${dt(t.n,A.precision)}${t.u}`}}}const cs=(t,e)=>{if(!z(e))return e.duration=d,e.composition=xt(e.composition,r.none),new je(t,e,null,0,!0).resume()},us=(t,e,s)=>{const i=_e(t);for(let t=0,r=i.length;t<r;t++)ls(i[t],s,e&&e.controlAnimation&&e);return pe(i,e,s),i},ps=t=>{t.cancelable&&t.preventDefault()};class ms{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:y,remove:y}}get x(){return this.el.x||0}set x(t){this.el.x=t}get y(){return this.el.y||0}set y(t){this.el.y=t}get width(){return this.el.width||0}set width(t){this.el.width=t}get height(){return this.el.height||0}set height(t){this.el.height=t}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class fs{constructor(t){this.$el=t,this.inlineTransforms=[],this.point=new DOMPoint,this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(t,e){return this.point.x=t,this.point.y=e,this.point.matrixTransform(this.inversedMatrix)}traverseUp(t){let e=this.$el.parentElement,s=0;for(;e&&e!==i;)t(e,s),e=e.parentElement,s++}getMatrix(){const t=new DOMMatrix;return this.traverseUp(e=>{const s=getComputedStyle(e).transform;if(s){const e=new DOMMatrix(s);t.preMultiplySelf(e)}}),t}remove(){this.traverseUp((t,e)=>{this.inlineTransforms[e]=t.style.transform,t.style.transform="none"})}revert(){this.traverseUp((t,e)=>{const s=this.inlineTransforms[e];""===s?t.style.removeProperty("transform"):t.style.transform=s})}}const gs=(t,e)=>t&&O(t)?t(e):t;let ys=0;class vs{constructor(t,e={}){if(!t)return;D.current&&D.current.register(this);const r=e.x,n=e.y,o=e.trigger,a=e.modifier,l=e.releaseEase,h=l&&Be(l),d=!z(l)&&!z(l.ease),u=F(r)&&!z(r.mapTo)?r.mapTo:"translateX",p=F(n)&&!z(n.mapTo)?n.mapTo:"translateY",m=gs(e.container,this);this.containerArray=P(m)?m:null,this.$container=m&&!this.containerArray?_e(m)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.$target=F(t)?new ms(t):_e(t)[0],this.$trigger=_e(o||t)[0],this.fixed="fixed"===ds(this.$target,"position"),this.isFinePointer=!0,this.containerPadding=[0,0,0,0],this.containerFriction=0,this.releaseContainerFriction=0,this.snapX=0,this.snapY=0,this.scrollSpeed=0,this.scrollThreshold=0,this.dragSpeed=0,this.dragThreshold=3,this.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=d?l:ns({mass:xt(e.releaseMass,1),stiffness:xt(e.releaseStiffness,80),damping:xt(e.releaseDamping,20)}),this.releaseYSpring=d?l:ns({mass:xt(e.releaseMass,1),stiffness:xt(e.releaseStiffness,80),damping:xt(e.releaseDamping,20)}),this.releaseEase=h||Ae.outQuint,this.hasReleaseSpring=d,this.onGrab=e.onGrab||y,this.onDrag=e.onDrag||y,this.onRelease=e.onRelease||y,this.onUpdate=e.onUpdate||y,this.onSettle=e.onSettle||y,this.onSnap=e.onSnap||y,this.onResize=e.onResize||y,this.onAfterResize=e.onAfterResize||y,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),z(r)||!0===r)f[u]=0;else if(F(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===r&&(f[u]=0,this.disabled[0]=1);if(z(n)||!0===n)f[p]=0;else if(F(n)){const t=n,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[p]=e}else!1===n&&(f[p]=0,this.disabled[1]=1);this.animate=new ts(this.$target,f),this.xProp=u,this.yProp=p,this.destX=0,this.destY=0,this.deltaX=0,this.deltaY=0,this.scroll={x:0,y:0},this.coords=[this.x,this.y,0,0],this.snapped=[0,0],this.pointer=[0,0,0,0,0,0,0,0],this.scrollView=[0,0],this.dragArea=[0,0,0,0],this.containerBounds=[-c,c,c,-c],this.scrollBounds=[0,0,0,0],this.targetBounds=[0,0,0,0],this.window=[0,0],this.velocityStack=[0,0,0],this.velocityStackIndex=0,this.velocityTime=B(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new fs(this.$target),this.overshootCoords={x:0,y:0},this.overshootTicker=new ve({autoplay:!1,onUpdate:()=>{this.updated=!0,this.manual=!0,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,1),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,1)},onComplete:()=>{this.manual=!1,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,0),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,0)}},null,0).init(),this.updateTicker=new ve({autoplay:!1,onUpdate:()=>this.update()},null,0).init(),this.contained=!z(m),this.manual=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.enabled=!1,this.initialized=!1,this.activeProp=this.disabled[1]?u:p,this.animate.callbacks.onRender=()=>{const t=this.updated,e=!(this.grabbed&&t)&&this.released,s=this.x,i=this.y,r=s-this.coords[2],n=i-this.coords[3];this.deltaX=r,this.deltaY=n,this.coords[2]=s,this.coords[3]=i,t&&(r||n)&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=ot(n,r)):this.updated=!1},this.animate.callbacks.onComplete=()=>{!this.grabbed&&this.released&&(this.released=!1),this.manual||(this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.onSettle(this))},this.resizeTicker=new ve({autoplay:!1,duration:150*A.timeScale,onComplete:()=>{this.onResize(this),this.refresh(),this.onAfterResize(this)}}).init(),this.parameters=e,this.resizeObserver=new ResizeObserver(()=>{this.initialized?this.resizeTicker.restart():this.initialized=!0}),this.enable(),this.refresh(),this.resizeObserver.observe(this.$container),F(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=B(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,a=this.minVelocity,l=this.maxVelocity,h=this.velocityStackIndex;n[h]=dt(ht(Q(t*t+e*e)/r*o,a,l),5);const d=nt(n[0],n[1],n[2]);return this.velocity=d,this.velocityStackIndex=(h+1)%3,d}setX(t,e=!1){if(this.disabled[0])return;const s=dt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=ct(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=dt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=ct(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return dt(this.animate[this.xProp](),A.precision)}set x(t){this.setX(t,!1)}get y(){return dt(this.animate[this.yProp](),A.precision)}set y(t){this.setY(t,!1)}get progressX(){return es(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(es(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return es(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(es(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=dt(this.useWin?s.scrollX:this.$container.scrollLeft,0),e=dt(this.useWin?s.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,a=this.scrollThreshold;this.scroll.x=t,this.scroll.y=e,this.scrollBounds[0]=e-this.targetBounds[0]+i-a,this.scrollBounds[1]=t-this.targetBounds[1]-r+a,this.scrollBounds[2]=e-this.targetBounds[2]-n+a,this.scrollBounds[3]=t-this.targetBounds[3]+o-a}updateBoundingValues(){const t=this.$container;if(!t)return;const e=this.x,r=this.y,n=this.coords[2],o=this.coords[3];this.coords[2]=0,this.coords[3]=0,this.setX(0,!0),this.setY(0,!0),this.transforms.remove();const a=this.window[0]=s.innerWidth,l=this.window[1]=s.innerHeight,h=this.useWin,d=t.scrollWidth,c=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,y]=this.containerPadding;this.dragArea[0]=h?0:p.left,this.dragArea[1]=h?0:p.top,this.scrollView[0]=h?ht(d,a,d):d,this.scrollView[1]=h?ht(c,l,c):c,this.updateScrollCoords();const{width:v,height:b,left:_,top:T,right:x,bottom:w}=t.getBoundingClientRect();this.dragArea[2]=dt(h?ht(v,a,a):v,0),this.dragArea[3]=dt(h?ht(b,l,l):b,0);const S=ds(t,"overflow"),$="visible"===S,C="hidden"===S;if(this.canScroll=!u&&this.contained&&(t===i.body&&$||!C&&!$)&&(d>this.dragArea[2]+y-f||c>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!P(this.containerArray)),this.contained){const e=this.scroll.x,s=this.scroll.y,i=this.canScroll,r=this.$target.getBoundingClientRect(),n=i?h?0:t.scrollLeft:0,o=i?h?0:t.scrollTop:0,d=i?this.scrollView[0]-n-v:0,c=i?this.scrollView[1]-o-b:0;this.targetBounds[0]=dt(r.top+s-(h?0:T),0),this.targetBounds[1]=dt(r.right+e-(h?a:x),0),this.targetBounds[2]=dt(r.bottom+s-(h?l:w),0),this.targetBounds[3]=dt(r.left+e-(h?0:_),0),this.containerArray?(this.containerBounds[0]=this.containerArray[0]+m,this.containerBounds[1]=this.containerArray[1]-f,this.containerBounds[2]=this.containerArray[2]-g,this.containerBounds[3]=this.containerArray[3]+y):(this.containerBounds[0]=-dt(r.top-(u?ht(T,0,l):T)+o-m,0),this.containerBounds[1]=-dt(r.right-(u?ht(x,0,a):x)-d+f,0),this.containerBounds[2]=-dt(r.bottom-(u?ht(w,0,l):w)-c+g,0),this.containerBounds[3]=-dt(r.left-(u?ht(_,0,a):_)+n-y,0))}this.transforms.revert(),this.coords[2]=n,this.coords[3]=o,this.setX(e,!0),this.setY(r,!0)}isOutOfBounds(t,e,s){if(!this.contained)return 0;const[i,r,n,o]=t,[a,l]=this.disabled,h=!a&&e<o||!a&&e>r,d=!l&&s<i||!l&&s>n;return h&&!d?1:!h&&d?2:h&&d?3:0}refresh(){const t=this.parameters,e=t.x,r=t.y,n=gs(t.container,this),o=gs(t.containerPadding,this)||0,a=P(o)?o:[o,o,o,o],l=this.x,h=this.y,d=gs(t.cursor,this),c={onHover:"grab",onGrab:"grabbing"};if(d){const{onHover:t,onGrab:e}=d;t&&(c.onHover=t),e&&(c.onGrab=e)}const u=gs(t.dragThreshold,this),p={mouse:3,touch:7};if(M(u))p.mouse=u,p.touch=u;else if(u){const{mouse:t,touch:e}=u;z(t)||(p.mouse=t),z(e)||(p.touch=e)}this.containerArray=P(n)?n:null,this.$container=n&&!this.containerArray?_e(n)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.isFinePointer=matchMedia("(pointer:fine)").matches,this.containerPadding=xt(a,[0,0,0,0]),this.containerFriction=ht(xt(gs(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=ht(xt(gs(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=gs(F(e)&&!z(e.snap)?e.snap:t.snap,this),this.snapY=gs(F(r)&&!z(r.snap)?r.snap:t.snap,this),this.scrollSpeed=xt(gs(t.scrollSpeed,this),1.5),this.scrollThreshold=xt(gs(t.scrollThreshold,this),20),this.dragSpeed=xt(gs(t.dragSpeed,this),1),this.dragThreshold=this.isFinePointer?p.mouse:p.touch,this.minVelocity=xt(gs(t.minVelocity,this),0),this.maxVelocity=xt(gs(t.maxVelocity,this),50),this.velocityMultiplier=xt(gs(t.velocityMultiplier,this),1),this.cursor=!1!==d&&c,this.updateBoundingValues();const[m,f,g,y]=this.containerBounds;this.setX(ht(l,y,f),!0),this.setY(ht(h,m,g),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],a=this.dragArea[3],l=this.scroll.x,h=this.scroll.y,d=this.$container.scrollWidth,c=this.$container.scrollHeight,u=this.useWin?ht(d,this.window[0],d):d,p=this.useWin?ht(c,this.window[1],c):c,m=r-u,f=n-p;this.dragged&&m>0&&(this.coords[0]-=m,this.scrollView[0]=u),this.dragged&&f>0&&(this.coords[1]-=f,this.scrollView[1]=p);const g=10*this.scrollSpeed,y=this.scrollThreshold,[v,b]=this.coords,[_,T,x,w]=this.scrollBounds,S=dt(ht((b-_+t)/y,-1,0)*g,0),$=dt(ht((v-T-e)/y,0,1)*g,0),C=dt(ht((b-x-s)/y,0,1)*g,0),E=dt(ht((v-w+i)/y,-1,0)*g,0);if(S||C||E||$){const[t,e]=this.disabled;let s=l,i=h;t||(s=dt(ht(l+(E||$),0,r-o),0),this.coords[0]-=l-s),e||(i=dt(ht(h+(S||C),0,n-a),0),this.coords[1]-=h-i),this.useWin?this.$scrollContainer.scrollBy(-(l-s),-(h-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,a,l,h]=this.pointer;this.coords[0]+=(r-l)*this.dragSpeed,this.coords[1]+=(n-h)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[d,c]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(d>e?e+(d-e)*m:d<i?i+(d-i)*m:d,!1),this.setY(c>s?s+(c-s)*m:c<t?t+(c-t)*m:c,!1),this.computeVelocity(r-l,n-h),this.angle=ot(n-a,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return pe([this],null,"x"),pe([this],null,"y"),pe([this],null,"progressX"),pe([this],null,"progressY"),pe([this.scroll]),pe([this.overshootCoords]),this}scrollInView(t,e=0,s=Ae.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,a=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[l,h,d,u]=o,p=dt(ht(r-l,-c,0),0),m=dt(ht(i-h,0,c),0),f=dt(ht(r-d,0,c),0),g=dt(ht(i-u,-c,0),0);new je(n,{x:dt(n.x+(g?g-e:m?m+e:0),0),y:dt(n.y+(p?p-e:f?f+e:0),0),duration:z(t)?350*A.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then(()=>{this.canScroll=a})}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=cs(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=Ae.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,a,l]=this.containerPadding,h=this.scroll.y-this.targetBounds[0]+n+e,d=this.scroll.x-this.targetBounds[1]-o-e,c=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+l+e,p=this.isOutOfBounds([h,d,c,u],i,r);if(p){const[e,n]=this.disabled,o=ht(ct(i,this.snapX),u,d),a=ht(ct(r,this.snapY),h,c),l=z(t)?350*A.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,l,s),n||2!==p&&3!==p||this.animate[this.yProp](a,l,s)}return this}handleDown(t){const e=t.target;if(this.grabbed||"range"===e.type)return;t.stopPropagation(),this.grabbed=!0,this.released=!1,this.stop(),this.updateBoundingValues();const s=t.changedTouches,r=s?s[0].clientX:t.clientX,n=s?s[0].clientY:t.clientY,{x:o,y:a}=this.transforms.normalizePoint(r,n),[l,h,d,c]=this.containerBounds,u=(1-this.containerFriction)*this.dragSpeed,p=this.x,m=this.y;this.coords[0]=this.coords[2]=u?p>h?h+(p-h)/u:p<c?c+(p-c)/u:p:p,this.coords[1]=this.coords[3]=u?m>d?d+(m-d)/u:m<l?l+(m-l)/u:m:m,this.pointer[0]=o,this.pointer[1]=a,this.pointer[2]=o,this.pointer[3]=a,this.pointer[4]=o,this.pointer[5]=a,this.pointer[6]=o,this.pointer[7]=a,this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null);const f=ds(this.$target,"zIndex",!1);ys=(f>ys?f:ys)+1,this.targetStyles=cs(this.$target,{zIndex:ys}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=cs(i.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,Ae.out(3)),this.onGrab(this),i.addEventListener("touchmove",this),i.addEventListener("touchend",this),i.addEventListener("touchcancel",this),i.addEventListener("mousemove",this),i.addEventListener("mouseup",this),i.addEventListener("selectstart",this)}handleMove(t){if(!this.grabbed)return;const e=t.changedTouches,s=e?e[0].clientX:t.clientX,i=e?e[0].clientY:t.clientY,{x:r,y:n}=this.transforms.normalizePoint(s,i),o=r-this.pointer[6],a=n-this.pointer[7];let l=t.target,h=!1,d=!1,c=!1;for(;e&&l&&l!==this.$trigger;){const t=ds(l,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=l;if(e>s){c=!0,h=t<=3,d=t>=e-s-3;break}}l=l.parentElement}c&&(!h&&!d||h&&a<0||d&&a>0)?(this.pointer[0]=r,this.pointer[1]=n,this.pointer[2]=r,this.pointer[3]=n,this.pointer[4]=r,this.pointer[5]=n,this.pointer[6]=r,this.pointer[7]=n):(ps(t),this.triggerStyles||(this.triggerStyles=cs(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",ps,{passive:!1}),this.$trigger.addEventListener("touchmove",ps,{passive:!1}),this.$trigger.addEventListener("touchend",ps),(this.dragged||!this.disabled[0]&&tt(o)>this.dragThreshold||!this.disabled[1]&&tt(a)>this.dragThreshold)&&(this.updateTicker.resume(),this.pointer[2]=this.pointer[0],this.pointer[3]=this.pointer[1],this.pointer[0]=r,this.pointer[1]=n,this.dragged=!0,this.released=!1,this.onDrag(this)))}handleUp(){if(!this.grabbed)return;this.updateTicker.pause(),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null);const[t,e]=this.disabled,[s,n,o,a,l,h]=this.pointer,[d,c,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,y=this.releaseYSpring,v=this.releaseEase,b=this.hasReleaseSpring,_=this.overshootCoords,T=this.x,x=this.y,w=this.computeVelocity(s-l,n-h),S=this.angle=ot(n-a,s-o),$=150*w,C=(1-this.releaseContainerFriction)*this.dragSpeed,E=T+K(S)*$,k=x+J(S)*$,N=E>c?c+(E-c)*C:E<p?p+(E-p)*C:E,D=k>u?u+(k-u)*C:k<d?d+(k-d)*C:k,I=this.destX=ht(dt(ct(N,this.snapX),5),p,c),R=this.destY=ht(dt(ct(D,this.snapY),5),d,u),L=this.isOutOfBounds(this.containerBounds,E,k);let B=0,P=0,F=v,M=v,V=0;if(_.x=T,_.y=x,!t){const t=I===c?T>c?-1:1:T<p?-1:1,s=dt(T-I,0);g.velocity=e&&b?s?$*t/tt(s):0:w;const{ease:i,settlingDuration:r,restDuration:n}=g;B=T===I?0:b?r:r-n*A.timeScale,b&&(F=i),B>V&&(V=B)}if(!e){const e=R===u?x>u?-1:1:x<d?-1:1,s=dt(x-R,0);y.velocity=t&&b?s?$*e/tt(s):0:w;const{ease:i,settlingDuration:r,restDuration:n}=y;P=x===R?0:b?r:r-n*A.timeScale,b&&(M=i),P>V&&(V=P)}if(!b&&L&&C&&(B||P)){const t=r.blend;new je(_,{x:{to:N,duration:.65*B},y:{to:D,duration:.65*P},ease:v,composition:t}).init(),new je(_,{x:{to:I,duration:B},y:{to:R,duration:P},ease:v,composition:t}).init(),this.overshootTicker.stretch(nt(B,P)).restart()}else t||this.animate[this.xProp](I,B,F),e||this.animate[this.yProp](R,P,M);this.scrollInView(V,this.scrollThreshold,v);let O=!1;I!==m&&(this.snapped[0]=I,this.snapX&&(O=!0)),R!==f&&this.snapY&&(this.snapped[1]=R,this.snapY&&(O=!0)),O&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",ps),this.$trigger.removeEventListener("touchmove",ps),this.$trigger.removeEventListener("touchend",ps),i.removeEventListener("touchmove",this),i.removeEventListener("touchend",this),i.removeEventListener("touchcancel",this),i.removeEventListener("mousemove",this),i.removeEventListener("mouseup",this),i.removeEventListener("selectstart",this)}reset(){return this.stop(),this.resizeTicker.pause(),this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.setX(0,!0),this.setY(0,!0),this.coords[0]=0,this.coords[1]=0,this.pointer[0]=0,this.pointer[1]=0,this.pointer[2]=0,this.pointer[3]=0,this.pointer[4]=0,this.pointer[5]=0,this.pointer[6]=0,this.pointer[7]=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this}enable(){return this.enabled||(this.enabled=!0,this.$target.classList.remove("is-disabled"),this.touchActionStyles=cs(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"}),this.$trigger.addEventListener("touchstart",this,{passive:!0}),this.$trigger.addEventListener("mousedown",this,{passive:!0}),this.$trigger.addEventListener("mouseenter",this)),this}disable(){return this.enabled=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.touchActionStyles.revert(),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null),this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null),this.$target.classList.add("is-disabled"),this.$trigger.removeEventListener("touchstart",this),this.$trigger.removeEventListener("mousedown",this),this.$trigger.removeEventListener("mouseenter",this),i.removeEventListener("touchmove",this),i.removeEventListener("touchend",this),i.removeEventListener("touchcancel",this),i.removeEventListener("mousemove",this),i.removeEventListener("mouseup",this),i.removeEventListener("selectstart",this),this}revert(){return this.reset(),this.disable(),this.$target.classList.remove("is-disabled"),this.updateTicker.revert(),this.overshootTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),this.resizeObserver.disconnect(),this}handleEvent(t){switch(t.type){case"mousedown":case"touchstart":this.handleDown(t);break;case"mousemove":case"touchmove":this.handleMove(t);break;case"mouseup":case"touchend":case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":ps(t)}}}const bs=(t=y)=>new ve({duration:1*A.timeScale,onComplete:t},null,0).resume(),_s=t=>{let e;return(...s)=>{let i,r,n,o,a;e&&(i=e.currentIteration,r=e.iterationProgress,n=e.reversed,o=e._alternate,a=e._startTime,e.revert());const l=t(...s);return l&&!O(l)&&l.revert&&(e=l),z(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r,e._startTime=a),l||y}};class Ts{constructor(t={}){D.current&&D.current.register(this);const e=t.root;let r=i;e&&(r=e.current||e.nativeElement||_e(e)[0]||i);const n=t.defaults,o=A.defaults,a=t.mediaQueries;if(this.defaults=n?gt(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],this.constructorsOnce=[],this.revertConstructorsOnce=[],this.revertiblesOnce=[],this.once=!1,this.onceIndex=0,this.methods={},this.matches={},this.mediaQueryLists={},this.data={},a)for(let t in a){const e=s.matchMedia(a[t]);this.mediaQueryLists[t]=e,e.addEventListener("change",this)}}register(t){(this.once?this.revertiblesOnce:this.revertibles).push(t)}execute(t){let e=D.current,s=D.root,i=A.defaults;D.current=this,D.root=this.root,A.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return D.current=e,D.root=s,A.defaults=i,n}refresh(){return this.onceIndex=0,this.execute(()=>{let t=this.revertibles.length,e=this.revertConstructors.length;for(;t--;)this.revertibles[t].revert();for(;e--;)this.revertConstructors[e](this);this.revertibles.length=0,this.revertConstructors.length=0,this.constructors.forEach(t=>{const e=t(this);O(e)&&this.revertConstructors.push(e)})}),this}add(t,e){if(this.once=!1,O(t)){const e=t;this.constructors.push(e),this.execute(()=>{const t=e(this);O(t)&&this.revertConstructors.push(t)})}else this.methods[t]=(...t)=>this.execute(()=>e(...t));return this}addOnce(t){if(this.once=!0,O(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute(()=>{const t=s(this);O(t)&&this.revertConstructorsOnce.push(t)})}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(O(s))return s(this);const i=_s(t);let r;return this.constructorsOnce[e]=i,this.execute(()=>{r=i(this)}),r}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.revertiblesOnce,i=this.revertConstructorsOnce,r=this.mediaQueryLists;let n=t.length,o=e.length,a=s.length,l=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;a--;)s[a].revert();for(;l--;)i[l](this);for(let t in r)r[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,s.length=0,i.length=0,this.constructorsOnce.length=0,this.onceIndex=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const xs=(t,e)=>t&&O(t)?t(e):t,ws=new Map;class Ss{constructor(t){this.element=t,this.useWin=this.element===i.body,this.winWidth=0,this.winHeight=0,this.width=0,this.height=0,this.left=0,this.top=0,this.scale=1,this.zIndex=0,this.scrollX=0,this.scrollY=0,this.prevScrollX=0,this.prevScrollY=0,this.scrollWidth=0,this.scrollHeight=0,this.velocity=0,this.backwardX=!1,this.backwardY=!1,this.scrollTicker=new ve({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;yt(this,t=>t.handleScroll(),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new ve({autoplay:!1,frameRate:30,onUpdate:t=>{const e=t.deltaTime,s=this.prevScrollX,i=this.prevScrollY,r=this.scrollX,n=this.scrollY,o=s-r,a=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),a&&(this.backwardY=i>n),this.velocity=dt(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new ve({autoplay:!1,duration:250*A.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new ve({autoplay:!1,duration:500*A.timeScale,onBegin:()=>{this.scrollTicker.resume()},onComplete:()=>{this.scrollTicker.pause()}}).init(),this._head=null,this._tail=null,this.updateScrollCoords(),this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll(),this.resizeObserver=new ResizeObserver(()=>this.resizeTicker.restart()),this.resizeObserver.observe(this.element),(this.useWin?s:this.element).addEventListener("scroll",this,!1)}updateScrollCoords(){const t=this.useWin,e=this.element;this.scrollX=dt(t?s.scrollX:e.scrollLeft,0),this.scrollY=dt(t?s.scrollY:e.scrollTop,0)}updateWindowBounds(){this.winWidth=s.innerWidth,this.winHeight=(()=>{const t=i.createElement("div");i.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return i.body.removeChild(t),e})()}updateBounds(){const t=getComputedStyle(this.element),e=this.element;let s,i;if(this.scrollWidth=e.scrollWidth+parseFloat(t.marginLeft)+parseFloat(t.marginRight),this.scrollHeight=e.scrollHeight+parseFloat(t.marginTop)+parseFloat(t.marginBottom),this.updateWindowBounds(),this.useWin)s=this.winWidth,i=this.winHeight;else{const t=e.getBoundingClientRect();s=e.clientWidth,i=e.clientHeight,this.top=t.top,this.left=t.left,this.scale=t.width?s/t.width:t.height?i/t.height:1}this.width=s,this.height=i}refreshScrollObservers(){yt(this,t=>{t._debug&&t.removeDebug()}),this.updateBounds(),yt(this,t=>{t.refresh(),t.onResize(t),t._debug&&t.debug()})}refresh(){this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll()}handleScroll(){this.updateScrollCoords(),this.wakeTicker.restart()}handleEvent(t){"scroll"===t.type&&this.handleScroll()}revert(){this.scrollTicker.cancel(),this.dataTimer.cancel(),this.resizeTicker.cancel(),this.wakeTicker.cancel(),this.resizeObserver.disconnect(),(this.useWin?s:this.element).removeEventListener("scroll",this),ws.delete(this.element)}}const $s=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,a="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:l,u:h}=kt(a,Dt);let d=l;return"%"===h?d=l/100*s:h&&(d=Se(t,Dt,"px",!0).n),o&&i<0&&(d+=i),n&&r>0&&(d+=r),d},Cs=(t,e,s,i,r)=>{let n;if(V(e)){const o=E.exec(e);if(o){const a=o[0],l=a[0],h=e.split(a),d="min"===h[0],c="max"===h[0],u=$s(t,h[0],s,i,r),p=$s(t,h[1],s,i,r);if(d){const e=Et($s(t,"min",s),p,l);n=e<u?u:e}else if(c){const e=Et($s(t,"max",s),p,l);n=e>u?u:e}else n=Et(u,p,l)}else n=$s(t,e,s,i,r)}else n=e;return dt(n,0)},Es=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[o]){e=i;break}}return e};let ks=0;const Ns=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Ds{constructor(t={}){D.current&&D.current.register(this);const e=xt(t.sync,"play pause"),s=e?Be(e):null,r=e&&("linear"===e||e===$e),n=e&&!(s===$e&&!r),o=e&&(M(e)||!0===e||r),a=e&&V(e)&&!n&&!o,l=a?e.split(" ").map(t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null}):null,h=a&&l.length>2;this.index=ks++,this.id=z(t.id)?this.index:t.id,this.container=(t=>{const e=t&&_e(t)[0]||i.body;let s=ws.get(e);return s||(s=new Ss(e),ws.set(e,s)),s})(t.container),this.target=null,this.linked=null,this.repeat=null,this.horizontal=null,this.enter=null,this.leave=null,this.sync=n||o||!!l,this.syncEase=n?s:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=l&&!h&&l[0]?l[0]:y,this.onSyncLeave=l&&!h&&l[1]?l[1]:y,this.onSyncEnterForward=l&&h&&l[0]?l[0]:y,this.onSyncLeaveForward=l&&h&&l[1]?l[1]:y,this.onSyncEnterBackward=l&&h&&l[2]?l[2]:y,this.onSyncLeaveBackward=l&&h&&l[3]?l[3]:y,this.onEnter=t.onEnter||y,this.onLeave=t.onLeave||y,this.onEnterForward=t.onEnterForward||y,this.onLeaveForward=t.onLeaveForward||y,this.onEnterBackward=t.onEnterBackward||y,this.onLeaveBackward=t.onLeaveBackward||y,this.onUpdate=t.onUpdate||y,this.onResize=t.onResize||y,this.onSyncComplete=t.onSyncComplete||y,this.reverted=!1,this.ready=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offset=0,this.offsetStart=0,this.offsetEnd=0,this.distance=0,this.prevProgress=0,this.thresholds=["start","end","end","start"],this.coords=[0,0,0,0],this.debugStyles=null,this.$debug=null,this._params=t,this._debug=xt(t.debug,!1),this._next=null,this._prev=null,bt(this.container,this),bs(()=>{if(!this.reverted){if(!this.target){const e=_e(t.target)[0];this.target=e||i.body,this.refresh()}this._debug&&this.debug()}})}link(t){if(t&&(t.pause(),this.linked=t,z(t)||z(t.persist)||(t.persist=!0),!this._params.target)){let e;z(t.targets)?yt(t,t=>{t.targets&&!e&&(e=Es(t))}):e=Es(t),this.target=e||i.body,this.refresh()}return this}get velocity(){return this.container.velocity}get backward(){return this.horizontal?this.container.backwardX:this.container.backwardY}get scroll(){return this.horizontal?this.container.scrollX:this.container.scrollY}get progress(){const t=(this.scroll-this.offsetStart)/this.distance;return t===1/0||isNaN(t)?0:dt(ht(t,0,1),6)}refresh(){this.ready=!0,this.reverted=!1;const t=this._params;return this.repeat=xt(xs(t.repeat,this),!0),this.horizontal="x"===xt(xs(t.axis,this),"y"),this.enter=xt(xs(t.enter,this),"end start"),this.leave=xt(xs(t.leave,this),"start end"),this.updateBounds(),this.handleScroll(),this}removeDebug(){return this.$debug&&(this.$debug.parentNode.removeChild(this.$debug),this.$debug=null),this.debugStyles&&(this.debugStyles.revert(),this.$debug=null),this}debug(){this.removeDebug();const t=this.container,e=this.horizontal,s=t.element.querySelector(":scope > .animejs-onscroll-debug"),r=i.createElement("div"),n=i.createElement("div"),o=i.createElement("div"),a=Ns[this.index%Ns.length],l=t.useWin,h=l?t.winWidth:t.width,d=l?t.winHeight:t.height,c=t.scrollWidth,u=t.scrollHeight,p=this.container.width>360?320:260,m=e?0:10,f=e?10:0,g=e?24:p/2,y=e?g:15,v=e?60:g,b=e?v:y,_=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",x=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,w=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${w("absolute",m,f,e?c:p,e?p:u)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${e?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `,n.style.cssText=`${w("sticky",0,0,e?h:g,e?g:d)}`,s||(n.style.cssText+=`background:\n ${x("#FFFF")}${T(g-10)} / 100px 100px ${_},\n ${x("#FFF8")}${T(g-10)} / 10px 10px ${_};\n `),o.style.cssText=`${w("relative",0,0,e?c:g,e?g:u)}`,s||(o.style.cssText+=`background:\n ${x("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${_},\n ${x("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${_};\n `);const S=[" enter: "," leave: "];this.coords.forEach((t,s)=>{const r=s>1,l=(r?0:this.offset)+t,m=s%2,f=l<b,g=l>(r?e?h:d:e?c:u)-b,_=(r?m&&!f:!m&&!f)||g,T=i.createElement("div"),x=i.createElement("div"),$=e?_?"right":"left":_?"bottom":"top",C=_?(e?v:y)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;x.innerHTML=`${this.id}${S[m]}${this.thresholds[s]}`,T.style.cssText=`${w("absolute",0,0,v,y)}\n display: flex;\n flex-direction: ${e?"column":"row"};\n justify-content: flex-${r?"start":"end"};\n align-items: flex-${_?"end":"start"};\n border-${$}: 2px solid ${a};\n `,x.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${y};\n margin-${e?_?"right":"left":_?"bottom":"top"}: -2px;\n padding: 1px;\n font-family: ui-monospace, monospace;\n font-size: 10px;\n letter-spacing: -.025em;\n line-height: 9px;\n font-weight: 600;\n text-align: ${e&&_||!e&&!r?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${m?a:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":a};\n border: 2px solid ${m?a:"transparent"};\n border-${e?_?"top-left":"top-right":_?"top-left":"bottom-left"}-radius: 5px;\n border-${e?_?"bottom-left":"bottom-right":_?"top-right":"bottom-right"}-radius: 5px;\n `,T.appendChild(x);let E=l-C+(e?1:0);T.style[e?"left":"top"]=`${E}px`,(r?n:o).appendChild(T)}),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),s||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===ds(t.element,"position")&&(this.debugStyles=cs(t.element,{position:"relative "}))}updateBounds(){let t;this._debug&&this.removeDebug();const e=this.target,s=this.container,r=this.horizontal,n=this.linked;let o,a=e;for(n&&(o=n.currentTime,n.seek(0,!0));a&&a!==s.element&&a!==i.body;){const e="sticky"===ds(a,"position")&&cs(a,{position:"static"});a=a.parentElement,e&&(t||(t=[]),t.push(e))}const l=e.getBoundingClientRect(),h=s.scale,d=(r?l.left+s.scrollX-s.left:l.top+s.scrollY-s.top)*h,c=(r?l.width:l.height)*h,u=r?s.width:s.height,p=(r?s.scrollWidth:s.scrollHeight)-u,m=this.enter,f=this.leave;let g="start",y="end",v="end",b="start";if(V(m)){const t=m.split(" ");v=t[0],g=t.length>1?t[1]:g}else if(F(m)){const t=m;z(t.container)||(v=t.container),z(t.target)||(g=t.target)}else M(m)&&(v=m);if(V(f)){const t=f.split(" ");b=t[0],y=t.length>1?t[1]:y}else if(F(f)){const t=f;z(t.container)||(b=t.container),z(t.target)||(y=t.target)}else M(f)&&(b=f);const _=Cs(e,g,c),T=Cs(e,y,c),x=_+d-u,w=T+d-p,S=Cs(e,v,u,x,w),$=Cs(e,b,u,x,w),C=_+d-S,E=T+d-$,k=E-C;this.offset=d,this.offsetStart=C,this.offsetEnd=E,this.distance=k<=0?0:k,this.thresholds=[g,y,v,b],this.coords=[_,T,S,$],t&&t.forEach(t=>t.revert()),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){if(!this.ready)return;const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,a=this.scroll,l=a<=this.offsetStart,h=a>=this.offsetEnd,d=!l&&!h,c=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&c,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(l&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&M(i)){if(i<1){const t=1e-4,s=e<g&&1===g?t:e>g&&!g?-t:0;g=dt(ut(e,g,ut(.01,.2,i))+s,6)}}else s&&(g=s(g));m=g!==this.prevProgress,f=1===e,m&&!f&&i&&e&&o.wakeTicker.restart()}if(p){const t=n?o.scrollY:o.scrollX;p.style[n?"top":"left"]=t+10+"px"}(d&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(d&&(this.isInView=!0),this.forceEnter&&this.hasEntered?d&&(this.forceEnter=!1):(p&&d&&(p.style.zIndex=""+this.container.zIndex++),this.onSyncEnter(this),this.onEnter(this),this.backward?(this.onSyncEnterBackward(this),this.onEnterBackward(this)):(this.onSyncEnterForward(this),this.onEnterForward(this)),this.hasEntered=!0,u&&(this.forceEnter=!0))),(d||!d&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!d&&this.isInView&&(this.isInView=!1,this.onSyncLeave(this),this.onLeave(this),this.backward?(this.onSyncLeaveBackward(this),this.onLeaveBackward(this)):(this.onSyncLeaveForward(this),this.onLeaveForward(this)),e&&!i&&(f=!0)),g>=1&&this.began&&!this.completed&&(e&&f||!e)&&(e&&this.onSyncComplete(this),this.completed=!0,(!this.repeat&&!t||!this.repeat&&t&&t.completed)&&this.revert()),g<1&&this.completed&&(this.completed=!1),this.prevProgress=g}revert(){if(this.reverted)return;const t=this.container;return vt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this.ready=!1,this}}const As=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,Is=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?$e:r=>0===r||1===r?r:As(((t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=As(r,e,s)-t,i>0?o=r:n=r}while(tt(i)>1e-7&&++a<100);return r})(r,t,s),e,i),Rs=(t=10,e)=>{const s=e?st:it;return e=>s(ht(e,0,1)*t)*(1/t)},Ls=(...t)=>{const e=t.length;if(!e)return $e;const s=e-1,i=t[0],r=t[s],n=[0],o=[G(i)];for(let e=1;e<s;e++){const i=t[e],r=V(i)?i.trim().split(" "):[i],a=r[0],l=r[1];n.push(z(l)?e/s:G(l)/100),o.push(G(a))}return o.push(G(r)),n.push(1),function(t){for(let e=1,s=n.length;e<s;e++){const s=n[e];if(t<=s){const i=n[e-1],r=o[e-1];return r+(o[e]-r)*(t-i)/(s-i)}}return o[o.length-1]}},Bs=(t=10,e=1)=>{const s=[0],i=t-1;for(let t=1;t<i;t++){const r=s[t-1],n=t/i,o=n*(1-e)+(n+((t+1)/i-n)*Math.random())*e;s.push(ht(o,r,1))}return s.push(1),Ls(...s)};var Ps=Object.freeze({__proto__:null,Spring:rs,createSpring:os,cubicBezier:Is,eases:Ae,irregular:Bs,linear:Ls,spring:ns,steps:Rs});const Fs=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(dt(t(i/e),4));return`linear(${s.join(", ")})`},Ms={},Vs=t=>{let e=Ms[t];if(e)return e;if(e="linear",V(t)){if(L(t,"linear")||L(t,"cubic-")||L(t,"steps")||L(t,"ease"))e=t;else if(L(t,"cubicB"))e=R(t);else{const s=Re(t);O(s)&&(e=s===$e?"linear":Fs(s))}Ms[t]=e}else if(O(t)){const s=Fs(t);s&&(e=s)}else t.ease&&(e=Fs(t.ease));return e},Os=["x","y","z"],zs=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...Os],Hs=(()=>[...Os,...f.filter(t=>["X","Y","Z"].some(e=>t.endsWith(e)))])();let Xs=null;const Ys=(t,e,s,i,r)=>{let n=V(e)?e:wt(e,s,i,r,null,null);return M(n)?zs.includes(t)||L(t,"translate")?`${n}px`:L(t,"rotate")||L(t,"skew")?`${n}deg`:`${n}`:n},Ws=(t,e,s,i,r,n)=>{let o="0";const a=z(i)?getComputedStyle(t)[e]:Ys(e,i,t,r,n);return o=z(s)?P(i)?i.map(s=>Ys(e,s,t,r,n)):a:[Ys(e,s,t,r,n),a],o};class Us{constructor(t,s){D.current&&D.current.register(this),H(Xs)&&(!e||!z(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(f.forEach(t=>{const e=L(t,"skew"),s=L(t,"scale"),i=L(t,"rotate"),r=L(t,"translate"),n=i||e,o=n?"<angle>":s?"<number>":r?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:o,inherits:!1,initialValue:r?"0px":n?"0deg":s?"1":"0"})}catch{}}),Xs=!0):Xs=!1);const i=Te(t);i.length||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const r=xt(s.autoplay,A.defaults.autoplay),n=!(!r||!r.link)&&r,o=s.alternate&&!0===s.alternate,a=s.reversed&&!0===s.reversed,h=xt(s.loop,A.defaults.loop),d=!0===h||h===1/0?1/0:M(h)?h+1:1,c=o?a?"alternate-reverse":"alternate":a?"reverse":"normal",v=1===A.timeScale?1:u;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||A.defaults.onComplete,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!r||!1!==n,this.reversed=a,this.persist=xt(s.persist,A.defaults.persist),this.autoplay=r,this._speed=xt(s.playbackRate,A.defaults.playbackRate),this._resolve=y,this._completed=0,this._inlineStyles=[],i.forEach((t,e)=>{const r=t[l],n=Hs.some(t=>s.hasOwnProperty(t)),o=t.style,a=this._inlineStyles[e]={},h=xt(s.ease,A.defaults.ease),u=wt(h,t,e,i,null,null),y=O(u)||V(u)?u:h,b=h.ease&&h,_=Vs(y),T=(b?b.settlingDuration:wt(xt(s.duration,A.defaults.duration),t,e,i,null,null))*v,x=wt(xt(s.delay,A.defaults.delay),t,e,i,null,null)*v,w=xt(s.composition,"replace");for(let l in s){if(!q(l))continue;const h={},u={iterations:d,direction:c,fill:"both",easing:_,duration:T,delay:x,composite:w},p=s[l],g=!!n&&(f.includes(l)?l:m.get(l)),y=g?"transform":l;let b;if(a[y]||(a[y]=o[y]),F(p)){const s=p,n=xt(s.ease,_),a=n.ease&&n,d=s.to,c=s.from;if(u.duration=(a?a.settlingDuration:wt(xt(s.duration,T),t,e,i,null,null))*v,u.delay=wt(xt(s.delay,x),t,e,i,null,null)*v,u.composite=xt(s.composition,w),u.easing=Vs(n),b=Ws(t,l,c,d,e,i),g?(h[`--${g}`]=b,r[g]=b):h[l]=Ws(t,l,c,d,e,i),hs(this,t,l,h,u),!z(c))if(g){const t=`--${g}`;o.setProperty(t,h[t][0])}else o[l]=h[l][0]}else b=P(p)?p.map(s=>Ys(l,s,t,e,i)):Ys(l,p,t,e,i),g?(h[`--${g}`]=b,r[g]=b):h[l]=b,hs(this,t,l,h,u)}if(n){let t=p;for(let e in r)t+=`${g[e]}var(--${e})) `;o.transform=t}}),n&&this.autoplay.link(this)}forEach(t){try{const e=V(t)?e=>e[t]():t;this.animations.forEach(e)}catch{}return this}get speed(){return this._speed}set speed(t){this._speed=+t,this.forEach(e=>e.playbackRate=t)}get currentTime(){const t=this.controlAnimation,e=A.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===A.timeScale?1:u);this.forEach(t=>{!this.persist&&e>=this.duration&&t.play(),t.currentTime=e})}get progress(){return this.currentTime/this.duration}set progress(t){this.forEach(e=>e.currentTime=t*this.duration||0)}resume(){return this.paused?(this.paused=!1,this.forEach("play")):this}pause(){return this.paused?this:(this.paused=!0,this.forEach("pause"))}alternate(){return this.reversed=!this.reversed,this.forEach("reverse"),this.paused&&this.forEach("pause"),this}play(){return this.reversed&&this.alternate(),this.resume()}reverse(){return this.reversed||this.alternate(),this.resume()}seek(t,e=!1){return e&&(this.muteCallbacks=!0),t<this.duration&&(this.completed=!1),this.currentTime=t,this.muteCallbacks=!1,this.paused&&this.pause(),this}restart(){return this.completed=!1,this.seek(0,!0).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){return this.muteCallbacks=!0,this.commitStyles().forEach("cancel"),this.animations.length=0,requestAnimationFrame(()=>{this.targets.forEach(t=>{"none"===t.style.transform&&t.style.removeProperty("transform")})}),this}revert(){return this.cancel().targets.forEach((t,e)=>{const s=t.style,i=this._inlineStyles[e];for(let e in i){const r=i[e];z(r)||r===p?s.removeProperty(R(e)):t.style[e]=r}t.getAttribute("style")===p&&t.removeAttribute("style")}),this}then(t=y){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=y};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const qs={animate:(t,e)=>new Us(t,e),convertEase:Fs};let js=0,Gs=0;const Zs=(t,e)=>!(!t||!e)&&(t===e||t.contains(e)),Qs=t=>{if(!t)return null;const e=t.style,s=e.transition||"";return e.setProperty("transition","none","important"),s},Js=(t,e)=>{if(!t)return;const s=t.style;e?s.transition=e:s.removeProperty("transition")},Ks=t=>{const e=t.layout.transitionMuteStore,s=t.$el,i=t.$measure;s&&!e.has(s)&&e.set(s,Qs(s)),i&&!e.has(i)&&e.set(i,Qs(i))},ti=t=>{t.forEach((t,e)=>Js(e,t)),t.clear()},ei={display:"none",visibility:"hidden",opacity:"0",transform:"none",position:"static"},si=t=>{if(!t)return;const e=t.parentNode;e&&(e._head===t&&(e._head=t._next),e._tail===t&&(e._tail=t._prev),t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t._prev=null,t._next=null,t.parentNode=null)},ii=(t,e,s,i)=>{let r=t.dataset.layoutId;r||(r=t.dataset.layoutId="node-"+Gs++);const n=i||{};return n.$el=t,n.$measure=t,n.id=r,n.index=0,n.targets=null,n.delay=0,n.duration=0,n.ease=null,n.state=s,n.layout=s.layout,n.parentNode=e||null,n.isTarget=!1,n.isEntering=!1,n.isLeaving=!1,n.isInlined=!1,n.hasTransform=!1,n.inlineStyles=[],n.inlineTransforms=null,n.inlineTransition=null,n.branchAdded=!1,n.branchRemoved=!1,n.branchNotRendered=!1,n.sizeChanged=!1,n.hasVisibilitySwap=!1,n.hasDisplayNone=!1,n.hasVisibilityHidden=!1,n.measuredInlineTransform=null,n.measuredInlineTransition=null,n.measuredDisplay=null,n.measuredVisibility=null,n.measuredPosition=null,n.measuredHasDisplayNone=!1,n.measuredHasVisibilityHidden=!1,n.measuredIsVisible=!1,n.measuredIsRemoved=!1,n.measuredIsInsideRoot=!1,n.properties={transform:"none",x:0,y:0,left:0,top:0,clientLeft:0,clientTop:0,width:0,height:0},n.layout.properties.forEach(t=>n.properties[t]=0),n._head=null,n._tail=null,n._prev=null,n._next=null,n},ri=(t,e,s,i)=>{const r=t.$el,n=t.layout.root,o=n===r,a=t.properties,l=t.state.rootNode,h=t.parentNode,d=s.transform,c=r.style.transform,u=!!h&&h.measuredIsRemoved,p=s.position;o&&(t.layout.absoluteCoords="fixed"===p||"absolute"===p),t.$measure=e,t.inlineTransforms=c,t.hasTransform=d&&"none"!==d,t.measuredIsInsideRoot=Zs(n,e),t.measuredInlineTransform=null,t.measuredDisplay=s.display,t.measuredVisibility=s.visibility,t.measuredPosition=p,t.measuredHasDisplayNone="none"===s.display,t.measuredHasVisibilityHidden="hidden"===s.visibility,t.measuredIsVisible=!(t.measuredHasDisplayNone||t.measuredHasVisibilityHidden),t.measuredIsRemoved=t.measuredHasDisplayNone||t.measuredHasVisibilityHidden||u;let m=!1,f=r.previousSibling;for(;f&&(f.nodeType===Node.COMMENT_NODE||f.nodeType===Node.TEXT_NODE&&!f.textContent.trim());)f=f.previousSibling;if(f&&f.nodeType===Node.TEXT_NODE)m=!0;else{for(f=r.nextSibling;f&&(f.nodeType===Node.COMMENT_NODE||f.nodeType===Node.TEXT_NODE&&!f.textContent.trim());)f=f.nextSibling;m=null!==f&&f.nodeType===Node.TEXT_NODE}if(t.isInlined=m,t.hasTransform&&!i){const s=t.layout.transitionMuteStore;s.get(r)||(t.inlineTransition=Qs(r)),e===r?r.style.transform="none":(s.get(e)||(t.measuredInlineTransition=Qs(e)),t.measuredInlineTransform=e.style.transform,e.style.transform="none")}let g,y,v=0,b=0,_=0,T=0;if(!i){const t=e.getBoundingClientRect();v=t.left,b=t.top,_=t.width,T=t.height}for(let t in a){const e="transform"===t?d:s[t]||s.getPropertyValue&&s.getPropertyValue(t);z(e)||(a[t]=e)}if(a.left=v,a.top=b,a.clientLeft=i?0:e.clientLeft,a.clientTop=i?0:e.clientTop,o)t.layout.absoluteCoords?(g=v,y=b):(g=0,y=0);else{const e=h||l,s=e.properties.left,i=e.properties.top,r=e.properties.clientLeft,n=e.properties.clientTop;if(t.layout.absoluteCoords)g=v-s-r,y=b-i-n;else if(e===l){const t=l.properties.left,e=l.properties.top;g=v-t-l.properties.clientLeft,y=b-e-l.properties.clientTop}else g=v-s-r,y=b-i-n}return a.x=g,a.y=y,a.width=_,a.height=T,t},ni=(t,e)=>{if(e)for(let s in e)t.properties[s]=e[s]},oi=(t,e)=>{const s=wt(e.ease,t.$el,t.index,t.targets,null,null),i=O(s)?s:e.ease,r=!z(i)&&!z(i.ease);t.ease=r?i.ease:i,t.duration=r?i.settlingDuration:wt(e.duration,t.$el,t.index,t.targets,null,null),t.delay=wt(e.delay,t.$el,t.index,t.targets,null,null)},ai=t=>{const e=t.$el.style,s=t.inlineStyles;s.length=0,t.layout.recordedProperties.forEach(t=>{s.push(t,e[t]||"")})},li=t=>{const e=t.$el.style,s=t.inlineStyles;for(let t=0,i=s.length;t<i;t+=2){const i=s[t],r=s[t+1];r&&""!==r?e[i]=r:(e[i]="",e.removeProperty(i))}},hi=t=>{const e=t.inlineTransforms,s=t.$el.style;!t.hasTransform||!e||t.hasTransform&&"none"===s.transform||e&&"none"===e?s.removeProperty("transform"):e&&(s.transform=e);const i=t.$measure;if(t.hasTransform&&i!==t.$el){const e=i.style,s=t.measuredInlineTransform;s&&""!==s?e.transform=s:e.removeProperty("transform")}t.measuredInlineTransform=null,null!==t.inlineTransition&&(Js(t.$el,t.inlineTransition),t.inlineTransition=null),i!==t.$el&&null!==t.measuredInlineTransition&&(Js(i,t.measuredInlineTransition),t.measuredInlineTransition=null)},di=t=>{(t.measuredIsRemoved||t.hasVisibilitySwap)&&(t.$el.style.removeProperty("display"),t.$el.style.removeProperty("visibility"),t.hasVisibilitySwap&&(t.$measure.style.removeProperty("display"),t.$measure.style.removeProperty("visibility"))),t.layout.pendingRemoval.delete(t.$el)},ci=(t,e,s)=>(e.properties={...t.properties},e.state=s,e.isTarget=t.isTarget,e.hasTransform=t.hasTransform,e.inlineTransforms=t.inlineTransforms,e.measuredIsVisible=t.measuredIsVisible,e.measuredDisplay=t.measuredDisplay,e.measuredIsRemoved=t.measuredIsRemoved,e.measuredHasDisplayNone=t.measuredHasDisplayNone,e.measuredHasVisibilityHidden=t.measuredHasVisibilityHidden,e.hasDisplayNone=t.hasDisplayNone,e.isInlined=t.isInlined,e.hasVisibilityHidden=t.hasVisibilityHidden,e);class ui{constructor(t){this.layout=t,this.rootNode=null,this.rootNodes=new Set,this.nodes=new Map,this.scrollX=0,this.scrollY=0}revert(){return this.forEachNode(t=>{this.layout.pendingRemoval.delete(t.$el),t.$el.removeAttribute("data-layout-id"),t.$measure.removeAttribute("data-layout-id")}),this.rootNode=null,this.rootNodes.clear(),this.nodes.clear(),this}getNode(t){if(t&&t.dataset)return this.nodes.get(t.dataset.layoutId)}getComputedValue(t,e){const s=this.getNode(t);if(s)return s.properties[e]}forEach(t,e){let s=t,i=0;for(;s;)if(e(s,i++),s._head)s=s._head;else if(s._next)s=s._next;else{for(;s&&!s._next;)s=s.parentNode;s&&(s=s._next)}}forEachRootNode(t){this.forEach(this.rootNode,t)}forEachNode(t){for(const e of this.rootNodes)this.forEach(e,t)}registerElement(t,e){if(!t||1!==t.nodeType)return null;this.layout.transitionMuteStore.has(t)||this.layout.transitionMuteStore.set(t,Qs(t));const s=[t,e],i=this.layout.root;let r=null;for(;s.length;){const t=s.pop(),e=s.pop();if(!e||1!==e.nodeType||X(e))continue;const n=!!t&&t.measuredIsRemoved,o=n?ei:getComputedStyle(e),a=!!n||"none"===o.display,l=!!n||"hidden"===o.visibility,h=!a&&!l,d=e.dataset.layoutId,c=Zs(i,e);let u=d?this.nodes.get(d):null;if(u&&u.$el!==e){const a=Zs(i,u.$el),l=u.measuredIsVisible;if(a||!c&&(c||l||!h)){if(a&&!l&&h){ri(u,e,o,n);let t=e.lastElementChild;for(;t;)s.push(t,u),t=t.previousElementSibling;r||(r=u);continue}{let i=e.lastElementChild;for(;i;)s.push(i,t),i=i.previousElementSibling;r||(r=u);continue}}si(u),u=ii(e,t,this,u)}else u=ii(e,t,this,u);u.branchAdded=!1,u.branchRemoved=!1,u.branchNotRendered=!1,u.isTarget=!1,u.sizeChanged=!1,u.hasVisibilityHidden=l,u.hasDisplayNone=a,u.hasVisibilitySwap=l&&!u.measuredHasVisibilityHidden||a&&!u.measuredHasDisplayNone,this.nodes.set(u.id,u),u.parentNode=t||null,u._prev=null,u._next=null,t?(this.rootNodes.delete(u),t._head?(t._tail._next=u,u._prev=t._tail,t._tail=u):(t._head=u,t._tail=u)):this.rootNodes.add(u),ri(u,u.$el,o,n);let p=e.lastElementChild;for(;p;)s.push(p,u),p=p.previousElementSibling;r||(r=u)}return r}ensureDetachedNode(t,e){if(!t||t===this.layout.root)return null;const s=t.dataset.layoutId,i=s?this.nodes.get(s):null;if(i&&i.$el===t)return i;let r=null,n=t.parentElement;for(;n&&n!==this.layout.root;){if(e.has(n)){r=this.ensureDetachedNode(n,e);break}n=n.parentElement}return this.registerElement(t,r)}record(){const t=this.layout,e=t.children,s=t.root,i=P(e)?e:[e],r=[],n="*"===e?s:D.root,o=[];let a=s.parentElement;for(;a&&1===a.nodeType;){const t=getComputedStyle(a);if(t.transform&&"none"!==t.transform){const t=a.style.transform||"",e=Qs(a);o.push(a,t,e),a.style.transform="none"}a=a.parentElement}for(let t=0,e=i.length;t<e;t++){const e=i[t];r[t]=V(e)?n.querySelectorAll(e):e}const l=Te(r);this.nodes.clear(),this.rootNodes.clear();const h=this.registerElement(s,null);h.isTarget=!0,this.rootNode=h;const d=new Set;let c=0;const u=[];this.nodes.forEach(t=>{u.push(t.$el)}),this.nodes.forEach((t,e)=>{t.index=c++,t.targets=u,t&&t.measuredIsInsideRoot&&d.add(e)});const p=new Set,m=[];for(let t=0,e=l.length;t<e;t++){const e=l[t];if(e&&1===e.nodeType&&e!==s){if(!Zs(s,e)){const t=e.dataset.layoutId;if(!t||!d.has(t))continue}p.has(e)||(p.add(e),m.push(e))}}for(let t=0,e=m.length;t<e;t++)this.ensureDetachedNode(m[t],p);for(let t=0,e=l.length;t<e;t++){const e=l[t],s=this.getNode(e);if(s){let t=s;for(;t&&!t.isTarget;)t.isTarget=!0,t=t.parentNode}}this.scrollX=window.scrollX,this.scrollY=window.scrollY,this.forEachNode(hi);for(let t=0,e=o.length;t<e;t+=3){const e=o[t],s=o[t+1],i=o[t+2];s&&""!==s?e.style.transform=s:e.style.removeProperty("transform"),Js(e,i)}return this}}function pi(t){const e={},s={};for(let i in t){const r=t[i];"duration"===i||"delay"===i||"ease"===i?s[i]=r:e[i]=r}return[e,s]}class mi{constructor(t,e={}){D.current&&D.current.register(this);const s=pi(e.swapAt),i=pi(e.enterFrom),r=pi(e.leaveTo),n=e.properties;if(e.duration=xt(e.duration,350),e.delay=xt(e.delay,0),e.ease=xt(e.ease,"inOut(3.5)"),this.params=e,this.root=Te(t)[0],this.id=e.id||js++,this.children=e.children||"*",this.absoluteCoords=!1,this.swapAtParams=gt(e.swapAt||{opacity:0},{ease:"inOut(1.75)"}),this.enterFromParams=e.enterFrom||{opacity:0},this.leaveToParams=e.leaveTo||{opacity:0},this.properties=new Set(["opacity","fontSize","color","backgroundColor","borderRadius","border","filter","clipPath"]),s[0])for(let t in s[0])this.properties.add(t);if(i[0])for(let t in i[0])this.properties.add(t);if(r[0])for(let t in r[0])this.properties.add(t);if(n)for(let t=0,e=n.length;t<e;t++)this.properties.add(n[t]);this.recordedProperties=new Set(["display","visibility","translate","position","left","top","marginLeft","marginTop","width","height","maxWidth","maxHeight","minWidth","minHeight"]),this.properties.forEach(t=>this.recordedProperties.add(t)),this.pendingRemoval=new WeakSet,this.transitionMuteStore=new Map,this.oldState=new ui(this),this.newState=new ui(this),this.timeline=null,this.transformAnimation=null,this.animating=[],this.swapping=[],this.leaving=[],this.entering=[],this.oldState.record(),ti(this.transitionMuteStore)}revert(){return this.root.classList.remove("is-animated"),this.timeline&&(this.timeline.complete(),this.timeline=null),this.transformAnimation&&(this.transformAnimation.complete(),this.transformAnimation=null),this.animating.length=this.swapping.length=this.leaving.length=this.entering.length=0,this.oldState.revert(),this.newState.revert(),requestAnimationFrame(()=>ti(this.transitionMuteStore)),this}record(){return this.transformAnimation&&(this.transformAnimation.cancel(),this.transformAnimation=null),this.oldState.record(),this.timeline&&(this.timeline.cancel(),this.timeline=null),this.newState.forEachRootNode(li),this}animate(t={}){const e={ease:xt(t.ease,this.params.ease),delay:xt(t.delay,this.params.delay),duration:xt(t.duration,this.params.duration)},s={id:this.id},i=xt(t.onComplete,this.params.onComplete),r=xt(t.onPause,this.params.onPause);for(let e in N)"ease"!==e&&"duration"!==e&&"delay"!==e&&(z(t[e])?z(this.params[e])||(s[e]=this.params[e]):s[e]=t[e]);s.onComplete=()=>{const e=t.autoplay,s=A.editor;if(e&&e.linked||s&&s.showPanel)i&&i(this.timeline);else{this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(t=>{di(t),li(t)});for(let t=0,e=w.length;t<e;t++){const e=w[t];e.style.transform=f.getComputedValue(e,"transform")}this.root.classList.contains("is-animated")&&(this.root.classList.remove("is-animated"),i&&i(this.timeline)),requestAnimationFrame(()=>{this.root.classList.contains("is-animated")||ti(this.transitionMuteStore)})}},s.onPause=()=>{const e=t.autoplay;if(e&&e.linked)return i&&i(this.timeline),void(r&&r(this.timeline));this.root.classList.contains("is-animated")&&(this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(di),this.root.classList.remove("is-animated"),i&&i(this.timeline),r&&r(this.timeline))},s.composition=!1;const n=gt(gt(t.swapAt||{},this.swapAtParams),e),o=gt(gt(t.enterFrom||{},this.enterFromParams),e),a=gt(gt(t.leaveTo||{},this.leaveToParams),e),[l,h]=pi(n),[d,c]=pi(o),[u,p]=pi(a),m=this.oldState,f=this.newState,g=this.animating,y=this.swapping,v=this.entering,b=this.leaving,_=this.pendingRemoval;g.length=y.length=v.length=b.length=0,m.forEachRootNode(Ks),f.record(),f.forEachRootNode(ai);const T=[],x=[],w=[],S=[],$=f.rootNode,C=$.$el;f.forEachRootNode(t=>{const e=t.$el,s=t.id,i=t.parentNode,r=!!i&&i.branchAdded,n=!!i&&i.branchRemoved,o=!!i&&i.branchNotRendered;let a=m.nodes.get(s);const l=!a;l?(a=ci(t,{},m),m.nodes.set(s,a),a.measuredIsRemoved=!0):a.measuredIsRemoved&&!t.measuredIsRemoved&&(ci(t,a,m),a.measuredIsRemoved=!0);const h=a.parentNode,c=(h?h.id:null)!==(i?i.id:null),p=a.$el!==t.$el,y=a.measuredIsRemoved,x=t.measuredIsRemoved;if(!a.measuredIsRemoved&&!x&&!l&&(c||p)){const t=a.properties.left,e=a.properties.top,s=i||f.rootNode,r=s.id?m.nodes.get(s.id):null,n=r?r.properties.left:s.properties.left,o=r?r.properties.top:s.properties.top,l=r?r.properties.clientLeft:s.properties.clientLeft,h=r?r.properties.clientTop:s.properties.clientTop;a.properties.x=t-n-l,a.properties.y=e-o-h}t.hasVisibilitySwap&&(t.hasVisibilityHidden&&(t.$el.style.visibility="visible",t.$measure.style.visibility="hidden"),t.hasDisplayNone&&(t.$el.style.display=a.measuredDisplay||t.measuredDisplay||"",t.$measure.style.visibility="hidden"));const w=_.has(e),S=a.measuredIsVisible,C=t.measuredIsVisible,E=!S&&C&&!o,k=!x&&(y||w)&&!r,N=x&&!y&&!n,D=N||x&&w&&!n;t.branchAdded=r||k,t.branchRemoved=n||D,t.branchNotRendered=o||x,x&&S&&(t.$el.style.display=a.measuredDisplay,t.$el.style.visibility="visible",ci(a,t,f)),N?(t.isTarget&&(b.push(e),t.isLeaving=!0),_.add(e)):!x&&w&&_.delete(e),k&&!o||E?(ni(a,d),t.isTarget&&(v.push(e),t.isEntering=!0)):D&&!o&&ni(t,u),t===$||!t.isTarget||t.isEntering||t.isLeaving||g.push(e),T.push(e)});let E=0,k=0,D=0;f.forEachRootNode(t=>{const s=t.$el,i=t.parentNode,r=m.nodes.get(t.id),n=t.properties,o=r.properties;let a=i!==$&&i;for(;a&&!a.isTarget&&a!==$;)a=a.parentNode;t===$?(t.index=0,t.targets=g,oi(t,e)):t.isEntering?(t.index=a?a.index:E,t.targets=a?g:v,oi(t,c),E++):t.isLeaving?(t.index=a?a.index:k,t.targets=a?g:b,k++,oi(t,p)):t.isTarget?(t.index=D++,t.targets=g,oi(t,e)):(t.index=a?a.index:0,t.targets=g,oi(t,h)),r.index=t.index,r.targets=t.targets;for(let e in n)n[e]=wt(n[e],s,t.index,t.targets,null,null),o[e]=wt(o[e],s,r.index,r.targets,null,null);const d=Math.abs(n.width-o.width)>1,u=Math.abs(n.height-o.height)>1;if(t.sizeChanged=d||u,t.isTarget&&(!t.measuredIsRemoved&&r.measuredIsVisible||t.measuredIsRemoved&&t.measuredIsVisible)){"none"===n.transform&&"none"===o.transform||(t.hasTransform=!0,w.push(s));for(let t in n)if("transform"!==t&&n[t]!==o[t]){x.push(s);break}}t.isTarget||(y.push(s),t.sizeChanged&&i&&i.isTarget&&i.sizeChanged&&(l.transform&&(t.hasTransform=!0,w.push(s)),S.push(s)))});const I={delay:t=>f.getNode(t).delay,duration:t=>f.getNode(t).duration,ease:t=>f.getNode(t).ease};if(s.defaults=I,this.timeline=Ke(s),!x.length&&!w.length&&!y.length)return ti(this.transitionMuteStore),this.timeline.complete();if(T.length){this.root.classList.add("is-animated");for(let t=0,e=T.length;t<e;t++){const e=T[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties;r.isInlined||("grid"!==i.measuredDisplay&&"grid"!==r.measuredDisplay||e.style.setProperty("display","block","important"),(e!==C||this.absoluteCoords)&&(e.style.position=this.absoluteCoords?"fixed":"absolute",e.style.left="0px",e.style.top="0px",e.style.marginLeft="0px",e.style.marginTop="0px",e.style.translate=`${n.x}px ${n.y}px`),e===C&&"static"===r.measuredPosition&&(e.style.position="relative",e.style.left="0px",e.style.top="0px")),e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none"}m.scrollX===window.scrollX&&m.scrollY===window.scrollY||requestAnimationFrame(()=>window.scrollTo(m.scrollX,m.scrollY));for(let t=0,e=x.length;t<e;t++){const e=x[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties,o=r.properties;let a=!1;const l={composition:"none"};n.width!==o.width&&(l.width=[n.width,o.width],a=!0),n.height!==o.height&&(l.height=[n.height,o.height],a=!0),r.hasTransform||r.isInlined||(l.translate=[`${n.x}px ${n.y}px`,`${o.x}px ${o.y}px`],a=!0),this.properties.forEach(t=>{const e=n[t],s=o[t];"transform"!==t&&e!==s&&(l[t]=[e,s],a=!0)}),a&&this.timeline.add(e,l,0)}}if(y.length){for(let t=0,e=y.length;t<e;t++){const e=y[t],s=m.getNode(e),i=s.properties;e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",s.isInlined||(e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${m.getComputedValue(e,t)}`)})}for(let t=0,e=y.length;t<e;t++){const e=y[t],s=f.getNode(e),i=s.properties;this.timeline.call(()=>{e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",s.isInlined||(e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${f.getComputedValue(e,t)}`)})},s.delay+s.duration/2)}if(S.length){const t=Be(f.nodes.get(S[0].dataset.layoutId).ease),e=e=>1-t(1-e),s={};if(l)for(let t in l)"transform"!==t&&(s[t]=[{from:e=>m.getComputedValue(e,t),to:l[t]},{from:l[t],to:e=>f.getComputedValue(e,t),ease:e}]);this.timeline.add(S,s,0)}}const R=w.length;if(R){for(let t=0;t<R;t++){const e=w[t],s=f.getNode(e);s.isInlined||(e.style.translate=`${m.getComputedValue(e,"x")}px ${m.getComputedValue(e,"y")}px`),e.style.transform=m.getComputedValue(e,"transform"),S.includes(e)&&(s.ease=wt(n.ease,e,s.index,s.targets,null,null),s.duration=wt(n.duration,e,s.index,s.targets,null,null))}this.transformAnimation=qs.animate(w,{translate:t=>f.getNode(t).isInlined?"0px 0px":`${f.getComputedValue(t,"x")}px ${f.getComputedValue(t,"y")}px`,transform:t=>{const e=f.getComputedValue(t,"transform");if(!S.includes(t))return e;const s=m.getComputedValue(t,"transform"),i=f.getNode(t);return[s,wt(l.transform,t,i.index,i.targets,null,null),e]},autoplay:!1,...I}),this.timeline.sync(this.transformAnimation,0)}return this.timeline.init()}update(t,e={}){return this.record(),t(this),this.animate(e)}}const fi=ss,gi={},yi=t=>(...e)=>{const s=t(...e);return new Proxy(y,{apply:(t,e,[i])=>s(i),get:(t,e)=>{if(gi[e])return yi((...t)=>{const i=gi[e](...t);return t=>i(s(t))})}})},vi=(t,e,s=0)=>{const i=(...t)=>(t.length<e.length?yi(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(e,s)):e)(...t);return gi[t]||(gi[t]=i),i},bi=vi("roundPad",fi.roundPad),_i=vi("padStart",fi.padStart),Ti=vi("padEnd",fi.padEnd),xi=vi("wrap",fi.wrap),wi=vi("mapRange",fi.mapRange),Si=vi("degToRad",fi.degToRad),$i=vi("radToDeg",fi.radToDeg),Ci=vi("snap",fi.snap),Ei=vi("clamp",fi.clamp),ki=vi("round",fi.round),Ni=vi("lerp",fi.lerp,1),Di=vi("damp",fi.damp,1),Ai=(t=0,e=1,s=0)=>{const i=10**s;return Math.floor((Math.random()*(e-t+1/i)+t)*i)/i};let Ii=0;const Ri=(t,e=0,s=1,i=0)=>{let r=void 0===t?Ii++:t;return(t=e,n=s,o=i)=>{r+=1831565813,r=Math.imul(r^r>>>15,1|r),r^=r+Math.imul(r^r>>>7,61|r);const a=10**o;return Math.floor((((r^r>>>14)>>>0)/4294967296*(n-t+1/a)+t)*a)/a}},Li=t=>t[Ai(0,t.length-1)],Bi=t=>{let e,s,i=t.length;for(;i;)s=Ai(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},Pi=(t,e={})=>{let s,i=[],r=0;const n=e.from,o=e.reversed,a=e.ease,l=!z(a),h=l&&!z(a.ease)?a.ease:l?Be(a):null,d=e.grid,c=!0===d,u=e.axis,m=e.total,f=z(n)||0===n||"first"===n,g="center"===n,y="last"===n,v="random"===n,b=P(n),_=P(t),T=e.use,x=G(_?t[0]:t),w=_?G(t[1]):0,S=$.exec((_?t[1]:t)+p),C=e.start||0+(_?x:0);let E=f?0:M(n)?n:0;return(t,a,l,p,f)=>{const[$]=Te(t),k=z(m)?l.length:m,N=!z(T)&&(O(T)?T($,a,k):Ct($,T)),D=M(N)||V(N)&&M(+N)?+N:a;if(g&&(E=(k-1)/2),y&&(E=k-1),!i.length){if(c){let t=!0,e=1/0,s=1/0,r=-1/0,o=-1/0;const a=[],h=[];for(let i=0;i<k;i++){const n=l[i];let d=0,c=0,u=!1;if(n&&O(n.getBoundingClientRect)){const t=n.getBoundingClientRect();d=t.left+t.width/2,c=t.top+t.height/2,u=!0}else{const t=n;t&&M(t.x)&&M(t.y)&&(d=t.x,c=t.y,u=!0)}if(!u){t=!1;break}a.push(d),h.push(c),d<e&&(e=d),c<s&&(s=c),d>r&&(r=d),c>o&&(o=c)}if(t){let t=a[0],l=h[0];b?(t=e+n[0]*(r-e),l=s+n[1]*(o-s)):g?(t=(e+r)/2,l=(s+o)/2):y?(t=a[k-1],l=h[k-1]):M(n)&&(t=a[n],l=h[n]);for(let e=0;e<k;e++){const s=t-a[e],r=l-h[e];let n=Q(s*s+r*r);"x"===u&&(n=-s),"y"===u&&(n=-r),i.push(n)}let d=1/0;for(let t=0,e=i.length;t<e;t++){const e=tt(i[t]);e>0&&e<d&&(d=e)}if(d>0&&d<1/0)for(let t=0,e=i.length;t<e;t++)i[t]=i[t]/d}else for(let t=0;t<k;t++)i.push(tt(E-t))}else for(let t=0;t<k;t++)if(d){let e,s;b?(e=n[0]*(d[0]-1),s=n[1]*(d[1]-1)):g?(e=(d[0]-1)/2,s=(d[1]-1)/2):(e=E%d[0],s=it(E/d[0]));const r=e-t%d[0],o=s-it(t/d[0]);let a=Q(r*r+o*o);"x"===u&&(a=-r),"y"===u&&(a=-o),i.push(a)}else i.push(tt(E-t));r=nt(...i),h&&(i=i.map(t=>h(t/r)*r)),o&&(i=i.map(t=>u?t<0?-1*t:-t:tt(r-t))),v&&(i=Bi(i))}const A=_?(w-x)/r:x;z(s)&&(s=f?Ge(f,z(e.start)?f.iterationDuration:C):C);let I=s+(A*dt(i[D],2)||0);return e.modifier&&(I=e.modifier(I)),S&&(I=`${I}${S[2]}`),I}};var Fi=Object.freeze({__proto__:null,$:Te,addChild:bt,clamp:Ei,cleanInlineStyles:Qt,createSeededRandom:Ri,damp:Di,degToRad:Si,forEachChildren:yt,get:ds,keepTime:_s,lerp:Ni,mapRange:wi,padEnd:Ti,padStart:_i,radToDeg:$i,random:Ai,randomPick:Li,remove:us,removeChild:vt,round:ki,roundPad:bi,set:cs,shuffle:Bi,snap:Ci,stagger:Pi,sync:bs,wrap:xi});const Mi=t=>{const e=_e(t)[0];return e&&X(e)?e:console.warn(`${t} is not a valid SVGGeometryElement`)},Vi=(t,e,s,i,r)=>{const n=s+i,o=r?Math.max(0,Math.min(n,e)):(n%e+e)%e;return t.getPointAtLength(o)},Oi=(t,e,s=0)=>i=>{const r=+t.getTotalLength(),n=i[a],o=t.getCTM(),l=0===s;return{from:0,to:r,modifier:i=>{const a=i+s*r;if("a"===e){const e=Vi(t,r,a,-1,l),s=Vi(t,r,a,1,l);return 180*ot(s.y-e.y,s.x-e.x)/at}{const s=Vi(t,r,a,0,l);return"x"===e?n||!o?s.x:s.x*o.a+s.y*o.c+o.e:n||!o?s.y:s.x*o.b+s.y*o.d+o.f}}}},zi=(t,e=0)=>{const s=Mi(t);if(s)return{translateX:Oi(s,"x",e),translateY:Oi(s,"y",e),rotate:Oi(s,"a",e)}},Hi=(t,e=0,s=0)=>_e(t).map(t=>((t,e,s)=>{const i=u,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let a=n;const l=new Proxy(t,{get(t,e){const s=t[e];return e===h?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],l=+s[1],h=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(Q(s.a*s.a+s.b*s.b)+Q(s.c*s.c+s.d*s.d))/2)}return e})(o),d=-1e3*r*h,c=l*i*h+d,u=i*h+(0===r&&1===l||1===r&&0===l?0:10*h)-c;if("butt"!==n){const e=r===l?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${d}`),t.setAttribute("stroke-dasharray",`${c} ${u}`)}return Reflect.apply(s,t,e)}:O(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),l.setAttribute("draw",`${e} ${s}`)),l})(t,e,s)),Xi=(t,e=.33)=>(s,i,r,n)=>{if(!(s.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${s.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const o=Mi(t);if(!o)throw new Error("Can't morph to an invalid target. 'path2' must resolve to an existing <path>, <polygon> or <polyline> SVG element.");if(!(o.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${o.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const a="path"===s.tagName,l=a?" ":",",h=n?n._value:null;h&&s.setAttribute(a?"d":"points",h);let d="",c="";if(e){const t=s.getTotalLength(),i=o.getTotalLength(),r=Math.max(Math.ceil(t*e),Math.ceil(i*e));for(let e=0;e<r;e++){const n=e/(r-1),h=s.getPointAtLength(t*n),u=o.getPointAtLength(i*n),p=a?0===e?"M":"L":"";d+=p+dt(h.x,3)+l+h.y+" ",c+=p+dt(u.x,3)+l+u.y+" "}}else d=s.getAttribute(a?"d":"points"),c=o.getAttribute(a?"d":"points");return[d,c]};var Yi=Object.freeze({__proto__:null,createDrawable:Hi,createMotionPath:zi,morphTo:Xi});const Wi="undefined"!=typeof Intl&&Intl.Segmenter,Ui=/\{value\}/g,qi=/\{i\}/g,ji=/(\s+)/,Gi=/^\s+$/,Zi="line",Qi="word",Ji="char",Ki="data-line";let tr=null,er=null,sr=null;const ir=t=>t.isWordLike||" "===t.segment||M(+t.segment),rr=t=>t.setAttribute("aria-hidden","true"),nr=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],or={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},ar=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&ar(e)}},lr=(t,e,s)=>{const i=t.getAttribute(Ki);if(null!==i&&+i!==e||"BR"===t.tagName){s.add(t);const e=t.previousSibling,i=t.nextSibling;e&&3===e.nodeType&&Gi.test(e.textContent)&&s.add(e),i&&3===i.nodeType&&Gi.test(i.textContent)&&s.add(i)}let r=t.childElementCount;for(;r--;)lr(t.children[r],e,s);return s},hr=(t,e={})=>{let s="";const i=V(e.class)?` class="${e.class}"`:"",r=xt(e.clone,!1),n=xt(e.wrap,!1),o=n?!0===n?"clip":n:!!r&&"clip";return n&&(s+=`<span${o?` style="overflow:${o};"`:""}>`),s+=`<span${i}${r?' style="position:relative;"':""} data-${t}="{i}">`,r?(s+="<span>{value}</span>",s+=`<span inert style="position:absolute;top:${"top"===r?"-100%":"bottom"===r?"100%":"0"};left:${"left"===r?"-100%":"right"===r?"100%":"0"};white-space:nowrap;">{value}</span>`):s+="{value}",s+="</span>",n&&(s+="</span>"),s},dr=(t,e,s,i,r,n,o,a,l)=>{const h=r===Zi,d=r===Ji,c=`_${r}_`,u=O(t)?t(s):t,p=h?"block":"inline-block";sr.innerHTML=u.replace(Ui,`<i class="${c}"></i>`).replace(qi,`${d?l:h?o:a}`);const m=sr.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,y=m.querySelectorAll(`i.${c}`),v=y.length;if(v){f.style.display=p,g.style.display=p,g.setAttribute(Ki,`${o}`),h||(g.setAttribute("data-word",`${a}`),d&&g.setAttribute("data-char",`${l}`));let t=v;for(;t--;){const e=y[t],i=e.parentElement;i.style.display=p,h?i.innerHTML=s.innerHTML:i.replaceChild(s.cloneNode(!0),e)}e.push(g),i.appendChild(m)}else console.warn('The expression "{value}" is missing from the provided template.');return n&&(f.style.outline=`1px dotted ${or[r]}`),f};class cr{constructor(t,s={}){tr||(tr=Wi?new Wi([],{granularity:Qi}):{segment:t=>{const e=[],s=t.split(ji);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!Gi.test(i)})}return e}}),er||(er=Wi?new Wi([],{granularity:"grapheme"}):{segment:t=>[...t].map(t=>({segment:t}))}),!sr&&e&&(sr=i.createElement("template")),D.current&&D.current.register(this);const{words:r,chars:n,lines:o,accessible:a,includeSpaces:l,debug:h}=s,d=(t=P(t)?t[0]:t)&&t.nodeType?t:(be(t)||[])[0],c=!0===o?{}:o,u=!0===r||z(r)?{}:r,p=!0===n?{}:n;this.debug=xt(h,!1),this.includeSpaces=xt(l,!1),this.accessible=xt(a,!0),this.linesOnly=c&&!u&&!p,this.lineTemplate=F(c)?hr(Zi,c):c,this.wordTemplate=F(u)||this.linesOnly?hr(Qi,u):u,this.charTemplate=F(p)?hr(Ji,p):p,this.$target=d,this.html=d&&d.innerHTML,this.lines=[],this.words=[],this.chars=[],this.effects=[],this.effectsCleanups=[],this.cache=null,this.ready=!1,this.width=0,this.resizeTimeout=null;const m=()=>this.html&&(c||u||p)&&this.split();this.resizeObserver=new ResizeObserver(()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{const t=d.offsetWidth;t!==this.width&&(this.width=t,m())},150)}),this.lineTemplate&&!this.ready?i.fonts.ready.then(m):m(),d?this.resizeObserver.observe(d):console.warn("No Text Splitter target found.")}addEffect(t){if(!O(t))return console.warn("Effect must return a function."),this;const e=_s(t);return this.effects.push(e),this.ready&&(this.effectsCleanups[this.effects.length-1]=e(this)),this}revert(){return clearTimeout(this.resizeTimeout),this.lines.length=this.words.length=this.chars.length=0,this.resizeObserver.disconnect(),this.effectsCleanups.forEach(t=>O(t)?t(this):t.revert&&t.revert()),this.$target.innerHTML=this.html,this}splitNode(t){const e=this.wordTemplate,s=this.charTemplate,r=this.includeSpaces,n=this.debug,o=t.nodeType;if(3===o){const o=t.nodeValue;if(o.trim()){const a=[],l=this.words,h=this.chars,d=tr.segment(o),c=i.createDocumentFragment();let u=null;for(const t of d){const e=t.segment,s=ir(t);if(!u||s&&u&&ir(u))a.push(e);else{const t=a.length-1,s=a[t];ji.test(s)||ji.test(e)?a.push(e):a[t]+=e}u=t}for(let t=0,o=a.length;t<o;t++){const o=a[t];if(o.trim()){const d=a[t+1],u=r&&d&&!d.trim(),p=o,m=s?er.segment(p):null,f=s?i.createDocumentFragment():i.createTextNode(u?o+" ":o);if(s){const t=[...m];for(let e=0,r=t.length;e<r;e++){const o=t[e],a=e===r-1&&u?o.segment+" ":o.segment,d=i.createTextNode(a);dr(s,h,d,f,Ji,n,-1,l.length,h.length)}}e?dr(e,l,f,c,Qi,n,-1,l.length,h.length):s?c.appendChild(f):c.appendChild(i.createTextNode(o)),u&&t++}else{if(t&&r)continue;c.appendChild(i.createTextNode(o))}}t.parentNode.replaceChild(c,t)}}else if(1===o){const e=[...t.childNodes];for(let t=0,s=e.length;t<s;t++)this.splitNode(e[t])}}split(t=!1){const e=this.$target,s=!!this.cache&&!t,r=this.lineTemplate,n=this.wordTemplate,o=this.charTemplate,a="loading"!==i.fonts.status,l=r&&a;this.ready=!r||a,(l||t)&&this.effectsCleanups.forEach(t=>O(t)&&t(this)),s||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),l&&(s&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=nr(e,Qi))),o&&(l||n)&&(this.chars=nr(e,Ji));const h=this.words.length?this.words:this.chars;let d,c=0;for(let t=0,e=h.length;t<e;t++){const e=h[t],{top:s,height:i}=e.getBoundingClientRect();!z(d)&&s-d>.5*i&&c++,e.setAttribute(Ki,`${c}`);const r=e.querySelectorAll(`[${Ki}]`);let n=r.length;for(;n--;)r[n].setAttribute(Ki,`${c}`);d=s}if(l){const t=i.createDocumentFragment(),s=new Set,a=[];for(let t=0;t<c+1;t++){const i=e.cloneNode(!0);lr(i,t,new Set).forEach(t=>{const e=t.parentNode;e&&(1===t.nodeType&&s.add(e),e.removeChild(t))}),a.push(i)}s.forEach(ar);for(let e=0,s=a.length;e<s;e++)dr(r,this.lines,a[e],t,Zi,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=nr(e,Qi)),o&&(this.chars=nr(e,Ji))}if(this.linesOnly){const t=this.words;let e=t.length;for(;e--;){const s=t[e];s.replaceWith(s.textContent)}t.length=0}if(this.accessible&&(l||!s)){const t=i.createElement("span");t.style.cssText="position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;",t.innerHTML=this.html,e.insertBefore(t,e.firstChild),this.lines.forEach(rr),this.words.forEach(rr),this.chars.forEach(rr)}return this.width=e.offsetWidth,(l||t)&&this.effects.forEach((t,e)=>this.effectsCleanups[e]=t(this)),this}refresh(){this.split(!0)}}const ur=(t,e)=>new cr(t,e),pr=(t,e)=>(console.warn("text.split() is deprecated, import splitText() directly, or text.splitText()"),new cr(t,e)),mr=t=>{let e="";for(let s=0,i=t.length;s<i;s++)if(s+2<i&&"-"===t[s+1]&&t.charCodeAt(s)<t.charCodeAt(s+2)){const i=t.charCodeAt(s),r=t.charCodeAt(s+2);for(let t=i;t<=r;t++)e+=String.fromCharCode(t);s+=2}else e+=t[s];return e},fr={lowercase:"a-z",uppercase:"A-Z",numbers:"0-9",symbols:"!%#_|*+=",braille:"⠀-⣿",blocks:"▀-▟",shades:"░-▓"},gr=new WeakMap,yr=(t={})=>{t||(t={});const e=t.chars,s=Be(t.ease||"linear"),i=t.text,r=t.from,n=t.reversed||!1,o=t.perturbation||0,a=t.cursor,l=!0===a?"_":"number"==typeof a?String.fromCharCode(a):"string"==typeof a?a:"",h=l.length,d=t.seed||0,c=void 0===t.override||t.override,u=t.revealRate||60,p=1e3*A.timeScale/u,m=t.settleDuration||300*A.timeScale,f=t.settleRate||30,g=t.duration,v=t.revealDelay,b=t.delay,_=t.onChange||y;return(t,a,u,y)=>{const T="function"==typeof e?e(t,a,u):e||"a-zA-Z0-9!%#_",x=mr(fr[T]||T),w=x.length-1,S="function"==typeof g?g(t,a,u):g,$="function"==typeof v?v(t,a,u):v||0,C="function"==typeof b?b(t,a,u):b||0,E=d?Ri(d):Ri();gr.has(t)||gr.set(t,t.textContent);const k=y?y._value:t.textContent,N=void 0!==i?"function"==typeof i?i(t,a,u):i:y?y._value:gr.get(t),D=" "===N||" "===N?" ":N,I=" "===k?0:k.length,R=D.length,L=!0===c?x:"string"==typeof c&&c.length>0?mr(fr[c]||c):null,B=L?L.length-1:0,P=" "===c?" ":null,F=""===c?R:Math.max(I,R),M=S>0?S:(F-1)*p+m,V=dt((M+$)/A.timeScale,0)*A.timeScale,O=$>0?dt($/V,12):0,z=void 0===r||"auto"===r?R<I?"right":"left":r,H=new Int32Array(F);if("random"===z){for(let t=0;t<F;t++)H[t]=t;for(let t=F-1;t>0;t--){const e=E(0,t),s=H[t];H[t]=H[e],H[e]=s}}else{const t="right"===z?(""!==c&&I?I:F)-1:"center"===z?((""!==c&&I?I:F)-1)/2:"number"==typeof z?z:0,e=Math.abs,s=new Array(F);for(let t=0;t<F;t++)s[t]=t;s.sort((s,i)=>e(s-t)-e(i-t));for(let t=0;t<F;t++)H[s[t]]=t}if(n){const t=F-1;for(let e=0;e<F;e++)H[e]=t-H[e]}const X=dt(m/M,12),Y=dt((1-X)/F,12),W=h*Y,U=dt(1e3*A.timeScale/(f*V),12),q=new Float32Array(F),j=new Float32Array(F),G=o>0?o*X:0;for(let t=0;t<F;t++){const e=G>0?(E(0,2e3)-1e3)/1e3*G:0,s=G>0?(E(0,2e3)-1e3)/1e3*G:0;q[t]=H[t]*Y+e,j[t]=Math.ceil((q[t]+X+s)/U)*U}if(R<F&&"left"!==z&&"right"!==z&&"random"!==z){let t=0;for(let e=R;e<F;e++)j[e]>t&&(t=j[e]);const e=new Array(R);for(let t=0;t<R;t++)e[t]=t;e.sort((t,e)=>H[t]-H[e]);const s=(1-t)/R;for(let i=0;i<R;i++){const r=t+i*s;r>j[e[i]]&&(j[e[i]]=r)}}const Z=new Array(F);for(let t=0;t<F;t++)Z[t]=x[E(0,w)];const Q=L?L===x?Z:new Array(F):null;if(Q&&Q!==Z)for(let t=0;t<F;t++)Q[t]=P||L[E(0,L.length-1)];let J=k;if(!y)if(""===c)J="";else if(L){J="";for(let t=0;t<I;t++)J+=" "===k[t]?" ":Q[t]}let K=-1,tt=-1,et="";const st=""!==c,it=!!L,rt=h>0;return{from:0,to:1,duration:V,delay:C,ease:"linear",modifier:t=>{if(t===K)return et;if(K=t,C>0&&t<=0)return et=k,k;if(t<=0)return et=J,J;if(t>=1)return et=D,D;et="";const e=t/U|0,i=e!==tt;i&&(tt=e);const r=O>0?(t-O)/(1-O):t,n=r>0?s(r):0;for(let t=0;t<F;t++){const e=q[t];n>=j[t]?t<R&&(et+=D[t]):n<=0||n<e?st&&t<I&&(it?" "===k[t]?et+=" ":(i&&(Q[t]=P||L[E(0,B)]),et+=Q[t]):et+=k[t]):t<R&&" "===D[t]||t<I&&" "===k[t]?et+=" ":rt&&n-e<W?et+=l[h-1-((n-e)/Y|0)]:(i&&(Z[t]=x[E(0,w)]),et+=Z[t])}return i&&_(et,n),et}}}};var vr=Object.freeze({__proto__:null,TextSplitter:cr,scrambleText:yr,split:pr,splitText:ur});t.$=Te,t.Animatable=ts,t.AutoLayout=mi,t.Draggable=vs,t.JSAnimation=je,t.Scope=Ts,t.ScrollObserver=Ds,t.Spring=rs,t.TextSplitter=cr,t.Timeline=Je,t.Timer=ve,t.WAAPIAnimation=Us,t.addChild=bt,t.animate=(t,e)=>A.editor?A.editor.addAnimation(t,e):new je(t,e,null,0,!1).init(),t.clamp=Ei,t.cleanInlineStyles=Qt,t.createAnimatable=(t,e)=>new ts(t,e),t.createDraggable=(t,e)=>new vs(t,e),t.createDrawable=Hi,t.createLayout=(t,e)=>new mi(t,e),t.createMotionPath=zi,t.createScope=t=>new Ts(t),t.createSeededRandom=Ri,t.createSpring=os,t.createTimeline=Ke,t.createTimer=t=>new ve(t,null,0).init(),t.cubicBezier=Is,t.damp=Di,t.degToRad=Si,t.eases=Ae,t.easings=Ps,t.engine=ie,t.forEachChildren=yt,t.get=ds,t.globals=A,t.irregular=Bs,t.keepTime=_s,t.lerp=Ni,t.linear=Ls,t.mapRange=wi,t.morphTo=Xi,t.onScroll=(t={})=>new Ds(t),t.padEnd=Ti,t.padStart=_i,t.radToDeg=$i,t.random=Ai,t.randomPick=Li,t.remove=us,t.removeChild=vt,t.round=ki,t.roundPad=bi,t.scrambleText=yr,t.scrollContainers=ws,t.set=cs,t.shuffle=Bi,t.snap=Ci,t.split=pr,t.splitText=ur,t.spring=ns,t.stagger=Pi,t.steps=Rs,t.svg=Yi,t.sync=bs,t.text=vr,t.utils=Fi,t.waapi=qs,t.wrap=xi});diff --git a/dist/modules/animatable/animatable.cjs b/dist/modules/animatable/animatable.cjsindex f789943f..7266ea10 100644--- a/dist/modules/animatable/animatable.cjs+++ b/dist/modules/animatable/animatable.cjs@@ -1,6 +1,6 @@/*** Anime.js - animatable - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/animatable/animatable.js b/dist/modules/animatable/animatable.jsindex 60fd9c02..f07c321c 100644--- a/dist/modules/animatable/animatable.js+++ b/dist/modules/animatable/animatable.js@@ -1,13 +1,13 @@/*** Anime.js - animatable - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/import { compositionTypes, noop } from '../core/consts.js';import { scope } from '../core/globals.js';-import { isUnd, isKey, stringStartsWith, isObj, mergeObjects, forEachChildren, isStr, isArr } from '../core/helpers.js';+import { isUnd, isKey, stringStartsWith, isObj, mergeObjects, forEachChildren, isArr, isStr } from '../core/helpers.js';import { JSAnimation } from '../animation/animation.js';import { parseEase } from '../easings/eases/parser.js';diff --git a/dist/modules/animatable/index.cjs b/dist/modules/animatable/index.cjsindex 7ca6dfd3..7fde8e1e 100644--- a/dist/modules/animatable/index.cjs+++ b/dist/modules/animatable/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - animatable - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/animatable/index.js b/dist/modules/animatable/index.jsindex 3d53f6ba..dab4a437 100644--- a/dist/modules/animatable/index.js+++ b/dist/modules/animatable/index.js@@ -1,6 +1,6 @@/*** Anime.js - animatable - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/animation/additive.cjs b/dist/modules/animation/additive.cjsindex b6d84acf..9ac604d6 100644--- a/dist/modules/animation/additive.cjs+++ b/dist/modules/animation/additive.cjs@@ -1,6 +1,6 @@/*** Anime.js - animation - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/animation/additive.js b/dist/modules/animation/additive.jsindex 662677be..8d4ab1c7 100644--- a/dist/modules/animation/additive.js+++ b/dist/modules/animation/additive.js@@ -1,6 +1,6 @@/*** Anime.js - animation - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/animation/animation.cjs b/dist/modules/animation/animation.cjsindex 4c4ca859..556f637f 100644--- a/dist/modules/animation/animation.cjs+++ b/dist/modules/animation/animation.cjs@@ -1,6 +1,6 @@/*** Anime.js - animation - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -162,7 +162,7 @@ class JSAnimation extends timer.Timer {* @param {Number} [parentPosition]* @param {Boolean} [fastSet=false]* @param {Number} [index=0]- * @param {Number} [length=0]+ * @param {TargetsArray} [allTargets]*/constructor(targets$1,@@ -171,7 +171,7 @@ class JSAnimation extends timer.Timer {parentPosition,fastSet = false,index = 0,- length = 0+ allTargets) {super(/** @type {TimerParams & AnimationParams} */(parameters), parent, parentPosition);@@ -222,7 +222,7 @@ class JSAnimation extends timer.Timer {const target = parsedTargets[targetIndex];const ti = index || targetIndex;- const tl = length || targetsLength;+ const tl = allTargets || parsedTargets;let lastTransformGroupIndex = NaN;let lastTransformGroupLength = NaN;@@ -298,7 +298,14 @@ class JSAnimation extends timer.Timer {toFunctionStore.func = null;fromFunctionStore.func = null;- const computedToValue = values.getFunctionValue(key.to, target, ti, tl, toFunctionStore);+ const computedComposition = values.getFunctionValue(values.setValue(key.composition, tComposition), target, ti, tl, null, null);+ const tweenComposition = helpers.isNum(computedComposition) ? computedComposition : consts.compositionTypes[computedComposition];+ if (!siblings && tweenComposition !== consts.compositionTypes.none) siblings = composition.getTweenSiblings(target, propName);+ // Timelines pass the last sibling tween if it belongs to the same timeline+ // Standalone animations only pass prevTween when the property has multiple keyframes+ const tailTween = siblings ? siblings._tail : null;+ const prevSiblingTween = parent && tailTween && tailTween.parent.parent === parent ? tailTween : prevTween;+ const computedToValue = values.getFunctionValue(key.to, target, ti, tl, toFunctionStore, prevSiblingTween);let tweenToValue;// Allows function based values to return an object syntax value ({to: v})@@ -308,20 +315,18 @@ class JSAnimation extends timer.Timer {} else {tweenToValue = computedToValue;}- const tweenFromValue = values.getFunctionValue(key.from, target, ti, tl);+ const tweenFromValue = values.getFunctionValue(key.from, target, ti, tl, null, prevSiblingTween);const easeToParse = key.ease || tEasing;- const easeFunctionResult = values.getFunctionValue(easeToParse, target, ti, tl);+ const easeFunctionResult = values.getFunctionValue(easeToParse, target, ti, tl, null, prevSiblingTween);const keyEasing = helpers.isFnc(easeFunctionResult) || helpers.isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;const hasSpring = !helpers.isUnd(keyEasing) && !helpers.isUnd(/** @type {Spring} */(keyEasing).ease);const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;// Calculate default individual keyframe duration by dividing the tl of keyframes- const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : values.getFunctionValue(values.setValue(key.duration, (l > 1 ? values.getFunctionValue(tDuration, target, ti, tl) / l : tDuration)), target, ti, tl);+ const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : values.getFunctionValue(values.setValue(key.duration, (l > 1 ? values.getFunctionValue(tDuration, target, ti, tl, null, prevSiblingTween) / l : tDuration)), target, ti, tl, null, prevSiblingTween);// Default delay value should only be applied to the first tween- const tweenDelay = values.getFunctionValue(values.setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl);- const computedComposition = values.getFunctionValue(values.setValue(key.composition, tComposition), target, ti, tl);- const tweenComposition = helpers.isNum(computedComposition) ? computedComposition : consts.compositionTypes[computedComposition];+ const tweenDelay = values.getFunctionValue(values.setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl, null, prevSiblingTween);// Modifiers are treated differently and don't accept function based value to prevent having to pass a function wrapperconst tweenModifier = key.modifier || tModifier;const hasFromvalue = !helpers.isUnd(tweenFromValue);@@ -338,7 +343,6 @@ class JSAnimation extends timer.Timer {let prevSibling = prevTween;if (tweenComposition !== consts.compositionTypes.none) {- if (!siblings) siblings = composition.getTweenSiblings(target, propName);let nextSibling = siblings._head;// Iterate trough all the next siblings until we find a sibling with an equal or inferior start timewhile (nextSibling && !nextSibling._isOverridden && nextSibling._absoluteStartTime <= absoluteStartTime) {@@ -357,8 +361,8 @@ class JSAnimation extends timer.Timer {// Decompose valuesif (isFromToValue) {- values.decomposeRawValue(isFromToArray ? values.getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore) : tweenFromValue, fromTargetObject);- values.decomposeRawValue(isFromToArray ? values.getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore) : tweenToValue, toTargetObject);+ values.decomposeRawValue(isFromToArray ? values.getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore, prevSiblingTween) : tweenFromValue, fromTargetObject);+ values.decomposeRawValue(isFromToArray ? values.getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore, prevSiblingTween) : tweenToValue, toTargetObject);// Needed to force an inline style registrationconst originalValue = values.getOriginalAnimatableValue(target, propName, tweenType, inlineStylesStore);if (fromTargetObject.t === consts.valueTypes.NUMBER) {@@ -512,6 +516,18 @@ class JSAnimation extends timer.Timer {composition.composeTween(tween, siblings);}+ // Pre-compute the tween end value for function-based value chaining (ie morphTo / scrambleText in keyframe arrays and timelines)+ const vt = tween._valueType;+ if (vt === consts.valueTypes.COMPLEX) {+ tween._value = values.composeComplexValue(tween, 1, -1);+ } else if (vt === consts.valueTypes.COLOR) {+ tween._value = values.composeColorValue(tween, 1, -1);+ } else if (vt === consts.valueTypes.UNIT) {+ tween._value = `${tweenModifier(tween._toNumber)}${tween._unit}`;+ } else {+ tween._value = tweenModifier(tween._toNumber);+ }+if (isNaN(firstTweenChangeStartTime)) {firstTweenChangeStartTime = tween._startTime;}@@ -669,7 +685,7 @@ class JSAnimation extends timer.Timer {*/revert() {super.revert();- return styles.cleanInlineStyles(this);+ return styles.revertValues(this);}/**@@ -691,7 +707,13 @@ class JSAnimation extends timer.Timer {* @param {AnimationParams} parameters* @return {JSAnimation}*/-const animate = (targets, parameters) => new JSAnimation(targets, parameters, null, 0, false).init();+const animate = (targets, parameters) => {+ if (globals.globals.editor) {+ return globals.globals.editor.addAnimation(targets, parameters);+ } else {+ return new JSAnimation(targets, parameters, null, 0, false).init();+ }+};exports.JSAnimation = JSAnimation;exports.animate = animate;diff --git a/dist/modules/animation/animation.d.ts b/dist/modules/animation/animation.d.tsindex 9d560e41..9434ca72 100644--- a/dist/modules/animation/animation.d.ts+++ b/dist/modules/animation/animation.d.ts@@ -6,9 +6,9 @@ export class JSAnimation extends Timer {* @param {Number} [parentPosition]* @param {Boolean} [fastSet=false]* @param {Number} [index=0]- * @param {Number} [length=0]+ * @param {TargetsArray} [allTargets]*/- constructor(targets: TargetsParam, parameters: AnimationParams, parent?: Timeline, parentPosition?: number, fastSet?: boolean, index?: number, length?: number);+ constructor(targets: TargetsParam, parameters: AnimationParams, parent?: Timeline, parentPosition?: number, fastSet?: boolean, index?: number, allTargets?: TargetsArray);/** @type {TargetsArray} */targets: TargetsArray;/** @type {Callback<this>} */diff --git a/dist/modules/animation/animation.js b/dist/modules/animation/animation.jsindex 2f75fecb..68cd802a 100644--- a/dist/modules/animation/animation.js+++ b/dist/modules/animation/animation.js@@ -1,16 +1,16 @@/*** Anime.js - animation - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/-import { K, compositionTypes, valueTypes, minValue, tweenTypes, isDomSymbol } from '../core/consts.js';-import { mergeObjects, isUnd, isKey, isObj, round, cloneArray, isNil, addChild, forEachChildren, clampInfinity, normalizeTime, isArr, isFnc, isStr, isNum } from '../core/helpers.js';+import { K, compositionTypes, valueTypes, minValue, isDomSymbol, tweenTypes } from '../core/consts.js';+import { mergeObjects, isUnd, isKey, isObj, cloneArray, isNil, round, addChild, forEachChildren, clampInfinity, normalizeTime, isArr, isNum, isFnc, isStr } from '../core/helpers.js';import { globals } from '../core/globals.js';import { registerTargets } from '../core/targets.js';-import { setValue, getTweenType, getFunctionValue, decomposeRawValue, getOriginalAnimatableValue, createDecomposedValueTargetObject, decomposedOriginalValue, getRelativeValue, decomposeTweenValue } from '../core/values.js';-import { sanitizePropertyName, cleanInlineStyles } from '../core/styles.js';+import { setValue, getTweenType, getFunctionValue, decomposeRawValue, getOriginalAnimatableValue, createDecomposedValueTargetObject, decomposedOriginalValue, getRelativeValue, composeComplexValue, composeColorValue, decomposeTweenValue } from '../core/values.js';+import { sanitizePropertyName, revertValues } from '../core/styles.js';import { convertValueUnit } from '../core/units.js';import { parseEase } from '../easings/eases/parser.js';import { Timer } from '../timer/timer.js';@@ -160,7 +160,7 @@ class JSAnimation extends Timer {* @param {Number} [parentPosition]* @param {Boolean} [fastSet=false]* @param {Number} [index=0]- * @param {Number} [length=0]+ * @param {TargetsArray} [allTargets]*/constructor(targets,@@ -169,7 +169,7 @@ class JSAnimation extends Timer {parentPosition,fastSet = false,index = 0,- length = 0+ allTargets) {super(/** @type {TimerParams & AnimationParams} */(parameters), parent, parentPosition);@@ -220,7 +220,7 @@ class JSAnimation extends Timer {const target = parsedTargets[targetIndex];const ti = index || targetIndex;- const tl = length || targetsLength;+ const tl = allTargets || parsedTargets;let lastTransformGroupIndex = NaN;let lastTransformGroupLength = NaN;@@ -296,7 +296,14 @@ class JSAnimation extends Timer {toFunctionStore.func = null;fromFunctionStore.func = null;- const computedToValue = getFunctionValue(key.to, target, ti, tl, toFunctionStore);+ const computedComposition = getFunctionValue(setValue(key.composition, tComposition), target, ti, tl, null, null);+ const tweenComposition = isNum(computedComposition) ? computedComposition : compositionTypes[computedComposition];+ if (!siblings && tweenComposition !== compositionTypes.none) siblings = getTweenSiblings(target, propName);+ // Timelines pass the last sibling tween if it belongs to the same timeline+ // Standalone animations only pass prevTween when the property has multiple keyframes+ const tailTween = siblings ? siblings._tail : null;+ const prevSiblingTween = parent && tailTween && tailTween.parent.parent === parent ? tailTween : prevTween;+ const computedToValue = getFunctionValue(key.to, target, ti, tl, toFunctionStore, prevSiblingTween);let tweenToValue;// Allows function based values to return an object syntax value ({to: v})@@ -306,20 +313,18 @@ class JSAnimation extends Timer {} else {tweenToValue = computedToValue;}- const tweenFromValue = getFunctionValue(key.from, target, ti, tl);+ const tweenFromValue = getFunctionValue(key.from, target, ti, tl, null, prevSiblingTween);const easeToParse = key.ease || tEasing;- const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl);+ const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl, null, prevSiblingTween);const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;// Calculate default individual keyframe duration by dividing the tl of keyframes- const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl) / l : tDuration)), target, ti, tl);+ const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl, null, prevSiblingTween) / l : tDuration)), target, ti, tl, null, prevSiblingTween);// Default delay value should only be applied to the first tween- const tweenDelay = getFunctionValue(setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl);- const computedComposition = getFunctionValue(setValue(key.composition, tComposition), target, ti, tl);- const tweenComposition = isNum(computedComposition) ? computedComposition : compositionTypes[computedComposition];+ const tweenDelay = getFunctionValue(setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl, null, prevSiblingTween);// Modifiers are treated differently and don't accept function based value to prevent having to pass a function wrapperconst tweenModifier = key.modifier || tModifier;const hasFromvalue = !isUnd(tweenFromValue);@@ -336,7 +341,6 @@ class JSAnimation extends Timer {let prevSibling = prevTween;if (tweenComposition !== compositionTypes.none) {- if (!siblings) siblings = getTweenSiblings(target, propName);let nextSibling = siblings._head;// Iterate trough all the next siblings until we find a sibling with an equal or inferior start timewhile (nextSibling && !nextSibling._isOverridden && nextSibling._absoluteStartTime <= absoluteStartTime) {@@ -355,8 +359,8 @@ class JSAnimation extends Timer {// Decompose valuesif (isFromToValue) {- decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore) : tweenFromValue, fromTargetObject);- decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore) : tweenToValue, toTargetObject);+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore, prevSiblingTween) : tweenFromValue, fromTargetObject);+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore, prevSiblingTween) : tweenToValue, toTargetObject);// Needed to force an inline style registrationconst originalValue = getOriginalAnimatableValue(target, propName, tweenType, inlineStylesStore);if (fromTargetObject.t === valueTypes.NUMBER) {@@ -510,6 +514,18 @@ class JSAnimation extends Timer {composeTween(tween, siblings);}+ // Pre-compute the tween end value for function-based value chaining (ie morphTo / scrambleText in keyframe arrays and timelines)+ const vt = tween._valueType;+ if (vt === valueTypes.COMPLEX) {+ tween._value = composeComplexValue(tween, 1, -1);+ } else if (vt === valueTypes.COLOR) {+ tween._value = composeColorValue(tween, 1, -1);+ } else if (vt === valueTypes.UNIT) {+ tween._value = `${tweenModifier(tween._toNumber)}${tween._unit}`;+ } else {+ tween._value = tweenModifier(tween._toNumber);+ }+if (isNaN(firstTweenChangeStartTime)) {firstTweenChangeStartTime = tween._startTime;}@@ -667,7 +683,7 @@ class JSAnimation extends Timer {*/revert() {super.revert();- return cleanInlineStyles(this);+ return revertValues(this);}/**@@ -689,6 +705,12 @@ class JSAnimation extends Timer {* @param {AnimationParams} parameters* @return {JSAnimation}*/-const animate = (targets, parameters) => new JSAnimation(targets, parameters, null, 0, false).init();+const animate = (targets, parameters) => {+ if (globals.editor) {+ return globals.editor.addAnimation(targets, parameters);+ } else {+ return new JSAnimation(targets, parameters, null, 0, false).init();+ }+};export { JSAnimation, animate };diff --git a/dist/modules/animation/composition.cjs b/dist/modules/animation/composition.cjsindex 8887ffea..7e0a4077 100644--- a/dist/modules/animation/composition.cjs+++ b/dist/modules/animation/composition.cjs@@ -1,6 +1,6 @@/*** Anime.js - animation - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/animation/composition.js b/dist/modules/animation/composition.jsindex b4f665b4..0229de92 100644--- a/dist/modules/animation/composition.js+++ b/dist/modules/animation/composition.js@@ -1,15 +1,15 @@/*** Anime.js - animation - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/-import { minValue, compositionTypes, tweenTypes } from '../core/consts.js';+import { compositionTypes, minValue, tweenTypes } from '../core/consts.js';import { forEachChildren, removeChild, isUnd, addChild, round, cloneArray } from '../core/helpers.js';import { sanitizePropertyName } from '../core/styles.js';import { engine } from '../engine/engine.js';-import { addAdditiveAnimation, additive } from './additive.js';+import { additive, addAdditiveAnimation } from './additive.js';/*** @import {diff --git a/dist/modules/animation/index.cjs b/dist/modules/animation/index.cjsindex dd1af95d..115b2a4f 100644--- a/dist/modules/animation/index.cjs+++ b/dist/modules/animation/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - animation - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/animation/index.js b/dist/modules/animation/index.jsindex 4118467b..8d5007b6 100644--- a/dist/modules/animation/index.js+++ b/dist/modules/animation/index.js@@ -1,6 +1,6 @@/*** Anime.js - animation - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/core/clock.cjs b/dist/modules/core/clock.cjsindex c6c01831..2c75b552 100644--- a/dist/modules/core/clock.cjs+++ b/dist/modules/core/clock.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/core/clock.js b/dist/modules/core/clock.jsindex 68352dc7..97a194cf 100644--- a/dist/modules/core/clock.js+++ b/dist/modules/core/clock.js@@ -1,6 +1,6 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/core/colors.cjs b/dist/modules/core/colors.cjsindex 6f46e44e..b96fa8bf 100644--- a/dist/modules/core/colors.cjs+++ b/dist/modules/core/colors.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/core/colors.js b/dist/modules/core/colors.jsindex 1c603391..1b749a00 100644--- a/dist/modules/core/colors.js+++ b/dist/modules/core/colors.js@@ -1,6 +1,6 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/core/consts.cjs b/dist/modules/core/consts.cjsindex 85c007a1..8374d14a 100644--- a/dist/modules/core/consts.cjs+++ b/dist/modules/core/consts.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -12,7 +12,7 @@// TODO: Do we need to check if we're running inside a worker ?const isBrowser = typeof window !== 'undefined';-/** @typedef {Window & {AnimeJS: Array} & {AnimeJSDevTools: any}|null} AnimeJSWindow+/** @typedef {Window & {AnimeJS: Array}|null} AnimeJSWindow/** @type {AnimeJSWindow} */const win = isBrowser ? /** @type {AnimeJSWindow} */(/** @type {unknown} */(window)) : null;@@ -59,7 +59,6 @@ const isRegisteredTargetSymbol = Symbol();const isDomSymbol = Symbol();const isSvgSymbol = Symbol();const transformsSymbol = Symbol();-const morphPointsSymbol = Symbol();const proxyTargetSymbol = Symbol();// Numbers@@ -83,6 +82,7 @@ const shortTransforms = /*#__PURE__*/ (() => {})();const validTransforms = [+ 'perspective','translateX','translateY','translateZ',@@ -97,9 +97,6 @@ const validTransforms = ['skew','skewX','skewY',- 'matrix',- 'matrix3d',- 'perspective',];const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});@@ -122,7 +119,6 @@ const digitWithExponentRgx = /[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;// export const unitsExecRgx = /^([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)+([a-z]+|%)$/i;const unitsExecRgx = /^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;const lowerCaseRgx = /([a-z])([A-Z])/g;-const transformsExecRgx = /(\w+)(\([^)]+\)+)/g; // Match inline transforms with cacl() values, returns the value wrapped in ()const relativeValuesExecRgx = /(\*=|\+=|-=)/;const cssVariableMatchRgx = /var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/;@@ -144,7 +140,6 @@ exports.lowerCaseRgx = lowerCaseRgx;exports.maxFps = maxFps;exports.maxValue = maxValue;exports.minValue = minValue;-exports.morphPointsSymbol = morphPointsSymbol;exports.noop = noop;exports.proxyTargetSymbol = proxyTargetSymbol;exports.relativeValuesExecRgx = relativeValuesExecRgx;@@ -152,7 +147,6 @@ exports.rgbExecRgx = rgbExecRgx;exports.rgbaExecRgx = rgbaExecRgx;exports.shortTransforms = shortTransforms;exports.tickModes = tickModes;-exports.transformsExecRgx = transformsExecRgx;exports.transformsFragmentStrings = transformsFragmentStrings;exports.transformsSymbol = transformsSymbol;exports.tweenTypes = tweenTypes;diff --git a/dist/modules/core/consts.d.ts b/dist/modules/core/consts.d.tsindex ffa48c4d..e4916e49 100644--- a/dist/modules/core/consts.d.ts+++ b/dist/modules/core/consts.d.ts@@ -1,5 +1,5 @@export const isBrowser: boolean;-/** @typedef {Window & {AnimeJS: Array} & {AnimeJSDevTools: any}|null} AnimeJSWindow+/** @typedef {Window & {AnimeJS: Array}|null} AnimeJSWindow/** @type {AnimeJSWindow} */export const win: AnimeJSWindow;@@ -36,7 +36,6 @@ export const isRegisteredTargetSymbol: unique symbol;export const isDomSymbol: unique symbol;export const isSvgSymbol: unique symbol;export const transformsSymbol: unique symbol;-export const morphPointsSymbol: unique symbol;export const proxyTargetSymbol: unique symbol;export const minValue: 1e-11;export const maxValue: 1000000000000;@@ -57,7 +56,6 @@ export const hslaExecRgx: RegExp;export const digitWithExponentRgx: RegExp;export const unitsExecRgx: RegExp;export const lowerCaseRgx: RegExp;-export const transformsExecRgx: RegExp;export const relativeValuesExecRgx: RegExp;export const cssVariableMatchRgx: RegExp;/**@@ -65,6 +63,4 @@ export const cssVariableMatchRgx: RegExp;*/export type AnimeJSWindow = (Window & {AnimeJS: any[];-} & {- AnimeJSDevTools: any;}) | null;diff --git a/dist/modules/core/consts.js b/dist/modules/core/consts.jsindex 7654fc60..780f2135 100644--- a/dist/modules/core/consts.js+++ b/dist/modules/core/consts.js@@ -1,6 +1,6 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -10,7 +10,7 @@// TODO: Do we need to check if we're running inside a worker ?const isBrowser = typeof window !== 'undefined';-/** @typedef {Window & {AnimeJS: Array} & {AnimeJSDevTools: any}|null} AnimeJSWindow+/** @typedef {Window & {AnimeJS: Array}|null} AnimeJSWindow/** @type {AnimeJSWindow} */const win = isBrowser ? /** @type {AnimeJSWindow} */(/** @type {unknown} */(window)) : null;@@ -57,7 +57,6 @@ const isRegisteredTargetSymbol = Symbol();const isDomSymbol = Symbol();const isSvgSymbol = Symbol();const transformsSymbol = Symbol();-const morphPointsSymbol = Symbol();const proxyTargetSymbol = Symbol();// Numbers@@ -81,6 +80,7 @@ const shortTransforms = /*#__PURE__*/ (() => {})();const validTransforms = [+ 'perspective','translateX','translateY','translateZ',@@ -95,9 +95,6 @@ const validTransforms = ['skew','skewX','skewY',- 'matrix',- 'matrix3d',- 'perspective',];const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});@@ -120,8 +117,7 @@ const digitWithExponentRgx = /[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;// export const unitsExecRgx = /^([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)+([a-z]+|%)$/i;const unitsExecRgx = /^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;const lowerCaseRgx = /([a-z])([A-Z])/g;-const transformsExecRgx = /(\w+)(\([^)]+\)+)/g; // Match inline transforms with cacl() values, returns the value wrapped in ()const relativeValuesExecRgx = /(\*=|\+=|-=)/;const cssVariableMatchRgx = /var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/;-export { K, compositionTypes, cssVarPrefix, cssVariableMatchRgx, digitWithExponentRgx, doc, emptyString, hexTestRgx, hslExecRgx, hslaExecRgx, isBrowser, isDomSymbol, isRegisteredTargetSymbol, isSvgSymbol, lowerCaseRgx, maxFps, maxValue, minValue, morphPointsSymbol, noop, proxyTargetSymbol, relativeValuesExecRgx, rgbExecRgx, rgbaExecRgx, shortTransforms, tickModes, transformsExecRgx, transformsFragmentStrings, transformsSymbol, tweenTypes, unitsExecRgx, validRgbHslRgx, validTransforms, valueTypes, win };+export { K, compositionTypes, cssVarPrefix, cssVariableMatchRgx, digitWithExponentRgx, doc, emptyString, hexTestRgx, hslExecRgx, hslaExecRgx, isBrowser, isDomSymbol, isRegisteredTargetSymbol, isSvgSymbol, lowerCaseRgx, maxFps, maxValue, minValue, noop, proxyTargetSymbol, relativeValuesExecRgx, rgbExecRgx, rgbaExecRgx, shortTransforms, tickModes, transformsFragmentStrings, transformsSymbol, tweenTypes, unitsExecRgx, validRgbHslRgx, validTransforms, valueTypes, win };diff --git a/dist/modules/core/globals.cjs b/dist/modules/core/globals.cjsindex 8c6af6cf..dc4e3ae6 100644--- a/dist/modules/core/globals.cjs+++ b/dist/modules/core/globals.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -20,6 +20,18 @@ var consts = require('./consts.cjs');* } from '../scope/index.js'*/+/**+ * @typedef {Object} EditorGlobals+ * @property {boolean} showPanel+ * @property {boolean} synced+ * @property {Function} addAnimation+ * @property {Function} addTimeline+ * @property {Function} addTimelineChild+ * @property {Function} resolveStagger+ * @property {Object|null} _head+ * @property {Object|null} _tail+ */+/** @type {DefaultsParams} */const defaults = {id: null,@@ -63,11 +75,11 @@ const globals = {timeScale: 1,/** @type {Number} */tickThreshold: 200,+ /** @type {EditorGlobals|null} */+ editor: null,};-const devTools = consts.isBrowser && consts.win.AnimeJSDevTools;--const globalVersions = { version: '4.3.6', engine: null };+const globalVersions = { version: '4.4.0', engine: null };if (consts.isBrowser) {if (!consts.win.AnimeJS) consts.win.AnimeJS = [];@@ -75,7 +87,6 @@ if (consts.isBrowser) {}exports.defaults = defaults;-exports.devTools = devTools;exports.globalVersions = globalVersions;exports.globals = globals;exports.scope = scope;diff --git a/dist/modules/core/globals.d.ts b/dist/modules/core/globals.d.tsindex 7d85c57e..144aeef9 100644--- a/dist/modules/core/globals.d.ts+++ b/dist/modules/core/globals.d.ts@@ -8,6 +8,17 @@* Scope,* } from '../scope/index.js'*/+/**+ * @typedef {Object} EditorGlobals+ * @property {boolean} showPanel+ * @property {boolean} synced+ * @property {Function} addAnimation+ * @property {Function} addTimeline+ * @property {Function} addTimelineChild+ * @property {Function} resolveStagger+ * @property {Object|null} _head+ * @property {Object|null} _tail+ *//** @type {DefaultsParams} */export const defaults: DefaultsParams;export namespace scope {@@ -19,12 +30,22 @@ export namespace globals {export let precision: number;export let timeScale: number;export let tickThreshold: number;+ export let editor: EditorGlobals | null;}-export const devTools: any;export namespace globalVersions {let version: string;let engine: any;}+export type EditorGlobals = {+ showPanel: boolean;+ synced: boolean;+ addAnimation: Function;+ addTimeline: Function;+ addTimelineChild: Function;+ resolveStagger: Function;+ _head: any | null;+ _tail: any | null;+};import type { DefaultsParams } from '../types/index.js';import type { Scope } from '../scope/index.js';import { doc } from './consts.js';diff --git a/dist/modules/core/globals.js b/dist/modules/core/globals.jsindex a00c2a5f..1d25fbe4 100644--- a/dist/modules/core/globals.js+++ b/dist/modules/core/globals.js@@ -1,11 +1,11 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/-import { isBrowser, win, noop, maxFps, K, compositionTypes, doc } from './consts.js';+import { isBrowser, win, noop, compositionTypes, K, maxFps, doc } from './consts.js';/*** @import {@@ -18,6 +18,18 @@ import { isBrowser, win, noop, maxFps, K, compositionTypes, doc } from './consts* } from '../scope/index.js'*/+/**+ * @typedef {Object} EditorGlobals+ * @property {boolean} showPanel+ * @property {boolean} synced+ * @property {Function} addAnimation+ * @property {Function} addTimeline+ * @property {Function} addTimelineChild+ * @property {Function} resolveStagger+ * @property {Object|null} _head+ * @property {Object|null} _tail+ */+/** @type {DefaultsParams} */const defaults = {id: null,@@ -61,15 +73,15 @@ const globals = {timeScale: 1,/** @type {Number} */tickThreshold: 200,+ /** @type {EditorGlobals|null} */+ editor: null,};-const devTools = isBrowser && win.AnimeJSDevTools;--const globalVersions = { version: '4.3.6', engine: null };+const globalVersions = { version: '4.4.0', engine: null };if (isBrowser) {if (!win.AnimeJS) win.AnimeJS = [];win.AnimeJS.push(globalVersions);}-export { defaults, devTools, globalVersions, globals, scope };+export { defaults, globalVersions, globals, scope };diff --git a/dist/modules/core/helpers.cjs b/dist/modules/core/helpers.cjsindex 7ec8834e..1c4abf50 100644--- a/dist/modules/core/helpers.cjs+++ b/dist/modules/core/helpers.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -124,8 +124,6 @@ const _round = Math.round;*/const clamp = (v, min, max) => v < min ? min : v > max ? max : v;-const powCache = {};-/*** Rounds a number to specified decimal places*@@ -133,13 +131,12 @@ const powCache = {};* @param {Number} decimalLength - Number of decimal places* @return {Number}*/-const round = (v, decimalLength) => {- if (decimalLength < 0) return v;- if (!decimalLength) return _round(v);- let p = powCache[decimalLength];- if (!p) p = powCache[decimalLength] = 10 ** decimalLength;- return _round(v * p) / p;-};+ const round = (v, decimalLength) => {+ if (decimalLength < 0) return v;+ if (!decimalLength) return _round(v);+ const p = 10 ** decimalLength;+ return _round(v * p) / p;+ };/*** Snaps a value to nearest increment or array valuediff --git a/dist/modules/core/helpers.js b/dist/modules/core/helpers.jsindex d2751d69..d2051bdf 100644--- a/dist/modules/core/helpers.js+++ b/dist/modules/core/helpers.js@@ -1,11 +1,11 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/-import { isBrowser, maxValue, minValue, hexTestRgx, lowerCaseRgx, validRgbHslRgx } from './consts.js';+import { isBrowser, maxValue, minValue, lowerCaseRgx, hexTestRgx, validRgbHslRgx } from './consts.js';import { globals } from './globals.js';/**@@ -122,8 +122,6 @@ const _round = Math.round;*/const clamp = (v, min, max) => v < min ? min : v > max ? max : v;-const powCache = {};-/*** Rounds a number to specified decimal places*@@ -131,13 +129,12 @@ const powCache = {};* @param {Number} decimalLength - Number of decimal places* @return {Number}*/-const round = (v, decimalLength) => {- if (decimalLength < 0) return v;- if (!decimalLength) return _round(v);- let p = powCache[decimalLength];- if (!p) p = powCache[decimalLength] = 10 ** decimalLength;- return _round(v * p) / p;-};+ const round = (v, decimalLength) => {+ if (decimalLength < 0) return v;+ if (!decimalLength) return _round(v);+ const p = 10 ** decimalLength;+ return _round(v * p) / p;+ };/*** Snaps a value to nearest increment or array valuediff --git a/dist/modules/core/render.cjs b/dist/modules/core/render.cjsindex 110aece1..a492f449 100644--- a/dist/modules/core/render.cjs+++ b/dist/modules/core/render.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -10,9 +10,11 @@var globals = require('./globals.cjs');var consts = require('./consts.cjs');var helpers = require('./helpers.cjs');+var transforms = require('./transforms.cjs');+var values = require('./values.cjs');/**- * @import {+ * @import {* Tickable,* Renderable,* CallbackArgument,@@ -55,7 +57,6 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {const _hasChildren = tickable._hasChildren;const tickableDelay = tickable._delay;const tickablePrevAbsoluteTime = tickable._currentTime; // TODO: rename ._currentTime to ._absoluteCurrentTime-const tickableEndTime = tickableDelay + iterationDuration;const tickableAbsoluteTime = time - tickableDelay;const tickablePrevTime = helpers.clamp(tickablePrevAbsoluteTime, -tickableDelay, duration);@@ -187,30 +188,9 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {number = /** @type {Number} */(tweenModifier(helpers.round(helpers.lerp(tween._fromNumber, tween._toNumber, tweenProgress), tweenPrecision)));value = `${number}${tween._unit}`;} else if (tweenValueType === consts.valueTypes.COLOR) {- const fn = tween._fromNumbers;- const tn = tween._toNumbers;- const r = helpers.round(helpers.clamp(/** @type {Number} */(tweenModifier(helpers.lerp(fn[0], tn[0], tweenProgress))), 0, 255), 0);- const g = helpers.round(helpers.clamp(/** @type {Number} */(tweenModifier(helpers.lerp(fn[1], tn[1], tweenProgress))), 0, 255), 0);- const b = helpers.round(helpers.clamp(/** @type {Number} */(tweenModifier(helpers.lerp(fn[2], tn[2], tweenProgress))), 0, 255), 0);- const a = helpers.clamp(/** @type {Number} */(tweenModifier(helpers.round(helpers.lerp(fn[3], tn[3], tweenProgress), tweenPrecision))), 0, 1);- value = `rgba(${r},${g},${b},${a})`;- if (tweenHasComposition) {- const ns = tween._numbers;- ns[0] = r;- ns[1] = g;- ns[2] = b;- ns[3] = a;- }+ value = values.composeColorValue(tween, tweenProgress, tweenPrecision);} else if (tweenValueType === consts.valueTypes.COMPLEX) {- value = tween._strings[0];- for (let j = 0, l = tween._toNumbers.length; j < l; j++) {- const n = /** @type {Number} */(tweenModifier(helpers.round(helpers.lerp(tween._fromNumbers[j], tween._toNumbers[j], tweenProgress), tweenPrecision)));- const s = tween._strings[j + 1];- value += `${s ? n + s : n}`;- if (tweenHasComposition) {- tween._numbers[j] = n;- }- }+ value = values.composeComplexValue(tween, tweenProgress, tweenPrecision);}// For additive tweens and Animatables@@ -253,14 +233,8 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {}- // NOTE: Possible improvement: Use translate(x,y) / translate3d(x,y,z) syntax- // to reduce memory usage on string compositionif (tweenTransformsNeedUpdate && tween._renderTransforms) {- let str = consts.emptyString;- for (let key in tweenTargetTransformsProperties) {- str += `${consts.transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `;- }- tweenStyle.transform = str;+ tweenStyle.transform = transforms.buildTransformString(tweenTargetTransformsProperties);tweenTransformsNeedUpdate = 0;}@@ -317,6 +291,50 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {return hasRendered;};+// Shared context for extracted forEachChildren callbacks in tick()+// Avoids closure allocation every frame++let renderCtxChildrenTime = 0;+let renderCtxTlFps = 0;+let renderCtxTickTime = 0;+let renderCtxTickMode = 0;+let renderCtxMuteCallbacks = 0;+let renderCtxInternalRender = 0;+let renderCtxChildrenHasRendered = 0;+let renderCtxChildrenHaveCompleted = true;+let loopCtxIsRunningBackwards = false;+let loopCtxIterationDuration = 0;+let loopCtxMuteCallbacks = 0;++/** @param {JSAnimation} child */+const tickLoopChild = (child) => {+ if (!loopCtxIsRunningBackwards) {+ // Force an internal render to trigger the callbacks if the child has not completed on loop+ if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {+ render(child, loopCtxIterationDuration, loopCtxMuteCallbacks, 1, consts.tickModes.FORCE);+ }+ // Reset their began and completed flags to allow retrigering callbacks on the next iteration+ child.began = false;+ child.completed = false;+ } else {+ const childDuration = child.duration;+ const childStartTime = child._offset + child._delay;+ const childEndTime = childStartTime + childDuration;+ // Triggers the onComplete callback on reverse for children on the edges of the timeline+ if (!loopCtxMuteCallbacks && childDuration <= consts.minValue && (!childStartTime || childEndTime === loopCtxIterationDuration)) {+ child.onComplete(child);+ }+ }+};++/** @param {JSAnimation} child */+const tickRenderChild = (child) => {+ const childTime = helpers.round((renderCtxChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds+ const childTickMode = child._fps < renderCtxTlFps ? child.requestTick(renderCtxTickTime) : renderCtxTickMode;+ renderCtxChildrenHasRendered += render(child, childTime, renderCtxMuteCallbacks, renderCtxInternalRender, childTickMode);+ if (!child.completed && renderCtxChildrenHaveCompleted) renderCtxChildrenHaveCompleted = false;+};+/*** @param {Tickable} tickable* @param {Number} time@@ -333,45 +351,30 @@ const tick = (tickable, time, muteCallbacks, internalRender, tickMode) => {const tlIsRunningBackwards = tl.backwards;const tlChildrenTime = internalRender ? time : tl._iterationTime;const tlCildrenTickTime = helpers.now();-let tlChildrenHasRendered = 0;let tlChildrenHaveCompleted = true;-// If the timeline has looped forward, we need to manually triggers children skipped callbacksif (!internalRender && tl._currentIteration !== _currentIteration) {const tlIterationDuration = tl.iterationDuration;- helpers.forEachChildren(tl, (/** @type {JSAnimation} */child) => {- if (!tlIsRunningBackwards) {- // Force an internal render to trigger the callbacks if the child has not completed on loop- if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {- render(child, tlIterationDuration, muteCallbacks, 1, consts.tickModes.FORCE);- }- // Reset their began and completed flags to allow retrigering callbacks on the next iteration- child.began = false;- child.completed = false;- } else {- const childDuration = child.duration;- const childStartTime = child._offset + child._delay;- const childEndTime = childStartTime + childDuration;- // Triggers the onComplete callback on reverse for children on the edges of the timeline- if (!muteCallbacks && childDuration <= consts.minValue && (!childStartTime || childEndTime === tlIterationDuration)) {- child.onComplete(child);- }- }- });+ loopCtxIsRunningBackwards = tlIsRunningBackwards;+ loopCtxIterationDuration = tlIterationDuration;+ loopCtxMuteCallbacks = muteCallbacks;+ helpers.forEachChildren(tl, tickLoopChild);if (!muteCallbacks) tl.onLoop(/** @type {CallbackArgument} */(tl));}-- helpers.forEachChildren(tl, (/** @type {JSAnimation} */child) => {- const childTime = helpers.round((tlChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds- const childTickMode = child._fps < tl._fps ? child.requestTick(tlCildrenTickTime) : tickMode;- tlChildrenHasRendered += render(child, childTime, muteCallbacks, internalRender, childTickMode);- if (!child.completed && tlChildrenHaveCompleted) tlChildrenHaveCompleted = false;- }, tlIsRunningBackwards);-+ renderCtxChildrenTime = tlChildrenTime;+ renderCtxTlFps = tl._fps;+ renderCtxTickTime = tlCildrenTickTime;+ renderCtxTickMode = tickMode;+ renderCtxMuteCallbacks = muteCallbacks;+ renderCtxInternalRender = internalRender;+ renderCtxChildrenHasRendered = 0;+ renderCtxChildrenHaveCompleted = true;+ helpers.forEachChildren(tl, tickRenderChild, tlIsRunningBackwards);+ tlChildrenHasRendered = renderCtxChildrenHasRendered;+ tlChildrenHaveCompleted = renderCtxChildrenHaveCompleted;// Renders on timeline are triggered by its children so it needs to be set after rendering the childrenif (!muteCallbacks && tlChildrenHasRendered) tl.onRender(/** @type {CallbackArgument} */(tl));-// Triggers the timeline onComplete() once all chindren all completed and the current time has reached the endif ((tlChildrenHaveCompleted || tlIsRunningBackwards) && tl._currentTime >= tl.duration) {// Make sure the paused flag is false in case it has been skipped in the render functiondiff --git a/dist/modules/core/render.js b/dist/modules/core/render.jsindex 51732a63..d92e544d 100644--- a/dist/modules/core/render.js+++ b/dist/modules/core/render.js@@ -1,16 +1,18 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/import { globals } from './globals.js';-import { minValue, tickModes, valueTypes, compositionTypes, tweenTypes, transformsSymbol, transformsFragmentStrings, emptyString } from './consts.js';-import { forEachChildren, round, now, clamp, lerp } from './helpers.js';+import { tickModes, valueTypes, compositionTypes, tweenTypes, transformsSymbol, minValue } from './consts.js';+import { forEachChildren, clamp, round, lerp, now } from './helpers.js';+import { buildTransformString } from './transforms.js';+import { composeColorValue, composeComplexValue } from './values.js';/**- * @import {+ * @import {* Tickable,* Renderable,* CallbackArgument,@@ -53,7 +55,6 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {const _hasChildren = tickable._hasChildren;const tickableDelay = tickable._delay;const tickablePrevAbsoluteTime = tickable._currentTime; // TODO: rename ._currentTime to ._absoluteCurrentTime-const tickableEndTime = tickableDelay + iterationDuration;const tickableAbsoluteTime = time - tickableDelay;const tickablePrevTime = clamp(tickablePrevAbsoluteTime, -tickableDelay, duration);@@ -185,30 +186,9 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {number = /** @type {Number} */(tweenModifier(round(lerp(tween._fromNumber, tween._toNumber, tweenProgress), tweenPrecision)));value = `${number}${tween._unit}`;} else if (tweenValueType === valueTypes.COLOR) {- const fn = tween._fromNumbers;- const tn = tween._toNumbers;- const r = round(clamp(/** @type {Number} */(tweenModifier(lerp(fn[0], tn[0], tweenProgress))), 0, 255), 0);- const g = round(clamp(/** @type {Number} */(tweenModifier(lerp(fn[1], tn[1], tweenProgress))), 0, 255), 0);- const b = round(clamp(/** @type {Number} */(tweenModifier(lerp(fn[2], tn[2], tweenProgress))), 0, 255), 0);- const a = clamp(/** @type {Number} */(tweenModifier(round(lerp(fn[3], tn[3], tweenProgress), tweenPrecision))), 0, 1);- value = `rgba(${r},${g},${b},${a})`;- if (tweenHasComposition) {- const ns = tween._numbers;- ns[0] = r;- ns[1] = g;- ns[2] = b;- ns[3] = a;- }+ value = composeColorValue(tween, tweenProgress, tweenPrecision);} else if (tweenValueType === valueTypes.COMPLEX) {- value = tween._strings[0];- for (let j = 0, l = tween._toNumbers.length; j < l; j++) {- const n = /** @type {Number} */(tweenModifier(round(lerp(tween._fromNumbers[j], tween._toNumbers[j], tweenProgress), tweenPrecision)));- const s = tween._strings[j + 1];- value += `${s ? n + s : n}`;- if (tweenHasComposition) {- tween._numbers[j] = n;- }- }+ value = composeComplexValue(tween, tweenProgress, tweenPrecision);}// For additive tweens and Animatables@@ -251,14 +231,8 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {}- // NOTE: Possible improvement: Use translate(x,y) / translate3d(x,y,z) syntax- // to reduce memory usage on string compositionif (tweenTransformsNeedUpdate && tween._renderTransforms) {- let str = emptyString;- for (let key in tweenTargetTransformsProperties) {- str += `${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `;- }- tweenStyle.transform = str;+ tweenStyle.transform = buildTransformString(tweenTargetTransformsProperties);tweenTransformsNeedUpdate = 0;}@@ -315,6 +289,50 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {return hasRendered;};+// Shared context for extracted forEachChildren callbacks in tick()+// Avoids closure allocation every frame++let renderCtxChildrenTime = 0;+let renderCtxTlFps = 0;+let renderCtxTickTime = 0;+let renderCtxTickMode = 0;+let renderCtxMuteCallbacks = 0;+let renderCtxInternalRender = 0;+let renderCtxChildrenHasRendered = 0;+let renderCtxChildrenHaveCompleted = true;+let loopCtxIsRunningBackwards = false;+let loopCtxIterationDuration = 0;+let loopCtxMuteCallbacks = 0;++/** @param {JSAnimation} child */+const tickLoopChild = (child) => {+ if (!loopCtxIsRunningBackwards) {+ // Force an internal render to trigger the callbacks if the child has not completed on loop+ if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {+ render(child, loopCtxIterationDuration, loopCtxMuteCallbacks, 1, tickModes.FORCE);+ }+ // Reset their began and completed flags to allow retrigering callbacks on the next iteration+ child.began = false;+ child.completed = false;+ } else {+ const childDuration = child.duration;+ const childStartTime = child._offset + child._delay;+ const childEndTime = childStartTime + childDuration;+ // Triggers the onComplete callback on reverse for children on the edges of the timeline+ if (!loopCtxMuteCallbacks && childDuration <= minValue && (!childStartTime || childEndTime === loopCtxIterationDuration)) {+ child.onComplete(child);+ }+ }+};++/** @param {JSAnimation} child */+const tickRenderChild = (child) => {+ const childTime = round((renderCtxChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds+ const childTickMode = child._fps < renderCtxTlFps ? child.requestTick(renderCtxTickTime) : renderCtxTickMode;+ renderCtxChildrenHasRendered += render(child, childTime, renderCtxMuteCallbacks, renderCtxInternalRender, childTickMode);+ if (!child.completed && renderCtxChildrenHaveCompleted) renderCtxChildrenHaveCompleted = false;+};+/*** @param {Tickable} tickable* @param {Number} time@@ -331,45 +349,30 @@ const tick = (tickable, time, muteCallbacks, internalRender, tickMode) => {const tlIsRunningBackwards = tl.backwards;const tlChildrenTime = internalRender ? time : tl._iterationTime;const tlCildrenTickTime = now();-let tlChildrenHasRendered = 0;let tlChildrenHaveCompleted = true;-// If the timeline has looped forward, we need to manually triggers children skipped callbacksif (!internalRender && tl._currentIteration !== _currentIteration) {const tlIterationDuration = tl.iterationDuration;- forEachChildren(tl, (/** @type {JSAnimation} */child) => {- if (!tlIsRunningBackwards) {- // Force an internal render to trigger the callbacks if the child has not completed on loop- if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {- render(child, tlIterationDuration, muteCallbacks, 1, tickModes.FORCE);- }- // Reset their began and completed flags to allow retrigering callbacks on the next iteration- child.began = false;- child.completed = false;- } else {- const childDuration = child.duration;- const childStartTime = child._offset + child._delay;- const childEndTime = childStartTime + childDuration;- // Triggers the onComplete callback on reverse for children on the edges of the timeline- if (!muteCallbacks && childDuration <= minValue && (!childStartTime || childEndTime === tlIterationDuration)) {- child.onComplete(child);- }- }- });+ loopCtxIsRunningBackwards = tlIsRunningBackwards;+ loopCtxIterationDuration = tlIterationDuration;+ loopCtxMuteCallbacks = muteCallbacks;+ forEachChildren(tl, tickLoopChild);if (!muteCallbacks) tl.onLoop(/** @type {CallbackArgument} */(tl));}-- forEachChildren(tl, (/** @type {JSAnimation} */child) => {- const childTime = round((tlChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds- const childTickMode = child._fps < tl._fps ? child.requestTick(tlCildrenTickTime) : tickMode;- tlChildrenHasRendered += render(child, childTime, muteCallbacks, internalRender, childTickMode);- if (!child.completed && tlChildrenHaveCompleted) tlChildrenHaveCompleted = false;- }, tlIsRunningBackwards);-+ renderCtxChildrenTime = tlChildrenTime;+ renderCtxTlFps = tl._fps;+ renderCtxTickTime = tlCildrenTickTime;+ renderCtxTickMode = tickMode;+ renderCtxMuteCallbacks = muteCallbacks;+ renderCtxInternalRender = internalRender;+ renderCtxChildrenHasRendered = 0;+ renderCtxChildrenHaveCompleted = true;+ forEachChildren(tl, tickRenderChild, tlIsRunningBackwards);+ tlChildrenHasRendered = renderCtxChildrenHasRendered;+ tlChildrenHaveCompleted = renderCtxChildrenHaveCompleted;// Renders on timeline are triggered by its children so it needs to be set after rendering the childrenif (!muteCallbacks && tlChildrenHasRendered) tl.onRender(/** @type {CallbackArgument} */(tl));-// Triggers the timeline onComplete() once all chindren all completed and the current time has reached the endif ((tlChildrenHaveCompleted || tlIsRunningBackwards) && tl._currentTime >= tl.duration) {// Make sure the paused flag is false in case it has been skipped in the render functiondiff --git a/dist/modules/core/styles.cjs b/dist/modules/core/styles.cjsindex 3bf58059..086cf662 100644--- a/dist/modules/core/styles.cjs+++ b/dist/modules/core/styles.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -9,6 +9,7 @@var consts = require('./consts.cjs');var helpers = require('./helpers.cjs');+var transforms = require('./transforms.cjs');/*** @import {@@ -59,58 +60,78 @@ const sanitizePropertyName = (propertyName, target, tweenType) => {/*** @template {Renderable} T* @param {T} renderable+ * @param {Boolean} [inlineStylesOnly]* @return {T}*/-const cleanInlineStyles = renderable => {- // Allow cleanInlineStyles() to be called on timelines+const revertValues = (renderable, inlineStylesOnly = false) => {+ // Allow revertValues() to be called on timelinesif (renderable._hasChildren) {- helpers.forEachChildren(renderable, cleanInlineStyles, true);+ helpers.forEachChildren(renderable, (/** @type {Renderable} */child) => revertValues(child, inlineStylesOnly), true);} else {const animation = /** @type {JSAnimation} */(renderable);animation.pause();helpers.forEachChildren(animation, (/** @type {Tween} */tween) => {const tweenProperty = tween.property;const tweenTarget = tween.target;- if (tweenTarget[consts.isDomSymbol]) {- const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;- const originalInlinedValue = tween._inlineValue;- const tweenHadNoInlineValue = helpers.isNil(originalInlinedValue) || originalInlinedValue === consts.emptyString;- if (tween._tweenType === consts.tweenTypes.TRANSFORM) {- const cachedTransforms = tweenTarget[consts.transformsSymbol];- if (tweenHadNoInlineValue) {- delete cachedTransforms[tweenProperty];- } else {- cachedTransforms[tweenProperty] = originalInlinedValue;- }- if (tween._renderTransforms) {- if (!Object.keys(cachedTransforms).length) {- targetStyle.removeProperty('transform');+ const tweenType = tween._tweenType;+ const originalInlinedValue = tween._inlineValue;+ const tweenHadNoInlineValue = helpers.isNil(originalInlinedValue) || originalInlinedValue === consts.emptyString;+ if (tweenType === consts.tweenTypes.OBJECT) {+ if (!inlineStylesOnly && !tweenHadNoInlineValue) {+ tweenTarget[tweenProperty] = originalInlinedValue;+ }+ } else if (tweenTarget[consts.isDomSymbol]) {+ if (tweenType === consts.tweenTypes.ATTRIBUTE) {+ if (!inlineStylesOnly) {+ if (tweenHadNoInlineValue) {+ /** @type {DOMTarget} */(tweenTarget).removeAttribute(tweenProperty);} else {- let str = consts.emptyString;- for (let key in cachedTransforms) {- str += consts.transformsFragmentStrings[key] + cachedTransforms[key] + ') ';- }- targetStyle.transform = str;+ /** @type {DOMTarget} */(tweenTarget).setAttribute(tweenProperty, /** @type {String} */(originalInlinedValue));}}} else {- if (tweenHadNoInlineValue) {- targetStyle.removeProperty(helpers.toLowerCase(tweenProperty));+ const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;+ if (tweenType === consts.tweenTypes.TRANSFORM) {+ const cachedTransforms = tweenTarget[consts.transformsSymbol];+ if (tweenHadNoInlineValue) {+ delete cachedTransforms[tweenProperty];+ } else {+ cachedTransforms[tweenProperty] = originalInlinedValue;+ }+ if (tween._renderTransforms) {+ if (!Object.keys(cachedTransforms).length) {+ targetStyle.removeProperty('transform');+ } else {+ targetStyle.transform = transforms.buildTransformString(cachedTransforms);+ }+ }} else {- targetStyle[tweenProperty] = originalInlinedValue;+ if (tweenHadNoInlineValue) {+ targetStyle.removeProperty(helpers.toLowerCase(tweenProperty));+ } else {+ targetStyle[tweenProperty] = originalInlinedValue;+ }}}- if (animation._tail === tween) {- animation.targets.forEach(t => {- if (t.getAttribute && t.getAttribute('style') === consts.emptyString) {- t.removeAttribute('style');- } });- }+ }+ if (tweenTarget[consts.isDomSymbol] && animation._tail === tween) {+ animation.targets.forEach(t => {+ if (t.getAttribute && t.getAttribute('style') === consts.emptyString) {+ t.removeAttribute('style');+ } });}});}return renderable;};+/**+ * @template {Renderable} T+ * @param {T} renderable+ * @return {T}+ */+const cleanInlineStyles = renderable => revertValues(renderable, true);+exports.cleanInlineStyles = cleanInlineStyles;+exports.revertValues = revertValues;exports.sanitizePropertyName = sanitizePropertyName;diff --git a/dist/modules/core/styles.d.ts b/dist/modules/core/styles.d.tsindex 8be6491e..1598d26f 100644--- a/dist/modules/core/styles.d.ts+++ b/dist/modules/core/styles.d.ts@@ -1,4 +1,5 @@export function sanitizePropertyName(propertyName: string, target: Target, tweenType: tweenTypes): string;+export function revertValues<T extends Renderable>(renderable: T, inlineStylesOnly?: boolean): T;export function cleanInlineStyles<T extends Renderable>(renderable: T): T;import type { Target } from '../types/index.js';import { tweenTypes } from './consts.js';diff --git a/dist/modules/core/styles.js b/dist/modules/core/styles.jsindex 4abd1de9..006cd489 100644--- a/dist/modules/core/styles.js+++ b/dist/modules/core/styles.js@@ -1,12 +1,13 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/-import { tweenTypes, shortTransforms, isDomSymbol, transformsSymbol, transformsFragmentStrings, emptyString } from './consts.js';-import { forEachChildren, isSvg, toLowerCase, isNil } from './helpers.js';+import { tweenTypes, isDomSymbol, transformsSymbol, emptyString, shortTransforms } from './consts.js';+import { forEachChildren, toLowerCase, isNil, isSvg } from './helpers.js';+import { buildTransformString } from './transforms.js';/*** @import {@@ -57,57 +58,76 @@ const sanitizePropertyName = (propertyName, target, tweenType) => {/*** @template {Renderable} T* @param {T} renderable+ * @param {Boolean} [inlineStylesOnly]* @return {T}*/-const cleanInlineStyles = renderable => {- // Allow cleanInlineStyles() to be called on timelines+const revertValues = (renderable, inlineStylesOnly = false) => {+ // Allow revertValues() to be called on timelinesif (renderable._hasChildren) {- forEachChildren(renderable, cleanInlineStyles, true);+ forEachChildren(renderable, (/** @type {Renderable} */child) => revertValues(child, inlineStylesOnly), true);} else {const animation = /** @type {JSAnimation} */(renderable);animation.pause();forEachChildren(animation, (/** @type {Tween} */tween) => {const tweenProperty = tween.property;const tweenTarget = tween.target;- if (tweenTarget[isDomSymbol]) {- const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;- const originalInlinedValue = tween._inlineValue;- const tweenHadNoInlineValue = isNil(originalInlinedValue) || originalInlinedValue === emptyString;- if (tween._tweenType === tweenTypes.TRANSFORM) {- const cachedTransforms = tweenTarget[transformsSymbol];- if (tweenHadNoInlineValue) {- delete cachedTransforms[tweenProperty];- } else {- cachedTransforms[tweenProperty] = originalInlinedValue;- }- if (tween._renderTransforms) {- if (!Object.keys(cachedTransforms).length) {- targetStyle.removeProperty('transform');+ const tweenType = tween._tweenType;+ const originalInlinedValue = tween._inlineValue;+ const tweenHadNoInlineValue = isNil(originalInlinedValue) || originalInlinedValue === emptyString;+ if (tweenType === tweenTypes.OBJECT) {+ if (!inlineStylesOnly && !tweenHadNoInlineValue) {+ tweenTarget[tweenProperty] = originalInlinedValue;+ }+ } else if (tweenTarget[isDomSymbol]) {+ if (tweenType === tweenTypes.ATTRIBUTE) {+ if (!inlineStylesOnly) {+ if (tweenHadNoInlineValue) {+ /** @type {DOMTarget} */(tweenTarget).removeAttribute(tweenProperty);} else {- let str = emptyString;- for (let key in cachedTransforms) {- str += transformsFragmentStrings[key] + cachedTransforms[key] + ') ';- }- targetStyle.transform = str;+ /** @type {DOMTarget} */(tweenTarget).setAttribute(tweenProperty, /** @type {String} */(originalInlinedValue));}}} else {- if (tweenHadNoInlineValue) {- targetStyle.removeProperty(toLowerCase(tweenProperty));+ const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;+ if (tweenType === tweenTypes.TRANSFORM) {+ const cachedTransforms = tweenTarget[transformsSymbol];+ if (tweenHadNoInlineValue) {+ delete cachedTransforms[tweenProperty];+ } else {+ cachedTransforms[tweenProperty] = originalInlinedValue;+ }+ if (tween._renderTransforms) {+ if (!Object.keys(cachedTransforms).length) {+ targetStyle.removeProperty('transform');+ } else {+ targetStyle.transform = buildTransformString(cachedTransforms);+ }+ }} else {- targetStyle[tweenProperty] = originalInlinedValue;+ if (tweenHadNoInlineValue) {+ targetStyle.removeProperty(toLowerCase(tweenProperty));+ } else {+ targetStyle[tweenProperty] = originalInlinedValue;+ }}}- if (animation._tail === tween) {- animation.targets.forEach(t => {- if (t.getAttribute && t.getAttribute('style') === emptyString) {- t.removeAttribute('style');- } });- }+ }+ if (tweenTarget[isDomSymbol] && animation._tail === tween) {+ animation.targets.forEach(t => {+ if (t.getAttribute && t.getAttribute('style') === emptyString) {+ t.removeAttribute('style');+ } });}});}return renderable;};-export { cleanInlineStyles, sanitizePropertyName };+/**+ * @template {Renderable} T+ * @param {T} renderable+ * @return {T}+ */+const cleanInlineStyles = renderable => revertValues(renderable, true);++export { cleanInlineStyles, revertValues, sanitizePropertyName };diff --git a/dist/modules/core/targets.cjs b/dist/modules/core/targets.cjsindex 0c864eb3..ee08386d 100644--- a/dist/modules/core/targets.cjs+++ b/dist/modules/core/targets.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/core/targets.js b/dist/modules/core/targets.jsindex 3cd07292..57d444b3 100644--- a/dist/modules/core/targets.js+++ b/dist/modules/core/targets.js@@ -1,6 +1,6 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/core/transforms.cjs b/dist/modules/core/transforms.cjsindex d130be7b..c80f8fe4 100644--- a/dist/modules/core/transforms.cjs+++ b/dist/modules/core/transforms.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -24,26 +24,142 @@ var helpers = require('./helpers.cjs');*/const parseInlineTransforms = (target, propName, animationInlineStyles) => {const inlineTransforms = target.style.transform;- let inlinedStylesPropertyValue;if (inlineTransforms) {const cachedTransforms = target[consts.transformsSymbol];- let t; while (t = consts.transformsExecRgx.exec(inlineTransforms)) {- const inlinePropertyName = t[1];- // const inlinePropertyValue = t[2];- const inlinePropertyValue = t[2].slice(1, -1);- cachedTransforms[inlinePropertyName] = inlinePropertyValue;- if (inlinePropertyName === propName) {- inlinedStylesPropertyValue = inlinePropertyValue;- // Store the new parsed inline styles if animationInlineStyles is provided- if (animationInlineStyles) {- animationInlineStyles[propName] = inlinePropertyValue;+ let pos = 0;+ const len = inlineTransforms.length;+ let fullTranslateValue;+ while (pos < len) {+ // Skip whitespace+ while (pos < len && inlineTransforms.charCodeAt(pos) === 32) pos++;+ if (pos >= len) break;+ // Read function name+ const nameStart = pos;+ while (pos < len && inlineTransforms.charCodeAt(pos) !== 40) pos++;+ if (pos >= len) break;+ const name = inlineTransforms.substring(nameStart, pos);+ // Scan to closing paren, recording top-level comma positions+ let depth = 1;+ const valueStart = pos + 1;+ let c1 = -1, c2 = -1;+ pos++;+ while (pos < len && depth > 0) {+ const c = inlineTransforms.charCodeAt(pos);+ if (c === 40) depth++;+ else if (c === 41) depth--;+ else if (c === 44 && depth === 1) {+ if (c1 === -1) c1 = pos;+ else if (c2 === -1) c2 = pos;}+ pos++;}+ const valueEnd = pos - 1;+ // Decompose multi-arg functions into individual axis properties+ if (name === 'translate' || name === 'translate3d') {+ if (c1 === -1) {+ cachedTransforms.translateX = inlineTransforms.substring(valueStart, valueEnd).trim();+ } else {+ cachedTransforms.translateX = inlineTransforms.substring(valueStart, c1).trim();+ if (c2 === -1) {+ cachedTransforms.translateY = inlineTransforms.substring(c1 + 1, valueEnd).trim();+ } else {+ cachedTransforms.translateY = inlineTransforms.substring(c1 + 1, c2).trim();+ cachedTransforms.translateZ = inlineTransforms.substring(c2 + 1, valueEnd).trim();+ }+ }+ fullTranslateValue = inlineTransforms.substring(valueStart, valueEnd);+ } else if (name === 'scale' || name === 'scale3d') {+ if (c1 === -1) {+ cachedTransforms.scale = inlineTransforms.substring(valueStart, valueEnd).trim();+ } else {+ cachedTransforms.scaleX = inlineTransforms.substring(valueStart, c1).trim();+ if (c2 === -1) {+ cachedTransforms.scaleY = inlineTransforms.substring(c1 + 1, valueEnd).trim();+ } else {+ cachedTransforms.scaleY = inlineTransforms.substring(c1 + 1, c2).trim();+ cachedTransforms.scaleZ = inlineTransforms.substring(c2 + 1, valueEnd).trim();+ }+ }+ } else {+ cachedTransforms[name] = inlineTransforms.substring(valueStart, valueEnd);+ }+ }+ // Resolve the requested property from the cache+ if (propName === 'translate3d' && fullTranslateValue) {+ if (animationInlineStyles) animationInlineStyles[propName] = fullTranslateValue;+ return fullTranslateValue;+ }+ const cached = cachedTransforms[propName];+ if (!helpers.isUnd(cached)) {+ if (animationInlineStyles) animationInlineStyles[propName] = cached;+ return cached;}}- return inlineTransforms && !helpers.isUnd(inlinedStylesPropertyValue) ? inlinedStylesPropertyValue :+ return propName === 'translate3d' ? '0px, 0px, 0px' :+ propName === 'rotate3d' ? '0, 0, 0, 0deg' :helpers.stringStartsWith(propName, 'scale') ? '1' :helpers.stringStartsWith(propName, 'rotate') || helpers.stringStartsWith(propName, 'skew') ? '0deg' : '0px';};+/**+ * Builds a CSS transform string from the target's cached transform properties.+ * Iterates validTransforms in order (perspective > translate > rotate > scale > skew > matrix).+ * When adjacent axis properties are all present, emits a shorter shorthand (translateX + translateY -> translate(x, y))+ * The index is advanced past consumed properties so they are not emitted twice.+ * Properties without a grouping partner (e.g. translateY alone, scaleZ alone) emit individually.+ *+ * @param {Record<String, String>} props+ * @return {String}+ */+const buildTransformString = (props) => {+ let str = consts.emptyString;+ for (let i = 0, l = consts.validTransforms.length; i < l; i++) {+ const key = consts.validTransforms[i];+ const val = props[key];+ if (val !== undefined) {+ // Group translateX with adjacent translateY / translateZ+ if (key === 'translateX') {+ const next = props.translateY;+ if (next !== undefined) {+ const next2 = props.translateZ;+ if (next2 !== undefined) {+ str += `translate3d(${val},${next},${next2}) `;+ i += 2;+ } else {+ str += `translate(${val},${next}) `;+ i += 1;+ }+ continue;+ }+ }+ // Group scaleX with adjacent scaleY / scaleZ (only when standalone scale is absent)+ if (key === 'scaleX' && props.scale === undefined) {+ const next = props.scaleY;+ if (next !== undefined) {+ const next2 = props.scaleZ;+ if (next2 !== undefined) {+ str += `scale3d(${val},${next},${next2}) `;+ i += 2;+ } else {+ str += `scale(${val},${next}) `;+ i += 1;+ }+ continue;+ }+ }+ // All other properties: emit individually using pre-built fragment string+ str += `${consts.transformsFragmentStrings[key]}${val}) `;+ }+ // Preserve non-animatable rotate3d in correct position (after rotateZ, before scale)+ if (key === 'rotateZ') {+ if (props.rotate3d !== undefined) str += `rotate3d(${props.rotate3d}) `;+ }+ }+ // Preserve non-animatable matrix/matrix3d from inline styles+ if (props.matrix !== undefined) str += `matrix(${props.matrix}) `;+ if (props.matrix3d !== undefined) str += `matrix3d(${props.matrix3d}) `;+ return str;+};++exports.buildTransformString = buildTransformString;exports.parseInlineTransforms = parseInlineTransforms;diff --git a/dist/modules/core/transforms.d.ts b/dist/modules/core/transforms.d.tsindex d393500d..34c55b5d 100644--- a/dist/modules/core/transforms.d.ts+++ b/dist/modules/core/transforms.d.ts@@ -1,2 +1,3 @@export function parseInlineTransforms(target: DOMTarget, propName: string, animationInlineStyles: any): string;+export function buildTransformString(props: Record<string, string>): string;import type { DOMTarget } from '../types/index.js';diff --git a/dist/modules/core/transforms.js b/dist/modules/core/transforms.jsindex e4736139..63efc55d 100644--- a/dist/modules/core/transforms.js+++ b/dist/modules/core/transforms.js@@ -1,11 +1,11 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/-import { transformsSymbol, transformsExecRgx } from './consts.js';+import { transformsFragmentStrings, emptyString, validTransforms, transformsSymbol } from './consts.js';import { isUnd, stringStartsWith } from './helpers.js';/**@@ -22,26 +22,141 @@ import { isUnd, stringStartsWith } from './helpers.js';*/const parseInlineTransforms = (target, propName, animationInlineStyles) => {const inlineTransforms = target.style.transform;- let inlinedStylesPropertyValue;if (inlineTransforms) {const cachedTransforms = target[transformsSymbol];- let t; while (t = transformsExecRgx.exec(inlineTransforms)) {- const inlinePropertyName = t[1];- // const inlinePropertyValue = t[2];- const inlinePropertyValue = t[2].slice(1, -1);- cachedTransforms[inlinePropertyName] = inlinePropertyValue;- if (inlinePropertyName === propName) {- inlinedStylesPropertyValue = inlinePropertyValue;- // Store the new parsed inline styles if animationInlineStyles is provided- if (animationInlineStyles) {- animationInlineStyles[propName] = inlinePropertyValue;+ let pos = 0;+ const len = inlineTransforms.length;+ let fullTranslateValue;+ while (pos < len) {+ // Skip whitespace+ while (pos < len && inlineTransforms.charCodeAt(pos) === 32) pos++;+ if (pos >= len) break;+ // Read function name+ const nameStart = pos;+ while (pos < len && inlineTransforms.charCodeAt(pos) !== 40) pos++;+ if (pos >= len) break;+ const name = inlineTransforms.substring(nameStart, pos);+ // Scan to closing paren, recording top-level comma positions+ let depth = 1;+ const valueStart = pos + 1;+ let c1 = -1, c2 = -1;+ pos++;+ while (pos < len && depth > 0) {+ const c = inlineTransforms.charCodeAt(pos);+ if (c === 40) depth++;+ else if (c === 41) depth--;+ else if (c === 44 && depth === 1) {+ if (c1 === -1) c1 = pos;+ else if (c2 === -1) c2 = pos;}+ pos++;}+ const valueEnd = pos - 1;+ // Decompose multi-arg functions into individual axis properties+ if (name === 'translate' || name === 'translate3d') {+ if (c1 === -1) {+ cachedTransforms.translateX = inlineTransforms.substring(valueStart, valueEnd).trim();+ } else {+ cachedTransforms.translateX = inlineTransforms.substring(valueStart, c1).trim();+ if (c2 === -1) {+ cachedTransforms.translateY = inlineTransforms.substring(c1 + 1, valueEnd).trim();+ } else {+ cachedTransforms.translateY = inlineTransforms.substring(c1 + 1, c2).trim();+ cachedTransforms.translateZ = inlineTransforms.substring(c2 + 1, valueEnd).trim();+ }+ }+ fullTranslateValue = inlineTransforms.substring(valueStart, valueEnd);+ } else if (name === 'scale' || name === 'scale3d') {+ if (c1 === -1) {+ cachedTransforms.scale = inlineTransforms.substring(valueStart, valueEnd).trim();+ } else {+ cachedTransforms.scaleX = inlineTransforms.substring(valueStart, c1).trim();+ if (c2 === -1) {+ cachedTransforms.scaleY = inlineTransforms.substring(c1 + 1, valueEnd).trim();+ } else {+ cachedTransforms.scaleY = inlineTransforms.substring(c1 + 1, c2).trim();+ cachedTransforms.scaleZ = inlineTransforms.substring(c2 + 1, valueEnd).trim();+ }+ }+ } else {+ cachedTransforms[name] = inlineTransforms.substring(valueStart, valueEnd);+ }+ }+ // Resolve the requested property from the cache+ if (propName === 'translate3d' && fullTranslateValue) {+ if (animationInlineStyles) animationInlineStyles[propName] = fullTranslateValue;+ return fullTranslateValue;+ }+ const cached = cachedTransforms[propName];+ if (!isUnd(cached)) {+ if (animationInlineStyles) animationInlineStyles[propName] = cached;+ return cached;}}- return inlineTransforms && !isUnd(inlinedStylesPropertyValue) ? inlinedStylesPropertyValue :+ return propName === 'translate3d' ? '0px, 0px, 0px' :+ propName === 'rotate3d' ? '0, 0, 0, 0deg' :stringStartsWith(propName, 'scale') ? '1' :stringStartsWith(propName, 'rotate') || stringStartsWith(propName, 'skew') ? '0deg' : '0px';};-export { parseInlineTransforms };+/**+ * Builds a CSS transform string from the target's cached transform properties.+ * Iterates validTransforms in order (perspective > translate > rotate > scale > skew > matrix).+ * When adjacent axis properties are all present, emits a shorter shorthand (translateX + translateY -> translate(x, y))+ * The index is advanced past consumed properties so they are not emitted twice.+ * Properties without a grouping partner (e.g. translateY alone, scaleZ alone) emit individually.+ *+ * @param {Record<String, String>} props+ * @return {String}+ */+const buildTransformString = (props) => {+ let str = emptyString;+ for (let i = 0, l = validTransforms.length; i < l; i++) {+ const key = validTransforms[i];+ const val = props[key];+ if (val !== undefined) {+ // Group translateX with adjacent translateY / translateZ+ if (key === 'translateX') {+ const next = props.translateY;+ if (next !== undefined) {+ const next2 = props.translateZ;+ if (next2 !== undefined) {+ str += `translate3d(${val},${next},${next2}) `;+ i += 2;+ } else {+ str += `translate(${val},${next}) `;+ i += 1;+ }+ continue;+ }+ }+ // Group scaleX with adjacent scaleY / scaleZ (only when standalone scale is absent)+ if (key === 'scaleX' && props.scale === undefined) {+ const next = props.scaleY;+ if (next !== undefined) {+ const next2 = props.scaleZ;+ if (next2 !== undefined) {+ str += `scale3d(${val},${next},${next2}) `;+ i += 2;+ } else {+ str += `scale(${val},${next}) `;+ i += 1;+ }+ continue;+ }+ }+ // All other properties: emit individually using pre-built fragment string+ str += `${transformsFragmentStrings[key]}${val}) `;+ }+ // Preserve non-animatable rotate3d in correct position (after rotateZ, before scale)+ if (key === 'rotateZ') {+ if (props.rotate3d !== undefined) str += `rotate3d(${props.rotate3d}) `;+ }+ }+ // Preserve non-animatable matrix/matrix3d from inline styles+ if (props.matrix !== undefined) str += `matrix(${props.matrix}) `;+ if (props.matrix3d !== undefined) str += `matrix3d(${props.matrix3d}) `;+ return str;+};++export { buildTransformString, parseInlineTransforms };diff --git a/dist/modules/core/units.cjs b/dist/modules/core/units.cjsindex 8b836304..04768bf5 100644--- a/dist/modules/core/units.cjs+++ b/dist/modules/core/units.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/core/units.js b/dist/modules/core/units.jsindex accd29e8..a7266fdf 100644--- a/dist/modules/core/units.js+++ b/dist/modules/core/units.js@@ -1,6 +1,6 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/core/values.cjs b/dist/modules/core/values.cjsindex 8ce10916..be1869b2 100644--- a/dist/modules/core/values.cjs+++ b/dist/modules/core/values.cjs@@ -1,6 +1,6 @@/*** Anime.js - core - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -19,6 +19,7 @@ var colors = require('./colors.cjs');* Tween,* TweenPropValue,* TweenDecomposedValue,+* TargetsArray,* } from '../types/index.js'*/@@ -36,15 +37,16 @@ const setValue = (targetValue, defaultValue) => {* @param {TweenPropValue} value* @param {Target} target* @param {Number} index- * @param {Number} total- * @param {Object} [store]+ * @param {TargetsArray} targets+ * @param {Object|null} store+ * @param {Tween|null} prevTween* @return {any}*/-const getFunctionValue = (value, target, index, total, store) => {+const getFunctionValue = (value, target, index, targets, store, prevTween) => {let func;if (helpers.isFnc(value)) {func = () => {- const computed = /** @type {Function} */(value)(target, index, total);+ const computed = /** @type {Function} */(value)(target, index, targets, prevTween);// Fallback to 0 if the function returns undefined / NaN / null / false / 0return !isNaN(+computed) ? +computed : computed || 0;};@@ -111,9 +113,17 @@ const getCSSValue = (target, propName, animationInlineStyles) => {*/const getOriginalAnimatableValue = (target, propName, tweenType, animationInlineStyles) => {const type = !helpers.isUnd(tweenType) ? tweenType : getTweenType(target, propName);- return type === consts.tweenTypes.OBJECT ? target[propName] || 0 :- type === consts.tweenTypes.ATTRIBUTE ? /** @type {DOMTarget} */(target).getAttribute(propName) :- type === consts.tweenTypes.TRANSFORM ? transforms.parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :+ if (type === consts.tweenTypes.OBJECT) {+ const value = target[propName];+ if (value && animationInlineStyles) animationInlineStyles[propName] = value;+ return value || 0;+ }+ if (type === consts.tweenTypes.ATTRIBUTE) {+ const value = /** @type {DOMTarget} */(target).getAttribute(propName);+ if (value && animationInlineStyles) animationInlineStyles[propName] = value;+ return value;+ }+ return type === consts.tweenTypes.TRANSFORM ? transforms.parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :type === consts.tweenTypes.CSS_VAR ? getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles).trimStart() :getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles);};@@ -215,6 +225,56 @@ const decomposeTweenValue = (tween, targetObject) => {const decomposedOriginalValue = createDecomposedValueTargetObject();+/**+ * @param {Tween} tween+ * @param {Number} progress+ * @param {Number} precision+ * @return {String}+ */+const composeColorValue = (tween, progress, precision) => {+ const mod = tween._modifier;+ const fn = tween._fromNumbers;+ const tn = tween._toNumbers;+ const r = helpers.round(helpers.clamp(/** @type {Number} */(mod(helpers.lerp(fn[0], tn[0], progress))), 0, 255), 0);+ const g = helpers.round(helpers.clamp(/** @type {Number} */(mod(helpers.lerp(fn[1], tn[1], progress))), 0, 255), 0);+ const b = helpers.round(helpers.clamp(/** @type {Number} */(mod(helpers.lerp(fn[2], tn[2], progress))), 0, 255), 0);+ const a = helpers.clamp(/** @type {Number} */(mod(helpers.round(helpers.lerp(fn[3], tn[3], progress), precision))), 0, 1);+ if (tween._composition !== consts.compositionTypes.none) {+ const ns = tween._numbers;+ ns[0] = r;+ ns[1] = g;+ ns[2] = b;+ ns[3] = a;+ }+ return `rgba(${r},${g},${b},${a})`;+};++/**+ * @param {Tween} tween+ * @param {Number} progress+ * @param {Number} precision+ * @return {String}+ */+const composeComplexValue = (tween, progress, precision) => {+ const mod = tween._modifier;+ const fn = tween._fromNumbers;+ const tn = tween._toNumbers;+ const ts = tween._strings;+ const hasComposition = tween._composition !== consts.compositionTypes.none;+ let v = ts[0];+ for (let j = 0, l = tn.length; j < l; j++) {+ const n = /** @type {Number} */(mod(helpers.round(helpers.lerp(fn[j], tn[j], progress), precision)));+ const s = ts[j + 1];+ v += `${s ? n + s : n}`;+ if (hasComposition) {+ tween._numbers[j] = n;+ }+ }+ return v;+};++exports.composeColorValue = composeColorValue;+exports.composeComplexValue = composeComplexValue;exports.createDecomposedValueTargetObject = createDecomposedValueTargetObject;exports.decomposeRawValue = decomposeRawValue;exports.decomposeTweenValue = decomposeTweenValue;diff --git a/dist/modules/core/values.d.ts b/dist/modules/core/values.d.tsindex e4fd7d88..e12fe2ef 100644--- a/dist/modules/core/values.d.ts+++ b/dist/modules/core/values.d.ts@@ -1,5 +1,5 @@export function setValue<T, D>(targetValue: T | undefined, defaultValue: D): T | D;-export function getFunctionValue(value: TweenPropValue, target: Target, index: number, total: number, store?: any): any;+export function getFunctionValue(value: TweenPropValue, target: Target, index: number, targets: TargetsArray, store: any | null, prevTween: Tween | null): any;export function getTweenType(target: Target, prop: string): tweenTypes;export function getOriginalAnimatableValue(target: Target, propName: string, tweenType?: tweenTypes, animationInlineStyles?: any | void): string | number;export function getRelativeValue(x: number, y: number, operator: string): number;@@ -7,8 +7,11 @@ export function createDecomposedValueTargetObject(): TweenDecomposedValue;export function decomposeRawValue(rawValue: string | number, targetObject: TweenDecomposedValue): TweenDecomposedValue;export function decomposeTweenValue(tween: Tween, targetObject: TweenDecomposedValue): TweenDecomposedValue;export const decomposedOriginalValue: TweenDecomposedValue;+export function composeColorValue(tween: Tween, progress: number, precision: number): string;+export function composeComplexValue(tween: Tween, progress: number, precision: number): string;import type { TweenPropValue } from '../types/index.js';import type { Target } from '../types/index.js';+import type { TargetsArray } from '../types/index.js';+import type { Tween } from '../types/index.js';import { tweenTypes } from './consts.js';import type { TweenDecomposedValue } from '../types/index.js';-import type { Tween } from '../types/index.js';diff --git a/dist/modules/core/values.js b/dist/modules/core/values.jsindex 908fe3df..4636f4fb 100644--- a/dist/modules/core/values.js+++ b/dist/modules/core/values.js@@ -1,12 +1,12 @@/*** Anime.js - core - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/-import { tweenTypes, isDomSymbol, isSvgSymbol, validTransforms, shortTransforms, valueTypes, unitsExecRgx, digitWithExponentRgx, proxyTargetSymbol, cssVarPrefix, cssVariableMatchRgx, emptyString } from './consts.js';-import { isUnd, isValidSVGAttribute, stringStartsWith, isCol, isFnc, isStr, cloneArray } from './helpers.js';+import { tweenTypes, isDomSymbol, isSvgSymbol, validTransforms, shortTransforms, valueTypes, unitsExecRgx, digitWithExponentRgx, compositionTypes, proxyTargetSymbol, cssVarPrefix, cssVariableMatchRgx, emptyString } from './consts.js';+import { isUnd, isValidSVGAttribute, stringStartsWith, isCol, isFnc, isStr, round, lerp, clamp, cloneArray } from './helpers.js';import { parseInlineTransforms } from './transforms.js';import { convertColorStringValuesToRgbaArray } from './colors.js';@@ -17,6 +17,7 @@ import { convertColorStringValuesToRgbaArray } from './colors.js';* Tween,* TweenPropValue,* TweenDecomposedValue,+* TargetsArray,* } from '../types/index.js'*/@@ -34,15 +35,16 @@ const setValue = (targetValue, defaultValue) => {* @param {TweenPropValue} value* @param {Target} target* @param {Number} index- * @param {Number} total- * @param {Object} [store]+ * @param {TargetsArray} targets+ * @param {Object|null} store+ * @param {Tween|null} prevTween* @return {any}*/-const getFunctionValue = (value, target, index, total, store) => {+const getFunctionValue = (value, target, index, targets, store, prevTween) => {let func;if (isFnc(value)) {func = () => {- const computed = /** @type {Function} */(value)(target, index, total);+ const computed = /** @type {Function} */(value)(target, index, targets, prevTween);// Fallback to 0 if the function returns undefined / NaN / null / false / 0return !isNaN(+computed) ? +computed : computed || 0;};@@ -109,9 +111,17 @@ const getCSSValue = (target, propName, animationInlineStyles) => {*/const getOriginalAnimatableValue = (target, propName, tweenType, animationInlineStyles) => {const type = !isUnd(tweenType) ? tweenType : getTweenType(target, propName);- return type === tweenTypes.OBJECT ? target[propName] || 0 :- type === tweenTypes.ATTRIBUTE ? /** @type {DOMTarget} */(target).getAttribute(propName) :- type === tweenTypes.TRANSFORM ? parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :+ if (type === tweenTypes.OBJECT) {+ const value = target[propName];+ if (value && animationInlineStyles) animationInlineStyles[propName] = value;+ return value || 0;+ }+ if (type === tweenTypes.ATTRIBUTE) {+ const value = /** @type {DOMTarget} */(target).getAttribute(propName);+ if (value && animationInlineStyles) animationInlineStyles[propName] = value;+ return value;+ }+ return type === tweenTypes.TRANSFORM ? parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :type === tweenTypes.CSS_VAR ? getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles).trimStart() :getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles);};@@ -213,4 +223,52 @@ const decomposeTweenValue = (tween, targetObject) => {const decomposedOriginalValue = createDecomposedValueTargetObject();-export { createDecomposedValueTargetObject, decomposeRawValue, decomposeTweenValue, decomposedOriginalValue, getFunctionValue, getOriginalAnimatableValue, getRelativeValue, getTweenType, setValue };+/**+ * @param {Tween} tween+ * @param {Number} progress+ * @param {Number} precision+ * @return {String}+ */+const composeColorValue = (tween, progress, precision) => {+ const mod = tween._modifier;+ const fn = tween._fromNumbers;+ const tn = tween._toNumbers;+ const r = round(clamp(/** @type {Number} */(mod(lerp(fn[0], tn[0], progress))), 0, 255), 0);+ const g = round(clamp(/** @type {Number} */(mod(lerp(fn[1], tn[1], progress))), 0, 255), 0);+ const b = round(clamp(/** @type {Number} */(mod(lerp(fn[2], tn[2], progress))), 0, 255), 0);+ const a = clamp(/** @type {Number} */(mod(round(lerp(fn[3], tn[3], progress), precision))), 0, 1);+ if (tween._composition !== compositionTypes.none) {+ const ns = tween._numbers;+ ns[0] = r;+ ns[1] = g;+ ns[2] = b;+ ns[3] = a;+ }+ return `rgba(${r},${g},${b},${a})`;+};++/**+ * @param {Tween} tween+ * @param {Number} progress+ * @param {Number} precision+ * @return {String}+ */+const composeComplexValue = (tween, progress, precision) => {+ const mod = tween._modifier;+ const fn = tween._fromNumbers;+ const tn = tween._toNumbers;+ const ts = tween._strings;+ const hasComposition = tween._composition !== compositionTypes.none;+ let v = ts[0];+ for (let j = 0, l = tn.length; j < l; j++) {+ const n = /** @type {Number} */(mod(round(lerp(fn[j], tn[j], progress), precision)));+ const s = ts[j + 1];+ v += `${s ? n + s : n}`;+ if (hasComposition) {+ tween._numbers[j] = n;+ }+ }+ return v;+};++export { composeColorValue, composeComplexValue, createDecomposedValueTargetObject, decomposeRawValue, decomposeTweenValue, decomposedOriginalValue, getFunctionValue, getOriginalAnimatableValue, getRelativeValue, getTweenType, setValue };diff --git a/dist/modules/draggable/draggable.cjs b/dist/modules/draggable/draggable.cjsindex ae451c98..95d1ce14 100644--- a/dist/modules/draggable/draggable.cjs+++ b/dist/modules/draggable/draggable.cjs@@ -1,6 +1,6 @@/*** Anime.js - draggable - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/draggable/draggable.js b/dist/modules/draggable/draggable.jsindex c21072c3..a8ba009b 100644--- a/dist/modules/draggable/draggable.js+++ b/dist/modules/draggable/draggable.js@@ -1,6 +1,6 @@/*** Anime.js - draggable - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/draggable/index.cjs b/dist/modules/draggable/index.cjsindex ed71b231..ee438918 100644--- a/dist/modules/draggable/index.cjs+++ b/dist/modules/draggable/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - draggable - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/draggable/index.js b/dist/modules/draggable/index.jsindex 8ff74031..a0d8ddce 100644--- a/dist/modules/draggable/index.js+++ b/dist/modules/draggable/index.js@@ -1,6 +1,6 @@/*** Anime.js - draggable - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/cubic-bezier/index.cjs b/dist/modules/easings/cubic-bezier/index.cjsindex 436d3b22..285ca72c 100644--- a/dist/modules/easings/cubic-bezier/index.cjs+++ b/dist/modules/easings/cubic-bezier/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - easings - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/cubic-bezier/index.js b/dist/modules/easings/cubic-bezier/index.jsindex 983d9693..bac417fe 100644--- a/dist/modules/easings/cubic-bezier/index.js+++ b/dist/modules/easings/cubic-bezier/index.js@@ -1,6 +1,6 @@/*** Anime.js - easings - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/eases/index.cjs b/dist/modules/easings/eases/index.cjsindex e73848ad..67c94a7b 100644--- a/dist/modules/easings/eases/index.cjs+++ b/dist/modules/easings/eases/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - easings - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/eases/index.js b/dist/modules/easings/eases/index.jsindex 5a495fc1..87986214 100644--- a/dist/modules/easings/eases/index.js+++ b/dist/modules/easings/eases/index.js@@ -1,6 +1,6 @@/*** Anime.js - easings - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/eases/parser.cjs b/dist/modules/easings/eases/parser.cjsindex e095c439..c8a5605a 100644--- a/dist/modules/easings/eases/parser.cjs+++ b/dist/modules/easings/eases/parser.cjs@@ -1,6 +1,6 @@/*** Anime.js - easings - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/eases/parser.js b/dist/modules/easings/eases/parser.jsindex f615f1d0..d7da024b 100644--- a/dist/modules/easings/eases/parser.js+++ b/dist/modules/easings/eases/parser.js@@ -1,6 +1,6 @@/*** Anime.js - easings - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/index.cjs b/dist/modules/easings/index.cjsindex b958e256..929c839c 100644--- a/dist/modules/easings/index.cjs+++ b/dist/modules/easings/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - easings - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/index.js b/dist/modules/easings/index.jsindex 4e021b9c..f8641d16 100644--- a/dist/modules/easings/index.js+++ b/dist/modules/easings/index.js@@ -1,6 +1,6 @@/*** Anime.js - easings - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/irregular/index.cjs b/dist/modules/easings/irregular/index.cjsindex da93e100..5a4ada29 100644--- a/dist/modules/easings/irregular/index.cjs+++ b/dist/modules/easings/irregular/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - easings - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/irregular/index.js b/dist/modules/easings/irregular/index.jsindex 8256fff6..144fa30f 100644--- a/dist/modules/easings/irregular/index.js+++ b/dist/modules/easings/irregular/index.js@@ -1,6 +1,6 @@/*** Anime.js - easings - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/linear/index.cjs b/dist/modules/easings/linear/index.cjsindex 9afb6d71..f2487049 100644--- a/dist/modules/easings/linear/index.cjs+++ b/dist/modules/easings/linear/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - easings - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/linear/index.js b/dist/modules/easings/linear/index.jsindex 2b833126..02efa3f8 100644--- a/dist/modules/easings/linear/index.js+++ b/dist/modules/easings/linear/index.js@@ -1,6 +1,6 @@/*** Anime.js - easings - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/none.cjs b/dist/modules/easings/none.cjsindex 1dcc368a..052fb83c 100644--- a/dist/modules/easings/none.cjs+++ b/dist/modules/easings/none.cjs@@ -1,6 +1,6 @@/*** Anime.js - easings - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/none.js b/dist/modules/easings/none.jsindex ea6af22e..0873c092 100644--- a/dist/modules/easings/none.js+++ b/dist/modules/easings/none.js@@ -1,6 +1,6 @@/*** Anime.js - easings - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/spring/index.cjs b/dist/modules/easings/spring/index.cjsindex 1a7f3498..ce009da2 100644--- a/dist/modules/easings/spring/index.cjs+++ b/dist/modules/easings/spring/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - easings - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/spring/index.js b/dist/modules/easings/spring/index.jsindex cf987001..1822e418 100644--- a/dist/modules/easings/spring/index.js+++ b/dist/modules/easings/spring/index.js@@ -1,6 +1,6 @@/*** Anime.js - easings - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/steps/index.cjs b/dist/modules/easings/steps/index.cjsindex 9a371f7d..ccd29136 100644--- a/dist/modules/easings/steps/index.cjs+++ b/dist/modules/easings/steps/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - easings - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/easings/steps/index.js b/dist/modules/easings/steps/index.jsindex 84513b96..92c14a91 100644--- a/dist/modules/easings/steps/index.js+++ b/dist/modules/easings/steps/index.js@@ -1,6 +1,6 @@/*** Anime.js - easings - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/engine/engine.cjs b/dist/modules/engine/engine.cjsindex 9fe583c5..7abe9017 100644--- a/dist/modules/engine/engine.cjs+++ b/dist/modules/engine/engine.cjs@@ -1,6 +1,6 @@/*** Anime.js - engine - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/engine/engine.js b/dist/modules/engine/engine.jsindex d31b3eb6..71abcb67 100644--- a/dist/modules/engine/engine.js+++ b/dist/modules/engine/engine.js@@ -1,6 +1,6 @@/*** Anime.js - engine - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/engine/index.cjs b/dist/modules/engine/index.cjsindex 6e7fa20c..eff0d931 100644--- a/dist/modules/engine/index.cjs+++ b/dist/modules/engine/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - engine - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/engine/index.js b/dist/modules/engine/index.jsindex ccbefa91..f2f859d7 100644--- a/dist/modules/engine/index.js+++ b/dist/modules/engine/index.js@@ -1,6 +1,6 @@/*** Anime.js - engine - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/events/index.cjs b/dist/modules/events/index.cjsindex 900774ca..70c4d8b8 100644--- a/dist/modules/events/index.cjs+++ b/dist/modules/events/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - events - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/events/index.js b/dist/modules/events/index.jsindex 11c78f2a..f476dcb5 100644--- a/dist/modules/events/index.js+++ b/dist/modules/events/index.js@@ -1,6 +1,6 @@/*** Anime.js - events - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/events/scroll.cjs b/dist/modules/events/scroll.cjsindex dc727d2e..b0e3a4cd 100644--- a/dist/modules/events/scroll.cjs+++ b/dist/modules/events/scroll.cjs@@ -1,6 +1,6 @@/*** Anime.js - events - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/events/scroll.js b/dist/modules/events/scroll.jsindex 6d9659de..3c2e22b2 100644--- a/dist/modules/events/scroll.js+++ b/dist/modules/events/scroll.js@@ -1,6 +1,6 @@/*** Anime.js - events - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/index.cjs b/dist/modules/index.cjsindex 293b9a33..7fdebba1 100644--- a/dist/modules/index.cjs+++ b/dist/modules/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -21,12 +21,14 @@ var index$1 = require('./utils/index.cjs');var index$2 = require('./svg/index.cjs');var index$3 = require('./text/index.cjs');var waapi = require('./waapi/waapi.cjs');+var globals = require('./core/globals.cjs');var index$4 = require('./easings/cubic-bezier/index.cjs');var index$5 = require('./easings/steps/index.cjs');var index$6 = require('./easings/linear/index.cjs');var index$7 = require('./easings/irregular/index.cjs');var index$8 = require('./easings/spring/index.cjs');var parser = require('./easings/eases/parser.cjs');+var helpers = require('./core/helpers.cjs');var chainable = require('./utils/chainable.cjs');var random = require('./utils/random.cjs');var time = require('./utils/time.cjs');@@ -38,6 +40,7 @@ var motionpath = require('./svg/motionpath.cjs');var drawable = require('./svg/drawable.cjs');var morphto = require('./svg/morphto.cjs');var split = require('./text/split.cjs');+var scramble = require('./text/scramble.cjs');@@ -65,6 +68,7 @@ exports.svg = index$2;exports.text = index$3;exports.WAAPIAnimation = waapi.WAAPIAnimation;exports.waapi = waapi.waapi;+exports.globals = globals.globals;exports.cubicBezier = index$4.cubicBezier;exports.steps = index$5.steps;exports.linear = index$6.linear;@@ -73,6 +77,9 @@ exports.Spring = index$8.Spring;exports.createSpring = index$8.createSpring;exports.spring = index$8.spring;exports.eases = parser.eases;+exports.addChild = helpers.addChild;+exports.forEachChildren = helpers.forEachChildren;+exports.removeChild = helpers.removeChild;exports.clamp = chainable.clamp;exports.damp = chainable.damp;exports.degToRad = chainable.degToRad;@@ -103,3 +110,4 @@ exports.morphTo = morphto.morphTo;exports.TextSplitter = split.TextSplitter;exports.split = split.split;exports.splitText = split.splitText;+exports.scrambleText = scramble.scrambleText;diff --git a/dist/modules/index.d.ts b/dist/modules/index.d.tsindex d79cf605..559f2bab 100644--- a/dist/modules/index.d.ts+++ b/dist/modules/index.d.ts@@ -17,3 +17,4 @@ export * as easings from "./easings/index.js";export * as utils from "./utils/index.js";export * as svg from "./svg/index.js";export * as text from "./text/index.js";+export { globals } from "./core/globals.js";diff --git a/dist/modules/index.js b/dist/modules/index.jsindex aa8ee874..1ea996bd 100644--- a/dist/modules/index.js+++ b/dist/modules/index.js@@ -1,6 +1,6 @@/*** Anime.js - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -23,12 +23,14 @@ export { index$2 as svg };import * as index$3 from './text/index.js';export { index$3 as text };export { WAAPIAnimation, waapi } from './waapi/waapi.js';+export { globals } from './core/globals.js';export { cubicBezier } from './easings/cubic-bezier/index.js';export { steps } from './easings/steps/index.js';export { linear } from './easings/linear/index.js';export { irregular } from './easings/irregular/index.js';export { Spring, createSpring, spring } from './easings/spring/index.js';export { eases } from './easings/eases/parser.js';+export { addChild, forEachChildren, removeChild } from './core/helpers.js';export { clamp, damp, degToRad, lerp, mapRange, padEnd, padStart, radToDeg, round, roundPad, snap, wrap } from './utils/chainable.js';export { createSeededRandom, random, randomPick, shuffle } from './utils/random.js';export { keepTime, sync } from './utils/time.js';@@ -40,3 +42,4 @@ export { createMotionPath } from './svg/motionpath.js';export { createDrawable } from './svg/drawable.js';export { morphTo } from './svg/morphto.js';export { TextSplitter, split, splitText } from './text/split.js';+export { scrambleText } from './text/scramble.js';diff --git a/dist/modules/layout/index.cjs b/dist/modules/layout/index.cjsindex fe595933..056b40a8 100644--- a/dist/modules/layout/index.cjs+++ b/dist/modules/layout/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - layout - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/layout/index.js b/dist/modules/layout/index.jsindex 354649ea..61eec6f9 100644--- a/dist/modules/layout/index.js+++ b/dist/modules/layout/index.js@@ -1,6 +1,6 @@/*** Anime.js - layout - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/layout/layout.cjs b/dist/modules/layout/layout.cjsindex de820f9f..7d68506d 100644--- a/dist/modules/layout/layout.cjs+++ b/dist/modules/layout/layout.cjs@@ -1,6 +1,6 @@/*** Anime.js - layout - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -79,6 +79,7 @@ var globals = require('../core/globals.cjs');/*** @typedef {Object} LayoutSpecificAnimationParams+ * @property {Number|String} [id]* @property {Number|FunctionValue} [delay]* @property {Number|FunctionValue} [duration]* @property {EasingParam|FunctionValue} [ease]@@ -121,7 +122,7 @@ var globals = require('../core/globals.cjs');* @property {String} id* @property {DOMTarget} $el* @property {Number} index- * @property {Number} total+ * @property {Array<DOMTarget>} targets* @property {Number} delay* @property {Number} duration* @property {EasingParam} ease@@ -265,7 +266,7 @@ const createNode = ($el, parentNode, state, recycledNode) => {node.$measure = $el;node.id = dataId;node.index = 0;- node.total = 1;+ node.targets = null;node.delay = 0;node.duration = 0;node.ease = null;@@ -451,12 +452,12 @@ const updateNodeProperties = (node, props) => {* @param {LayoutAnimationTimingsParams} params*/const updateNodeTimingParams = (node, params) => {- const easeFunctionResult = values.getFunctionValue(params.ease, node.$el, node.index, node.total);+ const easeFunctionResult = values.getFunctionValue(params.ease, node.$el, node.index, node.targets, null, null);const keyEasing = helpers.isFnc(easeFunctionResult) ? easeFunctionResult : params.ease;const hasSpring = !helpers.isUnd(keyEasing) && !helpers.isUnd(/** @type {Spring} */(keyEasing).ease);node.ease = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;- node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : values.getFunctionValue(params.duration, node.$el, node.index, node.total);- node.delay = values.getFunctionValue(params.delay, node.$el, node.index, node.total);+ node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : values.getFunctionValue(params.duration, node.$el, node.index, node.targets, null, null);+ node.delay = values.getFunctionValue(params.delay, node.$el, node.index, node.targets, null, null);};/**@@ -829,10 +830,12 @@ class LayoutSnapshot {const inRootNodeIds = new Set();// Update index and total for inital timing calculation- let index = 0, total = this.nodes.size;+ let index = 0;+ const allNodeTargets = [];+ this.nodes.forEach((node) => { allNodeTargets.push(node.$el); });this.nodes.forEach((node, id) => {node.index = index++;- node.total = total;+ node.targets = allNodeTargets;// Track ids of nodes that belong to the current root to filter detached matchesif (node && node.measuredIsInsideRoot) {inRootNodeIds.add(id);@@ -944,8 +947,8 @@ class AutoLayout {this.params = params;/** @type {DOMTarget} */this.root = /** @type {DOMTarget} */(targets.registerTargets(root)[0]);- /** @type {Number} */- this.id = layoutId++;+ /** @type {Number|String} */+ this.id = params.id || layoutId++;/** @type {LayoutChildrenParam} */this.children = params.children || '*';/** @type {Boolean} */@@ -1068,7 +1071,9 @@ class AutoLayout {duration: values.setValue(params.duration, this.params.duration),};/** @type {TimelineParams} */- const tlParams = {};+ const tlParams = {+ id: this.id+ };const onComplete = values.setValue(params.onComplete, this.params.onComplete);const onPause = values.setValue(params.onPause, this.params.onPause);for (let name in globals.defaults) {@@ -1082,7 +1087,8 @@ class AutoLayout {}tlParams.onComplete = () => {const ap = /** @type {ScrollObserver} */(params.autoplay);- const isScrollControled = ap && ap.linked;+ const ed = globals.globals.editor;+ const isScrollControled = (ap && ap.linked) || (ed && ed.showPanel);if (isScrollControled) {if (onComplete) onComplete(this.timeline);return;@@ -1281,41 +1287,39 @@ class AutoLayout {animatedParent = animatedParent.parentNode;}- const animatingTotal = animating.length;-// Root is always animated first in sync with the first child (animating.length is the total of children)if (node === rootNode) {node.index = 0;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, animationTimings);} else if (node.isEntering) {node.index = animatedParent ? animatedParent.index : enteringIndex;- node.total = animatedParent ? animatingTotal : entering.length;+ node.targets = animatedParent ? animating : entering;updateNodeTimingParams(node, enterFromTimings);enteringIndex++;} else if (node.isLeaving) {node.index = animatedParent ? animatedParent.index : leavingIndex;- node.total = animatedParent ? animatingTotal : leaving.length;+ node.targets = animatedParent ? animating : leaving;leavingIndex++;updateNodeTimingParams(node, leaveToTimings);} else if (node.isTarget) {node.index = animatingIndex++;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, animationTimings);} else {node.index = animatedParent ? animatedParent.index : 0;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, swapAtTimings);}// Make sure the old state node has its inex and total values up to date for valid "from" function values calculationoldStateNode.index = node.index;- oldStateNode.total = node.total;+ oldStateNode.targets = node.targets;// Computes all values up front so we can check for changes and we don't have to re-compute them inside the animation propsfor (let prop in nodeProperties) {- nodeProperties[prop] = values.getFunctionValue(nodeProperties[prop], $el, node.index, node.total);- oldStateNodeProperties[prop] = values.getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.total);+ nodeProperties[prop] = values.getFunctionValue(nodeProperties[prop], $el, node.index, node.targets, null, null);+ oldStateNodeProperties[prop] = values.getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.targets, null, null);}// Use a 1px tolerance to detect dimensions changes to prevent width / height animations on barelly visible elements@@ -1541,8 +1545,8 @@ class AutoLayout {}$el.style.transform = oldState.getComputedValue($el, 'transform');if (animatedSwap.includes($el)) {- node.ease = values.getFunctionValue(swapAtParams.ease, $el, node.index, node.total);- node.duration = values.getFunctionValue(swapAtParams.duration, $el, node.index, node.total);+ node.ease = values.getFunctionValue(swapAtParams.ease, $el, node.index, node.targets, null, null);+ node.duration = values.getFunctionValue(swapAtParams.duration, $el, node.index, node.targets, null, null);}}this.transformAnimation = waapi.waapi.animate(transformed, {@@ -1557,7 +1561,7 @@ class AutoLayout {if (!animatedSwap.includes($el)) return newValue;const oldValue = oldState.getComputedValue($el, 'transform');const node = newState.getNode($el);- return [oldValue, values.getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]+ return [oldValue, values.getFunctionValue(swapAtProps.transform, $el, node.index, node.targets, null, null), newValue]},autoplay: false,// persist: true,diff --git a/dist/modules/layout/layout.d.ts b/dist/modules/layout/layout.d.tsindex 7ced17bd..b8d8c424 100644--- a/dist/modules/layout/layout.d.ts+++ b/dist/modules/layout/layout.d.ts@@ -8,8 +8,8 @@ export class AutoLayout {params: AutoLayoutParams;/** @type {DOMTarget} */root: DOMTarget;- /** @type {Number} */- id: number;+ /** @type {Number|String} */+ id: number | string;/** @type {LayoutChildrenParam} */children: LayoutChildrenParam;/** @type {Boolean} */@@ -74,6 +74,7 @@ export type LayoutAnimationTimingsParams = {export type LayoutStateAnimationProperties = Record<string, number | string | FunctionValue>;export type LayoutStateParams = LayoutStateAnimationProperties & LayoutAnimationTimingsParams;export type LayoutSpecificAnimationParams = {+ id?: number | string;delay?: number | FunctionValue;duration?: number | FunctionValue;ease?: EasingParam | FunctionValue;@@ -103,7 +104,7 @@ export type LayoutNode = {id: string;$el: DOMTarget;index: number;- total: number;+ targets: Array<DOMTarget>;delay: number;duration: number;ease: EasingParam;diff --git a/dist/modules/layout/layout.js b/dist/modules/layout/layout.jsindex 14cab705..00a86bbd 100644--- a/dist/modules/layout/layout.js+++ b/dist/modules/layout/layout.js@@ -1,6 +1,6 @@/*** Anime.js - layout - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -11,7 +11,7 @@ import { parseEase } from '../easings/eases/parser.js';import { setValue, getFunctionValue } from '../core/values.js';import { createTimeline } from '../timeline/timeline.js';import { waapi } from '../waapi/waapi.js';-import { scope, defaults } from '../core/globals.js';+import { scope, defaults, globals } from '../core/globals.js';/*** @import {@@ -77,6 +77,7 @@ import { scope, defaults } from '../core/globals.js';/*** @typedef {Object} LayoutSpecificAnimationParams+ * @property {Number|String} [id]* @property {Number|FunctionValue} [delay]* @property {Number|FunctionValue} [duration]* @property {EasingParam|FunctionValue} [ease]@@ -119,7 +120,7 @@ import { scope, defaults } from '../core/globals.js';* @property {String} id* @property {DOMTarget} $el* @property {Number} index- * @property {Number} total+ * @property {Array<DOMTarget>} targets* @property {Number} delay* @property {Number} duration* @property {EasingParam} ease@@ -263,7 +264,7 @@ const createNode = ($el, parentNode, state, recycledNode) => {node.$measure = $el;node.id = dataId;node.index = 0;- node.total = 1;+ node.targets = null;node.delay = 0;node.duration = 0;node.ease = null;@@ -449,12 +450,12 @@ const updateNodeProperties = (node, props) => {* @param {LayoutAnimationTimingsParams} params*/const updateNodeTimingParams = (node, params) => {- const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.total);+ const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.targets, null, null);const keyEasing = isFnc(easeFunctionResult) ? easeFunctionResult : params.ease;const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);node.ease = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;- node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.total);- node.delay = getFunctionValue(params.delay, node.$el, node.index, node.total);+ node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.targets, null, null);+ node.delay = getFunctionValue(params.delay, node.$el, node.index, node.targets, null, null);};/**@@ -827,10 +828,12 @@ class LayoutSnapshot {const inRootNodeIds = new Set();// Update index and total for inital timing calculation- let index = 0, total = this.nodes.size;+ let index = 0;+ const allNodeTargets = [];+ this.nodes.forEach((node) => { allNodeTargets.push(node.$el); });this.nodes.forEach((node, id) => {node.index = index++;- node.total = total;+ node.targets = allNodeTargets;// Track ids of nodes that belong to the current root to filter detached matchesif (node && node.measuredIsInsideRoot) {inRootNodeIds.add(id);@@ -942,8 +945,8 @@ class AutoLayout {this.params = params;/** @type {DOMTarget} */this.root = /** @type {DOMTarget} */(registerTargets(root)[0]);- /** @type {Number} */- this.id = layoutId++;+ /** @type {Number|String} */+ this.id = params.id || layoutId++;/** @type {LayoutChildrenParam} */this.children = params.children || '*';/** @type {Boolean} */@@ -1066,7 +1069,9 @@ class AutoLayout {duration: setValue(params.duration, this.params.duration),};/** @type {TimelineParams} */- const tlParams = {};+ const tlParams = {+ id: this.id+ };const onComplete = setValue(params.onComplete, this.params.onComplete);const onPause = setValue(params.onPause, this.params.onPause);for (let name in defaults) {@@ -1080,7 +1085,8 @@ class AutoLayout {}tlParams.onComplete = () => {const ap = /** @type {ScrollObserver} */(params.autoplay);- const isScrollControled = ap && ap.linked;+ const ed = globals.editor;+ const isScrollControled = (ap && ap.linked) || (ed && ed.showPanel);if (isScrollControled) {if (onComplete) onComplete(this.timeline);return;@@ -1279,41 +1285,39 @@ class AutoLayout {animatedParent = animatedParent.parentNode;}- const animatingTotal = animating.length;-// Root is always animated first in sync with the first child (animating.length is the total of children)if (node === rootNode) {node.index = 0;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, animationTimings);} else if (node.isEntering) {node.index = animatedParent ? animatedParent.index : enteringIndex;- node.total = animatedParent ? animatingTotal : entering.length;+ node.targets = animatedParent ? animating : entering;updateNodeTimingParams(node, enterFromTimings);enteringIndex++;} else if (node.isLeaving) {node.index = animatedParent ? animatedParent.index : leavingIndex;- node.total = animatedParent ? animatingTotal : leaving.length;+ node.targets = animatedParent ? animating : leaving;leavingIndex++;updateNodeTimingParams(node, leaveToTimings);} else if (node.isTarget) {node.index = animatingIndex++;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, animationTimings);} else {node.index = animatedParent ? animatedParent.index : 0;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, swapAtTimings);}// Make sure the old state node has its inex and total values up to date for valid "from" function values calculationoldStateNode.index = node.index;- oldStateNode.total = node.total;+ oldStateNode.targets = node.targets;// Computes all values up front so we can check for changes and we don't have to re-compute them inside the animation propsfor (let prop in nodeProperties) {- nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.total);- oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.total);+ nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.targets, null, null);+ oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.targets, null, null);}// Use a 1px tolerance to detect dimensions changes to prevent width / height animations on barelly visible elements@@ -1539,8 +1543,8 @@ class AutoLayout {}$el.style.transform = oldState.getComputedValue($el, 'transform');if (animatedSwap.includes($el)) {- node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.total);- node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.total);+ node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.targets, null, null);+ node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.targets, null, null);}}this.transformAnimation = waapi.animate(transformed, {@@ -1555,7 +1559,7 @@ class AutoLayout {if (!animatedSwap.includes($el)) return newValue;const oldValue = oldState.getComputedValue($el, 'transform');const node = newState.getNode($el);- return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]+ return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.targets, null, null), newValue]},autoplay: false,// persist: true,diff --git a/dist/modules/scope/index.cjs b/dist/modules/scope/index.cjsindex 08af3317..9d61df66 100644--- a/dist/modules/scope/index.cjs+++ b/dist/modules/scope/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - scope - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/scope/index.js b/dist/modules/scope/index.jsindex 51dd6804..af884800 100644--- a/dist/modules/scope/index.js+++ b/dist/modules/scope/index.js@@ -1,6 +1,6 @@/*** Anime.js - scope - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/scope/scope.cjs b/dist/modules/scope/scope.cjsindex bdf2ca2c..90c20fee 100644--- a/dist/modules/scope/scope.cjs+++ b/dist/modules/scope/scope.cjs@@ -1,6 +1,6 @@/*** Anime.js - scope - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/scope/scope.js b/dist/modules/scope/scope.jsindex f7c38611..bc827c65 100644--- a/dist/modules/scope/scope.js+++ b/dist/modules/scope/scope.js@@ -1,6 +1,6 @@/*** Anime.js - scope - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/svg/drawable.cjs b/dist/modules/svg/drawable.cjsindex 80785349..81d670a9 100644--- a/dist/modules/svg/drawable.cjs+++ b/dist/modules/svg/drawable.cjs@@ -1,6 +1,6 @@/*** Anime.js - svg - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/svg/drawable.js b/dist/modules/svg/drawable.jsindex d988f6ad..cf8e6f82 100644--- a/dist/modules/svg/drawable.js+++ b/dist/modules/svg/drawable.js@@ -1,6 +1,6 @@/*** Anime.js - svg - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/svg/helpers.cjs b/dist/modules/svg/helpers.cjsindex 2260c519..ec281b74 100644--- a/dist/modules/svg/helpers.cjs+++ b/dist/modules/svg/helpers.cjs@@ -1,6 +1,6 @@/*** Anime.js - svg - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/svg/helpers.js b/dist/modules/svg/helpers.jsindex cc1c3ba0..244520b8 100644--- a/dist/modules/svg/helpers.js+++ b/dist/modules/svg/helpers.js@@ -1,6 +1,6 @@/*** Anime.js - svg - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/svg/index.cjs b/dist/modules/svg/index.cjsindex 2bb71a7e..1cc22b4f 100644--- a/dist/modules/svg/index.cjs+++ b/dist/modules/svg/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - svg - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/svg/index.js b/dist/modules/svg/index.jsindex 0430ed9c..2341e445 100644--- a/dist/modules/svg/index.js+++ b/dist/modules/svg/index.js@@ -1,6 +1,6 @@/*** Anime.js - svg - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/svg/morphto.cjs b/dist/modules/svg/morphto.cjsindex 1a09ecc1..4ceabe0e 100644--- a/dist/modules/svg/morphto.cjs+++ b/dist/modules/svg/morphto.cjs@@ -1,13 +1,12 @@/*** Anime.js - svg - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/'use strict';-var consts = require('../core/consts.cjs');var helpers$1 = require('../core/helpers.cjs');var helpers = require('./helpers.cjs');@@ -23,7 +22,7 @@ var helpers = require('./helpers.cjs');* @param {Number} [precision]* @return {FunctionValue}*/-const morphTo = (path2, precision = .33) => ($path1) => {+const morphTo = (path2, precision = .33) => ($path1, index, total, prevTween) => {const tagName1 = ($path1.tagName || '').toLowerCase();if (!tagName1.match(/^(path|polygon|polyline)$/)) {throw new Error(`Can't morph a <${$path1.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);@@ -38,7 +37,7 @@ const morphTo = (path2, precision = .33) => ($path1) => {}const isPath = $path1.tagName === 'path';const separator = isPath ? ' ' : ',';- const previousPoints = $path1[consts.morphPointsSymbol];+ const previousPoints = prevTween ? prevTween._value : null;if (previousPoints) $path1.setAttribute(isPath ? 'd' : 'points', previousPoints);let v1 = '', v2 = '';@@ -60,8 +59,6 @@ const morphTo = (path2, precision = .33) => ($path1) => {}}- $path1[consts.morphPointsSymbol] = v2;-return [v1, v2];};diff --git a/dist/modules/svg/morphto.js b/dist/modules/svg/morphto.jsindex dd130074..543a6353 100644--- a/dist/modules/svg/morphto.js+++ b/dist/modules/svg/morphto.js@@ -1,11 +1,10 @@/*** Anime.js - svg - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/-import { morphPointsSymbol } from '../core/consts.js';import { round } from '../core/helpers.js';import { getPath } from './helpers.js';@@ -21,7 +20,7 @@ import { getPath } from './helpers.js';* @param {Number} [precision]* @return {FunctionValue}*/-const morphTo = (path2, precision = .33) => ($path1) => {+const morphTo = (path2, precision = .33) => ($path1, index, total, prevTween) => {const tagName1 = ($path1.tagName || '').toLowerCase();if (!tagName1.match(/^(path|polygon|polyline)$/)) {throw new Error(`Can't morph a <${$path1.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);@@ -36,7 +35,7 @@ const morphTo = (path2, precision = .33) => ($path1) => {}const isPath = $path1.tagName === 'path';const separator = isPath ? ' ' : ',';- const previousPoints = $path1[morphPointsSymbol];+ const previousPoints = prevTween ? prevTween._value : null;if (previousPoints) $path1.setAttribute(isPath ? 'd' : 'points', previousPoints);let v1 = '', v2 = '';@@ -58,8 +57,6 @@ const morphTo = (path2, precision = .33) => ($path1) => {}}- $path1[morphPointsSymbol] = v2;-return [v1, v2];};diff --git a/dist/modules/svg/motionpath.cjs b/dist/modules/svg/motionpath.cjsindex 6da8f053..180010fe 100644--- a/dist/modules/svg/motionpath.cjs+++ b/dist/modules/svg/motionpath.cjs@@ -1,6 +1,6 @@/*** Anime.js - svg - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/svg/motionpath.js b/dist/modules/svg/motionpath.jsindex 437367c6..264fee71 100644--- a/dist/modules/svg/motionpath.js+++ b/dist/modules/svg/motionpath.js@@ -1,6 +1,6 @@/*** Anime.js - svg - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/text/index.cjs b/dist/modules/text/index.cjsindex f9d52204..ff580626 100644--- a/dist/modules/text/index.cjs+++ b/dist/modules/text/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - text - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -8,9 +8,11 @@'use strict';var split = require('./split.cjs');+var scramble = require('./scramble.cjs');exports.TextSplitter = split.TextSplitter;exports.split = split.split;exports.splitText = split.splitText;+exports.scrambleText = scramble.scrambleText;diff --git a/dist/modules/text/index.d.ts b/dist/modules/text/index.d.tsindex 35a025e6..6f257136 100644--- a/dist/modules/text/index.d.ts+++ b/dist/modules/text/index.d.ts@@ -1 +1,2 @@export * from "./split.js";+export * from "./scramble.js";diff --git a/dist/modules/text/index.js b/dist/modules/text/index.jsindex 4d8abe60..54f5a271 100644--- a/dist/modules/text/index.js+++ b/dist/modules/text/index.js@@ -1,8 +1,9 @@/*** Anime.js - text - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/export { TextSplitter, split, splitText } from './split.js';+export { scrambleText } from './scramble.js';diff --git a/dist/modules/text/scramble.cjs b/dist/modules/text/scramble.cjsnew file mode 100644index 00000000..cde0f573--- /dev/null+++ b/dist/modules/text/scramble.cjs@@ -0,0 +1,272 @@+/**+ * Anime.js - text - CJS+ * @version v4.4.0+ * @license MIT+ * @copyright 2026 - Julian Garnier+ */++'use strict';++var random = require('../utils/random.cjs');+var globals = require('../core/globals.cjs');+var helpers = require('../core/helpers.cjs');+var parser = require('../easings/eases/parser.cjs');+var consts = require('../core/consts.cjs');++/**+ * @import {+ * ScrambleTextParams,+ * FunctionValue,+ * } from '../types/index.js'+*/++/**+ * '-' is the range operator; place it at the start or end of the string to use it as a literal (e.g. '-abc' or 'abc-')+ * @param {String} str+ * @return {String}+ */+const expandCharRanges = (str) => {+ let result = '';+ for (let i = 0, l = str.length; i < l; i++) {+ if (i + 2 < l && str[i + 1] === '-' && str.charCodeAt(i) < str.charCodeAt(i + 2)) {+ const start = str.charCodeAt(i);+ const end = str.charCodeAt(i + 2);+ for (let c = start; c <= end; c++) result += String.fromCharCode(c);+ i += 2;+ } else {+ result += str[i];+ }+ }+ return result;+};++const charSets = {+ lowercase: 'a-z',+ uppercase: 'A-Z',+ numbers: '0-9',+ symbols: '!%#_|*+=',+ braille: '⠀-⣿',+ blocks: '▀-▟',+ shades: '░-▓',+};++const originalTexts = new WeakMap();++/**+ * Returns a function-based tween value that scrambles the target's text content,+ * progressively revealing the original text.+ *+ * @param {ScrambleTextParams} [params]+ * @return {FunctionValue}+ */+const scrambleText = (params = {}) => {+ if (!params) params = {};+ const charsParam = params.chars;+ const easeFn = parser.parseEase(params.ease || 'linear');+ const text = params.text;+ const fromParam = params.from;+ const reversed = params.reversed || false;+ const perturbation = params.perturbation || 0;+ const cursorParam = params.cursor;+ const cursorChars = cursorParam === true ? '_'+ : typeof cursorParam === 'number' ? String.fromCharCode(cursorParam)+ : typeof cursorParam === 'string' ? cursorParam+ : '';+ const cursorLen = cursorChars.length;+ const seed = params.seed || 0;+ const override = params.override !== undefined ? params.override : true;+ const revealRate = params.revealRate || 60;+ const interval = 1000 * globals.globals.timeScale / revealRate;+ const settleDuration = params.settleDuration || 300 * globals.globals.timeScale;+ const settleRate = params.settleRate || 30;+ const durationParam = params.duration;+ const revealDelayParam = params.revealDelay;+ const delayParam = params.delay;+ const onChange = params.onChange || consts.noop;++ return (target, index, targets, prevTween) => {+ const rawChars = typeof charsParam === 'function' ? charsParam(target, index, targets) : (charsParam || 'a-zA-Z0-9!%#_');+ const characters = expandCharRanges(charSets[rawChars] || rawChars);+ const totalChars = characters.length - 1;+ const duration = typeof durationParam === 'function' ? durationParam(target, index, targets) : durationParam;+ const revealDelay = typeof revealDelayParam === 'function' ? revealDelayParam(target, index, targets) : (revealDelayParam || 0);+ const delay = typeof delayParam === 'function' ? delayParam(target, index, targets) : (delayParam || 0);+ const rng = seed ? random.createSeededRandom(seed) : random.createSeededRandom();+ if (!originalTexts.has(target)) originalTexts.set(target, target.textContent);+ const startingText = prevTween ? prevTween._value : target.textContent;+ const targetText = text !== undefined+ ? (typeof text === 'function' ? text(target, index, targets) : text)+ : prevTween ? prevTween._value+ : originalTexts.get(target);+ const settledText = targetText === ' ' || targetText === ' ' ? ' ' : targetText;+ const startLength = startingText === ' ' ? 0 : startingText.length;+ const endLength = settledText.length;+ const overrideChars = override === true ? characters+ : typeof override === 'string' && override.length > 0 ? expandCharRanges(charSets[/** @type {String} */(override)] || /** @type {String} */(override))+ : null;+ const totalOverrideChars = overrideChars ? overrideChars.length - 1 : 0;+ // Space override uses so the browser doesn't collapse consecutive spaces in innerHTML+ const overrideChar = override === ' ' ? ' ' : null;+ // When starting from blank, only animate the target text length to avoid padding beyond it+ const animLength = override === '' ? endLength : Math.max(startLength, endLength);+ // Compute total duration from interval spacing and settle time, or use the explicit duration+ const animDuration = duration > 0 ? duration : (animLength - 1) * interval + settleDuration;+ const computedDuration = helpers.round((animDuration + revealDelay) / globals.globals.timeScale, 0) * globals.globals.timeScale;+ const revealDelayRatio = revealDelay > 0 ? helpers.round(revealDelay / computedDuration, 12) : 0;+ // Auto-resolve reveal direction: shrinking text reveals from right, growing from left+ const resolvedFrom = fromParam === undefined || fromParam === 'auto' ? (endLength < startLength ? 'right' : 'left') : fromParam;+ const charOrder = new Int32Array(animLength);+ if (resolvedFrom === 'random') {+ for (let i = 0; i < animLength; i++) charOrder[i] = i;+ for (let i = animLength - 1; i > 0; i--) {+ const j = rng(0, i);+ const t = charOrder[i]; charOrder[i] = charOrder[j]; charOrder[j] = t;+ }+ } else {+ const ref = resolvedFrom === 'right' ? (override === '' || !startLength ? animLength : startLength) - 1+ : resolvedFrom === 'center' ? ((override === '' || !startLength ? animLength : startLength) - 1) / 2+ : typeof resolvedFrom === 'number' ? resolvedFrom+ : 0;+ const abs = Math.abs;+ const indices = new Array(animLength);+ for (let i = 0; i < animLength; i++) indices[i] = i;+ indices.sort((a, b) => abs(a - ref) - abs(b - ref));+ for (let i = 0; i < animLength; i++) charOrder[indices[i]] = i;+ }+ if (reversed) {+ const last = animLength - 1;+ for (let i = 0; i < animLength; i++) charOrder[i] = last - charOrder[i];+ }+ // settleRatio is the fraction of the animation each character spends in the active scrambling zone+ const settleRatio = helpers.round(settleDuration / animDuration, 12);+ // settleSpacing is the time gap between consecutive characters entering the active zone+ const settleSpacing = helpers.round((1 - settleRatio) / animLength, 12);+ const cursorZone = cursorLen * settleSpacing;+ // stepRatio controls how often scramble characters refresh (based on settleRate)+ const stepRatio = helpers.round(1000 * globals.globals.timeScale / (settleRate * computedDuration), 12);+ // Pre-compute per-character start and settle times+ const charStarts = new Float32Array(animLength);+ const charEnds = new Float32Array(animLength);+ const scale = perturbation > 0 ? perturbation * settleRatio : 0;+ for (let c = 0; c < animLength; c++) {+ const so = scale > 0 ? (rng(0, 2000) - 1000) / 1000 * scale : 0;+ const eo = scale > 0 ? (rng(0, 2000) - 1000) / 1000 * scale : 0;+ charStarts[c] = charOrder[c] * settleSpacing + so;+ charEnds[c] = Math.ceil((charStarts[c] + settleRatio + eo) / stepRatio) * stepRatio;+ }+ // When text shrinks with non-sequential from modes, delay target settle times past all extras+ if (endLength < animLength && resolvedFrom !== 'left' && resolvedFrom !== 'right' && resolvedFrom !== 'random') {+ let maxExtraEnd = 0;+ for (let c = endLength; c < animLength; c++) {+ if (charEnds[c] > maxExtraEnd) maxExtraEnd = charEnds[c];+ }+ const targets = new Array(endLength);+ for (let c = 0; c < endLength; c++) targets[c] = c;+ targets.sort((a, b) => charOrder[a] - charOrder[b]);+ const targetSpacing = (1 - maxExtraEnd) / endLength;+ for (let i = 0; i < endLength; i++) {+ const revealTime = maxExtraEnd + i * targetSpacing;+ if (revealTime > charEnds[targets[i]]) {+ charEnds[targets[i]] = revealTime;+ }+ }+ }+ // charCache holds the current scramble character for each position, refreshed at settleRate+ const charCache = new Array(animLength);+ for (let c = 0; c < animLength; c++) {+ charCache[c] = characters[rng(0, totalChars)];+ }+ // overrideCache holds scramble characters for the starting text (override: true or custom string)+ const overrideCache = overrideChars ? (overrideChars === characters ? charCache : new Array(animLength)) : null;+ if (overrideCache && overrideCache !== charCache) {+ for (let c = 0; c < animLength; c++) {+ overrideCache[c] = overrideChar || /** @type {String} */(overrideChars)[rng(0, overrideChars.length - 1)];+ }+ }+ // Build the initial display text based on override mode+ let fillStartText = startingText;+ if (!prevTween) {+ if (override === '') {+ fillStartText = '';+ } else if (overrideChars) {+ fillStartText = '';+ for (let c = 0; c < startLength; c++) {+ fillStartText += startingText[c] === ' ' ? ' ' : /** @type {Array<String>} */(overrideCache)[c];+ }+ }+ }++ let lastValue = -1;+ let lastStep = -1;+ let scrambled = '';+ const hasOverride = override !== '';+ const hasOverrideChars = !!overrideChars;+ const hasCursor = cursorLen > 0;++ return {+ from: 0,+ to: 1,+ duration: computedDuration,+ delay: delay,+ ease: 'linear',+ modifier: (v) => {+ if (v === lastValue) return scrambled;+ lastValue = v;+ if (delay > 0 && v <= 0) { scrambled = startingText; return startingText; }+ if (v <= 0) { scrambled = fillStartText; return fillStartText; }+ if (v >= 1) { scrambled = settledText; return settledText; }+ scrambled = '';+ // Only refresh scramble characters when we cross a settleRate step boundary+ const currentStep = (v / stepRatio) | 0;+ const refreshChars = currentStep !== lastStep;+ if (refreshChars) lastStep = currentStep;+ // Subtract delay ratio to get the effective animation progress+ const linear = revealDelayRatio > 0 ? (v - revealDelayRatio) / (1 - revealDelayRatio) : v;+ const t = linear > 0 ? easeFn(linear) : 0;+ for (let c = 0; c < animLength; c++) {+ // Each character has its own start/end window based on its reveal order+ const charStart = charStarts[c];+ const charEnd = charEnds[c];+ // Settled zone: character has finished its transition+ if (t >= charEnd) {+ if (c < endLength) scrambled += settledText[c];+ continue;+ }+ // Pre-transition zone: reveal wave hasn't reached this character yet+ if (t <= 0 || t < charStart) {+ if (hasOverride && c < startLength) {+ if (hasOverrideChars) {+ if (startingText[c] === ' ') {+ scrambled += ' ';+ } else {+ if (refreshChars) /** @type {Array<String>} */(overrideCache)[c] = overrideChar || /** @type {String} */(overrideChars)[rng(0, totalOverrideChars)];+ scrambled += /** @type {Array<String>} */(overrideCache)[c];+ }+ } else {+ // Default (override: false): show the original starting text+ scrambled += startingText[c];+ }+ }+ continue;+ }+ // Active zone: character is between charStart and charEnd+ const isSpace = (c < endLength && settledText[c] === ' ') || (c < startLength && startingText[c] === ' ');+ if (isSpace) {+ scrambled += ' ';+ } else if (hasCursor && t - charStart < cursorZone) {+ // Cursor sub-zone: show cursor character based on position within cursor width+ scrambled += cursorChars[cursorLen - 1 - (((t - charStart) / settleSpacing) | 0)];+ } else {+ // Scramble zone: show cycling random characters+ if (refreshChars) charCache[c] = characters[rng(0, totalChars)];+ scrambled += charCache[c];+ }+ }+ if (refreshChars) onChange(scrambled, t);+ return scrambled;+ }+ }+ }+};++exports.scrambleText = scrambleText;diff --git a/dist/modules/text/scramble.d.ts b/dist/modules/text/scramble.d.tsnew file mode 100644index 00000000..4c48f8e1--- /dev/null+++ b/dist/modules/text/scramble.d.ts@@ -0,0 +1,3 @@+export function scrambleText(params?: ScrambleTextParams): FunctionValue;+import type { ScrambleTextParams } from '../types/index.js';+import type { FunctionValue } from '../types/index.js';diff --git a/dist/modules/text/scramble.js b/dist/modules/text/scramble.jsnew file mode 100644index 00000000..787a1057--- /dev/null+++ b/dist/modules/text/scramble.js@@ -0,0 +1,270 @@+/**+ * Anime.js - text - ESM+ * @version v4.4.0+ * @license MIT+ * @copyright 2026 - Julian Garnier+ */++import { createSeededRandom } from '../utils/random.js';+import { globals } from '../core/globals.js';+import { round } from '../core/helpers.js';+import { parseEase } from '../easings/eases/parser.js';+import { noop } from '../core/consts.js';++/**+ * @import {+ * ScrambleTextParams,+ * FunctionValue,+ * } from '../types/index.js'+*/++/**+ * '-' is the range operator; place it at the start or end of the string to use it as a literal (e.g. '-abc' or 'abc-')+ * @param {String} str+ * @return {String}+ */+const expandCharRanges = (str) => {+ let result = '';+ for (let i = 0, l = str.length; i < l; i++) {+ if (i + 2 < l && str[i + 1] === '-' && str.charCodeAt(i) < str.charCodeAt(i + 2)) {+ const start = str.charCodeAt(i);+ const end = str.charCodeAt(i + 2);+ for (let c = start; c <= end; c++) result += String.fromCharCode(c);+ i += 2;+ } else {+ result += str[i];+ }+ }+ return result;+};++const charSets = {+ lowercase: 'a-z',+ uppercase: 'A-Z',+ numbers: '0-9',+ symbols: '!%#_|*+=',+ braille: '⠀-⣿',+ blocks: '▀-▟',+ shades: '░-▓',+};++const originalTexts = new WeakMap();++/**+ * Returns a function-based tween value that scrambles the target's text content,+ * progressively revealing the original text.+ *+ * @param {ScrambleTextParams} [params]+ * @return {FunctionValue}+ */+const scrambleText = (params = {}) => {+ if (!params) params = {};+ const charsParam = params.chars;+ const easeFn = parseEase(params.ease || 'linear');+ const text = params.text;+ const fromParam = params.from;+ const reversed = params.reversed || false;+ const perturbation = params.perturbation || 0;+ const cursorParam = params.cursor;+ const cursorChars = cursorParam === true ? '_'+ : typeof cursorParam === 'number' ? String.fromCharCode(cursorParam)+ : typeof cursorParam === 'string' ? cursorParam+ : '';+ const cursorLen = cursorChars.length;+ const seed = params.seed || 0;+ const override = params.override !== undefined ? params.override : true;+ const revealRate = params.revealRate || 60;+ const interval = 1000 * globals.timeScale / revealRate;+ const settleDuration = params.settleDuration || 300 * globals.timeScale;+ const settleRate = params.settleRate || 30;+ const durationParam = params.duration;+ const revealDelayParam = params.revealDelay;+ const delayParam = params.delay;+ const onChange = params.onChange || noop;++ return (target, index, targets, prevTween) => {+ const rawChars = typeof charsParam === 'function' ? charsParam(target, index, targets) : (charsParam || 'a-zA-Z0-9!%#_');+ const characters = expandCharRanges(charSets[rawChars] || rawChars);+ const totalChars = characters.length - 1;+ const duration = typeof durationParam === 'function' ? durationParam(target, index, targets) : durationParam;+ const revealDelay = typeof revealDelayParam === 'function' ? revealDelayParam(target, index, targets) : (revealDelayParam || 0);+ const delay = typeof delayParam === 'function' ? delayParam(target, index, targets) : (delayParam || 0);+ const rng = seed ? createSeededRandom(seed) : createSeededRandom();+ if (!originalTexts.has(target)) originalTexts.set(target, target.textContent);+ const startingText = prevTween ? prevTween._value : target.textContent;+ const targetText = text !== undefined+ ? (typeof text === 'function' ? text(target, index, targets) : text)+ : prevTween ? prevTween._value+ : originalTexts.get(target);+ const settledText = targetText === ' ' || targetText === ' ' ? ' ' : targetText;+ const startLength = startingText === ' ' ? 0 : startingText.length;+ const endLength = settledText.length;+ const overrideChars = override === true ? characters+ : typeof override === 'string' && override.length > 0 ? expandCharRanges(charSets[/** @type {String} */(override)] || /** @type {String} */(override))+ : null;+ const totalOverrideChars = overrideChars ? overrideChars.length - 1 : 0;+ // Space override uses so the browser doesn't collapse consecutive spaces in innerHTML+ const overrideChar = override === ' ' ? ' ' : null;+ // When starting from blank, only animate the target text length to avoid padding beyond it+ const animLength = override === '' ? endLength : Math.max(startLength, endLength);+ // Compute total duration from interval spacing and settle time, or use the explicit duration+ const animDuration = duration > 0 ? duration : (animLength - 1) * interval + settleDuration;+ const computedDuration = round((animDuration + revealDelay) / globals.timeScale, 0) * globals.timeScale;+ const revealDelayRatio = revealDelay > 0 ? round(revealDelay / computedDuration, 12) : 0;+ // Auto-resolve reveal direction: shrinking text reveals from right, growing from left+ const resolvedFrom = fromParam === undefined || fromParam === 'auto' ? (endLength < startLength ? 'right' : 'left') : fromParam;+ const charOrder = new Int32Array(animLength);+ if (resolvedFrom === 'random') {+ for (let i = 0; i < animLength; i++) charOrder[i] = i;+ for (let i = animLength - 1; i > 0; i--) {+ const j = rng(0, i);+ const t = charOrder[i]; charOrder[i] = charOrder[j]; charOrder[j] = t;+ }+ } else {+ const ref = resolvedFrom === 'right' ? (override === '' || !startLength ? animLength : startLength) - 1+ : resolvedFrom === 'center' ? ((override === '' || !startLength ? animLength : startLength) - 1) / 2+ : typeof resolvedFrom === 'number' ? resolvedFrom+ : 0;+ const abs = Math.abs;+ const indices = new Array(animLength);+ for (let i = 0; i < animLength; i++) indices[i] = i;+ indices.sort((a, b) => abs(a - ref) - abs(b - ref));+ for (let i = 0; i < animLength; i++) charOrder[indices[i]] = i;+ }+ if (reversed) {+ const last = animLength - 1;+ for (let i = 0; i < animLength; i++) charOrder[i] = last - charOrder[i];+ }+ // settleRatio is the fraction of the animation each character spends in the active scrambling zone+ const settleRatio = round(settleDuration / animDuration, 12);+ // settleSpacing is the time gap between consecutive characters entering the active zone+ const settleSpacing = round((1 - settleRatio) / animLength, 12);+ const cursorZone = cursorLen * settleSpacing;+ // stepRatio controls how often scramble characters refresh (based on settleRate)+ const stepRatio = round(1000 * globals.timeScale / (settleRate * computedDuration), 12);+ // Pre-compute per-character start and settle times+ const charStarts = new Float32Array(animLength);+ const charEnds = new Float32Array(animLength);+ const scale = perturbation > 0 ? perturbation * settleRatio : 0;+ for (let c = 0; c < animLength; c++) {+ const so = scale > 0 ? (rng(0, 2000) - 1000) / 1000 * scale : 0;+ const eo = scale > 0 ? (rng(0, 2000) - 1000) / 1000 * scale : 0;+ charStarts[c] = charOrder[c] * settleSpacing + so;+ charEnds[c] = Math.ceil((charStarts[c] + settleRatio + eo) / stepRatio) * stepRatio;+ }+ // When text shrinks with non-sequential from modes, delay target settle times past all extras+ if (endLength < animLength && resolvedFrom !== 'left' && resolvedFrom !== 'right' && resolvedFrom !== 'random') {+ let maxExtraEnd = 0;+ for (let c = endLength; c < animLength; c++) {+ if (charEnds[c] > maxExtraEnd) maxExtraEnd = charEnds[c];+ }+ const targets = new Array(endLength);+ for (let c = 0; c < endLength; c++) targets[c] = c;+ targets.sort((a, b) => charOrder[a] - charOrder[b]);+ const targetSpacing = (1 - maxExtraEnd) / endLength;+ for (let i = 0; i < endLength; i++) {+ const revealTime = maxExtraEnd + i * targetSpacing;+ if (revealTime > charEnds[targets[i]]) {+ charEnds[targets[i]] = revealTime;+ }+ }+ }+ // charCache holds the current scramble character for each position, refreshed at settleRate+ const charCache = new Array(animLength);+ for (let c = 0; c < animLength; c++) {+ charCache[c] = characters[rng(0, totalChars)];+ }+ // overrideCache holds scramble characters for the starting text (override: true or custom string)+ const overrideCache = overrideChars ? (overrideChars === characters ? charCache : new Array(animLength)) : null;+ if (overrideCache && overrideCache !== charCache) {+ for (let c = 0; c < animLength; c++) {+ overrideCache[c] = overrideChar || /** @type {String} */(overrideChars)[rng(0, overrideChars.length - 1)];+ }+ }+ // Build the initial display text based on override mode+ let fillStartText = startingText;+ if (!prevTween) {+ if (override === '') {+ fillStartText = '';+ } else if (overrideChars) {+ fillStartText = '';+ for (let c = 0; c < startLength; c++) {+ fillStartText += startingText[c] === ' ' ? ' ' : /** @type {Array<String>} */(overrideCache)[c];+ }+ }+ }++ let lastValue = -1;+ let lastStep = -1;+ let scrambled = '';+ const hasOverride = override !== '';+ const hasOverrideChars = !!overrideChars;+ const hasCursor = cursorLen > 0;++ return {+ from: 0,+ to: 1,+ duration: computedDuration,+ delay: delay,+ ease: 'linear',+ modifier: (v) => {+ if (v === lastValue) return scrambled;+ lastValue = v;+ if (delay > 0 && v <= 0) { scrambled = startingText; return startingText; }+ if (v <= 0) { scrambled = fillStartText; return fillStartText; }+ if (v >= 1) { scrambled = settledText; return settledText; }+ scrambled = '';+ // Only refresh scramble characters when we cross a settleRate step boundary+ const currentStep = (v / stepRatio) | 0;+ const refreshChars = currentStep !== lastStep;+ if (refreshChars) lastStep = currentStep;+ // Subtract delay ratio to get the effective animation progress+ const linear = revealDelayRatio > 0 ? (v - revealDelayRatio) / (1 - revealDelayRatio) : v;+ const t = linear > 0 ? easeFn(linear) : 0;+ for (let c = 0; c < animLength; c++) {+ // Each character has its own start/end window based on its reveal order+ const charStart = charStarts[c];+ const charEnd = charEnds[c];+ // Settled zone: character has finished its transition+ if (t >= charEnd) {+ if (c < endLength) scrambled += settledText[c];+ continue;+ }+ // Pre-transition zone: reveal wave hasn't reached this character yet+ if (t <= 0 || t < charStart) {+ if (hasOverride && c < startLength) {+ if (hasOverrideChars) {+ if (startingText[c] === ' ') {+ scrambled += ' ';+ } else {+ if (refreshChars) /** @type {Array<String>} */(overrideCache)[c] = overrideChar || /** @type {String} */(overrideChars)[rng(0, totalOverrideChars)];+ scrambled += /** @type {Array<String>} */(overrideCache)[c];+ }+ } else {+ // Default (override: false): show the original starting text+ scrambled += startingText[c];+ }+ }+ continue;+ }+ // Active zone: character is between charStart and charEnd+ const isSpace = (c < endLength && settledText[c] === ' ') || (c < startLength && startingText[c] === ' ');+ if (isSpace) {+ scrambled += ' ';+ } else if (hasCursor && t - charStart < cursorZone) {+ // Cursor sub-zone: show cursor character based on position within cursor width+ scrambled += cursorChars[cursorLen - 1 - (((t - charStart) / settleSpacing) | 0)];+ } else {+ // Scramble zone: show cycling random characters+ if (refreshChars) charCache[c] = characters[rng(0, totalChars)];+ scrambled += charCache[c];+ }+ }+ if (refreshChars) onChange(scrambled, t);+ return scrambled;+ }+ }+ }+};++export { scrambleText };diff --git a/dist/modules/text/split.cjs b/dist/modules/text/split.cjsindex cd8e33d5..f86f20bc 100644--- a/dist/modules/text/split.cjs+++ b/dist/modules/text/split.cjs@@ -1,6 +1,6 @@/*** Anime.js - text - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -197,7 +197,7 @@ const processHTMLTemplate = (htmlTemplate, store, node, $parentFragment, type, d*/class TextSplitter {/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]*/constructor(target, parameters = {}) {@@ -269,11 +269,11 @@ class TextSplitter {}/**- * @param {(...args: any[]) => Tickable | (() => void)} effect+ * @param {(...args: any[]) => Tickable | (() => void) | void} effect* @return this*/addEffect(effect) {- if (!helpers.isFnc(effect)) return console.warn('Effect must return a function.');+ if (!helpers.isFnc(effect)) { console.warn('Effect must return a function.'); return this; }const refreshableEffect = time.keepTime(effect);this.effects.push(refreshableEffect);if (this.ready) this.effectsCleanups[this.effects.length - 1] = refreshableEffect(this);@@ -479,7 +479,7 @@ class TextSplitter {}/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]* @return {TextSplitter}*/diff --git a/dist/modules/text/split.d.ts b/dist/modules/text/split.d.tsindex 110bfe3d..f1810885 100644--- a/dist/modules/text/split.d.ts+++ b/dist/modules/text/split.d.ts@@ -4,10 +4,10 @@*/export class TextSplitter {/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]*/- constructor(target: HTMLElement | NodeList | string | Array<HTMLElement>, parameters?: TextSplitterParams);+ constructor(target: Element | NodeList | string | Array<Element>, parameters?: TextSplitterParams);debug: boolean;includeSpaces: boolean;accessible: boolean;@@ -31,10 +31,10 @@ export class TextSplitter {resizeTimeout: NodeJS.Timeout;resizeObserver: ResizeObserver;/**- * @param {(...args: any[]) => Tickable | (() => void)} effect+ * @param {(...args: any[]) => Tickable | (() => void) | void} effect* @return this*/- addEffect(effect: (...args: any[]) => Tickable | (() => void)): void | this;+ addEffect(effect: (...args: any[]) => Tickable | (() => void) | void): this;revert(): this;/*** Recursively processes a node and its children@@ -48,7 +48,7 @@ export class TextSplitter {split(clearCache?: boolean): this;refresh(): void;}-export function splitText(target: HTMLElement | NodeList | string | Array<HTMLElement>, parameters?: TextSplitterParams): TextSplitter;+export function splitText(target: Element | NodeList | string | Array<Element>, parameters?: TextSplitterParams): TextSplitter;export function split(target: HTMLElement | NodeList | string | Array<HTMLElement>, parameters?: TextSplitterParams): TextSplitter;export type Segment = {segment: string;diff --git a/dist/modules/text/split.js b/dist/modules/text/split.jsindex 0d15a4af..bc54c59e 100644--- a/dist/modules/text/split.js+++ b/dist/modules/text/split.js@@ -1,6 +1,6 @@/*** Anime.js - text - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -195,7 +195,7 @@ const processHTMLTemplate = (htmlTemplate, store, node, $parentFragment, type, d*/class TextSplitter {/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]*/constructor(target, parameters = {}) {@@ -267,11 +267,11 @@ class TextSplitter {}/**- * @param {(...args: any[]) => Tickable | (() => void)} effect+ * @param {(...args: any[]) => Tickable | (() => void) | void} effect* @return this*/addEffect(effect) {- if (!isFnc(effect)) return console.warn('Effect must return a function.');+ if (!isFnc(effect)) { console.warn('Effect must return a function.'); return this; }const refreshableEffect = keepTime(effect);this.effects.push(refreshableEffect);if (this.ready) this.effectsCleanups[this.effects.length - 1] = refreshableEffect(this);@@ -477,7 +477,7 @@ class TextSplitter {}/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]* @return {TextSplitter}*/diff --git a/dist/modules/timeline/index.cjs b/dist/modules/timeline/index.cjsindex 5ec17fa8..71a5d77d 100644--- a/dist/modules/timeline/index.cjs+++ b/dist/modules/timeline/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - timeline - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/timeline/index.js b/dist/modules/timeline/index.jsindex 2c3ac6c4..1b06740d 100644--- a/dist/modules/timeline/index.js+++ b/dist/modules/timeline/index.js@@ -1,6 +1,6 @@/*** Anime.js - timeline - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/timeline/position.cjs b/dist/modules/timeline/position.cjsindex d2106f9c..6627191e 100644--- a/dist/modules/timeline/position.cjs+++ b/dist/modules/timeline/position.cjs@@ -1,6 +1,6 @@/*** Anime.js - timeline - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/timeline/position.js b/dist/modules/timeline/position.jsindex 9e14ae0c..b9e9e77f 100644--- a/dist/modules/timeline/position.js+++ b/dist/modules/timeline/position.js@@ -1,6 +1,6 @@/*** Anime.js - timeline - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/timeline/timeline.cjs b/dist/modules/timeline/timeline.cjsindex e8a79108..84ca8a34 100644--- a/dist/modules/timeline/timeline.cjs+++ b/dist/modules/timeline/timeline.cjs@@ -1,6 +1,6 @@/*** Anime.js - timeline - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -14,9 +14,9 @@ var values = require('../core/values.cjs');var targets = require('../core/targets.cjs');var render = require('../core/render.cjs');var styles = require('../core/styles.cjs');+var timer = require('../timer/timer.cjs');var composition = require('../animation/composition.cjs');var animation = require('../animation/animation.cjs');-var timer = require('../timer/timer.cjs');var parser = require('../easings/eases/parser.cjs');var position = require('./position.cjs');@@ -33,6 +33,7 @@ var position = require('./position.cjs');* DefaultsParams,* TimelinePosition,* StaggerFunction,+ * TargetsArray,* } from '../types/index.js'*/@@ -42,6 +43,8 @@ var position = require('./position.cjs');* } from '../waapi/waapi.js'*/+/** @import {TweakRegister} from 'tweaks' */+/*** @param {Timeline} tl* @return {Number}@@ -63,7 +66,7 @@ function getTimelineTotalDuration(tl) {* @param {Number} timePosition* @param {TargetsParam} targets* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [allTargets]* @return {Timeline}** @param {TimerParams|AnimationParams} childParams@@ -71,15 +74,15 @@ function getTimelineTotalDuration(tl) {* @param {Number} timePosition* @param {TargetsParam} [targets]* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [allTargets]*/-function addTlChild(childParams, tl, timePosition, targets, index, length) {+function addTlChild(childParams, tl, timePosition, targets, index, allTargets) {const isSetter = helpers.isNum(childParams.duration) && /** @type {Number} */(childParams.duration) <= consts.minValue;// Offset the tl position with -minValue for 0 duration animations or .set() calls in order to align their end value with the defined positionconst adjustedPosition = isSetter ? timePosition - consts.minValue : timePosition;if (tl.composition) render.tick(tl, adjustedPosition, 1, 1, consts.tickModes.AUTO);const tlChild = targets ?- new animation.JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, length) :+ new animation.JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, allTargets) :new timer.Timer(/** @type {TimerParams} */(childParams), tl, adjustedPosition);if (tl.composition) tlChild.init(true);// TODO: Might be better to insert at a position relative to startTime?@@ -127,7 +130,7 @@ class Timeline extends timer.Timer {* @overload* @param {TargetsParam} a1* @param {AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]* @return {this}** @overload@@ -137,7 +140,7 @@ class Timeline extends timer.Timer {** @param {TargetsParam|TimerParams} a1* @param {TimelinePosition|AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]*/add(a1, a2, a3) {const isAnim = helpers.isObj(a2);@@ -146,9 +149,11 @@ class Timeline extends timer.Timer {this._hasChildren = true;if (isAnim) {const childParams = /** @type {AnimationParams} */(a2);- // Check for function for children stagger positions- if (helpers.isFnc(a3)) {- const staggeredPosition = a3;+ const editorHook = globals.globals.editor && globals.globals.editor.addTimelineChild;+ const isStaggerType = a3 && /** @type {TweakRegister} */(a3).type === 'Stagger' && globals.globals.editor;+ // Check for function or Stagger type children positions+ const staggeredPosition = helpers.isFnc(a3) ? a3 : null;+ if (staggeredPosition || isStaggerType) {const parsedTargetsArray = targets.parseTargets(/** @type {TargetsParam} */(a1));// Store initial duration before adding new children that will change the durationconst tlDuration = this.duration;@@ -159,28 +164,36 @@ class Timeline extends timer.Timer {let i = 0;/** @type {Number} */const parsedLength = (parsedTargetsArray.length);+ // Call editor hook once for the entire stagger group instead of per target+ const resolvedParams = editorHook ? editorHook(/** @type {TargetsParam} */(a1), childParams, this.id, a3, parsedLength) : null;+ // Resolve stagger AFTER editor hook so tweaked position value (a3.defaultValue) is used+ const staggerFn = staggeredPosition || globals.globals.editor.resolveStagger(/** @type {TweakRegister} */(a3).defaultValue);parsedTargetsArray.forEach((/** @type {Target} */target) => {// Create a new parameter object for each staggered children- const staggeredChildParams = { ...childParams };+ const staggeredChildParams = { ...(resolvedParams || childParams) };// Reset the duration of the timeline iteration before each stagger to prevent wrong start value calculationthis.duration = tlDuration;this.iterationDuration = tlIterationDuration;if (!helpers.isUnd(id)) staggeredChildParams.id = id + '-' + i;+ const staggeredTimePosition = position.parseTimelinePosition(this, staggerFn(target, i, parsedTargetsArray, null, this));addTlChild(staggeredChildParams,this,- position.parseTimelinePosition(this, staggeredPosition(target, i, parsedLength, this)),+ staggeredTimePosition,target,i,- parsedLength+ parsedTargetsArray,);i++;});} else {+ // Call editor hook before resolving position so tweaked values are applied+ const resolvedChildParams = editorHook ? editorHook(/** @type {TargetsParam} */(a1), childParams, this.id, a3) : childParams;+ const resolvedPosition = a3 && /** @type {*} */(a3).type ? /** @type {*} */(a3).defaultValue : a3;addTlChild(- childParams,+ resolvedChildParams,this,- position.parseTimelinePosition(this, a3),+ position.parseTimelinePosition(this, resolvedPosition),/** @type {TargetsParam} */(a1),);}@@ -302,7 +315,7 @@ class Timeline extends timer.Timer {revert() {super.revert();helpers.forEachChildren(this, (/** @type {JSAnimation|Timer} */child) => child.revert, true);- return styles.cleanInlineStyles(this);+ return styles.revertValues(this);}/**@@ -322,7 +335,12 @@ class Timeline extends timer.Timer {* @param {TimelineParams} [parameters]* @return {Timeline}*/-const createTimeline = parameters => new Timeline(parameters).init();+const createTimeline = parameters => {+ if (globals.globals.editor) {+ return /** @type {Timeline} */(/** @type {unknown} */(globals.globals.editor.addTimeline(parameters)));+ }+ return new Timeline(parameters).init();+};exports.Timeline = Timeline;exports.createTimeline = createTimeline;diff --git a/dist/modules/timeline/timeline.d.ts b/dist/modules/timeline/timeline.d.tsindex 52a5a8c5..774fd079 100644--- a/dist/modules/timeline/timeline.d.ts+++ b/dist/modules/timeline/timeline.d.ts@@ -16,7 +16,7 @@ export class Timeline extends Timer {* @overload* @param {TargetsParam} a1* @param {AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]* @return {this}** @overload@@ -26,14 +26,14 @@ export class Timeline extends Timer {** @param {TargetsParam|TimerParams} a1* @param {TimelinePosition|AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]*/- add(a1: TargetsParam, a2: AnimationParams, a3?: TimelinePosition | StaggerFunction<number | string>): this;+ add(a1: TargetsParam, a2: AnimationParams, a3?: TimelinePosition | StaggerFunction<number | string> | TweakRegister): this;/*** @overload* @param {TargetsParam} a1* @param {AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]* @return {this}** @overload@@ -43,7 +43,7 @@ export class Timeline extends Timer {** @param {TargetsParam|TimerParams} a1* @param {TimelinePosition|AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]*/add(a1: TimerParams, a2?: TimelinePosition): this;/**@@ -164,6 +164,7 @@ import type { TargetsParam } from '../types/index.js';import type { AnimationParams } from '../types/index.js';import type { TimelinePosition } from '../types/index.js';import type { StaggerFunction } from '../types/index.js';+import type { TweakRegister } from 'tweaks';import type { TimerParams } from '../types/index.js';import type { Tickable } from '../types/index.js';import type { WAAPIAnimation } from '../waapi/waapi.js';diff --git a/dist/modules/timeline/timeline.js b/dist/modules/timeline/timeline.jsindex 2c0790d7..7aea1fbc 100644--- a/dist/modules/timeline/timeline.js+++ b/dist/modules/timeline/timeline.js@@ -1,6 +1,6 @@/*** Anime.js - timeline - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -11,10 +11,10 @@ import { isUnd, mergeObjects, isObj, isFnc, isStr, normalizeTime, forEachChildreimport { setValue } from '../core/values.js';import { parseTargets } from '../core/targets.js';import { tick } from '../core/render.js';-import { cleanInlineStyles } from '../core/styles.js';+import { revertValues } from '../core/styles.js';+import { Timer } from '../timer/timer.js';import { removeTargetsFromRenderable } from '../animation/composition.js';import { JSAnimation } from '../animation/animation.js';-import { Timer } from '../timer/timer.js';import { parseEase } from '../easings/eases/parser.js';import { parseTimelinePosition } from './position.js';@@ -31,6 +31,7 @@ import { parseTimelinePosition } from './position.js';* DefaultsParams,* TimelinePosition,* StaggerFunction,+ * TargetsArray,* } from '../types/index.js'*/@@ -40,6 +41,8 @@ import { parseTimelinePosition } from './position.js';* } from '../waapi/waapi.js'*/+/** @import {TweakRegister} from 'tweaks' */+/*** @param {Timeline} tl* @return {Number}@@ -61,7 +64,7 @@ function getTimelineTotalDuration(tl) {* @param {Number} timePosition* @param {TargetsParam} targets* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [allTargets]* @return {Timeline}** @param {TimerParams|AnimationParams} childParams@@ -69,15 +72,15 @@ function getTimelineTotalDuration(tl) {* @param {Number} timePosition* @param {TargetsParam} [targets]* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [allTargets]*/-function addTlChild(childParams, tl, timePosition, targets, index, length) {+function addTlChild(childParams, tl, timePosition, targets, index, allTargets) {const isSetter = isNum(childParams.duration) && /** @type {Number} */(childParams.duration) <= minValue;// Offset the tl position with -minValue for 0 duration animations or .set() calls in order to align their end value with the defined positionconst adjustedPosition = isSetter ? timePosition - minValue : timePosition;if (tl.composition) tick(tl, adjustedPosition, 1, 1, tickModes.AUTO);const tlChild = targets ?- new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, length) :+ new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, allTargets) :new Timer(/** @type {TimerParams} */(childParams), tl, adjustedPosition);if (tl.composition) tlChild.init(true);// TODO: Might be better to insert at a position relative to startTime?@@ -125,7 +128,7 @@ class Timeline extends Timer {* @overload* @param {TargetsParam} a1* @param {AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]* @return {this}** @overload@@ -135,7 +138,7 @@ class Timeline extends Timer {** @param {TargetsParam|TimerParams} a1* @param {TimelinePosition|AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]*/add(a1, a2, a3) {const isAnim = isObj(a2);@@ -144,9 +147,11 @@ class Timeline extends Timer {this._hasChildren = true;if (isAnim) {const childParams = /** @type {AnimationParams} */(a2);- // Check for function for children stagger positions- if (isFnc(a3)) {- const staggeredPosition = a3;+ const editorHook = globals.editor && globals.editor.addTimelineChild;+ const isStaggerType = a3 && /** @type {TweakRegister} */(a3).type === 'Stagger' && globals.editor;+ // Check for function or Stagger type children positions+ const staggeredPosition = isFnc(a3) ? a3 : null;+ if (staggeredPosition || isStaggerType) {const parsedTargetsArray = parseTargets(/** @type {TargetsParam} */(a1));// Store initial duration before adding new children that will change the durationconst tlDuration = this.duration;@@ -157,28 +162,36 @@ class Timeline extends Timer {let i = 0;/** @type {Number} */const parsedLength = (parsedTargetsArray.length);+ // Call editor hook once for the entire stagger group instead of per target+ const resolvedParams = editorHook ? editorHook(/** @type {TargetsParam} */(a1), childParams, this.id, a3, parsedLength) : null;+ // Resolve stagger AFTER editor hook so tweaked position value (a3.defaultValue) is used+ const staggerFn = staggeredPosition || globals.editor.resolveStagger(/** @type {TweakRegister} */(a3).defaultValue);parsedTargetsArray.forEach((/** @type {Target} */target) => {// Create a new parameter object for each staggered children- const staggeredChildParams = { ...childParams };+ const staggeredChildParams = { ...(resolvedParams || childParams) };// Reset the duration of the timeline iteration before each stagger to prevent wrong start value calculationthis.duration = tlDuration;this.iterationDuration = tlIterationDuration;if (!isUnd(id)) staggeredChildParams.id = id + '-' + i;+ const staggeredTimePosition = parseTimelinePosition(this, staggerFn(target, i, parsedTargetsArray, null, this));addTlChild(staggeredChildParams,this,- parseTimelinePosition(this, staggeredPosition(target, i, parsedLength, this)),+ staggeredTimePosition,target,i,- parsedLength+ parsedTargetsArray,);i++;});} else {+ // Call editor hook before resolving position so tweaked values are applied+ const resolvedChildParams = editorHook ? editorHook(/** @type {TargetsParam} */(a1), childParams, this.id, a3) : childParams;+ const resolvedPosition = a3 && /** @type {*} */(a3).type ? /** @type {*} */(a3).defaultValue : a3;addTlChild(- childParams,+ resolvedChildParams,this,- parseTimelinePosition(this, a3),+ parseTimelinePosition(this, resolvedPosition),/** @type {TargetsParam} */(a1),);}@@ -300,7 +313,7 @@ class Timeline extends Timer {revert() {super.revert();forEachChildren(this, (/** @type {JSAnimation|Timer} */child) => child.revert, true);- return cleanInlineStyles(this);+ return revertValues(this);}/**@@ -320,6 +333,11 @@ class Timeline extends Timer {* @param {TimelineParams} [parameters]* @return {Timeline}*/-const createTimeline = parameters => new Timeline(parameters).init();+const createTimeline = parameters => {+ if (globals.editor) {+ return /** @type {Timeline} */(/** @type {unknown} */(globals.editor.addTimeline(parameters)));+ }+ return new Timeline(parameters).init();+};export { Timeline, createTimeline };diff --git a/dist/modules/timer/index.cjs b/dist/modules/timer/index.cjsindex 60973366..b2ca5459 100644--- a/dist/modules/timer/index.cjs+++ b/dist/modules/timer/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - timer - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/timer/index.js b/dist/modules/timer/index.jsindex 5bbeef0b..364c0fb9 100644--- a/dist/modules/timer/index.js+++ b/dist/modules/timer/index.js@@ -1,6 +1,6 @@/*** Anime.js - timer - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/timer/timer.cjs b/dist/modules/timer/timer.cjsindex fe47d0cc..1edc4dca 100644--- a/dist/modules/timer/timer.cjs+++ b/dist/modules/timer/timer.cjs@@ -1,6 +1,6 @@/*** Anime.js - timer - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -69,6 +69,9 @@ const reviveTimer = timer => {let timerId = 0;+/** @param {Timer} prev @param {Timer} child */+const sortByPriority = (prev, child) => prev._priority > child._priority;+/*** Base class used to create Timers, Animations and Timelines*/@@ -95,6 +98,7 @@ class Timer extends clock.Clock {autoplay,frameRate,playbackRate,+ priority,onComplete,onLoop,onPause,@@ -116,16 +120,6 @@ class Timer extends clock.Clock {/** @type {Number} */(timerLoop) < 0 ? Infinity :/** @type {Number} */(timerLoop) + 1;- if (globals.devTools) {- const isInfinite = timerIterationCount === Infinity;- const registered = globals.devTools.register(this, parameters, isInfinite);- if (registered && isInfinite) {- const minIterations = alternate ? 2 : 1;- const iterations = parent ? globals.devTools.maxNestedInfiniteLoops : globals.devTools.maxInfiniteLoops;- timerIterationCount = Math.max(iterations, minIterations);- }- }-let offsetPosition = 0;if (parent) {@@ -209,6 +203,8 @@ class Timer extends clock.Clock {this._fps = values.setValue(frameRate, timerDefaults.frameRate);/** @type {Number} */this._speed = values.setValue(playbackRate, timerDefaults.playbackRate);+ /** @type {Number} */+ this._priority = +values.setValue(priority, 1);}get cancelled() {@@ -353,7 +349,7 @@ class Timer extends clock.Clock {render.tick(this, consts.minValue, 0, 0, consts.tickModes.FORCE);} else {if (!this._running) {- helpers.addChild(engine.engine, this);+ helpers.addChild(engine.engine, this, sortByPriority);engine.engine._hasChildren = true;this._running = true;}diff --git a/dist/modules/timer/timer.d.ts b/dist/modules/timer/timer.d.tsindex 257f8b14..0a0047aa 100644--- a/dist/modules/timer/timer.d.ts+++ b/dist/modules/timer/timer.d.ts@@ -65,6 +65,8 @@ export class Timer extends Clock {_prev: Renderable;/** @type {Renderable} */_next: Renderable;+ /** @type {Number} */+ _priority: number;set cancelled(cancelled: boolean);get cancelled(): boolean;set currentTime(time: number);diff --git a/dist/modules/timer/timer.js b/dist/modules/timer/timer.jsindex d8b8e402..8392c5f7 100644--- a/dist/modules/timer/timer.js+++ b/dist/modules/timer/timer.js@@ -1,13 +1,13 @@/*** Anime.js - timer - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/import { minValue, noop, maxValue, compositionTypes, tickModes } from '../core/consts.js';import { isFnc, isUnd, now, clampInfinity, clamp, round, forEachChildren, addChild, normalizeTime, floor } from '../core/helpers.js';-import { globals, devTools, scope } from '../core/globals.js';+import { globals, scope } from '../core/globals.js';import { setValue } from '../core/values.js';import { tick } from '../core/render.js';import { removeTweenSliblings, composeTween, getTweenSiblings } from '../animation/composition.js';@@ -67,6 +67,9 @@ const reviveTimer = timer => {let timerId = 0;+/** @param {Timer} prev @param {Timer} child */+const sortByPriority = (prev, child) => prev._priority > child._priority;+/*** Base class used to create Timers, Animations and Timelines*/@@ -93,6 +96,7 @@ class Timer extends Clock {autoplay,frameRate,playbackRate,+ priority,onComplete,onLoop,onPause,@@ -114,16 +118,6 @@ class Timer extends Clock {/** @type {Number} */(timerLoop) < 0 ? Infinity :/** @type {Number} */(timerLoop) + 1;- if (devTools) {- const isInfinite = timerIterationCount === Infinity;- const registered = devTools.register(this, parameters, isInfinite);- if (registered && isInfinite) {- const minIterations = alternate ? 2 : 1;- const iterations = parent ? devTools.maxNestedInfiniteLoops : devTools.maxInfiniteLoops;- timerIterationCount = Math.max(iterations, minIterations);- }- }-let offsetPosition = 0;if (parent) {@@ -207,6 +201,8 @@ class Timer extends Clock {this._fps = setValue(frameRate, timerDefaults.frameRate);/** @type {Number} */this._speed = setValue(playbackRate, timerDefaults.playbackRate);+ /** @type {Number} */+ this._priority = +setValue(priority, 1);}get cancelled() {@@ -351,7 +347,7 @@ class Timer extends Clock {tick(this, minValue, 0, 0, tickModes.FORCE);} else {if (!this._running) {- addChild(engine, this);+ addChild(engine, this, sortByPriority);engine._hasChildren = true;this._running = true;}diff --git a/dist/modules/types/index.d.ts b/dist/modules/types/index.d.tsindex ea6f9c9e..93f20de5 100644--- a/dist/modules/types/index.d.ts+++ b/dist/modules/types/index.d.ts@@ -27,12 +27,12 @@ export type Renderable = JSAnimation | Timeline;export type Tickable = Timer | Renderable;export type CallbackArgument = Timer & JSAnimation & Timeline;export type Revertible = Animatable | Tickable | WAAPIAnimation | Draggable | ScrollObserver | TextSplitter | Scope | AutoLayout;-export type StaggerFunction<T> = (target?: Target, index?: number, length?: number, tl?: Timeline) => T;+export type StaggerFunction<T> = (target?: Target, index?: number, targets?: TargetsArray, prevTween?: Tween | null, tl?: Timeline) => T;export type StaggerParams = {start?: number | string;- from?: number | "first" | "center" | "last" | "random";+ from?: number | "first" | "center" | "last" | "random" | Array<number>;reversed?: boolean;- grid?: Array<number>;+ grid?: Array<number> | boolean;axis?: ("x" | "y");use?: string | ((target: Target, i: number, length: number) => number);total?: number;@@ -57,8 +57,8 @@ export type PowerEasing = (power?: number | string) => EasingFunction;export type BackEasing = (overshoot?: number | string) => EasingFunction;export type ElasticEasing = (amplitude?: number | string, period?: number | string) => EasingFunction;export type EasingFunctionWithParams = PowerEasing | BackEasing | ElasticEasing;-export type EasingParam = (string & {}) | EaseStringParamNames | EasingFunction | Spring;-export type WAAPIEasingParam = (string & {}) | EaseStringParamNames | WAAPIEaseStringParamNames | EasingFunction | Spring;+export type EasingParam = (string & {}) | EaseStringParamNames | EasingFunction | Spring | TweakRegister;+export type WAAPIEasingParam = (string & {}) | EaseStringParamNames | WAAPIEaseStringParamNames | EasingFunction | Spring | TweakRegister;export type SpringParams = {/*** - Mass, default 1@@ -112,9 +112,10 @@ export type TimerOptions = {autoplay?: boolean | ScrollObserver;frameRate?: number;playbackRate?: number;+ priority?: number;};export type TimerParams = TimerOptions & TickableCallbacks<Timer>;-export type FunctionValue = (target: Target, index: number, length: number) => number | string | TweenObjectValue | EasingParam | Array<number | string | TweenObjectValue>;+export type FunctionValue = (target?: Target, index?: number, targets?: TargetsArray, prevTween?: Tween | null) => number | string | TweenObjectValue | EasingParam | Array<number | string | TweenObjectValue>;export type TweenModifier = (value: number) => number | string;export type ColorArray = [number, number, number, number];export type Tween = {@@ -246,7 +247,7 @@ export type TimelinePosition = number | `+=${number}` | `-=${number}` | `*=${num* - `'label'` - Label: Position animation at a named label position (e.g., `'My Label'`)<br>* - `stagger(String|Nummber)` - Stagger multi-elements animation positions (e.g., 10, 20, 30...)*/-export type TimelineAnimationPosition = TimelinePosition | StaggerFunction<number | string>;+export type TimelineAnimationPosition = TimelinePosition | StaggerFunction<number | string> | TweakRegister;export type TimelineOptions = {defaults?: DefaultsParams;playbackEase?: EasingParam;@@ -254,7 +255,7 @@ export type TimelineOptions = {};export type TimelineParams = TimerOptions & TimelineOptions & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>;export type WAAPITweenValue = string | number | Array<string> | Array<number>;-export type WAAPIFunctionValue = (target: DOMTarget, index: number, length: number) => WAAPITweenValue | WAAPIEasingParam;+export type WAAPIFunctionValue = (target: DOMTarget, index: number, targets: DOMTargetsArray) => WAAPITweenValue | WAAPIEasingParam;export type WAAPIKeyframeValue = WAAPITweenValue | WAAPIFunctionValue | Array<string | number | WAAPIFunctionValue>;export type WAAPITweenOptions = {to?: WAAPIKeyframeValue;@@ -392,6 +393,72 @@ export type TextSplitterParams = {includeSpaces?: boolean;debug?: boolean;};+export type ScrambleTextParams = {+ /**+ * - the text to transition to, otherwise uses the original text+ */+ text?: string | ((arg0: Target, arg1: number, arg2: TargetsArray) => string);+ /**+ * - the characters used for scramble; named sets: 'lowercase', 'uppercase', 'numbers', 'symbols', 'braille', 'blocks', 'shades'; range syntax: 'A-Z', 'a-z0-9'; defaults to 'a-zA-Z0-9!%#_'+ */+ chars?: string | ((arg0: Target, arg1: number, arg2: TargetsArray) => string);+ /**+ * - the easing applied to the scramble animation+ */+ ease?: EasingParam;+ /**+ * - where the reveal wave starts from, 'auto' (default) uses 'left' when text grows and 'right' when it shrinks+ */+ from?: number | "left" | "center" | "right" | "random" | "auto";+ /**+ * - reverses the reveal order, so 'center' reveals from edges inward instead of center outward+ */+ reversed?: boolean;+ /**+ * - characters displayed at the leading edge of the reveal wave; true uses '_', a number is a char code, a string is used directly+ */+ cursor?: boolean | number | string;+ /**+ * - adds random timing offsets to each character's start and end, creating a more organic reveal+ */+ perturbation?: number;+ /**+ * - a seed for the random number generator to produce reproducible scramble sequences+ */+ seed?: number;+ /**+ * - controls the starting appearance: false shows original text, true scrambles it (default), '' starts from blank, ' ' replaces characters with spaces, a custom string (supports range syntax like 'A-Z') uses its characters as scramble set+ */+ override?: boolean | string;+ /**+ * - characters per second entering the active zone; higher values make the reveal wave move faster (default: 60)+ */+ revealRate?: number;+ /**+ * - time in ms each character spends scrambling before settling into its final glyph (default: 300)+ */+ settleDuration?: number;+ /**+ * - how many times per second scramble characters cycle in the active zone (default: 30)+ */+ settleRate?: number;+ /**+ * - if set to a value greater than 0, overrides the computed duration from interval and settle; if unset or 0, duration is calculated automatically from text length and timing parameters+ */+ duration?: number | ((arg0: Target, arg1: number, arg2: TargetsArray) => number);+ /**+ * - delay in ms before the reveal wave starts within the scramble animation+ */+ revealDelay?: number | ((arg0: Target, arg1: number, arg2: TargetsArray) => number);+ /**+ * - delay in ms before the entire scramble animation starts+ */+ delay?: number | ((arg0: Target, arg1: number, arg2: TargetsArray) => number);+ /**+ * - callback fired each time a character changes during scramble; receives the current scrambled text and the eased progress (0-1)+ */+ onChange?: (arg0: string, arg1: number) => void;+};export type DrawableSVGGeometry = SVGGeometryElement & {setAttribute(name: "draw", value: `${number} ${number}`): void;draw: `${number} ${number}`;@@ -408,5 +475,6 @@ import type { TextSplitter } from '../text/split.js';import type { Scope } from '../scope/scope.js';import type { AutoLayout } from '../layout/layout.js';import type { Spring } from '../easings/spring/index.js';+import type { TweakRegister } from 'tweaks';import type { tweenTypes } from '../core/consts.js';import type { valueTypes } from '../core/consts.js';diff --git a/dist/modules/utils/chainable.cjs b/dist/modules/utils/chainable.cjsindex bdfec122..c1ccba86 100644--- a/dist/modules/utils/chainable.cjs+++ b/dist/modules/utils/chainable.cjs@@ -1,6 +1,6 @@/*** Anime.js - utils - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -36,10 +36,13 @@ const chain = fn => {const result = fn(...args);return new Proxy(consts.noop, {apply: (_, __, [v]) => result(v),- get: (_, prop) => chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {- const nextResult = chainables[prop](...nextArgs);- return (/**@type {Number|String} */v) => nextResult(result(v));- })+ get: (_, prop) => {+ if (!chainables[prop]) return undefined;+ return chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {+ const nextResult = chainables[prop](...nextArgs);+ return (/**@type {Number|String} */v) => nextResult(result(v));+ })+ }});}};diff --git a/dist/modules/utils/chainable.js b/dist/modules/utils/chainable.jsindex 56e3cf20..0fcf8f05 100644--- a/dist/modules/utils/chainable.js+++ b/dist/modules/utils/chainable.js@@ -1,6 +1,6 @@/*** Anime.js - utils - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -34,10 +34,13 @@ const chain = fn => {const result = fn(...args);return new Proxy(noop, {apply: (_, __, [v]) => result(v),- get: (_, prop) => chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {- const nextResult = chainables[prop](...nextArgs);- return (/**@type {Number|String} */v) => nextResult(result(v));- })+ get: (_, prop) => {+ if (!chainables[prop]) return undefined;+ return chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {+ const nextResult = chainables[prop](...nextArgs);+ return (/**@type {Number|String} */v) => nextResult(result(v));+ })+ }});}};diff --git a/dist/modules/utils/index.cjs b/dist/modules/utils/index.cjsindex 4fb2f5f8..a7efb4bc 100644--- a/dist/modules/utils/index.cjs+++ b/dist/modules/utils/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - utils - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -12,6 +12,7 @@ var random = require('./random.cjs');var time = require('./time.cjs');var target = require('./target.cjs');var stagger = require('./stagger.cjs');+var helpers = require('../core/helpers.cjs');var styles = require('../core/styles.cjs');var targets = require('../core/targets.cjs');@@ -39,5 +40,8 @@ exports.get = target.get;exports.remove = target.remove;exports.set = target.set;exports.stagger = stagger.stagger;+exports.addChild = helpers.addChild;+exports.forEachChildren = helpers.forEachChildren;+exports.removeChild = helpers.removeChild;exports.cleanInlineStyles = styles.cleanInlineStyles;exports.$ = targets.registerTargets;diff --git a/dist/modules/utils/index.d.ts b/dist/modules/utils/index.d.tsindex 32ed8b4f..fd735f39 100644--- a/dist/modules/utils/index.d.ts+++ b/dist/modules/utils/index.d.ts@@ -3,3 +3,4 @@ export * from "./random.js";export * from "./time.js";export * from "./target.js";export * from "./stagger.js";+export { forEachChildren, addChild, removeChild } from "../core/helpers.js";diff --git a/dist/modules/utils/index.js b/dist/modules/utils/index.jsindex 7785e905..5a8716d4 100644--- a/dist/modules/utils/index.js+++ b/dist/modules/utils/index.js@@ -1,6 +1,6 @@/*** Anime.js - utils - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -10,5 +10,6 @@ export { createSeededRandom, random, randomPick, shuffle } from './random.js';export { keepTime, sync } from './time.js';export { get, remove, set } from './target.js';export { stagger } from './stagger.js';+export { addChild, forEachChildren, removeChild } from '../core/helpers.js';export { cleanInlineStyles } from '../core/styles.js';export { registerTargets as $ } from '../core/targets.js';diff --git a/dist/modules/utils/number.cjs b/dist/modules/utils/number.cjsindex f95a3716..2f924d5b 100644--- a/dist/modules/utils/number.cjs+++ b/dist/modules/utils/number.cjs@@ -1,6 +1,6 @@/*** Anime.js - utils - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/utils/number.js b/dist/modules/utils/number.jsindex 6f413607..69277e96 100644--- a/dist/modules/utils/number.js+++ b/dist/modules/utils/number.js@@ -1,6 +1,6 @@/*** Anime.js - utils - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/utils/random.cjs b/dist/modules/utils/random.cjsindex 15596458..8ad90d9a 100644--- a/dist/modules/utils/random.cjs+++ b/dist/modules/utils/random.cjs@@ -1,6 +1,6 @@/*** Anime.js - utils - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/utils/random.js b/dist/modules/utils/random.jsindex b33454ce..4f20249c 100644--- a/dist/modules/utils/random.js+++ b/dist/modules/utils/random.js@@ -1,6 +1,6 @@/*** Anime.js - utils - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/utils/stagger.cjs b/dist/modules/utils/stagger.cjsindex 116b20e2..cabd9469 100644--- a/dist/modules/utils/stagger.cjs+++ b/dist/modules/utils/stagger.cjs@@ -1,6 +1,6 @@/*** Anime.js - utils - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -19,6 +19,7 @@ var random = require('./random.cjs');* @import {* StaggerParams,* StaggerFunction,+ * JSTarget,* } from '../types/index.js'*/@@ -34,24 +35,28 @@ var random = require('./random.cjs');* @param {StaggerParams} [params]* @return {StaggerFunction<Number>}*/+/*** @overload* @param {String} val* @param {StaggerParams} [params]* @return {StaggerFunction<String>}*/+/*** @overload* @param {[Number, Number]} val* @param {StaggerParams} [params]* @return {StaggerFunction<Number>}*/+/*** @overload* @param {[String, String]} val* @param {StaggerParams} [params]* @return {StaggerFunction<String>}*/+/*** @param {Number|String|[Number, Number]|[String, String]} val The staggered value or range* @param {StaggerParams} [params] The stagger parameters@@ -60,6 +65,7 @@ var random = require('./random.cjs');const stagger = (val, params = {}) => {let values$1 = [];let maxValue = 0;+ let cachedOffset;const from = params.from;const reversed = params.reversed;const ease = params.ease;@@ -67,12 +73,14 @@ const stagger = (val, params = {}) => {const hasSpring = hasEasing && !helpers.isUnd(/** @type {Spring} */(ease).ease);const staggerEase = hasSpring ? /** @type {Spring} */(ease).ease : hasEasing ? parser.parseEase(ease) : null;const grid = params.grid;+ const autoGrid = grid === true;const axis = params.axis;const customTotal = params.total;const fromFirst = helpers.isUnd(from) || from === 0 || from === 'first';const fromCenter = from === 'center';const fromLast = from === 'last';const fromRandom = from === 'random';+ const fromArr = helpers.isArr(from);const isRange = helpers.isArr(val);const useProp = params.use;const val1 = isRange ? helpers.parseNumber(val[0]) : helpers.parseNumber(val);@@ -80,40 +88,129 @@ const stagger = (val, params = {}) => {const unitMatch = consts.unitsExecRgx.exec((isRange ? val[1] : val) + consts.emptyString);const start = params.start || 0 + (isRange ? val1 : 0);let fromIndex = fromFirst ? 0 : helpers.isNum(from) ? from : 0;- return (target, i, t, tl) => {+ return (target, i, t, _, tl) => {const [ registeredTarget ] = targets.registerTargets(target);- const total = helpers.isUnd(customTotal) ? t : customTotal;+ const total = helpers.isUnd(customTotal) ? t.length : customTotal;const customIndex = !helpers.isUnd(useProp) ? helpers.isFnc(useProp) ? useProp(registeredTarget, i, total) : values.getOriginalAnimatableValue(registeredTarget, useProp) : false;const staggerIndex = helpers.isNum(customIndex) || helpers.isStr(customIndex) && helpers.isNum(+customIndex) ? +customIndex : i;if (fromCenter) fromIndex = (total - 1) / 2;if (fromLast) fromIndex = total - 1;if (!values$1.length) {- for (let index = 0; index < total; index++) {- if (!grid) {- values$1.push(helpers.abs(fromIndex - index));+ if (autoGrid) {+ let hasPositions = true;+ let minPosX = Infinity;+ let minPosY = Infinity;+ let maxPosX = -Infinity;+ let maxPosY = -Infinity;+ const pxArr = [];+ const pyArr = [];+ for (let index = 0; index < total; index++) {+ const el = t[index];+ let px = 0;+ let py = 0;+ let found = false;+ if (el && helpers.isFnc(el.getBoundingClientRect)) {+ const rect = el.getBoundingClientRect();+ px = rect.left + rect.width / 2;+ py = rect.top + rect.height / 2;+ found = true;+ } else {+ const obj = /** @type {JSTarget} */(el);+ if (obj && helpers.isNum(obj.x) && helpers.isNum(obj.y)) {+ px = obj.x;+ py = obj.y;+ found = true;+ }+ }+ if (!found) {+ hasPositions = false;+ break;+ }+ pxArr.push(px);+ pyArr.push(py);+ if (px < minPosX) minPosX = px;+ if (py < minPosY) minPosY = py;+ if (px > maxPosX) maxPosX = px;+ if (py > maxPosY) maxPosY = py;+ }+ if (hasPositions) {+ let fX = pxArr[0];+ let fY = pyArr[0];+ if (fromArr) {+ fX = minPosX + from[0] * (maxPosX - minPosX);+ fY = minPosY + from[1] * (maxPosY - minPosY);+ } else if (fromCenter) {+ fX = (minPosX + maxPosX) / 2;+ fY = (minPosY + maxPosY) / 2;+ } else if (fromLast) {+ fX = pxArr[total - 1];+ fY = pyArr[total - 1];+ } else if (helpers.isNum(from)) {+ fX = pxArr[from];+ fY = pyArr[from];+ }+ for (let index = 0; index < total; index++) {+ const distanceX = fX - pxArr[index];+ const distanceY = fY - pyArr[index];+ let value = helpers.sqrt(distanceX * distanceX + distanceY * distanceY);+ if (axis === 'x') value = -distanceX;+ if (axis === 'y') value = -distanceY;+ values$1.push(value);+ }+ let minDist = Infinity;+ for (let index = 0, l = values$1.length; index < l; index++) {+ const absVal = helpers.abs(values$1[index]);+ if (absVal > 0 && absVal < minDist) minDist = absVal;+ }+ if (minDist > 0 && minDist < Infinity) {+ for (let index = 0, l = values$1.length; index < l; index++) {+ values$1[index] = values$1[index] / minDist;+ }+ }} else {- const fromX = !fromCenter ? fromIndex % grid[0] : (grid[0] - 1) / 2;- const fromY = !fromCenter ? helpers.floor(fromIndex / grid[0]) : (grid[1] - 1) / 2;- const toX = index % grid[0];- const toY = helpers.floor(index / grid[0]);- const distanceX = fromX - toX;- const distanceY = fromY - toY;- let value = helpers.sqrt(distanceX * distanceX + distanceY * distanceY);- if (axis === 'x') value = -distanceX;- if (axis === 'y') value = -distanceY;- values$1.push(value);+ for (let index = 0; index < total; index++) {+ values$1.push(helpers.abs(fromIndex - index));+ }+ }+ } else {+ for (let index = 0; index < total; index++) {+ if (!grid) {+ values$1.push(helpers.abs(fromIndex - index));+ } else {+ let fromX, fromY;+ if (fromArr) {+ fromX = from[0] * (grid[0] - 1);+ fromY = from[1] * (grid[1] - 1);+ } else if (fromCenter) {+ fromX = (grid[0] - 1) / 2;+ fromY = (grid[1] - 1) / 2;+ } else {+ fromX = fromIndex % grid[0];+ fromY = helpers.floor(fromIndex / grid[0]);+ }+ const toX = index % grid[0];+ const toY = helpers.floor(index / grid[0]);+ const distanceX = fromX - toX;+ const distanceY = fromY - toY;+ let value = helpers.sqrt(distanceX * distanceX + distanceY * distanceY);+ if (axis === 'x') value = -distanceX;+ if (axis === 'y') value = -distanceY;+ values$1.push(value);+ }}- maxValue = helpers.max(...values$1);}+ maxValue = helpers.max(...values$1);if (staggerEase) values$1 = values$1.map(val => staggerEase(val / maxValue) * maxValue);if (reversed) values$1 = values$1.map(val => axis ? (val < 0) ? val * -1 : -val : helpers.abs(maxValue - val));if (fromRandom) values$1 = random.shuffle(values$1);}const spacing = isRange ? (val2 - val1) / maxValue : val1;- const offset = tl ? position.parseTimelinePosition(tl, helpers.isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);+ if (helpers.isUnd(cachedOffset)) {+ cachedOffset = tl ? position.parseTimelinePosition(tl, helpers.isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);+ }/** @type {String|Number} */- let output = offset + ((spacing * helpers.round(values$1[staggerIndex], 2)) || 0);- if (params.modifier) output = params.modifier(output);+ let output = cachedOffset + ((spacing * helpers.round(values$1[staggerIndex], 2)) || 0);+ if (params.modifier) output = params.modifier(/** @type {Number} */(output));if (unitMatch) output = `${output}${unitMatch[2]}`;return output;}diff --git a/dist/modules/utils/stagger.js b/dist/modules/utils/stagger.jsindex a8b95b08..8b2fb76f 100644--- a/dist/modules/utils/stagger.js+++ b/dist/modules/utils/stagger.js@@ -1,12 +1,12 @@/*** Anime.js - utils - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/import { unitsExecRgx, emptyString } from '../core/consts.js';-import { isUnd, parseNumber, isFnc, abs, floor, sqrt, round, isArr, isNum, isStr, max } from '../core/helpers.js';+import { isUnd, parseNumber, isFnc, isNum, sqrt, abs, floor, max, round, isArr, isStr } from '../core/helpers.js';import { parseEase } from '../easings/eases/parser.js';import { parseTimelinePosition } from '../timeline/position.js';import { getOriginalAnimatableValue } from '../core/values.js';@@ -17,6 +17,7 @@ import { shuffle } from './random.js';* @import {* StaggerParams,* StaggerFunction,+ * JSTarget,* } from '../types/index.js'*/@@ -32,24 +33,28 @@ import { shuffle } from './random.js';* @param {StaggerParams} [params]* @return {StaggerFunction<Number>}*/+/*** @overload* @param {String} val* @param {StaggerParams} [params]* @return {StaggerFunction<String>}*/+/*** @overload* @param {[Number, Number]} val* @param {StaggerParams} [params]* @return {StaggerFunction<Number>}*/+/*** @overload* @param {[String, String]} val* @param {StaggerParams} [params]* @return {StaggerFunction<String>}*/+/*** @param {Number|String|[Number, Number]|[String, String]} val The staggered value or range* @param {StaggerParams} [params] The stagger parameters@@ -58,6 +63,7 @@ import { shuffle } from './random.js';const stagger = (val, params = {}) => {let values = [];let maxValue = 0;+ let cachedOffset;const from = params.from;const reversed = params.reversed;const ease = params.ease;@@ -65,12 +71,14 @@ const stagger = (val, params = {}) => {const hasSpring = hasEasing && !isUnd(/** @type {Spring} */(ease).ease);const staggerEase = hasSpring ? /** @type {Spring} */(ease).ease : hasEasing ? parseEase(ease) : null;const grid = params.grid;+ const autoGrid = grid === true;const axis = params.axis;const customTotal = params.total;const fromFirst = isUnd(from) || from === 0 || from === 'first';const fromCenter = from === 'center';const fromLast = from === 'last';const fromRandom = from === 'random';+ const fromArr = isArr(from);const isRange = isArr(val);const useProp = params.use;const val1 = isRange ? parseNumber(val[0]) : parseNumber(val);@@ -78,40 +86,129 @@ const stagger = (val, params = {}) => {const unitMatch = unitsExecRgx.exec((isRange ? val[1] : val) + emptyString);const start = params.start || 0 + (isRange ? val1 : 0);let fromIndex = fromFirst ? 0 : isNum(from) ? from : 0;- return (target, i, t, tl) => {+ return (target, i, t, _, tl) => {const [ registeredTarget ] = registerTargets(target);- const total = isUnd(customTotal) ? t : customTotal;+ const total = isUnd(customTotal) ? t.length : customTotal;const customIndex = !isUnd(useProp) ? isFnc(useProp) ? useProp(registeredTarget, i, total) : getOriginalAnimatableValue(registeredTarget, useProp) : false;const staggerIndex = isNum(customIndex) || isStr(customIndex) && isNum(+customIndex) ? +customIndex : i;if (fromCenter) fromIndex = (total - 1) / 2;if (fromLast) fromIndex = total - 1;if (!values.length) {- for (let index = 0; index < total; index++) {- if (!grid) {- values.push(abs(fromIndex - index));+ if (autoGrid) {+ let hasPositions = true;+ let minPosX = Infinity;+ let minPosY = Infinity;+ let maxPosX = -Infinity;+ let maxPosY = -Infinity;+ const pxArr = [];+ const pyArr = [];+ for (let index = 0; index < total; index++) {+ const el = t[index];+ let px = 0;+ let py = 0;+ let found = false;+ if (el && isFnc(el.getBoundingClientRect)) {+ const rect = el.getBoundingClientRect();+ px = rect.left + rect.width / 2;+ py = rect.top + rect.height / 2;+ found = true;+ } else {+ const obj = /** @type {JSTarget} */(el);+ if (obj && isNum(obj.x) && isNum(obj.y)) {+ px = obj.x;+ py = obj.y;+ found = true;+ }+ }+ if (!found) {+ hasPositions = false;+ break;+ }+ pxArr.push(px);+ pyArr.push(py);+ if (px < minPosX) minPosX = px;+ if (py < minPosY) minPosY = py;+ if (px > maxPosX) maxPosX = px;+ if (py > maxPosY) maxPosY = py;+ }+ if (hasPositions) {+ let fX = pxArr[0];+ let fY = pyArr[0];+ if (fromArr) {+ fX = minPosX + from[0] * (maxPosX - minPosX);+ fY = minPosY + from[1] * (maxPosY - minPosY);+ } else if (fromCenter) {+ fX = (minPosX + maxPosX) / 2;+ fY = (minPosY + maxPosY) / 2;+ } else if (fromLast) {+ fX = pxArr[total - 1];+ fY = pyArr[total - 1];+ } else if (isNum(from)) {+ fX = pxArr[from];+ fY = pyArr[from];+ }+ for (let index = 0; index < total; index++) {+ const distanceX = fX - pxArr[index];+ const distanceY = fY - pyArr[index];+ let value = sqrt(distanceX * distanceX + distanceY * distanceY);+ if (axis === 'x') value = -distanceX;+ if (axis === 'y') value = -distanceY;+ values.push(value);+ }+ let minDist = Infinity;+ for (let index = 0, l = values.length; index < l; index++) {+ const absVal = abs(values[index]);+ if (absVal > 0 && absVal < minDist) minDist = absVal;+ }+ if (minDist > 0 && minDist < Infinity) {+ for (let index = 0, l = values.length; index < l; index++) {+ values[index] = values[index] / minDist;+ }+ }} else {- const fromX = !fromCenter ? fromIndex % grid[0] : (grid[0] - 1) / 2;- const fromY = !fromCenter ? floor(fromIndex / grid[0]) : (grid[1] - 1) / 2;- const toX = index % grid[0];- const toY = floor(index / grid[0]);- const distanceX = fromX - toX;- const distanceY = fromY - toY;- let value = sqrt(distanceX * distanceX + distanceY * distanceY);- if (axis === 'x') value = -distanceX;- if (axis === 'y') value = -distanceY;- values.push(value);+ for (let index = 0; index < total; index++) {+ values.push(abs(fromIndex - index));+ }+ }+ } else {+ for (let index = 0; index < total; index++) {+ if (!grid) {+ values.push(abs(fromIndex - index));+ } else {+ let fromX, fromY;+ if (fromArr) {+ fromX = from[0] * (grid[0] - 1);+ fromY = from[1] * (grid[1] - 1);+ } else if (fromCenter) {+ fromX = (grid[0] - 1) / 2;+ fromY = (grid[1] - 1) / 2;+ } else {+ fromX = fromIndex % grid[0];+ fromY = floor(fromIndex / grid[0]);+ }+ const toX = index % grid[0];+ const toY = floor(index / grid[0]);+ const distanceX = fromX - toX;+ const distanceY = fromY - toY;+ let value = sqrt(distanceX * distanceX + distanceY * distanceY);+ if (axis === 'x') value = -distanceX;+ if (axis === 'y') value = -distanceY;+ values.push(value);+ }}- maxValue = max(...values);}+ maxValue = max(...values);if (staggerEase) values = values.map(val => staggerEase(val / maxValue) * maxValue);if (reversed) values = values.map(val => axis ? (val < 0) ? val * -1 : -val : abs(maxValue - val));if (fromRandom) values = shuffle(values);}const spacing = isRange ? (val2 - val1) / maxValue : val1;- const offset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);+ if (isUnd(cachedOffset)) {+ cachedOffset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);+ }/** @type {String|Number} */- let output = offset + ((spacing * round(values[staggerIndex], 2)) || 0);- if (params.modifier) output = params.modifier(output);+ let output = cachedOffset + ((spacing * round(values[staggerIndex], 2)) || 0);+ if (params.modifier) output = params.modifier(/** @type {Number} */(output));if (unitMatch) output = `${output}${unitMatch[2]}`;return output;}diff --git a/dist/modules/utils/target.cjs b/dist/modules/utils/target.cjsindex 5f7c127a..0fb82be7 100644--- a/dist/modules/utils/target.cjs+++ b/dist/modules/utils/target.cjs@@ -1,6 +1,6 @@/*** Anime.js - utils - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/utils/target.js b/dist/modules/utils/target.jsindex 57e048b5..ae8e610d 100644--- a/dist/modules/utils/target.js+++ b/dist/modules/utils/target.js@@ -1,6 +1,6 @@/*** Anime.js - utils - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/utils/time.cjs b/dist/modules/utils/time.cjsindex 7e3ed444..5a215d66 100644--- a/dist/modules/utils/time.cjs+++ b/dist/modules/utils/time.cjs@@ -1,6 +1,6 @@/*** Anime.js - utils - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -28,19 +28,20 @@ const sync = (callback = consts.noop) => {};/**- * @param {(...args: any[]) => Tickable | ((...args: any[]) => void)} constructor+ * @param {(...args: any[]) => Tickable | ((...args: any[]) => void) | void} constructor* @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}*/const keepTime = constructor => {/** @type {Tickable} */let tracked;return (...args) => {- let currentIteration, currentIterationProgress, reversed, alternate;+ let currentIteration, currentIterationProgress, reversed, alternate, startTime;if (tracked) {currentIteration = tracked.currentIteration;currentIterationProgress = tracked.iterationProgress;reversed = tracked.reversed;alternate = tracked._alternate;+ startTime = tracked._startTime;tracked.revert();}const cleanup = constructor(...args);@@ -48,6 +49,7 @@ const keepTime = constructor => {if (!helpers.isUnd(currentIterationProgress)) {/** @type {Tickable} */(tracked).currentIteration = currentIteration;/** @type {Tickable} */(tracked).iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;+ /** @type {Tickable} */(tracked)._startTime = startTime;}return cleanup || consts.noop;}diff --git a/dist/modules/utils/time.d.ts b/dist/modules/utils/time.d.tsindex ee11bb12..1e527907 100644--- a/dist/modules/utils/time.d.ts+++ b/dist/modules/utils/time.d.ts@@ -1,5 +1,5 @@export function sync(callback?: Callback<Timer>): Timer;-export function keepTime(constructor: (...args: any[]) => Tickable | ((...args: any[]) => void)): (...args: any[]) => Tickable | ((...args: any[]) => void);+export function keepTime(constructor: (...args: any[]) => Tickable | ((...args: any[]) => void) | void): (...args: any[]) => Tickable | ((...args: any[]) => void);import { Timer } from '../timer/timer.js';import type { Callback } from '../types/index.js';import type { Tickable } from '../types/index.js';diff --git a/dist/modules/utils/time.js b/dist/modules/utils/time.jsindex d3754410..cc5d73f3 100644--- a/dist/modules/utils/time.js+++ b/dist/modules/utils/time.js@@ -1,6 +1,6 @@/*** Anime.js - utils - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -26,19 +26,20 @@ const sync = (callback = noop) => {};/**- * @param {(...args: any[]) => Tickable | ((...args: any[]) => void)} constructor+ * @param {(...args: any[]) => Tickable | ((...args: any[]) => void) | void} constructor* @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}*/const keepTime = constructor => {/** @type {Tickable} */let tracked;return (...args) => {- let currentIteration, currentIterationProgress, reversed, alternate;+ let currentIteration, currentIterationProgress, reversed, alternate, startTime;if (tracked) {currentIteration = tracked.currentIteration;currentIterationProgress = tracked.iterationProgress;reversed = tracked.reversed;alternate = tracked._alternate;+ startTime = tracked._startTime;tracked.revert();}const cleanup = constructor(...args);@@ -46,6 +47,7 @@ const keepTime = constructor => {if (!isUnd(currentIterationProgress)) {/** @type {Tickable} */(tracked).currentIteration = currentIteration;/** @type {Tickable} */(tracked).iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;+ /** @type {Tickable} */(tracked)._startTime = startTime;}return cleanup || noop;}diff --git a/dist/modules/waapi/composition.cjs b/dist/modules/waapi/composition.cjsindex a2800766..2eb0ed9c 100644--- a/dist/modules/waapi/composition.cjs+++ b/dist/modules/waapi/composition.cjs@@ -1,6 +1,6 @@/*** Anime.js - waapi - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/waapi/composition.js b/dist/modules/waapi/composition.jsindex 7c1bf8b4..731ff237 100644--- a/dist/modules/waapi/composition.js+++ b/dist/modules/waapi/composition.js@@ -1,6 +1,6 @@/*** Anime.js - waapi - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/waapi/index.cjs b/dist/modules/waapi/index.cjsindex 6b2356aa..cf073756 100644--- a/dist/modules/waapi/index.cjs+++ b/dist/modules/waapi/index.cjs@@ -1,6 +1,6 @@/*** Anime.js - waapi - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/waapi/index.js b/dist/modules/waapi/index.jsindex c35f2d00..a99276c5 100644--- a/dist/modules/waapi/index.js+++ b/dist/modules/waapi/index.js@@ -1,6 +1,6 @@/*** Anime.js - waapi - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/diff --git a/dist/modules/waapi/waapi.cjs b/dist/modules/waapi/waapi.cjsindex 0ff17c08..bcebceea 100644--- a/dist/modules/waapi/waapi.cjs+++ b/dist/modules/waapi/waapi.cjs@@ -1,6 +1,6 @@/*** Anime.js - waapi - CJS- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -116,12 +116,12 @@ let transformsPropertiesRegistered = null;* @param {WAAPIKeyframeValue} value* @param {DOMTarget} $el* @param {Number} i- * @param {Number} targetsLength+ * @param {DOMTargetsArray} parsedTargets* @return {String}*/-const normalizeTweenValue = (propName, value, $el, i, targetsLength) => {+const normalizeTweenValue = (propName, value, $el, i, parsedTargets) => {// Do not try to compute strings with getFunctionValue otherwise it will convert CSS variables- let v = helpers.isStr(value) ? value : values.getFunctionValue(/** @type {any} */(value), $el, i, targetsLength);+ let v = helpers.isStr(value) ? value : values.getFunctionValue(/** @type {any} */(value), $el, i, parsedTargets, null, null);if (!helpers.isNum(v)) return v;if (commonDefaultPXProperties.includes(propName) || helpers.stringStartsWith(propName, 'translate')) return `${v}px`;if (helpers.stringStartsWith(propName, 'rotate') || helpers.stringStartsWith(propName, 'skew')) return `${v}deg`;@@ -134,18 +134,18 @@ const normalizeTweenValue = (propName, value, $el, i, targetsLength) => {* @param {WAAPIKeyframeValue} from* @param {WAAPIKeyframeValue} to* @param {Number} i- * @param {Number} targetsLength+ * @param {DOMTargetsArray} parsedTargets* @return {WAAPITweenValue}*/-const parseIndividualTweenValue = ($el, propName, from, to, i, targetsLength) => {+const parseIndividualTweenValue = ($el, propName, from, to, i, parsedTargets) => {/** @type {WAAPITweenValue} */let tweenValue = '0';- const computedTo = !helpers.isUnd(to) ? normalizeTweenValue(propName, to, $el, i, targetsLength) : getComputedStyle($el)[propName];+ const computedTo = !helpers.isUnd(to) ? normalizeTweenValue(propName, to, $el, i, parsedTargets) : getComputedStyle($el)[propName];if (!helpers.isUnd(from)) {- const computedFrom = normalizeTweenValue(propName, from, $el, i, targetsLength);+ const computedFrom = normalizeTweenValue(propName, from, $el, i, parsedTargets);tweenValue = [computedFrom, computedTo];} else {- tweenValue = helpers.isArr(to) ? to.map((/** @type {any} */v) => normalizeTweenValue(propName, v, $el, i, targetsLength)) : computedTo;+ tweenValue = helpers.isArr(to) ? to.map((/** @type {any} */v) => normalizeTweenValue(propName, v, $el, i, parsedTargets)) : computedTo;}return tweenValue;};@@ -184,9 +184,8 @@ class WAAPIAnimation {}const parsedTargets = targets.registerTargets(targets$1);- const targetsLength = parsedTargets.length;- if (!targetsLength) {+ if (!parsedTargets.length) {console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);}@@ -242,7 +241,7 @@ class WAAPIAnimation {const easeToParse = values.setValue(params.ease, globals.globals.defaults.ease);- const easeFunctionResult = values.getFunctionValue(easeToParse, $el, i, targetsLength);+ const easeFunctionResult = values.getFunctionValue(easeToParse, $el, i, parsedTargets, null, null);const keyEasing = helpers.isFnc(easeFunctionResult) || helpers.isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;const spring = /** @type {Spring} */(easeToParse).ease && easeToParse;@@ -250,9 +249,9 @@ class WAAPIAnimation {const easing = parseWAAPIEasing(keyEasing);/** @type {Number} */- const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : values.getFunctionValue(values.setValue(params.duration, globals.globals.defaults.duration), $el, i, targetsLength)) * timeScale;+ const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : values.getFunctionValue(values.setValue(params.duration, globals.globals.defaults.duration), $el, i, parsedTargets, null, null)) * timeScale;/** @type {Number} */- const delay = values.getFunctionValue(values.setValue(params.delay, globals.globals.defaults.delay), $el, i, targetsLength) * timeScale;+ const delay = values.getFunctionValue(values.setValue(params.delay, globals.globals.defaults.delay), $el, i, parsedTargets, null, null) * timeScale;/** @type {CompositeOperation} */const composite = /** @type {CompositeOperation} */(values.setValue(params.composition, 'replace'));@@ -278,19 +277,19 @@ class WAAPIAnimation {const to = /** @type {WAAPITweenOptions} */(tweenOptions).to;const from = /** @type {WAAPITweenOptions} */(tweenOptions).from;/** @type {Number} */- tweenParams.duration = (tweenOptionsSpring ? /** @type {Spring} */(tweenOptionsSpring).settlingDuration : values.getFunctionValue(values.setValue(tweenOptions.duration, duration), $el, i, targetsLength)) * timeScale;+ tweenParams.duration = (tweenOptionsSpring ? /** @type {Spring} */(tweenOptionsSpring).settlingDuration : values.getFunctionValue(values.setValue(tweenOptions.duration, duration), $el, i, parsedTargets, null, null)) * timeScale;/** @type {Number} */- tweenParams.delay = values.getFunctionValue(values.setValue(tweenOptions.delay, delay), $el, i, targetsLength) * timeScale;+ tweenParams.delay = values.getFunctionValue(values.setValue(tweenOptions.delay, delay), $el, i, parsedTargets, null, null) * timeScale;/** @type {CompositeOperation} */tweenParams.composite = /** @type {CompositeOperation} */(values.setValue(tweenOptions.composition, composite));/** @type {String} */tweenParams.easing = parseWAAPIEasing(tweenOptionsEase);- parsedPropertyValue = parseIndividualTweenValue($el, name, from, to, i, targetsLength);+ parsedPropertyValue = parseIndividualTweenValue($el, name, from, to, i, parsedTargets);if (individualTransformProperty) {keyframes[`--${individualTransformProperty}`] = parsedPropertyValue;cachedTransforms[individualTransformProperty] = parsedPropertyValue;} else {- keyframes[name] = parseIndividualTweenValue($el, name, from, to, i, targetsLength);+ keyframes[name] = parseIndividualTweenValue($el, name, from, to, i, parsedTargets);}composition.addWAAPIAnimation(this, $el, name, keyframes, tweenParams);if (!helpers.isUnd(from)) {@@ -303,8 +302,8 @@ class WAAPIAnimation {}} else {parsedPropertyValue = helpers.isArr(propertyValue) ?- propertyValue.map((/** @type {any} */v) => normalizeTweenValue(name, v, $el, i, targetsLength)) :- normalizeTweenValue(name, /** @type {any} */(propertyValue), $el, i, targetsLength);+ propertyValue.map((/** @type {any} */v) => normalizeTweenValue(name, v, $el, i, parsedTargets)) :+ normalizeTweenValue(name, /** @type {any} */(propertyValue), $el, i, parsedTargets);if (individualTransformProperty) {keyframes[`--${individualTransformProperty}`] = parsedPropertyValue;cachedTransforms[individualTransformProperty] = parsedPropertyValue;diff --git a/dist/modules/waapi/waapi.js b/dist/modules/waapi/waapi.jsindex a5ef858b..931f6c96 100644--- a/dist/modules/waapi/waapi.js+++ b/dist/modules/waapi/waapi.js@@ -1,6 +1,6 @@/*** Anime.js - waapi - ESM- * @version v4.3.6+ * @version v4.4.0* @license MIT* @copyright 2026 - Julian Garnier*/@@ -9,7 +9,7 @@ import { isNil, isUnd, stringStartsWith, isKey, isObj, isArr, isStr, toLowerCaseimport { scope, globals } from '../core/globals.js';import { registerTargets } from '../core/targets.js';import { setValue, getFunctionValue } from '../core/values.js';-import { isBrowser, validTransforms, noop, transformsSymbol, shortTransforms, transformsFragmentStrings, emptyString, K } from '../core/consts.js';+import { isBrowser, validTransforms, K, noop, transformsSymbol, shortTransforms, transformsFragmentStrings, emptyString } from '../core/consts.js';import { none } from '../easings/none.js';import { parseEaseString } from '../easings/eases/parser.js';import { addWAAPIAnimation } from './composition.js';@@ -114,12 +114,12 @@ let transformsPropertiesRegistered = null;* @param {WAAPIKeyframeValue} value* @param {DOMTarget} $el* @param {Number} i- * @param {Number} targetsLength+ * @param {DOMTargetsArray} parsedTargets* @return {String}*/-const normalizeTweenValue = (propName, value, $el, i, targetsLength) => {+const normalizeTweenValue = (propName, value, $el, i, parsedTargets) => {// Do not try to compute strings with getFunctionValue otherwise it will convert CSS variables- let v = isStr(value) ? value : getFunctionValue(/** @type {any} */(value), $el, i, targetsLength);+ let v = isStr(value) ? value : getFunctionValue(/** @type {any} */(value), $el, i, parsedTargets, null, null);if (!isNum(v)) return v;if (commonDefaultPXProperties.includes(propName) || stringStartsWith(propName, 'translate')) return `${v}px`;if (stringStartsWith(propName, 'rotate') || stringStartsWith(propName, 'skew')) return `${v}deg`;@@ -132,18 +132,18 @@ const normalizeTweenValue = (propName, value, $el, i, targetsLength) => {* @param {WAAPIKeyframeValue} from* @param {WAAPIKeyframeValue} to* @param {Number} i- * @param {Number} targetsLength+ * @param {DOMTargetsArray} parsedTargets* @return {WAAPITweenValue}*/-const parseIndividualTweenValue = ($el, propName, from, to, i, targetsLength) => {+const parseIndividualTweenValue = ($el, propName, from, to, i, parsedTargets) => {/** @type {WAAPITweenValue} */let tweenValue = '0';- const computedTo = !isUnd(to) ? normalizeTweenValue(propName, to, $el, i, targetsLength) : getComputedStyle($el)[propName];+ const computedTo = !isUnd(to) ? normalizeTweenValue(propName, to, $el, i, parsedTargets) : getComputedStyle($el)[propName];if (!isUnd(from)) {- const computedFrom = normalizeTweenValue(propName, from, $el, i, targetsLength);+ const computedFrom = normalizeTweenValue(propName, from, $el, i, parsedTargets);tweenValue = [computedFrom, computedTo];} else {- tweenValue = isArr(to) ? to.map((/** @type {any} */v) => normalizeTweenValue(propName, v, $el, i, targetsLength)) : computedTo;+ tweenValue = isArr(to) ? to.map((/** @type {any} */v) => normalizeTweenValue(propName, v, $el, i, parsedTargets)) : computedTo;}return tweenValue;};@@ -182,9 +182,8 @@ class WAAPIAnimation {}const parsedTargets = registerTargets(targets);- const targetsLength = parsedTargets.length;- if (!targetsLength) {+ if (!parsedTargets.length) {console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);}@@ -240,7 +239,7 @@ class WAAPIAnimation {const easeToParse = setValue(params.ease, globals.defaults.ease);- const easeFunctionResult = getFunctionValue(easeToParse, $el, i, targetsLength);+ const easeFunctionResult = getFunctionValue(easeToParse, $el, i, parsedTargets, null, null);const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;const spring = /** @type {Spring} */(easeToParse).ease && easeToParse;@@ -248,9 +247,9 @@ class WAAPIAnimation {const easing = parseWAAPIEasing(keyEasing);/** @type {Number} */- const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, targetsLength)) * timeScale;+ const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, parsedTargets, null, null)) * timeScale;/** @type {Number} */- const delay = getFunctionValue(setValue(params.delay, globals.defaults.delay), $el, i, targetsLength) * timeScale;+ const delay = getFunctionValue(setValue(params.delay, globals.defaults.delay), $el, i, parsedTargets, null, null) * timeScale;/** @type {CompositeOperation} */const composite = /** @type {CompositeOperation} */(setValue(params.composition, 'replace'));@@ -276,19 +275,19 @@ class WAAPIAnimation {const to = /** @type {WAAPITweenOptions} */(tweenOptions).to;const from = /** @type {WAAPITweenOptions} */(tweenOptions).from;/** @type {Number} */- tweenParams.duration = (tweenOptionsSpring ? /** @type {Spring} */(tweenOptionsSpring).settlingDuration : getFunctionValue(setValue(tweenOptions.duration, duration), $el, i, targetsLength)) * timeScale;+ tweenParams.duration = (tweenOptionsSpring ? /** @type {Spring} */(tweenOptionsSpring).settlingDuration : getFunctionValue(setValue(tweenOptions.duration, duration), $el, i, parsedTargets, null, null)) * timeScale;/** @type {Number} */- tweenParams.delay = getFunctionValue(setValue(tweenOptions.delay, delay), $el, i, targetsLength) * timeScale;+ tweenParams.delay = getFunctionValue(setValue(tweenOptions.delay, delay), $el, i, parsedTargets, null, null) * timeScale;/** @type {CompositeOperation} */tweenParams.composite = /** @type {CompositeOperation} */(setValue(tweenOptions.composition, composite));/** @type {String} */tweenParams.easing = parseWAAPIEasing(tweenOptionsEase);- parsedPropertyValue = parseIndividualTweenValue($el, name, from, to, i, targetsLength);+ parsedPropertyValue = parseIndividualTweenValue($el, name, from, to, i, parsedTargets);if (individualTransformProperty) {keyframes[`--${individualTransformProperty}`] = parsedPropertyValue;cachedTransforms[individualTransformProperty] = parsedPropertyValue;} else {- keyframes[name] = parseIndividualTweenValue($el, name, from, to, i, targetsLength);+ keyframes[name] = parseIndividualTweenValue($el, name, from, to, i, parsedTargets);}addWAAPIAnimation(this, $el, name, keyframes, tweenParams);if (!isUnd(from)) {@@ -301,8 +300,8 @@ class WAAPIAnimation {}} else {parsedPropertyValue = isArr(propertyValue) ?- propertyValue.map((/** @type {any} */v) => normalizeTweenValue(name, v, $el, i, targetsLength)) :- normalizeTweenValue(name, /** @type {any} */(propertyValue), $el, i, targetsLength);+ propertyValue.map((/** @type {any} */v) => normalizeTweenValue(name, v, $el, i, parsedTargets)) :+ normalizeTweenValue(name, /** @type {any} */(propertyValue), $el, i, parsedTargets);if (individualTransformProperty) {keyframes[`--${individualTransformProperty}`] = parsedPropertyValue;cachedTransforms[individualTransformProperty] = parsedPropertyValue;diff --git a/examples/additive-creature/index.js b/examples/additive-creature/index.jsindex 1343c018..4d22e3a7 100644--- a/examples/additive-creature/index.js+++ b/examples/additive-creature/index.js@@ -29,7 +29,7 @@ utils.set(particuleEls, {modifier: v => `hsl(4, 70%, ${v}%)`,}),boxShadow: stagger([8, 1], { grid, from,- modifier: v => `0px 0px ${utils.round(v, 0)}em 0px var(--red)`,+ modifier: v => `0px 0px ${utils.round(v, 0)}em 0px var(--red-1)`,}),zIndex: stagger([rows * rows, 1], { grid, from, modifier: utils.round(0) }),});diff --git a/examples/assets/css/styles.css b/examples/assets/css/styles.cssindex f923808b..49e595b2 100644--- a/examples/assets/css/styles.css+++ b/examples/assets/css/styles.css@@ -161,6 +161,9 @@[data-color="11"] { --color-1: var(--sky-1); --color-2: var(--sky-2); --color-3: var(--sky-3); --color-4: var(--sky-4); --color-5: var(--sky-5);}[data-color="12"] { --color-1: var(--indigo-1); --color-2: var(--indigo-2); --color-3: var(--indigo-3); --color-4: var(--indigo-4); --color-5: var(--indigo-5);}[data-color="13"] { --color-1: var(--lavender-1); --color-2: var(--lavender-2); --color-3: var(--lavender-3); --color-4: var(--lavender-4); --color-5: var(--lavender-5);}+[data-color="14"] { --color-1: var(--purple-1); --color-2: var(--purple-2); --color-3: var(--purple-3); --color-4: var(--purple-4); --color-5: var(--purple-5);}+[data-color="15"] { --color-1: var(--magenta-1); --color-2: var(--magenta-2); --color-3: var(--magenta-3); --color-4: var(--magenta-4); --color-5: var(--magenta-5);}+[data-color="16"] { --color-1: var(--pink-1); --color-2: var(--pink-2); --color-3: var(--pink-3); --color-4: var(--pink-4); --color-5: var(--pink-5);}*, *:before, *:after {box-sizing: border-box;diff --git a/examples/auto-layout/cards/index.js b/examples/auto-layout/cards/index.jsindex b73090b2..4140b3b9 100644--- a/examples/auto-layout/cards/index.js+++ b/examples/auto-layout/cards/index.js@@ -25,7 +25,7 @@ for (let i = 1; i <= 12; i++) {}const layout = createLayout('#cards', {- duration: 500000+ duration: 1000});document.querySelectorAll('nav button').forEach(btn => {diff --git a/examples/auto-layout/planets/index.js b/examples/auto-layout/planets/index.jsindex 67cb14b8..aa379dc3 100644--- a/examples/auto-layout/planets/index.js+++ b/examples/auto-layout/planets/index.js@@ -119,9 +119,9 @@ const closeModal = () => {$overlay.close();$card = utils.$('#root .card.is-open')[0];$card.classList.remove('is-open');- $card.focus();+ $card.focus({ preventScroll: true });}).then(() => {- $card.focus();+ $card.focus({ preventScroll: true });})};diff --git a/examples/draggable-playground/index.html b/examples/draggable-playground/index.htmlindex e4d50efb..b8cc09b5 100644--- a/examples/draggable-playground/index.html+++ b/examples/draggable-playground/index.html@@ -110,14 +110,14 @@.rectangle {width: calc(var(--one-cell) * 2);height: calc(var(--one-cell) * 1);- background-color: var(--red);+ background-color: var(--red-1);border-radius: 20px;}.square {width: calc(var(--one-cell) * .8);height: calc(var(--one-cell) * .8);- background-color: var(--red);+ background-color: var(--red-1);border-radius: 20px;}@@ -125,7 +125,7 @@overflow: hidden;width: calc(var(--one-cell) * .1);height: calc(var(--one-cell) * .8);- background-color: var(--red);+ background-color: var(--red-1);border-radius: 20px;}@@ -170,7 +170,7 @@}.margin .draggable {- background-color: var(--red);+ background-color: var(--red-1);border-radius: 10px;}@@ -306,7 +306,7 @@.carousel-item:nth-child(even),.list-item:nth-child(even) {- background-color: var(--yellow);+ background-color: var(--yellow-1);}.carousel-link {@@ -316,7 +316,7 @@left: 20px;right: 20px;bottom: 20px;- border: 2px dotted var(--red);+ border: 2px dotted var(--red-1);}#snap-carousel {@@ -372,7 +372,7 @@width: min(25%, 105px);height: calc((var(--one-cell) * 1));border-radius: 10px;- background: var(--yellow);+ background: var(--yellow-1);backface-visibility: hidden;}@@ -385,7 +385,7 @@left: 60px;background: var(--black-1);padding: 20px;- box-shadow: 0 0 0 1px var(--red);+ box-shadow: 0 0 0 1px var(--red-1);}.trigger {@@ -394,7 +394,7 @@height: calc(var(--one-cell) * 3.2);margin-left: calc(var(--one-cell) * -1.2);margin-top: calc(var(--one-cell) * -1.2);- background: var(--yellow);+ background: var(--yellow-1);}#onsnap-callback {@@ -425,9 +425,9 @@width: 100%;border-top-left-radius: .5rem;border-top-right-radius: .5rem;- background-color: var(--red);+ background-color: var(--red-1);will-change: transform;- box-shadow: 0 500px 0 0 var(--red);+ box-shadow: 0 500px 0 0 var(--red-1);}.drawer-content {@@ -444,7 +444,7 @@z-index: 1;width: 100%;height: 3rem;- background-color: var(--red);+ background-color: var(--red-1);border-top-left-radius: .5rem;border-top-right-radius: .5rem;}@@ -471,7 +471,7 @@position: absolute;top: 1rem;right: 1rem;- background: var(--yellow);+ background: var(--yellow-1);margin-bottom: 10px;border-radius: .5rem;}diff --git a/examples/stagger/index.html b/examples/stagger/index.htmlnew file mode 100644index 00000000..5b87b429--- /dev/null+++ b/examples/stagger/index.html@@ -0,0 +1,28 @@+<!DOCTYPE html>+<html>+<head>+ <title>Stagger Grid / Anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <link href="../assets/css/styles.css" rel="stylesheet">+ <style>+ body {+ overflow: hidden;+ width: 100vw;+ height: 100vh;+ }++ .dot {+ position: absolute;+ width: 16px;+ height: 16px;+ background-color: var(--color-1);+ }+ </style>+</head>+<body>++ <script type="module" src="./index.js"></script>++</body>+</html>diff --git a/examples/stagger/index.js b/examples/stagger/index.jsnew file mode 100644index 00000000..a7adf4eb--- /dev/null+++ b/examples/stagger/index.js@@ -0,0 +1,33 @@+import { createTimeline, stagger, utils } from '../../dist/modules/index.js';++const totalColors = 14;+const totalDots = 1000;+const w = window.innerWidth;+const h = window.innerHeight;++for (let i = 0; i < totalDots; i++) {+ const el = document.createElement('div');+ el.classList.add('dot');+ el.dataset.color = String(utils.random(0, totalColors - 1));+ document.body.appendChild(el);+}++const dots = document.querySelectorAll('.dot');++utils.set(dots, {+ x: () => utils.random(0, w - 16),+ y: () => utils.random(0, h - 16),+ rotate: () => utils.random(-180, 180),+ scale: () => utils.random(.2, 2, 3),+});++createTimeline({ composition: false })+ .add(dots, {+ scale: [{ from: '-=1', to: '+=2' }],+ rotate: [{ from: '-=180', to: '+=180' }],+ background: [{ from: '#FFF' }],+ duration: 1000,+ ease: 'inOut(3)',+ loop: true,+ }, stagger([0, 2000], { grid: true, from: 'center', axis: 'x' }))+ .init();\ No newline at end of filediff --git a/examples/text/scramble-tl/index.html b/examples/text/scramble-tl/index.htmlnew file mode 100644index 00000000..c3647fbc--- /dev/null+++ b/examples/text/scramble-tl/index.html@@ -0,0 +1,99 @@+<!DOCTYPE html>+<html>+<head>+ <title>Text / Scramble TL / Anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <link href="../../assets/css/styles.css" rel="stylesheet">+ <script type="importmap">+ {+ "imports": {+ "animejs": "../../../dist/modules/index.js",+ "tweaks": "../../../node_modules/tweaks/tweaks.js",+ "tweaks/gui": "../../../node_modules/tweaks/gui.js"+ }+ }+ </script>+ <style>++ body {+ position: fixed;+ display: flex;+ justify-content: center;+ align-items: center;+ top: 0;+ left: 0;+ bottom: 0;+ right: 0;+ overflow: hidden;+ color: var(--orange-1);+ background: var(--orange-5);+ }++ main {+ position: relative;+ width: 100%;+ max-width: 1000px;+ aspect-ratio: 16/9;+ backface-visibility: hidden;+ }++ .slide {+ opacity: 0;+ width: 100%;+ position: absolute;+ top: 0;+ left: 0;+ bottom: 0;+ right: 0;+ display: flex;+ flex-direction: column;+ justify-content: center;+ align-items: center;+ }++ .slide .row {+ display: flex;+ justify-content: center;+ flex-wrap: nowrap;+ }++ .slide p {+ font-size: 2rem;+ flex-shrink: 0;+ line-height: 1;+ margin: 1ch;+ white-space: nowrap;+ }++ .features p {+ color: var(--color-1);+ }++ </style>+</head>+<body>+ <main>+ <div class="slide">+ <div class="row"><p>Introducing</p><p>Introducing</p></div>+ <div class="row"><p>Introducing</p><p>Introducing</p><p>Introducing</p></div>+ <div class="row"><p>Introducing</p><p>Introducing</p><p>Introducing</p><p>Introducing</p></div>+ <div class="row"><p>Introducing</p><p>Introducing</p><p class="center">Introducing</p><p>Introducing</p><p>Introducing</p></div>+ <div class="row"><p>Introducing</p><p>Introducing</p><p>Introducing</p><p>Introducing</p></div>+ <div class="row"><p>Introducing</p><p>Introducing</p><p>Introducing</p></div>+ <div class="row"><p>Introducing</p><p>Introducing</p></div>+ </div>+ <div class="slide features">+ <div class="row"><p data-color="3">Custom Easing</p><p data-color="8">Keyframe Chaining</p></div>+ <div class="row"><p data-color="14">Custom Characters</p><p data-color="0">Perturbation</p><p data-color="6">Settle Duration</p></div>+ <div class="row"><p data-color="3">Char Interval</p><p data-color="16">Text Cursor</p><p data-color="4">Seeded Random</p><p data-color="1">Text Override</p></div>+ <div class="row"><p data-color="11">Refresh Rate</p><p data-color="5">Reveal Direction</p><p data-color="10">Built-in charsets</p></div>+ <div class="row"><p data-color="13">Speed Control</p><p data-color="2">Reveal Delay</p></div>+ </div>+ <div class="slide">+ <p>Learn more at animejs.com</p>+ </div>+ </main>+ <script type="module" src="./index.js"></script>+</body>+</html>diff --git a/examples/text/scramble-tl/index.js b/examples/text/scramble-tl/index.jsnew file mode 100644index 00000000..06820146--- /dev/null+++ b/examples/text/scramble-tl/index.js@@ -0,0 +1,164 @@+import { createTimeline, scrambleText, stagger } from '../../../dist/modules/index.js';+import { showGUI } from '../../../../../animatorkit/editor/gui/index.js';++showGUI();++const tl = createTimeline();++tl.add('.slide:nth-child(1)', {+ opacity: {to: 1, duration: 250, ease: 'linear' },+ scale: [{from: .75, to: 1, duration: 1500, ease: 'inOut(3.5)'}],+ ease: 'inOut(3)',+});+tl.add('.slide:nth-child(1) p.center', {+ scale: { from: 3 },+ color: { from: 'var(--yellow-1)', to: 'var(--orange-1)' },+ innerHTML: scrambleText({+ override: ' ',+ ease: 'inQuad',+ duration: 500,+ from: 'center',+ cursor: '░▒▓█',+ }),+}, '<<');+tl.add('body', {+ background: 'var(--red-5)',+}, '<<+=50');+tl.add('.slide:nth-child(1) p:not(.center)', {+ scale: { from: .75 },+ color: { to: 'var(--red-1)' },+ innerHTML: scrambleText({+ override: ' ',+ from: 'center',+ duration: 500,+ revealDelay: 250,+ cursor: '░▒▓',+ perturbation: .25,+ }),+}, stagger([250, 750], { grid: true, from: 'center', ease: 'out(3)', start: '<<' }));+tl.add('.slide:nth-child(1) p:not(.center)', {+ innerHTML: scrambleText({+ text: '',+ override: false,+ from: 'center',+ ease: 'outQuad',+ reversed: true,+ duration: 800,+ cursor: '░▒▓',+ })+}, '<+=150');+tl.add('body', {+ background: 'var(--black-1)',+}, '<-=600');+tl.add('.slide:nth-child(1) p.center', {+ scale: 1.5,+ color: { to: 'var(--lime-1)' },+ ease: 'inOutExpo',+ duration: 1500,+ innerHTML: scrambleText({+ text: 'Anime.js Scramble Text',+ ease: 'inQuad',+ override: false,+ from: 'center',+ duration: 1000,+ perturbation: .25,+ }),+}, '<<');+tl.add('.slide:nth-child(1) p.center', {+ scale: 1,+ color: 'var(--white-1)',+ ease: 'inOutExpo',+ duration: 1150,+ innerHTML: scrambleText({+ override: false,+ text: 'Scramble text animations made easy.',+ from: 'right',+ duration: 950,+ settleDuration: 500,+ ease: 'inOut'+ }),+}, '<+=250');+tl.add('.slide:nth-child(1) p.center', {+ innerHTML: scrambleText({+ text: '',+ override: false,+ from: 'random',+ reversed: true,+ duration: 850,+ perturbation: .5,+ }),+}, '<+=500');+tl.set('.slide:nth-child(2)', {+ opacity: 1,+}, '<<');+tl.add('.slide:nth-child(2) p', {+ innerHTML: scrambleText({+ override: ' ',+ from: 'center',+ duration: 500,+ revealDelay: 250,+ cursor: '░▒▓',+ perturbation: .5,+ }),+}, stagger([0, 1000], { grid: true, from: 'center', ease: 'out(3)', start: '<<+=250', reversed: true }));+tl.add('.slide:nth-child(2) p', {+ scale: [.8, 1],+}, stagger([0, 150], { grid: true, from: 'center', ease: 'out(3)', start: '<<', reversed: true }));+tl.add('.slide:nth-child(2) p', {+ innerHTML: scrambleText({+ text: ' ',+ override: false,+ from: 'center',+ reversed: true,+ duration: 500,+ cursor: '░▒▓',+ })+}, stagger([0, 750], { grid: true, from: 'center', ease: 'out(3)', start: '<+=500' }));+tl.set('.slide:nth-child(3)', {+ opacity: 1,+}, '<<');+tl.add('.slide:nth-child(3) p', {+ color: 'var(--white-1)',+ scale: 1.5,+ ease: 'inOutExpo',+ innerHTML: scrambleText({+ override: ' ',+ from: 'center',+ settleDuration: 500,+ revealRate: 33,+ perturbation: .2,+ }),+}, '-=250')+tl.add('.slide:nth-child(3) p', {+ color: { to: 'var(--orange-1)', duration: 750 },+ ease: 'inOutExpo',+ duration: 1250,+ innerHTML: scrambleText({+ text: 'Anime.js v4.4.0',+ override: false,+ from: 'right',+ cursor: '░▒▓',+ duration: 750,+ ease: 'inOut',+ }),+}, '<+=750')+tl.add('.slide:nth-child(3) p', {+ color: 'var(--yellow-1)',+ scale: 2,+ ease: 'inOutExpo',+ duration: 750,+ innerHTML: scrambleText({+ text: ' ',+ chars: '#!%░▒▓_01',+ override: false,+ // cursor: '░▒▓',+ duration: 750,+ ease: 'out(2)',+ from: 'right',+ }),+}, '<+=1000')+tl.add('body', {+ background: 'var(--orange-5)',+ duration: 750,+}, '<<');+tl.init();diff --git a/examples/text/scramble/index.html b/examples/text/scramble/index.htmlnew file mode 100644index 00000000..916dba1c--- /dev/null+++ b/examples/text/scramble/index.html@@ -0,0 +1,101 @@+<!DOCTYPE html>+<html>+<head>+ <title>Text / Scramble / Anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <link href="../../assets/css/styles.css" rel="stylesheet">+ <script type="importmap">+ {+ "imports": {+ "tweaks": "../../../node_modules/tweaks/tweaks.js",+ "tweaks/gui": "../../../node_modules/tweaks/gui.js"+ }+ }+ </script>+ <style>++ body {+ display: flex;+ justify-content: center;+ min-height: 100svh;+ }++ main {+ width: 100%;+ max-width: 640px;+ padding: 80px 20px;+ display: flex;+ flex-direction: column;+ gap: 24px;+ }++ h1 {+ font-size: 2rem;+ font-weight: 700;+ line-height: 1.2;+ cursor: default;+ }++ h2 {+ font-size: 1.25rem;+ font-weight: 700;+ line-height: 1.3;+ cursor: default;+ }++ p {+ font-size: .875rem;+ line-height: 1.6;+ color: var(--fg-2);+ cursor: default;+ }++ ul {+ list-style: none;+ display: flex;+ flex-direction: column;+ gap: 8px;+ }++ li {+ font-size: .875rem;+ line-height: 1.4;+ color: var(--fg-2);+ padding-left: 20px;+ position: relative;+ cursor: default;+ }++ li:not(:empty)::before {+ content: '>';+ position: absolute;+ left: 0;+ color: var(--fg-3);+ }++ </style>+</head>+<body>+ <main>+ <h1 class="scramble">Anime.js Scramble Text</h1>+ <p class="scramble">A lightweight text scramble effect built into anime.js v4. Hover over any element on this page to see the scramble animation in action.</p>+ <h2 class="scramble">Features</h2>+ <ul>+ <li class="scramble">Named character sets and range syntax for the chars parameter</li>+ <li class="scramble">Directional reveal with the from parameter</li>+ <li class="scramble">Adjustable interval between each character</li>+ <li class="scramble">Per-character settle duration control</li>+ <li class="scramble">Deterministic output with seeded random</li>+ <li class="scramble">Cursor pattern for sweep-style effects</li>+ <li class="scramble">Perturbation to randomize timing and order</li>+ <li class="scramble">Fill character for different-length transitions</li>+ <li class="scramble">Works with any easing function</li>+ </ul>+ <h2 class="scramble">How It Works</h2>+ <p class="scramble">The scrambleText helper returns a function-based tween value. Each target element gets its own closure that captures the original text content and computes a per-character reveal timeline. Characters transition through random values before settling on their final position.</p>+ <p class="scramble">The animation duration is automatically calculated from the text length and timing parameters, ensuring consistent visual pacing regardless of content size, or use the duration parameter to set an exact duration that overrides the computed value.</p>+ </main>+ <script type="module" src="./index.js"></script>+</body>+</html>diff --git a/examples/text/scramble/index.js b/examples/text/scramble/index.jsnew file mode 100644index 00000000..af577d03--- /dev/null+++ b/examples/text/scramble/index.js@@ -0,0 +1,101 @@+import { animate, createTimer, createTimeline, scrambleText, $ } from '../../../dist/modules/index.js';+import { createTweaks, syncTweaks, Float, Int, Str, Bool, Select, registerType, registerTypeGUI } from 'tweaks';+import { GUI } from 'tweaks/gui';++// Debug panel start++syncTweaks('localStorage');++const Override = registerType('Override', false);+const overrideModes = { false: 0, true: 0, string: 0 };++registerTypeGUI('Override', (prop, labelKey) => {+ if (!prop.list) prop.list = { mode: 'false', text: '', src: undefined };+ const s = prop.list;+ if (s.src !== prop.value) {+ s.src = prop.value;+ if (prop.value === false) s.mode = 'false';+ else if (prop.value === true) s.mode = 'true';+ else { s.mode = 'string'; s.text = prop.value; }+ }+ let changed = GUI.Select(s, 'mode::"override"', overrideModes);+ if (changed) {+ prop.value = s.mode === 'true' ? true : s.mode === 'string' ? s.text : false;+ s.src = prop.value;+ }+ if (s.mode === 'string') {+ if (GUI.Text(s, 'text::"override chars"')) {+ prop.value = s.text;+ s.src = prop.value;+ changed = true;+ }+ }+ return changed;+});++const scrambleParams = createTweaks('Scramble', {+ text: Str(),+ from: Select(['auto', 'left', 'right', 'center', 'random']),+ reversed: Bool(false),+ ease: Select(['linear', 'in(2)', 'out(2)', 'inOut(2)', 'steps(10)']),+ chars: Select(['', 'lowercase', 'uppercase', 'numbers', 'symbols', 'braille', 'blocks', 'shades'], 0),+ cursor: Str('░▒▓█'),+ override: Override(false),+ perturbation: Float(0, 0, 1, 0.01),+ duration: Int(500),+ delay: Int(0, 0, 2000),+ revealDelay: Int(0, 0, 2000),+ revealRate: Int(50),+ settleDuration: Int(250),+ settleRate: Int(30),+});++const audioParams = { sound: false };++GUI.render(() => {+ if (GUI.BeginPanel('Scramble config')) {+ GUI.Tweaks(scrambleParams);+ if (GUI.Checkbox(audioParams, 'sound')) ctx.resume();+ GUI.EndPanel();+ }+});++// Debug panel ends++const ctx = new AudioContext();+let allowSound = false;+const tickSound = () => {+ if (!audioParams.sound || !allowSound) return;+ allowSound = false;+ const t = ctx.currentTime;+ const o = ctx.createOscillator();+ const g = ctx.createGain();+ o.type = 'sine';+ o.frequency.setValueAtTime(4000 + Math.random() * 400, t);+ g.gain.setValueAtTime(0.001, t);+ g.gain.linearRampToValueAtTime(0.035, t + 0.001);+ g.gain.exponentialRampToValueAtTime(0.001, t + 0.003);+ o.connect(g).connect(ctx.destination);+ o.start(t);+ o.stop(t + 0.003);+}++const sound = createTimer({ onUpdate: () => allowSound = true, frameRate: 30 });+const intro = createTimeline({ delay: 500 });++$('.scramble').forEach($el => {+ const replay = () => animate($el, { innerHTML: scrambleText({ ...scrambleParams, text: scrambleParams.text || undefined, onChange: tickSound }) });+ intro.add($el, {+ innerHTML: scrambleText({+ override: '',+ duration: 750,+ settleDuration: 250,+ perturbation: .2,+ cursor: '░▒▓█',+ }),+ }, '-=620');+ $el.addEventListener('pointerenter', replay);+ $el.addEventListener('pointerdown', replay);+});++intro.init();diff --git a/package.json b/package.jsonindex 7939762e..df50fe49 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "animejs",- "version": "4.3.6",+ "version": "4.4.0","description": "JavaScript animation engine","homepage": "https://animejs.com","author": "Julian Garnier <[email protected]>",@@ -187,6 +187,7 @@"nodemon": "^3.1.10","rollup": "^4.9.1","three": "^0.160.0",+ "tweaks": "^0.2.0","typescript": "^5.9.2"},"scripts": {diff --git a/src/animation/animation.js b/src/animation/animation.jsindex 09bd8d22..93f3ceec 100644--- a/src/animation/animation.js+++ b/src/animation/animation.js@@ -43,11 +43,13 @@ import {decomposeTweenValue,decomposedOriginalValue,createDecomposedValueTargetObject,+ composeColorValue,+ composeComplexValue,} from '../core/values.js';import {sanitizePropertyName,- cleanInlineStyles,+ revertValues,} from '../core/styles.js';import {@@ -215,7 +217,7 @@ export class JSAnimation extends Timer {* @param {Number} [parentPosition]* @param {Boolean} [fastSet=false]* @param {Number} [index=0]- * @param {Number} [length=0]+ * @param {TargetsArray} [allTargets]*/constructor(targets,@@ -224,7 +226,7 @@ export class JSAnimation extends Timer {parentPosition,fastSet = false,index = 0,- length = 0+ allTargets) {super(/** @type {TimerParams & AnimationParams} */(parameters), parent, parentPosition);@@ -275,7 +277,7 @@ export class JSAnimation extends Timer {const target = parsedTargets[targetIndex];const ti = index || targetIndex;- const tl = length || targetsLength;+ const tl = allTargets || parsedTargets;let lastTransformGroupIndex = NaN;let lastTransformGroupLength = NaN;@@ -351,7 +353,14 @@ export class JSAnimation extends Timer {toFunctionStore.func = null;fromFunctionStore.func = null;- const computedToValue = getFunctionValue(key.to, target, ti, tl, toFunctionStore);+ const computedComposition = getFunctionValue(setValue(key.composition, tComposition), target, ti, tl, null, null);+ const tweenComposition = isNum(computedComposition) ? computedComposition : compositionTypes[computedComposition];+ if (!siblings && tweenComposition !== compositionTypes.none) siblings = getTweenSiblings(target, propName);+ // Timelines pass the last sibling tween if it belongs to the same timeline+ // Standalone animations only pass prevTween when the property has multiple keyframes+ const tailTween = siblings ? siblings._tail : null;+ const prevSiblingTween = parent && tailTween && tailTween.parent.parent === parent ? tailTween : prevTween;+ const computedToValue = getFunctionValue(key.to, target, ti, tl, toFunctionStore, prevSiblingTween);let tweenToValue;// Allows function based values to return an object syntax value ({to: v})@@ -361,20 +370,18 @@ export class JSAnimation extends Timer {} else {tweenToValue = computedToValue;}- const tweenFromValue = getFunctionValue(key.from, target, ti, tl);+ const tweenFromValue = getFunctionValue(key.from, target, ti, tl, null, prevSiblingTween);const easeToParse = key.ease || tEasing;- const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl);+ const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl, null, prevSiblingTween);const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;// Calculate default individual keyframe duration by dividing the tl of keyframes- const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl) / l : tDuration)), target, ti, tl);+ const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl, null, prevSiblingTween) / l : tDuration)), target, ti, tl, null, prevSiblingTween);// Default delay value should only be applied to the first tween- const tweenDelay = getFunctionValue(setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl);- const computedComposition = getFunctionValue(setValue(key.composition, tComposition), target, ti, tl);- const tweenComposition = isNum(computedComposition) ? computedComposition : compositionTypes[computedComposition];+ const tweenDelay = getFunctionValue(setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl, null, prevSiblingTween);// Modifiers are treated differently and don't accept function based value to prevent having to pass a function wrapperconst tweenModifier = key.modifier || tModifier;const hasFromvalue = !isUnd(tweenFromValue);@@ -391,7 +398,6 @@ export class JSAnimation extends Timer {let prevSibling = prevTween;if (tweenComposition !== compositionTypes.none) {- if (!siblings) siblings = getTweenSiblings(target, propName);let nextSibling = siblings._head;// Iterate trough all the next siblings until we find a sibling with an equal or inferior start timewhile (nextSibling && !nextSibling._isOverridden && nextSibling._absoluteStartTime <= absoluteStartTime) {@@ -410,8 +416,8 @@ export class JSAnimation extends Timer {// Decompose valuesif (isFromToValue) {- decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore) : tweenFromValue, fromTargetObject);- decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore) : tweenToValue, toTargetObject);+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore, prevSiblingTween) : tweenFromValue, fromTargetObject);+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore, prevSiblingTween) : tweenToValue, toTargetObject);// Needed to force an inline style registrationconst originalValue = getOriginalAnimatableValue(target, propName, tweenType, inlineStylesStore);if (fromTargetObject.t === valueTypes.NUMBER) {@@ -565,6 +571,18 @@ export class JSAnimation extends Timer {composeTween(tween, siblings);}+ // Pre-compute the tween end value for function-based value chaining (ie morphTo / scrambleText in keyframe arrays and timelines)+ const vt = tween._valueType;+ if (vt === valueTypes.COMPLEX) {+ tween._value = composeComplexValue(tween, 1, -1);+ } else if (vt === valueTypes.COLOR) {+ tween._value = composeColorValue(tween, 1, -1);+ } else if (vt === valueTypes.UNIT) {+ tween._value = `${tweenModifier(tween._toNumber)}${tween._unit}`;+ } else {+ tween._value = tweenModifier(tween._toNumber);+ }+if (isNaN(firstTweenChangeStartTime)) {firstTweenChangeStartTime = tween._startTime;}@@ -722,7 +740,7 @@ export class JSAnimation extends Timer {*/revert() {super.revert();- return cleanInlineStyles(this);+ return revertValues(this);}/**@@ -744,4 +762,10 @@ export class JSAnimation extends Timer {* @param {AnimationParams} parameters* @return {JSAnimation}*/-export const animate = (targets, parameters) => new JSAnimation(targets, parameters, null, 0, false).init();+export const animate = (targets, parameters) => {+ if (globals.editor) {+ return globals.editor.addAnimation(targets, parameters);+ } else {+ return new JSAnimation(targets, parameters, null, 0, false).init();+ }+};diff --git a/src/core/consts.js b/src/core/consts.jsindex afb7dea8..cf297dcb 100644--- a/src/core/consts.js+++ b/src/core/consts.js@@ -3,7 +3,7 @@// TODO: Do we need to check if we're running inside a worker ?export const isBrowser = typeof window !== 'undefined';-/** @typedef {Window & {AnimeJS: Array} & {AnimeJSDevTools: any}|null} AnimeJSWindow+/** @typedef {Window & {AnimeJS: Array}|null} AnimeJSWindow/** @type {AnimeJSWindow} */export const win = isBrowser ? /** @type {AnimeJSWindow} */(/** @type {unknown} */(window)) : null;@@ -50,7 +50,6 @@ export const isRegisteredTargetSymbol = Symbol();export const isDomSymbol = Symbol();export const isSvgSymbol = Symbol();export const transformsSymbol = Symbol();-export const morphPointsSymbol = Symbol();export const proxyTargetSymbol = Symbol();// Numbers@@ -74,6 +73,7 @@ export const shortTransforms = /*#__PURE__*/ (() => {})();export const validTransforms = [+ 'perspective','translateX','translateY','translateZ',@@ -88,9 +88,6 @@ export const validTransforms = ['skew','skewX','skewY',- 'matrix',- 'matrix3d',- 'perspective',];export const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});@@ -113,6 +110,5 @@ export const digitWithExponentRgx = /[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;// export const unitsExecRgx = /^([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)+([a-z]+|%)$/i;export const unitsExecRgx = /^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/iexport const lowerCaseRgx = /([a-z])([A-Z])/g;-export const transformsExecRgx = /(\w+)(\([^)]+\)+)/g; // Match inline transforms with cacl() values, returns the value wrapped in ()export const relativeValuesExecRgx = /(\*=|\+=|-=)/;export const cssVariableMatchRgx = /var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/;diff --git a/src/core/globals.js b/src/core/globals.jsindex a35d7617..730cf631 100644--- a/src/core/globals.js+++ b/src/core/globals.js@@ -19,6 +19,18 @@ import {* } from '../scope/index.js'*/+/**+ * @typedef {Object} EditorGlobals+ * @property {boolean} showPanel+ * @property {boolean} synced+ * @property {Function} addAnimation+ * @property {Function} addTimeline+ * @property {Function} addTimelineChild+ * @property {Function} resolveStagger+ * @property {Object|null} _head+ * @property {Object|null} _tail+ */+/** @type {DefaultsParams} */export const defaults = {id: null,@@ -62,10 +74,10 @@ export const globals = {timeScale: 1,/** @type {Number} */tickThreshold: 200,+ /** @type {EditorGlobals|null} */+ editor: null,}-export const devTools = isBrowser && win.AnimeJSDevTools;-export const globalVersions = { version: '__packageVersion__', engine: null };if (isBrowser) {diff --git a/src/core/helpers.js b/src/core/helpers.jsindex c0d59f08..0cbbdd1a 100644--- a/src/core/helpers.js+++ b/src/core/helpers.js@@ -125,8 +125,6 @@ export const _round = Math.round;*/export const clamp = (v, min, max) => v < min ? min : v > max ? max : v;-const powCache = {};-/*** Rounds a number to specified decimal places*@@ -134,13 +132,12 @@ const powCache = {};* @param {Number} decimalLength - Number of decimal places* @return {Number}*/-export const round = (v, decimalLength) => {- if (decimalLength < 0) return v;- if (!decimalLength) return _round(v);- let p = powCache[decimalLength];- if (!p) p = powCache[decimalLength] = 10 ** decimalLength;- return _round(v * p) / p;-};+ export const round = (v, decimalLength) => {+ if (decimalLength < 0) return v;+ if (!decimalLength) return _round(v);+ const p = 10 ** decimalLength;+ return _round(v * p) / p;+ }/*** Snaps a value to nearest increment or array valuediff --git a/src/core/render.js b/src/core/render.jsindex 27a8fb14..950b9788 100644--- a/src/core/render.js+++ b/src/core/render.js@@ -7,8 +7,6 @@ import {valueTypes,tickModes,compositionTypes,- emptyString,- transformsFragmentStrings,transformsSymbol,minValue,} from './consts.js';@@ -21,8 +19,17 @@ import {forEachChildren,} from './helpers.js';+import {+ buildTransformString,+} from './transforms.js';++import {+ composeColorValue,+ composeComplexValue,+} from './values.js';+/**- * @import {+ * @import {* Tickable,* Renderable,* CallbackArgument,@@ -65,7 +72,6 @@ export const render = (tickable, time, muteCallbacks, internalRender, tickMode)const _hasChildren = tickable._hasChildren;const tickableDelay = tickable._delay;const tickablePrevAbsoluteTime = tickable._currentTime; // TODO: rename ._currentTime to ._absoluteCurrentTime-const tickableEndTime = tickableDelay + iterationDuration;const tickableAbsoluteTime = time - tickableDelay;const tickablePrevTime = clamp(tickablePrevAbsoluteTime, -tickableDelay, duration);@@ -197,30 +203,9 @@ export const render = (tickable, time, muteCallbacks, internalRender, tickMode)number = /** @type {Number} */(tweenModifier(round(lerp(tween._fromNumber, tween._toNumber, tweenProgress), tweenPrecision)));value = `${number}${tween._unit}`;} else if (tweenValueType === valueTypes.COLOR) {- const fn = tween._fromNumbers;- const tn = tween._toNumbers;- const r = round(clamp(/** @type {Number} */(tweenModifier(lerp(fn[0], tn[0], tweenProgress))), 0, 255), 0);- const g = round(clamp(/** @type {Number} */(tweenModifier(lerp(fn[1], tn[1], tweenProgress))), 0, 255), 0);- const b = round(clamp(/** @type {Number} */(tweenModifier(lerp(fn[2], tn[2], tweenProgress))), 0, 255), 0);- const a = clamp(/** @type {Number} */(tweenModifier(round(lerp(fn[3], tn[3], tweenProgress), tweenPrecision))), 0, 1);- value = `rgba(${r},${g},${b},${a})`;- if (tweenHasComposition) {- const ns = tween._numbers;- ns[0] = r;- ns[1] = g;- ns[2] = b;- ns[3] = a;- }+ value = composeColorValue(tween, tweenProgress, tweenPrecision);} else if (tweenValueType === valueTypes.COMPLEX) {- value = tween._strings[0];- for (let j = 0, l = tween._toNumbers.length; j < l; j++) {- const n = /** @type {Number} */(tweenModifier(round(lerp(tween._fromNumbers[j], tween._toNumbers[j], tweenProgress), tweenPrecision)));- const s = tween._strings[j + 1];- value += `${s ? n + s : n}`;- if (tweenHasComposition) {- tween._numbers[j] = n;- }- }+ value = composeComplexValue(tween, tweenProgress, tweenPrecision);}// For additive tweens and Animatables@@ -263,14 +248,8 @@ export const render = (tickable, time, muteCallbacks, internalRender, tickMode)}- // NOTE: Possible improvement: Use translate(x,y) / translate3d(x,y,z) syntax- // to reduce memory usage on string compositionif (tweenTransformsNeedUpdate && tween._renderTransforms) {- let str = emptyString;- for (let key in tweenTargetTransformsProperties) {- str += `${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `;- }- tweenStyle.transform = str;+ tweenStyle.transform = buildTransformString(tweenTargetTransformsProperties);tweenTransformsNeedUpdate = 0;}@@ -327,6 +306,50 @@ export const render = (tickable, time, muteCallbacks, internalRender, tickMode)return hasRendered;}+// Shared context for extracted forEachChildren callbacks in tick()+// Avoids closure allocation every frame++let renderCtxChildrenTime = 0;+let renderCtxTlFps = 0;+let renderCtxTickTime = 0;+let renderCtxTickMode = 0;+let renderCtxMuteCallbacks = 0;+let renderCtxInternalRender = 0;+let renderCtxChildrenHasRendered = 0;+let renderCtxChildrenHaveCompleted = true;+let loopCtxIsRunningBackwards = false;+let loopCtxIterationDuration = 0;+let loopCtxMuteCallbacks = 0;++/** @param {JSAnimation} child */+const tickLoopChild = (child) => {+ if (!loopCtxIsRunningBackwards) {+ // Force an internal render to trigger the callbacks if the child has not completed on loop+ if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {+ render(child, loopCtxIterationDuration, loopCtxMuteCallbacks, 1, tickModes.FORCE);+ }+ // Reset their began and completed flags to allow retrigering callbacks on the next iteration+ child.began = false;+ child.completed = false;+ } else {+ const childDuration = child.duration;+ const childStartTime = child._offset + child._delay;+ const childEndTime = childStartTime + childDuration;+ // Triggers the onComplete callback on reverse for children on the edges of the timeline+ if (!loopCtxMuteCallbacks && childDuration <= minValue && (!childStartTime || childEndTime === loopCtxIterationDuration)) {+ child.onComplete(child);+ }+ }+}++/** @param {JSAnimation} child */+const tickRenderChild = (child) => {+ const childTime = round((renderCtxChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds+ const childTickMode = child._fps < renderCtxTlFps ? child.requestTick(renderCtxTickTime) : renderCtxTickMode;+ renderCtxChildrenHasRendered += render(child, childTime, renderCtxMuteCallbacks, renderCtxInternalRender, childTickMode);+ if (!child.completed && renderCtxChildrenHaveCompleted) renderCtxChildrenHaveCompleted = false;+}+/*** @param {Tickable} tickable* @param {Number} time@@ -343,45 +366,30 @@ export const tick = (tickable, time, muteCallbacks, internalRender, tickMode) =>const tlIsRunningBackwards = tl.backwards;const tlChildrenTime = internalRender ? time : tl._iterationTime;const tlCildrenTickTime = now();-let tlChildrenHasRendered = 0;let tlChildrenHaveCompleted = true;-// If the timeline has looped forward, we need to manually triggers children skipped callbacksif (!internalRender && tl._currentIteration !== _currentIteration) {const tlIterationDuration = tl.iterationDuration;- forEachChildren(tl, (/** @type {JSAnimation} */child) => {- if (!tlIsRunningBackwards) {- // Force an internal render to trigger the callbacks if the child has not completed on loop- if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {- render(child, tlIterationDuration, muteCallbacks, 1, tickModes.FORCE);- }- // Reset their began and completed flags to allow retrigering callbacks on the next iteration- child.began = false;- child.completed = false;- } else {- const childDuration = child.duration;- const childStartTime = child._offset + child._delay;- const childEndTime = childStartTime + childDuration;- // Triggers the onComplete callback on reverse for children on the edges of the timeline- if (!muteCallbacks && childDuration <= minValue && (!childStartTime || childEndTime === tlIterationDuration)) {- child.onComplete(child);- }- }- });+ loopCtxIsRunningBackwards = tlIsRunningBackwards;+ loopCtxIterationDuration = tlIterationDuration;+ loopCtxMuteCallbacks = muteCallbacks;+ forEachChildren(tl, tickLoopChild);if (!muteCallbacks) tl.onLoop(/** @type {CallbackArgument} */(tl));}-- forEachChildren(tl, (/** @type {JSAnimation} */child) => {- const childTime = round((tlChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds- const childTickMode = child._fps < tl._fps ? child.requestTick(tlCildrenTickTime) : tickMode;- tlChildrenHasRendered += render(child, childTime, muteCallbacks, internalRender, childTickMode);- if (!child.completed && tlChildrenHaveCompleted) tlChildrenHaveCompleted = false;- }, tlIsRunningBackwards);-+ renderCtxChildrenTime = tlChildrenTime;+ renderCtxTlFps = tl._fps;+ renderCtxTickTime = tlCildrenTickTime;+ renderCtxTickMode = tickMode;+ renderCtxMuteCallbacks = muteCallbacks;+ renderCtxInternalRender = internalRender;+ renderCtxChildrenHasRendered = 0;+ renderCtxChildrenHaveCompleted = true;+ forEachChildren(tl, tickRenderChild, tlIsRunningBackwards);+ tlChildrenHasRendered = renderCtxChildrenHasRendered;+ tlChildrenHaveCompleted = renderCtxChildrenHaveCompleted;// Renders on timeline are triggered by its children so it needs to be set after rendering the childrenif (!muteCallbacks && tlChildrenHasRendered) tl.onRender(/** @type {CallbackArgument} */(tl));-// Triggers the timeline onComplete() once all chindren all completed and the current time has reached the endif ((tlChildrenHaveCompleted || tlIsRunningBackwards) && tl._currentTime >= tl.duration) {// Make sure the paused flag is false in case it has been skipped in the render functiondiff --git a/src/core/styles.js b/src/core/styles.jsindex 3c82e1e3..a2bfb50e 100644--- a/src/core/styles.js+++ b/src/core/styles.js@@ -4,7 +4,6 @@ import {isDomSymbol,transformsSymbol,emptyString,- transformsFragmentStrings,} from './consts.js';import {@@ -14,6 +13,10 @@ import {toLowerCase,} from './helpers.js';+import {+ buildTransformString,+} from './transforms.js';+/*** @import {* JSAnimation,@@ -63,56 +66,75 @@ export const sanitizePropertyName = (propertyName, target, tweenType) => {/*** @template {Renderable} T* @param {T} renderable+ * @param {Boolean} [inlineStylesOnly]* @return {T}*/-export const cleanInlineStyles = renderable => {- // Allow cleanInlineStyles() to be called on timelines+export const revertValues = (renderable, inlineStylesOnly = false) => {+ // Allow revertValues() to be called on timelinesif (renderable._hasChildren) {- forEachChildren(renderable, cleanInlineStyles, true);+ forEachChildren(renderable, (/** @type {Renderable} */child) => revertValues(child, inlineStylesOnly), true);} else {const animation = /** @type {JSAnimation} */(renderable);animation.pause();forEachChildren(animation, (/** @type {Tween} */tween) => {const tweenProperty = tween.property;const tweenTarget = tween.target;- if (tweenTarget[isDomSymbol]) {- const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;- const originalInlinedValue = tween._inlineValue;- const tweenHadNoInlineValue = isNil(originalInlinedValue) || originalInlinedValue === emptyString;- if (tween._tweenType === tweenTypes.TRANSFORM) {- const cachedTransforms = tweenTarget[transformsSymbol];- if (tweenHadNoInlineValue) {- delete cachedTransforms[tweenProperty];- } else {- cachedTransforms[tweenProperty] = originalInlinedValue;- }- if (tween._renderTransforms) {- if (!Object.keys(cachedTransforms).length) {- targetStyle.removeProperty('transform');+ const tweenType = tween._tweenType;+ const originalInlinedValue = tween._inlineValue;+ const tweenHadNoInlineValue = isNil(originalInlinedValue) || originalInlinedValue === emptyString;+ if (tweenType === tweenTypes.OBJECT) {+ if (!inlineStylesOnly && !tweenHadNoInlineValue) {+ tweenTarget[tweenProperty] = originalInlinedValue;+ }+ } else if (tweenTarget[isDomSymbol]) {+ if (tweenType === tweenTypes.ATTRIBUTE) {+ if (!inlineStylesOnly) {+ if (tweenHadNoInlineValue) {+ /** @type {DOMTarget} */(tweenTarget).removeAttribute(tweenProperty);} else {- let str = emptyString;- for (let key in cachedTransforms) {- str += transformsFragmentStrings[key] + cachedTransforms[key] + ') ';- }- targetStyle.transform = str;+ /** @type {DOMTarget} */(tweenTarget).setAttribute(tweenProperty, /** @type {String} */(originalInlinedValue));}}} else {- if (tweenHadNoInlineValue) {- targetStyle.removeProperty(toLowerCase(tweenProperty));+ const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;+ if (tweenType === tweenTypes.TRANSFORM) {+ const cachedTransforms = tweenTarget[transformsSymbol];+ if (tweenHadNoInlineValue) {+ delete cachedTransforms[tweenProperty];+ } else {+ cachedTransforms[tweenProperty] = originalInlinedValue;+ }+ if (tween._renderTransforms) {+ if (!Object.keys(cachedTransforms).length) {+ targetStyle.removeProperty('transform');+ } else {+ targetStyle.transform = buildTransformString(cachedTransforms);+ }+ }} else {- targetStyle[tweenProperty] = originalInlinedValue;+ if (tweenHadNoInlineValue) {+ targetStyle.removeProperty(toLowerCase(tweenProperty));+ } else {+ targetStyle[tweenProperty] = originalInlinedValue;+ }}}- if (animation._tail === tween) {- animation.targets.forEach(t => {- if (t.getAttribute && t.getAttribute('style') === emptyString) {- t.removeAttribute('style');- };- });- }+ }+ if (tweenTarget[isDomSymbol] && animation._tail === tween) {+ animation.targets.forEach(t => {+ if (t.getAttribute && t.getAttribute('style') === emptyString) {+ t.removeAttribute('style');+ };+ });}})}return renderable;}++/**+ * @template {Renderable} T+ * @param {T} renderable+ * @return {T}+ */+export const cleanInlineStyles = renderable => revertValues(renderable, true);diff --git a/src/core/transforms.js b/src/core/transforms.jsindex f963e299..6a12625d 100644--- a/src/core/transforms.js+++ b/src/core/transforms.js@@ -1,6 +1,8 @@import {- transformsExecRgx,transformsSymbol,+ validTransforms,+ transformsFragmentStrings,+ emptyString,} from './consts.js';import {@@ -22,24 +24,139 @@ import {*/export const parseInlineTransforms = (target, propName, animationInlineStyles) => {const inlineTransforms = target.style.transform;- let inlinedStylesPropertyValue;if (inlineTransforms) {const cachedTransforms = target[transformsSymbol];- let t; while (t = transformsExecRgx.exec(inlineTransforms)) {- const inlinePropertyName = t[1];- // const inlinePropertyValue = t[2];- const inlinePropertyValue = t[2].slice(1, -1);- cachedTransforms[inlinePropertyName] = inlinePropertyValue;- if (inlinePropertyName === propName) {- inlinedStylesPropertyValue = inlinePropertyValue;- // Store the new parsed inline styles if animationInlineStyles is provided- if (animationInlineStyles) {- animationInlineStyles[propName] = inlinePropertyValue;+ let pos = 0;+ const len = inlineTransforms.length;+ let fullTranslateValue;+ while (pos < len) {+ // Skip whitespace+ while (pos < len && inlineTransforms.charCodeAt(pos) === 32) pos++;+ if (pos >= len) break;+ // Read function name+ const nameStart = pos;+ while (pos < len && inlineTransforms.charCodeAt(pos) !== 40) pos++;+ if (pos >= len) break;+ const name = inlineTransforms.substring(nameStart, pos);+ // Scan to closing paren, recording top-level comma positions+ let depth = 1;+ const valueStart = pos + 1;+ let c1 = -1, c2 = -1;+ pos++;+ while (pos < len && depth > 0) {+ const c = inlineTransforms.charCodeAt(pos);+ if (c === 40) depth++;+ else if (c === 41) depth--;+ else if (c === 44 && depth === 1) {+ if (c1 === -1) c1 = pos;+ else if (c2 === -1) c2 = pos;}+ pos++;}+ const valueEnd = pos - 1;+ // Decompose multi-arg functions into individual axis properties+ if (name === 'translate' || name === 'translate3d') {+ if (c1 === -1) {+ cachedTransforms.translateX = inlineTransforms.substring(valueStart, valueEnd).trim();+ } else {+ cachedTransforms.translateX = inlineTransforms.substring(valueStart, c1).trim();+ if (c2 === -1) {+ cachedTransforms.translateY = inlineTransforms.substring(c1 + 1, valueEnd).trim();+ } else {+ cachedTransforms.translateY = inlineTransforms.substring(c1 + 1, c2).trim();+ cachedTransforms.translateZ = inlineTransforms.substring(c2 + 1, valueEnd).trim();+ }+ }+ fullTranslateValue = inlineTransforms.substring(valueStart, valueEnd);+ } else if (name === 'scale' || name === 'scale3d') {+ if (c1 === -1) {+ cachedTransforms.scale = inlineTransforms.substring(valueStart, valueEnd).trim();+ } else {+ cachedTransforms.scaleX = inlineTransforms.substring(valueStart, c1).trim();+ if (c2 === -1) {+ cachedTransforms.scaleY = inlineTransforms.substring(c1 + 1, valueEnd).trim();+ } else {+ cachedTransforms.scaleY = inlineTransforms.substring(c1 + 1, c2).trim();+ cachedTransforms.scaleZ = inlineTransforms.substring(c2 + 1, valueEnd).trim();+ }+ }+ } else {+ cachedTransforms[name] = inlineTransforms.substring(valueStart, valueEnd);+ }+ }+ // Resolve the requested property from the cache+ if (propName === 'translate3d' && fullTranslateValue) {+ if (animationInlineStyles) animationInlineStyles[propName] = fullTranslateValue;+ return fullTranslateValue;+ }+ const cached = cachedTransforms[propName];+ if (!isUnd(cached)) {+ if (animationInlineStyles) animationInlineStyles[propName] = cached;+ return cached;}}- return inlineTransforms && !isUnd(inlinedStylesPropertyValue) ? inlinedStylesPropertyValue :+ return propName === 'translate3d' ? '0px, 0px, 0px' :+ propName === 'rotate3d' ? '0, 0, 0, 0deg' :stringStartsWith(propName, 'scale') ? '1' :stringStartsWith(propName, 'rotate') || stringStartsWith(propName, 'skew') ? '0deg' : '0px';}++/**+ * Builds a CSS transform string from the target's cached transform properties.+ * Iterates validTransforms in order (perspective > translate > rotate > scale > skew > matrix).+ * When adjacent axis properties are all present, emits a shorter shorthand (translateX + translateY -> translate(x, y))+ * The index is advanced past consumed properties so they are not emitted twice.+ * Properties without a grouping partner (e.g. translateY alone, scaleZ alone) emit individually.+ *+ * @param {Record<String, String>} props+ * @return {String}+ */+export const buildTransformString = (props) => {+ let str = emptyString;+ for (let i = 0, l = validTransforms.length; i < l; i++) {+ const key = validTransforms[i];+ const val = props[key];+ if (val !== undefined) {+ // Group translateX with adjacent translateY / translateZ+ if (key === 'translateX') {+ const next = props.translateY;+ if (next !== undefined) {+ const next2 = props.translateZ;+ if (next2 !== undefined) {+ str += `translate3d(${val},${next},${next2}) `;+ i += 2;+ } else {+ str += `translate(${val},${next}) `;+ i += 1;+ }+ continue;+ }+ }+ // Group scaleX with adjacent scaleY / scaleZ (only when standalone scale is absent)+ if (key === 'scaleX' && props.scale === undefined) {+ const next = props.scaleY;+ if (next !== undefined) {+ const next2 = props.scaleZ;+ if (next2 !== undefined) {+ str += `scale3d(${val},${next},${next2}) `;+ i += 2;+ } else {+ str += `scale(${val},${next}) `;+ i += 1;+ }+ continue;+ }+ }+ // All other properties: emit individually using pre-built fragment string+ str += `${transformsFragmentStrings[key]}${val}) `;+ }+ // Preserve non-animatable rotate3d in correct position (after rotateZ, before scale)+ if (key === 'rotateZ') {+ if (props.rotate3d !== undefined) str += `rotate3d(${props.rotate3d}) `;+ }+ }+ // Preserve non-animatable matrix/matrix3d from inline styles+ if (props.matrix !== undefined) str += `matrix(${props.matrix}) `;+ if (props.matrix3d !== undefined) str += `matrix3d(${props.matrix3d}) `;+ return str;+}diff --git a/src/core/values.js b/src/core/values.jsindex aa3f0174..d669d53e 100644--- a/src/core/values.js+++ b/src/core/values.js@@ -3,6 +3,7 @@ import {validTransforms,tweenTypes,valueTypes,+ compositionTypes,digitWithExponentRgx,unitsExecRgx,isDomSymbol,@@ -21,6 +22,9 @@ import {isCol,isValidSVGAttribute,isStr,+ round,+ lerp,+ clamp,} from './helpers.js';import {@@ -38,6 +42,7 @@ import {* Tween,* TweenPropValue,* TweenDecomposedValue,+* TargetsArray,* } from '../types/index.js'*/@@ -55,15 +60,16 @@ export const setValue = (targetValue, defaultValue) => {* @param {TweenPropValue} value* @param {Target} target* @param {Number} index- * @param {Number} total- * @param {Object} [store]+ * @param {TargetsArray} targets+ * @param {Object|null} store+ * @param {Tween|null} prevTween* @return {any}*/-export const getFunctionValue = (value, target, index, total, store) => {+export const getFunctionValue = (value, target, index, targets, store, prevTween) => {let func;if (isFnc(value)) {func = () => {- const computed = /** @type {Function} */(value)(target, index, total);+ const computed = /** @type {Function} */(value)(target, index, targets, prevTween);// Fallback to 0 if the function returns undefined / NaN / null / false / 0return !isNaN(+computed) ? +computed : computed || 0;}@@ -130,9 +136,17 @@ const getCSSValue = (target, propName, animationInlineStyles) => {*/export const getOriginalAnimatableValue = (target, propName, tweenType, animationInlineStyles) => {const type = !isUnd(tweenType) ? tweenType : getTweenType(target, propName);- return type === tweenTypes.OBJECT ? target[propName] || 0 :- type === tweenTypes.ATTRIBUTE ? /** @type {DOMTarget} */(target).getAttribute(propName) :- type === tweenTypes.TRANSFORM ? parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :+ if (type === tweenTypes.OBJECT) {+ const value = target[propName];+ if (value && animationInlineStyles) animationInlineStyles[propName] = value;+ return value || 0;+ }+ if (type === tweenTypes.ATTRIBUTE) {+ const value = /** @type {DOMTarget} */(target).getAttribute(propName);+ if (value && animationInlineStyles) animationInlineStyles[propName] = value;+ return value;+ }+ return type === tweenTypes.TRANSFORM ? parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :type === tweenTypes.CSS_VAR ? getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles).trimStart() :getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles);}@@ -233,3 +247,51 @@ export const decomposeTweenValue = (tween, targetObject) => {}export const decomposedOriginalValue = createDecomposedValueTargetObject();++/**+ * @param {Tween} tween+ * @param {Number} progress+ * @param {Number} precision+ * @return {String}+ */+export const composeColorValue = (tween, progress, precision) => {+ const mod = tween._modifier;+ const fn = tween._fromNumbers;+ const tn = tween._toNumbers;+ const r = round(clamp(/** @type {Number} */(mod(lerp(fn[0], tn[0], progress))), 0, 255), 0);+ const g = round(clamp(/** @type {Number} */(mod(lerp(fn[1], tn[1], progress))), 0, 255), 0);+ const b = round(clamp(/** @type {Number} */(mod(lerp(fn[2], tn[2], progress))), 0, 255), 0);+ const a = clamp(/** @type {Number} */(mod(round(lerp(fn[3], tn[3], progress), precision))), 0, 1);+ if (tween._composition !== compositionTypes.none) {+ const ns = tween._numbers;+ ns[0] = r;+ ns[1] = g;+ ns[2] = b;+ ns[3] = a;+ }+ return `rgba(${r},${g},${b},${a})`;+}++/**+ * @param {Tween} tween+ * @param {Number} progress+ * @param {Number} precision+ * @return {String}+ */+export const composeComplexValue = (tween, progress, precision) => {+ const mod = tween._modifier;+ const fn = tween._fromNumbers;+ const tn = tween._toNumbers;+ const ts = tween._strings;+ const hasComposition = tween._composition !== compositionTypes.none;+ let v = ts[0];+ for (let j = 0, l = tn.length; j < l; j++) {+ const n = /** @type {Number} */(mod(round(lerp(fn[j], tn[j], progress), precision)));+ const s = ts[j + 1];+ v += `${s ? n + s : n}`;+ if (hasComposition) {+ tween._numbers[j] = n;+ }+ }+ return v;+}diff --git a/src/index.js b/src/index.jsindex d2fc079a..c4d32c98 100644--- a/src/index.js+++ b/src/index.js@@ -16,4 +16,5 @@ export * as svg from './svg/index.js';export * from './text/index.js';export * as text from './text/index.js';export * from './waapi/index.js';-export * from './types/index.js';\ No newline at end of file+export * from './types/index.js';+export { globals } from './core/globals.js';\ No newline at end of filediff --git a/src/layout/layout.js b/src/layout/layout.jsindex f3872eef..eebe0d57 100644--- a/src/layout/layout.js+++ b/src/layout/layout.js@@ -29,6 +29,7 @@ import {} from '../waapi/waapi.js';import {+ globals,defaults,scope,} from '../core/globals.js';@@ -97,6 +98,7 @@ import {/*** @typedef {Object} LayoutSpecificAnimationParams+ * @property {Number|String} [id]* @property {Number|FunctionValue} [delay]* @property {Number|FunctionValue} [duration]* @property {EasingParam|FunctionValue} [ease]@@ -139,7 +141,7 @@ import {* @property {String} id* @property {DOMTarget} $el* @property {Number} index- * @property {Number} total+ * @property {Array<DOMTarget>} targets* @property {Number} delay* @property {Number} duration* @property {EasingParam} ease@@ -283,7 +285,7 @@ const createNode = ($el, parentNode, state, recycledNode) => {node.$measure = $el;node.id = dataId;node.index = 0;- node.total = 1;+ node.targets = null;node.delay = 0;node.duration = 0;node.ease = null;@@ -469,12 +471,12 @@ const updateNodeProperties = (node, props) => {* @param {LayoutAnimationTimingsParams} params*/const updateNodeTimingParams = (node, params) => {- const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.total);+ const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.targets, null, null);const keyEasing = isFnc(easeFunctionResult) ? easeFunctionResult : params.ease;const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);node.ease = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;- node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.total);- node.delay = getFunctionValue(params.delay, node.$el, node.index, node.total);+ node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.targets, null, null);+ node.delay = getFunctionValue(params.delay, node.$el, node.index, node.targets, null, null);}/**@@ -847,10 +849,12 @@ class LayoutSnapshot {const inRootNodeIds = new Set();// Update index and total for inital timing calculation- let index = 0, total = this.nodes.size;+ let index = 0;+ const allNodeTargets = [];+ this.nodes.forEach((node) => { allNodeTargets.push(node.$el); });this.nodes.forEach((node, id) => {node.index = index++;- node.total = total;+ node.targets = allNodeTargets;// Track ids of nodes that belong to the current root to filter detached matchesif (node && node.measuredIsInsideRoot) {inRootNodeIds.add(id);@@ -962,8 +966,8 @@ export class AutoLayout {this.params = params;/** @type {DOMTarget} */this.root = /** @type {DOMTarget} */(registerTargets(root)[0]);- /** @type {Number} */- this.id = layoutId++;+ /** @type {Number|String} */+ this.id = params.id || layoutId++;/** @type {LayoutChildrenParam} */this.children = params.children || '*';/** @type {Boolean} */@@ -1086,7 +1090,9 @@ export class AutoLayout {duration: setValue(params.duration, this.params.duration),}/** @type {TimelineParams} */- const tlParams = {};+ const tlParams = {+ id: this.id+ }const onComplete = setValue(params.onComplete, this.params.onComplete);const onPause = setValue(params.onPause, this.params.onPause);for (let name in defaults) {@@ -1100,7 +1106,8 @@ export class AutoLayout {}tlParams.onComplete = () => {const ap = /** @type {ScrollObserver} */(params.autoplay);- const isScrollControled = ap && ap.linked;+ const ed = globals.editor;+ const isScrollControled = (ap && ap.linked) || (ed && ed.showPanel);if (isScrollControled) {if (onComplete) onComplete(this.timeline);return;@@ -1299,41 +1306,39 @@ export class AutoLayout {animatedParent = animatedParent.parentNode;}- const animatingTotal = animating.length;-// Root is always animated first in sync with the first child (animating.length is the total of children)if (node === rootNode) {node.index = 0;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, animationTimings);} else if (node.isEntering) {node.index = animatedParent ? animatedParent.index : enteringIndex;- node.total = animatedParent ? animatingTotal : entering.length;+ node.targets = animatedParent ? animating : entering;updateNodeTimingParams(node, enterFromTimings);enteringIndex++;} else if (node.isLeaving) {node.index = animatedParent ? animatedParent.index : leavingIndex;- node.total = animatedParent ? animatingTotal : leaving.length;+ node.targets = animatedParent ? animating : leaving;leavingIndex++;updateNodeTimingParams(node, leaveToTimings);} else if (node.isTarget) {node.index = animatingIndex++;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, animationTimings);} else {node.index = animatedParent ? animatedParent.index : 0;- node.total = animatingTotal;+ node.targets = animating;updateNodeTimingParams(node, swapAtTimings);}// Make sure the old state node has its inex and total values up to date for valid "from" function values calculationoldStateNode.index = node.index;- oldStateNode.total = node.total;+ oldStateNode.targets = node.targets;// Computes all values up front so we can check for changes and we don't have to re-compute them inside the animation propsfor (let prop in nodeProperties) {- nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.total);- oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.total);+ nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.targets, null, null);+ oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.targets, null, null);}// Use a 1px tolerance to detect dimensions changes to prevent width / height animations on barelly visible elements@@ -1559,8 +1564,8 @@ export class AutoLayout {}$el.style.transform = oldState.getComputedValue($el, 'transform');if (animatedSwap.includes($el)) {- node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.total);- node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.total);+ node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.targets, null, null);+ node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.targets, null, null);}}this.transformAnimation = waapi.animate(transformed, {@@ -1575,7 +1580,7 @@ export class AutoLayout {if (!animatedSwap.includes($el)) return newValue;const oldValue = oldState.getComputedValue($el, 'transform');const node = newState.getNode($el);- return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]+ return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.targets, null, null), newValue]},autoplay: false,// persist: true,diff --git a/src/svg/morphto.js b/src/svg/morphto.jsindex e2d90720..e3b731b3 100644--- a/src/svg/morphto.js+++ b/src/svg/morphto.js@@ -1,7 +1,3 @@-import {- morphPointsSymbol,-} from '../core/consts.js';-import {round,} from '../core/helpers.js';@@ -22,7 +18,7 @@ import {* @param {Number} [precision]* @return {FunctionValue}*/-export const morphTo = (path2, precision = .33) => ($path1) => {+export const morphTo = (path2, precision = .33) => ($path1, index, total, prevTween) => {const tagName1 = ($path1.tagName || '').toLowerCase();if (!tagName1.match(/^(path|polygon|polyline)$/)) {throw new Error(`Can't morph a <${$path1.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);@@ -37,7 +33,7 @@ export const morphTo = (path2, precision = .33) => ($path1) => {}const isPath = $path1.tagName === 'path';const separator = isPath ? ' ' : ',';- const previousPoints = $path1[morphPointsSymbol];+ const previousPoints = prevTween ? prevTween._value : null;if (previousPoints) $path1.setAttribute(isPath ? 'd' : 'points', previousPoints);let v1 = '', v2 = '';@@ -59,7 +55,5 @@ export const morphTo = (path2, precision = .33) => ($path1) => {}}- $path1[morphPointsSymbol] = v2;-return [v1, v2];}diff --git a/src/text/index.js b/src/text/index.jsindex 5e8c649d..c613935c 100644--- a/src/text/index.js+++ b/src/text/index.js@@ -1 +1,2 @@-export * from './split.js';\ No newline at end of file+export * from './split.js';+export * from './scramble.js';\ No newline at end of filediff --git a/src/text/scramble.js b/src/text/scramble.jsnew file mode 100644index 00000000..e690b6f2--- /dev/null+++ b/src/text/scramble.js@@ -0,0 +1,276 @@+import {+ createSeededRandom,+} from '../utils/random.js';++import {+ globals,+} from '../core/globals.js';++import {+ round,+} from '../core/helpers.js';++import {+ parseEase,+} from '../easings/eases/parser.js';++import {+ noop,+} from '../core/consts.js';+++/**+ * @import {+ * ScrambleTextParams,+ * FunctionValue,+ * } from '../types/index.js'+*/++/**+ * '-' is the range operator; place it at the start or end of the string to use it as a literal (e.g. '-abc' or 'abc-')+ * @param {String} str+ * @return {String}+ */+const expandCharRanges = (str) => {+ let result = '';+ for (let i = 0, l = str.length; i < l; i++) {+ if (i + 2 < l && str[i + 1] === '-' && str.charCodeAt(i) < str.charCodeAt(i + 2)) {+ const start = str.charCodeAt(i);+ const end = str.charCodeAt(i + 2);+ for (let c = start; c <= end; c++) result += String.fromCharCode(c);+ i += 2;+ } else {+ result += str[i];+ }+ }+ return result;+}++const charSets = {+ lowercase: 'a-z',+ uppercase: 'A-Z',+ numbers: '0-9',+ symbols: '!%#_|*+=',+ braille: '⠀-⣿',+ blocks: '▀-▟',+ shades: '░-▓',+}++const originalTexts = new WeakMap();++/**+ * Returns a function-based tween value that scrambles the target's text content,+ * progressively revealing the original text.+ *+ * @param {ScrambleTextParams} [params]+ * @return {FunctionValue}+ */+export const scrambleText = (params = {}) => {+ if (!params) params = {};+ const charsParam = params.chars;+ const easeFn = parseEase(params.ease || 'linear');+ const text = params.text;+ const fromParam = params.from;+ const reversed = params.reversed || false;+ const perturbation = params.perturbation || 0;+ const cursorParam = params.cursor;+ const cursorChars = cursorParam === true ? '_'+ : typeof cursorParam === 'number' ? String.fromCharCode(cursorParam)+ : typeof cursorParam === 'string' ? cursorParam+ : '';+ const cursorLen = cursorChars.length;+ const seed = params.seed || 0;+ const override = params.override !== undefined ? params.override : true;+ const revealRate = params.revealRate || 60;+ const interval = 1000 * globals.timeScale / revealRate;+ const settleDuration = params.settleDuration || 300 * globals.timeScale;+ const settleRate = params.settleRate || 30;+ const durationParam = params.duration;+ const revealDelayParam = params.revealDelay;+ const delayParam = params.delay;+ const onChange = params.onChange || noop;++ return (target, index, targets, prevTween) => {+ const rawChars = typeof charsParam === 'function' ? charsParam(target, index, targets) : (charsParam || 'a-zA-Z0-9!%#_');+ const characters = expandCharRanges(charSets[rawChars] || rawChars);+ const totalChars = characters.length - 1;+ const duration = typeof durationParam === 'function' ? durationParam(target, index, targets) : durationParam;+ const revealDelay = typeof revealDelayParam === 'function' ? revealDelayParam(target, index, targets) : (revealDelayParam || 0);+ const delay = typeof delayParam === 'function' ? delayParam(target, index, targets) : (delayParam || 0);+ const rng = seed ? createSeededRandom(seed) : createSeededRandom();+ if (!originalTexts.has(target)) originalTexts.set(target, target.textContent);+ const startingText = prevTween ? prevTween._value : target.textContent;+ const targetText = text !== undefined+ ? (typeof text === 'function' ? text(target, index, targets) : text)+ : prevTween ? prevTween._value+ : originalTexts.get(target);+ const settledText = targetText === ' ' || targetText === ' ' ? ' ' : targetText;+ const startLength = startingText === ' ' ? 0 : startingText.length;+ const endLength = settledText.length;+ const overrideChars = override === true ? characters+ : typeof override === 'string' && override.length > 0 ? expandCharRanges(charSets[/** @type {String} */(override)] || /** @type {String} */(override))+ : null;+ const totalOverrideChars = overrideChars ? overrideChars.length - 1 : 0;+ // Space override uses so the browser doesn't collapse consecutive spaces in innerHTML+ const overrideChar = override === ' ' ? ' ' : null;+ // When starting from blank, only animate the target text length to avoid padding beyond it+ const animLength = override === '' ? endLength : Math.max(startLength, endLength);+ // Compute total duration from interval spacing and settle time, or use the explicit duration+ const animDuration = duration > 0 ? duration : (animLength - 1) * interval + settleDuration;+ const computedDuration = round((animDuration + revealDelay) / globals.timeScale, 0) * globals.timeScale;+ const revealDelayRatio = revealDelay > 0 ? round(revealDelay / computedDuration, 12) : 0;+ // Auto-resolve reveal direction: shrinking text reveals from right, growing from left+ const resolvedFrom = fromParam === undefined || fromParam === 'auto' ? (endLength < startLength ? 'right' : 'left') : fromParam;+ const charOrder = new Int32Array(animLength);+ if (resolvedFrom === 'random') {+ for (let i = 0; i < animLength; i++) charOrder[i] = i;+ for (let i = animLength - 1; i > 0; i--) {+ const j = rng(0, i);+ const t = charOrder[i]; charOrder[i] = charOrder[j]; charOrder[j] = t;+ }+ } else {+ const ref = resolvedFrom === 'right' ? (override === '' || !startLength ? animLength : startLength) - 1+ : resolvedFrom === 'center' ? ((override === '' || !startLength ? animLength : startLength) - 1) / 2+ : typeof resolvedFrom === 'number' ? resolvedFrom+ : 0;+ const abs = Math.abs;+ const indices = new Array(animLength);+ for (let i = 0; i < animLength; i++) indices[i] = i;+ indices.sort((a, b) => abs(a - ref) - abs(b - ref));+ for (let i = 0; i < animLength; i++) charOrder[indices[i]] = i;+ }+ if (reversed) {+ const last = animLength - 1;+ for (let i = 0; i < animLength; i++) charOrder[i] = last - charOrder[i];+ }+ // settleRatio is the fraction of the animation each character spends in the active scrambling zone+ const settleRatio = round(settleDuration / animDuration, 12);+ // settleSpacing is the time gap between consecutive characters entering the active zone+ const settleSpacing = round((1 - settleRatio) / animLength, 12);+ const cursorZone = cursorLen * settleSpacing;+ // stepRatio controls how often scramble characters refresh (based on settleRate)+ const stepRatio = round(1000 * globals.timeScale / (settleRate * computedDuration), 12);+ // Pre-compute per-character start and settle times+ const charStarts = new Float32Array(animLength);+ const charEnds = new Float32Array(animLength);+ const scale = perturbation > 0 ? perturbation * settleRatio : 0;+ for (let c = 0; c < animLength; c++) {+ const so = scale > 0 ? (rng(0, 2000) - 1000) / 1000 * scale : 0;+ const eo = scale > 0 ? (rng(0, 2000) - 1000) / 1000 * scale : 0;+ charStarts[c] = charOrder[c] * settleSpacing + so;+ charEnds[c] = Math.ceil((charStarts[c] + settleRatio + eo) / stepRatio) * stepRatio;+ }+ // When text shrinks with non-sequential from modes, delay target settle times past all extras+ if (endLength < animLength && resolvedFrom !== 'left' && resolvedFrom !== 'right' && resolvedFrom !== 'random') {+ let maxExtraEnd = 0;+ for (let c = endLength; c < animLength; c++) {+ if (charEnds[c] > maxExtraEnd) maxExtraEnd = charEnds[c];+ }+ const targets = new Array(endLength);+ for (let c = 0; c < endLength; c++) targets[c] = c;+ targets.sort((a, b) => charOrder[a] - charOrder[b]);+ const targetSpacing = (1 - maxExtraEnd) / endLength;+ for (let i = 0; i < endLength; i++) {+ const revealTime = maxExtraEnd + i * targetSpacing;+ if (revealTime > charEnds[targets[i]]) {+ charEnds[targets[i]] = revealTime;+ }+ }+ }+ // charCache holds the current scramble character for each position, refreshed at settleRate+ const charCache = new Array(animLength);+ for (let c = 0; c < animLength; c++) {+ charCache[c] = characters[rng(0, totalChars)];+ }+ // overrideCache holds scramble characters for the starting text (override: true or custom string)+ const overrideCache = overrideChars ? (overrideChars === characters ? charCache : new Array(animLength)) : null;+ if (overrideCache && overrideCache !== charCache) {+ for (let c = 0; c < animLength; c++) {+ overrideCache[c] = overrideChar || /** @type {String} */(overrideChars)[rng(0, overrideChars.length - 1)];+ }+ }+ // Build the initial display text based on override mode+ let fillStartText = startingText;+ if (!prevTween) {+ if (override === '') {+ fillStartText = '';+ } else if (overrideChars) {+ fillStartText = '';+ for (let c = 0; c < startLength; c++) {+ fillStartText += startingText[c] === ' ' ? ' ' : /** @type {Array<String>} */(overrideCache)[c];+ }+ }+ }++ let lastValue = -1;+ let lastStep = -1;+ let scrambled = '';+ const hasOverride = override !== '';+ const hasOverrideChars = !!overrideChars;+ const hasCursor = cursorLen > 0;++ return {+ from: 0,+ to: 1,+ duration: computedDuration,+ delay: delay,+ ease: 'linear',+ modifier: (v) => {+ if (v === lastValue) return scrambled;+ lastValue = v;+ if (delay > 0 && v <= 0) { scrambled = startingText; return startingText; }+ if (v <= 0) { scrambled = fillStartText; return fillStartText; }+ if (v >= 1) { scrambled = settledText; return settledText; }+ scrambled = '';+ // Only refresh scramble characters when we cross a settleRate step boundary+ const currentStep = (v / stepRatio) | 0;+ const refreshChars = currentStep !== lastStep;+ if (refreshChars) lastStep = currentStep;+ // Subtract delay ratio to get the effective animation progress+ const linear = revealDelayRatio > 0 ? (v - revealDelayRatio) / (1 - revealDelayRatio) : v;+ const t = linear > 0 ? easeFn(linear) : 0;+ for (let c = 0; c < animLength; c++) {+ // Each character has its own start/end window based on its reveal order+ const charStart = charStarts[c];+ const charEnd = charEnds[c];+ // Settled zone: character has finished its transition+ if (t >= charEnd) {+ if (c < endLength) scrambled += settledText[c];+ continue;+ }+ // Pre-transition zone: reveal wave hasn't reached this character yet+ if (t <= 0 || t < charStart) {+ if (hasOverride && c < startLength) {+ if (hasOverrideChars) {+ if (startingText[c] === ' ') {+ scrambled += ' ';+ } else {+ if (refreshChars) /** @type {Array<String>} */(overrideCache)[c] = overrideChar || /** @type {String} */(overrideChars)[rng(0, totalOverrideChars)];+ scrambled += /** @type {Array<String>} */(overrideCache)[c];+ }+ } else {+ // Default (override: false): show the original starting text+ scrambled += startingText[c];+ }+ }+ continue;+ }+ // Active zone: character is between charStart and charEnd+ const isSpace = (c < endLength && settledText[c] === ' ') || (c < startLength && startingText[c] === ' ');+ if (isSpace) {+ scrambled += ' ';+ } else if (hasCursor && t - charStart < cursorZone) {+ // Cursor sub-zone: show cursor character based on position within cursor width+ scrambled += cursorChars[cursorLen - 1 - (((t - charStart) / settleSpacing) | 0)];+ } else {+ // Scramble zone: show cycling random characters+ if (refreshChars) charCache[c] = characters[rng(0, totalChars)];+ scrambled += charCache[c];+ }+ }+ if (refreshChars) onChange(scrambled, t);+ return scrambled;+ }+ }+ }+}diff --git a/src/text/split.js b/src/text/split.jsindex 3e4ffa3f..c397e9ff 100644--- a/src/text/split.js+++ b/src/text/split.js@@ -211,7 +211,7 @@ const processHTMLTemplate = (htmlTemplate, store, node, $parentFragment, type, d*/export class TextSplitter {/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]*/constructor(target, parameters = {}) {@@ -283,11 +283,11 @@ export class TextSplitter {}/**- * @param {(...args: any[]) => Tickable | (() => void)} effect+ * @param {(...args: any[]) => Tickable | (() => void) | void} effect* @return this*/addEffect(effect) {- if (!isFnc(effect)) return console.warn('Effect must return a function.');+ if (!isFnc(effect)) { console.warn('Effect must return a function.'); return this; }const refreshableEffect = keepTime(effect);this.effects.push(refreshableEffect);if (this.ready) this.effectsCleanups[this.effects.length - 1] = refreshableEffect(this);@@ -493,7 +493,7 @@ export class TextSplitter {}/**- * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target+ * @param {Element|NodeList|String|Array<Element>} target* @param {TextSplitterParams} [parameters]* @return {TextSplitter}*/diff --git a/src/timeline/timeline.js b/src/timeline/timeline.jsindex 695cdc86..5c23d5fe 100644--- a/src/timeline/timeline.js+++ b/src/timeline/timeline.js@@ -34,8 +34,8 @@ import {} from '../core/render.js';import {- cleanInlineStyles,-} from '../utils/target.js';+ revertValues,+} from '../core/styles.js';import {Timer,@@ -70,6 +70,7 @@ import {* DefaultsParams,* TimelinePosition,* StaggerFunction,+ * TargetsArray,* } from '../types/index.js'*/@@ -79,6 +80,8 @@ import {* } from '../waapi/waapi.js'*/+/** @import {TweakRegister} from 'tweaks' */+/*** @param {Timeline} tl* @return {Number}@@ -100,7 +103,7 @@ function getTimelineTotalDuration(tl) {* @param {Number} timePosition* @param {TargetsParam} targets* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [allTargets]* @return {Timeline}** @param {TimerParams|AnimationParams} childParams@@ -108,15 +111,15 @@ function getTimelineTotalDuration(tl) {* @param {Number} timePosition* @param {TargetsParam} [targets]* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [allTargets]*/-function addTlChild(childParams, tl, timePosition, targets, index, length) {+function addTlChild(childParams, tl, timePosition, targets, index, allTargets) {const isSetter = isNum(childParams.duration) && /** @type {Number} */(childParams.duration) <= minValue;// Offset the tl position with -minValue for 0 duration animations or .set() calls in order to align their end value with the defined positionconst adjustedPosition = isSetter ? timePosition - minValue : timePosition;if (tl.composition) tick(tl, adjustedPosition, 1, 1, tickModes.AUTO);const tlChild = targets ?- new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, length) :+ new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, allTargets) :new Timer(/** @type {TimerParams} */(childParams), tl, adjustedPosition);if (tl.composition) tlChild.init(true);// TODO: Might be better to insert at a position relative to startTime?@@ -164,7 +167,7 @@ export class Timeline extends Timer {* @overload* @param {TargetsParam} a1* @param {AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]* @return {this}** @overload@@ -174,7 +177,7 @@ export class Timeline extends Timer {** @param {TargetsParam|TimerParams} a1* @param {TimelinePosition|AnimationParams} a2- * @param {TimelinePosition|StaggerFunction<Number|String>} [a3]+ * @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [a3]*/add(a1, a2, a3) {const isAnim = isObj(a2);@@ -183,9 +186,11 @@ export class Timeline extends Timer {this._hasChildren = true;if (isAnim) {const childParams = /** @type {AnimationParams} */(a2);- // Check for function for children stagger positions- if (isFnc(a3)) {- const staggeredPosition = a3;+ const editorHook = globals.editor && globals.editor.addTimelineChild;+ const isStaggerType = a3 && /** @type {TweakRegister} */(a3).type === 'Stagger' && globals.editor;+ // Check for function or Stagger type children positions+ const staggeredPosition = isFnc(a3) ? a3 : null;+ if (staggeredPosition || isStaggerType) {const parsedTargetsArray = parseTargets(/** @type {TargetsParam} */(a1));// Store initial duration before adding new children that will change the durationconst tlDuration = this.duration;@@ -196,28 +201,36 @@ export class Timeline extends Timer {let i = 0;/** @type {Number} */const parsedLength = (parsedTargetsArray.length);+ // Call editor hook once for the entire stagger group instead of per target+ const resolvedParams = editorHook ? editorHook(/** @type {TargetsParam} */(a1), childParams, this.id, a3, parsedLength) : null;+ // Resolve stagger AFTER editor hook so tweaked position value (a3.defaultValue) is used+ const staggerFn = staggeredPosition || globals.editor.resolveStagger(/** @type {TweakRegister} */(a3).defaultValue);parsedTargetsArray.forEach((/** @type {Target} */target) => {// Create a new parameter object for each staggered children- const staggeredChildParams = { ...childParams };+ const staggeredChildParams = { ...(resolvedParams || childParams) };// Reset the duration of the timeline iteration before each stagger to prevent wrong start value calculationthis.duration = tlDuration;this.iterationDuration = tlIterationDuration;if (!isUnd(id)) staggeredChildParams.id = id + '-' + i;+ const staggeredTimePosition = parseTimelinePosition(this, staggerFn(target, i, parsedTargetsArray, null, this));addTlChild(staggeredChildParams,this,- parseTimelinePosition(this, staggeredPosition(target, i, parsedLength, this)),+ staggeredTimePosition,target,i,- parsedLength+ parsedTargetsArray,);i++;});} else {+ // Call editor hook before resolving position so tweaked values are applied+ const resolvedChildParams = editorHook ? editorHook(/** @type {TargetsParam} */(a1), childParams, this.id, a3) : childParams;+ const resolvedPosition = a3 && /** @type {*} */(a3).type ? /** @type {*} */(a3).defaultValue : a3;addTlChild(- childParams,+ resolvedChildParams,this,- parseTimelinePosition(this, a3),+ parseTimelinePosition(this, resolvedPosition),/** @type {TargetsParam} */(a1),);}@@ -339,7 +352,7 @@ export class Timeline extends Timer {revert() {super.revert();forEachChildren(this, (/** @type {JSAnimation|Timer} */child) => child.revert, true);- return cleanInlineStyles(this);+ return revertValues(this);}/**@@ -359,4 +372,9 @@ export class Timeline extends Timer {* @param {TimelineParams} [parameters]* @return {Timeline}*/-export const createTimeline = parameters => new Timeline(parameters).init();+export const createTimeline = parameters => {+ if (globals.editor) {+ return /** @type {Timeline} */(/** @type {unknown} */(globals.editor.addTimeline(parameters)));+ }+ return new Timeline(parameters).init();+};diff --git a/src/timer/timer.js b/src/timer/timer.jsindex 0949a951..ae775600 100644--- a/src/timer/timer.js+++ b/src/timer/timer.js@@ -22,7 +22,6 @@ import {import {scope,globals,- devTools,} from '../core/globals.js';import {@@ -100,6 +99,9 @@ const reviveTimer = timer => {let timerId = 0;+/** @param {Timer} prev @param {Timer} child */+const sortByPriority = (prev, child) => prev._priority > child._priority;+/*** Base class used to create Timers, Animations and Timelines*/@@ -126,6 +128,7 @@ export class Timer extends Clock {autoplay,frameRate,playbackRate,+ priority,onComplete,onLoop,onPause,@@ -147,16 +150,6 @@ export class Timer extends Clock {/** @type {Number} */(timerLoop) < 0 ? Infinity :/** @type {Number} */(timerLoop) + 1;- if (devTools) {- const isInfinite = timerIterationCount === Infinity;- const registered = devTools.register(this, parameters, isInfinite);- if (registered && isInfinite) {- const minIterations = alternate ? 2 : 1;- const iterations = parent ? devTools.maxNestedInfiniteLoops : devTools.maxInfiniteLoops;- timerIterationCount = Math.max(iterations, minIterations);- }- }-let offsetPosition = 0;if (parent) {@@ -240,6 +233,8 @@ export class Timer extends Clock {this._fps = setValue(frameRate, timerDefaults.frameRate);/** @type {Number} */this._speed = setValue(playbackRate, timerDefaults.playbackRate);+ /** @type {Number} */+ this._priority = +setValue(priority, 1);}get cancelled() {@@ -384,7 +379,7 @@ export class Timer extends Clock {tick(this, minValue, 0, 0, tickModes.FORCE);} else {if (!this._running) {- addChild(engine, this);+ addChild(engine, this, sortByPriority);engine._hasChildren = true;this._running = true;}diff --git a/src/types/index.js b/src/types/index.jsindex 75717650..71def3ab 100644--- a/src/types/index.js+++ b/src/types/index.js@@ -5,6 +5,7 @@ export {}// Private types/**+ * @import { TweakRegister } from 'tweaks';* @import { ScrollObserver } from '../events/scroll.js';* @import { JSAnimation } from '../animation/animation.js';* @import { Animatable } from '../animatable/animatable.js';@@ -62,7 +63,8 @@ export {}* @callback StaggerFunction* @param {Target} [target]* @param {Number} [index]- * @param {Number} [length]+ * @param {TargetsArray} [targets]+ * @param {Tween|null} [prevTween]* @param {Timeline} [tl]* @return {T}*/@@ -70,9 +72,9 @@ export {}/*** @typedef {Object} StaggerParams* @property {Number|String} [start]- * @property {Number|'first'|'center'|'last'|'random'} [from]+ * @property {Number|'first'|'center'|'last'|'random'|Array.<Number>} [from]* @property {Boolean} [reversed]- * @property {Array.<Number>} [grid]+ * @property {Array.<Number>|Boolean} [grid]* @property {('x'|'y')} [axis]* @property {String|((target: Target, i: Number, length: Number) => Number)} [use]* @property {Number} [total]@@ -133,8 +135,8 @@ export {}// A hack to get both ease names suggestions AND allow any strings// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-460346421-/** @typedef {(String & {})|EaseStringParamNames|EasingFunction|Spring} EasingParam */-/** @typedef {(String & {})|EaseStringParamNames|WAAPIEaseStringParamNames|EasingFunction|Spring} WAAPIEasingParam */+/** @typedef {(String & {})|EaseStringParamNames|EasingFunction|Spring|TweakRegister} EasingParam */+/** @typedef {(String & {})|EaseStringParamNames|WAAPIEaseStringParamNames|EasingFunction|Spring|TweakRegister} WAAPIEasingParam */// Spring types@@ -190,6 +192,7 @@ export {}* @property {Boolean|ScrollObserver} [autoplay]* @property {Number} [frameRate]* @property {Number} [playbackRate]+ * @property {Number} [priority]*//**@@ -200,9 +203,10 @@ export {}/*** @callback FunctionValue- * @param {Target} target - The animated target- * @param {Number} index - The target index- * @param {Number} length - The total number of animated targets+ * @param {Target} [target] - The animated target+ * @param {Number} [index] - The target index+ * @param {TargetsArray} [targets] - The array of all animated targets+ * @param {Tween|null} [prevTween] - The previous sibling tween for the same target and property* @return {Number|String|TweenObjectValue|EasingParam|Array.<Number|String|TweenObjectValue>}*/@@ -371,7 +375,7 @@ export {}* - `'label'` - Label: Position animation at a named label position (e.g., `'My Label'`)<br>* - `stagger(String|Nummber)` - Stagger multi-elements animation positions (e.g., 10, 20, 30...)*- * @typedef {TimelinePosition | StaggerFunction<Number|String>} TimelineAnimationPosition+ * @typedef {TimelinePosition | StaggerFunction<Number|String> | TweakRegister} TimelineAnimationPosition*//**@@ -395,7 +399,7 @@ export {}* @callback WAAPIFunctionValue* @param {DOMTarget} target - The animated target* @param {Number} index - The target index- * @param {Number} length - The total number of animated targets+ * @param {DOMTargetsArray} targets - The array of all animated targets* @return {WAAPITweenValue|WAAPIEasingParam}*/@@ -642,6 +646,26 @@ export {}* @property {Boolean} [debug]*/+/**+ * @typedef {Object} ScrambleTextParams+ * @property {String|function(Target, Number, TargetsArray): String} [text] - the text to transition to, otherwise uses the original text+ * @property {String|function(Target, Number, TargetsArray): String} [chars] - the characters used for scramble; named sets: 'lowercase', 'uppercase', 'numbers', 'symbols', 'braille', 'blocks', 'shades'; range syntax: 'A-Z', 'a-z0-9'; defaults to 'a-zA-Z0-9!%#_'+ * @property {EasingParam} [ease] - the easing applied to the scramble animation+ * @property {Number|'left'|'center'|'right'|'random'|'auto'} [from] - where the reveal wave starts from, 'auto' (default) uses 'left' when text grows and 'right' when it shrinks+ * @property {Boolean} [reversed] - reverses the reveal order, so 'center' reveals from edges inward instead of center outward+ * @property {Boolean|Number|String} [cursor] - characters displayed at the leading edge of the reveal wave; true uses '_', a number is a char code, a string is used directly+ * @property {Number} [perturbation] - adds random timing offsets to each character's start and end, creating a more organic reveal+ * @property {Number} [seed] - a seed for the random number generator to produce reproducible scramble sequences+ * @property {Boolean|String} [override] - controls the starting appearance: false shows original text, true scrambles it (default), '' starts from blank, ' ' replaces characters with spaces, a custom string (supports range syntax like 'A-Z') uses its characters as scramble set+ * @property {Number} [revealRate] - characters per second entering the active zone; higher values make the reveal wave move faster (default: 60)+ * @property {Number} [settleDuration] - time in ms each character spends scrambling before settling into its final glyph (default: 300)+ * @property {Number} [settleRate] - how many times per second scramble characters cycle in the active zone (default: 30)+ * @property {Number|function(Target, Number, TargetsArray): Number} [duration] - if set to a value greater than 0, overrides the computed duration from interval and settle; if unset or 0, duration is calculated automatically from text length and timing parameters+ * @property {Number|function(Target, Number, TargetsArray): Number} [revealDelay] - delay in ms before the reveal wave starts within the scramble animation+ * @property {Number|function(Target, Number, TargetsArray): Number} [delay] - delay in ms before the entire scramble animation starts+ * @property {function(String, Number): void} [onChange] - callback fired each time a character changes during scramble; receives the current scrambled text and the eased progress (0-1)+ */+// SVG types/**diff --git a/src/utils/chainable.js b/src/utils/chainable.jsindex 453dfed1..afe71a58 100644--- a/src/utils/chainable.js+++ b/src/utils/chainable.js@@ -30,10 +30,13 @@ const chain = fn => {const result = fn(...args);return new Proxy(noop, {apply: (_, __, [v]) => result(v),- get: (_, prop) => chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {- const nextResult = chainables[prop](...nextArgs);- return (/**@type {Number|String} */v) => nextResult(result(v));- })+ get: (_, prop) => {+ if (!chainables[prop]) return undefined;+ return chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {+ const nextResult = chainables[prop](...nextArgs);+ return (/**@type {Number|String} */v) => nextResult(result(v));+ })+ }});}}diff --git a/src/utils/index.js b/src/utils/index.jsindex 3229c0eb..db509d5d 100644--- a/src/utils/index.js+++ b/src/utils/index.js@@ -2,4 +2,5 @@ export * from './chainable.js';export * from './random.js';export * from './time.js';export * from './target.js';-export * from './stagger.js';\ No newline at end of file+export * from './stagger.js';+export { forEachChildren, addChild, removeChild } from '../core/helpers.js';\ No newline at end of filediff --git a/src/utils/stagger.js b/src/utils/stagger.jsindex 301e69b9..46f2d59b 100644--- a/src/utils/stagger.js+++ b/src/utils/stagger.js@@ -41,6 +41,7 @@ import {* @import {* StaggerParams,* StaggerFunction,+ * JSTarget,* } from '../types/index.js'*/@@ -56,24 +57,28 @@ import {* @param {StaggerParams} [params]* @return {StaggerFunction<Number>}*/+/*** @overload* @param {String} val* @param {StaggerParams} [params]* @return {StaggerFunction<String>}*/+/*** @overload* @param {[Number, Number]} val* @param {StaggerParams} [params]* @return {StaggerFunction<Number>}*/+/*** @overload* @param {[String, String]} val* @param {StaggerParams} [params]* @return {StaggerFunction<String>}*/+/*** @param {Number|String|[Number, Number]|[String, String]} val The staggered value or range* @param {StaggerParams} [params] The stagger parameters@@ -82,6 +87,7 @@ import {export const stagger = (val, params = {}) => {let values = [];let maxValue = 0;+ let cachedOffset;const from = params.from;const reversed = params.reversed;const ease = params.ease;@@ -89,12 +95,14 @@ export const stagger = (val, params = {}) => {const hasSpring = hasEasing && !isUnd(/** @type {Spring} */(ease).ease);const staggerEase = hasSpring ? /** @type {Spring} */(ease).ease : hasEasing ? parseEase(ease) : null;const grid = params.grid;+ const autoGrid = grid === true;const axis = params.axis;const customTotal = params.total;const fromFirst = isUnd(from) || from === 0 || from === 'first';const fromCenter = from === 'center';const fromLast = from === 'last';const fromRandom = from === 'random';+ const fromArr = isArr(from);const isRange = isArr(val);const useProp = params.use;const val1 = isRange ? parseNumber(val[0]) : parseNumber(val);@@ -102,40 +110,129 @@ export const stagger = (val, params = {}) => {const unitMatch = unitsExecRgx.exec((isRange ? val[1] : val) + emptyString);const start = params.start || 0 + (isRange ? val1 : 0);let fromIndex = fromFirst ? 0 : isNum(from) ? from : 0;- return (target, i, t, tl) => {+ return (target, i, t, _, tl) => {const [ registeredTarget ] = registerTargets(target);- const total = isUnd(customTotal) ? t : customTotal;+ const total = isUnd(customTotal) ? t.length : customTotal;const customIndex = !isUnd(useProp) ? isFnc(useProp) ? useProp(registeredTarget, i, total) : getOriginalAnimatableValue(registeredTarget, useProp) : false;const staggerIndex = isNum(customIndex) || isStr(customIndex) && isNum(+customIndex) ? +customIndex : i;if (fromCenter) fromIndex = (total - 1) / 2;if (fromLast) fromIndex = total - 1;if (!values.length) {- for (let index = 0; index < total; index++) {- if (!grid) {- values.push(abs(fromIndex - index));+ if (autoGrid) {+ let hasPositions = true;+ let minPosX = Infinity;+ let minPosY = Infinity;+ let maxPosX = -Infinity;+ let maxPosY = -Infinity;+ const pxArr = [];+ const pyArr = [];+ for (let index = 0; index < total; index++) {+ const el = t[index];+ let px = 0;+ let py = 0;+ let found = false;+ if (el && isFnc(el.getBoundingClientRect)) {+ const rect = el.getBoundingClientRect();+ px = rect.left + rect.width / 2;+ py = rect.top + rect.height / 2;+ found = true;+ } else {+ const obj = /** @type {JSTarget} */(el);+ if (obj && isNum(obj.x) && isNum(obj.y)) {+ px = obj.x;+ py = obj.y;+ found = true;+ }+ }+ if (!found) {+ hasPositions = false;+ break;+ }+ pxArr.push(px);+ pyArr.push(py);+ if (px < minPosX) minPosX = px;+ if (py < minPosY) minPosY = py;+ if (px > maxPosX) maxPosX = px;+ if (py > maxPosY) maxPosY = py;+ }+ if (hasPositions) {+ let fX = pxArr[0];+ let fY = pyArr[0];+ if (fromArr) {+ fX = minPosX + from[0] * (maxPosX - minPosX);+ fY = minPosY + from[1] * (maxPosY - minPosY);+ } else if (fromCenter) {+ fX = (minPosX + maxPosX) / 2;+ fY = (minPosY + maxPosY) / 2;+ } else if (fromLast) {+ fX = pxArr[total - 1];+ fY = pyArr[total - 1];+ } else if (isNum(from)) {+ fX = pxArr[from];+ fY = pyArr[from];+ }+ for (let index = 0; index < total; index++) {+ const distanceX = fX - pxArr[index];+ const distanceY = fY - pyArr[index];+ let value = sqrt(distanceX * distanceX + distanceY * distanceY);+ if (axis === 'x') value = -distanceX;+ if (axis === 'y') value = -distanceY;+ values.push(value);+ }+ let minDist = Infinity;+ for (let index = 0, l = values.length; index < l; index++) {+ const absVal = abs(values[index]);+ if (absVal > 0 && absVal < minDist) minDist = absVal;+ }+ if (minDist > 0 && minDist < Infinity) {+ for (let index = 0, l = values.length; index < l; index++) {+ values[index] = values[index] / minDist;+ }+ }} else {- const fromX = !fromCenter ? fromIndex % grid[0] : (grid[0] - 1) / 2;- const fromY = !fromCenter ? floor(fromIndex / grid[0]) : (grid[1] - 1) / 2;- const toX = index % grid[0];- const toY = floor(index / grid[0]);- const distanceX = fromX - toX;- const distanceY = fromY - toY;- let value = sqrt(distanceX * distanceX + distanceY * distanceY);- if (axis === 'x') value = -distanceX;- if (axis === 'y') value = -distanceY;- values.push(value);+ for (let index = 0; index < total; index++) {+ values.push(abs(fromIndex - index));+ }+ }+ } else {+ for (let index = 0; index < total; index++) {+ if (!grid) {+ values.push(abs(fromIndex - index));+ } else {+ let fromX, fromY;+ if (fromArr) {+ fromX = from[0] * (grid[0] - 1);+ fromY = from[1] * (grid[1] - 1);+ } else if (fromCenter) {+ fromX = (grid[0] - 1) / 2;+ fromY = (grid[1] - 1) / 2;+ } else {+ fromX = fromIndex % grid[0];+ fromY = floor(fromIndex / grid[0]);+ }+ const toX = index % grid[0];+ const toY = floor(index / grid[0]);+ const distanceX = fromX - toX;+ const distanceY = fromY - toY;+ let value = sqrt(distanceX * distanceX + distanceY * distanceY);+ if (axis === 'x') value = -distanceX;+ if (axis === 'y') value = -distanceY;+ values.push(value);+ }}- maxValue = max(...values);}+ maxValue = max(...values);if (staggerEase) values = values.map(val => staggerEase(val / maxValue) * maxValue);if (reversed) values = values.map(val => axis ? (val < 0) ? val * -1 : -val : abs(maxValue - val));if (fromRandom) values = shuffle(values);}const spacing = isRange ? (val2 - val1) / maxValue : val1;- const offset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);+ if (isUnd(cachedOffset)) {+ cachedOffset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);+ }/** @type {String|Number} */- let output = offset + ((spacing * round(values[staggerIndex], 2)) || 0);- if (params.modifier) output = params.modifier(output);+ let output = cachedOffset + ((spacing * round(values[staggerIndex], 2)) || 0);+ if (params.modifier) output = params.modifier(/** @type {Number} */(output));if (unitMatch) output = `${output}${unitMatch[2]}`;return output;}diff --git a/src/utils/time.js b/src/utils/time.jsindex 8e3b6f8b..1f96b92c 100644--- a/src/utils/time.js+++ b/src/utils/time.js@@ -31,19 +31,20 @@ export const sync = (callback = noop) => {}/**- * @param {(...args: any[]) => Tickable | ((...args: any[]) => void)} constructor+ * @param {(...args: any[]) => Tickable | ((...args: any[]) => void) | void} constructor* @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}*/export const keepTime = constructor => {/** @type {Tickable} */let tracked;return (...args) => {- let currentIteration, currentIterationProgress, reversed, alternate;+ let currentIteration, currentIterationProgress, reversed, alternate, startTime;if (tracked) {currentIteration = tracked.currentIteration;currentIterationProgress = tracked.iterationProgress;reversed = tracked.reversed;alternate = tracked._alternate;+ startTime = tracked._startTime;tracked.revert();}const cleanup = constructor(...args);@@ -51,6 +52,7 @@ export const keepTime = constructor => {if (!isUnd(currentIterationProgress)) {/** @type {Tickable} */(tracked).currentIteration = currentIteration;/** @type {Tickable} */(tracked).iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;+ /** @type {Tickable} */(tracked)._startTime = startTime;}return cleanup || noop;}diff --git a/src/waapi/waapi.js b/src/waapi/waapi.jsindex 98081159..6d1b26ce 100644--- a/src/waapi/waapi.js+++ b/src/waapi/waapi.js@@ -149,12 +149,12 @@ let transformsPropertiesRegistered = null;* @param {WAAPIKeyframeValue} value* @param {DOMTarget} $el* @param {Number} i- * @param {Number} targetsLength+ * @param {DOMTargetsArray} parsedTargets* @return {String}*/-const normalizeTweenValue = (propName, value, $el, i, targetsLength) => {+const normalizeTweenValue = (propName, value, $el, i, parsedTargets) => {// Do not try to compute strings with getFunctionValue otherwise it will convert CSS variables- let v = isStr(value) ? value : getFunctionValue(/** @type {any} */(value), $el, i, targetsLength);+ let v = isStr(value) ? value : getFunctionValue(/** @type {any} */(value), $el, i, parsedTargets, null, null);if (!isNum(v)) return v;if (commonDefaultPXProperties.includes(propName) || stringStartsWith(propName, 'translate')) return `${v}px`;if (stringStartsWith(propName, 'rotate') || stringStartsWith(propName, 'skew')) return `${v}deg`;@@ -167,18 +167,18 @@ const normalizeTweenValue = (propName, value, $el, i, targetsLength) => {* @param {WAAPIKeyframeValue} from* @param {WAAPIKeyframeValue} to* @param {Number} i- * @param {Number} targetsLength+ * @param {DOMTargetsArray} parsedTargets* @return {WAAPITweenValue}*/-const parseIndividualTweenValue = ($el, propName, from, to, i, targetsLength) => {+const parseIndividualTweenValue = ($el, propName, from, to, i, parsedTargets) => {/** @type {WAAPITweenValue} */let tweenValue = '0';- const computedTo = !isUnd(to) ? normalizeTweenValue(propName, to, $el, i, targetsLength) : getComputedStyle($el)[propName];+ const computedTo = !isUnd(to) ? normalizeTweenValue(propName, to, $el, i, parsedTargets) : getComputedStyle($el)[propName];if (!isUnd(from)) {- const computedFrom = normalizeTweenValue(propName, from, $el, i, targetsLength);+ const computedFrom = normalizeTweenValue(propName, from, $el, i, parsedTargets);tweenValue = [computedFrom, computedTo];} else {- tweenValue = isArr(to) ? to.map((/** @type {any} */v) => normalizeTweenValue(propName, v, $el, i, targetsLength)) : computedTo;+ tweenValue = isArr(to) ? to.map((/** @type {any} */v) => normalizeTweenValue(propName, v, $el, i, parsedTargets)) : computedTo;}return tweenValue;}@@ -218,9 +218,8 @@ export class WAAPIAnimation {}const parsedTargets = registerTargets(targets);- const targetsLength = parsedTargets.length;- if (!targetsLength) {+ if (!parsedTargets.length) {console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);}@@ -276,7 +275,7 @@ export class WAAPIAnimation {const easeToParse = setValue(params.ease, globals.defaults.ease);- const easeFunctionResult = getFunctionValue(easeToParse, $el, i, targetsLength);+ const easeFunctionResult = getFunctionValue(easeToParse, $el, i, parsedTargets, null, null);const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;const spring = /** @type {Spring} */(easeToParse).ease && easeToParse;@@ -284,9 +283,9 @@ export class WAAPIAnimation {const easing = parseWAAPIEasing(keyEasing);/** @type {Number} */- const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, targetsLength)) * timeScale;+ const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, parsedTargets, null, null)) * timeScale;/** @type {Number} */- const delay = getFunctionValue(setValue(params.delay, globals.defaults.delay), $el, i, targetsLength) * timeScale;+ const delay = getFunctionValue(setValue(params.delay, globals.defaults.delay), $el, i, parsedTargets, null, null) * timeScale;/** @type {CompositeOperation} */const composite = /** @type {CompositeOperation} */(setValue(params.composition, 'replace'));@@ -312,19 +311,19 @@ export class WAAPIAnimation {const to = /** @type {WAAPITweenOptions} */(tweenOptions).to;const from = /** @type {WAAPITweenOptions} */(tweenOptions).from;/** @type {Number} */- tweenParams.duration = (tweenOptionsSpring ? /** @type {Spring} */(tweenOptionsSpring).settlingDuration : getFunctionValue(setValue(tweenOptions.duration, duration), $el, i, targetsLength)) * timeScale;+ tweenParams.duration = (tweenOptionsSpring ? /** @type {Spring} */(tweenOptionsSpring).settlingDuration : getFunctionValue(setValue(tweenOptions.duration, duration), $el, i, parsedTargets, null, null)) * timeScale;/** @type {Number} */- tweenParams.delay = getFunctionValue(setValue(tweenOptions.delay, delay), $el, i, targetsLength) * timeScale;+ tweenParams.delay = getFunctionValue(setValue(tweenOptions.delay, delay), $el, i, parsedTargets, null, null) * timeScale;/** @type {CompositeOperation} */tweenParams.composite = /** @type {CompositeOperation} */(setValue(tweenOptions.composition, composite));/** @type {String} */tweenParams.easing = parseWAAPIEasing(tweenOptionsEase);- parsedPropertyValue = parseIndividualTweenValue($el, name, from, to, i, targetsLength);+ parsedPropertyValue = parseIndividualTweenValue($el, name, from, to, i, parsedTargets);if (individualTransformProperty) {keyframes[`--${individualTransformProperty}`] = parsedPropertyValue;cachedTransforms[individualTransformProperty] = parsedPropertyValue;} else {- keyframes[name] = parseIndividualTweenValue($el, name, from, to, i, targetsLength);+ keyframes[name] = parseIndividualTweenValue($el, name, from, to, i, parsedTargets);}addWAAPIAnimation(this, $el, name, keyframes, tweenParams);if (!isUnd(from)) {@@ -337,8 +336,8 @@ export class WAAPIAnimation {}} else {parsedPropertyValue = isArr(propertyValue) ?- propertyValue.map((/** @type {any} */v) => normalizeTweenValue(name, v, $el, i, targetsLength)) :- normalizeTweenValue(name, /** @type {any} */(propertyValue), $el, i, targetsLength);+ propertyValue.map((/** @type {any} */v) => normalizeTweenValue(name, v, $el, i, parsedTargets)) :+ normalizeTweenValue(name, /** @type {any} */(propertyValue), $el, i, parsedTargets);if (individualTransformProperty) {keyframes[`--${individualTransformProperty}`] = parsedPropertyValue;cachedTransforms[individualTransformProperty] = parsedPropertyValue;diff --git a/tests/playground/additive-animations-2.html b/tests/playground/additive-animations-2.htmlindex 85d79fcf..5b9bda21 100644--- a/tests/playground/additive-animations-2.html+++ b/tests/playground/additive-animations-2.html@@ -25,7 +25,7 @@left: 0;width: 100%;height: 100%;- color: var(--red);+ color: var(--red-1);}.ball {--diam: 100px;diff --git a/tests/playground/draggables/callbacks/index.html b/tests/playground/draggables/callbacks/index.htmlindex b7a1987c..7ed965c9 100644--- a/tests/playground/draggables/callbacks/index.html+++ b/tests/playground/draggables/callbacks/index.html@@ -30,7 +30,7 @@z-index: 1;width: 50dvw;height: 50dvh;- border: 1px solid var(--red);+ border: 1px solid var(--red-1);}.draggable {display: flex;@@ -38,7 +38,7 @@align-items: center;width: 4rem;height: 4rem;- background-color: var(--red);+ background-color: var(--red-1);}</style></head>diff --git a/tests/playground/keyframes/index.html b/tests/playground/keyframes/index.htmlindex dce0f92f..8c41ccef 100644--- a/tests/playground/keyframes/index.html+++ b/tests/playground/keyframes/index.html@@ -53,7 +53,7 @@}.css {- background-color: var(--yellow);+ background-color: var(--yellow-1);}.css.is-animated {@@ -65,7 +65,7 @@}.anime {- background-color: var(--red);+ background-color: var(--red-1);}</style></head>diff --git a/tests/playground/layout/index.html b/tests/playground/layout/index.htmlindex 930d41b2..b9ed00b0 100644--- a/tests/playground/layout/index.html+++ b/tests/playground/layout/index.html@@ -260,7 +260,7 @@</div><div class="demo"><div class="container absolute vertical">- <div class="child">A direct <span>child</span>element. <div class="sub-child"> And a <strong>sub child</strong> element</div></div>+ <div class="child">A direct <span>child</span> element. <div class="sub-child"> And a <strong>sub child</strong> element</div></div><div class="child">A direct <span>child</span> element. <div class="sub-child"> And a <span>sub child</span> element</div></div></div></div>diff --git a/tests/playground/layout/index.js b/tests/playground/layout/index.jsindex 802a0399..13021549 100644--- a/tests/playground/layout/index.js+++ b/tests/playground/layout/index.js@@ -323,15 +323,15 @@ const tests = [delay: stagger(200),enterFrom: {opacity: 0,- innerHTML: (_, i, t) => `enter: ${i}, ${t}`,+ innerHTML: (_, i, targets) => `enter: ${i}, ${targets.length}`,},leaveTo: {opacity: 0,- innerHTML: (_, i, t) => `leave: ${i}, ${t}`,+ innerHTML: (_, i, targets) => `leave: ${i}, ${targets.length}`,},swapAt: {opacity: 0,- innerHTML: (_, i, t) => `swap: ${i}, ${t}`,+ innerHTML: (_, i, targets) => `swap: ${i}, ${targets.length}`,}});data.$button.addEventListener('click', () => {diff --git a/tests/playground/lerp/index.html b/tests/playground/lerp/index.htmlindex 934596b8..d2bea8ee 100644--- a/tests/playground/lerp/index.html+++ b/tests/playground/lerp/index.html@@ -28,7 +28,7 @@.square {width: 100px;height: 100px;- background: var(--red);+ background: var(--red-1);border-radius: 1rem;padding: 1rem;}diff --git a/tests/playground/onscroll/assets/onscroll.css b/tests/playground/onscroll/assets/onscroll.cssindex dbf611b0..4224e094 100644--- a/tests/playground/onscroll/assets/onscroll.css+++ b/tests/playground/onscroll/assets/onscroll.css@@ -4,8 +4,8 @@ section {align-items: center;width: 100%;min-height: 100lvh;- border-top: 1px dotted var(--red);- border-bottom: 1px dotted var(--red);+ border-top: 1px dotted var(--red-1);+ border-bottom: 1px dotted var(--red-1);}section.spacer {diff --git a/tests/playground/onscroll/debug.html b/tests/playground/onscroll/debug.htmlindex 2313196a..b29058df 100644--- a/tests/playground/onscroll/debug.html+++ b/tests/playground/onscroll/debug.html@@ -44,7 +44,7 @@.target {width: 100px;height: 100px;- background: var(--red);+ background: var(--red-1);}</style></head>diff --git a/tests/playground/onscroll/sticky-snap.html b/tests/playground/onscroll/sticky-snap.htmlindex 2e3cb8d5..54e6c625 100644--- a/tests/playground/onscroll/sticky-snap.html+++ b/tests/playground/onscroll/sticky-snap.html@@ -21,7 +21,7 @@height: calc(100vh - 1px);scroll-snap-align: start;scroll-snap-stop: always;- border: 1px dotted var(--red);+ border: 1px dotted var(--red-1);}.half {width: 50%;diff --git a/tests/playground/scope/index.html b/tests/playground/scope/index.htmlindex f861a039..6824bed0 100644--- a/tests/playground/scope/index.html+++ b/tests/playground/scope/index.html@@ -27,7 +27,7 @@.square {width: 100px;height: 100px;- background: var(--red);+ background: var(--red-1);border-radius: 1rem;padding: 1rem;}diff --git a/tests/playground/scope/index.js b/tests/playground/scope/index.jsindex 1c87ec17..0834652c 100644--- a/tests/playground/scope/index.js+++ b/tests/playground/scope/index.js@@ -42,8 +42,6 @@ const scope = createScope({alternate: true}));--// Recreate the animation while keeping track of its current time between mediaquery changes// self.keepTime(() => animate('.square', {// scale: self.matches.isSmall ? .5 : 1.5,@@ -70,7 +68,7 @@ const scope = createScope({}self.keepTime(() => animate('.square', {- background: ($el) => utils.get($el, utils.randomPick(['--blue', '--lavender', '--pink'])),+ background: ($el) => utils.get($el, utils.randomPick(['--cyan-1', '--lavender-1', '--pink-1'])),loop: true,ease: 'inOut(2)',alternate: true,@@ -90,4 +88,4 @@ const scope = createScope({document.body.addEventListener('click', () => {console.log('REVERT');scope.revert();-})\ No newline at end of file+});diff --git a/tests/playground/scramble/index.html b/tests/playground/scramble/index.htmlnew file mode 100644index 00000000..144191c4--- /dev/null+++ b/tests/playground/scramble/index.html@@ -0,0 +1,176 @@+<!DOCTYPE html>+<html>+<head>+ <title>Scramble Text / Anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <link href="../assets/css/styles.css" rel="stylesheet">+ <style>+ body {+ display: flex;+ flex-direction: column;+ width: 100%;+ }+ .tests {+ display: flex;+ flex-wrap: wrap;+ width: 100%;+ }+ .test {+ position: relative;+ display: flex;+ flex-direction: column;+ align-items: flex-start;+ width: 100%;+ min-height: 8rem;+ border: 1px solid var(--bg-4);+ margin-right: -1px;+ margin-top: -1px;+ padding: 2.5rem 1rem 1rem 1rem;+ }+ @media (min-width: 740px) {+ .test { width: 50%; }+ }+ @media (min-width: 1200px) {+ .test { width: 33.333%; }+ }+ .test-header {+ display: flex;+ justify-content: space-between;+ position: absolute;+ top: 0;+ left: 0;+ right: 0;+ padding: .5rem;+ font-size: .7rem;+ color: var(--fg-4);+ }+ .test-header button {+ padding: 0 .5rem;+ color: var(--fg-3);+ background: none;+ cursor: pointer;+ }+ .scramble {+ font-size: 1rem;+ line-height: 1.5;+ hyphens: none;+ }+ </style>+</head>+<body>+ <div class="tests">+ <div class="test" id="default">+ <div class="test-header"><span>Default</span></div>+ <div class="scramble">Each character cycles through random glyphs before settling into place</div>+ </div>+ <div class="test" id="from-end">+ <div class="test-header"><span>From right</span></div>+ <div class="scramble">The reveal wave starts from the rightmost character and sweeps left, unscrambling each glyph in reverse order until the full string has settled into place</div>+ </div>+ <div class="test" id="from-center">+ <div class="test-header"><span>From center</span></div>+ <div class="scramble">Characters resolve outward from the midpoint of the string, spreading symmetrically in both directions until the first and last characters settle into their final place</div>+ </div>+ <div class="test" id="from-random">+ <div class="test-header"><span>From random</span></div>+ <div class="scramble">Each character picks a random position in the reveal sequence, so the text resolves in an unpredictable order with no directional bias from left to right</div>+ </div>+ <div class="test" id="binary">+ <div class="test-header"><span>Binary characters</span></div>+ <div class="scramble">The scramble pool is limited to zeros and ones, replacing every unrevealed character with binary digits to create a data stream aesthetic before the final text appears</div>+ </div>+ <div class="test" id="eased">+ <div class="test-header"><span>With ease</span></div>+ <div class="scramble">An easing curve shapes the reveal progress, so characters settle slowly at first, accelerate through the middle, then slow down again toward the end of the animation</div>+ </div>+ <div class="test" id="staggered">+ <div class="test-header"><span>Staggered</span></div>+ <div class="scramble">Each element scrambles its characters before settling left to right</div>+ <div class="scramble">A stagger delay offsets each animation from the one before it</div>+ <div class="scramble">The sequence completes as the final line resolves into place</div>+ </div>+ <div class="test" id="low-cps">+ <div class="test-header"><span>Low CPS</span></div>+ <div class="scramble">A low characters per second rate means scramble glyphs refresh less often, so each random character lingers visibly before being replaced by the next one</div>+ </div>+ <div class="test" id="from-index">+ <div class="test-header"><span>From index 20</span></div>+ <div class="scramble">The reveal originates at character index twenty and spreads outward from that point, resolving characters in order of their distance from the chosen origin position</div>+ </div>+ <div class="test" id="cursor">+ <div class="test-header"><span>Cursor</span></div>+ <div class="scramble">An underscore character forms a leading cursor that sweeps just ahead of the reveal boundary, marking positions that are about to settle before the final glyph appears</div>+ </div>+ <div class="test" id="cursor-pattern">+ <div class="test-header"><span>Cursor pattern (█▓▒░)</span></div>+ <div class="scramble">A block gradient pattern forms a growing cursor front that sweeps across the string, fading from solid to light before each character settles into its final glyph</div>+ </div>+ <div class="test" id="low-perturbation">+ <div class="test-header"><span>Perturbation 0.4</span></div>+ <div class="scramble">With perturbation at 0.4, most characters follow the natural reveal order while a portion settle slightly ahead or behind their expected position in the sequence</div>+ </div>+ <div class="test" id="seeded">+ <div class="test-header"><span>Seeded (42)</span></div>+ <div class="scramble">Providing a numeric seed to the generator means the scramble pattern, reveal order, and character choices are all identical on every replay for fully reproducible animations</div>+ </div>+ <div class="test" id="combined">+ <div class="test-header"><span>Cursor + perturbation + center</span></div>+ <div class="scramble">Cursor, center origin, and perturbation combine so characters burst outward from the middle through a sweeping glyph front before resolving into the final text</div>+ </div>+ <div class="test" id="text-longer">+ <div class="test-header"><span>Text longer</span></div>+ <div class="scramble">Short text</div>+ </div>+ <div class="test" id="text-shorter">+ <div class="test-header"><span>Text shorter</span></div>+ <div class="scramble">This is a longer piece of text that will scramble down to a much shorter string</div>+ </div>+ <div class="test" id="text-longer-space">+ <div class="test-header"><span>Text longer + space override</span></div>+ <div class="scramble">Short text</div>+ </div>+ <div class="test" id="text-shorter-end">+ <div class="test-header"><span>Text shorter + from right</span></div>+ <div class="scramble">This text shrinks from right to left, with extra characters scrambling away before the shorter target settles into place</div>+ </div>+ <div class="test" id="reversed">+ <div class="test-header"><span>Reversed</span></div>+ <div class="scramble">Reversing a center origin makes characters settle from the outer edges inward, converging toward the middle instead of the usual outward spread from the center</div>+ </div>+ <div class="test" id="blank-start">+ <div class="test-header"><span>Blank start</span></div>+ <div class="scramble">Starting from a blank string, each character appears from nothing, cycling through random glyphs before settling into its final position</div>+ </div>+ <div class="test" id="duration-short">+ <div class="test-header"><span>Duration 500ms</span></div>+ <div class="scramble">A short duration makes the entire scramble resolve quickly, with characters cycling through fewer random glyphs before settling into place</div>+ </div>+ <div class="test" id="duration-long">+ <div class="test-header"><span>Duration 3000ms</span></div>+ <div class="scramble">A long duration stretches the scramble over more time, letting characters linger in their randomized state before gradually resolving</div>+ </div>+ <div class="test" id="settle-short">+ <div class="test-header"><span>Settle duration 100ms</span></div>+ <div class="scramble">A short settle duration means each character snaps into its final glyph almost instantly once the reveal front reaches its position</div>+ </div>+ <div class="test" id="settle-long">+ <div class="test-header"><span>Settle duration 800ms</span></div>+ <div class="scramble">A long settle duration lets each character keep cycling through random glyphs for a while after being reached by the reveal front</div>+ </div>+ <div class="test" id="interval-short">+ <div class="test-header"><span>Reveal rate 100</span></div>+ <div class="scramble">A high reveal rate means characters enter the active zone quickly, creating a fast sweeping reveal effect</div>+ </div>+ <div class="test" id="interval-long">+ <div class="test-header"><span>Reveal rate 10</span></div>+ <div class="scramble">A low reveal rate means characters enter the active zone slowly, so the reveal wave takes longer to sweep across the text</div>+ </div>+ <div class="test" id="resize-loop">+ <div class="test-header"><span>Resize loop</span></div>+ <div class="scramble">Hi</div>+ </div>+ </div>+ <script type="module" src="./index.js"></script>+</body>+</html>diff --git a/tests/playground/scramble/index.js b/tests/playground/scramble/index.jsnew file mode 100644index 00000000..5c94ac92--- /dev/null+++ b/tests/playground/scramble/index.js@@ -0,0 +1,64 @@+import { animate, createTimeline, scrambleText, stagger } from '../../../dist/modules/index.js';++const demos = [+ { id: 'default', params: null },+ { id: 'from-end', params: { from: 'right' } },+ { id: 'from-center', params: { from: 'center' } },+ { id: 'from-random', params: { from: 'random' } },+ { id: 'binary', params: { chars: '01' } },+ { id: 'eased', params: { ease: 'inOut(2)' } },+ { id: 'staggered', params: {}, animParams: { delay: stagger(200) } },+ { id: 'low-cps', params: { settleRate: 5 } },+ { id: 'from-index', params: { from: 20 } },+ { id: 'cursor', params: { cursor: true } },+ { id: 'cursor-pattern', params: { cursor: '░▒▓█' } },+ { id: 'low-perturbation', params: { perturbation: 0.4 } },+ { id: 'seeded', params: { seed: 42 } },+ { id: 'combined', params: { cursor: true, perturbation: 0.5, from: 'center' } },+ { id: 'text-longer', params: { text: 'This text is significantly longer than the original short text, growing smoothly with a scramble transition effect' } },+ { id: 'text-shorter', params: { text: 'Short' } },+ { id: 'text-longer-space', params: { text: 'This text grows with space override padding to maintain consistent width during the transition', override: ' ' } },+ { id: 'text-shorter-end', params: { text: 'End', from: 'right' } },+ { id: 'reversed', params: { from: 'center', reversed: true } },+ { id: 'blank-start', params: { override: '' } },+ { id: 'duration-short', params: { duration: 500 } },+ { id: 'duration-long', params: { duration: 3000 } },+ { id: 'settle-short', params: { settleDuration: 100 } },+ { id: 'settle-long', params: { settleDuration: 800 } },+ { id: 'interval-short', params: { revealRate: 100 } },+ { id: 'interval-long', params: { revealRate: 10 } },+];++for (let i = 0, l = demos.length; i < l; i++) {+ const demo = demos[i];+ const $test = document.getElementById(demo.id);+ const $els = $test.querySelectorAll('.scramble');+ const anim = animate($els, {+ innerHTML: scrambleText(demo.params),+ duration: 1500,+ ...demo.animParams,+ });+ const replay = () => anim.restart();+ $test.addEventListener('pointerenter', replay);+ $test.addEventListener('pointerdown', replay);+}++const resizeTexts = [+ 'Hi',+ 'Hello World',+ 'The quick brown fox jumps over the lazy dog and keeps on running',+ 'Pack my box with five dozen liquor jugs and then add a few more for good measure',+ 'Nope',+ 'The five boxing wizards jump quickly over the lazy dog while the crowd watches in stunned silence',+ 'Done',+];++const $resizeEl = document.querySelector('#resize-loop .scramble');+const resizeTl = createTimeline({ loop: true });+for (let i = 1, l = resizeTexts.length; i < l; i++) {+ resizeTl.add($resizeEl, {+ innerHTML: scrambleText({ text: resizeTexts[i], override: false }),+ duration: 1500,+ }, '+=800');+}+resizeTl.init();diff --git a/tests/playground/stagger-demo.html b/tests/playground/stagger-demo.htmlindex 065df60b..15ae86dc 100644--- a/tests/playground/stagger-demo.html+++ b/tests/playground/stagger-demo.html@@ -27,7 +27,7 @@.stagger-visualizer div {width: 64px;height: 128px;- border: 1px solid var(--red);+ border: 1px solid var(--red-1);background-color: var(--black-1);}diff --git a/tests/playground/stagger-grid-demo.html b/tests/playground/stagger-grid-demo.htmlindex 567c9a3a..85cb99dc 100644--- a/tests/playground/stagger-grid-demo.html+++ b/tests/playground/stagger-grid-demo.html@@ -31,7 +31,7 @@.stagger-visualizer div {width: 1rem;height: 1rem;- background-color: var(--red);+ background-color: var(--red-1);}</style>diff --git a/tests/playground/svg-morph-timeline/index.html b/tests/playground/svg-morph-timeline/index.htmlnew file mode 100644index 00000000..cfd8a73a--- /dev/null+++ b/tests/playground/svg-morph-timeline/index.html@@ -0,0 +1,125 @@+<!DOCTYPE html>+<html>+<head>+ <title>SVG morphTo Timeline / Anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <link href="../assets/css/styles.css" rel="stylesheet">+ <style>+ body {+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ width: 100%;+ min-height: 100vh;+ gap: 2rem;+ padding: 2rem;+ }+ .test {+ position: relative;+ display: flex;+ flex-direction: column;+ align-items: center;+ width: 100%;+ max-width: 400px;+ border: 1px solid var(--bg-4);+ padding: 2.5rem 1rem 1rem 1rem;+ }+ .test-header {+ display: flex;+ justify-content: space-between;+ position: absolute;+ top: 0;+ left: 0;+ right: 0;+ padding: .5rem;+ font-size: .7rem;+ color: var(--fg-4);+ }+ svg {+ width: 200px;+ height: 200px;+ }+ svg path, svg polygon {+ fill: none;+ stroke-width: 2;+ }+ .references {+ display: flex;+ gap: 1rem;+ margin-top: .5rem;+ }+ .references svg {+ width: 60px;+ height: 60px;+ opacity: .3;+ }+ </style>+</head>+<body>+ <svg style="display:none">+ <defs>+ <path id="shape-a" d="M100 20 C145 20 180 55 180 100 C180 145 145 180 100 180 C55 180 20 145 20 100 C20 55 55 20 100 20 Z"/>+ <path id="shape-b" d="M100 20 L120 75 L180 80 L135 120 L150 180 L100 148 L50 180 L65 120 L20 80 L80 75 Z"/>+ <path id="shape-c" d="M100 10 L180 100 L100 190 L20 100 Z"/>+ <path id="shape-d" d="M100 15 L185 175 L15 175 Z"/>+ <polygon id="poly-a" points="100,20 180,100 100,180 20,100"/>+ <polygon id="poly-b" points="100,10 130,70 190,80 145,125 155,185 100,155 45,185 55,125 10,80 70,70"/>+ <polygon id="poly-c" points="100,15 185,175 15,175"/>+ </defs>+ </svg>++ <div class="test" id="chain-2">+ <div class="test-header"><span>Path: A -> B -> C</span></div>+ <svg viewBox="0 0 200 200">+ <path id="morph-2" stroke="#4E7EFC" d="M100 20 C145 20 180 55 180 100 C180 145 145 180 100 180 C55 180 20 145 20 100 C20 55 55 20 100 20 Z"/>+ </svg>+ <div class="references">+ <svg viewBox="0 0 200 200"><use href="#shape-a" stroke="#4E7EFC"/></svg>+ <svg viewBox="0 0 200 200"><use href="#shape-b" stroke="#4E7EFC"/></svg>+ <svg viewBox="0 0 200 200"><use href="#shape-c" stroke="#4E7EFC"/></svg>+ </div>+ </div>++ <div class="test" id="chain-3">+ <div class="test-header"><span>Path: A -> B -> C -> D</span></div>+ <svg viewBox="0 0 200 200">+ <path id="morph-3" stroke="#31B495" d="M100 20 C145 20 180 55 180 100 C180 145 145 180 100 180 C55 180 20 145 20 100 C20 55 55 20 100 20 Z"/>+ </svg>+ <div class="references">+ <svg viewBox="0 0 200 200"><use href="#shape-a" stroke="#31B495"/></svg>+ <svg viewBox="0 0 200 200"><use href="#shape-b" stroke="#31B495"/></svg>+ <svg viewBox="0 0 200 200"><use href="#shape-c" stroke="#31B495"/></svg>+ <svg viewBox="0 0 200 200"><use href="#shape-d" stroke="#31B495"/></svg>+ </div>+ </div>++ <div class="test" id="chain-loop">+ <div class="test-header"><span>Path: A -> B -> C -> A (loop)</span></div>+ <svg viewBox="0 0 200 200">+ <path id="morph-loop" stroke="#DA5A98" d="M100 20 C145 20 180 55 180 100 C180 145 145 180 100 180 C55 180 20 145 20 100 C20 55 55 20 100 20 Z"/>+ </svg>+ <div class="references">+ <svg viewBox="0 0 200 200"><use href="#shape-a" stroke="#DA5A98"/></svg>+ <svg viewBox="0 0 200 200"><use href="#shape-b" stroke="#DA5A98"/></svg>+ <svg viewBox="0 0 200 200"><use href="#shape-c" stroke="#DA5A98"/></svg>+ <svg viewBox="0 0 200 200"><use href="#shape-a" stroke="#DA5A98"/></svg>+ </div>+ </div>++ <div class="test" id="chain-poly">+ <div class="test-header"><span>Polygon: A -> B -> C</span></div>+ <svg viewBox="0 0 200 200">+ <polygon id="morph-poly" stroke="#F4D21F" points="100,20 180,100 100,180 20,100"/>+ </svg>+ <div class="references">+ <svg viewBox="0 0 200 200"><use href="#poly-a" stroke="#F4D21F"/></svg>+ <svg viewBox="0 0 200 200"><use href="#poly-b" stroke="#F4D21F"/></svg>+ <svg viewBox="0 0 200 200"><use href="#poly-c" stroke="#F4D21F"/></svg>+ </div>+ </div>++ <script type="module" src="./index.js"></script>+</body>+</html>diff --git a/tests/playground/svg-morph-timeline/index.js b/tests/playground/svg-morph-timeline/index.jsnew file mode 100644index 00000000..18c4b568--- /dev/null+++ b/tests/playground/svg-morph-timeline/index.js@@ -0,0 +1,25 @@+import { createTimeline, svg } from '../../../dist/modules/index.js';++const duration = 800;++// Path: A -> B -> C+const tl2 = createTimeline({ loop: true, defaults: { duration, ease: 'inOutQuad' } });+tl2.add('#morph-2', { d: svg.morphTo('#shape-b') });+tl2.add('#morph-2', { d: svg.morphTo('#shape-c') });++// Path: A -> B -> C -> D+const tl3 = createTimeline({ loop: true, defaults: { duration, ease: 'inOutQuad' } });+tl3.add('#morph-3', { d: svg.morphTo('#shape-b') });+tl3.add('#morph-3', { d: svg.morphTo('#shape-c') });+tl3.add('#morph-3', { d: svg.morphTo('#shape-d') });++// Path: A -> B -> C -> A (loop back to original)+const tlLoop = createTimeline({ loop: true, defaults: { duration, ease: 'inOutQuad' } });+tlLoop.add('#morph-loop', { d: svg.morphTo('#shape-b') });+tlLoop.add('#morph-loop', { d: svg.morphTo('#shape-c') });+tlLoop.add('#morph-loop', { d: svg.morphTo('#shape-a') });++// Polygon: A -> B -> C+const tlPoly = createTimeline({ loop: true, defaults: { duration, ease: 'inOutQuad' } });+tlPoly.add('#morph-poly', { points: svg.morphTo('#poly-b') });+tlPoly.add('#morph-poly', { points: svg.morphTo('#poly-c') });diff --git a/tests/playground/svg-motion-path/index.html b/tests/playground/svg-motion-path/index.htmlindex f82e403d..dab2c1fd 100644--- a/tests/playground/svg-motion-path/index.html+++ b/tests/playground/svg-motion-path/index.html@@ -34,7 +34,7 @@left: -1rem;width: 2rem;height: 2rem;- color: var(--red);+ color: var(--red-1);border: 2px solid currentColor;}.rect-el {diff --git a/tests/playground/timekeeper/index.html b/tests/playground/timekeeper/index.htmlindex 708ff6d1..2640e862 100644--- a/tests/playground/timekeeper/index.html+++ b/tests/playground/timekeeper/index.html@@ -29,7 +29,7 @@.square {width: 100px;height: 100px;- background: var(--red);+ background: var(--red-1);border-radius: 1rem;padding: 1rem;}diff --git a/tests/playground/timeline/nested/index.html b/tests/playground/timeline/nested/index.htmlindex 16d255a4..879b785e 100644--- a/tests/playground/timeline/nested/index.html+++ b/tests/playground/timeline/nested/index.html@@ -25,7 +25,7 @@height: 4rem;margin: 1rem;border-radius: .5rem;- background: var(--red);+ background: var(--red-1);}</style></head>diff --git a/tests/playground/waapi/composition/index.html b/tests/playground/waapi/composition/index.htmlindex 01cb4ad0..4778e6e8 100644--- a/tests/playground/waapi/composition/index.html+++ b/tests/playground/waapi/composition/index.html@@ -33,13 +33,13 @@background-color: currentColor;}.container-A .square {- color: var(--red);+ color: var(--red-1);}.container-B .square {color: var(--orange-1);}.container-C .square {- color: var(--yellow);+ color: var(--yellow-1);}</style></head>diff --git a/tests/playground/waapi/eases/index.js b/tests/playground/waapi/eases/index.jsindex 770d9dab..61d2d8f1 100644--- a/tests/playground/waapi/eases/index.js+++ b/tests/playground/waapi/eases/index.js@@ -18,7 +18,7 @@ for (let i = 0; i < total; i++) {// targets.forEach(($el, i) => {// animations[i] = $el.animate({// transform: `rotate(${(i / total) * 360}deg) translateY(200px) scaleX(.25)`,-// backgroundColor: [`var(--orange-1)`, `var(--red)`],+// backgroundColor: [`var(--orange-1)`, `var(--red-1)`],// }, {// easing: 'linear(0, 0.02, 0.0749, 0.1573, 0.2596, 0.3749, 0.4966, 0.6191, 0.7374, 0.8476, 0.9467, 1.0325, 1.1038, 1.16, 1.2014, 1.2285, 1.2425, 1.245, 1.2376, 1.222, 1.2003, 1.1742, 1.1453, 1.1152, 1.0854, 1.0568, 1.0304, 1.007, 0.9869, 0.9704, 0.9576, 0.9484, 0.9427, 0.9401, 0.9402, 0.9426, 0.9468, 0.9525, 0.9592, 0.9664, 0.9737, 0.981, 0.9879, 0.9942, 0.9997, 1.0044, 1.0082, 1.0111, 1.0131, 1.0143, 1.0148, 1.0146, 1.0138, 1.0127, 1.0112, 1.0095, 1.0078, 1.0059, 1.0042, 1.0025, 1.001, 0.9997, 0.9986, 0.9978, 0.9971, 0.9967, 0.9964, 0.9965, 0.9967, 0.997, 0.9974, 0.9978, 0.9982, 0.9987, 0.9991, 0.9995, 0.9998, 1.0001, 1.0004, 1.0006, 1.0007, 1.0008, 1.0009, 1.0008, 1.0007, 1.0006, 1.0005, 1.0004, 1.0003, 1.0002, 1.0001, 1, 0.9999, 0.9998, 1)',// iterations: Infinity,@@ -38,7 +38,7 @@ for (let i = 0; i < total; i++) {waapi.animate('.square', {transform: (_, i) => `rotate(${(i / total) * 360}deg) translateY(200px) scaleX(.25)`,backgroundColor: {- to: [`var(--orange-1)`, `var(--red)`],+ to: [`var(--orange-1)`, `var(--red-1)`],ease: 'linear',duration: 3000,},diff --git a/tests/playground/waapi/playback/index.js b/tests/playground/waapi/playback/index.jsindex d375a5ed..5fa556c4 100644--- a/tests/playground/waapi/playback/index.js+++ b/tests/playground/waapi/playback/index.js@@ -40,7 +40,7 @@ const scope = createScope({})const scrollAnim = waapi.animate('.square', {- translate: ($el, i, t) => `0px ${stagger([-20, 20])($el, i, t)}rem`,+ translate: ($el, i, targets) => `0px ${stagger([-20, 20])($el, i, targets)}rem`,rotate: `90deg`,delay: stagger(100),reversed: true,diff --git a/tests/playground/waapi/values/index.html b/tests/playground/waapi/values/index.htmlindex 7fc158ef..5bfda8c3 100644--- a/tests/playground/waapi/values/index.html+++ b/tests/playground/waapi/values/index.html@@ -31,7 +31,7 @@height: 1em;border-radius: 0px;background-color: currentColor;- color: var(--red);+ color: var(--red-1);}</style></head>diff --git a/tests/run.js b/tests/run.jsindex a8593b29..0da912c7 100644--- a/tests/run.js+++ b/tests/run.js@@ -24,6 +24,7 @@ import './suites/text.test.js';import './suites/units.test.js';import './suites/utils.test.js';import './suites/values.test.js';+import './suites/transforms.test.js';import './suites/colors.test.js';import './suites/eases.test.js';import './suites/leaks.test.js';diff --git a/tests/setup.js b/tests/setup.jsindex 0283f913..5ac05ab9 100644--- a/tests/setup.js+++ b/tests/setup.js@@ -76,6 +76,9 @@ mocha.setup({</p></div></div>+ <div id="scramble-text-tests" class="test small-test">+ <div id="scramble-text">Hello World</div>+ </div>`;done();}diff --git a/tests/suites/animations.test.js b/tests/suites/animations.test.jsindex 86ef6768..377ff6a2 100644--- a/tests/suites/animations.test.js+++ b/tests/suites/animations.test.js@@ -70,8 +70,6 @@ suite('Animations', () => {skewX: 100,skewY: 100,perspective: 100,- matrix: 100,- matrix3d: 100,duration: 100,});diff --git a/tests/suites/controls.test.js b/tests/suites/controls.test.jsindex 88780764..5a0e67ef 100644--- a/tests/suites/controls.test.js+++ b/tests/suites/controls.test.js@@ -204,7 +204,7 @@ suite('Controls', () => {expect(tl.currentTime).to.equal(tl.duration);expect(getChildAtIndex(tl, 0).currentTime).to.equal(getChildAtIndex(tl, 0).duration);expect(getChildAtIndex(tl, 1).currentTime).to.equal(getChildAtIndex(tl, 1).duration);- expect($target.getAttribute('style')).to.equal('height: 400px; transform: translateY(200px) translateX(200px); width: 64px;');+ expect($target.getAttribute('style')).to.equal('height: 400px; transform: translate(200px, 200px); width: 64px;');});test('Cancel a timer', () => {@@ -251,7 +251,7 @@ suite('Controls', () => {expect(tl.paused).to.equal(true);expect(getChildAtIndex(tl, 0).paused).to.equal(true);expect(getChildAtIndex(tl, 1).paused).to.equal(true);- expect($target.getAttribute('style')).to.equal('height: 200px; transform: translateY(100px) translateX(0px); width: 32px;');+ expect($target.getAttribute('style')).to.equal('height: 200px; transform: translate(0px, 100px); width: 32px;');});test('Revert a timeline', () => {diff --git a/tests/suites/function-based-values.test.js b/tests/suites/function-based-values.test.jsindex 3d8b1a70..01f4ee3a 100644--- a/tests/suites/function-based-values.test.js+++ b/tests/suites/function-based-values.test.js@@ -18,16 +18,16 @@ suite('Function based values', () => {const $targets = document.querySelectorAll('.target-class');const animation = animate($targets, {autoplay: false,- translateX: (el, i, total) => {+ translateX: (el, i, targets) => {return el.getAttribute('data-index');},- duration: (el, i, total) => {+ duration: (el, i, targets) => {const index = parseFloat(el.dataset.index);- return total + ((i + index) * 100);+ return targets.length + ((i + index) * 100);},- delay: (el, i, total) => {+ delay: (el, i, targets) => {const index = parseFloat(el.dataset.index);- return total + ((i + index) * 100);+ return targets.length + ((i + index) * 100);},ease: () => {return (/** @type {Number} */t) => t;@@ -144,7 +144,7 @@ suite('Function based values', () => {const $targets = document.querySelectorAll('.target-class');const animation = animate($targets, {autoplay: false,- translateX: ($el, i, t) => [$el.dataset.index, (t - 1) - i],+ translateX: ($el, i, targets) => [$el.dataset.index, (targets.length - 1) - i],});// From@@ -165,8 +165,8 @@ suite('Function based values', () => {const animation = animate($targets, {autoplay: false,translateX: [- ($el, i, t) => $el.dataset.index,- ($el, i, t) => (t - 1) - i+ ($el, i, targets) => $el.dataset.index,+ ($el, i, targets) => (targets.length - 1) - i],});@@ -188,8 +188,8 @@ suite('Function based values', () => {// const animation = animate($targets, {// autoplay: false,// translateX: [- // ($el, i, t) => $el.dataset.index,- // ($el, i, t) => utils.ran+ // ($el, i, targets) => $el.dataset.index,+ // ($el, i, targets) => utils.ran// ],// });diff --git a/tests/suites/keyframes.test.js b/tests/suites/keyframes.test.jsindex 4edaa3c2..fe509cf3 100644--- a/tests/suites/keyframes.test.js+++ b/tests/suites/keyframes.test.js@@ -284,11 +284,11 @@ suite('Keyframes', () => {// Easing should be continuous throughout the sequenceanimation.seek(250);- expect($target.style.transform).to.equal('translateY(-25px) translateX(0px)');+ expect($target.style.transform).to.equal('translate(0px, -25px)');animation.seek(500);- expect($target.style.transform).to.equal('translateY(0px) translateX(250px)');+ expect($target.style.transform).to.equal('translate(250px, 0px)');animation.seek(750);- expect($target.style.transform).to.equal('translateY(25px) translateX(0px)');+ expect($target.style.transform).to.equal('translate(0px, 25px)');});test('Percentage based keyframes values', () => {@@ -309,15 +309,15 @@ suite('Keyframes', () => {// Easing should be continuous throughout the sequenceanimation.seek(0);- expect($target.style.transform).to.equal('translateX(100px) translateY(100px)');+ expect($target.style.transform).to.equal('translate(100px, 100px)');animation.seek(200);- expect($target.style.transform).to.equal('translateX(-100px) translateY(60px)');+ expect($target.style.transform).to.equal('translate(-100px, 60px)');animation.seek(500);- expect($target.style.transform).to.equal('translateX(100px) translateY(0px)');+ expect($target.style.transform).to.equal('translate(100px, 0px)');animation.seek(800);- expect($target.style.transform).to.equal('translateX(-100px) translateY(-60px)');+ expect($target.style.transform).to.equal('translate(-100px, -60px)');animation.seek(1000);- expect($target.style.transform).to.equal('translateX(100px) translateY(-100px)');+ expect($target.style.transform).to.equal('translate(100px, -100px)');});test('Percentage based keyframes with float percentage values', () => {diff --git a/tests/suites/parameters.test.js b/tests/suites/parameters.test.jsindex 44a1ace0..a53f10aa 100644--- a/tests/suites/parameters.test.js+++ b/tests/suites/parameters.test.js@@ -211,10 +211,10 @@ suite('Parameters', () => {expect(getTweenDelay(getChildAtIndex(animation, 2))).to.equal(duration * (.1));expect(getChildAtIndex(animation, 2)._changeDuration).to.equal(duration * .70);- expect(targetEl.style.transform).to.equal('translateX(0px) rotate(0deg) translateY(0px)');+ expect(targetEl.style.transform).to.equal('translate(0px, 0px) rotate(0deg)');animation.pause();animation.seek(animation.duration * .5);- expect(targetEl.style.transform).to.equal('translateX(66.7px) rotate(302.4deg) translateY(134.69px)');+ expect(targetEl.style.transform).to.equal('translate(66.7px, 134.69px) rotate(302.4deg)');});test('Specific property parameters on transforms values when last transform value update after everything else', resolve => {@@ -286,7 +286,7 @@ suite('Parameters', () => {});expect(animation.duration).to.equal(minValue);- expect(targetEl.style.transform).to.equal('translateX(100px) translateY(100px)');+ expect(targetEl.style.transform).to.equal('translate(100px, 100px)');});test('0 duration timeline with infinite loop', () => {diff --git a/tests/suites/stagger.test.js b/tests/suites/stagger.test.jsindex b2d29e9c..4ae51f88 100644--- a/tests/suites/stagger.test.js+++ b/tests/suites/stagger.test.js@@ -310,4 +310,144 @@ suite('Stagger', () => {expect(getChildAtIndex(tl, 2)._head._toNumber).to.equal(100);expect(getChildAtIndex(tl, 3)._head._toNumber).to.equal(0);});++ test('Grid staggering with from as [x, y] array', () => {+ const animation = animate('#grid div', {+ scale: [1, 0],+ delay: stagger(10, {grid: [5, 3], from: [0.5, 0.5]}),+ autoplay: false+ });++ expect(getTweenDelay(getChildAtIndex(animation, 0))).to.be.closeTo(22.4, .0001);+ expect(getTweenDelay(getChildAtIndex(animation, 1))).to.be.closeTo(14.1, .01);+ expect(getTweenDelay(getChildAtIndex(animation, 2))).to.equal(10);+ expect(getTweenDelay(getChildAtIndex(animation, 3))).to.be.closeTo(14.1, .01);+ expect(getTweenDelay(getChildAtIndex(animation, 4))).to.be.closeTo(22.4, .0001);++ expect(getTweenDelay(getChildAtIndex(animation, 5))).to.equal(20);+ expect(getTweenDelay(getChildAtIndex(animation, 6))).to.equal(10);+ expect(getTweenDelay(getChildAtIndex(animation, 7))).to.equal(0);+ expect(getTweenDelay(getChildAtIndex(animation, 8))).to.equal(10);+ expect(getTweenDelay(getChildAtIndex(animation, 9))).to.equal(20);++ expect(getTweenDelay(getChildAtIndex(animation, 10))).to.be.closeTo(22.4, .0001);+ expect(getTweenDelay(getChildAtIndex(animation, 11))).to.be.closeTo(14.1, .01);+ expect(getTweenDelay(getChildAtIndex(animation, 12))).to.equal(10);+ expect(getTweenDelay(getChildAtIndex(animation, 13))).to.be.closeTo(14.1, .01);+ expect(getTweenDelay(getChildAtIndex(animation, 14))).to.be.closeTo(22.4, .0001);+ });++ test('Auto grid staggering with DOM elements', () => {+ const animation = animate('#grid div', {+ scale: [1, 0],+ delay: stagger(10, {grid: true, from: 'center'}),+ autoplay: false+ });++ // Center element should have delay 0+ expect(getTweenDelay(getChildAtIndex(animation, 7))).to.equal(0);++ // Symmetric elements should have equal delays+ // Middle row: left/right of center+ expect(getTweenDelay(getChildAtIndex(animation, 6))).to.equal(getTweenDelay(getChildAtIndex(animation, 8)));+ expect(getTweenDelay(getChildAtIndex(animation, 5))).to.equal(getTweenDelay(getChildAtIndex(animation, 9)));++ // Center column: top/bottom of center+ expect(getTweenDelay(getChildAtIndex(animation, 2))).to.equal(getTweenDelay(getChildAtIndex(animation, 12)));++ // All four corners should have equal delays+ const cornerDelay = getTweenDelay(getChildAtIndex(animation, 0));+ expect(getTweenDelay(getChildAtIndex(animation, 4))).to.equal(cornerDelay);+ expect(getTweenDelay(getChildAtIndex(animation, 10))).to.equal(cornerDelay);+ expect(getTweenDelay(getChildAtIndex(animation, 14))).to.equal(cornerDelay);++ // Corners should have the largest delay+ expect(cornerDelay).to.be.greaterThan(getTweenDelay(getChildAtIndex(animation, 6)));+ expect(cornerDelay).to.be.greaterThan(getTweenDelay(getChildAtIndex(animation, 2)));+ });++ test('Auto grid staggering with JS objects from center', () => {+ const targets = [];+ for (let row = 0; row < 3; row++) {+ for (let col = 0; col < 5; col++) {+ targets.push({ x: col, y: row, val: 1 });+ }+ }+ const animation = animate(targets, {+ val: 0,+ delay: stagger(10, { grid: true, from: 'center' }),+ autoplay: false,+ });++ expect(getTweenDelay(getChildAtIndex(animation, 0))).to.be.closeTo(22.4, .0001);+ expect(getTweenDelay(getChildAtIndex(animation, 1))).to.be.closeTo(14.1, .01);+ expect(getTweenDelay(getChildAtIndex(animation, 2))).to.equal(10);+ expect(getTweenDelay(getChildAtIndex(animation, 3))).to.be.closeTo(14.1, .01);+ expect(getTweenDelay(getChildAtIndex(animation, 4))).to.be.closeTo(22.4, .0001);++ expect(getTweenDelay(getChildAtIndex(animation, 5))).to.equal(20);+ expect(getTweenDelay(getChildAtIndex(animation, 6))).to.equal(10);+ expect(getTweenDelay(getChildAtIndex(animation, 7))).to.equal(0);+ expect(getTweenDelay(getChildAtIndex(animation, 8))).to.equal(10);+ expect(getTweenDelay(getChildAtIndex(animation, 9))).to.equal(20);++ expect(getTweenDelay(getChildAtIndex(animation, 10))).to.be.closeTo(22.4, .0001);+ expect(getTweenDelay(getChildAtIndex(animation, 11))).to.be.closeTo(14.1, .01);+ expect(getTweenDelay(getChildAtIndex(animation, 12))).to.equal(10);+ expect(getTweenDelay(getChildAtIndex(animation, 13))).to.be.closeTo(14.1, .01);+ expect(getTweenDelay(getChildAtIndex(animation, 14))).to.be.closeTo(22.4, .0001);+ });++ test('Auto grid staggering with from as [x, y] array', () => {+ const targets = [];+ for (let row = 0; row < 3; row++) {+ for (let col = 0; col < 5; col++) {+ targets.push({ x: col, y: row, val: 1 });+ }+ }+ const animation = animate(targets, {+ val: 0,+ delay: stagger(10, { grid: true, from: [1, 1] }),+ autoplay: false,+ });++ expect(getTweenDelay(getChildAtIndex(animation, 14))).to.equal(0);+ expect(getTweenDelay(getChildAtIndex(animation, 0))).to.be.closeTo(44.7, .01);+ expect(getTweenDelay(getChildAtIndex(animation, 4))).to.equal(20);+ expect(getTweenDelay(getChildAtIndex(animation, 10))).to.equal(40);+ });++ test('Auto grid staggering with axis parameter', () => {+ const targets = [];+ for (let row = 0; row < 3; row++) {+ for (let col = 0; col < 5; col++) {+ targets.push({ x: col, y: row, val: 0 });+ }+ }+ const animation = animate(targets, {+ val: stagger(10, { grid: true, from: 'center', axis: 'x' }),+ autoplay: false,+ });++ expect(getChildAtIndex(animation, 0)._toNumber).to.equal(-20);+ expect(getChildAtIndex(animation, 1)._toNumber).to.equal(-10);+ expect(getChildAtIndex(animation, 2)._toNumber).to.equal(0);+ expect(getChildAtIndex(animation, 3)._toNumber).to.equal(10);+ expect(getChildAtIndex(animation, 4)._toNumber).to.equal(20);+ expect(getChildAtIndex(animation, 5)._toNumber).to.equal(-20);+ expect(getChildAtIndex(animation, 10)._toNumber).to.equal(-20);+ });++ test('Auto grid staggering fallback to 1D without spatial data', () => {+ const targets = [{ val: 1 }, { val: 1 }, { val: 1 }, { val: 1 }];+ const animation = animate(targets, {+ val: 0,+ delay: stagger(10, { grid: true }),+ autoplay: false,+ });+ expect(getTweenDelay(getChildAtIndex(animation, 0))).to.equal(0);+ expect(getTweenDelay(getChildAtIndex(animation, 1))).to.equal(10);+ expect(getTweenDelay(getChildAtIndex(animation, 2))).to.equal(20);+ expect(getTweenDelay(getChildAtIndex(animation, 3))).to.equal(30);+ });});diff --git a/tests/suites/svg.test.js b/tests/suites/svg.test.jsindex 5236c917..a85644e5 100644--- a/tests/suites/svg.test.js+++ b/tests/suites/svg.test.js@@ -1,12 +1,12 @@import {expect,- getChildAtIndex,} from '../utils.js';import {animate,utils,svg,+ createTimeline,} from '../../dist/modules/index.js';suite('SVG', () => {@@ -153,7 +153,7 @@ suite('SVG', () => {});// Scale property should be set as a CSS transform on non SVG filter elements- expect(filterPolygonEl.style.transform).to.equal('translateX(430px) translateY(35px) scale(0.75)');+ expect(filterPolygonEl.style.transform).to.equal('translate(430px, 35px) scale(0.75)');// Non stylistic SVG attribute should be declared in came caseexpect(feTurbulenceEl.hasAttribute('baseFrequency')).to.equal(true);@@ -163,6 +163,7 @@ suite('SVG', () => {});test('svg.createMotionPath with offset', resolve => {+ /** @type {HTMLElement} */const squareEl = document.querySelector('#square');const [pathEl] = utils.$('#tests path');const pathSelector = 'motion-path-offset-test';@@ -195,4 +196,84 @@ suite('SVG', () => {resolve();});+ test('morphTo morphs path d attribute from one shape to another', resolve => {+ const $path = document.querySelector('#path');+ const originalD = $path.getAttribute('d');+ const anim = animate($path, {+ d: svg.morphTo('#polygon'),+ duration: 10,+ autoplay: false,+ });+ anim.seek(0);+ expect($path.getAttribute('d')).to.not.equal(originalD);+ anim.seek(anim.duration);+ const endD = $path.getAttribute('d');+ expect(endD).to.not.equal(originalD);+ resolve();+ });++ test('morphTo morphs polygon points attribute', resolve => {+ const $polygon = document.querySelector('#polygon');+ const originalPoints = $polygon.getAttribute('points');+ const anim = animate($polygon, {+ points: svg.morphTo('#polyline', 0),+ duration: 10,+ autoplay: false,+ });+ anim.seek(anim.duration);+ expect($polygon.getAttribute('points')).to.not.equal(originalPoints);+ resolve();+ });++ test('morphTo timeline chaining reads previous end value', resolve => {+ const $polygon = document.querySelector('#polygon');+ const originalPoints = $polygon.getAttribute('points');+ // Set polygon points to match polyline so DOM-based reads produce a polyline->polyline no-op+ $polygon.setAttribute('points', document.querySelector('#polyline').getAttribute('points'));+ const tl = createTimeline({ defaults: { duration: 10 }, autoplay: false });+ tl.add($polygon, { points: svg.morphTo('#path') });+ tl.add($polygon, { points: svg.morphTo('#polyline') });+ tl.seek(15);+ const midPoints = $polygon.getAttribute('points');+ tl.seek(tl.duration);+ const endPoints = $polygon.getAttribute('points');+ // If prevTween works, second morph goes path->polyline (different mid vs end)+ // If broken, second morph goes polyline->polyline (mid equals end)+ expect(midPoints).to.not.equal(endPoints);+ $polygon.setAttribute('points', originalPoints);+ resolve();+ });++ test('morphTo keyframe array reads prevTween value between keyframes', resolve => {+ const $path = document.querySelector('#path');+ const originalD = $path.getAttribute('d');+ const anim = animate($path, {+ d: [{ to: svg.morphTo('#polygon') }, { to: svg.morphTo('#polyline') }],+ duration: 100,+ autoplay: false,+ });+ anim.seek(50);+ const midD = $path.getAttribute('d');+ anim.seek(anim.duration);+ const endD = $path.getAttribute('d');+ // Both keyframes produce different endpoints (second morph starts from polygon, not original)+ expect(midD).to.not.equal(originalD);+ expect(endD).to.not.equal(originalD);+ expect(midD).to.not.equal(endD);+ $path.setAttribute('d', originalD);+ resolve();+ });++ test('morphTo revert restores original path', resolve => {+ const $path = document.querySelector('#path');+ const originalD = $path.getAttribute('d');+ const tl = createTimeline({ defaults: { duration: 10 }, autoplay: false });+ tl.add($path, { d: svg.morphTo('#polygon') });+ tl.seek(tl.duration);+ expect($path.getAttribute('d')).to.not.equal(originalD);+ tl.revert();+ expect($path.getAttribute('d')).to.equal(originalD);+ resolve();+ });+});diff --git a/tests/suites/text.test.js b/tests/suites/text.test.jsindex 46fcd3d0..84a32db5 100644--- a/tests/suites/text.test.js+++ b/tests/suites/text.test.js@@ -7,6 +7,8 @@ import {utils,splitText,animate,+ scrambleText,+ createTimeline,} from '../../dist/modules/index.js';// Firefox detect Japanse words differently@@ -428,4 +430,137 @@ suite('Text', () => {});});+ test('scrambleText returns a function-based value', () => {+ const value = scrambleText();+ expect(typeof value).to.equal('function');+ });++ test('scrambleText returns a tween object with from, to, ease, duration and modifier', () => {+ const $el = document.querySelector('#scramble-text');+ const tweenObj = scrambleText()($el);+ expect(tweenObj.from).to.equal(0);+ expect(tweenObj.to).to.equal(1);+ expect(tweenObj.ease).to.equal('linear');+ expect(tweenObj.duration).to.be.above(0);+ expect(typeof tweenObj.modifier).to.equal('function');+ });++ test('scrambleText default override scrambles text at start', () => {+ const $el = document.querySelector('#scramble-text');+ const tweenObj = scrambleText({ seed: 1 })($el);+ expect(tweenObj.modifier(0)).to.not.equal($el.textContent);+ });++ test('scrambleText override false preserves original text at start', () => {+ const $el = document.querySelector('#scramble-text');+ const tweenObj = scrambleText({ override: false })($el);+ expect(tweenObj.modifier(0)).to.equal($el.textContent);+ });++ test('scrambleText modifier returns target text at 1', () => {+ const $el = document.querySelector('#scramble-text');+ const tweenObj = scrambleText()($el);+ expect(tweenObj.modifier(1)).to.equal($el.textContent);+ });++ test('scrambleText modifier returns scrambled text for intermediate values', () => {+ const $el = document.querySelector('#scramble-text');+ const tweenObj = scrambleText({ seed: 1 })($el);+ const result = tweenObj.modifier(.5);+ expect(result.length).to.equal($el.textContent.length);+ expect(result).to.not.equal($el.textContent);+ });++ test('scrambleText modifier preserves whitespace', () => {+ const $el = document.querySelector('#scramble-text');+ const tweenObj = scrambleText({ seed: 1 })($el);+ const result = tweenObj.modifier(.125);+ const spaceIndex = $el.textContent.indexOf(' ');+ expect(result[spaceIndex]).to.equal(' ');+ });++ test('scrambleText modifier caches value for same input', () => {+ const $el = document.querySelector('#scramble-text');+ const tweenObj = scrambleText()($el);+ const first = tweenObj.modifier(.25);+ const second = tweenObj.modifier(.25);+ expect(first).to.equal(second);+ });++ test('scrambleText custom chars option', () => {+ const $el = document.querySelector('#scramble-text');+ const tweenObj = scrambleText({ chars: 'XY', seed: 1 })($el);+ const result = tweenObj.modifier(.5);+ for (let i = 0; i < result.length; i++) {+ if (result[i] !== ' ' && result[i] !== $el.textContent[i]) {+ expect(result[i] === 'X' || result[i] === 'Y').to.equal(true);+ }+ }+ });++ test('scrambleText progressive reveal increases revealed characters', () => {+ const $el = document.querySelector('#scramble-text');+ const originalText = $el.textContent;+ const tweenObj = scrambleText({ seed: 1 })($el);+ const at25 = tweenObj.modifier(.25);+ const at75 = tweenObj.modifier(.75);+ let revealed25 = 0;+ let revealed75 = 0;+ for (let i = 0; i < originalText.length; i++) {+ if (at25[i] === originalText[i] && originalText[i] !== ' ') revealed25++;+ if (at75[i] === originalText[i] && originalText[i] !== ' ') revealed75++;+ }+ expect(revealed75).to.be.above(revealed25);+ });++ test('scrambleText custom text param transitions to different text', () => {+ const $el = document.querySelector('#scramble-text');+ const tweenObj = scrambleText({ text: 'Goodbye' })($el);+ expect(tweenObj.modifier(1)).to.equal('Goodbye');+ });++ test('scrambleText works with animate()', resolve => {+ const $el = document.querySelector('#scramble-text');+ const originalText = $el.textContent;+ animate($el, {+ innerHTML: scrambleText(),+ duration: 100,+ autoplay: true,+ onComplete: () => {+ expect($el.innerHTML).to.equal(originalText);+ resolve();+ }+ });+ });++ test('scrambleText keyframe array reads prevTween value between keyframes', resolve => {+ const $el = document.querySelector('#scramble-text');+ $el.textContent = '';+ const anim = animate($el, {+ innerHTML: [+ { to: scrambleText({ text: 'First', duration: 100 }) },+ { to: scrambleText({ text: 'Second', duration: 100 }) },+ ],+ autoplay: false,+ });+ // End of first keyframe: should equal first target text+ anim.seek(100);+ expect($el.innerHTML).to.equal('First');+ // End of second keyframe: proves prevTween._value was read as starting text+ anim.seek(anim.duration);+ expect($el.innerHTML).to.equal('Second');+ resolve();+ });++ test('scrambleText timeline chaining reads previous end value', resolve => {+ const $el = document.querySelector('#scramble-text');+ $el.textContent = '';+ const tl = createTimeline({ defaults: { duration: 100 }, autoplay: false });+ tl.add($el, { innerHTML: scrambleText({ text: 'Hello' }) });+ tl.add($el, { innerHTML: scrambleText({ override: false }) });+ tl.seek(tl.duration);+ expect($el.innerHTML).to.equal('Hello');+ resolve();+ });+});diff --git a/tests/suites/timelines.test.js b/tests/suites/timelines.test.jsindex 636aff17..255b54af 100644--- a/tests/suites/timelines.test.js+++ b/tests/suites/timelines.test.js@@ -500,13 +500,13 @@ suite('Timelines', () => {}, '-=5')tl.seek(15)- expect($target.style.transform).to.equal('translateX(200px) translateY(100px)');+ expect($target.style.transform).to.equal('translate(200px, 100px)');tl.seek(16)- expect($target.style.transform).to.equal('translateX(185px) translateY(90px)');+ expect($target.style.transform).to.equal('translate(185px, 90px)');tl.seek(15)- expect($target.style.transform).to.equal('translateX(200px) translateY(100px)');+ expect($target.style.transform).to.equal('translate(200px, 100px)');tl.seek(14)- expect($target.style.transform).to.equal('translateX(185px) translateY(90px)');+ expect($target.style.transform).to.equal('translate(185px, 90px)');});test('Previous tween before last shouln\'t render on loop', resolve => {diff --git a/tests/suites/transforms.test.js b/tests/suites/transforms.test.jsnew file mode 100644index 00000000..c67b88c2--- /dev/null+++ b/tests/suites/transforms.test.js@@ -0,0 +1,1200 @@+import {+ expect,+} from '../utils.js';++import {+ animate,+ utils,+} from '../../dist/modules/index.js';++suite('Transforms', () => {++ // --- Parsing inline shorthand transforms ---++ test('Parse inline translate(x, y) shorthand', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate(20px, 30px)';+ expect(utils.get($target, 'translateX')).to.equal('20px');+ expect(utils.get($target, 'translateY')).to.equal('30px');+ });++ test('Parse inline translate(x) single value', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate(15px)';+ expect(utils.get($target, 'translateX')).to.equal('15px');+ });++ test('Parse inline translate3d(x, y, z)', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate3d(10px, 20px, 30px)';+ expect(utils.get($target, 'translateX')).to.equal('10px');+ expect(utils.get($target, 'translateY')).to.equal('20px');+ expect(utils.get($target, 'translateZ')).to.equal('30px');+ });++ test('Parse inline translate3d with calc values', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate3d(calc(10px + 5vw), calc(20px - 3vh), 50px)';+ expect(utils.get($target, 'translateX')).to.equal('calc(10px + 5vw)');+ expect(utils.get($target, 'translateY')).to.equal('calc(20px - 3vh)');+ expect(utils.get($target, 'translateZ')).to.equal('50px');+ });++ test('Parse inline translate3d with nested calc parens', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate3d(calc((100% - 50px) / 2), calc(var(--h) + 10px), 0px)';+ expect(utils.get($target, 'translateX')).to.equal('calc((100% - 50px) / 2)');+ expect(utils.get($target, 'translateY')).to.equal('calc(var(--h) + 10px)');+ expect(utils.get($target, 'translateZ')).to.equal('0px');+ });++ test('Parse inline translate with calc and clamp values', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate(clamp(10px, 50%, 200px), calc(100vh - 50px))';+ expect(utils.get($target, 'translateX')).to.equal('clamp(10px, 50%, 200px)');+ expect(utils.get($target, 'translateY')).to.equal('calc(-50px + 100vh)');+ });++ test('Parse inline scale(x, y) shorthand', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'scale(2, 3)';+ expect(utils.get($target, 'scaleX')).to.equal('2');+ expect(utils.get($target, 'scaleY')).to.equal('3');+ });++ test('Parse inline scale3d(x, y, z)', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'scale3d(1.5, 2, 0.5)';+ expect(utils.get($target, 'scaleX')).to.equal('1.5');+ expect(utils.get($target, 'scaleY')).to.equal('2');+ expect(utils.get($target, 'scaleZ')).to.equal('0.5');+ });++ test('Parse mixed shorthand and individual inline transforms', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate(5px, 10px) rotate(30deg) scaleX(2)';+ expect(utils.get($target, 'translateX')).to.equal('5px');+ expect(utils.get($target, 'translateY')).to.equal('10px');+ expect(utils.get($target, 'rotate')).to.equal('30deg');+ expect(utils.get($target, 'scaleX')).to.equal('2');+ });++ test('Parse translate shorthand followed by other transforms', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate(40px, 60px) rotate(45deg) scale3d(2, 2, 1)';+ expect(utils.get($target, 'translateX')).to.equal('40px');+ expect(utils.get($target, 'translateY')).to.equal('60px');+ expect(utils.get($target, 'rotate')).to.equal('45deg');+ expect(utils.get($target, 'scaleX')).to.equal('2');+ expect(utils.get($target, 'scaleY')).to.equal('2');+ expect(utils.get($target, 'scaleZ')).to.equal('1');+ });++ test('Parse inline scale(single_value)', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'scale(0.75)';+ expect(utils.get($target, 'scale')).to.equal('0.75');+ });++ test('Parse inline individual rotateX', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'rotateX(45deg)';+ expect(utils.get($target, 'rotateX')).to.equal('45deg');+ });++ test('Parse complex inline transform with all types combined', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'perspective(800px) translate3d(10px, 20px, 30px) rotate(45deg) rotateX(15deg) scale3d(1.5, 2, 1) skewX(10deg) skewY(5deg)';+ expect(utils.get($target, 'perspective')).to.equal('800px');+ expect(utils.get($target, 'translateX')).to.equal('10px');+ expect(utils.get($target, 'translateY')).to.equal('20px');+ expect(utils.get($target, 'translateZ')).to.equal('30px');+ expect(utils.get($target, 'rotate')).to.equal('45deg');+ expect(utils.get($target, 'rotateX')).to.equal('15deg');+ expect(utils.get($target, 'scaleX')).to.equal('1.5');+ expect(utils.get($target, 'scaleY')).to.equal('2');+ expect(utils.get($target, 'scaleZ')).to.equal('1');+ expect(utils.get($target, 'skewX')).to.equal('10deg');+ expect(utils.get($target, 'skewY')).to.equal('5deg');+ });++ test('Parse translate(x, y) with calc containing nested parens', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate(calc((100vw - 300px) / 2), calc(var(--offset, 10px) * 2))';+ expect(utils.get($target, 'translateX')).to.equal('calc((100vw - 300px) / 2)');+ expect(utils.get($target, 'translateY')).to.equal('calc(var(--offset, 10px) * 2)');+ });++ // --- Anime.js x/y/z shorthand properties ---++ test('Render x shorthand as translateX', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ x: 50,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'translateX')).to.equal('50px');+ expect($target.style.transform).to.equal('translateX(50px)');+ });++ test('Render y shorthand as translateY', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ y: 100,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'translateY')).to.equal('100px');+ expect($target.style.transform).to.equal('translateY(100px)');+ });++ test('Render z shorthand as translateZ', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ z: 50,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'translateZ')).to.equal('50px');+ expect($target.style.transform).to.equal('translateZ(50px)');+ });++ test('Render x and y shorthands produce translate(x, y)', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ x: 100,+ y: 200,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate(100px, 200px)');+ });++ test('Render x, y, z shorthands produce translate3d(x, y, z)', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ x: 100,+ y: 200,+ z: 300,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(100px, 200px, 300px)');+ });++ test('Animate z with inline translate3d preserves x and y', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate3d(10px, 20px, 30px)';+ const animation = animate($target, { z: 300, duration: 10 });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(10px, 20px, 300px)');+ });++ test('Animate x with inline translate3d preserves y and z', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate3d(10px, 20px, 30px)';+ const animation = animate($target, { x: 100, duration: 10 });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(100px, 20px, 30px)');+ });++ test('Animate y with inline translate3d preserves x and z', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate3d(10px, 20px, 30px)';+ const animation = animate($target, { y: 200, duration: 10 });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(10px, 200px, 30px)');+ });++ test('Animate x and y with inline translate3d preserves z', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate3d(10px, 20px, 30px)';+ const animation = animate($target, { x: 100, y: 200, duration: 10 });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(100px, 200px, 30px)');+ });++ test('Animate z with inline translate3d and other transforms', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate3d(10px, 20px, 30px) rotate(45deg)';+ const animation = animate($target, { z: 300, duration: 10 });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(10px, 20px, 300px) rotate(45deg)');+ });++ test('Render x and z shorthands without y produce individual transforms', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ x: 50,+ z: 100,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translateX(50px) translateZ(100px)');+ });++ test('Render x/y shorthands with other transforms', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ x: 50,+ y: 100,+ rotate: 45,+ scale: 1.5,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate(50px, 100px) rotate(45deg) scale(1.5)');+ });++ test('Render x shorthand with string unit value', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ x: '5rem',+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'translateX')).to.equal('5rem');+ });++ test('Render x/y/z shorthands with from-to values', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ x: [0, 100],+ y: [0, 200],+ z: [0, 300],+ ease: 'linear',+ duration: 10,+ });+ animation.pause().seek(0);+ expect($target.style.transform).to.equal('translate3d(0px, 0px, 0px)');+ animation.seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(100px, 200px, 300px)');+ });++ test('Transforms shorthand properties values', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translateX(10px) translateY(calc(-100px + 10vh)) translateZ(50px) scale(0.75)';+ const animation = animate('#target-id', {+ x: 100,+ y: 100,+ z: 100,+ scale: 10,+ duration: 10,+ });+ expect(utils.get('#target-id', 'x')).to.equal('10px');+ expect(utils.get('#target-id', 'y')).to.equal('calc(-100px + 10vh)');+ expect(utils.get('#target-id', 'z')).to.equal('50px');+ expect(utils.get('#target-id', 'scale')).to.equal('0.75');+ animation.pause().seek(animation.duration);+ expect(utils.get('#target-id', 'x')).to.equal('100px');+ expect(utils.get('#target-id', 'y')).to.equal('calc(100px + 100vh)');+ expect(utils.get('#target-id', 'z')).to.equal('100px');+ expect(utils.get('#target-id', 'scale')).to.equal('10');+ });++ // --- Rendering individual transforms ---++ test('Render individual translateY alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateY: 75,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translateY(75px)');+ });++ test('Render individual translateZ alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateZ: 100,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translateZ(100px)');+ });++ test('Render individual skew alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ skew: 20,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('skew(20deg)');+ });++ test('Render translateY and translateZ without translateX', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateY: 50,+ translateZ: 100,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translateY(50px) translateZ(100px)');+ });++ test('Render individual translateX when translateY is absent', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: 50,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translateX(50px)');+ });++ test('Render individual translateX and translateZ without translateY', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: 50,+ translateZ: 100,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translateX(50px) translateZ(100px)');+ });++ test('Render individual scaleX alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ scaleX: 2,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'scaleX')).to.equal('2');+ });++ test('Render individual scaleY alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ scaleY: 3,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'scaleY')).to.equal('3');+ });++ test('Render individual scaleZ alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ scaleZ: 0.5,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'scaleZ')).to.equal('0.5');+ });++ test('Render individual rotate alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ rotate: 90,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'rotate')).to.equal('90deg');+ });++ test('Render individual rotateX alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ rotateX: 45,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'rotateX')).to.equal('45deg');+ });++ test('Render individual rotateY alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ rotateY: 60,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'rotateY')).to.equal('60deg');+ });++ test('Render individual rotateZ alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ rotateZ: 180,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'rotateZ')).to.equal('180deg');+ });++ test('Render individual skewX alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ skewX: 30,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'skewX')).to.equal('30deg');+ });++ test('Render individual skewY alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ skewY: 15,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'skewY')).to.equal('15deg');+ });++ test('Render individual perspective alone', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ perspective: 500,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect(utils.get($target, 'perspective')).to.equal('500px');+ });++ // --- Rendering shorthand transforms ---++ test('Render translate(x, y) shorthand', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: 100,+ translateY: 200,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate(100px, 200px)');+ });++ test('Render translate3d(x, y, z) shorthand', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: 100,+ translateY: 200,+ translateZ: 300,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(100px, 200px, 300px)');+ });++ test('Render translate3d shorthand with plain initial values', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translateX(10px) translateY(20px) translateZ(30px)';+ const animation = animate($target, {+ translateX: 100,+ translateY: 200,+ translateZ: 300,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(100px, 200px, 300px)');+ });++ test('Render scale(x, y) shorthand without standalone scale', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ scaleX: 2,+ scaleY: 3,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('scale(2, 3)');+ });++ test('Render scale3d(x, y, z) shorthand', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ scaleX: 1.5,+ scaleY: 2,+ scaleZ: 0.5,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('scale3d(1.5, 2, 0.5)');+ });++ test('Render individual scaleX and scaleY when standalone scale is present', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ scale: 1.5,+ scaleX: 2,+ scaleY: 3,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('scale(1.5) scaleX(2) scaleY(3)');+ });++ // --- Complex CSS values in transforms ---++ test('Render translateX with calc expression', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: 'calc(calc(15px * 2) - 42rem)',+ duration: 10,+ });+ expect($target.style.transform).to.equal('translateX(calc(0px + 0rem))');+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translateX(calc(30px - 42rem))');+ });++ test('Render translateX with calc containing mixed units', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: 'calc(50px + 10vw)',+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translateX(calc(50px + 10vw))');+ });++ test('Render translateX and translateY with different calc expressions', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: 'calc(50% - 20px)',+ translateY: 'calc(50px + 10vh)',+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate(calc(50% - 20px), calc(50px + 10vh))');+ });++ // --- Complex transform combinations ---++ test('Render perspective with translate3d and rotate', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ perspective: 800,+ translateX: 100,+ translateY: 50,+ translateZ: -200,+ rotate: 45,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('perspective(800px) translate3d(100px, 50px, -200px) rotate(45deg)');+ });++ test('Render translate with all rotation axes', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ x: 50,+ y: 100,+ rotate: 30,+ rotateX: 45,+ rotateY: 60,+ rotateZ: 90,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate(50px, 100px) rotate(30deg) rotateX(45deg) rotateY(60deg) rotateZ(90deg)');+ });++ test('Render translate3d with scale3d and skew', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: 100,+ translateY: 200,+ translateZ: 50,+ scaleX: 1.5,+ scaleY: 2,+ scaleZ: 1,+ skewX: 10,+ skewY: 5,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(100px, 200px, 50px) scale3d(1.5, 2, 1) skewX(10deg) skewY(5deg)');+ });++ test('Render perspective with x/y shorthand, rotate and scale', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ perspective: 1000,+ x: 50,+ y: -30,+ rotate: 15,+ scale: 1.2,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('perspective(1000px) translate(50px, -30px) rotate(15deg) scale(1.2)');+ });++ test('Render all transform types in correct order', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ perspective: 500,+ translateX: 10,+ translateY: 20,+ translateZ: 30,+ rotate: 45,+ rotateX: 10,+ rotateY: 20,+ rotateZ: 30,+ scale: 1.5,+ scaleX: 2,+ scaleY: 2,+ scaleZ: 1,+ skewX: 5,+ skewY: 10,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('perspective(500px) translate3d(10px, 20px, 30px) rotate(45deg) rotateX(10deg) rotateY(20deg) rotateZ(30deg) scale(1.5) scaleX(2) scaleY(2) scaleZ(1) skewX(5deg) skewY(10deg)');+ });++ test('Render x shorthand with skew and perspective', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ perspective: 600,+ x: 80,+ skewX: 15,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('perspective(600px) translateX(80px) skewX(15deg)');+ });++ test('Render translate(x, y) with rotate3d', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'rotate3d(1, 1, 0, 45deg)';+ const animation = animate($target, {+ translateX: 100,+ translateY: 200,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate(100px, 200px) rotate3d(1, 1, 0, 45deg)');+ });++ test('Render rotate3d before scale in correct order', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'rotate3d(1, 0, 0, 30deg)';+ const animation = animate($target, {+ scale: 2,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('rotate3d(1, 0, 0, 30deg) scale(2)');+ });++ test('Render with inline matrix preserved', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'matrix(1, 0, 0, 1, 50, 100)';+ const animation = animate($target, {+ translateX: 200,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translateX(200px) matrix(1, 0, 0, 1, 50, 100)');+ });++ test('Render with inline matrix3d preserved', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 50, 100, 0, 1)';+ const animation = animate($target, {+ rotate: 45,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('rotate(45deg) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 50, 100, 0, 1)');+ });++ test('Render with inline rotate3d and matrix both preserved', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'rotate3d(0, 1, 0, 60deg) matrix(1, 0, 0, 1, 0, 0)';+ const animation = animate($target, {+ translateX: 100,+ translateY: 50,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate(100px, 50px) rotate3d(0, 1, 0, 60deg) matrix(1, 0, 0, 1, 0, 0)');+ });++ // --- Zero value transforms ---++ test('Render all-zero transforms produce correct shorthands', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: [100, 0],+ translateY: [100, 0],+ translateZ: [100, 0],+ rotate: [90, 0],+ rotateX: [90, 0],+ rotateY: [90, 0],+ rotateZ: [90, 0],+ scale: [2, 0],+ scaleX: [2, 0],+ scaleY: [2, 0],+ scaleZ: [2, 0],+ skewX: [45, 0],+ skewY: [45, 0],+ ease: 'linear',+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(0px, 0px, 0px) rotate(0deg) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(0) scaleX(0) scaleY(0) scaleZ(0) skewX(0deg) skewY(0deg)');+ });++ test('Render translate3d(0, 0, 0) shorthand when all axes are zero', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: [50, 0],+ translateY: [50, 0],+ translateZ: [50, 0],+ ease: 'linear',+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(0px, 0px, 0px)');+ });++ test('Render translate(0, 0) shorthand when X and Y are zero', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ translateX: [50, 0],+ translateY: [50, 0],+ ease: 'linear',+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate(0px, 0px)');+ });++ test('Render scale3d(0, 0, 0) shorthand when all axes are zero', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ scaleX: [2, 0],+ scaleY: [2, 0],+ scaleZ: [2, 0],+ ease: 'linear',+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('scale3d(0, 0, 0)');+ });++ test('Render scale(0, 0) shorthand when X and Y are zero', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ scaleX: [2, 0],+ scaleY: [2, 0],+ ease: 'linear',+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('scale(0, 0)');+ });++ test('Render x/y shorthands from non-zero to zero', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const animation = animate($target, {+ x: [100, 0],+ y: [200, 0],+ ease: 'linear',+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate(0px, 0px)');+ });++ // --- Roundtrip (parse and re-render) ---++ test('Parse and re-render translate3d shorthand roundtrip', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate3d(10px, 20px, 30px)';+ const animation = animate($target, {+ translateX: 100,+ translateY: 200,+ translateZ: 300,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate3d(100px, 200px, 300px)');+ });++ test('Parse and re-render scale3d shorthand roundtrip', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'scale3d(1, 1, 1)';+ const animation = animate($target, {+ scaleX: 2,+ scaleY: 3,+ scaleZ: 4,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('scale3d(2, 3, 4)');+ });++ test('Parse and re-render translate(x, y) shorthand roundtrip', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'translate(50px, 75px)';+ const animation = animate($target, {+ translateX: 200,+ translateY: 300,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('translate(200px, 300px)');+ });++ test('Parse and re-render scale(x, y) shorthand roundtrip', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'scale(2, 3)';+ const animation = animate($target, {+ scaleX: 4,+ scaleY: 5,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('scale(4, 5)');+ });++ test('Parse complex inline and animate to new values', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ $target.style.transform = 'perspective(500px) translate(30px, 60px) rotate(10deg) scale3d(1.2, 1.5, 1)';+ const animation = animate($target, {+ perspective: 800,+ translateX: 100,+ translateY: 200,+ rotate: 45,+ scaleX: 2,+ scaleY: 3,+ scaleZ: 1.5,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.style.transform).to.equal('perspective(800px) translate(100px, 200px) rotate(45deg) scale3d(2, 3, 1.5)');+ });++ // --- Aggregation (multiple animations on same target) ---++ test('Multiple animations on same target aggregate into translate(x, y)', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const anim1 = animate($target, {+ x: 100,+ duration: 10,+ });+ const anim2 = animate($target, {+ y: 200,+ duration: 10,+ });+ anim1.pause().seek(anim1.duration);+ anim2.pause().seek(anim2.duration);+ expect($target.style.transform).to.equal('translate(100px, 200px)');+ });++ test('Multiple animations on same target aggregate into translate3d(x, y, z)', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const anim1 = animate($target, {+ x: 100,+ duration: 10,+ });+ const anim2 = animate($target, {+ y: 200,+ duration: 10,+ });+ const anim3 = animate($target, {+ z: 300,+ duration: 10,+ });+ anim1.pause().seek(anim1.duration);+ anim2.pause().seek(anim2.duration);+ anim3.pause().seek(anim3.duration);+ expect($target.style.transform).to.equal('translate3d(100px, 200px, 300px)');+ });++ test('Multiple animations on same target aggregate into scale(x, y)', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const anim1 = animate($target, {+ scaleX: 2,+ duration: 10,+ });+ const anim2 = animate($target, {+ scaleY: 3,+ duration: 10,+ });+ anim1.pause().seek(anim1.duration);+ anim2.pause().seek(anim2.duration);+ expect($target.style.transform).to.equal('scale(2, 3)');+ });++ test('Multiple animations on same target aggregate into scale3d(x, y, z)', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const anim1 = animate($target, {+ scaleX: 1.5,+ duration: 10,+ });+ const anim2 = animate($target, {+ scaleY: 2,+ duration: 10,+ });+ const anim3 = animate($target, {+ scaleZ: 0.5,+ duration: 10,+ });+ anim1.pause().seek(anim1.duration);+ anim2.pause().seek(anim2.duration);+ anim3.pause().seek(anim3.duration);+ expect($target.style.transform).to.equal('scale3d(1.5, 2, 0.5)');+ });++ test('Multiple animations mixing x/y shorthand and other transforms', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const anim1 = animate($target, {+ x: 50,+ rotate: 45,+ duration: 10,+ });+ const anim2 = animate($target, {+ y: 100,+ scale: 2,+ duration: 10,+ });+ anim1.pause().seek(anim1.duration);+ anim2.pause().seek(anim2.duration);+ expect($target.style.transform).to.equal('translate(50px, 100px) rotate(45deg) scale(2)');+ });++ test('Multiple animations aggregate translate, rotate and skew', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const anim1 = animate($target, {+ x: 100,+ y: 50,+ rotate: 30,+ duration: 10,+ });+ const anim2 = animate($target, {+ skewX: 15,+ skewY: 10,+ duration: 10,+ });+ anim1.pause().seek(anim1.duration);+ anim2.pause().seek(anim2.duration);+ expect($target.style.transform).to.equal('translate(100px, 50px) rotate(30deg) skewX(15deg) skewY(10deg)');+ });++ test('Multiple animations aggregate perspective, translate3d and scale3d', () => {+ /** @type {HTMLElement} */+ const $target = document.querySelector('#target-id');+ const anim1 = animate($target, {+ perspective: 800,+ x: 50,+ duration: 10,+ });+ const anim2 = animate($target, {+ y: 100,+ z: -50,+ duration: 10,+ });+ const anim3 = animate($target, {+ scaleX: 1.5,+ scaleY: 2,+ scaleZ: 1,+ duration: 10,+ });+ anim1.pause().seek(anim1.duration);+ anim2.pause().seek(anim2.duration);+ anim3.pause().seek(anim3.duration);+ expect($target.style.transform).to.equal('perspective(800px) translate3d(50px, 100px, -50px) scale3d(1.5, 2, 1)');+ });++ // --- Revert and clean inline styles ---++ test('Revert cleans translate(x, y) shorthand transforms', () => {+ const $target = /** @type {HTMLElement} */(document.querySelector('#target-id'));+ const animation = animate($target, {+ translateX: 200,+ translateY: 200,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.getAttribute('style')).to.equal('transform: translate(200px, 200px);');+ animation.revert();+ expect($target.getAttribute('style')).to.equal(null);+ });++ test('Revert cleans translate3d(x, y, z) shorthand transforms', () => {+ const $target = /** @type {HTMLElement} */(document.querySelector('#target-id'));+ const animation = animate($target, {+ translateX: 100,+ translateY: 200,+ translateZ: 300,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.getAttribute('style')).to.equal('transform: translate3d(100px, 200px, 300px);');+ animation.revert();+ expect($target.getAttribute('style')).to.equal(null);+ });++ test('Revert cleans scale(x, y) shorthand transforms', () => {+ const $target = /** @type {HTMLElement} */(document.querySelector('#target-id'));+ const animation = animate($target, {+ scaleX: 2,+ scaleY: 3,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.getAttribute('style')).to.equal('transform: scale(2, 3);');+ animation.revert();+ expect($target.getAttribute('style')).to.equal(null);+ });++ test('Revert cleans scale3d(x, y, z) shorthand transforms', () => {+ const $target = /** @type {HTMLElement} */(document.querySelector('#target-id'));+ const animation = animate($target, {+ scaleX: 1.5,+ scaleY: 2,+ scaleZ: 0.5,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.getAttribute('style')).to.equal('transform: scale3d(1.5, 2, 0.5);');+ animation.revert();+ expect($target.getAttribute('style')).to.equal(null);+ });++ test('Revert cleans x/y shorthand transforms', () => {+ const $target = /** @type {HTMLElement} */(document.querySelector('#target-id'));+ const animation = animate($target, {+ x: 150,+ y: 250,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ expect($target.getAttribute('style')).to.equal('transform: translate(150px, 250px);');+ animation.revert();+ expect($target.getAttribute('style')).to.equal(null);+ });++ test('Revert preserves existing inline translate shorthand', () => {+ const $target = /** @type {HTMLElement} */(document.querySelector('#target-id'));+ $target.style.transform = 'translate(50px, 60px)';+ const animation = animate($target, {+ translateX: 200,+ translateY: 200,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ animation.revert();+ expect($target.getAttribute('style')).to.equal('transform: translate(50px, 60px);');+ });++ test('Revert preserves existing inline translate3d shorthand', () => {+ const $target = /** @type {HTMLElement} */(document.querySelector('#target-id'));+ $target.style.transform = 'translate3d(10px, 20px, 30px)';+ const animation = animate($target, {+ translateX: 200,+ translateY: 200,+ translateZ: 200,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ animation.revert();+ expect($target.getAttribute('style')).to.equal('transform: translate3d(10px, 20px, 30px);');+ });++ test('Revert partially cleans transforms keeping non-animated ones', () => {+ const $target = /** @type {HTMLElement} */(document.querySelector('#target-id'));+ $target.style.transform = 'translate(10px, 20px) rotate(45deg)';+ const animation = animate($target, {+ translateX: 200,+ translateY: 200,+ duration: 10,+ });+ animation.pause().seek(animation.duration);+ animation.revert();+ expect($target.getAttribute('style')).to.equal('transform: translate(10px, 20px) rotate(45deg);');+ });++});diff --git a/tests/suites/types.test.js b/tests/suites/types.test.jsindex efb86d0b..f4d32c2a 100644--- a/tests/suites/types.test.js+++ b/tests/suites/types.test.js@@ -7,7 +7,7 @@ animate('.anime-css', {b: 'string',c0: (el) => el.dataset.index,c1: (el, i) => el.dataset.index + i,- c2: (el, i, t) => t - (el.dataset.index + i),+ c2: (el, i, targets) => targets.length - (el.dataset.index + i),},'20%' : { x: '0rem', y: '-2.5rem', rotate: 45, ease: 'out' },'40%' : { x: '17rem', y: '-2.5rem' },@@ -35,13 +35,13 @@ const animation = animate('#target-id', {b: 'string',c0: (el) => el.dataset.index, // el should be of type targetc1: (el, i) => el.dataset.index + i,- c2: (el, i, t) => { t - (el.dataset.index + i) }, // Should throw because not returing a valid value+ c2: (el, i, targets) => { targets.length - (el.dataset.index + i) }, // Should throw because not returing a valid valued: {to: 100,duration: 10,},e: {- from: (el, i, t) => t - (el.dataset.index + i),+ from: (el, i, targets) => targets.length - (el.dataset.index + i),delay: 10,},f: [0, 100],@@ -50,8 +50,8 @@ const animation = animate('#target-id', {{ to: [0, 1], duration: 200, ease: 'outBack' },{ to: 1, duration: 100, delay: 500, ease: 'inQuart' },],- delay: (_, i, t) => i * t,- duration: (_, i, t) => i * t,+ delay: (_, i, targets) => i * targets.length,+ duration: (_, i, targets) => i * targets.length,modifier: v => v * 100,loopDelay: 100,loop: true,@@ -93,19 +93,19 @@ const tl = createTimeline({.add('#target-id', {a: 100,b: 'string',- c: (el, i, t) => { t - (el.dataset.index + i) }, // Should throw+ c: (el, i, targets) => { targets.length - (el.dataset.index + i) }, // Should throwd: {to: 100,duration: 10,},e: {- from: (el, i, t) => t - (el.dataset.index + i),+ from: (el, i, targets) => targets.length - (el.dataset.index + i),delay: 10,},f: [0, 100],g: (el) => el.dataset.index, // el should be of type target- delay: (_, i, t) => i * t,- duration: (_, i, t) => i * t,+ delay: (_, i, targets) => i * targets.length,+ duration: (_, i, targets) => i * targets.length,modifier: v => v * 100,loopDelay: 100,loop: true,diff --git a/tests/suites/values.test.js b/tests/suites/values.test.jsindex 76a0d3e4..e6594a42 100644--- a/tests/suites/values.test.js+++ b/tests/suites/values.test.js@@ -377,7 +377,7 @@ suite('Values', () => {/** @type {HTMLElement} */const $target = document.querySelector('#target-id');- expect($target.style.transform).to.equal('translateX(100px) translateY(100px) translateZ(100px) rotate(360deg) rotateX(360deg) rotateY(360deg) rotateZ(360deg) skew(45deg) skewX(45deg) skewY(45deg) scale(10) scaleX(10) scaleY(10) scaleZ(10) perspective(1000px)');+ expect($target.style.transform).to.equal('perspective(1000px) translate3d(100px, 100px, 100px) rotate(360deg) rotateX(360deg) rotateY(360deg) rotateZ(360deg) scale(10) scaleX(10) scaleY(10) scaleZ(10) skew(45deg) skewX(45deg) skewY(45deg)');});test('Get inline transforms values', () => {@@ -399,35 +399,6 @@ suite('Values', () => {});- test('Transforms shorthand properties values', () => {-- /** @type {HTMLElement} */- const $target = document.querySelector('#target-id');-- $target.style.transform = 'translateX(10px) translateY(calc(-100px + 10vh)) translateZ(50px) scale(0.75)';-- const animation = animate('#target-id', {- x: 100,- y: 100,- z: 100,- scale: 10,- duration: 10,- });-- expect(utils.get('#target-id', 'x')).to.equal('10px');- expect(utils.get('#target-id', 'y')).to.equal('calc(-100px + 10vh)');- expect(utils.get('#target-id', 'z')).to.equal('50px');- expect(utils.get('#target-id', 'scale')).to.equal('0.75');-- animation.pause().seek(animation.duration);-- expect(utils.get('#target-id', 'x')).to.equal('100px');- expect(utils.get('#target-id', 'y')).to.equal('calc(100px + 100vh)');- expect(utils.get('#target-id', 'z')).to.equal('100px');- expect(utils.get('#target-id', 'scale')).to.equal('10');-- });-test('Values with white space', () => {/** @type {HTMLElement} */const $target = document.querySelector('#target-id');