'use strict';

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

var vue = require('vue');
require('../../../../utils/index.js');
var elementPlus = require('element-plus');
var VNodeRenderer = require('../../common/VNodeRenderer.js');
var tour = require('./tour.js');
var event = require('../../../../utils/src/elementPlus/event.js');

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

exports.default = _sfc_main;
//# sourceMappingURL=Tour.vue2.js.map
