'use strict';

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

var vue = require('vue');
var index$2 = require('../tooltip/index.js');
var abstractTooltipProps = require('../tooltip/abstractTooltipProps.js');
var index$1 = require('../_util/props-util/index.js');
var type = require('../_util/type.js');
require('../hooks/index.js');
var omit = require('../_util/omit.js');
var transition = require('../_util/components/transition.js');
var Tooltip = require('../tooltip/Tooltip.js');
var classNames = require('../_util/classNames.js');
var warning = require('../_util/warning.js');
var index = require('./style/index.js');
var initDefaultProps = require('../_util/props-util/initDefaultProps.js');
var useConfigInject = require('../config-provider/hooks/useConfigInject.js');

const popoverProps = () => ({
  ...abstractTooltipProps.default(),
  content: type.anyType(),
  title: type.anyType()
});
const Popover = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "APopover",
  inheritAttrs: false,
  props: initDefaultProps.default(popoverProps(), {
    ...Tooltip.tooltipDefaultProps(),
    trigger: "hover",
    placement: "top",
    mouseEnterDelay: 0.1,
    mouseLeaveDelay: 0.1
  }),
  setup(props, {
    expose,
    slots,
    attrs
  }) {
    const tooltipRef = vue.ref();
    warning.default(props.visible === void 0, "popover", "`visible` will be removed in next major version, please use `open` instead.");
    expose({
      getPopupDomNode: () => {
        var _a, _b;
        return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.getPopupDomNode) == null ? void 0 : _b.call(_a);
      }
    });
    const {
      prefixCls,
      configProvider
    } = useConfigInject.default("popover", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    const rootPrefixCls = vue.computed(() => configProvider.getPrefixCls());
    const getOverlay = () => {
      var _a, _b;
      const {
        title = index$1.filterEmpty((_a = slots.title) == null ? void 0 : _a.call(slots)),
        content = index$1.filterEmpty((_b = slots.content) == null ? void 0 : _b.call(slots))
      } = props;
      const hasTitle = !!(Array.isArray(title) ? title.length : title);
      const hasContent = !!(Array.isArray(content) ? content.length : title);
      if (!hasTitle && !hasContent)
        return null;
      return vue.createVNode(vue.Fragment, null, [hasTitle && vue.createVNode("div", {
        "class": `${prefixCls.value}-title`
      }, [title]), vue.createVNode("div", {
        "class": `${prefixCls.value}-inner-content`
      }, [content])]);
    };
    return () => {
      const overlayCls = classNames.default(props.overlayClassName, hashId.value);
      return wrapSSR(vue.createVNode(index$2.default, vue.mergeProps(omit.default(props, ["title", "content"]), attrs, {
        "prefixCls": prefixCls.value,
        "ref": tooltipRef,
        "overlayClassName": overlayCls,
        "transitionName": transition.getTransitionName(rootPrefixCls.value, "zoom-big", props.transitionName),
        "data-popover-inject": true
      }), {
        title: getOverlay,
        default: slots.default
      }));
    };
  }
});
var Popover$1 = type.withInstall(Popover);

exports.default = Popover$1;
exports.popoverProps = popoverProps;
//# sourceMappingURL=index.js.map
