import { mix as f } from "../../../../../popmotion/dist/es/utils/mix.es.js";
import { percent as x, px as E } from "../../../../../style-value-types/dist/es/numbers/units.es.js";
import { circOut as F, linear as I } from "../../../../../popmotion/dist/es/easing/index.es.js";
import { progress as M } from "../../../../../popmotion/dist/es/utils/progress.es.js";
var s = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], N = s.length, _ = function(t) {
  return typeof t == "string" ? parseFloat(t) : t;
}, h = function(t) {
  return typeof t == "number" || E.test(t);
};
function A(t, n, r, i, C, O) {
  var m, p, v, u;
  C ? (t.opacity = f(
    0,
    (m = r.opacity) !== null && m !== void 0 ? m : 1,
    P(i)
  ), t.opacityExit = f((p = n.opacity) !== null && p !== void 0 ? p : 1, 0, V(i))) : O && (t.opacity = f((v = n.opacity) !== null && v !== void 0 ? v : 1, (u = r.opacity) !== null && u !== void 0 ? u : 1, i));
  for (var y = 0; y < N; y++) {
    var e = "border".concat(s[y], "Radius"), c = a(n, e), o = a(r, e);
    if (!(c === void 0 && o === void 0)) {
      c || (c = 0), o || (o = 0);
      var T = c === 0 || o === 0 || h(c) === h(o);
      T ? (t[e] = Math.max(f(_(c), _(o), i), 0), (x.test(o) || x.test(c)) && (t[e] += "%")) : t[e] = o;
    }
  }
  (n.rotate || r.rotate) && (t.rotate = f(n.rotate || 0, r.rotate || 0, i));
}
function a(t, n) {
  var r;
  return (r = t[n]) !== null && r !== void 0 ? r : t.borderRadius;
}
var P = B(0, 0.5, F), V = B(0.5, 0.95, I);
function B(t, n, r) {
  return function(i) {
    return i < t ? 0 : i > n ? 1 : r(M(t, n, i));
  };
}
export {
  A as mixValues
};
//# sourceMappingURL=mix-values.es.js.map
