(function(u,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(u=typeof globalThis<"u"?globalThis:u||self,i(u.VueSliderRange={},u.Vue))})(this,function(u,i){"use strict";var K=Object.defineProperty;var X=(u,i,f)=>i in u?K(u,i,{enumerable:!0,configurable:!0,writable:!0,value:f}):u[i]=f;var d=(u,i,f)=>(X(u,typeof i!="symbol"?i+"":i,f),f);var f=document.createElement("style");f.textContent=`.vue-slider-dot{position:absolute;transition:all 0s;z-index:5}.vue-slider-dot:focus{outline:none}.vue-slider-dot-tooltip{position:absolute;visibility:hidden}.vue-slider-dot-hover:hover .vue-slider-dot-tooltip,.vue-slider-dot-tooltip-show{visibility:visible}.vue-slider-dot-tooltip-top{top:-10px;left:50%;transform:translate(-50%,-100%)}.vue-slider-dot-tooltip-bottom{bottom:-10px;left:50%;transform:translate(-50%,100%)}.vue-slider-dot-tooltip-left{left:-10px;top:50%;transform:translate(-100%,-50%)}.vue-slider-dot-tooltip-right{right:-10px;top:50%;transform:translate(100%,-50%)}.vue-slider-marks{position:relative;width:100%;height:100%}.vue-slider-mark{position:absolute;z-index:1}.vue-slider-ltr .vue-slider-mark,.vue-slider-rtl .vue-slider-mark{width:0;height:100%;top:50%}.vue-slider-ltr .vue-slider-mark-step,.vue-slider-rtl .vue-slider-mark-step{top:0}.vue-slider-ltr .vue-slider-mark-label,.vue-slider-rtl .vue-slider-mark-label{top:100%;margin-top:10px}.vue-slider-ltr .vue-slider-mark{transform:translate(-50%,-50%)}.vue-slider-ltr .vue-slider-mark-step{left:0}.vue-slider-ltr .vue-slider-mark-label{left:50%;transform:translate(-50%)}.vue-slider-rtl .vue-slider-mark{transform:translate(50%,-50%)}.vue-slider-rtl .vue-slider-mark-step{right:0}.vue-slider-rtl .vue-slider-mark-label{right:50%;transform:translate(50%)}.vue-slider-ttb .vue-slider-mark,.vue-slider-btt .vue-slider-mark{width:100%;height:0;left:50%}.vue-slider-ttb .vue-slider-mark-step,.vue-slider-btt .vue-slider-mark-step{left:0}.vue-slider-ttb .vue-slider-mark-label,.vue-slider-btt .vue-slider-mark-label{left:100%;margin-left:10px}.vue-slider-btt .vue-slider-mark{transform:translate(-50%,50%)}.vue-slider-btt .vue-slider-mark-step{top:0}.vue-slider-btt .vue-slider-mark-label{top:50%;transform:translateY(-50%)}.vue-slider-ttb .vue-slider-mark{transform:translate(-50%,-50%)}.vue-slider-ttb .vue-slider-mark-step{bottom:0}.vue-slider-ttb .vue-slider-mark-label{bottom:50%;transform:translateY(50%)}.vue-slider-mark-step,.vue-slider-mark-label{position:absolute}.vue-slider{position:relative;box-sizing:content-box;-webkit-user-select:none;-moz-user-select:none;user-select:none;display:block;-webkit-tap-highlight-color:rgba(0,0,0,0)}.vue-slider-rail{position:relative;width:100%;height:100%;transition-property:width,height,left,right,top,bottom}.vue-slider-process{position:absolute;z-index:1} `,document.head.appendChild(f);const w=i.defineComponent({name:"VueSliderDot",emits:["drag-start"],props:{value:{type:[String,Number],default:0},tooltip:{type:String,required:!0},tooltipPlacement:{type:String,validator:e=>["top","right","bottom","left"].indexOf(e)>-1,required:!0},tooltipFormatter:{type:[String,Function]},focus:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},dotStyle:{type:Object},tooltipStyle:{type:Object}},computed:{dotClasses(){return["vue-slider-dot",{"vue-slider-dot-hover":this.tooltip==="hover"||this.tooltip==="active","vue-slider-dot-disabled":this.disabled,"vue-slider-dot-focus":this.focus}]},handleClasses(){return["vue-slider-dot-handle",{"vue-slider-dot-handle-disabled":this.disabled,"vue-slider-dot-handle-focus":this.focus}]},tooltipClasses(){return["vue-slider-dot-tooltip",[`vue-slider-dot-tooltip-${this.tooltipPlacement}`],{"vue-slider-dot-tooltip-show":this.showTooltip}]},tooltipInnerClasses(){return["vue-slider-dot-tooltip-inner",[`vue-slider-dot-tooltip-inner-${this.tooltipPlacement}`],{"vue-slider-dot-tooltip-inner-disabled":this.disabled,"vue-slider-dot-tooltip-inner-focus":this.focus}]},showTooltip(){switch(this.tooltip){case"always":return!0;case"none":return!1;case"focus":case"active":return!!this.focus;default:return!1}},tooltipValue(){return this.tooltipFormatter?typeof this.tooltipFormatter=="string"?this.tooltipFormatter.replace(/\{value\}/,String(this.value)):this.tooltipFormatter(this.value):this.value}},methods:{dragStart(){if(this.disabled)return!1;this.$emit("drag-start")}}}),S=(e,t)=>{const s=e.__vccOpts||e;for(const[r,o]of t)s[r]=o;return s},C=["aria-valuetext"],E={class:"vue-slider-dot-tooltip-text"};function O(e,t,s,r,o,n){var l;return i.openBlock(),i.createElementBlock("div",{ref:"dot",class:i.normalizeClass(e.dotClasses),"aria-valuetext":(l=e.tooltipValue)==null?void 0:l.toString(),onMousedownPassive:t[0]||(t[0]=(...p)=>e.dragStart&&e.dragStart(...p)),onTouchstartPassive:t[1]||(t[1]=(...p)=>e.dragStart&&e.dragStart(...p))},[i.renderSlot(e.$slots,"dot",{},()=>[i.createElementVNode("div",{class:i.normalizeClass(e.handleClasses),style:i.normalizeStyle(e.dotStyle)},null,6)]),e.tooltip!=="none"?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(e.tooltipClasses)},[i.renderSlot(e.$slots,"tooltip",{},()=>[i.createElementVNode("div",{class:i.normalizeClass(e.tooltipInnerClasses),style:i.normalizeStyle(e.tooltipStyle)},[i.createElementVNode("span",E,i.toDisplayString(e.tooltipValue),1)],6)])],2)):i.createCommentVNode("",!0)],42,C)}const D=S(w,[["render",O]]),z=i.defineComponent({name:"VueSliderMark",emits:["press-label"],props:{mark:{type:Object,required:!0},hideLabel:{type:Boolean},stepStyle:{type:Object,default:()=>({})},stepActiveStyle:{type:Object,default:()=>({})},labelStyle:{type:Object,default:()=>({})},labelActiveStyle:{type:Object,default:()=>({})}},computed:{marksClasses(){return["vue-slider-mark",{"vue-slider-mark-active":this.mark.active}]},stepClasses(){return["vue-slider-mark-step",{"vue-slider-mark-step-active":this.mark.active}]},labelClasses(){return["vue-slider-mark-label",{"vue-slider-mark-label-active":this.mark.active}]}},methods:{labelClickHandle(e){e.stopPropagation(),this.$emit("press-label",this.mark.pos)}}});function L(e,t,s,r,o,n){return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(e.marksClasses)},[i.renderSlot(e.$slots,"step",{},()=>[i.createElementVNode("div",{class:i.normalizeClass(e.stepClasses),style:i.normalizeStyle([e.stepStyle,e.mark.style||{},e.mark.active&&e.stepActiveStyle?e.stepActiveStyle:{},e.mark.active&&e.mark.activeStyle?e.mark.activeStyle:{}])},null,6)]),e.hideLabel?i.createCommentVNode("",!0):i.renderSlot(e.$slots,"label",{key:0},()=>[i.createElementVNode("div",{class:i.normalizeClass(e.labelClasses),style:i.normalizeStyle([e.labelStyle,e.mark.labelStyle||{},e.mark.active&&e.labelActiveStyle?e.labelActiveStyle:{},e.mark.active&&e.mark.labelActiveStyle?e.mark.labelActiveStyle:{}]),onClick:t[0]||(t[0]=(...l)=>e.labelClickHandle&&e.labelClickHandle(...l))},i.toDisplayString(e.mark.label),7)])],2)}const V=S(z,[["render",L]]),b=e=>typeof e=="number"?`${e}px`:e,I=e=>{const t=document.documentElement,s=document.body,r=e.getBoundingClientRect();return{y:r.top+(window.pageYOffset||t.scrollTop)-(t.clientTop||s.clientTop||0),x:r.left+(window.pageXOffset||t.scrollLeft)-(t.clientLeft||s.clientLeft||0)}},x=(e,t,s,r=1)=>{const o="targetTouches"in e?e.targetTouches[0]:e,n=I(t),l={x:o.pageX-n.x,y:o.pageY-n.y};return{x:s?t.offsetWidth*r-l.x:l.x,y:s?t.offsetHeight*r-l.y:l.y}},M=(e,t)=>{if(t.hook){const s=t.hook(e);if(typeof s=="function")return s;if(!s)return null}switch(e.keyCode){case 38:return s=>t.direction==="ttb"?s-1:s+1;case 39:return s=>t.direction==="rtl"?s-1:s+1;case 40:return s=>t.direction==="ttb"?s+1:s-1;case 37:return s=>t.direction==="rtl"?s+1:s-1;case 35:return()=>t.max;case 36:return()=>t.min;case 33:return s=>s+10;case 34:return s=>s-10;default:return null}};class m{constructor(t){d(this,"num");this.num=t}decimal(t,s){const r=this.num,o=this.getDecimalLen(r),n=this.getDecimalLen(t);let l=0;switch(s){case"+":l=this.getExponent(o,n),this.num=(this.safeRoundUp(r,l)+this.safeRoundUp(t,l))/l;break;case"-":l=this.getExponent(o,n),this.num=(this.safeRoundUp(r,l)-this.safeRoundUp(t,l))/l;break;case"*":this.num=this.safeRoundUp(this.safeRoundUp(r,this.getExponent(o)),this.safeRoundUp(t,this.getExponent(n)))/this.getExponent(o+n);break;case"/":l=this.getExponent(o,n),this.num=this.safeRoundUp(r,l)/this.safeRoundUp(t,l);break;case"%":l=this.getExponent(o,n),this.num=this.safeRoundUp(r,l)%this.safeRoundUp(t,l)/l;break}return this}plus(t){return this.decimal(t,"+")}minus(t){return this.decimal(t,"-")}multiply(t){return this.decimal(t,"*")}divide(t){return this.decimal(t,"/")}remainder(t){return this.decimal(t,"%")}toNumber(){return this.num}getDecimalLen(t){const s=`${t}`.split("e");return(`${s[0]}`.split(".")[1]||"").length-(s[1]?+s[1]:0)}getExponent(t,s){return Math.pow(10,s!==void 0?Math.max(t,s):t)}safeRoundUp(t,s){return Math.round(t*s)}}var A=(e=>(e[e.VALUE=1]="VALUE",e[e.INTERVAL=2]="INTERVAL",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX",e[e.ORDER=5]="ORDER",e))(A||{});const N={1:'The type of the "value" is illegal',2:'The prop "interval" is invalid, "(max - min)" must be divisible by "interval"',3:'The "value" must be greater than or equal to the "min".',4:'The "value" must be less than or equal to the "max".',5:'When "order" is false, the parameters "minRange", "maxRange", "fixed", "enabled" are invalid.'};class F{constructor(t){d(this,"dotsPos",[]);d(this,"dotsValue",[]);d(this,"data");d(this,"enableCross");d(this,"fixed");d(this,"max");d(this,"min");d(this,"interval");d(this,"minRange");d(this,"maxRange");d(this,"order");d(this,"marks");d(this,"included");d(this,"process");d(this,"adsorb");d(this,"dotOptions");d(this,"onError");d(this,"cacheRangeDir",{});this.data=t.data,this.max=t.max,this.min=t.min,this.interval=t.interval,this.order=t.order,this.marks=t.marks,this.included=t.included,this.process=t.process,this.adsorb=t.adsorb,this.dotOptions=t.dotOptions,this.onError=t.onError,this.order?(this.minRange=t.minRange||0,this.maxRange=t.maxRange||0,this.enableCross=t.enableCross,this.fixed=t.fixed):((t.minRange||t.maxRange||!t.enableCross||t.fixed)&&this.emitError(5),this.minRange=0,this.maxRange=0,this.enableCross=!0,this.fixed=!1),this.setValue(t.value)}setValue(t){this.setDotsValue(Array.isArray(t)?[...t]:[t],!0)}setDotsValue(t,s){this.dotsValue=t,s&&this.syncDotsPos()}setDotsPos(t){const s=this.order?[...t].sort((r,o)=>r-o):t;this.dotsPos=s,this.setDotsValue(s.map(r=>this.getValueByPos(r)),this.adsorb)}getValueByPos(t){let s=this.parsePos(t);if(this.included){let r=100;this.markList.forEach(o=>{const n=Math.abs(o.pos-t);nthis.parseValue(t))}get markList(){if(!this.marks)return[];const t=(s,r)=>{const o=this.parseValue(s);return{pos:o,value:s,label:s,active:this.isActiveByPos(o),...r}};return this.marks===!0?this.getValues().map(s=>t(s)):Object.prototype.toString.call(this.marks)==="[object Object]"?Object.keys(this.marks).sort((s,r)=>+s-+r).map(s=>{const r=this.marks[s];return t(s,typeof r!="string"?r:{label:r})}):Array.isArray(this.marks)?this.marks.map(s=>t(s)):typeof this.marks=="function"?this.getValues().map(s=>({value:s,result:this.marks(s)})).filter(({result:s})=>!!s).map(({value:s,result:r})=>t(s,r)):[]}getRecentDot(t){const s=this.dotsPos.map(r=>Math.abs(r-t));return s.indexOf(Math.min(...s))}getIndexByValue(t){return this.data?this.data.indexOf(t):new m(+t).minus(this.min).divide(this.interval).toNumber()}getValueByIndex(t){return t<0?t=0:t>this.total&&(t=this.total),this.data?this.data[t]:new m(t).multiply(this.interval).plus(this.min).toNumber()}setDotPos(t,s){t=this.getValidPos(t,s).pos;const r=t-this.dotsPos[s];if(!r)return;let o=new Array(this.dotsPos.length);this.fixed?o=this.getFixedChangePosArr(r,s):this.minRange||this.maxRange?o=this.getLimitRangeChangePosArr(t,r,s):o[s]=r,this.setDotsPos(this.dotsPos.map((n,l)=>n+(o[l]||0)))}getFixedChangePosArr(t,s){return this.dotsPos.forEach((r,o)=>{if(o!==s){const{pos:n,inRange:l}=this.getValidPos(r+t,o);l||(t=Math.min(Math.abs(n-r),Math.abs(t))*(t<0?-1:1))}}),this.dotsPos.map(r=>t)}getLimitRangeChangePosArr(t,s,r){const o=[{index:r,changePos:s}],n=s;return[this.minRange,this.maxRange].forEach((l,p)=>{if(!l)return!1;const a=p===0,c=s>0;let y=0;a?y=c?1:-1:y=c?-1:1;const W=(k,q)=>{const B=Math.abs(k-q);return a?Bthis.maxRangeDir};let g=r+y,v=this.dotsPos[g],$=t;for(;this.isPos(v)&&W(v,$);){const{pos:k}=this.getValidPos(v+n,g);o.push({index:g,changePos:k-v}),g=g+y,$=k,v=this.dotsPos[g]}}),this.dotsPos.map((l,p)=>{const a=o.filter(c=>c.index===p);return a.length?a[0].changePos:0})}isPos(t){return typeof t=="number"}getValidPos(t,s){const r=this.valuePosRange[s];let o=!0;return tr[1]&&(t=r[1],o=!1),{pos:t,inRange:o}}parseValue(t){if(this.data)t=this.data.indexOf(t);else if(typeof t=="number"||typeof t=="string"){if(t=+t,tthis.max)return this.emitError(4),0;if(typeof t!="number"||t!==t)return this.emitError(1),0;t=new m(t).minus(this.min).divide(this.interval).toNumber()}const s=new m(t).multiply(this.gap).toNumber();return s<0?0:s>100?100:s}parsePos(t){const s=Math.round(t/this.gap);return this.getValueByIndex(s)}isActiveByPos(t){return this.processArray.some(([s,r])=>t>=s&&t<=r)}getValues(){if(this.data)return this.data;{const t=[];for(let s=0;s<=this.total;s++)t.push(new m(s).multiply(this.interval).plus(this.min).toNumber());return t}}getRangeDir(t){return t?new m(t).divide(new m(this.data?this.data.length-1:this.max).minus(this.data?0:this.min).toNumber()).multiply(100).toNumber():100}emitError(t){this.onError&&this.onError(t,N[t])}get processArray(){if(this.process){if(typeof this.process=="function")return this.process(this.dotsPos);if(this.dotsPos.length===1)return[[0,this.dotsPos[0]]];if(this.dotsPos.length>1)return[[Math.min(...this.dotsPos),Math.max(...this.dotsPos)]]}return[]}get total(){let t=0;return this.data?t=this.data.length-1:t=new m(this.max).minus(this.min).divide(this.interval).toNumber(),t-Math.floor(t)!==0?(this.emitError(2),0):t}get gap(){return 100/this.total}get minRangeDir(){return this.cacheRangeDir[this.minRange]?this.cacheRangeDir[this.minRange]:this.cacheRangeDir[this.minRange]=this.getRangeDir(this.minRange)}get maxRangeDir(){return this.cacheRangeDir[this.maxRange]?this.cacheRangeDir[this.maxRange]:this.cacheRangeDir[this.maxRange]=this.getRangeDir(this.maxRange)}getDotRange(t,s,r){if(!this.dotOptions)return r;const o=Array.isArray(this.dotOptions)?this.dotOptions[t]:this.dotOptions;return o&&o[s]!==void 0?this.parseValue(o[s]):r}get valuePosRange(){const t=this.dotsPos,s=[];return t.forEach((r,o)=>{s.push([Math.max(this.minRange?this.minRangeDir*o:0,this.enableCross?0:t[o-1]||0,this.getDotRange(o,"min",0)),Math.min(this.minRange?100-this.minRangeDir*(t.length-1-o):100,this.enableCross?100:t[o+1]||100,this.getDotRange(o,"max",100))])}),s}get dotsIndex(){return this.dotsValue.map(t=>this.getIndexByValue(t))}}class j{constructor(t){d(this,"map");d(this,"states",0);this.map=t}add(t){this.states|=t}delete(t){this.states&=~t}toggle(t){this.has(t)?this.delete(t):this.add(t)}has(t){return!!(this.states&t)}}const h={None:0,Drag:2,Focus:4},P=4,H=i.defineComponent({name:"VueSlider",components:{VueSliderDot:D,VueSliderMark:V},emits:["change","drag-start","dragging","drag-end","error","update:modelValue"],data(){return{control:null,states:new j(h),scale:1,focusDotIndex:0}},props:{modelValue:{type:[Number,String,Array],default:0},silent:{type:Boolean,default:!1},direction:{type:String,default:"ltr",validator:e=>["ltr","rtl","ttb","btt"].indexOf(e)>-1},width:{type:[Number,String]},height:{type:[Number,String]},dotSize:{type:[Number,Array],default:14},contained:{type:Boolean,default:!1},min:{type:Number,default:0},max:{type:Number,default:100},interval:{type:Number,default:1},disabled:{type:Boolean,default:!1},clickable:{type:Boolean,default:!0},dragOnClick:{type:Boolean,default:!1},duration:{type:Number,default:.5},data:{type:[Object,Array]},dataValue:{type:String,default:"value"},dataLabel:{type:String,default:"label"},lazy:{type:Boolean,default:!1},tooltip:{type:String,default:"active",validator:e=>["none","always","focus","hover","active"].indexOf(e)>-1},tooltipPlacement:{type:[String,Array],validator:e=>(Array.isArray(e)?e:[e]).every(t=>["top","right","bottom","left"].indexOf(t)>-1)},tooltipFormatter:{type:[String,Array,Function]},useKeyboard:{type:Boolean,default:!0},keydownHook:{type:Function},enableCross:{type:Boolean,default:!0},fixed:{type:Boolean,default:!1},order:{type:Boolean,default:!0},minRange:{type:Number},maxRange:{type:Number},marks:{type:[Boolean,Object,Array,Function],default:!1},process:{type:[Boolean,Function],default:!0},zoom:{type:Number},included:{type:Boolean},adsorb:{type:Boolean},hideLabel:{type:Boolean},dotOptions:{type:[Object,Array]},dotAttrs:{type:Object},railStyle:{type:Object},processStyle:{type:Object},dotStyle:{type:Object},tooltipStyle:{type:Object},stepStyle:{type:Object},stepActiveStyle:{type:Object},labelStyle:{type:Object},labelActiveStyle:{type:Object}},computed:{isHorizontal(){return this.direction==="ltr"||this.direction==="rtl"},isReverse(){return this.direction==="rtl"||this.direction==="btt"},tailSize(){return b((this.isHorizontal?this.height:this.width)||P)},containerClasses(){return["vue-slider",[`vue-slider-${this.direction}`],{"vue-slider-disabled":this.disabled}]},containerStyles(){const[e,t]=Array.isArray(this.dotSize)?this.dotSize:[this.dotSize,this.dotSize],s=this.width?b(this.width):this.isHorizontal?"auto":b(P),r=this.height?b(this.height):this.isHorizontal?b(P):"auto";return{padding:this.contained?`${t/2}px ${e/2}px`:this.isHorizontal?`${t/2}px 0`:`0 ${e/2}px`,width:s,height:r}},processArray(){return this.control.processArray.map(([e,t,s],r)=>{e>t&&([e,t]=[t,e]);const o=this.isHorizontal?"width":"height";return{start:e,end:t,index:r,style:{[this.isHorizontal?"height":"width"]:"100%",[this.isHorizontal?"top":"left"]:0,[this.mainDirection]:`${e}%`,[o]:`${t-e}%`,transitionProperty:`${o},${this.mainDirection}`,transitionDuration:`${this.animateTime}s`,...this.processStyle,...s}}})},dotBaseStyle(){const[e,t]=Array.isArray(this.dotSize)?this.dotSize:[this.dotSize,this.dotSize];let s;return this.isHorizontal?s={transform:`translate(${this.isReverse?"50%":"-50%"}, -50%)`,WebkitTransform:`translate(${this.isReverse?"50%":"-50%"}, -50%)`,top:"50%",[this.direction==="ltr"?"left":"right"]:"0"}:s={transform:`translate(-50%, ${this.isReverse?"50%":"-50%"})`,WebkitTransform:`translate(-50%, ${this.isReverse?"50%":"-50%"})`,left:"50%",[this.direction==="btt"?"bottom":"top"]:"0"},{width:`${e}px`,height:`${t}px`,...s}},mainDirection(){switch(this.direction){case"ltr":return"left";case"rtl":return"right";case"btt":return"bottom";case"ttb":return"top";default:return"left"}},tooltipDirections(){const e=this.tooltipPlacement||(this.isHorizontal?"top":"left");return Array.isArray(e)?e:this.dots.map(()=>e)},dots(){return this.control.dotsPos.map((e,t)=>({pos:e,index:t,value:this.control.dotsValue[t],focus:this.states.has(h.Focus)&&this.focusDotIndex===t,disabled:this.disabled,style:this.dotStyle,...(Array.isArray(this.dotOptions)?this.dotOptions[t]:this.dotOptions)||{}}))},animateTime(){return this.states.has(h.Drag)?0:this.duration},canSort(){return this.order&&!this.minRange&&!this.maxRange&&!this.fixed&&this.enableCross},sliderData(){return this.isObjectArrayData(this.data)?this.data.map(e=>e[this.dataValue]):this.isObjectData(this.data)?Object.keys(this.data):this.data},sliderMarks(){return this.marks?this.marks:this.isObjectArrayData(this.data)?e=>{const t={label:e};return this.data.some(s=>s[this.dataValue]===e?(t.label=s[this.dataLabel],!0):!1),t}:this.isObjectData(this.data)?this.data:void 0},sliderTooltipFormatter(){if(this.tooltipFormatter)return this.tooltipFormatter;if(this.isObjectArrayData(this.data))return e=>{let t=""+e;return this.data.some(s=>s[this.dataValue]===e?(t=s[this.dataLabel],!0):!1),t};if(this.isObjectData(this.data)){const e=this.data;return t=>e[t]}else return},isNotSync(){const e=this.control.dotsValue;return Array.isArray(this.modelValue)?this.modelValue.length!==e.length||this.modelValue.some((t,s)=>t!==e[s]):this.modelValue!==e[0]},dragRange(){const e=this.dots[this.focusDotIndex-1],t=this.dots[this.focusDotIndex+1];return[e?e.pos:-1/0,t?t.pos:1/0]}},watch:{modelValue(){this.control&&!this.states.has(h.Drag)&&this.isNotSync&&this.control.setValue(this.modelValue)}},methods:{isObjectData(e){return!!e&&Object.prototype.toString.call(e)==="[object Object]"},isObjectArrayData(e){return!!e&&Array.isArray(e)&&e.length>0&&typeof e[0]=="object"},bindEvent(){document.addEventListener("touchmove",this.dragMove,{passive:!1}),document.addEventListener("touchend",this.dragEnd,{passive:!1}),document.addEventListener("mousedown",this.blurHandle),document.addEventListener("mousemove",this.dragMove),document.addEventListener("mouseup",this.dragEnd),document.addEventListener("mouseleave",this.dragEnd),document.addEventListener("keydown",this.keydownHandle)},unbindEvent(){document.removeEventListener("touchmove",this.dragMove),document.removeEventListener("touchend",this.dragEnd),document.removeEventListener("mousedown",this.blurHandle),document.removeEventListener("mousemove",this.dragMove),document.removeEventListener("mouseup",this.dragEnd),document.removeEventListener("mouseleave",this.dragEnd),document.removeEventListener("keydown",this.keydownHandle)},setScale(){this.scale=new m(Math.floor(this.isHorizontal?this.$el.offsetWidth:this.$el.offsetHeight)).multiply(this.zoom||1).divide(100).toNumber()},initControl(){this.control=new F({value:this.modelValue,data:this.sliderData,enableCross:this.enableCross,fixed:this.fixed,max:this.max,min:this.min,interval:this.interval,minRange:this.minRange,maxRange:this.maxRange,order:this.order,marks:this.sliderMarks,included:this.included,process:this.process,adsorb:this.adsorb,dotOptions:this.dotOptions,onError:this.emitError}),["data","enableCross","fixed","max","min","interval","minRange","maxRange","order","marks","process","adsorb","included","dotOptions"].forEach(e=>{this.$watch(e,t=>{if(e==="data"&&Array.isArray(this.control.data)&&Array.isArray(t)&&this.control.data.length===t.length&&t.every((s,r)=>s===this.control.data[r]))return!1;switch(e){case"data":case"dataLabel":case"dataValue":this.control.data=this.sliderData;break;case"mark":this.control.marks=this.sliderMarks;break;default:this.control[e]=t}["data","max","min","interval"].indexOf(e)>-1&&this.control.syncDotsPos()})})},syncValueByPos(){const e=this.control.dotsValue;if(this.isDiff(e,Array.isArray(this.modelValue)?this.modelValue:[this.modelValue])){const t=e.length===1?e[0]:[...e];this.$emit("change",t,this.focusDotIndex),this.$emit("update:modelValue",t)}},isDiff(e,t){return e.length!==t.length||e.some((s,r)=>s!==t[r])},emitError(e,t){this.silent||console.error(`[VueSlider error]: ${t}`),this.$emit("error",e,t)},dragStartOnProcess(e){if(this.dragOnClick){this.setScale();const t=this.getPosByEvent(e),s=this.control.getRecentDot(t);if(this.dots[s].disabled)return;this.dragStart(s),this.control.setDotPos(t,this.focusDotIndex),this.lazy||this.syncValueByPos()}},dragStart(e){this.focusDotIndex=e,this.setScale(),this.states.add(h.Drag),this.states.add(h.Focus),this.$emit("drag-start",this.focusDotIndex)},dragMove(e){if(!this.states.has(h.Drag))return!1;e.preventDefault();const t=this.getPosByEvent(e);this.isCrossDot(t),this.control.setDotPos(t,this.focusDotIndex),this.lazy||this.syncValueByPos();const s=this.control.dotsValue;this.$emit("dragging",s.length===1?s[0]:[...s],this.focusDotIndex)},isCrossDot(e){if(this.canSort){const t=this.focusDotIndex;let s=e;if(s>this.dragRange[1]?(s=this.dragRange[1],this.focusDotIndex++):s{this.lazy&&this.syncValueByPos(),this.included&&this.isNotSync?this.control.setValue(this.modelValue):this.control.syncDotsPos(),this.states.delete(h.Drag),(!this.useKeyboard||"targetTouches"in e)&&this.states.delete(h.Focus),this.$emit("drag-end",this.focusDotIndex)})},blurHandle(e){if(!this.states.has(h.Focus)||!this.$refs.container||this.$refs.container.contains(e.target))return!1;this.states.delete(h.Focus)},clickHandle(e){if(!this.clickable||this.disabled)return!1;if(this.states.has(h.Drag))return;this.setScale();const t=this.getPosByEvent(e);this.setValueByPos(t)},focus(e,t=0){e.disabled||(this.states.add(h.Focus),this.focusDotIndex=t)},blur(){this.states.delete(h.Focus)},getValue(){const e=this.control.dotsValue;return e.length===1?e[0]:e},getIndex(){const e=this.control.dotsIndex;return e.length===1?e[0]:e},setValue(e){this.control.setValue(Array.isArray(e)?[...e]:[e]),this.syncValueByPos()},setIndex(e){const t=Array.isArray(e)?e.map(s=>this.control.getValueByIndex(s)):this.control.getValueByIndex(e);this.setValue(t)},setValueByPos(e){const t=this.control.getRecentDot(e);if(this.disabled||this.dots[t].disabled)return!1;this.focusDotIndex=t,this.control.setDotPos(e,t),this.syncValueByPos(),this.useKeyboard&&this.states.add(h.Focus),setTimeout(()=>{this.included&&this.isNotSync?this.control.setValue(this.modelValue):this.control.syncDotsPos()})},keydownHandle(e){if(!this.useKeyboard||!this.states.has(h.Focus))return!1;const t=this.included&&this.marks,s=M(e,{direction:this.direction,max:t?this.control.markList.length-1:this.control.total,min:0,hook:this.keydownHook});if(s){e.preventDefault();let r=-1,o=0;t?(this.control.markList.some((n,l)=>n.value===this.control.dotsValue[this.focusDotIndex]?(r=s(l),!0):!1),r<0?r=0:r>this.control.markList.length-1&&(r=this.control.markList.length-1),o=this.control.markList[r].pos):(r=s(this.control.getIndexByValue(this.control.dotsValue[this.focusDotIndex])),o=this.control.parseValue(this.control.getValueByIndex(r))),this.isCrossDot(o),this.control.setDotPos(o,this.focusDotIndex),this.syncValueByPos()}},getPosByEvent(e){return x(e,this.$el,this.isReverse,this.zoom)[this.isHorizontal?"x":"y"]/this.scale},renderSlot(e,t,s){const r=this.$slots[e];return r?r(t):s}},created(){this.initControl()},mounted(){this.bindEvent()},beforeUnmount(){this.unbindEvent()}}),T={key:0,class:"vue-slider-marks"};function U(e,t,s,r,o,n){const l=i.resolveComponent("vue-slider-mark"),p=i.resolveComponent("vue-slider-dot");return i.openBlock(),i.createElementBlock("div",i.mergeProps({ref:"container",class:e.containerClasses,style:e.containerStyles,onClick:t[2]||(t[2]=(...a)=>e.clickHandle&&e.clickHandle(...a)),onTouchstartPassive:t[3]||(t[3]=(...a)=>e.dragStartOnProcess&&e.dragStartOnProcess(...a)),onMousedownPassive:t[4]||(t[4]=(...a)=>e.dragStartOnProcess&&e.dragStartOnProcess(...a))},e.$attrs),[i.createElementVNode("div",{class:"vue-slider-rail",style:i.normalizeStyle(e.railStyle)},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.processArray,(a,c)=>i.renderSlot(e.$slots,"process",i.normalizeProps(i.guardReactiveProps(a)),()=>[(i.openBlock(),i.createElementBlock("div",{class:"vue-slider-process",key:`process-${c}`,style:i.normalizeStyle(a.style)},null,4))])),256)),e.sliderMarks&&e.control?(i.openBlock(),i.createElementBlock("div",T,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.control.markList,(a,c)=>i.renderSlot(e.$slots,"mark",i.normalizeProps(i.guardReactiveProps(a)),()=>[(i.openBlock(),i.createBlock(l,{key:`mark-${c}`,mark:a,hideLabel:e.hideLabel,style:i.normalizeStyle({[e.isHorizontal?"height":"width"]:"100%",[e.isHorizontal?"width":"height"]:e.tailSize,[e.mainDirection]:`${a.pos}%`}),stepStyle:e.stepStyle,stepActiveStyle:e.stepActiveStyle,labelStyle:e.labelStyle,labelActiveStyle:e.labelActiveStyle,onPressLabel:t[0]||(t[0]=y=>e.clickable&&e.setValueByPos(y))},{step:i.withCtx(()=>[i.renderSlot(e.$slots,"step",i.normalizeProps(i.guardReactiveProps(a)))]),label:i.withCtx(()=>[i.renderSlot(e.$slots,"label",i.normalizeProps(i.guardReactiveProps(a)))]),_:2},1032,["mark","hideLabel","style","stepStyle","stepActiveStyle","labelStyle","labelActiveStyle"]))])),256))])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.dots,(a,c)=>(i.openBlock(),i.createBlock(p,i.mergeProps({ref_for:!0,ref:`dot-${c}`,key:`dot-${c}`,value:a.value,disabled:a.disabled,focus:a.focus,"dot-style":[a.style,a.disabled?a.disabledStyle:null,a.focus?a.focusStyle:null],tooltip:a.tooltip||e.tooltip,"tooltip-style":[e.tooltipStyle,a.tooltipStyle,a.disabled?a.tooltipDisabledStyle:null,a.focus?a.tooltipFocusStyle:null],"tooltip-formatter":Array.isArray(e.sliderTooltipFormatter)?e.sliderTooltipFormatter[c]:e.sliderTooltipFormatter,"tooltip-placement":e.tooltipDirections[c],style:[e.dotBaseStyle,{[e.mainDirection]:`${a.pos}%`,transition:`${e.mainDirection} ${e.animateTime}s`}],onDragStart:()=>e.dragStart(c),role:"slider","aria-valuenow":a.value,"aria-valuemin":e.min,"aria-valuemax":e.max,"aria-orientation":e.isHorizontal?"horizontal":"vertical",tabindex:"0",onFocus:()=>e.focus(a,c),onBlur:t[1]||(t[1]=()=>e.blur())},e.dotAttrs),{dot:i.withCtx(()=>[i.renderSlot(e.$slots,"dot",i.normalizeProps(i.guardReactiveProps(a)))]),tooltip:i.withCtx(()=>[i.renderSlot(e.$slots,"tooltip",i.normalizeProps(i.guardReactiveProps(a)))]),_:2},1040,["value","disabled","focus","dot-style","tooltip","tooltip-style","tooltip-formatter","tooltip-placement","style","onDragStart","aria-valuenow","aria-valuemin","aria-valuemax","aria-orientation","onFocus"]))),128))],4),i.renderSlot(e.$slots,"default",{value:e.getValue()})],16)}const R=S(H,[["render",U]]);R.VueSliderMark=V,R.VueSliderDot=D,u.ERROR_TYPE=A,u.VueSliderDot=D,u.VueSliderMark=V,u.default=R,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});