"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),D=require("../../_util/classNames.js"),s=require("../../_util/vue-types/index.js"),E=require("../../vc-util/Dom/addEventListener.js"),O=t.defineComponent({compatConfig:{MODE:3},name:"Handle",inheritAttrs:!1,props:{prefixCls:String,vertical:{type:Boolean,default:void 0},offset:Number,disabled:{type:Boolean,default:void 0},min:Number,max:Number,value:Number,tabindex:s.default.oneOfType([s.default.number,s.default.string]),reverse:{type:Boolean,default:void 0},ariaLabel:String,ariaLabelledBy:String,ariaValueTextFormatter:Function,onMouseenter:{type:Function},onMouseleave:{type:Function},onMousedown:{type:Function}},setup(i,{attrs:u,emit:d,expose:y}){const n=t.shallowRef(!1),l=t.shallowRef(),x=()=>{document.activeElement===l.value&&(n.value=!0)},M=e=>{n.value=!1,d("blur",e)},h=()=>{n.value=!1},r=()=>{l.value?.focus()},g=()=>{l.value?.blur()},w=()=>{n.value=!0,r()},B=e=>{e.preventDefault(),r(),d("mousedown",e)};y({focus:r,blur:g,clickFocus:w,ref:l});let c=null;t.onMounted(()=>{c=E.default(document,"mouseup",x)}),t.onBeforeUnmount(()=>{c?.remove()});const F=t.computed(()=>{const{vertical:e,offset:o,reverse:a}=i;return e?{[a?"top":"bottom"]:`${o}%`,[a?"bottom":"top"]:"auto",transform:a?null:"translateY(+50%)"}:{[a?"right":"left"]:`${o}%`,[a?"left":"right"]:"auto",transform:`translateX(${a?"+":"-"}50%)`}});return()=>{const{prefixCls:e,disabled:o,min:a,max:N,value:f,tabindex:m,ariaLabel:S,ariaLabelledBy:L,ariaValueTextFormatter:v,onMouseenter:T,onMouseleave:V}=i,q=D.default(u.class,{[`${e}-handle-click-focused`]:n.value}),C={"aria-valuemin":a,"aria-valuemax":N,"aria-valuenow":f,"aria-disabled":!!o},$=[u.style,F.value];let b=m||0;(o||m===null)&&(b=null);let p;v&&(p=v(f));const k={...u,role:"slider",tabindex:b,...C,class:q,onBlur:M,onKeydown:h,onMousedown:B,onMouseenter:T,onMouseleave:V,ref:l,style:$};return t.createVNode("div",{...k,"aria-label":S,"aria-labelledby":L,"aria-valuetext":p},null)}}});exports.default=O;
