"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var calculate_clamp_exports = {};
__export(calculate_clamp_exports, {
  MIN_FONT_SIZE_RATIO: () => MIN_FONT_SIZE_RATIO,
  calculateClamp: () => calculateClamp
});
module.exports = __toCommonJS(calculate_clamp_exports);
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})`;
};
//# sourceMappingURL=calculate-clamp.js.map
