import { defineComponent, ref, computed, provide, readonly, toRef, resolveComponent, openBlock, createBlock, withCtx, renderSlot, createCommentVNode } from 'vue';
import '../../popper/index.mjs';
import '../../../utils/index.mjs';
import '../../../hooks/index.mjs';
import PsTooltipTrigger from './trigger.mjs';
import { useTooltipContentProps, useTooltipTriggerProps, useTooltipProps } from './tooltip.mjs';
import { TOOLTIP_INJECTION_KEY } from './tokens.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { createModelToggleComposable } from '../../../hooks/use-model-toggle/index.mjs';
import { usePopperArrowProps } from '../../popper/src/arrow2.mjs';
import { usePopperContainer } from '../../../hooks/use-popper-container/index.mjs';
import { useId } from '../../../hooks/use-id/index.mjs';
import { isBoolean } from '@vueuse/core';

const { useModelToggleProps } = createModelToggleComposable("visible");
const _sfc_main = defineComponent({
  name: "PsTooltip",
  components: {
    PsTooltipTrigger
  },
  props: {
    ...useModelToggleProps,
    ...useTooltipContentProps,
    ...useTooltipTriggerProps,
    ...usePopperArrowProps,
    ...useTooltipProps
  },
  setup(props) {
    usePopperContainer();
    const id = useId();
    const open = ref(false);
    const controlled = computed(() => isBoolean(props.visible));
    provide(TOOLTIP_INJECTION_KEY, {
      controlled,
      id,
      open: readonly(open),
      trigger: toRef(props, "trigger")
    });
  }
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_ps_tooltip_trigger = resolveComponent("ps-tooltip-trigger");
  return openBlock(), createBlock(_component_ps_tooltip_trigger, {
    disabled: _ctx.disabled,
    trigger: _ctx.trigger,
    "virtual-ref": _ctx.virtualRef,
    "virtual-triggering": _ctx.virtualTriggering
  }, {
    default: withCtx(() => [
      _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
    ]),
    _: 3
  }, 8, ["disabled", "trigger", "virtual-ref", "virtual-triggering"]);
}
var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/meng/workspace/element-ps/packages/components/tooltip/src/tooltip.vue"]]);

export { Tooltip as default };
//# sourceMappingURL=tooltip2.mjs.map
