'use strict';

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

var vue = require('vue');
require('../../../utils/index.cjs');
require('../../../vue-components/index.cjs');
var useConfigInject = require('../../config-provider/src/hooks/useConfigInject.cjs');
var index = require('../style/index.cjs');
var PanelRender = require('./PanelRender.cjs');
var useMergedType = require('./useMergedType.cjs');
var props = require('./props.cjs');
var _class = require('../../../utils/dom/class.cjs');
var placement = require('../../../utils/placement.cjs');
var Tour = require('../../../vue-components/vc-tour/src/Tour.cjs');

var ATour = /* @__PURE__ */ vue.defineComponent({
  name: "ATour",
  inheritAttrs: false,
  props: props.tourProps(),
  setup(props, {
    attrs,
    emit,
    slots
  }) {
    const {
      current,
      type,
      steps,
      defaultCurrent
    } = vue.toRefs(props);
    const {
      prefixCls,
      direction
    } = useConfigInject.default("tour", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    const {
      currentMergedType,
      updateInnerCurrent
    } = useMergedType.default({
      defaultType: type,
      steps,
      current,
      defaultCurrent
    });
    return () => {
      const {
        steps: steps2,
        current: current2,
        type: type2,
        rootClassName,
        ...restProps
      } = props;
      const customClassName = _class.classNames({
        [`${prefixCls.value}-primary`]: currentMergedType.value === "primary",
        [`${prefixCls.value}-rtl`]: direction.value === "rtl"
      }, hashId.value, rootClassName);
      const mergedRenderPanel = (stepProps, stepCurrent) => {
        return vue.createVNode(PanelRender.default, {
          ...stepProps,
          "type": type2,
          "current": stepCurrent
        }, {
          indicatorsRender: slots.indicatorsRender
        });
      };
      const onStepChange = (stepCurrent) => {
        updateInnerCurrent(stepCurrent);
        emit("update:current", stepCurrent);
        emit("change", stepCurrent);
      };
      const builtinPlacements = vue.computed(() => placement.getPlacements({
        arrowPointAtCenter: true,
        autoAdjustOverflow: true
      }));
      return wrapSSR(vue.createVNode(Tour.default, {
        ...attrs,
        ...restProps,
        "rootClassName": customClassName,
        "prefixCls": prefixCls.value,
        "current": current2,
        "defaultCurrent": props.defaultCurrent,
        "animated": true,
        "renderPanel": mergedRenderPanel,
        "onChange": onStepChange,
        "steps": steps2,
        "builtinPlacements": builtinPlacements.value
      }, null));
    };
  }
});

exports.default = ATour;
//# sourceMappingURL=Tour.cjs.map
