"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index = require("../../focus-trap/index.js");
const content = require("./content.js");
const helper = require("./helper.js");
const Vue = require("vue");
const _hoisted_1 = ["data-side"];
var content_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElTourContent",
  __name: "content",
  props: content.tourContentProps,
  emits: content.tourContentEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const placement = Vue.ref(props.placement);
    const strategy = Vue.ref(props.strategy);
    const contentRef = Vue.ref(null);
    const arrowRef = Vue.ref(null);
    Vue.watch(() => props.placement, () => {
      placement.value = props.placement;
    });
    const { contentStyle, arrowStyle } = helper.useFloating(Vue.toRef(props, "reference"), contentRef, arrowRef, placement, strategy, Vue.toRef(props, "offset"), Vue.toRef(props, "zIndex"), Vue.toRef(props, "showArrow"));
    const side = Vue.computed(() => {
      return placement.value.split("-")[0];
    });
    const { ns } = Vue.inject(helper.tourKey);
    const onCloseRequested = () => {
      emit("close");
    };
    const onFocusoutPrevented = (event) => {
      if (event.detail.focusReason === "pointer") event.preventDefault();
    };
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", {
        ref_key: "contentRef",
        ref: contentRef,
        style: Vue.normalizeStyle(Vue.unref(contentStyle)),
        class: Vue.normalizeClass(Vue.unref(ns).e("content")),
        "data-side": side.value,
        tabindex: "-1"
      }, [Vue.createVNode(Vue.unref(index.default), {
        loop: "",
        trapped: "",
        "focus-start-el": "container",
        "focus-trap-el": contentRef.value || void 0,
        onReleaseRequested: onCloseRequested,
        onFocusoutPrevented
      }, {
        default: Vue.withCtx(() => [Vue.renderSlot(_ctx.$slots, "default")]),
        _: 3
      }, 8, ["focus-trap-el"]), __props.showArrow ? (Vue.openBlock(), Vue.createElementBlock("span", {
        key: 0,
        ref_key: "arrowRef",
        ref: arrowRef,
        style: Vue.normalizeStyle(Vue.unref(arrowStyle)),
        class: Vue.normalizeClass(Vue.unref(ns).e("arrow"))
      }, null, 6)) : Vue.createCommentVNode("v-if", true)], 14, _hoisted_1);
    };
  }
});
exports.default = content_vue_vue_type_script_setup_true_lang_default;
