').appendTo(this.$wrap),s=new u(i,e,this);this.pointer.push(s)}this.p1=this.pointer[0],this.options.range&&(this.p2=this.pointer[1])}},{key:"bindEvents",value:function(){var t=this,e=this;this.$wrap.on("touchstart.asRange mousedown.asRange",(function(t){if(!0!==e.disabled){if((t=i(t)).which?3===t.which:2===t.button)return!1;var s=e.$wrap.offset(),n=t[e.direction.axis]-s[e.direction.position];return e.getAdjacentPointer(n).mousedown(t),!1}})),this.$element.is("input")&&this.$element.on(this.namespace+"::change",(function(){var e=t.get();t.$element.val(e)})),n["default"].each(this.pointer,(function(i,s){s.$element.on(t.namespace+"::move",(function(){return e.value=e.get(),!(!e.initialized||e.updating||(e._trigger("change",e.value),1))}))}))}},{key:"getValueFromPosition",value:function(t){return t>0?this.min+t/this.getLength()*this.interval:0}},{key:"getAdjacentPointer",value:function(t){var e=this.getValueFromPosition(t);if(this.options.range){var i=this.p1.value,s=this.p2.value,n=Math.abs(i-s);return i<=s?e>i+n/2?this.p2:this.p1:e>s+n/2?this.p1:this.p2}return this.p1}},{key:"getLength",value:function(){return"v"===this.options.direction?this.$wrap.height():this.$wrap.width()}},{key:"update",value:function(t){var e=this;this.updating=!0,n["default"].each(["max","min","step","limit","value"],(function(i,s){t[s]&&(e[s]=t[s])})),(t.max||t.min)&&this.setInterval(t.min,t.max),t.value||(this.value=t.min),n["default"].each(this.components,(function(t,i){"function"==typeof i.update&&i.update(e)})),this.set(this.value),this._trigger("update"),this.updating=!1}},{key:"get",value:function(){var t=[];if(n["default"].each(this.pointer,(function(e,i){t[e]=i.get()})),this.options.range)return t;if(t[0]===this.options.min&&("string"==typeof this.options.replaceFirst&&(t[0]=this.options.replaceFirst),"object"===a(this.options.replaceFirst)))for(var e in this.options.replaceFirst)Object.hasOwnProperty(this.options.replaceFirst,e)&&(t[0]=e);return t[0]}},{key:"set",value:function(t){if(this.options.range){if("number"==typeof t&&(t=[t]),!n["default"].isArray(t))return;n["default"].each(this.pointer,(function(e,i){i.set(t[e])}))}else this.p1.set(t);this.value=t}},{key:"val",value:function(t){return t?(this.set(t),this):this.get()}},{key:"setInterval",value:function(t,e){this.min=t,this.max=e,this.interval=e-t}},{key:"enable",value:function(){return this.disabled=!1,this.$wrap.removeClass(this.namespace+"_disabled"),this._trigger("enable"),this}},{key:"disable",value:function(){return this.disabled=!0,this.$wrap.addClass(this.namespace+"_disabled"),this._trigger("disable"),this}},{key:"destroy",value:function(){n["default"].each(this.pointer,(function(t,e){e.destroy()})),this.$wrap.destroy(),this._trigger("destroy")}}],[{key:"registerComponent",value:function(t,e){c[t]=e}},{key:"setDefaults",value:function(t){n["default"].extend(r,n["default"].isPlainObject(t)&&t)}}]),t}();f.registerComponent("scale",l),f.registerComponent("selected",h),f.registerComponent("tip",p),function(){var t=(0,n["default"])(document);t.on("asRange::ready",(function(e,i){var s=void 0,a={keys:{UP:38,DOWN:40,LEFT:37,RIGHT:39,RETURN:13,ESCAPE:27,BACKSPACE:8,SPACE:32},map:{},bound:!1,press:function(t){var e=t.keyCode||t.which;if(e in a.map&&"function"==typeof a.map[e])return a.map[e](t),!1},attach:function(e){var i=void 0,s=void 0;for(i in e)e.hasOwnProperty(i)&&((s=i.toUpperCase())in a.keys?a.map[a.keys[s]]=e[i]:a.map[s]=e[i]);a.bound||(a.bound=!0,t.bind("keydown",a.press))},detach:function(){a.bound=!1,a.map={},t.unbind("keydown",a.press)}};!0===i.options.keyboard&&n["default"].each(i.pointer,(function(t,e){s=i.options.step?i.options.step:1;var n=function(){var t=e.value;e.set(t-s)},o=function(){var t=e.value;e.set(t+s)};e.$element.attr("tabindex","0").on("focus",(function(){return a.attach({left:n,right:o}),!1})).on("blur",(function(){return a.detach(),!1}))}))}))}();var d="asRange",v=n["default"].fn.asRange;n["default"].fn.asRange=s,n["default"].asRange=n["default"].extend({setDefaults:f.setDefaults,noConflict:function(){return n["default"].fn.asRange=v,s}},{version:"0.3.4"})}));