(function(){function e(){this.initialize=function(e){this.primaryDevice=e.primaryDevice||null,this.secondaryDevices=e.secondaryDevices||[],this.primaryVolumeView=null,this.secondaryVolumeViews=[],this.zoneVolumeView=null,this.events={},this.renderedOnce=!1,this.events[vdown+" .volume_drawer_close"]="close"},this.destroy=function(){this.primaryVolumeView&&this.primaryVolumeView.detachHandlers(),this.secondaryVolumeViews.forEach(function(e){e.detachHandlers()}),this.zoneVolumeView&&this.zoneVolumeView.detachHandlers()},this.setSecondaryDevices=function(e){this.secondaryDevices=e},this.setPrimaryDevice=function(e){this.primaryDevice=e;var t=this;e.getZone()&&(this.zone=e.getZone())},this.destroy=function(){this.primaryVolumeView&&this.primaryVolumeView.destroy(),this.secondaryVolumeViews.forEach(function(e){e.destroy()}),this.secondaryVolumeViews=[],this.zoneVolumeView&&this.zoneVolumeView.destroy()},this.render=function(){var e=this;this.destroy();var t=this.$el;t.empty(),t.addClass("volume-shade-view");var n="<div class='zone_volume'></div><div class='device_volumes'></div>",r=_.template(n);this.$el.html(r());var i=this.secondaryDevices&&this.secondaryDevices.length>0;return this.primaryVolumeView=new App.Views.VolumeView({device:this.primaryDevice,showTitle:i}),this.primaryVolumeView.$el.addClass("secondary_volume"),t.find(".device_volumes").append(this.primaryVolumeView.render().el),i&&(this.secondaryDevices.forEach(function(n){var r=new App.Views.VolumeView({device:n});r.$el.addClass("secondary_volume"),t.find(".device_volumes").append(r.render().el),e.secondaryVolumeViews.push(r)}),this.zoneVolumeView=new App.Views.ZoneVolumeView({device:this.primaryDevice,zone:this.zone}),this.$el.find(".zone_volume").append(this.zoneVolumeView.render().el)),i||this.$el.find(".zone_volume").hide(),this.delegateEvents(),this}}App.Views.VolumeListView=Backbone.View.extend(new e)})();