import * as _vue from "vue";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

import { inject } from 'vue';
import Tooltip from '../tooltip';
import abstractTooltipProps from '../tooltip/abstractTooltipProps';
import PropTypes from '../_util/vue-types';
import { getOptionProps, getComponent, getSlot } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
var props = abstractTooltipProps();
var Popover = {
  name: 'APopover',
  props: _objectSpread(_objectSpread({}, props), {}, {
    prefixCls: PropTypes.string,
    transitionName: PropTypes.string.def('zoom-big'),
    content: PropTypes.any,
    title: PropTypes.any
  }),
  setup: function setup() {
    return {
      configProvider: inject('configProvider', ConfigConsumerProps)
    };
  },
  methods: {
    getPopupDomNode: function getPopupDomNode() {
      return this.$refs.tooltip.getPopupDomNode();
    }
  },
  render: function render() {
    var _this = this;

    var title = this.title,
        customizePrefixCls = this.prefixCls,
        $slots = this.$slots;
    var getPrefixCls = this.configProvider.getPrefixCls;
    var prefixCls = getPrefixCls('popover', customizePrefixCls);
    var props = getOptionProps(this);
    delete props.title;
    delete props.content;

    var tooltipProps = _objectSpread(_objectSpread({}, props), {}, {
      prefixCls: prefixCls,
      ref: 'tooltip',
      title: _vue.createVNode("div", null, [(title || $slots.title) && _vue.createVNode("div", {
        "class": "".concat(prefixCls, "-title")
      }, [getComponent(this, 'title')]), _vue.createVNode("div", {
        "class": "".concat(prefixCls, "-inner-content")
      }, [getComponent(this, 'content')])])
    });

    return _vue.createVNode(Tooltip, tooltipProps, {
      default: function _default() {
        return [getSlot(_this)];
      }
    });
  }
};
/* istanbul ignore next */

Popover.install = function (app) {
  app.component(Popover.name, Popover);
};

export default Popover;