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

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var vue = require('vue');
var colorPicker_props = require('../props.js');
var radio_index = require('../../radio/index.js');
var colorPicker_hooks = require('../hooks.js');
var _common_js_colorPicker_constants = require('../../_common/js/color-picker/constants.js');
require('../../utils/withInstall.js');
require('../../radio/radio.js');
require('@babel/runtime/helpers/toConsumableArray');
require('@babel/runtime/helpers/slicedToArray');
require('lodash/isUndefined');
require('lodash/isString');
require('../../hooks/useConfig.js');
require('../../config-provider/useConfig.js');
require('lodash/cloneDeep');
require('lodash/isFunction');
require('../../config-provider/context.js');
require('lodash/mergeWith');
require('lodash/merge');
require('lodash/isArray');
require('../../_common/js/global-config/default-config.js');
require('../../_common/js/global-config/locale/zh_CN.js');
require('@babel/runtime/helpers/typeof');
require('../../_chunks/dep-7f0559c3.js');
require('dayjs');
require('../../utils/helper.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('lodash/camelCase');
require('lodash/isNull');
require('lodash/isNumber');
require('../../form/hooks.js');
require('../../hooks/useVModel.js');
require('lodash/kebabCase');
require('../../hooks/tnode.js');
require('../../utils/render-tnode.js');
require('lodash/isEmpty');
require('lodash/isObject');
require('../../radio/constants.js');
require('../../radio/props.js');
require('../../radio/group.js');
require('@babel/runtime/helpers/asyncToGenerator');
require('@babel/runtime/regenerator');
require('lodash/isNil');
require('../../watermark/hooks.js');
require('../../radio/radio-group-props.js');
require('../../radio/useKeyboard.js');
require('../../utils/dom.js');
require('../../utils/easing.js');
require('../../radio/radio-button.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);

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__default["default"](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]' && !vue.isVNode(s);
}
var PanelHeader = vue.defineComponent({
  name: "PanelHeader",
  props: _objectSpread(_objectSpread({}, colorPicker_props["default"]), {}, {
    mode: {
      type: String,
      "default": "color"
    },
    togglePopup: {
      type: Function
    },
    onModeChange: {
      type: Function,
      "default": function _default() {
        return function () {};
      }
    }
  }),
  setup: function setup(props2) {
    var baseClassName = colorPicker_hooks.useBaseClassName();
    var modeValue = vue.ref(props2.mode);
    var handleModeChange = function handleModeChange(v) {
      return props2.onModeChange(v);
    };
    vue.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 vue.createVNode("div", {
      "class": "".concat(baseClassName, "__head")
    }, [vue.createVNode("div", {
      "class": "".concat(baseClassName, "__mode")
    }, [((_this$colorModes2 = this.colorModes) === null || _this$colorModes2 === void 0 ? void 0 : _this$colorModes2.length) === 1 ? _common_js_colorPicker_constants.COLOR_MODES[this.colorModes[0]] : vue.createVNode(radio_index.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(_common_js_colorPicker_constants.COLOR_MODES).map(function (key) {
      return vue.createVNode(radio_index.RadioButton, {
        "key": key,
        "value": key
      }, {
        "default": function _default() {
          return [_common_js_colorPicker_constants.COLOR_MODES[key]];
        }
      });
    })) ? _slot : {
      "default": function _default() {
        return [_slot];
      }
    })])]);
  }
});

exports["default"] = PanelHeader;
//# sourceMappingURL=header.js.map
