'use strict';

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

var vue = require('vue');
require('../../../../utils/index.cjs');
var log = require('../../../../utils/log.cjs');
var _class = require('../../../../utils/dom/class.cjs');

function calcPoints(_vertical, marks, dots, step, min, max) {
  log.devWarning(dots ? step > 0 : true, "Slider", "`Slider[step]` should be a positive number in order to make Slider[dots] work.");
  const points = Object.keys(marks).map(Number.parseFloat).sort((a, b) => a - b);
  if (dots && step) {
    for (let i = min; i <= max; i += step) {
      if (!points.includes(i))
        points.push(i);
    }
  }
  return points;
}
function Steps(_, {
  attrs
}) {
  const {
    prefixCls,
    vertical,
    reverse,
    marks,
    dots,
    step,
    included,
    lowerBound,
    upperBound,
    max,
    min,
    dotStyle,
    activeDotStyle
  } = attrs;
  const range = max - min;
  const elements = calcPoints(vertical, marks, dots, step, min, max).map((point) => {
    const offset = `${Math.abs(point - min) / range * 100}%`;
    const isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;
    let style = vertical ? {
      ...dotStyle,
      [reverse ? "top" : "bottom"]: offset
    } : {
      ...dotStyle,
      [reverse ? "right" : "left"]: offset
    };
    if (isActived)
      style = {
        ...style,
        ...activeDotStyle
      };
    const pointClassName = _class.classNames({
      [`${prefixCls}-dot`]: true,
      [`${prefixCls}-dot-active`]: isActived,
      [`${prefixCls}-dot-reverse`]: reverse
    });
    return vue.createVNode("span", {
      "class": pointClassName,
      "style": style,
      "key": point
    }, null);
  });
  return vue.createVNode("div", {
    "class": `${prefixCls}-step`
  }, [elements]);
}
Steps.inheritAttrs = false;

exports.default = Steps;
//# sourceMappingURL=Steps.cjs.map
