import { n as __exportAll } from "./chunk-B-1-B7_t.js";
import { i as Slider_default } from "./slider-Csd3YX_k.js";
import { t as FieldFrame_default } from "./field-frame-DhCOWcMP.js";
import { computed, createBlock, createElementVNode, createVNode, defineComponent, mergeModels, openBlock, toDisplayString, unref, useModel, withCtx } from "vue";
//#region src/components/compositions/elements/input/RangeSliderInput.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "flex items-center gap-3" };
var _hoisted_2 = {
	class: "min-w-10 text-right text-sm text-muted-foreground tabular-nums",
	"data-testid": "range-slider-value"
};
var RangeSliderInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "RangeSliderInput",
	props: /* @__PURE__ */ mergeModels({
		modelValue: {},
		id: {},
		name: {},
		label: {},
		hideLabel: { type: Boolean },
		required: { type: Boolean },
		readonly: { type: Boolean },
		disabled: { type: Boolean },
		min: { default: 0 },
		max: { default: 100 },
		step: { default: 1 },
		helpText: {},
		errors: { default: () => [] }
	}, {
		"modelValue": {},
		"modelModifiers": {}
	}),
	emits: ["update:modelValue"],
	setup(__props) {
		/**
		* Props-driven range slider composition. Wraps the shadcn `Slider`
		* primitive (which always emits an array internally) and exposes a
		* scalar `modelValue` to the consumer.
		*
		* Self-contained — usable directly in any Vue app:
		*
		*   <RangeSliderInput v-model="volume" label="Volume" :min="0" :max="100" />
		*/
		const props = __props;
		const model = useModel(__props, "modelValue");
		const currentValue = computed(() => typeof model.value === "number" ? model.value : props.min);
		const sliderModel = computed(() => [currentValue.value]);
		function onUpdate(...args) {
			const next = args[0];
			if (Array.isArray(next)) {
				const first = next[0];
				model.value = typeof first === "number" ? first : props.min;
			} else if (typeof next === "number") model.value = next;
			else model.value = props.min;
		}
		return (_ctx, _cache) => {
			return openBlock(), createBlock(unref(FieldFrame_default), {
				label: __props.label,
				required: __props.required,
				"hide-label": __props.hideLabel,
				for: __props.id,
				"help-text": __props.helpText,
				errors: __props.errors
			}, {
				default: withCtx(() => [createElementVNode("div", _hoisted_1, [createVNode(unref(Slider_default), {
					id: __props.id,
					name: __props.name ?? void 0,
					min: __props.min,
					max: __props.max,
					step: __props.step,
					disabled: __props.disabled || __props.readonly,
					"model-value": sliderModel.value,
					"data-element-name": __props.name ?? void 0,
					class: "flex-1",
					"onUpdate:modelValue": onUpdate
				}, null, 8, [
					"id",
					"name",
					"min",
					"max",
					"step",
					"disabled",
					"model-value",
					"data-element-name"
				]), createElementVNode("span", _hoisted_2, toDisplayString(currentValue.value), 1)])]),
				_: 1
			}, 8, [
				"label",
				"required",
				"hide-label",
				"for",
				"help-text",
				"errors"
			]);
		};
	}
});
//#endregion
//#region src/components/compositions/elements/input/RangeSliderInput.vue
var RangeSliderInput_exports = /* @__PURE__ */ __exportAll({ default: () => RangeSliderInput_default });
var RangeSliderInput_default = RangeSliderInput_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { RangeSliderInput_exports as n, RangeSliderInput_default as t };

//# sourceMappingURL=RangeSliderInput-BjnajS0j.js.map