"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.borderBeamEffectProps = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _vue = require("vue");
var _unrefElement = require("../_util/hooks/_vueuse/unrefElement");
const borderBeamEffectProps = () => ({
  prefixCls: String,
  hostDom: {
    type: Object,
    default: null
  },
  className: String,
  style: Object
});
exports.borderBeamEffectProps = borderBeamEffectProps;
const supportPortalHost = hostDom => {
  const el = (0, _unrefElement.unrefElement)(hostDom);
  return typeof HTMLElement !== 'undefined' && el instanceof HTMLElement;
};
const BorderBeamEffectElement = (0, _vue.defineComponent)({
  name: 'BorderBeamEffectElement',
  props: {
    prefixCls: String,
    className: String,
    style: Object
  },
  setup(props, {
    attrs
  }) {
    return () => {
      return (0, _vue.createVNode)("div", (0, _objectSpread2.default)({
        "aria-hidden": "true",
        "class": [props.prefixCls, props.className],
        "style": props.style
      }, attrs), null);
    };
  }
});
const BorderBeamEffect = (0, _vue.defineComponent)({
  name: 'BorderBeamEffect',
  inheritAttrs: false,
  props: borderBeamEffectProps(),
  setup(props) {
    const targetDom = (0, _vue.computed)(() => (0, _unrefElement.unrefElement)(props.hostDom));
    const canPortal = (0, _vue.computed)(() => supportPortalHost(props.hostDom));
    return () => {
      const {
        prefixCls,
        className,
        style
      } = props;
      if (!targetDom.value || !canPortal.value) {
        return null;
      }
      return (0, _vue.createVNode)(_vue.Teleport, {
        "to": targetDom.value
      }, {
        default: () => [(0, _vue.createVNode)(BorderBeamEffectElement, {
          "prefixCls": prefixCls,
          "className": className,
          "style": style
        }, null)]
      });
    };
  }
});
var _default = exports.default = BorderBeamEffect;