import { __exports as a } from "./index-colorManipulator4.js";
import { __require as k } from "./index-interopRequireDefault.js";
import A from "./index-_virtual84.js";
import z from "./index-_virtual85.js";
var C;
function F() {
  if (C) return a;
  C = 1;
  var m = k();
  Object.defineProperty(a, "__esModule", {
    value: !0
  }), a.alpha = O, a.blend = j, a.colorChannel = void 0, a.darken = g, a.decomposeColor = i, a.emphasize = $, a.getContrastRatio = R, a.getLuminance = l, a.hexToRgb = _, a.hslToRgb = x, a.lighten = v, a.private_safeAlpha = T, a.private_safeColorChannel = void 0, a.private_safeDarken = q, a.private_safeEmphasize = I, a.private_safeLighten = V, a.recomposeColor = o, a.rgbToHex = D;
  var b = m(A), M = m(z);
  function d(e, r = 0, n = 1) {
    return process.env.NODE_ENV !== "production" && (e < r || e > n), (0, M.default)(e, r, n);
  }
  function _(e) {
    e = e.slice(1);
    const r = new RegExp(`.{1,${e.length >= 6 ? 2 : 1}}`, "g");
    let n = e.match(r);
    return n && n[0].length === 1 && (n = n.map((t) => t + t)), n ? `rgb${n.length === 4 ? "a" : ""}(${n.map((t, s) => s < 3 ? parseInt(t, 16) : Math.round(parseInt(t, 16) / 255 * 1e3) / 1e3).join(", ")})` : "";
  }
  function w(e) {
    const r = e.toString(16);
    return r.length === 1 ? `0${r}` : r;
  }
  function i(e) {
    if (e.type)
      return e;
    if (e.charAt(0) === "#")
      return i(_(e));
    const r = e.indexOf("("), n = e.substring(0, r);
    if (["rgb", "rgba", "hsl", "hsla", "color"].indexOf(n) === -1)
      throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${e}\` color.
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` : (0, b.default)(9, e));
    let t = e.substring(r + 1, e.length - 1), s;
    if (n === "color") {
      if (t = t.split(" "), s = t.shift(), t.length === 4 && t[3].charAt(0) === "/" && (t[3] = t[3].slice(1)), ["srgb", "display-p3", "a98-rgb", "prophoto-rgb", "rec-2020"].indexOf(s) === -1)
        throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${s}\` color space.
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : (0, b.default)(10, s));
    } else
      t = t.split(",");
    return t = t.map((u) => parseFloat(u)), {
      type: n,
      values: t,
      colorSpace: s
    };
  }
  const y = (e) => {
    const r = i(e);
    return r.values.slice(0, 3).map((n, t) => r.type.indexOf("hsl") !== -1 && t !== 0 ? `${n}%` : n).join(" ");
  };
  a.colorChannel = y;
  const N = (e, r) => {
    try {
      return y(e);
    } catch {
      return r && process.env.NODE_ENV, e;
    }
  };
  a.private_safeColorChannel = N;
  function o(e) {
    const {
      type: r,
      colorSpace: n
    } = e;
    let {
      values: t
    } = e;
    return r.indexOf("rgb") !== -1 ? t = t.map((s, u) => u < 3 ? parseInt(s, 10) : s) : r.indexOf("hsl") !== -1 && (t[1] = `${t[1]}%`, t[2] = `${t[2]}%`), r.indexOf("color") !== -1 ? t = `${n} ${t.join(" ")}` : t = `${t.join(", ")}`, `${r}(${t})`;
  }
  function D(e) {
    if (e.indexOf("#") === 0)
      return e;
    const {
      values: r
    } = i(e);
    return `#${r.map((n, t) => w(t === 3 ? Math.round(255 * n) : n)).join("")}`;
  }
  function x(e) {
    e = i(e);
    const {
      values: r
    } = e, n = r[0], t = r[1] / 100, s = r[2] / 100, u = t * Math.min(s, 1 - s), p = (c, E = (c + n / 30) % 12) => s - u * Math.max(Math.min(E - 3, 9 - E, 1), -1);
    let f = "rgb";
    const h = [Math.round(p(0) * 255), Math.round(p(8) * 255), Math.round(p(4) * 255)];
    return e.type === "hsla" && (f += "a", h.push(r[3])), o({
      type: f,
      values: h
    });
  }
  function l(e) {
    e = i(e);
    let r = e.type === "hsl" || e.type === "hsla" ? i(x(e)).values : e.values;
    return r = r.map((n) => (e.type !== "color" && (n /= 255), n <= 0.03928 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4)), Number((0.2126 * r[0] + 0.7152 * r[1] + 0.0722 * r[2]).toFixed(3));
  }
  function R(e, r) {
    const n = l(e), t = l(r);
    return (Math.max(n, t) + 0.05) / (Math.min(n, t) + 0.05);
  }
  function O(e, r) {
    return e = i(e), r = d(r), (e.type === "rgb" || e.type === "hsl") && (e.type += "a"), e.type === "color" ? e.values[3] = `/${r}` : e.values[3] = r, o(e);
  }
  function T(e, r, n) {
    try {
      return O(e, r);
    } catch {
      return n && process.env.NODE_ENV, e;
    }
  }
  function g(e, r) {
    if (e = i(e), r = d(r), e.type.indexOf("hsl") !== -1)
      e.values[2] *= 1 - r;
    else if (e.type.indexOf("rgb") !== -1 || e.type.indexOf("color") !== -1)
      for (let n = 0; n < 3; n += 1)
        e.values[n] *= 1 - r;
    return o(e);
  }
  function q(e, r, n) {
    try {
      return g(e, r);
    } catch {
      return n && process.env.NODE_ENV, e;
    }
  }
  function v(e, r) {
    if (e = i(e), r = d(r), e.type.indexOf("hsl") !== -1)
      e.values[2] += (100 - e.values[2]) * r;
    else if (e.type.indexOf("rgb") !== -1)
      for (let n = 0; n < 3; n += 1)
        e.values[n] += (255 - e.values[n]) * r;
    else if (e.type.indexOf("color") !== -1)
      for (let n = 0; n < 3; n += 1)
        e.values[n] += (1 - e.values[n]) * r;
    return o(e);
  }
  function V(e, r, n) {
    try {
      return v(e, r);
    } catch {
      return n && process.env.NODE_ENV, e;
    }
  }
  function $(e, r = 0.15) {
    return l(e) > 0.5 ? g(e, r) : v(e, r);
  }
  function I(e, r, n) {
    try {
      return $(e, r);
    } catch {
      return n && process.env.NODE_ENV, e;
    }
  }
  function j(e, r, n, t = 1) {
    const s = (h, c) => Math.round((h ** (1 / t) * (1 - n) + c ** (1 / t) * n) ** t), u = i(e), p = i(r), f = [s(u.values[0], p.values[0]), s(u.values[1], p.values[1]), s(u.values[2], p.values[2])];
    return o({
      type: "rgb",
      values: f
    });
  }
  return a;
}
export {
  F as __require
};
