/*! For license information please see 19907.519b327b385a50a70817.chunk.js.LICENSE.txt */ "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[19907],{19907:function(e,t,a){a.r(t),a(29305),a(32733),a(84701),a(81678),a(2623),a(44962),a(86584),a(89336),a(4754),a(10849),a(70389),a(94),a(36947),a(26437),a(52697),a(78557),a(90076),a(83994),a(82367);var n=a(5898),r=a(71866),l=a(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 o(){var e,t,a="function"==typeof Symbol?Symbol:{},n=a.iterator||"@@iterator",r=a.toStringTag||"@@toStringTag";function l(a,n,r,l){var o=n&&n.prototype instanceof s?n:s,y=Object.create(o.prototype);return u(y,"_invoke",function(a,n,r){var l,o,u,s=0,y=r||[],c=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,a){return l=t,o=0,u=e,p.n=a,i}};function d(a,n){for(o=a,u=n,t=0;!c&&s&&!r&&t3?(r=f===n)&&(u=l[(o=l[4])?5:(o=3,3)],l[4]=l[5]=e):l[0]<=d&&((r=a<2&&dn||n>f)&&(l[4]=a,l[5]=n,p.n=f,o=0))}if(r||a>1)return i;throw c=!0,n}return function(r,y,f){if(s>1)throw TypeError("Generator is already running");for(c&&1===y&&d(y,f),o=y,u=f;(t=o<2?e:u)||!c;){l||(o?o<3?(o>1&&(p.n=-1),d(o,u)):p.n=u:p.v=u);try{if(s=2,l){if(o||(r="next"),t=l[r]){if(!(t=t.call(l,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,o<2&&(o=0)}else 1===o&&(t=l.return)&&t.call(l),o<2&&(u=TypeError("The iterator does not provide a '"+r+"' method"),o=1);l=e}else if((t=(c=p.n<0)?u:a.call(n,p))!==i)break}catch(t){l=e,o=1,u=t}finally{s=1}}return{value:t,done:c}}}(a,r,l),!0),y}var i={};function s(){}function y(){}function c(){}t=Object.getPrototypeOf;var p=[][n]?t(t([][n]())):(u(t={},n,(function(){return this})),t),d=c.prototype=s.prototype=Object.create(p);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,u(e,r,"GeneratorFunction")),e.prototype=Object.create(d),e}return y.prototype=c,u(d,"constructor",c),u(c,"constructor",y),y.displayName="GeneratorFunction",u(c,r,"GeneratorFunction"),u(d),u(d,r,"Generator"),u(d,n,(function(){return this})),u(d,"toString",(function(){return"[object Generator]"})),(o=function(){return{w:l,m:f}})()}function u(e,t,a,n){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}u=function(e,t,a,n){if(t)r?r(e,t,{value:a,enumerable:!n,configurable:!n,writable:!n}):e[t]=a;else{var l=function(t,a){u(e,t,(function(e){return this._invoke(t,a,e)}))};l("next",0),l("throw",1),l("return",2)}},u(e,t,a,n)}function s(e,t,a,n,r,l,i){try{var o=e[l](i),u=o.value}catch(e){return void a(e)}o.done?t(u):Promise.resolve(u).then(n,r)}function y(e){return function(){var t=this,a=arguments;return new Promise((function(n,r){var l=e.apply(t,a);function i(e){s(l,n,r,i,o,"next",e)}function o(e){s(l,n,r,i,o,"throw",e)}i(void 0)}))}}function c(e,t){for(var a=0;a=this.getLastUpdateTime())a=this.manager.getPlaybackCore().estimateCurrentTicks(t.PositionTicks,t.When);else{var l=this.getStartPositionTicks(),i=this.getLastUpdate();a=this.manager.getPlaybackCore().estimateCurrentTicks(l,i)}var o=e.serverInfo().Id;this.scheduleReadyRequestOnPlaybackStart(e,"startPlayback"),this.manager.getPlayerWrapper().localPlay({ids:this.getPlaylistAsItemIds(),startPositionTicks:a,startIndex:this.getCurrentPlaylistIndex(),serverId:o}).catch((function(e){console.error(e),(0,r.A)(n.Ay.translate("MessageSyncPlayErrorMedia"))}))}}},{key:"setCurrentPlaylistItem",value:function(e,t){this.manager.isFollowingGroupPlayback()?(this.scheduleReadyRequestOnPlaybackStart(e,"setCurrentPlaylistItem"),this.manager.getPlayerWrapper().localSetCurrentPlaylistItem(t)):console.debug("SyncPlay setCurrentPlaylistItem: ignoring, not following playback.")}},{key:"getCurrentPlaylistIndex",value:function(){return this.lastPlayQueueUpdate?this.lastPlayQueueUpdate.PlayingItemIndex:-1}},{key:"getCurrentPlaylistItemId",value:function(){if(this.lastPlayQueueUpdate){var e=this.lastPlayQueueUpdate.PlayingItemIndex;return-1===e?null:this.playlist[e].PlaylistItemId}return null}},{key:"getPlaylist",value:function(){return this.playlist.slice(0)}},{key:"isPlaylistEmpty",value:function(){return 0===this.playlist.length}},{key:"getLastUpdate",value:function(){return this.lastPlayQueueUpdate?this.lastPlayQueueUpdate.LastUpdate:null}},{key:"getLastUpdateTime",value:function(){return this.lastPlayQueueUpdate?this.lastPlayQueueUpdate.LastUpdate.getTime():0}},{key:"getStartPositionTicks",value:function(){return this.lastPlayQueueUpdate?this.lastPlayQueueUpdate.StartPositionTicks:0}},{key:"getPlaylistAsItemIds",value:function(){return this.lastPlayQueueUpdate?this.lastPlayQueueUpdate.Playlist.map((function(e){return e.ItemId})):[]}},{key:"getRepeatMode",value:function(){return this.lastPlayQueueUpdate?this.lastPlayQueueUpdate.RepeatMode:"Sorted"}},{key:"getShuffleMode",value:function(){return this.lastPlayQueueUpdate?this.lastPlayQueueUpdate.ShuffleMode:"RepeatNone"}}])&&c(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();t.default=d}}]);