{"ast":null,"code":"import { resolveElements } from '../render/dom/utils/resolve-element.mjs';\nimport { visualElementStore } from '../render/store.mjs';\nimport { invariant } from '../utils/errors.mjs';\nimport { GroupPlaybackControls } from './GroupPlaybackControls.mjs';\nimport { isDOMKeyframes } from './utils/is-dom-keyframes.mjs';\nimport { animateTarget } from './interfaces/visual-element-target.mjs';\nimport { createVisualElement } from './utils/create-visual-element.mjs';\nimport { animateSingleValue } from './interfaces/single-value.mjs';\nimport { createAnimationsFromSequence } from './sequence/create.mjs';\nimport { isMotionValue } from '../value/utils/is-motion-value.mjs';\nfunction animateElements(elementOrSelector, keyframes, options, scope) {\n  const elements = resolveElements(elementOrSelector, scope);\n  const numElements = elements.length;\n  invariant(Boolean(numElements), \"No valid element provided.\");\n  const animations = [];\n  for (let i = 0; i < numElements; i++) {\n    const element = elements[i];\n    /**\n     * Check each element for an associated VisualElement. If none exists,\n     * we need to create one.\n     */\n    if (!visualElementStore.has(element)) {\n      /**\n       * TODO: We only need render-specific parts of the VisualElement.\n       * With some additional work the size of the animate() function\n       * could be reduced significantly.\n       */\n      createVisualElement(element);\n    }\n    const visualElement = visualElementStore.get(element);\n    const transition = {\n      ...options\n    };\n    /**\n     * Resolve stagger function if provided.\n     */\n    if (typeof transition.delay === \"function\") {\n      transition.delay = transition.delay(i, numElements);\n    }\n    animations.push(...animateTarget(visualElement, {\n      ...keyframes,\n      transition\n    }, {}));\n  }\n  return new GroupPlaybackControls(animations);\n}\nconst isSequence = value => Array.isArray(value) && Array.isArray(value[0]);\nfunction animateSequence(sequence, options, scope) {\n  const animations = [];\n  const animationDefinitions = createAnimationsFromSequence(sequence, options, scope);\n  animationDefinitions.forEach((_ref, subject) => {\n    let {\n      keyframes,\n      transition\n    } = _ref;\n    let animation;\n    if (isMotionValue(subject)) {\n      animation = animateSingleValue(subject, keyframes.default, transition.default);\n    } else {\n      animation = animateElements(subject, keyframes, transition);\n    }\n    animations.push(animation);\n  });\n  return new GroupPlaybackControls(animations);\n}\nconst createScopedAnimate = scope => {\n  /**\n   * Implementation\n   */\n  function scopedAnimate(valueOrElementOrSequence, keyframes, options) {\n    let animation;\n    if (isSequence(valueOrElementOrSequence)) {\n      animation = animateSequence(valueOrElementOrSequence, keyframes, scope);\n    } else if (isDOMKeyframes(keyframes)) {\n      animation = animateElements(valueOrElementOrSequence, keyframes, options, scope);\n    } else {\n      animation = animateSingleValue(valueOrElementOrSequence, keyframes, options);\n    }\n    if (scope) {\n      scope.animations.push(animation);\n    }\n    return animation;\n  }\n  return scopedAnimate;\n};\nconst animate = createScopedAnimate();\nexport { animate, createScopedAnimate };","map":{"version":3,"names":["resolveElements","visualElementStore","invariant","GroupPlaybackControls","isDOMKeyframes","animateTarget","createVisualElement","animateSingleValue","createAnimationsFromSequence","isMotionValue","animateElements","elementOrSelector","keyframes","options","scope","elements","numElements","length","Boolean","animations","i","element","has","visualElement","get","transition","delay","push","isSequence","value","Array","isArray","animateSequence","sequence","animationDefinitions","forEach","_ref","subject","animation","default","createScopedAnimate","scopedAnimate","valueOrElementOrSequence","animate"],"sources":["/opt/bitnami/minigames/frasle/node_modules/framer-motion/dist/es/animation/animate.mjs"],"sourcesContent":["import { resolveElements } from '../render/dom/utils/resolve-element.mjs';\nimport { visualElementStore } from '../render/store.mjs';\nimport { invariant } from '../utils/errors.mjs';\nimport { GroupPlaybackControls } from './GroupPlaybackControls.mjs';\nimport { isDOMKeyframes } from './utils/is-dom-keyframes.mjs';\nimport { animateTarget } from './interfaces/visual-element-target.mjs';\nimport { createVisualElement } from './utils/create-visual-element.mjs';\nimport { animateSingleValue } from './interfaces/single-value.mjs';\nimport { createAnimationsFromSequence } from './sequence/create.mjs';\nimport { isMotionValue } from '../value/utils/is-motion-value.mjs';\n\nfunction animateElements(elementOrSelector, keyframes, options, scope) {\n    const elements = resolveElements(elementOrSelector, scope);\n    const numElements = elements.length;\n    invariant(Boolean(numElements), \"No valid element provided.\");\n    const animations = [];\n    for (let i = 0; i < numElements; i++) {\n        const element = elements[i];\n        /**\n         * Check each element for an associated VisualElement. If none exists,\n         * we need to create one.\n         */\n        if (!visualElementStore.has(element)) {\n            /**\n             * TODO: We only need render-specific parts of the VisualElement.\n             * With some additional work the size of the animate() function\n             * could be reduced significantly.\n             */\n            createVisualElement(element);\n        }\n        const visualElement = visualElementStore.get(element);\n        const transition = { ...options };\n        /**\n         * Resolve stagger function if provided.\n         */\n        if (typeof transition.delay === \"function\") {\n            transition.delay = transition.delay(i, numElements);\n        }\n        animations.push(...animateTarget(visualElement, { ...keyframes, transition }, {}));\n    }\n    return new GroupPlaybackControls(animations);\n}\nconst isSequence = (value) => Array.isArray(value) && Array.isArray(value[0]);\nfunction animateSequence(sequence, options, scope) {\n    const animations = [];\n    const animationDefinitions = createAnimationsFromSequence(sequence, options, scope);\n    animationDefinitions.forEach(({ keyframes, transition }, subject) => {\n        let animation;\n        if (isMotionValue(subject)) {\n            animation = animateSingleValue(subject, keyframes.default, transition.default);\n        }\n        else {\n            animation = animateElements(subject, keyframes, transition);\n        }\n        animations.push(animation);\n    });\n    return new GroupPlaybackControls(animations);\n}\nconst createScopedAnimate = (scope) => {\n    /**\n     * Implementation\n     */\n    function scopedAnimate(valueOrElementOrSequence, keyframes, options) {\n        let animation;\n        if (isSequence(valueOrElementOrSequence)) {\n            animation = animateSequence(valueOrElementOrSequence, keyframes, scope);\n        }\n        else if (isDOMKeyframes(keyframes)) {\n            animation = animateElements(valueOrElementOrSequence, keyframes, options, scope);\n        }\n        else {\n            animation = animateSingleValue(valueOrElementOrSequence, keyframes, options);\n        }\n        if (scope) {\n            scope.animations.push(animation);\n        }\n        return animation;\n    }\n    return scopedAnimate;\n};\nconst animate = createScopedAnimate();\n\nexport { animate, createScopedAnimate };\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,yCAAyC;AACzE,SAASC,kBAAkB,QAAQ,qBAAqB;AACxD,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SAASC,cAAc,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