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lEM;AA1EI,CAAf","sourcesContent":["// Styles\nimport '../../stylus/components/_range-sliders.styl'\n\n// Extensions\nimport VSlider from '../VSlider'\n\nimport {\n createRange,\n deepEqual\n} from '../../util/helpers'\n\n/* @vue/component */\nexport default {\n name: 'v-range-slider',\n\n extends: VSlider,\n\n props: {\n value: {\n type: Array,\n default: () => ([])\n }\n },\n\n data: vm => ({\n activeThumb: null,\n lazyValue: !vm.value.length\n ? [0, 0]\n : vm.value\n }),\n\n computed: {\n classes () {\n return Object.assign({}, {\n 'v-input--range-slider': true\n }, VSlider.options.computed.classes.call(this))\n },\n internalValue: {\n get () {\n return this.lazyValue\n },\n set (val) {\n const { min, max } = this\n // Round value to ensure the\n // entire slider range can\n // be selected with step\n let value = val.map(v => this.roundValue(Math.min(Math.max(v, min), max)))\n\n // Switch values if range and wrong order\n if (value[0] > value[1] || value[1] < value[0]) {\n if (this.activeThumb !== null) this.activeThumb = this.activeThumb === 1 ? 0 : 1\n value = [value[1], value[0]]\n }\n\n this.lazyValue = value\n if (!deepEqual(value, this.value)) this.$emit('input', value)\n\n this.validate()\n }\n },\n inputWidth () {\n return this.internalValue.map(v => (\n this.roundValue(v) - this.min) / (this.max - this.min) * 100\n )\n },\n isDirty () {\n return this.internalValue.some(v => v !== this.min) || this.alwaysDirty\n },\n trackFillStyles () {\n const styles = VSlider.options.computed.trackFillStyles.call(this)\n const fillPercent = Math.abs(this.inputWidth[0] - this.inputWidth[1])\n\n styles.width = `calc(${fillPercent}% - ${this.trackPadding}px)`\n styles[this.$vuetify.rtl ? 'right' : 'left'] = `${this.inputWidth[0]}%`\n\n return styles\n },\n trackPadding () {\n if (this.isDirty ||\n this.internalValue[0]\n ) return 0\n\n return VSlider.options.computed.trackPadding.call(this)\n }\n },\n\n methods: {\n getIndexOfClosestValue (arr, v) {\n if (Math.abs(arr[0] - v) < Math.abs(arr[1] - v)) return 0\n else return 1\n },\n genInput () {\n return createRange(2).map(i => {\n const input = VSlider.options.methods.genInput.call(this)\n\n input.data.attrs.value = this.internalValue[i]\n\n input.data.on.focus = e => {\n this.activeThumb = i\n VSlider.options.methods.onFocus.call(this, e)\n }\n\n return input\n })\n },\n genChildren () {\n return [\n this.genInput(),\n this.genTrackContainer(),\n this.genSteps(),\n createRange(2).map(i => {\n const value = this.internalValue[i]\n const onDrag = e => {\n this.isActive = true\n this.activeThumb = i\n this.onThumbMouseDown(e)\n }\n const valueWidth = this.inputWidth[i]\n const isActive = (this.isFocused || this.isActive) && this.activeThumb === i\n\n return this.genThumbContainer(value, valueWidth, isActive, onDrag)\n })\n ]\n },\n onSliderClick (e) {\n if (!this.isActive) {\n this.isFocused = true\n this.onMouseMove(e, true)\n this.$emit('change', this.internalValue)\n }\n },\n onMouseMove (e, trackClick = false) {\n const { value, isInsideTrack } = this.parseMouseMove(e)\n\n if (isInsideTrack) {\n if (trackClick) this.activeThumb = this.getIndexOfClosestValue(this.internalValue, value)\n\n this.setInternalValue(value)\n }\n },\n onKeyDown (e) {\n const value = this.parseKeyDown(e, this.internalValue[this.activeThumb])\n\n if (value == null) return\n\n this.setInternalValue(value)\n },\n setInternalValue (value) {\n this.internalValue = this.internalValue.map((v, i) => {\n if (i === this.activeThumb) return value\n else return Number(v)\n })\n }\n }\n}\n"],"sourceRoot":""}