import a from "../../../../../../../chroma-js@2.4.2/node_modules/chroma-js/chroma.js";
import { lightness as d, shade as m, tint as p } from "./manipulation.js";
import { getOn as g } from "../theme/utils.js";
function l(s) {
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? l = function(o) {
    return typeof o;
  } : l = function(o) {
    return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, l(s);
}
var h = function(r) {
  var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 4.85;
  return function(n) {
    var u, c = l(n) === "object" && (u = g(n, r)) !== null && u !== void 0 ? u : r, e = l(n) === "object" ? n.colors.body : n;
    (a(c).alpha() < 1 || a(e).alpha() < 1) && console.warn(`Contrast cannot be accurately calculated when colors have alpha channel opacity. Make sure the provided foreground and background colors have no transparency:

Foreground: `.concat(c, `
Background: `).concat(e));
    for (var i = a.contrast(c, e), y = d(e), t = c; i < o; ) {
      y > 50 ? t = m(t, 0.05) : t = p(t, 0.05), i = a.contrast(t, e);
      var f = d(t);
      if (f < 5)
        return console.warn("High enough contrast could not be determined. Most likely your background color does not adjust for light mode."), t;
      if (f > 95)
        return console.warn("High enough contrast could not be determined. Most likely your background color does not adjust for dark mode."), t;
    }
    return a(t).hex();
  };
}, k = function(r) {
  var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
  return function(n) {
    return h(r, o)(n);
  };
};
export {
  k as makeDisabledContrastColor,
  h as makeHighContrastColor
};
//# sourceMappingURL=contrast.js.map
