import { isAnimationControls as o } from "../../../animation/utils/is-animation-controls.es.js";
import { createAnimationState as i } from "../../../render/utils/animation-state.es.js";
import { Feature as s } from "../Feature.es.js";
class u extends s {
  /**
   * We dynamically generate the AnimationState manager as it contains a reference
   * to the underlying animation library. We only want to load that if we load this,
   * so people can optionally code split it out using the `m` component.
   */
  constructor(t) {
    super(t), t.animationState || (t.animationState = i(t));
  }
  updateAnimationControlsSubscription() {
    const { animate: t } = this.node.getProps();
    o(t) && (this.unmountControls = t.subscribe(this.node));
  }
  /**
   * Subscribe any provided AnimationControls to the component's VisualElement
   */
  mount() {
    this.updateAnimationControlsSubscription();
  }
  update() {
    const { animate: t } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
    t !== n && this.updateAnimationControlsSubscription();
  }
  unmount() {
    var t;
    this.node.animationState.reset(), (t = this.unmountControls) == null || t.call(this);
  }
}
export {
  u as AnimationFeature
};
//# sourceMappingURL=index.es.js.map
