import { defineComponent, useSlots, computed, ref, resolveComponent, createBlock, openBlock, mergeProps, toHandlers, unref, createSlots, withCtx, createElementBlock, Fragment, renderList, createCommentVNode, createVNode, renderSlot, normalizeProps, guardReactiveProps } from 'vue';
import '../../../../utils/index.mjs';
import { tourEmits } from 'element-plus';
import VNodeRenderer from '../../common/VNodeRenderer.mjs';
import { tourEmits as tourEmits$1, tourProps } from './tour.mjs';
import { getGmEvent } from '../../../../utils/src/elementPlus/event.mjs';

var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{
    name: "GmTour"
  },
  __name: "Tour",
  props: tourProps,
  emits: tourEmits$1,
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const elEvents = getGmEvent(tourEmits, emit);
    const slots = useSlots();
    const tourSteps = computed(() => {
      return slots.default?.().filter((node) => node?.type?.name === "GmTourStep") ?? [];
    });
    const elRef = ref();
    __expose({
      elRef
    });
    return (_ctx, _cache) => {
      const _component_el_tour_step = resolveComponent("el-tour-step");
      const _component_el_tour = resolveComponent("el-tour");
      return openBlock(), createBlock(
        _component_el_tour,
        mergeProps({
          ref_key: "elRef",
          ref: elRef
        }, props, toHandlers(unref(elEvents))),
        createSlots({
          _: 2
          /* DYNAMIC */
        }, [
          unref(slots).default ? {
            name: "default",
            fn: withCtx(() => [
              (openBlock(true), createElementBlock(
                Fragment,
                null,
                renderList(tourSteps.value, (item, index) => {
                  return openBlock(), createBlock(
                    _component_el_tour_step,
                    mergeProps({ key: index }, item.props),
                    createSlots({
                      default: withCtx(() => [
                        item.children ? (openBlock(), createBlock(unref(VNodeRenderer), {
                          key: 0,
                          vnode: item.children.default()
                        }, null, 8, ["vnode"])) : createCommentVNode("v-if", true)
                      ]),
                      _: 2
                      /* DYNAMIC */
                    }, [
                      item.children?.header ? {
                        name: "header",
                        fn: withCtx(() => [
                          createVNode(unref(VNodeRenderer), {
                            vnode: item.children.header()
                          }, null, 8, ["vnode"])
                        ]),
                        key: "0"
                      } : void 0
                    ]),
                    1040
                    /* FULL_PROPS, DYNAMIC_SLOTS */
                  );
                }),
                128
                /* KEYED_FRAGMENT */
              ))
            ]),
            key: "0"
          } : void 0,
          unref(slots).indicators ? {
            name: "indicators",
            fn: withCtx((slotValue) => [
              renderSlot(_ctx.$slots, "indicators", normalizeProps(guardReactiveProps(slotValue)))
            ]),
            key: "1"
          } : void 0
        ]),
        1040
        /* FULL_PROPS, DYNAMIC_SLOTS */
      );
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=Tour.vue2.mjs.map
