function Zone(e,t,n){this.constructor=function(){var r=this;this.master=e,this.slaves=t||[],this.slaveDevices=[],this.slaves.forEach(function(e){var t=funcObj.devCon.getDevice(e);t&&r.slaveDevices.push(t)}),this.masterDevice=funcObj.devCon.getDevice(e),this.buildDevices(),this["ad-hoc"]=n,this.devices.forEach(function(e){$(e).on("DISPLAY_VOLUME_CHANGED",function(){r.blocked||r.onMemberVolumeChanged()})}),this.oldMaxVolume=null},this.buildDevices=function(){this.devices=this.slaveDevices.concat([this.masterDevice])},this.syncDevices=function(){this.slaveDevices=this.slaves.map(function(e){return funcObj.devCon.getDevice(e)}),this.buildDevices()},this.onMemberVolumeChanged=function(){!this.blocked&&this.didMaxVolumeChange()&&$(this).trigger("MAX_VOLUME_CHANGED",this.getMaxVolume())},this.didMaxVolumeChange=function(){if(this.oldMaxVolume){var e=this.getMaxDisplayVolume();return this.oldMaxVolume!==e?(this.oldMaxVolume=e,!0):!1}return this.oldMaxVolume=this.getMaxDisplayVolume(),!0},this.getMaxVolume=function(){if(this.devices&&this.devices.length>0){var e=0;return this.devices.forEach(function(t){if(t){var n=t.getCachedVolume();n>e&&(e=n)}}),e}return null},this.getMaxDisplayVolume=function(){if(this.devices&&this.devices.length>0){var e=0;return this.devices.forEach(function(t){var n=t.displayVolume;n>e&&(e=n)}),e}return null},this.getDeviceNamesForDisplay=function(){var e=this.masterDevice.getDisplayName(),t=this.slaveDevices.map(function(e){if(e)return e.getDisplayName()});for(var n=0;n<t.length;n++)n===t.length-1?e+=" & "+t[n]:n<t.length-1&&(e+=", "+t[n]);return e},this.setDisplayVolumeDelta=function(e,t){this.devices.forEach(function(n){n.setVolumeDelta(e,t)})},this.setMaxDisplayVolume=function(e,t){var n=this.getMaxDisplayVolume(),r=e-n;this.devices.forEach(function(e){e.markStartingVolume()}),this.setDisplayVolumeDelta(r,t)},this.constructor()};