import{defineComponent as $,ref as k,computed as z,createVNode as f}from"vue";import D from"../_util/classNames.mjs";import{withInstall as E,functionType as s,someType as a,booleanType as l,stringType as H,objectType as U}from"../_util/type.mjs";import W from"../config-provider/hooks/useConfigInject.mjs";import{useInjectFormItemContext as q}from"../form/FormItemContext.mjs";import G from"../vc-slider/src/Handle.mjs";import J from"../vc-slider/src/Range.mjs";import K from"../vc-slider/src/Slider.mjs";import L from"./SliderTooltip.mjs";import Q from"./style/index.mjs";const X=t=>typeof t=="number"?t.toString():"",Y=()=>({id:String,prefixCls:String,tooltipPrefixCls:String,range:a([Boolean,Object]),reverse:l(),min:Number,max:Number,step:a([Object,Number]),marks:U(),dots:l(),value:a([Array,Number]),defaultValue:a([Array,Number]),included:l(),disabled:l(),vertical:l(),tipFormatter:a([Function,Object],()=>X),tooltipOpen:l(),tooltipVisible:l(),tooltipPlacement:H(),getTooltipPopupContainer:s(),autofocus:l(),handleStyle:a([Array,Object]),trackStyle:a([Array,Object]),onChange:s(),onAfterChange:s(),onFocus:s(),onBlur:s(),"onUpdate:value":s()}),Z=$({compatConfig:{MODE:3},name:"ASlider",inheritAttrs:!1,props:Y(),slots:Object,setup(t,{attrs:d,slots:b,emit:g,expose:O}){const{prefixCls:n,rootPrefixCls:N,direction:v,getPopupContainer:F,configProvider:A}=W("slider",t),[h,V]=Q(n),P=q(),c=k(),y=k({}),T=(o,r)=>{y.value[o]=r},I=z(()=>t.tooltipPlacement?t.tooltipPlacement:t.vertical?v.value==="rtl"?"left":"right":"top"),B=()=>{c.value?.focus()},w=()=>{c.value?.blur()},x=o=>{g("update:value",o),g("change",o),P.onFieldChange()},S=o=>{g("blur",o)};O({focus:B,blur:w});const j=({tooltipPrefixCls:o,info:{value:r,dragging:C,index:e,...m}})=>{const{tipFormatter:i,tooltipOpen:u=t.tooltipVisible,getTooltipPopupContainer:p}=t,M=i?y.value[e]||C:!1,R=u||u===void 0&&M;return f(L,{prefixCls:o,title:i?i(r):"",open:R,placement:I.value,transitionName:`${N.value}-zoom-down`,key:e,overlayClassName:`${n.value}-tooltip`,getPopupContainer:p||F?.value},{default:()=>[f(G,{...m,value:r,onMouseenter:()=>T(e,!0),onMouseleave:()=>T(e,!1)},null)]})};return()=>{const{tooltipPrefixCls:o,range:r,id:C=P.id.value,...e}=t,m=A.getPrefixCls("tooltip",o),i=D(d.class,{[`${n.value}-rtl`]:v.value==="rtl"},V.value);v.value==="rtl"&&!e.vertical&&(e.reverse=!e.reverse);let u;return typeof r=="object"&&(u=r.draggableTrack),h(r?f(J,{...d,...e,step:e.step,draggableTrack:u,class:i,ref:c,handle:p=>j({tooltipPrefixCls:m,prefixCls:n.value,info:p}),prefixCls:n.value,onChange:x,onBlur:S},{mark:b.mark}):f(K,{...d,...e,id:C,step:e.step,class:i,ref:c,handle:p=>j({tooltipPrefixCls:m,prefixCls:n.value,info:p}),prefixCls:n.value,onChange:x,onBlur:S},{mark:b.mark}))}}}),ue=E(Z);export{ue as default,Y as sliderProps};
