import{d as x,M as h,N as u,bT as S,o as b,n as v,w as V,a as k,cy as y,dC as C,b3 as F,s as w,t as _,dD as I}from"./index-lT0LPxUj.js";const U=x({__name:"RangeSlider",props:{inputLabel:{default:["lower","upper"],type:Array},modelValue:{default:[0,100],type:Array},step:{default:1,type:Number},unit:{default:"",type:String}},emits:["update:modelValue"],setup(c,{emit:m}){const l=c,s=m,e=h({lower:0,upper:1}),o=u({get:()=>[e.lower,e.upper],set:t=>{e.lower=t[0],e.upper=t[1],s("update:modelValue",[e.lower,e.upper])}}),p=u({get:()=>e.lower,set:t=>{e.lower=typeof t=="string"?parseFloat(t):t,s("update:modelValue",[e.lower,e.upper])}}),d=u({get:()=>e.upper,set:t=>{e.upper=typeof t=="string"?parseFloat(t):t,s("update:modelValue",[e.lower,e.upper])}});return S(()=>[l.modelValue],()=>{e.lower=l.modelValue[0],e.upper=l.modelValue[1]}),(t,a)=>(b(),v(C,{step:l.step,class:"py-2 range-slider align-center",color:"grey","hide-details":"",strict:"",style:{position:"relative"},"thumb-size":"16","track-size":"2",modelValue:o.value,"onUpdate:modelValue":a[2]||(a[2]=i=>o.value=i)},{prepend:V(()=>[k(y,{label:l.inputLabel[0],step:l.step,suffix:l.unit,density:"compact","hide-details":"",style:{width:"80px"},type:"number",modelValue:p.value,"onUpdate:modelValue":a[0]||(a[0]=i=>p.value=i),variant:"underlined"},null,8,["label","step","suffix","modelValue"])]),append:V(()=>[k(y,{label:l.inputLabel[1],step:l.step,suffix:l.unit,density:"compact","hide-details":"",style:{width:"80px"},type:"number",modelValue:d.value,"onUpdate:modelValue":a[1]||(a[1]=i=>d.value=i),variant:"underlined"},null,8,["label","step","suffix","modelValue"])]),_:1},8,["step","modelValue"]))}}),N={class:"unit"},z={class:"label"},B=x({__name:"TickSlider",props:{modelValue:{default:0},tickLabels:{default:()=>[""]},unit:{default:""}},emits:["update:modelValue"],setup(c,{emit:m}){const l=c,s=m,e=h({tickIdx:0,ticks:{}}),o=u({get:()=>e.tickIdx,set:n=>{e.tickIdx=n,s("update:modelValue",e.ticks[e.tickIdx])}}),p=u(()=>Object.keys(e.ticks).map(n=>JSON.parse(n))),d=u(()=>p.value.length-1),t=()=>{e.tickIdx<=0||(o.value-=1)},a=()=>{e.tickIdx>=p.value.length-1||(o.value+=1)},i=()=>{e.ticks={},l.tickLabels.forEach((n,r)=>{e.ticks[r]=n}),g()},g=()=>{e.tickIdx=0,l.tickLabels.forEach((n,r)=>{l.modelValue===n&&(e.tickIdx=r)})};return S(()=>[l.modelValue],g),F(i),(n,r)=>(b(),v(I,{max:d.value,min:0,ticks:p.value,"onClick:append":a,"onClick:prepend":t,"append-icon":"mdi:mdi-plus",class:"py-3 tick-slider",color:"grey","hide-details":"","prepend-icon":"mdi:mdi-minus","show-ticks":"always",step:"1",style:{position:"relative"},"thumb-size":"16","track-size":"2",modelValue:o.value,"onUpdate:modelValue":r[0]||(r[0]=f=>o.value=f)},{append:V(()=>[w("div",N,_(l.unit),1)]),"tick-label":V(({index:f})=>[w("div",z,_(e.ticks[f]),1)]),_:1},8,["max","ticks","modelValue"]))}}),D=x({__name:"ValueSlider",props:{id:{default:"",type:String},modelValue:{default:0,type:Number},step:{default:1,type:Number},unit:{default:"",type:String}},emits:["update:modelValue"],setup(c,{emit:m}){const l=m,s=c,e=()=>{d.value-=s.step},o=()=>{d.value+=s.step},p=()=>{const t=s.step.toString();return t.includes(".")?t.split(".")[1].length:0},d=u({get:()=>s.modelValue,set:t=>{const a=typeof t=="string"?parseFloat(t):t,i=parseFloat(a.toFixed(p()));l("update:modelValue",i)}});return(t,a)=>(b(),v(I,{step:s.step,"onClick:append":o,"onClick:prepend":e,"append-icon":"mdi:mdi-plus",class:"py-1 value-slider",color:"grey","hide-details":"auto","prepend-icon":"mdi:mdi-minus",style:{position:"relative"},"thumb-size":"16","track-size":"2",modelValue:d.value,"onUpdate:modelValue":a[1]||(a[1]=i=>d.value=i)},{append:V(()=>[k(y,{label:s.id,step:s.step,suffix:s.unit,density:"compact","hide-details":"",style:{width:"80px"},type:"number",modelValue:d.value,"onUpdate:modelValue":a[0]||(a[0]=i=>d.value=i),variant:"underlined"},null,8,["label","step","suffix","modelValue"])]),_:1},8,["step","modelValue"]))}});export{U as _,B as a,D as b};
