import { mixNumber as s } from "../../utils/mix/number.es.js";
const y = 1e-4, u = 1 - y, E = 1 + y, R = 0.01, P = 0 - R, S = 0 + R;
function c(i) {
  return i.max - i.min;
}
function I(i, x, m) {
  return Math.abs(i - x) <= m;
}
function f(i, x, m, n = 0.5) {
  i.origin = n, i.originPoint = s(x.min, x.max, i.origin), i.scale = c(m) / c(x), i.translate = s(m.min, m.max, i.origin) - i.originPoint, (i.scale >= u && i.scale <= E || isNaN(i.scale)) && (i.scale = 1), (i.translate >= P && i.translate <= S || isNaN(i.translate)) && (i.translate = 0);
}
function T(i, x, m, n) {
  f(i.x, x.x, m.x, n ? n.originX : void 0), f(i.y, x.y, m.y, n ? n.originY : void 0);
}
function N(i, x, m, n = 0) {
  const A = n ? s(m.min, m.max, n) : m.min;
  i.min = A + x.min, i.max = i.min + c(x);
}
function _(i, x, m, n) {
  N(i.x, x.x, m.x, n == null ? void 0 : n.x), N(i.y, x.y, m.y, n == null ? void 0 : n.y);
}
function o(i, x, m, n = 0) {
  const A = n ? s(m.min, m.max, n) : m.min;
  i.min = x.min - A, i.max = i.min + c(x);
}
function C(i, x, m, n) {
  o(i.x, x.x, m.x, n == null ? void 0 : n.x), o(i.y, x.y, m.y, n == null ? void 0 : n.y);
}
export {
  f as calcAxisDelta,
  T as calcBoxDelta,
  c as calcLength,
  N as calcRelativeAxis,
  o as calcRelativeAxisPosition,
  _ as calcRelativeBox,
  C as calcRelativePosition,
  I as isNear
};
//# sourceMappingURL=delta-calc.es.js.map
