!function (i, t) { "use strict"; if ("function" == typeof define && define.amd) define(["angular"], t); else if ("object" == typeof module && module.exports) { var s = angular || require("angular"); s && s.module || "undefined" == typeof angular || (s = angular), module.exports = t(s) } else t(i.angular) }(this, function (i) { "use strict"; var t = i.module("rzModule", []).factory("RzSliderOptions", function () { var t = { floor: 0, ceil: null, step: 1, precision: 0, minRange: null, maxRange: null, pushRange: !1, minLimit: null, maxLimit: null, id: null, translate: null, getLegend: null, stepsArray: null, bindIndexForStepsArray: !1, draggableRange: !1, draggableRangeOnly: !1, showSelectionBar: !1, showSelectionBarEnd: !1, showSelectionBarFromValue: null, hidePointerLabels: !1, hideLimitLabels: !1, autoHideLimitLabels: !0, readOnly: !1, disabled: !1, interval: 350, showTicks: !1, showTicksValues: !1, ticksArray: null, ticksTooltip: null, ticksValuesTooltip: null, vertical: !1, getSelectionBarColor: null, getTickColor: null, getPointerColor: null, keyboardSupport: !0, scale: 1, enforceStep: !0, enforceRange: !1, noSwitching: !1, onlyBindHandles: !1, onStart: null, onChange: null, onEnd: null, rightToLeft: !1, boundPointerLabels: !0, mergeRangeLabelsIfSame: !1, customTemplateScope: null, logScale: !1, customValueToPosition: null, customPositionToValue: null, selectionBarGradient: null, ariaLabel: null, ariaLabelledBy: null, ariaLabelHigh: null, ariaLabelledByHigh: null }, s = {}, e = {}; return e.options = function (t) { i.extend(s, t) }, e.getOptions = function (e) { return i.extend({}, t, s, e) }, e }).factory("rzThrottle", ["$timeout", function (i) { return function (t, s, e) { var n, o, a, h = Date.now || function () { return (new Date).getTime() }, l = null, r = 0; e = e || {}; var u = function () { r = h(), l = null, a = t.apply(n, o), n = o = null }; return function () { var p = h(), c = s - (p - r); return n = this, o = arguments, c <= 0 ? (i.cancel(l), l = null, r = p, a = t.apply(n, o), n = o = null) : l || !1 === e.trailing || (l = i(u, c)), a } } }]).factory("RzSlider", ["$timeout", "$document", "$window", "$compile", "RzSliderOptions", "rzThrottle", function (t, s, e, n, o, a) { var h = function (i, t) { this.scope = i, this.lowValue = 0, this.highValue = 0, this.sliderElem = t, this.range = void 0 !== this.scope.rzSliderModel && void 0 !== this.scope.rzSliderHigh, this.dragging = { active: !1, value: 0, difference: 0, position: 0, lowLimit: 0, highLimit: 0 }, this.positionProperty = "left", this.dimensionProperty = "width", this.handleHalfDim = 0, this.maxPos = 0, this.precision = 0, this.step = 1, this.tracking = "", this.minValue = 0, this.maxValue = 0, this.valueRange = 0, this.intermediateTicks = !1, this.initHasRun = !1, this.firstKeyDown = !1, this.internalChange = !1, this.cmbLabelShown = !1, this.currentFocusElement = null, this.fullBar = null, this.selBar = null, this.minH = null, this.maxH = null, this.flrLab = null, this.ceilLab = null, this.minLab = null, this.maxLab = null, this.cmbLab = null, this.ticks = null, this.init() }; return h.prototype = { init: function () { var t, s, n = this, o = function () { n.calcViewDimensions() }; this.applyOptions(), this.syncLowValue(), this.range && this.syncHighValue(), this.initElemHandles(), this.manageElementsStyle(), this.setDisabledState(), this.calcViewDimensions(), this.setMinAndMax(), this.addAccessibility(), this.updateCeilLab(), this.updateFloorLab(), this.initHandles(), this.manageEventsBindings(), this.scope.$on("reCalcViewDimensions", o), i.element(e).on("resize", o), this.initHasRun = !0, t = a(function () { n.onLowHandleChange() }, n.options.interval), s = a(function () { n.onHighHandleChange() }, n.options.interval), this.scope.$on("rzSliderForceRender", function () { n.resetLabelsValue(), t(), n.range && s(), n.resetSlider() }), this.scope.$watch("rzSliderOptions()", function (i, t) { i !== t && (n.applyOptions(), n.syncLowValue(), n.range && n.syncHighValue(), n.resetSlider()) }, !0), this.scope.$watch("rzSliderModel", function (i, s) { n.internalChange || i !== s && t() }), this.scope.$watch("rzSliderHigh", function (i, t) { n.internalChange || i !== t && (null != i && s(), (n.range && null == i || !n.range && null != i) && (n.applyOptions(), n.resetSlider())) }), this.scope.$on("$destroy", function () { n.unbindEvents(), i.element(e).off("resize", o), n.currentFocusElement = null }) }, findStepIndex: function (t) { for (var s = 0, e = 0; e < this.options.stepsArray.length; e++) { var n = this.options.stepsArray[e]; if (n === t) { s = e; break } if (i.isDate(n)) { if (n.getTime() === t.getTime()) { s = e; break } } else if (i.isObject(n) && (i.isDate(n.value) && n.value.getTime() === t.getTime() || n.value === t)) { s = e; break } } return s }, syncLowValue: function () { this.options.stepsArray ? this.options.bindIndexForStepsArray ? this.lowValue = this.scope.rzSliderModel : this.lowValue = this.findStepIndex(this.scope.rzSliderModel) : this.lowValue = this.scope.rzSliderModel }, syncHighValue: function () { this.options.stepsArray ? this.options.bindIndexForStepsArray ? this.highValue = this.scope.rzSliderHigh : this.highValue = this.findStepIndex(this.scope.rzSliderHigh) : this.highValue = this.scope.rzSliderHigh }, getStepValue: function (t) { var s = this.options.stepsArray[t]; return i.isDate(s) ? s : i.isObject(s) ? s.value : s }, applyLowValue: function () { this.options.stepsArray ? this.options.bindIndexForStepsArray ? this.scope.rzSliderModel = this.lowValue : this.scope.rzSliderModel = this.getStepValue(this.lowValue) : this.scope.rzSliderModel = this.lowValue }, applyHighValue: function () { this.options.stepsArray ? this.options.bindIndexForStepsArray ? this.scope.rzSliderHigh = this.highValue : this.scope.rzSliderHigh = this.getStepValue(this.highValue) : this.scope.rzSliderHigh = this.highValue }, onLowHandleChange: function () { this.syncLowValue(), this.range && this.syncHighValue(), this.setMinAndMax(), this.updateLowHandle(this.valueToPosition(this.lowValue)), this.updateSelectionBar(), this.updateTicksScale(), this.updateAriaAttributes(), this.range && this.updateCmbLabel() }, onHighHandleChange: function () { this.syncLowValue(), this.syncHighValue(), this.setMinAndMax(), this.updateHighHandle(this.valueToPosition(this.highValue)), this.updateSelectionBar(), this.updateTicksScale(), this.updateCmbLabel(), this.updateAriaAttributes() }, applyOptions: function () { var t; t = this.scope.rzSliderOptions ? this.scope.rzSliderOptions() : {}, this.options = o.getOptions(t), this.options.step <= 0 && (this.options.step = 1), this.range = void 0 !== this.scope.rzSliderModel && void 0 !== this.scope.rzSliderHigh, this.options.draggableRange = this.range && this.options.draggableRange, this.options.draggableRangeOnly = this.range && this.options.draggableRangeOnly, this.options.draggableRangeOnly && (this.options.draggableRange = !0), this.options.showTicks = this.options.showTicks || this.options.showTicksValues || !!this.options.ticksArray, this.scope.showTicks = this.options.showTicks, (i.isNumber(this.options.showTicks) || this.options.ticksArray) && (this.intermediateTicks = !0), this.options.showSelectionBar = this.options.showSelectionBar || this.options.showSelectionBarEnd || null !== this.options.showSelectionBarFromValue, this.options.stepsArray ? this.parseStepsArray() : (this.options.translate ? this.customTrFn = this.options.translate : this.customTrFn = function (i) { return String(i) }, this.getLegend = this.options.getLegend), this.options.vertical && (this.positionProperty = "bottom", this.dimensionProperty = "height"), this.options.customTemplateScope && (this.scope.custom = this.options.customTemplateScope) }, parseStepsArray: function () { this.options.floor = 0, this.options.ceil = this.options.stepsArray.length - 1, this.options.step = 1, this.options.translate ? this.customTrFn = this.options.translate : this.customTrFn = function (i) { return this.options.bindIndexForStepsArray ? this.getStepValue(i) : i }, this.getLegend = function (t) { var s = this.options.stepsArray[t]; return i.isObject(s) ? s.legend : null } }, resetSlider: function () { this.manageElementsStyle(), this.addAccessibility(), this.setMinAndMax(), this.updateCeilLab(), this.updateFloorLab(), this.unbindEvents(), this.manageEventsBindings(), this.setDisabledState(), this.calcViewDimensions(), this.refocusPointerIfNeeded() }, refocusPointerIfNeeded: function () { this.currentFocusElement && (this.onPointerFocus(this.currentFocusElement.pointer, this.currentFocusElement.ref), this.focusElement(this.currentFocusElement.pointer)) }, initElemHandles: function () { i.forEach(this.sliderElem.children(), function (t, s) { var e = i.element(t); switch (s) { case 0: this.fullBar = e; break; case 1: this.selBar = e; break; case 2: this.minH = e; break; case 3: this.maxH = e; break; case 4: this.flrLab = e; break; case 5: this.ceilLab = e; break; case 6: this.minLab = e; break; case 7: this.maxLab = e; break; case 8: this.cmbLab = e; break; case 9: this.ticks = e } }, this), this.selBar.rzsp = 0, this.minH.rzsp = 0, this.maxH.rzsp = 0, this.flrLab.rzsp = 0, this.ceilLab.rzsp = 0, this.minLab.rzsp = 0, this.maxLab.rzsp = 0, this.cmbLab.rzsp = 0 }, manageElementsStyle: function () { this.range ? this.maxH.css("display", "") : this.maxH.css("display", "none"), this.alwaysHide(this.flrLab, this.options.showTicksValues || this.options.hideLimitLabels), this.alwaysHide(this.ceilLab, this.options.showTicksValues || this.options.hideLimitLabels); var i = this.options.showTicksValues && !this.intermediateTicks; this.alwaysHide(this.minLab, i || this.options.hidePointerLabels), this.alwaysHide(this.maxLab, i || !this.range || this.options.hidePointerLabels), this.alwaysHide(this.cmbLab, i || !this.range || this.options.hidePointerLabels), this.alwaysHide(this.selBar, !this.range && !this.options.showSelectionBar), this.options.vertical && this.sliderElem.addClass("rz-vertical"), this.options.draggableRange ? this.selBar.addClass("rz-draggable") : this.selBar.removeClass("rz-draggable"), this.intermediateTicks && this.options.showTicksValues && this.ticks.addClass("rz-ticks-values-under") }, alwaysHide: function (i, t) { i.rzAlwaysHide = t, t ? this.hideEl(i) : this.showEl(i) }, manageEventsBindings: function () { this.options.disabled || this.options.readOnly ? this.unbindEvents() : this.bindEvents() }, setDisabledState: function () { this.options.disabled ? this.sliderElem.attr("disabled", "disabled") : this.sliderElem.attr("disabled", null) }, resetLabelsValue: function () { this.minLab.rzsv = void 0, this.maxLab.rzsv = void 0 }, initHandles: function () { this.updateLowHandle(this.valueToPosition(this.lowValue)), this.range && this.updateHighHandle(this.valueToPosition(this.highValue)), this.updateSelectionBar(), this.range && this.updateCmbLabel(), this.updateTicksScale() }, translateFn: function (i, t, s, e) { e = void 0 === e || e; var n = "", o = !1, a = t.hasClass("no-label-injection"); e ? (this.options.stepsArray && !this.options.bindIndexForStepsArray && (i = this.getStepValue(i)), n = String(this.customTrFn(i, this.options.id, s))) : n = String(i), (void 0 === t.rzsv || t.rzsv.length !== n.length || t.rzsv.length > 0 && 0 === t.rzsd) && (o = !0, t.rzsv = n), a || t.html(n), this.scope[s + "Label"] = n, o && this.getDimension(t) }, setMinAndMax: function () { if (this.step = +this.options.step, this.precision = +this.options.precision, this.minValue = this.options.floor, this.options.logScale && 0 === this.minValue) throw Error("Can't use floor=0 with logarithmic scale"); this.options.enforceStep && (this.lowValue = this.roundStep(this.lowValue), this.range && (this.highValue = this.roundStep(this.highValue))), null != this.options.ceil ? this.maxValue = this.options.ceil : this.maxValue = this.options.ceil = this.range ? this.highValue : this.lowValue, this.options.enforceRange && (this.lowValue = this.sanitizeValue(this.lowValue), this.range && (this.highValue = this.sanitizeValue(this.highValue))), this.applyLowValue(), this.range && this.applyHighValue(), this.valueRange = this.maxValue - this.minValue }, addAccessibility: function () { this.minH.attr("role", "slider"), this.updateAriaAttributes(), !this.options.keyboardSupport || this.options.readOnly || this.options.disabled ? this.minH.attr("tabindex", "") : this.minH.attr("tabindex", "0"), this.options.vertical && this.minH.attr("aria-orientation", "vertical"), this.options.ariaLabel ? this.minH.attr("aria-label", this.options.ariaLabel) : this.options.ariaLabelledBy && this.minH.attr("aria-labelledby", this.options.ariaLabelledBy), this.range && (this.maxH.attr("role", "slider"), !this.options.keyboardSupport || this.options.readOnly || this.options.disabled ? this.maxH.attr("tabindex", "") : this.maxH.attr("tabindex", "0"), this.options.vertical && this.maxH.attr("aria-orientation", "vertical"), this.options.ariaLabelHigh ? this.maxH.attr("aria-label", this.options.ariaLabelHigh) : this.options.ariaLabelledByHigh && this.maxH.attr("aria-labelledby", this.options.ariaLabelledByHigh)) }, updateAriaAttributes: function () { this.minH.attr({ "aria-valuenow": this.scope.rzSliderModel, "aria-valuetext": this.customTrFn(this.scope.rzSliderModel, this.options.id, "model"), "aria-valuemin": this.minValue, "aria-valuemax": this.maxValue }), this.range && this.maxH.attr({ "aria-valuenow": this.scope.rzSliderHigh, "aria-valuetext": this.customTrFn(this.scope.rzSliderHigh, this.options.id, "high"), "aria-valuemin": this.minValue, "aria-valuemax": this.maxValue }) }, calcViewDimensions: function () { var i = this.getDimension(this.minH); if (this.handleHalfDim = i / 2, this.barDimension = this.getDimension(this.fullBar), this.maxPos = this.barDimension - i, this.getDimension(this.sliderElem), this.sliderElem.rzsp = this.sliderElem[0].getBoundingClientRect()[this.positionProperty], this.initHasRun) { this.updateFloorLab(), this.updateCeilLab(), this.initHandles(); var s = this; t(function () { s.updateTicksScale() }) } }, updateTicksScale: function () { if (this.options.showTicks) { var i = this.options.ticksArray || this.getTicksArray(), t = this.options.vertical ? "translateY" : "translateX", s = this; this.options.rightToLeft && i.reverse(), this.scope.ticks = i.map(function (i) { var e = s.valueToPosition(i); s.options.vertical && (e = s.maxPos - e); var n = t + "(" + Math.round(e) + "px)", o = { selected: s.isTickSelected(i), style: { "-webkit-transform": n, "-moz-transform": n, "-o-transform": n, "-ms-transform": n, transform: n } }; if (o.selected && s.options.getSelectionBarColor && (o.style["background-color"] = s.getSelectionBarColor()), !o.selected && s.options.getTickColor && (o.style["background-color"] = s.getTickColor(i)), s.options.ticksTooltip && (o.tooltip = s.options.ticksTooltip(i), o.tooltipPlacement = s.options.vertical ? "right" : "top"), s.options.showTicksValues && (o.value = s.getDisplayValue(i, "tick-value"), s.options.ticksValuesTooltip && (o.valueTooltip = s.options.ticksValuesTooltip(i), o.valueTooltipPlacement = s.options.vertical ? "right" : "top")), s.getLegend) { var a = s.getLegend(i, s.options.id); a && (o.legend = a) } return o }) } }, getTicksArray: function () { var i = this.step, t = []; this.intermediateTicks && (i = this.options.showTicks); for (var s = this.minValue; s <= this.maxValue; s += i) t.push(s); return t }, isTickSelected: function (i) { if (!this.range) if (null !== this.options.showSelectionBarFromValue) { var t = this.options.showSelectionBarFromValue; if (this.lowValue > t && i >= t && i <= this.lowValue) return !0; if (this.lowValue < t && i <= t && i >= this.lowValue) return !0 } else if (this.options.showSelectionBarEnd) { if (i >= this.lowValue) return !0 } else if (this.options.showSelectionBar && i <= this.lowValue) return !0; return !!(this.range && i >= this.lowValue && i <= this.highValue) }, updateFloorLab: function () { this.translateFn(this.minValue, this.flrLab, "floor"), this.getDimension(this.flrLab); var i = this.options.rightToLeft ? this.barDimension - this.flrLab.rzsd : 0; this.setPosition(this.flrLab, i) }, updateCeilLab: function () { this.translateFn(this.maxValue, this.ceilLab, "ceil"), this.getDimension(this.ceilLab); var i = this.options.rightToLeft ? 0 : this.barDimension - this.ceilLab.rzsd; this.setPosition(this.ceilLab, i) }, updateHandles: function (i, t) { "lowValue" === i ? this.updateLowHandle(t) : this.updateHighHandle(t), this.updateSelectionBar(), this.updateTicksScale(), this.range && this.updateCmbLabel() }, getHandleLabelPos: function (i, t) { var s = this[i].rzsd, e = t - s / 2 + this.handleHalfDim, n = this.barDimension - s; return this.options.boundPointerLabels ? this.options.rightToLeft && "minLab" === i || !this.options.rightToLeft && "maxLab" === i ? Math.min(e, n) : Math.min(Math.max(e, 0), n) : e }, updateLowHandle: function (i) { if (this.setPosition(this.minH, i), this.translateFn(this.lowValue, this.minLab, "model"), this.setPosition(this.minLab, this.getHandleLabelPos("minLab", i)), this.options.getPointerColor) { var t = this.getPointerColor("min"); this.scope.minPointerStyle = { backgroundColor: t } } this.options.autoHideLimitLabels && this.shFloorCeil() }, updateHighHandle: function (i) { if (this.setPosition(this.maxH, i), this.translateFn(this.highValue, this.maxLab, "high"), this.setPosition(this.maxLab, this.getHandleLabelPos("maxLab", i)), this.options.getPointerColor) { var t = this.getPointerColor("max"); this.scope.maxPointerStyle = { backgroundColor: t } } this.options.autoHideLimitLabels && this.shFloorCeil() }, shFloorCeil: function () { if (!this.options.hidePointerLabels) { var i = !1, t = !1, s = this.isLabelBelowFloorLab(this.minLab), e = this.isLabelAboveCeilLab(this.minLab), n = this.isLabelAboveCeilLab(this.maxLab), o = this.isLabelBelowFloorLab(this.cmbLab), a = this.isLabelAboveCeilLab(this.cmbLab); if (s ? (i = !0, this.hideEl(this.flrLab)) : (i = !1, this.showEl(this.flrLab)), e ? (t = !0, this.hideEl(this.ceilLab)) : (t = !1, this.showEl(this.ceilLab)), this.range) { var h = this.cmbLabelShown ? a : n, l = this.cmbLabelShown ? o : s; h ? this.hideEl(this.ceilLab) : t || this.showEl(this.ceilLab), l ? this.hideEl(this.flrLab) : i || this.showEl(this.flrLab) } } }, isLabelBelowFloorLab: function (i) { var t = this.options.rightToLeft, s = i.rzsp, e = i.rzsd, n = this.flrLab.rzsp, o = this.flrLab.rzsd; return t ? s + e >= n - 2 : s <= n + o + 2 }, isLabelAboveCeilLab: function (i) { var t = this.options.rightToLeft, s = i.rzsp, e = i.rzsd, n = this.ceilLab.rzsp, o = this.ceilLab.rzsd; return t ? s <= n + o + 2 : s + e >= n - 2 }, updateSelectionBar: function () { var i = 0, t = 0, s = this.options.rightToLeft ? !this.options.showSelectionBarEnd : this.options.showSelectionBarEnd, e = this.options.rightToLeft ? this.maxH.rzsp + this.handleHalfDim : this.minH.rzsp + this.handleHalfDim; if (this.range) t = Math.abs(this.maxH.rzsp - this.minH.rzsp), i = e; else if (null !== this.options.showSelectionBarFromValue) { var n = this.options.showSelectionBarFromValue, o = this.valueToPosition(n); (this.options.rightToLeft ? this.lowValue <= n : this.lowValue > n) ? (t = this.minH.rzsp - o, i = o + this.handleHalfDim) : (t = o - this.minH.rzsp, i = this.minH.rzsp + this.handleHalfDim) } else s ? (t = Math.abs(this.maxPos - this.minH.rzsp) + this.handleHalfDim, i = this.minH.rzsp + this.handleHalfDim) : (t = this.minH.rzsp + this.handleHalfDim, i = 0); if (this.setDimension(this.selBar, t), this.setPosition(this.selBar, i), this.options.getSelectionBarColor) { var a = this.getSelectionBarColor(); this.scope.barStyle = { backgroundColor: a } } else if (this.options.selectionBarGradient) { var h = null !== this.options.showSelectionBarFromValue ? this.valueToPosition(this.options.showSelectionBarFromValue) : 0, l = h - i > 0 ^ s, r = this.options.vertical ? l ? "bottom" : "top" : l ? "left" : "right"; this.scope.barStyle = { backgroundImage: "linear-gradient(to " + r + ", " + this.options.selectionBarGradient.from + " 0%," + this.options.selectionBarGradient.to + " 100%)" }, this.options.vertical ? (this.scope.barStyle.backgroundPosition = "center " + (h + t + i + (l ? -this.handleHalfDim : 0)) + "px", this.scope.barStyle.backgroundSize = "100% " + (this.barDimension - this.handleHalfDim) + "px") : (this.scope.barStyle.backgroundPosition = h - i + (l ? this.handleHalfDim : 0) + "px center", this.scope.barStyle.backgroundSize = this.barDimension - this.handleHalfDim + "px 100%") } }, getSelectionBarColor: function () { return this.range ? this.options.getSelectionBarColor(this.scope.rzSliderModel, this.scope.rzSliderHigh) : this.options.getSelectionBarColor(this.scope.rzSliderModel) }, getPointerColor: function (i) { return "max" === i ? this.options.getPointerColor(this.scope.rzSliderHigh, i) : this.options.getPointerColor(this.scope.rzSliderModel, i) }, getTickColor: function (i) { return this.options.getTickColor(i) }, updateCmbLabel: function () { if (this.options.rightToLeft ? this.minLab.rzsp - this.minLab.rzsd - 10 <= this.maxLab.rzsp : this.minLab.rzsp + this.minLab.rzsd + 10 >= this.maxLab.rzsp) { var i = this.getDisplayValue(this.lowValue, "model"), t = this.getDisplayValue(this.highValue, "high"), s = ""; s = this.options.mergeRangeLabelsIfSame && i === t ? i : this.options.rightToLeft ? t + " - " + i : i + " - " + t, this.translateFn(s, this.cmbLab, "cmb", !1); var e = this.options.boundPointerLabels ? Math.min(Math.max(this.selBar.rzsp + this.selBar.rzsd / 2 - this.cmbLab.rzsd / 2, 0), this.barDimension - this.cmbLab.rzsd) : this.selBar.rzsp + this.selBar.rzsd / 2 - this.cmbLab.rzsd / 2; this.setPosition(this.cmbLab, e), this.cmbLabelShown = !0, this.hideEl(this.minLab), this.hideEl(this.maxLab), this.showEl(this.cmbLab) } else this.cmbLabelShown = !1, this.updateHighHandle(this.valueToPosition(this.highValue)), this.updateLowHandle(this.valueToPosition(this.lowValue)), this.showEl(this.maxLab), this.showEl(this.minLab), this.hideEl(this.cmbLab); this.options.autoHideLimitLabels && this.shFloorCeil() }, getDisplayValue: function (i, t) { return this.options.stepsArray && !this.options.bindIndexForStepsArray && (i = this.getStepValue(i)), this.customTrFn(i, this.options.id, t) }, roundStep: function (i, t) { var s = t || this.step, e = parseFloat((i - this.minValue) / s).toPrecision(12); return e = Math.round(+e) * s, +(this.minValue + e).toFixed(this.precision) }, hideEl: function (i) { return i.css({ visibility: "hidden" }) }, showEl: function (i) { return i.rzAlwaysHide ? i : i.css({ visibility: "visible" }) }, setPosition: function (i, t) { i.rzsp = t; var s = {}; return s[this.positionProperty] = Math.round(t) + "px", i.css(s), t }, getDimension: function (i) { var t = i[0].getBoundingClientRect(); return this.options.vertical ? i.rzsd = (t.bottom - t.top) * this.options.scale : i.rzsd = (t.right - t.left) * this.options.scale, i.rzsd }, setDimension: function (i, t) { i.rzsd = t; var s = {}; return s[this.dimensionProperty] = Math.round(t) + "px", i.css(s), t }, sanitizeValue: function (i) { return Math.min(Math.max(i, this.minValue), this.maxValue) }, valueToPosition: function (i) { var t = this.linearValueToPosition; this.options.customValueToPosition ? t = this.options.customValueToPosition : this.options.logScale && (t = this.logValueToPosition); var s = t(i = this.sanitizeValue(i), this.minValue, this.maxValue) || 0; return this.options.rightToLeft && (s = 1 - s), s * this.maxPos }, linearValueToPosition: function (i, t, s) { return (i - t) / (s - t) }, logValueToPosition: function (i, t, s) { return ((i = Math.log(i)) - (t = Math.log(t))) / ((s = Math.log(s)) - t) }, positionToValue: function (i) { var t = i / this.maxPos; this.options.rightToLeft && (t = 1 - t); var s = this.linearPositionToValue; return this.options.customPositionToValue ? s = this.options.customPositionToValue : this.options.logScale && (s = this.logPositionToValue), s(t, this.minValue, this.maxValue) || 0 }, linearPositionToValue: function (i, t, s) { return i * (s - t) + t }, logPositionToValue: function (i, t, s) { t = Math.log(t); var e = i * ((s = Math.log(s)) - t) + t; return Math.exp(e) }, getEventAttr: function (i, t) { return void 0 === i.originalEvent ? i[t] : i.originalEvent[t] }, getEventXY: function (i, t) { var s = this.options.vertical ? "clientY" : "clientX"; if (void 0 !== i[s]) return i[s]; var e = this.getEventAttr(i, "touches"); if (void 0 !== t) for (var n = 0; n < e.length; n++) if (e[n].identifier === t) return e[n][s]; return e[0][s] }, getEventPosition: function (i, t) { var s = this.sliderElem.rzsp; return (this.options.vertical ? -this.getEventXY(i, t) + s : this.getEventXY(i, t) - s) * this.options.scale - this.handleHalfDim }, getEventNames: function (i) { var t = { moveEvent: "", endEvent: "" }; return this.getEventAttr(i, "touches") ? (t.moveEvent = "touchmove", t.endEvent = "touchend") : (t.moveEvent = "mousemove", t.endEvent = "mouseup"), t }, getNearestHandle: function (i) { if (!this.range) return this.minH; var t = this.getEventPosition(i), s = Math.abs(t - this.minH.rzsp), e = Math.abs(t - this.maxH.rzsp); return s < e ? this.minH : s > e ? this.maxH : this.options.rightToLeft ? t > this.minH.rzsp ? this.minH : this.maxH : t < this.minH.rzsp ? this.minH : this.maxH }, focusElement: function (i) { i[0].focus() }, bindEvents: function () { var t, s, e; this.options.draggableRange ? (t = "rzSliderDrag", s = this.onDragStart, e = this.onDragMove) : (t = "lowValue", s = this.onStart, e = this.onMove), this.options.onlyBindHandles || (this.selBar.on("mousedown", i.bind(this, s, null, t)), this.selBar.on("mousedown", i.bind(this, e, this.selBar))), this.options.draggableRangeOnly ? (this.minH.on("mousedown", i.bind(this, s, null, t)), this.maxH.on("mousedown", i.bind(this, s, null, t))) : (this.minH.on("mousedown", i.bind(this, this.onStart, this.minH, "lowValue")), this.range && this.maxH.on("mousedown", i.bind(this, this.onStart, this.maxH, "highValue")), this.options.onlyBindHandles || (this.fullBar.on("mousedown", i.bind(this, this.onStart, null, null)), this.fullBar.on("mousedown", i.bind(this, this.onMove, this.fullBar)), this.ticks.on("mousedown", i.bind(this, this.onStart, null, null)), this.ticks.on("mousedown", i.bind(this, this.onTickClick, this.ticks)))), this.options.onlyBindHandles || (this.selBar.on("touchstart", i.bind(this, s, null, t)), this.selBar.on("touchstart", i.bind(this, e, this.selBar))), this.options.draggableRangeOnly ? (this.minH.on("touchstart", i.bind(this, s, null, t)), this.maxH.on("touchstart", i.bind(this, s, null, t))) : (this.minH.on("touchstart", i.bind(this, this.onStart, this.minH, "lowValue")), this.range && this.maxH.on("touchstart", i.bind(this, this.onStart, this.maxH, "highValue")), this.options.onlyBindHandles || (this.fullBar.on("touchstart", i.bind(this, this.onStart, null, null)), this.fullBar.on("touchstart", i.bind(this, this.onMove, this.fullBar)), this.ticks.on("touchstart", i.bind(this, this.onStart, null, null)), this.ticks.on("touchstart", i.bind(this, this.onTickClick, this.ticks)))), this.options.keyboardSupport && (this.minH.on("focus", i.bind(this, this.onPointerFocus, this.minH, "lowValue")), this.range && this.maxH.on("focus", i.bind(this, this.onPointerFocus, this.maxH, "highValue"))) }, unbindEvents: function () { this.minH.off(), this.maxH.off(), this.fullBar.off(), this.selBar.off(), this.ticks.off() }, onStart: function (t, e, n) { var o, a, h = this.getEventNames(n); n.stopPropagation(), n.preventDefault(), this.calcViewDimensions(), t ? this.tracking = e : (t = this.getNearestHandle(n), this.tracking = t === this.minH ? "lowValue" : "highValue"), t.addClass("rz-active"), this.options.keyboardSupport && this.focusElement(t), o = i.bind(this, this.dragging.active ? this.onDragMove : this.onMove, t), a = i.bind(this, this.onEnd, o), s.on(h.moveEvent, o), s.on(h.endEvent, a), this.endHandlerToBeRemovedOnEnd = a, this.callOnStart(); var l = this.getEventAttr(n, "changedTouches"); l && (this.touchId || (this.isDragging = !0, this.touchId = l[0].identifier)) }, onMove: function (t, s, e) { var n, o = this.getEventAttr(s, "changedTouches"); if (o) for (var a = 0; a < o.length; a++) if (o[a].identifier === this.touchId) { n = o[a]; break } if (!o || n) { var h, l = this.getEventPosition(s, n ? n.identifier : void 0), r = this.options.rightToLeft ? this.minValue : this.maxValue, u = this.options.rightToLeft ? this.maxValue : this.minValue; l <= 0 ? h = u : l >= this.maxPos ? h = r : (h = this.positionToValue(l), h = e && i.isNumber(this.options.showTicks) ? this.roundStep(h, this.options.showTicks) : this.roundStep(h)), this.positionTrackingHandle(h) } }, onEnd: function (i, t) { var e = this.getEventAttr(t, "changedTouches"); if (!e || e[0].identifier === this.touchId) { this.isDragging = !1, this.touchId = null, this.options.keyboardSupport || (this.minH.removeClass("rz-active"), this.maxH.removeClass("rz-active"), this.tracking = ""), this.dragging.active = !1; var n = this.getEventNames(t); s.off(n.moveEvent, i), s.off(n.endEvent, this.endHandlerToBeRemovedOnEnd), this.endHandlerToBeRemovedOnEnd = null, this.callOnEnd() } }, onTickClick: function (i, t) { this.onMove(i, t, !0) }, onPointerFocus: function (t, s) { this.tracking = s, t.one("blur", i.bind(this, this.onPointerBlur, t)), t.on("keydown", i.bind(this, this.onKeyboardEvent)), t.on("keyup", i.bind(this, this.onKeyUp)), this.firstKeyDown = !0, t.addClass("rz-active"), this.currentFocusElement = { pointer: t, ref: s } }, onKeyUp: function () { this.firstKeyDown = !0, this.callOnEnd() }, onPointerBlur: function (i) { i.off("keydown"), i.off("keyup"), i.removeClass("rz-active"), this.isDragging || (this.tracking = "", this.currentFocusElement = null) }, getKeyActions: function (i) { var t = i + this.step, s = i - this.step, e = { UP: t, DOWN: s, LEFT: s, RIGHT: t, PAGEUP: i + this.valueRange / 10, PAGEDOWN: i - this.valueRange / 10, HOME: this.minValue, END: this.maxValue }; return this.options.rightToLeft && (e.LEFT = t, e.RIGHT = s, this.options.vertical && (e.UP = s, e.DOWN = t)), e }, onKeyboardEvent: function (i) { var s = this[this.tracking], e = i.keyCode || i.which, n = { 38: "UP", 40: "DOWN", 37: "LEFT", 39: "RIGHT", 33: "PAGEUP", 34: "PAGEDOWN", 36: "HOME", 35: "END" }, o = this.getKeyActions(s)[n[e]]; if (null != o && "" !== this.tracking) { i.preventDefault(), this.firstKeyDown && (this.firstKeyDown = !1, this.callOnStart()); var a = this; t(function () { var i = a.roundStep(a.sanitizeValue(o)); if (a.options.draggableRangeOnly) { var t, s, e = a.highValue - a.lowValue; "lowValue" === a.tracking ? (t = i, (s = i + e) > a.maxValue && (t = (s = a.maxValue) - e)) : (s = i, (t = i - e) < a.minValue && (s = (t = a.minValue) + e)), a.positionTrackingBar(t, s) } else a.positionTrackingHandle(i) }) } }, onDragStart: function (i, t, s) { var e = this.getEventPosition(s); this.dragging = { active: !0, value: this.positionToValue(e), difference: this.highValue - this.lowValue, lowLimit: this.options.rightToLeft ? this.minH.rzsp - e : e - this.minH.rzsp, highLimit: this.options.rightToLeft ? e - this.maxH.rzsp : this.maxH.rzsp - e }, this.onStart(i, t, s) }, getValue: function (i, t, s, e) { var n = this.options.rightToLeft, o = null; return o = "min" === i ? s ? e ? n ? this.minValue : this.maxValue - this.dragging.difference : n ? this.maxValue - this.dragging.difference : this.minValue : n ? this.positionToValue(t + this.dragging.lowLimit) : this.positionToValue(t - this.dragging.lowLimit) : s ? e ? n ? this.minValue + this.dragging.difference : this.maxValue : n ? this.maxValue : this.minValue + this.dragging.difference : n ? this.positionToValue(t + this.dragging.lowLimit) + this.dragging.difference : this.positionToValue(t - this.dragging.lowLimit) + this.dragging.difference, this.roundStep(o) }, onDragMove: function (i, t) { var s, e, n, o, a, h, l, r, u = this.getEventPosition(t); if (this.options.rightToLeft ? (n = this.dragging.lowLimit, o = this.dragging.highLimit, l = this.maxH, r = this.minH) : (n = this.dragging.highLimit, o = this.dragging.lowLimit, l = this.minH, r = this.maxH), a = u <= o, h = u >= this.maxPos - n, a) { if (0 === l.rzsp) return; s = this.getValue("min", u, !0, !1), e = this.getValue("max", u, !0, !1) } else if (h) { if (r.rzsp === this.maxPos) return; e = this.getValue("max", u, !0, !0), s = this.getValue("min", u, !0, !0) } else s = this.getValue("min", u, !1), e = this.getValue("max", u, !1); this.positionTrackingBar(s, e) }, positionTrackingBar: function (i, t) { null != this.options.minLimit && i < this.options.minLimit && (t = (i = this.options.minLimit) + this.dragging.difference), null != this.options.maxLimit && t > this.options.maxLimit && (i = (t = this.options.maxLimit) - this.dragging.difference), this.lowValue = i, this.highValue = t, this.applyLowValue(), this.range && this.applyHighValue(), this.applyModel(!0), this.updateHandles("lowValue", this.valueToPosition(i)), this.updateHandles("highValue", this.valueToPosition(t)) }, positionTrackingHandle: function (i) { var t = !1; i = this.applyMinMaxLimit(i), this.range && (this.options.pushRange ? (i = this.applyPushRange(i), t = !0) : (this.options.noSwitching && ("lowValue" === this.tracking && i > this.highValue ? i = this.applyMinMaxRange(this.highValue) : "highValue" === this.tracking && i < this.lowValue && (i = this.applyMinMaxRange(this.lowValue))), i = this.applyMinMaxRange(i), "lowValue" === this.tracking && i > this.highValue ? (this.lowValue = this.highValue, this.applyLowValue(), this.applyModel(), this.updateHandles(this.tracking, this.maxH.rzsp), this.updateAriaAttributes(), this.tracking = "highValue", this.minH.removeClass("rz-active"), this.maxH.addClass("rz-active"), this.options.keyboardSupport && this.focusElement(this.maxH), t = !0) : "highValue" === this.tracking && i < this.lowValue && (this.highValue = this.lowValue, this.applyHighValue(), this.applyModel(), this.updateHandles(this.tracking, this.minH.rzsp), this.updateAriaAttributes(), this.tracking = "lowValue", this.maxH.removeClass("rz-active"), this.minH.addClass("rz-active"), this.options.keyboardSupport && this.focusElement(this.minH), t = !0))), this[this.tracking] !== i && (this[this.tracking] = i, "lowValue" === this.tracking ? this.applyLowValue() : this.applyHighValue(), this.applyModel(), this.updateHandles(this.tracking, this.valueToPosition(i)), this.updateAriaAttributes(), t = !0), t && this.applyModel(!0) }, applyMinMaxLimit: function (i) { return null != this.options.minLimit && i < this.options.minLimit ? this.options.minLimit : null != this.options.maxLimit && i > this.options.maxLimit ? this.options.maxLimit : i }, applyMinMaxRange: function (i) { var t = "lowValue" === this.tracking ? this.highValue : this.lowValue, s = Math.abs(i - t); return null != this.options.minRange && s < this.options.minRange ? "lowValue" === this.tracking ? this.highValue - this.options.minRange : this.lowValue + this.options.minRange : null != this.options.maxRange && s > this.options.maxRange ? "lowValue" === this.tracking ? this.highValue - this.options.maxRange : this.lowValue + this.options.maxRange : i }, applyPushRange: function (i) { var t = "lowValue" === this.tracking ? this.highValue - i : i - this.lowValue, s = null !== this.options.minRange ? this.options.minRange : this.options.step, e = this.options.maxRange; return t < s ? ("lowValue" === this.tracking ? (this.highValue = Math.min(i + s, this.maxValue), i = this.highValue - s, this.applyHighValue(), this.updateHandles("highValue", this.valueToPosition(this.highValue))) : (this.lowValue = Math.max(i - s, this.minValue), i = this.lowValue + s, this.applyLowValue(), this.updateHandles("lowValue", this.valueToPosition(this.lowValue))), this.updateAriaAttributes()) : null !== e && t > e && ("lowValue" === this.tracking ? (this.highValue = i + e, this.applyHighValue(), this.updateHandles("highValue", this.valueToPosition(this.highValue))) : (this.lowValue = i - e, this.applyLowValue(), this.updateHandles("lowValue", this.valueToPosition(this.lowValue))), this.updateAriaAttributes()), i }, applyModel: function (i) { this.internalChange = !0, this.scope.$apply(), i && this.callOnChange(), this.internalChange = !1 }, callOnStart: function () { if (this.options.onStart) { var i = this, t = "lowValue" === this.tracking ? "min" : "max"; this.scope.$evalAsync(function () { i.options.onStart(i.options.id, i.scope.rzSliderModel, i.scope.rzSliderHigh, t) }) } }, callOnChange: function () { if (this.options.onChange) { var i = this, t = "lowValue" === this.tracking ? "min" : "max"; this.scope.$evalAsync(function () { i.options.onChange(i.options.id, i.scope.rzSliderModel, i.scope.rzSliderHigh, t) }) } }, callOnEnd: function () { if (this.options.onEnd) { var i = this, t = "lowValue" === this.tracking ? "min" : "max"; this.scope.$evalAsync(function () { i.options.onEnd(i.options.id, i.scope.rzSliderModel, i.scope.rzSliderHigh, t) }) } this.scope.$emit("slideEnded") } }, h }]).directive("rzslider", ["RzSlider", function (i) { return { restrict: "AE", replace: !0, scope: { rzSliderModel: "=?", rzSliderHigh: "=?", rzSliderOptions: "&?", rzSliderTplUrl: "@" }, templateUrl: function (i, t) { return t.rzSliderTplUrl || "rzSliderTpl.html" }, link: function (t, s) { t.slider = new i(t, s) } } }]); return t.run(["$templateCache", function (i) { i.put("rzSliderTpl.html", '<div class=rzslider><span class=rz-bar-wrapper><span class=rz-bar></span></span> <span class=rz-bar-wrapper><span class="rz-bar rz-selection" ng-style=barStyle></span></span> <span class="rz-pointer rz-pointer-min" ng-style=minPointerStyle></span> <span class="rz-pointer rz-pointer-max" ng-style=maxPointerStyle></span> <span class="rz-bubble rz-limit rz-floor"></span> <span class="rz-bubble rz-limit rz-ceil"></span> <span class=rz-bubble></span> <span class=rz-bubble></span> <span class=rz-bubble></span><ul ng-show=showTicks class=rz-ticks><li ng-repeat="t in ticks track by $index" class=rz-tick ng-class="{\'rz-selected\': t.selected}" ng-style=t.style ng-attr-uib-tooltip="{{ t.tooltip }}" ng-attr-tooltip-placement={{t.tooltipPlacement}} ng-attr-tooltip-append-to-body="{{ t.tooltip ? true : undefined}}"><span ng-if="t.value != null" class=rz-tick-value ng-attr-uib-tooltip="{{ t.valueTooltip }}" ng-attr-tooltip-placement={{t.valueTooltipPlacement}}>{{ t.value }}</span> <span ng-if="t.legend != null" class=rz-tick-legend>{{ t.legend }}</span></li></ul></div>') }]), t.name });;
