import { __read as p } from "../../../../../tslib/tslib.es6.es.js";
import { hasTransform as x } from "../utils/has-transform.es.js";
import { mix as s } from "../../../../../popmotion/dist/es/utils/mix.es.js";
function u(n, i, o) {
  var l = n - o, e = i * l;
  return o + e;
}
function c(n, i, o, l, e) {
  return e !== void 0 && (n = u(n, e, l)), u(n, o, l) + i;
}
function v(n, i, o, l, e) {
  i === void 0 && (i = 0), o === void 0 && (o = 1), n.min = c(n.min, i, o, l, e), n.max = c(n.max, i, o, l, e);
}
function g(n, i) {
  var o = i.x, l = i.y;
  v(n.x, o.translate, o.scale, o.originPoint), v(n.y, l.translate, l.scale, l.originPoint);
}
function O(n, i, o, l) {
  var e, a;
  l === void 0 && (l = !1);
  var y = o.length;
  if (!!y) {
    i.x = i.y = 1;
    for (var r, t, f = 0; f < y; f++)
      r = o[f], t = r.projectionDelta, ((a = (e = r.instance) === null || e === void 0 ? void 0 : e.style) === null || a === void 0 ? void 0 : a.display) !== "contents" && (l && r.options.layoutScroll && r.scroll && r !== r.root && d(n, { x: -r.scroll.x, y: -r.scroll.y }), t && (i.x *= t.x.scale, i.y *= t.y.scale, g(n, t)), l && x(r.latestValues) && d(n, r.latestValues));
  }
}
function V(n, i) {
  n.min = n.min + i, n.max = n.max + i;
}
function m(n, i, o) {
  var l = p(o, 3), e = l[0], a = l[1], y = l[2], r = i[y] !== void 0 ? i[y] : 0.5, t = s(n.min, n.max, r);
  v(n, i[e], i[a], t, i.scale);
}
var D = ["x", "scaleX", "originX"], K = ["y", "scaleY", "originY"];
function d(n, i) {
  m(n.x, i, D), m(n.y, i, K);
}
export {
  v as applyAxisDelta,
  g as applyBoxDelta,
  c as applyPointDelta,
  O as applyTreeDeltas,
  u as scalePoint,
  m as transformAxis,
  d as transformBox,
  V as translateAxis
};
//# sourceMappingURL=delta-apply.es.js.map
