hookery 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -11
- package/dist/bridges/auth0.d.mts +16 -0
- package/dist/bridges/auth0.d.ts +16 -0
- package/dist/bridges/auth0.js +3015 -0
- package/dist/bridges/auth0.js.map +1 -0
- package/dist/bridges/auth0.mjs +2977 -0
- package/dist/bridges/auth0.mjs.map +1 -0
- package/dist/bridges/axios.d.mts +17 -0
- package/dist/bridges/axios.d.ts +17 -0
- package/dist/bridges/axios.js +15351 -0
- package/dist/bridges/axios.js.map +1 -0
- package/dist/bridges/axios.mjs +15347 -0
- package/dist/bridges/axios.mjs.map +1 -0
- package/dist/bridges/clerk.d.mts +1 -0
- package/dist/bridges/clerk.d.ts +1 -0
- package/dist/bridges/clerk.js +5991 -0
- package/dist/bridges/clerk.js.map +1 -0
- package/dist/bridges/clerk.mjs +5985 -0
- package/dist/bridges/clerk.mjs.map +1 -0
- package/dist/bridges/firebase.d.mts +14 -0
- package/dist/bridges/firebase.d.ts +14 -0
- package/dist/bridges/firebase.js +52 -0
- package/dist/bridges/firebase.js.map +1 -0
- package/dist/bridges/firebase.mjs +25 -0
- package/dist/bridges/firebase.mjs.map +1 -0
- package/dist/bridges/jotai.d.mts +11 -0
- package/dist/bridges/jotai.d.ts +11 -0
- package/dist/bridges/jotai.js +870 -0
- package/dist/bridges/jotai.js.map +1 -0
- package/dist/bridges/jotai.mjs +827 -0
- package/dist/bridges/jotai.mjs.map +1 -0
- package/dist/bridges/motion.d.mts +6 -0
- package/dist/bridges/motion.d.ts +6 -0
- package/dist/bridges/motion.js +3752 -0
- package/dist/bridges/motion.js.map +1 -0
- package/dist/bridges/motion.mjs +3721 -0
- package/dist/bridges/motion.mjs.map +1 -0
- package/dist/bridges/next.d.mts +10 -0
- package/dist/bridges/next.d.ts +10 -0
- package/dist/bridges/next.js +2588 -0
- package/dist/bridges/next.js.map +1 -0
- package/dist/bridges/next.mjs +2582 -0
- package/dist/bridges/next.mjs.map +1 -0
- package/dist/bridges/redux.d.mts +15 -0
- package/dist/bridges/redux.d.ts +15 -0
- package/dist/bridges/redux.js +410 -0
- package/dist/bridges/redux.js.map +1 -0
- package/dist/bridges/redux.mjs +402 -0
- package/dist/bridges/redux.mjs.map +1 -0
- package/dist/bridges/remix.d.mts +1 -0
- package/dist/bridges/remix.d.ts +1 -0
- package/dist/bridges/remix.js +2215 -0
- package/dist/bridges/remix.js.map +1 -0
- package/dist/bridges/remix.mjs +2174 -0
- package/dist/bridges/remix.mjs.map +1 -0
- package/dist/bridges/stripe.d.mts +15 -0
- package/dist/bridges/stripe.d.ts +15 -0
- package/dist/bridges/stripe.js +1572 -0
- package/dist/bridges/stripe.js.map +1 -0
- package/dist/bridges/stripe.mjs +1556 -0
- package/dist/bridges/stripe.mjs.map +1 -0
- package/dist/bridges/supabase.d.mts +13 -0
- package/dist/bridges/supabase.d.ts +13 -0
- package/dist/bridges/supabase.js +51 -0
- package/dist/bridges/supabase.js.map +1 -0
- package/dist/bridges/supabase.mjs +24 -0
- package/dist/bridges/supabase.mjs.map +1 -0
- package/dist/bridges/tanstack.d.mts +3 -0
- package/dist/bridges/tanstack.d.ts +3 -0
- package/dist/bridges/tanstack.js +1319 -0
- package/dist/bridges/tanstack.js.map +1 -0
- package/dist/bridges/tanstack.mjs +1281 -0
- package/dist/bridges/tanstack.mjs.map +1 -0
- package/dist/bridges/yup.d.mts +16 -0
- package/dist/bridges/yup.d.ts +16 -0
- package/dist/bridges/yup.js +80 -0
- package/dist/bridges/yup.js.map +1 -0
- package/dist/bridges/yup.mjs +43 -0
- package/dist/bridges/yup.mjs.map +1 -0
- package/dist/bridges/zod.d.mts +19 -0
- package/dist/bridges/zod.d.ts +19 -0
- package/dist/bridges/zod.js +66 -0
- package/dist/bridges/zod.js.map +1 -0
- package/dist/bridges/zod.mjs +39 -0
- package/dist/bridges/zod.mjs.map +1 -0
- package/dist/bridges/zustand.d.mts +14 -0
- package/dist/bridges/zustand.d.ts +14 -0
- package/dist/bridges/zustand.js +58 -0
- package/dist/bridges/zustand.js.map +1 -0
- package/dist/bridges/zustand.mjs +21 -0
- package/dist/bridges/zustand.mjs.map +1 -0
- package/dist/index.d.mts +3124 -8
- package/dist/index.d.ts +3124 -8
- package/dist/index.js +4290 -10
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4172 -7
- package/dist/index.mjs.map +1 -0
- package/package.json +131 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../node_modules/framer-motion/src/utils/use-constant.ts","../../node_modules/framer-motion/src/utils/is-browser.ts","../../node_modules/framer-motion/src/utils/use-isomorphic-effect.ts","../../node_modules/motion-utils/src/array.ts","../../node_modules/motion-utils/src/clamp.ts","../../node_modules/motion-utils/src/format-error-message.ts","../../node_modules/motion-utils/src/errors.ts","../../node_modules/motion-utils/src/global-config.ts","../../node_modules/motion-utils/src/is-object.ts","../../node_modules/motion-utils/src/memo.ts","../../node_modules/motion-utils/src/noop.ts","../../node_modules/motion-utils/src/pipe.ts","../../node_modules/motion-utils/src/progress.ts","../../node_modules/motion-utils/src/subscription-manager.ts","../../node_modules/motion-utils/src/time-conversion.ts","../../node_modules/motion-utils/src/velocity-per-second.ts","../../node_modules/motion-utils/src/warn-once.ts","../../node_modules/motion-utils/src/easing/cubic-bezier.ts","../../node_modules/motion-utils/src/easing/modifiers/mirror.ts","../../node_modules/motion-utils/src/easing/modifiers/reverse.ts","../../node_modules/motion-utils/src/easing/back.ts","../../node_modules/motion-utils/src/easing/anticipate.ts","../../node_modules/motion-utils/src/easing/circ.ts","../../node_modules/motion-utils/src/easing/ease.ts","../../node_modules/motion-utils/src/easing/utils/is-easing-array.ts","../../node_modules/motion-utils/src/easing/utils/is-bezier-definition.ts","../../node_modules/motion-utils/src/easing/utils/map.ts","../../node_modules/motion-dom/src/frameloop/order.ts","../../node_modules/motion-dom/src/stats/buffer.ts","../../node_modules/motion-dom/src/frameloop/render-step.ts","../../node_modules/motion-dom/src/frameloop/batcher.ts","../../node_modules/motion-dom/src/frameloop/frame.ts","../../node_modules/motion-dom/src/frameloop/sync-time.ts","../../node_modules/motion-dom/src/stats/animation-count.ts","../../node_modules/motion-dom/src/animation/utils/is-css-variable.ts","../../node_modules/motion-dom/src/value/types/numbers/index.ts","../../node_modules/motion-dom/src/value/types/utils/sanitize.ts","../../node_modules/motion-dom/src/value/types/utils/float-regex.ts","../../node_modules/motion-dom/src/value/types/utils/is-nullish.ts","../../node_modules/motion-dom/src/value/types/utils/single-color-regex.ts","../../node_modules/motion-dom/src/value/types/color/utils.ts","../../node_modules/motion-dom/src/value/types/color/rgba.ts","../../node_modules/motion-dom/src/value/types/color/hex.ts","../../node_modules/motion-dom/src/value/types/numbers/units.ts","../../node_modules/motion-dom/src/value/types/color/hsla.ts","../../node_modules/motion-dom/src/value/types/color/index.ts","../../node_modules/motion-dom/src/value/types/utils/color-regex.ts","../../node_modules/motion-dom/src/value/types/complex/index.ts","../../node_modules/motion-dom/src/value/types/color/hsla-to-rgba.ts","../../node_modules/motion-dom/src/utils/mix/immediate.ts","../../node_modules/motion-dom/src/utils/mix/number.ts","../../node_modules/motion-dom/src/utils/mix/color.ts","../../node_modules/motion-dom/src/utils/mix/visibility.ts","../../node_modules/motion-dom/src/utils/mix/complex.ts","../../node_modules/motion-dom/src/utils/mix/index.ts","../../node_modules/motion-dom/src/animation/drivers/frame.ts","../../node_modules/motion-dom/src/animation/waapi/utils/linear.ts","../../node_modules/motion-dom/src/animation/generators/utils/calc-duration.ts","../../node_modules/motion-dom/src/animation/generators/utils/create-generator-easing.ts","../../node_modules/motion-dom/src/animation/generators/utils/velocity.ts","../../node_modules/motion-dom/src/animation/generators/spring/defaults.ts","../../node_modules/motion-dom/src/animation/generators/spring/find.ts","../../node_modules/motion-dom/src/animation/generators/spring/index.ts","../../node_modules/motion-dom/src/animation/generators/inertia.ts","../../node_modules/motion-dom/src/utils/interpolate.ts","../../node_modules/motion-dom/src/animation/keyframes/offsets/fill.ts","../../node_modules/motion-dom/src/animation/keyframes/offsets/default.ts","../../node_modules/motion-dom/src/animation/keyframes/offsets/time.ts","../../node_modules/motion-dom/src/animation/generators/keyframes.ts","../../node_modules/motion-dom/src/animation/keyframes/get-final.ts","../../node_modules/motion-dom/src/animation/utils/replace-transition-type.ts","../../node_modules/motion-dom/src/animation/utils/WithPromise.ts","../../node_modules/motion-dom/src/animation/JSAnimation.ts","../../node_modules/motion-dom/src/animation/keyframes/utils/fill-wildcards.ts","../../node_modules/motion-dom/src/render/dom/parse-transform.ts","../../node_modules/motion-dom/src/render/utils/keys-transform.ts","../../node_modules/motion-dom/src/animation/keyframes/utils/unit-conversion.ts","../../node_modules/motion-dom/src/animation/keyframes/KeyframesResolver.ts","../../node_modules/motion-dom/src/render/dom/is-css-var.ts","../../node_modules/motion-dom/src/render/dom/style-set.ts","../../node_modules/motion-dom/src/utils/supports/scroll-timeline.ts","../../node_modules/motion-dom/src/utils/supports/flags.ts","../../node_modules/motion-dom/src/utils/supports/memo.ts","../../node_modules/motion-dom/src/utils/supports/linear-easing.ts","../../node_modules/motion-dom/src/animation/waapi/easing/cubic-bezier.ts","../../node_modules/motion-dom/src/animation/waapi/easing/supported.ts","../../node_modules/motion-dom/src/animation/waapi/easing/map-easing.ts","../../node_modules/motion-dom/src/animation/waapi/start-waapi-animation.ts","../../node_modules/motion-dom/src/animation/generators/utils/is-generator.ts","../../node_modules/motion-dom/src/animation/waapi/utils/apply-generator.ts","../../node_modules/motion-dom/src/animation/NativeAnimation.ts","../../node_modules/motion-dom/src/animation/waapi/utils/unsupported-easing.ts","../../node_modules/motion-dom/src/animation/NativeAnimationExtended.ts","../../node_modules/motion-dom/src/animation/utils/is-animatable.ts","../../node_modules/motion-dom/src/animation/utils/can-animate.ts","../../node_modules/motion-dom/src/animation/utils/make-animation-instant.ts","../../node_modules/motion-dom/src/animation/waapi/supports/waapi.ts","../../node_modules/motion-dom/src/animation/AsyncMotionValueAnimation.ts","../../node_modules/motion-dom/src/animation/utils/calc-child-stagger.ts","../../node_modules/motion-dom/src/animation/utils/default-transitions.ts","../../node_modules/motion-dom/src/animation/utils/get-final-keyframe.ts","../../node_modules/motion-dom/src/animation/utils/get-value-transition.ts","../../node_modules/motion-dom/src/animation/utils/is-transition-defined.ts","../../node_modules/motion-dom/src/animation/interfaces/motion-value.ts","../../node_modules/motion-dom/src/render/utils/resolve-variants.ts","../../node_modules/motion-dom/src/render/utils/resolve-dynamic-variants.ts","../../node_modules/motion-dom/src/render/utils/keys-position.ts","../../node_modules/motion-dom/src/value/index.ts","../../node_modules/motion-dom/src/render/utils/is-keyframes-target.ts","../../node_modules/motion-dom/src/render/utils/setters.ts","../../node_modules/motion-dom/src/value/utils/is-motion-value.ts","../../node_modules/motion-dom/src/value/will-change/is.ts","../../node_modules/motion-dom/src/value/will-change/add-will-change.ts","../../node_modules/motion-dom/src/render/dom/utils/camel-to-dash.ts","../../node_modules/motion-dom/src/animation/optimized-appear/data-id.ts","../../node_modules/motion-dom/src/animation/optimized-appear/get-appear-id.ts","../../node_modules/motion-dom/src/animation/interfaces/visual-element-target.ts","../../node_modules/motion-dom/src/animation/interfaces/visual-element-variant.ts","../../node_modules/motion-dom/src/animation/interfaces/visual-element.ts","../../node_modules/motion-dom/src/utils/resolve-elements.ts","../../node_modules/motion-dom/src/utils/is-html-element.ts","../../node_modules/motion-dom/src/utils/is-svg-element.ts","../../node_modules/motion-dom/src/resize/handle-element.ts","../../node_modules/motion-dom/src/resize/handle-window.ts","../../node_modules/motion-dom/src/resize/index.ts","../../node_modules/motion-dom/src/scroll/observe.ts","../../node_modules/motion-dom/src/utils/transform.ts","../../node_modules/motion-dom/src/value/follow-value.ts","../../node_modules/framer-motion/src/context/MotionConfigContext.tsx","../../node_modules/framer-motion/src/render/dom/scroll/info.ts","../../node_modules/framer-motion/src/render/dom/scroll/offsets/inset.ts","../../node_modules/framer-motion/src/render/dom/scroll/offsets/edge.ts","../../node_modules/framer-motion/src/render/dom/scroll/offsets/offset.ts","../../node_modules/framer-motion/src/render/dom/scroll/offsets/presets.ts","../../node_modules/framer-motion/src/render/dom/scroll/offsets/index.ts","../../node_modules/framer-motion/src/render/dom/scroll/on-scroll-handler.ts","../../node_modules/framer-motion/src/render/dom/scroll/track.ts","../../node_modules/framer-motion/src/render/dom/scroll/utils/get-timeline.ts","../../node_modules/framer-motion/src/render/dom/scroll/attach-animation.ts","../../node_modules/framer-motion/src/render/dom/scroll/attach-function.ts","../../node_modules/framer-motion/src/render/dom/scroll/index.ts","../../node_modules/framer-motion/src/value/use-scroll.ts","../../node_modules/framer-motion/src/value/use-motion-value.ts","../../node_modules/framer-motion/src/value/use-combine-values.ts","../../node_modules/framer-motion/src/value/use-computed.ts","../../node_modules/framer-motion/src/value/use-transform.ts","../../node_modules/framer-motion/src/value/use-follow-value.ts","../../node_modules/framer-motion/src/value/use-spring.ts","../../node_modules/framer-motion/src/animation/hooks/animation-controls.ts","../../node_modules/framer-motion/src/animation/hooks/use-animation.ts","../../src/bridges/motion/index.ts"],"sourcesContent":["\"use client\"\n\nimport { useRef } from \"react\"\n\ntype Init<T> = () => T\n\n/**\n * Creates a constant value over the lifecycle of a component.\n *\n * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer\n * a guarantee that it won't re-run for performance reasons later on. By using `useConstant`\n * you can ensure that initialisers don't execute twice or more.\n */\nexport function useConstant<T>(init: Init<T>) {\n const ref = useRef<T | null>(null)\n\n if (ref.current === null) {\n ref.current = init()\n }\n\n return ref.current\n}\n","export const isBrowser = typeof window !== \"undefined\"\n","\"use client\"\n\nimport { useEffect, useLayoutEffect } from \"react\"\nimport { isBrowser } from \"./is-browser\"\n\nexport const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect\n","export function addUniqueItem<T>(arr: T[], item: T) {\n if (arr.indexOf(item) === -1) arr.push(item)\n}\n\nexport function removeItem<T>(arr: T[], item: T) {\n const index = arr.indexOf(item)\n if (index > -1) arr.splice(index, 1)\n}\n\n// Adapted from array-move\nexport function moveItem<T>([...arr]: T[], fromIndex: number, toIndex: number) {\n const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex\n\n if (startIndex >= 0 && startIndex < arr.length) {\n const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex\n\n const [item] = arr.splice(fromIndex, 1)\n arr.splice(endIndex, 0, item)\n }\n\n return arr\n}\n","export const clamp = (min: number, max: number, v: number) => {\n if (v > max) return max\n if (v < min) return min\n return v\n}\n","export function formatErrorMessage(message: string, errorCode?: string) {\n return errorCode\n ? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`\n : message\n}\n","import { formatErrorMessage } from \"./format-error-message\"\n\nexport type DevMessage = (\n check: boolean,\n message: string,\n errorCode?: string\n) => void\n\nlet warning: DevMessage = () => {}\nlet invariant: DevMessage = () => {}\n\nif (\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\"\n) {\n warning = (check, message, errorCode) => {\n if (!check && typeof console !== \"undefined\") {\n console.warn(formatErrorMessage(message, errorCode))\n }\n }\n\n invariant = (check, message, errorCode) => {\n if (!check) {\n throw new Error(formatErrorMessage(message, errorCode))\n }\n }\n}\n\nexport { invariant, warning }\n","export const MotionGlobalConfig: {\n skipAnimations?: boolean\n instantAnimations?: boolean\n useManualTiming?: boolean\n WillChange?: any\n mix?: <T>(a: T, b: T) => (p: number) => T\n} = {}\n","export function isObject(value: unknown): value is object {\n return typeof value === \"object\" && value !== null\n}\n","/*#__NO_SIDE_EFFECTS__*/\nexport function memo<T extends any>(callback: () => T) {\n let result: T | undefined\n\n return () => {\n if (result === undefined) result = callback()\n return result\n }\n}\n","/*#__NO_SIDE_EFFECTS__*/\nexport const noop = <T>(any: T): T => any\n","/**\n * Pipe\n * Compose other transformers to run linearily\n * pipe(min(20), max(40))\n * @param {...functions} transformers\n * @return {function}\n */\nconst combineFunctions = (a: Function, b: Function) => (v: any) => b(a(v))\nexport const pipe = (...transformers: Function[]) =>\n transformers.reduce(combineFunctions)\n","/*\n Progress within given range\n\n Given a lower limit and an upper limit, we return the progress\n (expressed as a number 0-1) represented by the given value, and\n limit that progress to within 0-1.\n\n @param [number]: Lower limit\n @param [number]: Upper limit\n @param [number]: Value to find progress within given range\n @return [number]: Progress of value within range as expressed 0-1\n*/\n/*#__NO_SIDE_EFFECTS__*/\nexport const progress = (from: number, to: number, value: number) => {\n const toFromDifference = to - from\n\n return toFromDifference === 0 ? 1 : (value - from) / toFromDifference\n}\n","import { addUniqueItem, removeItem } from \"./array\"\n\ntype GenericHandler = (...args: any) => void\n\nexport class SubscriptionManager<Handler extends GenericHandler> {\n private subscriptions: Handler[] = []\n\n add(handler: Handler): VoidFunction {\n addUniqueItem(this.subscriptions, handler)\n return () => removeItem(this.subscriptions, handler)\n }\n\n notify(\n a?: Parameters<Handler>[0],\n b?: Parameters<Handler>[1],\n c?: Parameters<Handler>[2]\n ) {\n const numSubscriptions = this.subscriptions.length\n\n if (!numSubscriptions) return\n\n if (numSubscriptions === 1) {\n /**\n * If there's only a single handler we can just call it without invoking a loop.\n */\n this.subscriptions[0](a, b, c)\n } else {\n for (let i = 0; i < numSubscriptions; i++) {\n /**\n * Check whether the handler exists before firing as it's possible\n * the subscriptions were modified during this loop running.\n */\n const handler = this.subscriptions[i]\n handler && handler(a, b, c)\n }\n }\n }\n\n getSize() {\n return this.subscriptions.length\n }\n\n clear() {\n this.subscriptions.length = 0\n }\n}\n","/**\n * Converts seconds to milliseconds\n *\n * @param seconds - Time in seconds.\n * @return milliseconds - Converted time in milliseconds.\n */\n\n/*#__NO_SIDE_EFFECTS__*/\nexport const secondsToMilliseconds = (seconds: number) => seconds * 1000\n\n/*#__NO_SIDE_EFFECTS__*/\nexport const millisecondsToSeconds = (milliseconds: number) =>\n milliseconds / 1000\n","/*\n Convert velocity into velocity per second\n\n @param [number]: Unit per frame\n @param [number]: Frame duration in ms\n*/\nexport function velocityPerSecond(velocity: number, frameDuration: number) {\n return frameDuration ? velocity * (1000 / frameDuration) : 0\n}\n","import { formatErrorMessage } from \"./format-error-message\"\n\nconst warned = new Set<string>()\n\nexport function hasWarned(message: string) {\n return warned.has(message)\n}\n\nexport function warnOnce(\n condition: boolean,\n message: string,\n errorCode?: string\n) {\n if (condition || warned.has(message)) return\n\n console.warn(formatErrorMessage(message, errorCode))\n warned.add(message)\n}\n","/*\n Bezier function generator\n This has been modified from Gaëtan Renaudeau's BezierEasing\n https://github.com/gre/bezier-easing/blob/master/src/index.js\n https://github.com/gre/bezier-easing/blob/master/LICENSE\n \n I've removed the newtonRaphsonIterate algo because in benchmarking it\n wasn't noticeably faster than binarySubdivision, indeed removing it\n usually improved times, depending on the curve.\n I also removed the lookup table, as for the added bundle size and loop we're\n only cutting ~4 or so subdivision iterations. I bumped the max iterations up\n to 12 to compensate and this still tended to be faster for no perceivable\n loss in accuracy.\n Usage\n const easeOut = cubicBezier(.17,.67,.83,.67);\n const x = easeOut(0.5); // returns 0.627...\n*/\n\nimport { noop } from \"../noop\"\n\n// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\nconst calcBezier = (t: number, a1: number, a2: number) =>\n (((1.0 - 3.0 * a2 + 3.0 * a1) * t + (3.0 * a2 - 6.0 * a1)) * t + 3.0 * a1) *\n t\n\nconst subdivisionPrecision = 0.0000001\nconst subdivisionMaxIterations = 12\n\nfunction binarySubdivide(\n x: number,\n lowerBound: number,\n upperBound: number,\n mX1: number,\n mX2: number\n) {\n let currentX: number\n let currentT: number\n let i: number = 0\n\n do {\n currentT = lowerBound + (upperBound - lowerBound) / 2.0\n currentX = calcBezier(currentT, mX1, mX2) - x\n if (currentX > 0.0) {\n upperBound = currentT\n } else {\n lowerBound = currentT\n }\n } while (\n Math.abs(currentX) > subdivisionPrecision &&\n ++i < subdivisionMaxIterations\n )\n\n return currentT\n}\n\nexport function cubicBezier(\n mX1: number,\n mY1: number,\n mX2: number,\n mY2: number\n) {\n // If this is a linear gradient, return linear easing\n if (mX1 === mY1 && mX2 === mY2) return noop\n\n const getTForX = (aX: number) => binarySubdivide(aX, 0, 1, mX1, mX2)\n\n // If animation is at start/end, return t without easing\n return (t: number) =>\n t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2)\n}\n","// Accepts an easing function and returns a new one that outputs mirrored values for\n\nimport { EasingModifier } from \"../types\"\n\n// the second half of the animation. Turns easeIn into easeInOut.\nexport const mirrorEasing: EasingModifier = (easing) => (p) =>\n p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2\n","// Accepts an easing function and returns a new one that outputs reversed values.\n\nimport { EasingModifier } from \"../types\"\n\n// Turns easeIn into easeOut.\nexport const reverseEasing: EasingModifier = (easing) => (p) =>\n 1 - easing(1 - p)\n","import { cubicBezier } from \"./cubic-bezier\"\nimport { mirrorEasing } from \"./modifiers/mirror\"\nimport { reverseEasing } from \"./modifiers/reverse\"\n\nexport const backOut = /*@__PURE__*/ cubicBezier(0.33, 1.53, 0.69, 0.99)\nexport const backIn = /*@__PURE__*/ reverseEasing(backOut)\nexport const backInOut = /*@__PURE__*/ mirrorEasing(backIn)\n","import { backIn } from \"./back\"\n\nexport const anticipate = (p: number) =>\n (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)))\n","import { mirrorEasing } from \"./modifiers/mirror\"\nimport { reverseEasing } from \"./modifiers/reverse\"\nimport { EasingFunction } from \"./types\"\n\nexport const circIn: EasingFunction = (p) => 1 - Math.sin(Math.acos(p))\nexport const circOut = reverseEasing(circIn)\nexport const circInOut = mirrorEasing(circIn)\n","import { cubicBezier } from \"./cubic-bezier\"\n\nexport const easeIn = /*@__PURE__*/ cubicBezier(0.42, 0, 1, 1)\nexport const easeOut = /*@__PURE__*/ cubicBezier(0, 0, 0.58, 1)\nexport const easeInOut = /*@__PURE__*/ cubicBezier(0.42, 0, 0.58, 1)\n","import { Easing } from \"../types\"\n\nexport const isEasingArray = (ease: any): ease is Easing[] => {\n return Array.isArray(ease) && typeof ease[0] !== \"number\"\n}\n","import { BezierDefinition, Easing } from \"../types\"\n\nexport const isBezierDefinition = (\n easing: Easing | Easing[]\n): easing is BezierDefinition =>\n Array.isArray(easing) && typeof easing[0] === \"number\"\n","import { invariant } from \"../../errors\"\nimport { noop } from \"../../noop\"\nimport { anticipate } from \"../anticipate\"\nimport { backIn, backInOut, backOut } from \"../back\"\nimport { circIn, circInOut, circOut } from \"../circ\"\nimport { cubicBezier } from \"../cubic-bezier\"\nimport { easeIn, easeInOut, easeOut } from \"../ease\"\nimport { Easing, EasingFunction } from \"../types\"\nimport { isBezierDefinition } from \"./is-bezier-definition\"\n\nconst easingLookup = {\n linear: noop,\n easeIn,\n easeInOut,\n easeOut,\n circIn,\n circInOut,\n circOut,\n backIn,\n backInOut,\n backOut,\n anticipate,\n}\n\nconst isValidEasing = (easing: Easing): easing is keyof typeof easingLookup => {\n return typeof easing === \"string\"\n}\n\nexport const easingDefinitionToFunction = (\n definition: Easing\n): EasingFunction => {\n if (isBezierDefinition(definition)) {\n // If cubic bezier definition, create bezier curve\n invariant(\n definition.length === 4,\n `Cubic bezier arrays must contain four numerical values.`,\n \"cubic-bezier-length\"\n )\n\n const [x1, y1, x2, y2] = definition\n return cubicBezier(x1, y1, x2, y2)\n } else if (isValidEasing(definition)) {\n // Else lookup from table\n invariant(\n easingLookup[definition] !== undefined,\n `Invalid easing type '${definition}'`,\n \"invalid-easing-type\"\n )\n return easingLookup[definition]\n }\n\n return definition\n}\n","import { StepId } from \"./types\"\n\nexport const stepsOrder: StepId[] = [\n \"setup\", // Compute\n \"read\", // Read\n \"resolveKeyframes\", // Write/Read/Write/Read\n \"preUpdate\", // Compute\n \"update\", // Compute\n \"preRender\", // Compute\n \"render\", // Write\n \"postRender\", // Compute\n] as const\n\nexport type StepNames = (typeof stepsOrder)[number]\n","import type { StatsRecording } from \"./types\"\n\nexport type InactiveStatsBuffer = {\n value: null\n addProjectionMetrics: null\n}\n\nexport type ActiveStatsBuffer = {\n value: StatsRecording\n addProjectionMetrics: (metrics: {\n nodes: number\n calculatedTargetDeltas: number\n calculatedProjections: number\n }) => void\n}\n\nexport const statsBuffer: InactiveStatsBuffer | ActiveStatsBuffer = {\n value: null,\n addProjectionMetrics: null,\n}\n","import { statsBuffer } from \"../stats/buffer\"\nimport { StepNames } from \"./order\"\nimport { FrameData, Process, Step } from \"./types\"\n\nexport function createRenderStep(\n runNextFrame: () => void,\n stepName?: StepNames\n): Step {\n /**\n * We create and reuse two queues, one to queue jobs for the current frame\n * and one for the next. We reuse to avoid triggering GC after x frames.\n */\n let thisFrame = new Set<Process>()\n let nextFrame = new Set<Process>()\n\n /**\n * Track whether we're currently processing jobs in this step. This way\n * we can decide whether to schedule new jobs for this frame or next.\n */\n let isProcessing = false\n\n let flushNextFrame = false\n\n /**\n * A set of processes which were marked keepAlive when scheduled.\n */\n const toKeepAlive = new WeakSet<Process>()\n\n let latestFrameData: FrameData = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n }\n\n let numCalls = 0\n\n function triggerCallback(callback: Process) {\n if (toKeepAlive.has(callback)) {\n step.schedule(callback)\n runNextFrame()\n }\n\n numCalls++\n callback(latestFrameData)\n }\n\n const step: Step = {\n /**\n * Schedule a process to run on the next frame.\n */\n schedule: (callback, keepAlive = false, immediate = false) => {\n const addToCurrentFrame = immediate && isProcessing\n const queue = addToCurrentFrame ? thisFrame : nextFrame\n\n if (keepAlive) toKeepAlive.add(callback)\n\n if (!queue.has(callback)) queue.add(callback)\n\n return callback\n },\n\n /**\n * Cancel the provided callback from running on the next frame.\n */\n cancel: (callback) => {\n nextFrame.delete(callback)\n toKeepAlive.delete(callback)\n },\n\n /**\n * Execute all schedule callbacks.\n */\n process: (frameData) => {\n latestFrameData = frameData\n\n /**\n * If we're already processing we've probably been triggered by a flushSync\n * inside an existing process. Instead of executing, mark flushNextFrame\n * as true and ensure we flush the following frame at the end of this one.\n */\n if (isProcessing) {\n flushNextFrame = true\n return\n }\n\n isProcessing = true\n\n // Swap this frame and the next to avoid GC\n ;[thisFrame, nextFrame] = [nextFrame, thisFrame]\n\n // Execute this frame\n thisFrame.forEach(triggerCallback)\n\n /**\n * If we're recording stats then\n */\n if (stepName && statsBuffer.value) {\n statsBuffer.value.frameloop[stepName].push(numCalls)\n }\n numCalls = 0\n\n // Clear the frame so no callbacks remain. This is to avoid\n // memory leaks should this render step not run for a while.\n thisFrame.clear()\n\n isProcessing = false\n\n if (flushNextFrame) {\n flushNextFrame = false\n step.process(frameData)\n }\n },\n }\n\n return step\n}\n","import { MotionGlobalConfig } from \"motion-utils\"\nimport { stepsOrder } from \"./order\"\nimport { createRenderStep } from \"./render-step\"\nimport { Batcher, FrameData, Process, Steps } from \"./types\"\n\nconst maxElapsed = 40\n\nexport function createRenderBatcher(\n scheduleNextBatch: (callback: Function) => void,\n allowKeepAlive: boolean\n) {\n let runNextFrame = false\n let useDefaultElapsed = true\n\n const state: FrameData = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n }\n\n const flagRunNextFrame = () => (runNextFrame = true)\n\n const steps = stepsOrder.reduce((acc, key) => {\n acc[key] = createRenderStep(\n flagRunNextFrame,\n allowKeepAlive ? key : undefined\n )\n return acc\n }, {} as Steps)\n\n const {\n setup,\n read,\n resolveKeyframes,\n preUpdate,\n update,\n preRender,\n render,\n postRender,\n } = steps\n\n const processBatch = () => {\n const timestamp = MotionGlobalConfig.useManualTiming\n ? state.timestamp\n : performance.now()\n runNextFrame = false\n\n if (!MotionGlobalConfig.useManualTiming) {\n state.delta = useDefaultElapsed\n ? 1000 / 60\n : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1)\n }\n\n state.timestamp = timestamp\n state.isProcessing = true\n\n // Unrolled render loop for better per-frame performance\n setup.process(state)\n read.process(state)\n resolveKeyframes.process(state)\n preUpdate.process(state)\n update.process(state)\n preRender.process(state)\n render.process(state)\n postRender.process(state)\n\n state.isProcessing = false\n\n if (runNextFrame && allowKeepAlive) {\n useDefaultElapsed = false\n scheduleNextBatch(processBatch)\n }\n }\n\n const wake = () => {\n runNextFrame = true\n useDefaultElapsed = true\n\n if (!state.isProcessing) {\n scheduleNextBatch(processBatch)\n }\n }\n\n const schedule = stepsOrder.reduce((acc, key) => {\n const step = steps[key]\n acc[key] = (process: Process, keepAlive = false, immediate = false) => {\n if (!runNextFrame) wake()\n\n return step.schedule(process, keepAlive, immediate)\n }\n return acc\n }, {} as Batcher)\n\n const cancel = (process: Process) => {\n for (let i = 0; i < stepsOrder.length; i++) {\n steps[stepsOrder[i]].cancel(process)\n }\n }\n\n return { schedule, cancel, state, steps }\n}\n","import { noop } from \"motion-utils\"\nimport { createRenderBatcher } from \"./batcher\"\n\nexport const {\n schedule: frame,\n cancel: cancelFrame,\n state: frameData,\n steps: frameSteps,\n} = /* @__PURE__ */ createRenderBatcher(\n typeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame : noop,\n true\n)\n","import { MotionGlobalConfig } from \"motion-utils\"\nimport { frameData } from \"./frame\"\n\nlet now: number | undefined\n\nfunction clearTime() {\n now = undefined\n}\n\n/**\n * An eventloop-synchronous alternative to performance.now().\n *\n * Ensures that time measurements remain consistent within a synchronous context.\n * Usually calling performance.now() twice within the same synchronous context\n * will return different values which isn't useful for animations when we're usually\n * trying to sync animations to the same frame.\n */\nexport const time = {\n now: (): number => {\n if (now === undefined) {\n time.set(\n frameData.isProcessing || MotionGlobalConfig.useManualTiming\n ? frameData.timestamp\n : performance.now()\n )\n }\n\n return now!\n },\n set: (newTime: number) => {\n now = newTime\n queueMicrotask(clearTime)\n },\n}\n","export const activeAnimations = {\n layout: 0,\n mainThread: 0,\n waapi: 0,\n}\n","import { AnyResolvedKeyframe } from \"../types\"\n\nexport type CSSVariableName = `--${string}`\n\nexport type CSSVariableToken = `var(${CSSVariableName})`\n\nconst checkStringStartsWith =\n <T extends string>(token: string) =>\n (key?: AnyResolvedKeyframe | null): key is T =>\n typeof key === \"string\" && key.startsWith(token)\n\nexport const isCSSVariableName =\n /*@__PURE__*/ checkStringStartsWith<CSSVariableName>(\"--\")\n\nconst startsAsVariableToken =\n /*@__PURE__*/ checkStringStartsWith<CSSVariableToken>(\"var(--\")\nexport const isCSSVariableToken = (\n value?: string\n): value is CSSVariableToken => {\n const startsWithToken = startsAsVariableToken(value)\n\n if (!startsWithToken) return false\n\n // Ensure any comments are stripped from the value as this can harm performance of the regex.\n return singleCssVariableRegex.test(value.split(\"/*\")[0].trim())\n}\n\nconst singleCssVariableRegex =\n /var\\(--(?:[\\w-]+\\s*|[\\w-]+\\s*,(?:\\s*[^)(\\s]|\\s*\\((?:[^)(]|\\([^)(]*\\))*\\))+\\s*)\\)$/iu\n\n/**\n * Check if a value contains a CSS variable anywhere (e.g. inside calc()).\n * Unlike isCSSVariableToken which checks if the value IS a var() token,\n * this checks if the value CONTAINS var() somewhere in the string.\n */\nexport function containsCSSVariable(\n value?: AnyResolvedKeyframe | null\n): boolean {\n if (typeof value !== \"string\") return false\n // Strip comments to avoid false positives\n return value.split(\"/*\")[0].includes(\"var(--\")\n}\n","import { clamp } from \"motion-utils\"\n\nexport const number = {\n test: (v: number) => typeof v === \"number\",\n parse: parseFloat,\n transform: (v: number) => v,\n}\n\nexport const alpha = {\n ...number,\n transform: (v: number) => clamp(0, 1, v),\n}\n\nexport const scale = {\n ...number,\n default: 1,\n}\n","// If this number is a decimal, make it just five decimal places\n// to avoid exponents\nexport const sanitize = (v: number) => Math.round(v * 100000) / 100000\n","export const floatRegex = /-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)/gu\n","export function isNullish(v: any): v is null | undefined {\n return v == null\n}\n","export const singleColorRegex =\n /^(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))$/iu\n","import { Color, HSLA, RGBA } from \"../types\"\nimport { floatRegex } from \"../utils/float-regex\"\nimport { isNullish } from \"../utils/is-nullish\"\nimport { singleColorRegex } from \"../utils/single-color-regex\"\n\n/**\n * Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000,\n * but false if a number or multiple colors\n */\nexport const isColorString = (type: string, testProp?: string) => (v: any) => {\n return Boolean(\n (typeof v === \"string\" &&\n singleColorRegex.test(v) &&\n v.startsWith(type)) ||\n (testProp &&\n !isNullish(v) &&\n Object.prototype.hasOwnProperty.call(v, testProp))\n )\n}\n\nexport const splitColor =\n <V extends RGBA | HSLA>(aName: string, bName: string, cName: string) =>\n (v: string | Color): V => {\n if (typeof v !== \"string\") return v as any\n\n const [a, b, c, alpha] = v.match(floatRegex) as any\n\n return {\n [aName]: parseFloat(a),\n [bName]: parseFloat(b),\n [cName]: parseFloat(c),\n alpha: alpha !== undefined ? parseFloat(alpha) : 1,\n } as V\n }\n","import { clamp } from \"motion-utils\"\nimport { alpha as alphaType, number } from \"../numbers\"\nimport { RGBA } from \"../types\"\nimport { sanitize } from \"../utils/sanitize\"\nimport { isColorString, splitColor } from \"./utils\"\n\nconst clampRgbUnit = (v: number) => clamp(0, 255, v)\nexport const rgbUnit = {\n ...number,\n transform: (v: number) => Math.round(clampRgbUnit(v)),\n}\n\nexport const rgba = {\n test: /*@__PURE__*/ isColorString(\"rgb\", \"red\"),\n parse: /*@__PURE__*/ splitColor<RGBA>(\"red\", \"green\", \"blue\"),\n transform: ({ red, green, blue, alpha = 1 }: RGBA) =>\n \"rgba(\" +\n rgbUnit.transform(red) +\n \", \" +\n rgbUnit.transform(green) +\n \", \" +\n rgbUnit.transform(blue) +\n \", \" +\n sanitize(alphaType.transform(alpha)) +\n \")\",\n}\n","import { RGBA } from \"../types\"\nimport { rgba } from \"./rgba\"\nimport { isColorString } from \"./utils\"\n\nfunction parseHex(v: string): RGBA {\n let r = \"\"\n let g = \"\"\n let b = \"\"\n let a = \"\"\n\n // If we have 6 characters, ie #FF0000\n if (v.length > 5) {\n r = v.substring(1, 3)\n g = v.substring(3, 5)\n b = v.substring(5, 7)\n a = v.substring(7, 9)\n\n // Or we have 3 characters, ie #F00\n } else {\n r = v.substring(1, 2)\n g = v.substring(2, 3)\n b = v.substring(3, 4)\n a = v.substring(4, 5)\n r += r\n g += g\n b += b\n a += a\n }\n\n return {\n red: parseInt(r, 16),\n green: parseInt(g, 16),\n blue: parseInt(b, 16),\n alpha: a ? parseInt(a, 16) / 255 : 1,\n }\n}\n\nexport const hex = {\n test: /*@__PURE__*/ isColorString(\"#\"),\n parse: parseHex,\n transform: rgba.transform,\n}\n","import { AnyResolvedKeyframe } from \"../../../animation/types\"\n\n/*#__NO_SIDE_EFFECTS__*/\nconst createUnitType = (unit: string) => ({\n test: (v: AnyResolvedKeyframe) =>\n typeof v === \"string\" && v.endsWith(unit) && v.split(\" \").length === 1,\n parse: parseFloat,\n transform: (v: number | string) => `${v}${unit}`,\n})\n\nexport const degrees = /*@__PURE__*/ createUnitType(\"deg\")\nexport const percent = /*@__PURE__*/ createUnitType(\"%\")\nexport const px = /*@__PURE__*/ createUnitType(\"px\")\nexport const vh = /*@__PURE__*/ createUnitType(\"vh\")\nexport const vw = /*@__PURE__*/ createUnitType(\"vw\")\n\nexport const progressPercentage = /*@__PURE__*/ (() => ({\n ...percent,\n parse: (v: string) => percent.parse(v) / 100,\n transform: (v: number) => percent.transform(v * 100),\n}))()\n","import { alpha as alphaType } from \"../numbers\"\nimport { percent } from \"../numbers/units\"\nimport { HSLA } from \"../types\"\nimport { sanitize } from \"../utils/sanitize\"\nimport { isColorString, splitColor } from \"./utils\"\n\nexport const hsla = {\n test: /*@__PURE__*/ isColorString(\"hsl\", \"hue\"),\n parse: /*@__PURE__*/ splitColor<HSLA>(\"hue\", \"saturation\", \"lightness\"),\n transform: ({ hue, saturation, lightness, alpha = 1 }: HSLA) => {\n return (\n \"hsla(\" +\n Math.round(hue) +\n \", \" +\n percent.transform(sanitize(saturation)) +\n \", \" +\n percent.transform(sanitize(lightness)) +\n \", \" +\n sanitize(alphaType.transform(alpha)) +\n \")\"\n )\n },\n}\n","import { HSLA, RGBA } from \"../types\"\nimport { hex } from \"./hex\"\nimport { hsla } from \"./hsla\"\nimport { rgba } from \"./rgba\"\n\nexport const color = {\n test: (v: any) => rgba.test(v) || hex.test(v) || hsla.test(v),\n parse: (v: any): RGBA | HSLA => {\n if (rgba.test(v)) {\n return rgba.parse(v)\n } else if (hsla.test(v)) {\n return hsla.parse(v)\n } else {\n return hex.parse(v)\n }\n },\n transform: (v: HSLA | RGBA | string) => {\n return typeof v === \"string\"\n ? v\n : v.hasOwnProperty(\"red\")\n ? rgba.transform(v as RGBA)\n : hsla.transform(v as HSLA)\n },\n getAnimatableNone: (v: string) => {\n const parsed = color.parse(v)\n parsed.alpha = 0\n return color.transform(parsed)\n },\n}\n","export const colorRegex =\n /(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))/giu\n","import { AnyResolvedKeyframe } from \"../../../animation/types\"\nimport { CSSVariableToken } from \"../../../animation/utils/is-css-variable\"\nimport { color } from \"../color\"\nimport { Color } from \"../types\"\nimport { colorRegex } from \"../utils/color-regex\"\nimport { floatRegex } from \"../utils/float-regex\"\nimport { sanitize } from \"../utils/sanitize\"\n\nfunction test(v: any) {\n return (\n isNaN(v) &&\n typeof v === \"string\" &&\n (v.match(floatRegex)?.length || 0) +\n (v.match(colorRegex)?.length || 0) >\n 0\n )\n}\n\nconst NUMBER_TOKEN = \"number\"\nconst COLOR_TOKEN = \"color\"\nconst VAR_TOKEN = \"var\"\nconst VAR_FUNCTION_TOKEN = \"var(\"\nconst SPLIT_TOKEN = \"${}\"\n\nexport type ComplexValues = Array<\n CSSVariableToken | AnyResolvedKeyframe | Color\n>\n\nexport interface ValueIndexes {\n color: number[]\n number: number[]\n var: number[]\n}\n\nexport interface ComplexValueInfo {\n values: ComplexValues\n split: string[]\n indexes: ValueIndexes\n types: Array<keyof ValueIndexes>\n}\n\n// this regex consists of the `singleCssVariableRegex|rgbHSLValueRegex|digitRegex`\nconst complexRegex =\n /var\\s*\\(\\s*--(?:[\\w-]+\\s*|[\\w-]+\\s*,(?:\\s*[^)(\\s]|\\s*\\((?:[^)(]|\\([^)(]*\\))*\\))+\\s*)\\)|#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\)|-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)/giu\n\nexport function analyseComplexValue(\n value: AnyResolvedKeyframe\n): ComplexValueInfo {\n const originalValue = value.toString()\n\n const values: ComplexValues = []\n const indexes: ValueIndexes = {\n color: [],\n number: [],\n var: [],\n }\n const types: Array<keyof ValueIndexes> = []\n\n let i = 0\n const tokenised = originalValue.replace(complexRegex, (parsedValue) => {\n if (color.test(parsedValue)) {\n indexes.color.push(i)\n types.push(COLOR_TOKEN)\n values.push(color.parse(parsedValue))\n } else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {\n indexes.var.push(i)\n types.push(VAR_TOKEN)\n values.push(parsedValue)\n } else {\n indexes.number.push(i)\n types.push(NUMBER_TOKEN)\n values.push(parseFloat(parsedValue))\n }\n ++i\n return SPLIT_TOKEN\n })\n const split = tokenised.split(SPLIT_TOKEN)\n\n return { values, split, indexes, types }\n}\n\nfunction parseComplexValue(v: AnyResolvedKeyframe) {\n return analyseComplexValue(v).values\n}\n\nfunction createTransformer(source: AnyResolvedKeyframe) {\n const { split, types } = analyseComplexValue(source)\n\n const numSections = split.length\n return (v: Array<CSSVariableToken | Color | number | string>) => {\n let output = \"\"\n for (let i = 0; i < numSections; i++) {\n output += split[i]\n if (v[i] !== undefined) {\n const type = types[i]\n if (type === NUMBER_TOKEN) {\n output += sanitize(v[i] as number)\n } else if (type === COLOR_TOKEN) {\n output += color.transform(v[i] as Color)\n } else {\n output += v[i]\n }\n }\n }\n\n return output\n }\n}\n\nconst convertNumbersToZero = (v: number | string) =>\n typeof v === \"number\" ? 0 : color.test(v) ? color.getAnimatableNone(v) : v\n\nfunction getAnimatableNone(v: AnyResolvedKeyframe) {\n const parsed = parseComplexValue(v)\n const transformer = createTransformer(v)\n return transformer(parsed.map(convertNumbersToZero))\n}\n\nexport const complex = {\n test,\n parse: parseComplexValue,\n createTransformer,\n getAnimatableNone,\n}\n","import { HSLA, RGBA } from \"../types\"\n\n// Adapted from https://gist.github.com/mjackson/5311256\nfunction hueToRgb(p: number, q: number, t: number) {\n if (t < 0) t += 1\n if (t > 1) t -= 1\n if (t < 1 / 6) return p + (q - p) * 6 * t\n if (t < 1 / 2) return q\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6\n return p\n}\n\nexport function hslaToRgba({ hue, saturation, lightness, alpha }: HSLA): RGBA {\n hue /= 360\n saturation /= 100\n lightness /= 100\n\n let red = 0\n let green = 0\n let blue = 0\n\n if (!saturation) {\n red = green = blue = lightness\n } else {\n const q =\n lightness < 0.5\n ? lightness * (1 + saturation)\n : lightness + saturation - lightness * saturation\n const p = 2 * lightness - q\n\n red = hueToRgb(p, q, hue + 1 / 3)\n green = hueToRgb(p, q, hue)\n blue = hueToRgb(p, q, hue - 1 / 3)\n }\n\n return {\n red: Math.round(red * 255),\n green: Math.round(green * 255),\n blue: Math.round(blue * 255),\n alpha,\n }\n}\n","export function mixImmediate<T>(a: T, b: T) {\n return (p: number) => (p > 0 ? b : a)\n}\n","/*\n Value in range from progress\n\n Given a lower limit and an upper limit, we return the value within\n that range as expressed by progress (usually a number from 0 to 1)\n\n So progress = 0.5 would change\n\n from -------- to\n\n to\n\n from ---- to\n\n E.g. from = 10, to = 20, progress = 0.5 => 15\n\n @param [number]: Lower limit of range\n @param [number]: Upper limit of range\n @param [number]: The progress between lower and upper limits expressed 0-1\n @return [number]: Value as calculated from progress within range (not limited within range)\n*/\nexport const mixNumber = (from: number, to: number, progress: number) => {\n return from + (to - from) * progress\n}\n","import { warning } from \"motion-utils\"\nimport { hex } from \"../../value/types/color/hex\"\nimport { hsla } from \"../../value/types/color/hsla\"\nimport { hslaToRgba } from \"../../value/types/color/hsla-to-rgba\"\nimport { rgba } from \"../../value/types/color/rgba\"\nimport { Color, HSLA, RGBA } from \"../../value/types/types\"\nimport { mixImmediate } from \"./immediate\"\nimport { mixNumber } from \"./number\"\n\n// Linear color space blending\n// Explained https://www.youtube.com/watch?v=LKnqECcg6Gw\n// Demonstrated http://codepen.io/osublake/pen/xGVVaN\nexport const mixLinearColor = (from: number, to: number, v: number) => {\n const fromExpo = from * from\n const expo = v * (to * to - fromExpo) + fromExpo\n return expo < 0 ? 0 : Math.sqrt(expo)\n}\n\nconst colorTypes = [hex, rgba, hsla]\nconst getColorType = (v: Color | string) =>\n colorTypes.find((type) => type.test(v))\n\nfunction asRGBA(color: Color | string) {\n const type = getColorType(color)\n\n warning(\n Boolean(type),\n `'${color}' is not an animatable color. Use the equivalent color code instead.`,\n \"color-not-animatable\"\n )\n\n if (!Boolean(type)) return false\n\n let model = type!.parse(color)\n\n if (type === hsla) {\n // TODO Remove this cast - needed since Motion's stricter typing\n model = hslaToRgba(model as HSLA)\n }\n\n return model as RGBA\n}\n\nexport const mixColor = (from: Color | string, to: Color | string) => {\n const fromRGBA = asRGBA(from)\n const toRGBA = asRGBA(to)\n\n if (!fromRGBA || !toRGBA) {\n return mixImmediate(from, to)\n }\n\n const blended = { ...fromRGBA }\n\n return (v: number) => {\n blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v)\n blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v)\n blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v)\n blended.alpha = mixNumber(fromRGBA.alpha, toRGBA.alpha, v)\n return rgba.transform!(blended)\n }\n}\n","export const invisibleValues = new Set([\"none\", \"hidden\"])\n\n/**\n * Returns a function that, when provided a progress value between 0 and 1,\n * will return the \"none\" or \"hidden\" string only when the progress is that of\n * the origin or target.\n */\nexport function mixVisibility(origin: string, target: string) {\n if (invisibleValues.has(origin)) {\n return (p: number) => (p <= 0 ? origin : target)\n } else {\n return (p: number) => (p >= 1 ? target : origin)\n }\n}\n","import { pipe, warning } from \"motion-utils\"\nimport { AnyResolvedKeyframe } from \"../../animation/types\"\nimport { isCSSVariableToken } from \"../../animation/utils/is-css-variable\"\nimport { color } from \"../../value/types/color\"\nimport {\n analyseComplexValue,\n complex,\n ComplexValueInfo,\n ComplexValues,\n} from \"../../value/types/complex\"\nimport { HSLA, RGBA } from \"../../value/types/types\"\nimport { mixColor } from \"./color\"\nimport { mixImmediate } from \"./immediate\"\nimport { mixNumber as mixNumberImmediate } from \"./number\"\nimport { invisibleValues, mixVisibility } from \"./visibility\"\n\ntype MixableArray = Array<number | RGBA | HSLA | string>\ninterface MixableObject {\n [key: string]: AnyResolvedKeyframe | RGBA | HSLA\n}\n\nfunction mixNumber(a: number, b: number) {\n return (p: number) => mixNumberImmediate(a, b, p)\n}\n\nexport function getMixer<T>(a: T) {\n if (typeof a === \"number\") {\n return mixNumber\n } else if (typeof a === \"string\") {\n return isCSSVariableToken(a)\n ? mixImmediate\n : color.test(a)\n ? mixColor\n : mixComplex\n } else if (Array.isArray(a)) {\n return mixArray\n } else if (typeof a === \"object\") {\n return color.test(a) ? mixColor : mixObject\n }\n\n return mixImmediate\n}\n\nexport function mixArray(a: MixableArray, b: MixableArray) {\n const output = [...a]\n const numValues = output.length\n\n const blendValue = a.map((v, i) => getMixer(v)(v as any, b[i] as any))\n\n return (p: number) => {\n for (let i = 0; i < numValues; i++) {\n output[i] = blendValue[i](p) as any\n }\n return output\n }\n}\n\nexport function mixObject(a: MixableObject, b: MixableObject) {\n const output = { ...a, ...b }\n const blendValue: { [key: string]: (v: number) => any } = {}\n\n for (const key in output) {\n if (a[key] !== undefined && b[key] !== undefined) {\n blendValue[key] = getMixer(a[key])(\n a[key] as any,\n b[key] as any\n ) as any\n }\n }\n\n return (v: number) => {\n for (const key in blendValue) {\n output[key] = blendValue[key](v)\n }\n return output\n }\n}\n\nfunction matchOrder(\n origin: ComplexValueInfo,\n target: ComplexValueInfo\n): ComplexValues {\n const orderedOrigin: ComplexValues = []\n\n const pointers = { color: 0, var: 0, number: 0 }\n\n for (let i = 0; i < target.values.length; i++) {\n const type = target.types[i]\n const originIndex = origin.indexes[type][pointers[type]]\n const originValue = origin.values[originIndex] ?? 0\n\n orderedOrigin[i] = originValue\n\n pointers[type]++\n }\n\n return orderedOrigin\n}\n\nexport const mixComplex = (\n origin: AnyResolvedKeyframe,\n target: AnyResolvedKeyframe\n) => {\n const template = complex.createTransformer(target)\n const originStats = analyseComplexValue(origin)\n const targetStats = analyseComplexValue(target)\n const canInterpolate =\n originStats.indexes.var.length === targetStats.indexes.var.length &&\n originStats.indexes.color.length === targetStats.indexes.color.length &&\n originStats.indexes.number.length >= targetStats.indexes.number.length\n\n if (canInterpolate) {\n if (\n (invisibleValues.has(origin as string) &&\n !targetStats.values.length) ||\n (invisibleValues.has(target as string) &&\n !originStats.values.length)\n ) {\n return mixVisibility(origin as string, target as string)\n }\n\n return pipe(\n mixArray(matchOrder(originStats, targetStats), targetStats.values),\n template\n )\n } else {\n warning(\n true,\n `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,\n \"complex-values-different\"\n )\n\n return mixImmediate(origin, target)\n }\n}\n","import { getMixer } from \"./complex\"\nimport { mixNumber as mixNumberImmediate } from \"./number\"\nimport { Mixer } from \"./types\"\n\nexport function mix<T>(from: T, to: T): Mixer<T>\nexport function mix(from: number, to: number, p: number): number\nexport function mix<T>(from: T, to: T, p?: T): Mixer<T> | number {\n if (\n typeof from === \"number\" &&\n typeof to === \"number\" &&\n typeof p === \"number\"\n ) {\n return mixNumberImmediate(from, to, p)\n }\n\n const mixer = getMixer(from)\n return mixer(from as any, to as any) as Mixer<T>\n}\n","import { cancelFrame, frame, frameData } from \"../../frameloop\"\nimport { time } from \"../../frameloop/sync-time\"\nimport { FrameData } from \"../../frameloop/types\"\nimport { Driver } from \"./types\"\n\nexport const frameloopDriver: Driver = (update) => {\n const passTimestamp = ({ timestamp }: FrameData) => update(timestamp)\n\n return {\n start: (keepAlive = true) => frame.update(passTimestamp, keepAlive),\n stop: () => cancelFrame(passTimestamp),\n /**\n * If we're processing this frame we can use the\n * framelocked timestamp to keep things in sync.\n */\n now: () => (frameData.isProcessing ? frameData.timestamp : time.now()),\n }\n}\n","import { EasingFunction } from \"motion-utils\"\n\nexport const generateLinearEasing = (\n easing: EasingFunction,\n duration: number, // as milliseconds\n resolution: number = 10 // as milliseconds\n): string => {\n let points = \"\"\n const numPoints = Math.max(Math.round(duration / resolution), 2)\n\n for (let i = 0; i < numPoints; i++) {\n points += Math.round(easing(i / (numPoints - 1)) * 10000) / 10000 + \", \"\n }\n\n return `linear(${points.substring(0, points.length - 2)})`\n}\n","import { KeyframeGenerator } from \"../../types\"\n\n/**\n * Implement a practical max duration for keyframe generation\n * to prevent infinite loops\n */\nexport const maxGeneratorDuration = 20_000\nexport function calcGeneratorDuration(\n generator: KeyframeGenerator<unknown>\n): number {\n let duration = 0\n const timeStep = 50\n let state = generator.next(duration)\n while (!state.done && duration < maxGeneratorDuration) {\n duration += timeStep\n state = generator.next(duration)\n }\n\n return duration >= maxGeneratorDuration ? Infinity : duration\n}\n","import { millisecondsToSeconds } from \"motion-utils\"\nimport { GeneratorFactory, Transition } from \"../../types\"\nimport { calcGeneratorDuration, maxGeneratorDuration } from \"./calc-duration\"\n\n/**\n * Create a progress => progress easing function from a generator.\n */\nexport function createGeneratorEasing(\n options: Transition,\n scale = 100,\n createGenerator: GeneratorFactory\n) {\n const generator = createGenerator({ ...options, keyframes: [0, scale] })\n const duration = Math.min(\n calcGeneratorDuration(generator),\n maxGeneratorDuration\n )\n\n return {\n type: \"keyframes\",\n ease: (progress: number) => {\n return generator.next(duration * progress).value / scale\n },\n duration: millisecondsToSeconds(duration),\n }\n}\n","import { velocityPerSecond } from \"motion-utils\"\n\nconst velocitySampleDuration = 5 // ms\n\nexport function calcGeneratorVelocity(\n resolveValue: (v: number) => number,\n t: number,\n current: number\n) {\n const prevT = Math.max(t - velocitySampleDuration, 0)\n return velocityPerSecond(current - resolveValue(prevT), t - prevT)\n}\n","export const springDefaults = {\n // Default spring physics\n stiffness: 100,\n damping: 10,\n mass: 1.0,\n velocity: 0.0,\n\n // Default duration/bounce-based options\n duration: 800, // in ms\n bounce: 0.3,\n visualDuration: 0.3, // in seconds\n\n // Rest thresholds\n restSpeed: {\n granular: 0.01,\n default: 2,\n },\n restDelta: {\n granular: 0.005,\n default: 0.5,\n },\n\n // Limits\n minDuration: 0.01, // in seconds\n maxDuration: 10.0, // in seconds\n minDamping: 0.05,\n maxDamping: 1,\n}\n","import {\n clamp,\n millisecondsToSeconds,\n secondsToMilliseconds,\n warning,\n} from \"motion-utils\"\nimport { SpringOptions } from \"../../types\"\nimport { springDefaults } from \"./defaults\"\n\n/**\n * This is ported from the Framer implementation of duration-based spring resolution.\n */\n\ntype Resolver = (num: number) => number\n\nconst safeMin = 0.001\n\nexport function findSpring({\n duration = springDefaults.duration,\n bounce = springDefaults.bounce,\n velocity = springDefaults.velocity,\n mass = springDefaults.mass,\n}: SpringOptions) {\n let envelope: Resolver\n let derivative: Resolver\n\n warning(\n duration <= secondsToMilliseconds(springDefaults.maxDuration),\n \"Spring duration must be 10 seconds or less\",\n \"spring-duration-limit\"\n )\n\n let dampingRatio = 1 - bounce\n\n /**\n * Restrict dampingRatio and duration to within acceptable ranges.\n */\n dampingRatio = clamp(\n springDefaults.minDamping,\n springDefaults.maxDamping,\n dampingRatio\n )\n duration = clamp(\n springDefaults.minDuration,\n springDefaults.maxDuration,\n millisecondsToSeconds(duration)\n )\n\n if (dampingRatio < 1) {\n /**\n * Underdamped spring\n */\n envelope = (undampedFreq) => {\n const exponentialDecay = undampedFreq * dampingRatio\n const delta = exponentialDecay * duration\n const a = exponentialDecay - velocity\n const b = calcAngularFreq(undampedFreq, dampingRatio)\n const c = Math.exp(-delta)\n return safeMin - (a / b) * c\n }\n\n derivative = (undampedFreq) => {\n const exponentialDecay = undampedFreq * dampingRatio\n const delta = exponentialDecay * duration\n const d = delta * velocity + velocity\n const e =\n Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration\n const f = Math.exp(-delta)\n const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio)\n const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1\n return (factor * ((d - e) * f)) / g\n }\n } else {\n /**\n * Critically-damped spring\n */\n envelope = (undampedFreq) => {\n const a = Math.exp(-undampedFreq * duration)\n const b = (undampedFreq - velocity) * duration + 1\n return -safeMin + a * b\n }\n\n derivative = (undampedFreq) => {\n const a = Math.exp(-undampedFreq * duration)\n const b = (velocity - undampedFreq) * (duration * duration)\n return a * b\n }\n }\n\n const initialGuess = 5 / duration\n const undampedFreq = approximateRoot(envelope, derivative, initialGuess)\n\n duration = secondsToMilliseconds(duration)\n if (isNaN(undampedFreq)) {\n return {\n stiffness: springDefaults.stiffness,\n damping: springDefaults.damping,\n duration,\n }\n } else {\n const stiffness = Math.pow(undampedFreq, 2) * mass\n return {\n stiffness,\n damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),\n duration,\n }\n }\n}\n\nconst rootIterations = 12\nfunction approximateRoot(\n envelope: Resolver,\n derivative: Resolver,\n initialGuess: number\n): number {\n let result = initialGuess\n for (let i = 1; i < rootIterations; i++) {\n result = result - envelope(result) / derivative(result)\n }\n return result\n}\n\nexport function calcAngularFreq(undampedFreq: number, dampingRatio: number) {\n return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio)\n}\n","import {\n clamp,\n millisecondsToSeconds,\n secondsToMilliseconds,\n} from \"motion-utils\"\nimport {\n AnimationState,\n KeyframeGenerator,\n SpringOptions,\n Transition,\n ValueAnimationOptions,\n} from \"../../types\"\nimport { generateLinearEasing } from \"../../waapi/utils/linear\"\nimport {\n calcGeneratorDuration,\n maxGeneratorDuration,\n} from \"../utils/calc-duration\"\nimport { createGeneratorEasing } from \"../utils/create-generator-easing\"\nimport { calcGeneratorVelocity } from \"../utils/velocity\"\nimport { springDefaults } from \"./defaults\"\nimport { calcAngularFreq, findSpring } from \"./find\"\n\nconst durationKeys = [\"duration\", \"bounce\"]\nconst physicsKeys = [\"stiffness\", \"damping\", \"mass\"]\n\nfunction isSpringType(options: SpringOptions, keys: string[]) {\n return keys.some((key) => (options as any)[key] !== undefined)\n}\n\nfunction getSpringOptions(options: SpringOptions) {\n let springOptions = {\n velocity: springDefaults.velocity,\n stiffness: springDefaults.stiffness,\n damping: springDefaults.damping,\n mass: springDefaults.mass,\n isResolvedFromDuration: false,\n ...options,\n }\n // stiffness/damping/mass overrides duration/bounce\n if (\n !isSpringType(options, physicsKeys) &&\n isSpringType(options, durationKeys)\n ) {\n if (options.visualDuration) {\n const visualDuration = options.visualDuration\n const root = (2 * Math.PI) / (visualDuration * 1.2)\n const stiffness = root * root\n const damping =\n 2 *\n clamp(0.05, 1, 1 - (options.bounce || 0)) *\n Math.sqrt(stiffness)\n\n springOptions = {\n ...springOptions,\n mass: springDefaults.mass,\n stiffness,\n damping,\n }\n } else {\n const derived = findSpring(options)\n\n springOptions = {\n ...springOptions,\n ...derived,\n mass: springDefaults.mass,\n }\n springOptions.isResolvedFromDuration = true\n }\n }\n\n return springOptions\n}\n\nfunction spring(\n optionsOrVisualDuration:\n | ValueAnimationOptions<number>\n | number = springDefaults.visualDuration,\n bounce = springDefaults.bounce\n): KeyframeGenerator<number> {\n const options =\n typeof optionsOrVisualDuration !== \"object\"\n ? ({\n visualDuration: optionsOrVisualDuration,\n keyframes: [0, 1],\n bounce,\n } as ValueAnimationOptions<number>)\n : optionsOrVisualDuration\n\n let { restSpeed, restDelta } = options\n\n const origin = options.keyframes[0]\n const target = options.keyframes[options.keyframes.length - 1]\n\n /**\n * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n * to reduce GC during animation.\n */\n const state: AnimationState<number> = { done: false, value: origin }\n\n const {\n stiffness,\n damping,\n mass,\n duration,\n velocity,\n isResolvedFromDuration,\n } = getSpringOptions({\n ...options,\n velocity: -millisecondsToSeconds(options.velocity || 0),\n })\n\n const initialVelocity = velocity || 0.0\n const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass))\n\n const initialDelta = target - origin\n const undampedAngularFreq = millisecondsToSeconds(\n Math.sqrt(stiffness / mass)\n )\n\n /**\n * If we're working on a granular scale, use smaller defaults for determining\n * when the spring is finished.\n *\n * These defaults have been selected emprically based on what strikes a good\n * ratio between feeling good and finishing as soon as changes are imperceptible.\n */\n const isGranularScale = Math.abs(initialDelta) < 5\n restSpeed ||= isGranularScale\n ? springDefaults.restSpeed.granular\n : springDefaults.restSpeed.default\n restDelta ||= isGranularScale\n ? springDefaults.restDelta.granular\n : springDefaults.restDelta.default\n\n let resolveSpring: (v: number) => number\n if (dampingRatio < 1) {\n const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio)\n\n // Underdamped spring\n resolveSpring = (t: number) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t)\n\n return (\n target -\n envelope *\n (((initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) /\n angularFreq) *\n Math.sin(angularFreq * t) +\n initialDelta * Math.cos(angularFreq * t))\n )\n }\n } else if (dampingRatio === 1) {\n // Critically damped spring\n resolveSpring = (t: number) =>\n target -\n Math.exp(-undampedAngularFreq * t) *\n (initialDelta +\n (initialVelocity + undampedAngularFreq * initialDelta) * t)\n } else {\n // Overdamped spring\n const dampedAngularFreq =\n undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1)\n\n resolveSpring = (t: number) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t)\n\n // When performing sinh or cosh values can hit Infinity so we cap them here\n const freqForT = Math.min(dampedAngularFreq * t, 300)\n\n return (\n target -\n (envelope *\n ((initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) *\n Math.sinh(freqForT) +\n dampedAngularFreq *\n initialDelta *\n Math.cosh(freqForT))) /\n dampedAngularFreq\n )\n }\n }\n\n const generator = {\n calculatedDuration: isResolvedFromDuration ? duration || null : null,\n next: (t: number) => {\n const current = resolveSpring(t)\n\n if (!isResolvedFromDuration) {\n let currentVelocity = t === 0 ? initialVelocity : 0.0\n\n /**\n * We only need to calculate velocity for under-damped springs\n * as over- and critically-damped springs can't overshoot, so\n * checking only for displacement is enough.\n */\n if (dampingRatio < 1) {\n currentVelocity =\n t === 0\n ? secondsToMilliseconds(initialVelocity)\n : calcGeneratorVelocity(resolveSpring, t, current)\n }\n\n const isBelowVelocityThreshold =\n Math.abs(currentVelocity) <= restSpeed!\n const isBelowDisplacementThreshold =\n Math.abs(target - current) <= restDelta!\n\n state.done =\n isBelowVelocityThreshold && isBelowDisplacementThreshold\n } else {\n state.done = t >= duration!\n }\n\n state.value = state.done ? target : current\n\n return state\n },\n toString: () => {\n const calculatedDuration = Math.min(\n calcGeneratorDuration(generator),\n maxGeneratorDuration\n )\n\n const easing = generateLinearEasing(\n (progress: number) =>\n generator.next(calculatedDuration * progress).value,\n calculatedDuration,\n 30\n )\n\n return calculatedDuration + \"ms \" + easing\n },\n toTransition: () => {},\n }\n\n return generator\n}\n\nspring.applyToOptions = (options: Transition) => {\n const generatorOptions = createGeneratorEasing(options as any, 100, spring)\n\n options.ease = generatorOptions.ease\n options.duration = secondsToMilliseconds(generatorOptions.duration)\n options.type = \"keyframes\"\n return options\n}\n\nexport { spring }\n","import {\n AnimationState,\n KeyframeGenerator,\n ValueAnimationOptions,\n} from \"../types\"\nimport { spring as createSpring } from \"./spring\"\nimport { calcGeneratorVelocity } from \"./utils/velocity\"\n\nexport function inertia({\n keyframes,\n velocity = 0.0,\n power = 0.8,\n timeConstant = 325,\n bounceDamping = 10,\n bounceStiffness = 500,\n modifyTarget,\n min,\n max,\n restDelta = 0.5,\n restSpeed,\n}: ValueAnimationOptions<number>): KeyframeGenerator<number> {\n const origin = keyframes[0]\n\n const state: AnimationState<number> = {\n done: false,\n value: origin,\n }\n\n const isOutOfBounds = (v: number) =>\n (min !== undefined && v < min) || (max !== undefined && v > max)\n\n const nearestBoundary = (v: number) => {\n if (min === undefined) return max\n if (max === undefined) return min\n\n return Math.abs(min - v) < Math.abs(max - v) ? min : max\n }\n\n let amplitude = power * velocity\n const ideal = origin + amplitude\n const target = modifyTarget === undefined ? ideal : modifyTarget(ideal)\n\n /**\n * If the target has changed we need to re-calculate the amplitude, otherwise\n * the animation will start from the wrong position.\n */\n if (target !== ideal) amplitude = target - origin\n\n const calcDelta = (t: number) => -amplitude * Math.exp(-t / timeConstant)\n\n const calcLatest = (t: number) => target + calcDelta(t)\n\n const applyFriction = (t: number) => {\n const delta = calcDelta(t)\n const latest = calcLatest(t)\n state.done = Math.abs(delta) <= restDelta\n state.value = state.done ? target : latest\n }\n\n /**\n * Ideally this would resolve for t in a stateless way, we could\n * do that by always precalculating the animation but as we know\n * this will be done anyway we can assume that spring will\n * be discovered during that.\n */\n let timeReachedBoundary: number | undefined\n let spring: KeyframeGenerator<number> | undefined\n\n const checkCatchBoundary = (t: number) => {\n if (!isOutOfBounds(state.value)) return\n\n timeReachedBoundary = t\n\n spring = createSpring({\n keyframes: [state.value, nearestBoundary(state.value)!],\n velocity: calcGeneratorVelocity(calcLatest, t, state.value), // TODO: This should be passing * 1000\n damping: bounceDamping,\n stiffness: bounceStiffness,\n restDelta,\n restSpeed,\n })\n }\n\n checkCatchBoundary(0)\n\n return {\n calculatedDuration: null,\n next: (t: number) => {\n /**\n * We need to resolve the friction to figure out if we need a\n * spring but we don't want to do this twice per frame. So here\n * we flag if we updated for this frame and later if we did\n * we can skip doing it again.\n */\n let hasUpdatedFrame = false\n if (!spring && timeReachedBoundary === undefined) {\n hasUpdatedFrame = true\n applyFriction(t)\n checkCatchBoundary(t)\n }\n\n /**\n * If we have a spring and the provided t is beyond the moment the friction\n * animation crossed the min/max boundary, use the spring.\n */\n if (timeReachedBoundary !== undefined && t >= timeReachedBoundary) {\n return spring!.next(t - timeReachedBoundary)\n } else {\n !hasUpdatedFrame && applyFriction(t)\n return state\n }\n },\n }\n}\n","import {\n clamp,\n EasingFunction,\n invariant,\n MotionGlobalConfig,\n noop,\n pipe,\n progress,\n} from \"motion-utils\"\nimport { mix } from \"./mix\"\nimport { Mixer, MixerFactory } from \"./mix/types\"\n\nexport interface InterpolateOptions<T> {\n clamp?: boolean\n ease?: EasingFunction | EasingFunction[]\n mixer?: MixerFactory<T>\n}\n\nfunction createMixers<T>(\n output: T[],\n ease?: EasingFunction | EasingFunction[],\n customMixer?: MixerFactory<T>\n) {\n const mixers: Array<Mixer<T>> = []\n const mixerFactory: MixerFactory<T> =\n customMixer || MotionGlobalConfig.mix || mix\n const numMixers = output.length - 1\n\n for (let i = 0; i < numMixers; i++) {\n let mixer = mixerFactory(output[i], output[i + 1])\n\n if (ease) {\n const easingFunction = Array.isArray(ease) ? ease[i] || noop : ease\n mixer = pipe(easingFunction, mixer) as Mixer<T>\n }\n\n mixers.push(mixer)\n }\n\n return mixers\n}\n\n/**\n * Create a function that maps from a numerical input array to a generic output array.\n *\n * Accepts:\n * - Numbers\n * - Colors (hex, hsl, hsla, rgb, rgba)\n * - Complex (combinations of one or more numbers or strings)\n *\n * ```jsx\n * const mixColor = interpolate([0, 1], ['#fff', '#000'])\n *\n * mixColor(0.5) // 'rgba(128, 128, 128, 1)'\n * ```\n *\n * TODO Revisit this approach once we've moved to data models for values,\n * probably not needed to pregenerate mixer functions.\n *\n * @public\n */\nexport function interpolate<T>(\n input: number[],\n output: T[],\n { clamp: isClamp = true, ease, mixer }: InterpolateOptions<T> = {}\n): (v: number) => T {\n const inputLength = input.length\n\n invariant(\n inputLength === output.length,\n \"Both input and output ranges must be the same length\",\n \"range-length\"\n )\n\n /**\n * If we're only provided a single input, we can just make a function\n * that returns the output.\n */\n if (inputLength === 1) return () => output[0]\n if (inputLength === 2 && output[0] === output[1]) return () => output[1]\n\n const isZeroDeltaRange = input[0] === input[1]\n\n // If input runs highest -> lowest, reverse both arrays\n if (input[0] > input[inputLength - 1]) {\n input = [...input].reverse()\n output = [...output].reverse()\n }\n\n const mixers = createMixers(output, ease, mixer)\n const numMixers = mixers.length\n\n const interpolator = (v: number): T => {\n if (isZeroDeltaRange && v < input[0]) return output[0]\n\n let i = 0\n\n if (numMixers > 1) {\n for (; i < input.length - 2; i++) {\n if (v < input[i + 1]) break\n }\n }\n\n const progressInRange = progress(input[i], input[i + 1], v)\n\n return mixers[i](progressInRange)\n }\n\n return isClamp\n ? (v: number) =>\n interpolator(clamp(input[0], input[inputLength - 1], v))\n : interpolator\n}\n","import { progress } from \"motion-utils\"\nimport { mixNumber } from \"../../../utils/mix/number\"\n\nexport function fillOffset(offset: number[], remaining: number): void {\n const min = offset[offset.length - 1]\n for (let i = 1; i <= remaining; i++) {\n const offsetProgress = progress(0, remaining, i)\n offset.push(mixNumber(min, 1, offsetProgress))\n }\n}\n","import { fillOffset } from \"./fill\"\n\nexport function defaultOffset(arr: any[]): number[] {\n const offset = [0]\n fillOffset(offset, arr.length - 1)\n return offset\n}\n","export function convertOffsetToTimes(offset: number[], duration: number) {\n return offset.map((o) => o * duration)\n}\n","import {\n easeInOut,\n easingDefinitionToFunction,\n EasingFunction,\n isEasingArray,\n} from \"motion-utils\"\nimport { interpolate } from \"../../utils/interpolate\"\nimport { defaultOffset } from \"../keyframes/offsets/default\"\nimport { convertOffsetToTimes } from \"../keyframes/offsets/time\"\nimport {\n AnimationState,\n AnyResolvedKeyframe,\n KeyframeGenerator,\n ValueAnimationOptions,\n} from \"../types\"\n\nexport function defaultEasing(\n values: any[],\n easing?: EasingFunction\n): EasingFunction[] {\n return values.map(() => easing || easeInOut).splice(0, values.length - 1)\n}\n\nexport function keyframes<T extends AnyResolvedKeyframe>({\n duration = 300,\n keyframes: keyframeValues,\n times,\n ease = \"easeInOut\",\n}: ValueAnimationOptions<T>): KeyframeGenerator<T> {\n /**\n * Easing functions can be externally defined as strings. Here we convert them\n * into actual functions.\n */\n const easingFunctions = isEasingArray(ease)\n ? ease.map(easingDefinitionToFunction)\n : easingDefinitionToFunction(ease)\n\n /**\n * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n * to reduce GC during animation.\n */\n const state: AnimationState<T> = {\n done: false,\n value: keyframeValues[0],\n }\n\n /**\n * Create a times array based on the provided 0-1 offsets\n */\n const absoluteTimes = convertOffsetToTimes(\n // Only use the provided offsets if they're the correct length\n // TODO Maybe we should warn here if there's a length mismatch\n times && times.length === keyframeValues.length\n ? times\n : defaultOffset(keyframeValues),\n duration\n )\n\n const mapTimeToKeyframe = interpolate<T>(absoluteTimes, keyframeValues, {\n ease: Array.isArray(easingFunctions)\n ? easingFunctions\n : defaultEasing(keyframeValues, easingFunctions),\n })\n\n return {\n calculatedDuration: duration,\n next: (t: number) => {\n state.value = mapTimeToKeyframe(t)\n state.done = t >= duration\n return state\n },\n }\n}\n","import { AnimationPlaybackOptions } from \"../types\"\n\nconst isNotNull = (value: unknown) => value !== null\n\nexport function getFinalKeyframe<T>(\n keyframes: T[],\n { repeat, repeatType = \"loop\" }: AnimationPlaybackOptions,\n finalKeyframe?: T,\n speed: number = 1\n): T {\n const resolvedKeyframes = keyframes.filter(isNotNull)\n const useFirstKeyframe =\n speed < 0 || (repeat && repeatType !== \"loop\" && repeat % 2 === 1)\n const index = useFirstKeyframe ? 0 : resolvedKeyframes.length - 1\n\n return !index || finalKeyframe === undefined\n ? resolvedKeyframes[index]\n : finalKeyframe\n}\n","import { inertia } from \"../generators/inertia\"\nimport { keyframes } from \"../generators/keyframes\"\nimport { spring } from \"../generators/spring\"\nimport { GeneratorFactory, ValueAnimationTransition } from \"../types\"\n\nconst transitionTypeMap: { [key: string]: GeneratorFactory } = {\n decay: inertia,\n inertia,\n tween: keyframes,\n keyframes: keyframes,\n spring,\n}\n\nexport function replaceTransitionType(transition: ValueAnimationTransition) {\n if (typeof transition.type === \"string\") {\n transition.type = transitionTypeMap[transition.type]\n }\n}\n","export class WithPromise {\n protected _finished: Promise<void>\n\n resolve: VoidFunction\n\n constructor() {\n this.updateFinished()\n }\n\n get finished() {\n return this._finished\n }\n\n protected updateFinished() {\n this._finished = new Promise<void>((resolve) => {\n this.resolve = resolve\n })\n }\n\n protected notifyFinished() {\n this.resolve()\n }\n\n /**\n * Allows the animation to be awaited.\n *\n * @deprecated Use `finished` instead.\n */\n then(onResolve: VoidFunction, onReject?: VoidFunction) {\n return this.finished.then(onResolve, onReject)\n }\n}\n","import {\n clamp,\n invariant,\n millisecondsToSeconds,\n pipe,\n secondsToMilliseconds,\n} from \"motion-utils\"\nimport { time } from \"../frameloop/sync-time\"\nimport { activeAnimations } from \"../stats/animation-count\"\nimport { mix } from \"../utils/mix\"\nimport { Mixer } from \"../utils/mix/types\"\nimport { frameloopDriver } from \"./drivers/frame\"\nimport { DriverControls } from \"./drivers/types\"\nimport { inertia } from \"./generators/inertia\"\nimport { keyframes as keyframesGenerator } from \"./generators/keyframes\"\nimport { calcGeneratorDuration } from \"./generators/utils/calc-duration\"\nimport { getFinalKeyframe } from \"./keyframes/get-final\"\nimport {\n AnimationPlaybackControlsWithThen,\n AnimationState,\n GeneratorFactory,\n KeyframeGenerator,\n TimelineWithFallback,\n ValueAnimationOptions,\n} from \"./types\"\nimport { replaceTransitionType } from \"./utils/replace-transition-type\"\nimport { WithPromise } from \"./utils/WithPromise\"\n\nconst percentToProgress = (percent: number) => percent / 100\n\nexport class JSAnimation<T extends number | string>\n extends WithPromise\n implements AnimationPlaybackControlsWithThen\n{\n state: AnimationPlayState = \"idle\"\n\n startTime: number | null = null\n\n /**\n * The driver that's controlling the animation loop. Normally this is a requestAnimationFrame loop\n * but in tests we can pass in a synchronous loop.\n */\n private driver?: DriverControls\n\n private isStopped = false\n\n private generator: KeyframeGenerator<T>\n\n private calculatedDuration: number\n\n private resolvedDuration: number\n\n private totalDuration: number\n\n private options: ValueAnimationOptions<T>\n\n /**\n * The current time of the animation.\n */\n private currentTime: number = 0\n\n /**\n * The time at which the animation was paused.\n */\n private holdTime: number | null = null\n\n /**\n * Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.\n */\n private playbackSpeed = 1\n\n /*\n * If our generator doesn't support mixing numbers, we need to replace keyframes with\n * [0, 100] and then make a function that maps that to the actual keyframes.\n *\n * 100 is chosen instead of 1 as it works nicer with spring animations.\n */\n private mixKeyframes: Mixer<T> | undefined\n\n private mirroredGenerator: KeyframeGenerator<T> | undefined\n\n constructor(options: ValueAnimationOptions<T>) {\n super()\n activeAnimations.mainThread++\n\n this.options = options\n this.initAnimation()\n this.play()\n\n if (options.autoplay === false) this.pause()\n }\n\n initAnimation() {\n const { options } = this\n\n replaceTransitionType(options)\n\n const {\n type = keyframesGenerator,\n repeat = 0,\n repeatDelay = 0,\n repeatType,\n velocity = 0,\n } = options\n let { keyframes } = options\n\n const generatorFactory =\n (type as GeneratorFactory) || keyframesGenerator\n\n if (\n process.env.NODE_ENV !== \"production\" &&\n generatorFactory !== keyframesGenerator\n ) {\n invariant(\n keyframes.length <= 2,\n `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes}`,\n \"spring-two-frames\"\n )\n }\n\n if (\n generatorFactory !== keyframesGenerator &&\n typeof keyframes[0] !== \"number\"\n ) {\n this.mixKeyframes = pipe(\n percentToProgress,\n mix(keyframes[0], keyframes[1])\n ) as (t: number) => T\n\n keyframes = [0 as T, 100 as T]\n }\n\n const generator = generatorFactory({ ...options, keyframes })\n\n /**\n * If we have a mirror repeat type we need to create a second generator that outputs the\n * mirrored (not reversed) animation and later ping pong between the two generators.\n */\n if (repeatType === \"mirror\") {\n this.mirroredGenerator = generatorFactory({\n ...options,\n keyframes: [...keyframes].reverse(),\n velocity: -velocity,\n })\n }\n\n /**\n * If duration is undefined and we have repeat options,\n * we need to calculate a duration from the generator.\n *\n * We set it to the generator itself to cache the duration.\n * Any timeline resolver will need to have already precalculated\n * the duration by this step.\n */\n if (generator.calculatedDuration === null) {\n generator.calculatedDuration = calcGeneratorDuration(generator)\n }\n\n const { calculatedDuration } = generator\n this.calculatedDuration = calculatedDuration\n this.resolvedDuration = calculatedDuration + repeatDelay\n this.totalDuration = this.resolvedDuration * (repeat + 1) - repeatDelay\n this.generator = generator\n }\n\n updateTime(timestamp: number) {\n const animationTime =\n Math.round(timestamp - this.startTime!) * this.playbackSpeed\n\n // Update currentTime\n if (this.holdTime !== null) {\n this.currentTime = this.holdTime\n } else {\n // Rounding the time because floating point arithmetic is not always accurate, e.g. 3000.367 - 1000.367 =\n // 2000.0000000000002. This is a problem when we are comparing the currentTime with the duration, for\n // example.\n this.currentTime = animationTime\n }\n }\n\n tick(timestamp: number, sample = false) {\n const {\n generator,\n totalDuration,\n mixKeyframes,\n mirroredGenerator,\n resolvedDuration,\n calculatedDuration,\n } = this\n\n if (this.startTime === null) return generator.next(0)\n\n const {\n delay = 0,\n keyframes,\n repeat,\n repeatType,\n repeatDelay,\n type,\n onUpdate,\n finalKeyframe,\n } = this.options\n\n /**\n * requestAnimationFrame timestamps can come through as lower than\n * the startTime as set by performance.now(). Here we prevent this,\n * though in the future it could be possible to make setting startTime\n * a pending operation that gets resolved here.\n */\n if (this.speed > 0) {\n this.startTime = Math.min(this.startTime, timestamp)\n } else if (this.speed < 0) {\n this.startTime = Math.min(\n timestamp - totalDuration / this.speed,\n this.startTime\n )\n }\n\n if (sample) {\n this.currentTime = timestamp\n } else {\n this.updateTime(timestamp)\n }\n\n // Rebase on delay\n const timeWithoutDelay =\n this.currentTime - delay * (this.playbackSpeed >= 0 ? 1 : -1)\n const isInDelayPhase =\n this.playbackSpeed >= 0\n ? timeWithoutDelay < 0\n : timeWithoutDelay > totalDuration\n this.currentTime = Math.max(timeWithoutDelay, 0)\n\n // If this animation has finished, set the current time to the total duration.\n if (this.state === \"finished\" && this.holdTime === null) {\n this.currentTime = totalDuration\n }\n\n let elapsed = this.currentTime\n let frameGenerator = generator\n\n if (repeat) {\n /**\n * Get the current progress (0-1) of the animation. If t is >\n * than duration we'll get values like 2.5 (midway through the\n * third iteration)\n */\n const progress =\n Math.min(this.currentTime, totalDuration) / resolvedDuration\n\n /**\n * Get the current iteration (0 indexed). For instance the floor of\n * 2.5 is 2.\n */\n let currentIteration = Math.floor(progress)\n\n /**\n * Get the current progress of the iteration by taking the remainder\n * so 2.5 is 0.5 through iteration 2\n */\n let iterationProgress = progress % 1.0\n\n /**\n * If iteration progress is 1 we count that as the end\n * of the previous iteration.\n */\n if (!iterationProgress && progress >= 1) {\n iterationProgress = 1\n }\n\n iterationProgress === 1 && currentIteration--\n\n currentIteration = Math.min(currentIteration, repeat + 1)\n\n /**\n * Reverse progress if we're not running in \"normal\" direction\n */\n\n const isOddIteration = Boolean(currentIteration % 2)\n if (isOddIteration) {\n if (repeatType === \"reverse\") {\n iterationProgress = 1 - iterationProgress\n if (repeatDelay) {\n iterationProgress -= repeatDelay / resolvedDuration\n }\n } else if (repeatType === \"mirror\") {\n frameGenerator = mirroredGenerator!\n }\n }\n\n elapsed = clamp(0, 1, iterationProgress) * resolvedDuration\n }\n\n /**\n * If we're in negative time, set state as the initial keyframe.\n * This prevents delay: x, duration: 0 animations from finishing\n * instantly.\n */\n const state = isInDelayPhase\n ? { done: false, value: keyframes[0] }\n : frameGenerator.next(elapsed)\n\n if (mixKeyframes) {\n state.value = mixKeyframes(state.value as number)\n }\n\n let { done } = state\n\n if (!isInDelayPhase && calculatedDuration !== null) {\n done =\n this.playbackSpeed >= 0\n ? this.currentTime >= totalDuration\n : this.currentTime <= 0\n }\n\n const isAnimationFinished =\n this.holdTime === null &&\n (this.state === \"finished\" || (this.state === \"running\" && done))\n\n // TODO: The exception for inertia could be cleaner here\n if (isAnimationFinished && type !== inertia) {\n state.value = getFinalKeyframe(\n keyframes,\n this.options,\n finalKeyframe,\n this.speed\n )\n }\n\n if (onUpdate) {\n onUpdate(state.value)\n }\n\n if (isAnimationFinished) {\n this.finish()\n }\n\n return state\n }\n\n /**\n * Allows the returned animation to be awaited or promise-chained. Currently\n * resolves when the animation finishes at all but in a future update could/should\n * reject if its cancels.\n */\n then(resolve: VoidFunction, reject?: VoidFunction) {\n return this.finished.then(resolve, reject)\n }\n\n get duration() {\n return millisecondsToSeconds(this.calculatedDuration)\n }\n\n get iterationDuration() {\n const { delay = 0 } = this.options || {}\n return this.duration + millisecondsToSeconds(delay)\n }\n\n get time() {\n return millisecondsToSeconds(this.currentTime)\n }\n\n set time(newTime: number) {\n newTime = secondsToMilliseconds(newTime)\n this.currentTime = newTime\n\n if (\n this.startTime === null ||\n this.holdTime !== null ||\n this.playbackSpeed === 0\n ) {\n this.holdTime = newTime\n } else if (this.driver) {\n this.startTime = this.driver.now() - newTime / this.playbackSpeed\n }\n\n this.driver?.start(false)\n }\n\n get speed() {\n return this.playbackSpeed\n }\n\n set speed(newSpeed: number) {\n this.updateTime(time.now())\n const hasChanged = this.playbackSpeed !== newSpeed\n this.playbackSpeed = newSpeed\n\n if (hasChanged) {\n this.time = millisecondsToSeconds(this.currentTime)\n }\n }\n\n play() {\n if (this.isStopped) return\n\n const { driver = frameloopDriver, startTime } = this.options\n\n if (!this.driver) {\n this.driver = driver((timestamp) => this.tick(timestamp))\n }\n\n this.options.onPlay?.()\n\n const now = this.driver.now()\n\n if (this.state === \"finished\") {\n this.updateFinished()\n this.startTime = now\n } else if (this.holdTime !== null) {\n this.startTime = now - this.holdTime\n } else if (!this.startTime) {\n this.startTime = startTime ?? now\n }\n\n if (this.state === \"finished\" && this.speed < 0) {\n this.startTime += this.calculatedDuration\n }\n\n this.holdTime = null\n\n /**\n * Set playState to running only after we've used it in\n * the previous logic.\n */\n this.state = \"running\"\n\n this.driver.start()\n }\n\n pause() {\n this.state = \"paused\"\n this.updateTime(time.now())\n this.holdTime = this.currentTime\n }\n\n /**\n * This method is bound to the instance to fix a pattern where\n * animation.stop is returned as a reference from a useEffect.\n */\n stop = () => {\n const { motionValue } = this.options\n if (motionValue && motionValue.updatedAt !== time.now()) {\n this.tick(time.now())\n }\n\n this.isStopped = true\n if (this.state === \"idle\") return\n this.teardown()\n this.options.onStop?.()\n }\n\n complete() {\n if (this.state !== \"running\") {\n this.play()\n }\n\n this.state = \"finished\"\n this.holdTime = null\n }\n\n finish() {\n this.notifyFinished()\n this.teardown()\n this.state = \"finished\"\n\n this.options.onComplete?.()\n }\n\n cancel() {\n this.holdTime = null\n this.startTime = 0\n this.tick(0)\n this.teardown()\n this.options.onCancel?.()\n }\n\n private teardown() {\n this.state = \"idle\"\n this.stopDriver()\n this.startTime = this.holdTime = null\n activeAnimations.mainThread--\n }\n\n private stopDriver() {\n if (!this.driver) return\n this.driver.stop()\n this.driver = undefined\n }\n\n sample(sampleTime: number): AnimationState<T> {\n this.startTime = 0\n return this.tick(sampleTime, true)\n }\n\n attachTimeline(timeline: TimelineWithFallback): VoidFunction {\n if (this.options.allowFlatten) {\n this.options.type = \"keyframes\"\n this.options.ease = \"linear\"\n this.initAnimation()\n }\n\n this.driver?.stop()\n return timeline.observe(this)\n }\n}\n\n// Legacy function support\nexport function animateValue<T extends number | string>(\n options: ValueAnimationOptions<T>\n) {\n return new JSAnimation(options)\n}\n","import { UnresolvedValueKeyframe, ValueKeyframe } from \"../../types\"\n\nexport function fillWildcards(\n keyframes: ValueKeyframe[] | UnresolvedValueKeyframe[]\n) {\n for (let i = 1; i < keyframes.length; i++) {\n keyframes[i] ??= keyframes[i - 1]\n }\n}\n","import { transformPropOrder } from \"../utils/keys-transform\"\n\nconst radToDeg = (rad: number) => (rad * 180) / Math.PI\n\ntype MatrixParser = (values: number[]) => number\n\ntype MatrixParsers = Record<\n (typeof transformPropOrder)[number],\n number | MatrixParser\n>\n\nconst rotate = (v: number[]) => {\n const angle = radToDeg(Math.atan2(v[1], v[0]))\n return rebaseAngle(angle)\n}\n\nconst matrix2dParsers: MatrixParsers = {\n x: 4,\n y: 5,\n translateX: 4,\n translateY: 5,\n scaleX: 0,\n scaleY: 3,\n scale: (v) => (Math.abs(v[0]) + Math.abs(v[3])) / 2,\n rotate,\n rotateZ: rotate,\n skewX: (v) => radToDeg(Math.atan(v[1])),\n skewY: (v) => radToDeg(Math.atan(v[2])),\n skew: (v) => (Math.abs(v[1]) + Math.abs(v[2])) / 2,\n} as const\n\nconst rebaseAngle = (angle: number) => {\n angle = angle % 360\n if (angle < 0) angle += 360\n return angle\n}\n\nconst rotateZ = rotate\n\nconst scaleX = (v: number[]) => Math.sqrt(v[0] * v[0] + v[1] * v[1])\nconst scaleY = (v: number[]) => Math.sqrt(v[4] * v[4] + v[5] * v[5])\n\nconst matrix3dParsers: MatrixParsers = {\n x: 12,\n y: 13,\n z: 14,\n translateX: 12,\n translateY: 13,\n translateZ: 14,\n scaleX,\n scaleY,\n scale: (v) => (scaleX(v) + scaleY(v)) / 2,\n rotateX: (v) => rebaseAngle(radToDeg(Math.atan2(v[6], v[5]))),\n rotateY: (v) => rebaseAngle(radToDeg(Math.atan2(-v[2], v[0]))),\n rotateZ,\n rotate: rotateZ,\n skewX: (v) => radToDeg(Math.atan(v[4])),\n skewY: (v) => radToDeg(Math.atan(v[1])),\n skew: (v) => (Math.abs(v[1]) + Math.abs(v[4])) / 2,\n} as const\n\nexport function defaultTransformValue(name: string): number {\n return name.includes(\"scale\") ? 1 : 0\n}\n\nexport function parseValueFromTransform(\n transform: string | undefined,\n name: string\n): number {\n if (!transform || transform === \"none\") {\n return defaultTransformValue(name)\n }\n\n const matrix3dMatch = transform.match(/^matrix3d\\(([-\\d.e\\s,]+)\\)$/u)\n\n let parsers: MatrixParsers\n let match: RegExpMatchArray | null\n\n if (matrix3dMatch) {\n parsers = matrix3dParsers\n match = matrix3dMatch\n } else {\n const matrix2dMatch = transform.match(/^matrix\\(([-\\d.e\\s,]+)\\)$/u)\n\n parsers = matrix2dParsers\n match = matrix2dMatch\n }\n\n if (!match) {\n return defaultTransformValue(name)\n }\n\n const valueParser = parsers[name]\n const values = match[1].split(\",\").map(convertTransformToNumber)\n\n return typeof valueParser === \"function\"\n ? valueParser(values)\n : values[valueParser]\n}\n\nexport const readTransformValue = (instance: HTMLElement, name: string) => {\n const { transform = \"none\" } = getComputedStyle(instance)\n return parseValueFromTransform(transform, name)\n}\n\nfunction convertTransformToNumber(value: string): number {\n return parseFloat(value.trim())\n}\n","/**\n * Generate a list of every possible transform key.\n */\nexport const transformPropOrder = [\n \"transformPerspective\",\n \"x\",\n \"y\",\n \"z\",\n \"translateX\",\n \"translateY\",\n \"translateZ\",\n \"scale\",\n \"scaleX\",\n \"scaleY\",\n \"rotate\",\n \"rotateX\",\n \"rotateY\",\n \"rotateZ\",\n \"skew\",\n \"skewX\",\n \"skewY\",\n]\n\n/**\n * A quick lookup for transform props.\n */\nexport const transformProps = /*@__PURE__*/ (() =>\n new Set(transformPropOrder))()\n","import type { Box } from \"motion-utils\"\nimport { parseValueFromTransform } from \"../../../render/dom/parse-transform\"\nimport { transformPropOrder } from \"../../../render/utils/keys-transform\"\nimport { MotionValue } from \"../../../value\"\nimport { number } from \"../../../value/types/numbers\"\nimport { px } from \"../../../value/types/numbers/units\"\nimport { ValueType } from \"../../../value/types/types\"\nimport { AnyResolvedKeyframe } from \"../../types\"\nimport { WithRender } from \"../types\"\n\nexport const isNumOrPxType = (v?: ValueType): v is ValueType =>\n v === number || v === px\n\ntype GetActualMeasurementInPixels = (\n bbox: Box,\n computedStyle: Partial<CSSStyleDeclaration>\n) => number\n\nconst transformKeys = new Set([\"x\", \"y\", \"z\"])\nconst nonTranslationalTransformKeys = transformPropOrder.filter(\n (key) => !transformKeys.has(key)\n)\n\ntype RemovedTransforms = [string, AnyResolvedKeyframe][]\nexport function removeNonTranslationalTransform(visualElement: WithRender) {\n const removedTransforms: RemovedTransforms = []\n\n nonTranslationalTransformKeys.forEach((key) => {\n const value: MotionValue<AnyResolvedKeyframe> | undefined =\n visualElement.getValue(key)\n if (value !== undefined) {\n removedTransforms.push([key, value.get()])\n value.set(key.startsWith(\"scale\") ? 1 : 0)\n }\n })\n\n return removedTransforms\n}\n\nexport const positionalValues: { [key: string]: GetActualMeasurementInPixels } =\n {\n // Dimensions\n width: ({ x }, { paddingLeft = \"0\", paddingRight = \"0\" }) =>\n x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight),\n height: ({ y }, { paddingTop = \"0\", paddingBottom = \"0\" }) =>\n y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom),\n\n top: (_bbox, { top }) => parseFloat(top as string),\n left: (_bbox, { left }) => parseFloat(left as string),\n bottom: ({ y }, { top }) => parseFloat(top as string) + (y.max - y.min),\n right: ({ x }, { left }) =>\n parseFloat(left as string) + (x.max - x.min),\n\n // Transform\n x: (_bbox, { transform }) => parseValueFromTransform(transform, \"x\"),\n y: (_bbox, { transform }) => parseValueFromTransform(transform, \"y\"),\n }\n\n// Alias translate longform names\npositionalValues.translateX = positionalValues.x\npositionalValues.translateY = positionalValues.y\n","import { frame } from \"../../frameloop\"\nimport { MotionValue } from \"../../value\"\nimport { AnyResolvedKeyframe } from \"../types\"\nimport { WithRender } from \"./types\"\nimport { fillWildcards } from \"./utils/fill-wildcards\"\nimport { removeNonTranslationalTransform } from \"./utils/unit-conversion\"\n\nexport type UnresolvedKeyframes<T extends AnyResolvedKeyframe> = Array<T | null>\n\nexport type ResolvedKeyframes<T extends AnyResolvedKeyframe> = Array<T>\n\nconst toResolve = new Set<KeyframeResolver>()\nlet isScheduled = false\nlet anyNeedsMeasurement = false\nlet isForced = false\n\nfunction measureAllKeyframes() {\n if (anyNeedsMeasurement) {\n const resolversToMeasure = Array.from(toResolve).filter(\n (resolver: KeyframeResolver) => resolver.needsMeasurement\n )\n const elementsToMeasure = new Set(\n resolversToMeasure.map((resolver) => resolver.element)\n )\n const transformsToRestore = new Map<\n WithRender,\n [string, AnyResolvedKeyframe][]\n >()\n\n /**\n * Write pass\n * If we're measuring elements we want to remove bounding box-changing transforms.\n */\n elementsToMeasure.forEach((element: WithRender) => {\n const removedTransforms = removeNonTranslationalTransform(\n element as any\n )\n\n if (!removedTransforms.length) return\n\n transformsToRestore.set(element, removedTransforms)\n\n element.render()\n })\n\n // Read\n resolversToMeasure.forEach((resolver) => resolver.measureInitialState())\n\n // Write\n elementsToMeasure.forEach((element: WithRender) => {\n element.render()\n\n const restore = transformsToRestore.get(element)\n if (restore) {\n restore.forEach(([key, value]) => {\n element.getValue(key)?.set(value)\n })\n }\n })\n\n // Read\n resolversToMeasure.forEach((resolver) => resolver.measureEndState())\n\n // Write\n resolversToMeasure.forEach((resolver) => {\n if (resolver.suspendedScrollY !== undefined) {\n window.scrollTo(0, resolver.suspendedScrollY)\n }\n })\n }\n\n anyNeedsMeasurement = false\n isScheduled = false\n\n toResolve.forEach((resolver) => resolver.complete(isForced))\n toResolve.clear()\n}\n\nfunction readAllKeyframes() {\n toResolve.forEach((resolver) => {\n resolver.readKeyframes()\n\n if (resolver.needsMeasurement) {\n anyNeedsMeasurement = true\n }\n })\n}\n\nexport function flushKeyframeResolvers() {\n isForced = true\n readAllKeyframes()\n measureAllKeyframes()\n isForced = false\n}\n\nexport type OnKeyframesResolved<T extends AnyResolvedKeyframe> = (\n resolvedKeyframes: ResolvedKeyframes<T>,\n finalKeyframe: T,\n forced: boolean\n) => void\n\nexport class KeyframeResolver<T extends AnyResolvedKeyframe = any> {\n name?: string\n element?: WithRender\n finalKeyframe?: T\n suspendedScrollY?: number\n\n protected unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>\n\n private motionValue?: MotionValue<T>\n private onComplete: OnKeyframesResolved<T>\n\n state: \"pending\" | \"scheduled\" | \"complete\" = \"pending\"\n\n /**\n * Track whether this resolver is async. If it is, it'll be added to the\n * resolver queue and flushed in the next frame. Resolvers that aren't going\n * to trigger read/write thrashing don't need to be async.\n */\n private isAsync = false\n\n /**\n * Track whether this resolver needs to perform a measurement\n * to resolve its keyframes.\n */\n needsMeasurement = false\n\n constructor(\n unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>,\n onComplete: OnKeyframesResolved<T>,\n name?: string,\n motionValue?: MotionValue<T>,\n element?: WithRender,\n isAsync = false\n ) {\n this.unresolvedKeyframes = [...unresolvedKeyframes]\n this.onComplete = onComplete\n this.name = name\n this.motionValue = motionValue\n this.element = element\n this.isAsync = isAsync\n }\n\n scheduleResolve() {\n this.state = \"scheduled\"\n\n if (this.isAsync) {\n toResolve.add(this)\n\n if (!isScheduled) {\n isScheduled = true\n frame.read(readAllKeyframes)\n frame.resolveKeyframes(measureAllKeyframes)\n }\n } else {\n this.readKeyframes()\n this.complete()\n }\n }\n\n readKeyframes() {\n const { unresolvedKeyframes, name, element, motionValue } = this\n\n // If initial keyframe is null we need to read it from the DOM\n if (unresolvedKeyframes[0] === null) {\n const currentValue = motionValue?.get()\n\n // TODO: This doesn't work if the final keyframe is a wildcard\n const finalKeyframe =\n unresolvedKeyframes[unresolvedKeyframes.length - 1]\n\n if (currentValue !== undefined) {\n unresolvedKeyframes[0] = currentValue\n } else if (element && name) {\n const valueAsRead = element.readValue(name, finalKeyframe)\n\n if (valueAsRead !== undefined && valueAsRead !== null) {\n unresolvedKeyframes[0] = valueAsRead\n }\n }\n\n if (unresolvedKeyframes[0] === undefined) {\n unresolvedKeyframes[0] = finalKeyframe\n }\n\n if (motionValue && currentValue === undefined) {\n motionValue.set(unresolvedKeyframes[0] as T)\n }\n }\n\n fillWildcards(unresolvedKeyframes)\n }\n\n setFinalKeyframe() {}\n measureInitialState() {}\n renderEndStyles() {}\n measureEndState() {}\n\n complete(isForcedComplete = false) {\n this.state = \"complete\"\n\n this.onComplete(\n this.unresolvedKeyframes as ResolvedKeyframes<T>,\n this.finalKeyframe as T,\n isForcedComplete\n )\n\n toResolve.delete(this)\n }\n\n cancel() {\n if (this.state === \"scheduled\") {\n toResolve.delete(this)\n this.state = \"pending\"\n }\n }\n\n resume() {\n if (this.state === \"pending\") this.scheduleResolve()\n }\n}\n","export const isCSSVar = (name: string) => name.startsWith(\"--\")\n","import { AnyResolvedKeyframe } from \"../../animation/types\"\nimport { isCSSVar } from \"./is-css-var\"\n\nexport function setStyle(\n element: HTMLElement | SVGElement,\n name: string,\n value: AnyResolvedKeyframe\n) {\n isCSSVar(name)\n ? element.style.setProperty(name, value as string)\n : (element.style[name as any] = value as string)\n}\n","import { memo } from \"motion-utils\"\nimport { ProgressTimeline } from \"../..\"\n\ndeclare global {\n interface Window {\n ScrollTimeline: ScrollTimeline\n }\n}\n\ndeclare class ScrollTimeline implements ProgressTimeline {\n constructor(options: ScrollOptions)\n\n currentTime: null | { value: number }\n\n cancel?: VoidFunction\n}\n\nexport const supportsScrollTimeline = /* @__PURE__ */ memo(\n () => window.ScrollTimeline !== undefined\n)\n","/**\n * Add the ability for test suites to manually set support flags\n * to better test more environments.\n */\nexport const supportsFlags: Record<string, boolean | undefined> = {}\n","import { memo } from \"motion-utils\"\nimport { supportsFlags } from \"./flags\"\n\nexport function memoSupports<T extends any>(\n callback: () => T,\n supportsFlag: keyof typeof supportsFlags\n) {\n const memoized = memo(callback)\n return () => supportsFlags[supportsFlag] ?? memoized()\n}\n","import { memoSupports } from \"./memo\"\n\nexport const supportsLinearEasing = /*@__PURE__*/ memoSupports(() => {\n try {\n document\n .createElement(\"div\")\n .animate({ opacity: 0 }, { easing: \"linear(0, 1)\" })\n } catch (e) {\n return false\n }\n return true\n}, \"linearEasing\")\n","import { BezierDefinition } from \"motion-utils\"\n\nexport const cubicBezierAsString = ([a, b, c, d]: BezierDefinition) =>\n `cubic-bezier(${a}, ${b}, ${c}, ${d})`\n","import { cubicBezierAsString } from \"./cubic-bezier\"\n\nexport const supportedWaapiEasing = {\n linear: \"linear\",\n ease: \"ease\",\n easeIn: \"ease-in\",\n easeOut: \"ease-out\",\n easeInOut: \"ease-in-out\",\n circIn: /*@__PURE__*/ cubicBezierAsString([0, 0.65, 0.55, 1]),\n circOut: /*@__PURE__*/ cubicBezierAsString([0.55, 0, 1, 0.45]),\n backIn: /*@__PURE__*/ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),\n backOut: /*@__PURE__*/ cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),\n}\n","import { Easing, isBezierDefinition } from \"motion-utils\"\nimport { supportsLinearEasing } from \"../../../utils/supports/linear-easing\"\nimport { generateLinearEasing } from \"../utils/linear\"\nimport { cubicBezierAsString } from \"./cubic-bezier\"\nimport { supportedWaapiEasing } from \"./supported\"\n\nexport function mapEasingToNativeEasing(\n easing: Easing | Easing[] | undefined,\n duration: number\n): undefined | string | string[] {\n if (!easing) {\n return undefined\n } else if (typeof easing === \"function\") {\n return supportsLinearEasing()\n ? generateLinearEasing(easing, duration)\n : \"ease-out\"\n } else if (isBezierDefinition(easing)) {\n return cubicBezierAsString(easing)\n } else if (Array.isArray(easing)) {\n return easing.map(\n (segmentEasing) =>\n (mapEasingToNativeEasing(segmentEasing, duration) as string) ||\n supportedWaapiEasing.easeOut\n )\n } else {\n return supportedWaapiEasing[easing as keyof typeof supportedWaapiEasing]\n }\n}\n","import { activeAnimations } from \"../../stats/animation-count\"\nimport { statsBuffer } from \"../../stats/buffer\"\nimport { ValueKeyframesDefinition, ValueTransition } from \"../types\"\nimport { mapEasingToNativeEasing } from \"./easing/map-easing\"\n\nexport function startWaapiAnimation(\n element: Element,\n valueName: string,\n keyframes: ValueKeyframesDefinition,\n {\n delay = 0,\n duration = 300,\n repeat = 0,\n repeatType = \"loop\",\n ease = \"easeOut\",\n times,\n }: ValueTransition = {},\n pseudoElement: string | undefined = undefined\n) {\n const keyframeOptions: PropertyIndexedKeyframes = {\n [valueName]: keyframes as string[],\n }\n if (times) keyframeOptions.offset = times\n\n const easing = mapEasingToNativeEasing(ease, duration)\n\n /**\n * If this is an easing array, apply to keyframes, not animation as a whole\n */\n if (Array.isArray(easing)) keyframeOptions.easing = easing\n\n if (statsBuffer.value) {\n activeAnimations.waapi++\n }\n\n const options: KeyframeAnimationOptions = {\n delay,\n duration,\n easing: !Array.isArray(easing) ? easing : \"linear\",\n fill: \"both\",\n iterations: repeat + 1,\n direction: repeatType === \"reverse\" ? \"alternate\" : \"normal\",\n }\n\n if (pseudoElement) options.pseudoElement = pseudoElement\n\n const animation = element.animate(keyframeOptions, options)\n\n if (statsBuffer.value) {\n animation.finished.finally(() => {\n activeAnimations.waapi--\n })\n }\n\n return animation\n}\n","import { AnimationGeneratorType, GeneratorFactory } from \"../../types\"\n\nexport function isGenerator(\n type?: AnimationGeneratorType\n): type is GeneratorFactory {\n return typeof type === \"function\" && \"applyToOptions\" in type\n}\n","import { ValueTransition } from \"../../../animation/types\"\nimport { supportsLinearEasing } from \"../../../utils/supports/linear-easing\"\nimport { isGenerator } from \"../../generators/utils/is-generator\"\n\nexport function applyGeneratorOptions({\n type,\n ...options\n}: ValueTransition): ValueTransition {\n if (isGenerator(type) && supportsLinearEasing()) {\n return type.applyToOptions!(options)\n } else {\n options.duration ??= 300\n options.ease ??= \"easeOut\"\n }\n\n return options\n}\n","import {\n invariant,\n millisecondsToSeconds,\n noop,\n secondsToMilliseconds,\n} from \"motion-utils\"\nimport { setStyle } from \"../render/dom/style-set\"\nimport { supportsScrollTimeline } from \"../utils/supports/scroll-timeline\"\nimport { getFinalKeyframe } from \"./keyframes/get-final\"\nimport {\n AnimationPlaybackControlsWithThen,\n AnyResolvedKeyframe,\n DOMValueAnimationOptions,\n TimelineWithFallback,\n} from \"./types\"\nimport { WithPromise } from \"./utils/WithPromise\"\nimport { startWaapiAnimation } from \"./waapi/start-waapi-animation\"\nimport { applyGeneratorOptions } from \"./waapi/utils/apply-generator\"\n\nexport interface NativeAnimationOptions<V extends AnyResolvedKeyframe = number>\n extends DOMValueAnimationOptions<V> {\n pseudoElement?: string\n startTime?: number\n}\n\n/**\n * NativeAnimation implements AnimationPlaybackControls for the browser's Web Animations API.\n */\nexport class NativeAnimation<T extends AnyResolvedKeyframe>\n extends WithPromise\n implements AnimationPlaybackControlsWithThen\n{\n /**\n * The interfaced Web Animation API animation\n */\n protected animation: Animation\n\n protected finishedTime: number | null = null\n\n protected options: NativeAnimationOptions\n\n private allowFlatten: boolean\n\n private isStopped = false\n\n private isPseudoElement: boolean\n\n /**\n * Tracks a manually-set start time that takes precedence over WAAPI's\n * dynamic startTime. This is cleared when play() or time setter is called,\n * allowing WAAPI to take over timing.\n */\n protected manualStartTime: number | null = null\n\n constructor(options?: NativeAnimationOptions) {\n super()\n\n if (!options) return\n\n const {\n element,\n name,\n keyframes,\n pseudoElement,\n allowFlatten = false,\n finalKeyframe,\n onComplete,\n } = options as any\n\n this.isPseudoElement = Boolean(pseudoElement)\n\n this.allowFlatten = allowFlatten\n this.options = options\n\n invariant(\n typeof options.type !== \"string\",\n `Mini animate() doesn't support \"type\" as a string.`,\n \"mini-spring\"\n )\n\n const transition = applyGeneratorOptions(options)\n\n this.animation = startWaapiAnimation(\n element,\n name,\n keyframes,\n transition,\n pseudoElement\n )\n\n if (transition.autoplay === false) {\n this.animation.pause()\n }\n\n this.animation.onfinish = () => {\n this.finishedTime = this.time\n\n if (!pseudoElement) {\n const keyframe = getFinalKeyframe(\n keyframes as any,\n this.options as any,\n finalKeyframe,\n this.speed\n )\n if (this.updateMotionValue) {\n this.updateMotionValue(keyframe)\n } else {\n /**\n * If we can, we want to commit the final style as set by the user,\n * rather than the computed keyframe value supplied by the animation.\n */\n setStyle(element, name, keyframe)\n }\n\n this.animation.cancel()\n }\n\n onComplete?.()\n this.notifyFinished()\n }\n }\n\n updateMotionValue?(value?: T): void\n\n play() {\n if (this.isStopped) return\n\n this.manualStartTime = null\n this.animation.play()\n\n if (this.state === \"finished\") {\n this.updateFinished()\n }\n }\n\n pause() {\n this.animation.pause()\n }\n\n complete() {\n this.animation.finish?.()\n }\n\n cancel() {\n try {\n this.animation.cancel()\n } catch (e) {}\n }\n\n stop() {\n if (this.isStopped) return\n this.isStopped = true\n const { state } = this\n\n if (state === \"idle\" || state === \"finished\") {\n return\n }\n\n if (this.updateMotionValue) {\n this.updateMotionValue()\n } else {\n this.commitStyles()\n }\n\n if (!this.isPseudoElement) this.cancel()\n }\n\n /**\n * WAAPI doesn't natively have any interruption capabilities.\n *\n * In this method, we commit styles back to the DOM before cancelling\n * the animation.\n *\n * This is designed to be overridden by NativeAnimationExtended, which\n * will create a renderless JS animation and sample it twice to calculate\n * its current value, \"previous\" value, and therefore allow\n * Motion to also correctly calculate velocity for any subsequent animation\n * while deferring the commit until the next animation frame.\n */\n protected commitStyles() {\n if (!this.isPseudoElement) {\n this.animation.commitStyles?.()\n }\n }\n\n get duration() {\n const duration =\n this.animation.effect?.getComputedTiming?.().duration || 0\n\n return millisecondsToSeconds(Number(duration))\n }\n\n get iterationDuration() {\n const { delay = 0 } = this.options || {}\n return this.duration + millisecondsToSeconds(delay)\n }\n\n get time() {\n return millisecondsToSeconds(Number(this.animation.currentTime) || 0)\n }\n\n set time(newTime: number) {\n this.manualStartTime = null\n this.finishedTime = null\n this.animation.currentTime = secondsToMilliseconds(newTime)\n }\n\n /**\n * The playback speed of the animation.\n * 1 = normal speed, 2 = double speed, 0.5 = half speed.\n */\n get speed() {\n return this.animation.playbackRate\n }\n\n set speed(newSpeed: number) {\n // Allow backwards playback after finishing\n if (newSpeed < 0) this.finishedTime = null\n\n this.animation.playbackRate = newSpeed\n }\n\n get state() {\n return this.finishedTime !== null\n ? \"finished\"\n : this.animation.playState\n }\n\n get startTime() {\n return this.manualStartTime ?? Number(this.animation.startTime)\n }\n\n set startTime(newStartTime: number) {\n this.manualStartTime = this.animation.startTime = newStartTime\n }\n\n /**\n * Attaches a timeline to the animation, for instance the `ScrollTimeline`.\n */\n attachTimeline({ timeline, observe }: TimelineWithFallback): VoidFunction {\n if (this.allowFlatten) {\n this.animation.effect?.updateTiming({ easing: \"linear\" })\n }\n\n this.animation.onfinish = null\n\n if (timeline && supportsScrollTimeline()) {\n this.animation.timeline = timeline as any\n\n return noop<void>\n } else {\n return observe(this)\n }\n }\n}\n","import { anticipate, backInOut, circInOut } from \"motion-utils\"\nimport { ValueAnimationTransition } from \"../../types\"\n\nconst unsupportedEasingFunctions = {\n anticipate,\n backInOut,\n circInOut,\n}\n\nfunction isUnsupportedEase(\n key: string\n): key is keyof typeof unsupportedEasingFunctions {\n return key in unsupportedEasingFunctions\n}\n\nexport function replaceStringEasing(transition: ValueAnimationTransition) {\n if (\n typeof transition.ease === \"string\" &&\n isUnsupportedEase(transition.ease)\n ) {\n transition.ease = unsupportedEasingFunctions[transition.ease]\n }\n}\n","import { clamp } from \"motion-utils\"\nimport { time } from \"../frameloop/sync-time\"\nimport { JSAnimation } from \"./JSAnimation\"\nimport { NativeAnimation, NativeAnimationOptions } from \"./NativeAnimation\"\nimport { AnyResolvedKeyframe, ValueAnimationOptions } from \"./types\"\nimport { replaceTransitionType } from \"./utils/replace-transition-type\"\nimport { replaceStringEasing } from \"./waapi/utils/unsupported-easing\"\n\nexport type NativeAnimationOptionsExtended<T extends AnyResolvedKeyframe> =\n NativeAnimationOptions & ValueAnimationOptions<T> & NativeAnimationOptions\n\n/**\n * 10ms is chosen here as it strikes a balance between smooth\n * results (more than one keyframe per frame at 60fps) and\n * keyframe quantity.\n */\nconst sampleDelta = 10 //ms\n\nexport class NativeAnimationExtended<\n T extends AnyResolvedKeyframe\n> extends NativeAnimation<T> {\n options: NativeAnimationOptionsExtended<T>\n\n constructor(options: NativeAnimationOptionsExtended<T>) {\n /**\n * The base NativeAnimation function only supports a subset\n * of Motion easings, and WAAPI also only supports some\n * easing functions via string/cubic-bezier definitions.\n *\n * This function replaces those unsupported easing functions\n * with a JS easing function. This will later get compiled\n * to a linear() easing function.\n */\n replaceStringEasing(options)\n\n /**\n * Ensure we replace the transition type with a generator function\n * before passing to WAAPI.\n *\n * TODO: Does this have a better home? It could be shared with\n * JSAnimation.\n */\n replaceTransitionType(options)\n\n super(options)\n\n if (options.startTime !== undefined) {\n this.startTime = options.startTime\n }\n\n this.options = options\n }\n\n /**\n * WAAPI doesn't natively have any interruption capabilities.\n *\n * Rather than read committed styles back out of the DOM, we can\n * create a renderless JS animation and sample it twice to calculate\n * its current value, \"previous\" value, and therefore allow\n * Motion to calculate velocity for any subsequent animation.\n */\n updateMotionValue(value?: T) {\n const { motionValue, onUpdate, onComplete, element, ...options } =\n this.options\n\n if (!motionValue) return\n\n if (value !== undefined) {\n motionValue.set(value)\n return\n }\n\n const sampleAnimation = new JSAnimation({\n ...options,\n autoplay: false,\n })\n\n /**\n * Use wall-clock elapsed time for sampling.\n * Under CPU load, WAAPI's currentTime may not reflect actual\n * elapsed time, causing incorrect sampling and visual jumps.\n */\n const sampleTime = Math.max(sampleDelta, time.now() - this.startTime)\n const delta = clamp(0, sampleDelta, sampleTime - sampleDelta)\n\n motionValue.setWithVelocity(\n sampleAnimation.sample(Math.max(0, sampleTime - delta)).value,\n sampleAnimation.sample(sampleTime).value,\n delta\n )\n\n sampleAnimation.stop()\n }\n}\n","import { complex } from \"../../value/types/complex\"\nimport { ValueKeyframesDefinition } from \"../types\"\n\n/**\n * Check if a value is animatable. Examples:\n *\n * ✅: 100, \"100px\", \"#fff\"\n * ❌: \"block\", \"url(2.jpg)\"\n * @param value\n *\n * @internal\n */\nexport const isAnimatable = (\n value: ValueKeyframesDefinition,\n name?: string\n) => {\n // If the list of keys that might be non-animatable grows, replace with Set\n if (name === \"zIndex\") return false\n\n // If it's a number or a keyframes array, we can animate it. We might at some point\n // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,\n // but for now lets leave it like this for performance reasons\n if (typeof value === \"number\" || Array.isArray(value)) return true\n\n if (\n typeof value === \"string\" && // It's animatable if we have a string\n (complex.test(value) || value === \"0\") && // And it contains numbers and/or colors\n !value.startsWith(\"url(\") // Unless it starts with \"url(\"\n ) {\n return true\n }\n\n return false\n}\n","import { warning } from \"motion-utils\"\nimport { isGenerator } from \"../generators/utils/is-generator\"\nimport { ResolvedKeyframes } from \"../keyframes/KeyframesResolver\"\nimport { AnimationGeneratorType } from \"../types\"\nimport { isAnimatable } from \"./is-animatable\"\n\nfunction hasKeyframesChanged(keyframes: ResolvedKeyframes<any>) {\n const current = keyframes[0]\n if (keyframes.length === 1) return true\n for (let i = 0; i < keyframes.length; i++) {\n if (keyframes[i] !== current) return true\n }\n}\n\nexport function canAnimate(\n keyframes: ResolvedKeyframes<any>,\n name?: string,\n type?: AnimationGeneratorType,\n velocity?: number\n) {\n /**\n * Check if we're able to animate between the start and end keyframes,\n * and throw a warning if we're attempting to animate between one that's\n * animatable and another that isn't.\n */\n const originKeyframe = keyframes[0]\n if (originKeyframe === null) {\n return false\n }\n\n /**\n * These aren't traditionally animatable but we do support them.\n * In future we could look into making this more generic or replacing\n * this function with mix() === mixImmediate\n */\n if (name === \"display\" || name === \"visibility\") return true\n\n const targetKeyframe = keyframes[keyframes.length - 1]\n const isOriginAnimatable = isAnimatable(originKeyframe, name)\n const isTargetAnimatable = isAnimatable(targetKeyframe, name)\n\n warning(\n isOriginAnimatable === isTargetAnimatable,\n `You are trying to animate ${name} from \"${originKeyframe}\" to \"${targetKeyframe}\". \"${\n isOriginAnimatable ? targetKeyframe : originKeyframe\n }\" is not an animatable value.`,\n \"value-not-animatable\"\n )\n\n // Always skip if any of these are true\n if (!isOriginAnimatable || !isTargetAnimatable) {\n return false\n }\n\n return (\n hasKeyframesChanged(keyframes) ||\n ((type === \"spring\" || isGenerator(type)) && velocity)\n )\n}\n","import { ValueAnimationOptions } from \"../types\"\n\nexport function makeAnimationInstant(\n options: Partial<{\n duration: ValueAnimationOptions[\"duration\"]\n type: ValueAnimationOptions[\"type\"]\n }>\n): void {\n options.duration = 0\n options.type = \"keyframes\"\n}\n","import { memo } from \"motion-utils\"\nimport {\n AnyResolvedKeyframe,\n ValueAnimationOptionsWithRenderContext,\n} from \"../../types\"\n\n/**\n * A list of values that can be hardware-accelerated.\n */\nconst acceleratedValues = new Set<string>([\n \"opacity\",\n \"clipPath\",\n \"filter\",\n \"transform\",\n // TODO: Could be re-enabled now we have support for linear() easing\n // \"background-color\"\n])\n\nconst supportsWaapi = /*@__PURE__*/ memo(() =>\n Object.hasOwnProperty.call(Element.prototype, \"animate\")\n)\n\nexport function supportsBrowserAnimation<T extends AnyResolvedKeyframe>(\n options: ValueAnimationOptionsWithRenderContext<T>\n) {\n const { motionValue, name, repeatDelay, repeatType, damping, type } =\n options\n\n const subject = motionValue?.owner?.current\n\n /**\n * We use this check instead of isHTMLElement() because we explicitly\n * **don't** want elements in different timing contexts (i.e. popups)\n * to be accelerated, as it's not possible to sync these animations\n * properly with those driven from the main window frameloop.\n */\n if (!(subject instanceof HTMLElement)) {\n return false\n }\n\n const { onUpdate, transformTemplate } = motionValue!.owner!.getProps()\n\n return (\n supportsWaapi() &&\n name &&\n acceleratedValues.has(name) &&\n (name !== \"transform\" || !transformTemplate) &&\n /**\n * If we're outputting values to onUpdate then we can't use WAAPI as there's\n * no way to read the value from WAAPI every frame.\n */\n !onUpdate &&\n !repeatDelay &&\n repeatType !== \"mirror\" &&\n damping !== 0 &&\n type !== \"inertia\"\n )\n}\n","import { MotionGlobalConfig, noop } from \"motion-utils\"\nimport { time } from \"../frameloop/sync-time\"\nimport { JSAnimation } from \"./JSAnimation\"\nimport { getFinalKeyframe } from \"./keyframes/get-final\"\nimport {\n KeyframeResolver as DefaultKeyframeResolver,\n flushKeyframeResolvers,\n ResolvedKeyframes,\n} from \"./keyframes/KeyframesResolver\"\nimport { NativeAnimationExtended } from \"./NativeAnimationExtended\"\nimport {\n AnimationPlaybackControls,\n AnyResolvedKeyframe,\n TimelineWithFallback,\n ValueAnimationOptions,\n} from \"./types\"\nimport { canAnimate } from \"./utils/can-animate\"\nimport { makeAnimationInstant } from \"./utils/make-animation-instant\"\nimport { WithPromise } from \"./utils/WithPromise\"\nimport { supportsBrowserAnimation } from \"./waapi/supports/waapi\"\n\n/**\n * Maximum time allowed between an animation being created and it being\n * resolved for us to use the latter as the start time.\n *\n * This is to ensure that while we prefer to \"start\" an animation as soon\n * as it's triggered, we also want to avoid a visual jump if there's a big delay\n * between these two moments.\n */\nconst MAX_RESOLVE_DELAY = 40\n\ntype OptionsWithoutKeyframes<T extends AnyResolvedKeyframe> = Omit<\n ValueAnimationOptions<T>,\n \"keyframes\"\n>\n\nexport class AsyncMotionValueAnimation<T extends AnyResolvedKeyframe>\n extends WithPromise\n implements AnimationPlaybackControls\n{\n private createdAt: number\n\n private resolvedAt: number | undefined\n\n private _animation: AnimationPlaybackControls | undefined\n\n private pendingTimeline: TimelineWithFallback | undefined\n\n private keyframeResolver: DefaultKeyframeResolver | undefined\n\n private stopTimeline: VoidFunction | undefined\n\n constructor({\n autoplay = true,\n delay = 0,\n type = \"keyframes\",\n repeat = 0,\n repeatDelay = 0,\n repeatType = \"loop\",\n keyframes,\n name,\n motionValue,\n element,\n ...options\n }: ValueAnimationOptions<T>) {\n super()\n\n this.createdAt = time.now()\n\n const optionsWithDefaults: OptionsWithoutKeyframes<T> = {\n autoplay,\n delay,\n type,\n repeat,\n repeatDelay,\n repeatType,\n name,\n motionValue,\n element,\n ...options,\n }\n\n const KeyframeResolver =\n element?.KeyframeResolver || DefaultKeyframeResolver\n\n this.keyframeResolver = new KeyframeResolver(\n keyframes,\n (\n resolvedKeyframes: ResolvedKeyframes<T>,\n finalKeyframe: T,\n forced: boolean\n ) =>\n this.onKeyframesResolved(\n resolvedKeyframes,\n finalKeyframe,\n optionsWithDefaults,\n !forced\n ),\n name,\n motionValue,\n element\n )\n this.keyframeResolver?.scheduleResolve()\n }\n\n onKeyframesResolved(\n keyframes: ResolvedKeyframes<T>,\n finalKeyframe: T,\n options: OptionsWithoutKeyframes<T>,\n sync: boolean\n ) {\n this.keyframeResolver = undefined\n\n const { name, type, velocity, delay, isHandoff, onUpdate } = options\n this.resolvedAt = time.now()\n\n /**\n * If we can't animate this value with the resolved keyframes\n * then we should complete it immediately.\n */\n if (!canAnimate(keyframes, name, type, velocity)) {\n if (MotionGlobalConfig.instantAnimations || !delay) {\n onUpdate?.(getFinalKeyframe(keyframes, options, finalKeyframe))\n }\n\n keyframes[0] = keyframes[keyframes.length - 1]\n\n makeAnimationInstant(options)\n options.repeat = 0\n }\n\n /**\n * Resolve startTime for the animation.\n *\n * This method uses the createdAt and resolvedAt to calculate the\n * animation startTime. *Ideally*, we would use the createdAt time as t=0\n * as the following frame would then be the first frame of the animation in\n * progress, which would feel snappier.\n *\n * However, if there's a delay (main thread work) between the creation of\n * the animation and the first committed frame, we prefer to use resolvedAt\n * to avoid a sudden jump into the animation.\n */\n const startTime = sync\n ? !this.resolvedAt\n ? this.createdAt\n : this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY\n ? this.resolvedAt\n : this.createdAt\n : undefined\n\n const resolvedOptions = {\n startTime,\n finalKeyframe,\n ...options,\n keyframes,\n }\n\n /**\n * Animate via WAAPI if possible. If this is a handoff animation, the optimised animation will be running via\n * WAAPI. Therefore, this animation must be JS to ensure it runs \"under\" the\n * optimised animation.\n */\n const useWaapi = !isHandoff && supportsBrowserAnimation(resolvedOptions)\n const element = resolvedOptions.motionValue?.owner?.current\n\n const animation = useWaapi\n ? new NativeAnimationExtended({\n ...resolvedOptions,\n element,\n } as any)\n : new JSAnimation(resolvedOptions)\n\n animation.finished.then(() => {\n this.notifyFinished()\n }).catch(noop)\n\n if (this.pendingTimeline) {\n this.stopTimeline = animation.attachTimeline(this.pendingTimeline)\n this.pendingTimeline = undefined\n }\n\n this._animation = animation\n }\n\n get finished() {\n if (!this._animation) {\n return this._finished\n } else {\n return this.animation.finished\n }\n }\n\n then(onResolve: VoidFunction, _onReject?: VoidFunction) {\n return this.finished.finally(onResolve).then(() => {})\n }\n\n get animation(): AnimationPlaybackControls {\n if (!this._animation) {\n this.keyframeResolver?.resume()\n flushKeyframeResolvers()\n }\n\n return this._animation!\n }\n\n get duration() {\n return this.animation.duration\n }\n\n get iterationDuration() {\n return this.animation.iterationDuration\n }\n\n get time() {\n return this.animation.time\n }\n\n set time(newTime: number) {\n this.animation.time = newTime\n }\n\n get speed() {\n return this.animation.speed\n }\n\n get state() {\n return this.animation.state\n }\n\n set speed(newSpeed: number) {\n this.animation.speed = newSpeed\n }\n\n get startTime() {\n return this.animation.startTime\n }\n\n attachTimeline(timeline: TimelineWithFallback) {\n if (this._animation) {\n this.stopTimeline = this.animation.attachTimeline(timeline)\n } else {\n this.pendingTimeline = timeline\n }\n\n return () => this.stop()\n }\n\n play() {\n this.animation.play()\n }\n\n pause() {\n this.animation.pause()\n }\n\n complete() {\n this.animation.complete()\n }\n\n cancel() {\n if (this._animation) {\n this.animation.cancel()\n }\n\n this.keyframeResolver?.cancel()\n }\n\n /**\n * Bound to support return animation.stop pattern\n */\n stop = () => {\n if (this._animation) {\n this._animation.stop()\n this.stopTimeline?.()\n }\n\n this.keyframeResolver?.cancel()\n }\n}\n","import type { DynamicOption } from \"../types\"\nimport type { VisualElement } from \"../../render/VisualElement\"\n\nexport function calcChildStagger(\n children: Set<VisualElement>,\n child: VisualElement,\n delayChildren?: number | DynamicOption<number>,\n staggerChildren: number = 0,\n staggerDirection: number = 1\n): number {\n const index = Array.from(children)\n .sort((a, b) => a.sortNodePosition(b))\n .indexOf(child)\n const numChildren = children.size\n const maxStaggerDuration = (numChildren - 1) * staggerChildren\n const delayIsFunction = typeof delayChildren === \"function\"\n\n return delayIsFunction\n ? delayChildren(index, numChildren)\n : staggerDirection === 1\n ? index * staggerChildren\n : maxStaggerDuration - index * staggerChildren\n}\n","import { transformProps } from \"../../render/utils/keys-transform\"\nimport type { ValueAnimationOptions } from \"../types\"\n\nconst underDampedSpring: Partial<ValueAnimationOptions> = {\n type: \"spring\",\n stiffness: 500,\n damping: 25,\n restSpeed: 10,\n}\n\nconst criticallyDampedSpring = (\n target: unknown\n): Partial<ValueAnimationOptions> => ({\n type: \"spring\",\n stiffness: 550,\n damping: target === 0 ? 2 * Math.sqrt(550) : 30,\n restSpeed: 10,\n})\n\nconst keyframesTransition: Partial<ValueAnimationOptions> = {\n type: \"keyframes\",\n duration: 0.8,\n}\n\n/**\n * Default easing curve is a slightly shallower version of\n * the default browser easing curve.\n */\nconst ease: Partial<ValueAnimationOptions> = {\n type: \"keyframes\",\n ease: [0.25, 0.1, 0.35, 1],\n duration: 0.3,\n}\n\nexport const getDefaultTransition = (\n valueKey: string,\n { keyframes }: ValueAnimationOptions\n): Partial<ValueAnimationOptions> => {\n if (keyframes.length > 2) {\n return keyframesTransition\n } else if (transformProps.has(valueKey)) {\n return valueKey.startsWith(\"scale\")\n ? criticallyDampedSpring(keyframes[1])\n : underDampedSpring\n }\n\n return ease\n}\n","import type { AnimationPlaybackOptions } from \"../types\"\n\nconst isNotNull = (value: unknown) => value !== null\n\nexport function getFinalKeyframe<T>(\n keyframes: T[],\n { repeat, repeatType = \"loop\" }: AnimationPlaybackOptions,\n finalKeyframe?: T\n): T {\n const resolvedKeyframes = keyframes.filter(isNotNull)\n const index =\n repeat && repeatType !== \"loop\" && repeat % 2 === 1\n ? 0\n : resolvedKeyframes.length - 1\n\n return !index || finalKeyframe === undefined\n ? resolvedKeyframes[index]\n : finalKeyframe\n}\n","export function getValueTransition(transition: any, key: string) {\n return (\n transition?.[key as keyof typeof transition] ??\n transition?.[\"default\"] ??\n transition\n )\n}\n","import type { AnyResolvedKeyframe } from \"../types\"\nimport type { Transition } from \"../types\"\n\n/**\n * Decide whether a transition is defined on a given Transition.\n * This filters out orchestration options and returns true\n * if any options are left.\n */\nexport function isTransitionDefined({\n when,\n delay: _delay,\n delayChildren,\n staggerChildren,\n staggerDirection,\n repeat,\n repeatType,\n repeatDelay,\n from,\n elapsed,\n ...transition\n}: Transition & { elapsed?: number; from?: AnyResolvedKeyframe }) {\n return !!Object.keys(transition).length\n}\n","import { MotionGlobalConfig, secondsToMilliseconds } from \"motion-utils\"\nimport { AsyncMotionValueAnimation } from \"../AsyncMotionValueAnimation\"\nimport { JSAnimation } from \"../JSAnimation\"\nimport type {\n AnyResolvedKeyframe,\n ValueAnimationOptions,\n ValueTransition,\n} from \"../types\"\nimport type { UnresolvedKeyframes } from \"../keyframes/KeyframesResolver\"\nimport { getValueTransition } from \"../utils/get-value-transition\"\nimport { makeAnimationInstant } from \"../utils/make-animation-instant\"\nimport { getDefaultTransition } from \"../utils/default-transitions\"\nimport { getFinalKeyframe } from \"../utils/get-final-keyframe\"\nimport { isTransitionDefined } from \"../utils/is-transition-defined\"\nimport { frame } from \"../../frameloop\"\nimport type { MotionValue, StartAnimation } from \"../../value\"\nimport type { VisualElement } from \"../../render/VisualElement\"\n\nexport const animateMotionValue =\n <V extends AnyResolvedKeyframe>(\n name: string,\n value: MotionValue<V>,\n target: V | UnresolvedKeyframes<V>,\n transition: ValueTransition & { elapsed?: number } = {},\n element?: VisualElement<any>,\n isHandoff?: boolean\n ): StartAnimation =>\n (onComplete) => {\n const valueTransition = getValueTransition(transition, name) || {}\n\n /**\n * Most transition values are currently completely overwritten by value-specific\n * transitions. In the future it'd be nicer to blend these transitions. But for now\n * delay actually does inherit from the root transition if not value-specific.\n */\n const delay = valueTransition.delay || transition.delay || 0\n\n /**\n * Elapsed isn't a public transition option but can be passed through from\n * optimized appear effects in milliseconds.\n */\n let { elapsed = 0 } = transition\n elapsed = elapsed - secondsToMilliseconds(delay)\n\n const options: ValueAnimationOptions = {\n keyframes: Array.isArray(target) ? target : [null, target],\n ease: \"easeOut\",\n velocity: value.getVelocity(),\n ...valueTransition,\n delay: -elapsed,\n onUpdate: (v) => {\n value.set(v)\n valueTransition.onUpdate && valueTransition.onUpdate(v)\n },\n onComplete: () => {\n onComplete()\n valueTransition.onComplete && valueTransition.onComplete()\n },\n name,\n motionValue: value,\n element: isHandoff ? undefined : element,\n }\n\n /**\n * If there's no transition defined for this value, we can generate\n * unique transition settings for this value.\n */\n if (!isTransitionDefined(valueTransition)) {\n Object.assign(options, getDefaultTransition(name, options))\n }\n\n /**\n * Both WAAPI and our internal animation functions use durations\n * as defined by milliseconds, while our external API defines them\n * as seconds.\n */\n options.duration &&= secondsToMilliseconds(options.duration)\n options.repeatDelay &&= secondsToMilliseconds(options.repeatDelay)\n\n /**\n * Support deprecated way to set initial value. Prefer keyframe syntax.\n */\n if (options.from !== undefined) {\n options.keyframes[0] = options.from as any\n }\n\n let shouldSkip = false\n\n if (\n (options as any).type === false ||\n (options.duration === 0 && !options.repeatDelay)\n ) {\n makeAnimationInstant(options)\n\n if (options.delay === 0) {\n shouldSkip = true\n }\n }\n\n if (\n MotionGlobalConfig.instantAnimations ||\n MotionGlobalConfig.skipAnimations\n ) {\n shouldSkip = true\n makeAnimationInstant(options)\n options.delay = 0\n }\n\n /**\n * If the transition type or easing has been explicitly set by the user\n * then we don't want to allow flattening the animation.\n */\n options.allowFlatten = !valueTransition.type && !valueTransition.ease\n\n /**\n * If we can or must skip creating the animation, and apply only\n * the final keyframe, do so. We also check once keyframes are resolved but\n * this early check prevents the need to create an animation at all.\n */\n if (shouldSkip && !isHandoff && value.get() !== undefined) {\n const finalKeyframe = getFinalKeyframe<V>(\n options.keyframes as V[],\n valueTransition\n )\n\n if (finalKeyframe !== undefined) {\n frame.update(() => {\n options.onUpdate!(finalKeyframe)\n options.onComplete!()\n })\n\n return\n }\n }\n\n return valueTransition.isSync\n ? new JSAnimation(options)\n : new AsyncMotionValueAnimation(options)\n }\n","import type {\n AnimationDefinition,\n MotionNodeOptions,\n TargetAndTransition,\n TargetResolver,\n} from \"../../node/types\"\nimport type { ResolvedValues } from \"../types\"\n\nfunction getValueState(visualElement?: any): [ResolvedValues, ResolvedValues] {\n const state: [ResolvedValues, ResolvedValues] = [{}, {}]\n\n visualElement?.values.forEach((value: any, key: string) => {\n state[0][key] = value.get()\n state[1][key] = value.getVelocity()\n })\n\n return state\n}\n\nexport function resolveVariantFromProps(\n props: MotionNodeOptions,\n definition: TargetAndTransition | TargetResolver,\n custom?: any,\n visualElement?: any\n): TargetAndTransition\nexport function resolveVariantFromProps(\n props: MotionNodeOptions,\n definition?: AnimationDefinition,\n custom?: any,\n visualElement?: any\n): undefined | TargetAndTransition\nexport function resolveVariantFromProps(\n props: MotionNodeOptions,\n definition?: AnimationDefinition,\n custom?: any,\n visualElement?: any\n) {\n /**\n * If the variant definition is a function, resolve.\n */\n if (typeof definition === \"function\") {\n const [current, velocity] = getValueState(visualElement)\n definition = definition(\n custom !== undefined ? custom : props.custom,\n current,\n velocity\n )\n }\n\n /**\n * If the variant definition is a variant label, or\n * the function returned a variant label, resolve.\n */\n if (typeof definition === \"string\") {\n definition = props.variants && props.variants[definition]\n }\n\n /**\n * At this point we've resolved both functions and variant labels,\n * but the resolved variant label might itself have been a function.\n * If so, resolve. This can only have returned a valid target object.\n */\n if (typeof definition === \"function\") {\n const [current, velocity] = getValueState(visualElement)\n definition = definition(\n custom !== undefined ? custom : props.custom,\n current,\n velocity\n )\n }\n\n return definition\n}\n","import type {\n AnimationDefinition,\n TargetAndTransition,\n TargetResolver,\n} from \"../../node/types\"\nimport { resolveVariantFromProps } from \"./resolve-variants\"\n\n/**\n * Resolves a variant if it's a variant resolver.\n * Uses `any` type for visualElement to avoid circular dependencies.\n */\nexport function resolveVariant(\n visualElement: any,\n definition?: TargetAndTransition | TargetResolver,\n custom?: any\n): TargetAndTransition\nexport function resolveVariant(\n visualElement: any,\n definition?: AnimationDefinition,\n custom?: any\n): TargetAndTransition | undefined\nexport function resolveVariant(\n visualElement: any,\n definition?: AnimationDefinition,\n custom?: any\n) {\n const props = visualElement.getProps()\n return resolveVariantFromProps(\n props,\n definition,\n custom !== undefined ? custom : props.custom,\n visualElement\n )\n}\n","import { transformPropOrder } from \"./keys-transform\"\n\nexport const positionalKeys = new Set([\n \"width\",\n \"height\",\n \"top\",\n \"left\",\n \"right\",\n \"bottom\",\n ...transformPropOrder,\n])\n","import { SubscriptionManager, velocityPerSecond, warnOnce } from \"motion-utils\"\nimport {\n AnimationPlaybackControlsWithThen,\n AnyResolvedKeyframe,\n TransformProperties,\n} from \"../animation/types\"\nimport { frame } from \"../frameloop\"\nimport { time } from \"../frameloop/sync-time\"\n\n/**\n * @public\n */\nexport type Subscriber<T> = (v: T) => void\n\n/**\n * @public\n */\nexport type PassiveEffect<T> = (v: T, safeSetter: (v: T) => void) => void\n\nexport type StartAnimation = (\n complete: () => void\n) => AnimationPlaybackControlsWithThen | undefined\n\nexport interface MotionValueEventCallbacks<V> {\n animationStart: () => void\n animationComplete: () => void\n animationCancel: () => void\n change: (latestValue: V) => void\n destroy: () => void\n}\n\n/**\n * Maximum time between the value of two frames, beyond which we\n * assume the velocity has since been 0.\n */\nconst MAX_VELOCITY_DELTA = 30\n\nconst isFloat = (value: any): value is string => {\n return !isNaN(parseFloat(value))\n}\n\ninterface ResolvedValues {\n [key: string]: AnyResolvedKeyframe\n}\n\nexport interface Owner {\n current: HTMLElement | unknown\n getProps: () => {\n onUpdate?: (latest: ResolvedValues) => void\n transformTemplate?: (\n transform: TransformProperties,\n generatedTransform: string\n ) => string\n }\n}\n\nexport interface MotionValueOptions {\n owner?: Owner\n}\n\nexport const collectMotionValues: { current: MotionValue[] | undefined } = {\n current: undefined,\n}\n\n/**\n * `MotionValue` is used to track the state and velocity of motion values.\n *\n * @public\n */\nexport class MotionValue<V = any> {\n /**\n * If a MotionValue has an owner, it was created internally within Motion\n * and therefore has no external listeners. It is therefore safe to animate via WAAPI.\n */\n owner?: Owner\n\n /**\n * The current state of the `MotionValue`.\n */\n private current: V | undefined\n\n /**\n * The previous state of the `MotionValue`.\n */\n private prev: V | undefined\n\n /**\n * The previous state of the `MotionValue` at the end of the previous frame.\n */\n private prevFrameValue: V | undefined\n\n /**\n * The last time the `MotionValue` was updated.\n */\n updatedAt: number\n\n /**\n * The time `prevFrameValue` was updated.\n */\n prevUpdatedAt: number | undefined\n\n /**\n * Add a passive effect to this `MotionValue`.\n *\n * A passive effect intercepts calls to `set`. For instance, `useSpring` adds\n * a passive effect that attaches a `spring` to the latest\n * set value. Hypothetically there could be a `useSmooth` that attaches an input smoothing effect.\n *\n * @internal\n */\n private passiveEffect?: PassiveEffect<V>\n private stopPassiveEffect?: VoidFunction\n\n /**\n * Whether the passive effect is active.\n */\n isEffectActive?: boolean\n\n /**\n * A reference to the currently-controlling animation.\n */\n animation?: AnimationPlaybackControlsWithThen\n\n /**\n * Tracks whether this value can output a velocity. Currently this is only true\n * if the value is numerical, but we might be able to widen the scope here and support\n * other value types.\n *\n * @internal\n */\n private canTrackVelocity: boolean | null = null\n\n /**\n * A list of MotionValues whose values are computed from this one.\n * This is a rough start to a proper signal-like dirtying system.\n */\n private dependents: Set<MotionValue> | undefined\n\n /**\n * Tracks whether this value should be removed\n */\n liveStyle?: boolean\n\n /**\n * @param init - The initiating value\n * @param config - Optional configuration options\n *\n * - `transformer`: A function to transform incoming values with.\n */\n constructor(init: V, options: MotionValueOptions = {}) {\n this.setCurrent(init)\n this.owner = options.owner\n }\n\n setCurrent(current: V) {\n this.current = current\n this.updatedAt = time.now()\n\n if (this.canTrackVelocity === null && current !== undefined) {\n this.canTrackVelocity = isFloat(this.current)\n }\n }\n\n setPrevFrameValue(prevFrameValue: V | undefined = this.current) {\n this.prevFrameValue = prevFrameValue\n this.prevUpdatedAt = this.updatedAt\n }\n\n /**\n * Adds a function that will be notified when the `MotionValue` is updated.\n *\n * It returns a function that, when called, will cancel the subscription.\n *\n * When calling `onChange` inside a React component, it should be wrapped with the\n * `useEffect` hook. As it returns an unsubscribe function, this should be returned\n * from the `useEffect` function to ensure you don't add duplicate subscribers..\n *\n * ```jsx\n * export const MyComponent = () => {\n * const x = useMotionValue(0)\n * const y = useMotionValue(0)\n * const opacity = useMotionValue(1)\n *\n * useEffect(() => {\n * function updateOpacity() {\n * const maxXY = Math.max(x.get(), y.get())\n * const newOpacity = transform(maxXY, [0, 100], [1, 0])\n * opacity.set(newOpacity)\n * }\n *\n * const unsubscribeX = x.on(\"change\", updateOpacity)\n * const unsubscribeY = y.on(\"change\", updateOpacity)\n *\n * return () => {\n * unsubscribeX()\n * unsubscribeY()\n * }\n * }, [])\n *\n * return <motion.div style={{ x }} />\n * }\n * ```\n *\n * @param subscriber - A function that receives the latest value.\n * @returns A function that, when called, will cancel this subscription.\n *\n * @deprecated\n */\n onChange(subscription: Subscriber<V>): () => void {\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(\n false,\n `value.onChange(callback) is deprecated. Switch to value.on(\"change\", callback).`\n )\n }\n return this.on(\"change\", subscription)\n }\n\n /**\n * An object containing a SubscriptionManager for each active event.\n */\n private events: {\n [key: string]: SubscriptionManager<any>\n } = {}\n\n on<EventName extends keyof MotionValueEventCallbacks<V>>(\n eventName: EventName,\n callback: MotionValueEventCallbacks<V>[EventName]\n ) {\n if (!this.events[eventName]) {\n this.events[eventName] = new SubscriptionManager()\n }\n\n const unsubscribe = this.events[eventName].add(callback)\n\n if (eventName === \"change\") {\n return () => {\n unsubscribe()\n\n /**\n * If we have no more change listeners by the start\n * of the next frame, stop active animations.\n */\n frame.read(() => {\n if (!this.events.change.getSize()) {\n this.stop()\n }\n })\n }\n }\n\n return unsubscribe\n }\n\n clearListeners() {\n for (const eventManagers in this.events) {\n this.events[eventManagers].clear()\n }\n }\n\n /**\n * Attaches a passive effect to the `MotionValue`.\n */\n attach(passiveEffect: PassiveEffect<V>, stopPassiveEffect: VoidFunction) {\n this.passiveEffect = passiveEffect\n this.stopPassiveEffect = stopPassiveEffect\n }\n\n /**\n * Sets the state of the `MotionValue`.\n *\n * @remarks\n *\n * ```jsx\n * const x = useMotionValue(0)\n * x.set(10)\n * ```\n *\n * @param latest - Latest value to set.\n * @param render - Whether to notify render subscribers. Defaults to `true`\n *\n * @public\n */\n set(v: V) {\n if (!this.passiveEffect) {\n this.updateAndNotify(v)\n } else {\n this.passiveEffect(v, this.updateAndNotify)\n }\n }\n\n setWithVelocity(prev: V, current: V, delta: number) {\n this.set(current)\n this.prev = undefined\n this.prevFrameValue = prev\n this.prevUpdatedAt = this.updatedAt - delta\n }\n\n /**\n * Set the state of the `MotionValue`, stopping any active animations,\n * effects, and resets velocity to `0`.\n */\n jump(v: V, endAnimation = true) {\n this.updateAndNotify(v)\n this.prev = v\n this.prevUpdatedAt = this.prevFrameValue = undefined\n endAnimation && this.stop()\n if (this.stopPassiveEffect) this.stopPassiveEffect()\n }\n\n dirty() {\n this.events.change?.notify(this.current)\n }\n\n addDependent(dependent: MotionValue) {\n if (!this.dependents) {\n this.dependents = new Set()\n }\n this.dependents.add(dependent)\n }\n\n removeDependent(dependent: MotionValue) {\n if (this.dependents) {\n this.dependents.delete(dependent)\n }\n }\n\n updateAndNotify = (v: V) => {\n const currentTime = time.now()\n\n /**\n * If we're updating the value during another frame or eventloop\n * than the previous frame, then the we set the previous frame value\n * to current.\n */\n if (this.updatedAt !== currentTime) {\n this.setPrevFrameValue()\n }\n\n this.prev = this.current\n\n this.setCurrent(v)\n\n // Update update subscribers\n if (this.current !== this.prev) {\n this.events.change?.notify(this.current)\n\n if (this.dependents) {\n for (const dependent of this.dependents) {\n dependent.dirty()\n }\n }\n }\n }\n\n /**\n * Returns the latest state of `MotionValue`\n *\n * @returns - The latest state of `MotionValue`\n *\n * @public\n */\n get() {\n if (collectMotionValues.current) {\n collectMotionValues.current.push(this)\n }\n\n return this.current!\n }\n\n /**\n * @public\n */\n getPrevious() {\n return this.prev\n }\n\n /**\n * Returns the latest velocity of `MotionValue`\n *\n * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.\n *\n * @public\n */\n getVelocity() {\n const currentTime = time.now()\n\n if (\n !this.canTrackVelocity ||\n this.prevFrameValue === undefined ||\n currentTime - this.updatedAt > MAX_VELOCITY_DELTA\n ) {\n return 0\n }\n\n const delta = Math.min(\n this.updatedAt - this.prevUpdatedAt!,\n MAX_VELOCITY_DELTA\n )\n\n // Casts because of parseFloat's poor typing\n return velocityPerSecond(\n parseFloat(this.current as any) -\n parseFloat(this.prevFrameValue as any),\n delta\n )\n }\n\n hasAnimated = false\n\n /**\n * Registers a new animation to control this `MotionValue`. Only one\n * animation can drive a `MotionValue` at one time.\n *\n * ```jsx\n * value.start()\n * ```\n *\n * @param animation - A function that starts the provided animation\n */\n start(startAnimation: StartAnimation) {\n this.stop()\n\n return new Promise<void>((resolve) => {\n this.hasAnimated = true\n this.animation = startAnimation(resolve)\n\n if (this.events.animationStart) {\n this.events.animationStart.notify()\n }\n }).then(() => {\n if (this.events.animationComplete) {\n this.events.animationComplete.notify()\n }\n this.clearAnimation()\n })\n }\n\n /**\n * Stop the currently active animation.\n *\n * @public\n */\n stop() {\n if (this.animation) {\n this.animation.stop()\n if (this.events.animationCancel) {\n this.events.animationCancel.notify()\n }\n }\n this.clearAnimation()\n }\n\n /**\n * Returns `true` if this value is currently animating.\n *\n * @public\n */\n isAnimating() {\n return !!this.animation\n }\n\n private clearAnimation() {\n delete this.animation\n }\n\n /**\n * Destroy and clean up subscribers to this `MotionValue`.\n *\n * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically\n * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually\n * created a `MotionValue` via the `motionValue` function.\n *\n * @public\n */\n destroy() {\n this.dependents?.clear()\n this.events.destroy?.notify()\n this.clearListeners()\n this.stop()\n\n if (this.stopPassiveEffect) {\n this.stopPassiveEffect()\n }\n }\n}\n\nexport function motionValue<V>(init: V, options?: MotionValueOptions) {\n return new MotionValue<V>(init, options)\n}\n","import type { UnresolvedValueKeyframe, ValueKeyframesDefinition } from \"../../animation/types\"\n\nexport const isKeyframesTarget = (\n v: ValueKeyframesDefinition\n): v is UnresolvedValueKeyframe[] => {\n return Array.isArray(v)\n}\n","import { motionValue } from \"../../value\"\nimport { resolveVariant } from \"./resolve-dynamic-variants\"\nimport { isKeyframesTarget } from \"./is-keyframes-target\"\nimport type { AnimationDefinition } from \"../../node/types\"\nimport type {\n AnyResolvedKeyframe,\n UnresolvedValueKeyframe,\n ValueKeyframesDefinition,\n} from \"../../animation/types\"\nimport type { VisualElement } from \"../VisualElement\"\n\n/**\n * Set VisualElement's MotionValue, creating a new MotionValue for it if\n * it doesn't exist.\n */\nfunction setMotionValue(\n visualElement: VisualElement,\n key: string,\n value: AnyResolvedKeyframe\n) {\n if (visualElement.hasValue(key)) {\n visualElement.getValue(key)!.set(value)\n } else {\n visualElement.addValue(key, motionValue(value))\n }\n}\n\nfunction resolveFinalValueInKeyframes(\n v: ValueKeyframesDefinition\n): UnresolvedValueKeyframe {\n // TODO maybe throw if v.length - 1 is placeholder token?\n return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v\n}\n\nexport function setTarget(\n visualElement: VisualElement,\n definition: AnimationDefinition\n) {\n const resolved = resolveVariant(visualElement, definition)\n let { transitionEnd = {}, transition = {}, ...target } = resolved || {}\n\n target = { ...target, ...transitionEnd }\n\n for (const key in target) {\n const value = resolveFinalValueInKeyframes(\n target[key as keyof typeof target] as any\n )\n setMotionValue(visualElement, key, value as AnyResolvedKeyframe)\n }\n}\n","import type { MotionValue } from \"..\"\n\nexport const isMotionValue = (value: any): value is MotionValue =>\n Boolean(value && value.getVelocity)\n","import { isMotionValue } from \"../utils/is-motion-value\"\nimport type { WillChange } from \"./types\"\n\nexport function isWillChangeMotionValue(value: any): value is WillChange {\n return Boolean(isMotionValue(value) && (value as WillChange).add)\n}\n","import { MotionGlobalConfig } from \"motion-utils\"\nimport type { VisualElement } from \"../../render/VisualElement\"\nimport { isWillChangeMotionValue } from \"./is\"\n\nexport function addValueToWillChange(\n visualElement: VisualElement,\n key: string\n) {\n const willChange = visualElement.getValue(\"willChange\")\n\n /**\n * It could be that a user has set willChange to a regular MotionValue,\n * in which case we can't add the value to it.\n */\n if (isWillChangeMotionValue(willChange)) {\n return willChange.add(key)\n } else if (!willChange && MotionGlobalConfig.WillChange) {\n const newWillChange = new MotionGlobalConfig.WillChange(\"auto\")\n\n visualElement.addValue(\"willChange\", newWillChange)\n newWillChange.add(key)\n }\n}\n","export function camelToDash(str: string): string {\n return str.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`)\n}\n","import { camelToDash } from \"../../render/dom/utils/camel-to-dash\"\n\nexport const optimizedAppearDataId = \"framerAppearId\"\n\nexport const optimizedAppearDataAttribute =\n \"data-\" + camelToDash(optimizedAppearDataId) as \"data-framer-appear-id\"\n","import { optimizedAppearDataAttribute } from \"./data-id\"\nimport type { WithAppearProps } from \"./types\"\n\nexport function getOptimisedAppearId(\n visualElement: WithAppearProps\n): string | undefined {\n return visualElement.props[optimizedAppearDataAttribute]\n}\n","import { frame } from \"../../frameloop\"\nimport { getValueTransition } from \"../utils/get-value-transition\"\nimport { positionalKeys } from \"../../render/utils/keys-position\"\nimport { setTarget } from \"../../render/utils/setters\"\nimport { addValueToWillChange } from \"../../value/will-change/add-will-change\"\nimport { getOptimisedAppearId } from \"../optimized-appear/get-appear-id\"\nimport { animateMotionValue } from \"./motion-value\"\nimport type { VisualElementAnimationOptions } from \"./types\"\nimport type { AnimationPlaybackControlsWithThen } from \"../types\"\nimport type { TargetAndTransition } from \"../../node/types\"\nimport type { AnimationTypeState } from \"../../render/utils/animation-state\"\nimport type { VisualElement } from \"../../render/VisualElement\"\n\n/**\n * Decide whether we should block this animation. Previously, we achieved this\n * just by checking whether the key was listed in protectedKeys, but this\n * posed problems if an animation was triggered by afterChildren and protectedKeys\n * had been set to true in the meantime.\n */\nfunction shouldBlockAnimation(\n { protectedKeys, needsAnimating }: AnimationTypeState,\n key: string\n) {\n const shouldBlock =\n protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true\n\n needsAnimating[key] = false\n return shouldBlock\n}\n\nexport function animateTarget(\n visualElement: VisualElement,\n targetAndTransition: TargetAndTransition,\n { delay = 0, transitionOverride, type }: VisualElementAnimationOptions = {}\n): AnimationPlaybackControlsWithThen[] {\n let {\n transition = visualElement.getDefaultTransition(),\n transitionEnd,\n ...target\n } = targetAndTransition\n\n const reduceMotion = (transition as { reduceMotion?: boolean })?.reduceMotion\n\n if (transitionOverride) transition = transitionOverride\n\n const animations: AnimationPlaybackControlsWithThen[] = []\n\n const animationTypeState =\n type &&\n visualElement.animationState &&\n visualElement.animationState.getState()[type]\n\n for (const key in target) {\n const value = visualElement.getValue(\n key,\n visualElement.latestValues[key] ?? null\n )\n const valueTarget = target[key as keyof typeof target]\n\n if (\n valueTarget === undefined ||\n (animationTypeState &&\n shouldBlockAnimation(animationTypeState, key))\n ) {\n continue\n }\n\n const valueTransition = {\n delay,\n ...getValueTransition(transition || {}, key),\n }\n\n /**\n * If the value is already at the defined target, skip the animation.\n */\n const currentValue = value.get()\n if (\n currentValue !== undefined &&\n !value.isAnimating &&\n !Array.isArray(valueTarget) &&\n valueTarget === currentValue &&\n !valueTransition.velocity\n ) {\n continue\n }\n\n /**\n * If this is the first time a value is being animated, check\n * to see if we're handling off from an existing animation.\n */\n let isHandoff = false\n if (window.MotionHandoffAnimation) {\n const appearId = getOptimisedAppearId(visualElement)\n\n if (appearId) {\n const startTime = window.MotionHandoffAnimation(\n appearId,\n key,\n frame\n )\n\n if (startTime !== null) {\n valueTransition.startTime = startTime\n isHandoff = true\n }\n }\n }\n\n addValueToWillChange(visualElement, key)\n\n const shouldReduceMotion =\n reduceMotion ?? visualElement.shouldReduceMotion\n\n value.start(\n animateMotionValue(\n key,\n value,\n valueTarget,\n shouldReduceMotion && positionalKeys.has(key)\n ? { type: false }\n : valueTransition,\n visualElement,\n isHandoff\n )\n )\n\n const animation = value.animation\n\n if (animation) {\n animations.push(animation)\n }\n }\n\n if (transitionEnd) {\n Promise.all(animations).then(() => {\n frame.update(() => {\n transitionEnd && setTarget(visualElement, transitionEnd)\n })\n })\n }\n\n return animations\n}\n","import { resolveVariant } from \"../../render/utils/resolve-dynamic-variants\"\nimport { calcChildStagger } from \"../utils/calc-child-stagger\"\nimport type { VisualElementAnimationOptions } from \"./types\"\nimport { animateTarget } from \"./visual-element-target\"\nimport type { DynamicOption } from \"../types\"\nimport type { VisualElement } from \"../../render/VisualElement\"\n\nexport function animateVariant(\n visualElement: VisualElement,\n variant: string,\n options: VisualElementAnimationOptions = {}\n): Promise<any> {\n const resolved = resolveVariant(\n visualElement,\n variant,\n options.type === \"exit\"\n ? visualElement.presenceContext?.custom\n : undefined\n )\n\n let { transition = visualElement.getDefaultTransition() || {} } =\n resolved || {}\n\n if (options.transitionOverride) {\n transition = options.transitionOverride\n }\n\n /**\n * If we have a variant, create a callback that runs it as an animation.\n * Otherwise, we resolve a Promise immediately for a composable no-op.\n */\n const getAnimation: () => Promise<any> = resolved\n ? () => Promise.all(animateTarget(visualElement, resolved, options))\n : () => Promise.resolve()\n\n /**\n * If we have children, create a callback that runs all their animations.\n * Otherwise, we resolve a Promise immediately for a composable no-op.\n */\n const getChildAnimations =\n visualElement.variantChildren && visualElement.variantChildren.size\n ? (forwardDelay = 0) => {\n const {\n delayChildren = 0,\n staggerChildren,\n staggerDirection,\n } = transition\n\n return animateChildren(\n visualElement,\n variant,\n forwardDelay,\n delayChildren,\n staggerChildren,\n staggerDirection,\n options\n )\n }\n : () => Promise.resolve()\n\n /**\n * If the transition explicitly defines a \"when\" option, we need to resolve either\n * this animation or all children animations before playing the other.\n */\n const { when } = transition\n if (when) {\n const [first, last] =\n when === \"beforeChildren\"\n ? [getAnimation, getChildAnimations]\n : [getChildAnimations, getAnimation]\n\n return first().then(() => last())\n } else {\n return Promise.all([getAnimation(), getChildAnimations(options.delay)])\n }\n}\n\nfunction animateChildren(\n visualElement: VisualElement,\n variant: string,\n delay: number = 0,\n delayChildren: number | DynamicOption<number> = 0,\n staggerChildren = 0,\n staggerDirection = 1,\n options: VisualElementAnimationOptions\n) {\n const animations: Promise<any>[] = []\n\n for (const child of visualElement.variantChildren!) {\n child.notify(\"AnimationStart\", variant)\n animations.push(\n animateVariant(child, variant, {\n ...options,\n delay:\n delay +\n (typeof delayChildren === \"function\" ? 0 : delayChildren) +\n calcChildStagger(\n visualElement.variantChildren!,\n child,\n delayChildren,\n staggerChildren,\n staggerDirection\n ),\n }).then(() => child.notify(\"AnimationComplete\", variant))\n )\n }\n\n return Promise.all(animations)\n}\n","import { resolveVariant } from \"../../render/utils/resolve-dynamic-variants\"\nimport type { AnimationDefinition } from \"../../node/types\"\nimport type { VisualElement } from \"../../render/VisualElement\"\nimport type { VisualElementAnimationOptions } from \"./types\"\nimport { animateTarget } from \"./visual-element-target\"\nimport { animateVariant } from \"./visual-element-variant\"\n\nexport function animateVisualElement(\n visualElement: VisualElement,\n definition: AnimationDefinition,\n options: VisualElementAnimationOptions = {}\n) {\n visualElement.notify(\"AnimationStart\", definition)\n let animation: Promise<any>\n\n if (Array.isArray(definition)) {\n const animations = definition.map((variant) =>\n animateVariant(visualElement, variant, options)\n )\n animation = Promise.all(animations)\n } else if (typeof definition === \"string\") {\n animation = animateVariant(visualElement, definition, options)\n } else {\n const resolvedDefinition =\n typeof definition === \"function\"\n ? resolveVariant(visualElement, definition, options.custom)\n : definition\n\n animation = Promise.all(\n animateTarget(visualElement, resolvedDefinition, options)\n )\n }\n\n return animation.then(() => {\n visualElement.notify(\"AnimationComplete\", definition)\n })\n}\n","export type ElementOrSelector =\n | Element\n | Element[]\n | NodeListOf<Element>\n | string\n | null\n | undefined\n\nexport interface WithQuerySelectorAll {\n querySelectorAll: Element[\"querySelectorAll\"]\n}\n\nexport interface AnimationScope<T = any> {\n readonly current: T\n animations: any[] // TODO: Refactor to types package AnimationPlaybackControls[]\n}\n\nexport interface SelectorCache {\n [key: string]: NodeListOf<Element>\n}\n\nexport function resolveElements(\n elementOrSelector: ElementOrSelector,\n scope?: AnimationScope,\n selectorCache?: SelectorCache\n): Element[] {\n if (elementOrSelector == null) {\n return []\n }\n\n if (elementOrSelector instanceof EventTarget) {\n return [elementOrSelector]\n } else if (typeof elementOrSelector === \"string\") {\n let root: WithQuerySelectorAll = document\n\n if (scope) {\n root = scope.current\n }\n\n const elements =\n selectorCache?.[elementOrSelector] ??\n root.querySelectorAll(elementOrSelector)\n\n return elements ? Array.from(elements) : []\n }\n\n return Array.from(elementOrSelector).filter(\n (element): element is Element => element != null\n )\n}\n","import { isObject } from \"motion-utils\"\n\n/**\n * Checks if an element is an HTML element in a way\n * that works across iframes\n */\nexport function isHTMLElement(element: unknown): element is HTMLElement {\n return isObject(element) && \"offsetHeight\" in element\n}\n","import { isObject } from \"motion-utils\"\n\n/**\n * Checks if an element is an SVG element in a way\n * that works across iframes\n */\nexport function isSVGElement(element: unknown): element is SVGElement {\n return isObject(element) && \"ownerSVGElement\" in element\n}\n","import { isSVGElement } from \"../utils/is-svg-element\"\nimport { ElementOrSelector, resolveElements } from \"../utils/resolve-elements\"\nimport { ResizeHandler } from \"./types\"\n\nconst resizeHandlers = new WeakMap<Element, Set<ResizeHandler<Element>>>()\n\nlet observer: ResizeObserver | undefined\n\nconst getSize =\n (\n borderBoxAxis: \"inline\" | \"block\",\n svgAxis: \"width\" | \"height\",\n htmlAxis: \"offsetWidth\" | \"offsetHeight\"\n ) =>\n (target: Element, borderBoxSize?: ReadonlyArray<ResizeObserverSize>) => {\n if (borderBoxSize && borderBoxSize[0]) {\n return borderBoxSize[0][\n (borderBoxAxis + \"Size\") as keyof ResizeObserverSize\n ]\n } else if (isSVGElement(target) && \"getBBox\" in target) {\n return (target as SVGGraphicsElement).getBBox()[svgAxis]\n } else {\n return (target as HTMLElement)[htmlAxis]\n }\n }\n\nconst getWidth = /*@__PURE__*/ getSize(\"inline\", \"width\", \"offsetWidth\")\nconst getHeight = /*@__PURE__*/ getSize(\"block\", \"height\", \"offsetHeight\")\n\nfunction notifyTarget({ target, borderBoxSize }: ResizeObserverEntry) {\n resizeHandlers.get(target)?.forEach((handler) => {\n handler(target, {\n get width() {\n return getWidth(target, borderBoxSize)\n },\n get height() {\n return getHeight(target, borderBoxSize)\n },\n })\n })\n}\n\nfunction notifyAll(entries: ResizeObserverEntry[]) {\n entries.forEach(notifyTarget)\n}\n\nfunction createResizeObserver() {\n if (typeof ResizeObserver === \"undefined\") return\n\n observer = new ResizeObserver(notifyAll)\n}\n\nexport function resizeElement(\n target: ElementOrSelector,\n handler: ResizeHandler<Element>\n) {\n if (!observer) createResizeObserver()\n\n const elements = resolveElements(target)\n\n elements.forEach((element) => {\n let elementHandlers = resizeHandlers.get(element)\n\n if (!elementHandlers) {\n elementHandlers = new Set()\n resizeHandlers.set(element, elementHandlers)\n }\n\n elementHandlers.add(handler)\n observer?.observe(element)\n })\n\n return () => {\n elements.forEach((element) => {\n const elementHandlers = resizeHandlers.get(element)\n\n elementHandlers?.delete(handler)\n\n if (!elementHandlers?.size) {\n observer?.unobserve(element)\n }\n })\n }\n}\n","import { WindowResizeHandler } from \"./types\"\n\nconst windowCallbacks = new Set<WindowResizeHandler>()\n\nlet windowResizeHandler: VoidFunction | undefined\n\nfunction createWindowResizeHandler() {\n windowResizeHandler = () => {\n const info = {\n get width() {\n return window.innerWidth\n },\n get height() {\n return window.innerHeight\n },\n }\n\n windowCallbacks.forEach((callback) => callback(info))\n }\n\n window.addEventListener(\"resize\", windowResizeHandler)\n}\n\nexport function resizeWindow(callback: WindowResizeHandler) {\n windowCallbacks.add(callback)\n\n if (!windowResizeHandler) createWindowResizeHandler()\n\n return () => {\n windowCallbacks.delete(callback)\n\n if (\n !windowCallbacks.size &&\n typeof windowResizeHandler === \"function\"\n ) {\n window.removeEventListener(\"resize\", windowResizeHandler)\n windowResizeHandler = undefined\n }\n }\n}\n","import { ElementOrSelector } from \"../utils/resolve-elements\"\nimport { resizeElement } from \"./handle-element\"\nimport { resizeWindow } from \"./handle-window\"\nimport { ResizeHandler, WindowResizeHandler } from \"./types\"\n\nexport function resize(onResize: WindowResizeHandler): VoidFunction\nexport function resize(\n target: ElementOrSelector,\n onResize: ResizeHandler<Element>\n): VoidFunction\nexport function resize(\n a: WindowResizeHandler | ElementOrSelector,\n b?: ResizeHandler<Element>\n) {\n return typeof a === \"function\" ? resizeWindow(a) : resizeElement(a, b!)\n}\n","import { ProgressTimeline } from \"../animation/types\"\nimport { cancelFrame, frame } from \"../frameloop\"\n\ntype Update = (progress: number) => void\n\nexport function observeTimeline(update: Update, timeline: ProgressTimeline) {\n let prevProgress: number\n\n const onFrame = () => {\n const { currentTime } = timeline\n const percentage = currentTime === null ? 0 : currentTime.value\n const progress = percentage / 100\n\n if (prevProgress !== progress) {\n update(progress)\n }\n\n prevProgress = progress\n }\n\n frame.preUpdate(onFrame, true)\n\n return () => cancelFrame(onFrame)\n}\n","import { EasingFunction } from \"motion-utils\"\nimport { interpolate } from \"./interpolate\"\n\n/**\n * @public\n */\nexport interface TransformOptions<T> {\n /**\n * Clamp values to within the given range. Defaults to `true`\n *\n * @public\n */\n clamp?: boolean\n\n /**\n * Easing functions to use on the interpolations between each value in the input and output ranges.\n *\n * If provided as an array, the array must be one item shorter than the input and output ranges, as the easings apply to the transition **between** each.\n *\n * @public\n */\n ease?: EasingFunction | EasingFunction[]\n\n /**\n * Provide a function that can interpolate between any two values in the provided range.\n *\n * @public\n */\n mixer?: (from: T, to: T) => (v: number) => any\n}\n\n/**\n * Transforms numbers into other values by mapping them from an input range to an output range.\n * Returns the type of the input provided.\n *\n * @remarks\n *\n * Given an input range of `[0, 200]` and an output range of\n * `[0, 1]`, this function will return a value between `0` and `1`.\n * The input range must be a linear series of numbers. The output range\n * can be any supported value type, such as numbers, colors, shadows, arrays, objects and more.\n * Every value in the output range must be of the same type and in the same format.\n *\n * ```jsx\n * export function MyComponent() {\n * const inputRange = [0, 200]\n * const outputRange = [0, 1]\n * const output = transform(100, inputRange, outputRange)\n *\n * // Returns 0.5\n * return <div>{output}</div>\n * }\n * ```\n *\n * @param inputValue - A number to transform between the input and output ranges.\n * @param inputRange - A linear series of numbers (either all increasing or decreasing).\n * @param outputRange - A series of numbers, colors, strings, or arrays/objects of those. Must be the same length as `inputRange`.\n * @param options - Clamp: Clamp values to within the given range. Defaults to `true`.\n *\n * @public\n */\nexport function transform<T>(\n inputValue: number,\n inputRange: number[],\n outputRange: T[],\n options?: TransformOptions<T>\n): T\n/**\n *\n * Transforms numbers into other values by mapping them from an input range to an output range.\n *\n * Given an input range of `[0, 200]` and an output range of\n * `[0, 1]`, this function will return a value between `0` and `1`.\n * The input range must be a linear series of numbers. The output range\n * can be any supported value type, such as numbers, colors, shadows, arrays, objects and more.\n * Every value in the output range must be of the same type and in the same format.\n *\n * ```jsx\n * export function MyComponent() {\n * const inputRange = [-200, -100, 100, 200]\n * const outputRange = [0, 1, 1, 0]\n * const convertRange = transform(inputRange, outputRange)\n * const output = convertRange(-150)\n *\n * // Returns 0.5\n * return <div>{output}</div>\n * }\n *\n * ```\n *\n * @param inputRange - A linear series of numbers (either all increasing or decreasing).\n * @param outputRange - A series of numbers, colors or strings. Must be the same length as `inputRange`.\n * @param options - Clamp: clamp values to within the given range. Defaults to `true`.\n *\n * @public\n */\nexport function transform<T>(\n inputRange: number[],\n outputRange: T[],\n options?: TransformOptions<T>\n): (inputValue: number) => T\nexport function transform<T>(\n ...args:\n | [number, number[], T[], TransformOptions<T>?]\n | [number[], T[], TransformOptions<T>?]\n) {\n const useImmediate = !Array.isArray(args[0])\n const argOffset = useImmediate ? 0 : -1\n const inputValue = args[0 + argOffset] as number\n const inputRange = args[1 + argOffset] as number[]\n const outputRange = args[2 + argOffset] as T[]\n const options = args[3 + argOffset] as TransformOptions<T>\n\n const interpolator = interpolate(inputRange, outputRange, options)\n\n return useImmediate ? interpolator(inputValue) : interpolator\n}\n","import { MotionValue, motionValue } from \".\"\nimport { JSAnimation } from \"../animation/JSAnimation\"\nimport { AnyResolvedKeyframe, ValueAnimationTransition } from \"../animation/types\"\nimport { frame } from \"../frameloop\"\nimport { isMotionValue } from \"./utils/is-motion-value\"\n\n/**\n * Options for useFollowValue hook, extending ValueAnimationTransition\n * but excluding lifecycle callbacks that don't make sense for the hook pattern.\n */\nexport type FollowValueOptions = Omit<\n ValueAnimationTransition,\n \"onUpdate\" | \"onComplete\" | \"onPlay\" | \"onRepeat\" | \"onStop\"\n>\n\n/**\n * Create a `MotionValue` that animates to its latest value using any transition type.\n * Can either be a value or track another `MotionValue`.\n *\n * ```jsx\n * const x = motionValue(0)\n * const y = followValue(x, { type: \"spring\", stiffness: 300 })\n * // or with tween\n * const z = followValue(x, { type: \"tween\", duration: 0.5, ease: \"easeOut\" })\n * ```\n *\n * @param source - Initial value or MotionValue to track\n * @param options - Animation transition options\n * @returns `MotionValue`\n *\n * @public\n */\nexport function followValue<T extends AnyResolvedKeyframe>(\n source: T | MotionValue<T>,\n options?: FollowValueOptions\n) {\n const initialValue = isMotionValue(source) ? source.get() : source\n const value = motionValue(initialValue)\n\n attachFollow(value, source, options)\n\n return value\n}\n\n/**\n * Attach an animation to a MotionValue that will animate whenever the value changes.\n * Similar to attachSpring but supports any transition type (spring, tween, inertia, etc.)\n *\n * @param value - The MotionValue to animate\n * @param source - Initial value or MotionValue to track\n * @param options - Animation transition options\n * @returns Cleanup function\n *\n * @public\n */\nexport function attachFollow<T extends AnyResolvedKeyframe>(\n value: MotionValue<T>,\n source: T | MotionValue<T>,\n options: FollowValueOptions = {}\n): VoidFunction {\n const initialValue = value.get()\n\n let activeAnimation: JSAnimation<number> | null = null\n let latestValue = initialValue\n let latestSetter: (v: T) => void\n\n const unit =\n typeof initialValue === \"string\"\n ? initialValue.replace(/[\\d.-]/g, \"\")\n : undefined\n\n const stopAnimation = () => {\n if (activeAnimation) {\n activeAnimation.stop()\n activeAnimation = null\n }\n }\n\n const startAnimation = () => {\n stopAnimation()\n\n const currentValue = asNumber(value.get())\n const targetValue = asNumber(latestValue)\n\n // Don't animate if we're already at the target\n if (currentValue === targetValue) {\n return\n }\n\n activeAnimation = new JSAnimation({\n keyframes: [currentValue, targetValue],\n velocity: value.getVelocity(),\n // Default to spring if no type specified (matches useSpring behavior)\n type: \"spring\",\n restDelta: 0.001,\n restSpeed: 0.01,\n ...options,\n onUpdate: latestSetter,\n })\n }\n\n value.attach((v, set) => {\n latestValue = v\n latestSetter = (latest) => set(parseValue(latest, unit) as T)\n\n frame.postRender(() => {\n startAnimation()\n value[\"events\"].animationStart?.notify()\n activeAnimation?.then(() => {\n value[\"events\"].animationComplete?.notify()\n })\n })\n }, stopAnimation)\n\n if (isMotionValue(source)) {\n const removeSourceOnChange = source.on(\"change\", (v) =>\n value.set(parseValue(v, unit) as T)\n )\n\n const removeValueOnDestroy = value.on(\"destroy\", removeSourceOnChange)\n\n return () => {\n removeSourceOnChange()\n removeValueOnDestroy()\n }\n }\n\n return stopAnimation\n}\n\nfunction parseValue(v: AnyResolvedKeyframe, unit?: string) {\n return unit ? v + unit : v\n}\n\nfunction asNumber(v: AnyResolvedKeyframe) {\n return typeof v === \"number\" ? v : parseFloat(v)\n}\n","\"use client\"\n\nimport type { Transition } from \"motion-dom\"\nimport { TransformPoint } from \"motion-utils\"\nimport { createContext } from \"react\"\n\nexport type ReducedMotionConfig = \"always\" | \"never\" | \"user\"\n\n/**\n * @public\n */\nexport interface MotionConfigContext {\n /**\n * Internal, exported only for usage in Framer\n */\n transformPagePoint: TransformPoint\n\n /**\n * Internal. Determines whether this is a static context ie the Framer canvas. If so,\n * it'll disable all dynamic functionality.\n */\n isStatic: boolean\n\n /**\n * Defines a new default transition for the entire tree.\n *\n * @public\n */\n transition?: Transition\n\n /**\n * If true, will respect the device prefersReducedMotion setting by switching\n * transform animations off.\n *\n * @public\n */\n reducedMotion?: ReducedMotionConfig\n\n /**\n * A custom `nonce` attribute used when wanting to enforce a Content Security Policy (CSP).\n * For more details see:\n * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles\n *\n * @public\n */\n nonce?: string\n}\n\n/**\n * @public\n */\nexport const MotionConfigContext = createContext<MotionConfigContext>({\n transformPagePoint: (p) => p,\n isStatic: false,\n reducedMotion: \"never\",\n})\n","import { progress, velocityPerSecond } from \"motion-utils\"\nimport { AxisScrollInfo, ScrollInfo } from \"./types\"\n\n/**\n * A time in milliseconds, beyond which we consider the scroll velocity to be 0.\n */\nconst maxElapsed = 50\n\nconst createAxisInfo = (): AxisScrollInfo => ({\n current: 0,\n offset: [],\n progress: 0,\n scrollLength: 0,\n targetOffset: 0,\n targetLength: 0,\n containerLength: 0,\n velocity: 0,\n})\n\nexport const createScrollInfo = (): ScrollInfo => ({\n time: 0,\n x: createAxisInfo(),\n y: createAxisInfo(),\n})\n\nconst keys = {\n x: {\n length: \"Width\",\n position: \"Left\",\n },\n y: {\n length: \"Height\",\n position: \"Top\",\n },\n} as const\n\nfunction updateAxisInfo(\n element: Element,\n axisName: \"x\" | \"y\",\n info: ScrollInfo,\n time: number\n) {\n const axis = info[axisName]\n const { length, position } = keys[axisName]\n\n const prev = axis.current\n const prevTime = info.time\n\n axis.current = element[`scroll${position}`]\n axis.scrollLength = element[`scroll${length}`] - element[`client${length}`]\n\n axis.offset.length = 0\n axis.offset[0] = 0\n axis.offset[1] = axis.scrollLength\n axis.progress = progress(0, axis.scrollLength, axis.current)\n\n const elapsed = time - prevTime\n axis.velocity =\n elapsed > maxElapsed\n ? 0\n : velocityPerSecond(axis.current - prev, elapsed)\n}\n\nexport function updateScrollInfo(\n element: Element,\n info: ScrollInfo,\n time: number\n) {\n updateAxisInfo(element, \"x\", info, time)\n updateAxisInfo(element, \"y\", info, time)\n info.time = time\n}\n","import { isHTMLElement } from \"motion-dom\"\n\nexport function calcInset(element: Element, container: Element) {\n const inset = { x: 0, y: 0 }\n\n let current: Element | null = element\n while (current && current !== container) {\n if (isHTMLElement(current)) {\n inset.x += current.offsetLeft\n inset.y += current.offsetTop\n current = current.offsetParent\n } else if (current.tagName === \"svg\") {\n /**\n * This isn't an ideal approach to measuring the offset of <svg /> tags.\n * It would be preferable, given they behave like HTMLElements in most ways\n * to use offsetLeft/Top. But these don't exist on <svg />. Likewise we\n * can't use .getBBox() like most SVG elements as these provide the offset\n * relative to the SVG itself, which for <svg /> is usually 0x0.\n */\n const svgBoundingBox = current.getBoundingClientRect()\n current = current.parentElement!\n const parentBoundingBox = current.getBoundingClientRect()\n inset.x += svgBoundingBox.left - parentBoundingBox.left\n inset.y += svgBoundingBox.top - parentBoundingBox.top\n } else if (current instanceof SVGGraphicsElement) {\n const { x, y } = current.getBBox()\n inset.x += x\n inset.y += y\n\n let svg: SVGElement | null = null\n let parent: SVGElement = current.parentNode as SVGElement\n while (!svg) {\n if (parent.tagName === \"svg\") {\n svg = parent\n }\n parent = current.parentNode as SVGElement\n }\n current = svg\n } else {\n break\n }\n }\n\n return inset\n}\n","import { Edge, NamedEdges } from \"../types\"\n\nexport const namedEdges: Record<NamedEdges, number> = {\n start: 0,\n center: 0.5,\n end: 1,\n}\n\nexport function resolveEdge(edge: Edge, length: number, inset = 0) {\n let delta = 0\n\n /**\n * If we have this edge defined as a preset, replace the definition\n * with the numerical value.\n */\n if (edge in namedEdges) {\n edge = namedEdges[edge as NamedEdges]\n }\n\n /**\n * Handle unit values\n */\n if (typeof edge === \"string\") {\n const asNumber = parseFloat(edge)\n\n if (edge.endsWith(\"px\")) {\n delta = asNumber\n } else if (edge.endsWith(\"%\")) {\n edge = asNumber / 100\n } else if (edge.endsWith(\"vw\")) {\n delta = (asNumber / 100) * document.documentElement.clientWidth\n } else if (edge.endsWith(\"vh\")) {\n delta = (asNumber / 100) * document.documentElement.clientHeight\n } else {\n edge = asNumber\n }\n }\n\n /**\n * If the edge is defined as a number, handle as a progress value.\n */\n if (typeof edge === \"number\") {\n delta = length * edge\n }\n\n return inset + delta\n}\n","import { Edge, EdgeString, Intersection, ProgressIntersection } from \"../types\"\nimport { namedEdges, resolveEdge } from \"./edge\"\n\nconst defaultOffset: ProgressIntersection = [0, 0]\n\nexport function resolveOffset(\n offset: Edge | Intersection | ProgressIntersection,\n containerLength: number,\n targetLength: number,\n targetInset: number\n) {\n let offsetDefinition: ProgressIntersection | [EdgeString, EdgeString] =\n Array.isArray(offset) ? offset : defaultOffset\n\n let targetPoint = 0\n let containerPoint = 0\n\n if (typeof offset === \"number\") {\n /**\n * If we're provided offset: [0, 0.5, 1] then each number x should become\n * [x, x], so we default to the behaviour of mapping 0 => 0 of both target\n * and container etc.\n */\n offsetDefinition = [offset, offset]\n } else if (typeof offset === \"string\") {\n offset = offset.trim() as EdgeString\n\n if (offset.includes(\" \")) {\n offsetDefinition = offset.split(\" \") as [EdgeString, EdgeString]\n } else {\n /**\n * If we're provided a definition like \"100px\" then we want to apply\n * that only to the top of the target point, leaving the container at 0.\n * Whereas a named offset like \"end\" should be applied to both.\n */\n offsetDefinition = [offset, namedEdges[offset as keyof typeof namedEdges] ? offset : `0`]\n }\n }\n\n targetPoint = resolveEdge(offsetDefinition[0], targetLength, targetInset)\n containerPoint = resolveEdge(offsetDefinition[1], containerLength)\n\n return targetPoint - containerPoint\n}\n","import { ProgressIntersection } from \"../types\"\n\nexport const ScrollOffset: Record<string, ProgressIntersection[]> = {\n Enter: [\n [0, 1],\n [1, 1],\n ],\n Exit: [\n [0, 0],\n [1, 0],\n ],\n Any: [\n [1, 0],\n [0, 1],\n ],\n All: [\n [0, 0],\n [1, 1],\n ],\n}\n","import { defaultOffset, interpolate } from \"motion-dom\"\nimport { clamp } from \"motion-utils\"\nimport { ScrollInfo, ScrollInfoOptions } from \"../types\"\nimport { calcInset } from \"./inset\"\nimport { resolveOffset } from \"./offset\"\nimport { ScrollOffset } from \"./presets\"\n\nconst point = { x: 0, y: 0 }\n\nfunction getTargetSize(target: Element) {\n return \"getBBox\" in target && target.tagName !== \"svg\"\n ? (target as SVGGraphicsElement).getBBox()\n : { width: target.clientWidth, height: target.clientHeight }\n}\n\nexport function resolveOffsets(\n container: Element,\n info: ScrollInfo,\n options: ScrollInfoOptions\n) {\n const { offset: offsetDefinition = ScrollOffset.All } = options\n const { target = container, axis = \"y\" } = options\n const lengthLabel = axis === \"y\" ? \"height\" : \"width\"\n\n const inset = target !== container ? calcInset(target, container) : point\n\n /**\n * Measure the target and container. If they're the same thing then we\n * use the container's scrollWidth/Height as the target, from there\n * all other calculations can remain the same.\n */\n const targetSize =\n target === container\n ? { width: container.scrollWidth, height: container.scrollHeight }\n : getTargetSize(target)\n\n const containerSize = {\n width: container.clientWidth,\n height: container.clientHeight,\n }\n\n /**\n * Reset the length of the resolved offset array rather than creating a new one.\n * TODO: More reusable data structures for targetSize/containerSize would also be good.\n */\n info[axis].offset.length = 0\n\n /**\n * Populate the offset array by resolving the user's offset definition into\n * a list of pixel scroll offets.\n */\n let hasChanged = !info[axis].interpolate\n\n const numOffsets = offsetDefinition.length\n for (let i = 0; i < numOffsets; i++) {\n const offset = resolveOffset(\n offsetDefinition[i],\n containerSize[lengthLabel],\n targetSize[lengthLabel],\n inset[axis]\n )\n\n if (!hasChanged && offset !== info[axis].interpolatorOffsets![i]) {\n hasChanged = true\n }\n\n info[axis].offset[i] = offset\n }\n\n /**\n * If the pixel scroll offsets have changed, create a new interpolator function\n * to map scroll value into a progress.\n */\n if (hasChanged) {\n info[axis].interpolate = interpolate(\n info[axis].offset,\n defaultOffset(offsetDefinition),\n { clamp: false }\n )\n\n info[axis].interpolatorOffsets = [...info[axis].offset]\n }\n\n info[axis].progress = clamp(\n 0,\n 1,\n info[axis].interpolate!(info[axis].current)\n )\n}\n","import { warnOnce } from \"motion-utils\"\nimport { updateScrollInfo } from \"./info\"\nimport { resolveOffsets } from \"./offsets/index\"\nimport {\n OnScrollHandler,\n OnScrollInfo,\n ScrollInfo,\n ScrollInfoOptions,\n} from \"./types\"\n\nfunction measure(\n container: Element,\n target: Element = container,\n info: ScrollInfo\n) {\n /**\n * Find inset of target within scrollable container\n */\n info.x.targetOffset = 0\n info.y.targetOffset = 0\n if (target !== container) {\n let node = target as HTMLElement\n while (node && node !== container) {\n info.x.targetOffset += node.offsetLeft\n info.y.targetOffset += node.offsetTop\n node = node.offsetParent as HTMLElement\n }\n }\n\n info.x.targetLength =\n target === container ? target.scrollWidth : target.clientWidth\n info.y.targetLength =\n target === container ? target.scrollHeight : target.clientHeight\n info.x.containerLength = container.clientWidth\n info.y.containerLength = container.clientHeight\n\n /**\n * In development mode ensure scroll containers aren't position: static as this makes\n * it difficult to measure their relative positions.\n */\n if (process.env.NODE_ENV !== \"production\") {\n if (container && target && target !== container) {\n warnOnce(\n getComputedStyle(container).position !== \"static\",\n \"Please ensure that the container has a non-static position, like 'relative', 'fixed', or 'absolute' to ensure scroll offset is calculated correctly.\"\n )\n }\n }\n}\n\nexport function createOnScrollHandler(\n element: Element,\n onScroll: OnScrollInfo,\n info: ScrollInfo,\n options: ScrollInfoOptions = {}\n): OnScrollHandler {\n return {\n measure: (time) => {\n measure(element, options.target, info)\n updateScrollInfo(element, info, time)\n\n if (options.offset || options.target) {\n resolveOffsets(element, info, options)\n }\n },\n notify: () => onScroll(info),\n }\n}\n","import { cancelFrame, frame, frameData, resize, Process } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { createScrollInfo } from \"./info\"\nimport { createOnScrollHandler } from \"./on-scroll-handler\"\nimport { OnScrollHandler, OnScrollInfo, ScrollInfoOptions } from \"./types\"\n\nconst scrollListeners = new WeakMap<Element, VoidFunction>()\nconst resizeListeners = new WeakMap<Element, VoidFunction>()\nconst onScrollHandlers = new WeakMap<Element, Set<OnScrollHandler>>()\nconst scrollSize = new WeakMap<Element, { width: number; height: number }>()\nconst dimensionCheckProcesses = new WeakMap<Element, Process>()\n\nexport type ScrollTargets = Array<HTMLElement>\n\nconst getEventTarget = (element: Element) =>\n element === document.scrollingElement ? window : element\n\nexport function scrollInfo(\n onScroll: OnScrollInfo,\n {\n container = document.scrollingElement as Element,\n trackContentSize = false,\n ...options\n }: ScrollInfoOptions = {}\n) {\n if (!container) return noop as VoidFunction\n\n let containerHandlers = onScrollHandlers.get(container)\n\n /**\n * Get the onScroll handlers for this container.\n * If one isn't found, create a new one.\n */\n if (!containerHandlers) {\n containerHandlers = new Set()\n onScrollHandlers.set(container, containerHandlers)\n }\n\n /**\n * Create a new onScroll handler for the provided callback.\n */\n const info = createScrollInfo()\n const containerHandler = createOnScrollHandler(\n container,\n onScroll,\n info,\n options\n )\n containerHandlers.add(containerHandler)\n\n /**\n * Check if there's a scroll event listener for this container.\n * If not, create one.\n */\n if (!scrollListeners.has(container)) {\n const measureAll = () => {\n for (const handler of containerHandlers) {\n handler.measure(frameData.timestamp)\n }\n\n frame.preUpdate(notifyAll)\n }\n\n const notifyAll = () => {\n for (const handler of containerHandlers) {\n handler.notify()\n }\n }\n\n const listener = () => frame.read(measureAll)\n\n scrollListeners.set(container, listener)\n\n const target = getEventTarget(container)\n window.addEventListener(\"resize\", listener, { passive: true })\n if (container !== document.documentElement) {\n resizeListeners.set(container, resize(container, listener))\n }\n\n target.addEventListener(\"scroll\", listener, { passive: true })\n\n listener()\n }\n\n /**\n * Enable content size tracking if requested and not already enabled.\n */\n if (trackContentSize && !dimensionCheckProcesses.has(container)) {\n const listener = scrollListeners.get(container)!\n\n // Store initial scroll dimensions (object is reused to avoid allocation)\n const size = {\n width: container.scrollWidth,\n height: container.scrollHeight,\n }\n scrollSize.set(container, size)\n\n // Add frame-based scroll dimension checking to detect content changes\n const checkScrollDimensions: Process = () => {\n const newWidth = container.scrollWidth\n const newHeight = container.scrollHeight\n\n if (size.width !== newWidth || size.height !== newHeight) {\n listener()\n size.width = newWidth\n size.height = newHeight\n }\n }\n\n // Schedule with keepAlive=true to run every frame\n const dimensionCheckProcess = frame.read(checkScrollDimensions, true)\n dimensionCheckProcesses.set(container, dimensionCheckProcess)\n }\n\n const listener = scrollListeners.get(container)!\n frame.read(listener, false, true)\n\n return () => {\n cancelFrame(listener)\n\n /**\n * Check if we even have any handlers for this container.\n */\n const currentHandlers = onScrollHandlers.get(container)\n if (!currentHandlers) return\n\n currentHandlers.delete(containerHandler)\n\n if (currentHandlers.size) return\n\n /**\n * If no more handlers, remove the scroll listener too.\n */\n const scrollListener = scrollListeners.get(container)\n scrollListeners.delete(container)\n\n if (scrollListener) {\n getEventTarget(container).removeEventListener(\n \"scroll\",\n scrollListener\n )\n resizeListeners.get(container)?.()\n window.removeEventListener(\"resize\", scrollListener)\n }\n\n // Clean up scroll dimension checking\n const dimensionCheckProcess = dimensionCheckProcesses.get(container)\n if (dimensionCheckProcess) {\n cancelFrame(dimensionCheckProcess)\n dimensionCheckProcesses.delete(container)\n }\n scrollSize.delete(container)\n }\n}\n","import { ProgressTimeline, supportsScrollTimeline } from \"motion-dom\"\nimport { scrollInfo } from \"../track\"\nimport { ScrollOptionsWithDefaults } from \"../types\"\n\ndeclare global {\n interface Window {\n ScrollTimeline: ScrollTimeline\n }\n}\n\ndeclare class ScrollTimeline implements ProgressTimeline {\n constructor(options: ScrollOptions)\n\n currentTime: null | { value: number }\n\n cancel?: VoidFunction\n}\n\nconst timelineCache = new Map<\n Element,\n Map<Element | \"self\", { x?: ProgressTimeline; y?: ProgressTimeline }>\n>()\n\nfunction scrollTimelineFallback(options: ScrollOptionsWithDefaults) {\n const currentTime = { value: 0 }\n\n const cancel = scrollInfo((info) => {\n currentTime.value = info[options.axis!].progress * 100\n }, options)\n\n return { currentTime, cancel }\n}\n\nexport function getTimeline({\n source,\n container,\n ...options\n}: ScrollOptionsWithDefaults): ProgressTimeline {\n const { axis } = options\n\n if (source) container = source\n\n const containerCache = timelineCache.get(container) ?? new Map()\n timelineCache.set(container, containerCache)\n\n const targetKey = options.target ?? \"self\"\n const targetCache = containerCache.get(targetKey) ?? {}\n\n const axisKey = axis + (options.offset ?? []).join(\",\")\n\n if (!targetCache[axisKey]) {\n targetCache[axisKey] =\n !options.target && supportsScrollTimeline()\n ? new ScrollTimeline({ source: container, axis } as any)\n : scrollTimelineFallback({ container, ...options })\n }\n\n return targetCache[axisKey]!\n}\n","import { AnimationPlaybackControls, observeTimeline } from \"motion-dom\"\nimport { ScrollOptionsWithDefaults } from \"./types\"\nimport { getTimeline } from \"./utils/get-timeline\"\n\nexport function attachToAnimation(\n animation: AnimationPlaybackControls,\n options: ScrollOptionsWithDefaults\n) {\n const timeline = getTimeline(options)\n\n return animation.attachTimeline({\n timeline: options.target ? undefined : timeline,\n observe: (valueAnimation) => {\n valueAnimation.pause()\n\n return observeTimeline((progress) => {\n valueAnimation.time =\n valueAnimation.iterationDuration * progress\n }, timeline)\n },\n })\n}\n","import { observeTimeline } from \"motion-dom\"\nimport { scrollInfo } from \"./track\"\nimport { OnScroll, OnScrollWithInfo, ScrollOptionsWithDefaults } from \"./types\"\nimport { getTimeline } from \"./utils/get-timeline\"\n\n/**\n * If the onScroll function has two arguments, it's expecting\n * more specific information about the scroll from scrollInfo.\n */\nfunction isOnScrollWithInfo(onScroll: OnScroll): onScroll is OnScrollWithInfo {\n return onScroll.length === 2\n}\n\nexport function attachToFunction(\n onScroll: OnScroll,\n options: ScrollOptionsWithDefaults\n) {\n if (isOnScrollWithInfo(onScroll)) {\n return scrollInfo((info) => {\n onScroll(info[options.axis!].progress, info)\n }, options)\n } else {\n return observeTimeline(onScroll, getTimeline(options))\n }\n}\n","import { AnimationPlaybackControls } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { attachToAnimation } from \"./attach-animation\"\nimport { attachToFunction } from \"./attach-function\"\nimport { OnScroll, ScrollOptions } from \"./types\"\n\nexport function scroll(\n onScroll: OnScroll | AnimationPlaybackControls,\n {\n axis = \"y\",\n container = document.scrollingElement as Element,\n ...options\n }: ScrollOptions = {}\n): VoidFunction {\n if (!container) return noop as VoidFunction\n\n const optionsWithDefaults = { axis, container, ...options }\n\n return typeof onScroll === \"function\"\n ? attachToFunction(onScroll, optionsWithDefaults)\n : attachToAnimation(onScroll, optionsWithDefaults)\n}\n","\"use client\"\n\nimport { motionValue } from \"motion-dom\"\nimport { invariant } from \"motion-utils\"\nimport { RefObject, useCallback, useEffect, useRef } from \"react\"\nimport { scroll } from \"../render/dom/scroll\"\nimport { ScrollInfoOptions } from \"../render/dom/scroll/types\"\nimport { useConstant } from \"../utils/use-constant\"\nimport { useIsomorphicLayoutEffect } from \"../utils/use-isomorphic-effect\"\n\nexport interface UseScrollOptions\n extends Omit<ScrollInfoOptions, \"container\" | \"target\"> {\n container?: RefObject<HTMLElement | null>\n target?: RefObject<HTMLElement | null>\n}\n\nconst createScrollMotionValues = () => ({\n scrollX: motionValue(0),\n scrollY: motionValue(0),\n scrollXProgress: motionValue(0),\n scrollYProgress: motionValue(0),\n})\n\nconst isRefPending = (ref?: RefObject<HTMLElement | null>) => {\n if (!ref) return false\n return !ref.current\n}\n\nexport function useScroll({\n container,\n target,\n ...options\n}: UseScrollOptions = {}) {\n const values = useConstant(createScrollMotionValues)\n const scrollAnimation = useRef<VoidFunction | null>(null)\n const needsStart = useRef(false)\n\n const start = useCallback(() => {\n scrollAnimation.current = scroll(\n (\n _progress: number,\n {\n x,\n y,\n }: {\n x: { current: number; progress: number }\n y: { current: number; progress: number }\n }\n ) => {\n values.scrollX.set(x.current)\n values.scrollXProgress.set(x.progress)\n values.scrollY.set(y.current)\n values.scrollYProgress.set(y.progress)\n },\n {\n ...options,\n container: container?.current || undefined,\n target: target?.current || undefined,\n }\n )\n\n return () => {\n scrollAnimation.current?.()\n }\n }, [container, target, JSON.stringify(options.offset)])\n\n useIsomorphicLayoutEffect(() => {\n needsStart.current = false\n\n if (isRefPending(container) || isRefPending(target)) {\n needsStart.current = true\n return\n } else {\n return start()\n }\n }, [start])\n\n useEffect(() => {\n if (needsStart.current) {\n invariant(\n !isRefPending(container),\n \"Container ref is defined but not hydrated\",\n \"use-scroll-ref\"\n )\n invariant(\n !isRefPending(target),\n \"Target ref is defined but not hydrated\",\n \"use-scroll-ref\"\n )\n return start()\n } else {\n return\n }\n }, [start])\n\n return values\n}\n","\"use client\"\n\nimport { motionValue, MotionValue } from \"motion-dom\"\nimport { useContext, useEffect, useState } from \"react\"\nimport { MotionConfigContext } from \"../context/MotionConfigContext\"\nimport { useConstant } from \"../utils/use-constant\"\n\n/**\n * Creates a `MotionValue` to track the state and velocity of a value.\n *\n * Usually, these are created automatically. For advanced use-cases, like use with `useTransform`, you can create `MotionValue`s externally and pass them into the animated component via the `style` prop.\n *\n * ```jsx\n * export const MyComponent = () => {\n * const scale = useMotionValue(1)\n *\n * return <motion.div style={{ scale }} />\n * }\n * ```\n *\n * @param initial - The initial state.\n *\n * @public\n */\nexport function useMotionValue<T>(initial: T): MotionValue<T> {\n const value = useConstant(() => motionValue(initial))\n\n /**\n * If this motion value is being used in static mode, like on\n * the Framer canvas, force components to rerender when the motion\n * value is updated.\n */\n const { isStatic } = useContext(MotionConfigContext)\n if (isStatic) {\n const [, setLatest] = useState(initial)\n useEffect(() => value.on(\"change\", setLatest), [])\n }\n\n return value\n}\n","\"use client\"\n\nimport { cancelFrame, frame, MotionValue } from \"motion-dom\"\nimport { useIsomorphicLayoutEffect } from \"../utils/use-isomorphic-effect\"\nimport { useMotionValue } from \"./use-motion-value\"\n\nexport function useCombineMotionValues<R>(\n values: MotionValue[],\n combineValues: () => R\n) {\n /**\n * Initialise the returned motion value. This remains the same between renders.\n */\n const value = useMotionValue(combineValues())\n\n /**\n * Create a function that will update the template motion value with the latest values.\n * This is pre-bound so whenever a motion value updates it can schedule its\n * execution in Framesync. If it's already been scheduled it won't be fired twice\n * in a single frame.\n */\n const updateValue = () => value.set(combineValues())\n\n /**\n * Synchronously update the motion value with the latest values during the render.\n * This ensures that within a React render, the styles applied to the DOM are up-to-date.\n */\n updateValue()\n\n /**\n * Subscribe to all motion values found within the template. Whenever any of them change,\n * schedule an update.\n */\n useIsomorphicLayoutEffect(() => {\n const scheduleUpdate = () => frame.preRender(updateValue, false, true)\n const subscriptions = values.map((v) => v.on(\"change\", scheduleUpdate))\n\n return () => {\n subscriptions.forEach((unsubscribe) => unsubscribe())\n cancelFrame(updateValue)\n }\n })\n\n return value\n}\n","\"use client\"\n\nimport { collectMotionValues, type MotionValue } from \"motion-dom\"\nimport { useCombineMotionValues } from \"./use-combine-values\"\n\nexport function useComputed<O>(compute: () => O): MotionValue<O> {\n /**\n * Open session of collectMotionValues. Any MotionValue that calls get()\n * will be saved into this array.\n */\n collectMotionValues.current = []\n\n compute()\n\n const value = useCombineMotionValues(collectMotionValues.current, compute)\n\n /**\n * Synchronously close session of collectMotionValues.\n */\n collectMotionValues.current = undefined\n\n return value\n}\n","\"use client\"\n\nimport {\n AnyResolvedKeyframe,\n MotionValue,\n transform,\n TransformOptions,\n} from \"motion-dom\"\nimport { useConstant } from \"../utils/use-constant\"\nimport { useCombineMotionValues } from \"./use-combine-values\"\nimport { useComputed } from \"./use-computed\"\n\nexport type InputRange = number[]\ntype SingleTransformer<I, O> = (input: I) => O\ntype MultiTransformer<I, O> = (input: I[]) => O\ntype Transformer<I, O> =\n | SingleTransformer<I, O>\n /**\n * Ideally, this would be typed <I, O> in all instances, but to type this\n * more accurately requires the tuple support in TypeScript 4:\n * https://gist.github.com/InventingWithMonster/c4d23752a0fae7888596c4ff6d92733a\n */\n | MultiTransformer<AnyResolvedKeyframe, O>\n\ninterface OutputMap<O> {\n [key: string]: O[]\n}\n\n/**\n * Create multiple `MotionValue`s that transform the output of another `MotionValue` by mapping it from one range of values into multiple output ranges.\n *\n * @remarks\n *\n * This is useful when you want to derive multiple values from a single input value.\n * The keys of the output map must remain constant across renders.\n *\n * ```jsx\n * export const MyComponent = () => {\n * const x = useMotionValue(0)\n * const { opacity, scale } = useTransform(x, [0, 100], {\n * opacity: [0, 1],\n * scale: [0.5, 1]\n * })\n *\n * return (\n * <motion.div style={{ opacity, scale, x }} />\n * )\n * }\n * ```\n *\n * @param inputValue - `MotionValue`\n * @param inputRange - A linear series of numbers (either all increasing or decreasing)\n * @param outputMap - An object where keys map to output ranges. Each output range must be the same length as `inputRange`.\n * @param options - Transform options applied to all outputs\n *\n * @returns An object with the same keys as `outputMap`, where each value is a `MotionValue`\n *\n * @public\n */\nexport function useTransform<T extends Record<string, any[]>>(\n inputValue: MotionValue<number>,\n inputRange: InputRange,\n outputMap: T,\n options?: TransformOptions<T[keyof T][number]>\n): { [K in keyof T]: MotionValue<T[K][number]> }\n\n/**\n * Create a `MotionValue` that transforms the output of another `MotionValue` by mapping it from one range of values into another.\n *\n * @remarks\n *\n * Given an input range of `[-200, -100, 100, 200]` and an output range of\n * `[0, 1, 1, 0]`, the returned `MotionValue` will:\n *\n * - When provided a value between `-200` and `-100`, will return a value between `0` and `1`.\n * - When provided a value between `-100` and `100`, will return `1`.\n * - When provided a value between `100` and `200`, will return a value between `1` and `0`\n *\n *\n * The input range must be a linear series of numbers. The output range\n * can be any value type supported by Motion: numbers, colors, shadows, etc.\n *\n * Every value in the output range must be of the same type and in the same format.\n *\n * ```jsx\n * export const MyComponent = () => {\n * const x = useMotionValue(0)\n * const xRange = [-200, -100, 100, 200]\n * const opacityRange = [0, 1, 1, 0]\n * const opacity = useTransform(x, xRange, opacityRange)\n *\n * return (\n * <motion.div\n * animate={{ x: 200 }}\n * style={{ opacity, x }}\n * />\n * )\n * }\n * ```\n *\n * @param inputValue - `MotionValue`\n * @param inputRange - A linear series of numbers (either all increasing or decreasing)\n * @param outputRange - A series of numbers, colors or strings. Must be the same length as `inputRange`.\n * @param options -\n *\n * - clamp: boolean. Clamp values to within the given range. Defaults to `true`\n * - ease: EasingFunction[]. Easing functions to use on the interpolations between each value in the input and output ranges. If provided as an array, the array must be one item shorter than the input and output ranges, as the easings apply to the transition between each.\n *\n * @returns `MotionValue`\n *\n * @public\n */\nexport function useTransform<I, O>(\n value: MotionValue<number>,\n inputRange: InputRange,\n outputRange: O[],\n options?: TransformOptions<O>\n): MotionValue<O>\n\n/**\n * Create a `MotionValue` that transforms the output of another `MotionValue` through a function.\n * In this example, `y` will always be double `x`.\n *\n * ```jsx\n * export const MyComponent = () => {\n * const x = useMotionValue(10)\n * const y = useTransform(x, value => value * 2)\n *\n * return <motion.div style={{ x, y }} />\n * }\n * ```\n *\n * @param input - A `MotionValue` that will pass its latest value through `transform` to update the returned `MotionValue`.\n * @param transform - A function that accepts the latest value from `input` and returns a new value.\n * @returns `MotionValue`\n *\n * @public\n */\nexport function useTransform<I, O>(\n input: MotionValue<I>,\n transformer: SingleTransformer<I, O>\n): MotionValue<O>\n\n/**\n * Pass an array of `MotionValue`s and a function to combine them. In this example, `z` will be the `x` multiplied by `y`.\n *\n * ```jsx\n * export const MyComponent = () => {\n * const x = useMotionValue(0)\n * const y = useMotionValue(0)\n * const z = useTransform([x, y], ([latestX, latestY]) => latestX * latestY)\n *\n * return <motion.div style={{ x, y, z }} />\n * }\n * ```\n *\n * @param input - An array of `MotionValue`s that will pass their latest values through `transform` to update the returned `MotionValue`.\n * @param transform - A function that accepts the latest values from `input` and returns a new value.\n * @returns `MotionValue`\n *\n * @public\n */\nexport function useTransform<I, O>(\n input:\n | MotionValue<string>[]\n | MotionValue<number>[]\n | MotionValue<AnyResolvedKeyframe>[],\n transformer: MultiTransformer<I, O>\n): MotionValue<O>\nexport function useTransform<I, O>(transformer: () => O): MotionValue<O>\n\nexport function useTransform<I, O, K extends string>(\n input:\n | MotionValue<I>\n | MotionValue<string>[]\n | MotionValue<number>[]\n | MotionValue<AnyResolvedKeyframe>[]\n | (() => O),\n inputRangeOrTransformer?: InputRange | Transformer<I, O>,\n outputRangeOrMap?: O[] | OutputMap<O>,\n options?: TransformOptions<O>\n): MotionValue<O> | { [key in K]: MotionValue<O> } {\n if (typeof input === \"function\") {\n return useComputed(input)\n }\n\n /**\n * Detect if outputRangeOrMap is an output map (object with keys)\n * rather than an output range (array).\n */\n const isOutputMap =\n outputRangeOrMap !== undefined &&\n !Array.isArray(outputRangeOrMap) &&\n typeof inputRangeOrTransformer !== \"function\"\n\n if (isOutputMap) {\n return useMapTransform(\n input as MotionValue<number>,\n inputRangeOrTransformer as InputRange,\n outputRangeOrMap as OutputMap<O>,\n options\n ) as { [key in K]: MotionValue<O> }\n }\n\n const outputRange = outputRangeOrMap as O[] | undefined\n const transformer =\n typeof inputRangeOrTransformer === \"function\"\n ? inputRangeOrTransformer\n : transform(inputRangeOrTransformer!, outputRange!, options)\n\n return Array.isArray(input)\n ? useListTransform(\n input,\n transformer as MultiTransformer<AnyResolvedKeyframe, O>\n )\n : useListTransform([input], ([latest]) =>\n (transformer as SingleTransformer<I, O>)(latest)\n )\n}\n\nfunction useListTransform<I, O>(\n values: MotionValue<I>[],\n transformer: MultiTransformer<I, O>\n): MotionValue<O> {\n const latest = useConstant<I[]>(() => [])\n\n return useCombineMotionValues(values, () => {\n latest.length = 0\n const numValues = values.length\n for (let i = 0; i < numValues; i++) {\n latest[i] = values[i].get()\n }\n\n return transformer(latest)\n })\n}\n\nfunction useMapTransform<O>(\n inputValue: MotionValue<number>,\n inputRange: InputRange,\n outputMap: OutputMap<O>,\n options?: TransformOptions<O>\n): { [key: string]: MotionValue<O> } {\n /**\n * Capture keys once to ensure hooks are called in consistent order.\n */\n const keys = useConstant(() => Object.keys(outputMap))\n const output = useConstant<{ [key: string]: MotionValue<O> }>(() => ({}))\n\n for (const key of keys) {\n output[key] = useTransform(inputValue, inputRange, outputMap[key], options)\n }\n\n return output\n}\n","\"use client\"\n\nimport {\n AnyResolvedKeyframe,\n attachFollow,\n FollowValueOptions,\n isMotionValue,\n MotionValue,\n} from \"motion-dom\"\nimport { useContext, useInsertionEffect } from \"react\"\nimport { MotionConfigContext } from \"../context/MotionConfigContext\"\nimport { useMotionValue } from \"./use-motion-value\"\nimport { useTransform } from \"./use-transform\"\n\n/**\n * Creates a `MotionValue` that, when `set`, will use the specified animation transition to animate to its new state.\n *\n * Unlike `useSpring` which is limited to spring animations, `useFollowValue` accepts any motion transition\n * including spring, tween, inertia, and keyframes.\n *\n * It can either work as a stand-alone `MotionValue` by initialising it with a value, or as a subscriber\n * to another `MotionValue`.\n *\n * @remarks\n *\n * ```jsx\n * // Spring animation (default)\n * const x = useFollowValue(0, { stiffness: 300 })\n *\n * // Tween animation\n * const y = useFollowValue(0, { type: \"tween\", duration: 0.5, ease: \"easeOut\" })\n *\n * // Track another MotionValue with spring\n * const source = useMotionValue(0)\n * const z = useFollowValue(source, { type: \"spring\", damping: 10 })\n *\n * // Inertia animation\n * const w = useFollowValue(0, { type: \"inertia\", velocity: 100 })\n * ```\n *\n * @param inputValue - `MotionValue` or number. If provided a `MotionValue`, when the input `MotionValue` changes, the created `MotionValue` will animate towards that value using the specified transition.\n * @param options - Animation transition options. Supports all transition types: spring, tween, inertia, keyframes.\n * @returns `MotionValue`\n *\n * @public\n */\nexport function useFollowValue(\n source: MotionValue<string>,\n options?: FollowValueOptions\n): MotionValue<string>\nexport function useFollowValue(\n source: string,\n options?: FollowValueOptions\n): MotionValue<string>\nexport function useFollowValue(\n source: MotionValue<number>,\n options?: FollowValueOptions\n): MotionValue<number>\nexport function useFollowValue(\n source: number,\n options?: FollowValueOptions\n): MotionValue<number>\nexport function useFollowValue(\n source: MotionValue<string> | MotionValue<number> | AnyResolvedKeyframe,\n options: FollowValueOptions = {}\n) {\n const { isStatic } = useContext(MotionConfigContext)\n const getFromSource = () => (isMotionValue(source) ? source.get() : source)\n\n // isStatic will never change, allowing early hooks return\n if (isStatic) {\n return useTransform(getFromSource)\n }\n\n const value = useMotionValue(getFromSource())\n\n useInsertionEffect(() => {\n return attachFollow(value, source, options)\n }, [value, JSON.stringify(options)])\n\n return value\n}\n","\"use client\"\n\nimport { MotionValue, SpringOptions } from \"motion-dom\"\nimport { useFollowValue } from \"./use-follow-value\"\n\n/**\n * Creates a `MotionValue` that, when `set`, will use a spring animation to animate to its new state.\n *\n * It can either work as a stand-alone `MotionValue` by initialising it with a value, or as a subscriber\n * to another `MotionValue`.\n *\n * @remarks\n *\n * ```jsx\n * const x = useSpring(0, { stiffness: 300 })\n * const y = useSpring(x, { damping: 10 })\n * ```\n *\n * @param inputValue - `MotionValue` or number. If provided a `MotionValue`, when the input `MotionValue` changes, the created `MotionValue` will spring towards that value.\n * @param springConfig - Configuration options for the spring.\n * @returns `MotionValue`\n *\n * @public\n */\nexport function useSpring(\n source: MotionValue<string>,\n options?: SpringOptions\n): MotionValue<string>\nexport function useSpring(\n source: string,\n options?: SpringOptions\n): MotionValue<string>\nexport function useSpring(\n source: MotionValue<number>,\n options?: SpringOptions\n): MotionValue<number>\nexport function useSpring(\n source: number,\n options?: SpringOptions\n): MotionValue<number>\nexport function useSpring(\n source: MotionValue<string> | MotionValue<number> | string | number,\n options: SpringOptions = {}\n): MotionValue<string> | MotionValue<number> {\n return useFollowValue(source as any, { type: \"spring\", ...options })\n}\n","import {\n animateVisualElement,\n setTarget,\n type AnimationDefinition,\n type LegacyAnimationControls,\n type VisualElement,\n} from \"motion-dom\"\nimport { invariant } from \"motion-utils\"\n\nfunction stopAnimation(visualElement: VisualElement) {\n visualElement.values.forEach((value) => value.stop())\n}\n\nfunction setVariants(visualElement: VisualElement, variantLabels: string[]) {\n const reversedLabels = [...variantLabels].reverse()\n\n reversedLabels.forEach((key) => {\n const variant = visualElement.getVariant(key)\n variant && setTarget(visualElement, variant)\n\n if (visualElement.variantChildren) {\n visualElement.variantChildren.forEach((child) => {\n setVariants(child, variantLabels)\n })\n }\n })\n}\n\nexport function setValues(\n visualElement: VisualElement,\n definition: AnimationDefinition\n) {\n if (Array.isArray(definition)) {\n return setVariants(visualElement, definition)\n } else if (typeof definition === \"string\") {\n return setVariants(visualElement, [definition])\n } else {\n setTarget(visualElement, definition as any)\n }\n}\n\n/**\n * @public\n */\nexport function animationControls(): LegacyAnimationControls {\n /**\n * Track whether the host component has mounted.\n */\n let hasMounted = false\n\n /**\n * A collection of linked component animation controls.\n */\n const subscribers = new Set<VisualElement>()\n\n const controls: LegacyAnimationControls = {\n subscribe(visualElement) {\n subscribers.add(visualElement)\n return () => void subscribers.delete(visualElement)\n },\n\n start(definition, transitionOverride) {\n invariant(\n hasMounted,\n \"controls.start() should only be called after a component has mounted. Consider calling within a useEffect hook.\"\n )\n\n const animations: Array<Promise<any>> = []\n subscribers.forEach((visualElement) => {\n animations.push(\n animateVisualElement(visualElement, definition, {\n transitionOverride,\n })\n )\n })\n\n return Promise.all(animations)\n },\n\n set(definition) {\n invariant(\n hasMounted,\n \"controls.set() should only be called after a component has mounted. Consider calling within a useEffect hook.\"\n )\n\n return subscribers.forEach((visualElement) => {\n setValues(visualElement, definition)\n })\n },\n\n stop() {\n subscribers.forEach((visualElement) => {\n stopAnimation(visualElement)\n })\n },\n\n mount() {\n hasMounted = true\n\n return () => {\n hasMounted = false\n controls.stop()\n }\n },\n }\n\n return controls\n}\n","\"use client\"\n\nimport { LegacyAnimationControls } from \"motion-dom\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport { useIsomorphicLayoutEffect } from \"../../utils/use-isomorphic-effect\"\nimport { animationControls } from \"./animation-controls\"\n\n/**\n * Creates `LegacyAnimationControls`, which can be used to manually start, stop\n * and sequence animations on one or more components.\n *\n * The returned `LegacyAnimationControls` should be passed to the `animate` property\n * of the components you want to animate.\n *\n * These components can then be animated with the `start` method.\n *\n * ```jsx\n * import * as React from 'react'\n * import { motion, useAnimation } from 'framer-motion'\n *\n * export function MyComponent(props) {\n * const controls = useAnimation()\n *\n * controls.start({\n * x: 100,\n * transition: { duration: 0.5 },\n * })\n *\n * return <motion.div animate={controls} />\n * }\n * ```\n *\n * @returns Animation controller with `start` and `stop` methods\n *\n * @public\n */\nexport function useAnimationControls(): LegacyAnimationControls {\n const controls = useConstant(animationControls)\n\n useIsomorphicLayoutEffect(controls.mount, [])\n\n return controls\n}\n\nexport const useAnimation = useAnimationControls\n","export { useAnimation, useMotionValue, useSpring, useTransform } from 'framer-motion';\r\n\r\n// Potential custom hook: useScrollProgress\r\nimport { useScroll } from 'framer-motion';\r\n\r\nexport function useScrollProgress() {\r\n const { scrollYProgress } = useScroll();\r\n return scrollYProgress;\r\n}\r\n"],"mappings":";;AAaM,SAAA,YAAA,MAAA;AACF,QAAA,MAAA,OAAA,IAAA;AAEA,MAAA,IAAA,YAAA,MAAA;AACI,QAAA,UAAA,KAAA;;;AAIR;A;;;;;ICrBa,YAAY,OAAO,WAAW;;;ACKpC,IAAA,4BAAA,YAAA,kBAAA;;;ACLS,SAAA,cAAiB,KAAU,MAAO;AAC9C,MAAI,IAAI,QAAQ,IAAI,MAAM;AAAI,QAAI,KAAK,IAAI;AAC/C;AAEgB,SAAA,WAAc,KAAU,MAAO;AAC3C,QAAM,QAAQ,IAAI,QAAQ,IAAI;AAC9B,MAAI,QAAQ;AAAI,QAAI,OAAO,OAAO,CAAC;AACvC;;;ACPa,IAAA,QAAQ,CAAC,KAAa,KAAa,MAAa;AACzD,MAAI,IAAI;AAAK,WAAO;AACpB,MAAI,IAAI;AAAK,WAAO;AACpB,SAAO;AACX;;;ACJgB,SAAA,mBAAmB,SAAiB,WAAkB;AAClE,SAAO,YACD,GAAG,OAAO,0FAA0F,SAAS,KAC7G;AACV;;;ACIA,IAAI,UAAsB,MAAK;AAAA;AAC/B,IAAI,YAAwB,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AU,GAAG;AAC3B,WAAO,YAAY,eAAe,UAAU;aACrC,OAAO,eAAe,UAAU;AACvC,WAAO,YAAY,eAAe,CAAC,UAAU,CAAC;SAC3C;AACH,cAAU,eAAe,UAAiB;;AAElD;SAKgB,oBAAiB;AAI7B,MAAI,aAAa;AAKjB,QAAM,cAAc,oBAAI,IAAG;AAE3B,QAAM,WAAoC;IACtC,UAAU,eAAa;AACnB,kBAAY,IAAI,aAAa;AAC7B,aAAO,MAAM,KAAK,YAAY,OAAO,aAAa;;IAGtD,MAAM,YAAY,oBAAkB;AAChC,gBACI,YACA,iHAAiH;AAGrH,YAAM,aAAkC,CAAA;AACxC,kBAAY,QAAQ,CAAC,kBAAiB;AAClC,mBAAW,KACP,qBAAqB,eAAe,YAAY;UAC5C;QACH,CAAA,CAAC;MAEV,CAAC;AAED,aAAO,QAAQ,IAAI,UAAU;;IAGjC,IAAI,YAAU;AACV,gBACI,YACA,+GAA+G;AAGnH,aAAO,YAAY,QAAQ,CAAC,kBAAiB;AACzC,kBAAU,eAAe,UAAU;MACvC,CAAC;;IAGL,OAAI;AACA,kBAAY,QAAQ,CAAC,kBAAiB;AAClC,sBAAc,aAAa;MAC/B,CAAC;;IAGL,QAAK;AACD,mBAAa;AAEb,aAAO,MAAK;AACR,qBAAa;AACb,iBAAS,KAAI;MACjB;;;AAIR,SAAO;AACX;;;;ACtEI,QAAA,WAAA,YAAA,iBAAA;AAEA,4BAAA,SAAA,OAAA,CAAA,CAAA;AAEA,SAAA;AACJ;AAEO,IAAA,eAAA;;;ACvCA,SAAS,oBAAoB;AAClC,QAAM,EAAE,gBAAgB,IAAI,UAAU;AACtC,SAAO;AACT;","names":["ease","frameData","process","alpha","alpha","alphaType","alpha","alphaType","alpha","progress","color","mixNumber","mixNumberImmediate","mixNumberImmediate","scale","progress","undampedFreq","keys","progress","keyframes","spring","createSpring","ease","ease","keyframes","percent","motionValue","keyframesGenerator","keyframes","progress","now","keyframes","transform","transform","motionValue","keyframes","ease","keyframes","motionValue","keyframes","motionValue","keyframes","motionValue","KeyframeResolver","DefaultKeyframeResolver","keyframes","isNotNull","getFinalKeyframe","keyframes","getFinalKeyframe","progress","stopAnimation","maxElapsed","time","asNumber","defaultOffset","time","notifyAll","listener","progress","useRef","useEffect","keys"]}
|