'use strict';

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

var vue = require('vue');
require('../../../utils/index.js');
var lodashEs = require('lodash-es');
var slider = require('./slider.js');
var createNamespace = require('../../../utils/create-namespace.js');
var addUnit = require('../../../utils/add-unit.js');

"use strict";
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{ name: "LlSlider", inheritAttrs: false },
  __name: "slider",
  props: slider.sliderProps,
  emits: slider.sliderEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const bem = createNamespace.createNamespace("slider");
    const attrs = vue.useAttrs();
    const containerAttrs = vue.computed(() => ({
      class: attrs.class,
      style: attrs.style
    }));
    const componentAttrs = vue.computed(() => lodashEs.omit(attrs, ["class", "style"]));
    const sliderValue = vue.computed({
      get() {
        return props.value;
      },
      set(value) {
        emit("update:value", value);
        emit("change", value);
      }
    });
    const hasMarks = vue.computed(() => {
      return attrs.marks && Object.keys(attrs.marks).length > 0;
    });
    return (_ctx, _cache) => {
      const _component_a_slider = vue.resolveComponent("a-slider");
      const _component_ll_input_number = vue.resolveComponent("ll-input-number");
      const _component_a_form_item_rest = vue.resolveComponent("a-form-item-rest");
      return vue.openBlock(), vue.createElementBlock(
        "div",
        vue.mergeProps({
          class: [vue.unref(bem).b("container")],
          style: { height: props.vertical ? props.verticalHeight : "auto" }
        }, containerAttrs.value),
        [
          vue.createVNode(_component_a_slider, vue.mergeProps(componentAttrs.value, {
            value: sliderValue.value,
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => sliderValue.value = $event),
            class: [
              vue.unref(bem).b(),
              _ctx.vertical ? vue.unref(bem).is("vertical") : vue.unref(bem).is("horizontal"),
              _ctx.reverse ? vue.unref(bem).is("reverse") : "",
              vue.unref(bem).is(_ctx.lineWeight)
            ],
            min: _ctx.min,
            max: _ctx.max,
            vertical: _ctx.vertical,
            reverse: _ctx.reverse,
            disabled: _ctx.disabled,
            step: _ctx.step
          }), vue.createSlots({
            _: 2
            /* DYNAMIC */
          }, [
            vue.renderList(Object.keys(_ctx.$slots), (item) => {
              return {
                name: item,
                fn: vue.withCtx((data) => [
                  vue.renderSlot(_ctx.$slots, item, vue.normalizeProps(vue.guardReactiveProps(data || {})))
                ])
              };
            })
          ]), 1040, ["value", "class", "min", "max", "vertical", "reverse", "disabled", "step"]),
          vue.createVNode(_component_a_form_item_rest, null, {
            default: vue.withCtx(() => [
              !_ctx.vertical && !vue.unref(attrs).range && _ctx.showInput && !hasMarks.value ? (vue.openBlock(), vue.createBlock(_component_ll_input_number, {
                key: 0,
                value: sliderValue.value,
                "onUpdate:value": _cache[1] || (_cache[1] = ($event) => sliderValue.value = $event),
                min: _ctx.min,
                max: _ctx.max,
                disabled: _ctx.disabled,
                step: _ctx.step,
                size: _ctx.inputSize,
                style: vue.normalizeStyle({ width: vue.unref(addUnit.addUnit)(_ctx.inputWidth) })
              }, null, 8, ["value", "min", "max", "disabled", "step", "size", "style"])) : vue.createCommentVNode("v-if", true)
            ]),
            _: 1
            /* STABLE */
          })
        ],
        16
        /* FULL_PROPS */
      );
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=slider.vue2.js.map
