import { defineComponent, createVNode } from 'vue';
import { DownOutlined } from '@ant-design/icons-vue';
import '../../../utils/index.mjs';
import useConfigInject from '../../config-provider/src/hooks/useConfigInject.mjs';
import { Dropdown } from '../../dropdown/index.mjs';
import { breadcrumbItemProps } from './props.mjs';
import { getPropsSlot } from '../../../utils/vue/props.mjs';

var ABreadcrumbItem = /* @__PURE__ */ defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ABreadcrumbItem",
  inheritAttrs: false,
  __ANT_BREADCRUMB_ITEM: true,
  props: breadcrumbItemProps(),
  // emits: ['click'],
  slots: Object,
  setup(props, {
    slots,
    attrs,
    emit
  }) {
    const {
      prefixCls
    } = useConfigInject("breadcrumb", props);
    const renderBreadcrumbNode = (breadcrumbItem, prefix) => {
      const overlay = getPropsSlot(slots, props, "overlay");
      if (overlay) {
        return createVNode(Dropdown, {
          ...props.dropdownProps,
          "overlay": overlay,
          "placement": "bottom"
        }, {
          default: () => [createVNode("span", {
            "class": `${prefix}-overlay-link`
          }, [breadcrumbItem, createVNode(DownOutlined, null, null)])]
        });
      }
      return breadcrumbItem;
    };
    const handleClick = (e) => {
      emit("click", e);
    };
    return () => {
      var _a;
      const separator = (_a = getPropsSlot(slots, props, "separator")) != null ? _a : "/";
      const children = getPropsSlot(slots, props);
      const {
        class: cls,
        style,
        ...restAttrs
      } = attrs;
      let link;
      if (props.href !== void 0) {
        link = createVNode("a", {
          "class": `${prefixCls.value}-link`,
          "onClick": handleClick,
          ...restAttrs
        }, [children]);
      } else {
        link = createVNode("span", {
          "class": `${prefixCls.value}-link`,
          "onClick": handleClick,
          ...restAttrs
        }, [children]);
      }
      link = renderBreadcrumbNode(link, prefixCls.value);
      if (children !== void 0 && children !== null) {
        return createVNode("li", {
          "class": cls,
          "style": style
        }, [link, separator && createVNode("span", {
          "class": `${prefixCls.value}-separator`
        }, [separator])]);
      }
      return null;
    };
  }
});

export { ABreadcrumbItem as default };
//# sourceMappingURL=BreadcrumbItem.mjs.map
