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,KACA,SAASC,CAAG,GACX,KACED,EACIC,CAA0B,CACtB,CAGxB,CACJ,CAEA,KAAK,KAAK,eAAe,MAAK,EAC9B,KAAK,KAAK,eAAe,eAAc,CAC3C,MACI,KAAK,KAAK,eAAe,UAAU,OAAQ,EAAK,EAGpD,KAAK,eAAiB,GACtB,MACJ,CAEA,IAAMC,EAAgB,KAAK,KAAK,eAAe,UAC3C,OACA,CAACX,CAAS,EAGVC,GAAkB,CAACD,GACnBW,EAAc,KAAK,IAAK,CACpB,KAAK,eAAiB,GACtBV,EAAe,KAAK,EAAE,CAC1B,CAAC,CAET,CAEA,OAAK,CACD,GAAM,CAAE,SAAAW,EAAU,eAAAX,CAAc,EAAK,KAAK,KAAK,iBAAmB,CAAA,EAE9DA,GACAA,EAAe,KAAK,EAAE,EAGtBW,IACA,KAAK,QAAUA,EAAS,KAAK,EAAE,EAEvC,CAEA,SAAO,CAAI,CACd,EChFM,IAAMC,EAA8B,CACvC,UAAW,CACP,QAASC,CACZ,EACD,KAAM,CACF,QAASC,CACZ","names":["AnimationFeature","Feature","node","createAnimationState","animate","isAnimationControls","prevAnimate","id","ExitAnimationFeature","Feature","isPresent","onExitComplete","prevIsPresent","initial","custom","resolved","resolveVariant","transition","transitionEnd","target","key","exitAnimation","register","animations","AnimationFeature","ExitAnimationFeature"],"sources":["../esm/npm/framer-motion@12.38.0/node_modules/framer-motion/src/motion/features/animation/index.ts","../esm/npm/framer-motion@12.38.0/node_modules/framer-motion/src/motion/features/animation/exit.ts","../esm/npm/framer-motion@12.38.0/node_modules/framer-motion/src/motion/features/animations.ts"],"sourcesContent":["import {\n    createAnimationState,\n    Feature,\n    isAnimationControls,\n    type VisualElement,\n} from \"motion-dom\"\n\nexport class AnimationFeature extends Feature\u003cunknown\u003e {\n    unmountControls?: () =\u003e void\n\n    /**\n     * We dynamically generate the AnimationState manager as it contains a reference\n     * to the underlying animation library. We only want to load that if we load this,\n     * so people can optionally code split it out using the `m` component.\n     */\n    constructor(node: VisualElement) {\n        super(node)\n        node.animationState ||= createAnimationState(node)\n    }\n\n    updateAnimationControlsSubscription() {\n        const { animate } = this.node.getProps()\n        if (isAnimationControls(animate)) {\n            this.unmountControls = animate.subscribe(this.node)\n        }\n    }\n\n    /**\n     * Subscribe any provided AnimationControls to the component's VisualElement\n     */\n    mount() {\n        this.updateAnimationControlsSubscription()\n    }\n\n    update() {\n        const { animate } = this.node.getProps()\n        const { animate: prevAnimate } = this.node.prevProps || {}\n        if (animate !== prevAnimate) {\n            this.updateAnimationControlsSubscription()\n        }\n    }\n\n    unmount() {\n        this.node.animationState!.reset()\n        this.unmountControls?.()\n    }\n}\n","import { Feature, resolveVariant } from \"motion-dom\"\n\nlet id = 0\n\nexport class ExitAnimationFeature extends Feature\u003cunknown\u003e {\n    private id: number = id++\n    private isExitComplete = false\n\n    update() {\n        if (!this.node.presenceContext) return\n\n        const { isPresent, onExitComplete } = this.node.presenceContext\n        const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}\n\n        if (!this.node.animationState || isPresent === prevIsPresent) {\n            return\n        }\n\n        if (isPresent \u0026\u0026 prevIsPresent === false) {\n            /**\n             * When re-entering, if the exit animation already completed\n             * (element is at rest), reset to initial values so the enter\n             * animation replays from the correct position.\n             */\n            if (this.isExitComplete) {\n                const { initial, custom } = this.node.getProps()\n\n                if (typeof initial === \"string\") {\n                    const resolved = resolveVariant(\n                        this.node,\n                        initial,\n                        custom\n                    )\n                    if (resolved) {\n                        const { transition, transitionEnd, ...target } =\n                            resolved\n                        for (const key in target) {\n                            this.node\n                                .getValue(key)\n                                ?.jump(\n                                    target[\n                                        key as keyof typeof target\n                                    ] as any\n                                )\n                        }\n                    }\n                }\n\n                this.node.animationState.reset()\n                this.node.animationState.animateChanges()\n            } else {\n                this.node.animationState.setActive(\"exit\", false)\n            }\n\n            this.isExitComplete = false\n            return\n        }\n\n        const exitAnimation = this.node.animationState.setActive(\n            \"exit\",\n            !isPresent\n        )\n\n        if (onExitComplete \u0026\u0026 !isPresent) {\n            exitAnimation.then(() =\u003e {\n                this.isExitComplete = true\n                onExitComplete(this.id)\n            })\n        }\n    }\n\n    mount() {\n        const { register, onExitComplete } = this.node.presenceContext || {}\n\n        if (onExitComplete) {\n            onExitComplete(this.id)\n        }\n\n        if (register) {\n            this.unmount = register(this.id)\n        }\n    }\n\n    unmount() {}\n}\n","import { AnimationFeature } from \"./animation\"\nimport { ExitAnimationFeature } from \"./animation/exit\"\nimport { FeaturePackages } from \"./types\"\n\nexport const animations: FeaturePackages = {\n    animation: {\n        Feature: AnimationFeature,\n    },\n    exit: {\n        Feature: ExitAnimationFeature,\n    },\n}\n"],"version":3}
