import Color from "../../node_modules/.pnpm/color@4.2.3/node_modules/color/index.mjs";
import "../store/modules/designStore/designStore.mjs";
import { chartColors, chartColorsSearch } from "../settings/chartThemes/index.mjs";
const animationsClass = (animations) => {
  if (animations.length) {
    return `animate__animated  animate__${animations[0]}`;
  }
  return "";
};
const getFilterStyle = (styles) => {
  if (!styles || !styles.filterShow)
    return {};
  const { opacity, saturate, contrast, hueRotate, brightness } = styles;
  return {
    opacity,
    filter: `saturate(${saturate}) contrast(${contrast}) hue-rotate(${hueRotate}deg) brightness(${brightness})`
  };
};
const getTransformStyle = (styles) => {
  const { rotateZ, rotateX, rotateY, skewX, skewY } = styles;
  return {
    transform: `rotateZ(${rotateZ || 0}deg) rotateX(${rotateX || 0}deg) rotateY(${rotateY || 0}deg) skewX(${skewX || 0}deg) skewY(${skewY || 0}deg)`
  };
};
const getBlendModeStyle = (styles) => {
  if (!styles || !styles.filterShow)
    return {};
  const { blendMode } = styles;
  return {
    "mix-blend-mode": blendMode
  };
};
function alpha(color, alpha2 = 1) {
  return Color(color).alpha(alpha2).toString();
}
function fade(color, fade2) {
  return Color(color).fade(fade2).toString();
}
function lighten(color, concentration) {
  return Color(color).lighten(concentration).toString();
}
function darken(color, concentration) {
  return Color(color).darken(concentration).toString();
}
function hslToHexa(hslString) {
  const color = Color(hslString);
  return color.hexa();
}
function hslToHex(hslString) {
  const color = Color(hslString);
  return color.hex();
}
const colorCustomMerge = (customColor) => {
  const formateCustomColor = {};
  customColor == null ? void 0 : customColor.forEach((item) => {
    formateCustomColor[item.id] = {
      color: item.color,
      name: item.name
    };
  });
  return { ...formateCustomColor, ...chartColors };
};
const colorGradientCustomMerge = (customColor) => {
  const formateGradientCustomColor = {};
  customColor == null ? void 0 : customColor.forEach((item) => {
    formateGradientCustomColor[item.id] = [
      item.color[0],
      item.color[1],
      fade(item.color[0], 0.3),
      fade(item.color[0], 0.5),
      fade(item.color[1], 0.5)
    ];
  });
  return { ...formateGradientCustomColor, ...chartColorsSearch };
};
export {
  alpha,
  animationsClass,
  colorCustomMerge,
  colorGradientCustomMerge,
  darken,
  fade,
  getBlendModeStyle,
  getFilterStyle,
  getTransformStyle,
  hslToHex,
  hslToHexa,
  lighten
};
