var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
  ThemeColor: () => ThemeColor,
  themeColorProps: () => themeColorProps
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_icons_vue = require("@ant-design/icons-vue");
var import_pro_utils = require("@antdv/pro-utils");
var import_ant_design_vue = require("ant-design-vue");
var import_vue2 = require("vue");
const Tag = (0, import_vue2.defineComponent)({
  name: "Tag",
  props: {
    color: (0, import_pro_utils.stringType)().isRequired,
    check: (0, import_pro_utils.boolType)().isRequired,
    className: (0, import_pro_utils.stringType)(),
    onClick: (0, import_pro_utils.funcType)()
  },
  setup(props) {
    return () => {
      return (0, import_vue.createVNode)("div", {
        "class": props.className,
        "onClick": props.onClick,
        "style": {
          backgroundColor: props.color
        }
      }, [props.check ? (0, import_vue.createVNode)(import_icons_vue.CheckOutlined, null, null) : ""]);
    };
  }
});
const themeColorProps = {
  colorList: (0, import_pro_utils.arrayType)(),
  prefixCls: (0, import_pro_utils.stringType)().isRequired,
  value: (0, import_pro_utils.stringType)().isRequired,
  onChange: (0, import_pro_utils.funcType)().isRequired,
  formatMessage: (0, import_pro_utils.funcType)().isRequired,
  hashId: (0, import_pro_utils.stringType)().isRequired
};
const ThemeColor = (0, import_vue2.defineComponent)({
  name: "ThemeColor",
  props: themeColorProps,
  setup(props) {
    return () => {
      const {
        value,
        colorList,
        onChange,
        prefixCls,
        formatMessage,
        hashId
      } = props;
      if (!colorList || (colorList == null ? void 0 : colorList.length) < 1) {
        return null;
      }
      const baseClassName = `${prefixCls}-theme-color`;
      return (0, import_vue.createVNode)("div", {
        "class": `${baseClassName} ${hashId}`.trim()
      }, [colorList == null ? void 0 : colorList.map(({
        key,
        color,
        title
      }) => {
        if (!key) return null;
        return (0, import_vue.createVNode)(import_ant_design_vue.Tooltip, {
          "key": color,
          "title": title != null ? title : formatMessage({
            id: `app.setting.themecolor.${key}`
          })
        }, {
          default: () => [(0, import_vue.createVNode)(Tag, {
            "className": `${baseClassName}-block ${hashId}`.trim(),
            "color": color,
            "check": value === color,
            "onClick": () => onChange && onChange(color)
          }, null)]
        });
      })]);
    };
  }
});
