import { createVNode, Fragment } from 'vue';
import { CloseCircleFilled, LoadingOutlined, SearchOutlined, DownOutlined, CheckOutlined, CloseOutlined } from '@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 : createVNode(CloseCircleFilled, null, null);
  const getSuffixIconNode = (arrowIcon) => createVNode(Fragment, null, [showArrow !== false && arrowIcon, hasFeedback && feedbackIcon]);
  let mergedSuffixIcon = null;
  if (suffixIcon !== void 0) {
    mergedSuffixIcon = getSuffixIconNode(suffixIcon);
  } else if (loading) {
    mergedSuffixIcon = getSuffixIconNode(createVNode(LoadingOutlined, {
      "spin": true
    }, null));
  } else {
    const iconCls = `${prefixCls}-suffix`;
    mergedSuffixIcon = ({
      open,
      showSearch
    }) => {
      if (open && showSearch)
        return getSuffixIconNode(createVNode(SearchOutlined, {
          "class": iconCls
        }, null));
      return getSuffixIconNode(createVNode(DownOutlined, {
        "class": iconCls
      }, null));
    };
  }
  let mergedItemIcon = null;
  if (menuItemSelectedIcon !== void 0)
    mergedItemIcon = menuItemSelectedIcon;
  else if (multiple)
    mergedItemIcon = createVNode(CheckOutlined, null, null);
  else
    mergedItemIcon = null;
  let mergedRemoveIcon = null;
  if (removeIcon !== void 0)
    mergedRemoveIcon = removeIcon;
  else
    mergedRemoveIcon = createVNode(CloseOutlined, null, null);
  return {
    clearIcon: mergedClearIcon,
    suffixIcon: mergedSuffixIcon,
    itemIcon: mergedItemIcon,
    removeIcon: mergedRemoveIcon
  };
}

export { getIcons as default };
//# sourceMappingURL=iconUtil.mjs.map
