(function(){function e(){var e;this.initialize=function(e){this._showTitle=e.showTitle===undefined?!0:e.showTitle,this.device=e.device||null,this.device&&this.device.resetLastDisplayVolume(),this.scrubberView=new App.Views.ScrubberView({percent:this.device===null?0:this.device.getCachedVolume()}),this.uuid=Math.random().toString(36).substring(2)+(new Date).getTime().toString(36),this.device&&this.setDevice(this.device)},this.syncTimeout=null,this.attachHandlers=function(){var e=this;this.scrubberView.registerOnMove(function(){e.device.setDisplayVolume(e.scrubberView.getPercent()),e.block(),e.syncTimeout&&window.clearTimeout(e.syncTimeout),e.syncTimeout=setTimeout(function(){e.syncScrubber()},2e3)}),this.device&&$(this.device).on("DISPLAY_VOLUME_CHANGED."+this.uuid,function(){if(e.blocked)return;e.scrubberView.setPercent(e.device.displayVolume)})},this.syncScrubber=function(){if(!this.device)return;var e=this,t=e.device.getCachedVolume(),n=e.scrubberView.getPercent();console.log("cachedVol",t),Math.abs(t-n)>.02&&e.scrubberView.setPercent(t)},this.detachHandlers=function(){this.device&&$(this.device).off("DISPLAY_VOLUME_CHANGED."+this.uuid),this.scrubberView.registerOnMove(null)},this.destroy=function(){this.detachHandlers()},this.setDevice=function(e){this.detachHandlers(),this.device=e,this.attachHandlers(),this.render()},this.render=function(){this.$el.empty();var t="<div class='volume_title'><%= deviceName %></div><div class='volume_row'>    <div class='tray_min_icon volume_icon'></div>    <div class='scrubber'></div></div>";return e||(e=_.template(t)),this.$el.html(e({deviceName:this.device===null?"":this.device.getDisplayName()})),this.$el.addClass("volume_view_wrapper"),this.scrubberView.setElement(this.$(".scrubber")).render(),this.scrubberView.postAttach(),this._showTitle||this.$el.find(".volume_title").addClass("disp_off"),this}}App.Views.VolumeView=App.Views.BlockableView.extend(new e)})();