import { kebabCase as k } from "lodash-es";
import i from "chroma-js";
const y = {
  primary: "Primary color",
  secondary: "Secondary color",
  accent: "Accent color",
  neutral: "Neutral color",
  base100: "Base color",
  base200: "Base (level 2)",
  base300: "Base (level 3)",
  info: "Info color",
  success: "Success color",
  warning: "Warning color",
  error: "Error color"
}, W = [
  900,
  800,
  700,
  600,
  500,
  400,
  300,
  200,
  100,
  50
], l = {
  100: "subtle",
  300: "light",
  700: "dark"
};
function m(t) {
  return typeof t != "string" ? !1 : t.startsWith("oklch") || t.startsWith("oklab") || t.startsWith("rgb") || t.startsWith("hsl") || t.startsWith("#") || t.startsWith("var(--");
}
function S(t, o) {
  if (!(typeof t > "u"))
    return m(t) || typeof t == "number" ? { [o]: t } : t;
}
function $(t, o = 3.5) {
  const a = i(t), n = "#ffffff", r = "#000000", e = i.contrast(a, n), s = i.contrast(a, r);
  return e >= o && s >= o || e >= o ? n : s >= o ? r : e >= s ? n : r;
}
function B(t, o) {
  if (!(typeof t > "u"))
    return m(t) || typeof t == "number" ? `${o}-[${t}]` : t;
}
function E(t) {
  const o = {};
  return Object.keys(y).forEach((a) => {
    const n = t.colors[a], r = k(a);
    o[`color-${r}`] = n, o[`color-${r}-500`] = n;
    const e = $(n);
    o[`color-${r}-content`] = e, o[`color-${r}-500-content`] = e;
    const s = i(n), g = s.darken(2.5), h = s.brighten(3.5), C = i.scale([
      h,
      s,
      g
    ]).domain([
      50,
      500,
      900
    ]).mode("oklch");
    r.startsWith("base") || W.forEach((c) => {
      if (c === 500) return;
      const f = `color-${r}-${c}`, u = C(c);
      o[f] = u.css("oklch");
      const b = $(u);
      o[`color-${r}-${c}-content`] = b, l[c] && (o[`color-${r}-${l[c]}`] = o[f], o[`color-${r}-${l[c]}-content`] = b);
    });
  }), o;
}
export {
  S as a,
  $ as b,
  y as c,
  E as g,
  m as i,
  B as p
};
