'use strict';

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

var vue = require('vue');
var CloseOutlined = require('@ant-design/icons-vue');
var index = require('../../_util/props-util/index.js');

function renderSwitcherIcon(prefixCls, switcherIcon, props, leafIcon, showLine) {
  const {
    isLeaf,
    expanded,
    loading
  } = props;
  let icon = switcherIcon;
  if (loading)
    return vue.createVNode(CloseOutlined.LoadingOutlined, {
      "class": `${prefixCls}-switcher-loading-icon`
    }, null);
  let showLeafIcon;
  if (showLine && typeof showLine === "object")
    showLeafIcon = showLine.showLeafIcon;
  let defaultIcon = null;
  const switcherCls = `${prefixCls}-switcher-icon`;
  if (isLeaf) {
    if (!showLine)
      return null;
    if (showLeafIcon && leafIcon)
      return leafIcon(props);
    if (typeof showLine === "object" && !showLeafIcon)
      defaultIcon = vue.createVNode("span", {
        "class": `${prefixCls}-switcher-leaf-line`
      }, null);
    else
      defaultIcon = vue.createVNode(CloseOutlined.FileOutlined, {
        "class": `${prefixCls}-switcher-line-icon`
      }, null);
    return defaultIcon;
  } else {
    defaultIcon = vue.createVNode(CloseOutlined.CaretDownFilled, {
      "class": switcherCls
    }, null);
    if (showLine) {
      defaultIcon = expanded ? vue.createVNode(CloseOutlined.MinusSquareOutlined, {
        "class": `${prefixCls}-switcher-line-icon`
      }, null) : vue.createVNode(CloseOutlined.PlusSquareOutlined, {
        "class": `${prefixCls}-switcher-line-icon`
      }, null);
    }
  }
  if (typeof switcherIcon === "function") {
    icon = switcherIcon({
      ...props,
      defaultIcon,
      switcherCls
    });
  } else if (index.isValidElement(icon)) {
    icon = vue.cloneVNode(icon, {
      class: switcherCls
    });
  }
  return icon || defaultIcon;
}

exports.default = renderSwitcherIcon;
//# sourceMappingURL=iconUtil.js.map
