/**
 * ldesign v0.4.2
 * (c) 2023 ldesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { isVNode, defineComponent, ref, watch, createVNode } from 'vue';
import props from '../props.js';
import '../const.js';
import { RadioGroup, RadioButton } from '../../radio/index.js';
import { useBaseClassName } from '../hooks.js';
import { COLOR_MODES } from '../../_common/js/color-picker/constants.js';
import '../../utils/withInstall.js';
import '../../radio/radio.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/slicedToArray';
import 'lodash/isUndefined';
import 'lodash/isString';
import '../../hooks/useConfig.js';
import '../../config-provider/useConfig.js';
import 'lodash/cloneDeep';
import 'lodash/isFunction';
import '../../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import 'lodash/isArray';
import '../../_common/js/global-config/default-config.js';
import '../../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import '../../_chunks/dep-2e5d8948.js';
import 'dayjs';
import '../../_chunks/dep-4580aabe.js';
import '../../config-provider/type.js';
import '../../utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'lodash/camelCase';
import 'lodash/isNull';
import 'lodash/isNumber';
import '../../form/hooks.js';
import '../../hooks/useVModel.js';
import 'lodash/kebabCase';
import '../../hooks/tnode.js';
import '../../utils/render-tnode.js';
import 'lodash/isEmpty';
import 'lodash/isObject';
import '../../radio/constants.js';
import '../../radio/props.js';
import '../../radio/group.js';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/regenerator';
import 'lodash/isNil';
import '../../watermark/hooks.js';
import '../../radio/radio-group-props.js';
import '../../radio/useKeyboard.js';
import '../../utils/dom.js';
import '../../utils/easing.js';
import '../../radio/radio-button.js';
import '../../radio/style';
import '../../radio/type.js';

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _isSlot(s) {
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
}
var PanelHeader = defineComponent({
  name: "PanelHeader",
  props: _objectSpread(_objectSpread({}, props), {}, {
    mode: {
      type: String,
      "default": "color"
    },
    togglePopup: {
      type: Function
    },
    onModeChange: {
      type: Function,
      "default": function _default() {
        return function () {};
      }
    }
  }),
  setup: function setup(props2) {
    var baseClassName = useBaseClassName();
    var modeValue = ref(props2.mode);
    var handleModeChange = function handleModeChange(v) {
      return props2.onModeChange(v);
    };
    watch(function () {
      return props2.mode;
    }, function (v) {
      return modeValue.value = v;
    });
    return {
      baseClassName: baseClassName,
      modeValue: modeValue,
      handleModeChange: handleModeChange
    };
  },
  render: function render() {
    var _slot;
    var _this$colorModes,
      _this$colorModes2,
      _this = this;
    if (((_this$colorModes = this.colorModes) === null || _this$colorModes === void 0 ? void 0 : _this$colorModes.length) === 1) return null;
    var baseClassName = this.baseClassName;
    return createVNode("div", {
      "class": "".concat(baseClassName, "__head")
    }, [createVNode("div", {
      "class": "".concat(baseClassName, "__mode")
    }, [((_this$colorModes2 = this.colorModes) === null || _this$colorModes2 === void 0 ? void 0 : _this$colorModes2.length) === 1 ? COLOR_MODES[this.colorModes[0]] : createVNode(RadioGroup, {
      "variant": "default-filled",
      "size": "small",
      "modelValue": _this.modeValue,
      "onUpdate:modelValue": function onUpdateModelValue($event) {
        return _this.modeValue = $event;
      },
      "onChange": this.handleModeChange
    }, _isSlot(_slot = Object.keys(COLOR_MODES).map(function (key) {
      return createVNode(RadioButton, {
        "key": key,
        "value": key
      }, {
        "default": function _default() {
          return [COLOR_MODES[key]];
        }
      });
    })) ? _slot : {
      "default": function _default() {
        return [_slot];
      }
    })])]);
  }
});

export { PanelHeader as default };
//# sourceMappingURL=header.js.map
