'use strict';

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

var vue = require('vue');
var index = require('../tooltip/index.js');
var raf = require('../_util/raf.js');
var Tooltip = require('../tooltip/Tooltip.js');

var SliderTooltip = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "SliderTooltip",
  inheritAttrs: false,
  props: Tooltip.tooltipProps(),
  setup(props, {
    attrs,
    slots
  }) {
    const innerRef = vue.ref(null);
    const rafRef = vue.ref(null);
    function cancelKeepAlign() {
      raf.default.cancel(rafRef.value);
      rafRef.value = null;
    }
    function keepAlign() {
      rafRef.value = raf.default(() => {
        var _a;
        (_a = innerRef.value) == null ? void 0 : _a.forcePopupAlign();
        rafRef.value = null;
      });
    }
    const align = () => {
      cancelKeepAlign();
      if (props.open)
        keepAlign();
    };
    vue.watch([() => props.open, () => props.title], () => {
      align();
    }, {
      flush: "post",
      immediate: true
    });
    vue.onActivated(() => {
      align();
    });
    vue.onBeforeUnmount(() => {
      cancelKeepAlign();
    });
    return () => {
      return vue.createVNode(index.default, vue.mergeProps({
        "ref": innerRef
      }, props, attrs), slots);
    };
  }
});

exports.default = SliderTooltip;
//# sourceMappingURL=SliderTooltip.js.map
