import { defineComponent, createVNode, mergeProps } from 'vue';
import { DownOutlined } from '@ant-design/icons-vue';
import PropTypes from '../_util/vue-types/index.mjs';
import { getPropsSlot } from '../_util/props-util/index.mjs';
import Dropdown from '../dropdown/dropdown.mjs';
import '../hooks/index.mjs';
import { objectType, eventType } from '../_util/type.mjs';
import useConfigInject from '../config-provider/hooks/useConfigInject.mjs';

const breadcrumbItemProps = () => ({
  prefixCls: String,
  href: String,
  separator: PropTypes.any,
  dropdownProps: objectType(),
  overlay: PropTypes.any,
  onClick: eventType()
});
var BreadcrumbItem = /* @__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, prefixCls2) => {
      const overlay = getPropsSlot(slots, props, "overlay");
      if (overlay) {
        return createVNode(Dropdown, mergeProps(props.dropdownProps, {
          "overlay": overlay,
          "placement": "bottom"
        }), {
          default: () => [createVNode("span", {
            "class": `${prefixCls2}-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", mergeProps({
          "class": `${prefixCls.value}-link`,
          "onClick": handleClick
        }, restAttrs), [children]);
      } else {
        link = createVNode("span", mergeProps({
          "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 { breadcrumbItemProps, BreadcrumbItem as default };
//# sourceMappingURL=BreadcrumbItem.mjs.map
