'use strict';

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

var vue = require('vue');
var iconsVue = require('@ant-design/icons-vue');

function getIcons(props, slots = {}) {
  const {
    loading,
    multiple,
    prefixCls,
    hasFeedback,
    feedbackIcon,
    showArrow
  } = props;
  const suffixIcon = props.suffixIcon || slots.suffixIcon && slots.suffixIcon();
  const clearIcon = props.clearIcon || slots.clearIcon && slots.clearIcon();
  const menuItemSelectedIcon = props.menuItemSelectedIcon || slots.menuItemSelectedIcon && slots.menuItemSelectedIcon();
  const removeIcon = props.removeIcon || slots.removeIcon && slots.removeIcon();
  const mergedClearIcon = clearIcon != null ? clearIcon : vue.createVNode(iconsVue.CloseCircleFilled, null, null);
  const getSuffixIconNode = (arrowIcon) => vue.createVNode(vue.Fragment, null, [showArrow !== false && arrowIcon, hasFeedback && feedbackIcon]);
  let mergedSuffixIcon = null;
  if (suffixIcon !== void 0) {
    mergedSuffixIcon = getSuffixIconNode(suffixIcon);
  } else if (loading) {
    mergedSuffixIcon = getSuffixIconNode(vue.createVNode(iconsVue.LoadingOutlined, {
      "spin": true
    }, null));
  } else {
    const iconCls = `${prefixCls}-suffix`;
    mergedSuffixIcon = ({
      open,
      showSearch
    }) => {
      if (open && showSearch)
        return getSuffixIconNode(vue.createVNode(iconsVue.SearchOutlined, {
          "class": iconCls
        }, null));
      return getSuffixIconNode(vue.createVNode(iconsVue.DownOutlined, {
        "class": iconCls
      }, null));
    };
  }
  let mergedItemIcon = null;
  if (menuItemSelectedIcon !== void 0)
    mergedItemIcon = menuItemSelectedIcon;
  else if (multiple)
    mergedItemIcon = vue.createVNode(iconsVue.CheckOutlined, null, null);
  else
    mergedItemIcon = null;
  let mergedRemoveIcon = null;
  if (removeIcon !== void 0)
    mergedRemoveIcon = removeIcon;
  else
    mergedRemoveIcon = vue.createVNode(iconsVue.CloseOutlined, null, null);
  return {
    clearIcon: mergedClearIcon,
    suffixIcon: mergedSuffixIcon,
    itemIcon: mergedItemIcon,
    removeIcon: mergedRemoveIcon
  };
}

exports.default = getIcons;
//# sourceMappingURL=iconUtil.cjs.map
