import * as React from 'react';
import Icon from '../../icon';
export default function getIcons(_ref) {
    var suffixIcon = _ref.suffixIcon,
        clearIcon = _ref.clearIcon,
        menuItemSelectedIcon = _ref.menuItemSelectedIcon,
        removeIcon = _ref.removeIcon,
        loading = _ref.loading,
        multiple = _ref.multiple,
        prefixCls = _ref.prefixCls;

    // Clear Icon
    var mergedClearIcon = clearIcon;
    if (!clearIcon) {
        mergedClearIcon = React.createElement(Icon, { type: 'close-circle' });
    }
    // Arrow item icon
    var mergedSuffixIcon = null;
    if (suffixIcon !== undefined) {
        mergedSuffixIcon = suffixIcon;
    } else if (loading) {
        mergedSuffixIcon = React.createElement(Icon, { type: 'loading' });
    } else {
        var iconCls = prefixCls + '-suffix';
        mergedSuffixIcon = function mergedSuffixIcon(_ref2) {
            var open = _ref2.open,
                showSearch = _ref2.showSearch;

            if (open && showSearch) {
                return React.createElement(Icon, { type: 'search', className: iconCls });
            }
            return React.createElement(Icon, { type: 'down', className: iconCls });
        };
    }
    // Checked item icon
    var mergedItemIcon = null;
    if (menuItemSelectedIcon !== undefined) {
        mergedItemIcon = menuItemSelectedIcon;
    } else if (multiple) {
        mergedItemIcon = React.createElement(Icon, { type: 'check' });
    } else {
        mergedItemIcon = null;
    }
    var mergedRemoveIcon = null;
    if (removeIcon !== undefined) {
        mergedRemoveIcon = removeIcon;
    } else {
        mergedRemoveIcon = React.createElement(Icon, { type: 'close' });
    }
    return {
        clearIcon: mergedClearIcon,
        suffixIcon: mergedSuffixIcon,
        menuItemSelectedIcon: mergedItemIcon,
        removeIcon: mergedRemoveIcon
    };
}