import { JSAnimation as a } from "./JSAnimation.es.js";
import { NativeAnimation as m } from "./NativeAnimation.es.js";
import { replaceTransitionType as r } from "./utils/replace-transition-type.es.js";
import { replaceStringEasing as l } from "./waapi/utils/unsupported-easing.es.js";
import { secondsToMilliseconds as p } from "../../../../../../motion-utils@12.23.6/node_modules/motion-utils/dist/es/time-conversion.es.js";
const s = 10;
class y extends m {
  constructor(e) {
    l(e), r(e), super(e), e.startTime && (this.startTime = e.startTime), this.options = e;
  }
  /**
   * WAAPI doesn't natively have any interruption capabilities.
   *
   * Rather than read commited styles back out of the DOM, we can
   * create a renderless JS animation and sample it twice to calculate
   * its current value, "previous" value, and therefore allow
   * Motion to calculate velocity for any subsequent animation.
   */
  updateMotionValue(e) {
    const { motionValue: t, onUpdate: f, onComplete: d, element: u, ...n } = this.options;
    if (!t)
      return;
    if (e !== void 0) {
      t.set(e);
      return;
    }
    const i = new a({
      ...n,
      autoplay: !1
    }), o = p(this.finishedTime ?? this.time);
    t.setWithVelocity(i.sample(o - s).value, i.sample(o).value, s), i.stop();
  }
}
export {
  y as NativeAnimationExtended
};
//# sourceMappingURL=NativeAnimationExtended.es.js.map
