import { createVNode as _createVNode } from "vue";
import _extends from "@babel/runtime/helpers/esm/extends";
import { defineComponent } from 'vue';
import { useInjectSlider } from '../context';
import { getDirectionStyle } from '../util';
import classnames from '../../_util/classNames';
const markProps = () => ({
  prefixCls: String,
  style: Object,
  value: Number,
  onClick: Function
});
const Mark = defineComponent({
  name: 'AMark',
  props: markProps(),
  setup(props, {
    slots
  }) {
    const context = useInjectSlider();
    return () => {
      var _a;
      const {
        prefixCls,
        style,
        value,
        onClick
      } = props;
      const {
        min,
        max,
        direction,
        includedStart,
        includedEnd,
        included
      } = context.value;
      const textCls = `${prefixCls}-text`;
      const positionStyle = getDirectionStyle(direction, value, min, max);
      return _createVNode("span", {
        "class": classnames(textCls, {
          [`${textCls}-active`]: included && includedStart <= value && value <= includedEnd
        }),
        "style": _extends(_extends({}, positionStyle), style),
        "onMousedown": e => {
          e.stopPropagation();
        },
        "onClick": () => {
          onClick(value);
        }
      }, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
    };
  }
});
export default Mark;