import '../../../../utils/index.mjs';
import Color from './color.mjs';
import { buildProps, definePropType } from '../../../../utils/props/runtime.mjs';

"use strict";
const isValidComponentSize = (val) => {
  return ["", "large", "default", "small"].includes(val);
};
const displayedRgb = (color, showAlpha) => {
  if (!(color instanceof Color)) {
    throw Error("color should be instance of _color Class");
  }
  const { r, g, b } = color.toRgb();
  return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
};
const colorFormatOptions = [
  { label: "hex", value: "hex" },
  { label: "rgb", value: "rgb" },
  { label: "rgba", value: "rgba" },
  { label: "hsv", value: "hsv" },
  { label: "hsl", value: "hsl" }
];
const colorPickerProps = buildProps({
  value: {
    type: String
  },
  showAlpha: {
    type: Boolean,
    default: true
  },
  colorFormat: {
    type: definePropType(String),
    default: "hex"
  },
  popperClass: {
    type: String
  },
  predefine: {
    type: definePropType(Array),
    default: () => [
      "#1187FF",
      "#3BA3FF",
      "#52C41A",
      "#FAAD14",
      "#FF8C00",
      "#FF4D4F",
      "#FF4500",
      "#13C2C2",
      "#531DAB",
      "#C71585",
      "#005ce5",
      "#E6A23C",
      "#1D2129",
      "#272E3B",
      "#4E5969",
      "#86909C",
      "#C9CDD4",
      "#D9D9D9",
      "#F4F4F4",
      "#FAFAFA",
      "#FF4500AD",
      "#90F09080",
      "#1F93FFBA",
      "#C7158575",
      "#000000A6",
      "#00000073"
    ]
  },
  disabled: {
    type: Boolean,
    default: false
  },
  size: {
    type: definePropType(String),
    validator: isValidComponentSize
  },
  placeholder: {
    type: String,
    default: "\u8BF7\u9009\u62E9"
  },
  // 拾色器模式
  pickerMode: {
    type: Boolean,
    default: false
  },
  // 是否点击清除图标删除内容
  allowClear: {
    type: Boolean,
    default: true
  },
  usePipette: {
    type: Boolean,
    default: true
  },
  pipetteContainer: {
    type: definePropType(Object),
    default: () => document.body
  }
});
const colorPickerEmits = {
  "update:value": (value) => typeof value === "string" || value === null,
  change: (value) => typeof value === "string" || value === null,
  "active-change": (value) => typeof value === "string" || value === null
};

export { colorFormatOptions, colorPickerEmits, colorPickerProps, displayedRgb, isValidComponentSize };
//# sourceMappingURL=color-picker.mjs.map
