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/G,IAAK,EAAGhD,IAAK,GAAKgK,EAAG,CAAEhH,IAAK,EAAGhD,IAAK,GACtD,EACA2nC,EAAmBjkC,UAAUyQ,gBAAkB,SAAUtT,GACrD,OAAO0C,KAAKqkC,aAAa/mC,IAAQ,CACrC,EACA8mC,EAAmBjkC,UAAU6B,OAAS,WAClChC,KAAKyjB,OACT,CAEJ,CA1BuC,CA0BrCpQ,G,wDC78NF,ICNIixB,EAAkB,45HAYtB,EDdA,SAAiBC,GACf,IAAIC,EAAQ,CAAC,EACb,OAAO,SAAUC,GAEf,YADmBxoC,IAAfuoC,EAAMC,KAAoBD,EAAMC,GAAOF,EAAGE,IACvCD,EAAMC,EACf,CACF,CCFY,EAAQ,SAAUC,GAC5B,OAAOJ,EAAgBp2B,KAAKw2B,IAAgC,MAAvBA,EAAKC,WAAW,IAE3B,MAAvBD,EAAKC,WAAW,IAEhBD,EAAKC,WAAW,GAAK,EAC1B,G","sources":["webpack:///./node_modules/framer-motion/node_modules/framesync/dist/framesync.es.js","webpack:///./node_modules/framer-motion/dist/framer-motion.es.js","webpack:///./node_modules/framer-motion/node_modules/@emotion/memoize/dist/memoize.browser.esm.js","webpack:///./node_modules/framer-motion/node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js"],"sourcesContent":["import { invariant } from 'hey-listen';\n\nvar prevTime = 0;\nvar onNextFrame = typeof window !== 'undefined' && window.requestAnimationFrame !== undefined ? function (callback) {\n    return window.requestAnimationFrame(callback);\n} : function (callback) {\n    var timestamp = Date.now();\n    var timeToCall = Math.max(0, 16.7 - (timestamp - prevTime));\n    prevTime = timestamp + timeToCall;\n    setTimeout(function () {\n        return callback(prevTime);\n    }, timeToCall);\n};\n\nvar createStep = function (setRunNextFrame) {\n    var processToRun = [];\n    var processToRunNextFrame = [];\n    var numThisFrame = 0;\n    var isProcessing = false;\n    var i = 0;\n    var cancelled = new WeakSet();\n    var toKeepAlive = new WeakSet();\n    var renderStep = {\n        cancel: function (process) {\n            var indexOfCallback = processToRunNextFrame.indexOf(process);\n            cancelled.add(process);\n            if (indexOfCallback !== -1) {\n                processToRunNextFrame.splice(indexOfCallback, 1);\n            }\n        },\n        process: function (frame) {\n            var _a;\n            isProcessing = true;\n            _a = [processToRunNextFrame, processToRun], processToRun = _a[0], processToRunNextFrame = _a[1];\n            processToRunNextFrame.length = 0;\n            numThisFrame = processToRun.length;\n            if (numThisFrame) {\n                var process_1;\n                for (i = 0; i < numThisFrame; i++) {\n                    process_1 = processToRun[i];\n                    process_1(frame);\n                    if (toKeepAlive.has(process_1) === true && !cancelled.has(process_1)) {\n                        renderStep.schedule(process_1);\n                        setRunNextFrame(true);\n                    }\n                }\n            }\n            isProcessing = false;\n        },\n        schedule: function (process, keepAlive, immediate) {\n            if (keepAlive === void 0) {\n                keepAlive = false;\n            }\n            if (immediate === void 0) {\n                immediate = false;\n            }\n            invariant(typeof process === \"function\", \"Argument must be a function\");\n            var addToCurrentBuffer = immediate && isProcessing;\n            var buffer = addToCurrentBuffer ? processToRun : processToRunNextFrame;\n            cancelled.delete(process);\n            if (keepAlive) toKeepAlive.add(process);\n            if (buffer.indexOf(process) === -1) {\n                buffer.push(process);\n                if (addToCurrentBuffer) numThisFrame = processToRun.length;\n            }\n        }\n    };\n    return renderStep;\n};\n\nvar maxElapsed = 40;\nvar defaultElapsed = 1 / 60 * 1000;\nvar useDefaultElapsed = true;\nvar willRunNextFrame = false;\nvar isProcessing = false;\nvar frame = {\n    delta: 0,\n    timestamp: 0\n};\nvar stepsOrder = [\"read\", \"update\", \"preRender\", \"render\", \"postRender\"];\nvar setWillRunNextFrame = function (willRun) {\n    return willRunNextFrame = willRun;\n};\nvar steps = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {\n    acc[key] = createStep(setWillRunNextFrame);\n    return acc;\n}, {});\nvar sync = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {\n    var step = steps[key];\n    acc[key] = function (process, keepAlive, immediate) {\n        if (keepAlive === void 0) {\n            keepAlive = false;\n        }\n        if (immediate === void 0) {\n            immediate = false;\n        }\n        if (!willRunNextFrame) startLoop();\n        step.schedule(process, keepAlive, immediate);\n        return process;\n    };\n    return acc;\n}, {});\nvar cancelSync = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {\n    acc[key] = steps[key].cancel;\n    return acc;\n}, {});\nvar processStep = function (stepId) {\n    return steps[stepId].process(frame);\n};\nvar processFrame = function (timestamp) {\n    willRunNextFrame = false;\n    frame.delta = useDefaultElapsed ? defaultElapsed : Math.max(Math.min(timestamp - frame.timestamp, maxElapsed), 1);\n    if (!useDefaultElapsed) defaultElapsed = frame.delta;\n    frame.timestamp = timestamp;\n    isProcessing = true;\n    stepsOrder.forEach(processStep);\n    isProcessing = false;\n    if (willRunNextFrame) {\n        useDefaultElapsed = false;\n        onNextFrame(processFrame);\n    }\n};\nvar startLoop = function () {\n    willRunNextFrame = true;\n    useDefaultElapsed = true;\n    if (!isProcessing) onNextFrame(processFrame);\n};\nvar getFrameData = function () {\n    return frame;\n};\n\nexport default sync;\nexport { cancelSync, getFrameData };\n","import { __values, __read, __assign, __rest, __spread, __extends } from 'tslib';\nimport sync, { getFrameData, cancelSync } from 'framesync';\nimport { velocityPerSecond, cubicBezier, linear, easeIn, easeInOut, easeOut, circIn, circInOut, circOut, backIn, backInOut, backOut, anticipate, bounceIn, bounceInOut, bounceOut, inertia, animate as animate$1, mix, clamp, distance, progress, pipe, interpolate, wrap } from 'popmotion';\nimport { invariant, warning } from 'hey-listen';\nimport { complex, number, color, px, percent, degrees, vw, vh, scale, alpha, progressPercentage } from 'style-value-types';\nimport React, { useRef, createContext, useContext, useEffect, createElement, useMemo, useLayoutEffect, forwardRef, Fragment, Component as Component$1, useCallback, useState, cloneElement, Children, isValidElement } from 'react';\n\nvar isRefObject = function (ref) {\n    return typeof ref === \"object\" && ref.hasOwnProperty(\"current\");\n};\n\n/**\n * A generic subscription manager.\n */\nvar SubscriptionManager = /** @class */ (function () {\n    function SubscriptionManager() {\n        this.subscriptions = new Set();\n    }\n    SubscriptionManager.prototype.add = function (handler) {\n        var _this = this;\n        this.subscriptions.add(handler);\n        return function () { return void _this.subscriptions.delete(handler); };\n    };\n    SubscriptionManager.prototype.notify = function (\n    /**\n     * Using ...args would be preferable but it's array creation and this\n     * might be fired every frame.\n     */\n    a, b, c) {\n        var e_1, _a;\n        if (!this.subscriptions.size)\n            return;\n        try {\n            for (var _b = __values(this.subscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {\n                var handler = _c.value;\n                handler(a, b, c);\n            }\n        }\n        catch (e_1_1) { e_1 = { error: e_1_1 }; }\n        finally {\n            try {\n                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n            }\n            finally { if (e_1) throw e_1.error; }\n        }\n    };\n    SubscriptionManager.prototype.clear = function () {\n        this.subscriptions.clear();\n    };\n    return SubscriptionManager;\n}());\n\nvar isFloat = function (value) {\n    return !isNaN(parseFloat(value));\n};\n/**\n * `MotionValue` is used to track the state and velocity of motion values.\n *\n * @public\n */\nvar MotionValue = /** @class */ (function () {\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     * @internal\n     */\n    function MotionValue(init) {\n        var _this = this;\n        /**\n         * Duration, in milliseconds, since last updating frame.\n         *\n         * @internal\n         */\n        this.timeDelta = 0;\n        /**\n         * Timestamp of the last time this `MotionValue` was updated.\n         *\n         * @internal\n         */\n        this.lastUpdated = 0;\n        /**\n         * Functions to notify when the `MotionValue` updates.\n         *\n         * @internal\n         */\n        this.updateSubscribers = new SubscriptionManager();\n        /**\n         * Functions to notify when the `MotionValue` updates and `render` is set to `true`.\n         *\n         * @internal\n         */\n        this.renderSubscribers = new SubscriptionManager();\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        this.canTrackVelocity = false;\n        this.updateAndNotify = function (v, render) {\n            if (render === void 0) { render = true; }\n            _this.prev = _this.current;\n            _this.current = v;\n            if (_this.prev !== _this.current) {\n                _this.updateSubscribers.notify(_this.current);\n            }\n            if (render) {\n                _this.renderSubscribers.notify(_this.current);\n            }\n            // Update timestamp\n            var _a = getFrameData(), delta = _a.delta, timestamp = _a.timestamp;\n            if (_this.lastUpdated !== timestamp) {\n                _this.timeDelta = delta;\n                _this.lastUpdated = timestamp;\n                sync.postRender(_this.scheduleVelocityCheck);\n            }\n        };\n        /**\n         * Schedule a velocity check for the next frame.\n         *\n         * This is an instanced and bound function to prevent generating a new\n         * function once per frame.\n         *\n         * @internal\n         */\n        this.scheduleVelocityCheck = function () { return sync.postRender(_this.velocityCheck); };\n        /**\n         * Updates `prev` with `current` if the value hasn't been updated this frame.\n         * This ensures velocity calculations return `0`.\n         *\n         * This is an instanced and bound function to prevent generating a new\n         * function once per frame.\n         *\n         * @internal\n         */\n        this.velocityCheck = function (_a) {\n            var timestamp = _a.timestamp;\n            if (timestamp !== _this.lastUpdated) {\n                _this.prev = _this.current;\n            }\n        };\n        this.set(init, false);\n        this.canTrackVelocity = isFloat(this.current);\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     * @library\n     *\n     * ```jsx\n     * function 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.onChange(updateOpacity)\n     *     const unsubscribeY = y.onChange(updateOpacity)\n     *\n     *     return () => {\n     *       unsubscribeX()\n     *       unsubscribeY()\n     *     }\n     *   }, [])\n     *\n     *   return <Frame x={x} />\n     * }\n     * ```\n     *\n     * @motion\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.onChange(updateOpacity)\n     *     const unsubscribeY = y.onChange(updateOpacity)\n     *\n     *     return () => {\n     *       unsubscribeX()\n     *       unsubscribeY()\n     *     }\n     *   }, [])\n     *\n     *   return <motion.div style={{ x }} />\n     * }\n     * ```\n     *\n     * @internalremarks\n     *\n     * We could look into a `useOnChange` hook if the above lifecycle management proves confusing.\n     *\n     * ```jsx\n     * useOnChange(x, () => {})\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     * @public\n     */\n    MotionValue.prototype.onChange = function (subscription) {\n        return this.updateSubscribers.add(subscription);\n    };\n    MotionValue.prototype.clearListeners = function () {\n        this.updateSubscribers.clear();\n    };\n    /**\n     * Adds a function that will be notified when the `MotionValue` requests a render.\n     *\n     * @param subscriber - A function that's provided the latest value.\n     * @returns A function that, when called, will cancel this subscription.\n     *\n     * @internal\n     */\n    MotionValue.prototype.onRenderRequest = function (subscription) {\n        // Render immediately\n        subscription(this.get());\n        return this.renderSubscribers.add(subscription);\n    };\n    /**\n     * Attaches a passive effect to the `MotionValue`.\n     *\n     * @internal\n     */\n    MotionValue.prototype.attach = function (passiveEffect) {\n        this.passiveEffect = passiveEffect;\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    MotionValue.prototype.set = function (v, render) {\n        if (render === void 0) { render = true; }\n        if (!render || !this.passiveEffect) {\n            this.updateAndNotify(v, render);\n        }\n        else {\n            this.passiveEffect(v, this.updateAndNotify);\n        }\n    };\n    /**\n     * Returns the latest state of `MotionValue`\n     *\n     * @returns - The latest state of `MotionValue`\n     *\n     * @public\n     */\n    MotionValue.prototype.get = function () {\n        return this.current;\n    };\n    /**\n     * @public\n     */\n    MotionValue.prototype.getPrevious = function () {\n        return this.prev;\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    MotionValue.prototype.getVelocity = function () {\n        // This could be isFloat(this.prev) && isFloat(this.current), but that would be wasteful\n        return this.canTrackVelocity\n            ? // These casts could be avoided if parseFloat would be typed better\n                velocityPerSecond(parseFloat(this.current) -\n                    parseFloat(this.prev), this.timeDelta)\n            : 0;\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     * @internal\n     */\n    MotionValue.prototype.start = function (animation) {\n        var _this = this;\n        this.stop();\n        return new Promise(function (resolve) {\n            _this.stopAnimation = animation(resolve);\n        }).then(function () { return _this.clearAnimation(); });\n    };\n    /**\n     * Stop the currently active animation.\n     *\n     * @public\n     */\n    MotionValue.prototype.stop = function () {\n        if (this.stopAnimation)\n            this.stopAnimation();\n        this.clearAnimation();\n    };\n    /**\n     * Returns `true` if this value is currently animating.\n     *\n     * @public\n     */\n    MotionValue.prototype.isAnimating = function () {\n        return !!this.stopAnimation;\n    };\n    MotionValue.prototype.clearAnimation = function () {\n        this.stopAnimation = null;\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    MotionValue.prototype.destroy = function () {\n        this.updateSubscribers.clear();\n        this.renderSubscribers.clear();\n        this.stop();\n    };\n    return MotionValue;\n}());\n/**\n * @internal\n */\nfunction motionValue(init) {\n    return new MotionValue(init);\n}\n\n/**\n * Converts seconds to milliseconds\n *\n * @param seconds - Time in seconds.\n * @return milliseconds - Converted time in milliseconds.\n */\nvar secondsToMilliseconds = function (seconds) { return seconds * 1000; };\n\nvar easingLookup = {\n    linear: linear,\n    easeIn: easeIn,\n    easeInOut: easeInOut,\n    easeOut: easeOut,\n    circIn: circIn,\n    circInOut: circInOut,\n    circOut: circOut,\n    backIn: backIn,\n    backInOut: backInOut,\n    backOut: backOut,\n    anticipate: anticipate,\n    bounceIn: bounceIn,\n    bounceInOut: bounceInOut,\n    bounceOut: bounceOut,\n};\nvar easingDefinitionToFunction = function (definition) {\n    if (Array.isArray(definition)) {\n        // If cubic bezier definition, create bezier curve\n        invariant(definition.length === 4, \"Cubic bezier arrays must contain four numerical values.\");\n        var _a = __read(definition, 4), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];\n        return cubicBezier(x1, y1, x2, y2);\n    }\n    else if (typeof definition === \"string\") {\n        // Else lookup from table\n        invariant(easingLookup[definition] !== undefined, \"Invalid easing type '\" + definition + \"'\");\n        return easingLookup[definition];\n    }\n    return definition;\n};\nvar isEasingArray = function (ease) {\n    return Array.isArray(ease) && typeof ease[0] !== \"number\";\n};\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 */\nvar isAnimatable = function (key, value) {\n    // If the list of keys tat might be non-animatable grows, replace with Set\n    if (key === \"zIndex\")\n        return false;\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))\n        return true;\n    if (typeof value === \"string\" && // It's animatable if we have a string\n        complex.test(value) && // And it contains numbers and/or colors\n        !value.startsWith(\"url(\") // Unless it starts with \"url(\"\n    ) {\n        return true;\n    }\n    return false;\n};\n\nvar isKeyframesTarget = function (v) {\n    return Array.isArray(v);\n};\n\nvar underDampedSpring = function () { return ({\n    type: \"spring\",\n    stiffness: 500,\n    damping: 25,\n    restDelta: 0.5,\n    restSpeed: 10,\n}); };\nvar overDampedSpring = function (to) { return ({\n    type: \"spring\",\n    stiffness: 550,\n    damping: to === 0 ? 100 : 30,\n    restDelta: 0.01,\n    restSpeed: 10,\n}); };\nvar linearTween = function () { return ({\n    type: \"keyframes\",\n    ease: \"linear\",\n    duration: 0.3,\n}); };\nvar keyframes = function (values) { return ({\n    type: \"keyframes\",\n    duration: 0.8,\n    values: values,\n}); };\nvar defaultTransitions = {\n    x: underDampedSpring,\n    y: underDampedSpring,\n    z: underDampedSpring,\n    rotate: underDampedSpring,\n    rotateX: underDampedSpring,\n    rotateY: underDampedSpring,\n    rotateZ: underDampedSpring,\n    scaleX: overDampedSpring,\n    scaleY: overDampedSpring,\n    scale: overDampedSpring,\n    opacity: linearTween,\n    backgroundColor: linearTween,\n    color: linearTween,\n    default: overDampedSpring,\n};\nvar getDefaultTransition = function (valueKey, to) {\n    var transitionFactory;\n    if (isKeyframesTarget(to)) {\n        transitionFactory = keyframes;\n    }\n    else {\n        transitionFactory =\n            defaultTransitions[valueKey] || defaultTransitions.default;\n    }\n    return __assign({ to: to }, transitionFactory(to));\n};\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 */\nfunction isTransitionDefined(_a) {\n    var when = _a.when, delay = _a.delay, delayChildren = _a.delayChildren, staggerChildren = _a.staggerChildren, staggerDirection = _a.staggerDirection, repeat = _a.repeat, repeatType = _a.repeatType, repeatDelay = _a.repeatDelay, from = _a.from, transition = __rest(_a, [\"when\", \"delay\", \"delayChildren\", \"staggerChildren\", \"staggerDirection\", \"repeat\", \"repeatType\", \"repeatDelay\", \"from\"]);\n    return !!Object.keys(transition).length;\n}\n/**\n * Convert Framer Motion's Transition type into Popmotion-compatible options.\n */\nfunction convertTransitionToAnimationOptions(_a) {\n    var yoyo = _a.yoyo, loop = _a.loop, flip = _a.flip, ease = _a.ease, times = _a.times, transition = __rest(_a, [\"yoyo\", \"loop\", \"flip\", \"ease\", \"times\"]);\n    var options = __assign({}, transition);\n    if (times) {\n        options.offset = times;\n    }\n    /**\n     * Convert any existing durations from seconds to milliseconds\n     */\n    if (transition.duration)\n        options[\"duration\"] = secondsToMilliseconds(transition.duration);\n    if (transition.repeatDelay)\n        options.repeatDelay = secondsToMilliseconds(transition.repeatDelay);\n    /**\n     * Map easing names to Popmotion's easing functions\n     */\n    if (ease) {\n        options[\"ease\"] = isEasingArray(ease)\n            ? ease.map(easingDefinitionToFunction)\n            : easingDefinitionToFunction(ease);\n    }\n    /**\n     * Support legacy transition API\n     */\n    if (transition.type === \"tween\")\n        options.type = \"keyframes\";\n    if (yoyo) {\n        options.repeatType = \"reverse\";\n    }\n    else if (loop) {\n        options.repeatType = \"loop\";\n    }\n    else if (flip) {\n        options.repeatType = \"mirror\";\n    }\n    options.repeat = loop || yoyo || flip || transition.repeat;\n    /**\n     * TODO: Popmotion 9 has the ability to automatically detect whether to use\n     * a keyframes or spring animation, but does so by detecting velocity and other spring options.\n     * It'd be good to introduce a similar thing here.\n     */\n    if (transition.type !== \"spring\")\n        options.type = \"keyframes\";\n    return options;\n}\n/**\n * Get the delay for a value by checking Transition with decreasing specificity.\n */\nfunction getDelayFromTransition(transition, key) {\n    var _a, _b, _c, _d, _e;\n    return ((_e = (_d = (_b = (_a = transition[key]) === null || _a === void 0 ? void 0 : _a.delay) !== null && _b !== void 0 ? _b : (_c = transition[\"default\"]) === null || _c === void 0 ? void 0 : _c.delay) !== null && _d !== void 0 ? _d : transition.delay) !== null && _e !== void 0 ? _e : 0);\n}\nfunction hydrateKeyframes(options) {\n    if (Array.isArray(options.to) && options.to[0] === null) {\n        options.to = __spread(options.to);\n        options.to[0] = options.from;\n    }\n    return options;\n}\nfunction getPopmotionAnimationOptions(transition, options, key) {\n    var _a;\n    if (Array.isArray(options.to)) {\n        (_a = transition.duration) !== null && _a !== void 0 ? _a : (transition.duration = 0.8);\n    }\n    hydrateKeyframes(options);\n    /**\n     * Get a default transition if none is determined to be defined.\n     */\n    if (!isTransitionDefined(transition)) {\n        transition = __assign(__assign({}, transition), getDefaultTransition(key, options.to));\n    }\n    return __assign(__assign({}, options), convertTransitionToAnimationOptions(transition));\n}\n/**\n *\n */\nfunction getAnimation(key, value, target, transition, onComplete) {\n    var _a;\n    var valueTransition = getValueTransition(transition, key);\n    var origin = (_a = valueTransition.from) !== null && _a !== void 0 ? _a : value.get();\n    var isTargetAnimatable = isAnimatable(key, target);\n    /**\n     * If we're trying to animate from \"none\", try and get an animatable version\n     * of the target. This could be improved to work both ways.\n     */\n    if (origin === \"none\" && isTargetAnimatable && typeof target === \"string\") {\n        origin = complex.getAnimatableNone(target);\n    }\n    var isOriginAnimatable = isAnimatable(key, origin);\n    warning(isOriginAnimatable === isTargetAnimatable, \"You are trying to animate \" + key + \" from \\\"\" + origin + \"\\\" to \\\"\" + target + \"\\\". \" + origin + \" is not an animatable value - to enable this animation set \" + origin + \" to a value animatable to \" + target + \" via the `style` property.\");\n    function start() {\n        var options = {\n            from: origin,\n            to: target,\n            velocity: value.getVelocity(),\n            onComplete: onComplete,\n            onUpdate: function (v) { return value.set(v); },\n        };\n        return valueTransition.type === \"inertia\" ||\n            valueTransition.type === \"decay\"\n            ? inertia(__assign(__assign({}, options), valueTransition))\n            : animate$1(__assign(__assign({}, getPopmotionAnimationOptions(valueTransition, options, key)), { onUpdate: function (v) {\n                    var _a;\n                    options.onUpdate(v);\n                    (_a = valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, v);\n                }, onComplete: function () {\n                    var _a;\n                    options.onComplete();\n                    (_a = valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition);\n                } }));\n    }\n    function set() {\n        var _a;\n        value.set(target);\n        onComplete();\n        (_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition);\n        return { stop: function () { } };\n    }\n    return !isOriginAnimatable ||\n        !isTargetAnimatable ||\n        valueTransition.type === false\n        ? set\n        : start;\n}\nfunction getValueTransition(transition, key) {\n    return transition[key] || transition[\"default\"] || transition;\n}\n/**\n * Start animation on a MotionValue. This function is an interface between\n * Framer Motion and Popmotion\n *\n * @internal\n */\nfunction startAnimation(key, value, target, transition) {\n    if (transition === void 0) { transition = {}; }\n    return value.start(function (onComplete) {\n        var delayTimer;\n        var controls;\n        var animation = getAnimation(key, value, target, transition, onComplete);\n        var delay = getDelayFromTransition(transition, key);\n        var start = function () { return (controls = animation()); };\n        if (delay) {\n            delayTimer = setTimeout(start, secondsToMilliseconds(delay));\n        }\n        else {\n            start();\n        }\n        return function () {\n            clearTimeout(delayTimer);\n            controls === null || controls === void 0 ? void 0 : controls.stop();\n        };\n    });\n}\n\nvar isCustomValue = function (v) {\n    return Boolean(v && typeof v === \"object\" && v.mix && v.toValue);\n};\nvar resolveFinalValueInKeyframes = function (v) {\n    // TODO maybe throw if v.length - 1 is placeholder token?\n    return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;\n};\n\n/**\n * Check if value is a numerical string, ie a string that is purely a number eg \"100\" or \"-100.1\"\n */\nvar isNumericalString = function (v) { return /^\\-?\\d*\\.?\\d+$/.test(v); };\n\n/**\n * ValueType for \"auto\"\n */\nvar auto = {\n    test: function (v) { return v === \"auto\"; },\n    parse: function (v) { return v; },\n};\n/**\n * ValueType for ints\n */\nvar int = __assign(__assign({}, number), { transform: Math.round });\n/**\n * A map of default value types for common values\n */\nvar defaultValueTypes = {\n    // Color props\n    color: color,\n    backgroundColor: color,\n    outlineColor: color,\n    fill: color,\n    stroke: color,\n    // Border props\n    borderColor: color,\n    borderTopColor: color,\n    borderRightColor: color,\n    borderBottomColor: color,\n    borderLeftColor: color,\n    borderWidth: px,\n    borderTopWidth: px,\n    borderRightWidth: px,\n    borderBottomWidth: px,\n    borderLeftWidth: px,\n    borderRadius: px,\n    radius: px,\n    borderTopLeftRadius: px,\n    borderTopRightRadius: px,\n    borderBottomRightRadius: px,\n    borderBottomLeftRadius: px,\n    // Positioning props\n    width: px,\n    maxWidth: px,\n    height: px,\n    maxHeight: px,\n    size: px,\n    top: px,\n    right: px,\n    bottom: px,\n    left: px,\n    // Spacing props\n    padding: px,\n    paddingTop: px,\n    paddingRight: px,\n    paddingBottom: px,\n    paddingLeft: px,\n    margin: px,\n    marginTop: px,\n    marginRight: px,\n    marginBottom: px,\n    marginLeft: px,\n    // Transform props\n    rotate: degrees,\n    rotateX: degrees,\n    rotateY: degrees,\n    rotateZ: degrees,\n    scale: scale,\n    scaleX: scale,\n    scaleY: scale,\n    scaleZ: scale,\n    skew: degrees,\n    skewX: degrees,\n    skewY: degrees,\n    distance: px,\n    translateX: px,\n    translateY: px,\n    translateZ: px,\n    x: px,\n    y: px,\n    z: px,\n    perspective: px,\n    transformPerspective: px,\n    opacity: alpha,\n    originX: progressPercentage,\n    originY: progressPercentage,\n    originZ: px,\n    // Misc\n    zIndex: int,\n    // SVG\n    fillOpacity: alpha,\n    strokeOpacity: alpha,\n    numOctaves: int,\n};\n/**\n * A list of value types commonly used for dimensions\n */\nvar dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];\n/**\n * Tests a provided value against a ValueType\n */\nvar testValueType = function (v) { return function (type) { return type.test(v); }; };\n/**\n * Tests a dimensional value against the list of dimension ValueTypes\n */\nvar findDimensionValueType = function (v) {\n    return dimensionValueTypes.find(testValueType(v));\n};\n/**\n * A list of all ValueTypes\n */\nvar valueTypes = __spread(dimensionValueTypes, [color, complex]);\n/**\n * Tests a value against the list of ValueTypes\n */\nvar findValueType = function (v) { return valueTypes.find(testValueType(v)); };\n/**\n * Gets the default ValueType for the provided value key\n */\nvar getDefaultValueType = function (key) { return defaultValueTypes[key]; };\n/**\n * Provided a value and a ValueType, returns the value as that value type.\n */\nvar getValueAsType = function (value, type) {\n    return type && typeof value === \"number\"\n        ? type.transform(value)\n        : value;\n};\n\n/**\n * Decides if the supplied variable is a function that returns a variant\n */\nfunction isVariantResolver(variant) {\n    return typeof variant === \"function\";\n}\n/**\n * Decides if the supplied variable is an array of variant labels\n */\nfunction isVariantLabels(v) {\n    return Array.isArray(v);\n}\n/**\n * Decides if the supplied variable is variant label\n */\nfunction isVariantLabel(v) {\n    return typeof v === \"string\" || isVariantLabels(v);\n}\n/**\n * Creates an object containing the latest state of every MotionValue on a VisualElement\n */\nfunction getCurrent(visualElement) {\n    var current = {};\n    visualElement.forEachValue(function (value, key) { return (current[key] = value.get()); });\n    return current;\n}\n/**\n * Creates an object containing the latest velocity of every MotionValue on a VisualElement\n */\nfunction getVelocity(visualElement) {\n    var velocity = {};\n    visualElement.forEachValue(function (value, key) { return (velocity[key] = value.getVelocity()); });\n    return velocity;\n}\n/**\n * Resovles a variant if it's a variant resolver\n */\nfunction resolveVariant(visualElement, variant, custom) {\n    var resolved = {};\n    if (!variant) {\n        return resolved;\n    }\n    else if (isVariantResolver(variant)) {\n        resolved = variant(custom !== null && custom !== void 0 ? custom : visualElement.getVariantPayload(), getCurrent(visualElement), getVelocity(visualElement));\n    }\n    else {\n        resolved = variant;\n    }\n    return __assign({ transition: visualElement.getDefaultTransition() }, resolved);\n}\n\n/**\n * Set VisualElement's MotionValue, creating a new MotionValue for it if\n * it doesn't exist.\n */\nfunction setMotionValue(visualElement, key, value) {\n    if (visualElement.hasValue(key)) {\n        visualElement.getValue(key).set(value);\n    }\n    else {\n        visualElement.addValue(key, motionValue(value));\n    }\n}\nfunction setTarget(visualElement, definition, _a) {\n    var priority = (_a === void 0 ? {} : _a).priority;\n    var _b = visualElement.makeTargetAnimatable(resolveVariant(visualElement, definition), false), _c = _b.transitionEnd, transitionEnd = _c === void 0 ? {} : _c, transition = _b.transition, target = __rest(_b, [\"transitionEnd\", \"transition\"]);\n    target = __assign(__assign({}, target), transitionEnd);\n    for (var key in target) {\n        var value = resolveFinalValueInKeyframes(target[key]);\n        setMotionValue(visualElement, key, value);\n        if (!priority)\n            visualElement.baseTarget[key] = value;\n    }\n}\nfunction setVariants(visualElement, variantLabels) {\n    var reversedLabels = __spread(variantLabels).reverse();\n    reversedLabels.forEach(function (key) {\n        var _a;\n        setTarget(visualElement, visualElement.getVariant(key));\n        (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {\n            setVariants(child, variantLabels);\n        });\n    });\n}\nfunction setValues(visualElement, definition) {\n    if (Array.isArray(definition)) {\n        return setVariants(visualElement, definition);\n    }\n    else if (typeof definition === \"string\") {\n        return setVariants(visualElement, [definition]);\n    }\n    else {\n        setTarget(visualElement, definition);\n    }\n}\nfunction checkTargetForNewValues(visualElement, target, origin) {\n    var _a, _b;\n    var _c;\n    var newValueKeys = Object.keys(target).filter(function (key) { return !visualElement.hasValue(key); });\n    var numNewValues = newValueKeys.length;\n    if (!numNewValues)\n        return;\n    for (var i = 0; i < numNewValues; i++) {\n        var key = newValueKeys[i];\n        var targetValue = target[key];\n        var value = null;\n        // If this is a keyframes value, we can attempt to use the first value in the\n        // array as that's going to be the first value of the animation anyway\n        if (Array.isArray(targetValue)) {\n            value = targetValue[0];\n        }\n        // If it isn't a keyframes or the first keyframes value was set as `null`, read the\n        // value from the DOM. It might be worth investigating whether to check props (for SVG)\n        // or props.style (for HTML) if the value exists there before attempting to read.\n        if (value === null) {\n            var readValue = (_a = origin[key]) !== null && _a !== void 0 ? _a : visualElement.readNativeValue(key);\n            value = readValue !== undefined ? readValue : target[key];\n            invariant(value !== null, \"No initial value for \\\"\" + key + \"\\\" can be inferred. Ensure an initial value for \\\"\" + key + \"\\\" is defined on the component.\");\n        }\n        if (typeof value === \"string\" && isNumericalString(value)) {\n            // If this is a number read as a string, ie \"0\" or \"200\", convert it to a number\n            value = parseFloat(value);\n        }\n        else if (!findValueType(value) && complex.test(targetValue)) {\n            // If value is not recognised as animatable, ie \"none\", create an animatable version origin based on the target\n            value = complex.getAnimatableNone(targetValue);\n        }\n        visualElement.addValue(key, motionValue(value));\n        (_b = (_c = origin)[key]) !== null && _b !== void 0 ? _b : (_c[key] = value);\n        visualElement.baseTarget[key] = value;\n    }\n}\nfunction getOriginFromTransition(key, transition) {\n    if (!transition)\n        return;\n    var valueTransition = transition[key] || transition[\"default\"] || transition;\n    return valueTransition.from;\n}\nfunction getOrigin(target, transition, visualElement) {\n    var _a, _b;\n    var origin = {};\n    for (var key in target) {\n        origin[key] = (_a = getOriginFromTransition(key, transition)) !== null && _a !== void 0 ? _a : (_b = visualElement.getValue(key)) === null || _b === void 0 ? void 0 : _b.get();\n    }\n    return origin;\n}\n\n/**\n * @internal\n */\nfunction startVisualElementAnimation(visualElement, definition, opts) {\n    if (opts === void 0) { opts = {}; }\n    if (opts.priority) {\n        visualElement.activeOverrides.add(opts.priority);\n    }\n    visualElement.resetIsAnimating(opts.priority);\n    var animation;\n    if (isVariantLabels(definition)) {\n        animation = animateVariantLabels(visualElement, definition, opts);\n    }\n    else if (isVariantLabel(definition)) {\n        animation = animateVariant(visualElement, definition, opts);\n    }\n    else {\n        animation = animateTarget(visualElement, definition, opts);\n    }\n    visualElement.onAnimationStart();\n    return animation.then(function () { return visualElement.onAnimationComplete(); });\n}\nfunction animateVariantLabels(visualElement, variantLabels, opts) {\n    var animations = __spread(variantLabels).reverse()\n        .map(function (label) { return animateVariant(visualElement, label, opts); });\n    return Promise.all(animations);\n}\nfunction animateVariant(visualElement, label, opts) {\n    var _a;\n    var priority = (opts && opts.priority) || 0;\n    var variantDefinition = visualElement.getVariant(label);\n    var variant = resolveVariant(visualElement, variantDefinition, opts && opts.custom);\n    var transition = variant.transition || {};\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    var getAnimation = variantDefinition\n        ? function () { return animateTarget(visualElement, variant, opts); }\n        : function () { return Promise.resolve(); };\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    var getChildrenAnimations = ((_a = visualElement.variantChildrenOrder) === null || _a === void 0 ? void 0 : _a.size) ? function (forwardDelay) {\n        if (forwardDelay === void 0) { forwardDelay = 0; }\n        var _a = transition.delayChildren, delayChildren = _a === void 0 ? 0 : _a;\n        return animateChildren(visualElement, label, delayChildren + forwardDelay, transition.staggerChildren, transition.staggerDirection, priority, opts === null || opts === void 0 ? void 0 : opts.custom);\n    }\n        : function () { return Promise.resolve(); };\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    var when = transition.when;\n    if (when) {\n        var _b = __read(when === \"beforeChildren\"\n            ? [getAnimation, getChildrenAnimations]\n            : [getChildrenAnimations, getAnimation], 2), first = _b[0], last = _b[1];\n        return first().then(last);\n    }\n    else {\n        return Promise.all([getAnimation(), getChildrenAnimations(opts === null || opts === void 0 ? void 0 : opts.delay)]);\n    }\n}\nfunction animateChildren(visualElement, variantLabel, delayChildren, staggerChildren, staggerDirection, priority, custom) {\n    if (delayChildren === void 0) { delayChildren = 0; }\n    if (staggerChildren === void 0) { staggerChildren = 0; }\n    if (staggerDirection === void 0) { staggerDirection = 1; }\n    if (priority === void 0) { priority = 0; }\n    var animations = [];\n    var maxStaggerDuration = (visualElement.variantChildrenOrder.size - 1) * staggerChildren;\n    var generateStaggerDuration = staggerDirection === 1\n        ? function (i) { return i * staggerChildren; }\n        : function (i) { return maxStaggerDuration - i * staggerChildren; };\n    Array.from(visualElement.variantChildrenOrder).forEach(function (child, i) {\n        var animation = animateVariant(child, variantLabel, {\n            priority: priority,\n            delay: delayChildren + generateStaggerDuration(i),\n            custom: custom,\n        });\n        animations.push(animation);\n    });\n    return Promise.all(animations);\n}\nfunction stopAnimation(visualElement) {\n    visualElement.forEachValue(function (value) { return value.stop(); });\n}\nfunction animateTarget(visualElement, definition, _a) {\n    var _b = _a === void 0 ? {} : _a, _c = _b.delay, delay = _c === void 0 ? 0 : _c, _d = _b.priority, priority = _d === void 0 ? 0 : _d, transitionOverride = _b.transitionOverride, custom = _b.custom;\n    var targetAndTransition = resolveVariant(visualElement, definition, custom);\n    if (transitionOverride)\n        targetAndTransition.transition = transitionOverride;\n    var _e = visualElement.makeTargetAnimatable(targetAndTransition), transitionEnd = _e.transitionEnd, transition = _e.transition, target = __rest(_e, [\"transitionEnd\", \"transition\"]);\n    if (priority)\n        visualElement.resolvedOverrides[priority] = target;\n    var animations = [];\n    for (var key in target) {\n        var value = visualElement.getValue(key);\n        if (!value || !target || target[key] === undefined)\n            continue;\n        var valueTarget = target[key];\n        if (!priority) {\n            visualElement.baseTarget[key] = resolveFinalValueInKeyframes(valueTarget);\n        }\n        if (visualElement.isAnimating.has(key))\n            continue;\n        visualElement.isAnimating.add(key);\n        animations.push(startAnimation(key, value, valueTarget, __assign({ delay: delay }, transition)));\n    }\n    var allAnimations = Promise.all(animations);\n    return transitionEnd\n        ? allAnimations.then(function () {\n            return setTarget(visualElement, transitionEnd, { priority: priority });\n        })\n        : allAnimations;\n}\n\nfunction setOverride(visualElement, definition, index) {\n    var _a;\n    visualElement.overrides[index] = definition;\n    (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {\n        setOverride(child, definition, index);\n    });\n}\nfunction startOverride(visualElement, index) {\n    var override = visualElement.overrides[index];\n    if (override) {\n        return startVisualElementAnimation(visualElement, override, {\n            priority: index,\n        });\n    }\n}\nfunction clearOverride(visualElement, index) {\n    var _a;\n    (_a = visualElement.variantChildrenOrder) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {\n        clearOverride(child, index);\n    });\n    var override = visualElement.overrides[index];\n    if (!override)\n        return;\n    visualElement.activeOverrides.delete(index);\n    var highest = getHighestOverridePriortiy(visualElement);\n    visualElement.resetIsAnimating();\n    if (highest) {\n        var highestOverride = visualElement.overrides[highest];\n        highestOverride && startOverride(visualElement, highest);\n    }\n    // Figure out which remaining values were affected by the override and animate those\n    var overrideTarget = visualElement.resolvedOverrides[index];\n    if (!overrideTarget)\n        return;\n    var remainingValues = {};\n    for (var key in visualElement.baseTarget) {\n        if (overrideTarget[key] !== undefined) {\n            remainingValues[key] = visualElement.baseTarget[key];\n        }\n    }\n    visualElement.onAnimationStart();\n    animateTarget(visualElement, remainingValues).then(function () {\n        visualElement.onAnimationComplete();\n    });\n}\nfunction getHighestOverridePriortiy(visualElement) {\n    if (!visualElement.activeOverrides.size)\n        return 0;\n    return Math.max.apply(Math, __spread(Array.from(visualElement.activeOverrides)));\n}\n\n/**\n * VisualElement is an abstract class that provides a generic animation-optimised interface to the\n * underlying renderer.\n *\n * Currently many features interact directly with HTMLVisualElement/SVGVisualElement\n * but the idea is we can create, for instance, a ThreeVisualElement that extends\n * VisualElement and we can quickly offer all the same features.\n */\nvar VisualElement = /** @class */ (function () {\n    function VisualElement(parent, ref) {\n        var _this = this;\n        // An iterable list of current children\n        this.children = new Set();\n        /**\n         * A set of values that we animate back to when a value is cleared of all overrides.\n         */\n        this.baseTarget = {};\n        /**\n         * A series of target overrides that we can animate to/from when overrides are set/cleared.\n         */\n        this.overrides = [];\n        /**\n         * A series of target overrides as they were originally resolved.\n         */\n        this.resolvedOverrides = [];\n        /**\n         * A Set of currently active override indexes\n         */\n        this.activeOverrides = new Set();\n        /**\n         * A Set of value keys that are currently animating.\n         */\n        this.isAnimating = new Set();\n        // The latest resolved MotionValues\n        this.latest = {};\n        // A map of MotionValues used to animate this element\n        this.values = new Map();\n        // Unsubscription callbacks for MotionValue subscriptions\n        this.valueSubscriptions = new Map();\n        // A configuration for this VisualElement, each derived class can extend this.\n        this.config = {};\n        this.isMounted = false;\n        // A pre-bound call to the user-provided `onUpdate` callback. This won't\n        // be called more than once per frame.\n        this.update = function () { return _this.config.onUpdate(_this.latest); };\n        // Pre-bound version of render\n        this.triggerRender = function () { return _this.render(); };\n        // This function gets passed to the rendered component's `ref` prop\n        // and is used to mount/unmount the VisualElement\n        this.ref = function (element) {\n            element ? _this.mount(element) : _this.unmount();\n            if (!_this.externalRef)\n                return;\n            if (typeof _this.externalRef === \"function\") {\n                _this.externalRef(element);\n            }\n            else if (isRefObject(_this.externalRef)) {\n                _this.externalRef.current = element;\n            }\n        };\n        // Create a relationship with the provided parent.\n        this.parent = parent;\n        this.rootParent = parent ? parent.rootParent : this;\n        this.treePath = parent ? __spread(parent.treePath, [parent]) : [];\n        // Calculate the depth of this node in the VisualElement graph\n        this.depth = parent ? parent.depth + 1 : 0;\n        // A reference to any externally-defined React ref. This might live better\n        // outside the VisualElement and be handled in a hook.\n        this.externalRef = ref;\n    }\n    VisualElement.prototype.getVariantPayload = function () {\n        return this.config.custom;\n    };\n    VisualElement.prototype.getVariant = function (label) {\n        var _a;\n        return (_a = this.config.variants) === null || _a === void 0 ? void 0 : _a[label];\n    };\n    VisualElement.prototype.addVariantChild = function (visualElement) {\n        if (!this.variantChildren)\n            this.variantChildren = new Set();\n        this.variantChildren.add(visualElement);\n    };\n    VisualElement.prototype.addVariantChildOrder = function (visualElement) {\n        if (!this.variantChildrenOrder)\n            this.variantChildrenOrder = new Set();\n        this.variantChildrenOrder.add(visualElement);\n    };\n    VisualElement.prototype.onAnimationStart = function () {\n        var _a, _b;\n        (_b = (_a = this.config).onAnimationStart) === null || _b === void 0 ? void 0 : _b.call(_a);\n    };\n    VisualElement.prototype.onAnimationComplete = function () {\n        var _a, _b;\n        this.isMounted && ((_b = (_a = this.config).onAnimationComplete) === null || _b === void 0 ? void 0 : _b.call(_a));\n    };\n    VisualElement.prototype.getDefaultTransition = function () {\n        return this.config.transition;\n    };\n    VisualElement.prototype.resetIsAnimating = function (priority) {\n        var _a;\n        if (priority === void 0) { priority = 0; }\n        this.isAnimating.clear();\n        // If this isn't the highest priority gesture, block the animation\n        // of anything that's currently being animated\n        if (priority < getHighestOverridePriortiy(this)) {\n            this.checkOverrideIsAnimating(priority);\n        }\n        (_a = this.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {\n            return child.resetIsAnimating(priority);\n        });\n    };\n    VisualElement.prototype.checkOverrideIsAnimating = function (priority) {\n        var numOverrides = this.overrides.length;\n        for (var i = priority + 1; i < numOverrides; i++) {\n            var resolvedOverride = this.resolvedOverrides[i];\n            if (resolvedOverride) {\n                for (var key in resolvedOverride) {\n                    this.isAnimating.add(key);\n                }\n            }\n        }\n    };\n    VisualElement.prototype.subscribe = function (child) {\n        var _this = this;\n        this.children.add(child);\n        return function () { return _this.children.delete(child); };\n    };\n    // Check whether this element has a MotionValue of the provided key\n    VisualElement.prototype.hasValue = function (key) {\n        return this.values.has(key);\n    };\n    // Add a MotionValue\n    VisualElement.prototype.addValue = function (key, value) {\n        if (this.hasValue(key))\n            this.removeValue(key);\n        this.values.set(key, value);\n        this.setSingleStaticValue(key, value.get());\n        this.subscribeToValue(key, value);\n    };\n    // Remove a MotionValue\n    VisualElement.prototype.removeValue = function (key) {\n        var _a;\n        (_a = this.valueSubscriptions.get(key)) === null || _a === void 0 ? void 0 : _a();\n        this.valueSubscriptions.delete(key);\n        this.values.delete(key);\n        delete this.latest[key];\n    };\n    VisualElement.prototype.getValue = function (key, defaultValue) {\n        var value = this.values.get(key);\n        if (value === undefined && defaultValue !== undefined) {\n            value = new MotionValue(defaultValue);\n            this.addValue(key, value);\n        }\n        return value;\n    };\n    // Iterate over all MotionValues\n    VisualElement.prototype.forEachValue = function (callback) {\n        this.values.forEach(callback);\n    };\n    // Get the underlying rendered instance of this VisualElement. For instance in\n    // HTMLVisualElement this will be a HTMLElement.\n    VisualElement.prototype.getInstance = function () {\n        return this.element;\n    };\n    VisualElement.prototype.updateConfig = function (config) {\n        if (config === void 0) { config = {}; }\n        this.config = __assign({}, config);\n    };\n    // Set a single `latest` value\n    VisualElement.prototype.setSingleStaticValue = function (key, value) {\n        this.latest[key] = value;\n    };\n    // Statically set values to `latest` without needing a MotionValue\n    VisualElement.prototype.setStaticValues = function (values, value) {\n        if (typeof values === \"string\") {\n            this.setSingleStaticValue(values, value);\n        }\n        else {\n            for (var key in values) {\n                this.setSingleStaticValue(key, values[key]);\n            }\n        }\n    };\n    VisualElement.prototype.scheduleRender = function () {\n        sync.render(this.triggerRender, false, true);\n    };\n    VisualElement.prototype.scheduleUpdateLayoutDelta = function () {\n        sync.preRender(this.rootParent.updateLayoutDelta, false, true);\n    };\n    VisualElement.prototype.subscribeToValue = function (key, value) {\n        var _this = this;\n        var onChange = function (latest) {\n            _this.setSingleStaticValue(key, latest);\n            // Schedule onUpdate if we have an onUpdate listener and the component has mounted\n            _this.element &&\n                _this.config.onUpdate &&\n                sync.update(_this.update, false, true);\n        };\n        var onRender = function () {\n            _this.element && _this.scheduleRender();\n        };\n        var unsubscribeOnChange = value.onChange(onChange);\n        var unsubscribeOnRender = value.onRenderRequest(onRender);\n        this.valueSubscriptions.set(key, function () {\n            unsubscribeOnChange();\n            unsubscribeOnRender();\n        });\n    };\n    // Mount the VisualElement with the actual DOM element\n    VisualElement.prototype.mount = function (element) {\n        invariant(!!element, \"No ref found. Ensure components created with motion.custom forward refs using React.forwardRef\");\n        if (this.parent) {\n            this.removeFromParent = this.parent.subscribe(this);\n        }\n        /**\n         * Save the element to this.element as a semantic API, this.current to the VisualElement\n         * is compatible with existing RefObject APIs.\n         */\n        this.element = this.current = element;\n    };\n    // Unmount the VisualElement and cancel any scheduled updates\n    VisualElement.prototype.unmount = function () {\n        var _this = this;\n        this.forEachValue(function (_, key) { return _this.removeValue(key); });\n        cancelSync.update(this.update);\n        cancelSync.render(this.render);\n        this.removeFromParent && this.removeFromParent();\n    };\n    return VisualElement;\n}());\n\nfunction noop(any) {\n    return any;\n}\n\n/**\n * Bounding boxes tend to be defined as top, left, right, bottom. For various operations\n * it's easier to consider each axis individually. This function returns a bounding box\n * as a map of single-axis min/max values.\n */\nfunction convertBoundingBoxToAxisBox(_a) {\n    var top = _a.top, left = _a.left, right = _a.right, bottom = _a.bottom;\n    return {\n        x: { min: left, max: right },\n        y: { min: top, max: bottom },\n    };\n}\nfunction convertAxisBoxToBoundingBox(_a) {\n    var x = _a.x, y = _a.y;\n    return {\n        top: y.min,\n        bottom: y.max,\n        left: x.min,\n        right: x.max,\n    };\n}\n/**\n * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function\n * provided by Framer to allow measured points to be corrected for device scaling. This is used\n * when measuring DOM elements and DOM event points.\n */\nfunction transformBoundingBox(_a, transformPoint) {\n    var top = _a.top, left = _a.left, bottom = _a.bottom, right = _a.right;\n    if (transformPoint === void 0) { transformPoint = noop; }\n    var topLeft = transformPoint({ x: left, y: top });\n    var bottomRight = transformPoint({ x: right, y: bottom });\n    return {\n        top: topLeft.y,\n        left: topLeft.x,\n        bottom: bottomRight.y,\n        right: bottomRight.x,\n    };\n}\n/**\n * Create an empty axis box of zero size\n */\nfunction axisBox() {\n    return { x: { min: 0, max: 1 }, y: { min: 0, max: 1 } };\n}\nfunction copyAxisBox(box) {\n    return {\n        x: __assign({}, box.x),\n        y: __assign({}, box.y),\n    };\n}\n/**\n * Create an empty box delta\n */\nvar zeroDelta = {\n    translate: 0,\n    scale: 1,\n    origin: 0,\n    originPoint: 0,\n};\nfunction delta() {\n    return {\n        x: __assign({}, zeroDelta),\n        y: __assign({}, zeroDelta),\n    };\n}\n\n/**\n * A list of all transformable axes. We'll use this list to generated a version\n * of each axes for each transform.\n */\nvar transformAxes = [\"\", \"X\", \"Y\", \"Z\"];\n/**\n * An ordered array of each transformable value. By default, transform values\n * will be sorted to this order.\n */\nvar order = [\"perspective\", \"translate\", \"scale\", \"rotate\", \"skew\"];\n/**\n * Used to store the keys of all transforms that will distorted a measured bounding box.\n */\nvar boxDistortingKeys = new Set();\n/**\n * Generate a list of every possible transform key.\n */\nvar transformProps = [\"transformPerspective\", \"x\", \"y\", \"z\"];\norder.forEach(function (operationKey) {\n    var isDistorting = new Set([\"rotate\", \"skew\"]).has(operationKey);\n    transformAxes.forEach(function (axesKey) {\n        var key = operationKey + axesKey;\n        transformProps.push(key);\n        isDistorting && boxDistortingKeys.add(key);\n    });\n});\n/**\n * A function to use with Array.sort to sort transform keys by their default order.\n */\nfunction sortTransformProps(a, b) {\n    return transformProps.indexOf(a) - transformProps.indexOf(b);\n}\n/**\n * A quick lookup for transform props.\n */\nvar transformPropSet = new Set(transformProps);\nfunction isTransformProp(key) {\n    return transformPropSet.has(key);\n}\n/**\n * A quick lookup for transform origin props\n */\nvar transformOriginProps = new Set([\"originX\", \"originY\", \"originZ\"]);\nfunction isTransformOriginProp(key) {\n    return transformOriginProps.has(key);\n}\n\nvar translateAlias = {\n    x: \"translateX\",\n    y: \"translateY\",\n    z: \"translateZ\",\n    transformPerspective: \"perspective\",\n};\n/**\n * Build a CSS transform style from individual x/y/scale etc properties.\n *\n * This outputs with a default order of transforms/scales/rotations, this can be customised by\n * providing a transformTemplate function.\n */\nfunction buildTransform(transform, transformKeys, transformTemplate, transformIsDefault, enableHardwareAcceleration, allowTransformNone) {\n    if (enableHardwareAcceleration === void 0) { enableHardwareAcceleration = true; }\n    if (allowTransformNone === void 0) { allowTransformNone = true; }\n    // The transform string we're going to build into.\n    var transformString = \"\";\n    // Transform keys into their default order - this will determine the output order.\n    transformKeys.sort(sortTransformProps);\n    // Track whether the defined transform has a defined z so we don't add a\n    // second to enable hardware acceleration\n    var transformHasZ = false;\n    // Loop over each transform and build them into transformString\n    var numTransformKeys = transformKeys.length;\n    for (var i = 0; i < numTransformKeys; i++) {\n        var key = transformKeys[i];\n        transformString += (translateAlias[key] || key) + \"(\" + transform[key] + \") \";\n        if (key === \"z\")\n            transformHasZ = true;\n    }\n    if (!transformHasZ && enableHardwareAcceleration) {\n        transformString += \"translateZ(0)\";\n    }\n    else {\n        transformString = transformString.trim();\n    }\n    // If we have a custom `transform` template, pass our transform values and\n    // generated transformString to that before returning\n    if (transformTemplate) {\n        transformString = transformTemplate(transform, transformIsDefault ? \"\" : transformString);\n    }\n    else if (allowTransformNone && transformIsDefault) {\n        transformString = \"none\";\n    }\n    return transformString;\n}\n/**\n * Build a transformOrigin style. Uses the same defaults as the browser for\n * undefined origins.\n */\nfunction buildTransformOrigin(_a) {\n    var _b = _a.originX, originX = _b === void 0 ? \"50%\" : _b, _c = _a.originY, originY = _c === void 0 ? \"50%\" : _c, _d = _a.originZ, originZ = _d === void 0 ? 0 : _d;\n    return originX + \" \" + originY + \" \" + originZ;\n}\n/**\n * Build a transform style that takes a calculated delta between the element's current\n * space on screen and projects it into the desired space.\n */\nfunction buildLayoutProjectionTransform(_a, treeScale) {\n    var x = _a.x, y = _a.y;\n    /**\n     * The translations we use to calculate are always relative to the viewport coordinate space.\n     * But when we apply scales, we also scale the coordinate space of an element and its children.\n     * For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need\n     * to move an element 100 pixels, we actually need to move it 200 in within that scaled space.\n     */\n    var xTranslate = x.translate / treeScale.x;\n    var yTranslate = y.translate / treeScale.y;\n    return \"translate3d(\" + xTranslate + \"px, \" + yTranslate + \"px, 0) scale(\" + x.scale + \", \" + y.scale + \")\";\n}\nvar identityProjection = buildLayoutProjectionTransform(delta(), {\n    x: 1,\n    y: 1,\n});\n/**\n * Take the calculated delta origin and apply it as a transform string.\n */\nfunction buildLayoutProjectionTransformOrigin(_a) {\n    var x = _a.x, y = _a.y;\n    return x.origin * 100 + \"% \" + y.origin * 100 + \"% 0\";\n}\n/**\n * Build a transform string only from the properties that distort bounding box measurements\n * (rotate and skew)\n */\nfunction buildBoxDistortingTransforms(transform, transformKeys) {\n    var transformString = \"\";\n    transformKeys.sort(sortTransformProps);\n    var numTransformKeys = transformKeys.length;\n    for (var i = 0; i < numTransformKeys; i++) {\n        var key = transformKeys[i];\n        if (boxDistortingKeys.has(key)) {\n            transformString += key + \"(\" + transform[key] + \") \";\n        }\n    }\n    return transformString;\n}\n\n/**\n * Returns true if the provided key is a CSS variable\n */\nfunction isCSSVariable(key) {\n    return key.startsWith(\"--\");\n}\n\nfunction isCSSVariable$1(value) {\n    return typeof value === \"string\" && value.startsWith(\"var(--\");\n}\n/**\n * Parse Framer's special CSS variable format into a CSS token and a fallback.\n *\n * ```\n * `var(--foo, #fff)` => [`--foo`, '#fff']\n * ```\n *\n * @param current\n */\nvar cssVariableRegex = /var\\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\\)/;\nfunction parseCSSVariable(current) {\n    var match = cssVariableRegex.exec(current);\n    if (!match)\n        return [,];\n    var _a = __read(match, 3), token = _a[1], fallback = _a[2];\n    return [token, fallback];\n}\nvar maxDepth = 4;\nfunction getVariableValue(current, element, depth) {\n    if (depth === void 0) { depth = 1; }\n    invariant(depth <= maxDepth, \"Max CSS variable fallback depth detected in property \\\"\" + current + \"\\\". This may indicate a circular fallback dependency.\");\n    var _a = __read(parseCSSVariable(current), 2), token = _a[0], fallback = _a[1];\n    // No CSS variable detected\n    if (!token)\n        return;\n    // Attempt to read this CSS variable off the element\n    var resolved = window.getComputedStyle(element).getPropertyValue(token);\n    if (resolved) {\n        return resolved.trim();\n    }\n    else if (isCSSVariable$1(fallback)) {\n        // The fallback might itself be a CSS variable, in which case we attempt to resolve it too.\n        return getVariableValue(fallback, element, depth + 1);\n    }\n    else {\n        return fallback;\n    }\n}\n/**\n * Resolve CSS variables from\n *\n * @internal\n */\nfunction resolveCSSVariables(visualElement, _a, transitionEnd) {\n    var _b;\n    var target = __rest(_a, []);\n    var element = visualElement.getInstance();\n    if (!(element instanceof HTMLElement))\n        return { target: target, transitionEnd: transitionEnd };\n    // If `transitionEnd` isn't `undefined`, clone it. We could clone `target` and `transitionEnd`\n    // only if they change but I think this reads clearer and this isn't a performance-critical path.\n    if (transitionEnd) {\n        transitionEnd = __assign({}, transitionEnd);\n    }\n    // Go through existing `MotionValue`s and ensure any existing CSS variables are resolved\n    visualElement.forEachValue(function (value) {\n        var current = value.get();\n        if (!isCSSVariable$1(current))\n            return;\n        var resolved = getVariableValue(current, element);\n        if (resolved)\n            value.set(resolved);\n    });\n    // Cycle through every target property and resolve CSS variables. Currently\n    // we only read single-var properties like `var(--foo)`, not `calc(var(--foo) + 20px)`\n    for (var key in target) {\n        var current = target[key];\n        if (!isCSSVariable$1(current))\n            continue;\n        var resolved = getVariableValue(current, element);\n        if (!resolved)\n            continue;\n        // Clone target if it hasn't already been\n        target[key] = resolved;\n        // If the user hasn't already set this key on `transitionEnd`, set it to the unresolved\n        // CSS variable. This will ensure that after the animation the component will reflect\n        // changes in the value of the CSS variable.\n        if (transitionEnd)\n            (_b = transitionEnd[key]) !== null && _b !== void 0 ? _b : (transitionEnd[key] = current);\n    }\n    return { target: target, transitionEnd: transitionEnd };\n}\n\nfunction pixelsToPercent(pixels, axis) {\n    return (pixels / (axis.max - axis.min)) * 100;\n}\n/**\n * We always correct borderRadius as a percentage rather than pixels to reduce paints.\n * For example, if you are projecting a box that is 100px wide with a 10px borderRadius\n * into a box that is 200px wide with a 20px borderRadius, that is actually a 10%\n * borderRadius in both states. If we animate between the two in pixels that will trigger\n * a paint each time. If we animate between the two in percentage we'll avoid a paint.\n */\nfunction correctBorderRadius(latest, viewportBox) {\n    /**\n     * If latest is a string, if it's a percentage we can return immediately as it's\n     * going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.\n     */\n    if (typeof latest === \"string\") {\n        if (px.test(latest)) {\n            latest = parseFloat(latest);\n        }\n        else {\n            return latest;\n        }\n    }\n    /**\n     * If latest is a number, it's a pixel value. We use the current viewportBox to calculate that\n     * pixel value as a percentage of each axis\n     */\n    var x = pixelsToPercent(latest, viewportBox.x);\n    var y = pixelsToPercent(latest, viewportBox.y);\n    return x + \"% \" + y + \"%\";\n}\nvar varToken = \"_$css\";\nfunction correctBoxShadow(latest, _viewportBox, delta, treeScale) {\n    var original = latest;\n    /**\n     * We need to first strip and store CSS variables from the string.\n     */\n    var containsCSSVariables = latest.includes(\"var(\");\n    var cssVariables = [];\n    if (containsCSSVariables) {\n        latest = latest.replace(cssVariableRegex, function (match) {\n            cssVariables.push(match);\n            return varToken;\n        });\n    }\n    var shadow = complex.parse(latest);\n    // TODO: Doesn't support multiple shadows\n    if (shadow.length > 5)\n        return original;\n    var template = complex.createTransformer(latest);\n    var offset = typeof shadow[0] !== \"number\" ? 1 : 0;\n    // Calculate the overall context scale\n    var xScale = delta.x.scale * treeScale.x;\n    var yScale = delta.y.scale * treeScale.y;\n    shadow[0 + offset] /= xScale;\n    shadow[1 + offset] /= yScale;\n    /**\n     * Ideally we'd correct x and y scales individually, but because blur and\n     * spread apply to both we have to take a scale average and apply that instead.\n     * We could potentially improve the outcome of this by incorporating the ratio between\n     * the two scales.\n     */\n    var averageScale = mix(xScale, yScale, 0.5);\n    // Blur\n    if (typeof shadow[2 + offset] === \"number\")\n        shadow[2 + offset] /= averageScale;\n    // Spread\n    if (typeof shadow[3 + offset] === \"number\")\n        shadow[3 + offset] /= averageScale;\n    var output = template(shadow);\n    if (containsCSSVariables) {\n        var i_1 = 0;\n        output = output.replace(varToken, function () {\n            var cssVariable = cssVariables[i_1];\n            i_1++;\n            return cssVariable;\n        });\n    }\n    return output;\n}\nvar borderCorrectionDefinition = {\n    process: correctBorderRadius,\n};\nvar valueScaleCorrection = {\n    borderRadius: __assign(__assign({}, borderCorrectionDefinition), { applyTo: [\n            \"borderTopLeftRadius\",\n            \"borderTopRightRadius\",\n            \"borderBottomLeftRadius\",\n            \"borderBottomRightRadius\",\n        ] }),\n    borderTopLeftRadius: borderCorrectionDefinition,\n    borderTopRightRadius: borderCorrectionDefinition,\n    borderBottomLeftRadius: borderCorrectionDefinition,\n    borderBottomRightRadius: borderCorrectionDefinition,\n    boxShadow: {\n        process: correctBoxShadow,\n    },\n};\n/**\n * @internal\n */\nfunction addScaleCorrection(correctors) {\n    for (var key in correctors) {\n        valueScaleCorrection[key] = correctors[key];\n    }\n}\n\n/**\n * Build style and CSS variables\n *\n * This function converts a Motion style prop:\n *\n * { x: 100, width: 100, originX: 0.5 }\n *\n * Into an object with default value types applied and default\n * transform order set:\n *\n * {\n *   transform: 'translateX(100px) translateZ(0)`,\n *   width: '100px',\n *   transformOrigin: '50% 50%'\n * }\n *\n * Styles are saved to `style` and CSS vars to `vars`.\n *\n * This function works with mutative data structures.\n */\nfunction buildHTMLStyles(latest, style, vars, transform, transformOrigin, transformKeys, _a, isLayoutProjectionEnabled, delta, deltaFinal, treeScale, targetBox) {\n    var enableHardwareAcceleration = _a.enableHardwareAcceleration, transformTemplate = _a.transformTemplate, allowTransformNone = _a.allowTransformNone;\n    // Empty the transformKeys array. As we're throwing out refs to its items\n    // this might not be as cheap as suspected. Maybe using the array as a buffer\n    // with a manual incrementation would be better.\n    transformKeys.length = 0;\n    // Track whether we encounter any transform or transformOrigin values.\n    var hasTransform = false;\n    var hasTransformOrigin = false;\n    // Does the calculated transform essentially equal \"none\"?\n    var transformIsNone = true;\n    /**\n     * Loop over all our latest animated values and decide whether to handle them\n     * as a style or CSS variable. Transforms and transform origins are kept seperately\n     * for further processing\n     */\n    for (var key in latest) {\n        var value = latest[key];\n        // Convert the value to its default value type, ie 0 -> \"0px\"\n        var valueType = getDefaultValueType(key);\n        var valueAsType = getValueAsType(value, valueType);\n        if (isTransformProp(key)) {\n            // If this is a transform, flag and enable further transform processing\n            hasTransform = true;\n            transform[key] = valueAsType;\n            transformKeys.push(key);\n            if (!transformIsNone)\n                continue;\n            // If all the transform keys we've so far encountered are their default value\n            // then check to see if this one isn't\n            var defaultValue = valueType.default !== undefined ? valueType.default : 0;\n            if (value !== defaultValue)\n                transformIsNone = false;\n        }\n        else if (isTransformOriginProp(key)) {\n            // If this is a transform origin, flag and enable further transform-origin processing\n            transformOrigin[key] = valueAsType;\n            hasTransformOrigin = true;\n        }\n        else if (key !== \"transform\" || typeof value !== \"function\") {\n            // Handle all remaining values. Decide which map to save to depending\n            // on whether this is a CSS variable\n            var bucket = isCSSVariable(key) ? vars : style;\n            // If we need to perform scale correction, and we have a handler for this\n            // value type (ie borderRadius), perform it\n            if (isLayoutProjectionEnabled && valueScaleCorrection[key]) {\n                var corrected = valueScaleCorrection[key].process(value, targetBox, delta, treeScale);\n                /**\n                 * Scale-correctable values can define a number of other values to break\n                 * down into. For instance borderRadius needs applying to borderBottomLeftRadius etc\n                 */\n                var applyTo = valueScaleCorrection[key].applyTo;\n                if (applyTo) {\n                    var num = applyTo.length;\n                    for (var i = 0; i < num; i++) {\n                        bucket[applyTo[i]] = corrected;\n                    }\n                }\n                else {\n                    bucket[key] = corrected;\n                }\n            }\n            else {\n                bucket[key] = valueAsType;\n            }\n        }\n    }\n    /**\n     * Build transform and transformOrigin. If we're performing layout projection these need\n     * to be based off the deltaFinal data. Any user-set origins will have been pre-baked\n     * into the deltaFinal.\n     */\n    if (isLayoutProjectionEnabled) {\n        style.transform = buildLayoutProjectionTransform(deltaFinal, treeScale);\n        if (style.transform === identityProjection)\n            style.transform = \"\";\n        /**\n         * If we have transform styles, build only those that distort bounding boxes (rotate/skew)\n         * as translations and scales will already have been used to calculate deltaFinal.\n         */\n        if (hasTransform) {\n            style.transform +=\n                \" \" + buildBoxDistortingTransforms(transform, transformKeys);\n            style.transform = style.transform.trim();\n        }\n        if (transformTemplate) {\n            style.transform = transformTemplate(transform, style.transform);\n        }\n        style.transformOrigin = buildLayoutProjectionTransformOrigin(deltaFinal);\n    }\n    else {\n        if (hasTransform) {\n            style.transform = buildTransform(transform, transformKeys, transformTemplate, transformIsNone, enableHardwareAcceleration, allowTransformNone);\n        }\n        if (hasTransformOrigin) {\n            style.transformOrigin = buildTransformOrigin(transformOrigin);\n        }\n    }\n}\n\n/**\n * Reset an axis to the provided origin box.\n *\n * This is a mutative operation.\n */\nfunction resetAxis(axis, originAxis) {\n    axis.min = originAxis.min;\n    axis.max = originAxis.max;\n}\n/**\n * Reset a box to the provided origin box.\n *\n * This is a mutative operation.\n */\nfunction resetBox(box, originBox) {\n    resetAxis(box.x, originBox.x);\n    resetAxis(box.y, originBox.y);\n}\n/**\n * Scales a point based on a factor and an originPoint\n */\nfunction scalePoint(point, scale, originPoint) {\n    var distanceFromOrigin = point - originPoint;\n    var scaled = scale * distanceFromOrigin;\n    return originPoint + scaled;\n}\n/**\n * Applies a translate/scale delta to a point\n */\nfunction applyPointDelta(point, translate, scale, originPoint, boxScale) {\n    if (boxScale !== undefined) {\n        point = scalePoint(point, boxScale, originPoint);\n    }\n    return scalePoint(point, scale, originPoint) + translate;\n}\n/**\n * Applies a translate/scale delta to an axis\n */\nfunction applyAxisDelta(axis, translate, scale, originPoint, boxScale) {\n    if (translate === void 0) { translate = 0; }\n    if (scale === void 0) { scale = 1; }\n    axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);\n    axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);\n}\n/**\n * Applies a translate/scale delta to a box\n */\nfunction applyBoxDelta(box, _a) {\n    var x = _a.x, y = _a.y;\n    applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);\n    applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);\n}\n/**\n * Apply a transform to an axis from the latest resolved motion values.\n * This function basically acts as a bridge between a flat motion value map\n * and applyAxisDelta\n */\nfunction applyAxisTransforms(final, axis, transforms, _a) {\n    var _b = __read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];\n    // Copy the current axis to the final axis before mutation\n    final.min = axis.min;\n    final.max = axis.max;\n    var axisOrigin = transforms[originKey] !== undefined ? transforms[originKey] : 0.5;\n    var originPoint = mix(axis.min, axis.max, axisOrigin);\n    // Apply the axis delta to the final axis\n    applyAxisDelta(final, transforms[key], transforms[scaleKey], originPoint, transforms.scale);\n}\n/**\n * The names of the motion values we want to apply as translation, scale and origin.\n */\nvar xKeys = [\"x\", \"scaleX\", \"originX\"];\nvar yKeys = [\"y\", \"scaleY\", \"originY\"];\n/**\n * Apply a transform to a box from the latest resolved motion values.\n */\nfunction applyBoxTransforms(finalBox, box, transforms) {\n    applyAxisTransforms(finalBox.x, box.x, transforms, xKeys);\n    applyAxisTransforms(finalBox.y, box.y, transforms, yKeys);\n}\n/**\n * Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse\n */\nfunction removePointDelta(point, translate, scale, originPoint, boxScale) {\n    point -= translate;\n    point = scalePoint(point, 1 / scale, originPoint);\n    if (boxScale !== undefined) {\n        point = scalePoint(point, 1 / boxScale, originPoint);\n    }\n    return point;\n}\n/**\n * Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse\n */\nfunction removeAxisDelta(axis, translate, scale, origin, boxScale) {\n    if (translate === void 0) { translate = 0; }\n    if (scale === void 0) { scale = 1; }\n    if (origin === void 0) { origin = 0.5; }\n    var originPoint = mix(axis.min, axis.max, origin) - translate;\n    axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale);\n    axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale);\n}\n/**\n * Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse\n * and acts as a bridge between motion values and removeAxisDelta\n */\nfunction removeAxisTransforms(axis, transforms, _a) {\n    var _b = __read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];\n    removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale);\n}\n/**\n * Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse\n * and acts as a bridge between motion values and removeAxisDelta\n */\nfunction removeBoxTransforms(box, transforms) {\n    removeAxisTransforms(box.x, transforms, xKeys);\n    removeAxisTransforms(box.y, transforms, yKeys);\n}\n/**\n * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms\n * in a tree upon our box before then calculating how to project it into our desired viewport-relative box\n *\n * This is the final nested loop within HTMLVisualElement.updateLayoutDelta\n */\nfunction applyTreeDeltas(box, treePath) {\n    var treeLength = treePath.length;\n    for (var i = 0; i < treeLength; i++) {\n        applyBoxDelta(box, treePath[i].delta);\n    }\n}\n\nvar clampProgress = function (v) { return clamp(0, 1, v); };\n/**\n * Returns true if the provided value is within maxDistance of the provided target\n */\nfunction isNear(value, target, maxDistance) {\n    if (target === void 0) { target = 0; }\n    if (maxDistance === void 0) { maxDistance = 0.01; }\n    return distance(value, target) < maxDistance;\n}\nfunction calcLength(axis) {\n    return axis.max - axis.min;\n}\n/**\n * Calculate a transform origin relative to the source axis, between 0-1, that results\n * in an asthetically pleasing scale/transform needed to project from source to target.\n */\nfunction calcOrigin(source, target) {\n    var origin = 0.5;\n    var sourceLength = calcLength(source);\n    var targetLength = calcLength(target);\n    if (targetLength > sourceLength) {\n        origin = progress(target.min, target.max - sourceLength, source.min);\n    }\n    else if (sourceLength > targetLength) {\n        origin = progress(source.min, source.max - targetLength, target.min);\n    }\n    return clampProgress(origin);\n}\n/**\n * Update the AxisDelta with a transform that projects source into target.\n *\n * The transform `origin` is optional. If not provided, it'll be automatically\n * calculated based on the relative positions of the two bounding boxes.\n */\nfunction updateAxisDelta(delta, source, target, origin) {\n    delta.origin = origin === undefined ? calcOrigin(source, target) : origin;\n    delta.originPoint = mix(source.min, source.max, delta.origin);\n    delta.scale = calcLength(target) / calcLength(source);\n    if (isNear(delta.scale, 1, 0.0001))\n        delta.scale = 1;\n    delta.translate =\n        mix(target.min, target.max, delta.origin) - delta.originPoint;\n    if (isNear(delta.translate))\n        delta.translate = 0;\n}\n/**\n * Update the BoxDelta with a transform that projects the source into the target.\n *\n * The transform `origin` is optional. If not provided, it'll be automatically\n * calculated based on the relative positions of the two bounding boxes.\n */\nfunction updateBoxDelta(delta, source, target, origin) {\n    updateAxisDelta(delta.x, source.x, target.x, origin);\n    updateAxisDelta(delta.y, source.y, target.y, origin);\n}\n/**\n * Update the treeScale by incorporating the parent's latest scale into its treeScale.\n */\nfunction updateTreeScale(treeScale, parentTreeScale, parentDelta) {\n    treeScale.x = parentTreeScale.x * parentDelta.x.scale;\n    treeScale.y = parentTreeScale.y * parentDelta.y.scale;\n}\n\n// Call a handler once for each axis\nfunction eachAxis(handler) {\n    return [handler(\"x\"), handler(\"y\")];\n}\n\n/**\n * Measure and return the element bounding box.\n *\n * We convert the box into an AxisBox2D to make it easier to work with each axis\n * individually and programmatically.\n *\n * This function optionally accepts a transformPagePoint function which allows us to compensate\n * for, for instance, measuring the element within a scaled plane like a Framer devivce preview component.\n */\nfunction getBoundingBox(element, transformPagePoint) {\n    var box = element.getBoundingClientRect();\n    return convertBoundingBoxToAxisBox(transformBoundingBox(box, transformPagePoint));\n}\n\nvar positionalKeys = new Set([\n    \"width\",\n    \"height\",\n    \"top\",\n    \"left\",\n    \"right\",\n    \"bottom\",\n    \"x\",\n    \"y\",\n]);\nvar isPositionalKey = function (key) { return positionalKeys.has(key); };\nvar hasPositionalKey = function (target) {\n    return Object.keys(target).some(isPositionalKey);\n};\nvar setAndResetVelocity = function (value, to) {\n    // Looks odd but setting it twice doesn't render, it'll just\n    // set both prev and current to the latest value\n    value.set(to, false);\n    value.set(to);\n};\nvar isNumOrPxType = function (v) {\n    return v === number || v === px;\n};\nvar BoundingBoxDimension;\n(function (BoundingBoxDimension) {\n    BoundingBoxDimension[\"width\"] = \"width\";\n    BoundingBoxDimension[\"height\"] = \"height\";\n    BoundingBoxDimension[\"left\"] = \"left\";\n    BoundingBoxDimension[\"right\"] = \"right\";\n    BoundingBoxDimension[\"top\"] = \"top\";\n    BoundingBoxDimension[\"bottom\"] = \"bottom\";\n})(BoundingBoxDimension || (BoundingBoxDimension = {}));\nvar getPosFromMatrix = function (matrix, pos) {\n    return parseFloat(matrix.split(\", \")[pos]);\n};\nvar getTranslateFromMatrix = function (pos2, pos3) { return function (_bbox, _a) {\n    var transform = _a.transform;\n    if (transform === \"none\" || !transform)\n        return 0;\n    var matrix3d = transform.match(/^matrix3d\\((.+)\\)$/);\n    if (matrix3d) {\n        return getPosFromMatrix(matrix3d[1], pos3);\n    }\n    else {\n        var matrix = transform.match(/^matrix\\((.+)\\)$/);\n        if (matrix) {\n            return getPosFromMatrix(matrix[1], pos2);\n        }\n        else {\n            return 0;\n        }\n    }\n}; };\nvar transformKeys = new Set([\"x\", \"y\", \"z\"]);\nvar nonTranslationalTransformKeys = transformProps.filter(function (key) { return !transformKeys.has(key); });\nfunction removeNonTranslationalTransform(visualElement) {\n    var removedTransforms = [];\n    nonTranslationalTransformKeys.forEach(function (key) {\n        var value = visualElement.getValue(key);\n        if (value !== undefined) {\n            removedTransforms.push([key, value.get()]);\n            value.set(key.startsWith(\"scale\") ? 1 : 0);\n        }\n    });\n    // Apply changes to element before measurement\n    if (removedTransforms.length)\n        visualElement.render();\n    return removedTransforms;\n}\nvar positionalValues = {\n    // Dimensions\n    width: function (_a) {\n        var x = _a.x;\n        return x.max - x.min;\n    },\n    height: function (_a) {\n        var y = _a.y;\n        return y.max - y.min;\n    },\n    top: function (_bbox, _a) {\n        var top = _a.top;\n        return parseFloat(top);\n    },\n    left: function (_bbox, _a) {\n        var left = _a.left;\n        return parseFloat(left);\n    },\n    bottom: function (_a, _b) {\n        var y = _a.y;\n        var top = _b.top;\n        return parseFloat(top) + (y.max - y.min);\n    },\n    right: function (_a, _b) {\n        var x = _a.x;\n        var left = _b.left;\n        return parseFloat(left) + (x.max - x.min);\n    },\n    // Transform\n    x: getTranslateFromMatrix(4, 13),\n    y: getTranslateFromMatrix(5, 14),\n};\nvar convertChangedValueTypes = function (target, visualElement, changedKeys) {\n    var originBbox = visualElement.getBoundingBox();\n    var elementComputedStyle = visualElement.getComputedStyle();\n    var display = elementComputedStyle.display, top = elementComputedStyle.top, left = elementComputedStyle.left, bottom = elementComputedStyle.bottom, right = elementComputedStyle.right, transform = elementComputedStyle.transform;\n    var originComputedStyle = { top: top, left: left, bottom: bottom, right: right, transform: transform };\n    // If the element is currently set to display: \"none\", make it visible before\n    // measuring the target bounding box\n    if (display === \"none\") {\n        visualElement.setStaticValues(\"display\", target.display || \"block\");\n    }\n    // Apply the latest values (as set in checkAndConvertChangedValueTypes)\n    visualElement.render();\n    var targetBbox = visualElement.getBoundingBox();\n    changedKeys.forEach(function (key) {\n        // Restore styles to their **calculated computed style**, not their actual\n        // originally set style. This allows us to animate between equivalent pixel units.\n        var value = visualElement.getValue(key);\n        setAndResetVelocity(value, positionalValues[key](originBbox, originComputedStyle));\n        target[key] = positionalValues[key](targetBbox, elementComputedStyle);\n    });\n    return target;\n};\nvar checkAndConvertChangedValueTypes = function (visualElement, target, origin, transitionEnd) {\n    if (origin === void 0) { origin = {}; }\n    if (transitionEnd === void 0) { transitionEnd = {}; }\n    target = __assign({}, target);\n    transitionEnd = __assign({}, transitionEnd);\n    var targetPositionalKeys = Object.keys(target).filter(isPositionalKey);\n    // We want to remove any transform values that could affect the element's bounding box before\n    // it's measured. We'll reapply these later.\n    var removedTransformValues = [];\n    var hasAttemptedToRemoveTransformValues = false;\n    var changedValueTypeKeys = [];\n    targetPositionalKeys.forEach(function (key) {\n        var value = visualElement.getValue(key);\n        if (!visualElement.hasValue(key))\n            return;\n        var from = origin[key];\n        var to = target[key];\n        var fromType = findDimensionValueType(from);\n        var toType;\n        // TODO: The current implementation of this basically throws an error\n        // if you try and do value conversion via keyframes. There's probably\n        // a way of doing this but the performance implications would need greater scrutiny,\n        // as it'd be doing multiple resize-remeasure operations.\n        if (isKeyframesTarget(to)) {\n            var numKeyframes = to.length;\n            for (var i = to[0] === null ? 1 : 0; i < numKeyframes; i++) {\n                if (!toType) {\n                    toType = findDimensionValueType(to[i]);\n                    invariant(toType === fromType ||\n                        (isNumOrPxType(fromType) && isNumOrPxType(toType)), \"Keyframes must be of the same dimension as the current value\");\n                }\n                else {\n                    invariant(findDimensionValueType(to[i]) === toType, \"All keyframes must be of the same type\");\n                }\n            }\n        }\n        else {\n            toType = findDimensionValueType(to);\n        }\n        if (fromType !== toType) {\n            // If they're both just number or px, convert them both to numbers rather than\n            // relying on resize/remeasure to convert (which is wasteful in this situation)\n            if (isNumOrPxType(fromType) && isNumOrPxType(toType)) {\n                var current = value.get();\n                if (typeof current === \"string\") {\n                    value.set(parseFloat(current));\n                }\n                if (typeof to === \"string\") {\n                    target[key] = parseFloat(to);\n                }\n                else if (Array.isArray(to) && toType === px) {\n                    target[key] = to.map(parseFloat);\n                }\n            }\n            else if ((fromType === null || fromType === void 0 ? void 0 : fromType.transform) && (toType === null || toType === void 0 ? void 0 : toType.transform) &&\n                (from === 0 || to === 0)) {\n                // If one or the other value is 0, it's safe to coerce it to the\n                // type of the other without measurement\n                if (from === 0) {\n                    value.set(toType.transform(from));\n                }\n                else {\n                    target[key] = fromType.transform(to);\n                }\n            }\n            else {\n                // If we're going to do value conversion via DOM measurements, we first\n                // need to remove non-positional transform values that could affect the bbox measurements.\n                if (!hasAttemptedToRemoveTransformValues) {\n                    removedTransformValues = removeNonTranslationalTransform(visualElement);\n                    hasAttemptedToRemoveTransformValues = true;\n                }\n                changedValueTypeKeys.push(key);\n                transitionEnd[key] =\n                    transitionEnd[key] !== undefined\n                        ? transitionEnd[key]\n                        : target[key];\n                setAndResetVelocity(value, to);\n            }\n        }\n    });\n    if (changedValueTypeKeys.length) {\n        var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);\n        // If we removed transform values, reapply them before the next render\n        if (removedTransformValues.length) {\n            removedTransformValues.forEach(function (_a) {\n                var _b = __read(_a, 2), key = _b[0], value = _b[1];\n                visualElement.getValue(key).set(value);\n            });\n        }\n        // Reapply original values\n        visualElement.render();\n        return { target: convertedTarget, transitionEnd: transitionEnd };\n    }\n    else {\n        return { target: target, transitionEnd: transitionEnd };\n    }\n};\n/**\n * Convert value types for x/y/width/height/top/left/bottom/right\n *\n * Allows animation between `'auto'` -> `'100%'` or `0` -> `'calc(50% - 10vw)'`\n *\n * @internal\n */\nfunction unitConversion(visualElement, target, origin, transitionEnd) {\n    return hasPositionalKey(target)\n        ? checkAndConvertChangedValueTypes(visualElement, target, origin, transitionEnd)\n        : { target: target, transitionEnd: transitionEnd };\n}\n\n/**\n * Parse a DOM variant to make it animatable. This involves resolving CSS variables\n * and ensuring animations like \"20%\" => \"calc(50vw)\" are performed in pixels.\n */\nvar parseDomVariant = function (visualElement, target, origin, transitionEnd) {\n    var resolved = resolveCSSVariables(visualElement, target, transitionEnd);\n    target = resolved.target;\n    transitionEnd = resolved.transitionEnd;\n    return unitConversion(visualElement, target, origin, transitionEnd);\n};\n\n/**\n * A VisualElement for HTMLElements\n */\nvar HTMLVisualElement = /** @class */ (function (_super) {\n    __extends(HTMLVisualElement, _super);\n    function HTMLVisualElement() {\n        var _this = _super !== null && _super.apply(this, arguments) || this;\n        /**\n         *\n         */\n        _this.defaultConfig = {\n            enableHardwareAcceleration: true,\n            allowTransformNone: true,\n        };\n        /**\n         * A mutable record of styles we want to apply directly to the rendered Element\n         * every frame. We use a mutable data structure to reduce GC during animations.\n         */\n        _this.style = {};\n        /**\n         * A record of styles we only want to apply via React. This gets set in useMotionValues\n         * and applied in the render function. I'd prefer this to live somewhere else to decouple\n         * VisualElement from React but works for now.\n         */\n        _this.reactStyle = {};\n        /**\n         * A mutable record of CSS variables we want to apply directly to the rendered Element\n         * every frame. We use a mutable data structure to reduce GC during animations.\n         */\n        _this.vars = {};\n        /**\n         * A mutable record of transforms we want to apply directly to the rendered Element\n         * every frame. We use a mutable data structure to reduce GC during animations.\n         */\n        _this.transform = {};\n        /**\n         * A mutable record of transform origins we want to apply directly to the rendered Element\n         * every frame. We use a mutable data structure to reduce GC during animations.\n         */\n        _this.transformOrigin = {};\n        /**\n         * A mutable record of transform keys we want to apply to the rendered Element. We order\n         * this to order transforms in the desired order. We use a mutable data structure to reduce GC during animations.\n         */\n        _this.transformKeys = [];\n        _this.config = _this.defaultConfig;\n        /**\n         * ========================================\n         * Layout\n         * ========================================\n         */\n        _this.isLayoutProjectionEnabled = false;\n        /**\n         * A set of layout update event handlers. These are only called once all layouts have been read,\n         * making it safe to perform DOM write operations.\n         */\n        _this.layoutUpdateListeners = new SubscriptionManager();\n        _this.layoutMeasureListeners = new SubscriptionManager();\n        _this.viewportBoxUpdateListeners = new SubscriptionManager();\n        /**\n         * Keep track of whether the viewport box has been updated since the last render.\n         * If it has, we want to fire the onViewportBoxUpdate listener.\n         */\n        _this.hasViewportBoxUpdated = false;\n        /**\n         * The visual target we want to project our component into on a given frame\n         * before applying transforms defined in `animate` or `style`.\n         *\n         * This is considered mutable to avoid object creation on each frame.\n         */\n        _this.targetBoxFinal = axisBox();\n        /**\n         * The overall scale of the local coordinate system as transformed by all parents\n         * of this component. We use this for scale correction on our calculated layouts\n         * and scale-affected values like `boxShadow`.\n         *\n         * This is considered mutable to avoid object creation on each frame.\n         */\n        _this.treeScale = { x: 1, y: 1 };\n        _this.prevTreeScale = { x: 1, y: 1 };\n        /**\n         * The delta between the boxCorrected and the desired\n         * targetBox (before user-set transforms are applied). The calculated output will be\n         * handed to the renderer and used as part of the style correction calculations, for\n         * instance calculating how to display the desired border-radius correctly.\n         *\n         * This is considered mutable to avoid object creation on each frame.\n         */\n        _this.delta = delta();\n        /**\n         * The delta between the boxCorrected and the desired targetBoxFinal. The calculated\n         * output will be handed to the renderer and used to project the boxCorrected into\n         * the targetBoxFinal.\n         *\n         * This is considered mutable to avoid object creation on each frame.\n         */\n        _this.deltaFinal = delta();\n        /**\n         * The computed transform string to apply deltaFinal to the element. Currently this is only\n         * being used to diff and decide whether to render on the current frame, but a minor optimisation\n         * could be to provide this to the buildHTMLStyle function.\n         */\n        _this.deltaTransform = identityProjection;\n        /**\n         *\n         */\n        _this.stopLayoutAxisAnimation = {\n            x: function () { },\n            y: function () { },\n        };\n        _this.isTargetBoxLocked = false;\n        /**\n         *\n         */\n        _this.axisProgress = {\n            x: motionValue(0),\n            y: motionValue(0),\n        };\n        _this.updateLayoutDelta = function () {\n            _this.isLayoutProjectionEnabled && _this.box && _this.updateLayoutDeltas();\n            /**\n             * Ensure all children layouts are also updated.\n             *\n             * This uses a pre-bound function executor rather than a lamda to avoid creating a new function\n             * multiple times per frame (source of mid-animation GC)\n             */\n            _this.children.forEach(fireUpdateLayoutDelta);\n        };\n        return _this;\n    }\n    /**\n     * When a value is removed, we want to make sure it's removed from all rendered data structures.\n     */\n    HTMLVisualElement.prototype.removeValue = function (key) {\n        _super.prototype.removeValue.call(this, key);\n        delete this.vars[key];\n        delete this.style[key];\n    };\n    /**\n     * Empty the mutable data structures by re-creating them. We can do this every React render\n     * as the comparative workload to the rest of the render is very low and this is also when\n     * we want to reflect values that might have been removed by the render.\n     */\n    HTMLVisualElement.prototype.clean = function () {\n        this.style = {};\n        this.vars = {};\n        this.transform = {};\n    };\n    HTMLVisualElement.prototype.updateConfig = function (config) {\n        if (config === void 0) { config = {}; }\n        this.config = __assign(__assign({}, this.defaultConfig), config);\n    };\n    /**\n     * Read a value directly from the HTMLElement style.\n     */\n    HTMLVisualElement.prototype.read = function (key) {\n        return this.getComputedStyle()[key] || 0;\n    };\n    HTMLVisualElement.prototype.addValue = function (key, value) {\n        _super.prototype.addValue.call(this, key, value);\n        // If we have rotate values we want to foce the layoutOrigin used in layout projection\n        // to the center of the element.\n        if (key.startsWith(\"rotate\"))\n            this.layoutOrigin = 0.5;\n    };\n    /**\n     * Read a value directly from the HTMLElement in case it's not defined by a Motion\n     * prop. If it's a transform, we just return a pre-defined default value as reading these\n     * out of a matrix is either error-prone or can incur a big payload for little benefit.\n     */\n    HTMLVisualElement.prototype.readNativeValue = function (key) {\n        if (isTransformProp(key)) {\n            var defaultValueType = getDefaultValueType(key);\n            return defaultValueType ? defaultValueType.default || 0 : 0;\n        }\n        else {\n            return this.read(key);\n        }\n    };\n    /**\n     * Ensure that HTML and Framer-specific value types like `px`->`%` and `Color`\n     * can be animated by Motion.\n     */\n    HTMLVisualElement.prototype.makeTargetAnimatable = function (_a, parseDOMValues) {\n        if (parseDOMValues === void 0) { parseDOMValues = true; }\n        var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, [\"transition\", \"transitionEnd\"]);\n        var transformValues = this.config.transformValues;\n        var origin = getOrigin(target, transition || {}, this);\n        /**\n         * If Framer has provided a function to convert `Color` etc value types, convert them\n         */\n        if (transformValues) {\n            if (transitionEnd)\n                transitionEnd = transformValues(transitionEnd);\n            if (target)\n                target = transformValues(target);\n            if (origin)\n                origin = transformValues(origin);\n        }\n        if (parseDOMValues) {\n            checkTargetForNewValues(this, target, origin);\n            var parsed = parseDomVariant(this, target, origin, transitionEnd);\n            transitionEnd = parsed.transitionEnd;\n            target = parsed.target;\n        }\n        return __assign({ transition: transition,\n            transitionEnd: transitionEnd }, target);\n    };\n    HTMLVisualElement.prototype.enableLayoutProjection = function () {\n        this.isLayoutProjectionEnabled = true;\n    };\n    HTMLVisualElement.prototype.hide = function () {\n        if (this.isVisible === false)\n            return;\n        this.isVisible = false;\n        this.scheduleRender();\n    };\n    HTMLVisualElement.prototype.show = function () {\n        if (this.isVisible === true)\n            return;\n        this.isVisible = true;\n        this.scheduleRender();\n    };\n    /**\n     * Register an event listener to fire when the layout is updated. We might want to expose support\n     * for this via a `motion` prop.\n     */\n    HTMLVisualElement.prototype.onLayoutUpdate = function (callback) {\n        return this.layoutUpdateListeners.add(callback);\n    };\n    HTMLVisualElement.prototype.onLayoutMeasure = function (callback) {\n        return this.layoutMeasureListeners.add(callback);\n    };\n    HTMLVisualElement.prototype.onViewportBoxUpdate = function (callback) {\n        return this.viewportBoxUpdateListeners.add(callback);\n    };\n    /**\n     * To be called when all layouts are successfully updated. In turn we can notify layoutUpdate\n     * subscribers.\n     */\n    HTMLVisualElement.prototype.layoutReady = function (config) {\n        this.layoutUpdateListeners.notify(this.box, this.prevViewportBox || this.box, config);\n    };\n    /**\n     * Measure and return the Element's bounding box. We convert it to a AxisBox2D\n     * structure to make it easier to work on each individual axis generically.\n     */\n    HTMLVisualElement.prototype.getBoundingBox = function () {\n        var transformPagePoint = this.config.transformPagePoint;\n        return getBoundingBox(this.element, transformPagePoint);\n    };\n    HTMLVisualElement.prototype.getBoundingBoxWithoutTransforms = function () {\n        var bbox = this.getBoundingBox();\n        removeBoxTransforms(bbox, this.latest);\n        return bbox;\n    };\n    /**\n     * Return the computed style after a render.\n     */\n    HTMLVisualElement.prototype.getComputedStyle = function () {\n        return window.getComputedStyle(this.element);\n    };\n    /**\n     * Record the bounding box as it exists before a re-render.\n     */\n    HTMLVisualElement.prototype.snapshotBoundingBox = function () {\n        this.prevViewportBox = this.getBoundingBoxWithoutTransforms();\n        /**\n         * Update targetBox to match the prevViewportBox. This is just to ensure\n         * that targetBox is affected by scroll in the same way as the measured box\n         */\n        this.rebaseTargetBox(false, this.prevViewportBox);\n    };\n    HTMLVisualElement.prototype.rebaseTargetBox = function (force, box) {\n        var _this = this;\n        if (force === void 0) { force = false; }\n        if (box === void 0) { box = this.box; }\n        var _a = this.axisProgress, x = _a.x, y = _a.y;\n        var shouldRebase = this.box &&\n            !this.isTargetBoxLocked &&\n            !x.isAnimating() &&\n            !y.isAnimating();\n        if (force || shouldRebase) {\n            eachAxis(function (axis) {\n                var _a = box[axis], min = _a.min, max = _a.max;\n                _this.setAxisTarget(axis, min, max);\n            });\n        }\n    };\n    HTMLVisualElement.prototype.measureLayout = function () {\n        var _this = this;\n        this.box = this.getBoundingBox();\n        this.boxCorrected = copyAxisBox(this.box);\n        if (!this.targetBox)\n            this.targetBox = copyAxisBox(this.box);\n        this.layoutMeasureListeners.notify(this.box, this.prevViewportBox || this.box);\n        sync.update(function () { return _this.rebaseTargetBox(); });\n    };\n    HTMLVisualElement.prototype.lockTargetBox = function () {\n        this.isTargetBoxLocked = true;\n    };\n    HTMLVisualElement.prototype.unlockTargetBox = function () {\n        this.stopLayoutAnimation();\n        this.isTargetBoxLocked = false;\n    };\n    /**\n     * Reset the transform on the current Element. This is called as part\n     * of a batched process across the entire layout tree. To remove this write\n     * cycle it'd be interesting to see if it's possible to \"undo\" all the current\n     * layout transforms up the tree in the same way this.getBoundingBoxWithoutTransforms\n     * works\n     */\n    HTMLVisualElement.prototype.resetTransform = function () {\n        var transformTemplate = this.config.transformTemplate;\n        this.element.style.transform = transformTemplate\n            ? transformTemplate({}, \"\")\n            : \"none\";\n        // Ensure that whatever happens next, we restore our transform\n        this.scheduleRender();\n    };\n    /**\n     * Set new min/max boundaries to project an axis into\n     */\n    HTMLVisualElement.prototype.setAxisTarget = function (axis, min, max) {\n        var targetAxis = this.targetBox[axis];\n        targetAxis.min = min;\n        targetAxis.max = max;\n        // Flag that we want to fire the onViewportBoxUpdate event handler\n        this.hasViewportBoxUpdated = true;\n        this.rootParent.scheduleUpdateLayoutDelta();\n    };\n    /**\n     *\n     */\n    HTMLVisualElement.prototype.startLayoutAxisAnimation = function (axis, transition) {\n        var _this = this;\n        var _a;\n        var progress = this.axisProgress[axis];\n        var _b = this.targetBox[axis], min = _b.min, max = _b.max;\n        var length = max - min;\n        progress.clearListeners();\n        progress.set(min);\n        progress.set(min); // Set twice to hard-reset velocity\n        progress.onChange(function (v) { return _this.setAxisTarget(axis, v, v + length); });\n        return (_a = this.animateMotionValue) === null || _a === void 0 ? void 0 : _a.call(this, axis, progress, 0, transition);\n    };\n    HTMLVisualElement.prototype.stopLayoutAnimation = function () {\n        var _this = this;\n        eachAxis(function (axis) { return _this.axisProgress[axis].stop(); });\n    };\n    /**\n     * Update the layout deltas to reflect the relative positions of the layout\n     * and the desired target box\n     */\n    HTMLVisualElement.prototype.updateLayoutDeltas = function () {\n        /**\n         * Reset the corrected box with the latest values from box, as we're then going\n         * to perform mutative operations on it.\n         */\n        resetBox(this.boxCorrected, this.box);\n        /**\n         * If this component has a parent, update this treeScale by incorporating the parent's\n         * delta into its treeScale.\n         */\n        if (this.parent) {\n            this.prevTreeScale.x = this.treeScale.x;\n            this.prevTreeScale.y = this.treeScale.y;\n            updateTreeScale(this.treeScale, this.parent.treeScale, this.parent.delta);\n        }\n        /**\n         * Apply all the parent deltas to this box to produce the corrected box. This\n         * is the layout box, as it will appear on screen as a result of the transforms of its parents.\n         */\n        applyTreeDeltas(this.boxCorrected, this.treePath);\n        /**\n         * Update the delta between the corrected box and the target box before user-set transforms were applied.\n         * This will allow us to calculate the corrected borderRadius and boxShadow to compensate\n         * for our layout reprojection, but still allow them to be scaled correctly by the user.\n         * It might be that to simplify this we may want to accept that user-set scale is also corrected\n         * and we wouldn't have to keep and calc both deltas, OR we could support a user setting\n         * to allow people to choose whether these styles are corrected based on just the\n         * layout reprojection or the final bounding box.\n         */\n        updateBoxDelta(this.delta, this.boxCorrected, this.targetBox, this.layoutOrigin);\n        /**\n         * If we have a listener for the viewport box, fire it.\n         */\n        this.hasViewportBoxUpdated &&\n            this.viewportBoxUpdateListeners.notify(this.targetBox, this.delta);\n        this.hasViewportBoxUpdated = false;\n        /**\n         * Ensure this element renders on the next frame if the projection transform has changed.\n         */\n        var deltaTransform = buildLayoutProjectionTransform(this.delta, this.treeScale);\n        if (deltaTransform !== this.deltaTransform ||\n            // Also compare calculated treeScale, for values that rely on only this for scale correction.\n            this.prevTreeScale.x !== this.treeScale.x ||\n            this.prevTreeScale.y !== this.treeScale.y) {\n            this.scheduleRender();\n        }\n        this.deltaTransform = deltaTransform;\n    };\n    HTMLVisualElement.prototype.updateTransformDeltas = function () {\n        if (!this.isLayoutProjectionEnabled || !this.box)\n            return;\n        /**\n         * Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal.\n         * This is the final box that we will then project into by calculating a transform delta and\n         * applying it to the corrected box.\n         */\n        applyBoxTransforms(this.targetBoxFinal, this.targetBox, this.latest);\n        /**\n         * Update the delta between the corrected box and the final target box, after\n         * user-set transforms are applied to it. This will be used by the renderer to\n         * create a transform style that will reproject the element from its actual layout\n         * into the desired bounding box.\n         */\n        updateBoxDelta(this.deltaFinal, this.boxCorrected, this.targetBoxFinal, this.layoutOrigin);\n    };\n    /**\n     * ========================================\n     * Build & render\n     * ========================================\n     */\n    /**\n     * Build a style prop using the latest resolved MotionValues\n     */\n    HTMLVisualElement.prototype.build = function () {\n        this.updateTransformDeltas();\n        if (this.isVisible !== undefined) {\n            this.style.visibility = this.isVisible ? \"visible\" : \"hidden\";\n        }\n        buildHTMLStyles(this.latest, this.style, this.vars, this.transform, this.transformOrigin, this.transformKeys, this.config, this.isLayoutProjectionEnabled && !!this.box, this.delta, this.deltaFinal, this.treeScale, this.targetBoxFinal);\n    };\n    /**\n     * Render the Element by rebuilding and applying the latest styles and vars.\n     */\n    HTMLVisualElement.prototype.render = function () {\n        // Rebuild the latest animated values into style and vars caches.\n        this.build();\n        // Directly assign style into the Element's style prop. In tests Object.assign is the\n        // fastest way to assign styles.\n        Object.assign(this.element.style, this.style);\n        // Loop over any CSS variables and assign those.\n        for (var key in this.vars) {\n            this.element.style.setProperty(key, this.vars[key]);\n        }\n    };\n    return HTMLVisualElement;\n}(VisualElement));\n/**\n * Pre-bound version of updateLayoutDelta so we're not creating a new function multiple\n * times per frame.\n */\nvar fireUpdateLayoutDelta = function (child) {\n    return child.updateLayoutDelta();\n};\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 */\nfunction useConstant(init) {\n    var ref = useRef(null);\n    if (ref.current === null) {\n        ref.current = init();\n    }\n    return ref.current;\n}\n\nfunction calcOrigin$1(origin, offset, size) {\n    return typeof origin === \"string\"\n        ? origin\n        : px.transform(offset + size * origin);\n}\n/**\n * The SVG transform origin defaults are different to CSS and is less intuitive,\n * so we use the measured dimensions of the SVG to reconcile these.\n */\nfunction calcSVGTransformOrigin(dimensions, originX, originY) {\n    var pxOriginX = calcOrigin$1(originX, dimensions.x, dimensions.width);\n    var pxOriginY = calcOrigin$1(originY, dimensions.y, dimensions.height);\n    return pxOriginX + \" \" + pxOriginY;\n}\n\n// Convert a progress 0-1 to a pixels value based on the provided length\nvar progressToPixels = function (progress, length) {\n    return px.transform(progress * length);\n};\nvar dashKeys = {\n    offset: \"stroke-dashoffset\",\n    array: \"stroke-dasharray\",\n};\nvar camelKeys = {\n    offset: \"strokeDashoffset\",\n    array: \"strokeDasharray\",\n};\n/**\n * Build SVG path properties. Uses the path's measured length to convert\n * our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset\n * and stroke-dasharray attributes.\n *\n * This function is mutative to reduce per-frame GC.\n */\nfunction buildSVGPath(attrs, totalLength, length, spacing, offset, useDashCase) {\n    if (spacing === void 0) { spacing = 1; }\n    if (offset === void 0) { offset = 0; }\n    if (useDashCase === void 0) { useDashCase = true; }\n    // We use dash case when setting attributes directly to the DOM node and camel case\n    // when defining props on a React component.\n    var keys = useDashCase ? dashKeys : camelKeys;\n    // Build the dash offset\n    attrs[keys.offset] = progressToPixels(-offset, totalLength);\n    // Build the dash array\n    var pathLength = progressToPixels(length, totalLength);\n    var pathSpacing = progressToPixels(spacing, totalLength);\n    attrs[keys.array] = pathLength + \" \" + pathSpacing;\n}\n\nvar unmeasured = { x: 0, y: 0, width: 0, height: 0 };\n/**\n * Build SVG visual attrbutes, like cx and style.transform\n */\nfunction buildSVGAttrs(_a, style, vars, attrs, transform, transformOrigin, transformKeys, config, dimensions, totalPathLength, isLayoutProjectionEnabled, delta, deltaFinal, treeScale, targetBox) {\n    var attrX = _a.attrX, attrY = _a.attrY, originX = _a.originX, originY = _a.originY, pathLength = _a.pathLength, _b = _a.pathSpacing, pathSpacing = _b === void 0 ? 1 : _b, _c = _a.pathOffset, pathOffset = _c === void 0 ? 0 : _c, \n    // This is object creation, which we try to avoid per-frame.\n    latest = __rest(_a, [\"attrX\", \"attrY\", \"originX\", \"originY\", \"pathLength\", \"pathSpacing\", \"pathOffset\"]);\n    /**\n     * With SVG we treat all animated values as attributes rather than CSS, so we build into attrs\n     */\n    buildHTMLStyles(latest, attrs, vars, transform, transformOrigin, transformKeys, config, isLayoutProjectionEnabled, delta, deltaFinal, treeScale, targetBox);\n    /**\n     * However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs\n     * and copy it into style.\n     */\n    if (attrs.transform) {\n        style.transform = attrs.transform;\n        delete attrs.transform;\n    }\n    // Parse transformOrigin\n    if (originX !== undefined || originY !== undefined || style.transform) {\n        style.transformOrigin = calcSVGTransformOrigin(dimensions || unmeasured, originX !== undefined ? originX : 0.5, originY !== undefined ? originY : 0.5);\n    }\n    // Treat x/y not as shortcuts but as actual attributes\n    if (attrX !== undefined)\n        attrs.x = attrX;\n    if (attrY !== undefined)\n        attrs.y = attrY;\n    // Build SVG path if one has been measured\n    if (totalPathLength !== undefined && pathLength !== undefined) {\n        buildSVGPath(attrs, totalPathLength, pathLength, pathSpacing, pathOffset, false);\n    }\n    return attrs;\n}\n\n/**\n * A set of attribute names that are always read/written as camel case.\n */\nvar camelCaseAttributes = new Set([\n    \"baseFrequency\",\n    \"diffuseConstant\",\n    \"kernelMatrix\",\n    \"kernelUnitLength\",\n    \"keySplines\",\n    \"keyTimes\",\n    \"limitingConeAngle\",\n    \"markerHeight\",\n    \"markerWidth\",\n    \"numOctaves\",\n    \"targetX\",\n    \"targetY\",\n    \"surfaceScale\",\n    \"specularConstant\",\n    \"specularExponent\",\n    \"stdDeviation\",\n    \"tableValues\",\n    \"viewBox\",\n]);\n\nvar CAMEL_CASE_PATTERN = /([a-z])([A-Z])/g;\nvar REPLACE_TEMPLATE = \"$1-$2\";\n/**\n * Convert camelCase to dash-case properties.\n */\nvar camelToDash = function (str) {\n    return str.replace(CAMEL_CASE_PATTERN, REPLACE_TEMPLATE).toLowerCase();\n};\n\n/**\n * A VisualElement for SVGElements. Inherits from and extends HTMLVisualElement as the two\n * share data structures.\n */\nvar SVGVisualElement = /** @class */ (function (_super) {\n    __extends(SVGVisualElement, _super);\n    function SVGVisualElement() {\n        var _this = _super !== null && _super.apply(this, arguments) || this;\n        /**\n         * A mutable record of attributes we want to apply directly to the rendered Element\n         * every frame. We use a mutable data structure to reduce GC during animations.\n         */\n        _this.attrs = {};\n        /**\n         * We disable hardware acceleration for SVG transforms as they're not currently able to be accelerated.\n         */\n        _this.defaultConfig = {\n            enableHardwareAcceleration: false,\n        };\n        /**\n         * Without duplicating this call from HTMLVisualElement we end up with HTMLVisualElement.defaultConfig\n         * being assigned to config\n         */\n        _this.config = _this.defaultConfig;\n        return _this;\n    }\n    /**\n     * Measure the SVG element on mount. This can affect page rendering so there might be a\n     * better time to perform this - for instance dynamically only if there's a transform-origin dependent\n     * transform being set (like rotate)\n     */\n    SVGVisualElement.prototype.mount = function (element) {\n        _super.prototype.mount.call(this, element);\n        this.measure();\n    };\n    /**\n     * Update the SVG dimensions and path length\n     */\n    SVGVisualElement.prototype.measure = function () {\n        try {\n            this.dimensions =\n                typeof this.element.getBBox ===\n                    \"function\"\n                    ? this.element.getBBox()\n                    : this.element.getBoundingClientRect();\n        }\n        catch (e) {\n            // Most likely trying to measure an unrendered element under Firefox\n            this.dimensions = { x: 0, y: 0, width: 0, height: 0 };\n        }\n        if (isPath(this.element)) {\n            this.totalPathLength = this.element.getTotalLength();\n        }\n    };\n    /**\n     * Empty the mutable data structures in case attrs have been removed between renders.\n     */\n    SVGVisualElement.prototype.clean = function () {\n        _super.prototype.clean.call(this);\n        this.attrs = {};\n    };\n    /**\n     * Read an attribute directly from the SVGElement\n     */\n    SVGVisualElement.prototype.read = function (key) {\n        key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;\n        return this.element.getAttribute(key);\n    };\n    SVGVisualElement.prototype.build = function () {\n        this.updateTransformDeltas();\n        buildSVGAttrs(this.latest, this.style, this.vars, this.attrs, this.transform, this.transformOrigin, this.transformKeys, this.config, this.dimensions, this.totalPathLength, this.isLayoutProjectionEnabled && !!this.box, this.delta, this.deltaFinal, this.treeScale, this.targetBoxFinal);\n    };\n    SVGVisualElement.prototype.render = function () {\n        // Update HTML styles and CSS variables\n        _super.prototype.render.call(this);\n        // Loop through attributes and apply them to the SVGElement\n        for (var key in this.attrs) {\n            this.element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, this.attrs[key]);\n        }\n    };\n    return SVGVisualElement;\n}(HTMLVisualElement));\nfunction isPath(element) {\n    return element.tagName === \"path\";\n}\n\n/**\n * @internal\n */\n/**\n * @internal\n */\nvar svgElements = [\n    \"animate\",\n    \"circle\",\n    \"clipPath\",\n    \"defs\",\n    \"desc\",\n    \"ellipse\",\n    \"feBlend\",\n    \"feColorMatrix\",\n    \"feComponentTransfer\",\n    \"feComposite\",\n    \"feConvolveMatrix\",\n    \"feDiffuseLighting\",\n    \"feDisplacementMap\",\n    \"feDistantLight\",\n    \"feDropShadow\",\n    \"feFlood\",\n    \"feFuncA\",\n    \"feFuncB\",\n    \"feFuncG\",\n    \"feFuncR\",\n    \"feGaussianBlur\",\n    \"feImage\",\n    \"feMerge\",\n    \"feMergeNode\",\n    \"feMorphology\",\n    \"feOffset\",\n    \"fePointLight\",\n    \"feSpecularLighting\",\n    \"feSpotLight\",\n    \"feTile\",\n    \"feTurbulence\",\n    \"filter\",\n    \"foreignObject\",\n    \"g\",\n    \"image\",\n    \"line\",\n    \"linearGradient\",\n    \"marker\",\n    \"mask\",\n    \"metadata\",\n    \"path\",\n    \"pattern\",\n    \"polygon\",\n    \"polyline\",\n    \"radialGradient\",\n    \"rect\",\n    \"stop\",\n    \"svg\",\n    \"switch\",\n    \"symbol\",\n    \"text\",\n    \"textPath\",\n    \"tspan\",\n    \"use\",\n    \"view\",\n];\n\nvar svgTagNames = new Set(svgElements);\n/**\n * Determine whether this is a HTML or SVG component based on if the provided\n * Component is a string and a recognised SVG tag. A potentially better way to\n * do this would be to offer a `motion.customSVG` function and determine this\n * when we generate the `motion.circle` etc components.\n */\nfunction isSVGComponent(Component) {\n    return typeof Component === \"string\" && svgTagNames.has(Component);\n}\n\n/**\n * @public\n */\nvar PresenceContext = createContext(null);\n\nvar MotionContext = createContext({\n    variantContext: {},\n});\nfunction useVariantContext() {\n    return useContext(MotionContext).variantContext;\n}\nfunction useVisualElementContext() {\n    return useContext(MotionContext).visualElement;\n}\n\n/**\n * DOM-flavoured variation of the useVisualElement hook. Used to create either a HTMLVisualElement\n * or SVGVisualElement for the component.\n *\n */\nvar useDomVisualElement = function (Component, props, isStatic, ref) {\n    var parent = useVisualElementContext();\n    var visualElement = useConstant(function () {\n        var DOMVisualElement = isSVGComponent(Component)\n            ? SVGVisualElement\n            : HTMLVisualElement;\n        return new DOMVisualElement(parent, ref);\n    });\n    visualElement.updateConfig(__assign(__assign(__assign({}, visualElement.config), { enableHardwareAcceleration: !isStatic }), props));\n    visualElement.layoutId = props.layoutId;\n    var presenceContext = useContext(PresenceContext);\n    /**\n     * Update VisualElement with presence data.\n     */\n    var isPresent = presenceContext === null ? true : presenceContext.isPresent;\n    visualElement.isPresent =\n        props.isPresent !== undefined ? props.isPresent : isPresent;\n    /**\n     *\n     */\n    var presenceId = presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.id;\n    visualElement.isPresenceRoot = !parent || parent.presenceId !== presenceId;\n    /**\n     * TODO: Investigate if we need this\n     */\n    useEffect(function () {\n        if (props.onViewportBoxUpdate) {\n            return visualElement.onViewportBoxUpdate(props.onViewportBoxUpdate);\n        }\n    }, [props.onViewportBoxUpdate]);\n    return visualElement;\n};\n\n/**\n * A list of all valid MotionProps.\n *\n * @internalremarks\n * This doesn't throw if a `MotionProp` name is missing - it should.\n */\nvar validMotionProps = new Set([\n    \"initial\",\n    \"animate\",\n    \"exit\",\n    \"style\",\n    \"variants\",\n    \"transition\",\n    \"transformTemplate\",\n    \"transformValues\",\n    \"custom\",\n    \"inherit\",\n    \"layout\",\n    \"layoutId\",\n    \"onLayoutAnimationComplete\",\n    \"onViewportBoxUpdate\",\n    \"onAnimationStart\",\n    \"onAnimationComplete\",\n    \"onUpdate\",\n    \"onDragStart\",\n    \"onDrag\",\n    \"onDragEnd\",\n    \"onMeasureDragConstraints\",\n    \"onDirectionLock\",\n    \"onDragTransitionEnd\",\n    \"drag\",\n    \"dragControls\",\n    \"dragListener\",\n    \"dragConstraints\",\n    \"dragDirectionLock\",\n    \"_dragX\",\n    \"_dragY\",\n    \"dragElastic\",\n    \"dragMomentum\",\n    \"dragPropagation\",\n    \"dragTransition\",\n    \"onPan\",\n    \"onPanStart\",\n    \"onPanEnd\",\n    \"onPanSessionStart\",\n    \"onTap\",\n    \"onTapStart\",\n    \"onTapCancel\",\n    \"whileHover\",\n    \"whileTap\",\n    \"onHoverEnd\",\n    \"onHoverStart\",\n]);\n/**\n * Check whether a prop name is a valid `MotionProp` key.\n *\n * @param key - Name of the property to check\n * @returns `true` is key is a valid `MotionProp`.\n *\n * @public\n */\nfunction isValidMotionProp(key) {\n    return validMotionProps.has(key);\n}\n\nvar isPropValid = function (key) { return !isValidMotionProp(key); };\n/**\n * Emotion and Styled Components both allow users to pass through arbitrary props to their components\n * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which\n * of these should be passed to the underlying DOM node.\n *\n * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props\n * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props\n * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of\n * `@emotion/is-prop-valid`, however to fix this problem we need to use it.\n *\n * By making it an optionalDependency we can offer this functionality only in the situations where it's\n * actually required.\n */\ntry {\n    var emotionIsPropValid_1 = require(\"@emotion/is-prop-valid\").default;\n    isPropValid = function (key) {\n        // Handle events explicitly as Emotion validates them all as true\n        if (key.startsWith(\"on\")) {\n            return !isValidMotionProp(key);\n        }\n        else {\n            return emotionIsPropValid_1(key);\n        }\n    };\n}\ncatch (_a) {\n    // We don't need to actually do anything here - the fallback is the existing `isPropValid`.\n}\nfunction filterProps(props) {\n    var domProps = {};\n    for (var key in props) {\n        if (isPropValid(key))\n            domProps[key] = props[key];\n    }\n    return domProps;\n}\n\nfunction buildHTMLProps(visualElement, _a) {\n    var drag = _a.drag;\n    // The `any` isn't ideal but it is the type of createElement props argument\n    var htmlProps = {\n        style: __assign(__assign(__assign({}, visualElement.reactStyle), visualElement.style), visualElement.vars),\n    };\n    if (!!drag) {\n        // Disable the ghost element when a user drags\n        htmlProps.draggable = false;\n        // Disable text selection\n        htmlProps.style.userSelect = \"none\";\n        // Disable scrolling on the draggable direction\n        htmlProps.style.touchAction =\n            drag === true ? \"none\" : \"pan-\" + (drag === \"x\" ? \"y\" : \"x\");\n    }\n    return htmlProps;\n}\n\n/**\n * Build React props for SVG elements\n */\nfunction buildSVGProps(visualElement) {\n    return __assign(__assign({}, visualElement.attrs), { style: __assign({}, visualElement.reactStyle) });\n}\n\nfunction render(Component, props, visualElement) {\n    // Only filter props from components we control, ie `motion.div`. If this\n    // is a custom component pass along everything provided to it.\n    var forwardedProps = typeof Component === \"string\" ? filterProps(props) : props;\n    /**\n     * Every render, empty and rebuild the animated values to be applied to our Element.\n     * During animation these data structures are used in a mutable fashion to reduce\n     * garbage collection, but between renders we can flush them to remove values\n     * that might have been taken out of the provided props.\n     */\n    visualElement.clean();\n    visualElement.build();\n    // Generate props to visually render this component\n    var visualProps = isSVGComponent(Component)\n        ? buildSVGProps(visualElement)\n        : buildHTMLProps(visualElement, props);\n    return createElement(Component, __assign(__assign(__assign({}, forwardedProps), { ref: visualElement.ref }), visualProps));\n}\n\nvar isMotionValue = function (value) {\n    return value instanceof MotionValue;\n};\n\nfunction isForcedMotionValue(key, _a) {\n    var layout = _a.layout, layoutId = _a.layoutId;\n    return (isTransformProp(key) ||\n        isTransformOriginProp(key) ||\n        ((layout || layoutId !== undefined) && !!valueScaleCorrection[key]));\n}\n/**\n * Scrape props for MotionValues and add/remove them to this component's\n * VisualElement\n */\nfunction useMotionValues(visualElement, props) {\n    var prev = useConstant(empty);\n    /**\n     * Remove MotionValues that are no longer present\n     */\n    for (var key in prev) {\n        var isForced = isForcedMotionValue(key, props);\n        var existsAsProp = props[key] !== undefined;\n        var existsAsStyle = props.style && props.style[key] !== undefined;\n        var propIsMotionValue = existsAsProp && isMotionValue(props[key]);\n        var styleIsMotionValue = existsAsStyle && isMotionValue(props.style[key]);\n        var transformRemoved = isForced && !existsAsProp && !existsAsStyle;\n        var motionValueRemoved = !isForced && !propIsMotionValue && !styleIsMotionValue;\n        if (transformRemoved || motionValueRemoved) {\n            visualElement.removeValue(key);\n            delete prev[key];\n        }\n    }\n    /**\n     * Add incoming MotionValues\n     */\n    addMotionValues(visualElement, prev, props, false, props);\n    if (props.style)\n        addMotionValues(visualElement, prev, props.style, true, props);\n    /**\n     * Transform custom values if provided a handler, ie size -> width/height\n     * Ideally we'd ditch this by removing support for size and other custom values from Framer.\n     */\n    if (props.transformValues) {\n        visualElement.reactStyle = props.transformValues(visualElement.reactStyle);\n    }\n}\n/**\n * Add incoming MotionValues\n *\n * TODO: Type the VisualElements properly\n */\nfunction addMotionValues(visualElement, prev, source, isStyle, props) {\n    if (isStyle === void 0) { isStyle = false; }\n    if (isStyle)\n        visualElement.reactStyle = {};\n    for (var key in source) {\n        var value = source[key];\n        var foundMotionValue = false;\n        if (isMotionValue(value)) {\n            // If this is a MotionValue, add it if it isn't a reserved key\n            if (!reservedNames.has(key)) {\n                visualElement.addValue(key, value);\n                foundMotionValue = true;\n            }\n        }\n        else if (isForcedMotionValue(key, props)) {\n            // If this is a transform prop, always create a MotionValue\n            // to ensure we can reconcile them all together.\n            if (!visualElement.hasValue(key)) {\n                visualElement.addValue(key, motionValue(value));\n            }\n            else if (value !== prev[key]) {\n                if (isMotionValue(prev[key])) {\n                    /**\n                     * If the previous value was a MotionValue, and this value isn't,\n                     * we want to create a new MotionValue rather than update one that's been removed.\n                     */\n                    visualElement.addValue(key, motionValue(value));\n                }\n                else {\n                    /**\n                     * Otherwise, we just want to ensure the MotionValue is of the latest value.\n                     */\n                    var motion = visualElement.getValue(key);\n                    motion.set(value);\n                }\n            }\n            foundMotionValue = true;\n        }\n        else if (isStyle) {\n            visualElement.reactStyle[key] = value;\n        }\n        if (foundMotionValue)\n            prev[key] = value;\n    }\n}\n/**\n * These are props we accept as MotionValues but don't want to add\n * to the VisualElement\n */\nvar reservedNames = new Set([]);\nvar empty = function () { return ({}); };\n\n/**\n * @public\n */\nvar MotionConfigContext = createContext({\n    transformPagePoint: function (p) { return p; },\n    features: [],\n    isStatic: false,\n});\n/**\n * MotionConfig can be used in combination with the `m` component to cut bundle size\n * and dynamically load only the features you use.\n *\n * ```jsx\n * import {\n *   m as motion,\n *   AnimationFeature,\n *   MotionConfig\n * } from \"framer-motion\"\n *\n * export function App() {\n *   return (\n *     <MotionConfig features={[AnimationFeature]}>\n *       <motion.div animate={{ x: 100 }} />\n *     </MotionConfig>\n *   )\n * }\n * ```\n *\n * @public\n */\nfunction MotionConfig(_a) {\n    var children = _a.children, _b = _a.features, features = _b === void 0 ? [] : _b, props = __rest(_a, [\"children\", \"features\"]);\n    var pluginContext = useContext(MotionConfigContext);\n    var loadedFeatures = __spread(pluginContext.features, features);\n    // We do want to rerender children when the number of loaded features changes\n    var value = useMemo(function () { return ({ features: loadedFeatures }); }, [\n        loadedFeatures.length,\n    ]);\n    // Mutative to prevent triggering rerenders in all listening\n    // components every time this component renders\n    for (var key in props) {\n        value[key] = props[key];\n    }\n    return (createElement(MotionConfigContext.Provider, { value: value }, children));\n}\n\nfunction checkShouldInheritVariant(_a) {\n    var animate = _a.animate, variants = _a.variants, inherit = _a.inherit;\n    return inherit === undefined ? !!variants && !animate : inherit;\n}\n\n/**\n * Load features via renderless components based on the provided MotionProps\n */\nfunction useFeatures(defaultFeatures, isStatic, visualElement, props) {\n    var plugins = useContext(MotionConfigContext);\n    // If this is a static component, or we're rendering on the server, we don't load\n    // any feature components\n    if (isStatic || typeof window === \"undefined\")\n        return null;\n    var allFeatures = __spread(defaultFeatures, plugins.features);\n    var numFeatures = allFeatures.length;\n    var features = [];\n    // Decide which features we should render and add them to the returned array\n    for (var i = 0; i < numFeatures; i++) {\n        var _a = allFeatures[i], shouldRender = _a.shouldRender, key = _a.key, getComponent = _a.getComponent;\n        if (shouldRender(props)) {\n            var Component = getComponent(props);\n            Component &&\n                features.push(createElement(Component, __assign({ key: key }, props, { visualElement: visualElement, inherit: checkShouldInheritVariant(props) })));\n        }\n    }\n    return features;\n}\n\nvar Presence;\n(function (Presence) {\n    Presence[Presence[\"Entering\"] = 0] = \"Entering\";\n    Presence[Presence[\"Present\"] = 1] = \"Present\";\n    Presence[Presence[\"Exiting\"] = 2] = \"Exiting\";\n})(Presence || (Presence = {}));\nvar VisibilityAction;\n(function (VisibilityAction) {\n    VisibilityAction[VisibilityAction[\"Hide\"] = 0] = \"Hide\";\n    VisibilityAction[VisibilityAction[\"Show\"] = 1] = \"Show\";\n})(VisibilityAction || (VisibilityAction = {}));\n\n/**\n * Default handlers for batching VisualElements\n */\nvar defaultHandler = {\n    measureLayout: function (child) { return child.measureLayout(); },\n    layoutReady: function (child) { return child.layoutReady(); },\n};\n/**\n * Sort VisualElements by tree depth, so we process the highest elements first.\n */\nvar sortByDepth = function (a, b) {\n    return a.depth - b.depth;\n};\n/**\n * Create a batcher to process VisualElements\n */\nfunction createBatcher() {\n    var queue = new Set();\n    var add = function (child) { return queue.add(child); };\n    var flush = function (_a) {\n        var _b = _a === void 0 ? defaultHandler : _a, measureLayout = _b.measureLayout, layoutReady = _b.layoutReady;\n        var order = Array.from(queue).sort(sortByDepth);\n        /**\n         * Write: Reset any transforms on children elements so we can read their actual layout\n         */\n        order.forEach(function (child) { return child.resetTransform(); });\n        /**\n         * Read: Measure the actual layout\n         */\n        order.forEach(measureLayout);\n        /**\n         * Write: Notify the VisualElements they're ready for further write operations.\n         */\n        order.forEach(layoutReady);\n        /**\n         * After all children have started animating, ensure any Entering components are set to Present.\n         * If we add deferred animations (set up all animations and then start them in two loops) this\n         * could be moved to the start loop. But it needs to happen after all the animations configs\n         * are generated in AnimateSharedLayout as this relies on presence data\n         */\n        order.forEach(function (child) {\n            if (child.isPresent)\n                child.presence = Presence.Present;\n        });\n        queue.clear();\n    };\n    return { add: add, flush: flush };\n}\nfunction isSharedLayout(context) {\n    return !!context.forceUpdate;\n}\nvar SharedLayoutContext = createContext(createBatcher());\n/**\n * @internal\n */\nvar FramerTreeLayoutContext = createContext(createBatcher());\n\nvar isBrowser = typeof window !== \"undefined\";\nvar useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;\n\nfunction useSnapshotOnUnmount(visualElement) {\n    var syncLayout = useContext(SharedLayoutContext);\n    var framerSyncLayout = useContext(FramerTreeLayoutContext);\n    useIsomorphicLayoutEffect(function () { return function () {\n        if (isSharedLayout(syncLayout)) {\n            syncLayout.remove(visualElement);\n        }\n        if (isSharedLayout(framerSyncLayout)) {\n            framerSyncLayout.remove(visualElement);\n        }\n    }; }, []);\n}\n\n/**\n * When a component is the child of `AnimatePresence`, it can use `usePresence`\n * to access information about whether it's still present in the React tree.\n *\n * ```jsx\n * import { usePresence } from \"framer-motion\"\n *\n * export const Component = () => {\n *   const [isPresent, safeToRemove] = usePresence()\n *\n *   useEffect(() => {\n *     !isPresent && setTimeout(safeToRemove, 1000)\n *   }, [isPresent])\n *\n *   return <div />\n * }\n * ```\n *\n * If `isPresent` is `false`, it means that a component has been removed the tree, but\n * `AnimatePresence` won't really remove it until `safeToRemove` has been called.\n *\n * @public\n */\nfunction usePresence() {\n    var context = useContext(PresenceContext);\n    if (context === null)\n        return [true, null];\n    var isPresent = context.isPresent, onExitComplete = context.onExitComplete, register = context.register;\n    // It's safe to call the following hooks conditionally (after an early return) because the context will always\n    // either be null or non-null for the lifespan of the component.\n    // Replace with useOpaqueId when released in React\n    var id = useUniqueId();\n    useEffect(function () { return register(id); }, []);\n    var safeToRemove = function () { return onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete(id); };\n    return !isPresent && onExitComplete ? [false, safeToRemove] : [true];\n}\n/**\n * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.\n * There is no `safeToRemove` function.\n *\n * ```jsx\n * import { useIsPresent } from \"framer-motion\"\n *\n * export const Component = () => {\n *   const isPresent = useIsPresent()\n *\n *   useEffect(() => {\n *     !isPresent && console.log(\"I've been removed!\")\n *   }, [isPresent])\n *\n *   return <div />\n * }\n * ```\n *\n * @public\n */\nfunction useIsPresent() {\n    return isPresent(useContext(PresenceContext));\n}\nfunction isPresent(context) {\n    return context === null ? true : context.isPresent;\n}\nvar counter = 0;\nvar incrementId = function () { return counter++; };\nvar useUniqueId = function () { return useConstant(incrementId); };\n\n/**\n * Use callback either only on the initial render or on all renders. In concurrent mode\n * the \"initial\" render might run multiple times\n *\n * @param callback - Callback to run\n * @param isInitialOnly - Set to `true` to only run on initial render, or `false` for all renders. Defaults to `false`.\n *\n * @public\n */\nfunction useInitialOrEveryRender(callback, isInitialOnly) {\n    if (isInitialOnly === void 0) { isInitialOnly = false; }\n    var isInitialRender = useRef(true);\n    if (!isInitialOnly || (isInitialOnly && isInitialRender.current)) {\n        callback();\n    }\n    isInitialRender.current = false;\n}\n\n/**\n * This hook is resonsible for creating the variant-propagation tree\n * relationship between VisualElements.\n */\nfunction useVariants(visualElement, _a, isStatic) {\n    var _b, _c;\n    var variants = _a.variants, initial = _a.initial, animate = _a.animate, whileTap = _a.whileTap, whileHover = _a.whileHover;\n    var _d = useVariantContext(), parent = _d.parent, parentInitial = _d.initial, parentAnimate = _d.animate;\n    var presenceContext = useContext(PresenceContext);\n    /**\n     * We only add this VisualElement to the variant tree *if* we're:\n     * 1. Being provided a variants prop\n     * 2. Being used to control variants (ie animate, whileHover etc)\n     * 3. Or being passed animation controls, which we have to assume may control variants\n     * Otherwise this component should be \"invisible\" to variant propagation. This is a concession\n     * to Framer which uses a `motion` component in every `Frame` and it might be if we change that\n     * in the future that this restriction is removed.\n     */\n    var controlsVariants = isVariantLabel$1(animate) ||\n        isVariantLabel$1(whileTap) ||\n        isVariantLabel$1(whileHover) ||\n        isAnimationControls(animate);\n    var isVariantNode = variants || controlsVariants;\n    /**\n     * Override initial with one from a parent `AnimatePresence`, if present\n     */\n    initial = (_b = presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) !== null && _b !== void 0 ? _b : initial;\n    /**\n     * If initial is false, and animate isn't animation controls, we assign animate\n     * to initial and set our values to that for the initial render.\n     */\n    if (initial === false && !isAnimationControls(animate)) {\n        initial = animate;\n    }\n    var context = useMemo(function () { return ({\n        parent: isVariantNode ? visualElement : parent,\n        initial: isVariantLabel$1(initial) ? initial : parentInitial,\n        animate: isVariantLabel$1(animate) ? animate : parentAnimate,\n    }); }, \n    /**\n     * Only create a new context value (thereby re-rendering children) if this\n     * is a static component and `initial` changes.\n     */\n    [isStatic ? initial : null]);\n    // Set initial state. If this is a static component (ie in Framer canvas), respond to updates\n    // in `initial`.\n    useInitialOrEveryRender(function () {\n        var initialToApply = initial || parentInitial;\n        initialToApply && setValues(visualElement, initialToApply);\n    }, !isStatic);\n    /**\n     * Subscribe to the parent visualElement if this is a participant in the variant tree\n     */\n    isVariantNode && !controlsVariants && (parent === null || parent === void 0 ? void 0 : parent.addVariantChild(visualElement));\n    /**\n     * If this component isn't exiting the tree, clear all the children in the render phase.\n     * This will allow children to resubscribe in the correct order to ensure the correct stagger order.\n     */\n    isPresent(presenceContext) && ((_c = visualElement.variantChildrenOrder) === null || _c === void 0 ? void 0 : _c.clear());\n    /**\n     * Subscribe to the propagated parent.\n     */\n    useEffect(function () {\n        isVariantNode && (parent === null || parent === void 0 ? void 0 : parent.addVariantChildOrder(visualElement));\n    });\n    /**\n     * Track mount status so children can detect whether they were present during the\n     * component's initial mount.\n     */\n    useEffect(function () {\n        visualElement.isMounted = true;\n        return function () {\n            var _a;\n            visualElement.isMounted = false;\n            (_a = parent === null || parent === void 0 ? void 0 : parent.variantChildren) === null || _a === void 0 ? void 0 : _a.delete(visualElement);\n        };\n    }, []);\n    /**\n     * We want to update the \"base\" (or fallback) value on the initial render.\n     */\n    useInitialOrEveryRender(function () {\n        visualElement.forEachValue(function (value, key) {\n            visualElement.baseTarget[key] = value.get();\n        });\n    }, true);\n    return context;\n}\nfunction isVariantLabel$1(v) {\n    return typeof v === \"string\" || Array.isArray(v);\n}\nfunction isAnimationControls(v) {\n    return typeof v === \"object\" && typeof v.start === \"function\";\n}\n\n/**\n * Create a `motion` component.\n *\n * This function accepts a Component argument, which can be either a string (ie \"div\"\n * for `motion.div`), or an actual React component.\n *\n * Alongside this is a config option which provides a way of rendering the provided\n * component \"offline\", or outside the React render cycle.\n *\n * @internal\n */\nfunction createMotionComponent(Component, _a) {\n    var defaultFeatures = _a.defaultFeatures, useVisualElement = _a.useVisualElement, render = _a.render;\n    function MotionComponent(props, externalRef) {\n        /**\n         * If a component is static, we only visually update it as a\n         * result of a React re-render, rather than any interactions or animations.\n         * If this component or any ancestor is static, we disable hardware acceleration\n         * and don't load any additional functionality.\n         */\n        var isStatic = useContext(MotionConfigContext).isStatic;\n        /**\n         * Create a VisualElement for this component. A VisualElement provides a common\n         * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as\n         * providing a way of rendering to these APIs outside of the React render loop\n         * for more performant animations and interactions\n         */\n        var visualElement = useVisualElement(Component, props, isStatic, externalRef);\n        /**\n         * Scrape MotionValues from props and add/remove them to/from the VisualElement.\n         */\n        useMotionValues(visualElement, props);\n        /**\n         * Add the visualElement as a node in the variant tree.\n         */\n        var variantContext = useVariants(visualElement, props, isStatic);\n        /**\n         * Load features as renderless components unless the component isStatic\n         */\n        var features = useFeatures(defaultFeatures, isStatic, visualElement, props);\n        /**\n         * Only create a new context value when the sub-contexts change.\n         */\n        var context = useMemo(function () { return ({ visualElement: visualElement, variantContext: variantContext }); }, [\n            visualElement,\n            variantContext,\n        ]);\n        var component = render(Component, props, visualElement);\n        /**\n         * If this component is a child of AnimateSharedLayout, we need to snapshot the component\n         * before it's unmounted. This lives here rather than in features/layout/Measure because\n         * as a child component its unmount effect runs after this component has been unmounted.\n         */\n        useSnapshotOnUnmount(visualElement);\n        // The mount order and hierarchy is specific to ensure our element ref is hydrated by the time\n        // all plugins and features has to execute.\n        return (createElement(Fragment, null,\n            createElement(MotionContext.Provider, { value: context }, component),\n            features));\n    }\n    return forwardRef(MotionComponent);\n}\n\nfunction createLock(name) {\n    var lock = null;\n    return function () {\n        var openLock = function () {\n            lock = null;\n        };\n        if (lock === null) {\n            lock = name;\n            return openLock;\n        }\n        return false;\n    };\n}\nvar globalHorizontalLock = createLock(\"dragHorizontal\");\nvar globalVerticalLock = createLock(\"dragVertical\");\nfunction getGlobalLock(drag) {\n    var lock = false;\n    if (drag === \"y\") {\n        lock = globalVerticalLock();\n    }\n    else if (drag === \"x\") {\n        lock = globalHorizontalLock();\n    }\n    else {\n        var openHorizontal_1 = globalHorizontalLock();\n        var openVertical_1 = globalVerticalLock();\n        if (openHorizontal_1 && openVertical_1) {\n            lock = function () {\n                openHorizontal_1();\n                openVertical_1();\n            };\n        }\n        else {\n            // Release the locks because we don't use them\n            if (openHorizontal_1)\n                openHorizontal_1();\n            if (openVertical_1)\n                openVertical_1();\n        }\n    }\n    return lock;\n}\n\nfunction addDomEvent(target, eventName, handler, options) {\n    target.addEventListener(eventName, handler, options);\n    return function () { return target.removeEventListener(eventName, handler, options); };\n}\n/**\n * Attaches an event listener directly to the provided DOM element.\n *\n * Bypassing React's event system can be desirable, for instance when attaching non-passive\n * event handlers.\n *\n * ```jsx\n * const ref = useRef(null)\n *\n * useDomEvent(ref, 'wheel', onWheel, { passive: false })\n *\n * return <div ref={ref} />\n * ```\n *\n * @param ref - React.RefObject that's been provided to the element you want to bind the listener to.\n * @param eventName - Name of the event you want listen for.\n * @param handler - Function to fire when receiving the event.\n * @param options - Options to pass to `Event.addEventListener`.\n *\n * @public\n */\nfunction useDomEvent(ref, eventName, handler, options) {\n    useEffect(function () {\n        var element = ref.current;\n        if (handler && element) {\n            return addDomEvent(element, eventName, handler, options);\n        }\n    }, [ref, eventName, handler, options]);\n}\n\nfunction isMouseEvent(event) {\n    // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.\n    if (typeof PointerEvent !== \"undefined\" && event instanceof PointerEvent) {\n        return !!(event.pointerType === \"mouse\");\n    }\n    return event instanceof MouseEvent;\n}\nfunction isTouchEvent(event) {\n    var hasTouches = !!event.touches;\n    return hasTouches;\n}\n\n/**\n * Filters out events not attached to the primary pointer (currently left mouse button)\n * @param eventHandler\n */\nfunction filterPrimaryPointer(eventHandler) {\n    return function (event) {\n        var isMouseEvent = event instanceof MouseEvent;\n        var isPrimaryPointer = !isMouseEvent ||\n            (isMouseEvent && event.button === 0);\n        if (isPrimaryPointer) {\n            eventHandler(event);\n        }\n    };\n}\nvar defaultPagePoint = { pageX: 0, pageY: 0 };\nfunction pointFromTouch(e, pointType) {\n    if (pointType === void 0) { pointType = \"page\"; }\n    var primaryTouch = e.touches[0] || e.changedTouches[0];\n    var point = primaryTouch || defaultPagePoint;\n    return {\n        x: point[pointType + \"X\"],\n        y: point[pointType + \"Y\"],\n    };\n}\nfunction pointFromMouse(point, pointType) {\n    if (pointType === void 0) { pointType = \"page\"; }\n    return {\n        x: point[pointType + \"X\"],\n        y: point[pointType + \"Y\"],\n    };\n}\nfunction extractEventInfo(event, pointType) {\n    if (pointType === void 0) { pointType = \"page\"; }\n    return {\n        point: isTouchEvent(event)\n            ? pointFromTouch(event, pointType)\n            : pointFromMouse(event, pointType),\n    };\n}\nfunction getViewportPointFromEvent(event) {\n    return extractEventInfo(event, \"client\");\n}\nvar wrapHandler = function (handler, shouldFilterPrimaryPointer) {\n    if (shouldFilterPrimaryPointer === void 0) { shouldFilterPrimaryPointer = false; }\n    var listener = function (event) {\n        return handler(event, extractEventInfo(event));\n    };\n    return shouldFilterPrimaryPointer\n        ? filterPrimaryPointer(listener)\n        : listener;\n};\n\nvar isBrowser$1 = typeof window !== \"undefined\";\n// We check for event support via functions in case they've been mocked by a testing suite.\nvar supportsPointerEvents = function () {\n    return isBrowser$1 && window.onpointerdown === null;\n};\nvar supportsTouchEvents = function () {\n    return isBrowser$1 && window.ontouchstart === null;\n};\nvar supportsMouseEvents = function () {\n    return isBrowser$1 && window.onmousedown === null;\n};\n\nvar mouseEventNames = {\n    pointerdown: \"mousedown\",\n    pointermove: \"mousemove\",\n    pointerup: \"mouseup\",\n    pointercancel: \"mousecancel\",\n    pointerover: \"mouseover\",\n    pointerout: \"mouseout\",\n    pointerenter: \"mouseenter\",\n    pointerleave: \"mouseleave\",\n};\nvar touchEventNames = {\n    pointerdown: \"touchstart\",\n    pointermove: \"touchmove\",\n    pointerup: \"touchend\",\n    pointercancel: \"touchcancel\",\n};\nfunction getPointerEventName(name) {\n    if (supportsPointerEvents()) {\n        return name;\n    }\n    else if (supportsTouchEvents()) {\n        return touchEventNames[name];\n    }\n    else if (supportsMouseEvents()) {\n        return mouseEventNames[name];\n    }\n    return name;\n}\nfunction addPointerEvent(target, eventName, handler, options) {\n    return addDomEvent(target, getPointerEventName(eventName), wrapHandler(handler, eventName === \"pointerdown\"), options);\n}\nfunction usePointerEvent(ref, eventName, handler, options) {\n    return useDomEvent(ref, getPointerEventName(eventName), handler && wrapHandler(handler, eventName === \"pointerdown\"), options);\n}\n\n/**\n * @internal\n */\nvar PanSession = /** @class */ (function () {\n    function PanSession(event, handlers, _a) {\n        var _this = this;\n        var transformPagePoint = (_a === void 0 ? {} : _a).transformPagePoint;\n        /**\n         * @internal\n         */\n        this.startEvent = null;\n        /**\n         * @internal\n         */\n        this.lastMoveEvent = null;\n        /**\n         * @internal\n         */\n        this.lastMoveEventInfo = null;\n        /**\n         * @internal\n         */\n        this.handlers = {};\n        this.updatePoint = function () {\n            if (!(_this.lastMoveEvent && _this.lastMoveEventInfo))\n                return;\n            var info = getPanInfo(_this.lastMoveEventInfo, _this.history);\n            var isPanStarted = _this.startEvent !== null;\n            // Only start panning if the offset is larger than 3 pixels. If we make it\n            // any larger than this we'll want to reset the pointer history\n            // on the first update to avoid visual snapping to the cursoe.\n            var isDistancePastThreshold = distance(info.offset, { x: 0, y: 0 }) >= 3;\n            if (!isPanStarted && !isDistancePastThreshold)\n                return;\n            var point = info.point;\n            var timestamp = getFrameData().timestamp;\n            _this.history.push(__assign(__assign({}, point), { timestamp: timestamp }));\n            var _a = _this.handlers, onStart = _a.onStart, onMove = _a.onMove;\n            if (!isPanStarted) {\n                onStart && onStart(_this.lastMoveEvent, info);\n                _this.startEvent = _this.lastMoveEvent;\n            }\n            onMove && onMove(_this.lastMoveEvent, info);\n        };\n        this.handlePointerMove = function (event, info) {\n            _this.lastMoveEvent = event;\n            _this.lastMoveEventInfo = transformPoint(info, _this.transformPagePoint);\n            // Because Safari doesn't trigger mouseup events when it's above a `<select>`\n            if (isMouseEvent(event) && event.buttons === 0) {\n                _this.handlePointerUp(event, info);\n                return;\n            }\n            // Throttle mouse move event to once per frame\n            sync.update(_this.updatePoint, true);\n        };\n        this.handlePointerUp = function (event, info) {\n            _this.end();\n            var onEnd = _this.handlers.onEnd;\n            if (!onEnd)\n                return;\n            var panInfo = getPanInfo(transformPoint(info, _this.transformPagePoint), _this.history);\n            onEnd && onEnd(event, panInfo);\n        };\n        // If we have more than one touch, don't start detecting this gesture\n        if (isTouchEvent(event) && event.touches.length > 1)\n            return;\n        this.handlers = handlers;\n        this.transformPagePoint = transformPagePoint;\n        var info = extractEventInfo(event);\n        var initialInfo = transformPoint(info, this.transformPagePoint);\n        var point = initialInfo.point;\n        var timestamp = getFrameData().timestamp;\n        this.history = [__assign(__assign({}, point), { timestamp: timestamp })];\n        var onSessionStart = handlers.onSessionStart;\n        onSessionStart &&\n            onSessionStart(event, getPanInfo(initialInfo, this.history));\n        this.removeListeners = pipe(addPointerEvent(window, \"pointermove\", this.handlePointerMove), addPointerEvent(window, \"pointerup\", this.handlePointerUp), addPointerEvent(window, \"pointercancel\", this.handlePointerUp));\n    }\n    PanSession.prototype.updateHandlers = function (handlers) {\n        this.handlers = handlers;\n    };\n    PanSession.prototype.end = function () {\n        this.removeListeners && this.removeListeners();\n        cancelSync.update(this.updatePoint);\n    };\n    return PanSession;\n}());\nfunction transformPoint(info, transformPagePoint) {\n    return transformPagePoint ? { point: transformPagePoint(info.point) } : info;\n}\nfunction subtractPoint(a, b) {\n    return { x: a.x - b.x, y: a.y - b.y };\n}\nfunction getPanInfo(_a, history) {\n    var point = _a.point;\n    return {\n        point: point,\n        delta: subtractPoint(point, lastDevicePoint(history)),\n        offset: subtractPoint(point, startDevicePoint(history)),\n        velocity: getVelocity$1(history, 0.1),\n    };\n}\nfunction startDevicePoint(history) {\n    return history[0];\n}\nfunction lastDevicePoint(history) {\n    return history[history.length - 1];\n}\nfunction getVelocity$1(history, timeDelta) {\n    if (history.length < 2) {\n        return { x: 0, y: 0 };\n    }\n    var i = history.length - 1;\n    var timestampedPoint = null;\n    var lastPoint = lastDevicePoint(history);\n    while (i >= 0) {\n        timestampedPoint = history[i];\n        if (lastPoint.timestamp - timestampedPoint.timestamp >\n            secondsToMilliseconds(timeDelta)) {\n            break;\n        }\n        i--;\n    }\n    if (!timestampedPoint) {\n        return { x: 0, y: 0 };\n    }\n    var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;\n    if (time === 0) {\n        return { x: 0, y: 0 };\n    }\n    var currentVelocity = {\n        x: (lastPoint.x - timestampedPoint.x) / time,\n        y: (lastPoint.y - timestampedPoint.y) / time,\n    };\n    if (currentVelocity.x === Infinity) {\n        currentVelocity.x = 0;\n    }\n    if (currentVelocity.y === Infinity) {\n        currentVelocity.y = 0;\n    }\n    return currentVelocity;\n}\n\n/**\n * Apply constraints to a point. These constraints are both physical along an\n * axis, and an elastic factor that determines how much to constrain the point\n * by if it does lie outside the defined parameters.\n */\nfunction applyConstraints(point, _a, elastic) {\n    var min = _a.min, max = _a.max;\n    if (min !== undefined && point < min) {\n        // If we have a min point defined, and this is outside of that, constrain\n        point = elastic ? mix(min, point, elastic) : Math.max(point, min);\n    }\n    else if (max !== undefined && point > max) {\n        // If we have a max point defined, and this is outside of that, constrain\n        point = elastic ? mix(max, point, elastic) : Math.min(point, max);\n    }\n    return point;\n}\n/**\n * Calculates a min projection point based on a pointer, pointer progress\n * within the drag target, and constraints.\n *\n * For instance if an element was 100px width, we were dragging from 0.25\n * along this axis, the pointer is at 200px, and there were no constraints,\n * we would calculate a min projection point of 175px.\n */\nfunction calcConstrainedMinPoint(point, length, progress, constraints, elastic) {\n    // Calculate a min point for this axis and apply it to the current pointer\n    var min = point - length * progress;\n    return constraints ? applyConstraints(min, constraints, elastic) : min;\n}\n/**\n * Calculate constraints in terms of the viewport when defined relatively to the\n * measured axis. This is measured from the nearest edge, so a max constraint of 200\n * on an axis with a max value of 300 would return a constraint of 500 - axis length\n */\nfunction calcRelativeAxisConstraints(axis, min, max) {\n    return {\n        min: min !== undefined ? axis.min + min : undefined,\n        max: max !== undefined\n            ? axis.max + max - (axis.max - axis.min)\n            : undefined,\n    };\n}\n/**\n * Calculate constraints in terms of the viewport when\n * defined relatively to the measured bounding box.\n */\nfunction calcRelativeConstraints(layoutBox, _a) {\n    var top = _a.top, left = _a.left, bottom = _a.bottom, right = _a.right;\n    return {\n        x: calcRelativeAxisConstraints(layoutBox.x, left, right),\n        y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),\n    };\n}\n/**\n * Calculate viewport constraints when defined as another viewport-relative axis\n */\nfunction calcViewportAxisConstraints(layoutAxis, constraintsAxis) {\n    var _a;\n    var min = constraintsAxis.min - layoutAxis.min;\n    var max = constraintsAxis.max - layoutAxis.max;\n    // If the constraints axis is actually smaller than the layout axis then we can\n    // flip the constraints\n    if (constraintsAxis.max - constraintsAxis.min <\n        layoutAxis.max - layoutAxis.min) {\n        _a = __read([max, min], 2), min = _a[0], max = _a[1];\n    }\n    return {\n        min: layoutAxis.min + min,\n        max: layoutAxis.min + max,\n    };\n}\n/**\n * Calculate viewport constraints when defined as another viewport-relative box\n */\nfunction calcViewportConstraints(layoutBox, constraintsBox) {\n    return {\n        x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),\n        y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),\n    };\n}\n/**\n * Calculate the an axis position based on two axes and a progress value.\n */\nfunction calcPositionFromProgress(axis, constraints, progress) {\n    var axisLength = axis.max - axis.min;\n    var min = mix(constraints.min, constraints.max - axisLength, progress);\n    return { min: min, max: min + axisLength };\n}\n/**\n * Rebase the calculated viewport constraints relative to the layout.min point.\n */\nfunction rebaseAxisConstraints(layout, constraints) {\n    var relativeConstraints = {};\n    if (constraints.min !== undefined) {\n        relativeConstraints.min = constraints.min - layout.min;\n    }\n    if (constraints.max !== undefined) {\n        relativeConstraints.max = constraints.max - layout.min;\n    }\n    return relativeConstraints;\n}\n\nvar elementDragControls = new WeakMap();\n/**\n *\n */\nvar lastPointerEvent;\nvar VisualElementDragControls = /** @class */ (function () {\n    function VisualElementDragControls(_a) {\n        var visualElement = _a.visualElement;\n        /**\n         * Track whether we're currently dragging.\n         *\n         * @internal\n         */\n        this.isDragging = false;\n        /**\n         * The current direction of drag, or `null` if both.\n         *\n         * @internal\n         */\n        this.currentDirection = null;\n        /**\n         * The permitted boundaries of travel, in pixels.\n         *\n         * @internal\n         */\n        this.constraints = false;\n        /**\n         * A reference to the host component's latest props.\n         *\n         * @internal\n         */\n        this.props = {};\n        /**\n         * @internal\n         */\n        this.hasMutatedConstraints = false;\n        /**\n         * Track the initial position of the cursor relative to the dragging element\n         * when dragging starts as a value of 0-1 on each axis. We then use this to calculate\n         * an ideal bounding box for the VisualElement renderer to project into every frame.\n         *\n         * @internal\n         */\n        this.cursorProgress = {\n            x: 0.5,\n            y: 0.5,\n        };\n        // When updating _dragX, or _dragY instead of the VisualElement,\n        // persist their values between drag gestures.\n        this.originPoint = {};\n        // This is a reference to the global drag gesture lock, ensuring only one component\n        // can \"capture\" the drag of one or both axes.\n        // TODO: Look into moving this into pansession?\n        this.openGlobalLock = null;\n        /**\n         * @internal\n         */\n        this.panSession = null;\n        this.visualElement = visualElement;\n        this.visualElement.enableLayoutProjection();\n        elementDragControls.set(visualElement, this);\n    }\n    /**\n     * Instantiate a PanSession for the drag gesture\n     *\n     * @public\n     */\n    VisualElementDragControls.prototype.start = function (originEvent, _a) {\n        var _this = this;\n        var _b = _a === void 0 ? {} : _a, _c = _b.snapToCursor, snapToCursor = _c === void 0 ? false : _c, cursorProgress = _b.cursorProgress;\n        /**\n         * If this drag session has been manually triggered by the user, it might be from an event\n         * outside the draggable element. If snapToCursor is set to true, we need to measure the position\n         * of the element and snap it to the cursor.\n         */\n        snapToCursor && this.snapToCursor(originEvent);\n        var onSessionStart = function () {\n            // Stop any animations on both axis values immediately. This allows the user to throw and catch\n            // the component.\n            _this.stopMotion();\n        };\n        var onStart = function (event, info) {\n            var _a, _b;\n            // Attempt to grab the global drag gesture lock - maybe make this part of PanSession\n            var _c = _this.props, drag = _c.drag, dragPropagation = _c.dragPropagation;\n            if (drag && !dragPropagation) {\n                if (_this.openGlobalLock)\n                    _this.openGlobalLock();\n                _this.openGlobalLock = getGlobalLock(drag);\n                // If we don 't have the lock, don't start dragging\n                if (!_this.openGlobalLock)\n                    return;\n            }\n            /**\n             * Record the progress of the mouse within the draggable element on each axis.\n             * onPan, we're going to use this to calculate a new bounding box for the element to\n             * project into. This will ensure that even if the DOM element moves via a relayout, it'll\n             * stick to the correct place under the pointer.\n             */\n            _this.prepareBoundingBox();\n            _this.visualElement.lockTargetBox();\n            /**\n             * Resolve the drag constraints. These are either set as top/right/bottom/left constraints\n             * relative to the element's layout, or a ref to another element. Both need converting to\n             * viewport coordinates.\n             */\n            _this.resolveDragConstraints();\n            /**\n             * When dragging starts, we want to find where the cursor is relative to the bounding box\n             * of the element. Every frame, we calculate a new bounding box using this relative position\n             * and let the visualElement renderer figure out how to reproject the element into this bounding\n             * box.\n             *\n             * By doing it this way, rather than applying an x/y transform directly to the element,\n             * we can ensure the component always visually sticks to the cursor as we'd expect, even\n             * if the DOM element itself changes layout as a result of React updates the user might\n             * make based on the drag position.\n             */\n            var point = getViewportPointFromEvent(event).point;\n            eachAxis(function (axis) {\n                var _a = _this.visualElement.targetBox[axis], min = _a.min, max = _a.max;\n                _this.cursorProgress[axis] = cursorProgress\n                    ? cursorProgress[axis]\n                    : progress(min, max, point[axis]);\n                /**\n                 * If we have external drag MotionValues, record their origin point. On pointermove\n                 * we'll apply the pan gesture offset directly to this value.\n                 */\n                var axisValue = _this.getAxisMotionValue(axis);\n                if (axisValue) {\n                    _this.originPoint[axis] = axisValue.get();\n                }\n            });\n            // Set current drag status\n            _this.isDragging = true;\n            _this.currentDirection = null;\n            // Fire onDragStart event\n            (_b = (_a = _this.props).onDragStart) === null || _b === void 0 ? void 0 : _b.call(_a, event, info);\n        };\n        var onMove = function (event, info) {\n            var _a, _b, _c, _d;\n            var _e = _this.props, dragPropagation = _e.dragPropagation, dragDirectionLock = _e.dragDirectionLock;\n            // If we didn't successfully receive the gesture lock, early return.\n            if (!dragPropagation && !_this.openGlobalLock)\n                return;\n            var offset = info.offset;\n            // Attempt to detect drag direction if directionLock is true\n            if (dragDirectionLock && _this.currentDirection === null) {\n                _this.currentDirection = getCurrentDirection(offset);\n                // If we've successfully set a direction, notify listener\n                if (_this.currentDirection !== null) {\n                    (_b = (_a = _this.props).onDirectionLock) === null || _b === void 0 ? void 0 : _b.call(_a, _this.currentDirection);\n                }\n                return;\n            }\n            // Update each point with the latest position\n            _this.updateAxis(\"x\", event, offset);\n            _this.updateAxis(\"y\", event, offset);\n            // Fire onDrag event\n            (_d = (_c = _this.props).onDrag) === null || _d === void 0 ? void 0 : _d.call(_c, event, info);\n            // Update the last pointer event\n            lastPointerEvent = event;\n        };\n        var onEnd = function (event, info) { return _this.stop(event, info); };\n        var transformPagePoint = this.props.transformPagePoint;\n        this.panSession = new PanSession(originEvent, {\n            onSessionStart: onSessionStart,\n            onStart: onStart,\n            onMove: onMove,\n            onEnd: onEnd,\n        }, { transformPagePoint: transformPagePoint });\n    };\n    /**\n     * Ensure the component's layout and target bounding boxes are up-to-date.\n     */\n    VisualElementDragControls.prototype.prepareBoundingBox = function () {\n        var element = this.visualElement.getInstance();\n        var transform = element.style.transform;\n        this.visualElement.resetTransform();\n        this.visualElement.measureLayout();\n        element.style.transform = transform;\n        this.visualElement.rebaseTargetBox(true, this.visualElement.getBoundingBoxWithoutTransforms());\n    };\n    VisualElementDragControls.prototype.resolveDragConstraints = function () {\n        var _this = this;\n        var dragConstraints = this.props.dragConstraints;\n        if (dragConstraints) {\n            this.constraints = isRefObject(dragConstraints)\n                ? this.resolveRefConstraints(this.visualElement.box, dragConstraints)\n                : calcRelativeConstraints(this.visualElement.box, dragConstraints);\n        }\n        else {\n            this.constraints = false;\n        }\n        /**\n         * If we're outputting to external MotionValues, we want to rebase the measured constraints\n         * from viewport-relative to component-relative.\n         */\n        if (this.constraints && !this.hasMutatedConstraints) {\n            eachAxis(function (axis) {\n                if (_this.getAxisMotionValue(axis)) {\n                    _this.constraints[axis] = rebaseAxisConstraints(_this.visualElement.box[axis], _this.constraints[axis]);\n                }\n            });\n        }\n    };\n    VisualElementDragControls.prototype.resolveRefConstraints = function (layoutBox, constraints) {\n        var _a = this.props, onMeasureDragConstraints = _a.onMeasureDragConstraints, transformPagePoint = _a.transformPagePoint;\n        var constraintsElement = constraints.current;\n        invariant(constraintsElement !== null, \"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.\");\n        this.constraintsBox = getBoundingBox(constraintsElement, transformPagePoint);\n        var measuredConstraints = calcViewportConstraints(layoutBox, this.constraintsBox);\n        /**\n         * If there's an onMeasureDragConstraints listener we call it and\n         * if different constraints are returned, set constraints to that\n         */\n        if (onMeasureDragConstraints) {\n            var userConstraints = onMeasureDragConstraints(convertAxisBoxToBoundingBox(measuredConstraints));\n            this.hasMutatedConstraints = !!userConstraints;\n            if (userConstraints) {\n                measuredConstraints = convertBoundingBoxToAxisBox(userConstraints);\n            }\n        }\n        return measuredConstraints;\n    };\n    VisualElementDragControls.prototype.cancelDrag = function () {\n        this.isDragging = false;\n        this.panSession && this.panSession.end();\n        this.panSession = null;\n        if (!this.props.dragPropagation && this.openGlobalLock) {\n            this.openGlobalLock();\n            this.openGlobalLock = null;\n        }\n    };\n    VisualElementDragControls.prototype.stop = function (event, info) {\n        var _a;\n        this.visualElement.unlockTargetBox();\n        (_a = this.panSession) === null || _a === void 0 ? void 0 : _a.end();\n        this.panSession = null;\n        var isDragging = this.isDragging;\n        this.cancelDrag();\n        if (!isDragging)\n            return;\n        var _b = this.props, dragMomentum = _b.dragMomentum, dragElastic = _b.dragElastic, onDragEnd = _b.onDragEnd;\n        if (dragMomentum || dragElastic) {\n            var velocity = info.velocity;\n            this.animateDragEnd(velocity);\n        }\n        onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd(event, info);\n    };\n    VisualElementDragControls.prototype.snapToCursor = function (event) {\n        var _this = this;\n        this.prepareBoundingBox();\n        eachAxis(function (axis) {\n            var axisValue = _this.getAxisMotionValue(axis);\n            if (axisValue) {\n                var point = getViewportPointFromEvent(event).point;\n                var box = _this.visualElement.box;\n                var length_1 = box[axis].max - box[axis].min;\n                var center = box[axis].min + length_1 / 2;\n                var offset = point[axis] - center;\n                _this.originPoint[axis] = point[axis];\n                axisValue.set(offset);\n            }\n            else {\n                _this.cursorProgress[axis] = 0.5;\n                _this.updateVisualElementAxis(axis, event);\n            }\n        });\n    };\n    /**\n     * Update the specified axis with the latest pointer information.\n     */\n    VisualElementDragControls.prototype.updateAxis = function (axis, event, offset) {\n        var drag = this.props.drag;\n        // If we're not dragging this axis, do an early return.\n        if (!shouldDrag(axis, drag, this.currentDirection))\n            return;\n        return this.getAxisMotionValue(axis)\n            ? this.updateAxisMotionValue(axis, offset)\n            : this.updateVisualElementAxis(axis, event);\n    };\n    VisualElementDragControls.prototype.updateAxisMotionValue = function (axis, offset) {\n        var axisValue = this.getAxisMotionValue(axis);\n        if (!offset || !axisValue)\n            return;\n        var dragElastic = this.props.dragElastic;\n        var nextValue = this.originPoint[axis] + offset[axis];\n        var update = this.constraints\n            ? applyConstraints(nextValue, this.constraints[axis], dragElastic)\n            : nextValue;\n        axisValue.set(update);\n    };\n    VisualElementDragControls.prototype.updateVisualElementAxis = function (axis, event) {\n        var _a;\n        var dragElastic = this.props.dragElastic;\n        // Get the actual layout bounding box of the element\n        var axisLayout = this.visualElement.box[axis];\n        // Calculate its current length. In the future we might want to lerp this to animate\n        // between lengths if the layout changes as we change the DOM\n        var axisLength = axisLayout.max - axisLayout.min;\n        // Get the initial progress that the pointer sat on this axis on gesture start.\n        var axisProgress = this.cursorProgress[axis];\n        var point = getViewportPointFromEvent(event).point;\n        // Calculate a new min point based on the latest pointer position, constraints and elastic\n        var min = calcConstrainedMinPoint(point[axis], axisLength, axisProgress, (_a = this.constraints) === null || _a === void 0 ? void 0 : _a[axis], dragElastic);\n        // Update the axis viewport target with this new min and the length\n        this.visualElement.setAxisTarget(axis, min, min + axisLength);\n    };\n    VisualElementDragControls.prototype.updateProps = function (_a) {\n        var _b = _a.drag, drag = _b === void 0 ? false : _b, _c = _a.dragDirectionLock, dragDirectionLock = _c === void 0 ? false : _c, _d = _a.dragPropagation, dragPropagation = _d === void 0 ? false : _d, _e = _a.dragConstraints, dragConstraints = _e === void 0 ? false : _e, _f = _a.dragElastic, dragElastic = _f === void 0 ? 0.35 : _f, _g = _a.dragMomentum, dragMomentum = _g === void 0 ? true : _g, remainingProps = __rest(_a, [\"drag\", \"dragDirectionLock\", \"dragPropagation\", \"dragConstraints\", \"dragElastic\", \"dragMomentum\"]);\n        this.props = __assign({ drag: drag,\n            dragDirectionLock: dragDirectionLock,\n            dragPropagation: dragPropagation,\n            dragConstraints: dragConstraints,\n            dragElastic: dragElastic,\n            dragMomentum: dragMomentum }, remainingProps);\n    };\n    /**\n     * Drag works differently depending on which props are provided.\n     *\n     * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.\n     * - If the component will perform layout animations, we output the gesture to the component's\n     *      visual bounding box\n     * - Otherwise, we apply the delta to the x/y motion values.\n     */\n    VisualElementDragControls.prototype.getAxisMotionValue = function (axis) {\n        var _a = this.props, layout = _a.layout, layoutId = _a.layoutId;\n        var dragKey = \"_drag\" + axis.toUpperCase();\n        if (this.props[dragKey]) {\n            return this.props[dragKey];\n        }\n        else if (!layout && layoutId === undefined) {\n            return this.visualElement.getValue(axis, 0);\n        }\n    };\n    VisualElementDragControls.prototype.animateDragEnd = function (velocity) {\n        var _this = this;\n        var _a = this.props, drag = _a.drag, dragMomentum = _a.dragMomentum, dragElastic = _a.dragElastic, dragTransition = _a.dragTransition;\n        var momentumAnimations = eachAxis(function (axis) {\n            if (!shouldDrag(axis, drag, _this.currentDirection)) {\n                return;\n            }\n            var transition = _this.constraints ? _this.constraints[axis] : {};\n            /**\n             * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame\n             * of spring animations so we should look into adding a disable spring option to `inertia`.\n             * We could do something here where we affect the `bounceStiffness` and `bounceDamping`\n             * using the value of `dragElastic`.\n             */\n            var bounceStiffness = dragElastic ? 200 : 1000000;\n            var bounceDamping = dragElastic ? 40 : 10000000;\n            var inertia = __assign(__assign({ type: \"inertia\", velocity: dragMomentum ? velocity[axis] : 0, bounceStiffness: bounceStiffness,\n                bounceDamping: bounceDamping, timeConstant: 750, restDelta: 1, restSpeed: 10 }, dragTransition), transition);\n            // If we're not animating on an externally-provided `MotionValue` we can use the\n            // component's animation controls which will handle interactions with whileHover (etc),\n            // otherwise we just have to animate the `MotionValue` itself.\n            return _this.getAxisMotionValue(axis)\n                ? _this.startAxisValueAnimation(axis, inertia)\n                : _this.visualElement.startLayoutAxisAnimation(axis, inertia);\n        });\n        // Run all animations and then resolve the new drag constraints.\n        return Promise.all(momentumAnimations).then(function () {\n            var _a, _b;\n            (_b = (_a = _this.props).onDragTransitionEnd) === null || _b === void 0 ? void 0 : _b.call(_a);\n        });\n    };\n    VisualElementDragControls.prototype.stopMotion = function () {\n        var _this = this;\n        eachAxis(function (axis) {\n            var axisValue = _this.getAxisMotionValue(axis);\n            axisValue\n                ? axisValue.stop()\n                : _this.visualElement.stopLayoutAnimation();\n        });\n    };\n    VisualElementDragControls.prototype.startAxisValueAnimation = function (axis, transition) {\n        var axisValue = this.getAxisMotionValue(axis);\n        if (!axisValue)\n            return;\n        var currentValue = axisValue.get();\n        axisValue.set(currentValue);\n        axisValue.set(currentValue); // Set twice to hard-reset velocity\n        return startAnimation(axis, axisValue, 0, transition);\n    };\n    VisualElementDragControls.prototype.scalePoint = function () {\n        var _this = this;\n        var _a = this.props, drag = _a.drag, dragConstraints = _a.dragConstraints;\n        if (!isRefObject(dragConstraints) || !this.constraintsBox)\n            return;\n        // Stop any current animations as there can be some visual glitching if we resize mid animation\n        this.stopMotion();\n        // Record the relative progress of the targetBox relative to the constraintsBox\n        var boxProgress = { x: 0, y: 0 };\n        eachAxis(function (axis) {\n            boxProgress[axis] = calcOrigin(_this.visualElement.targetBox[axis], _this.constraintsBox[axis]);\n        });\n        /**\n         * For each axis, calculate the current progress of the layout axis within the constraints.\n         * Then, using the latest layout and constraints measurements, reposition the new layout axis\n         * proportionally within the constraints.\n         */\n        this.prepareBoundingBox();\n        this.resolveDragConstraints();\n        eachAxis(function (axis) {\n            if (!shouldDrag(axis, drag, null))\n                return;\n            // Calculate the position of the targetBox relative to the constraintsBox using the\n            // previously calculated progress\n            var _a = calcPositionFromProgress(_this.visualElement.targetBox[axis], _this.constraintsBox[axis], boxProgress[axis]), min = _a.min, max = _a.max;\n            _this.visualElement.setAxisTarget(axis, min, max);\n        });\n    };\n    VisualElementDragControls.prototype.mount = function (visualElement) {\n        var _this = this;\n        var element = visualElement.getInstance();\n        /**\n         * Attach a pointerdown event listener on this DOM element to initiate drag tracking.\n         */\n        var stopPointerListener = addPointerEvent(element, \"pointerdown\", function (event) {\n            var _a = _this.props, drag = _a.drag, _b = _a.dragListener, dragListener = _b === void 0 ? true : _b;\n            drag && dragListener && _this.start(event);\n        });\n        /**\n         * Attach a window resize listener to scale the draggable target within its defined\n         * constraints as the window resizes.\n         */\n        var stopResizeListener = addDomEvent(window, \"resize\", function () {\n            _this.scalePoint();\n        });\n        /**\n         * Ensure drag constraints are resolved correctly relative to the dragging element\n         * whenever its layout changes.\n         */\n        var stopLayoutUpdateListener = visualElement.onLayoutUpdate(function () {\n            if (_this.isDragging)\n                _this.resolveDragConstraints();\n        });\n        /**\n         * If the previous component with this same layoutId was dragging at the time\n         * it was unmounted, we want to continue the same gesture on this component.\n         */\n        var prevSnapshot = visualElement.prevSnapshot;\n        (prevSnapshot === null || prevSnapshot === void 0 ? void 0 : prevSnapshot.isDragging) &&\n            this.start(lastPointerEvent, {\n                cursorProgress: prevSnapshot.cursorProgress,\n            });\n        /**\n         * Return a function that will teardown the drag gesture\n         */\n        return function () {\n            stopPointerListener === null || stopPointerListener === void 0 ? void 0 : stopPointerListener();\n            stopResizeListener === null || stopResizeListener === void 0 ? void 0 : stopResizeListener();\n            stopLayoutUpdateListener === null || stopLayoutUpdateListener === void 0 ? void 0 : stopLayoutUpdateListener();\n            _this.cancelDrag();\n        };\n    };\n    return VisualElementDragControls;\n}());\nfunction shouldDrag(direction, drag, currentDirection) {\n    return ((drag === true || drag === direction) &&\n        (currentDirection === null || currentDirection === direction));\n}\n/**\n * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower\n * than the provided threshold, return `null`.\n *\n * @param offset - The x/y offset from origin.\n * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.\n */\nfunction getCurrentDirection(offset, lockThreshold) {\n    if (lockThreshold === void 0) { lockThreshold = 10; }\n    var direction = null;\n    if (Math.abs(offset.y) > lockThreshold) {\n        direction = \"y\";\n    }\n    else if (Math.abs(offset.x) > lockThreshold) {\n        direction = \"x\";\n    }\n    return direction;\n}\n\n/**\n * A hook that allows an element to be dragged.\n *\n * @internal\n */\nfunction useDrag(props, visualElement) {\n    var groupDragControls = props.dragControls;\n    var transformPagePoint = useContext(MotionConfigContext).transformPagePoint;\n    var dragControls = useConstant(function () {\n        return new VisualElementDragControls({\n            visualElement: visualElement,\n        });\n    });\n    dragControls.updateProps(__assign(__assign({}, props), { transformPagePoint: transformPagePoint }));\n    // If we've been provided a DragControls for manual control over the drag gesture,\n    // subscribe this component to it on mount.\n    useEffect(function () { return groupDragControls && groupDragControls.subscribe(dragControls); }, [dragControls]);\n    // Mount the drag controls with the visualElement\n    useEffect(function () { return dragControls.mount(visualElement); }, []);\n}\n\nvar makeRenderlessComponent = function (hook) { return function (props) {\n    hook(props);\n    return null;\n}; };\n\nvar Component = makeRenderlessComponent(function (_a) {\n    var visualElement = _a.visualElement, props = __rest(_a, [\"visualElement\"]);\n    return useDrag(props, visualElement);\n});\n/**\n * @public\n */\nvar Drag = {\n    key: \"drag\",\n    shouldRender: function (props) { return !!props.drag || !!props.dragControls; },\n    getComponent: function () { return Component; },\n};\n\nfunction useUnmountEffect(callback) {\n    return useEffect(function () { return function () { return callback(); }; }, []);\n}\n\n/**\n *\n * @param handlers -\n * @param ref -\n *\n * @internalremarks\n * Currently this sets new pan gesture functions every render. The memo route has been explored\n * in the past but ultimately we're still creating new functions every render. An optimisation\n * to explore is creating the pan gestures and loading them into a `ref`.\n *\n * @internal\n */\nfunction usePanGesture(_a, ref) {\n    var onPan = _a.onPan, onPanStart = _a.onPanStart, onPanEnd = _a.onPanEnd, onPanSessionStart = _a.onPanSessionStart;\n    var hasPanEvents = onPan || onPanStart || onPanEnd || onPanSessionStart;\n    var panSession = useRef(null);\n    var transformPagePoint = useContext(MotionConfigContext).transformPagePoint;\n    var handlers = {\n        onSessionStart: onPanSessionStart,\n        onStart: onPanStart,\n        onMove: onPan,\n        onEnd: function (event, info) {\n            panSession.current = null;\n            onPanEnd && onPanEnd(event, info);\n        },\n    };\n    useEffect(function () {\n        if (panSession.current !== null) {\n            panSession.current.updateHandlers(handlers);\n        }\n    });\n    function onPointerDown(event) {\n        panSession.current = new PanSession(event, handlers, {\n            transformPagePoint: transformPagePoint,\n        });\n    }\n    usePointerEvent(ref, \"pointerdown\", hasPanEvents && onPointerDown);\n    useUnmountEffect(function () { return panSession.current && panSession.current.end(); });\n}\n\n/**\n * Recursively traverse up the tree to check whether the provided child node\n * is the parent or a descendant of it.\n *\n * @param parent - Element to find\n * @param child - Element to test against parent\n */\nvar isNodeOrChild = function (parent, child) {\n    if (!child) {\n        return false;\n    }\n    else if (parent === child) {\n        return true;\n    }\n    else {\n        return isNodeOrChild(parent, child.parentElement);\n    }\n};\n\nvar order$1 = [\"whileHover\", \"whileTap\", \"whileDrag\"];\nvar getGesturePriority = function (gesture) {\n    return order$1.indexOf(gesture) + 1;\n};\n\nvar tapGesturePriority = getGesturePriority(\"whileTap\");\n/**\n * @param handlers -\n * @internal\n */\nfunction useTapGesture(_a, visualElement) {\n    var onTap = _a.onTap, onTapStart = _a.onTapStart, onTapCancel = _a.onTapCancel, whileTap = _a.whileTap;\n    var hasTapListeners = onTap || onTapStart || onTapCancel || whileTap;\n    var isTapping = useRef(false);\n    var cancelPointerEventListener = useRef(null);\n    function removePointerUp() {\n        var _a;\n        (_a = cancelPointerEventListener.current) === null || _a === void 0 ? void 0 : _a.call(cancelPointerEventListener);\n        cancelPointerEventListener.current = null;\n    }\n    whileTap && setOverride(visualElement, whileTap, tapGesturePriority);\n    // We load this event handler into a ref so we can later refer to\n    // onPointerUp.current which will always have reference to the latest props\n    var onPointerUp = useRef(null);\n    onPointerUp.current = function (event, info) {\n        var element = visualElement.getInstance();\n        removePointerUp();\n        if (!isTapping.current || !element)\n            return;\n        isTapping.current = false;\n        whileTap && clearOverride(visualElement, tapGesturePriority);\n        // Check the gesture lock - if we get it, it means no drag gesture is active\n        // and we can safely fire the tap gesture.\n        var openGestureLock = getGlobalLock(true);\n        if (!openGestureLock)\n            return;\n        openGestureLock();\n        if (!isNodeOrChild(element, event.target)) {\n            onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info);\n        }\n        else {\n            onTap === null || onTap === void 0 ? void 0 : onTap(event, info);\n        }\n    };\n    function onPointerDown(event, info) {\n        removePointerUp();\n        cancelPointerEventListener.current = pipe(addPointerEvent(window, \"pointerup\", function (event, info) { var _a; return (_a = onPointerUp.current) === null || _a === void 0 ? void 0 : _a.call(onPointerUp, event, info); }), addPointerEvent(window, \"pointercancel\", function (event, info) { var _a; return (_a = onPointerUp.current) === null || _a === void 0 ? void 0 : _a.call(onPointerUp, event, info); }));\n        var element = visualElement.getInstance();\n        if (!element || isTapping.current)\n            return;\n        isTapping.current = true;\n        onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);\n        whileTap && startOverride(visualElement, tapGesturePriority);\n    }\n    usePointerEvent(visualElement, \"pointerdown\", hasTapListeners ? onPointerDown : undefined);\n    useUnmountEffect(removePointerUp);\n}\n\nvar hoverPriority = getGesturePriority(\"whileHover\");\nvar filterTouch = function (listener) { return function (event, info) {\n    if (isMouseEvent(event))\n        listener(event, info);\n}; };\n/**\n *\n * @param props\n * @param ref\n * @internal\n */\nfunction useHoverGesture(_a, visualElement) {\n    var whileHover = _a.whileHover, onHoverStart = _a.onHoverStart, onHoverEnd = _a.onHoverEnd;\n    if (whileHover) {\n        setOverride(visualElement, whileHover, hoverPriority);\n    }\n    usePointerEvent(visualElement, \"pointerenter\", filterTouch(function (event, info) {\n        onHoverStart === null || onHoverStart === void 0 ? void 0 : onHoverStart(event, info);\n        whileHover && startOverride(visualElement, hoverPriority);\n    }));\n    usePointerEvent(visualElement, \"pointerleave\", filterTouch(function (event, info) {\n        onHoverEnd === null || onHoverEnd === void 0 ? void 0 : onHoverEnd(event, info);\n        whileHover && clearOverride(visualElement, hoverPriority);\n    }));\n}\n\n/**\n * Add pan and tap gesture recognition to an element.\n *\n * @param props - Gesture event handlers\n * @param ref - React `ref` containing a DOM `Element`\n * @public\n */\nfunction useGestures(props, visualElement) {\n    usePanGesture(props, visualElement);\n    useTapGesture(props, visualElement);\n    useHoverGesture(props, visualElement);\n}\n\nvar gestureProps = [\n    \"onPan\",\n    \"onPanStart\",\n    \"onPanEnd\",\n    \"onPanSessionStart\",\n    \"onTap\",\n    \"onTapStart\",\n    \"onTapCancel\",\n    \"whileTap\",\n    \"whileHover\",\n    \"onHoverStart\",\n    \"onHoverEnd\",\n];\nvar GestureComponent = makeRenderlessComponent(function (_a) {\n    var visualElement = _a.visualElement, props = __rest(_a, [\"visualElement\"]);\n    useGestures(props, visualElement);\n});\n/**\n * @public\n */\nvar Gestures = {\n    key: \"gestures\",\n    shouldRender: function (props) {\n        return gestureProps.some(function (key) { return props.hasOwnProperty(key); });\n    },\n    getComponent: function () { return GestureComponent; },\n};\n\n/**\n * Control animations on one or more components.\n *\n * @public\n */\nvar AnimationControls = /** @class */ (function () {\n    function AnimationControls() {\n        /**\n         * Track whether the host component has mounted.\n         *\n         * @internal\n         */\n        this.hasMounted = false;\n        /**\n         * Pending animations that are started before a component is mounted.\n         *\n         * @internal\n         */\n        this.pendingAnimations = [];\n        /**\n         * A collection of linked component animation controls.\n         *\n         * @internal\n         */\n        this.subscribers = new Set();\n    }\n    /**\n     * Subscribes a component's animation controls to this.\n     *\n     * @param controls - The controls to subscribe\n     * @returns An unsubscribe function.\n     *\n     * @internal\n     */\n    AnimationControls.prototype.subscribe = function (visualElement) {\n        var _this = this;\n        this.subscribers.add(visualElement);\n        return function () { return _this.subscribers.delete(visualElement); };\n    };\n    /**\n     * Starts an animation on all linked components.\n     *\n     * @remarks\n     *\n     * ```jsx\n     * controls.start(\"variantLabel\")\n     * controls.start({\n     *   x: 0,\n     *   transition: { duration: 1 }\n     * })\n     * ```\n     *\n     * @param definition - Properties or variant label to animate to\n     * @param transition - Optional `transtion` to apply to a variant\n     * @returns - A `Promise` that resolves when all animations have completed.\n     *\n     * @public\n     */\n    AnimationControls.prototype.start = function (definition, transitionOverride) {\n        var _this = this;\n        if (this.hasMounted) {\n            var animations_1 = [];\n            this.subscribers.forEach(function (visualElement) {\n                var animation = startVisualElementAnimation(visualElement, definition, { transitionOverride: transitionOverride });\n                animations_1.push(animation);\n            });\n            return Promise.all(animations_1);\n        }\n        else {\n            return new Promise(function (resolve) {\n                _this.pendingAnimations.push({\n                    animation: [definition, transitionOverride],\n                    resolve: resolve,\n                });\n            });\n        }\n    };\n    /**\n     * Instantly set to a set of properties or a variant.\n     *\n     * ```jsx\n     * // With properties\n     * controls.set({ opacity: 0 })\n     *\n     * // With variants\n     * controls.set(\"hidden\")\n     * ```\n     *\n     * @internalremarks\n     * We could perform a similar trick to `.start` where this can be called before mount\n     * and we maintain a list of of pending actions that get applied on mount. But the\n     * expectation of `set` is that it happens synchronously and this would be difficult\n     * to do before any children have even attached themselves. It's also poor practise\n     * and we should discourage render-synchronous `.start` calls rather than lean into this.\n     *\n     * @public\n     */\n    AnimationControls.prototype.set = function (definition) {\n        invariant(this.hasMounted, \"controls.set() should only be called after a component has mounted. Consider calling within a useEffect hook.\");\n        return this.subscribers.forEach(function (visualElement) {\n            setValues(visualElement, definition);\n        });\n    };\n    /**\n     * Stops animations on all linked components.\n     *\n     * ```jsx\n     * controls.stop()\n     * ```\n     *\n     * @public\n     */\n    AnimationControls.prototype.stop = function () {\n        this.subscribers.forEach(function (visualElement) {\n            stopAnimation(visualElement);\n        });\n    };\n    /**\n     * Initialises the animation controls.\n     *\n     * @internal\n     */\n    AnimationControls.prototype.mount = function () {\n        var _this = this;\n        this.hasMounted = true;\n        this.pendingAnimations.forEach(function (_a) {\n            var animation = _a.animation, resolve = _a.resolve;\n            _this.start.apply(_this, __spread(animation)).then(resolve);\n        });\n    };\n    /**\n     * Stops all child animations when the host component unmounts.\n     *\n     * @internal\n     */\n    AnimationControls.prototype.unmount = function () {\n        this.hasMounted = false;\n        this.stop();\n    };\n    return AnimationControls;\n}());\n/**\n * @internal\n */\nvar animationControls = function () { return new AnimationControls(); };\n\nvar ExitComponent = makeRenderlessComponent(function (props) {\n    var animate = props.animate, exit = props.exit, visualElement = props.visualElement;\n    var _a = __read(usePresence(), 2), isPresent = _a[0], onExitComplete = _a[1];\n    var presenceContext = useContext(PresenceContext);\n    var isPlayingExitAnimation = useRef(false);\n    var custom = (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.custom) !== undefined\n        ? presenceContext.custom\n        : props.custom;\n    useEffect(function () {\n        if (!isPresent) {\n            if (!isPlayingExitAnimation.current && exit) {\n                startVisualElementAnimation(visualElement, exit, {\n                    custom: custom,\n                }).then(onExitComplete);\n            }\n            isPlayingExitAnimation.current = true;\n        }\n        else if (isPlayingExitAnimation.current &&\n            animate &&\n            typeof animate !== \"boolean\" &&\n            !(animate instanceof AnimationControls)) {\n            startVisualElementAnimation(visualElement, animate);\n        }\n        if (isPresent) {\n            isPlayingExitAnimation.current = false;\n        }\n    }, [animate, custom, exit, isPresent, onExitComplete, props]);\n});\n/**\n * @public\n */\nvar Exit = {\n    key: \"exit\",\n    shouldRender: function (props) { return !!props.exit && !checkShouldInheritVariant(props); },\n    getComponent: function () { return ExitComponent; },\n};\n\nfunction shallowCompare(next, prev) {\n    if (prev === null)\n        return false;\n    var prevLength = prev.length;\n    if (prevLength !== next.length)\n        return false;\n    for (var i = 0; i < prevLength; i++) {\n        if (prev[i] !== next[i])\n            return false;\n    }\n    return true;\n}\n\nvar hasUpdated = function (prev, next) {\n    return (next !== undefined &&\n        (Array.isArray(prev) && Array.isArray(next)\n            ? !shallowCompare(next, prev)\n            : prev !== next));\n};\nfunction targetWithoutTransition(_a, mergeTransitionEnd) {\n    if (mergeTransitionEnd === void 0) { mergeTransitionEnd = false; }\n    var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, [\"transition\", \"transitionEnd\"]);\n    return mergeTransitionEnd\n        ? __assign(__assign({}, target), transitionEnd)\n        : target;\n}\n/**\n * Handle the `animate` prop when its an object of values, ie:\n *\n * ```jsx\n * <motion.div animate={{ opacity: 1 }} />\n * ```\n *\n * @internalremarks\n * It might be worth consolidating this with `use-variants`\n *\n * ```jsx\n * <motion.div animate=\"visible\" />\n * ```\n *\n * @param target\n * @param controls\n * @param values\n * @param transition\n *\n * @internal\n */\nfunction useAnimateProp(visualElement, targetAndTransition, defaultTransition) {\n    var isInitialRender = useRef(true);\n    var prevValues = useRef(null);\n    if (!prevValues.current) {\n        prevValues.current = targetWithoutTransition(targetAndTransition, true);\n    }\n    useEffect(function () {\n        var targetToAnimate = {};\n        // These are the values we're actually animating\n        var animatingTarget = targetWithoutTransition(targetAndTransition);\n        // This is the target as it'll be once transitionEnd values are applied\n        var finalTarget = targetWithoutTransition(targetAndTransition, true);\n        // Detect which values have changed between renders\n        for (var key in animatingTarget) {\n            // This value should animate on mount if this value doesn't already exist (wasn't\n            // defined in `style` or `initial`) or if it does exist and it's already changed.\n            var shouldAnimateOnMount = isInitialRender.current &&\n                (!visualElement.hasValue(key) ||\n                    visualElement.getValue(key).get() !== finalTarget[key]);\n            // If this value has updated between renders or it's we're animating this value on mount,\n            // add it to the animate target.\n            var isValidValue = finalTarget[key] !== null;\n            var valueHasUpdated = hasUpdated(prevValues.current[key], finalTarget[key]);\n            if (isValidValue && (valueHasUpdated || shouldAnimateOnMount)) {\n                targetToAnimate[key] = animatingTarget[key];\n            }\n        }\n        isInitialRender.current = false;\n        prevValues.current = __assign(__assign({}, prevValues.current), finalTarget);\n        if (Object.keys(targetToAnimate).length) {\n            startVisualElementAnimation(visualElement, __assign(__assign({}, targetToAnimate), { transition: targetAndTransition.transition || defaultTransition, transitionEnd: targetAndTransition.transitionEnd }));\n        }\n    }, [targetAndTransition]);\n}\n\nvar labelsToArray = function (label) {\n    if (!label) {\n        return [];\n    }\n    if (Array.isArray(label)) {\n        return label;\n    }\n    return [label];\n};\nvar resolveVariantLabels = function (variant) {\n    var unresolvedVariant = variant instanceof MotionValue ? variant.get() : variant;\n    return Array.from(new Set(labelsToArray(unresolvedVariant)));\n};\n/**\n * Hooks in React sometimes accept a dependency array as their final argument. (ie useEffect/useMemo)\n * When values in this array change, React re-runs the dependency. However if the array\n * contains a variable number of items, React throws an error.\n */\nvar asDependencyList = function (list) { return [\n    list.join(\",\"),\n]; };\n\nvar hasVariantChanged = function (oldVariant, newVariant) {\n    return oldVariant.join(\",\") !== newVariant.join(\",\");\n};\n/**\n * Handle variants and the `animate` prop when its set as variant labels.\n *\n * @param initial - Initial variant(s)\n * @param animate - Variant(s) to animate to\n * @param inherit - `true` is inheriting animations from parent\n * @param controls - Animation controls\n *\n * @internal\n */\nfunction useVariantAnimations(visualElement, initial, animate, inherit) {\n    var _a;\n    var targetVariants = resolveVariantLabels(animate);\n    var context = useVariantContext();\n    var parentAlreadyMounted = (_a = context.parent) === null || _a === void 0 ? void 0 : _a.isMounted;\n    var hasMounted = useRef(false);\n    useEffect(function () {\n        var shouldAnimate = false;\n        if (inherit) {\n            // If we're inheriting variant changes and the parent has already\n            // mounted when this component loads, we need to manually trigger\n            // this animation.\n            shouldAnimate = !!parentAlreadyMounted;\n            targetVariants = resolveVariantLabels(context.animate);\n        }\n        else {\n            shouldAnimate =\n                hasMounted.current ||\n                    hasVariantChanged(resolveVariantLabels(initial), targetVariants);\n        }\n        shouldAnimate &&\n            startVisualElementAnimation(visualElement, targetVariants);\n        hasMounted.current = true;\n    }, asDependencyList(targetVariants));\n}\n\n/**\n * `useAnimationGroupSubscription` allows a component to subscribe to an\n * externally-created `AnimationControls`, created by the `useAnimation` hook.\n *\n * @param animation\n * @param controls\n *\n * @internal\n */\nfunction useAnimationGroupSubscription(visualElement, animation) {\n    var unsubscribe = useMemo(function () { return animation.subscribe(visualElement); }, [\n        animation,\n    ]);\n    useUnmountEffect(function () { return unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe(); });\n}\n\nvar target = {\n    shouldRender: function (props) {\n        return props.animate !== undefined &&\n            !isVariantLabel(props.animate) &&\n            !isAnimationControls(props.animate);\n    },\n    Component: makeRenderlessComponent(function (_a) {\n        var animate = _a.animate, visualElement = _a.visualElement, transition = _a.transition;\n        return useAnimateProp(visualElement, animate, transition);\n    }),\n};\nvar variant = {\n    shouldRender: function (props) {\n        return (props.variants && !isAnimationControls(props.animate)) ||\n            isVariantLabel(props.animate);\n    },\n    Component: makeRenderlessComponent(function (_a) {\n        var animate = _a.animate, _b = _a.inherit, inherit = _b === void 0 ? true : _b, visualElement = _a.visualElement, initial = _a.initial;\n        return useVariantAnimations(visualElement, initial, animate, inherit);\n    }),\n};\nvar controls = {\n    shouldRender: function (props) { return isAnimationControls(props.animate); },\n    Component: makeRenderlessComponent(function (_a) {\n        var animate = _a.animate, visualElement = _a.visualElement;\n        return useAnimationGroupSubscription(visualElement, animate);\n    }),\n};\nvar getAnimationComponent = function (props) {\n    if (target.shouldRender(props)) {\n        return target.Component;\n    }\n    else if (variant.shouldRender(props)) {\n        return variant.Component;\n    }\n    else if (controls.shouldRender(props)) {\n        return controls.Component;\n    }\n};\n/**\n * @public\n */\nvar Animation = {\n    key: \"animation\",\n    shouldRender: function () { return true; },\n    getComponent: getAnimationComponent,\n};\n\nfunction tweenAxis(target, prev, next, p) {\n    target.min = mix(prev.min, next.min, p);\n    target.max = mix(prev.max, next.max, p);\n}\n\nvar progressTarget = 1000;\nvar Animate = /** @class */ (function (_super) {\n    __extends(Animate, _super);\n    function Animate() {\n        var _this = _super !== null && _super.apply(this, arguments) || this;\n        _this.frameTarget = {\n            x: { min: 0, max: 0 },\n            y: { min: 0, max: 0 },\n        };\n        _this.stopAxisAnimation = {\n            x: undefined,\n            y: undefined,\n        };\n        _this.animate = function (target, origin, _a) {\n            if (_a === void 0) { _a = {}; }\n            var originBox = _a.originBox, targetBox = _a.targetBox, visibilityAction = _a.visibilityAction, shouldStackAnimate = _a.shouldStackAnimate, config = __rest(_a, [\"originBox\", \"targetBox\", \"visibilityAction\", \"shouldStackAnimate\"]);\n            var _b = _this.props, visualElement = _b.visualElement, layout = _b.layout;\n            /**\n             * Early return if we've been instructed not to animate this render.\n             */\n            if (shouldStackAnimate === false)\n                return _this.safeToRemove();\n            /**\n             * Allow the measured origin (prev bounding box) and target (actual layout) to be\n             * overridden by the provided config.\n             */\n            origin = originBox || origin;\n            target = targetBox || target;\n            var boxHasMoved = hasMoved(origin, target);\n            var animations = eachAxis(function (axis) {\n                /**\n                 * If layout is set to \"position\", we can resize the origin box based on the target\n                 * box and only animate its position.\n                 */\n                if (layout === \"position\") {\n                    var targetLength = target[axis].max - target[axis].min;\n                    origin[axis].max = origin[axis].min + targetLength;\n                }\n                if (visualElement.isTargetBoxLocked) {\n                    return;\n                }\n                else if (visibilityAction !== undefined) {\n                    // If we're meant to show/hide the visualElement, do so\n                    visibilityAction === VisibilityAction.Hide\n                        ? visualElement.hide()\n                        : visualElement.show();\n                }\n                else if (boxHasMoved) {\n                    // If the box has moved, animate between it's current visual state and its\n                    // final state\n                    return _this.animateAxis(axis, target[axis], origin[axis], config);\n                }\n                else {\n                    // If the box has remained in the same place, immediately set the axis target\n                    // to the final desired state\n                    return visualElement.setAxisTarget(axis, target[axis].min, target[axis].max);\n                }\n            });\n            // Force a render to ensure there's no flash of uncorrected bounding box.\n            visualElement.render();\n            /**\n             * If this visualElement isn't present (ie it's been removed from the tree by the user but\n             * kept in by the tree by AnimatePresence) then call safeToRemove when all axis animations\n             * have successfully finished.\n             */\n            return Promise.all(animations).then(function () {\n                var _a, _b;\n                (_b = (_a = _this.props).onLayoutAnimationComplete) === null || _b === void 0 ? void 0 : _b.call(_a);\n                if (visualElement.isPresent) {\n                    visualElement.presence = Presence.Present;\n                }\n                else {\n                    _this.safeToRemove();\n                }\n            });\n        };\n        return _this;\n    }\n    Animate.prototype.componentDidMount = function () {\n        var _this = this;\n        var visualElement = this.props.visualElement;\n        visualElement.animateMotionValue = startAnimation;\n        visualElement.enableLayoutProjection();\n        this.unsubLayoutReady = visualElement.onLayoutUpdate(this.animate);\n        visualElement.updateConfig(__assign(__assign({}, visualElement.config), { safeToRemove: function () { return _this.safeToRemove(); } }));\n    };\n    Animate.prototype.componentWillUnmount = function () {\n        var _this = this;\n        this.unsubLayoutReady();\n        eachAxis(function (axis) { var _a, _b; return (_b = (_a = _this.stopAxisAnimation)[axis]) === null || _b === void 0 ? void 0 : _b.call(_a); });\n    };\n    /**\n     * TODO: This manually performs animations on the visualElement's layout progress\n     * values. It'd be preferable to amend the HTMLVisualElement.startLayoutAxisAnimation\n     * API to accept more custom animations like this.\n     */\n    Animate.prototype.animateAxis = function (axis, target, origin, _a) {\n        var _b, _c;\n        var _d = _a === void 0 ? {} : _a, transition = _d.transition, crossfadeOpacity = _d.crossfadeOpacity;\n        (_c = (_b = this.stopAxisAnimation)[axis]) === null || _c === void 0 ? void 0 : _c.call(_b);\n        var visualElement = this.props.visualElement;\n        var frameTarget = this.frameTarget[axis];\n        var layoutProgress = visualElement.axisProgress[axis];\n        /**\n         * Set layout progress back to 0. We set it twice to hard-reset any velocity that might\n         * be re-incoporated into a subsequent spring animation.\n         */\n        layoutProgress.clearListeners();\n        layoutProgress.set(0);\n        layoutProgress.set(0);\n        /**\n         * If this is a crossfade animation, create a function that updates both the opacity of this component\n         * and the one being crossfaded out.\n         */\n        var crossfade;\n        if (crossfadeOpacity) {\n            crossfade = this.createCrossfadeAnimation(crossfadeOpacity);\n            visualElement.show();\n        }\n        /**\n         * Create an animation function to run once per frame. This will tween the visual bounding box from\n         * origin to target using the latest progress value.\n         */\n        var frame = function () {\n            // Convert the latest layoutProgress, which is a value from 0-1000, into a 0-1 progress\n            var p = layoutProgress.get() / progressTarget;\n            // Tween the axis and update the visualElement with the latest values\n            tweenAxis(frameTarget, origin, target, p);\n            visualElement.setAxisTarget(axis, frameTarget.min, frameTarget.max);\n            // If this is a crossfade animation, update both elements.\n            crossfade === null || crossfade === void 0 ? void 0 : crossfade(p);\n        };\n        // Synchronously run a frame to ensure there's no flash of the uncorrected bounding box.\n        frame();\n        // Ensure that the layout delta is updated for this frame.\n        visualElement.updateLayoutDelta();\n        // Create a function to stop animation on this specific axis\n        var unsubscribeProgress = layoutProgress.onChange(frame);\n        // Start the animation on this axis\n        var animation = startAnimation(axis === \"x\" ? \"layoutX\" : \"layoutY\", layoutProgress, progressTarget, transition || this.props.transition || defaultTransition).then(unsubscribeProgress);\n        this.stopAxisAnimation[axis] = function () {\n            layoutProgress.stop();\n            unsubscribeProgress();\n        };\n        return animation;\n    };\n    Animate.prototype.createCrossfadeAnimation = function (crossfadeOpacity) {\n        var visualElement = this.props.visualElement;\n        var opacity = visualElement.getValue(\"opacity\", 0);\n        return function (p) {\n            opacity.set(easeCrossfadeIn(mix(0, 1, p)));\n            crossfadeOpacity.set(easeCrossfadeOut(mix(1, 0, p)));\n        };\n    };\n    Animate.prototype.safeToRemove = function () {\n        var _a, _b;\n        (_b = (_a = this.props).safeToRemove) === null || _b === void 0 ? void 0 : _b.call(_a);\n    };\n    Animate.prototype.render = function () {\n        return null;\n    };\n    return Animate;\n}(Component$1));\nfunction AnimateLayoutContextProvider(props) {\n    var _a = __read(usePresence(), 2), safeToRemove = _a[1];\n    return createElement(Animate, __assign({}, props, { safeToRemove: safeToRemove }));\n}\nfunction hasMoved(a, b) {\n    return hasAxisMoved(a.x, b.x) || hasAxisMoved(a.y, b.y);\n}\nfunction hasAxisMoved(a, b) {\n    return a.min !== b.min || a.max !== b.max;\n}\nvar defaultTransition = {\n    duration: 0.45,\n    ease: [0.4, 0, 0.1, 1],\n};\nfunction compress(min, max, easing) {\n    return function (p) {\n        // Could replace ifs with clamp\n        if (p < min)\n            return 0;\n        if (p > max)\n            return 1;\n        return easing(progress(min, max, p));\n    };\n}\nvar easeCrossfadeIn = compress(0, 0.5, circOut);\nvar easeCrossfadeOut = compress(0.5, 0.95, linear);\n/**\n * @public\n */\nvar AnimateLayout = {\n    key: \"animate-layout\",\n    shouldRender: function (props) { return !!props.layout || !!props.layoutId; },\n    getComponent: function () { return AnimateLayoutContextProvider; },\n};\n\n/**\n * This component is responsible for scheduling the measuring of the motion component\n */\nvar Measure = /** @class */ (function (_super) {\n    __extends(Measure, _super);\n    function Measure() {\n        return _super !== null && _super.apply(this, arguments) || this;\n    }\n    /**\n     * If this is a child of a SyncContext, register the VisualElement with it on mount.\n     */\n    Measure.prototype.componentDidMount = function () {\n        var _a = this.props, syncLayout = _a.syncLayout, framerSyncLayout = _a.framerSyncLayout, visualElement = _a.visualElement;\n        isSharedLayout(syncLayout) && syncLayout.register(visualElement);\n        isSharedLayout(framerSyncLayout) &&\n            framerSyncLayout.register(visualElement);\n    };\n    /**\n     * If this is a child of a SyncContext, notify it that it needs to re-render. It will then\n     * handle the snapshotting.\n     *\n     * If it is stand-alone component, add it to the batcher.\n     */\n    Measure.prototype.getSnapshotBeforeUpdate = function () {\n        var _a = this.props, syncLayout = _a.syncLayout, visualElement = _a.visualElement;\n        if (isSharedLayout(syncLayout)) {\n            syncLayout.syncUpdate();\n        }\n        else {\n            visualElement.snapshotBoundingBox();\n            syncLayout.add(visualElement);\n        }\n        return null;\n    };\n    Measure.prototype.componentDidUpdate = function () {\n        var _a = this.props, syncLayout = _a.syncLayout, visualElement = _a.visualElement;\n        if (!isSharedLayout(syncLayout))\n            syncLayout.flush();\n        /**\n         * If this axis isn't animating as a result of this render we want to reset the targetBox\n         * to the measured box\n         */\n        visualElement.rebaseTargetBox();\n    };\n    Measure.prototype.render = function () {\n        return null;\n    };\n    return Measure;\n}(React.Component));\nfunction MeasureContextProvider(props) {\n    var syncLayout = useContext(SharedLayoutContext);\n    var framerSyncLayout = useContext(FramerTreeLayoutContext);\n    return (React.createElement(Measure, __assign({}, props, { syncLayout: syncLayout, framerSyncLayout: framerSyncLayout })));\n}\nvar MeasureLayout = {\n    key: \"measure-layout\",\n    shouldRender: function (props) {\n        return !!props.drag || !!props.layout || !!props.layoutId;\n    },\n    getComponent: function () { return MeasureContextProvider; },\n};\n\nvar allMotionFeatures = [\n    MeasureLayout,\n    Animation,\n    Drag,\n    Gestures,\n    Exit,\n    AnimateLayout,\n];\nvar domBaseConfig = {\n    useVisualElement: useDomVisualElement,\n    render: render,\n};\n/**\n * Convert any React component into a `motion` component. The provided component\n * **must** use `React.forwardRef` to the underlying DOM component you want to animate.\n *\n * ```jsx\n * const Component = React.forwardRef((props, ref) => {\n *   return <div ref={ref} />\n * })\n *\n * const MotionComponent = motion.custom(Component)\n * ```\n *\n * @public\n */\nfunction createMotionProxy(defaultFeatures) {\n    var config = __assign(__assign({}, domBaseConfig), { defaultFeatures: defaultFeatures });\n    function custom(Component) {\n        return createMotionComponent(Component, config);\n    }\n    var componentCache = new Map();\n    function get(target, key) {\n        if (key === \"custom\")\n            return target.custom;\n        if (!componentCache.has(key)) {\n            componentCache.set(key, createMotionComponent(key, config));\n        }\n        return componentCache.get(key);\n    }\n    return new Proxy({ custom: custom }, { get: get });\n}\n/**\n * HTML & SVG components, optimised for use with gestures and animation. These can be used as\n * drop-in replacements for any HTML & SVG component, all CSS & SVG properties are supported.\n *\n * @public\n */\nvar motion = /*@__PURE__*/ createMotionProxy(allMotionFeatures);\n/**\n * Create a DOM `motion` component with the provided string. This is primarily intended\n * as a full alternative to `motion` for consumers who have to support environments that don't\n * support `Proxy`.\n *\n * ```javascript\n * import { createDomMotionComponent } from \"framer-motion\"\n *\n * const motion = {\n *   div: createDomMotionComponent('div')\n * }\n * ```\n *\n * @public\n */\nfunction createDomMotionComponent(key) {\n    return createMotionComponent(key, __assign(__assign({}, domBaseConfig), { defaultFeatures: allMotionFeatures }));\n}\n\n/**\n * @public\n */\nvar m = /*@__PURE__*/ createMotionProxy([MeasureLayout]);\n\nfunction useForceUpdate() {\n    var unloadingRef = useRef(false);\n    var _a = __read(useState(0), 2), forcedRenderCount = _a[0], setForcedRenderCount = _a[1];\n    useUnmountEffect(function () { return (unloadingRef.current = true); });\n    return useCallback(function () {\n        !unloadingRef.current && setForcedRenderCount(forcedRenderCount + 1);\n    }, [forcedRenderCount]);\n}\n\nvar presenceId = 0;\nfunction getPresenceId() {\n    var id = presenceId;\n    presenceId++;\n    return id;\n}\nvar PresenceChild = function (_a) {\n    var children = _a.children, initial = _a.initial, isPresent = _a.isPresent, onExitComplete = _a.onExitComplete, custom = _a.custom, presenceAffectsLayout = _a.presenceAffectsLayout;\n    var presenceChildren = useConstant(newChildrenMap);\n    var id = useConstant(getPresenceId);\n    var context = useMemo(function () {\n        return {\n            id: id,\n            initial: initial,\n            isPresent: isPresent,\n            custom: custom,\n            onExitComplete: function (childId) {\n                presenceChildren.set(childId, true);\n                var allComplete = true;\n                presenceChildren.forEach(function (isComplete) {\n                    if (!isComplete)\n                        allComplete = false;\n                });\n                allComplete && (onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete());\n            },\n            register: function (childId) {\n                presenceChildren.set(childId, false);\n                return function () { return presenceChildren.delete(childId); };\n            },\n        };\n    }, \n    /**\n     * If the presence of a child affects the layout of the components around it,\n     * we want to make a new context value to ensure they get re-rendered\n     * so they can detect that layout change.\n     */\n    presenceAffectsLayout ? undefined : [isPresent]);\n    useMemo(function () {\n        presenceChildren.forEach(function (_, key) { return presenceChildren.set(key, false); });\n    }, [isPresent]);\n    return (createElement(PresenceContext.Provider, { value: context }, children));\n};\nfunction newChildrenMap() {\n    return new Map();\n}\n\nfunction getChildKey(child) {\n    return child.key || \"\";\n}\nfunction updateChildLookup(children, allChildren) {\n    var seenChildren = process.env.NODE_ENV !== \"production\" ? new Set() : null;\n    children.forEach(function (child) {\n        var key = getChildKey(child);\n        if (process.env.NODE_ENV !== \"production\" && seenChildren) {\n            if (seenChildren.has(key)) {\n                console.warn(\"Children of AnimatePresence require unique keys. \\\"\" + key + \"\\\" is a duplicate.\");\n            }\n            seenChildren.add(key);\n        }\n        allChildren.set(key, child);\n    });\n}\nfunction onlyElements(children) {\n    var filtered = [];\n    // We use forEach here instead of map as map mutates the component key by preprending `.$`\n    Children.forEach(children, function (child) {\n        if (isValidElement(child))\n            filtered.push(child);\n    });\n    return filtered;\n}\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * @library\n *\n * Any `Frame` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { Frame, AnimatePresence } from 'framer'\n *\n * // As items are added and removed from `items`\n * export function Items({ items }) {\n *   return (\n *     <AnimatePresence>\n *       {items.map(item => (\n *         <Frame\n *           key={item.id}\n *           initial={{ opacity: 0 }}\n *           animate={{ opacity: 1 }}\n *           exit={{ opacity: 0 }}\n *         />\n *       ))}\n *     </AnimatePresence>\n *   )\n * }\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * @motion\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n *   <AnimatePresence>\n *     {items.map(item => (\n *       <motion.div\n *         key={item.id}\n *         initial={{ opacity: 0 }}\n *         animate={{ opacity: 1 }}\n *         exit={{ opacity: 0 }}\n *       />\n *     ))}\n *   </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nvar AnimatePresence = function (_a) {\n    var children = _a.children, custom = _a.custom, _b = _a.initial, initial = _b === void 0 ? true : _b, onExitComplete = _a.onExitComplete, exitBeforeEnter = _a.exitBeforeEnter, _c = _a.presenceAffectsLayout, presenceAffectsLayout = _c === void 0 ? true : _c;\n    // We want to force a re-render once all exiting animations have finished. We\n    // either use a local forceRender function, or one from a parent context if it exists.\n    var forceRender = useForceUpdate();\n    var layoutContext = useContext(SharedLayoutContext);\n    if (isSharedLayout(layoutContext)) {\n        forceRender = layoutContext.forceUpdate;\n    }\n    var isInitialRender = useRef(true);\n    // Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key\n    var filteredChildren = onlyElements(children);\n    // Keep a living record of the children we're actually rendering so we\n    // can diff to figure out which are entering and exiting\n    var presentChildren = useRef(filteredChildren);\n    // A lookup table to quickly reference components by key\n    var allChildren = useRef(new Map())\n        .current;\n    // A living record of all currently exiting components.\n    var exiting = useRef(new Set()).current;\n    updateChildLookup(filteredChildren, allChildren);\n    // If this is the initial component render, just deal with logic surrounding whether\n    // we play onMount animations or not.\n    if (isInitialRender.current) {\n        isInitialRender.current = false;\n        return (createElement(Fragment, null, filteredChildren.map(function (child) { return (createElement(PresenceChild, { key: getChildKey(child), isPresent: true, initial: initial ? undefined : false, presenceAffectsLayout: presenceAffectsLayout }, child)); })));\n    }\n    // If this is a subsequent render, deal with entering and exiting children\n    var childrenToRender = __spread(filteredChildren);\n    // Diff the keys of the currently-present and target children to update our\n    // exiting list.\n    var presentKeys = presentChildren.current.map(getChildKey);\n    var targetKeys = filteredChildren.map(getChildKey);\n    // Diff the present children with our target children and mark those that are exiting\n    var numPresent = presentKeys.length;\n    for (var i = 0; i < numPresent; i++) {\n        var key = presentKeys[i];\n        if (targetKeys.indexOf(key) === -1) {\n            exiting.add(key);\n        }\n        else {\n            // In case this key has re-entered, remove from the exiting list\n            exiting.delete(key);\n        }\n    }\n    // If we currently have exiting children, and we're deferring rendering incoming children\n    // until after all current children have exiting, empty the childrenToRender array\n    if (exitBeforeEnter && exiting.size) {\n        childrenToRender = [];\n    }\n    // Loop through all currently exiting components and clone them to overwrite `animate`\n    // with any `exit` prop they might have defined.\n    exiting.forEach(function (key) {\n        // If this component is actually entering again, early return\n        if (targetKeys.indexOf(key) !== -1)\n            return;\n        var child = allChildren.get(key);\n        if (!child)\n            return;\n        var insertionIndex = presentKeys.indexOf(key);\n        var onExit = function () {\n            allChildren.delete(key);\n            exiting.delete(key);\n            // Remove this child from the present children\n            var removeIndex = presentChildren.current.findIndex(function (presentChild) { return presentChild.key === key; });\n            presentChildren.current.splice(removeIndex, 1);\n            // Defer re-rendering until all exiting children have indeed left\n            if (!exiting.size) {\n                presentChildren.current = filteredChildren;\n                forceRender();\n                onExitComplete && onExitComplete();\n            }\n        };\n        childrenToRender.splice(insertionIndex, 0, createElement(PresenceChild, { key: getChildKey(child), isPresent: false, onExitComplete: onExit, custom: custom, presenceAffectsLayout: presenceAffectsLayout }, child));\n    });\n    // Add `MotionContext` even to children that don't need it to ensure we're rendering\n    // the same tree between renders\n    childrenToRender = childrenToRender.map(function (child) {\n        var key = child.key;\n        return exiting.has(key) ? (child) : (createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout }, child));\n    });\n    presentChildren.current = childrenToRender;\n    if (process.env.NODE_ENV !== \"production\" &&\n        exitBeforeEnter &&\n        childrenToRender.length > 1) {\n        console.warn(\"You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.\");\n    }\n    return (createElement(Fragment, null, exiting.size\n        ? childrenToRender\n        : childrenToRender.map(function (child) { return cloneElement(child); })));\n};\n\nfunction createSwitchAnimation(child, stack) {\n    if (stack && child !== stack.lead) {\n        return { visibilityAction: VisibilityAction.Hide };\n    }\n    else if (stack &&\n        child.presence !== Presence.Entering &&\n        child === stack.lead &&\n        stack.lead !== stack.prevLead) {\n        return { visibilityAction: VisibilityAction.Show };\n    }\n    var originBox;\n    var targetBox;\n    if (child.presence === Presence.Entering) {\n        originBox = stack === null || stack === void 0 ? void 0 : stack.getFollowOrigin();\n    }\n    else if (child.presence === Presence.Exiting) {\n        targetBox = stack === null || stack === void 0 ? void 0 : stack.getFollowTarget();\n    }\n    return { originBox: originBox, targetBox: targetBox };\n}\nfunction createCrossfadeAnimation(child, stack) {\n    var _a, _b, _c;\n    var config = {};\n    var stackLead = stack && stack.lead;\n    var stackLeadPresence = stackLead === null || stackLead === void 0 ? void 0 : stackLead.presence;\n    if (stack && child === stackLead) {\n        if (child.presence === Presence.Entering) {\n            config.originBox = stack.getFollowOrigin();\n        }\n        else if (child.presence === Presence.Exiting) {\n            config.targetBox = stack.getFollowTarget();\n        }\n    }\n    else if (stack && child === stack.follow) {\n        config.transition = stack.getLeadTransition();\n        if (stackLeadPresence === Presence.Entering) {\n            config.targetBox = stack.getLeadTarget();\n        }\n        else if (stackLeadPresence === Presence.Exiting) {\n            config.originBox = stack.getLeadOrigin();\n        }\n    }\n    // If neither the lead or follow component is the root child of AnimatePresence,\n    // don't handle crossfade animations\n    if (!((_a = stack === null || stack === void 0 ? void 0 : stack.follow) === null || _a === void 0 ? void 0 : _a.isPresenceRoot) && !(stackLead === null || stackLead === void 0 ? void 0 : stackLead.isPresenceRoot)) {\n        return config;\n    }\n    if (!stack || child === stackLead) {\n        if (child.presence === Presence.Entering) {\n            config.crossfadeOpacity = (_b = stack === null || stack === void 0 ? void 0 : stack.follow) === null || _b === void 0 ? void 0 : _b.getValue(\"opacity\", 0);\n        }\n    }\n    else if (stack && child === stack.follow) {\n        if (!stackLead || stackLeadPresence === Presence.Entering) ;\n        else if (stackLeadPresence === Presence.Exiting) {\n            config.crossfadeOpacity = (_c = stack === null || stack === void 0 ? void 0 : stack.lead) === null || _c === void 0 ? void 0 : _c.getValue(\"opacity\", 1);\n        }\n    }\n    else {\n        config.visibilityAction = VisibilityAction.Hide;\n    }\n    return config;\n}\n\n/**\n * For each layout animation, we want to identify two components\n * within a stack that will serve as the \"lead\" and \"follow\" components.\n *\n * In the switch animation, the lead component performs the entire animation.\n * It uses the follow bounding box to animate out from and back to. The follow\n * component is hidden.\n *\n * In the crossfade animation, both the lead and follow components perform\n * the entire animation, animating from the follow origin bounding box to the lead\n * target bounding box.\n *\n * Generalising a stack as First In Last Out, *searching from the end* we can\n * generally consider the lead component to be:\n *  - If the last child is present, the last child\n *  - If the last child is exiting, the last *encountered* exiting component\n */\nfunction findLeadAndFollow(stack, _a) {\n    var _b = __read(_a, 2), prevLead = _b[0], prevFollow = _b[1];\n    var lead = undefined;\n    var leadIndex = 0;\n    var follow = undefined;\n    // Find the lead child first\n    var numInStack = stack.length;\n    var lastIsPresent = false;\n    for (var i = numInStack - 1; i >= 0; i--) {\n        var child = stack[i];\n        var isLastInStack = i === numInStack - 1;\n        if (isLastInStack)\n            lastIsPresent = child.isPresent;\n        if (lastIsPresent) {\n            lead = child;\n        }\n        else {\n            // If the child before this will be present, make this the\n            // lead.\n            var prev = stack[i - 1];\n            if (prev && prev.isPresent)\n                lead = child;\n        }\n        if (lead) {\n            leadIndex = i;\n            break;\n        }\n    }\n    if (!lead)\n        lead = stack[0];\n    // Find the follow child\n    follow = stack[leadIndex - 1];\n    // If the lead component is exiting, find the closest follow\n    // present component\n    if (lead) {\n        for (var i = leadIndex - 1; i >= 0; i--) {\n            var child = stack[i];\n            if (child.isPresent) {\n                follow = child;\n                break;\n            }\n        }\n    }\n    // If the lead has changed and the previous lead still exists in the\n    // stack, set it to the previous lead. This allows us to differentiate between\n    // a, b, c(exit) -> a, b(exit), c(exit)\n    // and\n    // a, b(exit), c -> a, b(exit), c(exit)\n    if (lead !== prevLead &&\n        !lastIsPresent &&\n        follow === prevFollow &&\n        stack.find(function (stackChild) { return stackChild === prevLead; })) {\n        lead = prevLead;\n    }\n    return [lead, follow];\n}\nvar LayoutStack = /** @class */ (function () {\n    function LayoutStack() {\n        this.order = [];\n        // Track whether we've ever had a child\n        this.hasChildren = false;\n    }\n    LayoutStack.prototype.add = function (child) {\n        var _a;\n        this.order.push(child);\n        // Load previous values from snapshot into this child\n        // TODO Neaten up\n        // TODO Double check when reimplementing move\n        // TODO Add isDragging status and\n        if (this.snapshot) {\n            child.prevSnapshot = this.snapshot;\n            // TODO Remove in favour of above\n            child.prevViewportBox = this.snapshot.boundingBox;\n            var latest = this.snapshot.latestMotionValues;\n            for (var key in latest) {\n                if (!child.hasValue(key)) {\n                    child.addValue(key, motionValue(latest[key]));\n                }\n                else {\n                    (_a = child.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(latest[key]);\n                }\n            }\n        }\n        this.hasChildren = true;\n    };\n    LayoutStack.prototype.remove = function (child) {\n        var index = this.order.findIndex(function (stackChild) { return child === stackChild; });\n        if (index !== -1)\n            this.order.splice(index, 1);\n    };\n    LayoutStack.prototype.updateLeadAndFollow = function () {\n        this.prevLead = this.lead;\n        this.prevFollow = this.follow;\n        var _a = __read(findLeadAndFollow(this.order, [\n            this.lead,\n            this.follow,\n        ]), 2), lead = _a[0], follow = _a[1];\n        this.lead = lead;\n        this.follow = follow;\n    };\n    LayoutStack.prototype.updateSnapshot = function () {\n        if (!this.lead)\n            return;\n        var snapshot = {\n            boundingBox: this.lead.prevViewportBox,\n            latestMotionValues: {},\n        };\n        this.lead.forEachValue(function (value, key) {\n            var latest = value.get();\n            if (!isTransformProp(latest)) {\n                snapshot.latestMotionValues[key] = latest;\n            }\n        });\n        var dragControls = elementDragControls.get(this.lead);\n        if (dragControls && dragControls.isDragging) {\n            snapshot.isDragging = true;\n            snapshot.cursorProgress = dragControls.cursorProgress;\n        }\n        this.snapshot = snapshot;\n    };\n    LayoutStack.prototype.isLeadPresent = function () {\n        var _a;\n        return this.lead && ((_a = this.lead) === null || _a === void 0 ? void 0 : _a.presence) !== Presence.Exiting;\n    };\n    LayoutStack.prototype.getFollowOrigin = function () {\n        var _a;\n        return this.follow\n            ? this.follow.prevViewportBox\n            : (_a = this.snapshot) === null || _a === void 0 ? void 0 : _a.boundingBox;\n    };\n    LayoutStack.prototype.getFollowTarget = function () {\n        var _a;\n        return (_a = this.follow) === null || _a === void 0 ? void 0 : _a.box;\n    };\n    LayoutStack.prototype.getLeadOrigin = function () {\n        var _a;\n        return (_a = this.lead) === null || _a === void 0 ? void 0 : _a.prevViewportBox;\n    };\n    LayoutStack.prototype.getLeadTarget = function () {\n        var _a;\n        return (_a = this.lead) === null || _a === void 0 ? void 0 : _a.box;\n    };\n    LayoutStack.prototype.getLeadTransition = function () {\n        var _a;\n        return (_a = this.lead) === null || _a === void 0 ? void 0 : _a.config.transition;\n    };\n    return LayoutStack;\n}());\n\n/**\n * @public\n */\nvar AnimateSharedLayout = /** @class */ (function (_super) {\n    __extends(AnimateSharedLayout, _super);\n    function AnimateSharedLayout() {\n        var _this = _super !== null && _super.apply(this, arguments) || this;\n        /**\n         * A list of all the children in the shared layout\n         */\n        _this.children = new Set();\n        /**\n         * As animate components with a defined `layoutId` are added/removed to the tree,\n         * we store them in order. When one is added, it will animate out from the\n         * previous one, and when it's removed, it'll animate to the previous one.\n         */\n        _this.stacks = new Map();\n        /**\n         * Track whether the component has mounted. If it hasn't, the presence of added children\n         * are set to Present, whereas if it has they're considered Entering\n         */\n        _this.hasMounted = false;\n        /**\n         * Track whether we already have an update scheduled. If we don't, we'll run snapshots\n         * and schedule one.\n         */\n        _this.updateScheduled = false;\n        /**\n         * Tracks whether we already have a render scheduled. If we don't, we'll force one with this.forceRender\n         */\n        _this.renderScheduled = false;\n        /**\n         * The methods provided to all children in the shared layout tree.\n         */\n        _this.syncContext = __assign(__assign({}, createBatcher()), { syncUpdate: function (force) { return _this.scheduleUpdate(force); }, forceUpdate: function () {\n                // By copying syncContext to itself, when this component re-renders it'll also re-render\n                // all children subscribed to the SharedLayout context.\n                _this.syncContext = __assign({}, _this.syncContext);\n                _this.scheduleUpdate(true);\n            }, register: function (child) { return _this.addChild(child); }, remove: function (child) { return _this.removeChild(child); } });\n        return _this;\n    }\n    AnimateSharedLayout.prototype.componentDidMount = function () {\n        this.hasMounted = true;\n        this.updateStacks();\n    };\n    AnimateSharedLayout.prototype.componentDidUpdate = function () {\n        this.startLayoutAnimation();\n    };\n    AnimateSharedLayout.prototype.shouldComponentUpdate = function () {\n        this.renderScheduled = true;\n        return true;\n    };\n    AnimateSharedLayout.prototype.startLayoutAnimation = function () {\n        var _this = this;\n        /**\n         * Reset update and render scheduled status\n         */\n        this.renderScheduled = this.updateScheduled = false;\n        var type = this.props.type;\n        /**\n         * Update presence metadata based on the latest AnimatePresence status.\n         * This is a kind of goofy way of dealing with this, perhaps there's a better model to find.\n         */\n        this.children.forEach(function (child) {\n            if (!child.isPresent) {\n                child.presence = Presence.Exiting;\n            }\n            else if (child.presence !== Presence.Entering) {\n                child.presence =\n                    child.presence === Presence.Exiting\n                        ? Presence.Entering\n                        : Presence.Present;\n            }\n        });\n        /**\n         * In every layoutId stack, nominate a component to lead the animation and another\n         * to follow\n         */\n        this.updateStacks();\n        /**\n         * Decide which animation to use between shared layoutId components\n         */\n        var createAnimation = type === \"crossfade\"\n            ? createCrossfadeAnimation\n            : createSwitchAnimation;\n        /**\n         * Create a handler which we can use to flush the children animations\n         */\n        var handler = {\n            measureLayout: function (child) { return child.measureLayout(); },\n            layoutReady: function (child) {\n                var layoutId = child.layoutId;\n                child.layoutReady(createAnimation(child, _this.getStack(layoutId)));\n            },\n        };\n        /**\n         * Shared layout animations can be used without the AnimateSharedLayout wrapping component.\n         * This requires some co-ordination across components to stop layout thrashing\n         * and ensure measurements are taken at the correct time.\n         *\n         * Here we use that same mechanism of schedule/flush.\n         */\n        this.children.forEach(function (child) { return _this.syncContext.add(child); });\n        this.syncContext.flush(handler);\n        /**\n         * Clear snapshots so subsequent rerenders don't retain memory of outgoing components\n         */\n        this.stacks.forEach(function (stack) { return (stack.snapshot = undefined); });\n    };\n    AnimateSharedLayout.prototype.updateStacks = function () {\n        this.stacks.forEach(function (stack) { return stack.updateLeadAndFollow(); });\n    };\n    AnimateSharedLayout.prototype.scheduleUpdate = function (force) {\n        if (force === void 0) { force = false; }\n        if (!(force || !this.updateScheduled))\n            return;\n        /**\n         * Flag we've scheduled an update\n         */\n        this.updateScheduled = true;\n        /**\n         * Read: Snapshot children\n         */\n        this.children.forEach(function (child) { return child.snapshotBoundingBox(); });\n        /**\n         * Every child keeps a local snapshot, but we also want to record\n         * snapshots of the visible children as, if they're are being removed\n         * in this render, we can still access them.\n         */\n        this.stacks.forEach(function (stack) { return stack.updateSnapshot(); });\n        /**\n         * Force a rerender by setting state if we aren't already going to render.\n         */\n        if (force || !this.renderScheduled) {\n            this.renderScheduled = true;\n            this.forceUpdate();\n        }\n    };\n    AnimateSharedLayout.prototype.addChild = function (child) {\n        this.children.add(child);\n        this.addToStack(child);\n        child.presence = this.hasMounted ? Presence.Entering : Presence.Present;\n    };\n    AnimateSharedLayout.prototype.removeChild = function (child) {\n        this.scheduleUpdate();\n        this.children.delete(child);\n        this.removeFromStack(child);\n    };\n    AnimateSharedLayout.prototype.addToStack = function (child) {\n        var stack = this.getStack(child.layoutId);\n        stack === null || stack === void 0 ? void 0 : stack.add(child);\n    };\n    AnimateSharedLayout.prototype.removeFromStack = function (child) {\n        var stack = this.getStack(child.layoutId);\n        stack === null || stack === void 0 ? void 0 : stack.remove(child);\n    };\n    /**\n     * Return a stack of animate children based on the provided layoutId.\n     * Will create a stack if none currently exists with that layoutId.\n     */\n    AnimateSharedLayout.prototype.getStack = function (id) {\n        if (id === undefined)\n            return;\n        // Create stack if it doesn't already exist\n        !this.stacks.has(id) && this.stacks.set(id, new LayoutStack());\n        return this.stacks.get(id);\n    };\n    AnimateSharedLayout.prototype.render = function () {\n        return (createElement(SharedLayoutContext.Provider, { value: this.syncContext }, this.props.children));\n    };\n    return AnimateSharedLayout;\n}(Component$1));\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 * @library\n *\n * ```jsx\n * export function MyComponent() {\n *   const scale = useMotionValue(1)\n *\n *   return <Frame scale={scale} />\n * }\n * ```\n *\n * @motion\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 */\nfunction useMotionValue(initial) {\n    return useConstant(function () { return motionValue(initial); });\n}\n\nfunction useOnChange(value, callback) {\n    useEffect(function () {\n        return isMotionValue(value) ? value.onChange(callback) : undefined;\n    });\n}\nfunction useMultiOnChange(values, handler) {\n    useEffect(function () {\n        var subscriptions = values.map(function (value) { return value.onChange(handler); });\n        return function () { return subscriptions.forEach(function (unsubscribe) { return unsubscribe(); }); };\n    });\n}\n\nfunction useCombineMotionValues(values, combineValues) {\n    /**\n     * Initialise the returned motion value. This remains the same between renders.\n     */\n    var value = useMotionValue(combineValues());\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    var updateValue = function () { return value.set(combineValues()); };\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     * Subscribe to all motion values found within the template. Whenever any of them change,\n     * schedule an update.\n     */\n    useMultiOnChange(values, function () { return sync.update(updateValue, false, true); });\n    return value;\n}\n\n/**\n * Combine multiple motion values into a new one using a string template literal.\n *\n * ```jsx\n * import {\n *   motion,\n *   useSpring,\n *   useMotionValue,\n *   useMotionTemplate\n * } from \"framer-motion\"\n *\n * function Component() {\n *   const shadowX = useSpring(0)\n *   const shadowY = useMotionValue(0)\n *   const shadow = useMotionTemplate`drop-shadow(${shadowX}px ${shadowY}px 20px rgba(0,0,0,0.3))`\n *\n *   return <motion.div style={{ filter: shadow }} />\n * }\n * ```\n *\n * @public\n */\nfunction useMotionTemplate(fragments) {\n    var values = [];\n    for (var _i = 1; _i < arguments.length; _i++) {\n        values[_i - 1] = arguments[_i];\n    }\n    /**\n     * Create a function that will build a string from the latest motion values.\n     */\n    var numFragments = fragments.length;\n    function buildValue() {\n        var output = \"\";\n        for (var i = 0; i < numFragments; i++) {\n            output += fragments[i];\n            var value = values[i];\n            if (value)\n                output += values[i].get();\n        }\n        return output;\n    }\n    return useCombineMotionValues(values, buildValue);\n}\n\n/**\n * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself\n *\n * TODO: Remove and move to library\n *\n * @internal\n */\nfunction resolveMotionValue(value) {\n    var unwrappedValue = value instanceof MotionValue ? value.get() : value;\n    return isCustomValue(unwrappedValue)\n        ? unwrappedValue.toValue()\n        : unwrappedValue;\n}\n\nvar isCustomValueType = function (v) {\n    return typeof v === \"object\" && v.mix;\n};\nvar getMixer = function (v) { return (isCustomValueType(v) ? v.mix : undefined); };\nfunction transform() {\n    var args = [];\n    for (var _i = 0; _i < arguments.length; _i++) {\n        args[_i] = arguments[_i];\n    }\n    var useImmediate = !Array.isArray(args[0]);\n    var argOffset = useImmediate ? 0 : -1;\n    var inputValue = args[0 + argOffset];\n    var inputRange = args[1 + argOffset];\n    var outputRange = args[2 + argOffset];\n    var options = args[3 + argOffset];\n    var interpolator = interpolate(inputRange, outputRange, __assign({ mixer: getMixer(outputRange[0]) }, options));\n    return useImmediate ? interpolator(inputValue) : interpolator;\n}\n\nfunction useTransform(input, inputRangeOrTransformer, outputRange, options) {\n    var transformer = typeof inputRangeOrTransformer === \"function\"\n        ? inputRangeOrTransformer\n        : transform(inputRangeOrTransformer, outputRange, options);\n    return Array.isArray(input)\n        ? useListTransform(input, transformer)\n        : useListTransform([input], function (_a) {\n            var _b = __read(_a, 1), latest = _b[0];\n            return transformer(latest);\n        });\n}\nfunction useListTransform(values, transformer) {\n    var latest = useConstant(function () { return []; });\n    return useCombineMotionValues(values, function () {\n        latest.length = 0;\n        var numValues = values.length;\n        for (var i = 0; i < numValues; i++) {\n            latest[i] = values[i].get();\n        }\n        return transformer(latest);\n    });\n}\n\n// Keep things reasonable and avoid scale: Infinity. In practise we might need\n// to add another value, opacity, that could interpolate scaleX/Y [0,0.01] => [0,1]\n// to simply hide content at unreasonable scales.\nvar maxScale = 100000;\nvar invertScale = function (scale) {\n    return scale > 0.001 ? 1 / scale : maxScale;\n};\nvar hasWarned = false;\n/**\n * Returns a `MotionValue` each for `scaleX` and `scaleY` that update with the inverse\n * of their respective parent scales.\n *\n * This is useful for undoing the distortion of content when scaling a parent component.\n *\n * By default, `useInvertedScale` will automatically fetch `scaleX` and `scaleY` from the nearest parent.\n * By passing other `MotionValue`s in as `useInvertedScale({ scaleX, scaleY })`, it will invert the output\n * of those instead.\n *\n * @motion\n *\n * ```jsx\n * const MyComponent = () => {\n *   const { scaleX, scaleY } = useInvertedScale()\n *   return <motion.div style={{ scaleX, scaleY }} />\n * }\n * ```\n *\n * @library\n *\n * ```jsx\n * function MyComponent() {\n *   const { scaleX, scaleY } = useInvertedScale()\n *   return <Frame scaleX={scaleX} scaleY={scaleY} />\n * }\n * ```\n *\n * @deprecated\n */\nfunction useInvertedScale(scale) {\n    var parentScaleX = useMotionValue(1);\n    var parentScaleY = useMotionValue(1);\n    var visualElement = useVisualElementContext();\n    invariant(!!(scale || visualElement), \"If no scale values are provided, useInvertedScale must be used within a child of another motion component.\");\n    warning(hasWarned, \"useInvertedScale is deprecated and will be removed in 3.0. Use the layout prop instead.\");\n    hasWarned = true;\n    if (scale) {\n        parentScaleX = scale.scaleX || parentScaleX;\n        parentScaleY = scale.scaleY || parentScaleY;\n    }\n    else if (visualElement) {\n        parentScaleX = visualElement.getValue(\"scaleX\", 1);\n        parentScaleY = visualElement.getValue(\"scaleY\", 1);\n    }\n    var scaleX = useTransform(parentScaleX, invertScale);\n    var scaleY = useTransform(parentScaleY, invertScale);\n    return { scaleX: scaleX, scaleY: scaleY };\n}\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 */\nfunction useSpring(source, config) {\n    if (config === void 0) { config = {}; }\n    var activeSpringAnimation = useRef(null);\n    var value = useMotionValue(isMotionValue(source) ? source.get() : source);\n    useMemo(function () {\n        return value.attach(function (v, set) {\n            if (activeSpringAnimation.current) {\n                activeSpringAnimation.current.stop();\n            }\n            activeSpringAnimation.current = animate$1(__assign(__assign({ from: value.get(), to: v, velocity: value.getVelocity() }, config), { onUpdate: set }));\n            return value.get();\n        });\n    }, Object.values(config));\n    useOnChange(source, function (v) { return value.set(parseFloat(v)); });\n    return value;\n}\n\nfunction createScrollMotionValues() {\n    return {\n        scrollX: motionValue(0),\n        scrollY: motionValue(0),\n        scrollXProgress: motionValue(0),\n        scrollYProgress: motionValue(0),\n    };\n}\nfunction setProgress(offset, maxOffset, value) {\n    value.set(!offset || !maxOffset ? 0 : offset / maxOffset);\n}\nfunction createScrollUpdater(values, getOffsets) {\n    var update = function () {\n        var _a = getOffsets(), xOffset = _a.xOffset, yOffset = _a.yOffset, xMaxOffset = _a.xMaxOffset, yMaxOffset = _a.yMaxOffset;\n        // Set absolute positions\n        values.scrollX.set(xOffset);\n        values.scrollY.set(yOffset);\n        // Set 0-1 progress\n        setProgress(xOffset, xMaxOffset, values.scrollXProgress);\n        setProgress(yOffset, yMaxOffset, values.scrollYProgress);\n    };\n    update();\n    return update;\n}\n\nvar getElementScrollOffsets = function (element) { return function () {\n    return {\n        xOffset: element.scrollLeft,\n        yOffset: element.scrollTop,\n        xMaxOffset: element.scrollWidth - element.offsetWidth,\n        yMaxOffset: element.scrollHeight - element.offsetHeight,\n    };\n}; };\n/**\n * Returns MotionValues that update when the provided element scrolls:\n *\n * - `scrollX` — Horizontal scroll distance in pixels.\n * - `scrollY` — Vertical scroll distance in pixels.\n * - `scrollXProgress` — Horizontal scroll progress between `0` and `1`.\n * - `scrollYProgress` — Vertical scroll progress between `0` and `1`.\n *\n * This element must be set to `overflow: scroll` on either or both axes to report scroll offset.\n *\n * @library\n *\n * ```jsx\n * import * as React from \"react\"\n * import {\n *   Frame,\n *   useElementScroll,\n *   useTransform\n * } from \"framer\"\n *\n * export function MyComponent() {\n *   const ref = React.useRef()\n *   const { scrollYProgress } = useElementScroll(ref)\n *\n *   return (\n *     <Frame ref={ref}>\n *       <Frame scaleX={scrollYProgress} />\n *     </Frame>\n *   )\n * }\n * ```\n *\n * @motion\n *\n * ```jsx\n * export const MyComponent = () => {\n *   const ref = useRef()\n *   const { scrollYProgress } = useElementScroll(ref)\n *\n *   return (\n *     <div ref={ref}>\n *       <motion.div style={{ scaleX: scrollYProgress }} />\n *     </div>\n *   )\n * }\n * ```\n *\n * @public\n */\nfunction useElementScroll(ref) {\n    var values = useConstant(createScrollMotionValues);\n    useIsomorphicLayoutEffect(function () {\n        var element = ref.current;\n        invariant(!!element, \"ref provided to useScroll must be passed into a HTML element.\");\n        if (!element)\n            return;\n        var updateScrollValues = createScrollUpdater(values, getElementScrollOffsets(element));\n        var scrollListener = addDomEvent(element, \"scroll\", updateScrollValues, { passive: true });\n        var resizeListener = addDomEvent(element, \"resize\", updateScrollValues);\n        return function () {\n            scrollListener && scrollListener();\n            resizeListener && resizeListener();\n        };\n    }, []);\n    return values;\n}\n\nvar viewportScrollValues = createScrollMotionValues();\nfunction getViewportScrollOffsets() {\n    return {\n        xOffset: window.pageXOffset,\n        yOffset: window.pageYOffset,\n        xMaxOffset: document.body.clientWidth - window.innerWidth,\n        yMaxOffset: document.body.clientHeight - window.innerHeight,\n    };\n}\nvar hasListeners = false;\nfunction addEventListeners() {\n    hasListeners = true;\n    if (typeof window === \"undefined\")\n        return;\n    var updateScrollValues = createScrollUpdater(viewportScrollValues, getViewportScrollOffsets);\n    addDomEvent(window, \"scroll\", updateScrollValues, { passive: true });\n    addDomEvent(window, \"resize\", updateScrollValues);\n}\n/**\n * Returns MotionValues that update when the viewport scrolls:\n *\n * - `scrollX` — Horizontal scroll distance in pixels.\n * - `scrollY` — Vertical scroll distance in pixels.\n * - `scrollXProgress` — Horizontal scroll progress between `0` and `1`.\n * - `scrollYProgress` — Vertical scroll progress between `0` and `1`.\n *\n * @library\n *\n * ```jsx\n * import * as React from \"react\"\n * import {\n *   Frame,\n *   useViewportScroll,\n *   useTransform\n * } from \"framer\"\n *\n * export function MyComponent() {\n *   const { scrollYProgress } = useViewportScroll()\n *   return <Frame scaleX={scrollYProgress} />\n * }\n * ```\n *\n * @motion\n *\n * ```jsx\n * export const MyComponent = () => {\n *   const { scrollYProgress } = useViewportScroll()\n *   return <motion.div style={{ scaleX: scrollYProgress }} />\n * }\n * ```\n *\n * @public\n */\nfunction useViewportScroll() {\n    useIsomorphicLayoutEffect(function () {\n        !hasListeners && addEventListeners();\n    }, []);\n    return viewportScrollValues;\n}\n\n// Does this device prefer reduced motion? Returns `null` server-side.\nvar prefersReducedMotion = motionValue(null);\nif (typeof window !== \"undefined\") {\n    if (window.matchMedia) {\n        var motionMediaQuery_1 = window.matchMedia(\"(prefers-reduced-motion)\");\n        var setReducedMotionPreferences = function () {\n            return prefersReducedMotion.set(motionMediaQuery_1.matches);\n        };\n        motionMediaQuery_1.addListener(setReducedMotionPreferences);\n        setReducedMotionPreferences();\n    }\n    else {\n        prefersReducedMotion.set(false);\n    }\n}\n/**\n * A hook that returns `true` if we should be using reduced motion based on the current device's Reduced Motion setting.\n *\n * This can be used to implement changes to your UI based on Reduced Motion. For instance, replacing motion-sickness inducing\n * `x`/`y` animations with `opacity`, disabling the autoplay of background videos, or turning off parallax motion.\n *\n * It will actively respond to changes and re-render your components with the latest setting.\n *\n * ```jsx\n * export function Sidebar({ isOpen }) {\n *   const shouldReduceMotion = useReducedMotion()\n *   const closedX = shouldReduceMotion ? 0 : \"-100%\"\n *\n *   return (\n *     <motion.div animate={{\n *       opacity: isOpen ? 1 : 0,\n *       x: isOpen ? 0 : closedX\n *     }} />\n *   )\n * }\n * ```\n *\n * @return boolean\n *\n * @public\n */\nfunction useReducedMotion() {\n    var _a = __read(useState(prefersReducedMotion.get()), 2), shouldReduceMotion = _a[0], setShouldReduceMotion = _a[1];\n    useOnChange(prefersReducedMotion, setShouldReduceMotion);\n    return shouldReduceMotion;\n}\n\n/**\n * Creates `AnimationControls`, which can be used to manually start, stop\n * and sequence animations on one or more components.\n *\n * The returned `AnimationControls` 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 * @library\n *\n * ```jsx\n * import * as React from 'react'\n * import { Frame, useAnimation } from 'framer'\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 <Frame animate={controls} />\n * }\n * ```\n *\n * @motion\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 */\nfunction useAnimation() {\n    var animationControls = useConstant(function () { return new AnimationControls(); });\n    useEffect(function () {\n        animationControls.mount();\n        return function () { return animationControls.unmount(); };\n    }, []);\n    return animationControls;\n}\n\n/**\n * Animate a single value or a `MotionValue`.\n *\n * The first argument is either a `MotionValue` to animate, or an initial animation value.\n *\n * The second is either a value to animate to, or an array of keyframes to animate through.\n *\n * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.\n *\n * Returns `PlaybackControls`, currently just a `stop` method.\n *\n * ```javascript\n * const x = useMotionValue(0)\n *\n * useEffect(() => {\n *   const controls = animate(x, 100, {\n *     type: \"spring\",\n *     stiffness: 2000,\n *     onComplete: v => {}\n *   })\n *\n *   return controls.stop\n * })\n * ```\n *\n * @public\n */\nfunction animate(from, to, transition) {\n    if (transition === void 0) { transition = {}; }\n    var value = isMotionValue(from) ? from : motionValue(from);\n    startAnimation(\"\", value, to, transition);\n    return {\n        stop: function () { return value.stop(); },\n    };\n}\n\n/**\n * Cycles through a series of visual properties. Can be used to toggle between or cycle through animations. It works similar to `useState` in React. It is provided an initial array of possible states, and returns an array of two arguments.\n *\n * @library\n *\n * ```jsx\n * import * as React from \"react\"\n * import { Frame, useCycle } from \"framer\"\n *\n * export function MyComponent() {\n *   const [x, cycleX] = useCycle(0, 50, 100)\n *\n *   return (\n *     <Frame\n *       animate={{ x: x }}\n *       onTap={() => cycleX()}\n *      />\n *    )\n * }\n * ```\n *\n * @motion\n *\n * An index value can be passed to the returned `cycle` function to cycle to a specific index.\n *\n * ```jsx\n * import * as React from \"react\"\n * import { motion, useCycle } from \"framer-motion\"\n *\n * export const MyComponent = () => {\n *   const [x, cycleX] = useCycle(0, 50, 100)\n *\n *   return (\n *     <motion.div\n *       animate={{ x: x }}\n *       onTap={() => cycleX()}\n *      />\n *    )\n * }\n * ```\n *\n * @param items - items to cycle through\n * @returns [currentState, cycleState]\n *\n * @public\n */\nfunction useCycle() {\n    var items = [];\n    for (var _i = 0; _i < arguments.length; _i++) {\n        items[_i] = arguments[_i];\n    }\n    // TODO: After Framer X beta, remove this warning\n    warning(items.length > 1, \"useCycle syntax has changed. `useCycle([0, 1, 2])` becomes `useCycle(0, 1, 2)`\");\n    var index = useRef(0);\n    var _a = __read(useState(items[index.current]), 2), item = _a[0], setItem = _a[1];\n    return [\n        item,\n        function (next) {\n            index.current =\n                typeof next !== \"number\"\n                    ? wrap(0, items.length, index.current + 1)\n                    : next;\n            setItem(items[index.current]);\n        },\n    ];\n}\n\n/**\n * Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components.\n *\n * @library\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <Frame onTapStart={startDrag} />\n *     <Frame drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @motion\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <div onPointerDown={startDrag} />\n *     <motion.div drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @public\n */\nvar DragControls = /** @class */ (function () {\n    function DragControls() {\n        this.componentControls = new Set();\n    }\n    /**\n     * Subscribe a component's internal `VisualElementDragControls` to the user-facing API.\n     *\n     * @internal\n     */\n    DragControls.prototype.subscribe = function (controls) {\n        var _this = this;\n        this.componentControls.add(controls);\n        return function () { return _this.componentControls.delete(controls); };\n    };\n    /**\n     * Start a drag gesture on every `motion` component that has this set of drag controls\n     * passed into it via the `dragControls` prop.\n     *\n     * ```jsx\n     * dragControls.start(e, {\n     *   snapToCursor: true\n     * })\n     * ```\n     *\n     * @param event - PointerEvent\n     * @param options - Options\n     *\n     * @public\n     */\n    DragControls.prototype.start = function (event, options) {\n        this.componentControls.forEach(function (controls) {\n            controls.start(event.nativeEvent || event, options);\n        });\n    };\n    DragControls.prototype.updateConstraints = function () {\n        this.componentControls.forEach(function (controls) {\n            controls.prepareBoundingBox();\n            controls.resolveDragConstraints();\n        });\n    };\n    return DragControls;\n}());\nvar createDragControls = function () { return new DragControls(); };\n/**\n * Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop\n * and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we\n * might want to initiate that dragging from a different component than the draggable one.\n *\n * By creating a `dragControls` using the `useDragControls` hook, we can pass this into\n * the draggable component's `dragControls` prop. It exposes a `start` method\n * that can start dragging from pointer events on other components.\n *\n * @library\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <Frame onTapStart={startDrag} />\n *     <Frame drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @motion\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <div onPointerDown={startDrag} />\n *     <motion.div drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @public\n */\nfunction useDragControls() {\n    return useConstant(createDragControls);\n}\n\n/**\n * Uses the ref that is passed in, or creates a new one\n * @param external - External ref\n * @internal\n */\nfunction useExternalRef(externalRef) {\n    // We're conditionally calling `useRef` here which is sort of naughty as hooks\n    // shouldn't be called conditionally. However, Framer Motion will break if this\n    // condition changes anyway. It might be possible to use an invariant here to\n    // make it explicit, but I expect changing `ref` is not normal behaviour.\n    var ref = !externalRef || typeof externalRef === \"function\"\n        ? useRef(null)\n        : externalRef;\n    // Handle `ref` functions. Again, calling the hook conditionally is kind of naughty\n    // but `ref` types changing between renders would break Motion anyway. If we receive\n    // bug reports about this, we should track the provided ref and throw an invariant\n    // rather than move the conditional to inside the useEffect as this will be fired\n    // for every Frame component within Framer.\n    if (externalRef && typeof externalRef === \"function\") {\n        useEffect(function () {\n            externalRef(ref.current);\n            return function () { return externalRef(null); };\n        }, []);\n    }\n    return ref;\n}\n\n/**\n * This is just a very basic VisualElement, more of a hack to keep supporting useAnimatedState with\n * the latest APIs.\n */\nvar StateVisualElement = /** @class */ (function (_super) {\n    __extends(StateVisualElement, _super);\n    function StateVisualElement() {\n        var _this = _super !== null && _super.apply(this, arguments) || this;\n        _this.initialState = {};\n        return _this;\n    }\n    StateVisualElement.prototype.updateLayoutDelta = function () { };\n    StateVisualElement.prototype.build = function () { };\n    StateVisualElement.prototype.clean = function () { };\n    StateVisualElement.prototype.makeTargetAnimatable = function (_a) {\n        var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, [\"transition\", \"transitionEnd\"]);\n        var origin = getOrigin(target, transition || {}, this);\n        checkTargetForNewValues(this, target, origin);\n        return __assign({ transition: transition, transitionEnd: transitionEnd }, target);\n    };\n    StateVisualElement.prototype.getBoundingBox = function () {\n        return { x: { min: 0, max: 0 }, y: { min: 0, max: 0 } };\n    };\n    StateVisualElement.prototype.readNativeValue = function (key) {\n        return this.initialState[key] || 0;\n    };\n    StateVisualElement.prototype.render = function () {\n        this.build();\n    };\n    return StateVisualElement;\n}(VisualElement));\n/**\n * This is not an officially supported API and may be removed\n * on any version.\n * @internal\n */\nfunction useAnimatedState(initialState) {\n    var _a = __read(useState(initialState), 2), animationState = _a[0], setAnimationState = _a[1];\n    var visualElement = useConstant(function () { return new StateVisualElement(); });\n    visualElement.updateConfig({\n        onUpdate: function (v) { return setAnimationState(__assign({}, v)); },\n    });\n    visualElement.initialState = initialState;\n    useEffect(function () {\n        visualElement.mount({});\n        return function () { return visualElement.unmount(); };\n    }, []);\n    var startAnimation = useConstant(function () { return function (animationDefinition) {\n        return startVisualElementAnimation(visualElement, animationDefinition);\n    }; });\n    return [animationState, startAnimation];\n}\n\nexport { AnimateLayout as AnimateLayoutFeature, AnimatePresence, AnimateSharedLayout, AnimationControls, Animation as AnimationFeature, DragControls, Drag as DragFeature, Exit as ExitFeature, FramerTreeLayoutContext, Gestures as GesturesFeature, HTMLVisualElement, MotionConfig, MotionConfigContext, MotionValue, PresenceContext, SharedLayoutContext, VisibilityAction, addScaleCorrection, animate, animationControls, createBatcher, createDomMotionComponent, createMotionComponent, isValidMotionProp, m, motion, motionValue, resolveMotionValue, startAnimation, startVisualElementAnimation, transform, useAnimatedState, useAnimation, useCycle, useDomEvent, useDragControls, useElementScroll, useExternalRef, useGestures, useInvertedScale, useIsPresent, useMotionTemplate, useMotionValue, usePanGesture, usePresence, useReducedMotion, useSpring, useTapGesture, useTransform, useViewportScroll };\n","function memoize(fn) {\n  var cache = {};\n  return function (arg) {\n    if (cache[arg] === undefined) cache[arg] = fn(arg);\n    return cache[arg];\n  };\n}\n\nexport default memoize;\n","import memoize from '@emotion/memoize';\n\nvar reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23\n\nvar index = memoize(function (prop) {\n  return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111\n  /* o */\n  && prop.charCodeAt(1) === 110\n  /* n */\n  && prop.charCodeAt(2) < 91;\n}\n/* Z+1 */\n);\n\nexport default index;\n"],"names":["prevTime","onNextFrame","window","undefined","requestAnimationFrame","callback","timestamp","Date","now","timeToCall","Math","max","setTimeout","defaultElapsed","useDefaultElapsed","willRunNextFrame","isProcessing","delta","stepsOrder","setWillRunNextFrame","willRun","steps","reduce","acc","key","setRunNextFrame","processToRun","processToRunNextFrame","numThisFrame","i","cancelled","WeakSet","toKeepAlive","renderStep","cancel","process","indexOfCallback","indexOf","add","splice","frame","_a","process_1","length","has","schedule","keepAlive","immediate","addToCurrentBuffer","buffer","delete","push","createStep","step","startLoop","cancelSync","processStep","stepId","processFrame","min","forEach","getFrameData","isRefObject","ref","hasOwnProperty","SubscriptionManager","this","subscriptions","Set","prototype","handler","_this","notify","a","b","c","e_1","size","_b","__values","_c","next","done","value","e_1_1","error","return","call","clear","MotionValue","init","timeDelta","lastUpdated","updateSubscribers","renderSubscribers","canTrackVelocity","updateAndNotify","v","render","prev","current","scheduleVelocityCheck","velocityCheck","set","isNaN","parseFloat","onChange","subscription","clearListeners","onRenderRequest","get","attach","passiveEffect","getPrevious","getVelocity","start","animation","stop","Promise","resolve","stopAnimation","then","clearAnimation","isAnimating","destroy","motionValue","secondsToMilliseconds","seconds","easingLookup","linear","easeIn","easeInOut","easeOut","circIn","circInOut","circOut","backIn","backInOut","backOut","anticipate","bounceIn","bounceInOut","bounceOut","easingDefinitionToFunction","definition","Array","isArray","__read","x1","y1","x2","y2","isEasingArray","ease","isAnimatable","startsWith","isKeyframesTarget","underDampedSpring","type","stiffness","damping","restDelta","restSpeed","overDampedSpring","to","linearTween","duration","keyframes","values","defaultTransitions","x","y","z","rotate","rotateX","rotateY","rotateZ","scaleX","scaleY","scale","opacity","backgroundColor","color","default","getDefaultTransition","valueKey","transitionFactory","__assign","getPopmotionAnimationOptions","transition","options","__spread","from","hydrateKeyframes","when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","__rest","Object","keys","isTransitionDefined","yoyo","loop","flip","times","offset","map","convertTransitionToAnimationOptions","startAnimation","target","onComplete","delayTimer","controls","valueTransition","getValueTransition","origin","isTargetAnimatable","isOriginAnimatable","velocity","onUpdate","getAnimation","_d","_e","getDelayFromTransition","clearTimeout","resolveFinalValueInKeyframes","transform","round","defaultValueTypes","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderWidth","px","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","radius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","margin","marginTop","marginRight","marginBottom","marginLeft","scaleZ","skew","skewX","skewY","distance","translateX","translateY","translateZ","perspective","transformPerspective","originX","originY","originZ","zIndex","fillOpacity","strokeOpacity","numOctaves","dimensionValueTypes","vw","vh","test","parse","testValueType","findDimensionValueType","find","valueTypes","findValueType","getDefaultValueType","getValueAsType","isVariantLabels","isVariantLabel","resolveVariant","visualElement","variant","custom","resolved","isVariantResolver","getVariantPayload","forEachValue","getCurrent","setMotionValue","hasValue","getValue","addValue","setTarget","priority","makeTargetAnimatable","transitionEnd","baseTarget","setVariants","variantLabels","reverse","getVariant","variantChildren","child","setValues","checkTargetForNewValues","newValueKeys","filter","numNewValues","targetValue","readValue","readNativeValue","getOriginFromTransition","getOrigin","startVisualElementAnimation","opts","activeOverrides","resetIsAnimating","animations","label","animateVariant","all","animateVariantLabels","animateTarget","onAnimationStart","onAnimationComplete","variantDefinition","getChildrenAnimations","variantChildrenOrder","forwardDelay","variantLabel","maxStaggerDuration","generateStaggerDuration","animateChildren","first","last","transitionOverride","targetAndTransition","resolvedOverrides","valueTarget","allAnimations","setOverride","index","overrides","startOverride","override","clearOverride","highest","getHighestOverridePriortiy","overrideTarget","remainingValues","apply","VisualElement","parent","children","latest","Map","valueSubscriptions","config","isMounted","update","triggerRender","element","mount","unmount","externalRef","rootParent","treePath","depth","variants","addVariantChild","addVariantChildOrder","checkOverrideIsAnimating","numOverrides","resolvedOverride","subscribe","removeValue","setSingleStaticValue","subscribeToValue","defaultValue","getInstance","updateConfig","setStaticValues","scheduleRender","scheduleUpdateLayoutDelta","updateLayoutDelta","unsubscribeOnChange","unsubscribeOnRender","removeFromParent","_","noop","any","convertBoundingBoxToAxisBox","copyAxisBox","box","zeroDelta","translate","originPoint","transformAxes","boxDistortingKeys","transformProps","sortTransformProps","operationKey","isDistorting","axesKey","transformPropSet","isTransformProp","transformOriginProps","isTransformOriginProp","translateAlias","buildLayoutProjectionTransform","treeScale","identityProjection","isCSSVariable","isCSSVariable$1","cssVariableRegex","maxDepth","getVariableValue","match","exec","parseCSSVariable","token","fallback","getComputedStyle","getPropertyValue","trim","pixelsToPercent","pixels","axis","varToken","borderCorrectionDefinition","viewportBox","valueScaleCorrection","applyTo","boxShadow","_viewportBox","original","containsCSSVariables","includes","cssVariables","replace","shadow","template","xScale","yScale","averageScale","output","i_1","cssVariable","buildHTMLStyles","style","vars","transformOrigin","transformKeys","isLayoutProjectionEnabled","deltaFinal","targetBox","enableHardwareAcceleration","transformTemplate","allowTransformNone","hasTransform","hasTransformOrigin","transformIsNone","valueType","valueAsType","bucket","corrected","num","transformString","sort","numTransformKeys","buildBoxDistortingTransforms","buildLayoutProjectionTransformOrigin","transformIsDefault","transformHasZ","buildTransform","buildTransformOrigin","resetAxis","originAxis","scalePoint","point","applyPointDelta","boxScale","applyAxisDelta","applyBoxDelta","applyAxisTransforms","final","transforms","scaleKey","originKey","axisOrigin","xKeys","yKeys","removePointDelta","removeAxisTransforms","removeAxisDelta","clampProgress","isNear","maxDistance","calcLength","calcOrigin","source","sourceLength","targetLength","updateAxisDelta","updateBoxDelta","eachAxis","getBoundingBox","transformPagePoint","transformPoint","topLeft","bottomRight","transformBoundingBox","getBoundingClientRect","BoundingBoxDimension","positionalKeys","isPositionalKey","setAndResetVelocity","isNumOrPxType","getPosFromMatrix","matrix","pos","split","getTranslateFromMatrix","pos2","pos3","_bbox","matrix3d","nonTranslationalTransformKeys","positionalValues","checkAndConvertChangedValueTypes","targetPositionalKeys","removedTransformValues","hasAttemptedToRemoveTransformValues","changedValueTypeKeys","toType","fromType","numKeyframes","removedTransforms","removeNonTranslationalTransform","convertedTarget","changedKeys","originBbox","elementComputedStyle","display","originComputedStyle","targetBbox","convertChangedValueTypes","unitConversion","some","hasPositionalKey","parseDomVariant","HTMLElement","resolveCSSVariables","HTMLVisualElement","_super","arguments","defaultConfig","reactStyle","layoutUpdateListeners","layoutMeasureListeners","viewportBoxUpdateListeners","hasViewportBoxUpdated","targetBoxFinal","prevTreeScale","deltaTransform","stopLayoutAxisAnimation","isTargetBoxLocked","axisProgress","updateLayoutDeltas","fireUpdateLayoutDelta","__extends","clean","read","layoutOrigin","defaultValueType","parseDOMValues","transformValues","parsed","enableLayoutProjection","hide","isVisible","show","onLayoutUpdate","onLayoutMeasure","onViewportBoxUpdate","layoutReady","prevViewportBox","getBoundingBoxWithoutTransforms","bbox","snapshotBoundingBox","rebaseTargetBox","force","shouldRebase","setAxisTarget","measureLayout","boxCorrected","lockTargetBox","unlockTargetBox","stopLayoutAnimation","resetTransform","targetAxis","startLayoutAxisAnimation","progress","animateMotionValue","originBox","parentTreeScale","parentDelta","treeLength","applyTreeDeltas","updateTransformDeltas","finalBox","build","visibility","assign","setProperty","useConstant","useRef","calcOrigin$1","progressToPixels","dashKeys","array","camelKeys","unmeasured","buildSVGAttrs","attrs","dimensions","totalPathLength","attrX","attrY","pathLength","pathSpacing","pathOffset","calcSVGTransformOrigin","totalLength","spacing","useDashCase","buildSVGPath","camelCaseAttributes","CAMEL_CASE_PATTERN","camelToDash","str","toLowerCase","SVGVisualElement","measure","getBBox","e","tagName","getTotalLength","getAttribute","setAttribute","svgTagNames","isSVGComponent","Component","PresenceContext","createContext","MotionContext","variantContext","useVariantContext","useContext","useVisualElementContext","validMotionProps","isValidMotionProp","isPropValid","emotionIsPropValid_1","isMotionValue","isForcedMotionValue","layout","layoutId","addMotionValues","isStyle","props","foundMotionValue","reservedNames","Presence","VisibilityAction","empty","MotionConfigContext","p","features","isStatic","checkShouldInheritVariant","animate","inherit","defaultHandler","sortByDepth","createBatcher","queue","flush","order","isPresent","presence","Present","isSharedLayout","context","forceUpdate","SharedLayoutContext","FramerTreeLayoutContext","useIsomorphicLayoutEffect","useLayoutEffect","useEffect","usePresence","onExitComplete","register","id","useUniqueId","counter","incrementId","useInitialOrEveryRender","isInitialOnly","isInitialRender","isVariantLabel$1","isAnimationControls","createMotionComponent","defaultFeatures","useVisualElement","forwardRef","isForced","existsAsProp","existsAsStyle","propIsMotionValue","styleIsMotionValue","useMotionValues","initial","whileTap","whileHover","parentInitial","parentAnimate","presenceContext","controlsVariants","isVariantNode","useMemo","initialToApply","useVariants","plugins","allFeatures","numFeatures","shouldRender","getComponent","createElement","useFeatures","component","syncLayout","framerSyncLayout","remove","useSnapshotOnUnmount","Fragment","Provider","createLock","name","lock","globalHorizontalLock","globalVerticalLock","getGlobalLock","drag","openHorizontal_1","openVertical_1","addDomEvent","eventName","addEventListener","removeEventListener","isMouseEvent","event","PointerEvent","pointerType","MouseEvent","isTouchEvent","touches","defaultPagePoint","pageX","pageY","pointFromTouch","pointType","changedTouches","pointFromMouse","extractEventInfo","getViewportPointFromEvent","wrapHandler","shouldFilterPrimaryPointer","eventHandler","listener","button","isBrowser$1","supportsPointerEvents","onpointerdown","supportsTouchEvents","ontouchstart","supportsMouseEvents","onmousedown","mouseEventNames","pointerdown","pointermove","pointerup","pointercancel","pointerover","pointerout","pointerenter","pointerleave","touchEventNames","getPointerEventName","addPointerEvent","usePointerEvent","useDomEvent","PanSession","handlers","startEvent","lastMoveEvent","lastMoveEventInfo","updatePoint","info","getPanInfo","history","isPanStarted","isDistancePastThreshold","onStart","onMove","handlePointerMove","buttons","handlePointerUp","end","onEnd","panInfo","initialInfo","onSessionStart","removeListeners","updateHandlers","subtractPoint","lastDevicePoint","startDevicePoint","getVelocity$1","timestampedPoint","lastPoint","time","currentVelocity","Infinity","applyConstraints","elastic","calcRelativeAxisConstraints","calcViewportAxisConstraints","layoutAxis","constraintsAxis","lastPointerEvent","elementDragControls","WeakMap","VisualElementDragControls","isDragging","currentDirection","constraints","hasMutatedConstraints","cursorProgress","openGlobalLock","panSession","originEvent","snapToCursor","stopMotion","dragPropagation","prepareBoundingBox","resolveDragConstraints","axisValue","getAxisMotionValue","onDragStart","dragDirectionLock","lockThreshold","direction","abs","getCurrentDirection","onDirectionLock","updateAxis","onDrag","layoutBox","dragConstraints","resolveRefConstraints","relativeConstraints","onMeasureDragConstraints","constraintsElement","constraintsBox","measuredConstraints","calcViewportConstraints","userConstraints","convertAxisBoxToBoundingBox","cancelDrag","dragMomentum","dragElastic","onDragEnd","animateDragEnd","length_1","center","updateVisualElementAxis","shouldDrag","updateAxisMotionValue","nextValue","axisLayout","axisLength","calcConstrainedMinPoint","updateProps","_f","_g","remainingProps","dragKey","toUpperCase","dragTransition","momentumAnimations","bounceStiffness","bounceDamping","inertia","timeConstant","startAxisValueAnimation","onDragTransitionEnd","currentValue","boxProgress","calcPositionFromProgress","stopPointerListener","dragListener","stopResizeListener","stopLayoutUpdateListener","prevSnapshot","makeRenderlessComponent","hook","groupDragControls","dragControls","useDrag","Drag","useUnmountEffect","isNodeOrChild","parentElement","order$1","getGesturePriority","gesture","tapGesturePriority","hoverPriority","filterTouch","useGestures","onPan","onPanStart","onPanEnd","onPanSessionStart","hasPanEvents","onTap","onTapStart","onTapCancel","hasTapListeners","isTapping","cancelPointerEventListener","removePointerUp","onPointerUp","openGestureLock","useTapGesture","onHoverStart","onHoverEnd","useHoverGesture","gestureProps","GestureComponent","Gestures","AnimationControls","hasMounted","pendingAnimations","subscribers","animations_1","ExitComponent","exit","isPlayingExitAnimation","Exit","targetWithoutTransition","mergeTransitionEnd","resolveVariantLabels","unresolvedVariant","defaultTransition","prevValues","targetToAnimate","animatingTarget","finalTarget","shouldAnimateOnMount","isValidValue","valueHasUpdated","prevLength","shallowCompare","useAnimateProp","targetVariants","parentAlreadyMounted","oldVariant","newVariant","shouldAnimate","join","useVariantAnimations","unsubscribe","useAnimationGroupSubscription","Animation","Animate","frameTarget","stopAxisAnimation","visibilityAction","shouldStackAnimate","safeToRemove","boxHasMoved","hasAxisMoved","animateAxis","Hide","onLayoutAnimationComplete","componentDidMount","unsubLayoutReady","componentWillUnmount","crossfadeOpacity","crossfade","layoutProgress","createCrossfadeAnimation","tweenAxis","unsubscribeProgress","easeCrossfadeIn","easeCrossfadeOut","AnimateLayoutContextProvider","compress","easing","AnimateLayout","Measure","getSnapshotBeforeUpdate","syncUpdate","componentDidUpdate","MeasureContextProvider","MeasureLayout","allMotionFeatures","domBaseConfig","presenceId","isPresenceRoot","forwardedProps","domProps","filterProps","visualProps","buildSVGProps","htmlProps","draggable","userSelect","touchAction","buildHTMLProps","createMotionProxy","componentCache","Proxy","motion","getPresenceId","PresenceChild","presenceAffectsLayout","presenceChildren","newChildrenMap","childId","allComplete","isComplete","getChildKey","AnimatePresence","exitBeforeEnter","forceRender","unloadingRef","useState","forcedRenderCount","setForcedRenderCount","useCallback","useForceUpdate","layoutContext","filteredChildren","filtered","Children","isValidElement","onlyElements","presentChildren","allChildren","exiting","updateChildLookup","childrenToRender","presentKeys","targetKeys","numPresent","insertionIndex","removeIndex","findIndex","presentChild","cloneElement","createSwitchAnimation","stack","lead","Entering","prevLead","Show","getFollowOrigin","Exiting","getFollowTarget","stackLead","stackLeadPresence","follow","getLeadTransition","getLeadTarget","getLeadOrigin","LayoutStack","hasChildren","snapshot","boundingBox","latestMotionValues","stackChild","updateLeadAndFollow","prevFollow","leadIndex","numInStack","lastIsPresent","findLeadAndFollow","updateSnapshot","isLeadPresent","AnimateSharedLayout","stacks","updateScheduled","renderScheduled","syncContext","scheduleUpdate","addChild","removeChild","updateStacks","startLayoutAnimation","shouldComponentUpdate","createAnimation","getStack","addToStack","removeFromStack","createScrollMotionValues","scrollX","scrollY","scrollXProgress","scrollYProgress","prefersReducedMotion","matchMedia","motionMediaQuery_1","setReducedMotionPreferences","matches","addListener","useAnimation","animationControls","DragControls","componentControls","nativeEvent","updateConstraints","StateVisualElement","initialState","reactPropsRegex","fn","cache","arg","prop","charCodeAt"],"sourceRoot":""}