diff --git a/VERSION b/VERSION index a91ceb0062..ed59bd1eb1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.33.1 +3.33.2 diff --git a/dist/rx-player.d.ts b/dist/rx-player.d.ts index ed3905868f..b468ec4aa4 100644 --- a/dist/rx-player.d.ts +++ b/dist/rx-player.d.ts @@ -1,3 +1,3 @@ -import RxPlayer from "./_esm5.processed/index"; +import RxPlayer from "./_esm5.processed/minimal"; export default RxPlayer; diff --git a/dist/rx-player.js b/dist/rx-player.js index 7643da783a..b651574086 100644 --- a/dist/rx-player.js +++ b/dist/rx-player.js @@ -53141,7 +53141,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) { // Workaround to support Firefox autoplay on FF 42. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624 videoElement.preload = "auto"; - _this.version = /* PLAYER_VERSION */"3.33.1"; + _this.version = /* PLAYER_VERSION */"3.33.2"; _this.log = log/* default */.Z; _this.state = "STOPPED"; _this.videoElement = videoElement; @@ -55591,7 +55591,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) { }]); return Player; }(event_emitter/* default */.Z); -Player.version = /* PLAYER_VERSION */"3.33.1"; +Player.version = /* PLAYER_VERSION */"3.33.2"; /* harmony default export */ var public_api = (Player); ;// CONCATENATED MODULE: ./src/core/api/index.ts /** diff --git a/dist/rx-player.min.d.ts b/dist/rx-player.min.d.ts index ed3905868f..b468ec4aa4 100644 --- a/dist/rx-player.min.d.ts +++ b/dist/rx-player.min.d.ts @@ -1,3 +1,3 @@ -import RxPlayer from "./_esm5.processed/index"; +import RxPlayer from "./_esm5.processed/minimal"; export default RxPlayer; diff --git a/dist/rx-player.min.js b/dist/rx-player.min.js index 16dcabd058..f499073406 100644 --- a/dist/rx-player.min.js +++ b/dist/rx-player.min.js @@ -1,2 +1,2 @@ /*! For license information please see rx-player.min.js.LICENSE.txt */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RxPlayer=t():e.RxPlayer=t()}(self,(function(){return function(){var e={3774:function(e,t,n){"use strict";n.d(t,{J:function(){return a},c:function(){return o}});var r=n(1946),i=n(2203).Z?void 0:window,a=void 0===i?void 0:(0,r.Z)(i.MediaSource)?(0,r.Z)(i.MozMediaSource)?(0,r.Z)(i.WebKitMediaSource)?i.MSMediaSource:i.WebKitMediaSource:i.MozMediaSource:i.MediaSource,o={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4}},3666:function(e,t,n){"use strict";n.d(t,{$u:function(){return h},GQ:function(){return y},SB:function(){return f},YM:function(){return l},fq:function(){return u},kD:function(){return s},lV:function(){return g},l_:function(){return m},op:function(){return v},vS:function(){return c},vU:function(){return d},yS:function(){return p}});var r,i,a,o=n(2203),s=!1,u=!1,l=!1,d=!1,c=!1,f=!1,v=!1,p=!1,h=!1,m=!1,g=!1,y=!1;o.Z||(void 0!==window.MSInputMethodContext&&void 0!==document.documentMode?(u=!0,l=!0):"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&/(Trident|Edge)\//.test(navigator.userAgent)?l=!0:-1!==navigator.userAgent.toLowerCase().indexOf("edg/")?s=!0:-1!==navigator.userAgent.toLowerCase().indexOf("firefox")?d=!0:"string"==typeof navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)?f=!0:(Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>=0||"[object SafariRemoteNotification]"===(null===(i=null===(r=window.safari)||void 0===r?void 0:r.pushNotification)||void 0===i?void 0:i.toString())||/Safari\/(\d+)/.test(navigator.userAgent)&&/Version\/(\d+)/.test(navigator.userAgent)&&-1!==(null===(a=navigator.vendor)||void 0===a?void 0:a.indexOf("Apple"))&&!/Chrome\/(\d+)/.test(navigator.userAgent)&&!/Chromium\/(\d+)/.test(navigator.userAgent))&&(c=!0),/SamsungBrowser/.test(navigator.userAgent)&&(v=!0),-1!==navigator.userAgent.indexOf("PlayStation 5")?g=!0:/Tizen/.test(navigator.userAgent)?p=!0:/[Ww]eb[O0]S/.test(navigator.userAgent)?(h=!0,/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)||(/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent))):/[Pp]anasonic/.test(navigator.userAgent)?m=!0:-1!==navigator.userAgent.indexOf("Xbox")&&(y=!0))},5767:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e){var t=e.textTracks;if(!(0,i.Z)(t)){for(var n=0;n=0;o--)if("track"===a[o].nodeName)try{e.removeChild(a[o])}catch(e){r.Z.warn("Compat: Could not remove text track child from element.")}}e.src="",e.removeAttribute("src")}},3038:function(e,t,n){"use strict";n.d(t,{Dl:function(){return x},M4:function(){return P},N8:function(){return k},O0:function(){return y},Q$:function(){return M},Q4:function(){return S},RV:function(){return I},S1:function(){return f},XR:function(){return p},bQ:function(){return C},it:function(){return g},k6:function(){return E},kJ:function(){return b},kk:function(){return Z},qo:function(){return R},u_:function(){return T},w0:function(){return m},x6:function(){return A},y4:function(){return w},zU:function(){return _}});var r=n(6872),i=n(6923),a=n(1946),o=n(8894),s=n(5095),u=n(2203),l=["","webkit","moz","ms"],d=u.Z||null==window.devicePixelRatio||0===window.devicePixelRatio?1:window.devicePixelRatio;function c(e,t){return t.filter((function(t){return function(e,t){var n=document.createElement(e.tagName),r="on"+t;return r in n||(n.setAttribute(r,"return;"),"function"==typeof n[r])}(e,t)}))[0]}function f(e,t){var n,r=function(e,t){return e.reduce((function(e,n){return e.concat((void 0===t?l:t).map((function(e){return e+n})))}),[])}(e,t);return function(e,t,a){if(!a.isCancelled()){if(e instanceof HTMLElement){if(void 0===n&&(n=c(e,r)),!(0,i.Z)(n))return void 0;e.addEventListener(n,t),a.register((function(){void 0!==n&&e.removeEventListener(n,t)}))}r.forEach((function(n){var r=!1;"function"==typeof e.addEventListener?e.addEventListener(n,t):(r=!0,e["on"+n]=t),a.register((function(){"function"==typeof e.removeEventListener&&e.removeEventListener(n,t),r&&delete e["on"+n]}))}))}}}function v(e){var t,n=document;null!=n.hidden?t="":null!=n.mozHidden?t="moz":null!=n.msHidden?t="ms":null!=n.webkitHidden&&(t="webkit");var r=(0,i.Z)(t)?t+"Hidden":"hidden",a=(0,i.Z)(t)?t+"visibilitychange":"visibilitychange",o=document[r],u=new s.Z(!o,e);return D(document,a,(function(){var e=!document[r];u.setValueIfChanged(e)}),e),u}function p(e){var t,n=v(e),i=new s.Z(!0,e);return e.register((function(){clearTimeout(t),t=void 0})),n.onUpdate((function(e){if(clearTimeout(t),t=void 0,!e){var n=r.Z.getCurrent().INACTIVITY_DELAY;t=window.setTimeout((function(){i.setValueIfChanged(!1)}),n)}i.setValueIfChanged(!0)}),{clearSignal:e,emitCurrentValue:!0}),i}function h(e,t){var n=t.width,r=t.height/(e.clientHeight/e.clientWidth);return Math.min(n,r)}function m(e,t){var n=e;if(!0===n.webkitSupportsPresentationMode&&"function"==typeof n.webkitSetPresentationMode){var r="picture-in-picture"===n.webkitPresentationMode,i=new s.Z({isEnabled:r,pipWindow:null},t);return D(n,"webkitpresentationmodechanged",(function(){var e="picture-in-picture"===n.webkitPresentationMode;i.setValue({isEnabled:e,pipWindow:null})}),t),i}var a=document.pictureInPictureElement===n,o=new s.Z({isEnabled:a,pipWindow:null},t);return D(n,"enterpictureinpicture",(function(e){var t;o.setValue({isEnabled:!0,pipWindow:null!==(t=e.pictureInPictureWindow)&&void 0!==t?t:null})}),t),D(n,"leavepictureinpicture",(function(){o.setValue({isEnabled:!1,pipWindow:null})}),t),o}function g(e,t){var n,i=v(t),a=new s.Z(!0,t);return t.register((function(){clearTimeout(n),n=void 0})),i.onUpdate(o,{clearSignal:t}),e.onUpdate(o,{clearSignal:t}),o(),a;function o(){if(clearTimeout(n),n=void 0,e.getValue().isEnabled||i.getValue())a.setValueIfChanged(!0);else{var t=r.Z.getCurrent().INACTIVITY_DELAY;n=window.setTimeout((function(){a.setValueIfChanged(!1)}),t)}}}function y(e,t,n){var r=new s.Z(e.clientWidth*d,n),i=o.Z;t.onUpdate(l,{clearSignal:n}),D(window,"resize",l,n);var u=window.setInterval(l,2e4);return l(),n.register((function(){i(),clearInterval(u)})),r;function l(){i();var n=t.getValue();if(n.isEnabled)if((0,a.Z)(n.pipWindow))r.setValueIfChanged(1/0);else{var s=n.pipWindow,u=h(e,s),l=function(){r.setValueIfChanged(h(e,s)*d)};s.addEventListener("resize",l),i=function(){s.removeEventListener("resize",l),i=o.Z},r.setValueIfChanged(u*d)}else r.setValueIfChanged(e.clientWidth*d)}}f(["loadedmetadata"]),f(["timeupdate"]);var _=f(["fullscreenchange","FullscreenChange"],l.concat("MS")),b=f(["addtrack"]),S=f(["removetrack"]),T=f(["sourceopen","webkitsourceopen"]),E=f(["sourceclose","webkitsourceclose"]),k=f(["sourceended","webkitsourceended"]),w=f(["update"]),A=f(["removesourcebuffer"]),I=f(["keymessage","message"]),Z=f(["keyadded","ready"]),x=f(["keyerror","error"]),R=f(["keystatuseschange"]),M=f(["seeking"]),C=f(["seeked"]),P=f(["ended"]);function D(e,t,n,r){e.addEventListener(t,n),r.register((function(){e.removeEventListener(t,n)}))}},2203:function(e,t){"use strict";var n="undefined"==typeof window;t.Z=n},1988:function(e,t,n){"use strict";function r(e){return"function"==typeof window.VTTCue&&e instanceof window.VTTCue}n.d(t,{Z:function(){return r}})},7253:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e,t,n){if(e>=t)return r.Z.warn("Compat: Invalid cue times: "+e+" - "+t),null;if((0,i.Z)(window.VTTCue)){if((0,i.Z)(window.TextTrackCue))throw new Error("VTT cues not supported in your target");return new TextTrackCue(e,t,n)}return new VTTCue(e,t,n)}},1669:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(3666);function i(){return r.op}},6872:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r={DEFAULT_UNMUTED_VOLUME:.1,DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_MANUAL_BITRATE_SWITCHING_MODE:"seamless",DEFAULT_ENABLE_FAST_SWITCHING:!0,DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless",DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:-.7,video:-.1,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUTO_PLAY:!1,DEFAULT_SHOW_NATIVE_SUBTITLE:!0,DEFAULT_STOP_AT_END:!0,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MINIMUM_MAX_BUFFER_AHEAD:{text:120},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_INITIAL_BITRATES:{audio:0,video:0,other:0},DEFAULT_MIN_BITRATES:{audio:0,video:0,other:0},DEFAULT_MAX_BITRATES:{audio:1/0,video:1/0,other:1/0},INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_WHEN_HIDDEN:!1,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_LIMIT_VIDEO_WIDTH:!1,DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,FORCE_DISCONTINUITY_SEEK_DELAY:5e3,BITRATE_REBUFFERING_RATIO:1.5,BUFFER_GC_GAPS:{CALM:240,BEEFY:30},DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE:1/0,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:250,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_ENTER_BUFFER_BASED_ALGO:10,ABR_EXIT_BUFFER_BASED_ALGO:5,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.005,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_VIDEO_CODECS:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/webm;codecs="vp8"'],EME_DEFAULT_AUDIO_CODECS:['audio/mp4;codecs="mp4a.40.2"',"audio/webm;codecs=opus"],EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAPTATION_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0},image:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5},i=n(8026);function a(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=e.length||(e[t].enabled=!0)}(this._audioTracks.map((function(e){return e.nativeTrack})),e)},t}(a.Z);function f(e){for(var t=0;t=0){var i=e instanceof ArrayBuffer?new Uint8Array(e):e,a=JSON.parse((0,Z.uR)(i)),o=(0,A.K)(a.keys[0].k),s=(0,A.K)(a.keys[0].kid);n(t._vid.webkitAddKey(t._key,o,s,""))}else n(t._vid.webkitAddKey(t._key,e,null,""))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){n._vid.webkitGenerateKeyRequest(n._key,t),e()}))},n.close=function(){var e=this;return new Promise((function(t){e._closeSession(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},t}(_.Z),M=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){var t=this;return S((function(){if(!x(e))throw new Error("Video not attached to the MediaKeys");t._videoElement=e}))},t.createSession=function(){if(null==this._videoElement)throw new Error("Video not attached to the MediaKeys");return new R(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var C=n(9252),P=n(6968);function D(e,t){var n=e;return S((function(){if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");n.webkitSetMediaKeys(t)}))}var N=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._serverCertificate=r,i._videoElement=t,i._keyType=n,i._unbindSession=I.Z,i._closeSession=I.Z,i.closed=new Promise((function(e){i._closeSession=e})),i.keyStatuses=new Map,i.expiration=NaN,i}(0,a.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){if(void 0===t._nativeSession||void 0===t._nativeSession.update||"function"!=typeof t._nativeSession.update)return r("Unavailable WebKit key session.");try{var i;i=e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e.buffer),n(t._nativeSession.update(i))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r,i,a,o=n._videoElement;if(void 0===(null===(r=o.webkitKeys)||void 0===r?void 0:r.createSession))throw new Error("No WebKitMediaKeys API.");if(a=n._keyType,(0,C.Z)(a,"com.apple.fps")){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=function(e,t){var n=e instanceof Uint8Array?e:new Uint8Array(e),r=t instanceof Uint8Array?t:new Uint8Array(t);if((0,P.dN)(n,0)+4!==n.length)throw new Error("Unsupported WebKit initData.");var i=(0,Z.wV)(n),a=i.indexOf("skd://"),o=a>-1?i.substring(a+6):i,s=(0,Z.TZ)(o),u=0,l=new Uint8Array(n.byteLength+4+s.byteLength+4+r.byteLength);return l.set(n),u+=n.length,l.set((0,P.O_)(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set((0,P.O_)(r.byteLength),u),u+=4,l.set(r,u),l}(t,n._serverCertificate)}else i=t;var s=o.webkitKeys.createSession("video/mp4",i);if(null==s)throw new Error("Impossible to get the key sessions");n._listenEvent(s),n._nativeSession=s,e()}))},n.close=function(){var e=this;return new Promise((function(t,n){e._unbindSession(),e._closeSession(),void 0!==e._nativeSession?(e._nativeSession.close(),t()):n("No session to close.")}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},n._listenEvent=function(e){var t=this;this._unbindSession();var n=function(e){t.trigger(e.type,e)};["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.addEventListener(t,n),e.addEventListener("webkit"+t,n)})),this._unbindSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.removeEventListener(t,n),e.removeEventListener("webkit"+t,n)}))}},(0,m.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._nativeSession)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(_.Z),O=function(){function e(e){if(void 0===r)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new r(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0===this._videoElement)throw new Error("Video not attached to the MediaKeys");return D(this._videoElement,this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new N(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();function L(){if(void 0===r)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:r.isTypeSupported,createCustomMediaKeys:function(e){return new O(e)},setMediaKeys:function(e,t){if(null===t)return D(e,t);if(!(t instanceof O))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}var U=function(e){var t,n,i,a=B;if("standard"!==e&&("auto"!==e||(c.vS||c.SB)&&void 0!==r)||!v.Z&&(0,d.Z)(navigator.requestMediaKeySystemAccess)){var o,s;if("webkit"===e&&void 0!==r){n=(0,f.S1)(["needkey"]);var p=L();o=p.isTypeSupported,s=p.createCustomMediaKeys,a=p.setMediaKeys,i="webkit"}else if(x(HTMLVideoElement.prototype)){n=(0,f.S1)(["needkey"]);var m={isTypeSupported:function(e){var t=document.querySelector("video");return null==t&&(t=document.createElement("video")),null!=t&&"function"==typeof t.canPlayType&&!!t.canPlayType("video/mp4",e)},createCustomMediaKeys:function(e){return new M(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof M))throw new Error("Custom setMediaKeys is supposed to be called with old webkit custom MediaKeys.");return t._setVideo(e)}};o=m.isTypeSupported,s=m.createCustomMediaKeys,a=m.setMediaKeys,i="older-webkit"}else if(void 0!==r){n=(0,f.S1)(["needkey"]);var y=L();o=y.isTypeSupported,s=y.createCustomMediaKeys,a=y.setMediaKeys,i="webkit"}else if(c.fq&&void 0!==h){n=(0,f.S1)(["encrypted","needkey"]);var _={isTypeSupported:function(e,t){if(void 0===h)throw new Error("No MSMediaKeys API.");return void 0!==t?h.isTypeSupported(e,t):h.isTypeSupported(e)},createCustomMediaKeys:function(e){return new k(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof k))throw new Error("Custom setMediaKeys is supposed to be called with IE11 custom MediaKeys.");return t._setVideo(e)}};o=_.isTypeSupported,s=_.createCustomMediaKeys,a=_.setMediaKeys,i="ms"}else if(void 0!==T){n=(0,f.S1)(["encrypted","needkey"]);var b={isTypeSupported:function(e,t){if(void 0===T)throw new Error("No MozMediaKeys API.");return void 0!==t?T.isTypeSupported(e,t):T.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===T)throw new Error("No MozMediaKeys API.");return new T(e)},setMediaKeys:function(e,t){return S((function(){var n=e;if(void 0===n.mozSetMediaKeys||"function"!=typeof n.mozSetMediaKeys)throw new Error("Can't set video on MozMediaKeys.");return n.mozSetMediaKeys(t)}))}};o=b.isTypeSupported,s=b.createCustomMediaKeys,a=b.setMediaKeys,i="moz"}else{n=(0,f.S1)(["encrypted","needkey"]);var E=window.MediaKeys,w=function(){if(void 0===E)throw new u.Z("MEDIA_KEYS_NOT_SUPPORTED","No `MediaKeys` implementation found in the current browser.");if(void 0===E.isTypeSupported){throw new Error("This browser seems to be unable to play encrypted contents currently.Note: Some browsers do not allow decryption in some situations, like when not using HTTPS.")}};o=function(e){return w(),(0,l.Z)("function"==typeof E.isTypeSupported),E.isTypeSupported(e)},s=function(e){return w(),new E(e)},i="unknown"}t=function(e,t){if(!o(e))return Promise.reject(new Error("Unsupported key type"));for(var n=0;ne.length)return V.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var i=e.subarray(n,n+r),a={systemId:(0,z.Y)(i,8),data:i};W(t,a)?V.Z.warn("Compat: Duplicated PSSH found in initialization data, removing it."):t.push(a),n+=r}return n!==e.length?(V.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}]):t}(new Uint8Array(t));return{type:n,values:r}}var j=n(6872),q=n(5157),Y=n(5389),X=n(3274),Q=n(7714),$=n(770);function J(e){return $.Z.setState(e,null),F.setMediaKeys(e,null).then((function(){V.Z.info("DRM: MediaKeys disabled with success")})).catch((function(e){V.Z.error("DRM: Could not disable MediaKeys",e instanceof Error?e:"Unknown Error")}))}function ee(){return(ee=(0,i.Z)(s().mark((function e(t,n,r){var i,a,o,u,l,d,c;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.emeImplementation,a=n.keySystemOptions,o=n.loadedSessionsStore,u=n.mediaKeySystemAccess,l=n.mediaKeys,d=$.Z.getState(t),c=null!==d&&d.loadedSessionsStore!==o?d.loadedSessionsStore.closeAllSessions():Promise.resolve(),e.next=5,c;case 5:if(!r.isCancelled()){e.next=7;break}throw r.cancellationError;case 7:if($.Z.setState(t,{emeImplementation:i,keySystemOptions:a,mediaKeySystemAccess:u,mediaKeys:l,loadedSessionsStore:o}),t.mediaKeys!==l){e.next=10;break}return e.abrupt("return");case 10:V.Z.info("DRM: Attaching MediaKeys to the media element"),i.setMediaKeys(t,l).then((function(){V.Z.info("DRM: MediaKeys attached with success")})).catch((function(e){V.Z.error("DRM: Could not set MediaKeys",e instanceof Error?e:"Unknown Error")}));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(e){if(""===e.sessionId)return!1;var t=e.keyStatuses,n=[];return t.forEach((function(e){n.push(e)})),n.length<=0?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses",e.sessionId),!1):(0,Q.Z)(n,"expired")?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has an expired key",e.sessionId),!1):(0,Q.Z)(n,"internal-error")?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has a key with an internal-error",e.sessionId),!1):(V.Z.debug("DRM: isSessionUsable: MediaKeySession is usable",e.sessionId),!0)}function ne(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?re(i,t):null===a?(V.Z.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),re(i,t)):function(e,t,n,r){return ie.apply(this,arguments)}(i,a,t,r)}function re(e,t){V.Z.info("DRM: Creating a new temporary session");var n=e.createSession(t,"temporary");return Promise.resolve({type:"created-session",value:n})}function ie(){return ie=(0,i.Z)(s().mark((function e(t,n,r,a){var o,u,l,d,c,f;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f=function(){return f=(0,i.Z)(s().mark((function e(){var i,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===a.cancellationError){e.next=2;break}throw a.cancellationError;case 2:return V.Z.info("DRM: Removing previous persistent session."),null!==(i=n.get(r))&&n.delete(i.sessionId),e.prev=5,e.next=8,t.closeSession(o.mediaKeySession);case 8:e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(5),""===o.mediaKeySession.sessionId){e.next=14;break}throw e.t0;case 14:t.removeSessionWithoutClosingIt(o.mediaKeySession);case 15:if(null===a.cancellationError){e.next=17;break}throw a.cancellationError;case 17:return u=t.createSession(r,"persistent-license"),e.abrupt("return",{type:"created-session",value:u});case 19:case"end":return e.stop()}}),e,null,[[5,10]])}))),f.apply(this,arguments)},c=function(){return f.apply(this,arguments)},null===a.cancellationError){e.next=4;break}throw a.cancellationError;case 4:if(V.Z.info("DRM: Creating persistent MediaKeySession"),o=t.createSession(r,"persistent-license"),null!==(u=n.getAndReuse(r))){e.next=9;break}return e.abrupt("return",{type:"created-session",value:o});case 9:return e.prev=9,e.next=12,t.loadPersistentSession(o.mediaKeySession,u.sessionId);case 12:if(l=e.sent){e.next=19;break}return V.Z.warn("DRM: No data stored for the loaded session"),n.delete(u.sessionId),t.removeSessionWithoutClosingIt(o.mediaKeySession),d=t.createSession(r,"persistent-license"),e.abrupt("return",{type:"created-session",value:d});case 19:if(!l||!te(o.mediaKeySession)){e.next=23;break}return n.add(r,r.keyIds,o.mediaKeySession),V.Z.info("DRM: Succeeded to load persistent session."),e.abrupt("return",{type:"loaded-persistent-session",value:o});case 23:return V.Z.warn("DRM: Previous persistent session not usable anymore."),e.abrupt("return",c());case 27:return e.prev=27,e.t0=e.catch(9),V.Z.warn("DRM: Unable to load persistent session: "+(e.t0 instanceof Error?e.t0.toString():"Unknown Error")),e.abrupt("return",c());case 31:case"end":return e.stop()}}),e,null,[[9,27]])}))),ie.apply(this,arguments)}function ae(e,t){return oe.apply(this,arguments)}function oe(){return(oe=(0,i.Z)(s().mark((function e(t,n){var r,i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n<0||n>=t.getLength())){e.next=2;break}return e.abrupt("return");case 2:for(V.Z.info("DRM: LSS cache limit exceeded",n,t.getLength()),r=[],i=t.getAll().slice(),a=i.length-n,o=0;o=o.length)){e.next=2;break}throw new q.Z("INCOMPATIBLE_KEYSYSTEMS","No key system compatible with your wanted configuration has been found in the current browser.");case 2:if(null!=F.requestMediaKeySystemAccess){e.next=4;break}throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");case 4:return r=o[t],i=r.keyName,a=r.keyType,l=r.keySystemOptions,d=ce(i,a,l),V.Z.debug("DRM: Request keysystem access "+a+","+(t+1)+" of "+o.length),e.prev=7,e.next=10,F.requestMediaKeySystemAccess(a,d);case 10:return c=e.sent,V.Z.info("DRM: Found compatible keysystem",a,t+1),e.abrupt("return",{type:"create-media-key-system-access",value:{options:l,mediaKeySystemAccess:c}});case 15:if(e.prev=15,e.t0=e.catch(7),V.Z.debug("DRM: Rejected access to keysystem",a,t+1),null===n.cancellationError){e.next=20;break}throw n.cancellationError;case 20:return e.abrupt("return",u(t+1));case 21:case"end":return e.stop()}}),e,null,[[7,15]])})))).apply(this,arguments)}}var ve=n(2297);function pe(e,t,n){var r;V.Z.debug("Compat: Calling generateRequest on the MediaKeySession");try{r=function(e){V.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");for(var t=!1,n=new Uint8Array,r=new Uint8Array,i=0;ie.length)throw V.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var o=e.subarray(i,i+a);if(16===e[i+12]&&119===e[i+13]&&239===e[i+14]&&236===e[i+15]&&192===e[i+16]&&178===e[i+17]&&77===e[i+18]&&2===e[i+19]&&172===e[i+20]&&227===e[i+21]&&60===e[i+22]&&30===e[i+23]&&82===e[i+24]&&226===e[i+25]&&251===e[i+26]&&75===e[i+27]){var s=(0,ve.Xj)(o),u=null===s?void 0:o[s[1]];V.Z.info("Compat: CENC PSSH found with version",u),void 0===u?V.Z.warn("Compat: could not read version of CENC PSSH"):t===(1===u)?n=(0,P.zo)(n,o):1===u?(V.Z.warn("Compat: cenc version 1 encountered, removing every other cenc pssh box."),n=o,t=!0):V.Z.warn("Compat: filtering out cenc pssh box with wrong version",u)}else r=(0,P.zo)(r,o);i+=a}if(i!==e.length)throw V.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");return(0,P.zo)(r,n)}(n)}catch(e){r=n}var i=null!=t?t:"";return e.generateRequest(i,r).catch((function(t){if(""!==i||!(t instanceof TypeError))throw t;return V.Z.warn('Compat: error while calling `generateRequest` with an empty initialization data type. Retrying with a default "cenc" value.',t),e.generateRequest("cenc",r)}))}var he=100;function me(e,t){return ge.apply(this,arguments)}function ge(){return(ge=(0,i.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V.Z.info("DRM: Load persisted session",n),e.next=3,t.load(n);case 3:if((r=e.sent)&&!(t.keyStatuses.size>0)){e.next=6;break}return e.abrupt("return",r);case 6:return e.abrupt("return",new Promise((function(e){t.addEventListener("keystatuseschange",i);var n=setTimeout(i,he);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=n(7864);function _e(e){var t=new b.ZP;return Promise.race([e.close().then((function(){t.cancel()})),e.closed.then((function(){t.cancel()})),function(){return n.apply(this,arguments)}()]);function n(){return(n=(0,i.Z)(s().mark((function e(){var n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,ye.Z)(1e3,t.signal);case 3:return e.next=5,r();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),!(e.t0 instanceof b.FU)){e.next=11;break}return e.abrupt("return");case 11:n=e.t0 instanceof Error?e.t0.message:"Unknown error made it impossible to close the session",V.Z.error("DRM: "+n);case 13:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function r(){return a.apply(this,arguments)}function a(){return(a=(0,i.Z)(s().mark((function n(){return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.update(new Uint8Array(1));case 3:n.next=13;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t.isUsed()){n.next=9;break}return n.abrupt("return");case 9:if(!(n.t0 instanceof Error&&"The session is already closed."===n.t0.message)){n.next=11;break}return n.abrupt("return");case 11:return n.next=13,(0,ye.Z)(1e3,t.signal);case 13:if(!t.isUsed()){n.next=15;break}return n.abrupt("return");case 15:throw new Error("Compat: Couldn't know if session is closed");case 16:case"end":return n.stop()}}),n,null,[[0,5]])})))).apply(this,arguments)}}function be(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Se(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){if(null!==this._keyIds&&Te(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return Te(t,this._initializationData.keyIds)}return this._checkInitializationDataCompatibility(e)},t._checkInitializationDataCompatibility=function(e){return void 0!==e.keyIds&&e.keyIds.length>0&&void 0!==this._initializationData.keyIds?Te(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function Ae(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&n._storage[e].mediaKeySession===i&&n._storage.splice(e,1)})).catch((function(e){V.Z.warn("DRM-LSS: MediaKeySession.closed rejected: "+e)})),this._storage.push(Object.assign({},a)),V.Z.debug("DRM-LSS: MediaKeySession added",a.sessionType,this._storage.length),a},t.reuse=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.keySessionRecord.isCompatibleWith(e))return this._storage.splice(t,1),this._storage.push(n),V.Z.debug("DRM-LSS: Reusing session:",n.mediaKeySession.sessionId,n.sessionType),Object.assign({},n)}return null},t.getEntryForSession=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.mediaKeySession===e)return Object.assign({},n)}return null},t.generateLicenseRequest=function(){var e=(0,i.Z)(s().mark((function e(t,n,r){var i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=Ae(this._storage);case 1:if((o=a()).done){e.next=8;break}if((u=o.value).mediaKeySession!==t){e.next=6;break}return i=u,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==i){e.next=11;break}return V.Z.error("DRM-LSS: generateRequest error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",pe(t,n,r));case 11:if(i.isGeneratingRequest=!0,"none"===i.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,pe(t,n,r);case 17:e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(14),void 0!==i){e.next=23;break}throw e.t0;case 23:throw i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start(),e.t0;case 26:if(void 0!==i){e.next=28;break}return e.abrupt("return",void 0);case 28:i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start();case 30:case"end":return e.stop()}}),e,this,[[14,19]])})));return function(t,n,r){return e.apply(this,arguments)}}(),t.loadPersistentSession=function(){var e=(0,i.Z)(s().mark((function e(t,n){var r,i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=Ae(this._storage);case 1:if((a=i()).done){e.next=8;break}if((o=a.value).mediaKeySession!==t){e.next=6;break}return r=o,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==r){e.next=11;break}return V.Z.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",me(t,n));case 11:if(r.isLoadingPersistentSession=!0,"none"===r.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,me(t,n);case 17:u=e.sent,e.next=27;break;case 20:if(e.prev=20,e.t0=e.catch(14),void 0!==r){e.next=24;break}throw e.t0;case 24:throw r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.t0;case 27:if(void 0!==r){e.next=29;break}return e.abrupt("return",u);case 29:return r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.abrupt("return",u);case 32:case"end":return e.stop()}}),e,this,[[14,20]])})));return function(t,n){return e.apply(this,arguments)}}(),t.closeSession=function(){var e=(0,i.Z)(s().mark((function e(t){var n,r,i,a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Ae(this._storage);case 1:if((i=r()).done){e.next=8;break}if((a=i.value).mediaKeySession!==t){e.next=6;break}return n=a,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==n){e.next=11;break}return V.Z.warn("DRM-LSS: No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Promise.resolve(!1));case 11:return e.abrupt("return",this._closeEntry(n));case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getLength=function(){return this._storage.length},t.getAll=function(){return this._storage},t.closeAllSessions=function(){var e=(0,i.Z)(s().mark((function e(){var t,n,r=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._storage,V.Z.debug("DRM-LSS: Closing all current MediaKeySessions",t.length),this._storage=[],n=t.map((function(e){return r._closeEntry(e)})),e.next=6,Promise.all(n);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.removeSessionWithoutClosingIt=function(e){(0,l.Z)(""===e.sessionId,"Initialized `MediaKeySession`s should always be properly closed");for(var t=this._storage.length-1;t>=0;t--){if(this._storage[t].mediaKeySession===e)return V.Z.debug("DRM-LSS: Removing session without closing it",e.sessionId),this._storage.splice(t,1),!0}return!1},t.getIndex=function(e){for(var t=0;t=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0){var o=void 0===t?3:4,s=this._entries[a];if((null!==(r=s.version)&&void 0!==r?r:-1)>=o&&i===s.sessionId)return;V.Z.info("DRM-PSS: Updating session info.",i),this._entries.splice(a,1)}else V.Z.info("DRM-PSS: Add new session",i);var u=e.values.getFormattedValues().map((function(e){var t=e.systemId,n=e.data;return{systemId:t,hash:e.hash,data:new Pe(n)}}));void 0===t?this._entries.push({version:3,sessionId:i,values:u,initDataType:e.type}):this._entries.push({version:4,sessionId:i,keyIds:t.map((function(e){return new Pe(e)})),values:u,initDataType:e.type}),this._save()}else V.Z.warn("DRM-PSS: Invalid Persisten Session given.")},t.delete=function(e){for(var t=-1,n=0;n0&&(r=new q.Z("KEY_STATUS_CHANGE_ERROR","One or several problematic key statuses have been encountered",{keyStatuses:d})),{warning:r,blacklistedKeyIds:u,whitelistedKeyIds:l}}var nt=f.Dl,rt=f.RV,it=f.qo;function at(e,t,n,r,a){V.Z.info("DRM: Binding session events",e.sessionId);var o=t.getLicenseConfig,u=void 0===o?{}:o,l=new b.ZP;return l.linkToSignal(a),(0,d.Z)(e.closed)||e.closed.then((function(){return l.cancel()})).catch((function(e){a.isCancelled()||(l.cancel(),r.onError(e))})),nt(e,(function(e){l.cancel(),r.onError(new q.Z("KEY_ERROR",e.type))}),l.signal),it(e,(function(e){(function(e){return c.apply(this,arguments)})(e).catch((function(e){a.isCancelled()||l.isUsed()&&e instanceof b.XG||(l.cancel(),r.onError(e))}))}),l.signal),rt(e,(function(n){var a,o=n,c=new Uint8Array(o.message),f=(0,Ce.Z)(o.messageType)?o.messageType:"license-request";V.Z.info("DRM: Received message event, type "+f,e.sessionId),function(e,t,n){var r=t.baseDelay,a=t.maxDelay,o=t.totalRetry,u=t.shouldRetry,l=t.onRetry,c=0;return f();function f(){return v.apply(this,arguments)}function v(){return(v=(0,i.Z)(s().mark((function t(){var i,v,p;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===n.cancellationError){t.next=2;break}throw n.cancellationError;case 2:return t.prev=2,t.next=5,e();case 5:return i=t.sent,t.abrupt("return",i);case 9:if(t.prev=9,t.t0=t.catch(2),null===n.cancellationError){t.next=13;break}throw n.cancellationError;case 13:if(!(!(0,d.Z)(u)&&!u(t.t0)||c++>=o)){t.next=15;break}throw t.t0;case 15:return"function"==typeof l&&l(t.t0,c),v=Qe(r,c,a),t.next=19,(0,Xe.Z)(v);case 19:return p=f(),t.abrupt("return",p);case 21:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}}((function(){return function(e,n){var r;return new Promise((function(i,a){try{V.Z.debug("DRM: Calling `getLicense`",n);var o=t.getLicense(e,n),s=(0,d.Z)(u.timeout)?1e4:u.timeout;s>=0&&(r=setTimeout((function(){a(new dt('"getLicense" timeout exceeded ('+s+" ms)"))}),s)),Promise.resolve(o).then(l,c)}catch(e){c(e)}function l(e){void 0!==r&&clearTimeout(r),i(e)}function c(e){void 0!==r&&clearTimeout(r),a(e)}}))}(c,f)}),{totalRetry:null!=(a=u.retry)?a:2,baseDelay:200,maxDelay:3e3,shouldRetry:function(e){return e instanceof dt||(0,d.Z)(e)||!0!==e.noRetry},onRetry:function(e){return r.onWarning(ot(e))}},l.signal).then((function(t){if(l.isUsed())return Promise.resolve();if((0,d.Z)(t))V.Z.info("DRM: No license given, skipping session.update");else try{return st(e,t)}catch(e){l.cancel(),r.onError(e)}})).catch((function(e){if(!l.isUsed()){l.cancel();var t=ot(e);if(!(0,d.Z)(e))if(!0===e.fallbackOnLastTry)return V.Z.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void r.onError(new lt(t));r.onError(t)}}))}),l.signal),void f();function c(){return c=(0,i.Z)(s().mark((function n(r){var o,u;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return u=function(){return(u=(0,i.Z)(s().mark((function n(){var i,o;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!l.isUsed()){n.next=2;break}return n.abrupt("return");case 2:if("function"!=typeof t.onKeyStatusesChange){n.next=24;break}return n.prev=3,n.next=6,t.onKeyStatusesChange(r,e);case 6:if(i=n.sent,!l.isUsed()){n.next=9;break}return n.abrupt("return");case 9:n.next=18;break;case 11:if(n.prev=11,n.t0=n.catch(3),!a.isCancelled()){n.next=15;break}return n.abrupt("return");case 15:throw o=new q.Z("KEY_STATUS_CHANGE_ERROR","Unknown `onKeyStatusesChange` error"),!(0,d.Z)(n.t0)&&(0,Ce.Z)(n.t0.message)&&(o.message=n.t0.message),o;case 18:if(!(0,d.Z)(i)){n.next=22;break}V.Z.info("DRM: No license given, skipping session.update"),n.next=24;break;case 22:return n.next=24,st(e,i);case 24:case"end":return n.stop()}}),n,null,[[3,11]])})))).apply(this,arguments)},o=function(){return u.apply(this,arguments)},V.Z.info("DRM: keystatuseschange event received",e.sessionId),n.next=5,Promise.all([o(),Promise.resolve(f())]);case 5:case"end":return n.stop()}}),n)}))),c.apply(this,arguments)}function f(){if(!l.isUsed()&&0!==e.keyStatuses.size){var i=tt(e,t,n),a=i.warning,o=i.blacklistedKeyIds,s=i.whitelistedKeyIds;void 0!==a&&(r.onWarning(a),l.isUsed())||r.onKeyUpdate({whitelistedKeyIds:s,blacklistedKeyIds:o})}}}function ot(e){if(e instanceof dt)return new q.Z("KEY_LOAD_TIMEOUT","The license server took too much time to respond.");var t=new q.Z("KEY_LOAD_ERROR","An error occured when calling `getLicense`.");return!(0,d.Z)(e)&&(0,Ce.Z)(e.message)&&(t.message=e.message),t}function st(e,t){return ut.apply(this,arguments)}function ut(){return(ut=(0,i.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V.Z.info("DRM: Updating MediaKeySession with message"),e.prev=1,e.next=4,t.update(n);case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.toString():"`session.update` failed",new q.Z("KEY_UPDATE_ERROR",r);case 10:V.Z.info("DRM: MediaKeySession update succeeded.");case 11:case"end":return e.stop()}}),e,null,[[1,6]])})))).apply(this,arguments)}var lt=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,je.Z)(r),t.prototype),r.sessionError=n,r}return(0,a.Z)(t,e),t}((0,qe.Z)(Error)),dt=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,je.Z)(n),lt.prototype),n.message=t,n}return(0,a.Z)(t,e),t}((0,qe.Z)(Error)),ct=n(9822);function ft(e,t){return vt.apply(this,arguments)}function vt(){return(vt=(0,i.Z)(s().mark((function e(t,n){var r,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setServerCertificate(n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),V.Z.warn("DRM: mediaKeys.setServerCertificate returned an error",e.t0 instanceof Error?e.t0:""),i=e.t0 instanceof Error?e.t0.toString():"`setServerCertificate` error",new q.Z("LICENSE_SERVER_CERTIFICATE_ERROR",i);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function pt(e,t){return ht.apply(this,arguments)}function ht(){return(ht=(0,i.Z)(s().mark((function e(t,n){var r,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==Fe.hasOne(t)){e.next=3;break}return V.Z.info("DRM: The MediaKeys already has a server certificate, skipping..."),e.abrupt("return",{type:"already-has-one"});case 3:if("function"==typeof t.setServerCertificate){e.next=6;break}return V.Z.warn("DRM: Could not set the server certificate. mediaKeys.setServerCertificate is not a function"),e.abrupt("return",{type:"method-not-implemented"});case 6:return V.Z.info("DRM: Setting server certificate on the MediaKeys"),Fe.prepare(t),e.prev=8,e.next=11,ft(t,n);case 11:return r=e.sent,Fe.set(t,n),e.abrupt("return",{type:"success",value:r});case 16:return e.prev=16,e.t0=e.catch(8),i=(0,ct.Z)(e.t0)?e.t0:new q.Z("LICENSE_SERVER_CERTIFICATE_ERROR","Unknown error when setting the server certificate."),e.abrupt("return",{type:"error",value:i});case 20:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}var mt=n(4339);function gt(e,t){if(!(isNaN(t)||t<0||t>=e.getLength())){var n=e.getLength(),r=n-t;V.Z.info("DRM: Too many stored persistent sessions, removing some.",n,r),e.deleteOldSessions(r)}}var yt=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return P.zo.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return De(this.getFormattedValues(),n)},t.getFormattedValues=function(){return null===this._lazyFormattedValues&&(this._lazyFormattedValues=this._innerValues.slice().sort((function(e,t){return e.systemId===t.systemId?0:void 0===e.systemId?1:void 0===t.systemId||e.systemId=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&U._currentSessions.splice(r),void 0!==t.content&&Et(t.content.manifest,[],[],R.record.getAssociatedKeyIds()),null===(n=i.persistentSessionsStore)||void 0===n||n.delete(C.sessionId),i.loadedSessionsStore.closeSession(C).catch((function(e){var t=e instanceof Error?e:"unknown error";V.Z.warn("DRM: failed to close expired session",t)})).then((function(){return U._unlockInitDataQueue()})).catch((function(e){return U._onFatalError(e)})),void(U._isStopped()||U.trigger("warning",e.reason))}if(e instanceof lt){if(R.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;V.Z.info("DRM: blacklisting Representations based on protection data."),kt(a,t)}U._unlockInitDataQueue()}else U._onFatalError(e)}},this._canceller.signal),void 0!==a.singleLicensePer&&"init-data"!==a.singleLicensePer||this._unlockInitDataQueue(),"created-session"!==x.type){e.next=72;break}return N=t.values.constructRequestData(),e.prev=59,e.next=62,i.loadedSessionsStore.generateLicenseRequest(C,t.type,N);case 62:e.next=72;break;case 64:if(e.prev=64,e.t1=e.catch(59),null!==(O=i.loadedSessionsStore.getEntryForSession(C))&&"none"===O.closingStatus.type){e.next=71;break}return(L=this._currentSessions.indexOf(R))>=0&&this._currentSessions.splice(L,1),e.abrupt("return",Promise.resolve());case 71:throw new q.Z("KEY_GENERATE_REQUEST_ERROR",e.t1 instanceof Error?e.t1.toString():"Unknown error");case 72:return e.abrupt("return",Promise.resolve());case 73:case"end":return e.stop()}}),e,this,[[59,64]])})));return function(t,n){return e.apply(this,arguments)}}(),n._tryToUseAlreadyCreatedSession=function(e,t){var n=t.stores,r=t.options,i=(0,X.Z)(this._currentSessions,(function(t){return t.record.isCompatibleWith(e)}));if(void 0===i)return!1;var a=i.blacklistedSessionError;if(!(0,d.Z)(a))return void 0===e.type||void 0===e.content?(V.Z.error("DRM: This initialization data has already been blacklisted but the current content is not known."),!0):(V.Z.info("DRM: This initialization data has already been blacklisted. Blacklisting the related content."),kt(e.content.manifest,e),!0);if(void 0!==e.keyIds){var o;if(void 0===r.singleLicensePer||"init-data"===r.singleLicensePer){var s=i.keyStatuses.blacklisted;o=function(e,t){for(var n,r,i=function(){var e=r.value;if(t.some((function(t){return(0,K.Z)(t,e)})))return{v:!0}},a=be(e);!(r=a()).done;)if(n=i())return n.v;return!1}(e.keyIds,s)}else{var u=i.keyStatuses.whitelisted;o=!Te(e.keyIds,u)}if(o)return void 0===e.content?(V.Z.error("DRM: Cannot forbid key id, the content is unknown."),!0):(V.Z.info("DRM: Current initialization data is linked to blacklisted keys. Marking Representations as not decipherable"),Et(e.content.manifest,[],e.keyIds,[]),!0)}if(null!==n.loadedSessionsStore.reuse(e))return V.Z.debug("DRM: Init data already processed. Skipping it."),!0;var l=this._currentSessions.indexOf(i);return-1===l?V.Z.error("DRM: Unable to remove processed init data: not found."):(V.Z.debug("DRM: A session from a processed init data is not available anymore. Re-processing it."),this._currentSessions.splice(l,1)),!1},n._onFatalError=function(e){if(!this._canceller.isUsed()){var t=e instanceof Error?e:new Y.Z("NONE","Unknown decryption error");this.error=t,this._initDataQueue.length=0,this._stateData={state:mt.u.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===mt.u.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===mt.u.Disposed||this._stateData.state===mt.u.Error},n._processCurrentInitDataQueue=function(){for(;!1===this._stateData.isInitDataQueueLocked;){var e=this._initDataQueue.shift();if(void 0===e)return;this.onInitializationData(e)}},n._lockInitDataQueue=function(){!1===this._stateData.isInitDataQueueLocked&&(this._stateData.isInitDataQueueLocked=!0)},n._unlockInitDataQueue=function(){2===this._stateData.isMediaKeysAttached?(this._stateData.isInitDataQueueLocked=!1,this._processCurrentInitDataQueue()):V.Z.error("DRM: Trying to unlock in the wrong state")},t}(_.Z);function Tt(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&(0,Q.Z)(t,"persistent-license")}function Et(e,t,n,r){e.updateRepresentationsDeciperability((function(e){if(void 0===e.contentProtections)return e.decipherable;var i=e.contentProtections.keyIds;if(void 0!==i)for(var a,o=_t(i);!(a=o()).done;){for(var s,u=a.value,l=_t(n);!(s=l()).done;){var d=s.value;if((0,K.Z)(d,u.keyId))return!1}for(var c,f=_t(t);!(c=f()).done;){var v=c.value;if((0,K.Z)(v,u.keyId))return!0}for(var p,h=_t(r);!(p=h()).done;){var m=p.value;if((0,K.Z)(m,u.keyId))return}}return e.decipherable}))}function kt(e,t){e.updateRepresentationsDeciperability((function(e){var n,r;if(!1===e.decipherable)return!1;for(var i,a,o=function(){var e=a.value;if((void 0===t.type||e.type===t.type)&&t.values.getFormattedValues().every((function(t){return e.values.some((function(e){return(void 0===t.systemId||e.systemId===t.systemId)&&(0,K.Z)(e.data,t.data)}))})))return{v:!1}},s=_t(null!==(r=null===(n=e.contentProtections)||void 0===n?void 0:n.initData)&&void 0!==r?r:[]);!(a=s()).done;)if(i=o())return i.v;return e.decipherable}))}function wt(e,t,n,r,i,a){for(var o,s,u=[].concat(i,a),l=function(){var e=s.value;u.some((function(t){return(0,K.Z)(t,e)}))||(V.Z.hasLevel("DEBUG")&&V.Z.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",(0,Z.ci)(e)),u.push(e))},d=_t(t.getAssociatedKeyIds());!(s=d()).done;)l();if(void 0!==n&&"init-data"!==n){var c=e.keyIds,f=e.content;if(void 0!==c){var v=c.filter((function(e){return!u.some((function(t){return(0,K.Z)(t,e)}))}));v.length>0&&(V.Z.hasLevel("DEBUG")&&V.Z.debug("DRM: init data keys missing in the license, blacklisting them",v.map((function(e){return(0,Z.ci)(e)})).join(", ")),u.push.apply(u,v))}if(r&&void 0!==f)if("content"===n){for(var p,h=new Set,m=_t(f.manifest.periods);!(p=m()).done;){It(h,p.value)}At(h,u)}else if("periods"===n)for(var g,y=_t(f.manifest.periods);!(g=y()).done;){var _=g.value,b=new Set;if(It(b,_),(null===(o=e.content)||void 0===o?void 0:o.period.id)===_.id)At(b,u);else for(var S=Array.from(b),T=function(){var e=k[E];if(u.some((function(t){return(0,K.Z)(t,e)})))return At(b,u),1},E=0,k=S;E0?e.seekable.end(0):n;return(0,s.Z)(r)?(a.Z.warn("startAt.fromLivePosition set but no known live position, beginning at 0."),0):Math.max(0,r+t.fromLivePosition)}if(null!=t.percentage){if((0,s.Z)(n)||!isFinite(n))return a.Z.warn("startAt.percentage set but no known duration, beginning at 0."),0;var i=t.percentage;return i>=100?n:i<=0?0:n*(+i/100)}return 0}(e,u);return a.Z.debug("Init: Initial time calculated:",t),t}),o,(function(e){return n.trigger("warning",e)}),!0,r).autoPlayResult.then((function(){return(0,c.Z)(t,e,!0,r).onUpdate((function(e,t){e&&(t(),n.trigger("loaded",{segmentBuffersStore:null}))}),{emitCurrentValue:!0,clearSignal:r})})).catch((function(e){r.isCancelled()||n._onFatalError(e)}))},t}(d.K)},7117:function(e,t,n){"use strict";n.d(t,{Z:function(){return tn}});var r=n(5861),i=n(4578),a=n(4687),o=n.n(a);var s=n(6872),u=n(3714),l=n(3887),d=n(811),c=n(7733),f=n(8026),v=n(5095),p=n(288),h=n(8894),m=n(2829),g=n(5138);function y(e){var t=e.map((function(t){return Math.log(t/e[0])})),n=t.map((function(e){return e-t[0]+1})),r=(n[n.length-1]-1)/(2*e.length+10),i=1/r;return e.map((function(e,t){return a(t)}));function a(t){if(0===t)return 0;var o=Math.min(Math.max(1,t),e.length-1);return e[o]===e[o-1]?a(t-1):i*(r+(e[o]*n[o-1]-e[o-1]*n[o])/(e[o]-e[o-1]))+4}}var _=function(){function e(e){this._levelsMap=y(e).map((function(e){return e+4})),this._bitrates=e,this._lastUnsuitableQualityTimestamp=void 0,this._blockRaiseDelay=6e3,l.Z.debug("ABR: Steps for buffer based chooser.",this._levelsMap.map((function(t,n){return"bufferLevel: "+t+", bitrate: "+e[n]})).join(" ,"))}var t=e.prototype;return t.onAddedSegment=function(e){var t=this._levelsMap,n=this._bitrates,r=e.bufferGap,i=e.currentBitrate,a=e.currentScore,o=e.speed;if(null!=i){for(var s,u=-1,d=0;di)break}if(u<0||n.length!==t.length)return l.Z.error("ABR: Current Bitrate not found in the calculated levels"),void(this._currentEstimate=n[0]);void 0!==a&&(s=0===o?a.score:a.score/o);var f=isFinite(r)?r:0,v=performance.now();if(f=0;m--)if(f>=t[m])return void(this._currentEstimate=n[m]);this._currentEstimate=n[0]}else if(void 0!==this._lastUnsuitableQualityTimestamp&&v-this._lastUnsuitableQualityTimestampy)return e}();if(void 0!==_)if(r>=t[_])return l.Z.debug("ABR: Raising quality in BufferBasedChooser",n[_]),void(this._currentEstimate=n[_]);this._currentEstimate=i}}else this._currentEstimate=n[0]},t.getLastEstimate=function(){return this._currentEstimate},e}(),b=n(3274),S=function(){function e(e){this._alpha=Math.exp(Math.log(.5)/e),this._lastEstimate=0,this._totalWeight=0}var t=e.prototype;return t.addSample=function(e,t){var n=Math.pow(this._alpha,e),r=t*(1-n)+n*this._lastEstimate;isNaN(r)||(this._lastEstimate=r,this._totalWeight+=e)},t.getEstimate=function(){var e=1-Math.pow(this._alpha,this._totalWeight);return this._lastEstimate/e},e}();function T(e){if(!(e.progress.length<5)){for(var t=new S(2),n=e.progress,r=1;r=u.outOfStarvationGap&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1):this._inStarvationMode&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1),this._inStarvationMode&&(o=function(e,t,n,r,i){if(!r){var a=t.bufferGap,o=t.speed,s=t.position,u=isFinite(a)?a:0,l=function(e,t){for(var n=-1,r=0;r-1.2){n=r;break}if(a>t&&t-i.time>-1.2){n=r;break}}}if(n<0)return[];for(var o=e[n],s=o.content.segment.time,u=[o],l=n+1;l0?d.progress[d.progress.length-1]:void 0,p=T(d);if(void 0!==v&&void 0!==p){var h=E(v,p);if((c-v.timestamp)/1e3<=h&&h-u/o>2500)return p}if(d.content.segment.complete){var m=d.content.segment.duration,g=(c-d.requestTimestamp)/1e3;if(null!=n&&!(g<=(1.5*m+2)/o)){var y=m/g,_=n.bitrate*Math.min(.7,y);return void 0===i||_1&&(a/=e.speed),{bandwidthEstimate:o,bitrateChosen:a}},t.isUrgent=function(e,t,n,r){return null===t||!(e>=t.bitrate)&&function(e,t,n){if(n)return!0;var r=isFinite(e.bufferGap)?e.bufferGap:0,i=e.position.last+r,a=(0,b.Z)(t,(function(e){var t=e.content;return t.segment.duration>0&&t.segment.time+t.segment.duration>i}));if(void 0===a)return!0;var o=performance.now(),s=a.progress.length>0?a.progress[a.progress.length-1]:void 0,u=T(a);if(void 0===s||void 0===u)return!0;var l=E(s,u);return(o-s.timestamp)/1e3>1.2*l||l-r/e.speed>-1.5}(r,n,this._lowLatencyMode)},e}();function w(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ns.bitrate)return 2===this._lastAbrEstimate.algorithmType&&(null!==this._lastAbrEstimate.representation&&(this._lastMaintanableBitrate=this._lastAbrEstimate.representation.bitrate),this._consecutiveWrongGuesses=0),null;var u=this._scoreCalculator.getEstimate(n);if(2!==this._lastAbrEstimate.algorithmType){if(void 0===u)return null;if(this._canGuessHigher(a,o,u)){var d=Z(e,n);if(null!==d)return d}return null}if(this._isLastGuessValidated(s,r,u)&&(l.Z.debug("ABR: Guessed Representation validated",s.bitrate),this._lastMaintanableBitrate=s.bitrate,this._consecutiveWrongGuesses=0),n.id!==s.id)return s;if(this._shouldStopGuess(n,u,a,i))return this._consecutiveWrongGuesses++,this._blockGuessesUntil=performance.now()+Math.min(15e3*this._consecutiveWrongGuesses,12e4),function(e,t){var n=(0,g.Z)(e,(function(e){return e.id===t.id}));if(n<0)return l.Z.error("ABR: Current Representation not found."),null;for(;--n>=0;)if(e[n].bitrate=2.5&&performance.now()>this._blockGuessesUntil&&1===i&&r/t>1.01},t._shouldStopGuess=function(e,t,n,r){if(void 0!==t&&t.score<1.01)return!0;if((void 0===t||t.score<1.2)&&n<.6)return!0;for(var i,a=r.filter((function(t){return t.content.representation.id===e.id})),o=performance.now(),s=w(a);!(i=s()).done;){var u=i.value,l=o-u.requestTimestamp;if(u.content.segment.isInit){if(l>1e3)return!0}else{if(l>1e3*u.content.segment.duration+200)return!0;var d=T(u);if(void 0!==d&&d<.8*e.bitrate)return!0}}return!1},t._isLastGuessValidated=function(e,t,n){return void 0!==n&&1===n.confidenceLevel&&n.score>1.5||t>=e.bitrate&&(null===this._lastMaintanableBitrate||this._lastMaintanableBitratet.bitrate)return e[r];return null}var x=function(){function e(){var e=s.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new S(t),this._slowEWMA=new S(n),this._bytesSampled=0}var t=e.prototype;return t.addSample=function(e,t){if(!(t1&&this._lastRepresentationWithGoodScore!==e&&(l.Z.debug("ABR: New last stable representation",e.bitrate),this._lastRepresentationWithGoodScore=e)},t.getEstimate=function(e){if(null!==this._currentRepresentationData&&this._currentRepresentationData.representation.id===e.id){var t=this._currentRepresentationData,n=t.ewma,r=t.loadedSegments,i=t.loadedDuration;return{score:n.getEstimate(),confidenceLevel:r>=5&&i>=10?1:0}}},t.getLastStableRepresentation=function(){return this._lastRepresentationWithGoodScore},e}();function D(e,t,n,r){var i=t<=n?n:t>=r?r:t,a=(0,g.Z)(e,(function(e){return e.bitrate>i}));return-1===a?e[e.length-1]:0===a?e[0]:e[a-1]}var N=new v.Z(-1);N.finish();var O=new v.Z(0);O.finish();var L=new v.Z(1/0);L.finish();var U=new v.Z(void 0);U.finish();var B=new v.Z(1/0);B.finish();var F=function(e){var t={},n=e.manualBitrates,r=e.minAutoBitrates,i=e.maxAutoBitrates,a=e.initialBitrates,o=e.throttlers,u=e.lowLatencyMode;return function(e,d,c,f,y){var S,T,E,w,A,Z,M,F=e.adaptation.type,V=function(e){var n=t[e];if(null==n){l.Z.debug("ABR: Creating new BandwidthEstimator for ",e);var r=new x;return t[e]=r,r}return n}(F),z=null!==(S=n[F])&&void 0!==S?S:N,K=null!==(T=r[F])&&void 0!==T?T:O,G=null!==(E=i[F])&&void 0!==E?E:L,W=null!==(w=a[F])&&void 0!==w?w:0;return function(e,t){var n=e.bandwidthEstimator,r=e.context,i=e.currentRepresentation,a=e.filters,o=e.initialBitrate,u=e.lowLatencyMode,d=e.manualBitrate,c=e.maxAutoBitrate,f=e.minAutoBitrate,y=e.playbackObserver,S=e.representations,T=new P,E=new k(null!=o?o:0,u),w=new C,A=h.Z,Z={metrics:L,requestBegin:U,requestProgress:B,requestEnd:F,addedSegment:function(e){A(e)}},x=new p.ZP;x.linkToSignal(t);var M=N(S.getValue(),x.signal);return S.onUpdate(O,{clearSignal:t}),{estimates:M,callbacks:Z};function N(e,t){if(0===e.length)return new v.Z({representation:null,bitrate:void 0,knownStableBitrate:void 0,manual:!1,urgent:!0});if(1===e.length)return new v.Z({bitrate:void 0,representation:e[0],manual:!1,urgent:!0,knownStableBitrate:void 0});var o=!1,p=new _(e.map((function(e){return e.bitrate}))),S=new R,k=new I(T,S),Z=y.getReference().getValue(),x=new v.Z(C());return y.listen((function(e){Z=e,M()}),{includeLastObservation:!1,clearSignal:t}),A=function(e){if(null!==Z){var t=Z,n=t.position,r=t.speed,i=e.buffered,a=(0,m.L7)(i,n.last),o=e.content.representation,s=T.getEstimate(o),u={bufferGap:a,currentBitrate:o.bitrate,currentScore:s,speed:r};p.onAddedSegment(u),M()}},t.register((function(){A=h.Z})),d.onUpdate(M,{clearSignal:t}),f.onUpdate(M,{clearSignal:t}),c.onUpdate(M,{clearSignal:t}),a.limitWidth.onUpdate(M,{clearSignal:t}),a.limitWidth.onUpdate(M,{clearSignal:t}),x;function M(){x.setValue(C())}function C(){var t=d.getValue();if(t>=0)return{representation:D(e,t,0,1/0),bitrate:void 0,knownStableBitrate:void 0,manual:!0,urgent:!0};var v=Z,h=v.bufferGap,m=v.position,y=v.maximumPosition,_=a.limitWidth.getValue(),A=a.throttleBitrate.getValue(),I=i.getValue(),x=f.getValue(),R=c.getValue(),M=function(e,t,n){var r=e;n<1/0&&(r=function(e,t){if(0===e.length)return[];e.sort((function(e,t){return e.bitrate-t.bitrate}));var n=e[0].bitrate,r=Math.max(t,n),i=(0,g.Z)(e,(function(e){return e.bitrate>r}));return-1===i?e:e.slice(0,i)}(r,n));void 0!==t&&(r=function(e,t){var n=e.slice().sort((function(e,t){var n,r;return(null!==(n=e.width)&&void 0!==n?n:0)-(null!==(r=t.width)&&void 0!==r?r:0)})),r=(0,b.Z)(n,(function(e){return"number"==typeof e.width&&e.width>=t}));if(void 0===r)return e;var i="number"==typeof r.width?r.width:0;return e.filter((function(e){return"number"!=typeof e.width||e.width<=i}))}(r,t));return r}(e,_,A),C=w.getRequests(),P=E.getBandwidthEstimate(Z,n,I,C,S.bandwidth),N=P.bandwidthEstimate,O=P.bitrateChosen,L=T.getLastStableRepresentation(),U=null===L?void 0:L.bitrate/(Z.speed>0?Z.speed:1),B=s.Z.getCurrent(),F=B.ABR_ENTER_BUFFER_BASED_ALGO,V=B.ABR_EXIT_BUFFER_BASED_ALGO;o&&h<=V?o=!1:!o&&isFinite(h)&&h>=F&&(o=!0);var z=D(M,O,x,R),K=p.getLastEstimate(),G=z.bitrate,W=null;o&&void 0!==K&&K>G&&(G=(W=D(M,K,x,R)).bitrate);var H=null;return u&&null!==I&&r.manifest.isDynamic&&y-m.last<40&&(H=k.getGuess(e,Z,I,G,C)),null!==H&&H.bitrate>G?(l.Z.debug("ABR: Choosing representation with guess-based estimation.",H.bitrate,H.id),S.update(H,N,2),{bitrate:N,representation:H,urgent:null===I||H.bitrate=500||404===e.status||415===e.status||412===e.status:e.type===Y.br.TIMEOUT||e.type===Y.br.ERROR_EVENT:e instanceof X.Z?"boolean"==typeof e.canRetry?e.canRetry:void 0!==e.xhr&&(e.xhr.status>=500||404===e.xhr.status||415===e.xhr.status||412===e.xhr.status):(0,Q.Z)(e)&&"INTEGRITY_ERROR"===e.code}function te(e){return e instanceof H.Z?e.type===Y.br.ERROR_EVENT&&!1===navigator.onLine:e instanceof X.Z&&e.isOfflineError}function ne(e,t,n,r,i){return re.apply(this,arguments)}function re(){return re=(0,r.Z)(o().mark((function e(t,n,i,a,s){var u,d,c,f,v,m,g,y,_,b,S,T,E,k;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(k=function(e){var t;if(0===m.size)return e[0];var n=performance.now();return null===(t=e.filter((function(e){var t;return!0!==(null===(t=m.get(e))||void 0===t?void 0:t.isBlacklisted)})).reduce((function(e,t){var r,i=null===(r=m.get(t))||void 0===r?void 0:r.blockedUntil;return void 0!==i&&i<=n&&(i=void 0),void 0===e?[t,i]:void 0===i?void 0===e[1]?e:[t,void 0]:void 0===e[1]?e:iv?(l.blockedUntil=void 0,l.isBlacklisted=!0):(h=l.errorCounter,g=Math.min(u*Math.pow(2,h-1),d),y=(0,J.Z)(g),l.blockedUntil=performance.now()+y),e.abrupt("return",S(e.t0));case 22:case"end":return e.stop()}var o}),e,null,[[0,7]])})))).apply(this,arguments)},_=function(e){return b.apply(this,arguments)},y=function(){if(null===t){var e=m.get(null);if(void 0!==e&&e.isBlacklisted)return;return null}if(null===n)return k(t);var r=n.getCdnPreferenceForResource(t);return k(r)},null===s.cancellationError){e.next=9;break}return e.abrupt("return",Promise.reject(s.cancellationError));case 9:if(u=a.baseDelay,d=a.maxDelay,c=a.maxRetryRegular,f=a.maxRetryOffline,v=a.onRetry,null!==t&&0===t.length&&l.Z.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`."),m=new Map,void 0!==(g=y())){e.next=15;break}throw new Error("No CDN to request");case 15:return e.abrupt("return",_(g));case 16:case"end":return e.stop()}}),e)}))),re.apply(this,arguments)}function ie(e,t,n){return ne(null,null,e,t,n)}function ae(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return oe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oe(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?this._consecutiveUnsafeMode=d,v=void 0===r?0:performance.now()-r,m=Math.max(this._settings.minimumManifestUpdateInterval-v,0),g=new p.ZP;if(g.linkToSignal(this._canceller.signal),this.scheduleManualRefresh=function(t){var i=t.enablePartialRefresh,a=t.delay,o=t.canUseUnsafeMode&&f,s=void 0===r?0:performance.now()-r,u=Math.max(n._settings.minimumManifestUpdateInterval-s,0),l=setTimeout((function(){g.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:i,unsafeMode:o})}),Math.max((null!=a?a:0)-s,u));g.signal.register((function(){clearTimeout(l)}))},null!==e.expired){var y=setTimeout((function(){var t;null===(t=e.expired)||void 0===t||t.then((function(){g.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),h.Z)}),m);g.signal.register((function(){clearTimeout(y)}))}if(void 0!==e.lifetime&&e.lifetime>=0){var _,b=1e3*e.lifetime-v;void 0===c?_=b:e.lifetime<3&&c>=100?(_=Math.min(Math.max(3e3-v,Math.max(b,0)+c),6*b),l.Z.info("MUS: Manifest update rythm is too frequent. Postponing next request.",b,_)):c>=1e3*e.lifetime/10?(_=Math.min(Math.max(b,0)+c,6*b),l.Z.info("MUS: Manifest took too long to parse. Postponing next request",_,_)):_=b;var S=setTimeout((function(){g.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),Math.max(_,m));g.signal.register((function(){clearTimeout(S)}))}},n._triggerNextManifestRefresh=function(e,t){var n,r,i=this,a=t.enablePartialRefresh,o=t.unsafeMode,u=e.updateUrl;null!==this._prioritizedContentUrl?(n=!0,r=this._prioritizedContentUrl,this._prioritizedContentUrl=null):r=(n=!a||void 0===u)?e.getUrl():u;var d=e.clockOffset;o?(this._consecutiveUnsafeMode+=1,l.Z.info('Init: Refreshing the Manifest in "unsafeMode" for the '+String(this._consecutiveUnsafeMode)+" consecutive time.")):this._consecutiveUnsafeMode>0&&(l.Z.info('Init: Not parsing the Manifest in "unsafeMode" anymore after '+String(this._consecutiveUnsafeMode)+" consecutive times."),this._consecutiveUnsafeMode=0),this._isRefreshPending||(this._isRefreshPending=!0,this._fetchManifest(r).then((function(t){return t.parse({externalClockOffset:d,previousManifest:e,unsafeMode:o})})).then((function(t){i._isRefreshPending=!1;var r=t.manifest,a=t.sendingTime,o=t.parsingTime,u=performance.now();if(n)e.replace(r);else try{e.update(r)}catch(t){var d=t instanceof Error?t.message:"unknown error";l.Z.warn("MUS: Attempt to update Manifest failed: "+d,"Re-downloading the Manifest fully");var c=s.Z.getCurrent().FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY,f=void 0===a?0:performance.now()-a,v=Math.max(i._settings.minimumManifestUpdateInterval-f,0),p=h.Z,m=setTimeout((function(){p(),i._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:!1})}),Math.max(c-f,v));return void(p=i._canceller.signal.register((function(){clearTimeout(m)})))}var g=performance.now()-u;i._recursivelyRefreshManifest(e,{sendingTime:a,parsingTime:o,updatingTime:g})})).catch((function(e){i._isRefreshPending=!1,i._onFatalError(e)})))},n._onFatalError=function(e){this._canceller.isUsed()||(this.trigger("error",e),this.dispose())},t}(G.Z);var ue=se;function le(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return de(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return de(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function de(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&this._removeIndexFromDowngradeList(n);var r=s.Z.getCurrent().DEFAULT_CDN_DOWNGRADE_TIME;this._downgradedCdnList.metadata.push(e);var i=window.setTimeout((function(){var n=fe(t._downgradedCdnList.metadata,e);n>=0&&t._removeIndexFromDowngradeList(n),t.trigger("priorityChange",null)}),r);this._downgradedCdnList.timeouts.push(i),this.trigger("priorityChange",null)},n._innerGetCdnPreferenceForResource=function(e){var t=this,n=e.reduce((function(e,n){return t._downgradedCdnList.metadata.some((function(e){return e.id===n.id&&e.baseUrl===n.baseUrl}))?e[1].push(n):e[0].push(n),e}),[[],[]]),r=n[0],i=n[1];return r.concat(i)},n._removeIndexFromDowngradeList=function(e){this._downgradedCdnList.metadata.splice(e,1);var t=this._downgradedCdnList.timeouts.splice(e,1);clearTimeout(t[0])},t}(G.Z);function fe(e,t){return 0===e.length?-1:void 0!==t.id?(0,g.Z)(e,(function(e){return e.id===t.id})):(0,g.Z)(e,(function(e){return e.baseUrl===t.baseUrl}))}var ve=n(520),pe=n(7714),he=n(908),me=function(){function e(){this._cache=new WeakMap}var t=e.prototype;return t.add=function(e,t){var n=e.representation;e.segment.isInit&&this._cache.set(n,t)},t.get=function(e){var t=e.representation;if(e.segment.isInit){var n=this._cache.get(t);if(void 0!==n)return n}return null},e}(),ge=(0,he.Z)();var ye=function(){function e(e){var t=e.prioritySteps;if(this._minPendingPriority=null,this._waitingQueue=[],this._pendingTasks=[],this._prioritySteps=t,this._prioritySteps.high>=this._prioritySteps.low)throw new Error("TP: the max high level priority should be given a lowerpriority number than the min low priority.")}var t=e.prototype;return t.create=function(e,t,n,r){var i,a=this;return(0,c.Z)(r,(function(o,s){return i={hasEnded:!1,priority:t,trigger:function(){if(!i.hasEnded){var e=function(){u(),a._endTask(i)},t=new p.ZP,u=t.linkToSignal(r);i.interrupter=t,t.signal.register((function(){i.interrupter=null,r.isCancelled()||n.beforeInterrupted()})),a._minPendingPriority=null===a._minPendingPriority?i.priority:Math.min(a._minPendingPriority,i.priority),a._pendingTasks.push(i),i.taskFn(t.signal).then((function(t){n.beforeEnded(),e(),o(t)})).catch((function(n){!r.isCancelled()&&t.isUsed()&&n instanceof p.FU||function(t){e(),s(t)}(n)}))}},taskFn:e,interrupter:null},a._canBeStartedNow(i)?(i.trigger(),a._isRunningHighPriorityTasks()&&a._interruptCancellableTasks()):a._waitingQueue.push(i),function(){return a._endTask(i)}}))},t._endTask=function(e){e.hasEnded=!0;var t=_e(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=_e(e.taskFn,this._pendingTasks);if(n<0)return;this._pendingTasks.splice(n,1),this._pendingTasks.length>0?this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))):this._minPendingPriority=null,this._loopThroughWaitingQueue()}},t.updatePriority=function(e,t){var n=_e(e,this._waitingQueue);if(n>=0){var r=this._waitingQueue[n];if(r.priority===t)return;if(r.priority=t,!this._canBeStartedNow(r))return;return this._findAndRunWaitingQueueTask(n),void(this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks())}var i=_e(e,this._pendingTasks);if(i<0)l.Z.warn("TP: request to update the priority of a non-existent task");else{var a=this._pendingTasks[i];if(a.priority!==t){var o=a.priority;a.priority=t,null===this._minPendingPriority||tt.priority?t.priority:e}),null);if(!(null===e||null!==this._minPendingPriority&&this._minPendingPriority=this._prioritySteps.low)return this._interruptPendingTask(t),this._interruptCancellableTasks()}},t._findAndRunWaitingQueueTask=function(e){return e>=this._waitingQueue.length||e<0?(l.Z.warn("TP : Tried to start a non existing task"),!1):(this._waitingQueue.splice(e,1)[0].trigger(),!0)},t._interruptPendingTask=function(e){var t,n=_e(e.taskFn,this._pendingTasks);n<0?l.Z.warn("TP: Interrupting a non-existent pending task. Aborting..."):(this._pendingTasks.splice(n,1),this._waitingQueue.push(e),0===this._pendingTasks.length?this._minPendingPriority=null:this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))),null===(t=e.interrupter)||void 0===t||t.cancel())},t._canBeStartedNow=function(e){return null===this._minPendingPriority||e.priority<=this._minPendingPriority},t._isRunningHighPriorityTasks=function(){return null!==this._minPendingPriority&&this._minPendingPriority<=this._prioritySteps.high},e}();function _e(e,t){return(0,g.Z)(t,(function(t){return t.taskFn===e}))}var be=function(){function e(e,t,n){var r=new ce(n),i=s.Z.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new ye({prioritySteps:{high:o,low:a}}),this._cdnPrioritizer=r,this._backoffOptions=t}return e.prototype.createSegmentFetcher=function(e,t){var n,i,a,u=function(e,t){var n=t.maxRetryRegular,r=t.maxRetryOffline,i=t.lowLatencyMode,a=t.requestTimeout,o=s.Z.getCurrent(),u=o.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,l=o.DEFAULT_REQUEST_TIMEOUT,d=o.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE,c=o.INITIAL_BACKOFF_DELAY_BASE,f=o.MAX_BACKOFF_DELAY_BASE;return{maxRetryRegular:"image"===e?0:null!=n?n:u,maxRetryOffline:null!=r?r:d,baseDelay:i?c.LOW_LATENCY:c.REGULAR,maxDelay:i?f.LOW_LATENCY:f.REGULAR,requestTimeout:(0,W.Z)(a)?l:a}}(e,this._backoffOptions),d=function(e,t,n,i,a){var s={timeout:a.requestTimeout<0?void 0:a.requestTimeout},u=(0,pe.Z)(["audio","video"],e)?new me:void 0,d=t.loadSegment,c=t.parseSegment;return function(){var e=(0,r.Z)(o().mark((function e(t,r,v){var h,m,g,y,_,b,S,T,E,k,w,A,I,Z,x,R,M,C;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(C=function(){var e;E||!(0,W.Z)(b)&&void 0!==b.size&&void 0!==b.requestDuration&&S.length>0&&S.every((function(e){return e}))&&(E=!0,null===(e=i.onMetrics)||void 0===e||e.call(i,{size:b.size,requestDuration:b.requestDuration,content:t,segmentDuration:T}))},M=function(e){r.onRetry(q(e))},R=function(e,n){S.push(!1);var r=S.length-1;return function(i){var a={data:e,isChunked:n};try{var o=c(a,t,i);return S[r]||(T=void 0!==T&&"media"===o.segmentType&&null!==o.chunkInfos&&void 0!==o.chunkInfos.duration?T+o.chunkInfos.duration:void 0,S[r]=!0,C()),o}catch(e){throw(0,z.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown parsing error"})}}},x=function(e){return d(e,t,s,v,k)},Z=function(){var e;void 0===b&&(l.Z.debug("SF: Segment request cancelled",y),b=null,null===(e=i.onRequestEnd)||void 0===e||e.call(i,{id:_}))},y=(0,ve.K)(t),_=ge(),S=[],T=0,E=!1,k={onProgress:function(e){var t;void 0===b&&void 0!==e.totalSize&&e.size0;){var e=this._queue.shift();void 0!==e&&e.reject(new p.FU)}if("open"===this._mediaSource.readyState)try{l.Z.debug("AVSB: Calling `abort` on the SourceBuffer"),this._sourceBuffer.abort()}catch(e){l.Z.warn("AVSB: Failed to abort a "+this.bufferType+" SourceBuffer:",e instanceof Error?e:"")}},n._onPendingTaskError=function(e){if(this._lastInitSegmentUniqueId=null,null!==this._pendingTask){var t=e instanceof Error?e:new Error("An unknown error occured when doing operations on the SourceBuffer"),n=this._pendingTask;n.type===we.f.Push&&0===n.data.length&&null!==n.inventoryData&&this._segmentInventory.insertChunk(n.inventoryData,!1),this._pendingTask=null,n.reject(t)}},n._addToQueue=function(e,t){var n=this;return(0,c.Z)(t,(function(t,r){var i=0===n._queue.length&&null===n._pendingTask,a=(0,f.Z)({resolve:t,reject:r},e);return n._queue.push(a),i&&n._flush(),function(){var e=n._queue.indexOf(a);e>=0&&n._queue.splice(e,1),a.resolve=h.Z,a.reject=h.Z}}))},n._flush=function(){if(!this._sourceBuffer.updating){if(null!==this._pendingTask){var e=this._pendingTask;if(e.type!==we.f.Push||0===e.data.length){switch(e.type){case we.f.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData,!0);break;case we.f.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case we.f.Remove:this.synchronizeInventory();break;default:(0,ke.Z)(e)}var t=e.resolve;return this._pendingTask=null,t(),void this._flush()}}else{var n=this._queue.shift();if(void 0===n)return;if(n.type!==we.f.Push)this._pendingTask=n;else{var r,i=n.value;try{r=this._preparePushOperation(i.data)}catch(e){this._pendingTask=(0,f.Z)({data:[],inventoryData:i.inventoryInfos},n);var a=e instanceof Error?e:new Error("An unknown error occured when preparing a push operation");return this._lastInitSegmentUniqueId=null,void n.reject(a)}this._pendingTask=(0,f.Z)({data:r,inventoryData:i.inventoryInfos},n)}}try{switch(this._pendingTask.type){case we.f.EndOfSegment:return l.Z.debug("AVSB: Acknowledging complete segment",(0,ve.K)(this._pendingTask.value)),void this._flush();case we.f.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();l.Z.debug("AVSB: pushing segment",this.bufferType,(0,ve.K)(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case we.f.Remove:var s=this._pendingTask.value,u=s.start,d=s.end;l.Z.debug("AVSB: removing data from SourceBuffer",this.bufferType,u,d),this._sourceBuffer.remove(u,d);break;default:(0,ke.Z)(this._pendingTask)}}catch(e){this._onPendingTaskError(e)}}},n._preparePushOperation=function(e){var t=[],n=e.codec,r=e.timestampOffset,i=e.appendWindow,a=!1;if(void 0!==n&&n!==this.codec&&(l.Z.debug("AVSB: updating codec",n),a=function(e,t){if("function"==typeof e.changeType){try{e.changeType(t)}catch(e){return l.Z.warn("Could not call 'changeType' on the given SourceBuffer:",e instanceof Error?e:""),!1}return!0}return!1}(this._sourceBuffer,n),a?this.codec=n:l.Z.debug("AVSB: could not update codec",n,this.codec)),this._sourceBuffer.timestampOffset!==r){var o=r;l.Z.debug("AVSB: updating timestampOffset",this.bufferType,this._sourceBuffer.timestampOffset,o),this._sourceBuffer.timestampOffset=o}if(void 0===i[0])this._sourceBuffer.appendWindowStart>0&&(l.Z.debug("AVSB: re-setting `appendWindowStart` to `0`"),this._sourceBuffer.appendWindowStart=0);else if(i[0]!==this._sourceBuffer.appendWindowStart){if(i[0]>=this._sourceBuffer.appendWindowEnd){var s=i[0]+1;l.Z.debug("AVSB: pre-updating `appendWindowEnd`",s),this._sourceBuffer.appendWindowEnd=s}l.Z.debug("AVSB: setting `appendWindowStart`",i[0]),this._sourceBuffer.appendWindowStart=i[0]}if(void 0===i[1]?this._sourceBuffer.appendWindowEnd!==1/0&&(l.Z.debug("AVSB: re-setting `appendWindowEnd` to `Infinity`"),this._sourceBuffer.appendWindowEnd=1/0):i[1]!==this._sourceBuffer.appendWindowEnd&&(l.Z.debug("AVSB: setting `appendWindowEnd`",i[1]),this._sourceBuffer.appendWindowEnd=i[1]),null!==e.initSegmentUniqueId&&(a||!this._isLastInitSegment(e.initSegmentUniqueId))){var u=this._initSegmentsMap.get(e.initSegmentUniqueId);if(void 0===u)throw new Error("Invalid initialization segment uniqueId");t.push(u),this._lastInitSegmentUniqueId=e.initSegmentUniqueId}return null!==e.chunk&&t.push(e.chunk),t},n._isLastInitSegment=function(e){return null!==this._lastInitSegmentUniqueId&&this._lastInitSegmentUniqueId===e},t}(we.C),Ze=["audio","video","text","image"];function xe(e){return"audio"===e||"video"===e}var Re=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return xe(e)};var t=e.prototype;return t.getBufferTypes=function(){var e=this.getNativeBufferTypes();return null==Te.Z.nativeTextTracksBuffer&&null==Te.Z.htmlTextTracksBuffer||e.push("text"),null!=Te.Z.imageBuffer&&e.push("image"),e},t.getNativeBufferTypes=function(){return"AUDIO"===this._mediaElement.nodeName?["audio"]:["video","audio"]},t.getStatus=function(e){var t=this._initializedSegmentBuffers[e];return void 0===t?{type:"uninitialized"}:null===t?{type:"disabled"}:{type:"initialized",value:t}},t.waitForUsableBuffers=function(e){var t=this;return this._areNativeBuffersUsable()?Promise.resolve():(0,c.Z)(e,(function(e){var n,r=function(){var e=t._onNativeBufferAddedOrDisabled.indexOf(n);e>=0&&t._onNativeBufferAddedOrDisabled.splice(e,1)};return n=function(){t._areNativeBuffersUsable()&&(r(),e())},t._onNativeBufferAddedOrDisabled.push(n),r}))},t.disableSegmentBuffer=function(t){var n=this._initializedSegmentBuffers[t];if(null!==n){if(void 0!==n)throw new Error("Cannot disable an active SegmentBuffer.");this._initializedSegmentBuffers[t]=null,e.isNative(t)&&this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()}))}else l.Z.warn("SBS: The "+t+" SegmentBuffer was already disabled.")},t.createSegmentBuffer=function(e,t,n){void 0===n&&(n={});var r,i=this._initializedSegmentBuffers[e];if(xe(e)){if(null!=i)return i instanceof Ie&&i.codec!==t?l.Z.warn("SB: Reusing native SegmentBuffer with codec",i.codec,"for codec",t):l.Z.info("SB: Reusing native SegmentBuffer with codec",t),i;l.Z.info("SB: Adding native SegmentBuffer with codec",t);var a=new Ie(e,t,this._mediaSource);return this._initializedSegmentBuffers[e]=a,this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()})),a}if(null!=i)return l.Z.info("SB: Reusing a previous custom SegmentBuffer for the type",e),i;if("text"===e){if(l.Z.info("SB: Creating a new text SegmentBuffer"),"html"===n.textTrackMode){if(null==Te.Z.htmlTextTracksBuffer)throw new Error("HTML Text track feature not activated");r=new Te.Z.htmlTextTracksBuffer(this._mediaElement,n.textTrackElement)}else{if(null==Te.Z.nativeTextTracksBuffer)throw new Error("Native Text track feature not activated");r=new Te.Z.nativeTextTracksBuffer(this._mediaElement,!0===n.hideNativeSubtitle)}return this._initializedSegmentBuffers.text=r,r}if("image"===e){if(null==Te.Z.imageBuffer)throw new Error("Image buffer feature not activated");return l.Z.info("SB: Creating a new image SegmentBuffer"),r=new Te.Z.imageBuffer,this._initializedSegmentBuffers.image=r,r}throw l.Z.error("SB: Unknown buffer type:",e),new u.Z("BUFFER_TYPE_UNKNOWN","The player wants to create a SegmentBuffer of an unknown type.")},t.disposeSegmentBuffer=function(e){var t=this._initializedSegmentBuffers[e];null!=t?(l.Z.info("SB: Aborting SegmentBuffer",e),t.dispose(),delete this._initializedSegmentBuffers[e]):l.Z.warn("SB: Trying to dispose a SegmentBuffer that does not exist")},t.disposeAll=function(){var e=this;Ze.forEach((function(t){"initialized"===e.getStatus(t).type&&e.disposeSegmentBuffer(t)}))},t._areNativeBuffersUsable=function(){var e=this,t=this.getNativeBufferTypes();return!t.some((function(t){return void 0===e._initializedSegmentBuffers[t]}))&&!t.every((function(t){return null===e._initializedSegmentBuffers[t]}))},e}(),Me=n(7473),Ce=n.n(Me),Pe=n(3146),De=function(){function e(e){this._weakMap=new WeakMap,this._fn=e}var t=e.prototype;return t.get=function(e){var t=this._weakMap.get(e);if(void 0===t){var n=this._fn(e);return this._weakMap.set(e,n),n}return t},t.destroy=function(e){this._weakMap.delete(e)},e}();function Ne(e,t){var n,r=e.segmentBuffer,i=e.playbackObserver,a=e.maxBufferBehind,o=e.maxBufferAhead;function s(){(function(e,t,n,r,i){return Oe.apply(this,arguments)})(r,n,a.getValue(),o.getValue(),t).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";l.Z.error("Could not run BufferGarbageCollector:",t)}))}i.listen((function(e){var t;n=null!==(t=e.position.pending)&&void 0!==t?t:e.position.last,s()}),{includeLastObservation:!0,clearSignal:t}),a.onUpdate(s,{clearSignal:t}),o.onUpdate(s,{clearSignal:t}),s()}function Oe(){return(Oe=(0,r.Z)(o().mark((function e(t,n,r,i,a){var s,u,d,c,f,v,p,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(isFinite(r)||isFinite(i)){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:s=[],u=(0,m.F_)(t.getBufferedRanges(),n),d=u.innerRange,c=u.outerRanges,f=function(){if(isFinite(i)){for(var e=0;et.start&&s.push({start:n+i,end:t.end})}null!=d&&n+i=t.end?s.push(t):n>=t.end&&n-r>t.start&&n-rd.start&&s.push({start:d.start,end:n-r})}}(),f(),v=0,p=s;case 9:if(!(v0&&n[0].segment.id===e._mediaSegmentAwaitingInitMetadata)){var r=e._mediaSegmentRequest;if(0===n.length){if(null===r)return;return l.Z.debug("Stream: no more media segment to request. Cancelling queue.",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()}if(null===r)return l.Z.debug("Stream: Media segments now need to be requested. Starting queue.",e._content.adaptation.type,n.length),void e._restartMediaSegmentDownloadingQueue();var i=n[0];return r.segment.id!==i.segment.id?(l.Z.debug("Stream: Next media segment changed, cancelling previous",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()):void(r.priority!==i.priority&&(l.Z.debug("Stream: Priority of next media segment changed, updating",e._content.adaptation.type,r.priority,i.priority),e._segmentFetcher.updatePriority(r.request,i.priority)))}}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}),this._downloadQueue.onUpdate((function(t){var n,r=e._initSegmentRequest;null===t.initSegment||null===r?(null===(n=t.initSegment)||void 0===n?void 0:n.segment.id)!==(null==r?void 0:r.segment.id)&&(null===t.initSegment&&l.Z.debug("Stream: no more init segment to request. Cancelling queue.",e._content.adaptation.type),e._restartInitSegmentDownloadingQueue(t.initSegment)):t.initSegment.priority!==r.priority&&e._segmentFetcher.updatePriority(r.request,t.initSegment.priority)}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}))},n.stop=function(){var e;null===(e=this._currentCanceller)||void 0===e||e.cancel(),this._currentCanceller=null},n._restartMediaSegmentDownloadingQueue=function(){var e=this;null!==this._mediaSegmentRequest&&this._mediaSegmentRequest.canceller.cancel();!function t(n){if(null!==e._currentCanceller&&e._currentCanceller.isUsed())e._mediaSegmentRequest=null;else{if(void 0===n)return e._mediaSegmentRequest=null,void e.trigger("emptyQueue",null);var r=new p.ZP,i=null===e._currentCanceller?h.Z:r.linkToSignal(e._currentCanceller.signal),a=n.segment,o=n.priority,s=(0,f.Z)({segment:a},e._content),u=!1,c=!1;r.signal.register((function(){e._mediaSegmentRequest=null,u||(e._mediaSegmentAwaitingInitMetadata===a.id&&(e._mediaSegmentAwaitingInitMetadata=null),u=!0,c=!1)}));var v=function(t){(0,d.Z)("media"===t.segmentType,"Should have loaded a media segment."),e.trigger("parsedMediaSegment",(0,f.Z)({},t,{segment:a}))},m=function(){var n=e._downloadQueue.getValue().segmentQueue;if(0===n.length)return u=!0,void e.trigger("emptyQueue",null);n[0].segment.id===a.id&&n.shift(),u=!0,t(n[0])},g=e._segmentFetcher.createRequest(s,o,{onRetry:function(t){e.trigger("requestRetry",{segment:a,error:t})},beforeInterrupted:function(){l.Z.info("Stream: segment request interrupted temporarly.",a.id,a.time)},onChunk:function(t){var n=e._initSegmentInfoRef.getValue();void 0!==n?v(t(null!=n?n:void 0)):(c=!0,e._initSegmentInfoRef.waitUntilDefined((function(e){v(t(null!=e?e:void 0))}),{clearSignal:r.signal}))},onAllChunksReceived:function(){c?(e._mediaSegmentAwaitingInitMetadata=a.id,e._initSegmentInfoRef.waitUntilDefined((function(){e._mediaSegmentAwaitingInitMetadata=null,c=!1,e.trigger("fullyLoadedSegment",a)}),{clearSignal:r.signal})):e.trigger("fullyLoadedSegment",a)},beforeEnded:function(){i(),e._mediaSegmentRequest=null,c?e._initSegmentInfoRef.waitUntilDefined(m,{clearSignal:r.signal}):m()}},r.signal);g.catch((function(t){i(),u||(u=!0,e.stop(),e.trigger("error",t))})),e._mediaSegmentRequest={segment:a,priority:o,request:g,canceller:r}}}(this._downloadQueue.getValue().segmentQueue[0])},n._restartInitSegmentDownloadingQueue=function(e){var t=this;if((null===this._currentCanceller||!this._currentCanceller.isUsed())&&(null!==this._initSegmentRequest&&this._initSegmentRequest.canceller.cancel(),null!==e)){var n=new p.ZP,r=null===this._currentCanceller?h.Z:n.linkToSignal(this._currentCanceller.signal),i=e.segment,a=e.priority,o=(0,f.Z)({segment:i},this._content),s=!1,u=this._segmentFetcher.createRequest(o,a,{onRetry:function(e){t.trigger("requestRetry",{segment:i,error:e})},beforeInterrupted:function(){l.Z.info("Stream: init segment request interrupted temporarly.",i.id)},beforeEnded:function(){r(),t._initSegmentRequest=null,s=!0},onChunk:function(e){var n,r=e(void 0);(0,d.Z)("init"===r.segmentType,"Should have loaded an init segment."),t.trigger("parsedInitSegment",(0,f.Z)({},r,{segment:i})),"init"===r.segmentType&&t._initSegmentInfoRef.setValue(null!==(n=r.initTimescale)&&void 0!==n?n:null)},onAllChunksReceived:function(){t.trigger("fullyLoadedSegment",i)}},n.signal);u.catch((function(e){r(),s||(s=!0,t.stop(),t.trigger("error",e))})),n.signal.register((function(){t._initSegmentRequest=null,s||(s=!0)})),this._initSegmentRequest={segment:i,priority:a,request:u,canceller:n}}},t}(G.Z);function Ue(e,t,n,r,i){var a=e.period,o=e.adaptation,s=e.representation,u=function(e,t){for(var n=0;n=t.end)return null;if(r.bufferedEnd>t.start)return n}return null}(i,t);if(null===u){if(null===n){if(r&&void 0!==a.end&&t.end>=a.end)return{start:void 0,end:null};var d=s.index.checkDiscontinuity(t.start);if(null!==d)return{start:void 0,end:d}}return null}var c=i[u];if(void 0!==c.bufferedStart&&c.bufferedStart>t.start&&(null===n||c.infos.segment.end<=n)){var f=c.bufferedStart;return r||!1===s.index.awaitSegmentBetween(t.start,f)?(l.Z.debug("RS: current discontinuity encountered",o.type,c.bufferedStart),{start:void 0,end:f}):null}var v=function(e,t,n){if(n<=0)return l.Z.error("RS: Asked to check a discontinuity before the first chunk."),null;for(var r=n;r=t.end)return null;if(i.bufferedStart-a.bufferedEnd>0)return r}return null}(i,t,u+1);if(null!==v){var p=i[v-1],h=i[v];if(null===n||h.infos.segment.end<=n){if(!r&&!1!==s.index.awaitSegmentBetween(p.infos.segment.end,h.infos.segment.time))return null;var m=p.bufferedEnd,g=h.bufferedStart;return l.Z.debug("RS: future discontinuity encountered",o.type,m,g),{start:m,end:g}}}if(null===n){if(r&&void 0!==a.end){if(t.end=0;n--){var r=e[n];if(void 0===r.bufferedStart)return null;if(r.bufferedStart=a.end)return null;for(var b=i.length-1;b>=0;b--){var S=i[b];if(void 0===S.bufferedStart)break;if(S.bufferedStart=n.length-1?null:n[t+1],u=null;if(function(e,t,n){var r=s.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedStart)return l.Z.warn("Stream: Start of a segment unknown. Assuming it is garbage collected by default.",e.start),!0;if(null!==t&&void 0!==t.bufferedEnd&&e.bufferedStart-t.bufferedEnd<.1)return!1;if(nr)return l.Z.info("Stream: The start of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,r,o.start)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.start;if(void 0!==t&&void 0!==a&&t-a>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.start;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(u=a(e.infos),e.bufferedStart))return!1;l.Z.debug("Stream: skipping segment gc-ed at the start",e.start,e.bufferedStart)}if(function(e,t,n){var r=s.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedEnd)return l.Z.warn("Stream: End of a segment unknown. Assuming it is garbage collected by default.",e.end),!0;if(null!==t&&void 0!==t.bufferedStart&&t.bufferedStart-e.bufferedEnd<.1)return!1;if(n>e.bufferedEnd&&e.end-e.bufferedEnd>r)return l.Z.info("Stream: The end of the wanted segment has been garbage collected",e.end,e.bufferedEnd),!0;return!1}(e,i,o.end)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.end;if(void 0!==t&&void 0!==a&&a-t>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.end;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(u=null!=u?u:a(e.infos),e.bufferedEnd))return!1;l.Z.debug("Stream: skipping segment gc-ed at the end",e.end,e.bufferedEnd)}return!0})),g=s.Z.getCurrent(),y=g.MINIMUM_SEGMENT_SIZE,_=g.MIN_BUFFER_AHEAD,b=!1,S=Math.min(1/60,y),T=!1,E=[],k=h.filter((function(e){var t=(0,f.Z)({segment:e},n);if(u.length>0&&u.some((function(e){return(0,ve.z)(t,e)})))return!1;var s=e.duration,d=e.time,h=e.end;if(e.isInit)return!0;if(b)return E.push(e),!1;if(e.complete&&s0&&u.some((function(e){if(e.period.id!==n.period.id||e.adaptation.id!==n.adaptation.id)return!1;var a=e.segment;return!(a.time-S>d)&&(!(a.end+S-S&&w.end-h>-S)return!1}}var A=s*n.representation.bitrate;if(p-A<0&&(T=!0,d>o.start+_))return b=!0,E.push(e),!1;var I=a(t);if(I.length>1){var Z=I[I.length-1],x=I[I.length-2];if(null===Z.buffered&&null===x.buffered)return l.Z.warn("Stream: Segment GCed multiple times in a row, ignoring it.","If this happens a lot and lead to unpleasant experience, please check your device's available memory. If it's low when this message is emitted, you might want to update the RxPlayer's settings (`maxBufferAhead`, `maxVideoBufferSize` etc.) so less memory is used by regular media data buffering."+c.type,v.id,e.time),!1}for(var R=0;Rd){var C=M.start>d+S||Fe(m,R).ende[n].start;)n++;return e[--n]}function Ve(e,t,n,r){var i=s.Z.getCurrent().CONTENT_REPLACEMENT_PADDING;return e.period.id===t.period.id&&(!(e.segment.timea}return rr}(e.representation,t.representation,r)))}function ze(e,t){for(var n=e-t,r=s.Z.getCurrent().SEGMENT_PRIORITIES_STEPS,i=0;i=u&&l.isInitialized()&&!l.isStillAwaitingFutureSegments()&&function(e,t,n){var r,i=e.getPeriodAfter(t);return t.containsTime(n,i)&&e.isLastPeriodKnown&&t.id===(null===(r=e.periods[e.periods.length-1])||void 0===r?void 0:r.id)}(a,o,t)?u-1:t-.1;var d,c=i+n;d=!(!s.index.isInitialized()||s.index.isStillAwaitingFutureSegments()||void 0===o.end)&&(void 0===u?c>=o.end:null===u||c>=u);return{start:Math.max(i,o.start),end:Math.min(c,null!==(r=o.end)&&void 0!==r?r:1/0),hasReachedPeriodEnd:d}}(e,l,i),c=u.index.shouldRefresh(d.start,d.end),f=o.getPendingOperations().filter((function(e){return e.type===we.f.EndOfSegment})).map((function(e){return e.value})),v=function(e,t){for(var n=s.Z.getCurrent().MINIMUM_SEGMENT_SIZE,r=Math.max(1/60,n),i=e.start+r,a=e.end-r,o=[],u=t.length-1;u>=0;u--){var l=t[u],d=l.infos.representation;if(1===l.status&&!1!==d.decipherable&&d.isSupported){var c=l.infos.segment,f=c.time/c.timescale;((c.complete?f+c.duration/c.timescale:l.end)>i&&fi&&l.start0&&(b=Math.min.apply(Math,f.map((function(e){return e.segment.time})))),m.length>0&&(b=null!==b?Math.min(b,m[0].time):m[0].time),y.length>0&&(b=null!==b?Math.min(b,y[0].segment.time):y[0].segment.time),{imminentDiscontinuity:Ue(e,d,b,_,v),hasFinishedLoading:_,neededSegments:y,isBufferFull:g,shouldRefreshManifest:c}}function Ge(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return We(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return We(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function We(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nu.end||e+ni.start&&o.push({start:i.start,end:e-n}),e+n0&&Z.every((function(e){return void 0!==e.keyIds}))&&(I=!0,t.encryptionDataEncountered(Z.map((function(e){return(0,f.Z)({content:r},e)}))),T.isUsed()))return}var x=new Le(r,w,u,A);return x.addEventListener("error",(function(e){E.signal.isCancelled()||(T.cancel(),t.error(e))})),x.addEventListener("parsedInitSegment",M),x.addEventListener("parsedMediaSegment",M),x.addEventListener("emptyQueue",R),x.addEventListener("requestRetry",(function(e){if(t.warning(e.error),!E.signal.isCancelled()){var n=e.segment,r=m.index;!1===r.isSegmentStillAvailable(n)?R():r.canBeOutOfSyncError(e.error,n)&&t.manifestMightBeOufOfSync()}})),x.addEventListener("fullyLoadedSegment",(function(e){o.endOfSegment((0,f.Z)({segment:e},r),T.signal).catch(C)})),x.start(),E.signal.register((function(){x.removeEventListener(),x.stop()})),a.listen(R,{includeLastObservation:!1,clearSignal:E.signal}),r.manifest.addEventListener("manifestUpdate",R,E.signal),g.onUpdate(R,{emitCurrentValue:!1,clearSignal:E.signal}),y.onUpdate(R,{emitCurrentValue:!1,clearSignal:E.signal}),d.onUpdate(R,{emitCurrentValue:!1,clearSignal:E.signal}),void R();function R(){var e,n;if(!E.isUsed()){var i=a.getReference().getValue(),u=null!==(e=i.position.pending)&&void 0!==e?e:i.position.last,f=Ke(r,u,a,b.getValue(),g.getValue(),y.getValue(),o),v=f.neededSegments,p=null;if(m.index.isInitialized()){if(v.length>0&&!k.isLoaded&&null!==k.segment){var h=v[0].priority;p={segment:k.segment,priority:h}}}else if(null===k.segment)l.Z.warn("Stream: Uninitialized index without an initialization segment");else if(k.isLoaded)l.Z.warn("Stream: Uninitialized index with an already loaded initialization segment");else{var _=null!==(n=i.position.pending)&&void 0!==n?n:i.position.last;p={segment:k.segment,priority:ze(c.start,_)}}var A=d.getValue();if(null===A)w.setValue({initSegment:p,segmentQueue:v});else{if(A.urgent)return l.Z.debug("Stream: Urgent switch, terminate now.",S),w.setValue({initSegment:null,segmentQueue:[]}),w.finish(),E.cancel(),void t.terminating();var I=v[0],Z=x.getRequestedInitSegment(),R=x.getRequestedMediaSegment(),M=null===R||void 0===I||R.id!==I.segment.id?[]:[I],P=null===Z?null:p;if(w.setValue({initSegment:P,segmentQueue:M}),0===M.length&&null===P)return l.Z.debug("Stream: No request left, terminate",S),w.finish(),E.cancel(),void t.terminating()}if(t.streamStatusUpdate({period:c,position:i.position.last,bufferType:S,imminentDiscontinuity:f.imminentDiscontinuity,isEmptyStream:!1,hasFinishedLoading:f.hasFinishedLoading,neededSegments:f.neededSegments}),!E.signal.isCancelled()){var D=s.Z.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;if(f.isBufferFull){var N=Math.max(0,u-D);N>0&&o.removeBuffer(0,N,T.signal).catch(C)}f.shouldRefreshManifest&&t.needsManifestRefresh()}}}function M(e){if(!T.isUsed())if("init"===e.segmentType){if(k.isLoaded=!0,!I){var n=m.getAllEncryptionData();if(n.length>0&&(t.encryptionDataEncountered(n.map((function(e){return(0,f.Z)({content:r},e)}))),T.isUsed()))return}if(null!==e.initializationData){var i=m.uniqueId;k.uniqueId=i,o.declareInitSegment(i,e.initializationData),function(e,t){return Qe.apply(this,arguments)}({playbackObserver:a,content:r,initSegmentUniqueId:i,segment:e.segment,segmentData:e.initializationData,segmentBuffer:o},T.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C)}R()}else{var s=e.inbandEvents,u=e.needsManifestRefresh,l=e.protectionDataUpdate;if(!I&&l){var d=m.getAllEncryptionData();if(d.length>0&&(t.encryptionDataEncountered(d.map((function(e){return(0,f.Z)({content:r},e)}))),T.isUsed()))return}if(!0===u&&(t.needsManifestRefresh(),T.isUsed()))return;if(void 0!==s&&s.length>0&&(t.inbandEvent(s),T.isUsed()))return;var c=k.uniqueId;(function(e,t){return $e.apply(this,arguments)})({playbackObserver:a,content:r,initSegmentUniqueId:c,parsedSegment:e,segment:e.segment,segmentBuffer:o},T.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C)}}function C(e){T.isUsed()&&e instanceof p.FU||(T.cancel(),t.error(e))}};var et=function(e,t,n){var r=e.playbackObserver,i=e.content,a=e.options,o=e.representationEstimator,d=e.segmentBuffer,c=e.segmentFetcherCreator,m=e.wantedBufferAhead,g=e.maxVideoBufferSize,y="direct"===a.manualBitrateSwitchingMode,_=i.manifest,b=i.period,S=i.adaptation,T=new p.ZP;T.linkToSignal(n);var E,k=new Map,w=new v.Z(null,T.signal),A=function(e,t,n,r,i,a){var o=e.manifest,s=e.adaptation,l=new v.Z([],a);p(),o.addEventListener("decipherabilityUpdate",p);var d=a.register(h),c=t(e,n,l,r,a),f=c.estimates;return{abrCallbacks:c.callbacks,estimateRef:f};function p(){var e=s.getPlayableRepresentations();if(0===e.length){var t=new u.Z("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+s.type+" Adaptation can be played",{adaptation:s});return h(),void i(t)}var n=l.getValue();n.length===e.length&&n.every((function(t,n){return t.id===e[n].id}))||l.setValue(e)}function h(){o.removeEventListener("decipherabilityUpdate",p),void 0!==d&&d()}}(i,o,w,r,(function(e){T.cancel(),t.error(e)}),T.signal),I=A.estimateRef,Z=A.abrCallbacks,x=c.createSegmentFetcher(S.type,{onRequestBegin:Z.requestBegin,onRequestEnd:Z.requestEnd,onProgress:Z.requestProgress,onMetrics:Z.metrics});function R(e,t,n,i){var o=new p.ZP;o.linkToSignal(T.signal);var s=(0,v.l)(m,(function(t){return t*function(e){var t=k.get(e.id),n=void 0!==t?t:1;void 0===t&&k.set(e.id,n);return n}(e)}),o.signal),u="video"===S.type?g:new v.Z(1/0);l.Z.info("Stream: changing representation",S.type,e.id,e.bitrate);var c=(0,f.Z)({},i,{error:function(r){var a,o=(0,z.Z)(r,{defaultCode:"NONE",defaultReason:"Unknown `RepresentationStream` error"});if("BUFFER_FULL_ERROR"!==o.code)i.error(r);else{var s=m.getValue(),u=.7*(null!==(a=k.get(e.id))&&void 0!==a?a:1);if(u<=.05||s*u<=2)throw o;k.set(e.id,u),(0,$.Z)(4e3,T.signal).then((function(){return R(e,t,n,i)})).catch(h.Z)}},terminating:function(){o.cancel(),i.terminating()}});Je({playbackObserver:r,content:{representation:e,adaptation:S,period:b,manifest:_},segmentBuffer:d,segmentFetcher:x,terminate:t,options:{bufferGoal:s,maxBufferSize:u,drmSystemId:a.drmSystemId,fastSwitchThreshold:n}},c,T.signal)}I.onUpdate((function(e){var n=e.bitrate;void 0!==n&&n!==E&&(E=n,l.Z.debug("Stream: new "+S.type+" bitrate estimate",n),t.bitrateEstimationChange({type:S.type,bitrate:n}))}),{emitCurrentValue:!0,clearSignal:T.signal}),function e(n){var r=new p.ZP;r.linkToSignal(T.signal);var i=I.getValue(),o=i.representation,u=i.manual;if(null===o)return;if(y&&u&&!n){var d=s.Z.getCurrent().DELTA_POSITION_AFTER_RELOAD;return Ce()((function(){if(!r.isUsed()&&I.getValue().manual){var e=d.bitrateSwitch;return t.waitingMediaSourceReload({bufferType:S.type,period:b,timeOffset:e,stayInPeriod:!0})}}))}var c=new v.Z(null,r.signal);I.onUpdate((function(e){if(null!==e.representation&&e.representation.id!==o.id)return e.urgent?(l.Z.info("Stream: urgent Representation switch",S.type),c.setValue({urgent:!0})):(l.Z.info("Stream: slow Representation switch",S.type),c.setValue({urgent:!1}))}),{clearSignal:r.signal,emitCurrentValue:!0});var f=new v.Z(0);a.enableFastSwitching&&I.onUpdate((function(e){f.setValueIfChanged(null==e?void 0:e.knownStableBitrate)}),{clearSignal:r.signal,emitCurrentValue:!0});var h={type:S.type,period:b,representation:o};if(w.setValue(o),T.isUsed())return;if(t.representationChange(h),T.isUsed())return;var m={streamStatusUpdate:t.streamStatusUpdate,encryptionDataEncountered:t.encryptionDataEncountered,manifestMightBeOufOfSync:t.manifestMightBeOufOfSync,needsManifestRefresh:t.needsManifestRefresh,inbandEvent:t.inbandEvent,warning:t.warning,error:function(e){T.cancel(),t.error(e)},addedSegment:function(e){Z.addedSegment(e),T.isUsed()||t.addedSegment(e)},terminating:function(){if(!r.isUsed())return r.cancel(),e(!1)}};R(o,c,f,m)}(!0)},tt=n(9252);var nt=function(e,t){var n=e.split(";"),r=n[0],i=n.slice(1),a=t.split(";"),o=a[0],s=a.slice(1);if(r!==o)return!1;var u=(0,b.Z)(i,(function(e){return(0,tt.Z)(e,"codecs=")})),l=(0,b.Z)(s,(function(e){return(0,tt.Z)(e,"codecs=")}));if(void 0===u||void 0===l)return!1;var d=u.substring(7),c=l.substring(7);return d.split(".")[0]===c.split(".")[0]};function rt(e,t,n,r,i){if(void 0!==e.codec&&"reload"===i.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return nt(e.getMimeTypeString(),t)}))}(n,e.codec))return{type:"needs-reload",value:void 0};var a=e.getBufferedRanges();if(0===a.length)return{type:"continue",value:void 0};var o=(0,m.JN)(a),u=t.start,l=null==t.end?1/0:t.end,d=(0,m.tn)(o,[{start:u,end:l}]);if(0===d.length)return{type:"continue",value:void 0};e.synchronizeInventory();var c=e.getInventory();if(!c.some((function(e){return e.infos.period.id===t.id&&e.infos.adaptation.id!==n.id})))return{type:"continue",value:void 0};var f=function(e,t,n){return e.reduce((function(e,r){if(r.infos.period.id!==t.id||r.infos.adaptation.id!==n.id)return e;var i=r.bufferedStart,a=r.bufferedEnd;return void 0===i||void 0===a||e.push({start:i,end:a}),e}),[])}(c,t,n),v=(0,m.uH)(d,f);if(0===v.length)return{type:"continue",value:void 0};var p=r.currentTime,h=i.audioTrackSwitchingMode;if(("video"===n.type||"audio"===n.type&&"reload"===h)&&(0,m.Ti)({start:u,end:l},p)&&(r.readyState>1||!n.getPlayableRepresentations().some((function(t){var n;return nt(t.getMimeTypeString(),null!==(n=e.codec)&&void 0!==n?n:"")})))&&!(0,m.A1)(f,p))return{type:"needs-reload",value:void 0};var g="audio"===n.type&&"direct"===h,y=[],_=function(e,t){for(var n=0;n=t.start)return n>0?e[n-1]:null;return e.length>0?e[e.length-1]:null}(c,t);null!==_&&(void 0===_.bufferedEnd||t.start-_.bufferedEnd<1)&&y.push({start:0,end:t.start+1});var b=n.type,S=s.Z.getCurrent().ADAPTATION_SWITCH_BUFFER_PADDINGS,T=S[b].before;null==T&&(T=0);var E=S[b].after;if(null==E&&(E=0),g||y.push({start:p-T,end:p+E}),void 0!==t.end){var k=function(e,t){for(var n=0;nt.start)return e[n];return null}(c,t);null!==k&&(void 0===k.bufferedStart||k.bufferedStart-t.end<1)&&y.push({start:t.end-1,end:Number.MAX_VALUE})}var w=(0,m.uH)(v,y);return 0===w.length?{type:"continue",value:void 0}:g?{type:"flush-buffer",value:w}:{type:"clean-buffer",value:w}}function it(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return at(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return at(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=o.end&&(l.Z.debug('Stream: full "empty" AdaptationStream',n),s=!0),i.streamStatusUpdate({period:o,bufferType:n,position:u,imminentDiscontinuity:null,isEmptyStream:!0,hasFinishedLoading:s,neededSegments:[]})}t.onUpdate(u,{emitCurrentValue:!1,clearSignal:a}),e.listen(u,{includeLastObservation:!1,clearSignal:a}),u()}var ut=function(e,t,n){var i=e.bufferType,a=e.content,u=e.garbageCollectors,d=e.playbackObserver,c=e.representationEstimator,h=e.segmentFetcherCreator,g=e.segmentBuffersStore,y=e.options,_=e.wantedBufferAhead,b=e.maxVideoBufferSize,S=a.period,T=new v.Z(void 0,n);if(t.periodStreamReady({type:i,period:S,adaptationRef:T}),!n.isCancelled()){var E,k=!0;T.onUpdate((function(e){(0,r.Z)(o().mark((function r(){var a,c,f,v,h,m,b,T,I,Z,x,R,M,C,P,D;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0!==e){r.next=2;break}return r.abrupt("return");case 2:if((c=new p.ZP).linkToSignal(n),null==E||E.cancel(),E=c,null!==e){r.next=34;break}if(l.Z.info("Stream: Set no "+i+" Adaptation. P:",S.start),"initialized"!==(f=g.getStatus(i)).type){r.next=26;break}if(l.Z.info("Stream: Clearing previous "+i+" SegmentBuffer"),!Re.isNative(i)){r.next=15;break}return r.abrupt("return",A(0,!0,c.signal));case 15:if(v=null!==(a=S.end)&&void 0!==a?a:1/0,!(S.start>v)){r.next=20;break}l.Z.warn("Stream: Can't free buffer: period's start is after its end"),r.next=24;break;case 20:return r.next=22,f.value.removeBuffer(S.start,v,c.signal);case 22:if(!c.isUsed()){r.next=24;break}return r.abrupt("return");case 24:r.next=30;break;case 26:if("uninitialized"!==f.type){r.next=30;break}if(g.disableSegmentBuffer(i),!c.isUsed()){r.next=30;break}return r.abrupt("return");case 30:if(t.adaptationChange({type:i,adaptation:null,period:S}),!c.isUsed()){r.next=33;break}return r.abrupt("return");case 33:return r.abrupt("return",st(d,_,i,{period:S},t,c.signal));case 34:if(h=s.Z.getCurrent(),m=h.DELTA_POSITION_AFTER_RELOAD,b=k?0:"audio"===i?m.trackSwitch.audio:"video"===i?m.trackSwitch.video:m.trackSwitch.other,k=!1,!Re.isNative(i)||"disabled"!==g.getStatus(i).type){r.next=39;break}return r.abrupt("return",A(b,!0,c.signal));case 39:if(l.Z.info("Stream: Updating "+i+" adaptation","A: "+e.id,"P: "+S.start),t.adaptationChange({type:i,adaptation:e,period:S}),!c.isUsed()){r.next=43;break}return r.abrupt("return");case 43:if(T=d.getReadyState(),I=ot(g,i,e,y),Z={currentTime:d.getCurrentTime(),readyState:T},"needs-reload"!==(x=rt(I,S,e,Z,y)).type){r.next=49;break}return r.abrupt("return",A(b,!0,c.signal));case 49:return r.next=51,g.waitForUsableBuffers(c.signal);case 51:if(!c.isUsed()){r.next=53;break}return r.abrupt("return");case 53:if("flush-buffer"!==x.type&&"clean-buffer"!==x.type){r.next=67;break}R=it(x.value);case 55:if((M=R()).done){r.next=63;break}return C=M.value,P=C.start,D=C.end,r.next=59,I.removeBuffer(P,D,c.signal);case 59:if(!c.isUsed()){r.next=61;break}return r.abrupt("return");case 61:r.next=55;break;case 63:if("flush-buffer"!==x.type){r.next=67;break}if(t.needsBufferFlush(),!c.isUsed()){r.next=67;break}return r.abrupt("return");case 67:u.get(I)(c.signal),w(e,I,c.signal);case 69:case"end":return r.stop()}}),r)})))().catch((function(e){e instanceof p.FU||(null==E||E.cancel(),t.error(e))}))}),{clearSignal:n,emitCurrentValue:!0})}function w(e,n,r){var o=a.manifest,s=function(e,t){return e.deriveReadOnlyObserver((function(e,n){var r=new v.Z(i(),n);return e.onUpdate(a,{clearSignal:n,emitCurrentValue:!1}),r;function i(){var n=e.getValue(),r=t.getBufferedRanges(),i=(0,m.L7)(r,n.position.last);return(0,f.Z)({},n,{bufferGap:i})}function a(){r.setValue(i())}}))}(d,n);et({content:{manifest:o,period:S,adaptation:e},options:y,playbackObserver:s,representationEstimator:c,segmentBuffer:n,segmentFetcherCreator:h,wantedBufferAhead:_,maxVideoBufferSize:b},Object.assign(Object.assign({},t),{error:function(e){if(!Re.isNative(i)){l.Z.error("Stream: "+i+" Stream crashed. Aborting it.",e instanceof Error?e:""),g.disposeSegmentBuffer(i);var n=(0,z.Z)(e,{defaultCode:"NONE",defaultReason:"Unknown `AdaptationStream` error"});if(t.warning(n),r.isCancelled())return;return st(d,_,i,{period:S},t,r)}l.Z.error("Stream: "+i+" Stream crashed. Stopping playback.",e instanceof Error?e:""),t.error(e)}}),r)}function A(e,n,r){Ce()((function(){d.listen((function(){t.waitingMediaSourceReload({bufferType:i,period:S,timeOffset:e,stayInPeriod:n})}),{includeLastObservation:!0,clearSignal:r})}))}};function lt(e,t){if(0===t.length)return[];e.synchronizeInventory();for(var n,r=[],i=e.getInventory(),a=function(){var e=i[o];if(t.some((function(t){return e.infos.period.id===t.period.id&&e.infos.adaptation.id===t.adaptation.id&&e.infos.representation.id===t.representation.id}))){var n=e.bufferedStart,a=e.bufferedEnd;if(void 0===n||void 0===a)return l.Z.warn("SO: No buffered start or end found from a segment."),{v:[{start:0,end:Number.MAX_VALUE}]};var s=r[r.length-1];void 0!==s&&s.end===n?s.end=a:r.push({start:n,end:a})}},o=0;o=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?t[t.length-1].end>=n-5:t[0].start<=n+5}var vt=function(e,t,n,i,a,d,c,f){for(var h,m=e.manifest,g=e.initialPeriod,y=d.maxBufferAhead,_=d.maxBufferBehind,b=d.wantedBufferAhead,S=d.maxVideoBufferSize,T=s.Z.getCurrent(),E=T.MINIMUM_MAX_BUFFER_AHEAD,k=T.MAXIMUM_MAX_BUFFER_AHEAD,w=T.MAXIMUM_MAX_BUFFER_BEHIND,A=new De((function(e){var n,r,i=e.bufferType,a=null!==(n=w[i])&&void 0!==n?n:1/0,o=null!==(r=k[i])&&void 0!==r?r:1/0;return function(n){Ne({segmentBuffer:e,playbackObserver:t,maxBufferBehind:(0,v.l)(_,(function(e){return Math.min(e,a)}),n),maxBufferAhead:(0,v.l)(y,(function(e){var t,n=Math.max(e,null!==(t=E[i])&&void 0!==t?t:0);return Math.min(n,o)}),n)},n)}})),I=dt(i.getBufferTypes());!(h=I()).done;){Z(h.value,g)}function Z(e,n){var a=new Pe.Z((function(e,t){return e.start-t.start})),s=!1,d=new p.ZP;return d.linkToSignal(f),t.listen((function(t){var n,r,i=t.position,o=null!==(n=i.pending)&&void 0!==n?n:i.last;if(s&&function(e){var t=a.head(),n=a.last();if(null==t||null==n)return!0;return t.start>e||(null==n.end?1/0:n.end)0;){var u=a.get(a.length()-1);a.removeElement(u),c.periodStreamCleared({type:e,period:u})}d.cancel(),(d=new p.ZP).linkToSignal(f);var h=null!==(r=m.getPeriodForTime(o))&&void 0!==r?r:m.getNextPeriod(o);if(void 0===h)return l.Z.warn("Stream: The wanted position is not found in the Manifest."),void(s=!0);v(h)}}),{clearSignal:f,includeLastObservation:!0}),m.addEventListener("decipherabilityUpdate",(function(e){(function(e){return h.apply(this,arguments)})(e).catch((function(e){d.cancel(),c.error(e)}))}),f),v(n);function v(t){var n=Object.assign(Object.assign({},c),{waitingMediaSourceReload:function(e){var t=a.head();void 0===t||t.id!==e.period.id?c.lockedStream({bufferType:e.bufferType,period:e.period}):c.needsMediaSourceReload({timeOffset:e.timeOffset,minimumPosition:e.stayInPeriod?e.period.start:void 0,maximumPosition:e.stayInPeriod?e.period.end:void 0})},periodStreamReady:function(e){s=!0,a.add(e.period),c.periodStreamReady(e)},periodStreamCleared:function(e){a.removeElement(e.period),c.periodStreamCleared(e)},error:function(e){d.cancel(),c.error(e)}});x(e,t,n,d.signal)}function h(){return h=(0,r.Z)(o().mark((function n(r){var h,g,y,_,b,S,T,E,k,w,A,I,Z;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(h=i.getStatus(e),0!==(g=r.filter((function(t){return t.adaptation.type===e}))).length&&"initialized"===h.type&&!g.every((function(e){return!0===e.representation.decipherable}))){n.next=4;break}return n.abrupt("return");case 4:for(y=h.value,_=g.filter((function(e){return void 0===e.representation.decipherable})),b=g.filter((function(e){return!1===e.representation.decipherable})),S=lt(y,b),T=lt(y,_),s=!1,l.Z.info("Stream: Destroying all PeriodStreams for decipherability matters",e);a.length()>0;)E=a.get(a.length()-1),a.removeElement(E),c.periodStreamCleared({type:e,period:E});d.cancel(),(d=new p.ZP).linkToSignal(f),k=0,w=[].concat(S,T);case 16:if(!(k=r.end){var d=m.getPeriodAfter(r);if(r.containsTime(u,d))return;l.Z.info("Stream: Destroying PeriodStream as the current playhead moved above it",e,r.start,null!==(a=s.pending)&&void 0!==a?a:s.last,r.end),n(),o.periodStreamCleared({type:e,period:r}),c.cancel()}}),{clearSignal:s,includeLastObservation:!0});var f={bufferType:e,content:{manifest:m,period:r},garbageCollectors:A,maxVideoBufferSize:S,segmentFetcherCreator:a,segmentBuffersStore:i,options:d,playbackObserver:t,representationEstimator:n,wantedBufferAhead:b},v=Object.assign(Object.assign({},o),{streamStatusUpdate:function(t){if(t.hasFinishedLoading){var n=m.getPeriodAfter(r);null!==n&&function(t){if(null!==u){if(u.period.id===t.id)return;l.Z.warn("Stream: Creating next `PeriodStream` while one was already created.",e,t.id,u.period.id),o.periodStreamCleared({type:e,period:u.period}),u.canceller.cancel()}var n=new p.ZP;n.linkToSignal(s),u={canceller:n,period:t},x(e,t,o,u.canceller.signal)}(n)}else null!==u&&(l.Z.info("Stream: Destroying next PeriodStream due to current one being active",e,u.period.start),o.periodStreamCleared({type:e,period:u.period}),u.canceller.cancel(),u=null);o.streamStatusUpdate(t)},error:function(e){null!==u&&(u.canceller.cancel(),u=null),c.cancel(),o.error(e)}});ut(f,v,c.signal)}},pt=vt,ht=n(9420);function mt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return gt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);na.getMaximumAvailablePosition()){var l=new u.Z("MEDIA_TIME_AFTER_MANIFEST","The current position is after the latest time announced in the Manifest.");i.trigger("warning",l)}}),{includeLastObservation:!0,clearSignal:o}),t.addEventListener("manifestUpdate",(function(){i.trigger("endingPositionChange",i._getManifestEndTime()),o.isCancelled()||i._checkEndOfStream()}),o),i}(0,i.Z)(t,e);var n=t.prototype;return n.getCurrentEndingTime=function(){return this._getManifestEndTime()},n.onAdaptationChange=function(e,t,n){if(this._manifest.isLastPeriodKnown){var r=this._manifest.periods[this._manifest.periods.length-1];if(t.id===(null==r?void 0:r.id)&&("audio"===e||"video"===e)){"audio"===e?this._maximumPositionCalculator.updateLastAudioAdaptation(n):this._maximumPositionCalculator.updateLastVideoAdaptation(n);var i=this._maximumPositionCalculator.getEndingPosition(),a=void 0!==i?{isEnd:!0,endingPosition:i}:{isEnd:!1,endingPosition:this._maximumPositionCalculator.getMaximumAvailablePosition()};this.trigger("endingPositionChange",a)}}this._canceller.isUsed()||null===n&&this._addActivelyLoadedPeriod(t,e)},n.onRepresentationChange=function(e,t){this._addActivelyLoadedPeriod(t,e)},n.onPeriodCleared=function(e,t){this._removeActivelyLoadedPeriod(t,e)},n.onLastSegmentFinishedLoading=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod||(t.hasFinishedLoadingLastPeriod=!0,this._checkEndOfStream())},n.onLastSegmentLoadingResume=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod&&(t.hasFinishedLoadingLastPeriod=!1,this._checkEndOfStream())},n.dispose=function(){this.removeEventListener(),this._canceller.cancel()},n._addActivelyLoadedPeriod=function(e,t){var n=this._lazilyCreateActiveStreamInfo(t);n.activePeriods.has(e)||(n.activePeriods.add(e),this._checkCurrentPeriod())},n._removeActivelyLoadedPeriod=function(e,t){var n=this._activeStreams.get(t);void 0!==n&&n.activePeriods.has(e)&&(n.activePeriods.removeElement(e),this._checkCurrentPeriod())},n._checkCurrentPeriod=function(){var e=this;if(0!==this._allBufferTypes.length){var t=this._activeStreams.get(this._allBufferTypes[0]);if(void 0!==t)for(var n,r,i=function(){for(var t=r.value,n=!0,i=1;i=0;a--){var o=i[a];try{"open"===r&&(l.Z.info("Init: Aborting SourceBuffer before removing"),o.abort()),l.Z.info("Init: Removing SourceBuffer from mediaSource"),t.removeSourceBuffer(o)}catch(e){l.Z.warn("Init: Error while disposing SourceBuffer",e instanceof Error?e:"")}}i.length>0&&l.Z.warn("Init: Not all SourceBuffers could have been removed.")}if(l.Z.info("Init: Clearing HTMLMediaElement's src"),(0,Tt.Z)(e),null!==n)try{l.Z.debug("Init: Revoking previous URL"),URL.revokeObjectURL(n)}catch(e){l.Z.warn("Init: Error while revoking the media source URL",e instanceof Error?e:"")}}function It(e,t){return(0,c.Z)(t,(function(n){var r=function(e,t){if(null==Et.J)throw new u.Z("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=(0,wt.Z)(e.src)?e.src:null;At(e,null,n),l.Z.info("Init: Creating MediaSource");var r=new Et.J,i=URL.createObjectURL(r);return l.Z.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){At(e,r,i)})),r}(e,t);kt.u_(r,(function(){l.Z.info("Init: MediaSource opened"),n(r)}),t)}))}function Zt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return xt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function xt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?a:Math.max(i,a+c)}if(!(0,W.Z)(n.fromLivePosition)){l.Z.debug("Init: using startAt.fromLivePosition");var f=null!==(r=e.getLivePosition())&&void 0!==r?r:a,v=n.fromLivePosition;return v>=0?f:Math.max(i,f+v)}if(!(0,W.Z)(n.percentage)){l.Z.debug("Init: using startAt.percentage");var p=n.percentage;return p>100?a:p<0?i:i+(a-i)*(+p/100)}}var h=e.getMinimumSafePosition();if(e.isLive){var m,g=e.suggestedPresentationDelay,y=e.clockOffset,_=e.getMaximumSafePosition(),b=s.Z.getCurrent().DEFAULT_LIVE_GAP;if(void 0===y)l.Z.info("Init: no clock offset found for a live content, starting close to maximum available position"),m=_;else{l.Z.info("Init: clock offset found for a live content, checking if we can start close to it");var S=void 0===e.availabilityStartTime?0:e.availabilityStartTime,T=(performance.now()+y)/1e3-S;m=Math.min(_,T)}var E=void 0!==g?g:t?b.LOW_LATENCY:b.DEFAULT;return l.Z.debug("Init: "+m+" defined as the live time, applying a live gap of "+E),Math.max(m-E,h)}return l.Z.info("Init: starting at the minimum available position:",h),h}var Nt=n(379),Ot=n(9016),Lt=n(7794),Ut=n(3666);var Bt=31536e3,Ft=function(){function e(e){this._mediaSource=e,this._currentMediaSourceDurationUpdateCanceller=null}var t=e.prototype;return t.updateDuration=function(e,t){null!==this._currentMediaSourceDurationUpdateCanceller&&this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=new p.ZP;var n=this._mediaSource,r=this._currentMediaSourceDurationUpdateCanceller.signal,i=function(e,t){var n=new v.Z("open"===e.readyState,t);return(0,kt.u_)(e,(function(){l.Z.debug("Init: Reacting to MediaSource open in duration updater"),n.setValueIfChanged(!0)}),t),(0,kt.N8)(e,(function(){l.Z.debug("Init: Reacting to MediaSource ended in duration updater"),n.setValueIfChanged(!1)}),t),(0,kt.k6)(e,(function(){l.Z.debug("Init: Reacting to MediaSource close in duration updater"),n.setValueIfChanged(!1)}),t),n}(n,r),a=new p.ZP;a.linkToSignal(r),i.onUpdate((function(){if(a.cancel(),!i.getValue())return;(a=new p.ZP).linkToSignal(r);var o=function(e,t){if(0===e.length){var n=new v.Z(!1);return n.finish(),n}var r=new v.Z(!1,t);o();for(var i=function(){var n=e[a];n.addEventListener("updatestart",o),n.addEventListener("update",o),t.register((function(){n.removeEventListener("updatestart",o),n.removeEventListener("update",o)}))},a=0;a0&&(i=Math.max(o.buffered.end(s-1)))}if(r===e.duration)return"success";if(i>r){if(i=.1?c=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function qt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);no||void 0!==f&&o>=f)&&(Xt(d)&&u.push(d.publicEvent),this._eventsBeingPlayed.delete(d)):c<=o&&void 0!==f&&o=(null!=f?f:c)&&(a?s.push({type:"stream-event-skip",value:d.publicEvent}):(s.push({type:"stream-event",value:d.publicEvent}),Xt(d)&&u.push(d.publicEvent)))}if(s.length>0)for(var v,p=jt(s);!(v=p()).done;){var h=v.value;if("stream-event"===h.type?this.trigger("event",h.value):this.trigger("eventSkip",h.value),r.isCancelled())return}if(u.length>0)for(var m,g=jt(u);!(m=g()).done;){var y=m.value;if("function"==typeof y.onExit&&y.onExit(),r.isCancelled())return}},t}(G.Z);function Xt(e){return void 0!==e.end}var Qt=Yt,$t=n(4576);function Jt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return en(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return en(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function en(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nd.end&&(t=d.end-1)}}else t=u;return{maximumPosition:o.getMaximumSafePosition(),position:{last:n.position,pending:t},duration:n.duration,paused:{last:n.paused,pending:i.getValue()||!r===n.paused?void 0:!r},readyState:n.readyState,speed:l}}function f(){d.setValue(c())}}))}(h,{autoPlay:a,manifest:d,initialPlayPerformed:w,initialSeekPerformed:A,speed:_,startTime:l},n),Z=this._createRebufferingController(h,d,_,n),x=this._createContentTimeBoundariesObserver(d,f,I,T,n);k.then((function(){(0,Nt.Z)(h,c,!1,n).onUpdate((function(e,t){e&&(t(),i.trigger("loaded",{segmentBuffersStore:T}))}),{emitCurrentValue:!0,clearSignal:n})})).catch((function(e){n.isCancelled()||i._onFatalError(e)}));var R=this;pt({manifest:d,initialPeriod:b},I,g,T,y,o,{needsBufferFlush:function(){var e=c.currentTime+.001;h.setCurrentTime(e),h.listen((function(t,n){(null!==t.currentRange||t.position>e+.1)&&(n(),h.setCurrentTime(t.position+.001))}),{includeLastObservation:!1,clearSignal:n})},streamStatusUpdate:function(e){var t=e.period,r=e.bufferType,i=e.imminentDiscontinuity,a=e.position;Z.updateDiscontinuityInfo({period:t,bufferType:r,discontinuity:i,position:a}),n.isCancelled()||d.isLastPeriodKnown&&e.period.id===d.periods[d.periods.length-1].id&&(e.hasFinishedLoading||e.isEmptyStream?x.onLastSegmentFinishedLoading(e.bufferType):x.onLastSegmentLoadingResume(e.bufferType))},needsManifestRefresh:function(){return R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!0,canUseUnsafeMode:!0})},manifestMightBeOufOfSync:function(){var e=s.Z.getCurrent().OUT_OF_SYNC_MANIFEST_REFRESH_DELAY;R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!1,canUseUnsafeMode:!1,delay:e})},lockedStream:function(e){return Z.onLockedStream(e.bufferType,e.period)},adaptationChange:function(e){R.trigger("adaptationChange",e),n.isCancelled()||x.onAdaptationChange(e.type,e.period,e.adaptation)},representationChange:function(e){R.trigger("representationChange",e),n.isCancelled()||x.onRepresentationChange(e.type,e.period)},inbandEvent:function(e){return R.trigger("inbandEvents",e)},warning:function(e){return R.trigger("warning",e)},periodStreamReady:function(e){return R.trigger("periodStreamReady",e)},periodStreamCleared:function(e){x.onPeriodCleared(e.type,e.period),n.isCancelled()||R.trigger("periodStreamCleared",e)},bitrateEstimationChange:function(e){return R.trigger("bitrateEstimationChange",e)},addedSegment:function(e){return R.trigger("addedSegment",e)},needsMediaSourceReload:function(e){var n,r,i=I.getReference().getValue(),a=null!==(n=i.position.pending)&&void 0!==n?n:I.getCurrentTime(),o=null!==(r=i.paused.pending)&&void 0!==r?r:I.getIsPaused(),s=a+e.timeOffset;void 0!==e.minimumPosition&&(s=Math.max(e.minimumPosition,s)),void 0!==e.maximumPosition&&(s=Math.min(e.maximumPosition,s)),t({position:s,autoPlay:!o})},needsDecipherabilityFlush:function(){var e,n,r,i,a=(0,V.Z)(c);if(void 0===(i=null==a?void 0:a[0])||i.indexOf("widevine")<0){var o=I.getReference().getValue(),s=null!==(e=o.position.pending)&&void 0!==e?e:I.getCurrentTime(),u=null!==(n=o.paused.pending)&&void 0!==n?n:I.getIsPaused();t({position:s,autoPlay:!u})}else{var l=I.getReference().getValue(),d=null!==(r=l.position.pending)&&void 0!==r?r:I.getCurrentTime();d+.0010)return l.setValue(!0),void u.cancel();var a=r.lV?4:3;return e.readyState>=a&&(null!==e.currentRange||e.ended)&&(!(0,i.Z)()||t.duration>0)?(l.setValue(!0),void u.cancel()):void 0}}),{includeLastObservation:!0,clearSignal:u.signal}),l}},9016:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(1669),i=n(3774),a=n(3666);var o=n(3714),s=n(3887),u=n(5095);function l(e,t,n,l,d,c,f){var v,p,h=new Promise((function(e,t){v=e,p=t})),m=new u.Z(!1,f),g=new u.Z(!1,f);e.addEventListener("loadedmetadata",_);var y=f.register((function(t){e.removeEventListener("loadedmetadata",_),p(t)}));return e.readyState>=i.c.HAVE_METADATA&&_(),{autoPlayResult:h,initialPlayPerformed:g,initialSeekPerformed:m};function _(){e.removeEventListener("loadedmetadata",_);var i=!1,u=function(e){s.Z.info("Init: Set initial time",e),t.setCurrentTime(e),i=!0,m.setValue(!0),m.finish()},h="function"==typeof n?n():n;if((a.GQ||a.YM)&&0===h?(m.setValue(!0),m.finish()):c&&a.SB?setTimeout((function(){u(h)}),0):u(h),(0,r.Z)()&&0===e.duration){var b=new o.Z("MEDIA_ERR_NOT_LOADED_METADATA","Cannot load automatically: your browser falsely announced having loaded the content.");d(b)}if(!f.isCancelled()){var S=i;t.listen((function(t,n){i&&t.seeking?S=!1:!S&&!t.seeking&&null===t.rebuffering&&t.readyState>=1&&(n(),function(){var t,n;if(s.Z.info("Init: Can begin to play content"),!l)return e.autoplay&&s.Z.warn("Init: autoplay is enabled on HTML media element. Media will play as soon as possible."),g.setValue(!0),g.finish(),y(),v({type:"skipped"});if(e.ended)return s.Z.warn("Init: autoplay is enabled but the video is ended. Skipping autoplay to prevent video to start again"),g.setValue(!0),g.finish(),y(),v({type:"skipped"});try{n=null!==(t=e.play())&&void 0!==t?t:Promise.resolve()}catch(e){return y(),p(e)}n.then((function(){if(!f.isCancelled())return g.setValue(!0),g.finish(),y(),v({type:"autoplay"})})).catch((function(e){if(y(),!f.isCancelled()){if(e instanceof Error&&"NotAllowedError"===e.name){s.Z.warn("Init: Media element can't play. It may be due to browser auto-play policies.");var t=new o.Z("MEDIA_ERR_BLOCKED_AUTOPLAY","Cannot trigger auto-play automatically: your browser does not allow it.");if(d(t),f.isCancelled())return;return v({type:"autoplay-blocked"})}p(e)}}))}())}),{includeLastObservation:!0,clearSignal:f})}}}},7794:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(5157),i=n(7874),a=n(3887),o=n(5095),s=n(288),u=n(4339);function l(e,t,n,l,d){if(0===t.length)return h("No `keySystems` option given.");if(null===i.Z.decrypt)return h("EME feature not activated.");var c=new s.ZP;c.linkToSignal(d);var f=new o.Z({initializationState:{type:"uninitialized",value:null},drmSystemId:void 0},d),v=i.Z.decrypt;if(!v.hasEmeApis())return h("EME API not available on the current page.");a.Z.debug("Init: Creating ContentDecryptor");var p=new v(e,t);return p.addEventListener("stateChange",(function(e){if(e===u.u.WaitingForAttachment){var t=new o.Z(!1);t.onUpdate((function(t,n){t&&(n(),e===u.u.WaitingForAttachment&&p.attach())}),{clearSignal:c.signal}),f.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:p.systemId})}else e===u.u.ReadyForContent&&(f.setValue({initializationState:{type:"initialized",value:null},drmSystemId:p.systemId}),p.removeEventListener("stateChange"))})),p.addEventListener("error",(function(e){c.cancel(),l.onError(e)})),p.addEventListener("warning",(function(e){l.onWarning(e)})),n.onUpdate((function(e){null!==e&&p.onInitializationData(e)}),{clearSignal:c.signal}),c.signal.register((function(){p.dispose()})),f;function h(e){n.onUpdate((function(t,n){if(null!==t){n();var i=new r.Z("MEDIA_IS_ENCRYPTED_ERROR",e);l.onError(i)}}),{clearSignal:d});var t=new o.Z({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return t.finish(),t}}},6199:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(4578),i=n(3666).yS,a=n(6872),o=n(3714),s=n(3887),u=n(1959),l=n(2829),d=n(288),c=1/60,f=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._playbackObserver=t,i._manifest=n,i._speed=r,i._discontinuitiesStore=[],i._isStarted=!1,i._canceller=new d.ZP,i}(0,r.Z)(t,e);var n=t.prototype;return n.start=function(){var e=this;if(!this._isStarted){var t;this._isStarted=!0;var n=null,r=new h(this._playbackObserver,this._speed);this._canceller.signal.register((function(){r.dispose()}));var o=null;this._playbackObserver.listen((function(u){var d,f,v=e._discontinuitiesStore,h=u.buffered,m=u.position,g=u.readyState,y=u.rebuffering,_=u.freezing,b=a.Z.getCurrent(),S=b.BUFFER_DISCONTINUITY_THRESHOLD,T=b.FORCE_DISCONTINUITY_SEEK_DELAY,E=b.FREEZING_STALLED_DELAY,k=b.UNFREEZING_SEEK_DELAY,w=b.UNFREEZING_DELTA_POSITION;if(!u.seeking&&i&&null===n&&null!==t&&u.positionk&&(s.Z.warn("Init: trying to seek to un-freeze player"),e._playbackObserver.setCurrentTime(e._playbackObserver.getCurrentTime()+w),o={attemptTimestamp:I}),I-_.timestamp>E)return null===y||null!==n?r.stopRebuffering():r.startRebuffering(),void e.trigger("stalled","freezing")}else o=null;if(null===y)return r.stopRebuffering(),1===g?(f=u.seeking?null!==u.pendingInternalSeek?"internal-seek":"seeking":"not-ready",void e.trigger("stalled",f)):void e.trigger("unstalled",null);var Z="seeking"===y.reason&&null!==u.pendingInternalSeek?"internal-seek":y.reason;if(null!==n){var x=performance.now();if(x-n0){var M=function(e,t,n){if(0===e.length)return null;for(var r=null,i=0;in)return r;var o=void 0;if(void 0===a.end||a.end>n){var u=e[i],l=u.discontinuity,d=u.position,f=l.start,v=l.end;if(n>=(null!=f?f:d)-c)if(null===v){var p=t.getPeriodAfter(a);null!==p?o=p.start+c:s.Z.warn("Init: discontinuity at Period's end but no next Period")}else no?r:o)}}return r}(v,e._manifest,R);if(null!==M){var C=M+.001;if(!(C<=e._playbackObserver.getCurrentTime()))return s.Z.warn("SA: skippable discontinuity found in the stream",m,C),e._playbackObserver.setCurrentTime(C),void e.trigger("warning",p(R,C));s.Z.info("Init: position to seek already reached, no seeking",e._playbackObserver.getCurrentTime(),C)}}var P=null!=R?R:m,D=(0,l.XS)(h,P);if(e._speed.getValue()>0&&D=0;O--){var L=e._manifest.periods[O];if(void 0!==L.end&&L.end<=P){if(e._manifest.periods[O+1].start>P&&e._manifest.periods[O+1].start>e._playbackObserver.getCurrentTime()){var U=e._manifest.periods[O+1];return e._playbackObserver.setCurrentTime(U.start),void e.trigger("warning",p(P,U.start))}break}}e.trigger("stalled",Z)}else e.trigger("stalled",Z)}),{includeLastObservation:!0,clearSignal:this._canceller.signal})}},n.updateDiscontinuityInfo=function(e){this._isStarted||this.start();var t=this._playbackObserver.getReference().getValue();!function(e,t,n){for(;e.length>0&&void 0!==e[0].period.end&&e[0].period.end+10r.start)return void(v(t)&&e.splice(a,0,t));v(t)&&e.push(t)}(this._discontinuitiesStore,e,t)},n.onLockedStream=function(e,t){var n;this._isStarted||this.start();var r=this._playbackObserver.getReference().getValue();if(!(!r.rebuffering||r.paused||this._speed.getValue()<=0||"audio"!==e&&"video"!==e)){var i=r.position,a=null!==(n=r.rebuffering.position)&&void 0!==n?n:i,o=t.start;i=0;n--){if(e[n].startt)return e.slice(n,e.length)}return[]}function m(e,t,n){var r=Math.max(e.start,t),i=p(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=h(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var g=function(){function e(){this._cuesBuffer=[]}var t=e.prototype;return t.get=function(e){for(var t=this._cuesBuffer,n=[],r=t.length-1;r>=0;r--){var i=t[r];if(e=i.start){for(var a=i.cues,o=0;o=a[o].start&&e0)for(var s=0;se){var a=r[i];if(a.start>=n)return;if(a.end>=n){if(e<=a.start)a.cues=h(a.cues,n),a.start=n;else{var o=m(a,e,n),s=o[0],u=o[1];this._cuesBuffer[i]=s,r.splice(i+1,0,u)}return}a.start>=e?(r.splice(i,1),i--):(a.cues=p(a.cues,e),a.end=Math.max(e,a.start))}},t.insert=function(e,t,n){var r=this._cuesBuffer,i={start:t,end:n,cues:e},a=Math.abs(t-n)/5;function o(e){var t=r[e];void 0===t||v(i.end,t.end,a)?r[e]=i:(t.start>=i.end||(t.cues=h(t.cues,i.end),t.start=i.end),r.splice(e,0,i))}for(var s=0;su.end);return void o(s)}if(tu.end);return void o(s)}if(v(u.end,n,a))return u.cues=p(u.cues,t),u.end=t,void r.splice(s+1,0,i);if(u.end>n){var l=m(u,t,n),d=l[0],c=l[1];return this._cuesBuffer[s]=d,r.splice(s+1,0,i),void r.splice(s+2,0,c)}u.cues=p(u.cues,t),u.end=t;var f=s+1;for(u=r[f];void 0!==u&&n>u.end;)r.splice(f,1),u=r[f];return void o(f)}}if(r.length){var g=r[r.length-1];v(g.end,t,a)&&(g.end=t)}r.push(i)},e}();function y(e,t,n,r){for(var i=[t/n.columns,e/n.rows],a=r.getElementsByClassName("proportional-style"),o=0;o0}var _=i.M4,b=i.bQ,S=i.Q$;function T(e,t){try{e.removeChild(t)}catch(e){a.Z.warn("HTSB: Can't remove text track: not in the element.")}}function E(e){var t=e.getAttribute("data-resolution-rows"),n=e.getAttribute("data-resolution-columns");if(null===t||null===n)return null;var r=parseInt(t,10),i=parseInt(n,10);return null===r||null===i?null:{rows:r,columns:i}}var k=function(e){function t(t,n){var r;return a.Z.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new c.Z,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new l.ZP,r._canceller=new l.ZP,r._buffer=new g,r._currentCues=[],r.autoRefreshSubtitles(r._canceller.signal),r}(0,r.Z)(t,e);var n=t.prototype;return n.declareInitSegment=function(e){a.Z.warn("ISB: Declaring initialization segment for image SegmentBuffer",e)},n.freeInitSegment=function(e){a.Z.warn("ISB: Freeing initialization segment for image SegmentBuffer",e)},n.pushChunk=function(e){try{this.pushChunkSync(e)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this.removeBufferSync(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("HTSB: Disposing HTMLTextSegmentBuffer"),this._disableCurrentCues(),this._buffer.remove(0,1/0),this._buffered.remove(0,1/0),this._canceller.cancel()},n.pushChunkSync=function(e){var t,n;a.Z.debug("HTSB: Appending new html text tracks");var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk;if(null!==s){var u,l,d=s.start,c=s.end,v=s.data,p=s.type,h=s.language,m=null!==(t=o[0])&&void 0!==t?t:0,g=null!==(n=o[1])&&void 0!==n?n:1/0,y=function(e,t,n,r){a.Z.debug("HTSB: Finding parser for html text tracks:",e);var i=f.Z.htmlTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("HTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("HTTB: Parsed successfully!",o.length),o}(p,v,i,h);if(0!==m&&g!==1/0){for(var _=0;_=0&&y[_].start>=g;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].end>g;)y[_].end=g,_--}if(void 0!==d)u=Math.max(m,d);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor start time. Aborting");a.Z.warn("HTSB: No start time given. Guessing from cues."),u=y[0].start}if(void 0!==c)l=Math.min(g,c);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor end time. Aborting");a.Z.warn("HTSB: No end time given. Guessing from cues."),l=y[y.length-1].end}l<=u?a.Z.warn("HTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."):(null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos,!0),this._buffer.insert(y,u,l),this._buffered.insert(u,l))}},n.removeBufferSync=function(e,t){a.Z.debug("HTSB: Removing html text track data",e,t),this._buffer.remove(e,t),this._buffered.remove(e,t)},n._disableCurrentCues=function(){if(this._sizeUpdateCanceller.cancel(),this._currentCues.length>0){for(var e=0;e0){this._sizeUpdateCanceller=new l.ZP,this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);var c=u.Z.getCurrent().TEXT_TRACK_SIZE_CHECKS_INTERVAL,f=function(e,t,n){var r=e.getBoundingClientRect(),i=r.height,u=r.width,l=new o.Z({height:i,width:u},n),d=i,c=u;if(void 0!==s){var f=new s((function(e){if(0!==e.length){var t=e[0].contentRect,n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}else a.Z.error("Compat: Resized but no observed element.")}));f.observe(e),n.register((function(){f.disconnect()}))}else{var v=setInterval((function(){var t=e.getBoundingClientRect(),n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}),t);n.register((function(){clearInterval(v)}))}return l}(this._textTrackElement,c,this._sizeUpdateCanceller.signal);f.onUpdate((function(e){for(var t=e.height,n=e.width,r=0;r0?e.textTracks[u-1]:e.addTextTrack(s)).mode=t?null!==(n=a.HIDDEN)&&void 0!==n?n:"hidden":null!==(r=a.SHOWING)&&void 0!==r?r:"showing"}else o=document.createElement("track"),e.appendChild(o),a=o.track,o.kind=s,a.mode=t?"hidden":"showing";return{track:a,trackElement:o}}(t,n),s=o.track,l=o.trackElement;return r.bufferType="text",r._buffered=new u.Z,r._videoElement=t,r._track=s,r._trackElement=l,r}(0,r.Z)(t,e);var n=t.prototype;return n.declareInitSegment=function(e){a.Z.warn("ISB: Declaring initialization segment for image SegmentBuffer",e)},n.freeInitSegment=function(e){a.Z.warn("ISB: Freeing initialization segment for image SegmentBuffer",e)},n.pushChunk=function(e){var t,n;if(a.Z.debug("NTSB: Appending new native text tracks"),null===e.data.chunk)return Promise.resolve();var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk,u=s.start,d=s.end,c=s.data,f=s.type,v=s.language,p=null!==(t=o[0])&&void 0!==t?t:0,h=null!==(n=o[1])&&void 0!==n?n:1/0;try{var m,g,y=function(e,t,n,r){a.Z.debug("NTSB: Finding parser for native text tracks:",e);var i=l.Z.nativeTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("NTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("NTSB: Parsed successfully!",o.length),o}(f,c,i,v);if(0!==p&&h!==1/0){for(var _=0;_=0&&y[_].startTime>=h;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].endTime>h;)y[_].endTime=h,_--}if(void 0!==u)m=Math.max(p,u);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor start time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No start time given. Guessing from cues."),m=y[0].startTime}if(void 0!==d)g=Math.min(h,d);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor end time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No end time given. Guessing from cues."),g=y[y.length-1].endTime}if(g<=m)return a.Z.warn("NTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."),Promise.resolve();if(y.length>0){var b=y[0],S=this._track.cues;null!==S&&S.length>0&&b.startTime=0;i--){var s=r[i],u=s.startTime,l=s.endTime;u>=e&&u<=t&&l<=t&&o(n,s)}this._buffered.remove(e,t)},t}(s.C)},9612:function(e,t,n){"use strict";n.d(t,{C:function(){return y},f:function(){return m}});var r=n(6872),i=n(3887),a=n(520);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this._history=this._history.splice(r)),this._history.length>this._maxHistoryLength){var a=this._history.length-this._maxHistoryLength;this._history=this._history.splice(a)}},e}();function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var A=f[E+w-1];k={end:null!==(a=A.bufferedEnd)&&void 0!==a?a:A.end,precizeEnd:A.precizeEnd},i.Z.debug("SI: "+w+" segments GCed.",y);for(var I,Z=l(f.splice(E,w));!(I=Z()).done;){var x=I.value;void 0===x.bufferedStart&&void 0===x.bufferedEnd&&2!==x.status&&this._bufferedHistory.addBufferedSegment(x.infos,null)}v=E}if(void 0===m)return;if(T-(null!==(o=m.bufferedStart)&&void 0!==o?o:m.start)>=g){if(p(m,S,k,y),v===f.length-1)return void h(m,T,y);for(var R=null!==(s=(m=f[++v]).bufferedStart)&&void 0!==s?s:m.start,M=null!==(u=m.bufferedEnd)&&void 0!==u?u:m.end,C=b<_-1?e.start(b+1):void 0;void 0!==m&&T-R>=g&&(void 0===C||T-R>=M-C);){var P=f[v-1];void 0===P.bufferedEnd&&(P.bufferedEnd=m.precizeStart?m.start:P.end,i.Z.debug("SI: calculating buffered end of contiguous segment",y,P.bufferedEnd,P.end)),m.bufferedStart=P.bufferedEnd,void 0!==(m=f[++v])&&(R=null!==(d=m.bufferedStart)&&void 0!==d?d:m.start,M=null!==(c=m.bufferedEnd)&&void 0!==c?c:m.end)}}var D=f[v-1];void 0!==D&&h(D,T,y)}}if(null!=m){i.Z.debug("SI: last segments have been GCed",y,v,f.length);for(var N,O=l(f.splice(v,f.length-v));!(N=O()).done;){var L=N.value;void 0===L.bufferedStart&&void 0===L.bufferedEnd&&2!==L.status&&this._bufferedHistory.addBufferedSegment(L.infos,null)}}!t&&void 0!==y&&i.Z.hasLevel("DEBUG")&&i.Z.debug("SI: current "+y+" inventory timeline:\n"+function(e){var t=1/60,n={},r=[],i=null,a=null;function o(e){var t=String.fromCharCode(r.length+65);return r.push({letter:t,periodId:e.period.id,representationId:e.representation.id,bitrate:e.representation.bitrate}),t}for(var s="",u=0;u=l)i.Z.warn("SI: Invalid chunked inserted: starts before it ends",d,u,l);else{for(var c=this._inventory,f={status:t?0:2,chunkSize:s,splitted:!1,start:u,end:l,precizeStart:!1,precizeEnd:!1,bufferedStart:void 0,bufferedEnd:void 0,infos:{segment:o,period:n,adaptation:r,representation:a}},v=c.length-1;v>=0;v--){var p=c[v];if(p.start<=u){if(p.end<=u){for(i.Z.debug("SI: Pushing segment strictly after previous one.",d,u,p.end),this._inventory.splice(v+1,0,f),v+=2;vf.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",d,f.end,c[v].start),c[v].start=f.end,c[v].bufferedStart=void 0,void(c[v].precizeStart=c[v].precizeStart&&f.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",d,u,l,c[v].start,c[v].end),c.splice(v,1)}return}if(p.start===u){if(p.end<=l){for(i.Z.debug("SI: Segment pushed replace another one",d,u,l,p.end),this._inventory.splice(v,1,f),v+=1;vf.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",d,f.end,c[v].start),c[v].start=f.end,c[v].bufferedStart=void 0,void(c[v].precizeStart=c[v].precizeStart&&f.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",d,u,l,c[v].start,c[v].end),c.splice(v,1)}return}return i.Z.debug("SI: Segment pushed ends before another with the same start",d,u,l,p.end),c.splice(v,0,f),p.start=f.end,p.bufferedStart=void 0,void(p.precizeStart=p.precizeStart&&f.precizeEnd)}if(p.end<=f.end){for(i.Z.debug("SI: Segment pushed updates end of previous one",d,u,l,p.start,p.end),this._inventory.splice(v+1,0,f),p.end=f.start,p.bufferedEnd=void 0,p.precizeEnd=p.precizeEnd&&f.precizeStart,v+=2;vf.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",d,f.end,c[v].start),c[v].start=f.end,c[v].bufferedStart=void 0,void(c[v].precizeStart=c[v].precizeStart&&f.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",d,u,l,c[v].start,c[v].end),c.splice(v,1)}return}i.Z.warn("SI: Segment pushed is contained in a previous one",d,u,l,p.start,p.end);var h={status:p.status,chunkSize:p.chunkSize,splitted:!0,start:f.end,end:p.end,precizeStart:p.precizeStart&&p.precizeEnd&&f.precizeEnd,precizeEnd:p.precizeEnd,bufferedStart:void 0,bufferedEnd:p.end,infos:p.infos};return p.end=f.start,p.splitted=!0,p.bufferedEnd=void 0,p.precizeEnd=p.precizeEnd&&f.precizeStart,c.splice(v+1,0,f),void c.splice(v+2,0,h)}}var m=this._inventory[0];if(void 0===m)return i.Z.debug("SI: first segment pushed",d,u,l),void this._inventory.push(f);if(!(m.start>=l)){if(m.end<=l){for(i.Z.debug("SI: Segment pushed starts before and completely recovers the previous first one",d,u,l,m.start,m.end),this._inventory.splice(0,1,f);c.length>1&&c[1].startf.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",d,f.end,c[1].start),c[1].start=f.end,c[1].bufferedStart=void 0,void(c[1].precizeStart=f.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",d,u,l,c[1].start,c[1].end),c.splice(1,1)}return}return i.Z.debug("SI: Segment pushed start of the next one",d,u,l,m.start,m.end),m.start=l,m.bufferedStart=void 0,m.precizeStart=f.precizeEnd,void this._inventory.splice(0,0,f)}i.Z.debug("SI: Segment pushed comes before all previous ones",d,u,l,m.start),this._inventory.splice(0,0,f)}}},t.completeSegment=function(e,t){if(!e.segment.isInit){for(var n=this._inventory,r=[],o=0;o0&&(s=!0,1===r.length&&(i.Z.warn("SI: Completed Segment is splitted.",e.segment.id,e.segment.time,e.segment.end),r[0].splitted=!0));var u=o,d=n[o].chunkSize;for(o+=1;o0&&(this._inventory.splice(u+1,v),o-=v),0===this._inventory[u].status&&(this._inventory[u].status=1),this._inventory[u].chunkSize=d,this._inventory[u].end=p,this._inventory[u].bufferedEnd=h,this._inventory[u].splitted=s,r.push(this._inventory[u])}if(0===r.length)i.Z.warn("SI: Completed Segment not found",e.segment.id,e.segment.time);else{this.synchronizeBuffered(t);for(var m,g=l(r);!(m=g()).done;){var y=m.value;void 0!==y.bufferedStart&&void 0!==y.bufferedEnd?2!==y.status&&this._bufferedHistory.addBufferedSegment(y.infos,{start:y.bufferedStart,end:y.bufferedEnd}):i.Z.debug("SI: buffered range not known after sync. Skipping history.",y.start,y.end)}}}},t.getInventory=function(){return this._inventory},t.getHistoryFor=function(e){return this._bufferedHistory.getHistoryFor(e)},e}();function f(e){if(void 0===e.bufferedStart||1!==e.status)return!1;var t=e.start,n=e.end-t,i=r.Z.getCurrent(),a=i.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,o=i.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(t-e.bufferedStart)<=a&&(void 0===e.bufferedEnd||e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-n)<=Math.min(o,n/3))}function v(e){if(void 0===e.bufferedEnd||1!==e.status)return!1;var t=e.start,n=e.end,i=n-t,a=r.Z.getCurrent(),o=a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,s=a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(n-e.bufferedEnd)<=o&&null!=e.bufferedStart&&e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-i)<=Math.min(s,i/3)}function p(e,t,n,a){var o=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedStart?(e.bufferedStartt&&(n.precizeEnd||e.start-n.end<=o)?(i.Z.debug("SI: buffered start is end of previous segment",a,t,e.start,n.end),e.bufferedStart=n.end,f(e)&&(e.start=n.end,e.precizeStart=!0)):e.start-t<=o?(i.Z.debug("SI: found true buffered start",a,t,e.start),e.bufferedStart=t,f(e)&&(e.start=t,e.precizeStart=!0)):tt&&(i.Z.debug("SI: Segment partially GCed at the end",n,e.bufferedEnd,t),e.bufferedEnd=t),!e.precizeEnd&&t-e.end<=a&&v(e)&&(e.precizeEnd=!0,e.end=t)):e.precizeEnd?(i.Z.debug("SI: buffered end is precize end",n,e.end),e.bufferedEnd=e.end):t-e.end<=a?(i.Z.debug("SI: found true buffered end",n,t,e.end),e.bufferedEnd=t,v(e)&&(e.end=t,e.precizeEnd=!0)):t>e.end?(i.Z.debug("SI: range end too far from expected end",n,t,e.end),e.bufferedEnd=e.end):(i.Z.debug("SI: Segment appears immediately garbage collected at the end",n,e.bufferedEnd,t),e.bufferedEnd=t)}var m,g=c,y=function(){function e(){this._segmentInventory=new g}var t=e.prototype;return t.synchronizeInventory=function(e){this._segmentInventory.synchronizeBuffered(this.getBufferedRanges(),e)},t.getInventory=function(){return this._segmentInventory.getInventory()},t.getPendingOperations=function(){return[]},t.getSegmentHistory=function(e){return this._segmentInventory.getHistoryFor(e)},e}();!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(m||(m={}))},4309:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2829),i=function(){function e(){this._ranges=[],this.length=0}var t=e.prototype;return t.insert=function(e,t){(0,r.kR)(this._ranges,{start:e,end:t}),this.length=this._ranges.length},t.remove=function(e,t){var n=[];e>0&&n.push({start:0,end:e}),t<1/0&&n.push({start:t,end:1/0}),this._ranges=(0,r.tn)(this._ranges,n),this.length=this._ranges.length},t.start=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].start},t.end=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].end},e}()},7839:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;return s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="CustomLoaderError",s.message=n,s.canRetry=i,s.isOfflineError=a,s.xhr=o,s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},5157:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;return u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="EncryptedMediaError",u.type=o.ZB.ENCRYPTED_MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1,"string"==typeof(null==a?void 0:a.keyStatuses)&&(u.keyStatuses=a.keyStatuses),u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},5992:function(e,t,n){"use strict";n.d(t,{SM:function(){return a},ZB:function(){return r},br:function(){return i}});var r={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"},i={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"},a={PIPELINE_LOAD_ERROR:"PIPELINE_LOAD_ERROR",PIPELINE_PARSE_ERROR:"PIPELINE_PARSE_ERROR",INTEGRITY_ERROR:"INTEGRITY_ERROR",MANIFEST_PARSE_ERROR:"MANIFEST_PARSE_ERROR",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"MANIFEST_INCOMPATIBLE_CODECS_ERROR",MANIFEST_UPDATE_ERROR:"MANIFEST_UPDATE_ERROR",MANIFEST_UNSUPPORTED_ADAPTATION_TYPE:"MANIFEST_UNSUPPORTED_ADAPTATION_TYPE",MEDIA_STARTING_TIME_NOT_FOUND:"MEDIA_STARTING_TIME_NOT_FOUND",MEDIA_TIME_BEFORE_MANIFEST:"MEDIA_TIME_BEFORE_MANIFEST",MEDIA_TIME_AFTER_MANIFEST:"MEDIA_TIME_AFTER_MANIFEST",MEDIA_TIME_NOT_FOUND:"MEDIA_TIME_NOT_FOUND",NO_PLAYABLE_REPRESENTATION:"NO_PLAYABLE_REPRESENTATION",MEDIA_IS_ENCRYPTED_ERROR:"MEDIA_IS_ENCRYPTED_ERROR",CREATE_MEDIA_KEYS_ERROR:"CREATE_MEDIA_KEYS_ERROR",KEY_ERROR:"KEY_ERROR",KEY_STATUS_CHANGE_ERROR:"KEY_STATUS_CHANGE_ERROR",KEY_UPDATE_ERROR:"KEY_UPDATE_ERROR",KEY_LOAD_ERROR:"KEY_LOAD_ERROR",KEY_LOAD_TIMEOUT:"KEY_LOAD_TIMEOUT",KEY_GENERATE_REQUEST_ERROR:"KEY_GENERATE_REQUEST_ERROR",INCOMPATIBLE_KEYSYSTEMS:"INCOMPATIBLE_KEYSYSTEMS",INVALID_ENCRYPTED_EVENT:"INVALID_ENCRYPTED_EVENT",INVALID_KEY_SYSTEM:"INVALID_KEY_SYSTEM",LICENSE_SERVER_CERTIFICATE_ERROR:"LICENSE_SERVER_CERTIFICATE_ERROR",MULTIPLE_SESSIONS_SAME_INIT_DATA:"MULTIPLE_SESSIONS_SAME_INIT_DATA",BUFFER_APPEND_ERROR:"BUFFER_APPEND_ERROR",BUFFER_FULL_ERROR:"BUFFER_FULL_ERROR",BUFFER_TYPE_UNKNOWN:"BUFFER_TYPE_UNKNOWN",MEDIA_ERR_BLOCKED_AUTOPLAY:"MEDIA_ERR_BLOCKED_AUTOPLAY",MEDIA_ERR_PLAY_NOT_ALLOWED:"MEDIA_ERR_PLAY_NOT_ALLOWED",MEDIA_ERR_NOT_LOADED_METADATA:"MEDIA_ERR_NOT_LOADED_METADATA",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_UNKNOWN:"MEDIA_ERR_UNKNOWN",MEDIA_SOURCE_NOT_SUPPORTED:"MEDIA_SOURCE_NOT_SUPPORTED",MEDIA_KEYS_NOT_SUPPORTED:"MEDIA_KEYS_NOT_SUPPORTED",DISCONTINUITY_ENCOUNTERED:"DISCONTINUITY_ENCOUNTERED",NONE:"NONE"}},7367:function(e,t,n){"use strict";function r(e,t,n){return e+" ("+t+") "+n}n.d(t,{Z:function(){return r}})},8750:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(9822),i=n(5389);function a(e,t){var n=t.defaultCode,a=t.defaultReason;if((0,r.Z)(e))return e;var o=e instanceof Error?e.toString():a;return new i.Z(n,o)}},9822:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(5157),i=n(5992),a=n(3714),o=n(9362),s=n(5389);function u(e){return(e instanceof r.Z||e instanceof a.Z||e instanceof s.Z||e instanceof o.Z)&&Object.keys(i.ZB).indexOf(e.type)>=0}},3714:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="MediaError",u.type=o.ZB.MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1;var l=null==a?void 0:a.adaptation;if(void 0!==l)switch(l.type){case"audio":u.trackInfo={type:"audio",track:l.toAudioTrack()};break;case"video":u.trackInfo={type:"video",track:l.toVideoTrack()};break;case"text":u.trackInfo={type:"text",track:l.toTextTrack()}}return u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9362:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="NetworkError",a.type=o.ZB.NETWORK_ERROR,a.xhr=void 0===i.xhr?null:i.xhr,a.url=i.url,a.status=i.status,a.errorType=i.type,a.code=n,a.message=(0,s.Z)(a.name,a.code,i.message),a.fatal=!1,a}return(0,i.Z)(t,e),t.prototype.isHttpError=function(e){return this.errorType===o.br.ERROR_HTTP_CODE&&this.status===e},t}((0,a.Z)(Error))},5389:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="OtherError",a.type=o.ZB.OTHER_ERROR,a.code=n,a.message=(0,s.Z)(a.name,a.code,i),a.fatal=!1,a}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9105:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;switch(s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="RequestError",s.url=n,void 0!==o&&(s.xhr=o),s.status=i,s.type=a,a){case"TIMEOUT":s.message="The request timed out";break;case"ERROR_EVENT":s.message="An error prevented the request to be performed successfully";break;case"PARSE_ERROR":s.message="An error happened while formatting the response data";break;case"ERROR_HTTP_CODE":s.message="An HTTP status code indicating failure was received: "+String(s.status)}return s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},7273:function(e,t){"use strict";t.Z={dashParsers:{wasm:null,js:null},createDebugElement:null,directfile:null,decrypt:null,htmlTextTracksBuffer:null,htmlTextTracksParsers:{},imageBuffer:null,imageParser:null,mediaSourceInit:null,nativeTextTracksBuffer:null,nativeTextTracksParsers:{},transports:{}}},7874:function(e,t,n){"use strict";var r=n(7273);t.Z=r.Z},3887:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(8894),i=new(function(){function e(){this.error=r.Z,this.warn=r.Z,this.info=r.Z,this.debug=r.Z,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentLevel="NONE"}var t=e.prototype;return t.setLevel=function(e){var t,n=this._levels[e];"number"==typeof n?(t=n,this._currentLevel=e):(t=0,this._currentLevel="NONE"),this.error=t>=this._levels.ERROR?console.error.bind(console):r.Z,this.warn=t>=this._levels.WARNING?console.warn.bind(console):r.Z,this.info=t>=this._levels.INFO?console.info.bind(console):r.Z,this.debug=t>=this._levels.DEBUG?console.log.bind(console):r.Z},t.getLevel=function(){return this._currentLevel},t.hasLevel=function(e){return this._levels[e]>=this._levels[this._currentLevel]},e}())},8999:function(e,t,n){"use strict";n.d(t,{r:function(){return h},Z:function(){return m}});var r=n(3887),i=n(3274),a=n(1946),o=n(7829);var s="undefined"!=typeof window&&"function"==typeof window.Set&&"function"==typeof Array.from?function(e){return Array.from(new Set(e))}:function(e){return e.filter((function(e,t,n){return n.indexOf(e)===t}))},u=n(3774);function l(e){return null!=u.J&&("function"!=typeof u.J.isTypeSupported||u.J.isTypeSupported(e))}var d=n(4791);function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this.trickModeTracks=i.map((function(t){return new e(t)})));for(var d=t.representations,c=[],f=!1,v=0;v0&&!r.isSupported){var i=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:r});n.contentWarnings.push(i)}return r})).filter((function(e){return e.representations.length>0}));if(s.every((function(e){return!e.isSupported}))&&o.length>0&&("video"===i||"audio"===i))throw new a.Z("MANIFEST_PARSE_ERROR","No supported "+i+" adaptations");return s.length>0&&(r[i]=s),r}),{}),!Array.isArray(this.adaptations.video)&&!Array.isArray(this.adaptations.audio))throw new a.Z("MANIFEST_PARSE_ERROR","No supported audio and video tracks.");this.duration=e.duration,this.start=e.start,null!=this.duration&&null!=this.start&&(this.end=this.start+this.duration),this.streamEvents=void 0===e.streamEvents?[]:e.streamEvents}var t=e.prototype;return t.getAdaptations=function(){var e=this.adaptations;return(0,v.Z)(e).reduce((function(e,t){return null!=t?e.concat(t):e}),[])},t.getAdaptationsForType=function(e){var t=this.adaptations[e];return null==t?[]:t},t.getAdaptation=function(e){return(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},t.getSupportedAdaptations=function(e){if(void 0===e)return this.getAdaptations().filter((function(e){return e.isSupported}));var t=this.adaptations[e];return void 0===t?[]:t.filter((function(e){return e.isSupported}))},t.containsTime=function(e,t){return e>=this.start&&(void 0===this.end||ethis.end)},e}(),h=function(){function e(e){this._url=e.media}var t=e.prototype;return t.getInitSegment=function(){return null},t.getSegments=function(){return[{id:"0",isInit:!1,number:0,url:this._url,time:0,end:Number.MAX_VALUE,duration:Number.MAX_VALUE,complete:!0,privateInfos:{},timescale:1}]},t.getFirstAvailablePosition=function(){},t.getLastAvailablePosition=function(){},t.getEnd=function(){},t.awaitSegmentBetween=function(){return!1},t.shouldRefresh=function(){return!1},t.checkDiscontinuity=function(){return null},t.isSegmentStillAvailable=function(){return!0},t.canBeOutOfSyncError=function(){return!1},t.isStillAwaitingFutureSegments=function(){return!1},t.isInitialized=function(){return!0},t._replace=function(){o.Z.warn("Tried to replace a static RepresentationIndex")},t._update=function(){o.Z.warn("Tried to update a static RepresentationIndex")},e}();!function(e){e[e.Full=0]="Full",e[e.Partial=1]="Partial"}(r||(r={}));var m=n(5138);function g(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0)o.Z.warn("Manifest: "+y.length+" new Representations found when merging."),(h=t.representations).push.apply(h,y),v.push.apply(v,y)}l=e},l=0;l0){o.Z.warn("Manifest: "+s.length+" new Adaptations found when merging.");for(var d,c=g(s);!(d=c()).done;){var f=d.value,v=e.adaptations[f.type];void 0===v?e.adaptations[f.type]=[f]:v.push(f),i.addedAdaptations.push(f)}}return i}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&r._addSupplementaryImageAdaptations(u),o.length>0&&r._addSupplementaryTextAdaptations(o),r}(0,i.Z)(t,e);var n=t.prototype;return n.getPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return e===t.id}))},n.getPeriodForTime=function(e){for(var t=null,n=this.periods.length-1;n>=0;n--){var r=this.periods[n];if(r.containsTime(e,t))return r;t=r}},n.getNextPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return t.start>e}))},n.getPeriodAfter=function(e){var t=e.end;if(void 0===t)return null;var n=(0,s.Z)(this.periods,(function(e){return void 0===e.end||t0&&this.trigger("decipherabilityUpdate",t)},n.getAdaptations=function(){(0,c.Z)("manifest.getAdaptations() is deprecated. Please use manifest.period[].getAdaptations() instead");var e=this.periods[0];if(void 0===e)return[];var t=e.adaptations,n=[];for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];n.push.apply(n,i)}return n},n.getAdaptationsForType=function(e){(0,c.Z)("manifest.getAdaptationsForType(type) is deprecated. Please use manifest.period[].getAdaptationsForType(type) instead");var t=this.periods[0];if(void 0===t)return[];var n=t.adaptations[e];return void 0===n?[]:n},n.getAdaptation=function(e){return(0,c.Z)("manifest.getAdaptation(id) is deprecated. Please use manifest.period[].getAdaptation(id) instead"),(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},n._addSupplementaryImageAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).map((function(e){var n=e.mimeType,r=e.url,i="gen-image-ada-"+T(),o="gen-image-rep-"+T(),s=(0,d.$)(r),u=r.substring(0,s),l=r.substring(s),c=new f.Z({id:i,type:"image",representations:[{bitrate:0,cdnMetadata:[{baseUrl:u}],id:o,mimeType:n,index:new h({media:l})}]},{isManuallyAdded:!0});if(c.representations.length>0&&!c.isSupported){var v=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:c});t.contentWarnings.push(v)}return c}));if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.image=null!=r.image?r.image.concat(n):n}},n._addSupplementaryTextAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).reduce((function(e,n){var r=n.mimeType,i=n.codecs,o=n.url,s=n.language,u=n.languages,l=n.closedCaption,c=null!=s?[s]:null!=u?u:[],v=(0,d.$)(o),p=o.substring(0,v),m=o.substring(v);return e.concat(c.map((function(e){var n="gen-text-ada-"+T(),o="gen-text-rep-"+T(),s=new f.Z({id:n,type:"text",language:e,closedCaption:l,representations:[{bitrate:0,cdnMetadata:[{baseUrl:p}],id:o,mimeType:r,codecs:i,index:new h({media:m})}]},{isManuallyAdded:!0});if(s.representations.length>0&&!s.isSupported){var u=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:s});t.contentWarnings.push(u)}return s})))}),[]);if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.text=null!=r.text?r.text.concat(n):n}},n._performUpdate=function(e,t){var n;if(this.availabilityStartTime=e.availabilityStartTime,this.expired=e.expired,this.isDynamic=e.isDynamic,this.isLive=e.isLive,this.isLastPeriodKnown=e.isLastPeriodKnown,this.lifetime=e.lifetime,this.contentWarnings=e.contentWarnings,this.suggestedPresentationDelay=e.suggestedPresentationDelay,this.transport=e.transport,this.publishTime=e.publishTime,t===r.Full)this._timeBounds=e._timeBounds,this.uris=e.uris,n=function(e,t){for(var n={updatedPeriods:[],addedPeriods:[],removedPeriods:[]},i=0,a=0;ae.length)return o.Z.error("Manifest: error when updating Periods"),n;if(i0&&(e.push.apply(e,b),(y=n.addedPeriods).push.apply(y,b)),n}(this.periods,e.periods);else{this._timeBounds.maximumTimeData=e._timeBounds.maximumTimeData,this.updateUrl=e.uris[0],n=function(e,t){var n,i={updatedPeriods:[],addedPeriods:[],removedPeriods:[]};if(0===e.length)return e.splice.apply(e,[0,0].concat(t)),(n=i.addedPeriods).push.apply(n,t),i;if(0===t.length)return i;var s=e[e.length-1];if(s.startc){var E;o.Z.warn("Manifest: old Periods not found in new when updating, removing");var k=e.splice(c,p-c);(E=i.removedPeriods).push.apply(E,k),p=c}var w=_(e[p],v,r.Full);i.updatedPeriods.push({period:e[p],result:w})}c++}if(c0;){var s=this.periods[0];if(void 0===s.end||s.end>i)break;this.periods.shift()}}this.adaptations=void 0===this.periods[0]?{}:this.periods[0].adaptations,this.trigger("manifestUpdate",n)},t}(u.Z);var w=k},520:function(e,t,n){"use strict";n.d(t,{K:function(){return a},z:function(){return i}});var r=n(1946);function i(e,t){return e.segment.id===t.segment.id&&e.representation.uniqueId===t.representation.uniqueId}function a(e){if((0,r.Z)(e))return"";var t=e.period,n=e.adaptation,i=e.representation,a=e.segment;return n.type+" P: "+t.id+" A: "+n.id+" R: "+i.id+" S: "+(a.isInit?"init":a.complete?a.time+"-"+a.duration:""+a.time)}},2689:function(e,t,n){"use strict";n.d(t,{s:function(){return r}});var r=Math.pow(2,32)-1},2297:function(e,t,n){"use strict";n.d(t,{Qy:function(){return f},Xj:function(){return p},iz:function(){return c},lp:function(){return d},nR:function(){return v},t_:function(){return l},vA:function(){return u}});var r=n(3887),i=n(811),a=n(6968);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ni)return null;s=(0,a.pV)(e,r),r+=8}if(s<0)throw new Error("ISOBMFF: Size out of range");if(n===t)return 1970628964===t&&(r+=16),[o,r,o+s];o+=s}return null}function v(e,t,n,r,i){for(var o,s=e.length,u=0;us)return;o=(0,a.pV)(e,l),l+=8}if(1970628964===d&&l+16<=s&&(0,a.pX)(e,l)===t&&(0,a.pX)(e,l+4)===n&&(0,a.pX)(e,l+8)===r&&(0,a.pX)(e,l+12)===i)return l+=16,e.subarray(l,u+o)}}function p(e){var t=e.length;if(t<8)return r.Z.warn("ISOBMFF: box inferior to 8 bytes, cannot find offsets"),null;var n=0,i=(0,a.pX)(e,n);n+=4;var o=(0,a.pX)(e,n);if(n+=4,0===i)i=t;else if(1===i){if(n+8>t)return r.Z.warn("ISOBMFF: box too short, cannot find offsets"),null;i=(0,a.pV)(e,n),n+=8}if(i<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===o&&(n+=16),[0,n,i]}},6807:function(e,t,n){"use strict";n.d(t,{E3:function(){return u},Le:function(){return o},XA:function(){return i},fs:function(){return s},uq:function(){return a}});var r=n(2297);function i(e){var t=(0,r.t_)(e,1836019558);return null===t?null:(0,r.t_)(t,1953653094)}function a(e){return(0,r.lp)(e,1836019558).reduce((function(e,t){var n=(0,r.t_)(t,1953653094);return null!==n&&e.push(n),e}),[])}function o(e){return(0,r.t_)(e,1835295092)}function s(e){var t=(0,r.t_)(e,1836019574);if(null===t)return null;var n=(0,r.t_)(t,1953653099);return null===n?null:(0,r.t_)(n,1835297121)}function u(e,t){return void 0===t&&(t=0),(0,r.t_)(e.subarray(t),1701671783)}},6490:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},Y:function(){return u}});var r=n(3887);var i="function"==typeof Uint8Array.prototype.slice?function(e,t,n){return e.slice(t,n)}:function(e,t,n){return new Uint8Array(Array.prototype.slice.call(e,t,n))},a=n(3635),o=n(2297);function s(e){var t=0,n=(0,o.t_)(e,1836019574);if(null===n)return[];for(var a=[];t1)r.Z.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length)){var o=i(e,n,n+16);return(0,a.ci)(o)}}}},4644:function(e,t,n){"use strict";n.d(t,{J6:function(){return m},LD:function(){return h},MM:function(){return p},Qx:function(){return f},R0:function(){return y},Wf:function(){return c},s9:function(){return g}});var r=n(3887),i=n(6968),a=n(3635),o=n(2689),s=n(2297),u=n(6807);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;){var v=(0,i.pX)(e,o);o+=4;var p=2147483647&v;if(1===(2147483648&v)>>>31)throw new Error("sidx with reference_type `1` not yet implemented");var h=(0,i.pX)(e,o);o+=4,o+=4,c.push({time:l,duration:h,timescale:d,range:[r,r+p-1]}),l+=h,r+=p}return c}function f(e){var t=(0,u.XA)(e);if(null!==t){var n=(0,s.t_)(t,1952867444);if(null!==n){var r=n[0];return 1===r?(0,i.pV)(n,4):0===r?(0,i.pX)(n,4):void 0}}}function v(e){var t=(0,s.t_)(e,1952868452);if(null!==t){var n=1,r=(0,i.QI)(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),(0,i.pX)(t,n)}}function p(e){var t=(0,u.uq)(e);if(0!==t.length){for(var n,r=0,a=l(t);!(n=a()).done;){var o=n.value,d=(0,s.t_)(o,1953658222);if(null===d)return;var c=0,f=d[c];if(c+=1,f>1)return;var p=(0,i.QI)(d,c);c+=3;var h=(256&p)>0,m=0;if(!h&&void 0===(m=v(o)))return;var g=(1&p)>0,y=(4&p)>0,_=(512&p)>0,b=(1024&p)>0,S=(2048&p)>0,T=(0,i.pX)(d,c);c+=4,g&&(c+=4),y&&(c+=4);for(var E=T,k=0;E-- >0;)h?(k+=(0,i.pX)(d,c),c+=4):k+=m,_&&(c+=4),b&&(c+=4),S&&(c+=4);r+=k}return r}}function h(e){var t=(0,u.fs)(e);if(null!==t){var n=(0,s.t_)(t,1835296868);if(null!==n){var r=0,a=n[r];return r+=4,1===a?(0,i.pX)(n,r+16):0===a?(0,i.pX)(n,r+8):void 0}}}function m(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=(0,i.pX)(e,0);if(0===n){if(t>o.s){var r=new Uint8Array(t+8);return r.set((0,i.kh)(1),0),r.set(e.subarray(4,8),4),r.set((0,i.el)(t+8),8),r.set(e.subarray(8,t),16),r}return e.set((0,i.kh)(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set((0,i.el)(t),8),e}if(t<=o.s)return e.set((0,i.kh)(t),0),e;var a=new Uint8Array(t+8);return a.set((0,i.kh)(1),0),a.set(e.subarray(4,8),4),a.set((0,i.el)(t+8),8),a.set(e.subarray(8,t),16),a}function g(e){for(var t=[],n=0;n0)throw new Error("Unhandled version: "+s);var c=(0,r.dN)(e,t);t+=4;var f=(0,r.dN)(e,t);t+=4;var v=(0,i.uR)(e.subarray(t,t+4));t+=4;var p=(0,r.qb)(e,t);t+=2;var h=(0,r.qb)(e,t),m=[e[t+=2],e[t+1]].join(":"),g=1===e[t+=2];t=64;var y=[];if(0===c)throw new Error("bif: no images to parse");for(var _=0,b=null;t0,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return(0,a.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return(0,o.Z)(this._index,e,t,this._manifestBoundsCalculator,this._scaledPeriodEnd,this._isEMSGWhitelisted)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){var e=this._index;return 0===e.timeline.length?null:(0,i.zG)(Math.max(this._scaledPeriodStart,e.timeline[0].start),e)},t.getLastAvailablePosition=function(){var e,t=this._index.timeline;if(0===t.length)return null;var n=t[t.length-1],r=Math.min((0,i.jH)(n,null,this._scaledPeriodEnd),null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return(0,i.zG)(r,this._index)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.initializeIndex=function(e){for(var t=0;t0?Math.floor(d/l):0),C=A+M*w;C_)break;var D=null===g?null:(0,i.QB)(C,P)(g),N=C-e.indexTimeOffset,O=w;N<0&&(O=w+N,N=0);var L={id:String(C),time:N/m,end:(N+O)/m,duration:O/m,isInit:!1,range:I,timescale:1,url:D,number:P,timestampOffset:-e.indexTimeOffset/m,complete:R,privateInfos:{isEMSGWhitelisted:s}};S.push(L),C=A+ ++M*w}if(C>=p)return S;if(b+=x+1,void 0!==_&&b>_)return S}return S}},4784:function(e,t,n){"use strict";n.d(t,{QB:function(){return o},zA:function(){return a}});var r=n(6923);function i(e){return function(t,n,i){var a,o,s,u=(0,r.Z)(i)?parseInt(i,10):1;return a=String(e),o=u,(s=a.toString()).length>=o?s:(new Array(o+1).join("0")+s).slice(-o)}}function a(e,t,n){return function(e,t,n){return-1===e.indexOf("$")?e:e.replace(/\$\$/g,"$").replace(/\$RepresentationID\$/g,String(t)).replace(/\$Bandwidth(\%0(\d+)d)?\$/g,i(void 0===n?0:n))}(e,t,n)}function o(e,t){return function(n){return-1===n.indexOf("$")?n:n.replace(/\$\$/g,"$").replace(/\$Number(\%0(\d+)d)?\$/g,(function(e,n,r){if(void 0===t)throw new Error("Segment number not defined in a $Number$ scheme");return i(t)(e,n,r)})).replace(/\$Time(\%0(\d+)d)?\$/g,(function(t,n,r){if(void 0===e)throw new Error("Segment time not defined in a $Time$ scheme");return i(e)(t,n,r)}))}}},1707:function(e,t,n){"use strict";n.d(t,{Z:function(){return qe}});var r=n(7904),i=n(1946),a=n(6872),o=n(3887),s=n(3274),u=n(9829);function l(e){var t=Date.parse(e)-performance.now();if(!isNaN(t))return t;o.Z.warn("DASH Parser: Invalid clock received: ",e)}function d(e){for(var t=e.representations,n=null,r=0;r=0;t--){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=d(r);if(void 0===u)return{safe:void 0,unsafe:void 0};a=u}if(void 0!==i){var l=d(i);if(void 0===l)return{safe:void 0,unsafe:void 0};s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return o.Z.info("Parser utils: found Period with no segment. ","Going to previous one to calculate last position"),{safe:void 0,unsafe:void 0};if(null!==s)return null!==a?{safe:Math.min(a,s),unsafe:Math.max(a,s)}:{safe:s,unsafe:s};if(null!==a)return{safe:a,unsafe:a}}}return{safe:void 0,unsafe:void 0}}(e);return{minimumSafePosition:t,maximumSafePosition:n.safe,maximumUnsafePosition:n.unsafe}}var v=function(){function e(e){this._isDynamic=e.isDynamic,this._timeShiftBufferDepth=e.isDynamic&&void 0!==e.timeShiftBufferDepth?e.timeShiftBufferDepth:null,this._serverTimestampOffset=e.serverTimestampOffset,this._availabilityStartTime=e.availabilityStartTime}var t=e.prototype;return t.setLastPosition=function(e,t){this._lastPosition=e,this._positionTime=t},t.lastPositionIsKnown=function(){return this._isDynamic?null!=this._positionTime&&null!=this._lastPosition:null!=this._lastPosition},t.getEstimatedMinimumSegmentTime=function(){var e;if(!this._isDynamic||null===this._timeShiftBufferDepth)return 0;var t=null!==(e=this.getEstimatedLiveEdge())&&void 0!==e?e:this.getEstimatedMaximumPosition(0);return void 0!==t?t-this._timeShiftBufferDepth:void 0},t.getEstimatedLiveEdge=function(){if(this._isDynamic&&void 0!==this._serverTimestampOffset)return(performance.now()+this._serverTimestampOffset)/1e3-this._availabilityStartTime},t.getEstimatedMaximumPosition=function(e){if(!this._isDynamic)return this._lastPosition;var t=this.getEstimatedLiveEdge();return void 0!==t&&e!==1/0?t+e:void 0!==this._positionTime&&void 0!==this._lastPosition?Math.max(this._lastPosition-this._positionTime+performance.now()/1e3,0):this._lastPosition},e}();var p=n(9592),h=n(908),m=n(1679),g=n(3635);var y=n(8999),_=n(5138),b=n(7714),S=n(6923);function T(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var s=i-a.start;if(s%a.duration==0&&s/a.duration<=a.repeatCount)return{repeatNumberInPrevSegments:s/a.duration,prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInNewElements:0}}if(++o>=e.length)return null;if((a=e[o]).start===i)return{prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(a.start>i)return null}else for(var u=0,l=t[0],d=i;;){var c=l.getAttribute("d"),f=null===c?null:parseInt(c,10);if(null===f||Number.isNaN(f))return null;var v=l.getAttribute("r"),p=null===v?null:parseInt(v,10);if(null!==p){if(Number.isNaN(p)||p<0)return null;if(p>0){var h=n-d;if(h%f==0&&h/f<=p)return{repeatNumberInPrevSegments:0,repeatNumberInNewElements:h/f,prevSegmentsIdx:0,newElementsIdx:u}}d+=f*(p+1)}else d+=f;if(++u>=t.length)return null;var m=(l=t[u]).getAttribute("t"),g=null===m?null:parseInt(m,10);if(null!==g){if(Number.isNaN(g))return null;d=g}if(d===n)return{newElementsIdx:u,prevSegmentsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(d>i)return null}}(t,e);if(null===r)return o.Z.warn('DASH: Cannot perform "based" update. Common segment not found.'),z(e);var i=r.prevSegmentsIdx,a=r.newElementsIdx,s=r.repeatNumberInPrevSegments,u=r.repeatNumberInNewElements,l=t.length-i+a-1;if(l>=e.length)return o.Z.info('DASH: Cannot perform "based" update. New timeline too short'),z(e);var d=t.slice(i);if(s>0){var c=d[0];c.start+=c.duration*s,d[0].repeatCount-=s}if(u>0&&0!==a)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form.'),z(e);var f=d[d.length-1],v=V(e[l]),p=(null!==(n=v.repeatCount)&&void 0!==n?n:0)-u;if(v.duration!==f.duration||f.repeatCount>p)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form at the beginning.'),z(e);void 0!==v.repeatCount&&v.repeatCount>f.repeatCount&&(f.repeatCount=v.repeatCount);for(var h=[],m=[],g=l+1;g=Math.min(u,null!==(r=this._scaledPeriodEnd)&&void 0!==r?r:1/0))return!1;var d=(0,R.gT)(e,this._index);if(o.length>0&&null!==l&&!l.isLastOfTimeline){var c=o[o.length-1];if(d<(0,R.jH)(c,null,this._scaledPeriodEnd)+s+s)return!0}return!!this._isLastPeriod&&(void 0===this._scaledPeriodEnd?u+s>this._scaledPeriodStart&&void 0:d-sthis._scaledPeriodStart)},t.isSegmentStillAvailable=function(e){return!!e.isInit||(this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline()),function(e,t,n,r){var i=H(t,n,r);if(null===i)return!1;for(var a=0;ae.time)return!1;if(s===e.time)return void 0===o.range?void 0===e.range:null!=e.range&&o.range[0]===e.range[0]&&o.range[1]===e.range[1];if(o.repeatCount>=0&&void 0!==o.duration){var u=(s-o.start)/o.duration-1;return u%1==0&&u<=i.newRepeatCount}}return!1}(e,this._index,this._manifestBoundsCalculator,this._scaledPeriodEnd))},t.checkDiscontinuity=function(e){this._refreshTimeline();var t=this._index.timeline;return null===t&&(t=this._getTimeline(),this._index.timeline=t),(0,R._j)({timeline:t,timescale:this._index.timescale,indexTimeOffset:this._index.indexTimeOffset},e,this._scaledPeriodEnd)},t.canBeOutOfSyncError=function(e){return!!this._isDynamic&&(e instanceof D.Z&&e.isHttpError(404))},t._replace=function(e){this._parseTimeline=e._parseTimeline,this._index=e._index,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._manifestBoundsCalculator=e._manifestBoundsCalculator,this._isLastPeriod=e._isLastPeriod},t._update=function(e){null===this._index.timeline&&(this._index.timeline=this._getTimeline()),null===e._index.timeline&&(e._index.timeline=e._getTimeline()),(0,L.Z)(this._index.timeline,e._index.timeline)&&(this._index.startNumber=e._index.startNumber),this._index.availabilityTimeOffset=e._index.availabilityTimeOffset,this._index.availabilityTimeComplete=e._index.availabilityTimeComplete,this._index.endNumber=e._index.endNumber,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._isLastPeriod=e._isLastPeriod},t.isStillAwaitingFutureSegments=function(){var e;if(!this._isDynamic)return!1;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=this._index.timeline;if(0===t.length){if(void 0!==this._scaledPeriodEnd){var n=this._manifestBoundsCalculator.getEstimatedLiveEdge();if(void 0!==n&&(0,R.gT)(n,this._index)>this._scaledPeriodEnd)return!1}return this._isLastPeriod}var r=B(this._index.timescale),i=H(this._index,this._manifestBoundsCalculator,this._scaledPeriodEnd);if(null!==i&&!i.isLastOfTimeline){var a=Math.min(i.end,null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return!(void 0!==this._scaledPeriodEnd&&a+r>=this._scaledPeriodEnd)}if(!this._isLastPeriod)return!1;if(void 0===this._scaledPeriodEnd)return!0;var o=t[t.length-1];return(0,R.jH)(o,null,this._scaledPeriodEnd)+rn){if(r===n+1)return e.slice(0,i+1);var o=e.slice(0,i),s=Object.assign({},a),u=r-a.repeatCount-1;return s.repeatCount=Math.max(0,n-u),o.push(s),o}}return e}function H(e,t,n){if(e.timeline.length<=0)return null;if(e.availabilityTimeOffset===1/0){var r=e.timeline.length-1,i=e.timeline[r];return{isLastOfTimeline:!0,timelineIdx:r,newRepeatCount:i.repeatCount,end:(0,R.jH)(i,null,n)}}var a=t.getEstimatedMaximumPosition(e.availabilityTimeOffset);if(void 0===a){var o=e.timeline.length-1,s=e.timeline[o];return{isLastOfTimeline:!0,timelineIdx:o,newRepeatCount:s.repeatCount,end:(0,R.jH)(s,null,n)}}for(var u=e.timeline.length-1;u>=e.timeline.length;u--){var l=e.timeline[u],d=l.start+l.duration;if((0,R.zG)(d,e)<=a){var c=(0,R.jH)(l,e.timeline[u+1],n);if((0,R.zG)(c,e)<=a)return{isLastOfTimeline:u===e.timeline.length-1,timelineIdx:u,newRepeatCount:l.repeatCount,end:d};var f=(0,R.gT)(a,e)-l.start,v=Math.floor(f/l.duration);return(0,N.Z)(v>=1),{isLastOfTimeline:!1,timelineIdx:u,newRepeatCount:v-1,end:l.start+v*l.duration}}}return null}var j=G,q=function(){function e(e,t){var n,r,i=t.availabilityTimeOffset,a=t.manifestBoundsCalculator,o=t.isDynamic,s=t.periodEnd,u=t.periodStart,l=t.representationId,d=t.representationBitrate,c=t.isEMSGWhitelisted,f=null!==(n=e.timescale)&&void 0!==n?n:1;this._availabilityTimeOffset=i,this._manifestBoundsCalculator=a;var v=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,p=v-u*f;if(void 0===e.duration)throw new Error("Invalid SegmentTemplate: no duration");var h=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:(0,C.zA)(e.initialization.media,l,d),m=void 0===e.media?null:(0,C.zA)(e.media,l,d);this._index={duration:e.duration,timescale:f,indexRange:e.indexRange,indexTimeOffset:p,initialization:null==e.initialization?void 0:{url:h,range:e.initialization.range},url:m,presentationTimeOffset:v,startNumber:e.startNumber,endNumber:e.endNumber},this._isDynamic=o,this._periodStart=u,this._scaledRelativePeriodEnd=void 0===s?void 0:(s-u)*f,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return(0,M.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){var n=this._index,r=n.duration,i=n.startNumber,a=n.endNumber,o=n.timescale,s=n.url,u=this._periodStart*o,l=this._scaledRelativePeriodEnd,d=e*o-u,c=(e+t)*o-u,f=this._getFirstSegmentStart(),v=this._getLastSegmentStart();if(null==f||null==v)return[];var p=Math.max(f,d),h=Math.min(v,c);if(h+r<=p)return[];for(var m=[],g=null!=i?i:1,y=Math.floor(p/r),_=y*r;_<=h;_+=r){var b=y+g;if(void 0!==a&&b>a)return m;var S=null!=l&&_+r>l?l-_:r,T=_+u,E=_+this._index.presentationTimeOffset,k=null===s?null:(0,C.QB)(E,b)(s),w={id:String(b),number:b,time:T/o,end:(T+S)/o,duration:S/o,timescale:1,isInit:!1,scaledDuration:S/o,url:k,timestampOffset:-n.indexTimeOffset/o,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};m.push(w),y++}return m},t.getFirstAvailablePosition=function(){var e=this._getFirstSegmentStart();return null==e?e:e/this._index.timescale+this._periodStart},t.getLastAvailablePosition=function(){var e=this._getLastSegmentStart();if((0,i.Z)(e))return e;var t=this._estimateRelativeScaledEnd();return Math.min(e+this._index.duration,null!=t?t:1/0)/this._index.timescale+this._periodStart},t.getEnd=function(){if(!this._isDynamic)return this.getLastAvailablePosition();var e=this._estimateRelativeScaledEnd();if(void 0!==e){var t=this._index.timescale;return(e+this._periodStart*t)/t}},t.awaitSegmentBetween=function(e,t){if((0,N.Z)(e<=t),!this._isDynamic)return!1;var n=this._index.timescale,r=B(n),a=this._periodStart*n,o=e*n-a,s=t*n-a,u=this._getLastSegmentStart();if((0,i.Z)(u)){var l=this._estimateRelativeScaledEnd();return void 0===l?s+r>=0:s+r>=0&&od-r:s>d-r&&othis._periodStart?(a-this._periodStart)*i:0;return Math.floor(o/r)*r}},t._getLastSegmentStart=function(){var e,t,n=this._index,r=n.duration,i=n.timescale,o=n.endNumber,s=n.startNumber,u=void 0===s?1:s;if(this._isDynamic){var l=this._manifestBoundsCalculator.getEstimatedLiveEdge();if(void 0!==l&&void 0!==this._scaledRelativePeriodEnd&&this._scaledRelativePeriodEndg||h<2?m:(h-2)*r},t._estimateRelativeScaledEnd=function(){var e,t;if(void 0!==this._index.endNumber){var n=this._index.endNumber-(null!==(e=this._index.startNumber)&&void 0!==e?e:1)+1;return Math.max(Math.min(n*this._index.duration,null!==(t=this._scaledRelativePeriodEnd)&&void 0!==t?t:1/0),0)}if(void 0!==this._scaledRelativePeriodEnd)return Math.max(this._scaledRelativePeriodEnd,0)},e}();function Y(e,t){var n;if(0===t.length)return e;var r=t.map((function(e){return{url:e.value}}));if(0===e.length)return r;for(var i=[],a=0;a=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var m=t.parentSegmentTemplates.slice(),g=e.children.segmentTemplate;void 0!==g&&m.push(g);var y=I.Z.apply(void 0,[{}].concat(m));void 0===y.availabilityTimeOffset&&void 0===t.availabilityTimeOffset||(v.availabilityTimeOffset=(null!==(n=y.availabilityTimeOffset)&&void 0!==n?n:0)+(null!==(r=t.availabilityTimeOffset)&&void 0!==r?r:0)),i=j.isTimelineIndexArgument(y)?new j(y,v):new q(y,v)}else{var _=t.adaptation.children;if(void 0!==_.segmentBase){var b=_.segmentBase;i=new x.Z(b,v)}else if(void 0!==_.segmentList){var S=_.segmentList;i=new P(S,v)}else i=new q({duration:Number.MAX_VALUE,timescale:1,startNumber:0,media:""},v)}return i}(e,(0,I.Z)({},n,{availabilityTimeOffset:v,availabilityTimeComplete:m,unsafelyBaseOnPreviousRepresentation:p,adaptation:t,inbandEventStreams:h}));void 0===e.attributes.bitrate?(o.Z.warn("DASH: No usable bitrate found in the Representation."),g=0):g=e.attributes.bitrate;var _,b,T,E=Y(n.baseURLs,e.children.baseURLs),k={bitrate:g,cdnMetadata:0===E.length?[{baseUrl:"",id:void 0}]:E.map((function(e){return{baseUrl:e.url,id:e.serviceLocation}})),index:y,id:f};void 0!==e.children.supplementalProperties&&(0,s.Z)(e.children.supplementalProperties,(function(e){return"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===e.schemeIdUri&&"JOC"===e.value}))&&(k.isSpatialAudio=!0),void 0!==e.attributes.codecs?_=e.attributes.codecs:void 0!==t.attributes.codecs&&(_=t.attributes.codecs),void 0!==_&&(_="mp4a.40.02"===_?"mp4a.40.2":_,k.codecs=_),void 0!==e.attributes.supplementalCodecs?b=e.attributes.supplementalCodecs:void 0!==t.attributes.supplementalCodecs&&(b=t.attributes.supplementalCodecs),void 0!==b&&(k.supplementalCodecs=(T=b,(0,S.Z)(T)?T.trim().replace(Z,", "):"")),void 0!==e.attributes.frameRate?k.frameRate=e.attributes.frameRate:void 0!==t.attributes.frameRate&&(k.frameRate=t.attributes.frameRate),void 0!==e.attributes.height?k.height=e.attributes.height:void 0!==t.attributes.height&&(k.height=t.attributes.height),void 0!==e.attributes.mimeType?k.mimeType=e.attributes.mimeType:void 0!==t.attributes.mimeType&&(k.mimeType=t.attributes.mimeType),void 0!==e.attributes.width?k.width=e.attributes.width:void 0!==t.attributes.width&&(k.width=t.attributes.width);var w=void 0!==t.children.contentProtections?t.children.contentProtections:[];if(void 0!==e.children.contentProtections&&w.push.apply(w,e.children.contentProtections),w.length>0){var A=w.reduce((function(e,t){var n;if(void 0!==t.attributes.schemeIdUri&&"urn:uuid:"===t.attributes.schemeIdUri.substring(0,9)&&(n=t.attributes.schemeIdUri.substring(9).replace(/-/g,"").toLowerCase()),void 0!==t.attributes.keyId&&t.attributes.keyId.length>0){var r={keyId:t.attributes.keyId,systemId:n};void 0===e.keyIds?e.keyIds=[r]:e.keyIds.push(r)}if(void 0!==n){for(var i,a=[],o=X(t.children.cencPssh);!(i=o()).done;){var u=i.value;a.push({systemId:n,data:u})}if(a.length>0){var l,d=(0,s.Z)(e.initData,(function(e){return"cenc"===e.type}));if(void 0===d)e.initData.push({type:"cenc",values:a});else(l=d.values).push.apply(l,a)}}return e}),{keyIds:void 0,initData:[]});(Object.keys(A.initData).length>0||void 0!==A.keyIds&&A.keyIds.length>0)&&(k.contentProtections=A)}k.hdrInfo=$({adaptationProfiles:t.attributes.profiles,supplementalProperties:t.children.supplementalProperties,essentialProperties:t.children.essentialProperties,manifestProfiles:n.manifestProfiles,codecs:_}),c.push(k)},v=X(e);!(d=v()).done;)f();return c}function ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(n.sort(se),e[t]=n.map((function(e){return e[0]}))),e}),{});return c.video.sort(se),k(de,f),de}(E.children.adaptations,U),F=(null!==(a=t.xmlNamespaces)&&void 0!==a?a:[]).concat(null!==(u=E.attributes.namespaces)&&void 0!==u?u:[]),V=function(e,t,n){for(var r,i,a,o=[],s=ue(e);!(a=s()).done;)for(var u,l=a.value,d=l.attributes,c=d.schemeIdUri,f=void 0===c?"":c,v=d.timescale,p=void 0===v?1:v,h=n.concat(null!==(r=l.attributes.namespaces)&&void 0!==r?r:[]),m=ue(l.children.events);!(u=m()).done;){var y=u.value;if(void 0!==y.eventStreamData){var _=(null!==(i=y.presentationTime)&&void 0!==i?i:0)/p+t,b=void 0===y.duration?void 0:_+y.duration/p,S=void 0;if(y.eventStreamData instanceof Element)S=y.eventStreamData;else{var T=h.reduce((function(e,t){return e+"xmlns:"+t.key+'="'+t.value+'" '}),"","application/xml").documentElement.childNodes[0]}o.push({start:_,end:b,id:y.id,data:{type:"dash-event-stream",value:{schemeIdUri:f,timescale:p,element:S}}})}}return o}(E.children.eventStreams,x,F),z={id:v,start:x,end:M,duration:R,adaptations:B,streamEvents:V};if(l.unshift(z),!f.lastPositionIsKnown()){var K=function(e){for(var t,n=null,r=!0,a=(0,m.Z)(e).filter((function(e){return!(0,i.Z)(e)})),o=ue((0,p.Z)(a,(function(e){return e})));!(t=o()).done;)for(var s,u=ue(t.value.representations);!(s=u()).done;){var l=s.value.index.getLastAvailablePosition();null!==l&&(r=!1,"number"==typeof l&&(n=(0,i.Z)(n)?l:Math.max(n,l)))}if(!(0,i.Z)(n))return n;if(r)return null;return}(B);if(c)if("number"==typeof K){var G=performance.now()/1e3;f.setLastPosition(K,G)}else{var W=fe(t,x);if(void 0!==W){var H=W[0],j=W[1];f.setLastPosition(H,j)}}else"number"==typeof K&&f.setLastPosition(K)}},h=e.length-1;h>=0;h--)v();if(t.isDynamic&&!f.lastPositionIsKnown()){var T=fe(t,0);if(void 0!==T){var E=T[0],w=T[1];f.setLastPosition(E,w)}}return function(e){if(0===e.length)return[];for(var t=[e[0]],n=1;nr.start)&&(o.Z.warn("DASH: Updating overlapping Periods.",null==i?void 0:i.start,r.start),i.duration=r.start-i.start,i.end=r.start,!(i.duration>0))&&(t.pop(),0!==t.length);)i=t[t.length-1];t.push(r)}return t}(l)}function fe(e,t){if((0,i.Z)(e.clockOffset)){var n=Date.now()/1e3;if(n>=t)return o.Z.warn("DASH Parser: no clock synchronization mechanism found. Using the system clock instead."),[n-e.availabilityStartTime,performance.now()/1e3]}else{var r=e.clockOffset/1e3-e.availabilityStartTime,a=performance.now()/1e3,s=a+r;if(s>=t)return[s,a]}}function ve(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pe(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?t[0].value:void 0}(t);if(null!=_&&_.length>0)return{type:"needs-clock",value:{url:_,continue:function(i){return i.success?(n.externalClockOffset=l(i.data),e(t,n,r,!0)):(r.push(i.error),o.Z.warn("DASH Parser: Error on fetching the clock ressource",i.error),e(t,n,r,!0))}}}}}for(var b=[],S=0;S=0&&(d=0===m.minimumUpdatePeriod?a.Z.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:m.minimumUpdatePeriod);var R=f(I),M=R.minimumSafePosition,C=R.maximumSafePosition,P=R.maximumUnsafePosition,D=performance.now();if(g){var N;if(void 0!==C)N=C;else if(void 0===k)o.Z.warn("DASH Parser: use system clock to define maximum position"),N=Date.now()/1e3-b;else N=(performance.now()+k)/1e3-b;var O=w.getEstimatedLiveEdge();void 0===O&&(O=void 0!==P?P:N),p={isLinear:!0,maximumSafePosition:N,livePosition:O,time:D},c=M,null!==(x=null!=S?S:null)&&void 0!==c&&O-c>x&&(x=O-c)}else{c=void 0!==M?M:void 0!==(null===(i=I[0])||void 0===i?void 0:i.start)?I[0].start:0;var L=null!=Z?Z:1/0;if(void 0!==I[I.length-1]){var U=I[I.length-1],B=null!==(s=U.end)&&void 0!==s?s:void 0!==U.duration?U.start+U.duration:void 0;void 0!==B&&B=0;o--){var s,u=b[o].index,l=a[o],f=l.parsed,v=l.warnings,p=l.receivedTime,h=l.sendingTime,m=l.url;v.length>0&&r.push.apply(r,v);for(var g,y=ve(f);!(g=y()).done;){var _=g.value;d.set(_,{receivedTime:p,sendingTime:h,url:m})}(s=c.periods).splice.apply(s,[u,1].concat(f))}return e(t,n,r,i,d)}}}};function me(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function ge(e){for(var t={},n=0;n0){var s=Me(a,"cenc:pssh"),u=s[0],l=s[1];null!==l&&(o.Z.warn(l.message),t.push(l)),null!==u&&n.push(u)}}}return[{cencPssh:n},t]}(e.childNodes),n=t[0],r=t[1];return[{children:n,attributes:function(e){for(var t={},n=0;n0&&(r=r.concat(c));break;case"SegmentList":var f=Be(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=Ve(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=Ne(a),_=y[0],b=y[1];b.length>0&&(r=r.concat(b)),void 0!==_&&n.push(_);break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Ce(a)]:t.supplementalProperties.push(Ce(a))}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Pe(t,n),i=0;i0&&(r=r.concat(u));break;case"ContentComponent":t.contentComponent=ge(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[Ce(a)]:t.essentialProperties.push(Ce(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Ce(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=ze(a),c=d[0],f=d[1];t.representations.push(c),f.length>0&&(r=r.concat(f));break;case"Role":null==t.roles?t.roles=[Ce(a)]:t.roles.push(Ce(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Ce(a)]:t.supplementalProperties.push(Ce(a));break;case"SegmentBase":var v=Le(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Be(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=Ve(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var T=Ne(a),E=T[0],k=T[1];k.length>0&&(r=r.concat(k)),void 0!==E&&n.push(E)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Pe(t,n),i=0;i0&&(n=n.concat(d))}}return[t,n]}function We(e){for(var t={eventStreamData:e},n=[],r=Pe(t,n),i=0;i0&&(i=i.concat(_))}}return[{baseURLs:n,adaptations:r,eventStreams:a,segmentTemplate:t},i]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Pe(t,n),i=0;i",c=(new DOMParser).parseFromString(d,"text/xml");if(null==c||0===c.children.length)throw new Error("DASH parser: Invalid external ressources");for(var f=c.children[0].children,v=[],p=[],h=0;h0;){var r=e[0];if(r.start>=t)return n;if(-1===r.repeatCount)return n;if(0===r.repeatCount)e.shift(),n+=1;else{var i=e[1];if(void 0!==i&&i.start<=t)e.shift(),n+=1;else{if(r.duration<=0)return n;for(var a=r.start+r.duration,o=1;ar.repeatCount)){var s=r.repeatCount-o;return r.start=a,r.repeatCount=s,n+=o}e.shift(),n=r.repeatCount+1}}}return n}n.d(t,{Z:function(){return r}})},3911:function(e,t,n){"use strict";n.d(t,{KF:function(){return i},PZ:function(){return u},_j:function(){return l},gT:function(){return o},jH:function(){return a},zG:function(){return s}});var r=n(1946);function i(e,t,n){var i,a=e.repeatCount;return a>=0?a:(i=(0,r.Z)(t)?void 0!==n?n:Number.MAX_VALUE:t.start,Math.ceil((i-e.start)/e.duration)-1)}function a(e,t,n){var r=e.start,a=e.duration;return a<=0?r:r+(i(e,t,n)+1)*a}function o(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function s(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function u(e,t,n){return[e*n,(e+t)*n]}function l(e,t,n){var r=e.timeline,i=o(t,e);if(i<0)return null;var u=function(e,t){for(var n=0,r=e.length;n>>1;e[i].start<=t?n=i+1:r=i}return n-1}(r,i);if(u<0||u>=r.length-1)return null;var l=r[u];if(l.duration<=0)return null;var d=r[u+1];if(void 0===d)return null;var c=d.start;return i>=a(l,d,n)&&i=0;u--){var l=e[u].start;if(l===o){var d=n-u;return e.splice.apply(e,[u,d].concat(t)),!1}if(lo)return i.Z.warn("RepresentationIndex: Manifest update removed all previous segments"),e.splice.apply(e,[0,n].concat(t)),!0;if(void 0===c.repeatCount||c.repeatCount<=0)return c.repeatCount<0&&(c.repeatCount=Math.floor((o-c.start)/c.duration)-1),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;if(c.start+c.duration*(c.repeatCount+1)<=o)return e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;var f=(o-c.start)/c.duration-1;if(f%1==0&&c.duration===t[0].duration){var v=t[0].repeatCount<0?-1:t[0].repeatCount+f+1;return e.splice.apply(e,[u,n-u].concat(t)),e[u].start=c.start,e[u].repeatCount=v,!1}return i.Z.warn("RepresentationIndex: Manifest update removed previous segments"),e[u].repeatCount=Math.floor(f),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1}}var p=e[e.length-1],h=t[t.length-1];return void 0!==p.repeatCount&&p.repeatCount<0?p.start>h.start?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0):p.start+p.duration*(p.repeatCount+1)>=h.start+h.duration*(h.repeatCount+1)?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0)}},5734:function(e,t,n){"use strict";var r=n(6923),i=/&#([0-9]+);/g,a=/
/gi,o=/]*>([\s\S]*?)<\/style[^>]*>/i,s=/\s*

]+))?>(.*)/i,u=/]+?start="?([0-9]*)"?[^0-9]/i;function l(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var d,c,f=/]/gi,v=/]|<\/body>/gi,p=[],h=o.exec(e),m=Array.isArray(h)?h[1]:"";v.exec(e);var g,y=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);null!==r;){var i=r[1],a=l(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(m),_=function(e){var t=/p\s*{([^}]*)}/gi.exec(e);return null===t?"":t[1]}(m);if((0,r.Z)(n)&&void 0===(g=y[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;d=f.exec(e),c=v.exec(e),null!==d||null!==c;){if(null===d||null===c||d.index>=c.index)throw new Error("parse error");var b=e.slice(d.index,c.index),S=u.exec(b);if(!Array.isArray(S))throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return p;function E(e,n){for(var o=e.length;--o>=0;){var u=s.exec(e[o]);if(Array.isArray(u)){var l=u[1],d=u[2];if(g===l)if(" "===d)p[p.length-1].end=n;else{var c=document.createElement("DIV");c.className="rxp-texttrack-region";var f=document.createElement("DIV");f.className="rxp-texttrack-div",f.style.position="absolute",f.style.bottom="0",f.style.width="100%",f.style.color="#fff",f.style.textShadow="-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000";var v=document.createElement("div");v.className="rxp-texttrack-p",(0,r.Z)(_)&&(v.style.cssText=_);for(var h=d.split(a),m=0;m/gi,s=/]*>([\s\S]*?)<\/style[^>]*>/i,u=/\s*

]+))?>(.*)/i,l=/]+?start="?([0-9]*)"?[^0-9]/i;function d(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var c,f,v=/]/gi,p=/]|<\/body>/gi,h=[],m=s.exec(e),g=null!==m?m[1]:"";p.exec(e);var y,_=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);Array.isArray(r);){var i=r[1],a=d(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(g);if((0,i.Z)(n)&&void 0===(y=_[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;c=v.exec(e),f=p.exec(e),null!==c||null!==f;){if(null===c||null===f||c.index>=f.index)throw new Error("parse error");var b=e.slice(c.index,f.index),S=l.exec(b);if(null===S)throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return function(e){for(var t=[],n=0;n=0;)if(null!==(r=u.exec(e[s]))){var l=r,d=l[1],c=l[2];y===d&&(" "===c?h[h.length-1].end=n:h.push({text:(i=c,i.replace(o,"\n").replace(a,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}}},2061:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}function a(e){for(var t=[],n=0;n0&&(1===o.length?o[0].indexOf("--\x3e")>=0&&t.push(o):(o[1].indexOf("--\x3e")>=0||o[0].indexOf("--\x3e")>=0)&&t.push(o)),n=a}return t}},8675:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2061),i=n(788);function a(e,t){for(var n=e.split(/\r\n|\n|\r/),a=(0,r.Z)(n),s=[],u=0;u0){var l=document.createTextNode(o[s]);r.appendChild(l)}}else if("B"===a.nodeName){var d=e(a);d.style.fontWeight="bold",r.appendChild(d)}else if("I"===a.nodeName){var c=e(a);c.style.fontStyle="italic",r.appendChild(c)}else if("U"===a.nodeName){var f=e(a);f.style.textDecoration="underline",r.appendChild(f)}else if(u(a)&&"string"==typeof a.color){var v=e(a);v.style.color=a.color,r.appendChild(v)}else{var p=e(a);r.appendChild(p)}}return r}(t)}function u(e){return"FONT"===e.nodeName&&"color"in e}},8057:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7253),i=n(2061),a=n(788);function o(e,t){for(var n,o,s,u,l,d=e.split(/\r\n|\n|\r/),c=(0,i.Z)(d),f=[],v=0;v0){var _=p.getAttribute("xml:space"),b=(0,l.Z)(_)?"default"===_:o,T=(0,d.Z)({},i,(0,c.U)(g,[p],n,t));u.push.apply(u,e(p,T,[p].concat(a),b))}}return u}(e,(0,d.Z)({},r),[],i)}(e,n,r,i,s),T=0;T|\u2265/g,">").replace(/\u200E/g,"‎").replace(/\u200F/g,"‏").replace(/\u00A0/g," ")}else if((0,l.OE)(s))i+="\n";else if((0,l.jg)(s)&&s.nodeType===Node.ELEMENT_NODE&&s.childNodes.length>0){var c=s.getAttribute("xml:space");i+=n(s,(0,o.Z)(c)?"default"===c:t)}}return i}return n(e,t)}(t,v),y=(0,i.Z)(h+n,m+n,g);return null===y?null:((0,a.Z)(y)&&function(e,t){var n=t.extent;if((0,o.Z)(n)){var r=u._0.exec(n);null!=r&&(e.size=Number(r[1]))}switch(t.writingMode){case"tb":case"tblr":e.vertical="lr";break;case"tbrl":e.vertical="rl"}var i=t.origin;if((0,o.Z)(i))u._0.exec(i);var a=t.align;if((0,o.Z)(a)){e.align=a,"center"===a&&("center"!==e.align&&(e.align="middle"),e.position="auto");var s=c[a];e.positionAlign=void 0===s?"":s;var l=d[a];e.lineAlign=void 0===l?"":l}}(y,r),y)}var v=function(e,t){for(var n=(0,r.Z)(e,t),i=[],a=0;a0&&(t=n)}return t}function a(e){var t=e.getElementsByTagName("body");if(t.length>0)return t[0];var n=e.getElementsByTagName("tt:body");return n.length>0?n[0]:null}function o(e){var t=e.getElementsByTagName("style");if(t.length>0)return t;var n=e.getElementsByTagName("tt:style");return n.length>0?n:t}function s(e){var t=e.getElementsByTagName("region");if(t.length>0)return t;var n=e.getElementsByTagName("tt:region");return n.length>0?n:t}function u(e){var t=e.getElementsByTagName("p");if(t.length>0)return t;var n=e.getElementsByTagName("tt:p");return n.length>0?n:t}function l(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function d(e){return"span"===e.nodeName||"tt:span"===e.nodeName}n.d(t,{DM:function(){return s},H:function(){return a},OE:function(){return l},jF:function(){return i},jg:function(){return d},kd:function(){return u},vU:function(){return o}})},1138:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923),i=n(360);function a(e,t){for(var n=[],a=t;a=2)for(var r=function(r){var o=e[r];if(Array.isArray(/::cue {/.exec(o)))for(o=e[++r];(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)n+=o,o=e[++r];else{for(var s=[],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);(0,i.Z)(o)&&Array.isArray(u);)s.push(u[1]),o=e[++r],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);for(var l="";(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)l+=o,o=e[++r];s.forEach((function(e){void 0===t[e]?t[e]=l:t[e]+=l}))}a=r},a=1;a0&&n.appendChild(document.createElement("br")),o[s].length>0){var u=document.createTextNode(o[s]);n.appendChild(u)}}else{var c=e.nodeName.toLowerCase().split("."),f=[];if(c.forEach((function(e){(0,i.Z)(t[e])&&f.push(t[e])})),0!==f.length){var v=document.createAttribute("style");f.forEach((function(e){v.value+=e}));var p=(0,l.Z)(r,a)?a:"span";(n=document.createElement(p)).setAttributeNode(v)}else{var h=(0,l.Z)(r,a)?a:"span";n=document.createElement(h)}for(var m=0;m/,"").replace(/<([u,i,b,c])(\..*?)?(?: .*?)?>(.*?)<\/\1>/g,"<$1$2>$3"),r=(new DOMParser).parseFromString(n,"text/html").body.childNodes,i=[],a=0;a=2){var a=parseInt(i[1],10);isNaN(a)||(t.position=a,void 0!==i[2]&&(t.positionAlign=i[2]))}}(0,u.Z)(e.size)&&(t.size=e.size),"string"==typeof e.align&&(0,s.Z)(["start","center","end","left"],e.align)&&(t.align=e.align)}var d=n(7253);var c=function(e,t){var n=e.split(/\r\n|\n|\r/);if(!/^WEBVTT($| |\t)/.test(n[0]))throw new Error("Can't parse WebVTT: Invalid file.");for(var s,u,c,f,v=(0,o.yE)(n),p=(0,i.Z)(n,v),h=[],m=0;m/;if(o.test(e[0]))n=e[0],r=e.slice(1,e.length);else{if(!o.test(e[1]))return null;a=e[0],n=e[1],r=e.slice(2,e.length)}var s=function(e){var t=/^([\d:.]+)[ |\t]+-->[ |\t]+([\d:.]+)[ |\t]*(.*)$/.exec(e);if(null===t)return null;var n=i(t[1]),r=i(t[2]);return null==n||null==r?null:{start:n,end:r,settings:t[3].split(/ |\t/).reduce((function(e,t){var n=t.split(":");return 2===n.length&&(e[n[0]]=n[1]),e}),{})}}(n);return null===s?null:{start:s.start+t,end:s.end+t,settings:s.settings,payload:r,header:a}}},360:function(e,t,n){"use strict";n.d(t,{$4:function(){return s},JF:function(){return a},tq:function(){return o},yE:function(){return i}});var r=n(6923);function i(e){for(var t=0;t=0)return!0;var r=e[t+1];return void 0!==r&&r.indexOf("--\x3e")>=0}function s(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}},85:function(e,t,n){"use strict";n.d(t,{Z:function(){return ce}});var r=n(7874),i=n(8791),a=n(5861),o=n(4687),s=n.n(o),u=n(4597),l=n(9829);function d(e,t){return null===e?null:null===t.url?e.baseUrl:(0,l.Z)(e.baseUrl,t.url)}function c(e,t,n,r,i){return f.apply(this,arguments)}function f(){return(f=(0,a.Z)(s().mark((function e(t,n,r,i,a){var o,l,c;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.segment,l=d(t,o),!o.isInit&&null!==l){e.next=4;break}return e.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return e.next=6,(0,u.ZP)({url:l,responseType:"arraybuffer",timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i});case 6:return c=e.sent,e.abrupt("return",{resultType:"segment-loaded",resultData:c});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(e,t){var n,i=t.segment,a=t.period,o=e.data,s=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(s)throw new Error("Image data should not be downloaded in chunks");var u=null!==(n=i.timestampOffset)&&void 0!==n?n:0;return null===o||null===r.Z.imageParser?{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:{duration:i.duration,time:i.time},chunkOffset:u,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}:{segmentType:"media",chunkData:{data:r.Z.imageParser(new Uint8Array(o)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkSize:void 0,chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkOffset:u,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}var p=n(6872),h=n(8750),m=n(3887),g=n(1989),y=n(8026),_=n(3635);function b(e){var t=e.aggressiveMode,n=e.referenceDateTime,i=void 0!==e.serverSyncInfos?e.serverSyncInfos.serverTimestamp-e.serverSyncInfos.clientTime:void 0;return function(a,o,s,l,d){var c,f=a.responseData,v=o.externalClockOffset,b=null!==(c=a.url)&&void 0!==c?c:o.originalUrl,S=null!=i?i:v,T={aggressiveMode:!0===t,unsafelyBaseOnPreviousManifest:o.unsafeMode?o.previousManifest:null,url:b,referenceDateTime:n,externalClockOffset:S},E=r.Z.dashParsers;if(null===E.wasm||"uninitialized"===E.wasm.status||"failure"===E.wasm.status)return m.Z.debug("DASH: WASM MPD Parser not initialized. Running JS one."),w();var k=function(e){if(e instanceof ArrayBuffer)return e;if("string"==typeof e)return(0,_.tG)(e).buffer;if(e instanceof Document)return(0,_.tG)(e.documentElement.innerHTML).buffer;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return function(e){var t=new DataView(e);if(61371===t.getUint16(0)&&191===t.getUint8(2))return!0;if(65279===t.getUint16(0)||65534===t.getUint16(0))return!1;return!0}(k)?"initialized"===E.wasm.status?(m.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T))):(m.Z.debug("DASH: Awaiting WASM initialization before parsing the MPD."),E.wasm.waitForInitialization().catch((function(){})).then((function(){return null===E.wasm||"initialized"!==E.wasm.status?(m.Z.warn("DASH: WASM MPD parser initialization failed. Running JS parser instead"),w()):(m.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T)))}))):(m.Z.info("DASH: MPD doesn't seem to be UTF-8-encoded. Running JS parser instead of the WASM one."),w());function w(){if(null===E.js)throw new Error("No MPD parser is imported");var e=function(e){if(e instanceof ArrayBuffer)return(new DOMParser).parseFromString((0,_.uR)(new Uint8Array(e)),"text/xml");if("string"==typeof e)return(new DOMParser).parseFromString(e,"text/xml");if(e instanceof Document)return e;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return A(E.js(e,T))}function A(t){if("done"===t.type)return t.value.warnings.length>0&&s(t.value.warnings),l.isCancelled()?Promise.reject(l.cancellationError):{manifest:new g.ZP(t.value.parsed,e),url:b};var n=t.value,r=n.urls.map((function(e){return d((function(){var t=p.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT;return"string"===n.format?(0,u.ZP)({url:e,responseType:"text",timeout:t,cancelSignal:l}):(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:t,cancelSignal:l})})).then((function(e){if("string"===n.format){if("string"!=typeof e.responseData)throw new Error("External DASH resources should have been a string");return(0,y.Z)(e,{responseData:{success:!0,data:e.responseData}})}if(!(e.responseData instanceof ArrayBuffer))throw new Error("External DASH resources should have been ArrayBuffers");return(0,y.Z)(e,{responseData:{success:!0,data:e.responseData}})}),(function(e){var t=(0,h.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"An unknown error occured when parsing ressources."});return(0,y.Z)({},{size:void 0,requestDuration:void 0,responseData:{success:!1,error:t}})}))}));return Promise.all(r).then((function(e){return n.format,A(n.continue(e))}))}}}var S=n(7839),T=n(9105),E=n(5992),k=n(1946),w="function"==typeof Headers?Headers:null,A="function"==typeof AbortController?AbortController:null;function I(){return"function"==typeof window.fetch&&!(0,k.Z)(A)&&!(0,k.Z)(w)}var Z=n(8806),x=n(281);function R(e,t){return"audio"===e||"video"===e?"video/mp4"===t.mimeType||"audio/mp4"===t.mimeType?"mp4":"video/webm"===t.mimeType||"audio/webm"===t.mimeType?"webm":void 0:"text"===e&&"application/mp4"===t.mimeType?"mp4":void 0}var M=n(288),C=n(4460);function P(e){return function(t,n,r,i,a){return new Promise((function(s,u){var l=new M.ZP,d=l.linkToSignal(i);function c(){l.signal.deregister(u),d()}l.signal.register(u),e(t,n,r,l.signal,Object.assign(Object.assign({},a),{onNewChunk:function(e){try{o(e),a.onNewChunk(e)}catch(e){c(),l.cancel(),u(e)}}})).then((function(e){if(c(),!l.isUsed()){if("segment-loaded"===e.resultType)try{o(e.resultData.responseData)}catch(e){return void u(e)}s(e)}}),(function(e){c(),u(e)}))}));function o(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&"mp4"===R(n.adaptation.type,n.representation)&&(0,C.Z)(new Uint8Array(e),n.segment.isInit)}}}var D=n(6968);function N(e,t,n,r,i){if(void 0===t.range)return(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(void 0===t.indexRange)return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(t.range[1]+1===t.indexRange[0])return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)([t.range[0],t.indexRange[1]])},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));var a=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.indexRange)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress});return Promise.all([a,o]).then((function(t){var n=t[0],r=t[1],i=(0,D.zo)(new Uint8Array(n.responseData),new Uint8Array(r.responseData)),a=Math.min(n.sendingTime,r.sendingTime),o=Math.max(n.receivedTime,r.receivedTime);return{resultType:"segment-loaded",resultData:{url:e,responseData:i,size:n.size+r.size,requestDuration:o-a,sendingTime:a,receivedTime:o}}}))}var O=n(8766);function L(e,t,n,r,i){var o=t.segment,u=void 0!==o.range?{Range:(0,x.Z)(o.range)}:void 0,l=null;return function(e){var t;if(!(0,k.Z)(e.headers))if((0,k.Z)(w))t=e.headers;else{t=new w;for(var n=Object.keys(e.headers),r=0;r=300)throw m.Z.warn("Fetch: Request HTTP Error",t.status,t.url),new T.Z(t.url,t.status,E.br.ERROR_HTTP_CODE);if((0,k.Z)(t.body))throw new T.Z(t.url,t.status,E.br.PARSE_ERROR);var n=t.headers.get("Content-Length"),r=(0,k.Z)(n)||isNaN(+n)?void 0:+n,i=t.body.getReader(),u=0;return l();function l(){return c.apply(this,arguments)}function c(){return(c=(0,a.Z)(s().mark((function n(){var a,o,c,f,p;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.read();case 2:if((a=n.sent).done||(0,k.Z)(a.value)){n.next=11;break}return u+=a.value.byteLength,o=performance.now(),c={url:t.url,currentTime:o,duration:o-d,sendingTime:d,chunkSize:a.value.byteLength,chunk:a.value.buffer,size:u,totalSize:r},e.onData(c),n.abrupt("return",l());case 11:if(!a.done){n.next=16;break}return v(),f=performance.now(),p=f-d,n.abrupt("return",{requestDuration:p,receivedTime:f,sendingTime:d,size:u,status:t.status,url:t.url});case 16:return n.abrupt("return",l());case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}})).catch((function(t){if(null!==u)throw u;if(v(),l)throw m.Z.warn("Fetch: Request timeouted."),new T.Z(e.url,0,E.br.TIMEOUT);if(t instanceof T.Z)throw t;throw m.Z.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new T.Z(e.url,0,E.br.ERROR_EVENT)}))}({url:e,headers:u,onData:function(e){var t=new Uint8Array(e.chunk),n=function(e){for(var t=0,n=[];te.length)return[n,r];var o=(0,O.Z)(r,1835295092);if(o<0)return[n,r];var s=t+o+(0,D.pX)(e,o+t);if(s>e.length)return[n,r];var u=Math.max(a,s),l=e.subarray(t,u);n.push(l),t=u}return[n,null]}(null!==l?(0,D.zo)(l,t):t),a=n[0];l=n[1];for(var o=0;o0)for(var v=0;v=Math.pow(2,8-n))return n}function ee(e,t){var n=J(e,t);if(null==n)return m.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return m.Z.warn("webm: impossible length"),null;for(var r=0,i=0;ie.length)return m.Z.warn("webm: impossible length"),null;for(var r=(e[t]&(1<<8-n)-1)*Math.pow(2,8*(n-1)),i=1;i=i)return!0}return!1}(r,t);return{inbandEvents:a,needsManifestRefresh:o}}}function oe(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a,o=n.period,s=n.adaptation,u=n.representation,l=n.segment,d=n.manifest,c=e.data,f=e.isChunked,v=[o.start,o.end];if(null===c)return l.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionDataUpdate:!1,appendWindow:v};var p=c instanceof Uint8Array?c:new Uint8Array(c),h=R(s.type,u),m="mp4"===h||void 0===h,g=!1;if(m){var y,_=(0,B.Z)(p);l.isInit&&(y=null!==(i=(0,F.R0)(p))&&void 0!==i?i:void 0),(_.length>0||void 0!==y)&&(g=u._addProtectionData("cenc",y,_))}if(!l.isInit){var b=m?ie(p,f,l,r):null,S=null!==(a=l.timestampOffset)&&void 0!==a?a:0;if(m){var T=(0,F.s9)(p);if(void 0!==T){var E=ae(T.filter((function(e){return void 0!==l.privateInfos&&void 0!==l.privateInfos.isEMSGWhitelisted&&l.privateInfos.isEMSGWhitelisted(e)})),d.publishTime);if(void 0!==E){var w=E.needsManifestRefresh,A=E.inbandEvents;return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,appendWindow:v,inbandEvents:A,protectionDataUpdate:g,needsManifestRefresh:w}}}}return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,protectionDataUpdate:g,appendWindow:v}}var I=l.indexRange,Z=null;if("webm"===h)Z=function(e,t){var n=X(V,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=Q(e,r);if(null==a)return null;var o=$(e,r);if(null==o)return null;var s=X(W,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l0)){var x=Z[Z.length-1];Array.isArray(x.range)&&(x.range[1]=1/0)}u.index instanceof re.Z&&null!==Z&&Z.length>0&&u.index.initializeIndex(Z);var M=m?(0,F.LD)(p):"webm"===h?Q(p,0):void 0,C=(0,k.Z)(M)?void 0:M;return{segmentType:"init",initializationData:p,initializationDataSize:p.length,protectionDataUpdate:g,initTimescale:C}}}var se=n(6807);function ue(e,t,n,r){var i,a,o=e.segment,s=e.adaptation,u=e.representation;if(o.isInit)return null;null===n?r?(i=o.time,a=o.end):m.Z.warn("Transport: Unavailable time data for current text track."):(i=n.time,void 0!==n.duration?a=i+n.duration:!r&&o.complete&&(a=i+o.duration));var l=function(e){var t=e.codec;if(void 0===t)throw new Error("Cannot parse subtitles: unknown format");switch(t.toLowerCase()){case"stpp":case"stpp.ttml.im1t":return"ttml";case"wvtt":return"vtt"}throw new Error('The codec used for the subtitles "'+t+'" is not managed yet.')}(u),d=function(e){var t=(0,se.Le)(e);return null===t?"":(0,_.uR)(t)}(t);return{data:d,type:l,language:s.language,start:i,end:a}}function le(e,t,n){var r,i,a=e.segment,o=e.adaptation,s=e.representation;if(a.isInit)return null;n?m.Z.warn("Transport: Unavailable time data for current text track."):(r=a.time,a.complete&&(i=a.time+a.duration));var u=function(e){var t=e.mimeType,n=void 0===t?"":t;switch(e.mimeType){case"application/ttml+xml":return"ttml";case"application/x-sami":case"application/smil":return"sami";case"text/vtt":return"vtt"}var r=e.codec;if("srt"===(void 0===r?"":r).toLowerCase())return"srt";throw new Error("could not find a text-track parser for the type "+n)}(s);return{data:t,type:u,language:o.language,start:r,end:i}}function de(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.period,o=n.adaptation,s=n.representation,u=n.segment,l=e.data,d=e.isChunked;if(null===l)return u.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:null!==(i=u.timestampOffset)&&void 0!==i?i:0,protectionDataUpdate:!1,appendWindow:[a.start,a.end]};var c=R(o.type,s);if("webm"===c)throw new Error("Text tracks with a WEBM container are not yet handled.");return"mp4"===c?function(e,t,n,r,i){var a,o=n.period,s=n.representation,u=n.segment,l=u.isInit,d=u.indexRange,c="string"==typeof e?(0,_.tG)(e):e instanceof Uint8Array?e:new Uint8Array(e);if(l){var f=(0,F.Wf)(c,Array.isArray(d)?d[0]:0);if(!0===i&&null!==f&&f.length>0){var v=f[f.length-1];Array.isArray(v.range)&&(v.range[1]=1/0)}var p=(0,F.LD)(c);return s.index instanceof re.Z&&null!==f&&f.length>0&&s.index.initializeIndex(f),{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:p}}var h=ie(c,t,u,r),m=ue(n,c,h,t),g=null!==(a=u.timestampOffset)&&void 0!==a?a:0;return{segmentType:"media",chunkData:m,chunkSize:c.length,chunkInfos:h,chunkOffset:g,protectionDataUpdate:!1,appendWindow:[o.start,o.end]}}(l,d,n,r,t):function(e,t,n){var r,i,a=n.period,o=n.segment,s=o.timestampOffset,u=void 0===s?0:s;if(o.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if("string"!=typeof e){var l=e instanceof Uint8Array?e:new Uint8Array(e);r=(0,_.uR)(l),i=l.length}else r=e;return{segmentType:"media",chunkData:le(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:u,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}(l,d,n)}}var ce=function(e){var t=(0,i.Z)({customManifestLoader:e.manifestLoader},null===r.Z.dashParsers.wasm||"initialized"!==r.Z.dashParsers.wasm.status&&"initializing"!==r.Z.dashParsers.wasm.status?"arraybuffer":"text"),n=b(e),a=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:P(r);function r(e,r,i,a,o){var s=d(e,r.segment);if(null==s)return Promise.resolve({resultType:"segment-created",resultData:null});if(t||void 0===n)return U(s,r,t,i,o,a);var u={adaptation:r.adaptation,manifest:r.manifest,period:r.period,representation:r.representation,segment:r.segment,transport:"dash",timeout:i.timeout,url:s};return new Promise((function(e,l){var d=!1,c=n(u,{reject:function(e){var t,n,r;if(!d&&!a.isCancelled()){d=!0,a.deregister(f);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a DASH segment through a custom segmentLoader.",s=new S.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);l(s)}},resolve:function(t){d||a.isCancelled()||(d=!0,a.deregister(f),e({resultType:"segment-loaded",resultData:{responseData:t.data,size:t.size,requestDuration:t.duration}}))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(f),U(s,r,t,i,o,a).then(e,l))}});function f(e){d||(d=!0,"function"==typeof c&&c(),l(e))}a.register(f)}))}}(e),o=oe(e),s=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:P(n);function n(e,n,r,i,a){var o=n.adaptation,s=n.representation,l=n.segment,c=l.range,f=d(e,l);if(null===f)return Promise.resolve({resultType:"segment-created",resultData:null});if(l.isInit)return N(f,l,r,i,a);var v=R(o.type,s),p="mp4"===v||void 0===v;if(t&&p){if(I())return L(f,n,r,a,i);(0,Z.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}return p?(0,u.ZP)({url:f,responseType:"arraybuffer",headers:Array.isArray(c)?{Range:(0,x.Z)(c)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):(0,u.ZP)({url:f,responseType:"text",headers:Array.isArray(c)?{Range:(0,x.Z)(c)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}}(e);return{manifest:{loadManifest:t,parseManifest:n},audio:{loadSegment:a,parseSegment:o},video:{loadSegment:a,parseSegment:o},text:{loadSegment:s,parseSegment:de(e)},image:{loadSegment:c,parseSegment:v}}}},2339:function(e,t,n){"use strict";n.d(t,{Z:function(){return me}});var r=n(5861),i=n(4687),a=n.n(i),o=n(7874),s=n(3887),u=n(1989),l=n(6807),d=n(9362),c=n(811),f=n(8232),v=n(3911),p=n(5505);function h(e,t,n){var r=e.timeline,i=e.timescale,a=r[r.length-1],o=t.timescale===i?{time:t.time,duration:t.duration}:{time:t.time/t.timescale*i,duration:t.duration/t.timescale*i};return!(n.time===o.time)&&(o.time>=(0,v.jH)(a,null)&&(a.duration===o.duration?a.repeatCount++:e.timeline.push({duration:o.duration,start:o.time,repeatCount:0}),!0))}function m(e,t){return e.replace(/\{start time\}/g,String(t))}function g(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function y(e,t){var n=e.repeatCount;if(null!=e.duration&&n<0){var r=void 0!==t?t.start:1/0;n=Math.ceil((r-e.start)/e.duration)-1}return n}var _=function(){function e(e,t){var n=t.aggressiveMode,r=t.isLive,i=t.segmentPrivateInfos,a=t.timeShiftBufferDepth,o=null==t.manifestReceivedTime?performance.now():t.manifestReceivedTime;if(this._index=e,this._indexValidityTime=o,this._timeShiftBufferDepth=a,this._initSegmentInfos={bitsPerSample:i.bitsPerSample,channels:i.channels,codecPrivateData:i.codecPrivateData,packetSize:i.packetSize,samplingRate:i.samplingRate,timescale:e.timescale,protection:i.protection},this._isAggressiveMode=n,this._isLive=r,0!==e.timeline.length){var s=e.timeline[e.timeline.length-1],u=(0,v.jH)(s,null);if(this._initialScaledLastPosition=u,r){var l=o/1e3*e.timescale;this._scaledLiveGap=l-u}}}var t=e.prototype;return t.getInitSegment=function(){return{id:"init",isInit:!0,privateInfos:{smoothInitSegment:this._initSegmentInfos},url:null,time:0,end:0,duration:0,timescale:1,complete:!0}},t.getSegments=function(e,t){this._refreshTimeline();for(var n,r=function(e,t,n){var r=void 0===e.timescale||0===e.timescale?1:e.timescale;return{up:t*r,to:(t+n)*r}}(this._index,e,t),i=r.up,a=r.to,o=this._index,s=o.timeline,u=o.timescale,l=o.media,d=this._isAggressiveMode,c=[],f=s.length,v=null==this._scaledLiveGap?void 0:performance.now()/1e3*u-this._scaledLiveGap,p=0;p=a)return c;null!=n&&(n+=S+1)}return c},t.shouldRefresh=function(e,t){if(this._refreshTimeline(),!this._isLive)return!1;var n=this._index,r=n.timeline,i=n.timescale,a=r[r.length-1];if(void 0===a)return!1;var o=a.repeatCount,s=a.start+(o+1)*a.duration;return!(t*i=s||e*i>a.start+o*a.duration)},t.getFirstAvailablePosition=function(){this._refreshTimeline();var e=this._index;return 0===e.timeline.length?null:e.timeline[0].start/e.timescale},t.getLastAvailablePosition=function(){this._refreshTimeline();var e=this._index;if(null==this._scaledLiveGap){var t=e.timeline[e.timeline.length-1];return(0,v.jH)(t,null)/e.timescale}for(var n=e.timeline.length-1;n>=0;n--)for(var r=e.timeline[n],i=performance.now()/1e3*e.timescale,a=r.start,o=r.duration,s=r.repeatCount;s>=0;s--){var u=a+o*(s+1);if((this._isAggressiveMode?u-o:u)<=i-this._scaledLiveGap)return u/e.timescale}},t.getEnd=function(){if(!this._isLive)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,c.Z)(e<=t),this.isStillAwaitingFutureSegments())return!1;var r=this.getLastAvailablePosition();return!(void 0!==r&&t(null!==(n=this.getFirstAvailablePosition())&&void 0!==n?n:0)&&void 0)},t.checkDiscontinuity=function(e){return this._refreshTimeline(),(0,v._j)(this._index,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();for(var t=this._index,n=t.timeline,r=t.timescale,i=0;ie.time)return!1;if(o===e.time)return!0;if(a.repeatCount>=0&&void 0!==a.duration){var s=(o-a.start)/a.duration-1;return s%1==0&&s<=a.repeatCount}}return!1},t.canBeOutOfSyncError=function(e){return!!this._isLive&&(e instanceof d.Z&&(e.isHttpError(404)||e.isHttpError(412)))},t._replace=function(e){var t=this._index.timeline,n=e._index.timeline,r=this._index.timescale,i=e._index.timescale;if(this._index=e._index,this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap,0!==t.length&&0!==n.length&&r===i){var a=t[t.length-1],o=n[n.length-1],u=(0,v.jH)(o,null);if(!((0,v.jH)(a,null)<=u))for(var l=0;lu){if(d.duration!==o.duration)return;var f=u-d.start;if(0===f)return s.Z.warn("Smooth Parser: a discontinuity detected in the previous manifest has been resolved."),void(this._index.timeline=this._index.timeline.concat(t.slice(l)));if(f<0||f%d.duration!=0)return;var p=f/d.duration-1,h=d.repeatCount-p;if(h<0)return;o.repeatCount+=h;var m=t.slice(l+1);return void(this._index.timeline=this._index.timeline.concat(m))}}}},t._update=function(e){(0,p.Z)(this._index.timeline,e._index.timeline),this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap},t.isStillAwaitingFutureSegments=function(){return this._isLive},t.isInitialized=function(){return!0},t.addNewSegments=function(e,t){this._refreshTimeline();for(var n=0;n>3:2)?"mp4a.40.2":"mp4a.40."+n}(u,l);return{audiotag:void 0!==i?parseInt(i,10):i,bitrate:v,bitsPerSample:void 0!==a?parseInt(a,10):a,channels:void 0!==o?parseInt(o,10):o,codecPrivateData:u,codecs:p,customAttributes:n,mimeType:void 0!==l?U[l]:l,packetSize:void 0!==d?parseInt(d,10):d,samplingRate:void 0!==c?parseInt(c,10):c};case"video":var h=r("CodecPrivateData"),m=r("FourCC"),g=r("MaxWidth"),y=r("MaxHeight"),_=r("Bitrate"),b=void 0===_||isNaN(parseInt(_,10))?0:parseInt(_,10);if(void 0!==m&&void 0===U[m]||void 0===h)return s.Z.warn("Smooth parser: Unsupported video codec. Ignoring quality level."),null;var S=function(e){var t=/00000001\d7([0-9a-fA-F]{6})/.exec(e);return null!==t&&(0,E.Z)(t[1])?"avc1."+t[1]:"avc1.4D401E"}(h);return{bitrate:b,customAttributes:n,mimeType:void 0!==m?U[m]:m,codecPrivateData:h,codecs:S,width:void 0!==g?parseInt(g,10):void 0,height:void 0!==y?parseInt(y,10):void 0};case"text":var T=r("CodecPrivateData"),k=r("FourCC"),w=r("Bitrate");return{bitrate:void 0===w||isNaN(parseInt(w,10))?0:parseInt(w,10),customAttributes:n,mimeType:void 0!==k?U[k]:k,codecPrivateData:null!=T?T:""};default:return s.Z.error("Smooth Parser: Unrecognized StreamIndex type: "+t),null}}function o(t){var r=t.root,i=t.timescale,o=t.baseUrl,u=t.protections,l=t.timeShiftBufferDepth,d=t.manifestReceivedTime,f=t.isLive,v=r.getAttribute("Timescale"),p=null===v||isNaN(+v)?i:+v,h=r.getAttribute("Type");if(null===h)throw new Error("StreamIndex without type.");(0,S.Z)(b.r,h)||s.Z.warn("Smooth Parser: Unrecognized adaptation type:",h);var m=h,g=r.getAttribute("Subtype"),y=r.getAttribute("Language"),w=r.getAttribute("Url"),I=null===w?"":w;var Z,x=O(r,(function(e,t,r){switch(t){case"QualityLevel":var i=a(r,m);if(null===i)return e;("video"!==m||i.bitrate>n)&&e.qualityLevels.push(i);break;case"c":e.cNodes.push(r)}return e}),{qualityLevels:[],cNodes:[]}),M=x.qualityLevels,C=x.cNodes,P={timeline:(Z=C,Z.reduce((function(e,t,n){var r=t.getAttribute("d"),i=t.getAttribute("t"),a=t.getAttribute("r"),o=null!==a?+a-1:0,s=null!==i?+i:void 0,u=null!==r?+r:void 0;if(0===n)s=void 0===s||isNaN(s)?0:s;else{var l=e[n-1];if(null==s||isNaN(s)){if(null==l.duration||isNaN(l.duration))throw new Error("Smooth: Invalid CNodes. Missing timestamp.");s=l.start+l.duration*(l.repeatCount+1)}}if(null==u||isNaN(u)){var d=Z[n+1];if(void 0===d)return e;var c=d.getAttribute("t"),f=(0,E.Z)(c)?+c:null;if(null===f)throw new Error("Can't build index timeline from Smooth Manifest.");u=f-s}return e.push({duration:u,start:s,repeatCount:o}),e}),[])),timescale:p};(0,c.Z)(0!==M.length,"Adaptation should have at least one playable representation.");var D=m+((0,E.Z)(y)?"_"+y:""),N=M.map((function(t){var n,r,i,a,s={timeline:P.timeline,timescale:P.timescale,media:(n=I,r=t.bitrate,i=t.customAttributes,n.replace(/\{bitrate\}/g,String(r)).replace(/{CustomAttributes}/g,i.length>0?i[0]:""))},c=(0,E.Z)(t.mimeType)?t.mimeType:L[m],v=t.codecs,p=D+"_"+(null!=m?m+"-":"")+(null!=c?c+"-":"")+(null!=v?v+"-":"")+String(t.bitrate),h=[];u.length>0&&(a=u[0],u.forEach((function(e){var t=e.keyId;e.keySystems.forEach((function(e){h.push({keyId:t,systemId:e.systemId})}))})));var g={bitsPerSample:t.bitsPerSample,channels:t.channels,codecPrivateData:t.codecPrivateData,packetSize:t.packetSize,samplingRate:t.samplingRate,protection:null!=a?{keyId:a.keyId}:void 0},y=null!=e.aggressiveMode&&e.aggressiveMode,b=new _(s,{aggressiveMode:y,isLive:f,manifestReceivedTime:d,segmentPrivateInfos:g,timeShiftBufferDepth:l}),S=(0,k.Z)({},t,{index:b,cdnMetadata:[{baseUrl:o}],mimeType:c,codecs:v,id:p});if(h.length>0||void 0!==a){var w=void 0===a?[]:a.keySystems.map((function(e){var t=e.systemId,n=e.privateData,r=t.replace(/-/g,""),i=function(e,t){if(32!==e.length)throw new Error("HSS: wrong system id length");var n=0;return R("pssh",(0,T.zo)([n,0,0,0],(0,A.nr)(e),(0,T.kh)(t.length),t))}(r,n);return{systemId:r,data:i}}));if(w.length>0){var Z=[{type:"cenc",values:w}];S.contentProtections={keyIds:h,initData:Z}}else S.contentProtections={keyIds:h,initData:[]}}return S}));if("ADVT"===g)return null;var U={id:D,type:m,representations:N,language:null==y?void 0:y};return"text"===m&&"DESC"===g&&(U.closedCaption=!0),U}return function(n,r,a){var s="";if(void 0!==r){var u=(0,w.$)(r);s=r.substring(0,u)}var l=n.documentElement;if(null==l||"SmoothStreamingMedia"!==l.nodeName)throw new Error("document root should be SmoothStreamingMedia");var d=l.getAttribute("MajorVersion"),c=l.getAttribute("MinorVersion");if(null===d||null===c||!/^[2]-[0-2]$/.test(d+"-"+c))throw new Error("Version should be 2.0, 2.1 or 2.2");var f,v,p=l.getAttribute("Timescale"),h=(0,E.Z)(p)?isNaN(+p)?1e7:+p:1e7,m=O(l,(function(t,n,r){switch(n){case"Protection":t.protections.push(N(r,e.keySystems));break;case"StreamIndex":t.adaptationNodes.push(r)}return t}),{adaptationNodes:[],protections:[]}),g=m.protections,y=m.adaptationNodes,_="boolean"==typeof(f=l.getAttribute("IsLive"))?f:"string"==typeof f&&"TRUE"===f.toUpperCase();if(_){var b=l.getAttribute("DVRWindowLength");null==b||isNaN(+b)||0==+b||(v=+b/h)}var S,T,k,A,I,Z,x,R=y.reduce((function(e,t){var n=o({root:t,baseUrl:s,timescale:h,protections:g,isLive:_,timeShiftBufferDepth:v,manifestReceivedTime:a});if(null===n)return e;var r=n.type,i=e[r];return void 0===i?e[r]=[n]:i.push(n),e}),{}),M=null,P=void 0!==R.video?R.video[0]:void 0,D=void 0!==R.audio?R.audio[0]:void 0;if(void 0!==P||void 0!==D){var L=[],U=[];if(void 0!==P){var B=P.representations[0];if(void 0!==B){var F=B.index.getFirstAvailablePosition(),V=B.index.getLastAvailablePosition();null!=F&&L.push(F),null!=V&&U.push(V)}}if(void 0!==D){var z=D.representations[0];if(void 0!==z){var K=z.index.getFirstAvailablePosition(),G=z.index.getLastAvailablePosition();null!=K&&L.push(K),null!=G&&U.push(G)}}L.length>0&&(I=Math.max.apply(Math,L)),U.length>0&&(Z=Math.min.apply(Math,U),x=Math.max.apply(Math,U))}var W=l.getAttribute("Duration"),H=null!==W&&0!=+W?+W/h:void 0;if(_){S=e.suggestedPresentationDelay,T=t,k=null!=I?I:T;var j=x;void 0===j&&(j=Date.now()/1e3-T);var q=Z;void 0===q&&(q=j),A={isLinear:!0,maximumSafePosition:q,livePosition:j,time:performance.now()},M=null!=v?v:null}else{k=null!=I?I:0,A={isLinear:!1,maximumSafePosition:void 0!==Z?Z:void 0!==H?k+H:1/0,livePosition:void 0,time:performance.now()}}var Y=_?0:k,X=_?void 0:A.maximumSafePosition,Q={availabilityStartTime:void 0===T?0:T,clockOffset:i,isLive:_,isDynamic:_,isLastPeriodKnown:!0,timeBounds:{minimumSafePosition:k,timeshiftDepth:M,maximumTimeData:A},periods:[{adaptations:R,duration:void 0!==X?X-Y:H,end:X,id:"gen-smooth-period-0",start:Y}],suggestedPresentationDelay:S,transportType:"smooth",uris:null==r?[]:[r]};return C(Q),Q}},F=B,V=n(4597),z=n(8806),K=n(4460),G=n(8791),W=n(4644),H=n(2297);function j(e,t,n,r,i){var a,o,u,d=[];if(i){var c=(0,l.XA)(e);null!==c?(u=function(e){var t=(0,H.nR)(e,3565190898,3392751253,2387879627,2655430559);if(void 0===t)return[];for(var n=[],r=t[0],i=t[4],a=0;a0;if(n)return e;var r=new Uint8Array(e.length+4);return r.set(e.subarray(0,t+8),0),r[t+3]=1|r[t+3],r.set([0,0,0,0],t+8),r.set(e.subarray(t+8,e.length),t+12),(0,W.J6)(r)}(l,s[1]-s[0]),f=J(u,d,c,i,(0,H.nR)(a,2721664850,1520127764,2722393154,2086964724)),v=M("moof",[i,f]),p=(0,H.Qy)(v,1836019558),h=(0,H.Qy)(f,1953653094),m=(0,H.Qy)(c,1953658222);if(null===p||null===h||null===m)throw new Error("Smooth: Invalid moof, trun or traf generation");var g=p[1]-p[0]+i.length+(h[1]-h[0])+u.length+d.length+(m[1]-m[0])+8,y=n[2]-n[0],_=v.length-y,b=(0,H.Qy)(e,1835295092);if(null===b)throw new Error("Smooth: Invalid ISOBMFF given");if(!q.YM&&(0===_||_<=-8)){var S=b[1];return v.set((0,T.kh)(S),g),e.set(v,n[0]),_<=-8&&e.set(R("free",new Uint8Array(-_-8)),v.length),e}var E=b[1]+_;v.set((0,T.kh)(E),g);var k=new Uint8Array(e.length+_),w=e.subarray(0,n[0]),A=e.subarray(n[2],e.length);return k.set(w,0),k.set(v,w.length),k.set(A,w.length+v.length),k}var te=n(7839),ne=n(281);function re(e,t,n,r,i,a){var o,s,u,l=M("stbl",[n,R("stts",new Uint8Array(8)),R("stsc",new Uint8Array(8)),R("stsz",new Uint8Array(12)),R("stco",new Uint8Array(8))]),d=function(e){return R("dref",(0,T.zo)(7,[1],e))}(R("url ",new Uint8Array([0,0,0,1]))),c=M("dinf",[d]),f=M("minf",[r,c,l]),v=function(e){var t,n;switch(e){case"video":t="vide",n="VideoHandler";break;case"audio":t="soun",n="SoundHandler";break;default:t="hint",n=""}return R("hdlr",(0,T.zo)(8,(0,A.tG)(t),12,(0,A.tG)(n),1))}(t),p=function(e){return R("mdhd",(0,T.zo)(12,(0,T.kh)(e),8))}(e),h=M("mdia",[p,v,f]),m=function(e,t,n){return R("tkhd",(0,T.zo)((0,T.kh)(7),8,(0,T.kh)(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],(0,T.XT)(e),2,(0,T.XT)(t),2))}(i,a,1),g=M("trak",[m,h]),y=M("mvex",[(o=1,R("trex",(0,T.zo)(4,(0,T.kh)(o),[0,0,0,1],12)))]),_=function(e,t){return R("mvhd",(0,T.zo)(12,(0,T.kh)(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,(0,T.XT)(t+1)))}(e,1),b=function(e,t,n){return M("moov",[e,t,n])}(_,y,g),S=(s="isom",u=["isom","iso2","iso6","avc1","dash"],R("ftyp",T.zo.apply(void 0,[(0,A.tG)(s),[0,0,0,1]].concat(u.map(A.tG)))));return(0,T.zo)(S,b)}function ie(e,t,n,r,i,a,o,s){var u=o.split("00000001"),l=u[1],d=u[2];if(void 0===l||void 0===d)throw new Error("Smooth: unsupported codec private data.");var c,f,v=function(e,t,n){var r=2===n?1:4===n?3:0,i=e[1],a=e[2],o=e[3];return R("avcC",(0,T.zo)([1,i,a,o,252|r,225],(0,T.XT)(e.length),e,[1],(0,T.XT)(t.length),t))}((0,A.nr)(l),(0,A.nr)(d),a);if(void 0===s){var p=function(e,t,n,r,i,a,o){return R("avc1",(0,T.zo)(6,(0,T.XT)(1),16,(0,T.XT)(e),(0,T.XT)(t),(0,T.XT)(n),2,(0,T.XT)(r),6,[0,1,i.length],(0,A.tG)(i),31-i.length,(0,T.XT)(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,v);c=Q([p])}else{var h=M("schi",[$(1,8,s)]),m=Y("cenc",65536),g=function(e,t,n,r,i,a,o,s){return R("encv",(0,T.zo)(6,(0,T.XT)(1),16,(0,T.XT)(e),(0,T.XT)(t),(0,T.XT)(n),2,(0,T.XT)(r),6,[0,1,i.length],(0,A.tG)(i),31-i.length,(0,T.XT)(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,v,M("sinf",[X("avc1"),m,h]));c=Q([g])}return re(e,"video",c,((f=new Uint8Array(12))[3]=1,R("vmhd",f)),t,n)}var ae=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function oe(e,t,n,r,i,a,o){var s,u,l,d=function(e,t){return R("esds",(0,T.zo)(4,[3,25],(0,T.XT)(e),[0,4,17,64,21],11,[5,2],(0,A.nr)(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,l=((l=((l=(63&2)<<4)|31&ae.indexOf(s))<<4)|31&u)<<3,(0,A.ci)((0,T.XT)(l))):a),c=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return R("mp4a",(0,T.zo)(6,(0,T.XT)(e),8,(0,T.XT)(t),(0,T.XT)(n),2,(0,T.XT)(r),(0,T.XT)(i),2,a))}(1,t,n,r,i,d);return Q([e])}var a=M("schi",[$(1,8,o)]),s=Y("cenc",65536),u=M("sinf",[X("mp4a"),s,a]),l=function(e,t,n,r,i,a,o){return R("enca",(0,T.zo)(6,(0,T.XT)(e),8,(0,T.XT)(t),(0,T.XT)(n),2,(0,T.XT)(r),(0,T.XT)(i),2,a,o))}(1,t,n,r,i,d,u);return Q([l])}();return re(e,"audio",c,R("smhd",new Uint8Array(8)),0,0)}var se=/(\.isml?)(\?token=\S+)?$/,ue=/\?token=(\S+)/;function le(e,t){return(0,E.Z)(t)?e.replace(ue,"?token="+t):e.replace(ue,"")}function de(e){return"string"==typeof e.mimeType&&e.mimeType.indexOf("mp4")>=0}function ce(e,t){return null===e?null:null===t.url?e.baseUrl:(0,w.Z)(e.baseUrl,t.url)}function fe(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:(0,ne.Z)(s)}),(0,V.ZP)({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!de(t.representation)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return(0,K.Z)(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var ve=function(e){var t=e.checkMediaSegmentIntegrity,n=e.customSegmentLoader;return function(e,r,i,a,o){var s=r.segment,u=r.manifest,l=r.period,d=r.adaptation,c=r.representation;if(s.isInit){if(void 0===s.privateInfos||void 0===s.privateInfos.smoothInitSegment)throw new Error("Smooth: Invalid segment format");var f,v=s.privateInfos.smoothInitSegment,p=v.codecPrivateData,h=v.timescale,m=v.protection,g=void 0===m?{keyId:void 0,keySystems:void 0}:m;if(void 0===p)throw new Error("Smooth: no codec private data.");switch(d.type){case"video":var y=c.width,_=void 0===y?0:y,b=c.height;f=ie(h,_,void 0===b?0:b,72,72,4,p,g.keyId);break;case"audio":var S=v.channels,T=void 0===S?0:S,E=v.bitsPerSample,k=void 0===E?0:E,w=v.packetSize,A=void 0===w?0:w,I=v.samplingRate;f=oe(h,T,k,A,void 0===I?0:I,p,g.keyId);break;default:0,f=new Uint8Array(0)}return Promise.resolve({resultType:"segment-created",resultData:f})}if(null===e)return Promise.resolve({resultType:"segment-created",resultData:null});var Z={adaptation:d,manifest:u,period:l,representation:c,segment:s,transport:"smooth",timeout:i.timeout,url:e};return"function"!=typeof n?fe(e,r,o,i,a,t):new Promise((function(s,u){var l=!1,d=n(Z,{reject:function(e){var t,n,r;if(!l&&!a.isCancelled()){l=!0,a.deregister(c);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a Smooth segment through a custom segmentLoader.",s=new te.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);u(s)}},resolve:function(e){if(!l&&!a.isCancelled()){l=!0,a.deregister(c),de(r.representation)&&!0===t||s({resultType:"segment-loaded",resultData:{responseData:e.data,size:e.size,requestDuration:e.duration}});var n=e.data instanceof Uint8Array?e.data:new Uint8Array(e.data);(0,K.Z)(n,r.segment.isInit),s({resultType:"segment-loaded",resultData:{responseData:n,size:e.size,requestDuration:e.duration}})}},fallback:function(){l||a.isCancelled()||(l=!0,a.deregister(c),fe(e,r,o,i,a,t).then(s,u))},progress:function(e){l||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})}});function c(e){l||((l=!0)||"function"!=typeof d||d(),u(e))}a.register(c)}))}},pe=/\.wsx?(\?token=\S+)?/;function he(e,t,n){var r;s.Z.debug("Smooth Parser: update segments information.");for(var i=e.representations,a=0;a0&&he(o,v,a),{segmentType:"media",chunkData:h,chunkInfos:p,chunkOffset:0,chunkSize:h.length,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}},c={loadSegment:function(t,n,r,i,a){var o=n.segment,s=n.representation,u=ce(t,o);return o.isInit||null===u?Promise.resolve({resultType:"segment-created",resultData:null}):de(s)?(0,V.ZP)({url:u,responseType:"arraybuffer",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(t){if(!0!==e.checkMediaSegmentIntegrity)return{resultType:"segment-loaded",resultData:t};var r=new Uint8Array(t.responseData);return(0,K.Z)(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):(0,V.ZP)({url:u,responseType:"text",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))},parseSegment:function(e,t,n){var r,i,a,o=t.manifest,u=t.adaptation,d=t.representation,c=t.segment,f=u.language,v=de(d),p=d.mimeType,h=void 0===p?"":p,m=d.codec,g=void 0===m?"":m,y=e.data,_=e.isChunked;if(c.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(null===y)return{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]};var b,S,T,E,k=null;if(v){var w;i=(w="string"==typeof y?(0,A.tG)(y):y instanceof Uint8Array?y:new Uint8Array(y)).length;var I=void 0!==n?j(w,_,n,c,o.isLive):null;a=null==I?void 0:I.nextSegments,null===(k=null!==(r=null==I?void 0:I.chunkInfos)&&void 0!==r?r:null)?_?s.Z.warn("Smooth: Unavailable time data for current text track."):(b=c.time,S=c.end):(b=k.time,S=void 0!==k.duration?k.time+k.duration:c.end);var Z=g.toLowerCase();if("application/ttml+xml+mp4"===h||"stpp"===Z||"stpp.ttml.im1t"===Z)E="ttml";else{if("wvtt"!==Z)throw new Error("could not find a text-track parser for the type "+h);E="vtt"}var x=(0,l.Le)(w);T=null===x?"":(0,A.uR)(x)}else{var R;if(b=c.time,S=c.end,"string"!=typeof y){var M=y instanceof Uint8Array?y:new Uint8Array(y);i=M.length,R=(0,A.uR)(M)}else R=y;switch(h){case"application/x-sami":case"application/smil":E="sami";break;case"application/ttml+xml":E="ttml";break;case"text/vtt":E="vtt"}if(void 0===E){if("srt"!==g.toLowerCase())throw new Error("could not find a text-track parser for the type "+h);E="srt"}T=R}return null!==k&&Array.isArray(a)&&a.length>0&&he(u,a,c),{segmentType:"media",chunkData:{type:E,data:T,start:b,end:S,language:f},chunkSize:i,chunkInfos:k,chunkOffset:null!=b?b:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}};return{manifest:{resolveManifestUrl:function(e,t){if(void 0===e)return Promise.resolve(void 0);var n;pe.test(e)?((0,z.Z)("Giving WSX URL to loadVideo is deprecated. You should only give Manifest URLs."),n=(0,V.ZP)({url:le(e,""),responseType:"document",cancelSignal:t}).then((function(e){var t=e.responseData.getElementsByTagName("media")[0].getAttribute("src");if(null===t||0===t.length)throw new Error("Invalid ISML");return t}))):n=Promise.resolve(e);var r=function(e){var t=ue.exec(e);if(null!==t){var n=t[1];if(void 0!==n)return n}return""}(e);return n.then((function(e){return le(function(e){return se.test(e)?((0,z.Z)("Giving a isml URL to loadVideo is deprecated. Please give the Manifest URL directly"),e.replace(se,"$1/manifest$2")):e}(e),r)}))},loadManifest:(0,G.Z)(i,"text"),parseManifest:function(n,r){var i,a=null!==(i=n.url)&&void 0!==i?i:r.originalUrl,o=n.receivedTime,s=n.responseData,l="string"==typeof s?(new DOMParser).parseFromString(s,"text/xml"):s,d=t(l,a,o);return{manifest:new u.ZP(d,{representationFilter:e.representationFilter,supplementaryImageTracks:e.supplementaryImageTracks,supplementaryTextTracks:e.supplementaryTextTracks}),url:a}}},audio:d,video:d,text:c,image:{loadSegment:function(e,t,n,i,o){return(0,r.Z)(a().mark((function r(){var s,u,l;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(s=t.segment,u=ce(e,s),!s.isInit&&null!==u){r.next=4;break}return r.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return r.next=6,(0,V.ZP)({url:u,responseType:"arraybuffer",timeout:n.timeout,onProgress:o.onProgress,cancelSignal:i});case 6:return l=r.sent,r.abrupt("return",{resultType:"segment-loaded",resultData:l});case 8:case"end":return r.stop()}}),r)})))()},parseSegment:function(e,t,n){var r=e.data,i=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(i)throw new Error("Image data should not be downloaded in chunks");return null===r||null===o.Z.imageParser?{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}:{segmentType:"media",chunkData:{data:o.Z.imageParser(new Uint8Array(r)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkSize:void 0,chunkOffset:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}}}}},281:function(e,t,n){"use strict";function r(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}n.d(t,{Z:function(){return r}})},4460:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(5389),i=n(8766);function a(e,t){if(t){if((0,i.Z)(e,1718909296)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `ftyp` box");if((0,i.Z)(e,1836019574)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moov` box")}else{if((0,i.Z)(e,1836019558)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moof` box");if((0,i.Z)(e,1835295092)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `mdat` box")}}},8766:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(6968);function i(e,t){for(var n=e.length,i=0;i+8<=n;){var a=(0,r.pX)(e,i);if(0===a)a=n-i;else if(1===a){if(i+16>n)return-1;a=(0,r.pV)(e,i+8)}if(isNaN(a)||a<=0)return-1;if((0,r.pX)(e,i+4)===t)return i+a<=n?i:-1;i+=a}return-1}},8791:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7904),i=n(4597),a=n(7839);function o(e,t){var n=e.customManifestLoader,o=function(e){return function(t,n,a){if(void 0===t)throw new Error("Cannot perform HTTP(s) request. URL not known");switch(e){case"arraybuffer":return(0,i.ZP)({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:a});case"text":return(0,i.ZP)({url:t,responseType:"text",timeout:n.timeout,cancelSignal:a});case"document":return(0,i.ZP)({url:t,responseType:"document",timeout:n.timeout,cancelSignal:a});default:(0,r.Z)(e)}}}(t);return"function"!=typeof n?o:function(e,t){return function(n,r,i){return new Promise((function(o,s){var u=Date.now()-performance.now(),l=!1,d=e(n,{reject:function(e){var t,n,r;if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var o=e,u=null!==(t=null==o?void 0:o.message)&&void 0!==t?t:"Unknown error when fetching the Manifest through a custom manifestLoader.",d=new a.Z(u,null!==(n=null==o?void 0:o.canRetry)&&void 0!==n&&n,null!==(r=null==o?void 0:o.isOfflineError)&&void 0!==r&&r,null==o?void 0:o.xhr);s(d)}},resolve:function(e){if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var t=void 0!==e.receivingTime?e.receivingTime-u:void 0,n=void 0!==e.sendingTime?e.sendingTime-u:void 0;o({responseData:e.data,size:e.size,requestDuration:e.duration,url:e.url,receivedTime:t,sendingTime:n})}},fallback:function(){l||i.isCancelled()||(l=!0,i.deregister(c),t(n,r,i).then(o,s))}},{timeout:r.timeout});function c(e){l||(l=!0,"function"==typeof d&&d(),s(e))}i.register(c)}))}}(n,o)}},4791:function(e,t,n){"use strict";function r(e,t){if(e.length!==t.length)return!1;if(e===t)return!0;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}n.d(t,{Z:function(){return r}})},3274:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.find)return e.find(t,n);for(var r=e.length>>>0,i=0;i>>0,i=0;i>>0;if(0===r)return!1;for(var i,a,o=0|n,s=o>=0?Math.min(o,r-1):Math.max(r+o,0);s=a.length)throw new Error("Unable to parse base64 string.");var t=a[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function s(e){var t,n="",r=e.length;for(t=2;t>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2|e[t]>>6],n+=i[63&e[t]];return t===r+1&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4],n+="=="),t===r&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2],n+="="),n}function u(e){var t=e.length%4,n=e;0!==t&&(r.Z.warn("base64ToBytes: base64 given miss padding"),n+=3===t?"=":2===t?"==":"===");var i=n.indexOf("=");if(-1!==i&&i>16,l[c+1]=a>>8&255,l[c+2]=255&a;return l.subarray(0,l.length-s)}},6968:function(e,t,n){"use strict";function r(){for(var e,t=arguments.length,n=-1,r=0;++n0&&(i.set(e,a),a+=e.length);return i}function i(e,t){return(e[t+0]<<8)+(e[t+1]<<0)}function a(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function o(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function s(e,t){return 4294967296*(16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3])+16777216*e[t+4]+65536*e[t+5]+256*e[t+6]+e[t+7]}function u(e){return new Uint8Array([e>>>8&255,255&e])}function l(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function d(e){var t=e%4294967296,n=(e-t)/4294967296;return new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function c(e,t){return(e[t+0]<<0)+(e[t+1]<<8)}function f(e,t){return e[t+0]+256*e[t+1]+65536*e[t+2]+16777216*e[t+3]}function v(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}n.d(t,{O_:function(){return v},QI:function(){return a},XT:function(){return u},dN:function(){return f},el:function(){return d},kh:function(){return l},pV:function(){return s},pX:function(){return o},qb:function(){return c},zK:function(){return i},zo:function(){return r}})},7864:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(7733);function i(e,t){return(0,r.Z)(t,(function(t){var n=setTimeout((function(){return t()}),e);return function(){return clearTimeout(n)}}))}},7733:function(e,t,n){"use strict";function r(e,t){var n;return new Promise((function(r,i){if(null!==e.cancellationError)return i(e.cancellationError);var a=!1;function o(e){void 0!==n&&n(),i(e)}n=t((function(t){e.deregister(o),a=!0,r(t)}),(function(t){e.deregister(o),a=!0,i(t)})),a||e.register(o)}))}n.d(t,{Z:function(){return r}})},1959:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946),a=function(){function e(){this._listeners={}}var t=e.prototype;return t.addEventListener=function(e,t,n){var r=this,i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],void 0!==n&&n.register((function(){r.removeEventListener(e,t)}))},t.removeEventListener=function(e,t){if((0,i.Z)(e))this._listeners={};else{var n=this._listeners[e];if(Array.isArray(n))if((0,i.Z)(t))delete this._listeners[e];else{var r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&delete this._listeners[e]}}},t.trigger=function(e,t){var n=this._listeners[e];Array.isArray(n)&&n.slice().forEach((function(e){try{e(t)}catch(e){r.Z.error("EventEmitter: listener error",e instanceof Error?e:null)}}))},e}()},9592:function(e,t,n){"use strict";function r(e,t){return"function"==typeof Array.prototype.flatMap?e.flatMap(t):e.reduce((function(e,n){var r=t(n);return Array.isArray(r)?(e.push.apply(e,r),e):(e.push(r),e)}),[])}n.d(t,{Z:function(){return r}})},2572:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=.3;function i(e){return e*((2*Math.random()-1)*r+1)}},908:function(e,t,n){"use strict";function r(){var e="",t=-1;return function(){return++t>=Number.MAX_SAFE_INTEGER&&(e+="0",t=0),e+String(t)}}n.d(t,{Z:function(){return r}})},6923:function(e,t,n){"use strict";function r(e){return"string"==typeof e&&e.length>0}n.d(t,{Z:function(){return r}})},1946:function(e,t,n){"use strict";function r(e){return null==e}n.d(t,{Z:function(){return r}})},7829:function(e,t,n){"use strict";var r=n(5553);t.ZP=r.ZP},5553:function(e,t,n){"use strict";n.d(t,{ZP:function(){return d},iH:function(){return l},Y1:function(){return u}});var r=n(6923),i=n(1946),a={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},o={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"};function s(e){if((0,i.Z)(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=a[e];break;case 3:t=o[e]}return t}((""+e).toLowerCase().split("-")[0]);return(0,r.Z)(t)?t:e}function u(e){if(!(0,i.Z)(e)){var t,n=!1;return"string"==typeof e?t=e:(t=e.language,!0===e.closedCaption&&(n=!0)),{language:t,closedCaption:n,normalized:s(t)}}return e}function l(e){if((0,i.Z)(e))return e;if("string"==typeof e)return{language:e,audioDescription:!1,normalized:s(e)};var t={language:e.language,audioDescription:!0===e.audioDescription,normalized:s(s(e.language))};return!0===e.isDub&&(t.isDub=!0),t}var d=s},8894:function(e,t,n){"use strict";function r(){}n.d(t,{Z:function(){return r}})},8026:function(e,t){"use strict";t.Z="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n++){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}},1679:function(e,t,n){"use strict";t.Z="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))}},2829:function(e,t,n){"use strict";n.d(t,{A1:function(){return s},DD:function(){return m},F_:function(){return p},JN:function(){return c},L7:function(){return g},Ti:function(){return u},XS:function(){return v},at:function(){return h},kR:function(){return y},rx:function(){return f},tn:function(){return b},uH:function(){return S}});var r=1/60;function i(e,t){return Math.abs(e-t)=0;n--){var r=e.start(n);if(t>=r){var i=e.end(n);if(t=o?r.push({start:a,end:o}):n={start:a,end:o}}return{outerRanges:r,innerRange:n}}function h(e,t){var n=f(e,t);return null!==n?n.end-n.start:0}function m(e,t){var n=f(e,t);return null!==n?t-n.start:0}function g(e,t){var n=f(e,t);return null!==n?n.end-t:1/0}function y(e,t){if(t.start===t.end)return e;for(var n=t,r=0;r0)for(var o=0;o0)for(var s=0;sl&&n.push({start:l,end:a[d].start}),l=a[d].end;l=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&n._listeners.splice(r,1)}},i={trigger:e,complete:r,hasBeenCleared:!1};this._listeners.push(i),!0===(null==t?void 0:t.emitCurrentValue)&&e(this._value,r),this._isFinished||i.hasBeenCleared?r():void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.register(r)},t.waitUntilDefined=function(e,t){var n=this;this.onUpdate((function(t,r){void 0!==t&&(r(),e(n._value))}),{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:!0})},t._onFinished=function(e,t){var n=this;if(t.isCancelled())return i.Z;var a=function(){var e=(0,r.Z)(n._onFinishCbs,(function(e){return e.trigger===o}));e>=0&&(n._onFinishCbs[e].hasBeenCleared=!0,n._onFinishCbs.splice(e,1))},o=function(){a(),e()},s=t.register(a);return this._onFinishCbs.push({trigger:o,hasBeenCleared:!1}),s},t.finish=function(){void 0!==this._deregisterCancellation&&this._deregisterCancellation(),this._isFinished=!0;for(var e,t=a(this._listeners.slice());!(e=t()).done;){var n=e.value;try{n.hasBeenCleared||(n.complete(),n.hasBeenCleared=!0)}catch(e){}}if(this._listeners.length=0,this._onFinishCbs.length>0){for(var r,i=a(this._onFinishCbs.slice());!(r=i()).done;){var o=r.value;try{o.hasBeenCleared||(o.trigger(),o.hasBeenCleared=!0)}catch(e){}}this._onFinishCbs.length=0}},e}();function u(e,t,n){var r=new s(t(e.getValue()),n);return e.onUpdate((function(e){r.setValue(t(e))}),{clearSignal:n}),e._onFinished((function(){r.finish()}),n),r}t.Z=s},4597:function(e,t,n){"use strict";n.d(t,{ZP:function(){return o}});var r=n(9105),i=n(6923),a=n(1946);var o=function(e){var t={url:e.url,headers:e.headers,responseType:(0,a.Z)(e.responseType)?"json":e.responseType,timeout:e.timeout};return new Promise((function(n,o){var s,u=e.onProgress,l=e.cancelSignal,d=t.url,c=t.headers,f=t.responseType,v=t.timeout,p=new XMLHttpRequest;if(p.open("GET",d,!0),void 0!==v&&(p.timeout=v,s=window.setTimeout((function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))}),v+3e3)),p.responseType=f,"document"===p.responseType&&p.overrideMimeType("text/xml"),!(0,a.Z)(c)){var h=c;for(var m in h)h.hasOwnProperty(m)&&p.setRequestHeader(m,h[m])}var g=performance.now(),y=null;function _(){void 0!==s&&clearTimeout(s),null!==y&&y()}void 0!==l&&(y=l.register((function(e){_(),(0,a.Z)(p)||4===p.readyState||p.abort(),o(e)})),l.isCancelled())||(p.onerror=function(){_(),o(new r.Z(d,p.status,"ERROR_EVENT",p))},p.ontimeout=function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))},void 0!==u&&(p.onprogress=function(e){var t=performance.now();u({url:d,duration:t-g,sendingTime:g,currentTime:t,size:e.loaded,totalSize:e.total})}),p.onload=function(e){if(4===p.readyState)if(_(),p.status>=200&&p.status<300){var t,s=performance.now(),u=p.response instanceof ArrayBuffer?p.response.byteLength:e.total,l=p.status,c=p.responseType,f=(0,i.Z)(p.responseURL)?p.responseURL:d;if(t="json"===c?"object"==typeof p.response?p.response:function(e){try{return JSON.parse(e)}catch(e){return null}}(p.responseText):p.response,(0,a.Z)(t))return void o(new r.Z(d,p.status,"PARSE_ERROR",p));n({status:l,url:f,responseType:c,sendingTime:g,receivedTime:s,requestDuration:s-g,size:u,responseData:t})}else o(new r.Z(d,p.status,"ERROR_HTTP_CODE",p))},p.send())}))}},9829:function(e,t,n){"use strict";n.d(t,{$:function(){return o},Z:function(){return a}});var r=/^(?:[a-z]+:)?\/\//i,i=/\/\.{1,2}\//;function a(){var e=arguments.length;if(0===e)return"";for(var t="",n=0;n=0&&t===n+1)return e.length}var i=e.indexOf("?");return i>=0&&i=this._array.length)throw new Error("Invalid index.");return this._array[e]},t.toArray=function(){return this._array.slice()},t.findFirst=function(e){return(0,r.Z)(this._array,e)},t.has=function(e){return(0,i.Z)(this._array,e)},t.removeElement=function(e){var t=this._array.indexOf(e);if(t>=0)return this._array.splice(t,1),t},t.head=function(){return this._array[0]},t.last=function(){return this._array[this._array.length-1]},t.shift=function(){return this._array.shift()},t.pop=function(){return this._array.pop()},e}()},9252:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof String.prototype.startsWith)return e.startsWith(t,n);var r="number"==typeof n?Math.max(n,0):0;return e.substring(r,r+t.length)===t}n.d(t,{Z:function(){return r}})},3635:function(e,t,n){"use strict";n.d(t,{DM:function(){return h},TZ:function(){return s},ci:function(){return v},nr:function(){return f},tG:function(){return l},uR:function(){return c},wO:function(){return p},wV:function(){return u}});var r=n(3887),i=n(811),a="object"==typeof window&&"function"==typeof window.TextDecoder,o="object"==typeof window&&"function"==typeof window.TextEncoder;function s(e){for(var t=new ArrayBuffer(2*e.length),n=new Uint8Array(t),r=0;r>8&255}return n}function u(e){if(a)try{return new TextDecoder("utf-16le").decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-16LE, fallbacking to another implementation",t)}for(var n="",i=0;i=t?n:new Array(t-n.length+1).join("0")+n}function c(e){if(a)try{return(new TextDecoder).decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-8, fallbacking to another implementation",t)}var n=e;239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));var i,o=function(e){for(var t="",n=0;n=256?"%u"+d(l,4):"%"+d(l,2)}}return decodeURIComponent(i)}function f(e){for(var t=e.length,n=new Uint8Array(t/2),r=0,i=0;r>>4).toString(16),n+=(15&e[r]).toString(16),t.length>0&&r0;)try{var n=t._listeners.pop();null==n||n(e)}catch(e){o.Z.error("Error while calling clean up listener",e instanceof Error?e.toString():"Unknown error")}}))}var t=e.prototype;return t.isCancelled=function(){return this._isCancelled},t.register=function(e){var t=this;return this._isCancelled?((0,s.Z)(null!==this.cancellationError),e(this.cancellationError),u.Z):(this._listeners.push(e),function(){return t.deregister(e)})},t.deregister=function(e){for(var t=this._listeners.length-1;t>=0;t--)this._listeners[t]===e&&this._listeners.splice(t,1)},e}(),c=function(e){function t(){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(n),t.prototype),n.name="CancellationError",n.message="This task was cancelled.",n}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},8806:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7714),i=[];function a(e){(0,r.Z)(i,e)||(console.warn(e),i.push(e))}},7473:function(e){"use strict";var t=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},n=function(e){var n,r,i=document.createTextNode(""),a=0;return new e((function(){var e;if(n)r&&(n=r.concat(n));else{if(!r)return;n=r}if(r=n,n=null,"function"==typeof r)return e=r,r=null,void e();for(i.data=a=++a%2;r;)e=r.shift(),r.length||(r=null),e()})).observe(i,{characterData:!0}),function(e){t(e),n?"function"==typeof n?n=[n,e]:n.push(e):(n=e,i.data=a=++a%2)}};e.exports=function(){if("object"==typeof process&&process&&"function"==typeof process.nextTick)return process.nextTick;if("function"==typeof queueMicrotask)return function(e){queueMicrotask(t(e))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return n(MutationObserver);if("function"==typeof WebKitMutationObserver)return n(WebKitMutationObserver)}return"function"==typeof setImmediate?function(e){setImmediate(t(e))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(e){setTimeout(t(e),0)}:null}()},7061:function(e,t,n){var r=n(8698).default;function i(){"use strict";e.exports=i=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var t,n={},a=Object.prototype,o=a.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",d=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(t){f=function(e,t,n){return e[t]=n}}function v(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),o=new P(r||[]);return s(a,"_invoke",{value:x(e,n,o)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=v;var h="suspendedStart",m="suspendedYield",g="executing",y="completed",_={};function b(){}function S(){}function T(){}var E={};f(E,l,(function(){return this}));var k=Object.getPrototypeOf,w=k&&k(k(D([])));w&&w!==a&&o.call(w,l)&&(E=w);var A=T.prototype=b.prototype=Object.create(E);function I(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function Z(e,t){function n(i,a,s,u){var l=p(e[i],e,a);if("throw"!==l.type){var d=l.arg,c=d.value;return c&&"object"==r(c)&&o.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(c).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;s(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function x(e,n,r){var i=h;return function(a,o){if(i===g)throw new Error("Generator is already running");if(i===y){if("throw"===a)throw o;return{value:t,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var u=R(s,r);if(u){if(u===_)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=g;var l=p(e,n,r);if("normal"===l.type){if(i=r.done?y:m,l.arg===_)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=y,r.method="throw",r.arg=l.arg)}}}function R(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,R(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),_;var a=p(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,_;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,_):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,_)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function D(e){if(e||""===e){var n=e[l];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:D(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),_}},n}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(n){return e.exports=t="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},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,n){var r=n(7061)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},7326:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,{Z:function(){return r}})},5861:function(e,t,n){"use strict";function r(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,u,"next",e)}function u(e){r(o,i,a,s,u,"throw",e)}s(void 0)}))}}n.d(t,{Z:function(){return i}})},1656:function(e,t,n){"use strict";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){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}function a(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(i="internal-seeking",r=t._internalSeeksIncoming.shift());var a=null!=e?e:t._generateInitialObservation(),o=G(t._mediaElement,i,t._withMediaSource),s=null;o.seeking&&("number"==typeof r?s=r:null!==a.pendingInternalSeek&&"seeking"!==n&&(s=a.pendingInternalSeek));var u=function(e,t,n){var r,i,a=n.withMediaSource,o=n.lowLatencyMode,s=c.Z.getCurrent().REBUFFERING_GAP,u=t.event,l=t.position,d=t.bufferGap,f=t.currentRange,v=t.duration,p=t.paused,h=t.readyState,m=t.ended,g=e.rebuffering,y=e.event,_=e.position,b=function(e,t,n,r,i){var a=c.Z.getCurrent().REBUFFERING_GAP,o=i?"LOW_LATENCY":"DEFAULT";if(void 0===t)return n&&Math.abs(r-e)<=a[o];return null!==t&&r-t.end<=a[o]}(l,f,m,v,o),S=h>=1&&"loadedmetadata"!==u&&null===g&&!(b||m),T=null,E=o?s.LOW_LATENCY:s.DEFAULT;if(a){if(S)d===1/0?(r=!0,T=l):void 0===d?h<3&&(r=!0,T=void 0):d<=E&&(r=!0,T=l+d);else if(null!==g){var k=K(g,o);!0!==r&&null!==g&&h>1&&(b||m||void 0!==d&&isFinite(d)&&d>k)||void 0===d&&h>=3?i=!0:void 0===d?T=void 0:d===1/0?T=l:d<=k&&(T=l+d)}}else S&&(!p&&"timeupdate"===u&&"timeupdate"===y&&l===_||"seeking"===u&&(d===1/0||void 0===d&&h<3))?r=!0:null!==g&&("seeking"!==u&&l!==_||"canplay"===u||void 0===d&&h>=3||void 0!==d&&d<1/0&&(d>K(g,o)||b||m))&&(i=!0);if(!0===i)return null;var w;if(!0===r||null!==g)return w="seeking"===u||null!==g&&"seeking"===g.reason||t.seeking?"seeking":1===h?"not-ready":"buffering",null!==g&&g.reason===w?{reason:g.reason,timestamp:g.timestamp,position:T}:{reason:w,timestamp:performance.now(),position:T};return null}(a,o,{lowLatencyMode:t._lowLatencyMode,withMediaSource:t._withMediaSource}),d=function(e,t){var n=c.Z.getCurrent().MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;if(e.freezing)return t.ended||t.paused||0===t.readyState||0===t.playbackRate||e.position!==t.position?null:e.freezing;return"timeupdate"===t.event&&void 0!==t.bufferGap&&t.bufferGap>n&&!t.ended&&!t.paused&&t.readyState>=1&&0!==t.playbackRate&&t.position===e.position?{timestamp:performance.now()}:null}(a,o),f=(0,E.Z)({},{rebuffering:u,freezing:d,pendingInternalSeek:s},o);return l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current media element state tick","event",f.event,"position",f.position,"seeking",f.seeking,"internalSeek",f.pendingInternalSeek,"rebuffering",null!==f.rebuffering,"freezing",null!==f.freezing,"ended",f.ended,"paused",f.paused,"playbackRate",f.playbackRate,"readyState",f.readyState),f},s=new w.Z(o("init"),this._canceller.signal),u=function(t){var n=o(t);l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current playback timeline:\n"+function(e,t){for(var n="",r="",i=0;it){var d=n.length-Math.floor(l.length/2);r=" ".repeat(d)+"^"+t}if(i=3?(r=void 0,i=void 0):i=null!==(r=(0,k.rx)(a,o))?r.end-o:1/0,{bufferGap:i,buffered:a,currentRange:r,position:o,duration:s,ended:u,paused:l,playbackRate:d,readyState:c,seeking:f,event:t}}function W(e,t,n){var r=t(e.getReference(),n);return{getCurrentTime:function(){return e.getCurrentTime()},getReadyState:function(){return e.getReadyState()},getPlaybackRate:function(){return e.getPlaybackRate()},getIsPaused:function(){return e.getIsPaused()},getReference:function(){return r},listen:function(e,t){var i;n.isCancelled()||!0===(null===(i=null==t?void 0:t.clearSignal)||void 0===i?void 0:i.isCancelled())||r.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},deriveReadOnlyObserver:function(e){return W(this,e,n)}}}var H=n(3274),j=n(7829),q=n(3146);function Y(e){return e.map((function(e){return null===e?e:{normalized:void 0===e.language?void 0:(0,j.ZP)(e.language),audioDescription:e.audioDescription,codec:e.codec}}))}function X(e){return e.map((function(e){return null===e?e:{normalized:(0,j.ZP)(e.language),forced:e.forced,closedCaption:e.closedCaption}}))}var Q=function(){function e(e){this._periods=new q.Z((function(e,t){return e.period.start-t.period.start})),this._audioChoiceMemory=new WeakMap,this._textChoiceMemory=new WeakMap,this._videoChoiceMemory=new WeakMap,this._preferredAudioTracks=[],this._preferredTextTracks=[],this._preferredVideoTracks=[],this.trickModeTrackEnabled=e.preferTrickModeTracks}var t=e.prototype;return t.setPreferredAudioTracks=function(e,t){this._preferredAudioTracks=e,t&&this._applyAudioPreferences()},t.setPreferredTextTracks=function(e,t){this._preferredTextTracks=e,t&&this._applyTextPreferences()},t.setPreferredVideoTracks=function(e,t){this._preferredVideoTracks=e,t&&this._applyVideoPreferences()},t.addPeriod=function(e,t,n){var r=ie(this._periods,t),i=t.getSupportedAdaptations(e);if(void 0!==r){if(void 0!==r[e])return void l.Z.warn("TrackChoiceManager: "+e+" already added for period",t.start);r[e]={adaptations:i,adaptationRef:n}}else{var a;this._periods.add(((a={period:t})[e]={adaptations:i,adaptationRef:n},a))}},t.removePeriod=function(e,t){var n=function(e,t){for(var n=0;n0;)this._periods.pop()},t.update=function(){this._resetChosenAudioTracks(),this._resetChosenTextTracks(),this._resetChosenVideoTracks()},t.setInitialAudioTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.audio:null;if((0,h.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("audio"),i=this._audioChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,_.Z)(r,i))n.adaptationRef.setValue(i);else{var a=J(r,Y(this._preferredAudioTracks));this._audioChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialTextTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.text:null;if((0,h.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("text"),i=this._textChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,_.Z)(r,i))n.adaptationRef.setValue(i);else{var a=te(r,X(this._preferredTextTracks),this._audioChoiceMemory.get(e));this._textChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialVideoTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.video:null;if((0,h.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r,i=e.getSupportedAdaptations("video"),a=this._videoChoiceMemory.get(e);if(null===a)r=null;else if(void 0!==a&&(0,_.Z)(i,a.baseAdaptation))r=a.baseAdaptation;else{r=re(i,this._preferredVideoTracks)}if(null===r)return this._videoChoiceMemory.set(e,null),void n.adaptationRef.setValue(null);var o=ae(r,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:r,adaptation:o}),n.adaptationRef.setValue(o)},t.setAudioTrackByID=function(e,t){var n=ie(this._periods,e),r=void 0!==n?n.audio:null;if((0,h.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,H.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Audio Track not found.");this._audioChoiceMemory.get(e)!==i&&(this._audioChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setTextTrackByID=function(e,t){var n=ie(this._periods,e),r=void 0!==n?n.text:null;if((0,h.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,H.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Text Track not found.");this._textChoiceMemory.get(e)!==i&&(this._textChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setVideoTrackByID=function(e,t){var n=ie(this._periods,e),r=void 0!==n?n.video:null;if((0,h.Z)(r))throw new Error("LanguageManager: Given Period not found.");var i=(0,H.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Video Track not found.");var a=ae(i,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:i,adaptation:a}),r.adaptationRef.setValue(a)},t.disableTextTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.text:null;if((0,h.Z)(n))throw new Error("TrackChoiceManager: Given Period not found.");null!==this._textChoiceMemory.get(e)&&(this._textChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrack=function(e){var t=ie(this._periods,e),n=null==t?void 0:t.video;if(void 0===n)throw new Error("TrackManager: Given Period not found.");null!==this._videoChoiceMemory.get(e)&&(this._videoChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!1,this._resetChosenVideoTracks()},t.enableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!0,this._resetChosenVideoTracks()},t.isTrickModeEnabled=function(){return this.trickModeTrackEnabled},t.getChosenAudioTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.audio:null;if((0,h.Z)(n))return null;var r=this._audioChoiceMemory.get(e);return(0,h.Z)(r)?null:r.toAudioTrack()},t.getChosenTextTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.text:null;if((0,h.Z)(n))return null;var r=this._textChoiceMemory.get(e);return(0,h.Z)(r)?null:r.toTextTrack()},t.getChosenVideoTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.video:null;if((0,h.Z)(n))return null;var r=this._videoChoiceMemory.get(e);return(0,h.Z)(r)?null:r.adaptation.toVideoTrack()},t.getAvailableAudioTracks=function(e){var t=ie(this._periods,e),n=void 0!==t?t.audio:null;if((0,h.Z)(n))return[];var r=this._audioChoiceMemory.get(e),i=(0,h.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,E.Z)(e.toAudioTrack(),{active:t})}))},t.getAvailableTextTracks=function(e){var t=ie(this._periods,e),n=void 0!==t?t.text:null;if((0,h.Z)(n))return[];var r=this._textChoiceMemory.get(e),i=(0,h.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,E.Z)(e.toTextTrack(),{active:t})}))},t.getAvailableVideoTracks=function(e){var t,n=ie(this._periods,e),r=void 0!==n?n.video:null;if((0,h.Z)(r))return[];var i=this._videoChoiceMemory.get(e),a=void 0===i?void 0:null!==(t=null==i?void 0:i.adaptation.id)&&void 0!==t?t:void 0;return r.adaptations.map((function(e){var t=null!==a&&a===e.id,n=e.toVideoTrack(),r=void 0!==n.trickModeTracks?n.trickModeTracks.map((function(e){var t=null!==a&&a===e.id;return(0,E.Z)(e,{active:t})})):[],i=(0,E.Z)(n,{active:t});return void 0!==r&&(i.trickModeTracks=r),i}))},t._applyAudioPreferences=function(){this._audioChoiceMemory=new WeakMap,this._resetChosenAudioTracks()},t._applyTextPreferences=function(){this._textChoiceMemory=new WeakMap,this._resetChosenTextTracks()},t._applyVideoPreferences=function(){this._videoChoiceMemory=new WeakMap,this._resetChosenVideoTracks()},t._resetChosenAudioTracks=function(){var e=this,t=Y(this._preferredAudioTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,h.Z)(i.audio))n(r+1);else{var a=i.period,o=i.audio,s=a.getSupportedAdaptations("audio"),u=e._audioChoiceMemory.get(a);if(null===u||void 0!==u&&(0,_.Z)(s,u))n(r+1);else{var l=J(s,t);e._audioChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenTextTracks=function(){var e=this,t=X(this._preferredTextTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,h.Z)(i.text))n(r+1);else{var a=i.period,o=i.text,s=a.getSupportedAdaptations("text"),u=e._textChoiceMemory.get(a);if(null===u||void 0!==u&&(0,_.Z)(s,u))n(r+1);else{var l=te(s,t,e._audioChoiceMemory.get(a));e._textChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenVideoTracks=function(){var e=this,t=this._preferredVideoTracks;!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,h.Z)(i.video))n(r+1);else{var a=i.period,o=i.video,s=a.getSupportedAdaptations("video"),u=e._videoChoiceMemory.get(a);if(null!==u){if(void 0!==u&&(0,_.Z)(s,u.baseAdaptation)){var l=ae(u.baseAdaptation,e.trickModeTrackEnabled);return l.id===u.adaptation.id?void n(r+1):(e._videoChoiceMemory.set(a,{baseAdaptation:u.baseAdaptation,adaptation:l}),o.adaptationRef.setValue(l),n(0))}var d=re(s,t);if(null===d)return e._videoChoiceMemory.set(a,null),o.adaptationRef.setValue(null),n(0);var c=ae(d,e.trickModeTrackEnabled);return e._videoChoiceMemory.set(a,{baseAdaptation:d,adaptation:c}),o.adaptationRef.setValue(c),n(0)}n(r+1)}}}(0)},e}();function $(e){return function(t){var n;if(void 0!==e.normalized&&(null!==(n=t.normalizedLanguage)&&void 0!==n?n:"")!==e.normalized)return!1;if(void 0!==e.audioDescription)if(e.audioDescription){if(!0!==t.isAudioDescription)return!1}else if(!0===t.isAudioDescription)return!1;if(void 0===e.codec)return!0;var r=e.codec.test,i=function(e){return void 0!==e.codec&&r.test(e.codec)};return e.codec.all?t.representations.every(i):t.representations.some(i)}}function J(e,t){if(0===e.length)return null;for(var n=0;n0){if(null!=n){var l=(0,H.Z)(u,(function(e){return e.normalizedLanguage===n.normalizedLanguage}));if(void 0!==l)return l}return null!==(r=(0,H.Z)(u,(function(e){return void 0===e.normalizedLanguage})))&&void 0!==r?r:null}return null}function ne(e){return function(t){if(void 0!==e.signInterpreted&&e.signInterpreted!==t.isSignInterpreted)return!1;if(void 0===e.codec)return!0;var n=e.codec.test,r=function(e){return void 0!==e.codec&&n.test(e.codec)};return e.codec.all?t.representations.every(r):t.representations.some(r)}}function re(e,t){if(0===e.length)return null;for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ny)throw new Error('Invalid maxVideoBitrate parameter. Its value, "'+y+'", is inferior to the set minVideoBitrate, "'+m+'"')}if((0,h.Z)(e.maxAudioBitrate))g=E.audio;else{if(g=Number(e.maxAudioBitrate),isNaN(g))throw new Error("Invalid maxAudioBitrate parameter. Should be a number.");if(p>g)throw new Error('Invalid maxAudioBitrate parameter. Its value, "'+g+'", is inferior to the set minAudioBitrate, "'+p+'"')}return{maxBufferAhead:t,maxBufferBehind:n,limitVideoWidth:C,videoElement:d,wantedBufferAhead:r,maxVideoBufferSize:i,throttleWhenHidden:a,throttleVideoBitrateWhenHidden:o,preferredAudioTracks:s,preferredTextTracks:u,preferredVideoTracks:l,initialAudioBitrate:v,initialVideoBitrate:f,minAudioBitrate:p,minVideoBitrate:m,maxAudioBitrate:g,maxVideoBitrate:y,stopAtEnd:(0,h.Z)(e.stopAtEnd)?Z:!!e.stopAtEnd}}(e),o=a.initialAudioBitrate,s=a.initialVideoBitrate,u=a.limitVideoWidth,d=a.minAudioBitrate,f=a.minVideoBitrate,v=a.maxAudioBitrate,p=a.maxBufferAhead,m=a.maxBufferBehind,g=a.maxVideoBitrate,y=a.preferredAudioTracks,_=a.preferredTextTracks,b=a.preferredVideoTracks,S=a.throttleWhenHidden,T=a.throttleVideoBitrateWhenHidden,E=a.videoElement,k=a.wantedBufferAhead,Z=a.maxVideoBufferSize,x=a.stopAtEnd,R=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;E.preload="auto",t.version="3.33.1",t.log=l.Z,t.state="STOPPED",t.videoElement=E;var M=new A.ZP;t._destroyCanceller=M,t._priv_pictureInPictureRef=fe(E,M.signal),he(E,(function(){t.trigger("fullscreenChange",t.isFullscreen())}),M.signal);for(var C=[],P=0;P<(null===(r=E.textTracks)||void 0===r?void 0:r.length);P++){var D=null===(i=E.textTracks)||void 0===i?void 0:i[P];(0,h.Z)(D)||C.push(D)}var N=function(e){for(var n=e.target,r=[],i=0;i0?e.textTracks[0]:null},i.getPlayerState=function(){return this.state},i.isContentLoaded=function(){return!(0,_.Z)(["LOADING","RELOADING","STOPPED"],this.state)},i.isBuffering=function(){return(0,_.Z)(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)},i.isPaused=function(){return!this.videoElement||((0,_.Z)(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused)},i.isLive=function(){if(null===this._priv_contentInfos)return!1;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;return!t&&null!==n&&n.isLive},i.areTrickModeTracksEnabled=function(){return this._priv_preferTrickModeTracks},i.getUrl=function(){if(null!==this._priv_contentInfos){var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest,r=e.originalUrl;return t?r:null!==n?n.getUrl():void 0}},i.updateContentUrls=function(e,t){if(null===this._priv_contentInfos)throw new Error("No content loaded");var n=!0===(null==t?void 0:t.refresh);this._priv_contentInfos.initializer.updateContentUrls(e,n)},i.getVideoDuration=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration},i.getVideoBufferGap=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,k.L7)(e.buffered,e.currentTime)},i.getVideoLoadedTime=function(){if((0,I.Z)("`getVideoLoadedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,k.at)(e.buffered,e.currentTime)},i.getVideoPlayedTime=function(){if((0,I.Z)("`getVideoPlayedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,k.DD)(e.buffered,e.currentTime)},i.getWallClockTime=function(){if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)return this.videoElement.currentTime;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){var r=a(this.videoElement);return(null!=r?r:0)+this.videoElement.currentTime}return null!==n?this.videoElement.currentTime+(void 0!==n.availabilityStartTime?n.availabilityStartTime:0):0},i.getPosition=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.currentTime},i.getLastStoredContentPosition=function(){return this._priv_reloadingMetadata.reloadPosition},i.getPlaybackRate=function(){return this._priv_speed.getValue()},i.setPlaybackRate=function(e,t){var n;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);var r=null==t?void 0:t.preferTrickModeTracks;if("boolean"==typeof r){this._priv_preferTrickModeTracks=r;var i=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.trackChoiceManager;(0,h.Z)(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}},i.getAvailableVideoBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,h.Z)(r.video)?[]:r.video.getAvailableBitrates()},i.getAvailableAudioBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,h.Z)(r.audio)?[]:r.audio.getAvailableBitrates()},i.getManualAudioBitrate=function(){return this._priv_bitrateInfos.manualBitrates.audio.getValue()},i.getManualVideoBitrate=function(){return this._priv_bitrateInfos.manualBitrates.video.getValue()},i.getVideoBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,h.Z)(e.video))return e.video.bitrate},i.getAudioBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,h.Z)(e.audio))return e.audio.bitrate},i.getMinVideoBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.video.getValue()},i.getMinAudioBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.audio.getValue()},i.getMaxVideoBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.video.getValue()},i.getMaxAudioBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.audio.getValue()},i.play=function(){var e=this;if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement.play();return(0,h.Z)(t)||"function"!=typeof t.catch?Promise.resolve():t.catch((function(t){if("NotAllowedError"===t.name){var n=new v.Z("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());e.trigger("warning",n)}throw t}))},i.pause=function(){if(null===this.videoElement)throw new Error("Disposed player");this.videoElement.pause()},i.seekTo=function(e){var t;if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)throw new Error("player: no content loaded");var n,r=this._priv_contentInfos,i=r.isDirectFile,o=r.manifest;if(!i&&null===o)throw new Error("player: the content did not load yet");if("number"==typeof e)n=e;else if("object"==typeof e){var s=e,u=this.videoElement.currentTime;if((0,h.Z)(s.relative))if((0,h.Z)(s.position)){if((0,h.Z)(s.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(null!==o)n=s.wallClockTime-(null!==(t=o.availabilityStartTime)&&void 0!==t?t:0);else if(i&&null!==this.videoElement){var d=a(this.videoElement);void 0!==d&&(n=s.wallClockTime-d)}void 0===n&&(n=s.wallClockTime)}else n=s.position;else n=u+s.relative}if(void 0===n)throw new Error("invalid time given");return l.Z.info("API: API Seek to",n),this.videoElement.currentTime=n,n},i.isFullscreen=function(){return(0,I.Z)("isFullscreen is deprecated. Fullscreen management should now be managed by the application"),s()},i.setFullscreen=function(e){if(void 0===e&&(e=!0),(0,I.Z)("setFullscreen is deprecated. Fullscreen management should now be managed by the application"),null===this.videoElement)throw new Error("Disposed player");e?function(e){if(!s()){var t=e;"function"==typeof t.requestFullscreen?t.requestFullscreen():"function"==typeof t.msRequestFullscreen?t.msRequestFullscreen():"function"==typeof t.mozRequestFullScreen?t.mozRequestFullScreen():"function"==typeof t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}(this.videoElement):o()},i.exitFullscreen=function(){(0,I.Z)("exitFullscreen is deprecated. Fullscreen management should now be managed by the application"),o()},i.getVolume=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.volume},i.setVolume=function(e){if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement;e!==t.volume&&(t.volume=e,this.trigger("volumeChange",e))},i.isMute=function(){return 0===this.getVolume()},i.mute=function(){this._priv_mutedMemory=this.getVolume(),this.setVolume(0)},i.unMute=function(){var e=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;0===this.getVolume()&&this.setVolume(0===this._priv_mutedMemory?e:this._priv_mutedMemory)},i.setVideoBitrate=function(e){this._priv_bitrateInfos.manualBitrates.video.setValue(e)},i.setAudioBitrate=function(e){this._priv_bitrateInfos.manualBitrates.audio.setValue(e)},i.setMinVideoBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.video.getValue();if(e>t)throw new Error('Invalid minimum video bitrate given. Its value, "'+e+'" is superior the current maximum video birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.video.setValue(e)},i.setMinAudioBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.audio.getValue();if(e>t)throw new Error('Invalid minimum audio bitrate given. Its value, "'+e+'" is superior the current maximum audio birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.audio.setValue(e)},i.setMaxVideoBitrate=function(e){var t=this._priv_bitrateInfos.minAutoBitrates.video.getValue();if(e0||c.result.removedAdaptations.length>0)){var f=u.getAvailableAudioTracks(s);r._priv_triggerEventIfNotStopped("availableAudioTracksChange",null!=f?f:[],i);var v=u.getAvailableTextTracks(s);r._priv_triggerEventIfNotStopped("availableTextTracksChange",null!=v?v:[],i);var p=u.getAvailableVideoTracks(s);r._priv_triggerEventIfNotStopped("availableVideoTracksChange",null!=p?p:[],i)}return}}),e.currentContentCanceller.signal)}},i._priv_onActivePeriodChanged=function(e,t){var n,r,i,a,o,s,u,l,d=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.currentPeriod=d;var c=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==d&&(this._priv_contentEventsMemory.periodChange=d,this._priv_triggerEventIfNotStopped("periodChange",d,c)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),c),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),c),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),c);var f=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.trackChoiceManager;if((0,h.Z)(f))this._priv_triggerEventIfNotStopped("audioTrackChange",null,c),this._priv_triggerEventIfNotStopped("textTrackChange",null,c),this._priv_triggerEventIfNotStopped("videoTrackChange",null,c);else{var v=f.getChosenAudioTrack(d);this._priv_triggerEventIfNotStopped("audioTrackChange",v,c);var p=f.getChosenTextTrack(d);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);var m=f.getChosenVideoTrack(d);this._priv_triggerEventIfNotStopped("videoTrackChange",m,c)}if(this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",this.getAvailableAudioBitrates(),c),!e.currentContentCanceller.isUsed()&&(this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",this.getAvailableVideoBitrates(),c),!e.currentContentCanceller.isUsed())){var g=null!==(o=null===(a=null===(i=this._priv_getCurrentRepresentations())||void 0===i?void 0:i.audio)||void 0===a?void 0:a.bitrate)&&void 0!==o?o:-1;if(this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",g,c),!e.currentContentCanceller.isUsed()){var y=null!==(l=null===(u=null===(s=this._priv_getCurrentRepresentations())||void 0===s?void 0:s.video)||void 0===u?void 0:u.bitrate)&&void 0!==l?l:-1;this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",y,c)}}}},i._priv_onPeriodStreamReady=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=t.adaptationRef,o=e.trackChoiceManager;switch(r){case"video":(0,h.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new video period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialVideoTrack(i));break;case"audio":(0,h.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialAudioTrack(i));break;case"text":(0,h.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialTextTrack(i));break;default:var s=i.adaptations[r];!(0,h.Z)(s)&&s.length>0?a.setValue(s[0]):a.setValue(null)}}},i._priv_onPeriodStreamCleared=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=e.trackChoiceManager;switch(r){case"audio":case"text":case"video":(0,h.Z)(a)||a.removePeriod(r,i)}var o=e.activeAdaptations,s=e.activeRepresentations;if(!(0,h.Z)(o)&&!(0,h.Z)(o[i.id])){var u=o[i.id];delete u[r],0===Object.keys(u).length&&delete o[i.id]}if(!(0,h.Z)(s)&&!(0,h.Z)(s[i.id])){var l=s[i.id];delete l[r],0===Object.keys(l).length&&delete s[i.id]}}},i._priv_onAdaptationChange=function(e,t){var n,r=t.type,i=t.adaptation,a=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeAdaptations&&(e.activeAdaptations={});var o,s=e.activeAdaptations,u=e.currentPeriod,l=s[a.id];if((0,h.Z)(l))s[a.id]=((o={})[r]=i,o);else l[r]=i;var d=e.trackChoiceManager,c=e.currentContentCanceller.signal;if(null!==d&&null!==u&&!(0,h.Z)(a)&&a.id===u.id)switch(r){case"audio":var f=d.getChosenAudioTrack(u);this._priv_triggerEventIfNotStopped("audioTrackChange",f,c);var v=this.getAvailableAudioBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",v,c);break;case"text":var p=d.getChosenTextTrack(u);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);break;case"video":var m=d.getChosenVideoTrack(u);this._priv_triggerEventIfNotStopped("videoTrackChange",m,c);var g=this.getAvailableVideoBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",g,c)}}},i._priv_onRepresentationChange=function(e,t){var n,r,i=t.type,a=t.period,o=t.representation;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeRepresentations&&(e.activeRepresentations={});var s,u=e.activeRepresentations,l=e.currentPeriod,d=u[a.id];if((0,h.Z)(d))u[a.id]=((s={})[i]=o,s);else d[i]=o;var c=null!==(r=null==o?void 0:o.bitrate)&&void 0!==r?r:-1;if(!(0,h.Z)(a)&&null!==l&&l.id===a.id){var f=this._priv_contentInfos.currentContentCanceller.signal;"video"===i?this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",c,f):"audio"===i&&this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",c,f)}}},i._priv_onBitrateEstimationChange=function(e){var t=e.type,n=e.bitrate;void 0!==n&&(this._priv_bitrateInfos.lastBitrates[t]=n),this.trigger("bitrateEstimationChange",{type:t,bitrate:n})},i._priv_onNativeTextTracksNext=function(e){this.trigger("nativeTextTracksChange",e)},i._priv_setPlayerState=function(e){this.state!==e&&(this.state=e,l.Z.info("API: playerStateChange event",e),this.trigger("playerStateChange",e))},i._priv_triggerPositionUpdate=function(e,t){var n,r;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var i=e.isDirectFile,o=e.manifest;if((i||null!==o)&&!(0,h.Z)(t)){var s=null!==o?o.getMaximumSafePosition():void 0,u={position:t.position,duration:t.duration,playbackRate:t.playbackRate,maximumBufferTime:s,bufferGap:void 0!==t.bufferGap&&isFinite(t.bufferGap)?t.bufferGap:0};if(null!==o&&o.isLive&&t.position>0){var l=null!==(r=o.availabilityStartTime)&&void 0!==r?r:0;u.wallClockTime=t.position+l;var d=o.getLivePosition();void 0!==d&&(u.liveGap=d-t.position)}else if(i&&null!==this.videoElement){var c=a(this.videoElement);void 0!==c&&(u.wallClockTime=c+t.position)}this.trigger("positionUpdate",u)}}},i._priv_triggerAvailableBitratesChangeEvent=function(e,t,n){var r=this._priv_contentEventsMemory[e];n.isCancelled()||void 0!==r&&(0,y.Z)(t,r)||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_triggerCurrentBitrateChangeEvent=function(e,t,n){n.isCancelled()||t===this._priv_contentEventsMemory[e]||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_getCurrentRepresentations=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeRepresentations;return null===t||null===n||(0,h.Z)(n[t.id])?null:n[t.id]},i._priv_triggerEventIfNotStopped=function(e,t,n){n.isCancelled()||this.trigger(e,t)},i._priv_initializeMediaElementTrackChoiceManager=function(e,t,n){var r,i,a,o=this;(0,b.Z)(null!==g.Z.directfile,"Initializing `MediaElementTrackChoiceManager` without Directfile feature"),(0,b.Z)(null!==this.videoElement,"Initializing `MediaElementTrackChoiceManager` on a disposed RxPlayer");var s=new g.Z.directfile.mediaElementTrackChoiceManager(this.videoElement),u=void 0===e?this._priv_preferredAudioTracks:[e];s.setPreferredAudioTracks(u,!0);var l=void 0===t?this._priv_preferredTextTracks:[t];return s.setPreferredTextTracks(l,!0),s.setPreferredVideoTracks(this._priv_preferredVideoTracks,!0),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",s.getAvailableAudioTracks(),n),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",s.getAvailableVideoTracks(),n),this._priv_triggerEventIfNotStopped("availableTextTracksChange",s.getAvailableTextTracks(),n),this._priv_triggerEventIfNotStopped("audioTrackChange",null!==(r=s.getChosenAudioTrack())&&void 0!==r?r:null,n),this._priv_triggerEventIfNotStopped("textTrackChange",null!==(i=s.getChosenTextTrack())&&void 0!==i?i:null,n),this._priv_triggerEventIfNotStopped("videoTrackChange",null!==(a=s.getChosenVideoTrack())&&void 0!==a?a:null,n),s.addEventListener("availableVideoTracksChange",(function(e){return o.trigger("availableVideoTracksChange",e)})),s.addEventListener("availableAudioTracksChange",(function(e){return o.trigger("availableAudioTracksChange",e)})),s.addEventListener("availableTextTracksChange",(function(e){return o.trigger("availableTextTracksChange",e)})),s.addEventListener("audioTrackChange",(function(e){return o.trigger("audioTrackChange",e)})),s.addEventListener("videoTrackChange",(function(e){return o.trigger("videoTrackChange",e)})),s.addEventListener("textTrackChange",(function(e){return o.trigger("textTrackChange",e)})),s},(0,e.Z)(r,null,[{key:"ErrorTypes",get:function(){return p.ZB}},{key:"ErrorCodes",get:function(){return p.SM}},{key:"LogLevel",get:function(){return l.Z.getLevel()},set:function(e){l.Z.setLevel(e)}}]),r}(S.Z);ye.version="3.33.1";var _e=ye;!function(){m.Z.mediaSourceInit=n(7117).Z,m.Z.decrypt=n(3380).ZP,m.Z.imageBuffer=n(7127).Z,m.Z.imageParser=n(3203).Z,m.Z.transports.smooth=n(2339).Z,m.Z.transports.dash=n(85).Z,m.Z.dashParsers.js=n(1707).Z,m.Z.nativeTextTracksBuffer=n(9059).Z,m.Z.nativeTextTracksParsers.vtt=n(9405).Z,m.Z.nativeTextTracksParsers.ttml=n(1570).Z,m.Z.nativeTextTracksParsers.sami=n(1812).Z,m.Z.nativeTextTracksParsers.srt=n(8057).Z,m.Z.htmlTextTracksBuffer=n(5192).Z,m.Z.htmlTextTracksParsers.sami=n(5734).Z,m.Z.htmlTextTracksParsers.ttml=n(7439).Z,m.Z.htmlTextTracksParsers.srt=n(8675).Z,m.Z.htmlTextTracksParsers.vtt=n(4099).Z;var e=n(9372).Z,t=n(6796).Z;m.Z.directfile={initDirectFile:e,mediaElementTrackChoiceManager:t}}(),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&l.Z.setLevel("DEBUG");var be=_e}(),r=r.default}()})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RxPlayer=t():e.RxPlayer=t()}(self,(function(){return function(){var e={3774:function(e,t,n){"use strict";n.d(t,{J:function(){return a},c:function(){return o}});var r=n(1946),i=n(2203).Z?void 0:window,a=void 0===i?void 0:(0,r.Z)(i.MediaSource)?(0,r.Z)(i.MozMediaSource)?(0,r.Z)(i.WebKitMediaSource)?i.MSMediaSource:i.WebKitMediaSource:i.MozMediaSource:i.MediaSource,o={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4}},3666:function(e,t,n){"use strict";n.d(t,{$u:function(){return h},GQ:function(){return y},SB:function(){return f},YM:function(){return l},fq:function(){return u},kD:function(){return s},lV:function(){return g},l_:function(){return m},op:function(){return v},vS:function(){return c},vU:function(){return d},yS:function(){return p}});var r,i,a,o=n(2203),s=!1,u=!1,l=!1,d=!1,c=!1,f=!1,v=!1,p=!1,h=!1,m=!1,g=!1,y=!1;o.Z||(void 0!==window.MSInputMethodContext&&void 0!==document.documentMode?(u=!0,l=!0):"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&/(Trident|Edge)\//.test(navigator.userAgent)?l=!0:-1!==navigator.userAgent.toLowerCase().indexOf("edg/")?s=!0:-1!==navigator.userAgent.toLowerCase().indexOf("firefox")?d=!0:"string"==typeof navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)?f=!0:(Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>=0||"[object SafariRemoteNotification]"===(null===(i=null===(r=window.safari)||void 0===r?void 0:r.pushNotification)||void 0===i?void 0:i.toString())||/Safari\/(\d+)/.test(navigator.userAgent)&&/Version\/(\d+)/.test(navigator.userAgent)&&-1!==(null===(a=navigator.vendor)||void 0===a?void 0:a.indexOf("Apple"))&&!/Chrome\/(\d+)/.test(navigator.userAgent)&&!/Chromium\/(\d+)/.test(navigator.userAgent))&&(c=!0),/SamsungBrowser/.test(navigator.userAgent)&&(v=!0),-1!==navigator.userAgent.indexOf("PlayStation 5")?g=!0:/Tizen/.test(navigator.userAgent)?p=!0:/[Ww]eb[O0]S/.test(navigator.userAgent)?(h=!0,/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)||(/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent))):/[Pp]anasonic/.test(navigator.userAgent)?m=!0:-1!==navigator.userAgent.indexOf("Xbox")&&(y=!0))},5767:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e){var t=e.textTracks;if(!(0,i.Z)(t)){for(var n=0;n=0;o--)if("track"===a[o].nodeName)try{e.removeChild(a[o])}catch(e){r.Z.warn("Compat: Could not remove text track child from element.")}}e.src="",e.removeAttribute("src")}},3038:function(e,t,n){"use strict";n.d(t,{Dl:function(){return x},M4:function(){return P},N8:function(){return k},O0:function(){return y},Q$:function(){return M},Q4:function(){return S},RV:function(){return I},S1:function(){return f},XR:function(){return p},bQ:function(){return C},it:function(){return g},k6:function(){return E},kJ:function(){return b},kk:function(){return Z},qo:function(){return R},u_:function(){return T},w0:function(){return m},x6:function(){return A},y4:function(){return w},zU:function(){return _}});var r=n(6872),i=n(6923),a=n(1946),o=n(8894),s=n(5095),u=n(2203),l=["","webkit","moz","ms"],d=u.Z||null==window.devicePixelRatio||0===window.devicePixelRatio?1:window.devicePixelRatio;function c(e,t){return t.filter((function(t){return function(e,t){var n=document.createElement(e.tagName),r="on"+t;return r in n||(n.setAttribute(r,"return;"),"function"==typeof n[r])}(e,t)}))[0]}function f(e,t){var n,r=function(e,t){return e.reduce((function(e,n){return e.concat((void 0===t?l:t).map((function(e){return e+n})))}),[])}(e,t);return function(e,t,a){if(!a.isCancelled()){if(e instanceof HTMLElement){if(void 0===n&&(n=c(e,r)),!(0,i.Z)(n))return void 0;e.addEventListener(n,t),a.register((function(){void 0!==n&&e.removeEventListener(n,t)}))}r.forEach((function(n){var r=!1;"function"==typeof e.addEventListener?e.addEventListener(n,t):(r=!0,e["on"+n]=t),a.register((function(){"function"==typeof e.removeEventListener&&e.removeEventListener(n,t),r&&delete e["on"+n]}))}))}}}function v(e){var t,n=document;null!=n.hidden?t="":null!=n.mozHidden?t="moz":null!=n.msHidden?t="ms":null!=n.webkitHidden&&(t="webkit");var r=(0,i.Z)(t)?t+"Hidden":"hidden",a=(0,i.Z)(t)?t+"visibilitychange":"visibilitychange",o=document[r],u=new s.Z(!o,e);return D(document,a,(function(){var e=!document[r];u.setValueIfChanged(e)}),e),u}function p(e){var t,n=v(e),i=new s.Z(!0,e);return e.register((function(){clearTimeout(t),t=void 0})),n.onUpdate((function(e){if(clearTimeout(t),t=void 0,!e){var n=r.Z.getCurrent().INACTIVITY_DELAY;t=window.setTimeout((function(){i.setValueIfChanged(!1)}),n)}i.setValueIfChanged(!0)}),{clearSignal:e,emitCurrentValue:!0}),i}function h(e,t){var n=t.width,r=t.height/(e.clientHeight/e.clientWidth);return Math.min(n,r)}function m(e,t){var n=e;if(!0===n.webkitSupportsPresentationMode&&"function"==typeof n.webkitSetPresentationMode){var r="picture-in-picture"===n.webkitPresentationMode,i=new s.Z({isEnabled:r,pipWindow:null},t);return D(n,"webkitpresentationmodechanged",(function(){var e="picture-in-picture"===n.webkitPresentationMode;i.setValue({isEnabled:e,pipWindow:null})}),t),i}var a=document.pictureInPictureElement===n,o=new s.Z({isEnabled:a,pipWindow:null},t);return D(n,"enterpictureinpicture",(function(e){var t;o.setValue({isEnabled:!0,pipWindow:null!==(t=e.pictureInPictureWindow)&&void 0!==t?t:null})}),t),D(n,"leavepictureinpicture",(function(){o.setValue({isEnabled:!1,pipWindow:null})}),t),o}function g(e,t){var n,i=v(t),a=new s.Z(!0,t);return t.register((function(){clearTimeout(n),n=void 0})),i.onUpdate(o,{clearSignal:t}),e.onUpdate(o,{clearSignal:t}),o(),a;function o(){if(clearTimeout(n),n=void 0,e.getValue().isEnabled||i.getValue())a.setValueIfChanged(!0);else{var t=r.Z.getCurrent().INACTIVITY_DELAY;n=window.setTimeout((function(){a.setValueIfChanged(!1)}),t)}}}function y(e,t,n){var r=new s.Z(e.clientWidth*d,n),i=o.Z;t.onUpdate(l,{clearSignal:n}),D(window,"resize",l,n);var u=window.setInterval(l,2e4);return l(),n.register((function(){i(),clearInterval(u)})),r;function l(){i();var n=t.getValue();if(n.isEnabled)if((0,a.Z)(n.pipWindow))r.setValueIfChanged(1/0);else{var s=n.pipWindow,u=h(e,s),l=function(){r.setValueIfChanged(h(e,s)*d)};s.addEventListener("resize",l),i=function(){s.removeEventListener("resize",l),i=o.Z},r.setValueIfChanged(u*d)}else r.setValueIfChanged(e.clientWidth*d)}}f(["loadedmetadata"]),f(["timeupdate"]);var _=f(["fullscreenchange","FullscreenChange"],l.concat("MS")),b=f(["addtrack"]),S=f(["removetrack"]),T=f(["sourceopen","webkitsourceopen"]),E=f(["sourceclose","webkitsourceclose"]),k=f(["sourceended","webkitsourceended"]),w=f(["update"]),A=f(["removesourcebuffer"]),I=f(["keymessage","message"]),Z=f(["keyadded","ready"]),x=f(["keyerror","error"]),R=f(["keystatuseschange"]),M=f(["seeking"]),C=f(["seeked"]),P=f(["ended"]);function D(e,t,n,r){e.addEventListener(t,n),r.register((function(){e.removeEventListener(t,n)}))}},2203:function(e,t){"use strict";var n="undefined"==typeof window;t.Z=n},1988:function(e,t,n){"use strict";function r(e){return"function"==typeof window.VTTCue&&e instanceof window.VTTCue}n.d(t,{Z:function(){return r}})},7253:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e,t,n){if(e>=t)return r.Z.warn("Compat: Invalid cue times: "+e+" - "+t),null;if((0,i.Z)(window.VTTCue)){if((0,i.Z)(window.TextTrackCue))throw new Error("VTT cues not supported in your target");return new TextTrackCue(e,t,n)}return new VTTCue(e,t,n)}},1669:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(3666);function i(){return r.op}},6872:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r={DEFAULT_UNMUTED_VOLUME:.1,DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_MANUAL_BITRATE_SWITCHING_MODE:"seamless",DEFAULT_ENABLE_FAST_SWITCHING:!0,DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless",DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:-.7,video:-.1,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUTO_PLAY:!1,DEFAULT_SHOW_NATIVE_SUBTITLE:!0,DEFAULT_STOP_AT_END:!0,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MINIMUM_MAX_BUFFER_AHEAD:{text:120},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_INITIAL_BITRATES:{audio:0,video:0,other:0},DEFAULT_MIN_BITRATES:{audio:0,video:0,other:0},DEFAULT_MAX_BITRATES:{audio:1/0,video:1/0,other:1/0},INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_WHEN_HIDDEN:!1,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_LIMIT_VIDEO_WIDTH:!1,DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,FORCE_DISCONTINUITY_SEEK_DELAY:5e3,BITRATE_REBUFFERING_RATIO:1.5,BUFFER_GC_GAPS:{CALM:240,BEEFY:30},DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE:1/0,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:250,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_ENTER_BUFFER_BASED_ALGO:10,ABR_EXIT_BUFFER_BASED_ALGO:5,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.005,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_VIDEO_CODECS:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/webm;codecs="vp8"'],EME_DEFAULT_AUDIO_CODECS:['audio/mp4;codecs="mp4a.40.2"',"audio/webm;codecs=opus"],EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAPTATION_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0},image:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5},i=n(8026);function a(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=e.length||(e[t].enabled=!0)}(this._audioTracks.map((function(e){return e.nativeTrack})),e)},t}(a.Z);function f(e){for(var t=0;t=0){var i=e instanceof ArrayBuffer?new Uint8Array(e):e,a=JSON.parse((0,Z.uR)(i)),o=(0,A.K)(a.keys[0].k),s=(0,A.K)(a.keys[0].kid);n(t._vid.webkitAddKey(t._key,o,s,""))}else n(t._vid.webkitAddKey(t._key,e,null,""))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){n._vid.webkitGenerateKeyRequest(n._key,t),e()}))},n.close=function(){var e=this;return new Promise((function(t){e._closeSession(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},t}(_.Z),M=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){var t=this;return S((function(){if(!x(e))throw new Error("Video not attached to the MediaKeys");t._videoElement=e}))},t.createSession=function(){if(null==this._videoElement)throw new Error("Video not attached to the MediaKeys");return new R(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var C=n(9252),P=n(6968);function D(e,t){var n=e;return S((function(){if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");n.webkitSetMediaKeys(t)}))}var N=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._serverCertificate=r,i._videoElement=t,i._keyType=n,i._unbindSession=I.Z,i._closeSession=I.Z,i.closed=new Promise((function(e){i._closeSession=e})),i.keyStatuses=new Map,i.expiration=NaN,i}(0,a.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){if(void 0===t._nativeSession||void 0===t._nativeSession.update||"function"!=typeof t._nativeSession.update)return r("Unavailable WebKit key session.");try{var i;i=e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e.buffer),n(t._nativeSession.update(i))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r,i,a,o=n._videoElement;if(void 0===(null===(r=o.webkitKeys)||void 0===r?void 0:r.createSession))throw new Error("No WebKitMediaKeys API.");if(a=n._keyType,(0,C.Z)(a,"com.apple.fps")){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=function(e,t){var n=e instanceof Uint8Array?e:new Uint8Array(e),r=t instanceof Uint8Array?t:new Uint8Array(t);if((0,P.dN)(n,0)+4!==n.length)throw new Error("Unsupported WebKit initData.");var i=(0,Z.wV)(n),a=i.indexOf("skd://"),o=a>-1?i.substring(a+6):i,s=(0,Z.TZ)(o),u=0,l=new Uint8Array(n.byteLength+4+s.byteLength+4+r.byteLength);return l.set(n),u+=n.length,l.set((0,P.O_)(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set((0,P.O_)(r.byteLength),u),u+=4,l.set(r,u),l}(t,n._serverCertificate)}else i=t;var s=o.webkitKeys.createSession("video/mp4",i);if(null==s)throw new Error("Impossible to get the key sessions");n._listenEvent(s),n._nativeSession=s,e()}))},n.close=function(){var e=this;return new Promise((function(t,n){e._unbindSession(),e._closeSession(),void 0!==e._nativeSession?(e._nativeSession.close(),t()):n("No session to close.")}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},n._listenEvent=function(e){var t=this;this._unbindSession();var n=function(e){t.trigger(e.type,e)};["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.addEventListener(t,n),e.addEventListener("webkit"+t,n)})),this._unbindSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.removeEventListener(t,n),e.removeEventListener("webkit"+t,n)}))}},(0,m.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._nativeSession)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(_.Z),O=function(){function e(e){if(void 0===r)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new r(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0===this._videoElement)throw new Error("Video not attached to the MediaKeys");return D(this._videoElement,this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new N(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();function L(){if(void 0===r)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:r.isTypeSupported,createCustomMediaKeys:function(e){return new O(e)},setMediaKeys:function(e,t){if(null===t)return D(e,t);if(!(t instanceof O))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}var U=function(e){var t,n,i,a=B;if("standard"!==e&&("auto"!==e||(c.vS||c.SB)&&void 0!==r)||!v.Z&&(0,d.Z)(navigator.requestMediaKeySystemAccess)){var o,s;if("webkit"===e&&void 0!==r){n=(0,f.S1)(["needkey"]);var p=L();o=p.isTypeSupported,s=p.createCustomMediaKeys,a=p.setMediaKeys,i="webkit"}else if(x(HTMLVideoElement.prototype)){n=(0,f.S1)(["needkey"]);var m={isTypeSupported:function(e){var t=document.querySelector("video");return null==t&&(t=document.createElement("video")),null!=t&&"function"==typeof t.canPlayType&&!!t.canPlayType("video/mp4",e)},createCustomMediaKeys:function(e){return new M(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof M))throw new Error("Custom setMediaKeys is supposed to be called with old webkit custom MediaKeys.");return t._setVideo(e)}};o=m.isTypeSupported,s=m.createCustomMediaKeys,a=m.setMediaKeys,i="older-webkit"}else if(void 0!==r){n=(0,f.S1)(["needkey"]);var y=L();o=y.isTypeSupported,s=y.createCustomMediaKeys,a=y.setMediaKeys,i="webkit"}else if(c.fq&&void 0!==h){n=(0,f.S1)(["encrypted","needkey"]);var _={isTypeSupported:function(e,t){if(void 0===h)throw new Error("No MSMediaKeys API.");return void 0!==t?h.isTypeSupported(e,t):h.isTypeSupported(e)},createCustomMediaKeys:function(e){return new k(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof k))throw new Error("Custom setMediaKeys is supposed to be called with IE11 custom MediaKeys.");return t._setVideo(e)}};o=_.isTypeSupported,s=_.createCustomMediaKeys,a=_.setMediaKeys,i="ms"}else if(void 0!==T){n=(0,f.S1)(["encrypted","needkey"]);var b={isTypeSupported:function(e,t){if(void 0===T)throw new Error("No MozMediaKeys API.");return void 0!==t?T.isTypeSupported(e,t):T.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===T)throw new Error("No MozMediaKeys API.");return new T(e)},setMediaKeys:function(e,t){return S((function(){var n=e;if(void 0===n.mozSetMediaKeys||"function"!=typeof n.mozSetMediaKeys)throw new Error("Can't set video on MozMediaKeys.");return n.mozSetMediaKeys(t)}))}};o=b.isTypeSupported,s=b.createCustomMediaKeys,a=b.setMediaKeys,i="moz"}else{n=(0,f.S1)(["encrypted","needkey"]);var E=window.MediaKeys,w=function(){if(void 0===E)throw new u.Z("MEDIA_KEYS_NOT_SUPPORTED","No `MediaKeys` implementation found in the current browser.");if(void 0===E.isTypeSupported){throw new Error("This browser seems to be unable to play encrypted contents currently.Note: Some browsers do not allow decryption in some situations, like when not using HTTPS.")}};o=function(e){return w(),(0,l.Z)("function"==typeof E.isTypeSupported),E.isTypeSupported(e)},s=function(e){return w(),new E(e)},i="unknown"}t=function(e,t){if(!o(e))return Promise.reject(new Error("Unsupported key type"));for(var n=0;ne.length)return V.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var i=e.subarray(n,n+r),a={systemId:(0,z.Y)(i,8),data:i};W(t,a)?V.Z.warn("Compat: Duplicated PSSH found in initialization data, removing it."):t.push(a),n+=r}return n!==e.length?(V.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}]):t}(new Uint8Array(t));return{type:n,values:r}}var j=n(6872),q=n(5157),Y=n(5389),X=n(3274),Q=n(7714),$=n(770);function J(e){return $.Z.setState(e,null),F.setMediaKeys(e,null).then((function(){V.Z.info("DRM: MediaKeys disabled with success")})).catch((function(e){V.Z.error("DRM: Could not disable MediaKeys",e instanceof Error?e:"Unknown Error")}))}function ee(){return(ee=(0,i.Z)(s().mark((function e(t,n,r){var i,a,o,u,l,d,c;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.emeImplementation,a=n.keySystemOptions,o=n.loadedSessionsStore,u=n.mediaKeySystemAccess,l=n.mediaKeys,d=$.Z.getState(t),c=null!==d&&d.loadedSessionsStore!==o?d.loadedSessionsStore.closeAllSessions():Promise.resolve(),e.next=5,c;case 5:if(!r.isCancelled()){e.next=7;break}throw r.cancellationError;case 7:if($.Z.setState(t,{emeImplementation:i,keySystemOptions:a,mediaKeySystemAccess:u,mediaKeys:l,loadedSessionsStore:o}),t.mediaKeys!==l){e.next=10;break}return e.abrupt("return");case 10:V.Z.info("DRM: Attaching MediaKeys to the media element"),i.setMediaKeys(t,l).then((function(){V.Z.info("DRM: MediaKeys attached with success")})).catch((function(e){V.Z.error("DRM: Could not set MediaKeys",e instanceof Error?e:"Unknown Error")}));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(e){if(""===e.sessionId)return!1;var t=e.keyStatuses,n=[];return t.forEach((function(e){n.push(e)})),n.length<=0?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses",e.sessionId),!1):(0,Q.Z)(n,"expired")?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has an expired key",e.sessionId),!1):(0,Q.Z)(n,"internal-error")?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has a key with an internal-error",e.sessionId),!1):(V.Z.debug("DRM: isSessionUsable: MediaKeySession is usable",e.sessionId),!0)}function ne(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?re(i,t):null===a?(V.Z.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),re(i,t)):function(e,t,n,r){return ie.apply(this,arguments)}(i,a,t,r)}function re(e,t){V.Z.info("DRM: Creating a new temporary session");var n=e.createSession(t,"temporary");return Promise.resolve({type:"created-session",value:n})}function ie(){return ie=(0,i.Z)(s().mark((function e(t,n,r,a){var o,u,l,d,c,f;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f=function(){return f=(0,i.Z)(s().mark((function e(){var i,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===a.cancellationError){e.next=2;break}throw a.cancellationError;case 2:return V.Z.info("DRM: Removing previous persistent session."),null!==(i=n.get(r))&&n.delete(i.sessionId),e.prev=5,e.next=8,t.closeSession(o.mediaKeySession);case 8:e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(5),""===o.mediaKeySession.sessionId){e.next=14;break}throw e.t0;case 14:t.removeSessionWithoutClosingIt(o.mediaKeySession);case 15:if(null===a.cancellationError){e.next=17;break}throw a.cancellationError;case 17:return u=t.createSession(r,"persistent-license"),e.abrupt("return",{type:"created-session",value:u});case 19:case"end":return e.stop()}}),e,null,[[5,10]])}))),f.apply(this,arguments)},c=function(){return f.apply(this,arguments)},null===a.cancellationError){e.next=4;break}throw a.cancellationError;case 4:if(V.Z.info("DRM: Creating persistent MediaKeySession"),o=t.createSession(r,"persistent-license"),null!==(u=n.getAndReuse(r))){e.next=9;break}return e.abrupt("return",{type:"created-session",value:o});case 9:return e.prev=9,e.next=12,t.loadPersistentSession(o.mediaKeySession,u.sessionId);case 12:if(l=e.sent){e.next=19;break}return V.Z.warn("DRM: No data stored for the loaded session"),n.delete(u.sessionId),t.removeSessionWithoutClosingIt(o.mediaKeySession),d=t.createSession(r,"persistent-license"),e.abrupt("return",{type:"created-session",value:d});case 19:if(!l||!te(o.mediaKeySession)){e.next=23;break}return n.add(r,r.keyIds,o.mediaKeySession),V.Z.info("DRM: Succeeded to load persistent session."),e.abrupt("return",{type:"loaded-persistent-session",value:o});case 23:return V.Z.warn("DRM: Previous persistent session not usable anymore."),e.abrupt("return",c());case 27:return e.prev=27,e.t0=e.catch(9),V.Z.warn("DRM: Unable to load persistent session: "+(e.t0 instanceof Error?e.t0.toString():"Unknown Error")),e.abrupt("return",c());case 31:case"end":return e.stop()}}),e,null,[[9,27]])}))),ie.apply(this,arguments)}function ae(e,t){return oe.apply(this,arguments)}function oe(){return(oe=(0,i.Z)(s().mark((function e(t,n){var r,i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n<0||n>=t.getLength())){e.next=2;break}return e.abrupt("return");case 2:for(V.Z.info("DRM: LSS cache limit exceeded",n,t.getLength()),r=[],i=t.getAll().slice(),a=i.length-n,o=0;o=o.length)){e.next=2;break}throw new q.Z("INCOMPATIBLE_KEYSYSTEMS","No key system compatible with your wanted configuration has been found in the current browser.");case 2:if(null!=F.requestMediaKeySystemAccess){e.next=4;break}throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");case 4:return r=o[t],i=r.keyName,a=r.keyType,l=r.keySystemOptions,d=ce(i,a,l),V.Z.debug("DRM: Request keysystem access "+a+","+(t+1)+" of "+o.length),e.prev=7,e.next=10,F.requestMediaKeySystemAccess(a,d);case 10:return c=e.sent,V.Z.info("DRM: Found compatible keysystem",a,t+1),e.abrupt("return",{type:"create-media-key-system-access",value:{options:l,mediaKeySystemAccess:c}});case 15:if(e.prev=15,e.t0=e.catch(7),V.Z.debug("DRM: Rejected access to keysystem",a,t+1),null===n.cancellationError){e.next=20;break}throw n.cancellationError;case 20:return e.abrupt("return",u(t+1));case 21:case"end":return e.stop()}}),e,null,[[7,15]])})))).apply(this,arguments)}}var ve=n(2297);function pe(e,t,n){var r;V.Z.debug("Compat: Calling generateRequest on the MediaKeySession");try{r=function(e){V.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");for(var t=!1,n=new Uint8Array,r=new Uint8Array,i=0;ie.length)throw V.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var o=e.subarray(i,i+a);if(16===e[i+12]&&119===e[i+13]&&239===e[i+14]&&236===e[i+15]&&192===e[i+16]&&178===e[i+17]&&77===e[i+18]&&2===e[i+19]&&172===e[i+20]&&227===e[i+21]&&60===e[i+22]&&30===e[i+23]&&82===e[i+24]&&226===e[i+25]&&251===e[i+26]&&75===e[i+27]){var s=(0,ve.Xj)(o),u=null===s?void 0:o[s[1]];V.Z.info("Compat: CENC PSSH found with version",u),void 0===u?V.Z.warn("Compat: could not read version of CENC PSSH"):t===(1===u)?n=(0,P.zo)(n,o):1===u?(V.Z.warn("Compat: cenc version 1 encountered, removing every other cenc pssh box."),n=o,t=!0):V.Z.warn("Compat: filtering out cenc pssh box with wrong version",u)}else r=(0,P.zo)(r,o);i+=a}if(i!==e.length)throw V.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");return(0,P.zo)(r,n)}(n)}catch(e){r=n}var i=null!=t?t:"";return e.generateRequest(i,r).catch((function(t){if(""!==i||!(t instanceof TypeError))throw t;return V.Z.warn('Compat: error while calling `generateRequest` with an empty initialization data type. Retrying with a default "cenc" value.',t),e.generateRequest("cenc",r)}))}var he=100;function me(e,t){return ge.apply(this,arguments)}function ge(){return(ge=(0,i.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V.Z.info("DRM: Load persisted session",n),e.next=3,t.load(n);case 3:if((r=e.sent)&&!(t.keyStatuses.size>0)){e.next=6;break}return e.abrupt("return",r);case 6:return e.abrupt("return",new Promise((function(e){t.addEventListener("keystatuseschange",i);var n=setTimeout(i,he);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=n(7864);function _e(e){var t=new b.ZP;return Promise.race([e.close().then((function(){t.cancel()})),e.closed.then((function(){t.cancel()})),function(){return n.apply(this,arguments)}()]);function n(){return(n=(0,i.Z)(s().mark((function e(){var n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,ye.Z)(1e3,t.signal);case 3:return e.next=5,r();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),!(e.t0 instanceof b.FU)){e.next=11;break}return e.abrupt("return");case 11:n=e.t0 instanceof Error?e.t0.message:"Unknown error made it impossible to close the session",V.Z.error("DRM: "+n);case 13:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function r(){return a.apply(this,arguments)}function a(){return(a=(0,i.Z)(s().mark((function n(){return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.update(new Uint8Array(1));case 3:n.next=13;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t.isUsed()){n.next=9;break}return n.abrupt("return");case 9:if(!(n.t0 instanceof Error&&"The session is already closed."===n.t0.message)){n.next=11;break}return n.abrupt("return");case 11:return n.next=13,(0,ye.Z)(1e3,t.signal);case 13:if(!t.isUsed()){n.next=15;break}return n.abrupt("return");case 15:throw new Error("Compat: Couldn't know if session is closed");case 16:case"end":return n.stop()}}),n,null,[[0,5]])})))).apply(this,arguments)}}function be(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Se(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){if(null!==this._keyIds&&Te(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return Te(t,this._initializationData.keyIds)}return this._checkInitializationDataCompatibility(e)},t._checkInitializationDataCompatibility=function(e){return void 0!==e.keyIds&&e.keyIds.length>0&&void 0!==this._initializationData.keyIds?Te(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function Ae(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&n._storage[e].mediaKeySession===i&&n._storage.splice(e,1)})).catch((function(e){V.Z.warn("DRM-LSS: MediaKeySession.closed rejected: "+e)})),this._storage.push(Object.assign({},a)),V.Z.debug("DRM-LSS: MediaKeySession added",a.sessionType,this._storage.length),a},t.reuse=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.keySessionRecord.isCompatibleWith(e))return this._storage.splice(t,1),this._storage.push(n),V.Z.debug("DRM-LSS: Reusing session:",n.mediaKeySession.sessionId,n.sessionType),Object.assign({},n)}return null},t.getEntryForSession=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.mediaKeySession===e)return Object.assign({},n)}return null},t.generateLicenseRequest=function(){var e=(0,i.Z)(s().mark((function e(t,n,r){var i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=Ae(this._storage);case 1:if((o=a()).done){e.next=8;break}if((u=o.value).mediaKeySession!==t){e.next=6;break}return i=u,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==i){e.next=11;break}return V.Z.error("DRM-LSS: generateRequest error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",pe(t,n,r));case 11:if(i.isGeneratingRequest=!0,"none"===i.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,pe(t,n,r);case 17:e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(14),void 0!==i){e.next=23;break}throw e.t0;case 23:throw i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start(),e.t0;case 26:if(void 0!==i){e.next=28;break}return e.abrupt("return",void 0);case 28:i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start();case 30:case"end":return e.stop()}}),e,this,[[14,19]])})));return function(t,n,r){return e.apply(this,arguments)}}(),t.loadPersistentSession=function(){var e=(0,i.Z)(s().mark((function e(t,n){var r,i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=Ae(this._storage);case 1:if((a=i()).done){e.next=8;break}if((o=a.value).mediaKeySession!==t){e.next=6;break}return r=o,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==r){e.next=11;break}return V.Z.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",me(t,n));case 11:if(r.isLoadingPersistentSession=!0,"none"===r.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,me(t,n);case 17:u=e.sent,e.next=27;break;case 20:if(e.prev=20,e.t0=e.catch(14),void 0!==r){e.next=24;break}throw e.t0;case 24:throw r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.t0;case 27:if(void 0!==r){e.next=29;break}return e.abrupt("return",u);case 29:return r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.abrupt("return",u);case 32:case"end":return e.stop()}}),e,this,[[14,20]])})));return function(t,n){return e.apply(this,arguments)}}(),t.closeSession=function(){var e=(0,i.Z)(s().mark((function e(t){var n,r,i,a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Ae(this._storage);case 1:if((i=r()).done){e.next=8;break}if((a=i.value).mediaKeySession!==t){e.next=6;break}return n=a,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==n){e.next=11;break}return V.Z.warn("DRM-LSS: No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Promise.resolve(!1));case 11:return e.abrupt("return",this._closeEntry(n));case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getLength=function(){return this._storage.length},t.getAll=function(){return this._storage},t.closeAllSessions=function(){var e=(0,i.Z)(s().mark((function e(){var t,n,r=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._storage,V.Z.debug("DRM-LSS: Closing all current MediaKeySessions",t.length),this._storage=[],n=t.map((function(e){return r._closeEntry(e)})),e.next=6,Promise.all(n);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.removeSessionWithoutClosingIt=function(e){(0,l.Z)(""===e.sessionId,"Initialized `MediaKeySession`s should always be properly closed");for(var t=this._storage.length-1;t>=0;t--){if(this._storage[t].mediaKeySession===e)return V.Z.debug("DRM-LSS: Removing session without closing it",e.sessionId),this._storage.splice(t,1),!0}return!1},t.getIndex=function(e){for(var t=0;t=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0){var o=void 0===t?3:4,s=this._entries[a];if((null!==(r=s.version)&&void 0!==r?r:-1)>=o&&i===s.sessionId)return;V.Z.info("DRM-PSS: Updating session info.",i),this._entries.splice(a,1)}else V.Z.info("DRM-PSS: Add new session",i);var u=e.values.getFormattedValues().map((function(e){var t=e.systemId,n=e.data;return{systemId:t,hash:e.hash,data:new Pe(n)}}));void 0===t?this._entries.push({version:3,sessionId:i,values:u,initDataType:e.type}):this._entries.push({version:4,sessionId:i,keyIds:t.map((function(e){return new Pe(e)})),values:u,initDataType:e.type}),this._save()}else V.Z.warn("DRM-PSS: Invalid Persisten Session given.")},t.delete=function(e){for(var t=-1,n=0;n0&&(r=new q.Z("KEY_STATUS_CHANGE_ERROR","One or several problematic key statuses have been encountered",{keyStatuses:d})),{warning:r,blacklistedKeyIds:u,whitelistedKeyIds:l}}var nt=f.Dl,rt=f.RV,it=f.qo;function at(e,t,n,r,a){V.Z.info("DRM: Binding session events",e.sessionId);var o=t.getLicenseConfig,u=void 0===o?{}:o,l=new b.ZP;return l.linkToSignal(a),(0,d.Z)(e.closed)||e.closed.then((function(){return l.cancel()})).catch((function(e){a.isCancelled()||(l.cancel(),r.onError(e))})),nt(e,(function(e){l.cancel(),r.onError(new q.Z("KEY_ERROR",e.type))}),l.signal),it(e,(function(e){(function(e){return c.apply(this,arguments)})(e).catch((function(e){a.isCancelled()||l.isUsed()&&e instanceof b.XG||(l.cancel(),r.onError(e))}))}),l.signal),rt(e,(function(n){var a,o=n,c=new Uint8Array(o.message),f=(0,Ce.Z)(o.messageType)?o.messageType:"license-request";V.Z.info("DRM: Received message event, type "+f,e.sessionId),function(e,t,n){var r=t.baseDelay,a=t.maxDelay,o=t.totalRetry,u=t.shouldRetry,l=t.onRetry,c=0;return f();function f(){return v.apply(this,arguments)}function v(){return(v=(0,i.Z)(s().mark((function t(){var i,v,p;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===n.cancellationError){t.next=2;break}throw n.cancellationError;case 2:return t.prev=2,t.next=5,e();case 5:return i=t.sent,t.abrupt("return",i);case 9:if(t.prev=9,t.t0=t.catch(2),null===n.cancellationError){t.next=13;break}throw n.cancellationError;case 13:if(!(!(0,d.Z)(u)&&!u(t.t0)||c++>=o)){t.next=15;break}throw t.t0;case 15:return"function"==typeof l&&l(t.t0,c),v=Qe(r,c,a),t.next=19,(0,Xe.Z)(v);case 19:return p=f(),t.abrupt("return",p);case 21:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}}((function(){return function(e,n){var r;return new Promise((function(i,a){try{V.Z.debug("DRM: Calling `getLicense`",n);var o=t.getLicense(e,n),s=(0,d.Z)(u.timeout)?1e4:u.timeout;s>=0&&(r=setTimeout((function(){a(new dt('"getLicense" timeout exceeded ('+s+" ms)"))}),s)),Promise.resolve(o).then(l,c)}catch(e){c(e)}function l(e){void 0!==r&&clearTimeout(r),i(e)}function c(e){void 0!==r&&clearTimeout(r),a(e)}}))}(c,f)}),{totalRetry:null!=(a=u.retry)?a:2,baseDelay:200,maxDelay:3e3,shouldRetry:function(e){return e instanceof dt||(0,d.Z)(e)||!0!==e.noRetry},onRetry:function(e){return r.onWarning(ot(e))}},l.signal).then((function(t){if(l.isUsed())return Promise.resolve();if((0,d.Z)(t))V.Z.info("DRM: No license given, skipping session.update");else try{return st(e,t)}catch(e){l.cancel(),r.onError(e)}})).catch((function(e){if(!l.isUsed()){l.cancel();var t=ot(e);if(!(0,d.Z)(e))if(!0===e.fallbackOnLastTry)return V.Z.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void r.onError(new lt(t));r.onError(t)}}))}),l.signal),void f();function c(){return c=(0,i.Z)(s().mark((function n(r){var o,u;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return u=function(){return(u=(0,i.Z)(s().mark((function n(){var i,o;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!l.isUsed()){n.next=2;break}return n.abrupt("return");case 2:if("function"!=typeof t.onKeyStatusesChange){n.next=24;break}return n.prev=3,n.next=6,t.onKeyStatusesChange(r,e);case 6:if(i=n.sent,!l.isUsed()){n.next=9;break}return n.abrupt("return");case 9:n.next=18;break;case 11:if(n.prev=11,n.t0=n.catch(3),!a.isCancelled()){n.next=15;break}return n.abrupt("return");case 15:throw o=new q.Z("KEY_STATUS_CHANGE_ERROR","Unknown `onKeyStatusesChange` error"),!(0,d.Z)(n.t0)&&(0,Ce.Z)(n.t0.message)&&(o.message=n.t0.message),o;case 18:if(!(0,d.Z)(i)){n.next=22;break}V.Z.info("DRM: No license given, skipping session.update"),n.next=24;break;case 22:return n.next=24,st(e,i);case 24:case"end":return n.stop()}}),n,null,[[3,11]])})))).apply(this,arguments)},o=function(){return u.apply(this,arguments)},V.Z.info("DRM: keystatuseschange event received",e.sessionId),n.next=5,Promise.all([o(),Promise.resolve(f())]);case 5:case"end":return n.stop()}}),n)}))),c.apply(this,arguments)}function f(){if(!l.isUsed()&&0!==e.keyStatuses.size){var i=tt(e,t,n),a=i.warning,o=i.blacklistedKeyIds,s=i.whitelistedKeyIds;void 0!==a&&(r.onWarning(a),l.isUsed())||r.onKeyUpdate({whitelistedKeyIds:s,blacklistedKeyIds:o})}}}function ot(e){if(e instanceof dt)return new q.Z("KEY_LOAD_TIMEOUT","The license server took too much time to respond.");var t=new q.Z("KEY_LOAD_ERROR","An error occured when calling `getLicense`.");return!(0,d.Z)(e)&&(0,Ce.Z)(e.message)&&(t.message=e.message),t}function st(e,t){return ut.apply(this,arguments)}function ut(){return(ut=(0,i.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V.Z.info("DRM: Updating MediaKeySession with message"),e.prev=1,e.next=4,t.update(n);case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.toString():"`session.update` failed",new q.Z("KEY_UPDATE_ERROR",r);case 10:V.Z.info("DRM: MediaKeySession update succeeded.");case 11:case"end":return e.stop()}}),e,null,[[1,6]])})))).apply(this,arguments)}var lt=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,je.Z)(r),t.prototype),r.sessionError=n,r}return(0,a.Z)(t,e),t}((0,qe.Z)(Error)),dt=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,je.Z)(n),lt.prototype),n.message=t,n}return(0,a.Z)(t,e),t}((0,qe.Z)(Error)),ct=n(9822);function ft(e,t){return vt.apply(this,arguments)}function vt(){return(vt=(0,i.Z)(s().mark((function e(t,n){var r,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setServerCertificate(n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),V.Z.warn("DRM: mediaKeys.setServerCertificate returned an error",e.t0 instanceof Error?e.t0:""),i=e.t0 instanceof Error?e.t0.toString():"`setServerCertificate` error",new q.Z("LICENSE_SERVER_CERTIFICATE_ERROR",i);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function pt(e,t){return ht.apply(this,arguments)}function ht(){return(ht=(0,i.Z)(s().mark((function e(t,n){var r,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==Fe.hasOne(t)){e.next=3;break}return V.Z.info("DRM: The MediaKeys already has a server certificate, skipping..."),e.abrupt("return",{type:"already-has-one"});case 3:if("function"==typeof t.setServerCertificate){e.next=6;break}return V.Z.warn("DRM: Could not set the server certificate. mediaKeys.setServerCertificate is not a function"),e.abrupt("return",{type:"method-not-implemented"});case 6:return V.Z.info("DRM: Setting server certificate on the MediaKeys"),Fe.prepare(t),e.prev=8,e.next=11,ft(t,n);case 11:return r=e.sent,Fe.set(t,n),e.abrupt("return",{type:"success",value:r});case 16:return e.prev=16,e.t0=e.catch(8),i=(0,ct.Z)(e.t0)?e.t0:new q.Z("LICENSE_SERVER_CERTIFICATE_ERROR","Unknown error when setting the server certificate."),e.abrupt("return",{type:"error",value:i});case 20:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}var mt=n(4339);function gt(e,t){if(!(isNaN(t)||t<0||t>=e.getLength())){var n=e.getLength(),r=n-t;V.Z.info("DRM: Too many stored persistent sessions, removing some.",n,r),e.deleteOldSessions(r)}}var yt=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return P.zo.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return De(this.getFormattedValues(),n)},t.getFormattedValues=function(){return null===this._lazyFormattedValues&&(this._lazyFormattedValues=this._innerValues.slice().sort((function(e,t){return e.systemId===t.systemId?0:void 0===e.systemId?1:void 0===t.systemId||e.systemId=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&U._currentSessions.splice(r),void 0!==t.content&&Et(t.content.manifest,[],[],R.record.getAssociatedKeyIds()),null===(n=i.persistentSessionsStore)||void 0===n||n.delete(C.sessionId),i.loadedSessionsStore.closeSession(C).catch((function(e){var t=e instanceof Error?e:"unknown error";V.Z.warn("DRM: failed to close expired session",t)})).then((function(){return U._unlockInitDataQueue()})).catch((function(e){return U._onFatalError(e)})),void(U._isStopped()||U.trigger("warning",e.reason))}if(e instanceof lt){if(R.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;V.Z.info("DRM: blacklisting Representations based on protection data."),kt(a,t)}U._unlockInitDataQueue()}else U._onFatalError(e)}},this._canceller.signal),void 0!==a.singleLicensePer&&"init-data"!==a.singleLicensePer||this._unlockInitDataQueue(),"created-session"!==x.type){e.next=72;break}return N=t.values.constructRequestData(),e.prev=59,e.next=62,i.loadedSessionsStore.generateLicenseRequest(C,t.type,N);case 62:e.next=72;break;case 64:if(e.prev=64,e.t1=e.catch(59),null!==(O=i.loadedSessionsStore.getEntryForSession(C))&&"none"===O.closingStatus.type){e.next=71;break}return(L=this._currentSessions.indexOf(R))>=0&&this._currentSessions.splice(L,1),e.abrupt("return",Promise.resolve());case 71:throw new q.Z("KEY_GENERATE_REQUEST_ERROR",e.t1 instanceof Error?e.t1.toString():"Unknown error");case 72:return e.abrupt("return",Promise.resolve());case 73:case"end":return e.stop()}}),e,this,[[59,64]])})));return function(t,n){return e.apply(this,arguments)}}(),n._tryToUseAlreadyCreatedSession=function(e,t){var n=t.stores,r=t.options,i=(0,X.Z)(this._currentSessions,(function(t){return t.record.isCompatibleWith(e)}));if(void 0===i)return!1;var a=i.blacklistedSessionError;if(!(0,d.Z)(a))return void 0===e.type||void 0===e.content?(V.Z.error("DRM: This initialization data has already been blacklisted but the current content is not known."),!0):(V.Z.info("DRM: This initialization data has already been blacklisted. Blacklisting the related content."),kt(e.content.manifest,e),!0);if(void 0!==e.keyIds){var o;if(void 0===r.singleLicensePer||"init-data"===r.singleLicensePer){var s=i.keyStatuses.blacklisted;o=function(e,t){for(var n,r,i=function(){var e=r.value;if(t.some((function(t){return(0,K.Z)(t,e)})))return{v:!0}},a=be(e);!(r=a()).done;)if(n=i())return n.v;return!1}(e.keyIds,s)}else{var u=i.keyStatuses.whitelisted;o=!Te(e.keyIds,u)}if(o)return void 0===e.content?(V.Z.error("DRM: Cannot forbid key id, the content is unknown."),!0):(V.Z.info("DRM: Current initialization data is linked to blacklisted keys. Marking Representations as not decipherable"),Et(e.content.manifest,[],e.keyIds,[]),!0)}if(null!==n.loadedSessionsStore.reuse(e))return V.Z.debug("DRM: Init data already processed. Skipping it."),!0;var l=this._currentSessions.indexOf(i);return-1===l?V.Z.error("DRM: Unable to remove processed init data: not found."):(V.Z.debug("DRM: A session from a processed init data is not available anymore. Re-processing it."),this._currentSessions.splice(l,1)),!1},n._onFatalError=function(e){if(!this._canceller.isUsed()){var t=e instanceof Error?e:new Y.Z("NONE","Unknown decryption error");this.error=t,this._initDataQueue.length=0,this._stateData={state:mt.u.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===mt.u.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===mt.u.Disposed||this._stateData.state===mt.u.Error},n._processCurrentInitDataQueue=function(){for(;!1===this._stateData.isInitDataQueueLocked;){var e=this._initDataQueue.shift();if(void 0===e)return;this.onInitializationData(e)}},n._lockInitDataQueue=function(){!1===this._stateData.isInitDataQueueLocked&&(this._stateData.isInitDataQueueLocked=!0)},n._unlockInitDataQueue=function(){2===this._stateData.isMediaKeysAttached?(this._stateData.isInitDataQueueLocked=!1,this._processCurrentInitDataQueue()):V.Z.error("DRM: Trying to unlock in the wrong state")},t}(_.Z);function Tt(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&(0,Q.Z)(t,"persistent-license")}function Et(e,t,n,r){e.updateRepresentationsDeciperability((function(e){if(void 0===e.contentProtections)return e.decipherable;var i=e.contentProtections.keyIds;if(void 0!==i)for(var a,o=_t(i);!(a=o()).done;){for(var s,u=a.value,l=_t(n);!(s=l()).done;){var d=s.value;if((0,K.Z)(d,u.keyId))return!1}for(var c,f=_t(t);!(c=f()).done;){var v=c.value;if((0,K.Z)(v,u.keyId))return!0}for(var p,h=_t(r);!(p=h()).done;){var m=p.value;if((0,K.Z)(m,u.keyId))return}}return e.decipherable}))}function kt(e,t){e.updateRepresentationsDeciperability((function(e){var n,r;if(!1===e.decipherable)return!1;for(var i,a,o=function(){var e=a.value;if((void 0===t.type||e.type===t.type)&&t.values.getFormattedValues().every((function(t){return e.values.some((function(e){return(void 0===t.systemId||e.systemId===t.systemId)&&(0,K.Z)(e.data,t.data)}))})))return{v:!1}},s=_t(null!==(r=null===(n=e.contentProtections)||void 0===n?void 0:n.initData)&&void 0!==r?r:[]);!(a=s()).done;)if(i=o())return i.v;return e.decipherable}))}function wt(e,t,n,r,i,a){for(var o,s,u=[].concat(i,a),l=function(){var e=s.value;u.some((function(t){return(0,K.Z)(t,e)}))||(V.Z.hasLevel("DEBUG")&&V.Z.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",(0,Z.ci)(e)),u.push(e))},d=_t(t.getAssociatedKeyIds());!(s=d()).done;)l();if(void 0!==n&&"init-data"!==n){var c=e.keyIds,f=e.content;if(void 0!==c){var v=c.filter((function(e){return!u.some((function(t){return(0,K.Z)(t,e)}))}));v.length>0&&(V.Z.hasLevel("DEBUG")&&V.Z.debug("DRM: init data keys missing in the license, blacklisting them",v.map((function(e){return(0,Z.ci)(e)})).join(", ")),u.push.apply(u,v))}if(r&&void 0!==f)if("content"===n){for(var p,h=new Set,m=_t(f.manifest.periods);!(p=m()).done;){It(h,p.value)}At(h,u)}else if("periods"===n)for(var g,y=_t(f.manifest.periods);!(g=y()).done;){var _=g.value,b=new Set;if(It(b,_),(null===(o=e.content)||void 0===o?void 0:o.period.id)===_.id)At(b,u);else for(var S=Array.from(b),T=function(){var e=k[E];if(u.some((function(t){return(0,K.Z)(t,e)})))return At(b,u),1},E=0,k=S;E0?e.seekable.end(0):n;return(0,s.Z)(r)?(a.Z.warn("startAt.fromLivePosition set but no known live position, beginning at 0."),0):Math.max(0,r+t.fromLivePosition)}if(null!=t.percentage){if((0,s.Z)(n)||!isFinite(n))return a.Z.warn("startAt.percentage set but no known duration, beginning at 0."),0;var i=t.percentage;return i>=100?n:i<=0?0:n*(+i/100)}return 0}(e,u);return a.Z.debug("Init: Initial time calculated:",t),t}),o,(function(e){return n.trigger("warning",e)}),!0,r).autoPlayResult.then((function(){return(0,c.Z)(t,e,!0,r).onUpdate((function(e,t){e&&(t(),n.trigger("loaded",{segmentBuffersStore:null}))}),{emitCurrentValue:!0,clearSignal:r})})).catch((function(e){r.isCancelled()||n._onFatalError(e)}))},t}(d.K)},7117:function(e,t,n){"use strict";n.d(t,{Z:function(){return tn}});var r=n(5861),i=n(4578),a=n(4687),o=n.n(a);var s=n(6872),u=n(3714),l=n(3887),d=n(811),c=n(7733),f=n(8026),v=n(5095),p=n(288),h=n(8894),m=n(2829),g=n(5138);function y(e){var t=e.map((function(t){return Math.log(t/e[0])})),n=t.map((function(e){return e-t[0]+1})),r=(n[n.length-1]-1)/(2*e.length+10),i=1/r;return e.map((function(e,t){return a(t)}));function a(t){if(0===t)return 0;var o=Math.min(Math.max(1,t),e.length-1);return e[o]===e[o-1]?a(t-1):i*(r+(e[o]*n[o-1]-e[o-1]*n[o])/(e[o]-e[o-1]))+4}}var _=function(){function e(e){this._levelsMap=y(e).map((function(e){return e+4})),this._bitrates=e,this._lastUnsuitableQualityTimestamp=void 0,this._blockRaiseDelay=6e3,l.Z.debug("ABR: Steps for buffer based chooser.",this._levelsMap.map((function(t,n){return"bufferLevel: "+t+", bitrate: "+e[n]})).join(" ,"))}var t=e.prototype;return t.onAddedSegment=function(e){var t=this._levelsMap,n=this._bitrates,r=e.bufferGap,i=e.currentBitrate,a=e.currentScore,o=e.speed;if(null!=i){for(var s,u=-1,d=0;di)break}if(u<0||n.length!==t.length)return l.Z.error("ABR: Current Bitrate not found in the calculated levels"),void(this._currentEstimate=n[0]);void 0!==a&&(s=0===o?a.score:a.score/o);var f=isFinite(r)?r:0,v=performance.now();if(f=0;m--)if(f>=t[m])return void(this._currentEstimate=n[m]);this._currentEstimate=n[0]}else if(void 0!==this._lastUnsuitableQualityTimestamp&&v-this._lastUnsuitableQualityTimestampy)return e}();if(void 0!==_)if(r>=t[_])return l.Z.debug("ABR: Raising quality in BufferBasedChooser",n[_]),void(this._currentEstimate=n[_]);this._currentEstimate=i}}else this._currentEstimate=n[0]},t.getLastEstimate=function(){return this._currentEstimate},e}(),b=n(3274),S=function(){function e(e){this._alpha=Math.exp(Math.log(.5)/e),this._lastEstimate=0,this._totalWeight=0}var t=e.prototype;return t.addSample=function(e,t){var n=Math.pow(this._alpha,e),r=t*(1-n)+n*this._lastEstimate;isNaN(r)||(this._lastEstimate=r,this._totalWeight+=e)},t.getEstimate=function(){var e=1-Math.pow(this._alpha,this._totalWeight);return this._lastEstimate/e},e}();function T(e){if(!(e.progress.length<5)){for(var t=new S(2),n=e.progress,r=1;r=u.outOfStarvationGap&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1):this._inStarvationMode&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1),this._inStarvationMode&&(o=function(e,t,n,r,i){if(!r){var a=t.bufferGap,o=t.speed,s=t.position,u=isFinite(a)?a:0,l=function(e,t){for(var n=-1,r=0;r-1.2){n=r;break}if(a>t&&t-i.time>-1.2){n=r;break}}}if(n<0)return[];for(var o=e[n],s=o.content.segment.time,u=[o],l=n+1;l0?d.progress[d.progress.length-1]:void 0,p=T(d);if(void 0!==v&&void 0!==p){var h=E(v,p);if((c-v.timestamp)/1e3<=h&&h-u/o>2500)return p}if(d.content.segment.complete){var m=d.content.segment.duration,g=(c-d.requestTimestamp)/1e3;if(null!=n&&!(g<=(1.5*m+2)/o)){var y=m/g,_=n.bitrate*Math.min(.7,y);return void 0===i||_1&&(a/=e.speed),{bandwidthEstimate:o,bitrateChosen:a}},t.isUrgent=function(e,t,n,r){return null===t||!(e>=t.bitrate)&&function(e,t,n){if(n)return!0;var r=isFinite(e.bufferGap)?e.bufferGap:0,i=e.position.last+r,a=(0,b.Z)(t,(function(e){var t=e.content;return t.segment.duration>0&&t.segment.time+t.segment.duration>i}));if(void 0===a)return!0;var o=performance.now(),s=a.progress.length>0?a.progress[a.progress.length-1]:void 0,u=T(a);if(void 0===s||void 0===u)return!0;var l=E(s,u);return(o-s.timestamp)/1e3>1.2*l||l-r/e.speed>-1.5}(r,n,this._lowLatencyMode)},e}();function w(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ns.bitrate)return 2===this._lastAbrEstimate.algorithmType&&(null!==this._lastAbrEstimate.representation&&(this._lastMaintanableBitrate=this._lastAbrEstimate.representation.bitrate),this._consecutiveWrongGuesses=0),null;var u=this._scoreCalculator.getEstimate(n);if(2!==this._lastAbrEstimate.algorithmType){if(void 0===u)return null;if(this._canGuessHigher(a,o,u)){var d=Z(e,n);if(null!==d)return d}return null}if(this._isLastGuessValidated(s,r,u)&&(l.Z.debug("ABR: Guessed Representation validated",s.bitrate),this._lastMaintanableBitrate=s.bitrate,this._consecutiveWrongGuesses=0),n.id!==s.id)return s;if(this._shouldStopGuess(n,u,a,i))return this._consecutiveWrongGuesses++,this._blockGuessesUntil=performance.now()+Math.min(15e3*this._consecutiveWrongGuesses,12e4),function(e,t){var n=(0,g.Z)(e,(function(e){return e.id===t.id}));if(n<0)return l.Z.error("ABR: Current Representation not found."),null;for(;--n>=0;)if(e[n].bitrate=2.5&&performance.now()>this._blockGuessesUntil&&1===i&&r/t>1.01},t._shouldStopGuess=function(e,t,n,r){if(void 0!==t&&t.score<1.01)return!0;if((void 0===t||t.score<1.2)&&n<.6)return!0;for(var i,a=r.filter((function(t){return t.content.representation.id===e.id})),o=performance.now(),s=w(a);!(i=s()).done;){var u=i.value,l=o-u.requestTimestamp;if(u.content.segment.isInit){if(l>1e3)return!0}else{if(l>1e3*u.content.segment.duration+200)return!0;var d=T(u);if(void 0!==d&&d<.8*e.bitrate)return!0}}return!1},t._isLastGuessValidated=function(e,t,n){return void 0!==n&&1===n.confidenceLevel&&n.score>1.5||t>=e.bitrate&&(null===this._lastMaintanableBitrate||this._lastMaintanableBitratet.bitrate)return e[r];return null}var x=function(){function e(){var e=s.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new S(t),this._slowEWMA=new S(n),this._bytesSampled=0}var t=e.prototype;return t.addSample=function(e,t){if(!(t1&&this._lastRepresentationWithGoodScore!==e&&(l.Z.debug("ABR: New last stable representation",e.bitrate),this._lastRepresentationWithGoodScore=e)},t.getEstimate=function(e){if(null!==this._currentRepresentationData&&this._currentRepresentationData.representation.id===e.id){var t=this._currentRepresentationData,n=t.ewma,r=t.loadedSegments,i=t.loadedDuration;return{score:n.getEstimate(),confidenceLevel:r>=5&&i>=10?1:0}}},t.getLastStableRepresentation=function(){return this._lastRepresentationWithGoodScore},e}();function D(e,t,n,r){var i=t<=n?n:t>=r?r:t,a=(0,g.Z)(e,(function(e){return e.bitrate>i}));return-1===a?e[e.length-1]:0===a?e[0]:e[a-1]}var N=new v.Z(-1);N.finish();var O=new v.Z(0);O.finish();var L=new v.Z(1/0);L.finish();var U=new v.Z(void 0);U.finish();var B=new v.Z(1/0);B.finish();var F=function(e){var t={},n=e.manualBitrates,r=e.minAutoBitrates,i=e.maxAutoBitrates,a=e.initialBitrates,o=e.throttlers,u=e.lowLatencyMode;return function(e,d,c,f,y){var S,T,E,w,A,Z,M,F=e.adaptation.type,V=function(e){var n=t[e];if(null==n){l.Z.debug("ABR: Creating new BandwidthEstimator for ",e);var r=new x;return t[e]=r,r}return n}(F),z=null!==(S=n[F])&&void 0!==S?S:N,K=null!==(T=r[F])&&void 0!==T?T:O,G=null!==(E=i[F])&&void 0!==E?E:L,W=null!==(w=a[F])&&void 0!==w?w:0;return function(e,t){var n=e.bandwidthEstimator,r=e.context,i=e.currentRepresentation,a=e.filters,o=e.initialBitrate,u=e.lowLatencyMode,d=e.manualBitrate,c=e.maxAutoBitrate,f=e.minAutoBitrate,y=e.playbackObserver,S=e.representations,T=new P,E=new k(null!=o?o:0,u),w=new C,A=h.Z,Z={metrics:L,requestBegin:U,requestProgress:B,requestEnd:F,addedSegment:function(e){A(e)}},x=new p.ZP;x.linkToSignal(t);var M=N(S.getValue(),x.signal);return S.onUpdate(O,{clearSignal:t}),{estimates:M,callbacks:Z};function N(e,t){if(0===e.length)return new v.Z({representation:null,bitrate:void 0,knownStableBitrate:void 0,manual:!1,urgent:!0});if(1===e.length)return new v.Z({bitrate:void 0,representation:e[0],manual:!1,urgent:!0,knownStableBitrate:void 0});var o=!1,p=new _(e.map((function(e){return e.bitrate}))),S=new R,k=new I(T,S),Z=y.getReference().getValue(),x=new v.Z(C());return y.listen((function(e){Z=e,M()}),{includeLastObservation:!1,clearSignal:t}),A=function(e){if(null!==Z){var t=Z,n=t.position,r=t.speed,i=e.buffered,a=(0,m.L7)(i,n.last),o=e.content.representation,s=T.getEstimate(o),u={bufferGap:a,currentBitrate:o.bitrate,currentScore:s,speed:r};p.onAddedSegment(u),M()}},t.register((function(){A=h.Z})),d.onUpdate(M,{clearSignal:t}),f.onUpdate(M,{clearSignal:t}),c.onUpdate(M,{clearSignal:t}),a.limitWidth.onUpdate(M,{clearSignal:t}),a.limitWidth.onUpdate(M,{clearSignal:t}),x;function M(){x.setValue(C())}function C(){var t=d.getValue();if(t>=0)return{representation:D(e,t,0,1/0),bitrate:void 0,knownStableBitrate:void 0,manual:!0,urgent:!0};var v=Z,h=v.bufferGap,m=v.position,y=v.maximumPosition,_=a.limitWidth.getValue(),A=a.throttleBitrate.getValue(),I=i.getValue(),x=f.getValue(),R=c.getValue(),M=function(e,t,n){var r=e;n<1/0&&(r=function(e,t){if(0===e.length)return[];e.sort((function(e,t){return e.bitrate-t.bitrate}));var n=e[0].bitrate,r=Math.max(t,n),i=(0,g.Z)(e,(function(e){return e.bitrate>r}));return-1===i?e:e.slice(0,i)}(r,n));void 0!==t&&(r=function(e,t){var n=e.slice().sort((function(e,t){var n,r;return(null!==(n=e.width)&&void 0!==n?n:0)-(null!==(r=t.width)&&void 0!==r?r:0)})),r=(0,b.Z)(n,(function(e){return"number"==typeof e.width&&e.width>=t}));if(void 0===r)return e;var i="number"==typeof r.width?r.width:0;return e.filter((function(e){return"number"!=typeof e.width||e.width<=i}))}(r,t));return r}(e,_,A),C=w.getRequests(),P=E.getBandwidthEstimate(Z,n,I,C,S.bandwidth),N=P.bandwidthEstimate,O=P.bitrateChosen,L=T.getLastStableRepresentation(),U=null===L?void 0:L.bitrate/(Z.speed>0?Z.speed:1),B=s.Z.getCurrent(),F=B.ABR_ENTER_BUFFER_BASED_ALGO,V=B.ABR_EXIT_BUFFER_BASED_ALGO;o&&h<=V?o=!1:!o&&isFinite(h)&&h>=F&&(o=!0);var z=D(M,O,x,R),K=p.getLastEstimate(),G=z.bitrate,W=null;o&&void 0!==K&&K>G&&(G=(W=D(M,K,x,R)).bitrate);var H=null;return u&&null!==I&&r.manifest.isDynamic&&y-m.last<40&&(H=k.getGuess(e,Z,I,G,C)),null!==H&&H.bitrate>G?(l.Z.debug("ABR: Choosing representation with guess-based estimation.",H.bitrate,H.id),S.update(H,N,2),{bitrate:N,representation:H,urgent:null===I||H.bitrate=500||404===e.status||415===e.status||412===e.status:e.type===Y.br.TIMEOUT||e.type===Y.br.ERROR_EVENT:e instanceof X.Z?"boolean"==typeof e.canRetry?e.canRetry:void 0!==e.xhr&&(e.xhr.status>=500||404===e.xhr.status||415===e.xhr.status||412===e.xhr.status):(0,Q.Z)(e)&&"INTEGRITY_ERROR"===e.code}function te(e){return e instanceof H.Z?e.type===Y.br.ERROR_EVENT&&!1===navigator.onLine:e instanceof X.Z&&e.isOfflineError}function ne(e,t,n,r,i){return re.apply(this,arguments)}function re(){return re=(0,r.Z)(o().mark((function e(t,n,i,a,s){var u,d,c,f,v,m,g,y,_,b,S,T,E,k;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(k=function(e){var t;if(0===m.size)return e[0];var n=performance.now();return null===(t=e.filter((function(e){var t;return!0!==(null===(t=m.get(e))||void 0===t?void 0:t.isBlacklisted)})).reduce((function(e,t){var r,i=null===(r=m.get(t))||void 0===r?void 0:r.blockedUntil;return void 0!==i&&i<=n&&(i=void 0),void 0===e?[t,i]:void 0===i?void 0===e[1]?e:[t,void 0]:void 0===e[1]?e:iv?(l.blockedUntil=void 0,l.isBlacklisted=!0):(h=l.errorCounter,g=Math.min(u*Math.pow(2,h-1),d),y=(0,J.Z)(g),l.blockedUntil=performance.now()+y),e.abrupt("return",S(e.t0));case 22:case"end":return e.stop()}var o}),e,null,[[0,7]])})))).apply(this,arguments)},_=function(e){return b.apply(this,arguments)},y=function(){if(null===t){var e=m.get(null);if(void 0!==e&&e.isBlacklisted)return;return null}if(null===n)return k(t);var r=n.getCdnPreferenceForResource(t);return k(r)},null===s.cancellationError){e.next=9;break}return e.abrupt("return",Promise.reject(s.cancellationError));case 9:if(u=a.baseDelay,d=a.maxDelay,c=a.maxRetryRegular,f=a.maxRetryOffline,v=a.onRetry,null!==t&&0===t.length&&l.Z.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`."),m=new Map,void 0!==(g=y())){e.next=15;break}throw new Error("No CDN to request");case 15:return e.abrupt("return",_(g));case 16:case"end":return e.stop()}}),e)}))),re.apply(this,arguments)}function ie(e,t,n){return ne(null,null,e,t,n)}function ae(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return oe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oe(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?this._consecutiveUnsafeMode=d,v=void 0===r?0:performance.now()-r,m=Math.max(this._settings.minimumManifestUpdateInterval-v,0),g=new p.ZP;if(g.linkToSignal(this._canceller.signal),this.scheduleManualRefresh=function(t){var i=t.enablePartialRefresh,a=t.delay,o=t.canUseUnsafeMode&&f,s=void 0===r?0:performance.now()-r,u=Math.max(n._settings.minimumManifestUpdateInterval-s,0),l=setTimeout((function(){g.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:i,unsafeMode:o})}),Math.max((null!=a?a:0)-s,u));g.signal.register((function(){clearTimeout(l)}))},null!==e.expired){var y=setTimeout((function(){var t;null===(t=e.expired)||void 0===t||t.then((function(){g.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),h.Z)}),m);g.signal.register((function(){clearTimeout(y)}))}if(void 0!==e.lifetime&&e.lifetime>=0){var _,b=1e3*e.lifetime-v;void 0===c?_=b:e.lifetime<3&&c>=100?(_=Math.min(Math.max(3e3-v,Math.max(b,0)+c),6*b),l.Z.info("MUS: Manifest update rythm is too frequent. Postponing next request.",b,_)):c>=1e3*e.lifetime/10?(_=Math.min(Math.max(b,0)+c,6*b),l.Z.info("MUS: Manifest took too long to parse. Postponing next request",_,_)):_=b;var S=setTimeout((function(){g.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),Math.max(_,m));g.signal.register((function(){clearTimeout(S)}))}},n._triggerNextManifestRefresh=function(e,t){var n,r,i=this,a=t.enablePartialRefresh,o=t.unsafeMode,u=e.updateUrl;null!==this._prioritizedContentUrl?(n=!0,r=this._prioritizedContentUrl,this._prioritizedContentUrl=null):r=(n=!a||void 0===u)?e.getUrl():u;var d=e.clockOffset;o?(this._consecutiveUnsafeMode+=1,l.Z.info('Init: Refreshing the Manifest in "unsafeMode" for the '+String(this._consecutiveUnsafeMode)+" consecutive time.")):this._consecutiveUnsafeMode>0&&(l.Z.info('Init: Not parsing the Manifest in "unsafeMode" anymore after '+String(this._consecutiveUnsafeMode)+" consecutive times."),this._consecutiveUnsafeMode=0),this._isRefreshPending||(this._isRefreshPending=!0,this._fetchManifest(r).then((function(t){return t.parse({externalClockOffset:d,previousManifest:e,unsafeMode:o})})).then((function(t){i._isRefreshPending=!1;var r=t.manifest,a=t.sendingTime,o=t.parsingTime,u=performance.now();if(n)e.replace(r);else try{e.update(r)}catch(t){var d=t instanceof Error?t.message:"unknown error";l.Z.warn("MUS: Attempt to update Manifest failed: "+d,"Re-downloading the Manifest fully");var c=s.Z.getCurrent().FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY,f=void 0===a?0:performance.now()-a,v=Math.max(i._settings.minimumManifestUpdateInterval-f,0),p=h.Z,m=setTimeout((function(){p(),i._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:!1})}),Math.max(c-f,v));return void(p=i._canceller.signal.register((function(){clearTimeout(m)})))}var g=performance.now()-u;i._recursivelyRefreshManifest(e,{sendingTime:a,parsingTime:o,updatingTime:g})})).catch((function(e){i._isRefreshPending=!1,i._onFatalError(e)})))},n._onFatalError=function(e){this._canceller.isUsed()||(this.trigger("error",e),this.dispose())},t}(G.Z);var ue=se;function le(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return de(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return de(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function de(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&this._removeIndexFromDowngradeList(n);var r=s.Z.getCurrent().DEFAULT_CDN_DOWNGRADE_TIME;this._downgradedCdnList.metadata.push(e);var i=window.setTimeout((function(){var n=fe(t._downgradedCdnList.metadata,e);n>=0&&t._removeIndexFromDowngradeList(n),t.trigger("priorityChange",null)}),r);this._downgradedCdnList.timeouts.push(i),this.trigger("priorityChange",null)},n._innerGetCdnPreferenceForResource=function(e){var t=this,n=e.reduce((function(e,n){return t._downgradedCdnList.metadata.some((function(e){return e.id===n.id&&e.baseUrl===n.baseUrl}))?e[1].push(n):e[0].push(n),e}),[[],[]]),r=n[0],i=n[1];return r.concat(i)},n._removeIndexFromDowngradeList=function(e){this._downgradedCdnList.metadata.splice(e,1);var t=this._downgradedCdnList.timeouts.splice(e,1);clearTimeout(t[0])},t}(G.Z);function fe(e,t){return 0===e.length?-1:void 0!==t.id?(0,g.Z)(e,(function(e){return e.id===t.id})):(0,g.Z)(e,(function(e){return e.baseUrl===t.baseUrl}))}var ve=n(520),pe=n(7714),he=n(908),me=function(){function e(){this._cache=new WeakMap}var t=e.prototype;return t.add=function(e,t){var n=e.representation;e.segment.isInit&&this._cache.set(n,t)},t.get=function(e){var t=e.representation;if(e.segment.isInit){var n=this._cache.get(t);if(void 0!==n)return n}return null},e}(),ge=(0,he.Z)();var ye=function(){function e(e){var t=e.prioritySteps;if(this._minPendingPriority=null,this._waitingQueue=[],this._pendingTasks=[],this._prioritySteps=t,this._prioritySteps.high>=this._prioritySteps.low)throw new Error("TP: the max high level priority should be given a lowerpriority number than the min low priority.")}var t=e.prototype;return t.create=function(e,t,n,r){var i,a=this;return(0,c.Z)(r,(function(o,s){return i={hasEnded:!1,priority:t,trigger:function(){if(!i.hasEnded){var e=function(){u(),a._endTask(i)},t=new p.ZP,u=t.linkToSignal(r);i.interrupter=t,t.signal.register((function(){i.interrupter=null,r.isCancelled()||n.beforeInterrupted()})),a._minPendingPriority=null===a._minPendingPriority?i.priority:Math.min(a._minPendingPriority,i.priority),a._pendingTasks.push(i),i.taskFn(t.signal).then((function(t){n.beforeEnded(),e(),o(t)})).catch((function(n){!r.isCancelled()&&t.isUsed()&&n instanceof p.FU||function(t){e(),s(t)}(n)}))}},taskFn:e,interrupter:null},a._canBeStartedNow(i)?(i.trigger(),a._isRunningHighPriorityTasks()&&a._interruptCancellableTasks()):a._waitingQueue.push(i),function(){return a._endTask(i)}}))},t._endTask=function(e){e.hasEnded=!0;var t=_e(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=_e(e.taskFn,this._pendingTasks);if(n<0)return;this._pendingTasks.splice(n,1),this._pendingTasks.length>0?this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))):this._minPendingPriority=null,this._loopThroughWaitingQueue()}},t.updatePriority=function(e,t){var n=_e(e,this._waitingQueue);if(n>=0){var r=this._waitingQueue[n];if(r.priority===t)return;if(r.priority=t,!this._canBeStartedNow(r))return;return this._findAndRunWaitingQueueTask(n),void(this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks())}var i=_e(e,this._pendingTasks);if(i<0)l.Z.warn("TP: request to update the priority of a non-existent task");else{var a=this._pendingTasks[i];if(a.priority!==t){var o=a.priority;a.priority=t,null===this._minPendingPriority||tt.priority?t.priority:e}),null);if(!(null===e||null!==this._minPendingPriority&&this._minPendingPriority=this._prioritySteps.low)return this._interruptPendingTask(t),this._interruptCancellableTasks()}},t._findAndRunWaitingQueueTask=function(e){return e>=this._waitingQueue.length||e<0?(l.Z.warn("TP : Tried to start a non existing task"),!1):(this._waitingQueue.splice(e,1)[0].trigger(),!0)},t._interruptPendingTask=function(e){var t,n=_e(e.taskFn,this._pendingTasks);n<0?l.Z.warn("TP: Interrupting a non-existent pending task. Aborting..."):(this._pendingTasks.splice(n,1),this._waitingQueue.push(e),0===this._pendingTasks.length?this._minPendingPriority=null:this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))),null===(t=e.interrupter)||void 0===t||t.cancel())},t._canBeStartedNow=function(e){return null===this._minPendingPriority||e.priority<=this._minPendingPriority},t._isRunningHighPriorityTasks=function(){return null!==this._minPendingPriority&&this._minPendingPriority<=this._prioritySteps.high},e}();function _e(e,t){return(0,g.Z)(t,(function(t){return t.taskFn===e}))}var be=function(){function e(e,t,n){var r=new ce(n),i=s.Z.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new ye({prioritySteps:{high:o,low:a}}),this._cdnPrioritizer=r,this._backoffOptions=t}return e.prototype.createSegmentFetcher=function(e,t){var n,i,a,u=function(e,t){var n=t.maxRetryRegular,r=t.maxRetryOffline,i=t.lowLatencyMode,a=t.requestTimeout,o=s.Z.getCurrent(),u=o.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,l=o.DEFAULT_REQUEST_TIMEOUT,d=o.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE,c=o.INITIAL_BACKOFF_DELAY_BASE,f=o.MAX_BACKOFF_DELAY_BASE;return{maxRetryRegular:"image"===e?0:null!=n?n:u,maxRetryOffline:null!=r?r:d,baseDelay:i?c.LOW_LATENCY:c.REGULAR,maxDelay:i?f.LOW_LATENCY:f.REGULAR,requestTimeout:(0,W.Z)(a)?l:a}}(e,this._backoffOptions),d=function(e,t,n,i,a){var s={timeout:a.requestTimeout<0?void 0:a.requestTimeout},u=(0,pe.Z)(["audio","video"],e)?new me:void 0,d=t.loadSegment,c=t.parseSegment;return function(){var e=(0,r.Z)(o().mark((function e(t,r,v){var h,m,g,y,_,b,S,T,E,k,w,A,I,Z,x,R,M,C;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(C=function(){var e;E||!(0,W.Z)(b)&&void 0!==b.size&&void 0!==b.requestDuration&&S.length>0&&S.every((function(e){return e}))&&(E=!0,null===(e=i.onMetrics)||void 0===e||e.call(i,{size:b.size,requestDuration:b.requestDuration,content:t,segmentDuration:T}))},M=function(e){r.onRetry(q(e))},R=function(e,n){S.push(!1);var r=S.length-1;return function(i){var a={data:e,isChunked:n};try{var o=c(a,t,i);return S[r]||(T=void 0!==T&&"media"===o.segmentType&&null!==o.chunkInfos&&void 0!==o.chunkInfos.duration?T+o.chunkInfos.duration:void 0,S[r]=!0,C()),o}catch(e){throw(0,z.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown parsing error"})}}},x=function(e){return d(e,t,s,v,k)},Z=function(){var e;void 0===b&&(l.Z.debug("SF: Segment request cancelled",y),b=null,null===(e=i.onRequestEnd)||void 0===e||e.call(i,{id:_}))},y=(0,ve.K)(t),_=ge(),S=[],T=0,E=!1,k={onProgress:function(e){var t;void 0===b&&void 0!==e.totalSize&&e.size0;){var e=this._queue.shift();void 0!==e&&e.reject(new p.FU)}if("open"===this._mediaSource.readyState)try{l.Z.debug("AVSB: Calling `abort` on the SourceBuffer"),this._sourceBuffer.abort()}catch(e){l.Z.warn("AVSB: Failed to abort a "+this.bufferType+" SourceBuffer:",e instanceof Error?e:"")}},n._onPendingTaskError=function(e){if(this._lastInitSegmentUniqueId=null,null!==this._pendingTask){var t=e instanceof Error?e:new Error("An unknown error occured when doing operations on the SourceBuffer"),n=this._pendingTask;n.type===we.f.Push&&0===n.data.length&&null!==n.inventoryData&&this._segmentInventory.insertChunk(n.inventoryData,!1),this._pendingTask=null,n.reject(t)}},n._addToQueue=function(e,t){var n=this;return(0,c.Z)(t,(function(t,r){var i=0===n._queue.length&&null===n._pendingTask,a=(0,f.Z)({resolve:t,reject:r},e);return n._queue.push(a),i&&n._flush(),function(){var e=n._queue.indexOf(a);e>=0&&n._queue.splice(e,1),a.resolve=h.Z,a.reject=h.Z}}))},n._flush=function(){if(!this._sourceBuffer.updating){if(null!==this._pendingTask){var e=this._pendingTask;if(e.type!==we.f.Push||0===e.data.length){switch(e.type){case we.f.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData,!0);break;case we.f.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case we.f.Remove:this.synchronizeInventory();break;default:(0,ke.Z)(e)}var t=e.resolve;return this._pendingTask=null,t(),void this._flush()}}else{var n=this._queue.shift();if(void 0===n)return;if(n.type!==we.f.Push)this._pendingTask=n;else{var r,i=n.value;try{r=this._preparePushOperation(i.data)}catch(e){this._pendingTask=(0,f.Z)({data:[],inventoryData:i.inventoryInfos},n);var a=e instanceof Error?e:new Error("An unknown error occured when preparing a push operation");return this._lastInitSegmentUniqueId=null,void n.reject(a)}this._pendingTask=(0,f.Z)({data:r,inventoryData:i.inventoryInfos},n)}}try{switch(this._pendingTask.type){case we.f.EndOfSegment:return l.Z.debug("AVSB: Acknowledging complete segment",(0,ve.K)(this._pendingTask.value)),void this._flush();case we.f.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();l.Z.debug("AVSB: pushing segment",this.bufferType,(0,ve.K)(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case we.f.Remove:var s=this._pendingTask.value,u=s.start,d=s.end;l.Z.debug("AVSB: removing data from SourceBuffer",this.bufferType,u,d),this._sourceBuffer.remove(u,d);break;default:(0,ke.Z)(this._pendingTask)}}catch(e){this._onPendingTaskError(e)}}},n._preparePushOperation=function(e){var t=[],n=e.codec,r=e.timestampOffset,i=e.appendWindow,a=!1;if(void 0!==n&&n!==this.codec&&(l.Z.debug("AVSB: updating codec",n),a=function(e,t){if("function"==typeof e.changeType){try{e.changeType(t)}catch(e){return l.Z.warn("Could not call 'changeType' on the given SourceBuffer:",e instanceof Error?e:""),!1}return!0}return!1}(this._sourceBuffer,n),a?this.codec=n:l.Z.debug("AVSB: could not update codec",n,this.codec)),this._sourceBuffer.timestampOffset!==r){var o=r;l.Z.debug("AVSB: updating timestampOffset",this.bufferType,this._sourceBuffer.timestampOffset,o),this._sourceBuffer.timestampOffset=o}if(void 0===i[0])this._sourceBuffer.appendWindowStart>0&&(l.Z.debug("AVSB: re-setting `appendWindowStart` to `0`"),this._sourceBuffer.appendWindowStart=0);else if(i[0]!==this._sourceBuffer.appendWindowStart){if(i[0]>=this._sourceBuffer.appendWindowEnd){var s=i[0]+1;l.Z.debug("AVSB: pre-updating `appendWindowEnd`",s),this._sourceBuffer.appendWindowEnd=s}l.Z.debug("AVSB: setting `appendWindowStart`",i[0]),this._sourceBuffer.appendWindowStart=i[0]}if(void 0===i[1]?this._sourceBuffer.appendWindowEnd!==1/0&&(l.Z.debug("AVSB: re-setting `appendWindowEnd` to `Infinity`"),this._sourceBuffer.appendWindowEnd=1/0):i[1]!==this._sourceBuffer.appendWindowEnd&&(l.Z.debug("AVSB: setting `appendWindowEnd`",i[1]),this._sourceBuffer.appendWindowEnd=i[1]),null!==e.initSegmentUniqueId&&(a||!this._isLastInitSegment(e.initSegmentUniqueId))){var u=this._initSegmentsMap.get(e.initSegmentUniqueId);if(void 0===u)throw new Error("Invalid initialization segment uniqueId");t.push(u),this._lastInitSegmentUniqueId=e.initSegmentUniqueId}return null!==e.chunk&&t.push(e.chunk),t},n._isLastInitSegment=function(e){return null!==this._lastInitSegmentUniqueId&&this._lastInitSegmentUniqueId===e},t}(we.C),Ze=["audio","video","text","image"];function xe(e){return"audio"===e||"video"===e}var Re=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return xe(e)};var t=e.prototype;return t.getBufferTypes=function(){var e=this.getNativeBufferTypes();return null==Te.Z.nativeTextTracksBuffer&&null==Te.Z.htmlTextTracksBuffer||e.push("text"),null!=Te.Z.imageBuffer&&e.push("image"),e},t.getNativeBufferTypes=function(){return"AUDIO"===this._mediaElement.nodeName?["audio"]:["video","audio"]},t.getStatus=function(e){var t=this._initializedSegmentBuffers[e];return void 0===t?{type:"uninitialized"}:null===t?{type:"disabled"}:{type:"initialized",value:t}},t.waitForUsableBuffers=function(e){var t=this;return this._areNativeBuffersUsable()?Promise.resolve():(0,c.Z)(e,(function(e){var n,r=function(){var e=t._onNativeBufferAddedOrDisabled.indexOf(n);e>=0&&t._onNativeBufferAddedOrDisabled.splice(e,1)};return n=function(){t._areNativeBuffersUsable()&&(r(),e())},t._onNativeBufferAddedOrDisabled.push(n),r}))},t.disableSegmentBuffer=function(t){var n=this._initializedSegmentBuffers[t];if(null!==n){if(void 0!==n)throw new Error("Cannot disable an active SegmentBuffer.");this._initializedSegmentBuffers[t]=null,e.isNative(t)&&this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()}))}else l.Z.warn("SBS: The "+t+" SegmentBuffer was already disabled.")},t.createSegmentBuffer=function(e,t,n){void 0===n&&(n={});var r,i=this._initializedSegmentBuffers[e];if(xe(e)){if(null!=i)return i instanceof Ie&&i.codec!==t?l.Z.warn("SB: Reusing native SegmentBuffer with codec",i.codec,"for codec",t):l.Z.info("SB: Reusing native SegmentBuffer with codec",t),i;l.Z.info("SB: Adding native SegmentBuffer with codec",t);var a=new Ie(e,t,this._mediaSource);return this._initializedSegmentBuffers[e]=a,this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()})),a}if(null!=i)return l.Z.info("SB: Reusing a previous custom SegmentBuffer for the type",e),i;if("text"===e){if(l.Z.info("SB: Creating a new text SegmentBuffer"),"html"===n.textTrackMode){if(null==Te.Z.htmlTextTracksBuffer)throw new Error("HTML Text track feature not activated");r=new Te.Z.htmlTextTracksBuffer(this._mediaElement,n.textTrackElement)}else{if(null==Te.Z.nativeTextTracksBuffer)throw new Error("Native Text track feature not activated");r=new Te.Z.nativeTextTracksBuffer(this._mediaElement,!0===n.hideNativeSubtitle)}return this._initializedSegmentBuffers.text=r,r}if("image"===e){if(null==Te.Z.imageBuffer)throw new Error("Image buffer feature not activated");return l.Z.info("SB: Creating a new image SegmentBuffer"),r=new Te.Z.imageBuffer,this._initializedSegmentBuffers.image=r,r}throw l.Z.error("SB: Unknown buffer type:",e),new u.Z("BUFFER_TYPE_UNKNOWN","The player wants to create a SegmentBuffer of an unknown type.")},t.disposeSegmentBuffer=function(e){var t=this._initializedSegmentBuffers[e];null!=t?(l.Z.info("SB: Aborting SegmentBuffer",e),t.dispose(),delete this._initializedSegmentBuffers[e]):l.Z.warn("SB: Trying to dispose a SegmentBuffer that does not exist")},t.disposeAll=function(){var e=this;Ze.forEach((function(t){"initialized"===e.getStatus(t).type&&e.disposeSegmentBuffer(t)}))},t._areNativeBuffersUsable=function(){var e=this,t=this.getNativeBufferTypes();return!t.some((function(t){return void 0===e._initializedSegmentBuffers[t]}))&&!t.every((function(t){return null===e._initializedSegmentBuffers[t]}))},e}(),Me=n(7473),Ce=n.n(Me),Pe=n(3146),De=function(){function e(e){this._weakMap=new WeakMap,this._fn=e}var t=e.prototype;return t.get=function(e){var t=this._weakMap.get(e);if(void 0===t){var n=this._fn(e);return this._weakMap.set(e,n),n}return t},t.destroy=function(e){this._weakMap.delete(e)},e}();function Ne(e,t){var n,r=e.segmentBuffer,i=e.playbackObserver,a=e.maxBufferBehind,o=e.maxBufferAhead;function s(){(function(e,t,n,r,i){return Oe.apply(this,arguments)})(r,n,a.getValue(),o.getValue(),t).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";l.Z.error("Could not run BufferGarbageCollector:",t)}))}i.listen((function(e){var t;n=null!==(t=e.position.pending)&&void 0!==t?t:e.position.last,s()}),{includeLastObservation:!0,clearSignal:t}),a.onUpdate(s,{clearSignal:t}),o.onUpdate(s,{clearSignal:t}),s()}function Oe(){return(Oe=(0,r.Z)(o().mark((function e(t,n,r,i,a){var s,u,d,c,f,v,p,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(isFinite(r)||isFinite(i)){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:s=[],u=(0,m.F_)(t.getBufferedRanges(),n),d=u.innerRange,c=u.outerRanges,f=function(){if(isFinite(i)){for(var e=0;et.start&&s.push({start:n+i,end:t.end})}null!=d&&n+i=t.end?s.push(t):n>=t.end&&n-r>t.start&&n-rd.start&&s.push({start:d.start,end:n-r})}}(),f(),v=0,p=s;case 9:if(!(v0&&n[0].segment.id===e._mediaSegmentAwaitingInitMetadata)){var r=e._mediaSegmentRequest;if(0===n.length){if(null===r)return;return l.Z.debug("Stream: no more media segment to request. Cancelling queue.",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()}if(null===r)return l.Z.debug("Stream: Media segments now need to be requested. Starting queue.",e._content.adaptation.type,n.length),void e._restartMediaSegmentDownloadingQueue();var i=n[0];return r.segment.id!==i.segment.id?(l.Z.debug("Stream: Next media segment changed, cancelling previous",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()):void(r.priority!==i.priority&&(l.Z.debug("Stream: Priority of next media segment changed, updating",e._content.adaptation.type,r.priority,i.priority),e._segmentFetcher.updatePriority(r.request,i.priority)))}}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}),this._downloadQueue.onUpdate((function(t){var n,r=e._initSegmentRequest;null===t.initSegment||null===r?(null===(n=t.initSegment)||void 0===n?void 0:n.segment.id)!==(null==r?void 0:r.segment.id)&&(null===t.initSegment&&l.Z.debug("Stream: no more init segment to request. Cancelling queue.",e._content.adaptation.type),e._restartInitSegmentDownloadingQueue(t.initSegment)):t.initSegment.priority!==r.priority&&e._segmentFetcher.updatePriority(r.request,t.initSegment.priority)}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}))},n.stop=function(){var e;null===(e=this._currentCanceller)||void 0===e||e.cancel(),this._currentCanceller=null},n._restartMediaSegmentDownloadingQueue=function(){var e=this;null!==this._mediaSegmentRequest&&this._mediaSegmentRequest.canceller.cancel();!function t(n){if(null!==e._currentCanceller&&e._currentCanceller.isUsed())e._mediaSegmentRequest=null;else{if(void 0===n)return e._mediaSegmentRequest=null,void e.trigger("emptyQueue",null);var r=new p.ZP,i=null===e._currentCanceller?h.Z:r.linkToSignal(e._currentCanceller.signal),a=n.segment,o=n.priority,s=(0,f.Z)({segment:a},e._content),u=!1,c=!1;r.signal.register((function(){e._mediaSegmentRequest=null,u||(e._mediaSegmentAwaitingInitMetadata===a.id&&(e._mediaSegmentAwaitingInitMetadata=null),u=!0,c=!1)}));var v=function(t){(0,d.Z)("media"===t.segmentType,"Should have loaded a media segment."),e.trigger("parsedMediaSegment",(0,f.Z)({},t,{segment:a}))},m=function(){var n=e._downloadQueue.getValue().segmentQueue;if(0===n.length)return u=!0,void e.trigger("emptyQueue",null);n[0].segment.id===a.id&&n.shift(),u=!0,t(n[0])},g=e._segmentFetcher.createRequest(s,o,{onRetry:function(t){e.trigger("requestRetry",{segment:a,error:t})},beforeInterrupted:function(){l.Z.info("Stream: segment request interrupted temporarly.",a.id,a.time)},onChunk:function(t){var n=e._initSegmentInfoRef.getValue();void 0!==n?v(t(null!=n?n:void 0)):(c=!0,e._initSegmentInfoRef.waitUntilDefined((function(e){v(t(null!=e?e:void 0))}),{clearSignal:r.signal}))},onAllChunksReceived:function(){c?(e._mediaSegmentAwaitingInitMetadata=a.id,e._initSegmentInfoRef.waitUntilDefined((function(){e._mediaSegmentAwaitingInitMetadata=null,c=!1,e.trigger("fullyLoadedSegment",a)}),{clearSignal:r.signal})):e.trigger("fullyLoadedSegment",a)},beforeEnded:function(){i(),e._mediaSegmentRequest=null,c?e._initSegmentInfoRef.waitUntilDefined(m,{clearSignal:r.signal}):m()}},r.signal);g.catch((function(t){i(),u||(u=!0,e.stop(),e.trigger("error",t))})),e._mediaSegmentRequest={segment:a,priority:o,request:g,canceller:r}}}(this._downloadQueue.getValue().segmentQueue[0])},n._restartInitSegmentDownloadingQueue=function(e){var t=this;if((null===this._currentCanceller||!this._currentCanceller.isUsed())&&(null!==this._initSegmentRequest&&this._initSegmentRequest.canceller.cancel(),null!==e)){var n=new p.ZP,r=null===this._currentCanceller?h.Z:n.linkToSignal(this._currentCanceller.signal),i=e.segment,a=e.priority,o=(0,f.Z)({segment:i},this._content),s=!1,u=this._segmentFetcher.createRequest(o,a,{onRetry:function(e){t.trigger("requestRetry",{segment:i,error:e})},beforeInterrupted:function(){l.Z.info("Stream: init segment request interrupted temporarly.",i.id)},beforeEnded:function(){r(),t._initSegmentRequest=null,s=!0},onChunk:function(e){var n,r=e(void 0);(0,d.Z)("init"===r.segmentType,"Should have loaded an init segment."),t.trigger("parsedInitSegment",(0,f.Z)({},r,{segment:i})),"init"===r.segmentType&&t._initSegmentInfoRef.setValue(null!==(n=r.initTimescale)&&void 0!==n?n:null)},onAllChunksReceived:function(){t.trigger("fullyLoadedSegment",i)}},n.signal);u.catch((function(e){r(),s||(s=!0,t.stop(),t.trigger("error",e))})),n.signal.register((function(){t._initSegmentRequest=null,s||(s=!0)})),this._initSegmentRequest={segment:i,priority:a,request:u,canceller:n}}},t}(G.Z);function Ue(e,t,n,r,i){var a=e.period,o=e.adaptation,s=e.representation,u=function(e,t){for(var n=0;n=t.end)return null;if(r.bufferedEnd>t.start)return n}return null}(i,t);if(null===u){if(null===n){if(r&&void 0!==a.end&&t.end>=a.end)return{start:void 0,end:null};var d=s.index.checkDiscontinuity(t.start);if(null!==d)return{start:void 0,end:d}}return null}var c=i[u];if(void 0!==c.bufferedStart&&c.bufferedStart>t.start&&(null===n||c.infos.segment.end<=n)){var f=c.bufferedStart;return r||!1===s.index.awaitSegmentBetween(t.start,f)?(l.Z.debug("RS: current discontinuity encountered",o.type,c.bufferedStart),{start:void 0,end:f}):null}var v=function(e,t,n){if(n<=0)return l.Z.error("RS: Asked to check a discontinuity before the first chunk."),null;for(var r=n;r=t.end)return null;if(i.bufferedStart-a.bufferedEnd>0)return r}return null}(i,t,u+1);if(null!==v){var p=i[v-1],h=i[v];if(null===n||h.infos.segment.end<=n){if(!r&&!1!==s.index.awaitSegmentBetween(p.infos.segment.end,h.infos.segment.time))return null;var m=p.bufferedEnd,g=h.bufferedStart;return l.Z.debug("RS: future discontinuity encountered",o.type,m,g),{start:m,end:g}}}if(null===n){if(r&&void 0!==a.end){if(t.end=0;n--){var r=e[n];if(void 0===r.bufferedStart)return null;if(r.bufferedStart=a.end)return null;for(var b=i.length-1;b>=0;b--){var S=i[b];if(void 0===S.bufferedStart)break;if(S.bufferedStart=n.length-1?null:n[t+1],u=null;if(function(e,t,n){var r=s.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedStart)return l.Z.warn("Stream: Start of a segment unknown. Assuming it is garbage collected by default.",e.start),!0;if(null!==t&&void 0!==t.bufferedEnd&&e.bufferedStart-t.bufferedEnd<.1)return!1;if(nr)return l.Z.info("Stream: The start of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,r,o.start)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.start;if(void 0!==t&&void 0!==a&&t-a>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.start;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(u=a(e.infos),e.bufferedStart))return!1;l.Z.debug("Stream: skipping segment gc-ed at the start",e.start,e.bufferedStart)}if(function(e,t,n){var r=s.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedEnd)return l.Z.warn("Stream: End of a segment unknown. Assuming it is garbage collected by default.",e.end),!0;if(null!==t&&void 0!==t.bufferedStart&&t.bufferedStart-e.bufferedEnd<.1)return!1;if(n>e.bufferedEnd&&e.end-e.bufferedEnd>r)return l.Z.info("Stream: The end of the wanted segment has been garbage collected",e.end,e.bufferedEnd),!0;return!1}(e,i,o.end)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.end;if(void 0!==t&&void 0!==a&&a-t>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.end;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(u=null!=u?u:a(e.infos),e.bufferedEnd))return!1;l.Z.debug("Stream: skipping segment gc-ed at the end",e.end,e.bufferedEnd)}return!0})),g=s.Z.getCurrent(),y=g.MINIMUM_SEGMENT_SIZE,_=g.MIN_BUFFER_AHEAD,b=!1,S=Math.min(1/60,y),T=!1,E=[],k=h.filter((function(e){var t=(0,f.Z)({segment:e},n);if(u.length>0&&u.some((function(e){return(0,ve.z)(t,e)})))return!1;var s=e.duration,d=e.time,h=e.end;if(e.isInit)return!0;if(b)return E.push(e),!1;if(e.complete&&s0&&u.some((function(e){if(e.period.id!==n.period.id||e.adaptation.id!==n.adaptation.id)return!1;var a=e.segment;return!(a.time-S>d)&&(!(a.end+S-S&&w.end-h>-S)return!1}}var A=s*n.representation.bitrate;if(p-A<0&&(T=!0,d>o.start+_))return b=!0,E.push(e),!1;var I=a(t);if(I.length>1){var Z=I[I.length-1],x=I[I.length-2];if(null===Z.buffered&&null===x.buffered)return l.Z.warn("Stream: Segment GCed multiple times in a row, ignoring it.","If this happens a lot and lead to unpleasant experience, please check your device's available memory. If it's low when this message is emitted, you might want to update the RxPlayer's settings (`maxBufferAhead`, `maxVideoBufferSize` etc.) so less memory is used by regular media data buffering."+c.type,v.id,e.time),!1}for(var R=0;Rd){var C=M.start>d+S||Fe(m,R).ende[n].start;)n++;return e[--n]}function Ve(e,t,n,r){var i=s.Z.getCurrent().CONTENT_REPLACEMENT_PADDING;return e.period.id===t.period.id&&(!(e.segment.timea}return rr}(e.representation,t.representation,r)))}function ze(e,t){for(var n=e-t,r=s.Z.getCurrent().SEGMENT_PRIORITIES_STEPS,i=0;i=u&&l.isInitialized()&&!l.isStillAwaitingFutureSegments()&&function(e,t,n){var r,i=e.getPeriodAfter(t);return t.containsTime(n,i)&&e.isLastPeriodKnown&&t.id===(null===(r=e.periods[e.periods.length-1])||void 0===r?void 0:r.id)}(a,o,t)?u-1:t-.1;var d,c=i+n;d=!(!s.index.isInitialized()||s.index.isStillAwaitingFutureSegments()||void 0===o.end)&&(void 0===u?c>=o.end:null===u||c>=u);return{start:Math.max(i,o.start),end:Math.min(c,null!==(r=o.end)&&void 0!==r?r:1/0),hasReachedPeriodEnd:d}}(e,l,i),c=u.index.shouldRefresh(d.start,d.end),f=o.getPendingOperations().filter((function(e){return e.type===we.f.EndOfSegment})).map((function(e){return e.value})),v=function(e,t){for(var n=s.Z.getCurrent().MINIMUM_SEGMENT_SIZE,r=Math.max(1/60,n),i=e.start+r,a=e.end-r,o=[],u=t.length-1;u>=0;u--){var l=t[u],d=l.infos.representation;if(1===l.status&&!1!==d.decipherable&&d.isSupported){var c=l.infos.segment,f=c.time/c.timescale;((c.complete?f+c.duration/c.timescale:l.end)>i&&fi&&l.start0&&(b=Math.min.apply(Math,f.map((function(e){return e.segment.time})))),m.length>0&&(b=null!==b?Math.min(b,m[0].time):m[0].time),y.length>0&&(b=null!==b?Math.min(b,y[0].segment.time):y[0].segment.time),{imminentDiscontinuity:Ue(e,d,b,_,v),hasFinishedLoading:_,neededSegments:y,isBufferFull:g,shouldRefreshManifest:c}}function Ge(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return We(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return We(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function We(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nu.end||e+ni.start&&o.push({start:i.start,end:e-n}),e+n0&&Z.every((function(e){return void 0!==e.keyIds}))&&(I=!0,t.encryptionDataEncountered(Z.map((function(e){return(0,f.Z)({content:r},e)}))),T.isUsed()))return}var x=new Le(r,w,u,A);return x.addEventListener("error",(function(e){E.signal.isCancelled()||(T.cancel(),t.error(e))})),x.addEventListener("parsedInitSegment",M),x.addEventListener("parsedMediaSegment",M),x.addEventListener("emptyQueue",R),x.addEventListener("requestRetry",(function(e){if(t.warning(e.error),!E.signal.isCancelled()){var n=e.segment,r=m.index;!1===r.isSegmentStillAvailable(n)?R():r.canBeOutOfSyncError(e.error,n)&&t.manifestMightBeOufOfSync()}})),x.addEventListener("fullyLoadedSegment",(function(e){o.endOfSegment((0,f.Z)({segment:e},r),T.signal).catch(C)})),x.start(),E.signal.register((function(){x.removeEventListener(),x.stop()})),a.listen(R,{includeLastObservation:!1,clearSignal:E.signal}),r.manifest.addEventListener("manifestUpdate",R,E.signal),g.onUpdate(R,{emitCurrentValue:!1,clearSignal:E.signal}),y.onUpdate(R,{emitCurrentValue:!1,clearSignal:E.signal}),d.onUpdate(R,{emitCurrentValue:!1,clearSignal:E.signal}),void R();function R(){var e,n;if(!E.isUsed()){var i=a.getReference().getValue(),u=null!==(e=i.position.pending)&&void 0!==e?e:i.position.last,f=Ke(r,u,a,b.getValue(),g.getValue(),y.getValue(),o),v=f.neededSegments,p=null;if(m.index.isInitialized()){if(v.length>0&&!k.isLoaded&&null!==k.segment){var h=v[0].priority;p={segment:k.segment,priority:h}}}else if(null===k.segment)l.Z.warn("Stream: Uninitialized index without an initialization segment");else if(k.isLoaded)l.Z.warn("Stream: Uninitialized index with an already loaded initialization segment");else{var _=null!==(n=i.position.pending)&&void 0!==n?n:i.position.last;p={segment:k.segment,priority:ze(c.start,_)}}var A=d.getValue();if(null===A)w.setValue({initSegment:p,segmentQueue:v});else{if(A.urgent)return l.Z.debug("Stream: Urgent switch, terminate now.",S),w.setValue({initSegment:null,segmentQueue:[]}),w.finish(),E.cancel(),void t.terminating();var I=v[0],Z=x.getRequestedInitSegment(),R=x.getRequestedMediaSegment(),M=null===R||void 0===I||R.id!==I.segment.id?[]:[I],P=null===Z?null:p;if(w.setValue({initSegment:P,segmentQueue:M}),0===M.length&&null===P)return l.Z.debug("Stream: No request left, terminate",S),w.finish(),E.cancel(),void t.terminating()}if(t.streamStatusUpdate({period:c,position:i.position.last,bufferType:S,imminentDiscontinuity:f.imminentDiscontinuity,isEmptyStream:!1,hasFinishedLoading:f.hasFinishedLoading,neededSegments:f.neededSegments}),!E.signal.isCancelled()){var D=s.Z.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;if(f.isBufferFull){var N=Math.max(0,u-D);N>0&&o.removeBuffer(0,N,T.signal).catch(C)}f.shouldRefreshManifest&&t.needsManifestRefresh()}}}function M(e){if(!T.isUsed())if("init"===e.segmentType){if(k.isLoaded=!0,!I){var n=m.getAllEncryptionData();if(n.length>0&&(t.encryptionDataEncountered(n.map((function(e){return(0,f.Z)({content:r},e)}))),T.isUsed()))return}if(null!==e.initializationData){var i=m.uniqueId;k.uniqueId=i,o.declareInitSegment(i,e.initializationData),function(e,t){return Qe.apply(this,arguments)}({playbackObserver:a,content:r,initSegmentUniqueId:i,segment:e.segment,segmentData:e.initializationData,segmentBuffer:o},T.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C)}R()}else{var s=e.inbandEvents,u=e.needsManifestRefresh,l=e.protectionDataUpdate;if(!I&&l){var d=m.getAllEncryptionData();if(d.length>0&&(t.encryptionDataEncountered(d.map((function(e){return(0,f.Z)({content:r},e)}))),T.isUsed()))return}if(!0===u&&(t.needsManifestRefresh(),T.isUsed()))return;if(void 0!==s&&s.length>0&&(t.inbandEvent(s),T.isUsed()))return;var c=k.uniqueId;(function(e,t){return $e.apply(this,arguments)})({playbackObserver:a,content:r,initSegmentUniqueId:c,parsedSegment:e,segment:e.segment,segmentBuffer:o},T.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C)}}function C(e){T.isUsed()&&e instanceof p.FU||(T.cancel(),t.error(e))}};var et=function(e,t,n){var r=e.playbackObserver,i=e.content,a=e.options,o=e.representationEstimator,d=e.segmentBuffer,c=e.segmentFetcherCreator,m=e.wantedBufferAhead,g=e.maxVideoBufferSize,y="direct"===a.manualBitrateSwitchingMode,_=i.manifest,b=i.period,S=i.adaptation,T=new p.ZP;T.linkToSignal(n);var E,k=new Map,w=new v.Z(null,T.signal),A=function(e,t,n,r,i,a){var o=e.manifest,s=e.adaptation,l=new v.Z([],a);p(),o.addEventListener("decipherabilityUpdate",p);var d=a.register(h),c=t(e,n,l,r,a),f=c.estimates;return{abrCallbacks:c.callbacks,estimateRef:f};function p(){var e=s.getPlayableRepresentations();if(0===e.length){var t=new u.Z("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+s.type+" Adaptation can be played",{adaptation:s});return h(),void i(t)}var n=l.getValue();n.length===e.length&&n.every((function(t,n){return t.id===e[n].id}))||l.setValue(e)}function h(){o.removeEventListener("decipherabilityUpdate",p),void 0!==d&&d()}}(i,o,w,r,(function(e){T.cancel(),t.error(e)}),T.signal),I=A.estimateRef,Z=A.abrCallbacks,x=c.createSegmentFetcher(S.type,{onRequestBegin:Z.requestBegin,onRequestEnd:Z.requestEnd,onProgress:Z.requestProgress,onMetrics:Z.metrics});function R(e,t,n,i){var o=new p.ZP;o.linkToSignal(T.signal);var s=(0,v.l)(m,(function(t){return t*function(e){var t=k.get(e.id),n=void 0!==t?t:1;void 0===t&&k.set(e.id,n);return n}(e)}),o.signal),u="video"===S.type?g:new v.Z(1/0);l.Z.info("Stream: changing representation",S.type,e.id,e.bitrate);var c=(0,f.Z)({},i,{error:function(r){var a,o=(0,z.Z)(r,{defaultCode:"NONE",defaultReason:"Unknown `RepresentationStream` error"});if("BUFFER_FULL_ERROR"!==o.code)i.error(r);else{var s=m.getValue(),u=.7*(null!==(a=k.get(e.id))&&void 0!==a?a:1);if(u<=.05||s*u<=2)throw o;k.set(e.id,u),(0,$.Z)(4e3,T.signal).then((function(){return R(e,t,n,i)})).catch(h.Z)}},terminating:function(){o.cancel(),i.terminating()}});Je({playbackObserver:r,content:{representation:e,adaptation:S,period:b,manifest:_},segmentBuffer:d,segmentFetcher:x,terminate:t,options:{bufferGoal:s,maxBufferSize:u,drmSystemId:a.drmSystemId,fastSwitchThreshold:n}},c,T.signal)}I.onUpdate((function(e){var n=e.bitrate;void 0!==n&&n!==E&&(E=n,l.Z.debug("Stream: new "+S.type+" bitrate estimate",n),t.bitrateEstimationChange({type:S.type,bitrate:n}))}),{emitCurrentValue:!0,clearSignal:T.signal}),function e(n){var r=new p.ZP;r.linkToSignal(T.signal);var i=I.getValue(),o=i.representation,u=i.manual;if(null===o)return;if(y&&u&&!n){var d=s.Z.getCurrent().DELTA_POSITION_AFTER_RELOAD;return Ce()((function(){if(!r.isUsed()&&I.getValue().manual){var e=d.bitrateSwitch;return t.waitingMediaSourceReload({bufferType:S.type,period:b,timeOffset:e,stayInPeriod:!0})}}))}var c=new v.Z(null,r.signal);I.onUpdate((function(e){if(null!==e.representation&&e.representation.id!==o.id)return e.urgent?(l.Z.info("Stream: urgent Representation switch",S.type),c.setValue({urgent:!0})):(l.Z.info("Stream: slow Representation switch",S.type),c.setValue({urgent:!1}))}),{clearSignal:r.signal,emitCurrentValue:!0});var f=new v.Z(0);a.enableFastSwitching&&I.onUpdate((function(e){f.setValueIfChanged(null==e?void 0:e.knownStableBitrate)}),{clearSignal:r.signal,emitCurrentValue:!0});var h={type:S.type,period:b,representation:o};if(w.setValue(o),T.isUsed())return;if(t.representationChange(h),T.isUsed())return;var m={streamStatusUpdate:t.streamStatusUpdate,encryptionDataEncountered:t.encryptionDataEncountered,manifestMightBeOufOfSync:t.manifestMightBeOufOfSync,needsManifestRefresh:t.needsManifestRefresh,inbandEvent:t.inbandEvent,warning:t.warning,error:function(e){T.cancel(),t.error(e)},addedSegment:function(e){Z.addedSegment(e),T.isUsed()||t.addedSegment(e)},terminating:function(){if(!r.isUsed())return r.cancel(),e(!1)}};R(o,c,f,m)}(!0)},tt=n(9252);var nt=function(e,t){var n=e.split(";"),r=n[0],i=n.slice(1),a=t.split(";"),o=a[0],s=a.slice(1);if(r!==o)return!1;var u=(0,b.Z)(i,(function(e){return(0,tt.Z)(e,"codecs=")})),l=(0,b.Z)(s,(function(e){return(0,tt.Z)(e,"codecs=")}));if(void 0===u||void 0===l)return!1;var d=u.substring(7),c=l.substring(7);return d.split(".")[0]===c.split(".")[0]};function rt(e,t,n,r,i){if(void 0!==e.codec&&"reload"===i.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return nt(e.getMimeTypeString(),t)}))}(n,e.codec))return{type:"needs-reload",value:void 0};var a=e.getBufferedRanges();if(0===a.length)return{type:"continue",value:void 0};var o=(0,m.JN)(a),u=t.start,l=null==t.end?1/0:t.end,d=(0,m.tn)(o,[{start:u,end:l}]);if(0===d.length)return{type:"continue",value:void 0};e.synchronizeInventory();var c=e.getInventory();if(!c.some((function(e){return e.infos.period.id===t.id&&e.infos.adaptation.id!==n.id})))return{type:"continue",value:void 0};var f=function(e,t,n){return e.reduce((function(e,r){if(r.infos.period.id!==t.id||r.infos.adaptation.id!==n.id)return e;var i=r.bufferedStart,a=r.bufferedEnd;return void 0===i||void 0===a||e.push({start:i,end:a}),e}),[])}(c,t,n),v=(0,m.uH)(d,f);if(0===v.length)return{type:"continue",value:void 0};var p=r.currentTime,h=i.audioTrackSwitchingMode;if(("video"===n.type||"audio"===n.type&&"reload"===h)&&(0,m.Ti)({start:u,end:l},p)&&(r.readyState>1||!n.getPlayableRepresentations().some((function(t){var n;return nt(t.getMimeTypeString(),null!==(n=e.codec)&&void 0!==n?n:"")})))&&!(0,m.A1)(f,p))return{type:"needs-reload",value:void 0};var g="audio"===n.type&&"direct"===h,y=[],_=function(e,t){for(var n=0;n=t.start)return n>0?e[n-1]:null;return e.length>0?e[e.length-1]:null}(c,t);null!==_&&(void 0===_.bufferedEnd||t.start-_.bufferedEnd<1)&&y.push({start:0,end:t.start+1});var b=n.type,S=s.Z.getCurrent().ADAPTATION_SWITCH_BUFFER_PADDINGS,T=S[b].before;null==T&&(T=0);var E=S[b].after;if(null==E&&(E=0),g||y.push({start:p-T,end:p+E}),void 0!==t.end){var k=function(e,t){for(var n=0;nt.start)return e[n];return null}(c,t);null!==k&&(void 0===k.bufferedStart||k.bufferedStart-t.end<1)&&y.push({start:t.end-1,end:Number.MAX_VALUE})}var w=(0,m.uH)(v,y);return 0===w.length?{type:"continue",value:void 0}:g?{type:"flush-buffer",value:w}:{type:"clean-buffer",value:w}}function it(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return at(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return at(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=o.end&&(l.Z.debug('Stream: full "empty" AdaptationStream',n),s=!0),i.streamStatusUpdate({period:o,bufferType:n,position:u,imminentDiscontinuity:null,isEmptyStream:!0,hasFinishedLoading:s,neededSegments:[]})}t.onUpdate(u,{emitCurrentValue:!1,clearSignal:a}),e.listen(u,{includeLastObservation:!1,clearSignal:a}),u()}var ut=function(e,t,n){var i=e.bufferType,a=e.content,u=e.garbageCollectors,d=e.playbackObserver,c=e.representationEstimator,h=e.segmentFetcherCreator,g=e.segmentBuffersStore,y=e.options,_=e.wantedBufferAhead,b=e.maxVideoBufferSize,S=a.period,T=new v.Z(void 0,n);if(t.periodStreamReady({type:i,period:S,adaptationRef:T}),!n.isCancelled()){var E,k=!0;T.onUpdate((function(e){(0,r.Z)(o().mark((function r(){var a,c,f,v,h,m,b,T,I,Z,x,R,M,C,P,D;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(void 0!==e){r.next=2;break}return r.abrupt("return");case 2:if((c=new p.ZP).linkToSignal(n),null==E||E.cancel(),E=c,null!==e){r.next=34;break}if(l.Z.info("Stream: Set no "+i+" Adaptation. P:",S.start),"initialized"!==(f=g.getStatus(i)).type){r.next=26;break}if(l.Z.info("Stream: Clearing previous "+i+" SegmentBuffer"),!Re.isNative(i)){r.next=15;break}return r.abrupt("return",A(0,!0,c.signal));case 15:if(v=null!==(a=S.end)&&void 0!==a?a:1/0,!(S.start>v)){r.next=20;break}l.Z.warn("Stream: Can't free buffer: period's start is after its end"),r.next=24;break;case 20:return r.next=22,f.value.removeBuffer(S.start,v,c.signal);case 22:if(!c.isUsed()){r.next=24;break}return r.abrupt("return");case 24:r.next=30;break;case 26:if("uninitialized"!==f.type){r.next=30;break}if(g.disableSegmentBuffer(i),!c.isUsed()){r.next=30;break}return r.abrupt("return");case 30:if(t.adaptationChange({type:i,adaptation:null,period:S}),!c.isUsed()){r.next=33;break}return r.abrupt("return");case 33:return r.abrupt("return",st(d,_,i,{period:S},t,c.signal));case 34:if(h=s.Z.getCurrent(),m=h.DELTA_POSITION_AFTER_RELOAD,b=k?0:"audio"===i?m.trackSwitch.audio:"video"===i?m.trackSwitch.video:m.trackSwitch.other,k=!1,!Re.isNative(i)||"disabled"!==g.getStatus(i).type){r.next=39;break}return r.abrupt("return",A(b,!0,c.signal));case 39:if(l.Z.info("Stream: Updating "+i+" adaptation","A: "+e.id,"P: "+S.start),t.adaptationChange({type:i,adaptation:e,period:S}),!c.isUsed()){r.next=43;break}return r.abrupt("return");case 43:if(T=d.getReadyState(),I=ot(g,i,e,y),Z={currentTime:d.getCurrentTime(),readyState:T},"needs-reload"!==(x=rt(I,S,e,Z,y)).type){r.next=49;break}return r.abrupt("return",A(b,!0,c.signal));case 49:return r.next=51,g.waitForUsableBuffers(c.signal);case 51:if(!c.isUsed()){r.next=53;break}return r.abrupt("return");case 53:if("flush-buffer"!==x.type&&"clean-buffer"!==x.type){r.next=67;break}R=it(x.value);case 55:if((M=R()).done){r.next=63;break}return C=M.value,P=C.start,D=C.end,r.next=59,I.removeBuffer(P,D,c.signal);case 59:if(!c.isUsed()){r.next=61;break}return r.abrupt("return");case 61:r.next=55;break;case 63:if("flush-buffer"!==x.type){r.next=67;break}if(t.needsBufferFlush(),!c.isUsed()){r.next=67;break}return r.abrupt("return");case 67:u.get(I)(c.signal),w(e,I,c.signal);case 69:case"end":return r.stop()}}),r)})))().catch((function(e){e instanceof p.FU||(null==E||E.cancel(),t.error(e))}))}),{clearSignal:n,emitCurrentValue:!0})}function w(e,n,r){var o=a.manifest,s=function(e,t){return e.deriveReadOnlyObserver((function(e,n){var r=new v.Z(i(),n);return e.onUpdate(a,{clearSignal:n,emitCurrentValue:!1}),r;function i(){var n=e.getValue(),r=t.getBufferedRanges(),i=(0,m.L7)(r,n.position.last);return(0,f.Z)({},n,{bufferGap:i})}function a(){r.setValue(i())}}))}(d,n);et({content:{manifest:o,period:S,adaptation:e},options:y,playbackObserver:s,representationEstimator:c,segmentBuffer:n,segmentFetcherCreator:h,wantedBufferAhead:_,maxVideoBufferSize:b},Object.assign(Object.assign({},t),{error:function(e){if(!Re.isNative(i)){l.Z.error("Stream: "+i+" Stream crashed. Aborting it.",e instanceof Error?e:""),g.disposeSegmentBuffer(i);var n=(0,z.Z)(e,{defaultCode:"NONE",defaultReason:"Unknown `AdaptationStream` error"});if(t.warning(n),r.isCancelled())return;return st(d,_,i,{period:S},t,r)}l.Z.error("Stream: "+i+" Stream crashed. Stopping playback.",e instanceof Error?e:""),t.error(e)}}),r)}function A(e,n,r){Ce()((function(){d.listen((function(){t.waitingMediaSourceReload({bufferType:i,period:S,timeOffset:e,stayInPeriod:n})}),{includeLastObservation:!0,clearSignal:r})}))}};function lt(e,t){if(0===t.length)return[];e.synchronizeInventory();for(var n,r=[],i=e.getInventory(),a=function(){var e=i[o];if(t.some((function(t){return e.infos.period.id===t.period.id&&e.infos.adaptation.id===t.adaptation.id&&e.infos.representation.id===t.representation.id}))){var n=e.bufferedStart,a=e.bufferedEnd;if(void 0===n||void 0===a)return l.Z.warn("SO: No buffered start or end found from a segment."),{v:[{start:0,end:Number.MAX_VALUE}]};var s=r[r.length-1];void 0!==s&&s.end===n?s.end=a:r.push({start:n,end:a})}},o=0;o=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?t[t.length-1].end>=n-5:t[0].start<=n+5}var vt=function(e,t,n,i,a,d,c,f){for(var h,m=e.manifest,g=e.initialPeriod,y=d.maxBufferAhead,_=d.maxBufferBehind,b=d.wantedBufferAhead,S=d.maxVideoBufferSize,T=s.Z.getCurrent(),E=T.MINIMUM_MAX_BUFFER_AHEAD,k=T.MAXIMUM_MAX_BUFFER_AHEAD,w=T.MAXIMUM_MAX_BUFFER_BEHIND,A=new De((function(e){var n,r,i=e.bufferType,a=null!==(n=w[i])&&void 0!==n?n:1/0,o=null!==(r=k[i])&&void 0!==r?r:1/0;return function(n){Ne({segmentBuffer:e,playbackObserver:t,maxBufferBehind:(0,v.l)(_,(function(e){return Math.min(e,a)}),n),maxBufferAhead:(0,v.l)(y,(function(e){var t,n=Math.max(e,null!==(t=E[i])&&void 0!==t?t:0);return Math.min(n,o)}),n)},n)}})),I=dt(i.getBufferTypes());!(h=I()).done;){Z(h.value,g)}function Z(e,n){var a=new Pe.Z((function(e,t){return e.start-t.start})),s=!1,d=new p.ZP;return d.linkToSignal(f),t.listen((function(t){var n,r,i=t.position,o=null!==(n=i.pending)&&void 0!==n?n:i.last;if(s&&function(e){var t=a.head(),n=a.last();if(null==t||null==n)return!0;return t.start>e||(null==n.end?1/0:n.end)0;){var u=a.get(a.length()-1);a.removeElement(u),c.periodStreamCleared({type:e,period:u})}d.cancel(),(d=new p.ZP).linkToSignal(f);var h=null!==(r=m.getPeriodForTime(o))&&void 0!==r?r:m.getNextPeriod(o);if(void 0===h)return l.Z.warn("Stream: The wanted position is not found in the Manifest."),void(s=!0);v(h)}}),{clearSignal:f,includeLastObservation:!0}),m.addEventListener("decipherabilityUpdate",(function(e){(function(e){return h.apply(this,arguments)})(e).catch((function(e){d.cancel(),c.error(e)}))}),f),v(n);function v(t){var n=Object.assign(Object.assign({},c),{waitingMediaSourceReload:function(e){var t=a.head();void 0===t||t.id!==e.period.id?c.lockedStream({bufferType:e.bufferType,period:e.period}):c.needsMediaSourceReload({timeOffset:e.timeOffset,minimumPosition:e.stayInPeriod?e.period.start:void 0,maximumPosition:e.stayInPeriod?e.period.end:void 0})},periodStreamReady:function(e){s=!0,a.add(e.period),c.periodStreamReady(e)},periodStreamCleared:function(e){a.removeElement(e.period),c.periodStreamCleared(e)},error:function(e){d.cancel(),c.error(e)}});x(e,t,n,d.signal)}function h(){return h=(0,r.Z)(o().mark((function n(r){var h,g,y,_,b,S,T,E,k,w,A,I,Z;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(h=i.getStatus(e),0!==(g=r.filter((function(t){return t.adaptation.type===e}))).length&&"initialized"===h.type&&!g.every((function(e){return!0===e.representation.decipherable}))){n.next=4;break}return n.abrupt("return");case 4:for(y=h.value,_=g.filter((function(e){return void 0===e.representation.decipherable})),b=g.filter((function(e){return!1===e.representation.decipherable})),S=lt(y,b),T=lt(y,_),s=!1,l.Z.info("Stream: Destroying all PeriodStreams for decipherability matters",e);a.length()>0;)E=a.get(a.length()-1),a.removeElement(E),c.periodStreamCleared({type:e,period:E});d.cancel(),(d=new p.ZP).linkToSignal(f),k=0,w=[].concat(S,T);case 16:if(!(k=r.end){var d=m.getPeriodAfter(r);if(r.containsTime(u,d))return;l.Z.info("Stream: Destroying PeriodStream as the current playhead moved above it",e,r.start,null!==(a=s.pending)&&void 0!==a?a:s.last,r.end),n(),o.periodStreamCleared({type:e,period:r}),c.cancel()}}),{clearSignal:s,includeLastObservation:!0});var f={bufferType:e,content:{manifest:m,period:r},garbageCollectors:A,maxVideoBufferSize:S,segmentFetcherCreator:a,segmentBuffersStore:i,options:d,playbackObserver:t,representationEstimator:n,wantedBufferAhead:b},v=Object.assign(Object.assign({},o),{streamStatusUpdate:function(t){if(t.hasFinishedLoading){var n=m.getPeriodAfter(r);null!==n&&function(t){if(null!==u){if(u.period.id===t.id)return;l.Z.warn("Stream: Creating next `PeriodStream` while one was already created.",e,t.id,u.period.id),o.periodStreamCleared({type:e,period:u.period}),u.canceller.cancel()}var n=new p.ZP;n.linkToSignal(s),u={canceller:n,period:t},x(e,t,o,u.canceller.signal)}(n)}else null!==u&&(l.Z.info("Stream: Destroying next PeriodStream due to current one being active",e,u.period.start),o.periodStreamCleared({type:e,period:u.period}),u.canceller.cancel(),u=null);o.streamStatusUpdate(t)},error:function(e){null!==u&&(u.canceller.cancel(),u=null),c.cancel(),o.error(e)}});ut(f,v,c.signal)}},pt=vt,ht=n(9420);function mt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return gt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);na.getMaximumAvailablePosition()){var l=new u.Z("MEDIA_TIME_AFTER_MANIFEST","The current position is after the latest time announced in the Manifest.");i.trigger("warning",l)}}),{includeLastObservation:!0,clearSignal:o}),t.addEventListener("manifestUpdate",(function(){i.trigger("endingPositionChange",i._getManifestEndTime()),o.isCancelled()||i._checkEndOfStream()}),o),i}(0,i.Z)(t,e);var n=t.prototype;return n.getCurrentEndingTime=function(){return this._getManifestEndTime()},n.onAdaptationChange=function(e,t,n){if(this._manifest.isLastPeriodKnown){var r=this._manifest.periods[this._manifest.periods.length-1];if(t.id===(null==r?void 0:r.id)&&("audio"===e||"video"===e)){"audio"===e?this._maximumPositionCalculator.updateLastAudioAdaptation(n):this._maximumPositionCalculator.updateLastVideoAdaptation(n);var i=this._maximumPositionCalculator.getEndingPosition(),a=void 0!==i?{isEnd:!0,endingPosition:i}:{isEnd:!1,endingPosition:this._maximumPositionCalculator.getMaximumAvailablePosition()};this.trigger("endingPositionChange",a)}}this._canceller.isUsed()||null===n&&this._addActivelyLoadedPeriod(t,e)},n.onRepresentationChange=function(e,t){this._addActivelyLoadedPeriod(t,e)},n.onPeriodCleared=function(e,t){this._removeActivelyLoadedPeriod(t,e)},n.onLastSegmentFinishedLoading=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod||(t.hasFinishedLoadingLastPeriod=!0,this._checkEndOfStream())},n.onLastSegmentLoadingResume=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod&&(t.hasFinishedLoadingLastPeriod=!1,this._checkEndOfStream())},n.dispose=function(){this.removeEventListener(),this._canceller.cancel()},n._addActivelyLoadedPeriod=function(e,t){var n=this._lazilyCreateActiveStreamInfo(t);n.activePeriods.has(e)||(n.activePeriods.add(e),this._checkCurrentPeriod())},n._removeActivelyLoadedPeriod=function(e,t){var n=this._activeStreams.get(t);void 0!==n&&n.activePeriods.has(e)&&(n.activePeriods.removeElement(e),this._checkCurrentPeriod())},n._checkCurrentPeriod=function(){var e=this;if(0!==this._allBufferTypes.length){var t=this._activeStreams.get(this._allBufferTypes[0]);if(void 0!==t)for(var n,r,i=function(){for(var t=r.value,n=!0,i=1;i=0;a--){var o=i[a];try{"open"===r&&(l.Z.info("Init: Aborting SourceBuffer before removing"),o.abort()),l.Z.info("Init: Removing SourceBuffer from mediaSource"),t.removeSourceBuffer(o)}catch(e){l.Z.warn("Init: Error while disposing SourceBuffer",e instanceof Error?e:"")}}i.length>0&&l.Z.warn("Init: Not all SourceBuffers could have been removed.")}if(l.Z.info("Init: Clearing HTMLMediaElement's src"),(0,Tt.Z)(e),null!==n)try{l.Z.debug("Init: Revoking previous URL"),URL.revokeObjectURL(n)}catch(e){l.Z.warn("Init: Error while revoking the media source URL",e instanceof Error?e:"")}}function It(e,t){return(0,c.Z)(t,(function(n){var r=function(e,t){if(null==Et.J)throw new u.Z("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=(0,wt.Z)(e.src)?e.src:null;At(e,null,n),l.Z.info("Init: Creating MediaSource");var r=new Et.J,i=URL.createObjectURL(r);return l.Z.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){At(e,r,i)})),r}(e,t);kt.u_(r,(function(){l.Z.info("Init: MediaSource opened"),n(r)}),t)}))}function Zt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return xt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function xt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?a:Math.max(i,a+c)}if(!(0,W.Z)(n.fromLivePosition)){l.Z.debug("Init: using startAt.fromLivePosition");var f=null!==(r=e.getLivePosition())&&void 0!==r?r:a,v=n.fromLivePosition;return v>=0?f:Math.max(i,f+v)}if(!(0,W.Z)(n.percentage)){l.Z.debug("Init: using startAt.percentage");var p=n.percentage;return p>100?a:p<0?i:i+(a-i)*(+p/100)}}var h=e.getMinimumSafePosition();if(e.isLive){var m,g=e.suggestedPresentationDelay,y=e.clockOffset,_=e.getMaximumSafePosition(),b=s.Z.getCurrent().DEFAULT_LIVE_GAP;if(void 0===y)l.Z.info("Init: no clock offset found for a live content, starting close to maximum available position"),m=_;else{l.Z.info("Init: clock offset found for a live content, checking if we can start close to it");var S=void 0===e.availabilityStartTime?0:e.availabilityStartTime,T=(performance.now()+y)/1e3-S;m=Math.min(_,T)}var E=void 0!==g?g:t?b.LOW_LATENCY:b.DEFAULT;return l.Z.debug("Init: "+m+" defined as the live time, applying a live gap of "+E),Math.max(m-E,h)}return l.Z.info("Init: starting at the minimum available position:",h),h}var Nt=n(379),Ot=n(9016),Lt=n(7794),Ut=n(3666);var Bt=31536e3,Ft=function(){function e(e){this._mediaSource=e,this._currentMediaSourceDurationUpdateCanceller=null}var t=e.prototype;return t.updateDuration=function(e,t){null!==this._currentMediaSourceDurationUpdateCanceller&&this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=new p.ZP;var n=this._mediaSource,r=this._currentMediaSourceDurationUpdateCanceller.signal,i=function(e,t){var n=new v.Z("open"===e.readyState,t);return(0,kt.u_)(e,(function(){l.Z.debug("Init: Reacting to MediaSource open in duration updater"),n.setValueIfChanged(!0)}),t),(0,kt.N8)(e,(function(){l.Z.debug("Init: Reacting to MediaSource ended in duration updater"),n.setValueIfChanged(!1)}),t),(0,kt.k6)(e,(function(){l.Z.debug("Init: Reacting to MediaSource close in duration updater"),n.setValueIfChanged(!1)}),t),n}(n,r),a=new p.ZP;a.linkToSignal(r),i.onUpdate((function(){if(a.cancel(),!i.getValue())return;(a=new p.ZP).linkToSignal(r);var o=function(e,t){if(0===e.length){var n=new v.Z(!1);return n.finish(),n}var r=new v.Z(!1,t);o();for(var i=function(){var n=e[a];n.addEventListener("updatestart",o),n.addEventListener("update",o),t.register((function(){n.removeEventListener("updatestart",o),n.removeEventListener("update",o)}))},a=0;a0&&(i=Math.max(o.buffered.end(s-1)))}if(r===e.duration)return"success";if(i>r){if(i=.1?c=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function qt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);no||void 0!==f&&o>=f)&&(Xt(d)&&u.push(d.publicEvent),this._eventsBeingPlayed.delete(d)):c<=o&&void 0!==f&&o=(null!=f?f:c)&&(a?s.push({type:"stream-event-skip",value:d.publicEvent}):(s.push({type:"stream-event",value:d.publicEvent}),Xt(d)&&u.push(d.publicEvent)))}if(s.length>0)for(var v,p=jt(s);!(v=p()).done;){var h=v.value;if("stream-event"===h.type?this.trigger("event",h.value):this.trigger("eventSkip",h.value),r.isCancelled())return}if(u.length>0)for(var m,g=jt(u);!(m=g()).done;){var y=m.value;if("function"==typeof y.onExit&&y.onExit(),r.isCancelled())return}},t}(G.Z);function Xt(e){return void 0!==e.end}var Qt=Yt,$t=n(4576);function Jt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return en(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return en(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function en(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nd.end&&(t=d.end-1)}}else t=u;return{maximumPosition:o.getMaximumSafePosition(),position:{last:n.position,pending:t},duration:n.duration,paused:{last:n.paused,pending:i.getValue()||!r===n.paused?void 0:!r},readyState:n.readyState,speed:l}}function f(){d.setValue(c())}}))}(h,{autoPlay:a,manifest:d,initialPlayPerformed:w,initialSeekPerformed:A,speed:_,startTime:l},n),Z=this._createRebufferingController(h,d,_,n),x=this._createContentTimeBoundariesObserver(d,f,I,T,n);k.then((function(){(0,Nt.Z)(h,c,!1,n).onUpdate((function(e,t){e&&(t(),i.trigger("loaded",{segmentBuffersStore:T}))}),{emitCurrentValue:!0,clearSignal:n})})).catch((function(e){n.isCancelled()||i._onFatalError(e)}));var R=this;pt({manifest:d,initialPeriod:b},I,g,T,y,o,{needsBufferFlush:function(){var e=c.currentTime+.001;h.setCurrentTime(e),h.listen((function(t,n){(null!==t.currentRange||t.position>e+.1)&&(n(),h.setCurrentTime(t.position+.001))}),{includeLastObservation:!1,clearSignal:n})},streamStatusUpdate:function(e){var t=e.period,r=e.bufferType,i=e.imminentDiscontinuity,a=e.position;Z.updateDiscontinuityInfo({period:t,bufferType:r,discontinuity:i,position:a}),n.isCancelled()||d.isLastPeriodKnown&&e.period.id===d.periods[d.periods.length-1].id&&(e.hasFinishedLoading||e.isEmptyStream?x.onLastSegmentFinishedLoading(e.bufferType):x.onLastSegmentLoadingResume(e.bufferType))},needsManifestRefresh:function(){return R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!0,canUseUnsafeMode:!0})},manifestMightBeOufOfSync:function(){var e=s.Z.getCurrent().OUT_OF_SYNC_MANIFEST_REFRESH_DELAY;R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!1,canUseUnsafeMode:!1,delay:e})},lockedStream:function(e){return Z.onLockedStream(e.bufferType,e.period)},adaptationChange:function(e){R.trigger("adaptationChange",e),n.isCancelled()||x.onAdaptationChange(e.type,e.period,e.adaptation)},representationChange:function(e){R.trigger("representationChange",e),n.isCancelled()||x.onRepresentationChange(e.type,e.period)},inbandEvent:function(e){return R.trigger("inbandEvents",e)},warning:function(e){return R.trigger("warning",e)},periodStreamReady:function(e){return R.trigger("periodStreamReady",e)},periodStreamCleared:function(e){x.onPeriodCleared(e.type,e.period),n.isCancelled()||R.trigger("periodStreamCleared",e)},bitrateEstimationChange:function(e){return R.trigger("bitrateEstimationChange",e)},addedSegment:function(e){return R.trigger("addedSegment",e)},needsMediaSourceReload:function(e){var n,r,i=I.getReference().getValue(),a=null!==(n=i.position.pending)&&void 0!==n?n:I.getCurrentTime(),o=null!==(r=i.paused.pending)&&void 0!==r?r:I.getIsPaused(),s=a+e.timeOffset;void 0!==e.minimumPosition&&(s=Math.max(e.minimumPosition,s)),void 0!==e.maximumPosition&&(s=Math.min(e.maximumPosition,s)),t({position:s,autoPlay:!o})},needsDecipherabilityFlush:function(){var e,n,r,i,a=(0,V.Z)(c);if(void 0===(i=null==a?void 0:a[0])||i.indexOf("widevine")<0){var o=I.getReference().getValue(),s=null!==(e=o.position.pending)&&void 0!==e?e:I.getCurrentTime(),u=null!==(n=o.paused.pending)&&void 0!==n?n:I.getIsPaused();t({position:s,autoPlay:!u})}else{var l=I.getReference().getValue(),d=null!==(r=l.position.pending)&&void 0!==r?r:I.getCurrentTime();d+.0010)return l.setValue(!0),void u.cancel();var a=r.lV?4:3;return e.readyState>=a&&(null!==e.currentRange||e.ended)&&(!(0,i.Z)()||t.duration>0)?(l.setValue(!0),void u.cancel()):void 0}}),{includeLastObservation:!0,clearSignal:u.signal}),l}},9016:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(1669),i=n(3774),a=n(3666);var o=n(3714),s=n(3887),u=n(5095);function l(e,t,n,l,d,c,f){var v,p,h=new Promise((function(e,t){v=e,p=t})),m=new u.Z(!1,f),g=new u.Z(!1,f);e.addEventListener("loadedmetadata",_);var y=f.register((function(t){e.removeEventListener("loadedmetadata",_),p(t)}));return e.readyState>=i.c.HAVE_METADATA&&_(),{autoPlayResult:h,initialPlayPerformed:g,initialSeekPerformed:m};function _(){e.removeEventListener("loadedmetadata",_);var i=!1,u=function(e){s.Z.info("Init: Set initial time",e),t.setCurrentTime(e),i=!0,m.setValue(!0),m.finish()},h="function"==typeof n?n():n;if((a.GQ||a.YM)&&0===h?(m.setValue(!0),m.finish()):c&&a.SB?setTimeout((function(){u(h)}),0):u(h),(0,r.Z)()&&0===e.duration){var b=new o.Z("MEDIA_ERR_NOT_LOADED_METADATA","Cannot load automatically: your browser falsely announced having loaded the content.");d(b)}if(!f.isCancelled()){var S=i;t.listen((function(t,n){i&&t.seeking?S=!1:!S&&!t.seeking&&null===t.rebuffering&&t.readyState>=1&&(n(),function(){var t,n;if(s.Z.info("Init: Can begin to play content"),!l)return e.autoplay&&s.Z.warn("Init: autoplay is enabled on HTML media element. Media will play as soon as possible."),g.setValue(!0),g.finish(),y(),v({type:"skipped"});if(e.ended)return s.Z.warn("Init: autoplay is enabled but the video is ended. Skipping autoplay to prevent video to start again"),g.setValue(!0),g.finish(),y(),v({type:"skipped"});try{n=null!==(t=e.play())&&void 0!==t?t:Promise.resolve()}catch(e){return y(),p(e)}n.then((function(){if(!f.isCancelled())return g.setValue(!0),g.finish(),y(),v({type:"autoplay"})})).catch((function(e){if(y(),!f.isCancelled()){if(e instanceof Error&&"NotAllowedError"===e.name){s.Z.warn("Init: Media element can't play. It may be due to browser auto-play policies.");var t=new o.Z("MEDIA_ERR_BLOCKED_AUTOPLAY","Cannot trigger auto-play automatically: your browser does not allow it.");if(d(t),f.isCancelled())return;return v({type:"autoplay-blocked"})}p(e)}}))}())}),{includeLastObservation:!0,clearSignal:f})}}}},7794:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(5157),i=n(7874),a=n(3887),o=n(5095),s=n(288),u=n(4339);function l(e,t,n,l,d){if(0===t.length)return h("No `keySystems` option given.");if(null===i.Z.decrypt)return h("EME feature not activated.");var c=new s.ZP;c.linkToSignal(d);var f=new o.Z({initializationState:{type:"uninitialized",value:null},drmSystemId:void 0},d),v=i.Z.decrypt;if(!v.hasEmeApis())return h("EME API not available on the current page.");a.Z.debug("Init: Creating ContentDecryptor");var p=new v(e,t);return p.addEventListener("stateChange",(function(e){if(e===u.u.WaitingForAttachment){var t=new o.Z(!1);t.onUpdate((function(t,n){t&&(n(),e===u.u.WaitingForAttachment&&p.attach())}),{clearSignal:c.signal}),f.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:p.systemId})}else e===u.u.ReadyForContent&&(f.setValue({initializationState:{type:"initialized",value:null},drmSystemId:p.systemId}),p.removeEventListener("stateChange"))})),p.addEventListener("error",(function(e){c.cancel(),l.onError(e)})),p.addEventListener("warning",(function(e){l.onWarning(e)})),n.onUpdate((function(e){null!==e&&p.onInitializationData(e)}),{clearSignal:c.signal}),c.signal.register((function(){p.dispose()})),f;function h(e){n.onUpdate((function(t,n){if(null!==t){n();var i=new r.Z("MEDIA_IS_ENCRYPTED_ERROR",e);l.onError(i)}}),{clearSignal:d});var t=new o.Z({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return t.finish(),t}}},6199:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(4578),i=n(3666).yS,a=n(6872),o=n(3714),s=n(3887),u=n(1959),l=n(2829),d=n(288),c=1/60,f=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._playbackObserver=t,i._manifest=n,i._speed=r,i._discontinuitiesStore=[],i._isStarted=!1,i._canceller=new d.ZP,i}(0,r.Z)(t,e);var n=t.prototype;return n.start=function(){var e=this;if(!this._isStarted){var t;this._isStarted=!0;var n=null,r=new h(this._playbackObserver,this._speed);this._canceller.signal.register((function(){r.dispose()}));var o=null;this._playbackObserver.listen((function(u){var d,f,v=e._discontinuitiesStore,h=u.buffered,m=u.position,g=u.readyState,y=u.rebuffering,_=u.freezing,b=a.Z.getCurrent(),S=b.BUFFER_DISCONTINUITY_THRESHOLD,T=b.FORCE_DISCONTINUITY_SEEK_DELAY,E=b.FREEZING_STALLED_DELAY,k=b.UNFREEZING_SEEK_DELAY,w=b.UNFREEZING_DELTA_POSITION;if(!u.seeking&&i&&null===n&&null!==t&&u.positionk&&(s.Z.warn("Init: trying to seek to un-freeze player"),e._playbackObserver.setCurrentTime(e._playbackObserver.getCurrentTime()+w),o={attemptTimestamp:I}),I-_.timestamp>E)return null===y||null!==n?r.stopRebuffering():r.startRebuffering(),void e.trigger("stalled","freezing")}else o=null;if(null===y)return r.stopRebuffering(),1===g?(f=u.seeking?null!==u.pendingInternalSeek?"internal-seek":"seeking":"not-ready",void e.trigger("stalled",f)):void e.trigger("unstalled",null);var Z="seeking"===y.reason&&null!==u.pendingInternalSeek?"internal-seek":y.reason;if(null!==n){var x=performance.now();if(x-n0){var M=function(e,t,n){if(0===e.length)return null;for(var r=null,i=0;in)return r;var o=void 0;if(void 0===a.end||a.end>n){var u=e[i],l=u.discontinuity,d=u.position,f=l.start,v=l.end;if(n>=(null!=f?f:d)-c)if(null===v){var p=t.getPeriodAfter(a);null!==p?o=p.start+c:s.Z.warn("Init: discontinuity at Period's end but no next Period")}else no?r:o)}}return r}(v,e._manifest,R);if(null!==M){var C=M+.001;if(!(C<=e._playbackObserver.getCurrentTime()))return s.Z.warn("SA: skippable discontinuity found in the stream",m,C),e._playbackObserver.setCurrentTime(C),void e.trigger("warning",p(R,C));s.Z.info("Init: position to seek already reached, no seeking",e._playbackObserver.getCurrentTime(),C)}}var P=null!=R?R:m,D=(0,l.XS)(h,P);if(e._speed.getValue()>0&&D=0;O--){var L=e._manifest.periods[O];if(void 0!==L.end&&L.end<=P){if(e._manifest.periods[O+1].start>P&&e._manifest.periods[O+1].start>e._playbackObserver.getCurrentTime()){var U=e._manifest.periods[O+1];return e._playbackObserver.setCurrentTime(U.start),void e.trigger("warning",p(P,U.start))}break}}e.trigger("stalled",Z)}else e.trigger("stalled",Z)}),{includeLastObservation:!0,clearSignal:this._canceller.signal})}},n.updateDiscontinuityInfo=function(e){this._isStarted||this.start();var t=this._playbackObserver.getReference().getValue();!function(e,t,n){for(;e.length>0&&void 0!==e[0].period.end&&e[0].period.end+10r.start)return void(v(t)&&e.splice(a,0,t));v(t)&&e.push(t)}(this._discontinuitiesStore,e,t)},n.onLockedStream=function(e,t){var n;this._isStarted||this.start();var r=this._playbackObserver.getReference().getValue();if(!(!r.rebuffering||r.paused||this._speed.getValue()<=0||"audio"!==e&&"video"!==e)){var i=r.position,a=null!==(n=r.rebuffering.position)&&void 0!==n?n:i,o=t.start;i=0;n--){if(e[n].startt)return e.slice(n,e.length)}return[]}function m(e,t,n){var r=Math.max(e.start,t),i=p(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=h(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var g=function(){function e(){this._cuesBuffer=[]}var t=e.prototype;return t.get=function(e){for(var t=this._cuesBuffer,n=[],r=t.length-1;r>=0;r--){var i=t[r];if(e=i.start){for(var a=i.cues,o=0;o=a[o].start&&e0)for(var s=0;se){var a=r[i];if(a.start>=n)return;if(a.end>=n){if(e<=a.start)a.cues=h(a.cues,n),a.start=n;else{var o=m(a,e,n),s=o[0],u=o[1];this._cuesBuffer[i]=s,r.splice(i+1,0,u)}return}a.start>=e?(r.splice(i,1),i--):(a.cues=p(a.cues,e),a.end=Math.max(e,a.start))}},t.insert=function(e,t,n){var r=this._cuesBuffer,i={start:t,end:n,cues:e},a=Math.abs(t-n)/5;function o(e){var t=r[e];void 0===t||v(i.end,t.end,a)?r[e]=i:(t.start>=i.end||(t.cues=h(t.cues,i.end),t.start=i.end),r.splice(e,0,i))}for(var s=0;su.end);return void o(s)}if(tu.end);return void o(s)}if(v(u.end,n,a))return u.cues=p(u.cues,t),u.end=t,void r.splice(s+1,0,i);if(u.end>n){var l=m(u,t,n),d=l[0],c=l[1];return this._cuesBuffer[s]=d,r.splice(s+1,0,i),void r.splice(s+2,0,c)}u.cues=p(u.cues,t),u.end=t;var f=s+1;for(u=r[f];void 0!==u&&n>u.end;)r.splice(f,1),u=r[f];return void o(f)}}if(r.length){var g=r[r.length-1];v(g.end,t,a)&&(g.end=t)}r.push(i)},e}();function y(e,t,n,r){for(var i=[t/n.columns,e/n.rows],a=r.getElementsByClassName("proportional-style"),o=0;o0}var _=i.M4,b=i.bQ,S=i.Q$;function T(e,t){try{e.removeChild(t)}catch(e){a.Z.warn("HTSB: Can't remove text track: not in the element.")}}function E(e){var t=e.getAttribute("data-resolution-rows"),n=e.getAttribute("data-resolution-columns");if(null===t||null===n)return null;var r=parseInt(t,10),i=parseInt(n,10);return null===r||null===i?null:{rows:r,columns:i}}var k=function(e){function t(t,n){var r;return a.Z.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new c.Z,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new l.ZP,r._canceller=new l.ZP,r._buffer=new g,r._currentCues=[],r.autoRefreshSubtitles(r._canceller.signal),r}(0,r.Z)(t,e);var n=t.prototype;return n.declareInitSegment=function(e){a.Z.warn("ISB: Declaring initialization segment for image SegmentBuffer",e)},n.freeInitSegment=function(e){a.Z.warn("ISB: Freeing initialization segment for image SegmentBuffer",e)},n.pushChunk=function(e){try{this.pushChunkSync(e)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this.removeBufferSync(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("HTSB: Disposing HTMLTextSegmentBuffer"),this._disableCurrentCues(),this._buffer.remove(0,1/0),this._buffered.remove(0,1/0),this._canceller.cancel()},n.pushChunkSync=function(e){var t,n;a.Z.debug("HTSB: Appending new html text tracks");var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk;if(null!==s){var u,l,d=s.start,c=s.end,v=s.data,p=s.type,h=s.language,m=null!==(t=o[0])&&void 0!==t?t:0,g=null!==(n=o[1])&&void 0!==n?n:1/0,y=function(e,t,n,r){a.Z.debug("HTSB: Finding parser for html text tracks:",e);var i=f.Z.htmlTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("HTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("HTTB: Parsed successfully!",o.length),o}(p,v,i,h);if(0!==m&&g!==1/0){for(var _=0;_=0&&y[_].start>=g;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].end>g;)y[_].end=g,_--}if(void 0!==d)u=Math.max(m,d);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor start time. Aborting");a.Z.warn("HTSB: No start time given. Guessing from cues."),u=y[0].start}if(void 0!==c)l=Math.min(g,c);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor end time. Aborting");a.Z.warn("HTSB: No end time given. Guessing from cues."),l=y[y.length-1].end}l<=u?a.Z.warn("HTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."):(null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos,!0),this._buffer.insert(y,u,l),this._buffered.insert(u,l))}},n.removeBufferSync=function(e,t){a.Z.debug("HTSB: Removing html text track data",e,t),this._buffer.remove(e,t),this._buffered.remove(e,t)},n._disableCurrentCues=function(){if(this._sizeUpdateCanceller.cancel(),this._currentCues.length>0){for(var e=0;e0){this._sizeUpdateCanceller=new l.ZP,this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);var c=u.Z.getCurrent().TEXT_TRACK_SIZE_CHECKS_INTERVAL,f=function(e,t,n){var r=e.getBoundingClientRect(),i=r.height,u=r.width,l=new o.Z({height:i,width:u},n),d=i,c=u;if(void 0!==s){var f=new s((function(e){if(0!==e.length){var t=e[0].contentRect,n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}else a.Z.error("Compat: Resized but no observed element.")}));f.observe(e),n.register((function(){f.disconnect()}))}else{var v=setInterval((function(){var t=e.getBoundingClientRect(),n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}),t);n.register((function(){clearInterval(v)}))}return l}(this._textTrackElement,c,this._sizeUpdateCanceller.signal);f.onUpdate((function(e){for(var t=e.height,n=e.width,r=0;r0?e.textTracks[u-1]:e.addTextTrack(s)).mode=t?null!==(n=a.HIDDEN)&&void 0!==n?n:"hidden":null!==(r=a.SHOWING)&&void 0!==r?r:"showing"}else o=document.createElement("track"),e.appendChild(o),a=o.track,o.kind=s,a.mode=t?"hidden":"showing";return{track:a,trackElement:o}}(t,n),s=o.track,l=o.trackElement;return r.bufferType="text",r._buffered=new u.Z,r._videoElement=t,r._track=s,r._trackElement=l,r}(0,r.Z)(t,e);var n=t.prototype;return n.declareInitSegment=function(e){a.Z.warn("ISB: Declaring initialization segment for image SegmentBuffer",e)},n.freeInitSegment=function(e){a.Z.warn("ISB: Freeing initialization segment for image SegmentBuffer",e)},n.pushChunk=function(e){var t,n;if(a.Z.debug("NTSB: Appending new native text tracks"),null===e.data.chunk)return Promise.resolve();var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk,u=s.start,d=s.end,c=s.data,f=s.type,v=s.language,p=null!==(t=o[0])&&void 0!==t?t:0,h=null!==(n=o[1])&&void 0!==n?n:1/0;try{var m,g,y=function(e,t,n,r){a.Z.debug("NTSB: Finding parser for native text tracks:",e);var i=l.Z.nativeTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("NTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("NTSB: Parsed successfully!",o.length),o}(f,c,i,v);if(0!==p&&h!==1/0){for(var _=0;_=0&&y[_].startTime>=h;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].endTime>h;)y[_].endTime=h,_--}if(void 0!==u)m=Math.max(p,u);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor start time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No start time given. Guessing from cues."),m=y[0].startTime}if(void 0!==d)g=Math.min(h,d);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor end time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No end time given. Guessing from cues."),g=y[y.length-1].endTime}if(g<=m)return a.Z.warn("NTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."),Promise.resolve();if(y.length>0){var b=y[0],S=this._track.cues;null!==S&&S.length>0&&b.startTime=0;i--){var s=r[i],u=s.startTime,l=s.endTime;u>=e&&u<=t&&l<=t&&o(n,s)}this._buffered.remove(e,t)},t}(s.C)},9612:function(e,t,n){"use strict";n.d(t,{C:function(){return y},f:function(){return m}});var r=n(6872),i=n(3887),a=n(520);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this._history=this._history.splice(r)),this._history.length>this._maxHistoryLength){var a=this._history.length-this._maxHistoryLength;this._history=this._history.splice(a)}},e}();function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var A=f[E+w-1];k={end:null!==(a=A.bufferedEnd)&&void 0!==a?a:A.end,precizeEnd:A.precizeEnd},i.Z.debug("SI: "+w+" segments GCed.",y);for(var I,Z=l(f.splice(E,w));!(I=Z()).done;){var x=I.value;void 0===x.bufferedStart&&void 0===x.bufferedEnd&&2!==x.status&&this._bufferedHistory.addBufferedSegment(x.infos,null)}v=E}if(void 0===m)return;if(T-(null!==(o=m.bufferedStart)&&void 0!==o?o:m.start)>=g){if(p(m,S,k,y),v===f.length-1)return void h(m,T,y);for(var R=null!==(s=(m=f[++v]).bufferedStart)&&void 0!==s?s:m.start,M=null!==(u=m.bufferedEnd)&&void 0!==u?u:m.end,C=b<_-1?e.start(b+1):void 0;void 0!==m&&T-R>=g&&(void 0===C||T-R>=M-C);){var P=f[v-1];void 0===P.bufferedEnd&&(P.bufferedEnd=m.precizeStart?m.start:P.end,i.Z.debug("SI: calculating buffered end of contiguous segment",y,P.bufferedEnd,P.end)),m.bufferedStart=P.bufferedEnd,void 0!==(m=f[++v])&&(R=null!==(d=m.bufferedStart)&&void 0!==d?d:m.start,M=null!==(c=m.bufferedEnd)&&void 0!==c?c:m.end)}}var D=f[v-1];void 0!==D&&h(D,T,y)}}if(null!=m){i.Z.debug("SI: last segments have been GCed",y,v,f.length);for(var N,O=l(f.splice(v,f.length-v));!(N=O()).done;){var L=N.value;void 0===L.bufferedStart&&void 0===L.bufferedEnd&&2!==L.status&&this._bufferedHistory.addBufferedSegment(L.infos,null)}}!t&&void 0!==y&&i.Z.hasLevel("DEBUG")&&i.Z.debug("SI: current "+y+" inventory timeline:\n"+function(e){var t=1/60,n={},r=[],i=null,a=null;function o(e){var t=String.fromCharCode(r.length+65);return r.push({letter:t,periodId:e.period.id,representationId:e.representation.id,bitrate:e.representation.bitrate}),t}for(var s="",u=0;u=l)i.Z.warn("SI: Invalid chunked inserted: starts before it ends",d,u,l);else{for(var c=this._inventory,f={status:t?0:2,chunkSize:s,splitted:!1,start:u,end:l,precizeStart:!1,precizeEnd:!1,bufferedStart:void 0,bufferedEnd:void 0,infos:{segment:o,period:n,adaptation:r,representation:a}},v=c.length-1;v>=0;v--){var p=c[v];if(p.start<=u){if(p.end<=u){for(i.Z.debug("SI: Pushing segment strictly after previous one.",d,u,p.end),this._inventory.splice(v+1,0,f),v+=2;vf.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",d,f.end,c[v].start),c[v].start=f.end,c[v].bufferedStart=void 0,void(c[v].precizeStart=c[v].precizeStart&&f.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",d,u,l,c[v].start,c[v].end),c.splice(v,1)}return}if(p.start===u){if(p.end<=l){for(i.Z.debug("SI: Segment pushed replace another one",d,u,l,p.end),this._inventory.splice(v,1,f),v+=1;vf.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",d,f.end,c[v].start),c[v].start=f.end,c[v].bufferedStart=void 0,void(c[v].precizeStart=c[v].precizeStart&&f.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",d,u,l,c[v].start,c[v].end),c.splice(v,1)}return}return i.Z.debug("SI: Segment pushed ends before another with the same start",d,u,l,p.end),c.splice(v,0,f),p.start=f.end,p.bufferedStart=void 0,void(p.precizeStart=p.precizeStart&&f.precizeEnd)}if(p.end<=f.end){for(i.Z.debug("SI: Segment pushed updates end of previous one",d,u,l,p.start,p.end),this._inventory.splice(v+1,0,f),p.end=f.start,p.bufferedEnd=void 0,p.precizeEnd=p.precizeEnd&&f.precizeStart,v+=2;vf.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",d,f.end,c[v].start),c[v].start=f.end,c[v].bufferedStart=void 0,void(c[v].precizeStart=c[v].precizeStart&&f.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",d,u,l,c[v].start,c[v].end),c.splice(v,1)}return}i.Z.warn("SI: Segment pushed is contained in a previous one",d,u,l,p.start,p.end);var h={status:p.status,chunkSize:p.chunkSize,splitted:!0,start:f.end,end:p.end,precizeStart:p.precizeStart&&p.precizeEnd&&f.precizeEnd,precizeEnd:p.precizeEnd,bufferedStart:void 0,bufferedEnd:p.end,infos:p.infos};return p.end=f.start,p.splitted=!0,p.bufferedEnd=void 0,p.precizeEnd=p.precizeEnd&&f.precizeStart,c.splice(v+1,0,f),void c.splice(v+2,0,h)}}var m=this._inventory[0];if(void 0===m)return i.Z.debug("SI: first segment pushed",d,u,l),void this._inventory.push(f);if(!(m.start>=l)){if(m.end<=l){for(i.Z.debug("SI: Segment pushed starts before and completely recovers the previous first one",d,u,l,m.start,m.end),this._inventory.splice(0,1,f);c.length>1&&c[1].startf.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",d,f.end,c[1].start),c[1].start=f.end,c[1].bufferedStart=void 0,void(c[1].precizeStart=f.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",d,u,l,c[1].start,c[1].end),c.splice(1,1)}return}return i.Z.debug("SI: Segment pushed start of the next one",d,u,l,m.start,m.end),m.start=l,m.bufferedStart=void 0,m.precizeStart=f.precizeEnd,void this._inventory.splice(0,0,f)}i.Z.debug("SI: Segment pushed comes before all previous ones",d,u,l,m.start),this._inventory.splice(0,0,f)}}},t.completeSegment=function(e,t){if(!e.segment.isInit){for(var n=this._inventory,r=[],o=0;o0&&(s=!0,1===r.length&&(i.Z.warn("SI: Completed Segment is splitted.",e.segment.id,e.segment.time,e.segment.end),r[0].splitted=!0));var u=o,d=n[o].chunkSize;for(o+=1;o0&&(this._inventory.splice(u+1,v),o-=v),0===this._inventory[u].status&&(this._inventory[u].status=1),this._inventory[u].chunkSize=d,this._inventory[u].end=p,this._inventory[u].bufferedEnd=h,this._inventory[u].splitted=s,r.push(this._inventory[u])}if(0===r.length)i.Z.warn("SI: Completed Segment not found",e.segment.id,e.segment.time);else{this.synchronizeBuffered(t);for(var m,g=l(r);!(m=g()).done;){var y=m.value;void 0!==y.bufferedStart&&void 0!==y.bufferedEnd?2!==y.status&&this._bufferedHistory.addBufferedSegment(y.infos,{start:y.bufferedStart,end:y.bufferedEnd}):i.Z.debug("SI: buffered range not known after sync. Skipping history.",y.start,y.end)}}}},t.getInventory=function(){return this._inventory},t.getHistoryFor=function(e){return this._bufferedHistory.getHistoryFor(e)},e}();function f(e){if(void 0===e.bufferedStart||1!==e.status)return!1;var t=e.start,n=e.end-t,i=r.Z.getCurrent(),a=i.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,o=i.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(t-e.bufferedStart)<=a&&(void 0===e.bufferedEnd||e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-n)<=Math.min(o,n/3))}function v(e){if(void 0===e.bufferedEnd||1!==e.status)return!1;var t=e.start,n=e.end,i=n-t,a=r.Z.getCurrent(),o=a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,s=a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(n-e.bufferedEnd)<=o&&null!=e.bufferedStart&&e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-i)<=Math.min(s,i/3)}function p(e,t,n,a){var o=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedStart?(e.bufferedStartt&&(n.precizeEnd||e.start-n.end<=o)?(i.Z.debug("SI: buffered start is end of previous segment",a,t,e.start,n.end),e.bufferedStart=n.end,f(e)&&(e.start=n.end,e.precizeStart=!0)):e.start-t<=o?(i.Z.debug("SI: found true buffered start",a,t,e.start),e.bufferedStart=t,f(e)&&(e.start=t,e.precizeStart=!0)):tt&&(i.Z.debug("SI: Segment partially GCed at the end",n,e.bufferedEnd,t),e.bufferedEnd=t),!e.precizeEnd&&t-e.end<=a&&v(e)&&(e.precizeEnd=!0,e.end=t)):e.precizeEnd?(i.Z.debug("SI: buffered end is precize end",n,e.end),e.bufferedEnd=e.end):t-e.end<=a?(i.Z.debug("SI: found true buffered end",n,t,e.end),e.bufferedEnd=t,v(e)&&(e.end=t,e.precizeEnd=!0)):t>e.end?(i.Z.debug("SI: range end too far from expected end",n,t,e.end),e.bufferedEnd=e.end):(i.Z.debug("SI: Segment appears immediately garbage collected at the end",n,e.bufferedEnd,t),e.bufferedEnd=t)}var m,g=c,y=function(){function e(){this._segmentInventory=new g}var t=e.prototype;return t.synchronizeInventory=function(e){this._segmentInventory.synchronizeBuffered(this.getBufferedRanges(),e)},t.getInventory=function(){return this._segmentInventory.getInventory()},t.getPendingOperations=function(){return[]},t.getSegmentHistory=function(e){return this._segmentInventory.getHistoryFor(e)},e}();!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(m||(m={}))},4309:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2829),i=function(){function e(){this._ranges=[],this.length=0}var t=e.prototype;return t.insert=function(e,t){(0,r.kR)(this._ranges,{start:e,end:t}),this.length=this._ranges.length},t.remove=function(e,t){var n=[];e>0&&n.push({start:0,end:e}),t<1/0&&n.push({start:t,end:1/0}),this._ranges=(0,r.tn)(this._ranges,n),this.length=this._ranges.length},t.start=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].start},t.end=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].end},e}()},7839:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;return s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="CustomLoaderError",s.message=n,s.canRetry=i,s.isOfflineError=a,s.xhr=o,s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},5157:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;return u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="EncryptedMediaError",u.type=o.ZB.ENCRYPTED_MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1,"string"==typeof(null==a?void 0:a.keyStatuses)&&(u.keyStatuses=a.keyStatuses),u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},5992:function(e,t,n){"use strict";n.d(t,{SM:function(){return a},ZB:function(){return r},br:function(){return i}});var r={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"},i={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"},a={PIPELINE_LOAD_ERROR:"PIPELINE_LOAD_ERROR",PIPELINE_PARSE_ERROR:"PIPELINE_PARSE_ERROR",INTEGRITY_ERROR:"INTEGRITY_ERROR",MANIFEST_PARSE_ERROR:"MANIFEST_PARSE_ERROR",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"MANIFEST_INCOMPATIBLE_CODECS_ERROR",MANIFEST_UPDATE_ERROR:"MANIFEST_UPDATE_ERROR",MANIFEST_UNSUPPORTED_ADAPTATION_TYPE:"MANIFEST_UNSUPPORTED_ADAPTATION_TYPE",MEDIA_STARTING_TIME_NOT_FOUND:"MEDIA_STARTING_TIME_NOT_FOUND",MEDIA_TIME_BEFORE_MANIFEST:"MEDIA_TIME_BEFORE_MANIFEST",MEDIA_TIME_AFTER_MANIFEST:"MEDIA_TIME_AFTER_MANIFEST",MEDIA_TIME_NOT_FOUND:"MEDIA_TIME_NOT_FOUND",NO_PLAYABLE_REPRESENTATION:"NO_PLAYABLE_REPRESENTATION",MEDIA_IS_ENCRYPTED_ERROR:"MEDIA_IS_ENCRYPTED_ERROR",CREATE_MEDIA_KEYS_ERROR:"CREATE_MEDIA_KEYS_ERROR",KEY_ERROR:"KEY_ERROR",KEY_STATUS_CHANGE_ERROR:"KEY_STATUS_CHANGE_ERROR",KEY_UPDATE_ERROR:"KEY_UPDATE_ERROR",KEY_LOAD_ERROR:"KEY_LOAD_ERROR",KEY_LOAD_TIMEOUT:"KEY_LOAD_TIMEOUT",KEY_GENERATE_REQUEST_ERROR:"KEY_GENERATE_REQUEST_ERROR",INCOMPATIBLE_KEYSYSTEMS:"INCOMPATIBLE_KEYSYSTEMS",INVALID_ENCRYPTED_EVENT:"INVALID_ENCRYPTED_EVENT",INVALID_KEY_SYSTEM:"INVALID_KEY_SYSTEM",LICENSE_SERVER_CERTIFICATE_ERROR:"LICENSE_SERVER_CERTIFICATE_ERROR",MULTIPLE_SESSIONS_SAME_INIT_DATA:"MULTIPLE_SESSIONS_SAME_INIT_DATA",BUFFER_APPEND_ERROR:"BUFFER_APPEND_ERROR",BUFFER_FULL_ERROR:"BUFFER_FULL_ERROR",BUFFER_TYPE_UNKNOWN:"BUFFER_TYPE_UNKNOWN",MEDIA_ERR_BLOCKED_AUTOPLAY:"MEDIA_ERR_BLOCKED_AUTOPLAY",MEDIA_ERR_PLAY_NOT_ALLOWED:"MEDIA_ERR_PLAY_NOT_ALLOWED",MEDIA_ERR_NOT_LOADED_METADATA:"MEDIA_ERR_NOT_LOADED_METADATA",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_UNKNOWN:"MEDIA_ERR_UNKNOWN",MEDIA_SOURCE_NOT_SUPPORTED:"MEDIA_SOURCE_NOT_SUPPORTED",MEDIA_KEYS_NOT_SUPPORTED:"MEDIA_KEYS_NOT_SUPPORTED",DISCONTINUITY_ENCOUNTERED:"DISCONTINUITY_ENCOUNTERED",NONE:"NONE"}},7367:function(e,t,n){"use strict";function r(e,t,n){return e+" ("+t+") "+n}n.d(t,{Z:function(){return r}})},8750:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(9822),i=n(5389);function a(e,t){var n=t.defaultCode,a=t.defaultReason;if((0,r.Z)(e))return e;var o=e instanceof Error?e.toString():a;return new i.Z(n,o)}},9822:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(5157),i=n(5992),a=n(3714),o=n(9362),s=n(5389);function u(e){return(e instanceof r.Z||e instanceof a.Z||e instanceof s.Z||e instanceof o.Z)&&Object.keys(i.ZB).indexOf(e.type)>=0}},3714:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="MediaError",u.type=o.ZB.MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1;var l=null==a?void 0:a.adaptation;if(void 0!==l)switch(l.type){case"audio":u.trackInfo={type:"audio",track:l.toAudioTrack()};break;case"video":u.trackInfo={type:"video",track:l.toVideoTrack()};break;case"text":u.trackInfo={type:"text",track:l.toTextTrack()}}return u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9362:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="NetworkError",a.type=o.ZB.NETWORK_ERROR,a.xhr=void 0===i.xhr?null:i.xhr,a.url=i.url,a.status=i.status,a.errorType=i.type,a.code=n,a.message=(0,s.Z)(a.name,a.code,i.message),a.fatal=!1,a}return(0,i.Z)(t,e),t.prototype.isHttpError=function(e){return this.errorType===o.br.ERROR_HTTP_CODE&&this.status===e},t}((0,a.Z)(Error))},5389:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="OtherError",a.type=o.ZB.OTHER_ERROR,a.code=n,a.message=(0,s.Z)(a.name,a.code,i),a.fatal=!1,a}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9105:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;switch(s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="RequestError",s.url=n,void 0!==o&&(s.xhr=o),s.status=i,s.type=a,a){case"TIMEOUT":s.message="The request timed out";break;case"ERROR_EVENT":s.message="An error prevented the request to be performed successfully";break;case"PARSE_ERROR":s.message="An error happened while formatting the response data";break;case"ERROR_HTTP_CODE":s.message="An HTTP status code indicating failure was received: "+String(s.status)}return s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},7273:function(e,t){"use strict";t.Z={dashParsers:{wasm:null,js:null},createDebugElement:null,directfile:null,decrypt:null,htmlTextTracksBuffer:null,htmlTextTracksParsers:{},imageBuffer:null,imageParser:null,mediaSourceInit:null,nativeTextTracksBuffer:null,nativeTextTracksParsers:{},transports:{}}},7874:function(e,t,n){"use strict";var r=n(7273);t.Z=r.Z},3887:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(8894),i=new(function(){function e(){this.error=r.Z,this.warn=r.Z,this.info=r.Z,this.debug=r.Z,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentLevel="NONE"}var t=e.prototype;return t.setLevel=function(e){var t,n=this._levels[e];"number"==typeof n?(t=n,this._currentLevel=e):(t=0,this._currentLevel="NONE"),this.error=t>=this._levels.ERROR?console.error.bind(console):r.Z,this.warn=t>=this._levels.WARNING?console.warn.bind(console):r.Z,this.info=t>=this._levels.INFO?console.info.bind(console):r.Z,this.debug=t>=this._levels.DEBUG?console.log.bind(console):r.Z},t.getLevel=function(){return this._currentLevel},t.hasLevel=function(e){return this._levels[e]>=this._levels[this._currentLevel]},e}())},8999:function(e,t,n){"use strict";n.d(t,{r:function(){return h},Z:function(){return m}});var r=n(3887),i=n(3274),a=n(1946),o=n(7829);var s="undefined"!=typeof window&&"function"==typeof window.Set&&"function"==typeof Array.from?function(e){return Array.from(new Set(e))}:function(e){return e.filter((function(e,t,n){return n.indexOf(e)===t}))},u=n(3774);function l(e){return null!=u.J&&("function"!=typeof u.J.isTypeSupported||u.J.isTypeSupported(e))}var d=n(4791);function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this.trickModeTracks=i.map((function(t){return new e(t)})));for(var d=t.representations,c=[],f=!1,v=0;v0&&!r.isSupported){var i=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:r});n.contentWarnings.push(i)}return r})).filter((function(e){return e.representations.length>0}));if(s.every((function(e){return!e.isSupported}))&&o.length>0&&("video"===i||"audio"===i))throw new a.Z("MANIFEST_PARSE_ERROR","No supported "+i+" adaptations");return s.length>0&&(r[i]=s),r}),{}),!Array.isArray(this.adaptations.video)&&!Array.isArray(this.adaptations.audio))throw new a.Z("MANIFEST_PARSE_ERROR","No supported audio and video tracks.");this.duration=e.duration,this.start=e.start,null!=this.duration&&null!=this.start&&(this.end=this.start+this.duration),this.streamEvents=void 0===e.streamEvents?[]:e.streamEvents}var t=e.prototype;return t.getAdaptations=function(){var e=this.adaptations;return(0,v.Z)(e).reduce((function(e,t){return null!=t?e.concat(t):e}),[])},t.getAdaptationsForType=function(e){var t=this.adaptations[e];return null==t?[]:t},t.getAdaptation=function(e){return(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},t.getSupportedAdaptations=function(e){if(void 0===e)return this.getAdaptations().filter((function(e){return e.isSupported}));var t=this.adaptations[e];return void 0===t?[]:t.filter((function(e){return e.isSupported}))},t.containsTime=function(e,t){return e>=this.start&&(void 0===this.end||ethis.end)},e}(),h=function(){function e(e){this._url=e.media}var t=e.prototype;return t.getInitSegment=function(){return null},t.getSegments=function(){return[{id:"0",isInit:!1,number:0,url:this._url,time:0,end:Number.MAX_VALUE,duration:Number.MAX_VALUE,complete:!0,privateInfos:{},timescale:1}]},t.getFirstAvailablePosition=function(){},t.getLastAvailablePosition=function(){},t.getEnd=function(){},t.awaitSegmentBetween=function(){return!1},t.shouldRefresh=function(){return!1},t.checkDiscontinuity=function(){return null},t.isSegmentStillAvailable=function(){return!0},t.canBeOutOfSyncError=function(){return!1},t.isStillAwaitingFutureSegments=function(){return!1},t.isInitialized=function(){return!0},t._replace=function(){o.Z.warn("Tried to replace a static RepresentationIndex")},t._update=function(){o.Z.warn("Tried to update a static RepresentationIndex")},e}();!function(e){e[e.Full=0]="Full",e[e.Partial=1]="Partial"}(r||(r={}));var m=n(5138);function g(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0)o.Z.warn("Manifest: "+y.length+" new Representations found when merging."),(h=t.representations).push.apply(h,y),v.push.apply(v,y)}l=e},l=0;l0){o.Z.warn("Manifest: "+s.length+" new Adaptations found when merging.");for(var d,c=g(s);!(d=c()).done;){var f=d.value,v=e.adaptations[f.type];void 0===v?e.adaptations[f.type]=[f]:v.push(f),i.addedAdaptations.push(f)}}return i}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&r._addSupplementaryImageAdaptations(u),o.length>0&&r._addSupplementaryTextAdaptations(o),r}(0,i.Z)(t,e);var n=t.prototype;return n.getPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return e===t.id}))},n.getPeriodForTime=function(e){for(var t=null,n=this.periods.length-1;n>=0;n--){var r=this.periods[n];if(r.containsTime(e,t))return r;t=r}},n.getNextPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return t.start>e}))},n.getPeriodAfter=function(e){var t=e.end;if(void 0===t)return null;var n=(0,s.Z)(this.periods,(function(e){return void 0===e.end||t0&&this.trigger("decipherabilityUpdate",t)},n.getAdaptations=function(){(0,c.Z)("manifest.getAdaptations() is deprecated. Please use manifest.period[].getAdaptations() instead");var e=this.periods[0];if(void 0===e)return[];var t=e.adaptations,n=[];for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];n.push.apply(n,i)}return n},n.getAdaptationsForType=function(e){(0,c.Z)("manifest.getAdaptationsForType(type) is deprecated. Please use manifest.period[].getAdaptationsForType(type) instead");var t=this.periods[0];if(void 0===t)return[];var n=t.adaptations[e];return void 0===n?[]:n},n.getAdaptation=function(e){return(0,c.Z)("manifest.getAdaptation(id) is deprecated. Please use manifest.period[].getAdaptation(id) instead"),(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},n._addSupplementaryImageAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).map((function(e){var n=e.mimeType,r=e.url,i="gen-image-ada-"+T(),o="gen-image-rep-"+T(),s=(0,d.$)(r),u=r.substring(0,s),l=r.substring(s),c=new f.Z({id:i,type:"image",representations:[{bitrate:0,cdnMetadata:[{baseUrl:u}],id:o,mimeType:n,index:new h({media:l})}]},{isManuallyAdded:!0});if(c.representations.length>0&&!c.isSupported){var v=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:c});t.contentWarnings.push(v)}return c}));if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.image=null!=r.image?r.image.concat(n):n}},n._addSupplementaryTextAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).reduce((function(e,n){var r=n.mimeType,i=n.codecs,o=n.url,s=n.language,u=n.languages,l=n.closedCaption,c=null!=s?[s]:null!=u?u:[],v=(0,d.$)(o),p=o.substring(0,v),m=o.substring(v);return e.concat(c.map((function(e){var n="gen-text-ada-"+T(),o="gen-text-rep-"+T(),s=new f.Z({id:n,type:"text",language:e,closedCaption:l,representations:[{bitrate:0,cdnMetadata:[{baseUrl:p}],id:o,mimeType:r,codecs:i,index:new h({media:m})}]},{isManuallyAdded:!0});if(s.representations.length>0&&!s.isSupported){var u=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:s});t.contentWarnings.push(u)}return s})))}),[]);if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.text=null!=r.text?r.text.concat(n):n}},n._performUpdate=function(e,t){var n;if(this.availabilityStartTime=e.availabilityStartTime,this.expired=e.expired,this.isDynamic=e.isDynamic,this.isLive=e.isLive,this.isLastPeriodKnown=e.isLastPeriodKnown,this.lifetime=e.lifetime,this.contentWarnings=e.contentWarnings,this.suggestedPresentationDelay=e.suggestedPresentationDelay,this.transport=e.transport,this.publishTime=e.publishTime,t===r.Full)this._timeBounds=e._timeBounds,this.uris=e.uris,n=function(e,t){for(var n={updatedPeriods:[],addedPeriods:[],removedPeriods:[]},i=0,a=0;ae.length)return o.Z.error("Manifest: error when updating Periods"),n;if(i0&&(e.push.apply(e,b),(y=n.addedPeriods).push.apply(y,b)),n}(this.periods,e.periods);else{this._timeBounds.maximumTimeData=e._timeBounds.maximumTimeData,this.updateUrl=e.uris[0],n=function(e,t){var n,i={updatedPeriods:[],addedPeriods:[],removedPeriods:[]};if(0===e.length)return e.splice.apply(e,[0,0].concat(t)),(n=i.addedPeriods).push.apply(n,t),i;if(0===t.length)return i;var s=e[e.length-1];if(s.startc){var E;o.Z.warn("Manifest: old Periods not found in new when updating, removing");var k=e.splice(c,p-c);(E=i.removedPeriods).push.apply(E,k),p=c}var w=_(e[p],v,r.Full);i.updatedPeriods.push({period:e[p],result:w})}c++}if(c0;){var s=this.periods[0];if(void 0===s.end||s.end>i)break;this.periods.shift()}}this.adaptations=void 0===this.periods[0]?{}:this.periods[0].adaptations,this.trigger("manifestUpdate",n)},t}(u.Z);var w=k},520:function(e,t,n){"use strict";n.d(t,{K:function(){return a},z:function(){return i}});var r=n(1946);function i(e,t){return e.segment.id===t.segment.id&&e.representation.uniqueId===t.representation.uniqueId}function a(e){if((0,r.Z)(e))return"";var t=e.period,n=e.adaptation,i=e.representation,a=e.segment;return n.type+" P: "+t.id+" A: "+n.id+" R: "+i.id+" S: "+(a.isInit?"init":a.complete?a.time+"-"+a.duration:""+a.time)}},2689:function(e,t,n){"use strict";n.d(t,{s:function(){return r}});var r=Math.pow(2,32)-1},2297:function(e,t,n){"use strict";n.d(t,{Qy:function(){return f},Xj:function(){return p},iz:function(){return c},lp:function(){return d},nR:function(){return v},t_:function(){return l},vA:function(){return u}});var r=n(3887),i=n(811),a=n(6968);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ni)return null;s=(0,a.pV)(e,r),r+=8}if(s<0)throw new Error("ISOBMFF: Size out of range");if(n===t)return 1970628964===t&&(r+=16),[o,r,o+s];o+=s}return null}function v(e,t,n,r,i){for(var o,s=e.length,u=0;us)return;o=(0,a.pV)(e,l),l+=8}if(1970628964===d&&l+16<=s&&(0,a.pX)(e,l)===t&&(0,a.pX)(e,l+4)===n&&(0,a.pX)(e,l+8)===r&&(0,a.pX)(e,l+12)===i)return l+=16,e.subarray(l,u+o)}}function p(e){var t=e.length;if(t<8)return r.Z.warn("ISOBMFF: box inferior to 8 bytes, cannot find offsets"),null;var n=0,i=(0,a.pX)(e,n);n+=4;var o=(0,a.pX)(e,n);if(n+=4,0===i)i=t;else if(1===i){if(n+8>t)return r.Z.warn("ISOBMFF: box too short, cannot find offsets"),null;i=(0,a.pV)(e,n),n+=8}if(i<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===o&&(n+=16),[0,n,i]}},6807:function(e,t,n){"use strict";n.d(t,{E3:function(){return u},Le:function(){return o},XA:function(){return i},fs:function(){return s},uq:function(){return a}});var r=n(2297);function i(e){var t=(0,r.t_)(e,1836019558);return null===t?null:(0,r.t_)(t,1953653094)}function a(e){return(0,r.lp)(e,1836019558).reduce((function(e,t){var n=(0,r.t_)(t,1953653094);return null!==n&&e.push(n),e}),[])}function o(e){return(0,r.t_)(e,1835295092)}function s(e){var t=(0,r.t_)(e,1836019574);if(null===t)return null;var n=(0,r.t_)(t,1953653099);return null===n?null:(0,r.t_)(n,1835297121)}function u(e,t){return void 0===t&&(t=0),(0,r.t_)(e.subarray(t),1701671783)}},6490:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},Y:function(){return u}});var r=n(3887);var i="function"==typeof Uint8Array.prototype.slice?function(e,t,n){return e.slice(t,n)}:function(e,t,n){return new Uint8Array(Array.prototype.slice.call(e,t,n))},a=n(3635),o=n(2297);function s(e){var t=0,n=(0,o.t_)(e,1836019574);if(null===n)return[];for(var a=[];t1)r.Z.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length)){var o=i(e,n,n+16);return(0,a.ci)(o)}}}},4644:function(e,t,n){"use strict";n.d(t,{J6:function(){return m},LD:function(){return h},MM:function(){return p},Qx:function(){return f},R0:function(){return y},Wf:function(){return c},s9:function(){return g}});var r=n(3887),i=n(6968),a=n(3635),o=n(2689),s=n(2297),u=n(6807);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;){var v=(0,i.pX)(e,o);o+=4;var p=2147483647&v;if(1===(2147483648&v)>>>31)throw new Error("sidx with reference_type `1` not yet implemented");var h=(0,i.pX)(e,o);o+=4,o+=4,c.push({time:l,duration:h,timescale:d,range:[r,r+p-1]}),l+=h,r+=p}return c}function f(e){var t=(0,u.XA)(e);if(null!==t){var n=(0,s.t_)(t,1952867444);if(null!==n){var r=n[0];return 1===r?(0,i.pV)(n,4):0===r?(0,i.pX)(n,4):void 0}}}function v(e){var t=(0,s.t_)(e,1952868452);if(null!==t){var n=1,r=(0,i.QI)(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),(0,i.pX)(t,n)}}function p(e){var t=(0,u.uq)(e);if(0!==t.length){for(var n,r=0,a=l(t);!(n=a()).done;){var o=n.value,d=(0,s.t_)(o,1953658222);if(null===d)return;var c=0,f=d[c];if(c+=1,f>1)return;var p=(0,i.QI)(d,c);c+=3;var h=(256&p)>0,m=0;if(!h&&void 0===(m=v(o)))return;var g=(1&p)>0,y=(4&p)>0,_=(512&p)>0,b=(1024&p)>0,S=(2048&p)>0,T=(0,i.pX)(d,c);c+=4,g&&(c+=4),y&&(c+=4);for(var E=T,k=0;E-- >0;)h?(k+=(0,i.pX)(d,c),c+=4):k+=m,_&&(c+=4),b&&(c+=4),S&&(c+=4);r+=k}return r}}function h(e){var t=(0,u.fs)(e);if(null!==t){var n=(0,s.t_)(t,1835296868);if(null!==n){var r=0,a=n[r];return r+=4,1===a?(0,i.pX)(n,r+16):0===a?(0,i.pX)(n,r+8):void 0}}}function m(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=(0,i.pX)(e,0);if(0===n){if(t>o.s){var r=new Uint8Array(t+8);return r.set((0,i.kh)(1),0),r.set(e.subarray(4,8),4),r.set((0,i.el)(t+8),8),r.set(e.subarray(8,t),16),r}return e.set((0,i.kh)(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set((0,i.el)(t),8),e}if(t<=o.s)return e.set((0,i.kh)(t),0),e;var a=new Uint8Array(t+8);return a.set((0,i.kh)(1),0),a.set(e.subarray(4,8),4),a.set((0,i.el)(t+8),8),a.set(e.subarray(8,t),16),a}function g(e){for(var t=[],n=0;n0)throw new Error("Unhandled version: "+s);var c=(0,r.dN)(e,t);t+=4;var f=(0,r.dN)(e,t);t+=4;var v=(0,i.uR)(e.subarray(t,t+4));t+=4;var p=(0,r.qb)(e,t);t+=2;var h=(0,r.qb)(e,t),m=[e[t+=2],e[t+1]].join(":"),g=1===e[t+=2];t=64;var y=[];if(0===c)throw new Error("bif: no images to parse");for(var _=0,b=null;t0,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return(0,a.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return(0,o.Z)(this._index,e,t,this._manifestBoundsCalculator,this._scaledPeriodEnd,this._isEMSGWhitelisted)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){var e=this._index;return 0===e.timeline.length?null:(0,i.zG)(Math.max(this._scaledPeriodStart,e.timeline[0].start),e)},t.getLastAvailablePosition=function(){var e,t=this._index.timeline;if(0===t.length)return null;var n=t[t.length-1],r=Math.min((0,i.jH)(n,null,this._scaledPeriodEnd),null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return(0,i.zG)(r,this._index)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.initializeIndex=function(e){for(var t=0;t0?Math.floor(d/l):0),C=A+M*w;C_)break;var D=null===g?null:(0,i.QB)(C,P)(g),N=C-e.indexTimeOffset,O=w;N<0&&(O=w+N,N=0);var L={id:String(C),time:N/m,end:(N+O)/m,duration:O/m,isInit:!1,range:I,timescale:1,url:D,number:P,timestampOffset:-e.indexTimeOffset/m,complete:R,privateInfos:{isEMSGWhitelisted:s}};S.push(L),C=A+ ++M*w}if(C>=p)return S;if(b+=x+1,void 0!==_&&b>_)return S}return S}},4784:function(e,t,n){"use strict";n.d(t,{QB:function(){return o},zA:function(){return a}});var r=n(6923);function i(e){return function(t,n,i){var a,o,s,u=(0,r.Z)(i)?parseInt(i,10):1;return a=String(e),o=u,(s=a.toString()).length>=o?s:(new Array(o+1).join("0")+s).slice(-o)}}function a(e,t,n){return function(e,t,n){return-1===e.indexOf("$")?e:e.replace(/\$\$/g,"$").replace(/\$RepresentationID\$/g,String(t)).replace(/\$Bandwidth(\%0(\d+)d)?\$/g,i(void 0===n?0:n))}(e,t,n)}function o(e,t){return function(n){return-1===n.indexOf("$")?n:n.replace(/\$\$/g,"$").replace(/\$Number(\%0(\d+)d)?\$/g,(function(e,n,r){if(void 0===t)throw new Error("Segment number not defined in a $Number$ scheme");return i(t)(e,n,r)})).replace(/\$Time(\%0(\d+)d)?\$/g,(function(t,n,r){if(void 0===e)throw new Error("Segment time not defined in a $Time$ scheme");return i(e)(t,n,r)}))}}},1707:function(e,t,n){"use strict";n.d(t,{Z:function(){return qe}});var r=n(7904),i=n(1946),a=n(6872),o=n(3887),s=n(3274),u=n(9829);function l(e){var t=Date.parse(e)-performance.now();if(!isNaN(t))return t;o.Z.warn("DASH Parser: Invalid clock received: ",e)}function d(e){for(var t=e.representations,n=null,r=0;r=0;t--){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=d(r);if(void 0===u)return{safe:void 0,unsafe:void 0};a=u}if(void 0!==i){var l=d(i);if(void 0===l)return{safe:void 0,unsafe:void 0};s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return o.Z.info("Parser utils: found Period with no segment. ","Going to previous one to calculate last position"),{safe:void 0,unsafe:void 0};if(null!==s)return null!==a?{safe:Math.min(a,s),unsafe:Math.max(a,s)}:{safe:s,unsafe:s};if(null!==a)return{safe:a,unsafe:a}}}return{safe:void 0,unsafe:void 0}}(e);return{minimumSafePosition:t,maximumSafePosition:n.safe,maximumUnsafePosition:n.unsafe}}var v=function(){function e(e){this._isDynamic=e.isDynamic,this._timeShiftBufferDepth=e.isDynamic&&void 0!==e.timeShiftBufferDepth?e.timeShiftBufferDepth:null,this._serverTimestampOffset=e.serverTimestampOffset,this._availabilityStartTime=e.availabilityStartTime}var t=e.prototype;return t.setLastPosition=function(e,t){this._lastPosition=e,this._positionTime=t},t.lastPositionIsKnown=function(){return this._isDynamic?null!=this._positionTime&&null!=this._lastPosition:null!=this._lastPosition},t.getEstimatedMinimumSegmentTime=function(){var e;if(!this._isDynamic||null===this._timeShiftBufferDepth)return 0;var t=null!==(e=this.getEstimatedLiveEdge())&&void 0!==e?e:this.getEstimatedMaximumPosition(0);return void 0!==t?t-this._timeShiftBufferDepth:void 0},t.getEstimatedLiveEdge=function(){if(this._isDynamic&&void 0!==this._serverTimestampOffset)return(performance.now()+this._serverTimestampOffset)/1e3-this._availabilityStartTime},t.getEstimatedMaximumPosition=function(e){if(!this._isDynamic)return this._lastPosition;var t=this.getEstimatedLiveEdge();return void 0!==t&&e!==1/0?t+e:void 0!==this._positionTime&&void 0!==this._lastPosition?Math.max(this._lastPosition-this._positionTime+performance.now()/1e3,0):this._lastPosition},e}();var p=n(9592),h=n(908),m=n(1679),g=n(3635);var y=n(8999),_=n(5138),b=n(7714),S=n(6923);function T(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var s=i-a.start;if(s%a.duration==0&&s/a.duration<=a.repeatCount)return{repeatNumberInPrevSegments:s/a.duration,prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInNewElements:0}}if(++o>=e.length)return null;if((a=e[o]).start===i)return{prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(a.start>i)return null}else for(var u=0,l=t[0],d=i;;){var c=l.getAttribute("d"),f=null===c?null:parseInt(c,10);if(null===f||Number.isNaN(f))return null;var v=l.getAttribute("r"),p=null===v?null:parseInt(v,10);if(null!==p){if(Number.isNaN(p)||p<0)return null;if(p>0){var h=n-d;if(h%f==0&&h/f<=p)return{repeatNumberInPrevSegments:0,repeatNumberInNewElements:h/f,prevSegmentsIdx:0,newElementsIdx:u}}d+=f*(p+1)}else d+=f;if(++u>=t.length)return null;var m=(l=t[u]).getAttribute("t"),g=null===m?null:parseInt(m,10);if(null!==g){if(Number.isNaN(g))return null;d=g}if(d===n)return{newElementsIdx:u,prevSegmentsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(d>i)return null}}(t,e);if(null===r)return o.Z.warn('DASH: Cannot perform "based" update. Common segment not found.'),z(e);var i=r.prevSegmentsIdx,a=r.newElementsIdx,s=r.repeatNumberInPrevSegments,u=r.repeatNumberInNewElements,l=t.length-i+a-1;if(l>=e.length)return o.Z.info('DASH: Cannot perform "based" update. New timeline too short'),z(e);var d=t.slice(i);if(s>0){var c=d[0];c.start+=c.duration*s,d[0].repeatCount-=s}if(u>0&&0!==a)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form.'),z(e);var f=d[d.length-1],v=V(e[l]),p=(null!==(n=v.repeatCount)&&void 0!==n?n:0)-u;if(v.duration!==f.duration||f.repeatCount>p)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form at the beginning.'),z(e);void 0!==v.repeatCount&&v.repeatCount>f.repeatCount&&(f.repeatCount=v.repeatCount);for(var h=[],m=[],g=l+1;g=Math.min(u,null!==(r=this._scaledPeriodEnd)&&void 0!==r?r:1/0))return!1;var d=(0,R.gT)(e,this._index);if(o.length>0&&null!==l&&!l.isLastOfTimeline){var c=o[o.length-1];if(d<(0,R.jH)(c,null,this._scaledPeriodEnd)+s+s)return!0}return!!this._isLastPeriod&&(void 0===this._scaledPeriodEnd?u+s>this._scaledPeriodStart&&void 0:d-sthis._scaledPeriodStart)},t.isSegmentStillAvailable=function(e){return!!e.isInit||(this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline()),function(e,t,n,r){var i=H(t,n,r);if(null===i)return!1;for(var a=0;ae.time)return!1;if(s===e.time)return void 0===o.range?void 0===e.range:null!=e.range&&o.range[0]===e.range[0]&&o.range[1]===e.range[1];if(o.repeatCount>=0&&void 0!==o.duration){var u=(s-o.start)/o.duration-1;return u%1==0&&u<=i.newRepeatCount}}return!1}(e,this._index,this._manifestBoundsCalculator,this._scaledPeriodEnd))},t.checkDiscontinuity=function(e){this._refreshTimeline();var t=this._index.timeline;return null===t&&(t=this._getTimeline(),this._index.timeline=t),(0,R._j)({timeline:t,timescale:this._index.timescale,indexTimeOffset:this._index.indexTimeOffset},e,this._scaledPeriodEnd)},t.canBeOutOfSyncError=function(e){return!!this._isDynamic&&(e instanceof D.Z&&e.isHttpError(404))},t._replace=function(e){this._parseTimeline=e._parseTimeline,this._index=e._index,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._manifestBoundsCalculator=e._manifestBoundsCalculator,this._isLastPeriod=e._isLastPeriod},t._update=function(e){null===this._index.timeline&&(this._index.timeline=this._getTimeline()),null===e._index.timeline&&(e._index.timeline=e._getTimeline()),(0,L.Z)(this._index.timeline,e._index.timeline)&&(this._index.startNumber=e._index.startNumber),this._index.availabilityTimeOffset=e._index.availabilityTimeOffset,this._index.availabilityTimeComplete=e._index.availabilityTimeComplete,this._index.endNumber=e._index.endNumber,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._isLastPeriod=e._isLastPeriod},t.isStillAwaitingFutureSegments=function(){var e;if(!this._isDynamic)return!1;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=this._index.timeline;if(0===t.length){if(void 0!==this._scaledPeriodEnd){var n=this._manifestBoundsCalculator.getEstimatedLiveEdge();if(void 0!==n&&(0,R.gT)(n,this._index)>this._scaledPeriodEnd)return!1}return this._isLastPeriod}var r=B(this._index.timescale),i=H(this._index,this._manifestBoundsCalculator,this._scaledPeriodEnd);if(null!==i&&!i.isLastOfTimeline){var a=Math.min(i.end,null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return!(void 0!==this._scaledPeriodEnd&&a+r>=this._scaledPeriodEnd)}if(!this._isLastPeriod)return!1;if(void 0===this._scaledPeriodEnd)return!0;var o=t[t.length-1];return(0,R.jH)(o,null,this._scaledPeriodEnd)+rn){if(r===n+1)return e.slice(0,i+1);var o=e.slice(0,i),s=Object.assign({},a),u=r-a.repeatCount-1;return s.repeatCount=Math.max(0,n-u),o.push(s),o}}return e}function H(e,t,n){if(e.timeline.length<=0)return null;if(e.availabilityTimeOffset===1/0){var r=e.timeline.length-1,i=e.timeline[r];return{isLastOfTimeline:!0,timelineIdx:r,newRepeatCount:i.repeatCount,end:(0,R.jH)(i,null,n)}}var a=t.getEstimatedMaximumPosition(e.availabilityTimeOffset);if(void 0===a){var o=e.timeline.length-1,s=e.timeline[o];return{isLastOfTimeline:!0,timelineIdx:o,newRepeatCount:s.repeatCount,end:(0,R.jH)(s,null,n)}}for(var u=e.timeline.length-1;u>=e.timeline.length;u--){var l=e.timeline[u],d=l.start+l.duration;if((0,R.zG)(d,e)<=a){var c=(0,R.jH)(l,e.timeline[u+1],n);if((0,R.zG)(c,e)<=a)return{isLastOfTimeline:u===e.timeline.length-1,timelineIdx:u,newRepeatCount:l.repeatCount,end:d};var f=(0,R.gT)(a,e)-l.start,v=Math.floor(f/l.duration);return(0,N.Z)(v>=1),{isLastOfTimeline:!1,timelineIdx:u,newRepeatCount:v-1,end:l.start+v*l.duration}}}return null}var j=G,q=function(){function e(e,t){var n,r,i=t.availabilityTimeOffset,a=t.manifestBoundsCalculator,o=t.isDynamic,s=t.periodEnd,u=t.periodStart,l=t.representationId,d=t.representationBitrate,c=t.isEMSGWhitelisted,f=null!==(n=e.timescale)&&void 0!==n?n:1;this._availabilityTimeOffset=i,this._manifestBoundsCalculator=a;var v=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,p=v-u*f;if(void 0===e.duration)throw new Error("Invalid SegmentTemplate: no duration");var h=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:(0,C.zA)(e.initialization.media,l,d),m=void 0===e.media?null:(0,C.zA)(e.media,l,d);this._index={duration:e.duration,timescale:f,indexRange:e.indexRange,indexTimeOffset:p,initialization:null==e.initialization?void 0:{url:h,range:e.initialization.range},url:m,presentationTimeOffset:v,startNumber:e.startNumber,endNumber:e.endNumber},this._isDynamic=o,this._periodStart=u,this._scaledRelativePeriodEnd=void 0===s?void 0:(s-u)*f,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return(0,M.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){var n=this._index,r=n.duration,i=n.startNumber,a=n.endNumber,o=n.timescale,s=n.url,u=this._periodStart*o,l=this._scaledRelativePeriodEnd,d=e*o-u,c=(e+t)*o-u,f=this._getFirstSegmentStart(),v=this._getLastSegmentStart();if(null==f||null==v)return[];var p=Math.max(f,d),h=Math.min(v,c);if(h+r<=p)return[];for(var m=[],g=null!=i?i:1,y=Math.floor(p/r),_=y*r;_<=h;_+=r){var b=y+g;if(void 0!==a&&b>a)return m;var S=null!=l&&_+r>l?l-_:r,T=_+u,E=_+this._index.presentationTimeOffset,k=null===s?null:(0,C.QB)(E,b)(s),w={id:String(b),number:b,time:T/o,end:(T+S)/o,duration:S/o,timescale:1,isInit:!1,scaledDuration:S/o,url:k,timestampOffset:-n.indexTimeOffset/o,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};m.push(w),y++}return m},t.getFirstAvailablePosition=function(){var e=this._getFirstSegmentStart();return null==e?e:e/this._index.timescale+this._periodStart},t.getLastAvailablePosition=function(){var e=this._getLastSegmentStart();if((0,i.Z)(e))return e;var t=this._estimateRelativeScaledEnd();return Math.min(e+this._index.duration,null!=t?t:1/0)/this._index.timescale+this._periodStart},t.getEnd=function(){if(!this._isDynamic)return this.getLastAvailablePosition();var e=this._estimateRelativeScaledEnd();if(void 0!==e){var t=this._index.timescale;return(e+this._periodStart*t)/t}},t.awaitSegmentBetween=function(e,t){if((0,N.Z)(e<=t),!this._isDynamic)return!1;var n=this._index.timescale,r=B(n),a=this._periodStart*n,o=e*n-a,s=t*n-a,u=this._getLastSegmentStart();if((0,i.Z)(u)){var l=this._estimateRelativeScaledEnd();return void 0===l?s+r>=0:s+r>=0&&od-r:s>d-r&&othis._periodStart?(a-this._periodStart)*i:0;return Math.floor(o/r)*r}},t._getLastSegmentStart=function(){var e,t,n=this._index,r=n.duration,i=n.timescale,o=n.endNumber,s=n.startNumber,u=void 0===s?1:s;if(this._isDynamic){var l=this._manifestBoundsCalculator.getEstimatedLiveEdge();if(void 0!==l&&void 0!==this._scaledRelativePeriodEnd&&this._scaledRelativePeriodEndg||h<2?m:(h-2)*r},t._estimateRelativeScaledEnd=function(){var e,t;if(void 0!==this._index.endNumber){var n=this._index.endNumber-(null!==(e=this._index.startNumber)&&void 0!==e?e:1)+1;return Math.max(Math.min(n*this._index.duration,null!==(t=this._scaledRelativePeriodEnd)&&void 0!==t?t:1/0),0)}if(void 0!==this._scaledRelativePeriodEnd)return Math.max(this._scaledRelativePeriodEnd,0)},e}();function Y(e,t){var n;if(0===t.length)return e;var r=t.map((function(e){return{url:e.value}}));if(0===e.length)return r;for(var i=[],a=0;a=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var m=t.parentSegmentTemplates.slice(),g=e.children.segmentTemplate;void 0!==g&&m.push(g);var y=I.Z.apply(void 0,[{}].concat(m));void 0===y.availabilityTimeOffset&&void 0===t.availabilityTimeOffset||(v.availabilityTimeOffset=(null!==(n=y.availabilityTimeOffset)&&void 0!==n?n:0)+(null!==(r=t.availabilityTimeOffset)&&void 0!==r?r:0)),i=j.isTimelineIndexArgument(y)?new j(y,v):new q(y,v)}else{var _=t.adaptation.children;if(void 0!==_.segmentBase){var b=_.segmentBase;i=new x.Z(b,v)}else if(void 0!==_.segmentList){var S=_.segmentList;i=new P(S,v)}else i=new q({duration:Number.MAX_VALUE,timescale:1,startNumber:0,media:""},v)}return i}(e,(0,I.Z)({},n,{availabilityTimeOffset:v,availabilityTimeComplete:m,unsafelyBaseOnPreviousRepresentation:p,adaptation:t,inbandEventStreams:h}));void 0===e.attributes.bitrate?(o.Z.warn("DASH: No usable bitrate found in the Representation."),g=0):g=e.attributes.bitrate;var _,b,T,E=Y(n.baseURLs,e.children.baseURLs),k={bitrate:g,cdnMetadata:0===E.length?[{baseUrl:"",id:void 0}]:E.map((function(e){return{baseUrl:e.url,id:e.serviceLocation}})),index:y,id:f};void 0!==e.children.supplementalProperties&&(0,s.Z)(e.children.supplementalProperties,(function(e){return"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===e.schemeIdUri&&"JOC"===e.value}))&&(k.isSpatialAudio=!0),void 0!==e.attributes.codecs?_=e.attributes.codecs:void 0!==t.attributes.codecs&&(_=t.attributes.codecs),void 0!==_&&(_="mp4a.40.02"===_?"mp4a.40.2":_,k.codecs=_),void 0!==e.attributes.supplementalCodecs?b=e.attributes.supplementalCodecs:void 0!==t.attributes.supplementalCodecs&&(b=t.attributes.supplementalCodecs),void 0!==b&&(k.supplementalCodecs=(T=b,(0,S.Z)(T)?T.trim().replace(Z,", "):"")),void 0!==e.attributes.frameRate?k.frameRate=e.attributes.frameRate:void 0!==t.attributes.frameRate&&(k.frameRate=t.attributes.frameRate),void 0!==e.attributes.height?k.height=e.attributes.height:void 0!==t.attributes.height&&(k.height=t.attributes.height),void 0!==e.attributes.mimeType?k.mimeType=e.attributes.mimeType:void 0!==t.attributes.mimeType&&(k.mimeType=t.attributes.mimeType),void 0!==e.attributes.width?k.width=e.attributes.width:void 0!==t.attributes.width&&(k.width=t.attributes.width);var w=void 0!==t.children.contentProtections?t.children.contentProtections:[];if(void 0!==e.children.contentProtections&&w.push.apply(w,e.children.contentProtections),w.length>0){var A=w.reduce((function(e,t){var n;if(void 0!==t.attributes.schemeIdUri&&"urn:uuid:"===t.attributes.schemeIdUri.substring(0,9)&&(n=t.attributes.schemeIdUri.substring(9).replace(/-/g,"").toLowerCase()),void 0!==t.attributes.keyId&&t.attributes.keyId.length>0){var r={keyId:t.attributes.keyId,systemId:n};void 0===e.keyIds?e.keyIds=[r]:e.keyIds.push(r)}if(void 0!==n){for(var i,a=[],o=X(t.children.cencPssh);!(i=o()).done;){var u=i.value;a.push({systemId:n,data:u})}if(a.length>0){var l,d=(0,s.Z)(e.initData,(function(e){return"cenc"===e.type}));if(void 0===d)e.initData.push({type:"cenc",values:a});else(l=d.values).push.apply(l,a)}}return e}),{keyIds:void 0,initData:[]});(Object.keys(A.initData).length>0||void 0!==A.keyIds&&A.keyIds.length>0)&&(k.contentProtections=A)}k.hdrInfo=$({adaptationProfiles:t.attributes.profiles,supplementalProperties:t.children.supplementalProperties,essentialProperties:t.children.essentialProperties,manifestProfiles:n.manifestProfiles,codecs:_}),c.push(k)},v=X(e);!(d=v()).done;)f();return c}function ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(n.sort(se),e[t]=n.map((function(e){return e[0]}))),e}),{});return c.video.sort(se),k(de,f),de}(E.children.adaptations,U),F=(null!==(a=t.xmlNamespaces)&&void 0!==a?a:[]).concat(null!==(u=E.attributes.namespaces)&&void 0!==u?u:[]),V=function(e,t,n){for(var r,i,a,o=[],s=ue(e);!(a=s()).done;)for(var u,l=a.value,d=l.attributes,c=d.schemeIdUri,f=void 0===c?"":c,v=d.timescale,p=void 0===v?1:v,h=n.concat(null!==(r=l.attributes.namespaces)&&void 0!==r?r:[]),m=ue(l.children.events);!(u=m()).done;){var y=u.value;if(void 0!==y.eventStreamData){var _=(null!==(i=y.presentationTime)&&void 0!==i?i:0)/p+t,b=void 0===y.duration?void 0:_+y.duration/p,S=void 0;if(y.eventStreamData instanceof Element)S=y.eventStreamData;else{var T=h.reduce((function(e,t){return e+"xmlns:"+t.key+'="'+t.value+'" '}),"","application/xml").documentElement.childNodes[0]}o.push({start:_,end:b,id:y.id,data:{type:"dash-event-stream",value:{schemeIdUri:f,timescale:p,element:S}}})}}return o}(E.children.eventStreams,x,F),z={id:v,start:x,end:M,duration:R,adaptations:B,streamEvents:V};if(l.unshift(z),!f.lastPositionIsKnown()){var K=function(e){for(var t,n=null,r=!0,a=(0,m.Z)(e).filter((function(e){return!(0,i.Z)(e)})),o=ue((0,p.Z)(a,(function(e){return e})));!(t=o()).done;)for(var s,u=ue(t.value.representations);!(s=u()).done;){var l=s.value.index.getLastAvailablePosition();null!==l&&(r=!1,"number"==typeof l&&(n=(0,i.Z)(n)?l:Math.max(n,l)))}if(!(0,i.Z)(n))return n;if(r)return null;return}(B);if(c)if("number"==typeof K){var G=performance.now()/1e3;f.setLastPosition(K,G)}else{var W=fe(t,x);if(void 0!==W){var H=W[0],j=W[1];f.setLastPosition(H,j)}}else"number"==typeof K&&f.setLastPosition(K)}},h=e.length-1;h>=0;h--)v();if(t.isDynamic&&!f.lastPositionIsKnown()){var T=fe(t,0);if(void 0!==T){var E=T[0],w=T[1];f.setLastPosition(E,w)}}return function(e){if(0===e.length)return[];for(var t=[e[0]],n=1;nr.start)&&(o.Z.warn("DASH: Updating overlapping Periods.",null==i?void 0:i.start,r.start),i.duration=r.start-i.start,i.end=r.start,!(i.duration>0))&&(t.pop(),0!==t.length);)i=t[t.length-1];t.push(r)}return t}(l)}function fe(e,t){if((0,i.Z)(e.clockOffset)){var n=Date.now()/1e3;if(n>=t)return o.Z.warn("DASH Parser: no clock synchronization mechanism found. Using the system clock instead."),[n-e.availabilityStartTime,performance.now()/1e3]}else{var r=e.clockOffset/1e3-e.availabilityStartTime,a=performance.now()/1e3,s=a+r;if(s>=t)return[s,a]}}function ve(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pe(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?t[0].value:void 0}(t);if(null!=_&&_.length>0)return{type:"needs-clock",value:{url:_,continue:function(i){return i.success?(n.externalClockOffset=l(i.data),e(t,n,r,!0)):(r.push(i.error),o.Z.warn("DASH Parser: Error on fetching the clock ressource",i.error),e(t,n,r,!0))}}}}}for(var b=[],S=0;S=0&&(d=0===m.minimumUpdatePeriod?a.Z.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:m.minimumUpdatePeriod);var R=f(I),M=R.minimumSafePosition,C=R.maximumSafePosition,P=R.maximumUnsafePosition,D=performance.now();if(g){var N;if(void 0!==C)N=C;else if(void 0===k)o.Z.warn("DASH Parser: use system clock to define maximum position"),N=Date.now()/1e3-b;else N=(performance.now()+k)/1e3-b;var O=w.getEstimatedLiveEdge();void 0===O&&(O=void 0!==P?P:N),p={isLinear:!0,maximumSafePosition:N,livePosition:O,time:D},c=M,null!==(x=null!=S?S:null)&&void 0!==c&&O-c>x&&(x=O-c)}else{c=void 0!==M?M:void 0!==(null===(i=I[0])||void 0===i?void 0:i.start)?I[0].start:0;var L=null!=Z?Z:1/0;if(void 0!==I[I.length-1]){var U=I[I.length-1],B=null!==(s=U.end)&&void 0!==s?s:void 0!==U.duration?U.start+U.duration:void 0;void 0!==B&&B=0;o--){var s,u=b[o].index,l=a[o],f=l.parsed,v=l.warnings,p=l.receivedTime,h=l.sendingTime,m=l.url;v.length>0&&r.push.apply(r,v);for(var g,y=ve(f);!(g=y()).done;){var _=g.value;d.set(_,{receivedTime:p,sendingTime:h,url:m})}(s=c.periods).splice.apply(s,[u,1].concat(f))}return e(t,n,r,i,d)}}}};function me(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function ge(e){for(var t={},n=0;n0){var s=Me(a,"cenc:pssh"),u=s[0],l=s[1];null!==l&&(o.Z.warn(l.message),t.push(l)),null!==u&&n.push(u)}}}return[{cencPssh:n},t]}(e.childNodes),n=t[0],r=t[1];return[{children:n,attributes:function(e){for(var t={},n=0;n0&&(r=r.concat(c));break;case"SegmentList":var f=Be(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=Ve(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=Ne(a),_=y[0],b=y[1];b.length>0&&(r=r.concat(b)),void 0!==_&&n.push(_);break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Ce(a)]:t.supplementalProperties.push(Ce(a))}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Pe(t,n),i=0;i0&&(r=r.concat(u));break;case"ContentComponent":t.contentComponent=ge(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[Ce(a)]:t.essentialProperties.push(Ce(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Ce(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=ze(a),c=d[0],f=d[1];t.representations.push(c),f.length>0&&(r=r.concat(f));break;case"Role":null==t.roles?t.roles=[Ce(a)]:t.roles.push(Ce(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Ce(a)]:t.supplementalProperties.push(Ce(a));break;case"SegmentBase":var v=Le(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Be(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=Ve(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var T=Ne(a),E=T[0],k=T[1];k.length>0&&(r=r.concat(k)),void 0!==E&&n.push(E)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Pe(t,n),i=0;i0&&(n=n.concat(d))}}return[t,n]}function We(e){for(var t={eventStreamData:e},n=[],r=Pe(t,n),i=0;i0&&(i=i.concat(_))}}return[{baseURLs:n,adaptations:r,eventStreams:a,segmentTemplate:t},i]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Pe(t,n),i=0;i",c=(new DOMParser).parseFromString(d,"text/xml");if(null==c||0===c.children.length)throw new Error("DASH parser: Invalid external ressources");for(var f=c.children[0].children,v=[],p=[],h=0;h0;){var r=e[0];if(r.start>=t)return n;if(-1===r.repeatCount)return n;if(0===r.repeatCount)e.shift(),n+=1;else{var i=e[1];if(void 0!==i&&i.start<=t)e.shift(),n+=1;else{if(r.duration<=0)return n;for(var a=r.start+r.duration,o=1;ar.repeatCount)){var s=r.repeatCount-o;return r.start=a,r.repeatCount=s,n+=o}e.shift(),n=r.repeatCount+1}}}return n}n.d(t,{Z:function(){return r}})},3911:function(e,t,n){"use strict";n.d(t,{KF:function(){return i},PZ:function(){return u},_j:function(){return l},gT:function(){return o},jH:function(){return a},zG:function(){return s}});var r=n(1946);function i(e,t,n){var i,a=e.repeatCount;return a>=0?a:(i=(0,r.Z)(t)?void 0!==n?n:Number.MAX_VALUE:t.start,Math.ceil((i-e.start)/e.duration)-1)}function a(e,t,n){var r=e.start,a=e.duration;return a<=0?r:r+(i(e,t,n)+1)*a}function o(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function s(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function u(e,t,n){return[e*n,(e+t)*n]}function l(e,t,n){var r=e.timeline,i=o(t,e);if(i<0)return null;var u=function(e,t){for(var n=0,r=e.length;n>>1;e[i].start<=t?n=i+1:r=i}return n-1}(r,i);if(u<0||u>=r.length-1)return null;var l=r[u];if(l.duration<=0)return null;var d=r[u+1];if(void 0===d)return null;var c=d.start;return i>=a(l,d,n)&&i=0;u--){var l=e[u].start;if(l===o){var d=n-u;return e.splice.apply(e,[u,d].concat(t)),!1}if(lo)return i.Z.warn("RepresentationIndex: Manifest update removed all previous segments"),e.splice.apply(e,[0,n].concat(t)),!0;if(void 0===c.repeatCount||c.repeatCount<=0)return c.repeatCount<0&&(c.repeatCount=Math.floor((o-c.start)/c.duration)-1),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;if(c.start+c.duration*(c.repeatCount+1)<=o)return e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;var f=(o-c.start)/c.duration-1;if(f%1==0&&c.duration===t[0].duration){var v=t[0].repeatCount<0?-1:t[0].repeatCount+f+1;return e.splice.apply(e,[u,n-u].concat(t)),e[u].start=c.start,e[u].repeatCount=v,!1}return i.Z.warn("RepresentationIndex: Manifest update removed previous segments"),e[u].repeatCount=Math.floor(f),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1}}var p=e[e.length-1],h=t[t.length-1];return void 0!==p.repeatCount&&p.repeatCount<0?p.start>h.start?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0):p.start+p.duration*(p.repeatCount+1)>=h.start+h.duration*(h.repeatCount+1)?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0)}},5734:function(e,t,n){"use strict";var r=n(6923),i=/&#([0-9]+);/g,a=/
/gi,o=/]*>([\s\S]*?)<\/style[^>]*>/i,s=/\s*

]+))?>(.*)/i,u=/]+?start="?([0-9]*)"?[^0-9]/i;function l(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var d,c,f=/]/gi,v=/]|<\/body>/gi,p=[],h=o.exec(e),m=Array.isArray(h)?h[1]:"";v.exec(e);var g,y=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);null!==r;){var i=r[1],a=l(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(m),_=function(e){var t=/p\s*{([^}]*)}/gi.exec(e);return null===t?"":t[1]}(m);if((0,r.Z)(n)&&void 0===(g=y[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;d=f.exec(e),c=v.exec(e),null!==d||null!==c;){if(null===d||null===c||d.index>=c.index)throw new Error("parse error");var b=e.slice(d.index,c.index),S=u.exec(b);if(!Array.isArray(S))throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return p;function E(e,n){for(var o=e.length;--o>=0;){var u=s.exec(e[o]);if(Array.isArray(u)){var l=u[1],d=u[2];if(g===l)if(" "===d)p[p.length-1].end=n;else{var c=document.createElement("DIV");c.className="rxp-texttrack-region";var f=document.createElement("DIV");f.className="rxp-texttrack-div",f.style.position="absolute",f.style.bottom="0",f.style.width="100%",f.style.color="#fff",f.style.textShadow="-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000";var v=document.createElement("div");v.className="rxp-texttrack-p",(0,r.Z)(_)&&(v.style.cssText=_);for(var h=d.split(a),m=0;m/gi,s=/]*>([\s\S]*?)<\/style[^>]*>/i,u=/\s*

]+))?>(.*)/i,l=/]+?start="?([0-9]*)"?[^0-9]/i;function d(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var c,f,v=/]/gi,p=/]|<\/body>/gi,h=[],m=s.exec(e),g=null!==m?m[1]:"";p.exec(e);var y,_=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);Array.isArray(r);){var i=r[1],a=d(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(g);if((0,i.Z)(n)&&void 0===(y=_[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;c=v.exec(e),f=p.exec(e),null!==c||null!==f;){if(null===c||null===f||c.index>=f.index)throw new Error("parse error");var b=e.slice(c.index,f.index),S=l.exec(b);if(null===S)throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return function(e){for(var t=[],n=0;n=0;)if(null!==(r=u.exec(e[s]))){var l=r,d=l[1],c=l[2];y===d&&(" "===c?h[h.length-1].end=n:h.push({text:(i=c,i.replace(o,"\n").replace(a,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}}},2061:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}function a(e){for(var t=[],n=0;n0&&(1===o.length?o[0].indexOf("--\x3e")>=0&&t.push(o):(o[1].indexOf("--\x3e")>=0||o[0].indexOf("--\x3e")>=0)&&t.push(o)),n=a}return t}},8675:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2061),i=n(788);function a(e,t){for(var n=e.split(/\r\n|\n|\r/),a=(0,r.Z)(n),s=[],u=0;u0){var l=document.createTextNode(o[s]);r.appendChild(l)}}else if("B"===a.nodeName){var d=e(a);d.style.fontWeight="bold",r.appendChild(d)}else if("I"===a.nodeName){var c=e(a);c.style.fontStyle="italic",r.appendChild(c)}else if("U"===a.nodeName){var f=e(a);f.style.textDecoration="underline",r.appendChild(f)}else if(u(a)&&"string"==typeof a.color){var v=e(a);v.style.color=a.color,r.appendChild(v)}else{var p=e(a);r.appendChild(p)}}return r}(t)}function u(e){return"FONT"===e.nodeName&&"color"in e}},8057:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7253),i=n(2061),a=n(788);function o(e,t){for(var n,o,s,u,l,d=e.split(/\r\n|\n|\r/),c=(0,i.Z)(d),f=[],v=0;v0){var _=p.getAttribute("xml:space"),b=(0,l.Z)(_)?"default"===_:o,T=(0,d.Z)({},i,(0,c.U)(g,[p],n,t));u.push.apply(u,e(p,T,[p].concat(a),b))}}return u}(e,(0,d.Z)({},r),[],i)}(e,n,r,i,s),T=0;T|\u2265/g,">").replace(/\u200E/g,"‎").replace(/\u200F/g,"‏").replace(/\u00A0/g," ")}else if((0,l.OE)(s))i+="\n";else if((0,l.jg)(s)&&s.nodeType===Node.ELEMENT_NODE&&s.childNodes.length>0){var c=s.getAttribute("xml:space");i+=n(s,(0,o.Z)(c)?"default"===c:t)}}return i}return n(e,t)}(t,v),y=(0,i.Z)(h+n,m+n,g);return null===y?null:((0,a.Z)(y)&&function(e,t){var n=t.extent;if((0,o.Z)(n)){var r=u._0.exec(n);null!=r&&(e.size=Number(r[1]))}switch(t.writingMode){case"tb":case"tblr":e.vertical="lr";break;case"tbrl":e.vertical="rl"}var i=t.origin;if((0,o.Z)(i))u._0.exec(i);var a=t.align;if((0,o.Z)(a)){e.align=a,"center"===a&&("center"!==e.align&&(e.align="middle"),e.position="auto");var s=c[a];e.positionAlign=void 0===s?"":s;var l=d[a];e.lineAlign=void 0===l?"":l}}(y,r),y)}var v=function(e,t){for(var n=(0,r.Z)(e,t),i=[],a=0;a0&&(t=n)}return t}function a(e){var t=e.getElementsByTagName("body");if(t.length>0)return t[0];var n=e.getElementsByTagName("tt:body");return n.length>0?n[0]:null}function o(e){var t=e.getElementsByTagName("style");if(t.length>0)return t;var n=e.getElementsByTagName("tt:style");return n.length>0?n:t}function s(e){var t=e.getElementsByTagName("region");if(t.length>0)return t;var n=e.getElementsByTagName("tt:region");return n.length>0?n:t}function u(e){var t=e.getElementsByTagName("p");if(t.length>0)return t;var n=e.getElementsByTagName("tt:p");return n.length>0?n:t}function l(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function d(e){return"span"===e.nodeName||"tt:span"===e.nodeName}n.d(t,{DM:function(){return s},H:function(){return a},OE:function(){return l},jF:function(){return i},jg:function(){return d},kd:function(){return u},vU:function(){return o}})},1138:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923),i=n(360);function a(e,t){for(var n=[],a=t;a=2)for(var r=function(r){var o=e[r];if(Array.isArray(/::cue {/.exec(o)))for(o=e[++r];(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)n+=o,o=e[++r];else{for(var s=[],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);(0,i.Z)(o)&&Array.isArray(u);)s.push(u[1]),o=e[++r],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);for(var l="";(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)l+=o,o=e[++r];s.forEach((function(e){void 0===t[e]?t[e]=l:t[e]+=l}))}a=r},a=1;a0&&n.appendChild(document.createElement("br")),o[s].length>0){var u=document.createTextNode(o[s]);n.appendChild(u)}}else{var c=e.nodeName.toLowerCase().split("."),f=[];if(c.forEach((function(e){(0,i.Z)(t[e])&&f.push(t[e])})),0!==f.length){var v=document.createAttribute("style");f.forEach((function(e){v.value+=e}));var p=(0,l.Z)(r,a)?a:"span";(n=document.createElement(p)).setAttributeNode(v)}else{var h=(0,l.Z)(r,a)?a:"span";n=document.createElement(h)}for(var m=0;m/,"").replace(/<([u,i,b,c])(\..*?)?(?: .*?)?>(.*?)<\/\1>/g,"<$1$2>$3"),r=(new DOMParser).parseFromString(n,"text/html").body.childNodes,i=[],a=0;a=2){var a=parseInt(i[1],10);isNaN(a)||(t.position=a,void 0!==i[2]&&(t.positionAlign=i[2]))}}(0,u.Z)(e.size)&&(t.size=e.size),"string"==typeof e.align&&(0,s.Z)(["start","center","end","left"],e.align)&&(t.align=e.align)}var d=n(7253);var c=function(e,t){var n=e.split(/\r\n|\n|\r/);if(!/^WEBVTT($| |\t)/.test(n[0]))throw new Error("Can't parse WebVTT: Invalid file.");for(var s,u,c,f,v=(0,o.yE)(n),p=(0,i.Z)(n,v),h=[],m=0;m/;if(o.test(e[0]))n=e[0],r=e.slice(1,e.length);else{if(!o.test(e[1]))return null;a=e[0],n=e[1],r=e.slice(2,e.length)}var s=function(e){var t=/^([\d:.]+)[ |\t]+-->[ |\t]+([\d:.]+)[ |\t]*(.*)$/.exec(e);if(null===t)return null;var n=i(t[1]),r=i(t[2]);return null==n||null==r?null:{start:n,end:r,settings:t[3].split(/ |\t/).reduce((function(e,t){var n=t.split(":");return 2===n.length&&(e[n[0]]=n[1]),e}),{})}}(n);return null===s?null:{start:s.start+t,end:s.end+t,settings:s.settings,payload:r,header:a}}},360:function(e,t,n){"use strict";n.d(t,{$4:function(){return s},JF:function(){return a},tq:function(){return o},yE:function(){return i}});var r=n(6923);function i(e){for(var t=0;t=0)return!0;var r=e[t+1];return void 0!==r&&r.indexOf("--\x3e")>=0}function s(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}},85:function(e,t,n){"use strict";n.d(t,{Z:function(){return ce}});var r=n(7874),i=n(8791),a=n(5861),o=n(4687),s=n.n(o),u=n(4597),l=n(9829);function d(e,t){return null===e?null:null===t.url?e.baseUrl:(0,l.Z)(e.baseUrl,t.url)}function c(e,t,n,r,i){return f.apply(this,arguments)}function f(){return(f=(0,a.Z)(s().mark((function e(t,n,r,i,a){var o,l,c;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.segment,l=d(t,o),!o.isInit&&null!==l){e.next=4;break}return e.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return e.next=6,(0,u.ZP)({url:l,responseType:"arraybuffer",timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i});case 6:return c=e.sent,e.abrupt("return",{resultType:"segment-loaded",resultData:c});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(e,t){var n,i=t.segment,a=t.period,o=e.data,s=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(s)throw new Error("Image data should not be downloaded in chunks");var u=null!==(n=i.timestampOffset)&&void 0!==n?n:0;return null===o||null===r.Z.imageParser?{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:{duration:i.duration,time:i.time},chunkOffset:u,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}:{segmentType:"media",chunkData:{data:r.Z.imageParser(new Uint8Array(o)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkSize:void 0,chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkOffset:u,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}var p=n(6872),h=n(8750),m=n(3887),g=n(1989),y=n(8026),_=n(3635);function b(e){var t=e.aggressiveMode,n=e.referenceDateTime,i=void 0!==e.serverSyncInfos?e.serverSyncInfos.serverTimestamp-e.serverSyncInfos.clientTime:void 0;return function(a,o,s,l,d){var c,f=a.responseData,v=o.externalClockOffset,b=null!==(c=a.url)&&void 0!==c?c:o.originalUrl,S=null!=i?i:v,T={aggressiveMode:!0===t,unsafelyBaseOnPreviousManifest:o.unsafeMode?o.previousManifest:null,url:b,referenceDateTime:n,externalClockOffset:S},E=r.Z.dashParsers;if(null===E.wasm||"uninitialized"===E.wasm.status||"failure"===E.wasm.status)return m.Z.debug("DASH: WASM MPD Parser not initialized. Running JS one."),w();var k=function(e){if(e instanceof ArrayBuffer)return e;if("string"==typeof e)return(0,_.tG)(e).buffer;if(e instanceof Document)return(0,_.tG)(e.documentElement.innerHTML).buffer;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return function(e){var t=new DataView(e);if(61371===t.getUint16(0)&&191===t.getUint8(2))return!0;if(65279===t.getUint16(0)||65534===t.getUint16(0))return!1;return!0}(k)?"initialized"===E.wasm.status?(m.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T))):(m.Z.debug("DASH: Awaiting WASM initialization before parsing the MPD."),E.wasm.waitForInitialization().catch((function(){})).then((function(){return null===E.wasm||"initialized"!==E.wasm.status?(m.Z.warn("DASH: WASM MPD parser initialization failed. Running JS parser instead"),w()):(m.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T)))}))):(m.Z.info("DASH: MPD doesn't seem to be UTF-8-encoded. Running JS parser instead of the WASM one."),w());function w(){if(null===E.js)throw new Error("No MPD parser is imported");var e=function(e){if(e instanceof ArrayBuffer)return(new DOMParser).parseFromString((0,_.uR)(new Uint8Array(e)),"text/xml");if("string"==typeof e)return(new DOMParser).parseFromString(e,"text/xml");if(e instanceof Document)return e;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return A(E.js(e,T))}function A(t){if("done"===t.type)return t.value.warnings.length>0&&s(t.value.warnings),l.isCancelled()?Promise.reject(l.cancellationError):{manifest:new g.ZP(t.value.parsed,e),url:b};var n=t.value,r=n.urls.map((function(e){return d((function(){var t=p.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT;return"string"===n.format?(0,u.ZP)({url:e,responseType:"text",timeout:t,cancelSignal:l}):(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:t,cancelSignal:l})})).then((function(e){if("string"===n.format){if("string"!=typeof e.responseData)throw new Error("External DASH resources should have been a string");return(0,y.Z)(e,{responseData:{success:!0,data:e.responseData}})}if(!(e.responseData instanceof ArrayBuffer))throw new Error("External DASH resources should have been ArrayBuffers");return(0,y.Z)(e,{responseData:{success:!0,data:e.responseData}})}),(function(e){var t=(0,h.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"An unknown error occured when parsing ressources."});return(0,y.Z)({},{size:void 0,requestDuration:void 0,responseData:{success:!1,error:t}})}))}));return Promise.all(r).then((function(e){return n.format,A(n.continue(e))}))}}}var S=n(7839),T=n(9105),E=n(5992),k=n(1946),w="function"==typeof Headers?Headers:null,A="function"==typeof AbortController?AbortController:null;function I(){return"function"==typeof window.fetch&&!(0,k.Z)(A)&&!(0,k.Z)(w)}var Z=n(8806),x=n(281);function R(e,t){return"audio"===e||"video"===e?"video/mp4"===t.mimeType||"audio/mp4"===t.mimeType?"mp4":"video/webm"===t.mimeType||"audio/webm"===t.mimeType?"webm":void 0:"text"===e&&"application/mp4"===t.mimeType?"mp4":void 0}var M=n(288),C=n(4460);function P(e){return function(t,n,r,i,a){return new Promise((function(s,u){var l=new M.ZP,d=l.linkToSignal(i);function c(){l.signal.deregister(u),d()}l.signal.register(u),e(t,n,r,l.signal,Object.assign(Object.assign({},a),{onNewChunk:function(e){try{o(e),a.onNewChunk(e)}catch(e){c(),l.cancel(),u(e)}}})).then((function(e){if(c(),!l.isUsed()){if("segment-loaded"===e.resultType)try{o(e.resultData.responseData)}catch(e){return void u(e)}s(e)}}),(function(e){c(),u(e)}))}));function o(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&"mp4"===R(n.adaptation.type,n.representation)&&(0,C.Z)(new Uint8Array(e),n.segment.isInit)}}}var D=n(6968);function N(e,t,n,r,i){if(void 0===t.range)return(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(void 0===t.indexRange)return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(t.range[1]+1===t.indexRange[0])return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)([t.range[0],t.indexRange[1]])},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));var a=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.indexRange)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress});return Promise.all([a,o]).then((function(t){var n=t[0],r=t[1],i=(0,D.zo)(new Uint8Array(n.responseData),new Uint8Array(r.responseData)),a=Math.min(n.sendingTime,r.sendingTime),o=Math.max(n.receivedTime,r.receivedTime);return{resultType:"segment-loaded",resultData:{url:e,responseData:i,size:n.size+r.size,requestDuration:o-a,sendingTime:a,receivedTime:o}}}))}var O=n(8766);function L(e,t,n,r,i){var o=t.segment,u=void 0!==o.range?{Range:(0,x.Z)(o.range)}:void 0,l=null;return function(e){var t;if(!(0,k.Z)(e.headers))if((0,k.Z)(w))t=e.headers;else{t=new w;for(var n=Object.keys(e.headers),r=0;r=300)throw m.Z.warn("Fetch: Request HTTP Error",t.status,t.url),new T.Z(t.url,t.status,E.br.ERROR_HTTP_CODE);if((0,k.Z)(t.body))throw new T.Z(t.url,t.status,E.br.PARSE_ERROR);var n=t.headers.get("Content-Length"),r=(0,k.Z)(n)||isNaN(+n)?void 0:+n,i=t.body.getReader(),u=0;return l();function l(){return c.apply(this,arguments)}function c(){return(c=(0,a.Z)(s().mark((function n(){var a,o,c,f,p;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.read();case 2:if((a=n.sent).done||(0,k.Z)(a.value)){n.next=11;break}return u+=a.value.byteLength,o=performance.now(),c={url:t.url,currentTime:o,duration:o-d,sendingTime:d,chunkSize:a.value.byteLength,chunk:a.value.buffer,size:u,totalSize:r},e.onData(c),n.abrupt("return",l());case 11:if(!a.done){n.next=16;break}return v(),f=performance.now(),p=f-d,n.abrupt("return",{requestDuration:p,receivedTime:f,sendingTime:d,size:u,status:t.status,url:t.url});case 16:return n.abrupt("return",l());case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}})).catch((function(t){if(null!==u)throw u;if(v(),l)throw m.Z.warn("Fetch: Request timeouted."),new T.Z(e.url,0,E.br.TIMEOUT);if(t instanceof T.Z)throw t;throw m.Z.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new T.Z(e.url,0,E.br.ERROR_EVENT)}))}({url:e,headers:u,onData:function(e){var t=new Uint8Array(e.chunk),n=function(e){for(var t=0,n=[];te.length)return[n,r];var o=(0,O.Z)(r,1835295092);if(o<0)return[n,r];var s=t+o+(0,D.pX)(e,o+t);if(s>e.length)return[n,r];var u=Math.max(a,s),l=e.subarray(t,u);n.push(l),t=u}return[n,null]}(null!==l?(0,D.zo)(l,t):t),a=n[0];l=n[1];for(var o=0;o0)for(var v=0;v=Math.pow(2,8-n))return n}function ee(e,t){var n=J(e,t);if(null==n)return m.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return m.Z.warn("webm: impossible length"),null;for(var r=0,i=0;ie.length)return m.Z.warn("webm: impossible length"),null;for(var r=(e[t]&(1<<8-n)-1)*Math.pow(2,8*(n-1)),i=1;i=i)return!0}return!1}(r,t);return{inbandEvents:a,needsManifestRefresh:o}}}function oe(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a,o=n.period,s=n.adaptation,u=n.representation,l=n.segment,d=n.manifest,c=e.data,f=e.isChunked,v=[o.start,o.end];if(null===c)return l.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionDataUpdate:!1,appendWindow:v};var p=c instanceof Uint8Array?c:new Uint8Array(c),h=R(s.type,u),m="mp4"===h||void 0===h,g=!1;if(m){var y,_=(0,B.Z)(p);l.isInit&&(y=null!==(i=(0,F.R0)(p))&&void 0!==i?i:void 0),(_.length>0||void 0!==y)&&(g=u._addProtectionData("cenc",y,_))}if(!l.isInit){var b=m?ie(p,f,l,r):null,S=null!==(a=l.timestampOffset)&&void 0!==a?a:0;if(m){var T=(0,F.s9)(p);if(void 0!==T){var E=ae(T.filter((function(e){return void 0!==l.privateInfos&&void 0!==l.privateInfos.isEMSGWhitelisted&&l.privateInfos.isEMSGWhitelisted(e)})),d.publishTime);if(void 0!==E){var w=E.needsManifestRefresh,A=E.inbandEvents;return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,appendWindow:v,inbandEvents:A,protectionDataUpdate:g,needsManifestRefresh:w}}}}return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,protectionDataUpdate:g,appendWindow:v}}var I=l.indexRange,Z=null;if("webm"===h)Z=function(e,t){var n=X(V,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=Q(e,r);if(null==a)return null;var o=$(e,r);if(null==o)return null;var s=X(W,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l0)){var x=Z[Z.length-1];Array.isArray(x.range)&&(x.range[1]=1/0)}u.index instanceof re.Z&&null!==Z&&Z.length>0&&u.index.initializeIndex(Z);var M=m?(0,F.LD)(p):"webm"===h?Q(p,0):void 0,C=(0,k.Z)(M)?void 0:M;return{segmentType:"init",initializationData:p,initializationDataSize:p.length,protectionDataUpdate:g,initTimescale:C}}}var se=n(6807);function ue(e,t,n,r){var i,a,o=e.segment,s=e.adaptation,u=e.representation;if(o.isInit)return null;null===n?r?(i=o.time,a=o.end):m.Z.warn("Transport: Unavailable time data for current text track."):(i=n.time,void 0!==n.duration?a=i+n.duration:!r&&o.complete&&(a=i+o.duration));var l=function(e){var t=e.codec;if(void 0===t)throw new Error("Cannot parse subtitles: unknown format");switch(t.toLowerCase()){case"stpp":case"stpp.ttml.im1t":return"ttml";case"wvtt":return"vtt"}throw new Error('The codec used for the subtitles "'+t+'" is not managed yet.')}(u),d=function(e){var t=(0,se.Le)(e);return null===t?"":(0,_.uR)(t)}(t);return{data:d,type:l,language:s.language,start:i,end:a}}function le(e,t,n){var r,i,a=e.segment,o=e.adaptation,s=e.representation;if(a.isInit)return null;n?m.Z.warn("Transport: Unavailable time data for current text track."):(r=a.time,a.complete&&(i=a.time+a.duration));var u=function(e){var t=e.mimeType,n=void 0===t?"":t;switch(e.mimeType){case"application/ttml+xml":return"ttml";case"application/x-sami":case"application/smil":return"sami";case"text/vtt":return"vtt"}var r=e.codec;if("srt"===(void 0===r?"":r).toLowerCase())return"srt";throw new Error("could not find a text-track parser for the type "+n)}(s);return{data:t,type:u,language:o.language,start:r,end:i}}function de(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.period,o=n.adaptation,s=n.representation,u=n.segment,l=e.data,d=e.isChunked;if(null===l)return u.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:null!==(i=u.timestampOffset)&&void 0!==i?i:0,protectionDataUpdate:!1,appendWindow:[a.start,a.end]};var c=R(o.type,s);if("webm"===c)throw new Error("Text tracks with a WEBM container are not yet handled.");return"mp4"===c?function(e,t,n,r,i){var a,o=n.period,s=n.representation,u=n.segment,l=u.isInit,d=u.indexRange,c="string"==typeof e?(0,_.tG)(e):e instanceof Uint8Array?e:new Uint8Array(e);if(l){var f=(0,F.Wf)(c,Array.isArray(d)?d[0]:0);if(!0===i&&null!==f&&f.length>0){var v=f[f.length-1];Array.isArray(v.range)&&(v.range[1]=1/0)}var p=(0,F.LD)(c);return s.index instanceof re.Z&&null!==f&&f.length>0&&s.index.initializeIndex(f),{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:p}}var h=ie(c,t,u,r),m=ue(n,c,h,t),g=null!==(a=u.timestampOffset)&&void 0!==a?a:0;return{segmentType:"media",chunkData:m,chunkSize:c.length,chunkInfos:h,chunkOffset:g,protectionDataUpdate:!1,appendWindow:[o.start,o.end]}}(l,d,n,r,t):function(e,t,n){var r,i,a=n.period,o=n.segment,s=o.timestampOffset,u=void 0===s?0:s;if(o.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if("string"!=typeof e){var l=e instanceof Uint8Array?e:new Uint8Array(e);r=(0,_.uR)(l),i=l.length}else r=e;return{segmentType:"media",chunkData:le(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:u,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}(l,d,n)}}var ce=function(e){var t=(0,i.Z)({customManifestLoader:e.manifestLoader},null===r.Z.dashParsers.wasm||"initialized"!==r.Z.dashParsers.wasm.status&&"initializing"!==r.Z.dashParsers.wasm.status?"arraybuffer":"text"),n=b(e),a=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:P(r);function r(e,r,i,a,o){var s=d(e,r.segment);if(null==s)return Promise.resolve({resultType:"segment-created",resultData:null});if(t||void 0===n)return U(s,r,t,i,o,a);var u={adaptation:r.adaptation,manifest:r.manifest,period:r.period,representation:r.representation,segment:r.segment,transport:"dash",timeout:i.timeout,url:s};return new Promise((function(e,l){var d=!1,c=n(u,{reject:function(e){var t,n,r;if(!d&&!a.isCancelled()){d=!0,a.deregister(f);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a DASH segment through a custom segmentLoader.",s=new S.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);l(s)}},resolve:function(t){d||a.isCancelled()||(d=!0,a.deregister(f),e({resultType:"segment-loaded",resultData:{responseData:t.data,size:t.size,requestDuration:t.duration}}))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(f),U(s,r,t,i,o,a).then(e,l))}});function f(e){d||(d=!0,"function"==typeof c&&c(),l(e))}a.register(f)}))}}(e),o=oe(e),s=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:P(n);function n(e,n,r,i,a){var o=n.adaptation,s=n.representation,l=n.segment,c=l.range,f=d(e,l);if(null===f)return Promise.resolve({resultType:"segment-created",resultData:null});if(l.isInit)return N(f,l,r,i,a);var v=R(o.type,s),p="mp4"===v||void 0===v;if(t&&p){if(I())return L(f,n,r,a,i);(0,Z.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}return p?(0,u.ZP)({url:f,responseType:"arraybuffer",headers:Array.isArray(c)?{Range:(0,x.Z)(c)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):(0,u.ZP)({url:f,responseType:"text",headers:Array.isArray(c)?{Range:(0,x.Z)(c)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}}(e);return{manifest:{loadManifest:t,parseManifest:n},audio:{loadSegment:a,parseSegment:o},video:{loadSegment:a,parseSegment:o},text:{loadSegment:s,parseSegment:de(e)},image:{loadSegment:c,parseSegment:v}}}},2339:function(e,t,n){"use strict";n.d(t,{Z:function(){return me}});var r=n(5861),i=n(4687),a=n.n(i),o=n(7874),s=n(3887),u=n(1989),l=n(6807),d=n(9362),c=n(811),f=n(8232),v=n(3911),p=n(5505);function h(e,t,n){var r=e.timeline,i=e.timescale,a=r[r.length-1],o=t.timescale===i?{time:t.time,duration:t.duration}:{time:t.time/t.timescale*i,duration:t.duration/t.timescale*i};return!(n.time===o.time)&&(o.time>=(0,v.jH)(a,null)&&(a.duration===o.duration?a.repeatCount++:e.timeline.push({duration:o.duration,start:o.time,repeatCount:0}),!0))}function m(e,t){return e.replace(/\{start time\}/g,String(t))}function g(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function y(e,t){var n=e.repeatCount;if(null!=e.duration&&n<0){var r=void 0!==t?t.start:1/0;n=Math.ceil((r-e.start)/e.duration)-1}return n}var _=function(){function e(e,t){var n=t.aggressiveMode,r=t.isLive,i=t.segmentPrivateInfos,a=t.timeShiftBufferDepth,o=null==t.manifestReceivedTime?performance.now():t.manifestReceivedTime;if(this._index=e,this._indexValidityTime=o,this._timeShiftBufferDepth=a,this._initSegmentInfos={bitsPerSample:i.bitsPerSample,channels:i.channels,codecPrivateData:i.codecPrivateData,packetSize:i.packetSize,samplingRate:i.samplingRate,timescale:e.timescale,protection:i.protection},this._isAggressiveMode=n,this._isLive=r,0!==e.timeline.length){var s=e.timeline[e.timeline.length-1],u=(0,v.jH)(s,null);if(this._initialScaledLastPosition=u,r){var l=o/1e3*e.timescale;this._scaledLiveGap=l-u}}}var t=e.prototype;return t.getInitSegment=function(){return{id:"init",isInit:!0,privateInfos:{smoothInitSegment:this._initSegmentInfos},url:null,time:0,end:0,duration:0,timescale:1,complete:!0}},t.getSegments=function(e,t){this._refreshTimeline();for(var n,r=function(e,t,n){var r=void 0===e.timescale||0===e.timescale?1:e.timescale;return{up:t*r,to:(t+n)*r}}(this._index,e,t),i=r.up,a=r.to,o=this._index,s=o.timeline,u=o.timescale,l=o.media,d=this._isAggressiveMode,c=[],f=s.length,v=null==this._scaledLiveGap?void 0:performance.now()/1e3*u-this._scaledLiveGap,p=0;p=a)return c;null!=n&&(n+=S+1)}return c},t.shouldRefresh=function(e,t){if(this._refreshTimeline(),!this._isLive)return!1;var n=this._index,r=n.timeline,i=n.timescale,a=r[r.length-1];if(void 0===a)return!1;var o=a.repeatCount,s=a.start+(o+1)*a.duration;return!(t*i=s||e*i>a.start+o*a.duration)},t.getFirstAvailablePosition=function(){this._refreshTimeline();var e=this._index;return 0===e.timeline.length?null:e.timeline[0].start/e.timescale},t.getLastAvailablePosition=function(){this._refreshTimeline();var e=this._index;if(null==this._scaledLiveGap){var t=e.timeline[e.timeline.length-1];return(0,v.jH)(t,null)/e.timescale}for(var n=e.timeline.length-1;n>=0;n--)for(var r=e.timeline[n],i=performance.now()/1e3*e.timescale,a=r.start,o=r.duration,s=r.repeatCount;s>=0;s--){var u=a+o*(s+1);if((this._isAggressiveMode?u-o:u)<=i-this._scaledLiveGap)return u/e.timescale}},t.getEnd=function(){if(!this._isLive)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,c.Z)(e<=t),this.isStillAwaitingFutureSegments())return!1;var r=this.getLastAvailablePosition();return!(void 0!==r&&t(null!==(n=this.getFirstAvailablePosition())&&void 0!==n?n:0)&&void 0)},t.checkDiscontinuity=function(e){return this._refreshTimeline(),(0,v._j)(this._index,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();for(var t=this._index,n=t.timeline,r=t.timescale,i=0;ie.time)return!1;if(o===e.time)return!0;if(a.repeatCount>=0&&void 0!==a.duration){var s=(o-a.start)/a.duration-1;return s%1==0&&s<=a.repeatCount}}return!1},t.canBeOutOfSyncError=function(e){return!!this._isLive&&(e instanceof d.Z&&(e.isHttpError(404)||e.isHttpError(412)))},t._replace=function(e){var t=this._index.timeline,n=e._index.timeline,r=this._index.timescale,i=e._index.timescale;if(this._index=e._index,this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap,0!==t.length&&0!==n.length&&r===i){var a=t[t.length-1],o=n[n.length-1],u=(0,v.jH)(o,null);if(!((0,v.jH)(a,null)<=u))for(var l=0;lu){if(d.duration!==o.duration)return;var f=u-d.start;if(0===f)return s.Z.warn("Smooth Parser: a discontinuity detected in the previous manifest has been resolved."),void(this._index.timeline=this._index.timeline.concat(t.slice(l)));if(f<0||f%d.duration!=0)return;var p=f/d.duration-1,h=d.repeatCount-p;if(h<0)return;o.repeatCount+=h;var m=t.slice(l+1);return void(this._index.timeline=this._index.timeline.concat(m))}}}},t._update=function(e){(0,p.Z)(this._index.timeline,e._index.timeline),this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap},t.isStillAwaitingFutureSegments=function(){return this._isLive},t.isInitialized=function(){return!0},t.addNewSegments=function(e,t){this._refreshTimeline();for(var n=0;n>3:2)?"mp4a.40.2":"mp4a.40."+n}(u,l);return{audiotag:void 0!==i?parseInt(i,10):i,bitrate:v,bitsPerSample:void 0!==a?parseInt(a,10):a,channels:void 0!==o?parseInt(o,10):o,codecPrivateData:u,codecs:p,customAttributes:n,mimeType:void 0!==l?U[l]:l,packetSize:void 0!==d?parseInt(d,10):d,samplingRate:void 0!==c?parseInt(c,10):c};case"video":var h=r("CodecPrivateData"),m=r("FourCC"),g=r("MaxWidth"),y=r("MaxHeight"),_=r("Bitrate"),b=void 0===_||isNaN(parseInt(_,10))?0:parseInt(_,10);if(void 0!==m&&void 0===U[m]||void 0===h)return s.Z.warn("Smooth parser: Unsupported video codec. Ignoring quality level."),null;var S=function(e){var t=/00000001\d7([0-9a-fA-F]{6})/.exec(e);return null!==t&&(0,E.Z)(t[1])?"avc1."+t[1]:"avc1.4D401E"}(h);return{bitrate:b,customAttributes:n,mimeType:void 0!==m?U[m]:m,codecPrivateData:h,codecs:S,width:void 0!==g?parseInt(g,10):void 0,height:void 0!==y?parseInt(y,10):void 0};case"text":var T=r("CodecPrivateData"),k=r("FourCC"),w=r("Bitrate");return{bitrate:void 0===w||isNaN(parseInt(w,10))?0:parseInt(w,10),customAttributes:n,mimeType:void 0!==k?U[k]:k,codecPrivateData:null!=T?T:""};default:return s.Z.error("Smooth Parser: Unrecognized StreamIndex type: "+t),null}}function o(t){var r=t.root,i=t.timescale,o=t.baseUrl,u=t.protections,l=t.timeShiftBufferDepth,d=t.manifestReceivedTime,f=t.isLive,v=r.getAttribute("Timescale"),p=null===v||isNaN(+v)?i:+v,h=r.getAttribute("Type");if(null===h)throw new Error("StreamIndex without type.");(0,S.Z)(b.r,h)||s.Z.warn("Smooth Parser: Unrecognized adaptation type:",h);var m=h,g=r.getAttribute("Subtype"),y=r.getAttribute("Language"),w=r.getAttribute("Url"),I=null===w?"":w;var Z,x=O(r,(function(e,t,r){switch(t){case"QualityLevel":var i=a(r,m);if(null===i)return e;("video"!==m||i.bitrate>n)&&e.qualityLevels.push(i);break;case"c":e.cNodes.push(r)}return e}),{qualityLevels:[],cNodes:[]}),M=x.qualityLevels,C=x.cNodes,P={timeline:(Z=C,Z.reduce((function(e,t,n){var r=t.getAttribute("d"),i=t.getAttribute("t"),a=t.getAttribute("r"),o=null!==a?+a-1:0,s=null!==i?+i:void 0,u=null!==r?+r:void 0;if(0===n)s=void 0===s||isNaN(s)?0:s;else{var l=e[n-1];if(null==s||isNaN(s)){if(null==l.duration||isNaN(l.duration))throw new Error("Smooth: Invalid CNodes. Missing timestamp.");s=l.start+l.duration*(l.repeatCount+1)}}if(null==u||isNaN(u)){var d=Z[n+1];if(void 0===d)return e;var c=d.getAttribute("t"),f=(0,E.Z)(c)?+c:null;if(null===f)throw new Error("Can't build index timeline from Smooth Manifest.");u=f-s}return e.push({duration:u,start:s,repeatCount:o}),e}),[])),timescale:p};(0,c.Z)(0!==M.length,"Adaptation should have at least one playable representation.");var D=m+((0,E.Z)(y)?"_"+y:""),N=M.map((function(t){var n,r,i,a,s={timeline:P.timeline,timescale:P.timescale,media:(n=I,r=t.bitrate,i=t.customAttributes,n.replace(/\{bitrate\}/g,String(r)).replace(/{CustomAttributes}/g,i.length>0?i[0]:""))},c=(0,E.Z)(t.mimeType)?t.mimeType:L[m],v=t.codecs,p=D+"_"+(null!=m?m+"-":"")+(null!=c?c+"-":"")+(null!=v?v+"-":"")+String(t.bitrate),h=[];u.length>0&&(a=u[0],u.forEach((function(e){var t=e.keyId;e.keySystems.forEach((function(e){h.push({keyId:t,systemId:e.systemId})}))})));var g={bitsPerSample:t.bitsPerSample,channels:t.channels,codecPrivateData:t.codecPrivateData,packetSize:t.packetSize,samplingRate:t.samplingRate,protection:null!=a?{keyId:a.keyId}:void 0},y=null!=e.aggressiveMode&&e.aggressiveMode,b=new _(s,{aggressiveMode:y,isLive:f,manifestReceivedTime:d,segmentPrivateInfos:g,timeShiftBufferDepth:l}),S=(0,k.Z)({},t,{index:b,cdnMetadata:[{baseUrl:o}],mimeType:c,codecs:v,id:p});if(h.length>0||void 0!==a){var w=void 0===a?[]:a.keySystems.map((function(e){var t=e.systemId,n=e.privateData,r=t.replace(/-/g,""),i=function(e,t){if(32!==e.length)throw new Error("HSS: wrong system id length");var n=0;return R("pssh",(0,T.zo)([n,0,0,0],(0,A.nr)(e),(0,T.kh)(t.length),t))}(r,n);return{systemId:r,data:i}}));if(w.length>0){var Z=[{type:"cenc",values:w}];S.contentProtections={keyIds:h,initData:Z}}else S.contentProtections={keyIds:h,initData:[]}}return S}));if("ADVT"===g)return null;var U={id:D,type:m,representations:N,language:null==y?void 0:y};return"text"===m&&"DESC"===g&&(U.closedCaption=!0),U}return function(n,r,a){var s="";if(void 0!==r){var u=(0,w.$)(r);s=r.substring(0,u)}var l=n.documentElement;if(null==l||"SmoothStreamingMedia"!==l.nodeName)throw new Error("document root should be SmoothStreamingMedia");var d=l.getAttribute("MajorVersion"),c=l.getAttribute("MinorVersion");if(null===d||null===c||!/^[2]-[0-2]$/.test(d+"-"+c))throw new Error("Version should be 2.0, 2.1 or 2.2");var f,v,p=l.getAttribute("Timescale"),h=(0,E.Z)(p)?isNaN(+p)?1e7:+p:1e7,m=O(l,(function(t,n,r){switch(n){case"Protection":t.protections.push(N(r,e.keySystems));break;case"StreamIndex":t.adaptationNodes.push(r)}return t}),{adaptationNodes:[],protections:[]}),g=m.protections,y=m.adaptationNodes,_="boolean"==typeof(f=l.getAttribute("IsLive"))?f:"string"==typeof f&&"TRUE"===f.toUpperCase();if(_){var b=l.getAttribute("DVRWindowLength");null==b||isNaN(+b)||0==+b||(v=+b/h)}var S,T,k,A,I,Z,x,R=y.reduce((function(e,t){var n=o({root:t,baseUrl:s,timescale:h,protections:g,isLive:_,timeShiftBufferDepth:v,manifestReceivedTime:a});if(null===n)return e;var r=n.type,i=e[r];return void 0===i?e[r]=[n]:i.push(n),e}),{}),M=null,P=void 0!==R.video?R.video[0]:void 0,D=void 0!==R.audio?R.audio[0]:void 0;if(void 0!==P||void 0!==D){var L=[],U=[];if(void 0!==P){var B=P.representations[0];if(void 0!==B){var F=B.index.getFirstAvailablePosition(),V=B.index.getLastAvailablePosition();null!=F&&L.push(F),null!=V&&U.push(V)}}if(void 0!==D){var z=D.representations[0];if(void 0!==z){var K=z.index.getFirstAvailablePosition(),G=z.index.getLastAvailablePosition();null!=K&&L.push(K),null!=G&&U.push(G)}}L.length>0&&(I=Math.max.apply(Math,L)),U.length>0&&(Z=Math.min.apply(Math,U),x=Math.max.apply(Math,U))}var W=l.getAttribute("Duration"),H=null!==W&&0!=+W?+W/h:void 0;if(_){S=e.suggestedPresentationDelay,T=t,k=null!=I?I:T;var j=x;void 0===j&&(j=Date.now()/1e3-T);var q=Z;void 0===q&&(q=j),A={isLinear:!0,maximumSafePosition:q,livePosition:j,time:performance.now()},M=null!=v?v:null}else{k=null!=I?I:0,A={isLinear:!1,maximumSafePosition:void 0!==Z?Z:void 0!==H?k+H:1/0,livePosition:void 0,time:performance.now()}}var Y=_?0:k,X=_?void 0:A.maximumSafePosition,Q={availabilityStartTime:void 0===T?0:T,clockOffset:i,isLive:_,isDynamic:_,isLastPeriodKnown:!0,timeBounds:{minimumSafePosition:k,timeshiftDepth:M,maximumTimeData:A},periods:[{adaptations:R,duration:void 0!==X?X-Y:H,end:X,id:"gen-smooth-period-0",start:Y}],suggestedPresentationDelay:S,transportType:"smooth",uris:null==r?[]:[r]};return C(Q),Q}},F=B,V=n(4597),z=n(8806),K=n(4460),G=n(8791),W=n(4644),H=n(2297);function j(e,t,n,r,i){var a,o,u,d=[];if(i){var c=(0,l.XA)(e);null!==c?(u=function(e){var t=(0,H.nR)(e,3565190898,3392751253,2387879627,2655430559);if(void 0===t)return[];for(var n=[],r=t[0],i=t[4],a=0;a0;if(n)return e;var r=new Uint8Array(e.length+4);return r.set(e.subarray(0,t+8),0),r[t+3]=1|r[t+3],r.set([0,0,0,0],t+8),r.set(e.subarray(t+8,e.length),t+12),(0,W.J6)(r)}(l,s[1]-s[0]),f=J(u,d,c,i,(0,H.nR)(a,2721664850,1520127764,2722393154,2086964724)),v=M("moof",[i,f]),p=(0,H.Qy)(v,1836019558),h=(0,H.Qy)(f,1953653094),m=(0,H.Qy)(c,1953658222);if(null===p||null===h||null===m)throw new Error("Smooth: Invalid moof, trun or traf generation");var g=p[1]-p[0]+i.length+(h[1]-h[0])+u.length+d.length+(m[1]-m[0])+8,y=n[2]-n[0],_=v.length-y,b=(0,H.Qy)(e,1835295092);if(null===b)throw new Error("Smooth: Invalid ISOBMFF given");if(!q.YM&&(0===_||_<=-8)){var S=b[1];return v.set((0,T.kh)(S),g),e.set(v,n[0]),_<=-8&&e.set(R("free",new Uint8Array(-_-8)),v.length),e}var E=b[1]+_;v.set((0,T.kh)(E),g);var k=new Uint8Array(e.length+_),w=e.subarray(0,n[0]),A=e.subarray(n[2],e.length);return k.set(w,0),k.set(v,w.length),k.set(A,w.length+v.length),k}var te=n(7839),ne=n(281);function re(e,t,n,r,i,a){var o,s,u,l=M("stbl",[n,R("stts",new Uint8Array(8)),R("stsc",new Uint8Array(8)),R("stsz",new Uint8Array(12)),R("stco",new Uint8Array(8))]),d=function(e){return R("dref",(0,T.zo)(7,[1],e))}(R("url ",new Uint8Array([0,0,0,1]))),c=M("dinf",[d]),f=M("minf",[r,c,l]),v=function(e){var t,n;switch(e){case"video":t="vide",n="VideoHandler";break;case"audio":t="soun",n="SoundHandler";break;default:t="hint",n=""}return R("hdlr",(0,T.zo)(8,(0,A.tG)(t),12,(0,A.tG)(n),1))}(t),p=function(e){return R("mdhd",(0,T.zo)(12,(0,T.kh)(e),8))}(e),h=M("mdia",[p,v,f]),m=function(e,t,n){return R("tkhd",(0,T.zo)((0,T.kh)(7),8,(0,T.kh)(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],(0,T.XT)(e),2,(0,T.XT)(t),2))}(i,a,1),g=M("trak",[m,h]),y=M("mvex",[(o=1,R("trex",(0,T.zo)(4,(0,T.kh)(o),[0,0,0,1],12)))]),_=function(e,t){return R("mvhd",(0,T.zo)(12,(0,T.kh)(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,(0,T.XT)(t+1)))}(e,1),b=function(e,t,n){return M("moov",[e,t,n])}(_,y,g),S=(s="isom",u=["isom","iso2","iso6","avc1","dash"],R("ftyp",T.zo.apply(void 0,[(0,A.tG)(s),[0,0,0,1]].concat(u.map(A.tG)))));return(0,T.zo)(S,b)}function ie(e,t,n,r,i,a,o,s){var u=o.split("00000001"),l=u[1],d=u[2];if(void 0===l||void 0===d)throw new Error("Smooth: unsupported codec private data.");var c,f,v=function(e,t,n){var r=2===n?1:4===n?3:0,i=e[1],a=e[2],o=e[3];return R("avcC",(0,T.zo)([1,i,a,o,252|r,225],(0,T.XT)(e.length),e,[1],(0,T.XT)(t.length),t))}((0,A.nr)(l),(0,A.nr)(d),a);if(void 0===s){var p=function(e,t,n,r,i,a,o){return R("avc1",(0,T.zo)(6,(0,T.XT)(1),16,(0,T.XT)(e),(0,T.XT)(t),(0,T.XT)(n),2,(0,T.XT)(r),6,[0,1,i.length],(0,A.tG)(i),31-i.length,(0,T.XT)(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,v);c=Q([p])}else{var h=M("schi",[$(1,8,s)]),m=Y("cenc",65536),g=function(e,t,n,r,i,a,o,s){return R("encv",(0,T.zo)(6,(0,T.XT)(1),16,(0,T.XT)(e),(0,T.XT)(t),(0,T.XT)(n),2,(0,T.XT)(r),6,[0,1,i.length],(0,A.tG)(i),31-i.length,(0,T.XT)(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,v,M("sinf",[X("avc1"),m,h]));c=Q([g])}return re(e,"video",c,((f=new Uint8Array(12))[3]=1,R("vmhd",f)),t,n)}var ae=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function oe(e,t,n,r,i,a,o){var s,u,l,d=function(e,t){return R("esds",(0,T.zo)(4,[3,25],(0,T.XT)(e),[0,4,17,64,21],11,[5,2],(0,A.nr)(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,l=((l=((l=(63&2)<<4)|31&ae.indexOf(s))<<4)|31&u)<<3,(0,A.ci)((0,T.XT)(l))):a),c=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return R("mp4a",(0,T.zo)(6,(0,T.XT)(e),8,(0,T.XT)(t),(0,T.XT)(n),2,(0,T.XT)(r),(0,T.XT)(i),2,a))}(1,t,n,r,i,d);return Q([e])}var a=M("schi",[$(1,8,o)]),s=Y("cenc",65536),u=M("sinf",[X("mp4a"),s,a]),l=function(e,t,n,r,i,a,o){return R("enca",(0,T.zo)(6,(0,T.XT)(e),8,(0,T.XT)(t),(0,T.XT)(n),2,(0,T.XT)(r),(0,T.XT)(i),2,a,o))}(1,t,n,r,i,d,u);return Q([l])}();return re(e,"audio",c,R("smhd",new Uint8Array(8)),0,0)}var se=/(\.isml?)(\?token=\S+)?$/,ue=/\?token=(\S+)/;function le(e,t){return(0,E.Z)(t)?e.replace(ue,"?token="+t):e.replace(ue,"")}function de(e){return"string"==typeof e.mimeType&&e.mimeType.indexOf("mp4")>=0}function ce(e,t){return null===e?null:null===t.url?e.baseUrl:(0,w.Z)(e.baseUrl,t.url)}function fe(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:(0,ne.Z)(s)}),(0,V.ZP)({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!de(t.representation)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return(0,K.Z)(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var ve=function(e){var t=e.checkMediaSegmentIntegrity,n=e.customSegmentLoader;return function(e,r,i,a,o){var s=r.segment,u=r.manifest,l=r.period,d=r.adaptation,c=r.representation;if(s.isInit){if(void 0===s.privateInfos||void 0===s.privateInfos.smoothInitSegment)throw new Error("Smooth: Invalid segment format");var f,v=s.privateInfos.smoothInitSegment,p=v.codecPrivateData,h=v.timescale,m=v.protection,g=void 0===m?{keyId:void 0,keySystems:void 0}:m;if(void 0===p)throw new Error("Smooth: no codec private data.");switch(d.type){case"video":var y=c.width,_=void 0===y?0:y,b=c.height;f=ie(h,_,void 0===b?0:b,72,72,4,p,g.keyId);break;case"audio":var S=v.channels,T=void 0===S?0:S,E=v.bitsPerSample,k=void 0===E?0:E,w=v.packetSize,A=void 0===w?0:w,I=v.samplingRate;f=oe(h,T,k,A,void 0===I?0:I,p,g.keyId);break;default:0,f=new Uint8Array(0)}return Promise.resolve({resultType:"segment-created",resultData:f})}if(null===e)return Promise.resolve({resultType:"segment-created",resultData:null});var Z={adaptation:d,manifest:u,period:l,representation:c,segment:s,transport:"smooth",timeout:i.timeout,url:e};return"function"!=typeof n?fe(e,r,o,i,a,t):new Promise((function(s,u){var l=!1,d=n(Z,{reject:function(e){var t,n,r;if(!l&&!a.isCancelled()){l=!0,a.deregister(c);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a Smooth segment through a custom segmentLoader.",s=new te.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);u(s)}},resolve:function(e){if(!l&&!a.isCancelled()){l=!0,a.deregister(c),de(r.representation)&&!0===t||s({resultType:"segment-loaded",resultData:{responseData:e.data,size:e.size,requestDuration:e.duration}});var n=e.data instanceof Uint8Array?e.data:new Uint8Array(e.data);(0,K.Z)(n,r.segment.isInit),s({resultType:"segment-loaded",resultData:{responseData:n,size:e.size,requestDuration:e.duration}})}},fallback:function(){l||a.isCancelled()||(l=!0,a.deregister(c),fe(e,r,o,i,a,t).then(s,u))},progress:function(e){l||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})}});function c(e){l||((l=!0)||"function"!=typeof d||d(),u(e))}a.register(c)}))}},pe=/\.wsx?(\?token=\S+)?/;function he(e,t,n){var r;s.Z.debug("Smooth Parser: update segments information.");for(var i=e.representations,a=0;a0&&he(o,v,a),{segmentType:"media",chunkData:h,chunkInfos:p,chunkOffset:0,chunkSize:h.length,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}},c={loadSegment:function(t,n,r,i,a){var o=n.segment,s=n.representation,u=ce(t,o);return o.isInit||null===u?Promise.resolve({resultType:"segment-created",resultData:null}):de(s)?(0,V.ZP)({url:u,responseType:"arraybuffer",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(t){if(!0!==e.checkMediaSegmentIntegrity)return{resultType:"segment-loaded",resultData:t};var r=new Uint8Array(t.responseData);return(0,K.Z)(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):(0,V.ZP)({url:u,responseType:"text",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))},parseSegment:function(e,t,n){var r,i,a,o=t.manifest,u=t.adaptation,d=t.representation,c=t.segment,f=u.language,v=de(d),p=d.mimeType,h=void 0===p?"":p,m=d.codec,g=void 0===m?"":m,y=e.data,_=e.isChunked;if(c.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(null===y)return{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]};var b,S,T,E,k=null;if(v){var w;i=(w="string"==typeof y?(0,A.tG)(y):y instanceof Uint8Array?y:new Uint8Array(y)).length;var I=void 0!==n?j(w,_,n,c,o.isLive):null;a=null==I?void 0:I.nextSegments,null===(k=null!==(r=null==I?void 0:I.chunkInfos)&&void 0!==r?r:null)?_?s.Z.warn("Smooth: Unavailable time data for current text track."):(b=c.time,S=c.end):(b=k.time,S=void 0!==k.duration?k.time+k.duration:c.end);var Z=g.toLowerCase();if("application/ttml+xml+mp4"===h||"stpp"===Z||"stpp.ttml.im1t"===Z)E="ttml";else{if("wvtt"!==Z)throw new Error("could not find a text-track parser for the type "+h);E="vtt"}var x=(0,l.Le)(w);T=null===x?"":(0,A.uR)(x)}else{var R;if(b=c.time,S=c.end,"string"!=typeof y){var M=y instanceof Uint8Array?y:new Uint8Array(y);i=M.length,R=(0,A.uR)(M)}else R=y;switch(h){case"application/x-sami":case"application/smil":E="sami";break;case"application/ttml+xml":E="ttml";break;case"text/vtt":E="vtt"}if(void 0===E){if("srt"!==g.toLowerCase())throw new Error("could not find a text-track parser for the type "+h);E="srt"}T=R}return null!==k&&Array.isArray(a)&&a.length>0&&he(u,a,c),{segmentType:"media",chunkData:{type:E,data:T,start:b,end:S,language:f},chunkSize:i,chunkInfos:k,chunkOffset:null!=b?b:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}};return{manifest:{resolveManifestUrl:function(e,t){if(void 0===e)return Promise.resolve(void 0);var n;pe.test(e)?((0,z.Z)("Giving WSX URL to loadVideo is deprecated. You should only give Manifest URLs."),n=(0,V.ZP)({url:le(e,""),responseType:"document",cancelSignal:t}).then((function(e){var t=e.responseData.getElementsByTagName("media")[0].getAttribute("src");if(null===t||0===t.length)throw new Error("Invalid ISML");return t}))):n=Promise.resolve(e);var r=function(e){var t=ue.exec(e);if(null!==t){var n=t[1];if(void 0!==n)return n}return""}(e);return n.then((function(e){return le(function(e){return se.test(e)?((0,z.Z)("Giving a isml URL to loadVideo is deprecated. Please give the Manifest URL directly"),e.replace(se,"$1/manifest$2")):e}(e),r)}))},loadManifest:(0,G.Z)(i,"text"),parseManifest:function(n,r){var i,a=null!==(i=n.url)&&void 0!==i?i:r.originalUrl,o=n.receivedTime,s=n.responseData,l="string"==typeof s?(new DOMParser).parseFromString(s,"text/xml"):s,d=t(l,a,o);return{manifest:new u.ZP(d,{representationFilter:e.representationFilter,supplementaryImageTracks:e.supplementaryImageTracks,supplementaryTextTracks:e.supplementaryTextTracks}),url:a}}},audio:d,video:d,text:c,image:{loadSegment:function(e,t,n,i,o){return(0,r.Z)(a().mark((function r(){var s,u,l;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(s=t.segment,u=ce(e,s),!s.isInit&&null!==u){r.next=4;break}return r.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return r.next=6,(0,V.ZP)({url:u,responseType:"arraybuffer",timeout:n.timeout,onProgress:o.onProgress,cancelSignal:i});case 6:return l=r.sent,r.abrupt("return",{resultType:"segment-loaded",resultData:l});case 8:case"end":return r.stop()}}),r)})))()},parseSegment:function(e,t,n){var r=e.data,i=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(i)throw new Error("Image data should not be downloaded in chunks");return null===r||null===o.Z.imageParser?{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}:{segmentType:"media",chunkData:{data:o.Z.imageParser(new Uint8Array(r)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkSize:void 0,chunkOffset:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}}}}},281:function(e,t,n){"use strict";function r(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}n.d(t,{Z:function(){return r}})},4460:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(5389),i=n(8766);function a(e,t){if(t){if((0,i.Z)(e,1718909296)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `ftyp` box");if((0,i.Z)(e,1836019574)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moov` box")}else{if((0,i.Z)(e,1836019558)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moof` box");if((0,i.Z)(e,1835295092)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `mdat` box")}}},8766:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(6968);function i(e,t){for(var n=e.length,i=0;i+8<=n;){var a=(0,r.pX)(e,i);if(0===a)a=n-i;else if(1===a){if(i+16>n)return-1;a=(0,r.pV)(e,i+8)}if(isNaN(a)||a<=0)return-1;if((0,r.pX)(e,i+4)===t)return i+a<=n?i:-1;i+=a}return-1}},8791:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7904),i=n(4597),a=n(7839);function o(e,t){var n=e.customManifestLoader,o=function(e){return function(t,n,a){if(void 0===t)throw new Error("Cannot perform HTTP(s) request. URL not known");switch(e){case"arraybuffer":return(0,i.ZP)({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:a});case"text":return(0,i.ZP)({url:t,responseType:"text",timeout:n.timeout,cancelSignal:a});case"document":return(0,i.ZP)({url:t,responseType:"document",timeout:n.timeout,cancelSignal:a});default:(0,r.Z)(e)}}}(t);return"function"!=typeof n?o:function(e,t){return function(n,r,i){return new Promise((function(o,s){var u=Date.now()-performance.now(),l=!1,d=e(n,{reject:function(e){var t,n,r;if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var o=e,u=null!==(t=null==o?void 0:o.message)&&void 0!==t?t:"Unknown error when fetching the Manifest through a custom manifestLoader.",d=new a.Z(u,null!==(n=null==o?void 0:o.canRetry)&&void 0!==n&&n,null!==(r=null==o?void 0:o.isOfflineError)&&void 0!==r&&r,null==o?void 0:o.xhr);s(d)}},resolve:function(e){if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var t=void 0!==e.receivingTime?e.receivingTime-u:void 0,n=void 0!==e.sendingTime?e.sendingTime-u:void 0;o({responseData:e.data,size:e.size,requestDuration:e.duration,url:e.url,receivedTime:t,sendingTime:n})}},fallback:function(){l||i.isCancelled()||(l=!0,i.deregister(c),t(n,r,i).then(o,s))}},{timeout:r.timeout});function c(e){l||(l=!0,"function"==typeof d&&d(),s(e))}i.register(c)}))}}(n,o)}},4791:function(e,t,n){"use strict";function r(e,t){if(e.length!==t.length)return!1;if(e===t)return!0;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}n.d(t,{Z:function(){return r}})},3274:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.find)return e.find(t,n);for(var r=e.length>>>0,i=0;i>>0,i=0;i>>0;if(0===r)return!1;for(var i,a,o=0|n,s=o>=0?Math.min(o,r-1):Math.max(r+o,0);s=a.length)throw new Error("Unable to parse base64 string.");var t=a[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function s(e){var t,n="",r=e.length;for(t=2;t>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2|e[t]>>6],n+=i[63&e[t]];return t===r+1&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4],n+="=="),t===r&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2],n+="="),n}function u(e){var t=e.length%4,n=e;0!==t&&(r.Z.warn("base64ToBytes: base64 given miss padding"),n+=3===t?"=":2===t?"==":"===");var i=n.indexOf("=");if(-1!==i&&i>16,l[c+1]=a>>8&255,l[c+2]=255&a;return l.subarray(0,l.length-s)}},6968:function(e,t,n){"use strict";function r(){for(var e,t=arguments.length,n=-1,r=0;++n0&&(i.set(e,a),a+=e.length);return i}function i(e,t){return(e[t+0]<<8)+(e[t+1]<<0)}function a(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function o(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function s(e,t){return 4294967296*(16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3])+16777216*e[t+4]+65536*e[t+5]+256*e[t+6]+e[t+7]}function u(e){return new Uint8Array([e>>>8&255,255&e])}function l(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function d(e){var t=e%4294967296,n=(e-t)/4294967296;return new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function c(e,t){return(e[t+0]<<0)+(e[t+1]<<8)}function f(e,t){return e[t+0]+256*e[t+1]+65536*e[t+2]+16777216*e[t+3]}function v(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}n.d(t,{O_:function(){return v},QI:function(){return a},XT:function(){return u},dN:function(){return f},el:function(){return d},kh:function(){return l},pV:function(){return s},pX:function(){return o},qb:function(){return c},zK:function(){return i},zo:function(){return r}})},7864:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(7733);function i(e,t){return(0,r.Z)(t,(function(t){var n=setTimeout((function(){return t()}),e);return function(){return clearTimeout(n)}}))}},7733:function(e,t,n){"use strict";function r(e,t){var n;return new Promise((function(r,i){if(null!==e.cancellationError)return i(e.cancellationError);var a=!1;function o(e){void 0!==n&&n(),i(e)}n=t((function(t){e.deregister(o),a=!0,r(t)}),(function(t){e.deregister(o),a=!0,i(t)})),a||e.register(o)}))}n.d(t,{Z:function(){return r}})},1959:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946),a=function(){function e(){this._listeners={}}var t=e.prototype;return t.addEventListener=function(e,t,n){var r=this,i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],void 0!==n&&n.register((function(){r.removeEventListener(e,t)}))},t.removeEventListener=function(e,t){if((0,i.Z)(e))this._listeners={};else{var n=this._listeners[e];if(Array.isArray(n))if((0,i.Z)(t))delete this._listeners[e];else{var r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&delete this._listeners[e]}}},t.trigger=function(e,t){var n=this._listeners[e];Array.isArray(n)&&n.slice().forEach((function(e){try{e(t)}catch(e){r.Z.error("EventEmitter: listener error",e instanceof Error?e:null)}}))},e}()},9592:function(e,t,n){"use strict";function r(e,t){return"function"==typeof Array.prototype.flatMap?e.flatMap(t):e.reduce((function(e,n){var r=t(n);return Array.isArray(r)?(e.push.apply(e,r),e):(e.push(r),e)}),[])}n.d(t,{Z:function(){return r}})},2572:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=.3;function i(e){return e*((2*Math.random()-1)*r+1)}},908:function(e,t,n){"use strict";function r(){var e="",t=-1;return function(){return++t>=Number.MAX_SAFE_INTEGER&&(e+="0",t=0),e+String(t)}}n.d(t,{Z:function(){return r}})},6923:function(e,t,n){"use strict";function r(e){return"string"==typeof e&&e.length>0}n.d(t,{Z:function(){return r}})},1946:function(e,t,n){"use strict";function r(e){return null==e}n.d(t,{Z:function(){return r}})},7829:function(e,t,n){"use strict";var r=n(5553);t.ZP=r.ZP},5553:function(e,t,n){"use strict";n.d(t,{ZP:function(){return d},iH:function(){return l},Y1:function(){return u}});var r=n(6923),i=n(1946),a={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},o={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"};function s(e){if((0,i.Z)(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=a[e];break;case 3:t=o[e]}return t}((""+e).toLowerCase().split("-")[0]);return(0,r.Z)(t)?t:e}function u(e){if(!(0,i.Z)(e)){var t,n=!1;return"string"==typeof e?t=e:(t=e.language,!0===e.closedCaption&&(n=!0)),{language:t,closedCaption:n,normalized:s(t)}}return e}function l(e){if((0,i.Z)(e))return e;if("string"==typeof e)return{language:e,audioDescription:!1,normalized:s(e)};var t={language:e.language,audioDescription:!0===e.audioDescription,normalized:s(s(e.language))};return!0===e.isDub&&(t.isDub=!0),t}var d=s},8894:function(e,t,n){"use strict";function r(){}n.d(t,{Z:function(){return r}})},8026:function(e,t){"use strict";t.Z="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n++){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}},1679:function(e,t,n){"use strict";t.Z="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))}},2829:function(e,t,n){"use strict";n.d(t,{A1:function(){return s},DD:function(){return m},F_:function(){return p},JN:function(){return c},L7:function(){return g},Ti:function(){return u},XS:function(){return v},at:function(){return h},kR:function(){return y},rx:function(){return f},tn:function(){return b},uH:function(){return S}});var r=1/60;function i(e,t){return Math.abs(e-t)=0;n--){var r=e.start(n);if(t>=r){var i=e.end(n);if(t=o?r.push({start:a,end:o}):n={start:a,end:o}}return{outerRanges:r,innerRange:n}}function h(e,t){var n=f(e,t);return null!==n?n.end-n.start:0}function m(e,t){var n=f(e,t);return null!==n?t-n.start:0}function g(e,t){var n=f(e,t);return null!==n?n.end-t:1/0}function y(e,t){if(t.start===t.end)return e;for(var n=t,r=0;r0)for(var o=0;o0)for(var s=0;sl&&n.push({start:l,end:a[d].start}),l=a[d].end;l=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&n._listeners.splice(r,1)}},i={trigger:e,complete:r,hasBeenCleared:!1};this._listeners.push(i),!0===(null==t?void 0:t.emitCurrentValue)&&e(this._value,r),this._isFinished||i.hasBeenCleared?r():void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.register(r)},t.waitUntilDefined=function(e,t){var n=this;this.onUpdate((function(t,r){void 0!==t&&(r(),e(n._value))}),{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:!0})},t._onFinished=function(e,t){var n=this;if(t.isCancelled())return i.Z;var a=function(){var e=(0,r.Z)(n._onFinishCbs,(function(e){return e.trigger===o}));e>=0&&(n._onFinishCbs[e].hasBeenCleared=!0,n._onFinishCbs.splice(e,1))},o=function(){a(),e()},s=t.register(a);return this._onFinishCbs.push({trigger:o,hasBeenCleared:!1}),s},t.finish=function(){void 0!==this._deregisterCancellation&&this._deregisterCancellation(),this._isFinished=!0;for(var e,t=a(this._listeners.slice());!(e=t()).done;){var n=e.value;try{n.hasBeenCleared||(n.complete(),n.hasBeenCleared=!0)}catch(e){}}if(this._listeners.length=0,this._onFinishCbs.length>0){for(var r,i=a(this._onFinishCbs.slice());!(r=i()).done;){var o=r.value;try{o.hasBeenCleared||(o.trigger(),o.hasBeenCleared=!0)}catch(e){}}this._onFinishCbs.length=0}},e}();function u(e,t,n){var r=new s(t(e.getValue()),n);return e.onUpdate((function(e){r.setValue(t(e))}),{clearSignal:n}),e._onFinished((function(){r.finish()}),n),r}t.Z=s},4597:function(e,t,n){"use strict";n.d(t,{ZP:function(){return o}});var r=n(9105),i=n(6923),a=n(1946);var o=function(e){var t={url:e.url,headers:e.headers,responseType:(0,a.Z)(e.responseType)?"json":e.responseType,timeout:e.timeout};return new Promise((function(n,o){var s,u=e.onProgress,l=e.cancelSignal,d=t.url,c=t.headers,f=t.responseType,v=t.timeout,p=new XMLHttpRequest;if(p.open("GET",d,!0),void 0!==v&&(p.timeout=v,s=window.setTimeout((function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))}),v+3e3)),p.responseType=f,"document"===p.responseType&&p.overrideMimeType("text/xml"),!(0,a.Z)(c)){var h=c;for(var m in h)h.hasOwnProperty(m)&&p.setRequestHeader(m,h[m])}var g=performance.now(),y=null;function _(){void 0!==s&&clearTimeout(s),null!==y&&y()}void 0!==l&&(y=l.register((function(e){_(),(0,a.Z)(p)||4===p.readyState||p.abort(),o(e)})),l.isCancelled())||(p.onerror=function(){_(),o(new r.Z(d,p.status,"ERROR_EVENT",p))},p.ontimeout=function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))},void 0!==u&&(p.onprogress=function(e){var t=performance.now();u({url:d,duration:t-g,sendingTime:g,currentTime:t,size:e.loaded,totalSize:e.total})}),p.onload=function(e){if(4===p.readyState)if(_(),p.status>=200&&p.status<300){var t,s=performance.now(),u=p.response instanceof ArrayBuffer?p.response.byteLength:e.total,l=p.status,c=p.responseType,f=(0,i.Z)(p.responseURL)?p.responseURL:d;if(t="json"===c?"object"==typeof p.response?p.response:function(e){try{return JSON.parse(e)}catch(e){return null}}(p.responseText):p.response,(0,a.Z)(t))return void o(new r.Z(d,p.status,"PARSE_ERROR",p));n({status:l,url:f,responseType:c,sendingTime:g,receivedTime:s,requestDuration:s-g,size:u,responseData:t})}else o(new r.Z(d,p.status,"ERROR_HTTP_CODE",p))},p.send())}))}},9829:function(e,t,n){"use strict";n.d(t,{$:function(){return o},Z:function(){return a}});var r=/^(?:[a-z]+:)?\/\//i,i=/\/\.{1,2}\//;function a(){var e=arguments.length;if(0===e)return"";for(var t="",n=0;n=0&&t===n+1)return e.length}var i=e.indexOf("?");return i>=0&&i=this._array.length)throw new Error("Invalid index.");return this._array[e]},t.toArray=function(){return this._array.slice()},t.findFirst=function(e){return(0,r.Z)(this._array,e)},t.has=function(e){return(0,i.Z)(this._array,e)},t.removeElement=function(e){var t=this._array.indexOf(e);if(t>=0)return this._array.splice(t,1),t},t.head=function(){return this._array[0]},t.last=function(){return this._array[this._array.length-1]},t.shift=function(){return this._array.shift()},t.pop=function(){return this._array.pop()},e}()},9252:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof String.prototype.startsWith)return e.startsWith(t,n);var r="number"==typeof n?Math.max(n,0):0;return e.substring(r,r+t.length)===t}n.d(t,{Z:function(){return r}})},3635:function(e,t,n){"use strict";n.d(t,{DM:function(){return h},TZ:function(){return s},ci:function(){return v},nr:function(){return f},tG:function(){return l},uR:function(){return c},wO:function(){return p},wV:function(){return u}});var r=n(3887),i=n(811),a="object"==typeof window&&"function"==typeof window.TextDecoder,o="object"==typeof window&&"function"==typeof window.TextEncoder;function s(e){for(var t=new ArrayBuffer(2*e.length),n=new Uint8Array(t),r=0;r>8&255}return n}function u(e){if(a)try{return new TextDecoder("utf-16le").decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-16LE, fallbacking to another implementation",t)}for(var n="",i=0;i=t?n:new Array(t-n.length+1).join("0")+n}function c(e){if(a)try{return(new TextDecoder).decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-8, fallbacking to another implementation",t)}var n=e;239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));var i,o=function(e){for(var t="",n=0;n=256?"%u"+d(l,4):"%"+d(l,2)}}return decodeURIComponent(i)}function f(e){for(var t=e.length,n=new Uint8Array(t/2),r=0,i=0;r>>4).toString(16),n+=(15&e[r]).toString(16),t.length>0&&r0;)try{var n=t._listeners.pop();null==n||n(e)}catch(e){o.Z.error("Error while calling clean up listener",e instanceof Error?e.toString():"Unknown error")}}))}var t=e.prototype;return t.isCancelled=function(){return this._isCancelled},t.register=function(e){var t=this;return this._isCancelled?((0,s.Z)(null!==this.cancellationError),e(this.cancellationError),u.Z):(this._listeners.push(e),function(){return t.deregister(e)})},t.deregister=function(e){for(var t=this._listeners.length-1;t>=0;t--)this._listeners[t]===e&&this._listeners.splice(t,1)},e}(),c=function(e){function t(){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(n),t.prototype),n.name="CancellationError",n.message="This task was cancelled.",n}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},8806:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7714),i=[];function a(e){(0,r.Z)(i,e)||(console.warn(e),i.push(e))}},7473:function(e){"use strict";var t=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},n=function(e){var n,r,i=document.createTextNode(""),a=0;return new e((function(){var e;if(n)r&&(n=r.concat(n));else{if(!r)return;n=r}if(r=n,n=null,"function"==typeof r)return e=r,r=null,void e();for(i.data=a=++a%2;r;)e=r.shift(),r.length||(r=null),e()})).observe(i,{characterData:!0}),function(e){t(e),n?"function"==typeof n?n=[n,e]:n.push(e):(n=e,i.data=a=++a%2)}};e.exports=function(){if("object"==typeof process&&process&&"function"==typeof process.nextTick)return process.nextTick;if("function"==typeof queueMicrotask)return function(e){queueMicrotask(t(e))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return n(MutationObserver);if("function"==typeof WebKitMutationObserver)return n(WebKitMutationObserver)}return"function"==typeof setImmediate?function(e){setImmediate(t(e))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(e){setTimeout(t(e),0)}:null}()},7061:function(e,t,n){var r=n(8698).default;function i(){"use strict";e.exports=i=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var t,n={},a=Object.prototype,o=a.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",d=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(t){f=function(e,t,n){return e[t]=n}}function v(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),o=new P(r||[]);return s(a,"_invoke",{value:x(e,n,o)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=v;var h="suspendedStart",m="suspendedYield",g="executing",y="completed",_={};function b(){}function S(){}function T(){}var E={};f(E,l,(function(){return this}));var k=Object.getPrototypeOf,w=k&&k(k(D([])));w&&w!==a&&o.call(w,l)&&(E=w);var A=T.prototype=b.prototype=Object.create(E);function I(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function Z(e,t){function n(i,a,s,u){var l=p(e[i],e,a);if("throw"!==l.type){var d=l.arg,c=d.value;return c&&"object"==r(c)&&o.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(c).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;s(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function x(e,n,r){var i=h;return function(a,o){if(i===g)throw new Error("Generator is already running");if(i===y){if("throw"===a)throw o;return{value:t,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var u=R(s,r);if(u){if(u===_)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=g;var l=p(e,n,r);if("normal"===l.type){if(i=r.done?y:m,l.arg===_)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=y,r.method="throw",r.arg=l.arg)}}}function R(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,R(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),_;var a=p(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,_;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,_):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,_)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function D(e){if(e||""===e){var n=e[l];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:D(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),_}},n}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(n){return e.exports=t="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},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,n){var r=n(7061)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},7326:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,{Z:function(){return r}})},5861:function(e,t,n){"use strict";function r(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,u,"next",e)}function u(e){r(o,i,a,s,u,"throw",e)}s(void 0)}))}}n.d(t,{Z:function(){return i}})},1656:function(e,t,n){"use strict";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){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}function a(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(i="internal-seeking",r=t._internalSeeksIncoming.shift());var a=null!=e?e:t._generateInitialObservation(),o=G(t._mediaElement,i,t._withMediaSource),s=null;o.seeking&&("number"==typeof r?s=r:null!==a.pendingInternalSeek&&"seeking"!==n&&(s=a.pendingInternalSeek));var u=function(e,t,n){var r,i,a=n.withMediaSource,o=n.lowLatencyMode,s=c.Z.getCurrent().REBUFFERING_GAP,u=t.event,l=t.position,d=t.bufferGap,f=t.currentRange,v=t.duration,p=t.paused,h=t.readyState,m=t.ended,g=e.rebuffering,y=e.event,_=e.position,b=function(e,t,n,r,i){var a=c.Z.getCurrent().REBUFFERING_GAP,o=i?"LOW_LATENCY":"DEFAULT";if(void 0===t)return n&&Math.abs(r-e)<=a[o];return null!==t&&r-t.end<=a[o]}(l,f,m,v,o),S=h>=1&&"loadedmetadata"!==u&&null===g&&!(b||m),T=null,E=o?s.LOW_LATENCY:s.DEFAULT;if(a){if(S)d===1/0?(r=!0,T=l):void 0===d?h<3&&(r=!0,T=void 0):d<=E&&(r=!0,T=l+d);else if(null!==g){var k=K(g,o);!0!==r&&null!==g&&h>1&&(b||m||void 0!==d&&isFinite(d)&&d>k)||void 0===d&&h>=3?i=!0:void 0===d?T=void 0:d===1/0?T=l:d<=k&&(T=l+d)}}else S&&(!p&&"timeupdate"===u&&"timeupdate"===y&&l===_||"seeking"===u&&(d===1/0||void 0===d&&h<3))?r=!0:null!==g&&("seeking"!==u&&l!==_||"canplay"===u||void 0===d&&h>=3||void 0!==d&&d<1/0&&(d>K(g,o)||b||m))&&(i=!0);if(!0===i)return null;var w;if(!0===r||null!==g)return w="seeking"===u||null!==g&&"seeking"===g.reason||t.seeking?"seeking":1===h?"not-ready":"buffering",null!==g&&g.reason===w?{reason:g.reason,timestamp:g.timestamp,position:T}:{reason:w,timestamp:performance.now(),position:T};return null}(a,o,{lowLatencyMode:t._lowLatencyMode,withMediaSource:t._withMediaSource}),d=function(e,t){var n=c.Z.getCurrent().MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;if(e.freezing)return t.ended||t.paused||0===t.readyState||0===t.playbackRate||e.position!==t.position?null:e.freezing;return"timeupdate"===t.event&&void 0!==t.bufferGap&&t.bufferGap>n&&!t.ended&&!t.paused&&t.readyState>=1&&0!==t.playbackRate&&t.position===e.position?{timestamp:performance.now()}:null}(a,o),f=(0,E.Z)({},{rebuffering:u,freezing:d,pendingInternalSeek:s},o);return l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current media element state tick","event",f.event,"position",f.position,"seeking",f.seeking,"internalSeek",f.pendingInternalSeek,"rebuffering",null!==f.rebuffering,"freezing",null!==f.freezing,"ended",f.ended,"paused",f.paused,"playbackRate",f.playbackRate,"readyState",f.readyState),f},s=new w.Z(o("init"),this._canceller.signal),u=function(t){var n=o(t);l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current playback timeline:\n"+function(e,t){for(var n="",r="",i=0;it){var d=n.length-Math.floor(l.length/2);r=" ".repeat(d)+"^"+t}if(i=3?(r=void 0,i=void 0):i=null!==(r=(0,k.rx)(a,o))?r.end-o:1/0,{bufferGap:i,buffered:a,currentRange:r,position:o,duration:s,ended:u,paused:l,playbackRate:d,readyState:c,seeking:f,event:t}}function W(e,t,n){var r=t(e.getReference(),n);return{getCurrentTime:function(){return e.getCurrentTime()},getReadyState:function(){return e.getReadyState()},getPlaybackRate:function(){return e.getPlaybackRate()},getIsPaused:function(){return e.getIsPaused()},getReference:function(){return r},listen:function(e,t){var i;n.isCancelled()||!0===(null===(i=null==t?void 0:t.clearSignal)||void 0===i?void 0:i.isCancelled())||r.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},deriveReadOnlyObserver:function(e){return W(this,e,n)}}}var H=n(3274),j=n(7829),q=n(3146);function Y(e){return e.map((function(e){return null===e?e:{normalized:void 0===e.language?void 0:(0,j.ZP)(e.language),audioDescription:e.audioDescription,codec:e.codec}}))}function X(e){return e.map((function(e){return null===e?e:{normalized:(0,j.ZP)(e.language),forced:e.forced,closedCaption:e.closedCaption}}))}var Q=function(){function e(e){this._periods=new q.Z((function(e,t){return e.period.start-t.period.start})),this._audioChoiceMemory=new WeakMap,this._textChoiceMemory=new WeakMap,this._videoChoiceMemory=new WeakMap,this._preferredAudioTracks=[],this._preferredTextTracks=[],this._preferredVideoTracks=[],this.trickModeTrackEnabled=e.preferTrickModeTracks}var t=e.prototype;return t.setPreferredAudioTracks=function(e,t){this._preferredAudioTracks=e,t&&this._applyAudioPreferences()},t.setPreferredTextTracks=function(e,t){this._preferredTextTracks=e,t&&this._applyTextPreferences()},t.setPreferredVideoTracks=function(e,t){this._preferredVideoTracks=e,t&&this._applyVideoPreferences()},t.addPeriod=function(e,t,n){var r=ie(this._periods,t),i=t.getSupportedAdaptations(e);if(void 0!==r){if(void 0!==r[e])return void l.Z.warn("TrackChoiceManager: "+e+" already added for period",t.start);r[e]={adaptations:i,adaptationRef:n}}else{var a;this._periods.add(((a={period:t})[e]={adaptations:i,adaptationRef:n},a))}},t.removePeriod=function(e,t){var n=function(e,t){for(var n=0;n0;)this._periods.pop()},t.update=function(){this._resetChosenAudioTracks(),this._resetChosenTextTracks(),this._resetChosenVideoTracks()},t.setInitialAudioTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.audio:null;if((0,h.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("audio"),i=this._audioChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,_.Z)(r,i))n.adaptationRef.setValue(i);else{var a=J(r,Y(this._preferredAudioTracks));this._audioChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialTextTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.text:null;if((0,h.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("text"),i=this._textChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,_.Z)(r,i))n.adaptationRef.setValue(i);else{var a=te(r,X(this._preferredTextTracks),this._audioChoiceMemory.get(e));this._textChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialVideoTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.video:null;if((0,h.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r,i=e.getSupportedAdaptations("video"),a=this._videoChoiceMemory.get(e);if(null===a)r=null;else if(void 0!==a&&(0,_.Z)(i,a.baseAdaptation))r=a.baseAdaptation;else{r=re(i,this._preferredVideoTracks)}if(null===r)return this._videoChoiceMemory.set(e,null),void n.adaptationRef.setValue(null);var o=ae(r,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:r,adaptation:o}),n.adaptationRef.setValue(o)},t.setAudioTrackByID=function(e,t){var n=ie(this._periods,e),r=void 0!==n?n.audio:null;if((0,h.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,H.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Audio Track not found.");this._audioChoiceMemory.get(e)!==i&&(this._audioChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setTextTrackByID=function(e,t){var n=ie(this._periods,e),r=void 0!==n?n.text:null;if((0,h.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,H.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Text Track not found.");this._textChoiceMemory.get(e)!==i&&(this._textChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setVideoTrackByID=function(e,t){var n=ie(this._periods,e),r=void 0!==n?n.video:null;if((0,h.Z)(r))throw new Error("LanguageManager: Given Period not found.");var i=(0,H.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Video Track not found.");var a=ae(i,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:i,adaptation:a}),r.adaptationRef.setValue(a)},t.disableTextTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.text:null;if((0,h.Z)(n))throw new Error("TrackChoiceManager: Given Period not found.");null!==this._textChoiceMemory.get(e)&&(this._textChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrack=function(e){var t=ie(this._periods,e),n=null==t?void 0:t.video;if(void 0===n)throw new Error("TrackManager: Given Period not found.");null!==this._videoChoiceMemory.get(e)&&(this._videoChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!1,this._resetChosenVideoTracks()},t.enableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!0,this._resetChosenVideoTracks()},t.isTrickModeEnabled=function(){return this.trickModeTrackEnabled},t.getChosenAudioTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.audio:null;if((0,h.Z)(n))return null;var r=this._audioChoiceMemory.get(e);return(0,h.Z)(r)?null:r.toAudioTrack()},t.getChosenTextTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.text:null;if((0,h.Z)(n))return null;var r=this._textChoiceMemory.get(e);return(0,h.Z)(r)?null:r.toTextTrack()},t.getChosenVideoTrack=function(e){var t=ie(this._periods,e),n=void 0!==t?t.video:null;if((0,h.Z)(n))return null;var r=this._videoChoiceMemory.get(e);return(0,h.Z)(r)?null:r.adaptation.toVideoTrack()},t.getAvailableAudioTracks=function(e){var t=ie(this._periods,e),n=void 0!==t?t.audio:null;if((0,h.Z)(n))return[];var r=this._audioChoiceMemory.get(e),i=(0,h.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,E.Z)(e.toAudioTrack(),{active:t})}))},t.getAvailableTextTracks=function(e){var t=ie(this._periods,e),n=void 0!==t?t.text:null;if((0,h.Z)(n))return[];var r=this._textChoiceMemory.get(e),i=(0,h.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,E.Z)(e.toTextTrack(),{active:t})}))},t.getAvailableVideoTracks=function(e){var t,n=ie(this._periods,e),r=void 0!==n?n.video:null;if((0,h.Z)(r))return[];var i=this._videoChoiceMemory.get(e),a=void 0===i?void 0:null!==(t=null==i?void 0:i.adaptation.id)&&void 0!==t?t:void 0;return r.adaptations.map((function(e){var t=null!==a&&a===e.id,n=e.toVideoTrack(),r=void 0!==n.trickModeTracks?n.trickModeTracks.map((function(e){var t=null!==a&&a===e.id;return(0,E.Z)(e,{active:t})})):[],i=(0,E.Z)(n,{active:t});return void 0!==r&&(i.trickModeTracks=r),i}))},t._applyAudioPreferences=function(){this._audioChoiceMemory=new WeakMap,this._resetChosenAudioTracks()},t._applyTextPreferences=function(){this._textChoiceMemory=new WeakMap,this._resetChosenTextTracks()},t._applyVideoPreferences=function(){this._videoChoiceMemory=new WeakMap,this._resetChosenVideoTracks()},t._resetChosenAudioTracks=function(){var e=this,t=Y(this._preferredAudioTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,h.Z)(i.audio))n(r+1);else{var a=i.period,o=i.audio,s=a.getSupportedAdaptations("audio"),u=e._audioChoiceMemory.get(a);if(null===u||void 0!==u&&(0,_.Z)(s,u))n(r+1);else{var l=J(s,t);e._audioChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenTextTracks=function(){var e=this,t=X(this._preferredTextTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,h.Z)(i.text))n(r+1);else{var a=i.period,o=i.text,s=a.getSupportedAdaptations("text"),u=e._textChoiceMemory.get(a);if(null===u||void 0!==u&&(0,_.Z)(s,u))n(r+1);else{var l=te(s,t,e._audioChoiceMemory.get(a));e._textChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenVideoTracks=function(){var e=this,t=this._preferredVideoTracks;!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,h.Z)(i.video))n(r+1);else{var a=i.period,o=i.video,s=a.getSupportedAdaptations("video"),u=e._videoChoiceMemory.get(a);if(null!==u){if(void 0!==u&&(0,_.Z)(s,u.baseAdaptation)){var l=ae(u.baseAdaptation,e.trickModeTrackEnabled);return l.id===u.adaptation.id?void n(r+1):(e._videoChoiceMemory.set(a,{baseAdaptation:u.baseAdaptation,adaptation:l}),o.adaptationRef.setValue(l),n(0))}var d=re(s,t);if(null===d)return e._videoChoiceMemory.set(a,null),o.adaptationRef.setValue(null),n(0);var c=ae(d,e.trickModeTrackEnabled);return e._videoChoiceMemory.set(a,{baseAdaptation:d,adaptation:c}),o.adaptationRef.setValue(c),n(0)}n(r+1)}}}(0)},e}();function $(e){return function(t){var n;if(void 0!==e.normalized&&(null!==(n=t.normalizedLanguage)&&void 0!==n?n:"")!==e.normalized)return!1;if(void 0!==e.audioDescription)if(e.audioDescription){if(!0!==t.isAudioDescription)return!1}else if(!0===t.isAudioDescription)return!1;if(void 0===e.codec)return!0;var r=e.codec.test,i=function(e){return void 0!==e.codec&&r.test(e.codec)};return e.codec.all?t.representations.every(i):t.representations.some(i)}}function J(e,t){if(0===e.length)return null;for(var n=0;n0){if(null!=n){var l=(0,H.Z)(u,(function(e){return e.normalizedLanguage===n.normalizedLanguage}));if(void 0!==l)return l}return null!==(r=(0,H.Z)(u,(function(e){return void 0===e.normalizedLanguage})))&&void 0!==r?r:null}return null}function ne(e){return function(t){if(void 0!==e.signInterpreted&&e.signInterpreted!==t.isSignInterpreted)return!1;if(void 0===e.codec)return!0;var n=e.codec.test,r=function(e){return void 0!==e.codec&&n.test(e.codec)};return e.codec.all?t.representations.every(r):t.representations.some(r)}}function re(e,t){if(0===e.length)return null;for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ny)throw new Error('Invalid maxVideoBitrate parameter. Its value, "'+y+'", is inferior to the set minVideoBitrate, "'+m+'"')}if((0,h.Z)(e.maxAudioBitrate))g=E.audio;else{if(g=Number(e.maxAudioBitrate),isNaN(g))throw new Error("Invalid maxAudioBitrate parameter. Should be a number.");if(p>g)throw new Error('Invalid maxAudioBitrate parameter. Its value, "'+g+'", is inferior to the set minAudioBitrate, "'+p+'"')}return{maxBufferAhead:t,maxBufferBehind:n,limitVideoWidth:C,videoElement:d,wantedBufferAhead:r,maxVideoBufferSize:i,throttleWhenHidden:a,throttleVideoBitrateWhenHidden:o,preferredAudioTracks:s,preferredTextTracks:u,preferredVideoTracks:l,initialAudioBitrate:v,initialVideoBitrate:f,minAudioBitrate:p,minVideoBitrate:m,maxAudioBitrate:g,maxVideoBitrate:y,stopAtEnd:(0,h.Z)(e.stopAtEnd)?Z:!!e.stopAtEnd}}(e),o=a.initialAudioBitrate,s=a.initialVideoBitrate,u=a.limitVideoWidth,d=a.minAudioBitrate,f=a.minVideoBitrate,v=a.maxAudioBitrate,p=a.maxBufferAhead,m=a.maxBufferBehind,g=a.maxVideoBitrate,y=a.preferredAudioTracks,_=a.preferredTextTracks,b=a.preferredVideoTracks,S=a.throttleWhenHidden,T=a.throttleVideoBitrateWhenHidden,E=a.videoElement,k=a.wantedBufferAhead,Z=a.maxVideoBufferSize,x=a.stopAtEnd,R=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;E.preload="auto",t.version="3.33.2",t.log=l.Z,t.state="STOPPED",t.videoElement=E;var M=new A.ZP;t._destroyCanceller=M,t._priv_pictureInPictureRef=fe(E,M.signal),he(E,(function(){t.trigger("fullscreenChange",t.isFullscreen())}),M.signal);for(var C=[],P=0;P<(null===(r=E.textTracks)||void 0===r?void 0:r.length);P++){var D=null===(i=E.textTracks)||void 0===i?void 0:i[P];(0,h.Z)(D)||C.push(D)}var N=function(e){for(var n=e.target,r=[],i=0;i0?e.textTracks[0]:null},i.getPlayerState=function(){return this.state},i.isContentLoaded=function(){return!(0,_.Z)(["LOADING","RELOADING","STOPPED"],this.state)},i.isBuffering=function(){return(0,_.Z)(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)},i.isPaused=function(){return!this.videoElement||((0,_.Z)(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused)},i.isLive=function(){if(null===this._priv_contentInfos)return!1;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;return!t&&null!==n&&n.isLive},i.areTrickModeTracksEnabled=function(){return this._priv_preferTrickModeTracks},i.getUrl=function(){if(null!==this._priv_contentInfos){var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest,r=e.originalUrl;return t?r:null!==n?n.getUrl():void 0}},i.updateContentUrls=function(e,t){if(null===this._priv_contentInfos)throw new Error("No content loaded");var n=!0===(null==t?void 0:t.refresh);this._priv_contentInfos.initializer.updateContentUrls(e,n)},i.getVideoDuration=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration},i.getVideoBufferGap=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,k.L7)(e.buffered,e.currentTime)},i.getVideoLoadedTime=function(){if((0,I.Z)("`getVideoLoadedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,k.at)(e.buffered,e.currentTime)},i.getVideoPlayedTime=function(){if((0,I.Z)("`getVideoPlayedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,k.DD)(e.buffered,e.currentTime)},i.getWallClockTime=function(){if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)return this.videoElement.currentTime;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){var r=a(this.videoElement);return(null!=r?r:0)+this.videoElement.currentTime}return null!==n?this.videoElement.currentTime+(void 0!==n.availabilityStartTime?n.availabilityStartTime:0):0},i.getPosition=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.currentTime},i.getLastStoredContentPosition=function(){return this._priv_reloadingMetadata.reloadPosition},i.getPlaybackRate=function(){return this._priv_speed.getValue()},i.setPlaybackRate=function(e,t){var n;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);var r=null==t?void 0:t.preferTrickModeTracks;if("boolean"==typeof r){this._priv_preferTrickModeTracks=r;var i=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.trackChoiceManager;(0,h.Z)(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}},i.getAvailableVideoBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,h.Z)(r.video)?[]:r.video.getAvailableBitrates()},i.getAvailableAudioBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,h.Z)(r.audio)?[]:r.audio.getAvailableBitrates()},i.getManualAudioBitrate=function(){return this._priv_bitrateInfos.manualBitrates.audio.getValue()},i.getManualVideoBitrate=function(){return this._priv_bitrateInfos.manualBitrates.video.getValue()},i.getVideoBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,h.Z)(e.video))return e.video.bitrate},i.getAudioBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,h.Z)(e.audio))return e.audio.bitrate},i.getMinVideoBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.video.getValue()},i.getMinAudioBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.audio.getValue()},i.getMaxVideoBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.video.getValue()},i.getMaxAudioBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.audio.getValue()},i.play=function(){var e=this;if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement.play();return(0,h.Z)(t)||"function"!=typeof t.catch?Promise.resolve():t.catch((function(t){if("NotAllowedError"===t.name){var n=new v.Z("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());e.trigger("warning",n)}throw t}))},i.pause=function(){if(null===this.videoElement)throw new Error("Disposed player");this.videoElement.pause()},i.seekTo=function(e){var t;if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)throw new Error("player: no content loaded");var n,r=this._priv_contentInfos,i=r.isDirectFile,o=r.manifest;if(!i&&null===o)throw new Error("player: the content did not load yet");if("number"==typeof e)n=e;else if("object"==typeof e){var s=e,u=this.videoElement.currentTime;if((0,h.Z)(s.relative))if((0,h.Z)(s.position)){if((0,h.Z)(s.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(null!==o)n=s.wallClockTime-(null!==(t=o.availabilityStartTime)&&void 0!==t?t:0);else if(i&&null!==this.videoElement){var d=a(this.videoElement);void 0!==d&&(n=s.wallClockTime-d)}void 0===n&&(n=s.wallClockTime)}else n=s.position;else n=u+s.relative}if(void 0===n)throw new Error("invalid time given");return l.Z.info("API: API Seek to",n),this.videoElement.currentTime=n,n},i.isFullscreen=function(){return(0,I.Z)("isFullscreen is deprecated. Fullscreen management should now be managed by the application"),s()},i.setFullscreen=function(e){if(void 0===e&&(e=!0),(0,I.Z)("setFullscreen is deprecated. Fullscreen management should now be managed by the application"),null===this.videoElement)throw new Error("Disposed player");e?function(e){if(!s()){var t=e;"function"==typeof t.requestFullscreen?t.requestFullscreen():"function"==typeof t.msRequestFullscreen?t.msRequestFullscreen():"function"==typeof t.mozRequestFullScreen?t.mozRequestFullScreen():"function"==typeof t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}(this.videoElement):o()},i.exitFullscreen=function(){(0,I.Z)("exitFullscreen is deprecated. Fullscreen management should now be managed by the application"),o()},i.getVolume=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.volume},i.setVolume=function(e){if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement;e!==t.volume&&(t.volume=e,this.trigger("volumeChange",e))},i.isMute=function(){return 0===this.getVolume()},i.mute=function(){this._priv_mutedMemory=this.getVolume(),this.setVolume(0)},i.unMute=function(){var e=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;0===this.getVolume()&&this.setVolume(0===this._priv_mutedMemory?e:this._priv_mutedMemory)},i.setVideoBitrate=function(e){this._priv_bitrateInfos.manualBitrates.video.setValue(e)},i.setAudioBitrate=function(e){this._priv_bitrateInfos.manualBitrates.audio.setValue(e)},i.setMinVideoBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.video.getValue();if(e>t)throw new Error('Invalid minimum video bitrate given. Its value, "'+e+'" is superior the current maximum video birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.video.setValue(e)},i.setMinAudioBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.audio.getValue();if(e>t)throw new Error('Invalid minimum audio bitrate given. Its value, "'+e+'" is superior the current maximum audio birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.audio.setValue(e)},i.setMaxVideoBitrate=function(e){var t=this._priv_bitrateInfos.minAutoBitrates.video.getValue();if(e0||c.result.removedAdaptations.length>0)){var f=u.getAvailableAudioTracks(s);r._priv_triggerEventIfNotStopped("availableAudioTracksChange",null!=f?f:[],i);var v=u.getAvailableTextTracks(s);r._priv_triggerEventIfNotStopped("availableTextTracksChange",null!=v?v:[],i);var p=u.getAvailableVideoTracks(s);r._priv_triggerEventIfNotStopped("availableVideoTracksChange",null!=p?p:[],i)}return}}),e.currentContentCanceller.signal)}},i._priv_onActivePeriodChanged=function(e,t){var n,r,i,a,o,s,u,l,d=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.currentPeriod=d;var c=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==d&&(this._priv_contentEventsMemory.periodChange=d,this._priv_triggerEventIfNotStopped("periodChange",d,c)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),c),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),c),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),c);var f=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.trackChoiceManager;if((0,h.Z)(f))this._priv_triggerEventIfNotStopped("audioTrackChange",null,c),this._priv_triggerEventIfNotStopped("textTrackChange",null,c),this._priv_triggerEventIfNotStopped("videoTrackChange",null,c);else{var v=f.getChosenAudioTrack(d);this._priv_triggerEventIfNotStopped("audioTrackChange",v,c);var p=f.getChosenTextTrack(d);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);var m=f.getChosenVideoTrack(d);this._priv_triggerEventIfNotStopped("videoTrackChange",m,c)}if(this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",this.getAvailableAudioBitrates(),c),!e.currentContentCanceller.isUsed()&&(this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",this.getAvailableVideoBitrates(),c),!e.currentContentCanceller.isUsed())){var g=null!==(o=null===(a=null===(i=this._priv_getCurrentRepresentations())||void 0===i?void 0:i.audio)||void 0===a?void 0:a.bitrate)&&void 0!==o?o:-1;if(this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",g,c),!e.currentContentCanceller.isUsed()){var y=null!==(l=null===(u=null===(s=this._priv_getCurrentRepresentations())||void 0===s?void 0:s.video)||void 0===u?void 0:u.bitrate)&&void 0!==l?l:-1;this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",y,c)}}}},i._priv_onPeriodStreamReady=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=t.adaptationRef,o=e.trackChoiceManager;switch(r){case"video":(0,h.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new video period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialVideoTrack(i));break;case"audio":(0,h.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialAudioTrack(i));break;case"text":(0,h.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialTextTrack(i));break;default:var s=i.adaptations[r];!(0,h.Z)(s)&&s.length>0?a.setValue(s[0]):a.setValue(null)}}},i._priv_onPeriodStreamCleared=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=e.trackChoiceManager;switch(r){case"audio":case"text":case"video":(0,h.Z)(a)||a.removePeriod(r,i)}var o=e.activeAdaptations,s=e.activeRepresentations;if(!(0,h.Z)(o)&&!(0,h.Z)(o[i.id])){var u=o[i.id];delete u[r],0===Object.keys(u).length&&delete o[i.id]}if(!(0,h.Z)(s)&&!(0,h.Z)(s[i.id])){var l=s[i.id];delete l[r],0===Object.keys(l).length&&delete s[i.id]}}},i._priv_onAdaptationChange=function(e,t){var n,r=t.type,i=t.adaptation,a=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeAdaptations&&(e.activeAdaptations={});var o,s=e.activeAdaptations,u=e.currentPeriod,l=s[a.id];if((0,h.Z)(l))s[a.id]=((o={})[r]=i,o);else l[r]=i;var d=e.trackChoiceManager,c=e.currentContentCanceller.signal;if(null!==d&&null!==u&&!(0,h.Z)(a)&&a.id===u.id)switch(r){case"audio":var f=d.getChosenAudioTrack(u);this._priv_triggerEventIfNotStopped("audioTrackChange",f,c);var v=this.getAvailableAudioBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",v,c);break;case"text":var p=d.getChosenTextTrack(u);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);break;case"video":var m=d.getChosenVideoTrack(u);this._priv_triggerEventIfNotStopped("videoTrackChange",m,c);var g=this.getAvailableVideoBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",g,c)}}},i._priv_onRepresentationChange=function(e,t){var n,r,i=t.type,a=t.period,o=t.representation;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeRepresentations&&(e.activeRepresentations={});var s,u=e.activeRepresentations,l=e.currentPeriod,d=u[a.id];if((0,h.Z)(d))u[a.id]=((s={})[i]=o,s);else d[i]=o;var c=null!==(r=null==o?void 0:o.bitrate)&&void 0!==r?r:-1;if(!(0,h.Z)(a)&&null!==l&&l.id===a.id){var f=this._priv_contentInfos.currentContentCanceller.signal;"video"===i?this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",c,f):"audio"===i&&this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",c,f)}}},i._priv_onBitrateEstimationChange=function(e){var t=e.type,n=e.bitrate;void 0!==n&&(this._priv_bitrateInfos.lastBitrates[t]=n),this.trigger("bitrateEstimationChange",{type:t,bitrate:n})},i._priv_onNativeTextTracksNext=function(e){this.trigger("nativeTextTracksChange",e)},i._priv_setPlayerState=function(e){this.state!==e&&(this.state=e,l.Z.info("API: playerStateChange event",e),this.trigger("playerStateChange",e))},i._priv_triggerPositionUpdate=function(e,t){var n,r;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var i=e.isDirectFile,o=e.manifest;if((i||null!==o)&&!(0,h.Z)(t)){var s=null!==o?o.getMaximumSafePosition():void 0,u={position:t.position,duration:t.duration,playbackRate:t.playbackRate,maximumBufferTime:s,bufferGap:void 0!==t.bufferGap&&isFinite(t.bufferGap)?t.bufferGap:0};if(null!==o&&o.isLive&&t.position>0){var l=null!==(r=o.availabilityStartTime)&&void 0!==r?r:0;u.wallClockTime=t.position+l;var d=o.getLivePosition();void 0!==d&&(u.liveGap=d-t.position)}else if(i&&null!==this.videoElement){var c=a(this.videoElement);void 0!==c&&(u.wallClockTime=c+t.position)}this.trigger("positionUpdate",u)}}},i._priv_triggerAvailableBitratesChangeEvent=function(e,t,n){var r=this._priv_contentEventsMemory[e];n.isCancelled()||void 0!==r&&(0,y.Z)(t,r)||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_triggerCurrentBitrateChangeEvent=function(e,t,n){n.isCancelled()||t===this._priv_contentEventsMemory[e]||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_getCurrentRepresentations=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeRepresentations;return null===t||null===n||(0,h.Z)(n[t.id])?null:n[t.id]},i._priv_triggerEventIfNotStopped=function(e,t,n){n.isCancelled()||this.trigger(e,t)},i._priv_initializeMediaElementTrackChoiceManager=function(e,t,n){var r,i,a,o=this;(0,b.Z)(null!==g.Z.directfile,"Initializing `MediaElementTrackChoiceManager` without Directfile feature"),(0,b.Z)(null!==this.videoElement,"Initializing `MediaElementTrackChoiceManager` on a disposed RxPlayer");var s=new g.Z.directfile.mediaElementTrackChoiceManager(this.videoElement),u=void 0===e?this._priv_preferredAudioTracks:[e];s.setPreferredAudioTracks(u,!0);var l=void 0===t?this._priv_preferredTextTracks:[t];return s.setPreferredTextTracks(l,!0),s.setPreferredVideoTracks(this._priv_preferredVideoTracks,!0),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",s.getAvailableAudioTracks(),n),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",s.getAvailableVideoTracks(),n),this._priv_triggerEventIfNotStopped("availableTextTracksChange",s.getAvailableTextTracks(),n),this._priv_triggerEventIfNotStopped("audioTrackChange",null!==(r=s.getChosenAudioTrack())&&void 0!==r?r:null,n),this._priv_triggerEventIfNotStopped("textTrackChange",null!==(i=s.getChosenTextTrack())&&void 0!==i?i:null,n),this._priv_triggerEventIfNotStopped("videoTrackChange",null!==(a=s.getChosenVideoTrack())&&void 0!==a?a:null,n),s.addEventListener("availableVideoTracksChange",(function(e){return o.trigger("availableVideoTracksChange",e)})),s.addEventListener("availableAudioTracksChange",(function(e){return o.trigger("availableAudioTracksChange",e)})),s.addEventListener("availableTextTracksChange",(function(e){return o.trigger("availableTextTracksChange",e)})),s.addEventListener("audioTrackChange",(function(e){return o.trigger("audioTrackChange",e)})),s.addEventListener("videoTrackChange",(function(e){return o.trigger("videoTrackChange",e)})),s.addEventListener("textTrackChange",(function(e){return o.trigger("textTrackChange",e)})),s},(0,e.Z)(r,null,[{key:"ErrorTypes",get:function(){return p.ZB}},{key:"ErrorCodes",get:function(){return p.SM}},{key:"LogLevel",get:function(){return l.Z.getLevel()},set:function(e){l.Z.setLevel(e)}}]),r}(S.Z);ye.version="3.33.2";var _e=ye;!function(){m.Z.mediaSourceInit=n(7117).Z,m.Z.decrypt=n(3380).ZP,m.Z.imageBuffer=n(7127).Z,m.Z.imageParser=n(3203).Z,m.Z.transports.smooth=n(2339).Z,m.Z.transports.dash=n(85).Z,m.Z.dashParsers.js=n(1707).Z,m.Z.nativeTextTracksBuffer=n(9059).Z,m.Z.nativeTextTracksParsers.vtt=n(9405).Z,m.Z.nativeTextTracksParsers.ttml=n(1570).Z,m.Z.nativeTextTracksParsers.sami=n(1812).Z,m.Z.nativeTextTracksParsers.srt=n(8057).Z,m.Z.htmlTextTracksBuffer=n(5192).Z,m.Z.htmlTextTracksParsers.sami=n(5734).Z,m.Z.htmlTextTracksParsers.ttml=n(7439).Z,m.Z.htmlTextTracksParsers.srt=n(8675).Z,m.Z.htmlTextTracksParsers.vtt=n(4099).Z;var e=n(9372).Z,t=n(6796).Z;m.Z.directfile={initDirectFile:e,mediaElementTrackChoiceManager:t}}(),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&l.Z.setLevel("DEBUG");var be=_e}(),r=r.default}()})); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5073468e38..eae81d99e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rx-player", - "version": "3.33.1", + "version": "3.33.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "rx-player", - "version": "3.33.1", + "version": "3.33.2", "license": "Apache-2.0", "dependencies": { "next-tick": "1.1.0" diff --git a/package.json b/package.json index e555ea7162..26771bc605 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "rx-player", "author": "Canal+", - "version": "3.33.1", + "version": "3.33.2", "description": "Canal+ HTML5 Video Player", "main": "./dist/rx-player.js", "keywords": [ diff --git a/sonar-project.properties b/sonar-project.properties index 996a6828ee..a583848e83 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ sonar.projectKey=rx-player sonar.organization=rx-player sonar.projectName=rx-player -sonar.projectVersion=3.33.1 +sonar.projectVersion=3.33.2 sonar.sources=./src,./demo,./tests sonar.exclusions=demo/full/bundle.js,demo/standalone/lib.js,demo/bundle.js sonar.host.url=https://sonarcloud.io diff --git a/src/core/api/public_api.ts b/src/core/api/public_api.ts index 76f6fe035d..1dbb911dc6 100644 --- a/src/core/api/public_api.ts +++ b/src/core/api/public_api.ts @@ -380,7 +380,7 @@ class Player extends EventEmitter { // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624 videoElement.preload = "auto"; - this.version = /* PLAYER_VERSION */"3.33.1"; + this.version = /* PLAYER_VERSION */"3.33.2"; this.log = log; this.state = "STOPPED"; this.videoElement = videoElement; @@ -3140,7 +3140,7 @@ class Player extends EventEmitter { return mediaElementTrackChoiceManager; } } -Player.version = /* PLAYER_VERSION */"3.33.1"; +Player.version = /* PLAYER_VERSION */"3.33.2"; /** Every events sent by the RxPlayer's public API. */ interface IPublicAPIEvent {