"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[83354],{67122:function(e,t,n){n.r(t),n(29305),n(32733),n(84701),n(81678),n(44962),n(89336),n(26448),n(4754),n(94),n(36947),n(78557),n(90076),n(45309),n(83994),n(82367);var i=n(44797);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 s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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,r=e.responseSent,s=e.responseReceived,u=new a(t,n,r,s);this.updateTimeOffset(u),this.pings>=3?this.pollingInterval=6e4:this.pings++,i.A.trigger(this,"update",[null,this.getTimeOffset(),this.getPing()])}},{key:"onPingRequestErrorCallback",value:function(e){console.error(e),i.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}}]);