"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _vue = require("vue");
require("../Marks");
var _context = require("../context");
var _Dot = _interopRequireDefault(require("./Dot"));
const stepsProps = () => ({
  prefixCls: String,
  marks: Array,
  dots: {
    type: Boolean,
    default: undefined
  },
  style: [Object, Function],
  activeStyle: [Object, Function]
});
const Steps = (0, _vue.defineComponent)({
  name: 'ASteps',
  props: stepsProps(),
  setup(props) {
    const context = (0, _context.useInjectSlider)();
    const stepDots = (0, _vue.computed)(() => {
      const {
        marks,
        dots
      } = props;
      const {
        step,
        min,
        max
      } = context.value;
      const dotSet = new Set();
      marks.forEach(mark => {
        dotSet.add(mark.value);
      });
      if (dots && step !== null) {
        let current = min;
        while (current <= max) {
          dotSet.add(current);
          current += step;
        }
      }
      return Array.from(dotSet);
    });
    return () => {
      const {
        prefixCls,
        style,
        activeStyle
      } = props;
      return (0, _vue.createVNode)("div", {
        "class": `${prefixCls}-step`
      }, [stepDots.value.map(dotValue => (0, _vue.createVNode)(_Dot.default, {
        "prefixCls": prefixCls,
        "key": dotValue,
        "value": dotValue,
        "style": style,
        "activeStyle": activeStyle
      }, null))]);
    };
  }
});
var _default = exports.default = Steps;