import { n as cn } from "./utils-DXzSsU1e.js";
import { Fragment, computed, createBlock, createElementBlock, createVNode, defineComponent, mergeModels, mergeProps, normalizeClass, openBlock, renderList, unref, useModel, withCtx } from "vue";
import { reactiveOmit } from "@vueuse/core";
import { SliderRange, SliderRoot, SliderThumb, SliderTrack, useForwardPropsEmits } from "reka-ui";
import { cva } from "class-variance-authority";
//#endregion
//#region src/components/ui/slider/Slider.vue
var Slider_default = /* @__PURE__ */ defineComponent({
	__name: "Slider",
	props: /* @__PURE__ */ mergeModels({
		size: { default: "default" },
		orientation: { default: "horizontal" },
		min: {},
		max: {},
		step: {},
		disabled: { type: Boolean },
		inverted: { type: Boolean },
		minStepsBetweenThumbs: {},
		class: { type: [
			Boolean,
			null,
			String,
			Object,
			Array
		] }
	}, {
		"modelValue": {},
		"modelModifiers": {}
	}),
	emits: /* @__PURE__ */ mergeModels(["update:modelValue", "valueCommit"], ["update:modelValue"]),
	setup(__props, { emit: __emit }) {
		const props = __props;
		const emits = __emit;
		const modelValue = useModel(__props, "modelValue");
		const delegatedProps = reactiveOmit(props, "class", "size", "orientation", "modelValue");
		const orientation = computed(() => props.orientation === "vertical" ? "vertical" : "horizontal");
		const forwarded = useForwardPropsEmits(delegatedProps, emits);
		const normalizedValue = computed({
			get() {
				const val = modelValue.value;
				if (val === void 0 || val === null) return;
				return Array.isArray(val) ? val : [val];
			},
			set(next) {
				if (next === void 0) {
					modelValue.value = next;
					return;
				}
				if (typeof modelValue.value === "number" && next.length === 1) modelValue.value = next[0];
				else modelValue.value = next;
			}
		});
		const thumbValues = computed(() => {
			const val = normalizedValue.value;
			if (!val || val.length === 0) return [0];
			return val;
		});
		return (_ctx, _cache) => {
			return openBlock(), createBlock(unref(SliderRoot), mergeProps({
				modelValue: normalizedValue.value,
				"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => normalizedValue.value = $event)
			}, unref(forwarded), {
				orientation: orientation.value,
				class: unref(cn)(unref(sliderVariants)({
					size: __props.size,
					orientation: orientation.value
				}), props.class)
			}), {
				default: withCtx(() => [createVNode(unref(SliderTrack), { class: normalizeClass(unref(sliderTrackVariants)({ size: __props.size })) }, {
					default: withCtx(() => [createVNode(unref(SliderRange), { class: "absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full" })]),
					_: 1
				}, 8, ["class"]), (openBlock(true), createElementBlock(Fragment, null, renderList(thumbValues.value, (_, key) => {
					return openBlock(), createBlock(unref(SliderThumb), {
						key,
						class: normalizeClass(unref(sliderThumbVariants)({ size: __props.size }))
					}, null, 8, ["class"]);
				}), 128))]),
				_: 1
			}, 16, [
				"modelValue",
				"orientation",
				"class"
			]);
		};
	}
});
//#endregion
//#region src/components/ui/slider/index.ts
var sliderVariants = cva("relative flex touch-none select-none items-center data-[orientation=vertical]:flex-col", {
	variants: {
		size: {
			sm: "data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full",
			default: "data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full",
			lg: "data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full"
		},
		orientation: {
			horizontal: "w-full",
			vertical: "h-full flex-col w-fit"
		}
	},
	defaultVariants: {
		size: "default",
		orientation: "horizontal"
	}
});
var sliderTrackVariants = cva("relative grow overflow-hidden rounded-full bg-secondary", {
	variants: { size: {
		sm: "data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5",
		default: "data-[orientation=horizontal]:h-2 data-[orientation=vertical]:w-2",
		lg: "data-[orientation=horizontal]:h-3 data-[orientation=vertical]:w-3"
	} },
	defaultVariants: { size: "default" }
});
var sliderThumbVariants = cva("block rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", {
	variants: { size: {
		sm: "h-4 w-4",
		default: "h-5 w-5",
		lg: "h-6 w-6"
	} },
	defaultVariants: { size: "default" }
});
//#endregion
export { Slider_default as i, sliderTrackVariants as n, sliderVariants as r, sliderThumbVariants as t };

//# sourceMappingURL=slider-Csd3YX_k.js.map