!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):t(jQuery)}(function(a){"use strict";Number.isNaN=Number.isNaN||function(t){return"number"==typeof t&&t!=t};var t,l="rangeslider",d=0,u=((t=document.createElement("input")).setAttribute("type","range"),"text"!==t.type),p={polyfill:!0,orientation:"horizontal",rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",activeClass:"rangeslider--active",horizontalClass:"rangeslider--horizontal",verticalClass:"rangeslider--vertical",dirRTLClass:"rangeslider__rtl",dirTTBClass:"rangeslider__ttb",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]},c={orientation:{horizontal:{dimension:"width",direction:{ltr:"left",rtl:"right"},directionStyle:{ltr:"left",rtl:"right"},coordinate:"x"},vertical:{dimension:"height",direction:{btt:"top",ttb:"bottom"},directionStyle:{btt:"bottom",ttb:"top"},coordinate:"y"}}};function e(t,i){var e=function(t){for(var i,e=[],n=t.parentNode;(i=n)&&(0===i.offsetWidth||0===i.offsetHeight||!1===i.open);)e.push(n),n=n.parentNode;return e}(t),n=e.length,s=[],o=t[i];function r(t){void 0!==t.open&&(t.open=!t.open)}if(n){for(var h=0;h<n;h++)s[h]=e[h].style.cssText,e[h].style.setProperty?e[h].style.setProperty("display","block","important"):e[h].style.cssText+=";display: block !important",e[h].style.height="0",e[h].style.overflow="hidden",e[h].style.visibility="hidden",r(e[h]);o=t[i];for(var a=0;a<n;a++)e[a].style.cssText=s[a],r(e[a])}return o}function n(t,i){var e=parseFloat(t);return Number.isNaN(e)?i:e}function s(t){return t.charAt(0).toUpperCase()+t.substr(1)}function o(t,i){var e,n,s;if(this.$window=a(window),this.$document=a(document),this.$element=a(t),this.options=a.extend({},p,i),this.polyfill=this.options.polyfill,this.orientation=this.$element[0].getAttribute("data-orientation")||this.options.orientation,this.dir=(e=this.$element,n=this.orientation,s=e[0].getAttribute("data-direction")||("vertical"===n?"btt":"ltr"),c.orientation[n].direction[s]?s:"vertical"===n?"btt":"ltr"),this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.DIMENSION=c.orientation[this.orientation].dimension,this.DIRECTION=c.orientation[this.orientation].direction[this.dir],this.DIRECTION_STYLE=c.orientation[this.orientation].directionStyle[this.dir],this.COORDINATE=c.orientation[this.orientation].coordinate,this.polyfill&&u)return!1;this.identifier="js-"+l+"-"+d++,this.startEvent=this.options.startEvent.join("."+this.identifier+" ")+"."+this.identifier,this.moveEvent=this.options.moveEvent.join("."+this.identifier+" ")+"."+this.identifier,this.endEvent=this.options.endEvent.join("."+this.identifier+" ")+"."+this.identifier,this.toFixed=(this.step+"").replace(".","").length-1,this.$fill=a('<div class="'+this.options.fillClass+" "+("ttb"===this.dir&&"vertical"===this.orientation?this.options.dirTTBClass:"")+'" />'),this.$handle=a('<div class="'+this.options.handleClass+'" />'),this.$range=a('<div class="'+this.options.rangeClass+" "+("rtl"===this.dir&&"horizontal"===this.orientation?this.options.dirRTLClass:"")+" "+this.options[this.orientation+"Class"]+'" id="'+this.identifier+'" />').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=a.proxy(this.handleDown,this),this.handleMove=a.proxy(this.handleMove,this),this.handleEnd=a.proxy(this.handleEnd,this),this.init();var o,r,h=this;this.$window.on("resize."+this.identifier,(o=function(){!function(t,i){var e=Array.prototype.slice.call(arguments,2);setTimeout(function(){return t.apply(null,e)},i)}(function(){h.update(!1,!1)},300)},r=(r=20)||100,function(){if(!o.debouncing){var t=Array.prototype.slice.apply(arguments);o.lastReturnVal=o.apply(window,t),o.debouncing=!0}return clearTimeout(o.debounceTimeout),o.debounceTimeout=setTimeout(function(){o.debouncing=!1},r),o.lastReturnVal})),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+this.identifier,function(t,i){if(!i||i.origin!==h.identifier){var e=t.target.value,n=h.getPositionFromValue(e);h.setPosition(n)}})}return o.prototype.init=function(){this.update(!0,!1),this.onInit&&"function"==typeof this.onInit&&this.onInit()},o.prototype.update=function(t,i){(t=t||!1)&&(this.min=n(this.$element[0].getAttribute("min"),0),this.max=n(this.$element[0].getAttribute("max"),100),this.value=n(this.$element[0].value,Math.round(this.min+(this.max-this.min)/2)),this.step=n(this.$element[0].getAttribute("step"),1)),this.handleDimension=e(this.$handle[0],"offset"+s(this.DIMENSION)),this.rangeDimension=e(this.$range[0],"offset"+s(this.DIMENSION)),this.maxHandlePos=this.rangeDimension-this.handleDimension,this.grabPos=this.handleDimension/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position,i)},o.prototype.handleDown=function(t){if(t.preventDefault(),this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),this.$range.addClass(this.options.activeClass),!(-1<(" "+t.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass))){var i=this.getRelativePosition(t),e=this.$range[0].getBoundingClientRect()[this.DIRECTION],n=this.getPositionFromNode(this.$handle[0])-e,s="vertical"===this.orientation?this.maxHandlePos-(i-this.grabPos):i-this.grabPos;this.setPosition(s),n<=i&&i<n+this.handleDimension&&(this.grabPos=i-n)}},o.prototype.handleMove=function(t){t.preventDefault();var i=this.getRelativePosition(t),e="vertical"===this.orientation?this.maxHandlePos-(i-this.grabPos):i-this.grabPos;this.setPosition(e)},o.prototype.handleEnd=function(t){t.preventDefault(),this.$document.off(this.moveEvent,this.handleMove),this.$document.off(this.endEvent,this.handleEnd),this.$range.removeClass(this.options.activeClass),this.$element.trigger("change",{origin:this.identifier}),this.onSlideEnd&&"function"==typeof this.onSlideEnd&&this.onSlideEnd(this.position,this.value)},o.prototype.cap=function(t,i,e){return t<i?i:e<t?e:t},o.prototype.setPosition=function(t,i){var e,n;void 0===i&&(i=!0),e=this.getValueFromPosition(this.cap(t,0,this.maxHandlePos)),n=this.getPositionFromValue(e),this.$fill[0].style[this.DIMENSION]=e==this.max?"100%":n+this.grabPos+"px",this.$handle[0].style[this.DIRECTION_STYLE]=n+"px",this.setValue(e),this.position=n,this.value=e,i&&this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(n,e)},o.prototype.getPositionFromNode=function(t){for(var i=0;null!==t;)i+=t.offsetLeft,t=t.offsetParent;return i},o.prototype.getRelativePosition=function(t){var i=s(this.COORDINATE),e=this.$range[0].getBoundingClientRect()[this.DIRECTION],n=0;return void 0!==t.originalEvent["client"+i]?n=t.originalEvent["client"+i]:t.originalEvent.touches&&t.originalEvent.touches[0]&&void 0!==t.originalEvent.touches[0]["client"+i]?n=t.originalEvent.touches[0]["client"+i]:t.currentPoint&&void 0!==t.currentPoint[this.COORDINATE]&&(n=t.currentPoint[this.COORDINATE]),"rtl"===this.dir||"ttb"===this.dir?e-n:n-e},o.prototype.getPositionFromValue=function(t){var i;return i=(t-this.min)/(this.max-this.min),Number.isNaN(i)?0:i*this.maxHandlePos},o.prototype.getValueFromPosition=function(t){var i,e;return i=t/(this.maxHandlePos||1),e=this.step*Math.round(i*(this.max-this.min)/this.step)+this.min,Number(e.toFixed(this.toFixed))},o.prototype.setValue=function(t){t===this.value&&""!==this.$element[0].value||this.$element.val(t).trigger("input",{origin:this.identifier})},o.prototype.destroy=function(){this.$document.off("."+this.identifier),this.$window.off("."+this.identifier),this.$element.off("."+this.identifier).removeAttr("style").removeData("plugin_"+l),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0])},a.fn[l]=function(e){var n=Array.prototype.slice.call(arguments,1);return this.each(function(){var t=a(this),i=t.data("plugin_"+l);i||t.data("plugin_"+l,i=new o(this,e)),"string"==typeof e&&i[e].apply(i,n)})},"rangeslider.js is available in jQuery context e.g $(selector).rangeslider(options);"});