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