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

'use strict';

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

var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var vue = require('vue');
var upperCase = require('lodash/upperCase');
var colorPicker_props = require('../../props.js');
var colorPicker_const = require('../../const.js');
var select_index = require('../../../select/index.js');
var colorPicker_hooks = require('../../hooks.js');
var colorPicker_panel_format_inputs = require('./inputs.js');
require('../../../_common/js/color-picker/constants.js');
require('../../../utils/withInstall.js');
require('../../../select/select.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('@babel/runtime/helpers/slicedToArray');
require('lodash/pick');
require('lodash/isArray');
require('lodash/isFunction');
require('lodash/debounce');
require('lodash/cloneDeep');
require('lodash/get');
require('lodash/intersection');
require('../../../common-components/fake-arrow.js');
require('../../../hooks/useConfig.js');
require('../../../config-provider/useConfig.js');
require('lodash/isString');
require('../../../config-provider/context.js');
require('lodash/mergeWith');
require('lodash/merge');
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('../../../select-input/index.js');
require('../../../select-input/select-input.js');
require('../../../popup/index.js');
require('../../../popup/popup.js');
require('@popperjs/core');
require('lodash/isObject');
require('../../../hooks/useVModel.js');
require('lodash/kebabCase');
require('../../../utils/dom.js');
require('../../../utils/easing.js');
require('../../../_common/js/utils/set-style.js');
require('../../../popup/container.js');
require('../../../hooks/useResizeObserver.js');
require('../../../popup/props.js');
require('../../../hooks/tnode.js');
require('lodash/camelCase');
require('../../../utils/render-tnode.js');
require('lodash/isEmpty');
require('../../../select-input/props.js');
require('../../../select-input/useSingle.js');
require('../../../input/index.js');
require('../../../input/input.js');
require('@ldesign/icons-vue-next');
require('lodash/isUndefined');
require('../../../form/hooks.js');
require('../../../hooks/useGlobalIcon.js');
require('../../../input/props.js');
require('../../../input/useInput.js');
require('../../../form/const.js');
require('../../../input/useLengthLimit.js');
require('lodash/isNumber');
require('../../../_common/js/log/log.js');
require('../../../_common/js/utils/helper.js');
require('lodash/isNull');
require('../../../input/useInputEventHandler.js');
require('../../../input/useInputWidth.js');
require('../../../input/input-group.js');
require('../../../input/input-group-props.js');
require('../../../loading/index.js');
require('../../../loading/directive.js');
require('../../../loading/plugin.js');
require('../../../loading/loading.js');
require('../../../hooks/useTeleport.js');
require('../../../loading/props.js');
require('../../../loading/icon/gradient.js');
require('../../../_common/js/loading/circle-adapter.js');
require('../../../hooks/useDefaultValue.js');
require('../../../select-input/useMultiple.js');
require('../../../tag-input/index.js');
require('../../../tag-input/tag-input.js');
require('../../../tag-input/props.js');
require('../../../tag-input/hooks/useTagScroll.js');
require('../../../tag-input/useTagList.js');
require('../../../tag/index.js');
require('../../../tag/tag.js');
require('../../../tag/props.js');
require('../../../tag/check-tag.js');
require('../../../tag/check-tag-props.js');
require('../../../tag-input/hooks/useHover.js');
require('../../../tag-input/hooks/useDragSorter.js');
require('../../../select-input/useOverlayInnerStyle.js');
require('../../../select/props.js');
require('../../../select/select-panel.js');
require('lodash/omit');
require('../../../select/option.js');
require('../../../checkbox/index.js');
require('../../../checkbox/checkbox.js');
require('../../../hooks/useRipple.js');
require('../../../utils/set-style.js');
require('../../../hooks/useKeepAnimation.js');
require('../../../checkbox/props.js');
require('../../../checkbox/constants.js');
require('../../../checkbox/group.js');
require('../../../hooks/slot.js');
require('../../../checkbox/checkbox-group-props.js');
require('../../../select/option-props.js');
require('../../../select/helper.js');
require('../../../select/optionGroup.js');
require('../../../select/option-group-props.js');
require('../../../select/hooks/usePanelVirtualScroll.js');
require('../../../hooks/useVirtualScroll.js');
require('../../../select/hooks/useSelectOptions.js');
require('lodash/throttle');
require('../../../input-number/index.js');
require('../../../input-number/input-number.js');
require('../../../button/index.js');
require('../../../button/button.js');
require('../../../button/props.js');
require('../../../input-number/props.js');
require('../../../input-number/useInputNumber.js');
require('../../../hooks/useCommonClassName.js');
require('../../../_common/js/input-number/number.js');
require('lodash/isNil');
require('../../../_common/js/input-number/large-number.js');
require('./config.js');
require('../../../_common/js/color-picker/color.js');
require('@babel/runtime/helpers/classCallCheck');
require('@babel/runtime/helpers/createClass');
require('tinycolor2');
require('../../../_common/js/color-picker/cmyk.js');
require('../../../_common/js/color-picker/gradient.js');

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

var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
var upperCase__default = /*#__PURE__*/_interopDefaultLegacy(upperCase);

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 FormatPanel = vue.defineComponent({
  name: "FormatPanel",
  inheritAttrs: false,
  props: _objectSpread(_objectSpread({}, colorPicker_props["default"]), {}, {
    color: {
      type: Object
    },
    onModeChange: {
      type: Function,
      "default": function _default() {
        return function () {};
      }
    },
    onInputChange: {
      type: Function,
      "default": function _default() {
        return function () {};
      }
    }
  }),
  setup: function setup(props2) {
    var baseClassName = colorPicker_hooks.useBaseClassName();
    var formatModel = vue.ref(props2.format);
    vue.watch(function () {
      return [props2.format];
    }, function () {
      return formatModel.value = props2.format;
    });
    var handleModeChange = function handleModeChange(v) {
      formatModel.value = v;
      props2.onModeChange(v);
    };
    return {
      formatModel: formatModel,
      baseClassName: baseClassName,
      handleModeChange: handleModeChange
    };
  },
  render: function render() {
    var _this = this;
    var _slot;
    var formats = _toConsumableArray__default["default"](colorPicker_const.FORMATS);
    var baseClassName = this.baseClassName,
      handleModeChange = this.handleModeChange;
    var newProps = _objectSpread(_objectSpread({}, this.$props), {}, {
      format: this.formatModel
    });
    var selectInputProps = _objectSpread({}, this.selectInputProps || {});
    return vue.createVNode("div", {
      "class": "".concat(baseClassName, "__format")
    }, [vue.createVNode("div", {
      "class": "".concat(baseClassName, "__format--item")
    }, [vue.createVNode(select_index.Select, vue.mergeProps({
      "size": "small",
      "class": "".concat(baseClassName, "__format-mode-select")
    }, selectInputProps, {
      "popupProps": {
        overlayClassName: "".concat(baseClassName, "__select-options")
      },
      "modelValue": _this.formatModel,
      "onUpdate:modelValue": function onUpdateModelValue($event) {
        return _this.formatModel = $event;
      },
      "onChange": handleModeChange
    }), _isSlot(_slot = formats.map(function (item) {
      return vue.createVNode(select_index.Option, {
        "key": item,
        "value": item,
        "label": upperCase__default["default"](item),
        "style": {
          fontSize: "12px"
        }
      }, null);
    })) ? _slot : {
      "default": function _default() {
        return [_slot];
      }
    })]), vue.createVNode("div", {
      "class": "".concat(baseClassName, "__format--item")
    }, [vue.createVNode(colorPicker_panel_format_inputs["default"], newProps, null)])]);
  }
});

exports["default"] = FormatPanel;
//# sourceMappingURL=index.js.map
