const roundValue = (n) => Math.round((n + Number.EPSILON) * 1e4) / 1e4;
const MIN_FONT_SIZE_RATIO = 0.65;
const CLAMP_MIN_WIDTH = 320;
const CLAMP_MAX_WIDTH = 900;
const calculateClamp = ({
  maxSize,
  minSize,
  minWidth = CLAMP_MIN_WIDTH,
  maxWidth = CLAMP_MAX_WIDTH,
  relativeTo = "viewport"
}) => {
  const isNegative = minSize > maxSize;
  const min = isNegative ? maxSize : minSize;
  const max = isNegative ? minSize : maxSize;
  const unit = "px";
  const relativeUnits = {
    viewport: "vw",
    container: "cqw"
  };
  const relativeUnit = relativeUnits[relativeTo] || relativeUnits.viewport;
  const slope = (maxSize - minSize) / (maxWidth - minWidth);
  const intersection = -1 * minWidth * slope + minSize;
  return `clamp(${roundValue(min)}${unit}, ${roundValue(intersection)}${unit} + ${roundValue(slope * 100)}${relativeUnit}, ${roundValue(max)}${unit})`;
};
export {
  MIN_FONT_SIZE_RATIO,
  calculateClamp
};
//# sourceMappingURL=calculate-clamp.js.map
