import { Feature as o } from "../../../../../../../../motion-dom@12.38.0/node_modules/motion-dom/dist/es/render/Feature.es.js";
import { createAnimationState as i } from "../../../../../../../../motion-dom@12.38.0/node_modules/motion-dom/dist/es/render/utils/animation-state.es.js";
import { isAnimationControls as s } from "../../../../../../../../motion-dom@12.38.0/node_modules/motion-dom/dist/es/render/utils/is-animation-controls.es.js";
class u extends o {
  /**
   * 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();
    s(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
