const d = (e, t, n) => n <= t ? 0 : Math.max(0, Math.min(100, (e - t) / (n - t) * 100)), l = (e) => `calc(var(--benchmark-gauge-marker-inset, 20px) + ${e / 100} * (100% - 2 * var(--benchmark-gauge-marker-inset, 20px)))`, g = (e) => e >= 100 ? "0px" : `calc(${1 - e / 100} * (100% - 2 * var(--benchmark-gauge-marker-inset, 20px)))`, m = (e) => new Intl.NumberFormat("en", {
  notation: "compact",
  maximumSignificantDigits: 3
}).format(e), o = ["var(--e500)", "var(--a2900)", "var(--s400)"], h = ({
  markerColor: e,
  rankIndex: t,
  rankCount: n,
  colorByRank: c,
  rankColors: r
}) => {
  const u = "var(--n400)";
  if (e) return e;
  if (c) {
    const a = r != null && r.length ? r : o;
    if (!a.length)
      return u;
    const i = Math.round(t / Math.max(n - 1, 1) * (a.length - 1));
    return a[Math.max(0, Math.min(i, a.length - 1))] ?? u;
  }
  return u;
}, v = ({
  showLabels: e,
  startLabel: t,
  endLabel: n,
  min: c,
  max: r,
  compactLabels: u = !1
}) => {
  if (e === !1)
    return {
      startLabel: void 0,
      endLabel: void 0
    };
  const a = u ? m : String, i = (s, f) => {
    if (s !== null)
      return s !== void 0 ? s : e ? a(f) : void 0;
  };
  return {
    startLabel: i(t, c),
    endLabel: i(n, r)
  };
};
export {
  o as DEFAULT_RANK_COLORS,
  g as fillClipInset,
  l as markerPosition,
  v as resolveLabels,
  h as resolveMarkerColor,
  d as valueToPercent
};
