Files
pgsql-jellyfin/publish_test4/wwwroot/19907.519b327b385a50a70817.chunk.js
2026-07-08 13:46:27 -04:00

2 lines
9.3 KiB
JavaScript

/*! 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&&t<y.length;t++){var r,l=y[t],d=p.p,f=l[2];a>3?(r=f===n)&&(u=l[(o=l[4])?5:(o=3,3)],l[4]=l[5]=e):l[0]<=d&&((r=a<2&&d<l[1])?(o=0,p.v=n,p.n=l[1]):d<f&&(r=a<3||l[0]>n||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<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=i(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}var d=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.manager=null,this.lastPlayQueueUpdate=null,this.playlist=[]},(t=[{key:"init",value:function(e){this.manager=e}},{key:"updatePlayQueue",value:function(e,t){var a=this;if(t.LastUpdate=new Date(t.LastUpdate),t.LastUpdate.getTime()<=this.getLastUpdateTime())console.debug("SyncPlay updatePlayQueue: ignoring old update",t);else{console.debug("SyncPlay updatePlayQueue:",t);var n=e.serverInfo().Id;this.onPlayQueueUpdate(e,t,n).then((function(n){if(t.LastUpdate.getTime()<a.getLastUpdateTime())throw console.warn("SyncPlay updatePlayQueue: trying to apply old update.",t),new Error("Trying to apply old update");if(a.manager.isRemote())console.warn("SyncPlay updatePlayQueue: remote player has own SyncPlay manager.");else{var r=a.manager.getPlayerWrapper();switch(t.Reason){case"NewPlaylist":a.manager.isFollowingGroupPlayback()?a.startPlayback(e):a.manager.followGroupPlayback(e).then((function(){a.startPlayback(e)}));break;case"SetCurrentItem":case"NextItem":case"PreviousItem":r.onQueueUpdate();var l=a.getCurrentPlaylistItemId();a.setCurrentPlaylistItem(e,l);break;case"RemoveItems":r.onQueueUpdate();var i=n.playQueueUpdate.PlayingItemIndex,o=-1===i?null:n.playlist[i].PlaylistItemId,u=a.getCurrentPlaylistItemId();o!==u&&a.setCurrentPlaylistItem(e,u);break;case"MoveItem":case"Queue":case"QueueNext":r.onQueueUpdate();break;case"RepeatMode":r.localSetRepeatMode(a.getRepeatMode());break;case"ShuffleMode":r.localSetQueueShuffleMode(a.getShuffleMode());break;default:console.error("SyncPlay updatePlayQueue: unknown reason for update:",t.Reason)}}})).catch((function(e){console.warn("SyncPlay updatePlayQueue:",e)}))}}},{key:"onPlayQueueUpdate",value:function(e,t,a){var n=this,r=this.lastPlayQueueUpdate,i=this.playlist,o=t.Playlist.map((function(e){return e.ItemId}));return o.length?l.getItemsForPlayback(e,{Ids:o.join(",")}).then((function(u){return l.translateItemsForPlayback(e,u.Items,{ids:o,serverId:a}).then((function(e){if(n.lastPlayQueueUpdate&&t.LastUpdate.getTime()<=n.getLastUpdateTime())throw new Error("Trying to apply old update");for(var a=0;a<e.length;a++)e[a].PlaylistItemId=t.Playlist[a].PlaylistItemId;return n.lastPlayQueueUpdate=t,n.playlist=e,{playQueueUpdate:r,playlist:i}}))})):this.lastPlayQueueUpdate&&t.LastUpdate.getTime()<=this.getLastUpdateTime()?Promise.reject(new Error("Trying to apply old update")):(this.lastPlayQueueUpdate=t,this.playlist=[],Promise.resolve({playQueueUpdate:r,playlist:i}))}},{key:"scheduleReadyRequestOnPlaybackStart",value:function(e,t){var a=this;l.waitForEventOnce(this.manager,"playbackstart",l.WaitForEventDefaultTimeout,["playbackerror"]).then(y(o().m((function t(){var n,r,i,u,s,y,c;return o().w((function(t){for(;;)switch(t.n){case 0:if(console.debug("SyncPlay scheduleReadyRequestOnPlaybackStart: local pause and notify server."),(n=a.manager.getPlayerWrapper()).localPause(),r=new Date,i=a.manager.timeSyncCore.localDateToRemote(r),!n.currentTimeAsync){t.n=2;break}return t.n=1,n.currentTimeAsync();case 1:c=t.v,t.n=3;break;case 2:c=n.currentTime();case 3:u=c,s=Math.round(u*l.TicksPerMillisecond),y=n.isPlaying(),e.requestSyncPlayReady({When:i.toISOString(),PositionTicks:s,IsPlaying:y,PlaylistItemId:a.getCurrentPlaylistItemId()});case 4:return t.a(2)}}),t)})))).catch((function(l){console.error("Error while waiting for `playbackstart` event!",t,l),a.manager.isSyncPlayEnabled()||(0,r.A)(n.Ay.translate("MessageSyncPlayErrorMedia")),a.manager.haltGroupPlayback(e)}))}},{key:"startPlayback",value:function(e){if(!this.manager.isFollowingGroupPlayback())return console.debug("SyncPlay startPlayback: ignoring, not following playback."),Promise.reject();if(this.isPlaylistEmpty())console.debug("SyncPlay startPlayback: empty playlist.");else{var t=this.manager.getLastPlaybackCommand(),a=0;if(t&&t.EmittedAt.getTime()>=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}}]);