import{m as P}from"./vendor-vueform-slider-CCH9_7pb.js";import{u as J}from"./useFieldsExtraOptions-BNwbfzEK.js";import{d as $,e as p,w as h,f,i as V,x as o,j as B,t as C,F as z,r as A}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{t as E,r as D,u as t}from"./vendor-vue-reactivity-CheHbvBM.js";import{t as y,b as L,a as g}from"./vendor-vue-shared-DrzsEcag.js";import"./settingsStore-8bwiLMEn.js";import"./vendor-pinia-BSPefQhS.js";import"./convert-case-to-camel-case.utils-CK5dBN7n.js";const R={class:"slider-min-max"},U={class:"label"},q={class:"label"},G={class:"custom-marks"},H=["onClick"],ee=$({__name:"Small",props:{field:{},modelValue:{}},emits:["update:modelValue"],setup(S,{emit:M}){const m=S,{field:l}=E(m),_=p(()=>l.value.jump?1:Number(l.value.step||1)),u=p(()=>Number(l.value.min)),r=p(()=>Number(l.value.max)),v=D(m.modelValue),b=p(()=>l.value.jump),n=M,j=e=>{n("update:modelValue",Array.isArray(e)?e:[e])},{formatMinMax:N}=J(l),w=e=>{const s=e.toFixed(2);return parseFloat(s).toString()},i=p(()=>{var s;return(((s=l.value.scalePoints)==null?void 0:s.trim())||"").split(",").map(a=>Number(a.trim())).filter(a=>!isNaN(a)&&a>=u.value&&a<=r.value)}),F=e=>({left:`${(e-u.value)/(r.value-u.value)*100}%`}),x=e=>{l.value.disabled||b.value&&n("update:modelValue",[v.value[0],e])},O=e=>{b.value&&i.value.includes(e)&&n("update:modelValue",[e,v.value[1]])};return h(()=>m.modelValue,e=>{v.value=e}),h(v,e=>{if(b.value){const s=i.value.reduce((d,c)=>Math.abs(c-e[0])<Math.abs(d-e[0])?c:d,i.value[0]),a=i.value.reduce((d,c)=>Math.abs(c-e[1])<Math.abs(d-e[1])?c:d,i.value[0]),k=[s,a];JSON.stringify(k)!==JSON.stringify(m.modelValue)&&n("update:modelValue",k)}else JSON.stringify(e)!==JSON.stringify(m.modelValue)&&n("update:modelValue",e)}),(e,s)=>(V(),f("div",{class:g(["slider-wrapper ccb-small-multi-range-field",{jump:t(l).jump}])},[o("div",R,[o("div",{class:"slider-min-max-item first",onClick:s[0]||(s[0]=a=>O(u.value))},[o("span",U,y(t(N)(u.value)),1)]),o("div",{class:"slider-min-max-item",onClick:s[1]||(s[1]=a=>x(r.value))},[o("span",q,y(t(N)(r.value)),1)])]),B(t(P),{style:{margin:"10px 0"},format:w,min:t(l).min,max:t(l).max,step:_.value,disabled:t(l).disabled,modelValue:e.modelValue,"onUpdate:modelValue":j,"show-tooltip":"focus"},null,8,["min","max","step","disabled","modelValue"]),o("div",G,[t(l).scalePoints?(V(!0),f(z,{key:0},A(i.value,a=>(V(),f("div",{key:a,class:"mark",style:L(F(a))},[o("div",{class:g(["tick",{"tick-passed":a>=e.modelValue[0]&&a<=e.modelValue[1]}])},null,2),a!==u.value&&a!==r.value?(V(),f("div",{key:0,class:g(["label",{"label-passed":a<=e.modelValue[0]}]),onClick:k=>x(a)},y(a),11,H)):C("",!0)],4))),128)):C("",!0)])],2))}});export{ee as default};
//# sourceMappingURL=Small-m8t2psX9.js.map
