"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[49755,60138,83354],{55125:function(e,t,n){n.r(t),n(29305),n(32733),n(84701),n(81678),n(44962),n(4754),n(94),n(36947),n(78557),n(83994),n(82367);var r=n(90381),i=n(44797),a=n(44305),o=n(4438),s=n(95937);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function u(e,t){for(var n=0;n8&&this.measurements.shift();var t=this.measurements.slice(0);t.sort((function(e,t){return e.getDelay()-t.getDelay()})),this.measurement=t[0]}},{key:"requestPing",value:function(){return console.warn("SyncPlay TimeSync requestPing: override this method!"),Promise.reject(new Error("Not implemented."))}},{key:"internalRequestPing",value:function(){var e=this;this.poller||this.pingStop||(this.poller=setTimeout((function(){e.poller=null,e.requestPing().then((function(t){return e.onPingResponseCallback(t)})).catch((function(t){return e.onPingRequestErrorCallback(t)})).finally((function(){return e.internalRequestPing()}))}),this.pollingInterval))}},{key:"onPingResponseCallback",value:function(e){var t=e.requestSent,n=e.requestReceived,i=e.responseSent,a=e.responseReceived,o=new u(t,n,i,a);this.updateTimeOffset(o),this.pings>=3?this.pollingInterval=6e4:this.pings++,r.A.trigger(this,"update",[null,this.getTimeOffset(),this.getPing()])}},{key:"onPingRequestErrorCallback",value:function(e){console.error(e),r.A.trigger(this,"update",[e,null,null])}},{key:"resetMeasurements",value:function(){this.measurement=null,this.measurements=[]}},{key:"startPing",value:function(){this.pingStop=!1,this.internalRequestPing()}},{key:"stopPing",value:function(){this.pingStop=!0,this.poller&&(clearTimeout(this.poller),this.poller=null)}},{key:"forceUpdate",value:function(){this.stopPing(),this.pollingInterval=1e3,this.pings=0,this.startPing()}},{key:"remoteDateToLocal",value:function(e){return new Date(e.getTime()-this.getTimeOffset())}},{key:"localDateToRemote",value:function(e){return new Date(e.getTime()+this.getTimeOffset())}}])}();t.default=c},73391:function(e,t,n){n.r(t),n(29305),n(32733),n(84701),n(81678),n(44962),n(86584),n(4754),n(94),n(36947),n(78557),n(83994),n(82367);var r=n(20919);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];this.manager.getApiClient().requestSyncPlayRemoveFromPlaylist({ClearPlaylist:!0,ClearPlayingItem:e})}},{key:"removeFromPlaylist",value:function(e){this.manager.getApiClient().requestSyncPlayRemoveFromPlaylist({PlaylistItemIds:e})}},{key:"movePlaylistItem",value:function(e,t){this.manager.getApiClient().requestSyncPlayMovePlaylistItem({PlaylistItemId:e,NewIndex:t})}},{key:"queue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Queue",n=this.manager.getApiClient();e.items?r.translateItemsForPlayback(n,e.items,e).then((function(e){var r=e.map((function(e){return e.Id}));n.requestSyncPlayQueue({ItemIds:r,Mode:t})})):r.getItemsForPlayback(n,{Ids:e.ids.join(",")}).then((function(i){r.translateItemsForPlayback(n,i.Items,e).then((function(e){var r=e.map((function(e){return e.Id}));n.requestSyncPlayQueue({ItemIds:r,Mode:t})}))}))}},{key:"queueNext",value:function(e){this.queue(e,"QueueNext")}},{key:"nextItem",value:function(){this.manager.getApiClient().requestSyncPlayNextItem({PlaylistItemId:this.manager.getQueueCore().getCurrentPlaylistItemId()})}},{key:"previousItem",value:function(){this.manager.getApiClient().requestSyncPlayPreviousItem({PlaylistItemId:this.manager.getQueueCore().getCurrentPlaylistItemId()})}},{key:"setRepeatMode",value:function(e){this.manager.getApiClient().requestSyncPlaySetRepeatMode({Mode:e})}},{key:"setShuffleMode",value:function(e){this.manager.getApiClient().requestSyncPlaySetShuffleMode({Mode:e})}},{key:"toggleShuffleMode",value:function(){var e=this.manager.getQueueCore().getShuffleMode();e="Sorted"===e?"Shuffle":"Sorted",this.manager.getApiClient().requestSyncPlaySetShuffleMode({Mode:e})}}],t&&a(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();t.default=s},86004:function(e,t,n){n.r(t),n(29305),n(32733),n(84701),n(81678),n(24776),n(14382),n(44962),n(4754),n(94),n(9698),n(36947),n(78557),n(96054),n(83994),n(82367);var r=n(20919),i=n(55125),a=n(629),o=n(19907),s=n(73391),l=n(71866),u=n(5898),c=n(44797);function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function f(e,t){for(var n=0;n2&&void 0!==arguments[2]&&arguments[2];if(this.isSyncPlayEnabled()){if(t.GroupId===this.groupInfo.GroupId)return void console.debug("SyncPlay enableSyncPlay: group ".concat(this.groupInfo.GroupId," already joined."));console.warn("SyncPlay enableSyncPlay: switching from group ".concat(this.groupInfo.GroupId," to group ").concat(t.GroupId,".")),this.disableSyncPlay(!1),i=!1}this.groupInfo=t,this.syncPlayEnabledAt=t.LastUpdatedAt,this.playerWrapper.bindToPlayer(),c.A.trigger(this,"enabled",[!0]),r.waitForEventOnce(this.timeSyncCore,"time-sync-server-update").then((function(){n.syncPlayReady=!0,n.processCommand(n.queuedCommand,e),n.queuedCommand=null})),this.syncPlayReady=!1,this.followingGroupPlayback=!0,this.timeSyncCore.forceUpdate(),i&&(0,l.A)(u.Ay.translate("MessageSyncPlayEnabled"))}},{key:"disableSyncPlay",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.syncPlayEnabledAt=null,this.syncPlayReady=!1,this.followingGroupPlayback=!0,this.lastPlaybackCommand=null,this.queuedCommand=null,this.playbackCore.syncEnabled=!1,c.A.trigger(this,"enabled",[!1]),this.playerWrapper.unbindFromPlayer(),e&&(0,l.A)(u.Ay.translate("MessageSyncPlayDisabled"))}},{key:"isSyncPlayEnabled",value:function(){return null!==this.syncPlayEnabledAt}},{key:"getGroupInfo",value:function(){return this.groupInfo}},{key:"getStats",value:function(){return{TimeSyncDevice:this.timeSyncCore.getActiveDeviceName(),TimeSyncOffset:this.timeSyncCore.getTimeOffset().toFixed(2),PlaybackDiff:this.playbackCore.playbackDiffMillis.toFixed(2),SyncMethod:this.syncMethod}}},{key:"isPlaybackActive",value:function(){return this.playerWrapper.isPlaybackActive()}},{key:"isRemote",value:function(){return this.playerWrapper.isRemote()}},{key:"isPlaylistEmpty",value:function(){return this.queueCore.isPlaylistEmpty()}},{key:"isPlaying",value:function(){return!!this.lastPlaybackCommand&&"Unpause"===this.lastPlaybackCommand.Command}},{key:"showSyncIcon",value:function(e){this.syncMethod=e,c.A.trigger(this,"syncing",[!0,this.syncMethod])}},{key:"clearSyncIcon",value:function(){this.syncMethod="None",c.A.trigger(this,"syncing",[!1,this.syncMethod])}}],t&&f(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();t.default=m},95937:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){for(var n=0;n