import { defineComponent, useAttrs, computed, resolveComponent, createElementBlock, openBlock, mergeProps, unref, createVNode, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, createBlock, createCommentVNode, normalizeStyle } from 'vue';
import '../../../utils/index.mjs';
import { omit } from 'lodash-es';
import { sliderEmits, sliderProps } from './slider.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';
import { addUnit } from '../../../utils/add-unit.mjs';

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

export { _sfc_main as default };
//# sourceMappingURL=slider.vue2.mjs.map
