"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _vue = require("vue");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _context = require("../context");
var _util = require("../util");
var _classNames = _interopRequireDefault(require("../../_util/classNames"));
const dotProps = () => ({
  prefixCls: String,
  value: Number,
  style: [Object, Function],
  activeStyle: [Object, Function]
});
const Dot = (0, _vue.defineComponent)({
  name: 'ADot',
  props: dotProps(),
  setup(props) {
    const context = (0, _context.useInjectSlider)();
    return () => {
      const {
        prefixCls,
        value,
        style,
        activeStyle
      } = props;
      const {
        min,
        max,
        direction,
        included,
        includedStart,
        includedEnd
      } = context.value;
      const dotClassName = `${prefixCls}-dot`;
      const active = included && includedStart <= value && value <= includedEnd;
      let mergedStyle = (0, _extends2.default)((0, _extends2.default)({}, (0, _util.getDirectionStyle)(direction, value, min, max)), typeof style === 'function' ? style(value) : style);
      if (active) {
        mergedStyle = (0, _extends2.default)((0, _extends2.default)({}, mergedStyle), typeof activeStyle === 'function' ? activeStyle(value) : activeStyle);
      }
      return (0, _vue.createVNode)("span", {
        "class": (0, _classNames.default)(dotClassName, {
          [`${dotClassName}-active`]: active
        }),
        "style": mergedStyle
      }, null);
    };
  }
});
var _default = exports.default = Dot;