"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const resolveDynamicVariants = require("./dist-es-render-utils-resolve-dynamic-variants.cjs");
const visualElementTarget = require("./dist-es-animation-interfaces-visual-element-target.cjs");
const visualElementVariant = require("./dist-es-animation-interfaces-visual-element-variant.cjs");
function animateVisualElement(visualElement, definition, options = {}) {
  visualElement.notify("AnimationStart", definition);
  let animation;
  if (Array.isArray(definition)) {
    const animations = definition.map((variant) => visualElementVariant.animateVariant(visualElement, variant, options));
    animation = Promise.all(animations);
  } else if (typeof definition === "string") {
    animation = visualElementVariant.animateVariant(visualElement, definition, options);
  } else {
    const resolvedDefinition = typeof definition === "function" ? resolveDynamicVariants.resolveVariant(visualElement, definition, options.custom) : definition;
    animation = Promise.all(visualElementTarget.animateTarget(visualElement, resolvedDefinition, options));
  }
  return animation.then(() => {
    visualElement.notify("AnimationComplete", definition);
  });
}
exports.animateVisualElement = animateVisualElement;
//# sourceMappingURL=dist-es-animation-interfaces-visual-element.cjs.map
