import s from "../../../../../tinycolor2@1.6.0/node_modules/tinycolor2/esm/tinycolor.js";
import l from "../../../../../lodash-es@4.17.21/node_modules/lodash-es/forEach.js";
var u = function(r) {
  var o = ["r", "g", "b", "a", "h", "s", "l", "v"], i = 0, n = 0;
  return l(o, function(t) {
    if (r[t] && (i += 1, isNaN(r[t]) || (n += 1), t === "s" || t === "l")) {
      var a = /^\d+%$/;
      a.test(r[t]) && (n += 1);
    }
  }), i === n ? r : !1;
}, g = function(r, o) {
  var i = r.hex ? s(r.hex) : s(r), n = i.toHsl(), t = i.toHsv(), a = i.toRgb(), v = i.toHex();
  n.s === 0 && (n.h = o || 0, t.h = o || 0);
  var f = v === "000000" && a.a === 0;
  return {
    hsl: n,
    hex: f ? "transparent" : "#" + v,
    rgb: a,
    hsv: t,
    oldHue: r.h || o || n.h,
    source: r.source
  };
}, p = function(r) {
  if (r === "transparent")
    return !0;
  var o = String(r).charAt(0) === "#" ? 1 : 0;
  return r.length !== 4 + o && r.length < 7 + o && s(r).isValid();
}, C = function(r) {
  if (!r)
    return "#fff";
  var o = g(r);
  if (o.hex === "transparent")
    return "rgba(0,0,0,0.4)";
  var i = (o.rgb.r * 299 + o.rgb.g * 587 + o.rgb.b * 114) / 1e3;
  return i >= 128 ? "#000" : "#fff";
}, b = function(r, o) {
  var i = r.replace("°", "");
  return s(o + " (" + i + ")")._ok;
};
export {
  C as getContrastingColor,
  p as isValidHex,
  b as isvalidColorString,
  u as simpleCheckForValidColor,
  g as toState
};
//# sourceMappingURL=color.js.map
