import { DEFAULT_DARK_BG as k, DEFAULT_LIGHT_BG as y } from "./constants.js";
const f = (o, t, s) => {
  const r = o === "dark" ? { light: k, dark: k } : { light: y, dark: k };
  return t ? b(t, r) : s ? u(s, r) : r;
}, p = (o) => o === "transparent" || o === void 0, b = (o, t) => {
  var g, i, e, n;
  const s = o.split('style="');
  if (s.length < 2)
    return t;
  const r = (i = (g = s[1]) == null ? void 0 : g.split("background-color:")[1]) == null ? void 0 : i.split(";")[0], a = (n = (e = s[1]) == null ? void 0 : e.split("--shiki-dark-bg:")[1]) == null ? void 0 : n.split(";")[0];
  return {
    light: p(r) ? t.light : r,
    dark: p(a) ? t.dark : a
  };
}, u = (o, t) => o && typeof o == "object" && "props" in o && o.props && typeof o.props == "object" && "style" in o.props && typeof o.props.style == "object" && o.props.style && typeof o.props.style == "object" && "backgroundColor" in o.props.style && typeof o.props.style.backgroundColor == "string" && "--shiki-dark-bg" in o.props.style && typeof o.props.style["--shiki-dark-bg"] == "string" ? {
  light: p(o.props.style.backgroundColor) ? t.light : o.props.style.backgroundColor,
  dark: p(o.props.style["--shiki-dark-bg"]) ? t.dark : o.props.style["--shiki-dark-bg"]
} : t;
export {
  u as getBackgroundColorsFromChildren,
  b as getBackgroundColorsFromHtml,
  f as getShikiBackgroundColors
};
