import{E as A,G as m,g as B,j as l,N as n,o as M,c as j,L as F,X as G,a as f,K as E,y as b,V as O}from"./entry.9e31e8a4.js";import{t as C}from"./tw-merge.27ca352e.js";import{h as U,u as D}from"./ui.config.7ae255de.js";import{u as I}from"./useFormGroup.38d9f2fe.js";import{_ as J}from"./_plugin-vue_export-helper.c27b6911.js";import"./index.87a09f8b.js";const o=A(m.ui.strategy,m.ui.range,U),K=B({inheritAttrs:!1,props:{modelValue:{type:Number,default:0},id:{type:String,default:null},name:{type:String,default:null},disabled:{type:Boolean,default:!1},min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},size:{type:String,default:()=>o.default.size,validator(e){return Object.keys(o.size).includes(e)}},color:{type:String,default:()=>o.default.color,validator(e){return m.ui.colors.includes(e)}},inputClass:{type:String,default:null},ui:{type:Object,default:void 0}},emits:["update:modelValue","change"],setup(e,{emit:s}){const{ui:a,attrs:p,attrsClass:c}=D("range",e.ui,o),{emitFormChange:v,formGroup:r}=I(e),i=l(()=>r?.error?.value?"red":e.color),t=l(()=>r?.size?.value??e.size),y=r?.labelFor,h=l({get(){return e.modelValue},set(u){s("update:modelValue",u)}}),k=u=>{s("change",u),v()},z=l(()=>C(n(a.value.wrapper,a.value.size[t.value]),c)),V=l(()=>C(n(a.value.base,a.value.background,a.value.rounded,a.value.ring.replaceAll("{color}",i.value),a.value.size[t.value]),e.inputClass)),S=l(()=>n(a.value.thumb.base,a.value.thumb.color.replaceAll("{color}",i.value),a.value.thumb.ring,a.value.thumb.background,a.value.thumb.size[t.value])),w=l(()=>n(a.value.track.base,a.value.track.background,a.value.track.rounded,a.value.track.size[t.value])),N=l(()=>n(a.value.progress.base,a.value.progress.rounded,a.value.progress.background.replaceAll("{color}",i.value),a.value.progress.size[t.value])),$=l(()=>{const{modelValue:u,min:d,max:g}=e;return{width:`${(Math.max(d,Math.min(u,g))-d)/(g-d)*100}%`}});return{ui:a,attrs:p,id:y,value:h,wrapperClass:z,inputClass:V,thumbClass:S,trackClass:w,progressClass:N,progressStyle:$,onChange:k}}}),L=["id","name","min","max","disabled","step"];function P(e,s,a,p,c,v){return M(),j("div",{class:b(e.wrapperClass)},[F(f("input",E({id:e.id,ref:"input","onUpdate:modelValue":s[0]||(s[0]=r=>e.value=r),name:e.name,min:e.min,max:e.max,disabled:e.disabled,step:e.step,type:"range",class:[e.inputClass,e.thumbClass,e.trackClass]},e.attrs,{onChange:s[1]||(s[1]=(...r)=>e.onChange&&e.onChange(...r))}),null,16,L),[[G,e.value,void 0,{number:!0}]]),f("span",{class:b(e.progressClass),style:O(e.progressStyle)},null,6)],2)}const Z=J(K,[["render",P]]);export{Z as default};
