'use strict';

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

var vue = require('vue');
require('../vc-tour/index.js');
var classNames = require('../_util/classNames.js');
require('../hooks/index.js');
var type = require('../_util/type.js');
var placements = require('../_util/placements.js');
var panelRender = require('./panelRender.js');
var _interface = require('./interface.js');
var useMergedType = require('./useMergedType.js');
var index$1 = require('./style/index.js');
var useConfigInject = require('../config-provider/hooks/useConfigInject.js');
var Tour$1 = require('../vc-tour/Tour.js');

const Tour = /* @__PURE__ */ vue.defineComponent({
  name: "ATour",
  inheritAttrs: false,
  props: _interface.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$1.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 = classNames.default({
        [`${prefixCls.value}-primary`]: currentMergedType.value === "primary",
        [`${prefixCls.value}-rtl`]: direction.value === "rtl"
      }, hashId.value, rootClassName);
      const mergedRenderPanel = (stepProps, stepCurrent) => {
        return vue.createVNode(panelRender.default, vue.mergeProps(stepProps, {
          "type": type2,
          "current": stepCurrent
        }), {
          indicatorsRender: slots.indicatorsRender
        });
      };
      const onStepChange = (stepCurrent) => {
        updateInnerCurrent(stepCurrent);
        emit("update:current", stepCurrent);
        emit("change", stepCurrent);
      };
      const builtinPlacements = vue.computed(() => placements.default({
        arrowPointAtCenter: true,
        autoAdjustOverflow: true
      }));
      return wrapSSR(vue.createVNode(Tour$1.default, vue.mergeProps(attrs, restProps, {
        "rootClassName": customClassName,
        "prefixCls": prefixCls.value,
        "current": current2,
        "defaultCurrent": props.defaultCurrent,
        "animated": true,
        "renderPanel": mergedRenderPanel,
        "onChange": onStepChange,
        "steps": steps2,
        "builtinPlacements": builtinPlacements.value
      }), null));
    };
  }
});
var index = type.withInstall(Tour);

exports.default = index;
//# sourceMappingURL=index.js.map
