import{m as $}from"./slider-B0ER1pJ5.js";import{u as B}from"./useFieldsExtraOptions-BAS3Fj_1.js";import{a as z,C as A,b as p,k as D,O as x,m as v,g as f,p as t,n as E,D as y,u as i,F as C,H as _,q as h,P as q,I as M}from"./convert-case-to-camel-case.utils-DDUpNI96.js";import"./widget-BUAABBRb.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./translationsStore-DBJu9sBR.js";const H={class:"slider-min-max"},I={class:"label"},L={class:"label"},R={class:"custom-ticks"},U={class:"custom-marks"},G=["onClick"],ee=z({__name:"Modern",props:{field:{},modelValue:{}},emits:["update:modelValue"],setup(S,{emit:F}){const n=S,{field:l}=A(n),{formatMinMax:g}=B(l),O=p(()=>l.value.jump?1:Number(l.value.step||1)),u=p(()=>Number(l.value.min)),m=p(()=>Number(l.value.max)),V=D(n.modelValue),k=p(()=>l.value.jump),r=F,P=e=>{r("update:modelValue",Array.isArray(e)?e:[e])},j=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<=m.value)}),N=e=>{k.value&&o.value.includes(e)&&r("update:modelValue",[V.value[0],e])},w=e=>({left:`${(e-u.value)/(m.value-u.value)*100}%`}),J=e=>{k.value&&o.value.includes(e)&&r("update:modelValue",[e,V.value[1]])};return x(()=>n.modelValue,e=>{V.value=e}),x(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)&&r("update:modelValue",b)}else JSON.stringify(e)!==JSON.stringify(n.modelValue)&&r("update:modelValue",e)}),(e,s)=>(f(),v("div",{class:M(["slider-wrapper ccb-modern-multi-range-field",{jump:i(l).jump}])},[t("div",H,[t("div",{class:"slider-min-max-item first",onClick:s[0]||(s[0]=a=>J(u.value))},[t("span",I,y(i(g)(u.value)),1)]),t("div",{class:"slider-min-max-item",onClick:s[1]||(s[1]=a=>N(m.value))},[t("span",L,y(i(g)(m.value)),1)])]),E(i($),{style:{margin:"10px 0"},format:j,min:i(l).min,max:i(l).max,step:O.value,disabled:i(l).disabled,modelValue:e.modelValue,"onUpdate:modelValue":P,"show-tooltip":"focus"},null,8,["min","max","step","disabled","modelValue"]),t("div",R,[(f(),v(C,null,_(25,a=>t("div",{key:a,class:"tick"})),64))]),t("div",U,[s[2]||(s[2]=t("div",{class:"stick-line"},[t("div",{class:"stick-line-item"})],-1)),i(l).scalePoints?(f(!0),v(C,{key:0},_(o.value,a=>(f(),v("div",{key:a,class:"mark",style:q(w(a))},[a!==u.value&&a!==m.value?(f(),v("div",{key:0,class:M(["label",{"label-passed":a<=e.modelValue[0]}]),onClick:b=>N(a)},y(a),11,G)):h("",!0)],4))),128)):h("",!0)])],2))}});export{ee as default};
//# sourceMappingURL=Modern-DHKd_Cnv.js.map
