(function(){function e(){var e,t=60;this.initialize=function(e){this._percent=e.percent||0,this.events={},this.events[vdown+" .scrubber_point_hit_box"]="onDown",this._vmoveCallback=null,this._vupCallbacks=[],this._humanControlled=!1,this.drawProgress=this.drawProgress.bind(this),this.drawPoint=this.drawPoint.bind(this),this.render=this.render.bind(this)},this.postAttach=function(){this.$hitBox=this.$el.find(".scrubber_point_hit_box"),this.$container=this.$el.find(".scrubber_container"),this.$progress=this.$el.find(".scrubber_progress"),this.drawPoint(),this.drawProgress()},this.onDown=function(e){this.postAttach(),this._humanControlled=!0,this.attachStuff.call(this),this._lastPercent=this._percent,$(this).trigger("DOWN")},this.getDelta=function(){return this._percent-this._lastPercent},this.onMove=function(e){var t=this;if(!t._humanControlled)return;var n=t.$container.offset().left,r=(t.getXCoordinate.call(t,e)-n)/this.$container.width();r<0&&(r=0),r>=1&&(r=1),isNaN(r)||(t._percent=r),t._vmoveCallback&&t._vmoveCallback(t._percent),t.draw()},this.onUp=function(e){this._humanControlled=!1,this._vupCallbacks.forEach(function(e){e(self._percent)}),this.detachStuff.call(this)},this.attachStuff=function(){$(document).on(vmove+".scrubber",this.onMove.bind(this)),$(document).on(vup+".scrubber",this.onUp.bind(this))},this.detachStuff=function(){$(document).unbind(vmove+".scrubber"),$(document).unbind(vup+".scrubber")},this.draw=_.throttle(function(){this.drawPoint(),this.drawProgress()},1e3/t),this.drawPoint=function(){this._percent>1&&(this._percent=1),this._percent<0&&(this._percent=0),this.$hitBox.css({marginLeft:this._percent*100+"%"})},this.drawProgress=function(){this.$progress.css({transform:"scaleX("+this._percent+")"})},this.getXCoordinate=function(e){if(e.type==="mouseup"||e.type==="mousemove"||e.type==="mousedown")return e.pageX;if(e.type==="touchend"||e.type==="touchmove"||e.type==="touchstart")return e.originalEvent.changedTouches[0].pageX;throw new Error("attempting to get coordinate from event that's not supported. event type: "+e.type)},this.setPercent=function(e){if(this._percent===e)return;if(this._humanControlled)return;this._percent=e,this.drawPoint(),this.drawProgress()},this.getPercent=function(){return this._percent},this.registerOnMove=function(e){this._vmoveCallback=e},this.render=function(){var t="<div class='scrubber_container'>   <div class='left_endcap'></div>   <div class='scrubber_progress'></div>   <div class='scrubber_backdrop'></div>   <div class='scrubber_point_hit_box ignoreSwipe'>       <div class='scrubber_point' class='disp_off'></div>   </div></div>";return e||(e=_.template(t)),this.$el.html(e()),this}}App.Views.ScrubberView=Backbone.View.extend(new e)})();