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EA,QAAM,CACF,GAAI,OAAO,qBAAyB,IAAa,OAEjD,GAAM,CAAE,MAAAO,EAAO,UAAAC,CAAS,EAAK,KAAK,KACR,CAAC,SAAU,SAAU,MAAM,EAAE,KACnDC,EAAyBF,EAAOC,CAAS,CAAC,GAI1C,KAAK,cAAa,CAE1B,CAEA,SAAO,CACH,KAAK,eAAY,EACjB,KAAK,eAAiB,GACtB,KAAK,SAAW,EACpB,CACH,EAED,SAASC,EACL,CAAE,SAAAf,EAAW,CAAA,CAAE,EACf,CAAE,SAAUgB,EAAe,CAAA,CAAE,EAAkB,CAAA,EAAE,CAEjD,OAAQC,GACJjB,EAASiB,CAAI,IAAMD,EAAaC,CAAI,CAC5C,CChGO,IAAMC,GAAqC,CAC9C,OAAQ,CACJ,QAASC,CACZ,EACD,IAAK,CACD,QAASC,CACZ,EACD,MAAO,CACH,QAASC,CACZ,EACD,MAAO,CACH,QAASC,CACZ","names":["handleHoverEvent","node","event","lifecycle","props","eventName","callback","frame","extractEventInfo","HoverGesture","Feature","current","hover","_element","startEvent","endEvent","FocusGesture","Feature","isFocusVisible","pipe","addDomEvent","handlePressEvent","node","event","lifecycle","props","eventName","callback","frame","extractEventInfo","PressGesture","Feature","current","globalTapTarget","propagate","press","_element","startEvent","endEvent","success","observerCallbacks","observers","fireObserverCallback","entry","callback","fireAllObserverCallbacks","entries","initIntersectionObserver","root","options","lookupRoot","rootObservers","key","observeIntersection","element","rootInteresectionObserver","thresholdNames","InViewFeature","Feature","viewport","root","rootMargin","amount","once","options","onIntersectionUpdate","entry","isIntersecting","onViewportEnter","onViewportLeave","callback","observeIntersection","props","prevProps","hasViewportOptionChanged","prevViewport","name","gestureAnimations","InViewFeature","PressGesture","FocusGesture","HoverGesture"],"sources":["../esm/npm/framer-motion@12.38.0/node_modules/framer-motion/src/gestures/hover.ts","../esm/npm/framer-motion@12.38.0/node_modules/framer-motion/src/gestures/focus.ts","../esm/npm/framer-motion@12.38.0/node_modules/framer-motion/src/gestures/press.ts","../esm/npm/framer-motion@12.38.0/node_modules/framer-motion/src/motion/features/viewport/observers.ts","../esm/npm/framer-motion@12.38.0/node_modules/framer-motion/src/motion/features/viewport/index.ts","../esm/npm/framer-motion@12.38.0/node_modules/framer-motion/src/motion/features/gestures.ts"],"sourcesContent":["import { Feature, frame, hover, type VisualElement } from \"motion-dom\"\nimport { extractEventInfo } from \"../events/event-info\"\n\nfunction handleHoverEvent(\n    node: VisualElement\u003cElement\u003e,\n    event: PointerEvent,\n    lifecycle: \"Start\" | \"End\"\n) {\n    const { props } = node\n\n    if (node.animationState \u0026\u0026 props.whileHover) {\n        node.animationState.setActive(\"whileHover\", lifecycle === \"Start\")\n    }\n\n    const eventName = (\"onHover\" + lifecycle) as \"onHoverStart\" | \"onHoverEnd\"\n    const callback = props[eventName]\n    if (callback) {\n        frame.postRender(() =\u003e callback(event, extractEventInfo(event)))\n    }\n}\n\nexport class HoverGesture extends Feature\u003cElement\u003e {\n    mount() {\n        const { current } = this.node\n        if (!current) return\n\n        this.unmount = hover(current, (_element, startEvent) =\u003e {\n            handleHoverEvent(this.node, startEvent, \"Start\")\n\n            return (endEvent) =\u003e handleHoverEvent(this.node, endEvent, \"End\")\n        })\n    }\n\n    unmount() {}\n}\n","import { Feature, addDomEvent } from \"motion-dom\"\nimport { pipe } from \"motion-utils\"\n\nexport class FocusGesture extends Feature\u003cElement\u003e {\n    private isActive = false\n\n    onFocus() {\n        let isFocusVisible = false\n\n        /**\n         * If this element doesn't match focus-visible then don't\n         * apply whileHover. But, if matches throws that focus-visible\n         * is not a valid selector then in that browser outline styles will be applied\n         * to the element by default and we want to match that behaviour with whileFocus.\n         */\n        try {\n            isFocusVisible = this.node.current!.matches(\":focus-visible\")\n        } catch (e) {\n            isFocusVisible = true\n        }\n\n        if (!isFocusVisible || !this.node.animationState) return\n\n        this.node.animationState.setActive(\"whileFocus\", true)\n        this.isActive = true\n    }\n\n    onBlur() {\n        if (!this.isActive || !this.node.animationState) return\n        this.node.animationState.setActive(\"whileFocus\", false)\n        this.isActive = false\n    }\n\n    mount() {\n        this.unmount = pipe(\n            addDomEvent(this.node.current!, \"focus\", () =\u003e this.onFocus()),\n            addDomEvent(this.node.current!, \"blur\", () =\u003e this.onBlur())\n        ) as VoidFunction\n    }\n\n    unmount() {}\n}\n","import { Feature, frame, press, type VisualElement } from \"motion-dom\"\nimport { extractEventInfo } from \"../events/event-info\"\n\nfunction handlePressEvent(\n    node: VisualElement\u003cElement\u003e,\n    event: PointerEvent,\n    lifecycle: \"Start\" | \"End\" | \"Cancel\"\n) {\n    const { props } = node\n\n    if (node.current instanceof HTMLButtonElement \u0026\u0026 node.current.disabled) {\n        return\n    }\n\n    if (node.animationState \u0026\u0026 props.whileTap) {\n        node.animationState.setActive(\"whileTap\", lifecycle === \"Start\")\n    }\n\n    const eventName = (\"onTap\" + (lifecycle === \"End\" ? \"\" : lifecycle)) as\n        | \"onTapStart\"\n        | \"onTap\"\n        | \"onTapCancel\"\n\n    const callback = props[eventName]\n    if (callback) {\n        frame.postRender(() =\u003e callback(event, extractEventInfo(event)))\n    }\n}\n\nexport class PressGesture extends Feature\u003cElement\u003e {\n    mount() {\n        const { current } = this.node\n        if (!current) return\n\n        const { globalTapTarget, propagate } = this.node.props\n\n        this.unmount = press(\n            current,\n            (_element, startEvent) =\u003e {\n                handlePressEvent(this.node, startEvent, \"Start\")\n\n                return (endEvent, { success }) =\u003e\n                    handlePressEvent(\n                        this.node,\n                        endEvent,\n                        success ? \"End\" : \"Cancel\"\n                    )\n            },\n            {\n                useGlobalTarget: globalTapTarget,\n                stopPropagation: propagate?.tap === false,\n            }\n        )\n    }\n\n    unmount() {}\n}\n","type IntersectionHandler = (entry: IntersectionObserverEntry) =\u003e void\n\ninterface ElementIntersectionObservers {\n    [key: string]: IntersectionObserver\n}\n\n/**\n * Map an IntersectionHandler callback to an element. We only ever make one handler for one\n * element, so even though these handlers might all be triggered by different\n * observers, we can keep them in the same map.\n */\nconst observerCallbacks = new WeakMap\u003cElement, IntersectionHandler\u003e()\n\n/**\n * Multiple observers can be created for multiple element/document roots. Each with\n * different settings. So here we store dictionaries of observers to each root,\n * using serialised settings (threshold/margin) as lookup keys.\n */\nconst observers = new WeakMap\u003c\n    Element | Document,\n    ElementIntersectionObservers\n\u003e()\n\nconst fireObserverCallback = (entry: IntersectionObserverEntry) =\u003e {\n    const callback = observerCallbacks.get(entry.target)\n    callback \u0026\u0026 callback(entry)\n}\n\nconst fireAllObserverCallbacks: IntersectionObserverCallback = (entries) =\u003e {\n    entries.forEach(fireObserverCallback)\n}\n\nfunction initIntersectionObserver({\n    root,\n    ...options\n}: IntersectionObserverInit): IntersectionObserver {\n    const lookupRoot = root || document\n\n    /**\n     * If we don't have an observer lookup map for this root, create one.\n     */\n    if (!observers.has(lookupRoot)) {\n        observers.set(lookupRoot, {})\n    }\n    const rootObservers = observers.get(lookupRoot)!\n\n    const key = JSON.stringify(options)\n\n    /**\n     * If we don't have an observer for this combination of root and settings,\n     * create one.\n     */\n    if (!rootObservers[key]) {\n        rootObservers[key] = new IntersectionObserver(\n            fireAllObserverCallbacks,\n            { root, ...options }\n        )\n    }\n\n    return rootObservers[key]\n}\n\nexport function observeIntersection(\n    element: Element,\n    options: IntersectionObserverInit,\n    callback: IntersectionHandler\n) {\n    const rootInteresectionObserver = initIntersectionObserver(options)\n\n    observerCallbacks.set(element, callback)\n    rootInteresectionObserver.observe(element)\n\n    return () =\u003e {\n        observerCallbacks.delete(element)\n        rootInteresectionObserver.unobserve(element)\n    }\n}\n","import { Feature } from \"motion-dom\"\nimport { MotionProps } from \"../../types\"\nimport { observeIntersection } from \"./observers\"\n\nconst thresholdNames = {\n    some: 0,\n    all: 1,\n}\n\nexport class InViewFeature extends Feature\u003cElement\u003e {\n    private hasEnteredView = false\n\n    private isInView = false\n\n    private stopObserver?: () =\u003e void\n\n    private startObserver() {\n        this.stopObserver?.()\n\n        const { viewport = {} } = this.node.getProps()\n        const { root, margin: rootMargin, amount = \"some\", once } = viewport\n\n        const options = {\n            root: root ? root.current : undefined,\n            rootMargin,\n            threshold:\n                typeof amount === \"number\" ? amount : thresholdNames[amount],\n        }\n\n        const onIntersectionUpdate = (entry: IntersectionObserverEntry) =\u003e {\n            const { isIntersecting } = entry\n\n            /**\n             * If there's been no change in the viewport state, early return.\n             */\n            if (this.isInView === isIntersecting) return\n\n            this.isInView = isIntersecting\n\n            /**\n             * Handle hasEnteredView. If this is only meant to run once, and\n             * element isn't visible, early return. Otherwise set hasEnteredView to true.\n             */\n            if (once \u0026\u0026 !isIntersecting \u0026\u0026 this.hasEnteredView) {\n                return\n            } else if (isIntersecting) {\n                this.hasEnteredView = true\n            }\n\n            if (this.node.animationState) {\n                this.node.animationState.setActive(\n                    \"whileInView\",\n                    isIntersecting\n                )\n            }\n\n            /**\n             * Use the latest committed props rather than the ones in scope\n             * when this observer is created\n             */\n            const { onViewportEnter, onViewportLeave } = this.node.getProps()\n            const callback = isIntersecting ? onViewportEnter : onViewportLeave\n            callback \u0026\u0026 callback(entry)\n        }\n\n        this.stopObserver = observeIntersection(\n            this.node.current!,\n            options,\n            onIntersectionUpdate\n        )\n    }\n\n    mount() {\n        this.startObserver()\n    }\n\n    update() {\n        if (typeof IntersectionObserver === \"undefined\") return\n\n        const { props, prevProps } = this.node\n        const hasOptionsChanged = [\"amount\", \"margin\", \"root\"].some(\n            hasViewportOptionChanged(props, prevProps)\n        )\n\n        if (hasOptionsChanged) {\n            this.startObserver()\n        }\n    }\n\n    unmount() {\n        this.stopObserver?.()\n        this.hasEnteredView = false\n        this.isInView = false\n    }\n}\n\nfunction hasViewportOptionChanged(\n    { viewport = {} }: MotionProps,\n    { viewport: prevViewport = {} }: MotionProps = {}\n) {\n    return (name: keyof typeof viewport) =\u003e\n        viewport[name] !== prevViewport[name]\n}\n","import { HoverGesture } from \"../../gestures/hover\"\nimport { FocusGesture } from \"../../gestures/focus\"\nimport { PressGesture } from \"../../gestures/press\"\nimport { InViewFeature } from \"./viewport\"\nimport { FeaturePackages } from \"./types\"\n\nexport const gestureAnimations: FeaturePackages = {\n    inView: {\n        Feature: InViewFeature,\n    },\n    tap: {\n        Feature: PressGesture,\n    },\n    focus: {\n        Feature: FocusGesture,\n    },\n    hover: {\n        Feature: HoverGesture,\n    },\n}\n"],"version":3}
