"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const warnOnce = require("./dist-es-utils-warn-once.cjs");
const index = require("./dist-es-value-index.cjs");
const isMotionValue = require("./dist-es-value-utils-is-motion-value.cjs");
function updateMotionValuesFromProps(element, next, prev) {
  for (const key in next) {
    const nextValue = next[key];
    const prevValue = prev[key];
    if (isMotionValue.isMotionValue(nextValue)) {
      element.addValue(key, nextValue);
      if (process.env.NODE_ENV === "development") {
        warnOnce.warnOnce(nextValue.version === "11.18.2", `Attempting to mix Motion versions ${nextValue.version} with 11.18.2 may not work as expected.`);
      }
    } else if (isMotionValue.isMotionValue(prevValue)) {
      element.addValue(key, index.motionValue(nextValue, { owner: element }));
    } else if (prevValue !== nextValue) {
      if (element.hasValue(key)) {
        const existingValue = element.getValue(key);
        if (existingValue.liveStyle === true) {
          existingValue.jump(nextValue);
        } else if (!existingValue.hasAnimated) {
          existingValue.set(nextValue);
        }
      } else {
        const latestValue = element.getStaticValue(key);
        element.addValue(key, index.motionValue(latestValue !== void 0 ? latestValue : nextValue, { owner: element }));
      }
    }
  }
  for (const key in prev) {
    if (next[key] === void 0)
      element.removeValue(key);
  }
  return next;
}
exports.updateMotionValuesFromProps = updateMotionValuesFromProps;
//# sourceMappingURL=dist-es-render-utils-motion-values.cjs.map
