"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const index$2 = require("../../../../../@vueuse/core/index.js");
const constants = require("./constants.js");
const content = require("./content.js");
const pluginVue_exportHelper = require("../../../_virtual/plugin-vue_export-helper.js");
const index = require("../../../hooks/use-popper-container/index.js");
const index$1 = require("../../../hooks/use-namespace/index.js");
const event = require("../../../utils/dom/event.js");
const content$1 = require("../../popper/src/content.js");
const se = Vue.defineComponent({
  name: "ElTooltipContent",
  inheritAttrs: false
}), ie = /* @__PURE__ */ Vue.defineComponent({
  ...se,
  props: content.useTooltipContentProps,
  setup(P, { expose: w }) {
    const n = P, { selector: B } = index.usePopperContainerId(), S = index$1.useNamespace("tooltip"), l = Vue.ref(null), u = Vue.ref(false), {
      controlled: f,
      id: N,
      open: a,
      trigger: i,
      onClose: s,
      onOpen: O,
      onShow: L,
      onHide: A,
      onBeforeShow: d,
      onBeforeHide: c
    } = Vue.inject(constants.TOOLTIP_INJECTION_KEY, void 0), H = Vue.computed(() => n.transition || `${S.namespace.value}-fade-in-linear`), I = Vue.computed(() => n.persistent);
    Vue.onBeforeUnmount(() => {
      u.value = true;
    });
    const R = Vue.computed(() => Vue.unref(I) ? true : Vue.unref(a)), v = Vue.computed(() => n.disabled ? false : Vue.unref(a)), _ = Vue.computed(() => n.appendTo || B.value), $ = Vue.computed(() => {
      var e;
      return (e = n.style) != null ? e : {};
    }), M = Vue.computed(() => !Vue.unref(a)), z = () => {
      A();
    }, m = () => {
      if (Vue.unref(f))
        return true;
    }, V = event.composeEventHandlers(m, () => {
      n.enterable && Vue.unref(i) === "hover" && O();
    }), D = event.composeEventHandlers(m, () => {
      Vue.unref(i) === "hover" && s();
    }), j = () => {
      var e, r;
      (r = (e = l.value) == null ? void 0 : e.updatePopper) == null || r.call(e), d == null || d();
    }, J = () => {
      c == null || c();
    }, K = () => {
      L(), p = index$2.onClickOutside(Vue.computed(() => {
        var e;
        return (e = l.value) == null ? void 0 : e.popperContentRef;
      }), () => {
        if (Vue.unref(f))
          return;
        Vue.unref(i) !== "hover" && s();
      });
    }, U = () => {
      n.virtualTriggering || s();
    };
    let p;
    return Vue.watch(() => Vue.unref(a), (e) => {
      e || p == null || p();
    }, {
      flush: "post"
    }), Vue.watch(() => n.content, () => {
      var e, r;
      (r = (e = l.value) == null ? void 0 : e.updatePopper) == null || r.call(e);
    }), w({
      contentRef: l
    }), (e, r) => (Vue.openBlock(), Vue.createBlock(Vue.Teleport, {
      disabled: !e.teleported,
      to: Vue.unref(_)
    }, [
      Vue.createVNode(Vue.Transition, {
        name: Vue.unref(H),
        onAfterLeave: z,
        onBeforeEnter: j,
        onAfterEnter: K,
        onBeforeLeave: J
      }, {
        default: Vue.withCtx(() => [
          Vue.unref(R) ? Vue.withDirectives((Vue.openBlock(), Vue.createBlock(Vue.unref(content$1.default), Vue.mergeProps({
            key: 0,
            id: Vue.unref(N),
            ref_key: "contentRef",
            ref: l
          }, e.$attrs, {
            "aria-label": e.ariaLabel,
            "aria-hidden": Vue.unref(M),
            "boundaries-padding": e.boundariesPadding,
            "fallback-placements": e.fallbackPlacements,
            "gpu-acceleration": e.gpuAcceleration,
            offset: e.offset,
            placement: e.placement,
            "popper-options": e.popperOptions,
            strategy: e.strategy,
            effect: e.effect,
            enterable: e.enterable,
            pure: e.pure,
            "popper-class": e.popperClass,
            "popper-style": [e.popperStyle, Vue.unref($)],
            "reference-el": e.referenceEl,
            "trigger-target-el": e.triggerTargetEl,
            visible: Vue.unref(v),
            "z-index": e.zIndex,
            onMouseenter: Vue.unref(V),
            onMouseleave: Vue.unref(D),
            onBlur: U,
            onClose: Vue.unref(s)
          }), {
            default: Vue.withCtx(() => [
              u.value ? Vue.createCommentVNode("v-if", true) : Vue.renderSlot(e.$slots, "default", { key: 0 })
            ]),
            _: 3
          }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
            [Vue.vShow, Vue.unref(v)]
          ]) : Vue.createCommentVNode("v-if", true)
        ]),
        _: 3
      }, 8, ["name"])
    ], 8, ["disabled", "to"]));
  }
});
var he = /* @__PURE__ */ pluginVue_exportHelper.default(ie, [["__file", "content.vue"]]);
exports.default = he;
