@mux/mux-audio 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mux-audio.js CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";(()=>{var Vi=Object.create;var Nr=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var zi=Object.getOwnPropertyNames;var Xi=Object.getPrototypeOf,Qi=Object.prototype.hasOwnProperty;var Kr=(j,R)=>()=>(R||j((R={exports:{}}).exports,R),R.exports);var $i=(j,R,l,P)=>{if(R&&typeof R=="object"||typeof R=="function")for(let L of zi(R))!Qi.call(j,L)&&L!==l&&Nr(j,L,{get:()=>R[L],enumerable:!(P=Yi(R,L))||P.enumerable});return j};var Zt=(j,R,l)=>(l=j!=null?Vi(Xi(j)):{},$i(R||!j||!j.__esModule?Nr(l,"default",{value:j,enumerable:!0}):l,j));var Er=(j,R,l)=>{if(!R.has(j))throw TypeError("Cannot "+l)};var qt=(j,R,l)=>(Er(j,R,"read from private field"),l?l.call(j):R.get(j)),Bt=(j,R,l)=>{if(R.has(j))throw TypeError("Cannot add the same private member more than once");R instanceof WeakSet?R.add(j):R.set(j,l)},er=(j,R,l,P)=>(Er(j,R,"write to private field"),P?P.call(j,l):R.set(j,l),l);var tr=(j,R,l)=>(Er(j,R,"access private method"),l);var Gr=Kr((rr,Sr)=>{(function(){var j,R;j=this,R=function(){return function(){var l={80:function(A,M,O){A.exports=O(728).default},728:function(A,M,O){"use strict";O.d(M,{default:function(){return Hi}});var b=O(48),_=O.n(b),y=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(w){var C=16*Math.random()|0;return(w==="x"?C:3&C|8).toString(16)})},x=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},D=function(w){return w&&w.nodeName!==void 0?(w.muxId||(w.muxId=w.id||x()),w.muxId):w},E=function(w){var C;w&&w.nodeName!==void 0?w=D(C=w):C=document.querySelector(w);var F=C&&C.nodeName?C.nodeName.toLowerCase():"";return[C,w,F]},m=O(640),p=O.n(m),f=p().methodFactory;p().methodFactory=function(w,C,F){var N=f(w,C,F);return function(){for(var K=["[mux]"],V=0;V<arguments.length;V++)K.push(arguments[V]);N.apply(void 0,K)}},p().setLevel(p().getLevel());var e=p();function s(){return(_().doNotTrack||_().navigator&&_().navigator.doNotTrack)==="1"}var h={now:function(){var w=_().performance,C=w&&w.timing,F=w&&w.timeOrigin||C&&C.navigationStart;return typeof F=="number"&&typeof w.now=="function"?F+w.now():Date.now()}},g=O(678),i=O.n(g),r=function(w){return o(w)[0]},o=function(w){if(typeof w!="string"||w==="")return["localhost"];var C,F=(w.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return F&&(C=(F.match(/[^\.]+\.[^\.]+$/)||[])[0]),[F,C]},c={exists:function(){var w=_().performance;return(w&&w.timing)!==void 0},domContentLoadedEventEnd:function(){var w=_().performance,C=w&&w.timing;return C&&C.domContentLoadedEventEnd},navigationStart:function(){var w=_().performance,C=w&&w.timing;return C&&C.navigationStart}};function t(w,C,F){F=F===void 0?1:F,w[C]=w[C]||0,w[C]+=F}var n=["x-cdn","content-type","x-request-id"];function u(w){var C={};return(w=w||"").trim().split(/[\r\n]+/).forEach(function(F){if(F){var N=F.split(": "),K=N.shift();K&&(n.indexOf(K.toLowerCase())>=0||K.toLowerCase().indexOf("x-litix-")===0)&&(C[K]=N.join(": "))}}),C}var a=function(w){var C={};for(var F in w){var N=w[F];N["DATA-ID"].search("io.litix.data.")!==-1&&(C[N["DATA-ID"].replace("io.litix.data.","")]=N.VALUE)}return C};function d(w,C){var F=Object.keys(w);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(w);C&&(N=N.filter(function(K){return Object.getOwnPropertyDescriptor(w,K).enumerable})),F.push.apply(F,N)}return F}function v(w){for(var C=1;C<arguments.length;C++){var F=arguments[C]!=null?arguments[C]:{};C%2?d(Object(F),!0).forEach(function(N){S(w,N,F[N])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(F)):d(Object(F)).forEach(function(N){Object.defineProperty(w,N,Object.getOwnPropertyDescriptor(F,N))})}return w}function S(w,C,F){return C in w?Object.defineProperty(w,C,{value:F,enumerable:!0,configurable:!0,writable:!0}):w[C]=F,w}var T=function(w){if(!w)return{};var C=c.navigationStart(),F=w.loading,N=F?F.start:w.trequest,K=F?F.first:w.tfirst,V=F?F.end:w.tload;return{bytesLoaded:w.total,requestStart:Math.round(C+N),responseStart:Math.round(C+K),responseEnd:Math.round(C+V)}},I=function(w){if(w&&typeof w.getAllResponseHeaders=="function")return u(w.getAllResponseHeaders())},k=function(w,C){if(!w||typeof w.getRequests!="function")return{};var F=w.getRequests({state:"executed"});if(F.length===0)return{};var N,K=F[F.length-1],V=r(K.url),H=K.bytesLoaded,Q=new Date(K.requestStartDate).getTime(),J=new Date(K.firstByteDate).getTime(),X=new Date(K.requestEndDate).getTime(),ee=isNaN(K.duration)?0:K.duration,ce=typeof C.getMetricsFor=="function"?C.getMetricsFor(K.mediaType).HttpList:C.getDashMetrics().getHttpRequests(K.mediaType);return ce.length>0&&(N=u(ce[ce.length-1]._responseHeaders||"")),{requestStart:Q,requestResponseStart:J,requestResponseEnd:X,requestBytesLoaded:H,requestResponseHeaders:N,requestMediaDuration:ee,requestHostname:V}},B=function(w,C){var F=C.getQualityFor(w),N=C.getCurrentTrackFor(w).bitrateList;return N?{currentLevel:F,renditionWidth:N[F].width||null,renditionHeight:N[F].height||null,renditionBitrate:N[F].bandwidth}:{}};function U(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var W=0,G=function(){function w(){(function(K,V){if(!(K instanceof V))throw new TypeError("Cannot call a class as a function")})(this,w)}var C,F,N;return C=w,F=[{key:"on",value:function(K,V,H){return V._eventEmitterGuid=V._eventEmitterGuid||++W,this._listeners=this._listeners||{},this._listeners[K]=this._listeners[K]||[],H&&(V=V.bind(H)),this._listeners[K].push(V),V}},{key:"off",value:function(K,V){var H=this._listeners&&this._listeners[K];H&&H.forEach(function(Q,J){Q._eventEmitterGuid===V._eventEmitterGuid&&H.splice(J,1)})}},{key:"one",value:function(K,V,H){var Q=this;V._eventEmitterGuid=V._eventEmitterGuid||++W;var J=function X(){Q.off(K,X),V.apply(H||this,arguments)};J._eventEmitterGuid=V._eventEmitterGuid,this.on(K,J)}},{key:"emit",value:function(K,V){var H=this;if(this._listeners){V=V||{};var Q=this._listeners["before*"]||[],J=this._listeners[K]||[],X=this._listeners["after"+K]||[],ee=function(ce,ye){(ce=ce.slice()).forEach(function(ve){ve.call(H,{type:K},ye)})};ee(Q,V),ee(J,V),ee(X,V)}}}],F&&U(C.prototype,F),N&&U(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}(),z=G;function Y(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var $=function(){function w(K){var V=this;(function(H,Q){if(!(H instanceof Q))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,K.on("playing",function(){V._playheadShouldBeProgressing=!0}),K.on("play",this._startPlaybackHeartbeatInterval.bind(this)),K.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),K.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),K.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),K.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),K.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),K.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),K.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),K.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),K.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("seeked",function(){K.data.player_is_paused?V._stopPlaybackHeartbeatInterval():V._startPlaybackHeartbeatInterval()}),K.on("timeupdate",function(){V._playbackHeartbeatInterval!==null&&K.emit("playbackheartbeat")}),K.on("devicesleep",function(H,Q){V._playbackHeartbeatInterval!==null&&(_().clearInterval(V._playbackHeartbeatInterval),K.emit("playbackheartbeatend",{viewer_time:Q.viewer_time}),V._playbackHeartbeatInterval=null)})}var C,F,N;return C=w,(F=[{key:"_startPlaybackHeartbeatInterval",value:function(){var K=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=_().setInterval(function(){K.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(_().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&Y(C.prototype,F),N&&Y(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function Z(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function q(w,C,F){return C&&Z(w.prototype,C),F&&Z(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var ie=q(function w(C){var F=this;(function(N,K){if(!(N instanceof K))throw new TypeError("Cannot call a class as a function")})(this,w),C.on("viewinit",function(){F.viewErrored=!1}),C.on("error",function(){try{var N=C.errorTranslator({player_error_code:C.data.player_error_code,player_error_message:C.data.player_error_message});N?(C.data.player_error_code=N.player_error_code,C.data.player_error_message=N.player_error_message,F.viewErrored=!0):(delete C.data.player_error_code,delete C.data.player_error_message)}catch(K){C.mux.log.warn("Exception in error translator callback.",K),F.viewErrored=!0}})});function ne(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var ae=function(){function w(K){(function(V,H){if(!(V instanceof H))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,this._watchTimeTrackerLastCheckedTime=null,K.on("playbackheartbeat",this._updateWatchTime.bind(this)),K.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var C,F,N;return C=w,(F=[{key:"_updateWatchTime",value:function(K,V){var H=V.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=H),t(this.pm.data,"view_watch_time",H-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=H}},{key:"_clearWatchTimeState",value:function(K,V){this._updateWatchTime(K,V),this._watchTimeTrackerLastCheckedTime=null}}])&&ne(C.prototype,F),N&&ne(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function te(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var fe=function(){function w(K){(function(V,H){if(!(V instanceof H))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,this._playbackTimeTrackerLastPlayheadPosition=-1,K.on("playbackheartbeat",this._updatePlaybackTime.bind(this)),K.on("playbackheartbeatend",this._clearPlaybackTimeState.bind(this)),K.on("seeking",this._clearPlaybackTimeState.bind(this))}var C,F,N;return C=w,(F=[{key:"_updatePlaybackTime",value:function(){var K=this.pm.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&K>this._playbackTimeTrackerLastPlayheadPosition){var V=K-this._playbackTimeTrackerLastPlayheadPosition;V<=1e3&&t(this.pm.data,"view_content_playback_time",V)}this._playbackTimeTrackerLastPlayheadPosition=K}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&te(C.prototype,F),N&&te(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function de(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var re=function(){function w(K){(function(H,Q){if(!(H instanceof Q))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K;var V=this._updatePlayheadTime.bind(this);K.on("playbackheartbeat",V),K.on("playbackheartbeatend",V),K.on("timeupdate",V),K.on("destroy",function(){K.off("timeupdate",V)})}var C,F,N;return C=w,(F=[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=this.pm.data.view_max_playhead_position===void 0?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(K,V){var H=this,Q=function(){H.pm.currentFragmentPDT&&H.pm.currentFragmentStart&&(H.pm.data.player_program_time=H.pm.currentFragmentPDT+H.pm.data.player_playhead_time-H.pm.currentFragmentStart)};if(V&&V.player_playhead_time)this.pm.data.player_playhead_time=V.player_playhead_time,Q(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var J=this.pm.getPlayheadTime();J!==void 0&&(this.pm.data.player_playhead_time=J,Q(),this._updateMaxPlayheadPosition())}}}])&&de(C.prototype,F),N&&de(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function Ee(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function me(w,C,F){return C&&Ee(w.prototype,C),F&&Ee(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var Te=me(function w(C){if(function(K,V){if(!(K instanceof V))throw new TypeError("Cannot call a class as a function")}(this,w),!C.disableRebufferTracking){var F,N=function(){if(F){var K=C.data.viewer_time-F;t(C.data,"view_rebuffer_duration",K),F=C.data.viewer_time}C.data.view_watch_time>=0&&C.data.view_rebuffer_count>0&&(C.data.view_rebuffer_frequency=C.data.view_rebuffer_count/C.data.view_watch_time,C.data.view_rebuffer_percentage=C.data.view_rebuffer_duration/C.data.view_watch_time)};C.on("playbackheartbeat",function(){return N()}),C.on("rebufferstart",function(){F||(t(C.data,"view_rebuffer_count",1),F=C.data.viewer_time,C.one("rebufferend",function(){N(),F=void 0}))})}});function Me(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var _e=function(){function w(K){var V=this;(function(H,Q){if(!(H instanceof Q))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,K.disableRebufferTracking||K.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,K.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),K.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),K.on("seeking",function(){V._cleanupRebufferTracker(null,{viewer_time:h.now()})}))}var C,F,N;return C=w,F=[{key:"_checkIfRebuffering",value:function(K,V){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(K,V);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var H=V.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&H>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=V.viewer_time}else this._cleanupRebufferTracker(K,V,!0);else this._prepareRebufferTrackerState(V.viewer_time)}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(K){this._lastCheckedTime=K,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=K}},{key:"_cleanupRebufferTracker",value:function(K,V){var H=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:V.viewer_time});else{if(this._lastCheckedTime===null)return;var Q=this.pm.data.player_playhead_time-this._lastPlayheadTime,J=V.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&Q>0&&J-Q>this.pm.minimumRebufferDuration&&(this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+J-Q}))}H?this._prepareRebufferTrackerState(V.viewer_time):this._clearRebufferTrackerState()}}],F&&Me(C.prototype,F),N&&Me(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}(),ke=_e;function Ie(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var Be=function(){function w(K){var V=this;(function(H,Q){if(!(H instanceof Q))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,K.on("viewinit",function(){var H=K.data,Q=H.view_id;if(!H.view_program_changed){var J=function(X,ee){var ce=ee.viewer_time;X.type==="playing"&&K.data.view_time_to_first_frame===void 0?V.calculateTimeToFirstFrame(ce||h.now(),Q):X.type!=="adplaying"||K.data.view_time_to_first_frame!==void 0&&!V._inPrerollPosition()||V.calculateTimeToFirstFrame(ce||h.now(),Q)};K.one("playing",J),K.one("adplaying",J),K.one("viewend",function(){K.off("playing",J),K.off("adplaying",J)})}})}var C,F,N;return C=w,(F=[{key:"_inPrerollPosition",value:function(){return this.pm.data.view_content_playback_time===void 0||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(K,V){V===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:K}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.NAVIGATION_START&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.NAVIGATION_START))}}])&&Ie(C.prototype,F),N&&Ie(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function be(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function Ue(w,C,F){return C&&be(w.prototype,C),F&&be(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var Ke=Ue(function w(C){var F=this;(function(N,K){if(!(N instanceof K))throw new TypeError("Cannot call a class as a function")})(this,w),C.on("viewinit",function(){F._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(N){C.on(N,function(){if(F._lastPlayheadPosition>=0&&C.data.player_playhead_time>=0&&F._lastPlayerWidth>=0&&F._lastSourceWidth>0&&F._lastPlayerHeight>=0&&F._lastSourceHeight>0){var K=C.data.player_playhead_time-F._lastPlayheadPosition;if(K<0)return void(F._lastPlayheadPosition=-1);var V=Math.min(F._lastPlayerWidth/F._lastSourceWidth,F._lastPlayerHeight/F._lastSourceHeight),H=Math.max(0,V-1),Q=Math.max(0,1-V);C.data.view_max_upscale_percentage=Math.max(C.data.view_max_upscale_percentage||0,H),C.data.view_max_downscale_percentage=Math.max(C.data.view_max_downscale_percentage||0,Q),t(C.data,"view_total_content_playback_time",K),t(C.data,"view_total_upscaling",H*K),t(C.data,"view_total_downscaling",Q*K)}F._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(N){C.on(N,function(){F._lastPlayheadPosition=C.data.player_playhead_time,F._lastPlayerWidth=C.data.player_width,F._lastPlayerHeight=C.data.player_height,F._lastSourceWidth=C.data.video_source_width,F._lastSourceHeight=C.data.video_source_height})})});function je(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function Ne(w,C,F){return C&&je(w.prototype,C),F&&je(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var qe=Ne(function w(C){var F=this;(function(N,K){if(!(N instanceof K))throw new TypeError("Cannot call a class as a function")})(this,w),this.isSeeking=!1,C.on("seeking",function(N,K){i()(C.data,K),F._lastSeekingTime=h.now(),F.isSeeking===!1&&(F.isSeeking=!0,C.send("seeking"))}),C.on("seeked",function(){F.isSeeking=!1;var N=F._lastSeekingTime||h.now(),K=h.now()-N;t(C.data,"view_seek_count",1),t(C.data,"view_seek_duration",K);var V=C.data.view_max_seek_time||0;C.data.view_max_seek_time=Math.max(V,K)}),C.on("viewend",function(){F.isSeeking=!1})});function Fe(w,C){return function(F){if(Array.isArray(F))return F}(w)||function(F,N){var K=F==null?null:typeof Symbol!="undefined"&&F[Symbol.iterator]||F["@@iterator"];if(K!=null){var V,H,Q=[],J=!0,X=!1;try{for(K=K.call(F);!(J=(V=K.next()).done)&&(Q.push(V.value),!N||Q.length!==N);J=!0);}catch(ee){X=!0,H=ee}finally{try{J||K.return==null||K.return()}finally{if(X)throw H}}return Q}}(w,C)||function(F,N){if(F){if(typeof F=="string")return et(F,N);var K=Object.prototype.toString.call(F).slice(8,-1);return K==="Object"&&F.constructor&&(K=F.constructor.name),K==="Map"||K==="Set"?Array.from(F):K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K)?et(F,N):void 0}}(w,C)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function et(w,C){(C==null||C>w.length)&&(C=w.length);for(var F=0,N=new Array(C);F<C;F++)N[F]=w[F];return N}function Oe(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var Pe=function(w,C){w.push(C),w.sort(function(F,N){return F.viewer_time-N.viewer_time})},Ve=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Ce=function(){function w(K){var V=this;(function(Q,J){if(!(Q instanceof J))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,K.on("viewinit",function(){V.isAdBreak=!1,V._currentAdRequestNumber=0,V._currentAdResponseNumber=0,V._adRequests=[],V._adResponses=[],V._adHasPlayed=!1,V._wouldBeNewAdPlay=!0,V._prerollPlayTime=void 0}),Ve.forEach(function(Q){return K.on(Q,V._updateAdData.bind(V))});var H=function(){V.isAdBreak=!1};K.on("adbreakstart",function(){V.isAdBreak=!0}),K.on("play",H),K.on("playing",H),K.on("viewend",H),K.on("adrequest",function(Q,J){J=i()({ad_request_id:"generatedAdRequestId"+V._currentAdRequestNumber++},J),Pe(V._adRequests,J),t(K.data,"view_ad_request_count"),V.inPrerollPosition()&&(K.data.view_preroll_requested=!0,V._adHasPlayed||t(K.data,"view_preroll_request_count"))}),K.on("adresponse",function(Q,J){J=i()({ad_request_id:"generatedAdRequestId"+V._currentAdResponseNumber++},J),Pe(V._adResponses,J);var X=V.findAdRequest(J.ad_request_id);X&&t(K.data,"view_ad_request_time",Math.max(0,J.viewer_time-X.viewer_time))}),K.on("adplay",function(Q,J){V._adHasPlayed=!0,V._wouldBeNewAdPlay&&(V._wouldBeNewAdPlay=!1,t(K.data,"view_ad_played_count")),V.inPrerollPosition()&&!K.data.view_preroll_played&&(K.data.view_preroll_played=!0,V._adRequests.length>0&&(K.data.view_preroll_request_time=Math.max(0,J.viewer_time-V._adRequests[0].viewer_time)),K.data.view_start&&(K.data.view_startup_preroll_request_time=Math.max(0,J.viewer_time-K.data.view_start)),V._prerollPlayTime=J.viewer_time)}),K.on("adplaying",function(Q,J){V.inPrerollPosition()&&K.data.view_preroll_load_time===void 0&&V._prerollPlayTime!==void 0&&(K.data.view_preroll_load_time=J.viewer_time-V._prerollPlayTime,K.data.view_startup_preroll_load_time=J.viewer_time-V._prerollPlayTime)}),K.on("adended",function(){V._wouldBeNewAdPlay=!0}),K.on("aderror",function(){V._wouldBeNewAdPlay=!0})}var C,F,N;return C=w,(F=[{key:"inPrerollPosition",value:function(){return this.pm.data.view_content_playback_time===void 0||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",value:function(K){for(var V=0;V<this._adRequests.length;V++)if(this._adRequests[V].ad_request_id===K)return this._adRequests[V]}},{key:"_updateAdData",value:function(K,V){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&V.ad_tag_url){var H=Fe(o(V.ad_tag_url),2),Q=H[0],J=H[1];this.pm.data.view_preroll_ad_tag_domain=J,this.pm.data.view_preroll_ad_tag_hostname=Q}if(!this.pm.data.view_preroll_ad_asset_hostname&&V.ad_asset_url){var X=Fe(o(V.ad_asset_url),2),ee=X[0],ce=X[1];this.pm.data.view_preroll_ad_asset_domain=ce,this.pm.data.view_preroll_ad_asset_hostname=ee}}}}])&&Oe(C.prototype,F),N&&Oe(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function Le(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function it(w,C,F){return C&&Le(w.prototype,C),F&&Le(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var We=it(function w(C){var F,N;(function(Q,J){if(!(Q instanceof J))throw new TypeError("Cannot call a class as a function")})(this,w);var K=function(){C.disableRebufferTracking||F&&(t(C.data,"view_waiting_rebuffer_duration",h.now()-F),F=!1,_().clearInterval(N))},V=!1,H=function(){V=!1,K()};C.on("waiting",function(){V&&(C.disableRebufferTracking||(t(C.data,"view_waiting_rebuffer_count",1),F=h.now(),N=_().setInterval(function(){if(F){var Q=h.now();t(C.data,"view_waiting_rebuffer_duration",Q-F),F=Q}},250)))}),C.on("playing",function(){K(),V=!0}),C.on("pause",H),C.on("seeking",H)});function ot(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function gt(w,C,F){return C&&ot(w.prototype,C),F&&ot(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var Xe=gt(function w(C){var F=this;(function(V,H){if(!(V instanceof H))throw new TypeError("Cannot call a class as a function")})(this,w);var N=function(){F.lastWallClockTime=h.now(),C.on("before*",K)},K=function(V){var H=h.now(),Q=F.lastWallClockTime;F.lastWallClockTime=H,H-Q>3e4&&(C.emit("devicesleep",{viewer_time:Q}),i()(C.data,{viewer_time:Q}),C.send("devicesleep"),C.emit("devicewake",{viewer_time:H}),i()(C.data,{viewer_time:H}),C.send("devicewake"))};C.one("playbackheartbeat",N),C.on("playbackheartbeatend",function(){C.off("before*",K),C.one("playbackheartbeat",N)})}),Dt=O(375),mt=O(655),nt=O.n(mt),lt="muxData",at=function(){var w;try{w=Dt.parse(nt().get(lt)||"")}catch{w={}}return w},pt=function(w){try{nt().set(lt,Dt.stringify(w),{expires:7300})}catch{}},vt=function(){var w=at();return w.mux_viewer_id=w.mux_viewer_id||y(),w.msn=w.msn||Math.random(),pt(w),{mux_viewer_id:w.mux_viewer_id,mux_sample_number:w.msn}};function or(w,C){var F=C.beaconCollectionDomain,N=C.beaconDomain;if(F)return"https://"+F;var K=N||"litix.io";return(w=w||"inferred").match(/^[a-z0-9]+$/)?"https://"+w+"."+K:"https://img.litix.io/a.gif"}var Pt=function(){var w;switch(At()){case"cellular":w="cellular";break;case"ethernet":w="wired";break;case"wifi":w="wifi";break;case void 0:break;default:w="other"}return w},At=function(){var w=_().navigator,C=w&&(w.connection||w.mozConnection||w.webkitConnection);return C&&C.type};Pt.getConnectionFromAPI=At;var Qe=Pt,Yt=zt({a:"env",b:"beacon",c:"custom",d:"ad",e:"event",f:"experiment",i:"internal",m:"mux",n:"response",p:"player",q:"request",r:"retry",s:"session",t:"timestamp",u:"viewer",v:"video",w:"page",x:"view",y:"sub"}),Ct=zt({ad:"ad",ag:"aggregate",ap:"api",al:"application",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",br:"break",bw:"browser",by:"bytes",ca:"cached",cb:"cancel",cd:"code",cg:"category",ch:"changed",cn:"config",co:"count",ce:"counter",cp:"complete",cr:"creative",ct:"content",cu:"current",cx:"connection",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",du:"duration",dv:"device",ec:"encoding",ed:"edge",en:"end",eg:"engine",em:"embed",er:"error",es:"errorcode",et:"errortext",ee:"event",ev:"events",ex:"expires",ep:"experiments",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",hb:"holdback",he:"headers",ho:"host",hn:"hostname",ht:"height",id:"id",ii:"init",in:"instance",ip:"ip",is:"is",ke:"key",la:"language",lb:"labeled",le:"level",li:"live",ld:"loaded",lo:"load",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pr:"preload",ps:"position",pt:"part",py:"property",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",se:"session",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",st:"start",su:"startup",sv:"server",sw:"software",ta:"tag",tc:"tech",te:"text",tg:"target",th:"throughput",ti:"time",tl:"total",to:"to",tt:"title",ty:"type",ug:"upscaling",up:"upscale",ur:"url",us:"user",va:"variant",vd:"viewed",vi:"video",ve:"version",vw:"view",vr:"viewer",wd:"width",wa:"watch",wt:"waiting"});function zt(w){var C={};for(var F in w)w.hasOwnProperty(F)&&(C[w[F]]=F);return C}function Mt(w){var C={},F={};return Object.keys(w).forEach(function(N){var K=!1;if(w.hasOwnProperty(N)&&w[N]!==void 0){var V=N.split("_"),H=V[0],Q=Yt[H];Q||(e.info("Data key word `"+V[0]+"` not expected in "+N),Q=H+"_"),V.splice(1).forEach(function(J){J==="url"&&(K=!0),Ct[J]?Q+=Ct[J]:Number(J)&&Math.floor(Number(J))===Number(J)?Q+=J:(e.info("Data key word `"+J+"` not expected in "+N),Q+="_"+J+"_")}),K?F[Q]=w[N]:C[Q]=w[N]}}),i()(C,F)}var lr={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},ur=["hb","requestcompleted","requestfailed","requestcanceled"],st=function(w,C){this._beaconUrl=w||"https://img.litix.io",this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=i()({},lr,C)};st.prototype.queueEvent=function(w,C){var F=i()({},C);return(this._eventQueue.length<=this._options.maxQueueLength||w==="eventrateexceeded")&&(this._eventQueue.push(F),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},st.prototype.flushEvents=function(){this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending()},st.prototype.destroy=function(){var w=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,w?this._clearBeaconQueue():this.flushEvents(),_().clearTimeout(this._sendTimeout)},st.prototype._clearBeaconQueue=function(){var w=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,C=this._eventQueue.slice(w);w>0&&i()(C[C.length-1],Mt({mux_view_message:"event queue truncated"}));var F=this._createPayload(C);Lt(this._beaconUrl,F,!0,function(){})},st.prototype._sendBeaconQueue=function(){var w=this;if(!this._postInFlight){var C=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var F=this._createPayload(C),N=h.now();Lt(this._beaconUrl,F,!1,function(K,V){V?(w._eventQueue=C.concat(w._eventQueue),w._failureCount+=1,e.info("Error sending beacon: "+V)):w._failureCount=0,w._roundTripTime=h.now()-N,w._postInFlight=!1})}},st.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var w=Math.pow(2,this._failureCount-1);return(1+(w*=Math.random()))*this._options.baseTimeBetweenBeacons},st.prototype._startBeaconSending=function(){var w=this;_().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=_().setTimeout(function(){w._eventQueue.length&&w._sendBeaconQueue(),w._startBeaconSending()},this._getNextBeaconTime()))},st.prototype._createPayload=function(w){var C,F,N,K=this,V={transmission_timestamp:Math.round(h.now())};this._roundTripTime&&(V.rtt_ms=Math.round(this._roundTripTime));var H=function(){C=JSON.stringify({metadata:V,events:F||w}),N=C.length/1024},Q=function(){return N<=K._options.maxPayloadKBSize};return H(),Q()||(e.info("Payload size is too big ("+N+" kb). Removing unnecessary events."),F=w.filter(function(J){return ur.indexOf(J.e)===-1}),H()),Q()||(e.info("Payload size still too big ("+N+" kb). Cropping fields.."),F.forEach(function(J){for(var X in J){var ee=J[X];typeof ee=="string"&&ee.length>51200&&(J[X]=ee.substring(0,51200))}}),H()),C};var Lt=function(w,C,F,N){if(F&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(w,C))N();else if(_().fetch)_().fetch(w,{method:"POST",body:C,headers:{"Content-Type":"text/plain"},keepalive:!0}).then(function(V){return N(null,V.ok?null:"Error")}).catch(function(V){return N(null,V)});else{if(_().XMLHttpRequest){var K=new(_()).XMLHttpRequest;return K.onreadystatechange=function(){if(K.readyState===4)return N(null,K.status!==200?"error":void 0)},K.open("POST",w),K.setRequestHeader("Content-Type","text/plain"),void K.send(C)}N()}},Xt=st;function Et(w){return Et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},Et(w)}var fr=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id"],ci=["viewstart","error","ended","viewend"],Qt=function(w,C){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.mux=w,this.envKey=C,this.eventQueue=new Xt(or(C,F)),this.previousBeaconData=null,this.lastEventTime=null,this.sampleRate=F.sampleRate,this.disableCookies=F.disableCookies,this.respectDoNotTrack=F.respectDoNotTrack;var N=F.platform||{};this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:N.name,viewer_application_version:N.version,viewer_application_engine:N.layout,viewer_device_name:N.product,viewer_device_category:"",viewer_device_manufacturer:N.manufacturer,viewer_os_family:N.os&&N.os.family,viewer_os_architecture:N.os&&N.os.architecture,viewer_os_version:N.os&&N.os.version};var K=Qe();K&&(this.pageLevelData=i()(this.pageLevelData,{viewer_connection_type:K})),_()!==void 0&&_().location&&_().location.href&&(this.pageLevelData.page_url=_().location.href),this.viewerData=this.disableCookies?{}:vt()};Qt.prototype.send=function(w,C){if(w){if(this.respectDoNotTrack&&s())return e.info("Not sending `"+w+"` because Do Not Track is enabled");if(!C||Et(C)!=="object")return e.error("A data object was expected in send() but was not provided");var F,N,K=this.disableCookies?{}:(F=at(),N=h.now(),F.session_start&&(F.sst=F.session_start,delete F.session_start),F.session_id&&(F.sid=F.session_id,delete F.session_id),F.session_expires&&(F.sex=F.session_expires,delete F.session_expires),(!F.sex||F.sex<N)&&(F.sid=y(),F.sst=N),F.sex=N+15e5,pt(F),{session_id:F.sid,session_start:F.sst,session_expires:F.sex}),V={};i()(V,this.pageLevelData),i()(V,C),i()(V,K),i()(V,this.viewerData),V.event=w,V.env_key=this.envKey,V.user_id&&(V.viewer_user_id=V.user_id,delete V.user_id);var H=V.mux_sample_number>=this.sampleRate,Q=Mt(this._deduplicateBeaconData(w,V));if(this.lastEventTime=this.mux.utils.now(),H)return e.info("Not sending event due to sample rate restriction",w,V,Q);if(this.envKey||e.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",w,V,Q),!this.rateLimited){if(e.info("Sending event",w,V,Q),this.rateLimited=!this.eventQueue.queueEvent(w,Q),this.mux.WINDOW_UNLOADING&&w==="viewend")this.eventQueue.destroy(!0);else if((ci.indexOf(w)>=0||this.mux.WINDOW_HIDDEN&&w==="hb")&&this.eventQueue.flushEvents(),this.rateLimited)return V.event="eventrateexceeded",Q=Mt(V),this.eventQueue.queueEvent(V.event,Q),e.error("Beaconing disabled due to rate limit.")}}},Qt.prototype.destroy=function(){this.eventQueue.destroy(!1)},Qt.prototype._deduplicateBeaconData=function(w,C){var F=this,N={},K=C.view_id;if(!K||w==="viewstart"||w==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)N=i()({},C),K&&(this.previousBeaconData=N),K&&w==="viewend"&&(this.previousBeaconData=null);else{var V=w.indexOf("request")===0;Object.keys(C).forEach(function(H){var Q=C[H];(Q!==F.previousBeaconData[H]||fr.indexOf(H)>-1||function(J,X,ee,ce){return!(!J||X.indexOf("request_")!==0||X!=="request_response_headers"&&Et(ee)==="object"&&Et(ce)==="object"&&Object.keys(ee||{}).length===Object.keys(ce||{}).length)}(V,H,Q,F.previousBeaconData[H])||function(J,X){return J==="renditionchange"&&X.indexOf("video_source_")===0}(w,H))&&(N[H]=Q,F.previousBeaconData[H]=Q)})}return N};var hi=Qt;function Pr(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function vi(w,C,F){return C&&Pr(w.prototype,C),F&&Pr(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var gi=vi(function w(C){(function(X,ee){if(!(X instanceof ee))throw new TypeError("Cannot call a class as a function")})(this,w);var F=0,N=0,K=0,V=0,H=0,Q=0,J=0;C.on("requestcompleted",function(X,ee){var ce,ye,ve=ee.request_start,se=ee.request_response_start,le=ee.request_response_end,xe=ee.request_bytes_loaded;if(V++,se?(ce=se-ve,ye=le-se):ye=le-ve,ye>0&&xe>0){var Ye=xe/ye*8e3;H++,N+=xe,K+=ye,C.data.view_min_request_throughput=Math.min(C.data.view_min_request_throughput||1/0,Ye),C.data.view_average_request_throughput=N/K*8e3,C.data.view_request_count=V,ce>0&&(F+=ce,C.data.view_max_request_latency=Math.max(C.data.view_max_request_latency||0,ce),C.data.view_average_request_latency=F/H)}}),C.on("requestfailed",function(X,ee){V++,Q++,C.data.view_request_count=V,C.data.view_request_failed_count=Q}),C.on("requestcanceled",function(X,ee){V++,J++,C.data.view_request_count=V,C.data.view_request_canceled_count=J})});function Cr(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function mi(w,C,F){return C&&Cr(w.prototype,C),F&&Cr(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var pi=mi(function w(C){var F=this;(function(N,K){if(!(N instanceof K))throw new TypeError("Cannot call a class as a function")})(this,w),C.on("before*",function(N,K){var V=K.viewer_time,H=h.now(),Q=F._lastEventTime;if(F._lastEventTime=H,Q&&H-Q>36e5){var J=Object.keys(C.data).reduce(function(X,ee){return ee.indexOf("video_")===0?i()(X,function(ce,ye,ve){return ye in ce?Object.defineProperty(ce,ye,{value:ve,enumerable:!0,configurable:!0,writable:!0}):ce[ye]=ve,ce}({},ee,C.data[ee])):X},{});C.mux.log.info("Received event after at least an hour inactivity, creating a new view"),C.emit("viewinit",i()({viewer_time:V},J)),C.playbackHeartbeat._playheadShouldBeProgressing&&N.type!=="play"&&N.type!=="adbreakstart"&&(C.emit("play",{viewer_time:V}),N.type!=="playing"&&C.emit("playing",{viewer_time:V}))}})});function dr(w){return dr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},dr(w)}function Ei(w,C){return function(F){if(Array.isArray(F))return F}(w)||function(F,N){var K=F==null?null:typeof Symbol!="undefined"&&F[Symbol.iterator]||F["@@iterator"];if(K!=null){var V,H,Q=[],J=!0,X=!1;try{for(K=K.call(F);!(J=(V=K.next()).done)&&(Q.push(V.value),!N||Q.length!==N);J=!0);}catch(ee){X=!0,H=ee}finally{try{J||K.return==null||K.return()}finally{if(X)throw H}}return Q}}(w,C)||function(F,N){if(F){if(typeof F=="string")return Mr(F,N);var K=Object.prototype.toString.call(F).slice(8,-1);return K==="Object"&&F.constructor&&(K=F.constructor.name),K==="Map"||K==="Set"?Array.from(F):K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K)?Mr(F,N):void 0}}(w,C)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Mr(w,C){(C==null||C>w.length)&&(C=w.length);for(var F=0,N=new Array(C);F<C;F++)N[F]=w[F];return N}function Fr(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function cr(w,C){return cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(F,N){return F.__proto__=N,F},cr(w,C)}function yi(w){var C=function(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var F,N=$t(w);if(C){var K=$t(this).constructor;F=Reflect.construct(N,arguments,K)}else F=N.apply(this,arguments);return Ti(this,F)}}function Ti(w,C){if(C&&(dr(C)==="object"||typeof C=="function"))return C;if(C!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return we(w)}function we(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function $t(w){return $t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(C){return C.__proto__||Object.getPrototypeOf(C)},$t(w)}var xi=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange"],Si=function(w){(function(H,Q){if(typeof Q!="function"&&Q!==null)throw new TypeError("Super expression must either be null or a function");H.prototype=Object.create(Q&&Q.prototype,{constructor:{value:H,writable:!0,configurable:!0}}),Object.defineProperty(H,"prototype",{writable:!1}),Q&&cr(H,Q)})(V,w);var C,F,N,K=yi(V);function V(H,Q,J){var X;(function(se,le){if(!(se instanceof le))throw new TypeError("Cannot call a class as a function")})(this,V),(X=K.call(this)).DOM_CONTENT_LOADED_EVENT_END=c.domContentLoadedEventEnd(),X.NAVIGATION_START=c.navigationStart(),X.mux=H,X.id=Q,(J=i()({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(se){return se}},J)).data=J.data||{},J.data.property_key&&(J.data.env_key=J.data.property_key,delete J.data.property_key),e.setLevel(J.debug?"debug":"warn"),X.getPlayheadTime=J.getPlayheadTime,X.getStateData=J.getStateData||function(){return{}},X.getAdData=J.getAdData||function(){},X.minimumRebufferDuration=J.minimumRebufferDuration,X.sustainedRebufferThreshold=J.sustainedRebufferThreshold,X.playbackHeartbeatTime=J.playbackHeartbeatTime,X.disableRebufferTracking=J.disableRebufferTracking,X.disableRebufferTracking&&X.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),X.disablePlayheadRebufferTracking=J.disablePlayheadRebufferTracking,X.errorTranslator=J.errorTranslator,X.playbackEventDispatcher=new hi(H,J.data.env_key,J),X.data={player_instance_id:y(),mux_sample_rate:J.sampleRate,beacon_domain:J.beaconCollectionDomain?J.beaconCollectionDomain:J.beaconDomain},X.data.view_sequence_number=1,X.data.player_sequence_number=1,X.oldEmit=X.emit,X.emit=function(se,le){le=i()({viewer_time:this.mux.utils.now()},le),this.oldEmit(se,le)};var ee=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(we(X));X.on("viewinit",function(se,le){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),i()(this.data,le),this._initializeViewData(),this.one("play",ee),this.one("adbreakstart",ee)});var ce=function(se){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",se)}.bind(we(X));if(X.on("videochange",function(se,le){ce(le)}),X.on("programchange",function(se,le){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),ce(i()(le,{view_program_changed:!0})),ee(),this.emit("play"),this.emit("playing")}),X.on("fragmentchange",function(se,le){this.currentFragmentPDT=le.currentFragmentPDT,this.currentFragmentStart=le.currentFragmentStart}),X.on("destroy",X.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var ye=function(){var se=X.data.view_start!==void 0;X.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",se&&X.mux.WINDOW_HIDDEN&&(X.data.player_is_paused||X.emit("hb"))};window.addEventListener("visibilitychange",ye,!1);var ve=function(se){se.persisted||X.destroy()};window.addEventListener("pagehide",ve,!1),X.on("destroy",function(){window.removeEventListener("visibilitychange",ye),window.removeEventListener("pagehide",ve)})}return X.on("playerready",function(se,le){i()(this.data,le)}),xi.forEach(function(se){X.on(se,function(le,xe){se.indexOf("ad")!==0&&this._updateStateData(),i()(this.data,xe),this._sanitizeData()}),X.on("after"+se,function(){(se!=="error"||this.errorTracker.viewErrored)&&this.send(se)})}),X.on("viewend",function(se,le){i()(X.data,le)}),X.one("playerready",function(se){var le=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=le-this.data.player_init_time),!this.mux.PLAYER_TRACKED&&this.NAVIGATION_START&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.DOM_CONTENT_LOADED_EVENT_END)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.DOM_CONTENT_LOADED_EVENT_END||1/0)-this.NAVIGATION_START)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time}),X.longResumeTracker=new pi(we(X)),X.errorTracker=new ie(we(X)),new Xe(we(X)),X.seekingTracker=new qe(we(X)),X.playheadTime=new re(we(X)),X.playbackHeartbeat=new $(we(X)),new Ke(we(X)),X.watchTimeTracker=new ae(we(X)),new fe(we(X)),X.adTracker=new Ce(we(X)),new ke(we(X)),new Te(we(X)),new Be(we(X)),new We(we(X)),new gi(we(X)),J.hlsjs&&X.addHLSJS(J),J.dashjs&&X.addDashJS(J),X.emit("viewinit",J.data),X}return C=V,F=[{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,this.data.view_start!==void 0&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(H){var Q=i()({},this.data);if(Q.video_source_is_live===void 0&&(Q.player_source_duration===1/0||Q.video_source_duration===1/0?Q.video_source_is_live=!0:(Q.player_source_duration>0||Q.video_source_duration>0)&&(Q.video_source_is_live=!1)),Q.video_source_is_live||["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"].forEach(function(ce){Q[ce]=void 0}),Q.video_source_url=Q.video_source_url||Q.player_source_url,Q.video_source_url){var J=Ei(o(Q.video_source_url),2),X=J[0],ee=J[1];Q.video_source_domain=ee,Q.video_source_hostname=X}delete Q.ad_request_id,this.playbackEventDispatcher.send(H,Q),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat()}},{key:"_updateStateData",value:function(){i()(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var H=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(Q){var J=parseInt(H.data[Q],10);H.data[Q]=isNaN(J)?void 0:J}),["player_source_url","video_source_url"].forEach(function(Q){if(H.data[Q]){var J=H.data[Q].toLowerCase();J.indexOf("data:")!==0&&J.indexOf("blob:")!==0||(H.data[Q]="MSE style URL")}})}},{key:"_resetVideoData",value:function(H,Q){var J=this;Object.keys(this.data).forEach(function(X){X.indexOf("video_")===0&&delete J.data[X]})}},{key:"_resetViewData",value:function(){var H=this;Object.keys(this.data).forEach(function(Q){Q.indexOf("view_")===0&&delete H.data[Q]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(H,Q){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var H=this,Q=this.data.view_id=y(),J=function(){Q===H.data.view_id&&t(H.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",J):J()}},{key:"_restartHeartBeat",value:function(){var H=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){H.data.player_is_paused||H.emit("hb")},1e4))}},{key:"addHLSJS",value:function(H){H.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=H.hlsjs,function(Q,J,X){var ee=arguments.length>4?arguments[4]:void 0,ce=Q.log,ye=Q.utils.secondsToMs,ve=function(pe){var oe,he=parseInt(ee.version);return he===1&&pe.programDateTime!==null&&(oe=pe.programDateTime),he===0&&pe.pdt!==null&&(oe=pe.pdt),oe};if(c.exists()){var se=function(pe,oe){return Q.emit(J,pe,oe)},le=function(pe,oe){var he=oe.levels,ue=oe.audioTracks,ge=oe.url,Re=oe.stats,Ae=oe.networkDetails,rt=oe.sessionData,Ze={},ut={};he.forEach(function(ct,kt){Ze[kt]={width:ct.width,height:ct.height,bitrate:ct.bitrate,attrs:ct.attrs}}),ue.forEach(function(ct,kt){ut[kt]={name:ct.name,language:ct.lang,bitrate:ct.bitrate}});var ft=T(Re),dt=ft.bytesLoaded,He=ft.requestStart,mr=ft.responseStart,pr=ft.responseEnd;se("requestcompleted",v(v({},a(rt)),{},{request_event_type:pe,request_bytes_loaded:dt,request_start:He,request_response_start:mr,request_response_end:pr,request_type:"manifest",request_hostname:r(ge),request_response_headers:I(Ae),request_rendition_lists:{media:Ze,audio:ut,video:{}}}))};X.on(ee.Events.MANIFEST_LOADED,le);var xe=function(pe,oe){var he=oe.details,ue=oe.level,ge=oe.networkDetails,Re=oe.stats,Ae=T(Re),rt=Ae.bytesLoaded,Ze=Ae.requestStart,ut=Ae.responseStart,ft=Ae.responseEnd,dt=he.fragments[he.fragments.length-1],He=ve(dt)+ye(dt.duration);se("requestcompleted",{request_event_type:pe,request_bytes_loaded:rt,request_start:Ze,request_response_start:ut,request_response_end:ft,request_current_level:ue,request_type:"manifest",request_hostname:r(he.url),request_response_headers:I(ge),video_holdback:he.holdBack&&ye(he.holdBack),video_part_holdback:he.partHoldBack&&ye(he.partHoldBack),video_part_target_duration:he.partTarget&&ye(he.partTarget),video_target_duration:he.targetduration&&ye(he.targetduration),video_source_is_live:he.live,player_manifest_newest_program_time:isNaN(He)?void 0:He})};X.on(ee.Events.LEVEL_LOADED,xe);var Ye=function(pe,oe){var he=oe.details,ue=oe.networkDetails,ge=oe.stats,Re=T(ge),Ae=Re.bytesLoaded,rt=Re.requestStart,Ze=Re.responseStart,ut=Re.responseEnd;se("requestcompleted",{request_event_type:pe,request_bytes_loaded:Ae,request_start:rt,request_response_start:Ze,request_response_end:ut,request_type:"manifest",request_hostname:r(he.url),request_response_headers:I(ue)})};X.on(ee.Events.AUDIO_TRACK_LOADED,Ye);var $e=function(pe,oe){var he=oe.stats,ue=oe.networkDetails,ge=oe.frag;he=he||ge.stats;var Re=T(he),Ae={request_event_type:pe,request_bytes_loaded:Re.bytesLoaded,request_start:Re.requestStart,request_response_start:Re.responseStart,request_response_end:Re.responseEnd,request_hostname:ue?r(ue.responseURL):void 0,request_response_headers:I(ue),request_media_duration:ge.duration};ge.type==="main"?(Ae.request_type="media",Ae.request_current_level=ge.level,Ae.request_video_width=(X.levels[ge.level]||{}).width,Ae.request_video_height=(X.levels[ge.level]||{}).height):Ae.request_type=ge.type,se("requestcompleted",Ae)};X.on(ee.Events.FRAG_LOADED,$e);var yt=function(pe,oe){var he=oe.frag,ue=he.start,ge={currentFragmentPDT:ve(he),currentFragmentStart:ye(ue)};se("fragmentchange",ge)};X.on(ee.Events.FRAG_CHANGED,yt);var Se=function(pe,oe){var he=oe.type,ue=oe.details,ge=oe.response,Re=oe.fatal,Ae=oe.context,rt=oe.frag;if(ue===ee.ErrorDetails.MANIFEST_LOAD_ERROR||ue===ee.ErrorDetails.MANIFEST_LOAD_TIMEOUT||ue===ee.ErrorDetails.FRAG_LOAD_ERROR||ue===ee.ErrorDetails.FRAG_LOAD_TIMEOUT||ue===ee.ErrorDetails.LEVEL_LOAD_ERROR||ue===ee.ErrorDetails.LEVEL_LOAD_TIMEOUT){var Ze=rt&&rt.url||Ae&&Ae.url||"";se("requestfailed",{request_error:ue,request_url:Ze,request_hostname:r(Ze),request_type:ue===ee.ErrorDetails.FRAG_LOAD_ERROR||ue===ee.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":"manifest",request_error_code:ge&&ge.code,request_error_text:ge&&ge.text})}Re&&se("error",{player_error_code:he,player_error_message:ue})};X.on(ee.Events.ERROR,Se);var Je=function(pe,oe){var he=oe.frag,ue=he&&he._url||"";se("requestcanceled",{request_event_type:pe,request_url:ue,request_type:"media",request_hostname:r(ue)})};X.on(ee.Events.FRAG_LOAD_EMERGENCY_ABORTED,Je);var Ge=function(pe,oe){var he=oe.level,ue=X.levels[he];if(ue&&ue.attrs&&ue.attrs.BANDWIDTH){var ge,Re=ue.attrs.BANDWIDTH,Ae=parseFloat(ue.attrs["FRAME-RATE"]);isNaN(Ae)||(ge=Ae),Re?se("renditionchange",{video_source_fps:ge,video_source_bitrate:Re,video_source_width:ue.width,video_source_height:ue.height}):ce.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};X.on(ee.Events.LEVEL_SWITCHED,Ge),X._stopMuxMonitor=function(){X.off(ee.Events.MANIFEST_LOADED,le),X.off(ee.Events.LEVEL_LOADED,xe),X.off(ee.Events.AUDIO_TRACK_LOADED,Ye),X.off(ee.Events.FRAG_LOADED,$e),X.off(ee.Events.FRAG_CHANGED,yt),X.off(ee.Events.ERROR,Se),X.off(ee.Events.FRAG_LOAD_EMERGENCY_ABORTED,Je),X.off(ee.Events.LEVEL_SWITCHED,Ge),X.off(ee.Events.DESTROYING,X._stopMuxMonitor),delete X._stopMuxMonitor},X.on(ee.Events.DESTROYING,X._stopMuxMonitor)}else ce.warn("performance timing not supported. Not tracking HLS.js.")}(this.mux,this.id,H.hlsjs,{},H.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){var H;this.hlsjs&&((H=this.hlsjs)&&typeof H._stopMuxMonitor=="function"&&H._stopMuxMonitor(),this.hlsjs=void 0)}},{key:"addDashJS",value:function(H){H.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=H.dashjs,function(Q,J,X){var ee=Q.log;if(X&&X.on){var ce=function(Se,Je){return Q.emit(J,Se,Je)},ye=function(Se){var Je=Se.type,Ge=(Se.data||{}).url;ce("requestcompleted",{request_event_type:Je,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:r(Ge)})};X.on("manifestLoaded",ye);var ve={},se=function(Se){var Je=Se.type,Ge=Se.fragmentModel,pe=(Se.chunk||{}).mediaInfo||{},oe=pe.type,he=pe.bitrateList,ue={};(he=he||[]).forEach(function(dt,He){ue[He]={},ue[He].width=dt.width,ue[He].height=dt.height,ue[He].bitrate=dt.bandwidth,ue[He].attrs={}}),oe==="video"?ve.video=ue:oe==="audio"?ve.audio=ue:ve.media=ue;var ge=k(Ge,X),Re=ge.requestStart,Ae=ge.requestResponseStart,rt=ge.requestResponseEnd,Ze=ge.requestResponseHeaders,ut=ge.requestMediaDuration,ft=ge.requestHostname;ce("requestcompleted",{request_event_type:Je,request_start:Re,request_response_start:Ae,request_response_end:rt,request_bytes_loaded:-1,request_type:oe+"_init",request_response_headers:Ze,request_hostname:ft,request_media_duration:ut,request_rendition_lists:ve})};X.on("initFragmentLoaded",se);var le=function(Se){var Je=Se.type,Ge=Se.fragmentModel,pe=Se.chunk||{},oe=pe.mediaInfo,he=pe.start,ue=(oe||{}).type,ge=k(Ge,X),Re=ge.requestStart,Ae=ge.requestResponseStart,rt=ge.requestResponseEnd,Ze=ge.requestBytesLoaded,ut=ge.requestResponseHeaders,ft=ge.requestMediaDuration,dt=ge.requestHostname,He=B(ue,X),mr=He.currentLevel,pr=He.renditionWidth,ct=He.renditionHeight,kt=He.renditionBitrate;ce("requestcompleted",{request_event_type:Je,request_start:Re,request_response_start:Ae,request_response_end:rt,request_bytes_loaded:Ze,request_type:ue,request_response_headers:ut,request_hostname:dt,request_media_start_time:he,request_media_duration:ft,request_current_level:mr,request_labeled_bitrate:kt,request_video_width:pr,request_video_height:ct})};X.on("mediaFragmentLoaded",le);var xe={video:void 0,audio:void 0,totalBitrate:void 0},Ye=function(){if(xe.video&&typeof xe.video.bitrate=="number"){if(xe.video.width&&xe.video.height){var Se=xe.video.bitrate;return xe.audio&&typeof xe.audio.bitrate=="number"&&(Se+=xe.audio.bitrate),Se!==xe.totalBitrate?(xe.totalBitrate=Se,{video_source_bitrate:Se,video_source_height:xe.video.height,video_source_width:xe.video.width}):void 0}ee.warn("have bitrate info for video but missing width/height")}},$e=function(Se,Je,Ge){if(typeof Se.newQuality=="number"){var pe=Se.mediaType;if(pe==="audio"||pe==="video"){var oe=X.getBitrateInfoListFor(pe).find(function(ue){return ue.qualityIndex===Se.newQuality});if(oe&&typeof oe.bitrate=="number"){xe[pe]=oe;var he=Ye();he&&ce("renditionchange",he)}else ee.warn("missing bitrate info for ".concat(pe))}}else ee.warn("missing evt.newQuality in qualityChangeRendered event",Se)};X.on("qualityChangeRendered",$e);var yt=function(Se){var Je=Se.error,Ge=Se.event,pe=(Ge=Ge||{}).request||{},oe=_().event&&_().event.currentTarget||{};ce("requestfailed",{request_error:Je+"_"+Ge.id+"_"+pe.type,request_url:Ge.url,request_hostname:r(Ge.url),request_type:pe.mediaType,request_error_code:oe.status,request_error_type:oe.statusText})};X.on("error",yt),X._stopMuxMonitor=function(){X.off("manifestLoaded",ye),X.off("initFragmentLoaded",se),X.off("mediaFragmentLoaded",le),X.off("qualityChangeRendered",$e),X.off("error",yt),delete X._stopMuxMonitor}}else ee.warn("Invalid dash.js player reference. Monitoring blocked.")}(this.mux,this.id,H.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){var H;this.dashjs&&((H=this.dashjs)&&typeof H._stopMuxMonitor=="function"&&H._stopMuxMonitor(),this.dashjs=void 0)}}],F&&Fr(C.prototype,F),N&&Fr(C,N),Object.defineProperty(C,"prototype",{writable:!1}),V}(z),Di=Si,Ai=O(153),Ft=O.n(Ai);function hr(w){return hr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},hr(w)}function wr(w,C){return function(F){if(Array.isArray(F))return F}(w)||function(F,N){var K=F==null?null:typeof Symbol!="undefined"&&F[Symbol.iterator]||F["@@iterator"];if(K!=null){var V,H,Q=[],J=!0,X=!1;try{for(K=K.call(F);!(J=(V=K.next()).done)&&(Q.push(V.value),!N||Q.length!==N);J=!0);}catch(ee){X=!0,H=ee}finally{try{J||K.return==null||K.return()}finally{if(X)throw H}}return Q}}(w,C)||function(F,N){if(F){if(typeof F=="string")return kr(F,N);var K=Object.prototype.toString.call(F).slice(8,-1);return K==="Object"&&F.constructor&&(K=F.constructor.name),K==="Map"||K==="Set"?Array.from(F):K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K)?kr(F,N):void 0}}(w,C)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function kr(w,C){(C==null||C>w.length)&&(C=w.length);for(var F=0,N=new Array(C);F<C;F++)N[F]=w[F];return N}var _t,Li=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],_i={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};_()&&_().WeakMap&&(_t=new WeakMap);var bi="#EXT-X-TARGETDURATION",Oi="#EXT-X-PART-INF",Ri="#EXT-X-SERVER-CONTROL",Ii="#EXTINF",Pi="#EXT-X-PROGRAM-DATE-TIME",Ci="#EXT-X-VERSION",Mi="#EXT-X-SESSION-DATA",Jt=function(w){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(w),this.manifest};Jt.prototype.process=function(w){var C;for(this.buffer+=w,C=this.buffer.indexOf(`
1
+ "use strict";(()=>{var Ji=Object.create;var Vr=Object.defineProperty;var Zi=Object.getOwnPropertyDescriptor;var qi=Object.getOwnPropertyNames;var en=Object.getPrototypeOf,tn=Object.prototype.hasOwnProperty;var Yr=(j,R)=>()=>(R||j((R={exports:{}}).exports,R),R.exports);var rn=(j,R,l,P)=>{if(R&&typeof R=="object"||typeof R=="function")for(let L of qi(R))!tn.call(j,L)&&L!==l&&Vr(j,L,{get:()=>R[L],enumerable:!(P=Zi(R,L))||P.enumerable});return j};var sr=(j,R,l)=>(l=j!=null?Ji(en(j)):{},rn(R||!j||!j.__esModule?Vr(l,"default",{value:j,enumerable:!0}):l,j));var Dr=(j,R,l)=>{if(!R.has(j))throw TypeError("Cannot "+l)};var ze=(j,R,l)=>(Dr(j,R,"read from private field"),l?l.call(j):R.get(j)),lt=(j,R,l)=>{if(R.has(j))throw TypeError("Cannot add the same private member more than once");R instanceof WeakSet?R.add(j):R.set(j,l)},ut=(j,R,l,P)=>(Dr(j,R,"write to private field"),P?P.call(j,l):R.set(j,l),l);var At=(j,R,l)=>(Dr(j,R,"access private method"),l);var Qr=Yr((or,br)=>{(function(){var j,R;j=this,R=function(){return function(){var l={80:function(A,M,O){A.exports=O(728).default},728:function(A,M,O){"use strict";O.d(M,{default:function(){return $i}});var b=O(48),_=O.n(b),y=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(w){var C=16*Math.random()|0;return(w==="x"?C:3&C|8).toString(16)})},x=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},D=function(w){return w&&w.nodeName!==void 0?(w.muxId||(w.muxId=w.id||x()),w.muxId):w},E=function(w){var C;w&&w.nodeName!==void 0?w=D(C=w):C=document.querySelector(w);var F=C&&C.nodeName?C.nodeName.toLowerCase():"";return[C,w,F]},m=O(640),p=O.n(m),f=p().methodFactory;p().methodFactory=function(w,C,F){var N=f(w,C,F);return function(){for(var K=["[mux]"],V=0;V<arguments.length;V++)K.push(arguments[V]);N.apply(void 0,K)}},p().setLevel(p().getLevel());var e=p();function s(){return(_().doNotTrack||_().navigator&&_().navigator.doNotTrack)==="1"}var h={now:function(){var w=_().performance,C=w&&w.timing,F=w&&w.timeOrigin||C&&C.navigationStart;return typeof F=="number"&&typeof w.now=="function"?F+w.now():Date.now()}},g=O(678),i=O.n(g),r=function(w){return o(w)[0]},o=function(w){if(typeof w!="string"||w==="")return["localhost"];var C,F=(w.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return F&&(C=(F.match(/[^\.]+\.[^\.]+$/)||[])[0]),[F,C]},c={exists:function(){var w=_().performance;return(w&&w.timing)!==void 0},domContentLoadedEventEnd:function(){var w=_().performance,C=w&&w.timing;return C&&C.domContentLoadedEventEnd},navigationStart:function(){var w=_().performance,C=w&&w.timing;return C&&C.navigationStart}};function t(w,C,F){F=F===void 0?1:F,w[C]=w[C]||0,w[C]+=F}var n=["x-cdn","content-type","x-request-id"];function u(w){var C={};return(w=w||"").trim().split(/[\r\n]+/).forEach(function(F){if(F){var N=F.split(": "),K=N.shift();K&&(n.indexOf(K.toLowerCase())>=0||K.toLowerCase().indexOf("x-litix-")===0)&&(C[K]=N.join(": "))}}),C}var a=function(w){var C={};for(var F in w){var N=w[F];N["DATA-ID"].search("io.litix.data.")!==-1&&(C[N["DATA-ID"].replace("io.litix.data.","")]=N.VALUE)}return C};function d(w,C){var F=Object.keys(w);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(w);C&&(N=N.filter(function(K){return Object.getOwnPropertyDescriptor(w,K).enumerable})),F.push.apply(F,N)}return F}function v(w){for(var C=1;C<arguments.length;C++){var F=arguments[C]!=null?arguments[C]:{};C%2?d(Object(F),!0).forEach(function(N){S(w,N,F[N])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(F)):d(Object(F)).forEach(function(N){Object.defineProperty(w,N,Object.getOwnPropertyDescriptor(F,N))})}return w}function S(w,C,F){return C in w?Object.defineProperty(w,C,{value:F,enumerable:!0,configurable:!0,writable:!0}):w[C]=F,w}var T=function(w){if(!w)return{};var C=c.navigationStart(),F=w.loading,N=F?F.start:w.trequest,K=F?F.first:w.tfirst,V=F?F.end:w.tload;return{bytesLoaded:w.total,requestStart:Math.round(C+N),responseStart:Math.round(C+K),responseEnd:Math.round(C+V)}},I=function(w){if(w&&typeof w.getAllResponseHeaders=="function")return u(w.getAllResponseHeaders())},k=function(w,C){if(!w||typeof w.getRequests!="function")return{};var F=w.getRequests({state:"executed"});if(F.length===0)return{};var N,K=F[F.length-1],V=r(K.url),H=K.bytesLoaded,Q=new Date(K.requestStartDate).getTime(),J=new Date(K.firstByteDate).getTime(),X=new Date(K.requestEndDate).getTime(),ee=isNaN(K.duration)?0:K.duration,ce=typeof C.getMetricsFor=="function"?C.getMetricsFor(K.mediaType).HttpList:C.getDashMetrics().getHttpRequests(K.mediaType);return ce.length>0&&(N=u(ce[ce.length-1]._responseHeaders||"")),{requestStart:Q,requestResponseStart:J,requestResponseEnd:X,requestBytesLoaded:H,requestResponseHeaders:N,requestMediaDuration:ee,requestHostname:V}},B=function(w,C){var F=C.getQualityFor(w),N=C.getCurrentTrackFor(w).bitrateList;return N?{currentLevel:F,renditionWidth:N[F].width||null,renditionHeight:N[F].height||null,renditionBitrate:N[F].bandwidth}:{}};function U(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var W=0,G=function(){function w(){(function(K,V){if(!(K instanceof V))throw new TypeError("Cannot call a class as a function")})(this,w)}var C,F,N;return C=w,F=[{key:"on",value:function(K,V,H){return V._eventEmitterGuid=V._eventEmitterGuid||++W,this._listeners=this._listeners||{},this._listeners[K]=this._listeners[K]||[],H&&(V=V.bind(H)),this._listeners[K].push(V),V}},{key:"off",value:function(K,V){var H=this._listeners&&this._listeners[K];H&&H.forEach(function(Q,J){Q._eventEmitterGuid===V._eventEmitterGuid&&H.splice(J,1)})}},{key:"one",value:function(K,V,H){var Q=this;V._eventEmitterGuid=V._eventEmitterGuid||++W;var J=function X(){Q.off(K,X),V.apply(H||this,arguments)};J._eventEmitterGuid=V._eventEmitterGuid,this.on(K,J)}},{key:"emit",value:function(K,V){var H=this;if(this._listeners){V=V||{};var Q=this._listeners["before*"]||[],J=this._listeners[K]||[],X=this._listeners["after"+K]||[],ee=function(ce,ye){(ce=ce.slice()).forEach(function(ve){ve.call(H,{type:K},ye)})};ee(Q,V),ee(J,V),ee(X,V)}}}],F&&U(C.prototype,F),N&&U(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}(),z=G;function Y(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var $=function(){function w(K){var V=this;(function(H,Q){if(!(H instanceof Q))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,K.on("playing",function(){V._playheadShouldBeProgressing=!0}),K.on("play",this._startPlaybackHeartbeatInterval.bind(this)),K.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),K.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),K.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),K.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),K.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),K.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),K.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),K.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),K.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),K.on("seeked",function(){K.data.player_is_paused?V._stopPlaybackHeartbeatInterval():V._startPlaybackHeartbeatInterval()}),K.on("timeupdate",function(){V._playbackHeartbeatInterval!==null&&K.emit("playbackheartbeat")}),K.on("devicesleep",function(H,Q){V._playbackHeartbeatInterval!==null&&(_().clearInterval(V._playbackHeartbeatInterval),K.emit("playbackheartbeatend",{viewer_time:Q.viewer_time}),V._playbackHeartbeatInterval=null)})}var C,F,N;return C=w,(F=[{key:"_startPlaybackHeartbeatInterval",value:function(){var K=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=_().setInterval(function(){K.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(_().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&Y(C.prototype,F),N&&Y(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function Z(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function q(w,C,F){return C&&Z(w.prototype,C),F&&Z(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var ie=q(function w(C){var F=this;(function(N,K){if(!(N instanceof K))throw new TypeError("Cannot call a class as a function")})(this,w),C.on("viewinit",function(){F.viewErrored=!1}),C.on("error",function(){try{var N=C.errorTranslator({player_error_code:C.data.player_error_code,player_error_message:C.data.player_error_message});N?(C.data.player_error_code=N.player_error_code,C.data.player_error_message=N.player_error_message,F.viewErrored=!0):(delete C.data.player_error_code,delete C.data.player_error_message)}catch(K){C.mux.log.warn("Exception in error translator callback.",K),F.viewErrored=!0}})});function ne(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var ae=function(){function w(K){(function(V,H){if(!(V instanceof H))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,this._watchTimeTrackerLastCheckedTime=null,K.on("playbackheartbeat",this._updateWatchTime.bind(this)),K.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var C,F,N;return C=w,(F=[{key:"_updateWatchTime",value:function(K,V){var H=V.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=H),t(this.pm.data,"view_watch_time",H-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=H}},{key:"_clearWatchTimeState",value:function(K,V){this._updateWatchTime(K,V),this._watchTimeTrackerLastCheckedTime=null}}])&&ne(C.prototype,F),N&&ne(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function te(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var fe=function(){function w(K){(function(V,H){if(!(V instanceof H))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,this._playbackTimeTrackerLastPlayheadPosition=-1,K.on("playbackheartbeat",this._updatePlaybackTime.bind(this)),K.on("playbackheartbeatend",this._clearPlaybackTimeState.bind(this)),K.on("seeking",this._clearPlaybackTimeState.bind(this))}var C,F,N;return C=w,(F=[{key:"_updatePlaybackTime",value:function(){var K=this.pm.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&K>this._playbackTimeTrackerLastPlayheadPosition){var V=K-this._playbackTimeTrackerLastPlayheadPosition;V<=1e3&&t(this.pm.data,"view_content_playback_time",V)}this._playbackTimeTrackerLastPlayheadPosition=K}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&te(C.prototype,F),N&&te(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function de(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var re=function(){function w(K){(function(H,Q){if(!(H instanceof Q))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K;var V=this._updatePlayheadTime.bind(this);K.on("playbackheartbeat",V),K.on("playbackheartbeatend",V),K.on("timeupdate",V),K.on("destroy",function(){K.off("timeupdate",V)})}var C,F,N;return C=w,(F=[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=this.pm.data.view_max_playhead_position===void 0?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(K,V){var H=this,Q=function(){H.pm.currentFragmentPDT&&H.pm.currentFragmentStart&&(H.pm.data.player_program_time=H.pm.currentFragmentPDT+H.pm.data.player_playhead_time-H.pm.currentFragmentStart)};if(V&&V.player_playhead_time)this.pm.data.player_playhead_time=V.player_playhead_time,Q(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var J=this.pm.getPlayheadTime();J!==void 0&&(this.pm.data.player_playhead_time=J,Q(),this._updateMaxPlayheadPosition())}}}])&&de(C.prototype,F),N&&de(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function Ee(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function me(w,C,F){return C&&Ee(w.prototype,C),F&&Ee(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var Te=me(function w(C){if(function(K,V){if(!(K instanceof V))throw new TypeError("Cannot call a class as a function")}(this,w),!C.disableRebufferTracking){var F,N=function(){if(F){var K=C.data.viewer_time-F;t(C.data,"view_rebuffer_duration",K),F=C.data.viewer_time}C.data.view_watch_time>=0&&C.data.view_rebuffer_count>0&&(C.data.view_rebuffer_frequency=C.data.view_rebuffer_count/C.data.view_watch_time,C.data.view_rebuffer_percentage=C.data.view_rebuffer_duration/C.data.view_watch_time)};C.on("playbackheartbeat",function(){return N()}),C.on("rebufferstart",function(){F||(t(C.data,"view_rebuffer_count",1),F=C.data.viewer_time,C.one("rebufferend",function(){N(),F=void 0}))})}});function Me(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var _e=function(){function w(K){var V=this;(function(H,Q){if(!(H instanceof Q))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,K.disableRebufferTracking||K.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,K.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),K.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),K.on("seeking",function(){V._cleanupRebufferTracker(null,{viewer_time:h.now()})}))}var C,F,N;return C=w,F=[{key:"_checkIfRebuffering",value:function(K,V){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(K,V);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var H=V.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&H>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=V.viewer_time}else this._cleanupRebufferTracker(K,V,!0);else this._prepareRebufferTrackerState(V.viewer_time)}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(K){this._lastCheckedTime=K,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=K}},{key:"_cleanupRebufferTracker",value:function(K,V){var H=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:V.viewer_time});else{if(this._lastCheckedTime===null)return;var Q=this.pm.data.player_playhead_time-this._lastPlayheadTime,J=V.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&Q>0&&J-Q>this.pm.minimumRebufferDuration&&(this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+J-Q}))}H?this._prepareRebufferTrackerState(V.viewer_time):this._clearRebufferTrackerState()}}],F&&Me(C.prototype,F),N&&Me(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}(),ke=_e;function Ie(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var Be=function(){function w(K){var V=this;(function(H,Q){if(!(H instanceof Q))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,K.on("viewinit",function(){var H=K.data,Q=H.view_id;if(!H.view_program_changed){var J=function(X,ee){var ce=ee.viewer_time;X.type==="playing"&&K.data.view_time_to_first_frame===void 0?V.calculateTimeToFirstFrame(ce||h.now(),Q):X.type!=="adplaying"||K.data.view_time_to_first_frame!==void 0&&!V._inPrerollPosition()||V.calculateTimeToFirstFrame(ce||h.now(),Q)};K.one("playing",J),K.one("adplaying",J),K.one("viewend",function(){K.off("playing",J),K.off("adplaying",J)})}})}var C,F,N;return C=w,(F=[{key:"_inPrerollPosition",value:function(){return this.pm.data.view_content_playback_time===void 0||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(K,V){V===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:K}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.NAVIGATION_START&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.NAVIGATION_START))}}])&&Ie(C.prototype,F),N&&Ie(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function be(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function Ue(w,C,F){return C&&be(w.prototype,C),F&&be(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var Ke=Ue(function w(C){var F=this;(function(N,K){if(!(N instanceof K))throw new TypeError("Cannot call a class as a function")})(this,w),C.on("viewinit",function(){F._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(N){C.on(N,function(){if(F._lastPlayheadPosition>=0&&C.data.player_playhead_time>=0&&F._lastPlayerWidth>=0&&F._lastSourceWidth>0&&F._lastPlayerHeight>=0&&F._lastSourceHeight>0){var K=C.data.player_playhead_time-F._lastPlayheadPosition;if(K<0)return void(F._lastPlayheadPosition=-1);var V=Math.min(F._lastPlayerWidth/F._lastSourceWidth,F._lastPlayerHeight/F._lastSourceHeight),H=Math.max(0,V-1),Q=Math.max(0,1-V);C.data.view_max_upscale_percentage=Math.max(C.data.view_max_upscale_percentage||0,H),C.data.view_max_downscale_percentage=Math.max(C.data.view_max_downscale_percentage||0,Q),t(C.data,"view_total_content_playback_time",K),t(C.data,"view_total_upscaling",H*K),t(C.data,"view_total_downscaling",Q*K)}F._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(N){C.on(N,function(){F._lastPlayheadPosition=C.data.player_playhead_time,F._lastPlayerWidth=C.data.player_width,F._lastPlayerHeight=C.data.player_height,F._lastSourceWidth=C.data.video_source_width,F._lastSourceHeight=C.data.video_source_height})})});function je(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function Ne(w,C,F){return C&&je(w.prototype,C),F&&je(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var et=Ne(function w(C){var F=this;(function(N,K){if(!(N instanceof K))throw new TypeError("Cannot call a class as a function")})(this,w),this.isSeeking=!1,C.on("seeking",function(N,K){i()(C.data,K),F._lastSeekingTime=h.now(),F.isSeeking===!1&&(F.isSeeking=!0,C.send("seeking"))}),C.on("seeked",function(){F.isSeeking=!1;var N=F._lastSeekingTime||h.now(),K=h.now()-N;t(C.data,"view_seek_count",1),t(C.data,"view_seek_duration",K);var V=C.data.view_max_seek_time||0;C.data.view_max_seek_time=Math.max(V,K)}),C.on("viewend",function(){F.isSeeking=!1})});function Fe(w,C){return function(F){if(Array.isArray(F))return F}(w)||function(F,N){var K=F==null?null:typeof Symbol!="undefined"&&F[Symbol.iterator]||F["@@iterator"];if(K!=null){var V,H,Q=[],J=!0,X=!1;try{for(K=K.call(F);!(J=(V=K.next()).done)&&(Q.push(V.value),!N||Q.length!==N);J=!0);}catch(ee){X=!0,H=ee}finally{try{J||K.return==null||K.return()}finally{if(X)throw H}}return Q}}(w,C)||function(F,N){if(F){if(typeof F=="string")return tt(F,N);var K=Object.prototype.toString.call(F).slice(8,-1);return K==="Object"&&F.constructor&&(K=F.constructor.name),K==="Map"||K==="Set"?Array.from(F):K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K)?tt(F,N):void 0}}(w,C)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function tt(w,C){(C==null||C>w.length)&&(C=w.length);for(var F=0,N=new Array(C);F<C;F++)N[F]=w[F];return N}function Oe(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}var Pe=function(w,C){w.push(C),w.sort(function(F,N){return F.viewer_time-N.viewer_time})},Ve=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Ce=function(){function w(K){var V=this;(function(Q,J){if(!(Q instanceof J))throw new TypeError("Cannot call a class as a function")})(this,w),this.pm=K,K.on("viewinit",function(){V.isAdBreak=!1,V._currentAdRequestNumber=0,V._currentAdResponseNumber=0,V._adRequests=[],V._adResponses=[],V._adHasPlayed=!1,V._wouldBeNewAdPlay=!0,V._prerollPlayTime=void 0}),Ve.forEach(function(Q){return K.on(Q,V._updateAdData.bind(V))});var H=function(){V.isAdBreak=!1};K.on("adbreakstart",function(){V.isAdBreak=!0}),K.on("play",H),K.on("playing",H),K.on("viewend",H),K.on("adrequest",function(Q,J){J=i()({ad_request_id:"generatedAdRequestId"+V._currentAdRequestNumber++},J),Pe(V._adRequests,J),t(K.data,"view_ad_request_count"),V.inPrerollPosition()&&(K.data.view_preroll_requested=!0,V._adHasPlayed||t(K.data,"view_preroll_request_count"))}),K.on("adresponse",function(Q,J){J=i()({ad_request_id:"generatedAdRequestId"+V._currentAdResponseNumber++},J),Pe(V._adResponses,J);var X=V.findAdRequest(J.ad_request_id);X&&t(K.data,"view_ad_request_time",Math.max(0,J.viewer_time-X.viewer_time))}),K.on("adplay",function(Q,J){V._adHasPlayed=!0,V._wouldBeNewAdPlay&&(V._wouldBeNewAdPlay=!1,t(K.data,"view_ad_played_count")),V.inPrerollPosition()&&!K.data.view_preroll_played&&(K.data.view_preroll_played=!0,V._adRequests.length>0&&(K.data.view_preroll_request_time=Math.max(0,J.viewer_time-V._adRequests[0].viewer_time)),K.data.view_start&&(K.data.view_startup_preroll_request_time=Math.max(0,J.viewer_time-K.data.view_start)),V._prerollPlayTime=J.viewer_time)}),K.on("adplaying",function(Q,J){V.inPrerollPosition()&&K.data.view_preroll_load_time===void 0&&V._prerollPlayTime!==void 0&&(K.data.view_preroll_load_time=J.viewer_time-V._prerollPlayTime,K.data.view_startup_preroll_load_time=J.viewer_time-V._prerollPlayTime)}),K.on("adended",function(){V._wouldBeNewAdPlay=!0}),K.on("aderror",function(){V._wouldBeNewAdPlay=!0})}var C,F,N;return C=w,(F=[{key:"inPrerollPosition",value:function(){return this.pm.data.view_content_playback_time===void 0||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",value:function(K){for(var V=0;V<this._adRequests.length;V++)if(this._adRequests[V].ad_request_id===K)return this._adRequests[V]}},{key:"_updateAdData",value:function(K,V){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&V.ad_tag_url){var H=Fe(o(V.ad_tag_url),2),Q=H[0],J=H[1];this.pm.data.view_preroll_ad_tag_domain=J,this.pm.data.view_preroll_ad_tag_hostname=Q}if(!this.pm.data.view_preroll_ad_asset_hostname&&V.ad_asset_url){var X=Fe(o(V.ad_asset_url),2),ee=X[0],ce=X[1];this.pm.data.view_preroll_ad_asset_domain=ce,this.pm.data.view_preroll_ad_asset_hostname=ee}}}}])&&Oe(C.prototype,F),N&&Oe(C,N),Object.defineProperty(C,"prototype",{writable:!1}),w}();function Le(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function nt(w,C,F){return C&&Le(w.prototype,C),F&&Le(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var We=nt(function w(C){var F,N;(function(Q,J){if(!(Q instanceof J))throw new TypeError("Cannot call a class as a function")})(this,w);var K=function(){C.disableRebufferTracking||F&&(t(C.data,"view_waiting_rebuffer_duration",h.now()-F),F=!1,_().clearInterval(N))},V=!1,H=function(){V=!1,K()};C.on("waiting",function(){V&&(C.disableRebufferTracking||(t(C.data,"view_waiting_rebuffer_count",1),F=h.now(),N=_().setInterval(function(){if(F){var Q=h.now();t(C.data,"view_waiting_rebuffer_duration",Q-F),F=Q}},250)))}),C.on("playing",function(){K(),V=!0}),C.on("pause",H),C.on("seeking",H)});function ft(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function yt(w,C,F){return C&&ft(w.prototype,C),F&&ft(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var Qe=yt(function w(C){var F=this;(function(V,H){if(!(V instanceof H))throw new TypeError("Cannot call a class as a function")})(this,w);var N=function(){F.lastWallClockTime=h.now(),C.on("before*",K)},K=function(V){var H=h.now(),Q=F.lastWallClockTime;F.lastWallClockTime=H,H-Q>3e4&&(C.emit("devicesleep",{viewer_time:Q}),i()(C.data,{viewer_time:Q}),C.send("devicesleep"),C.emit("devicewake",{viewer_time:H}),i()(C.data,{viewer_time:H}),C.send("devicewake"))};C.one("playbackheartbeat",N),C.on("playbackheartbeatend",function(){C.off("before*",K),C.one("playbackheartbeat",N)})}),Ot=O(375),Tt=O(655),at=O.n(Tt),dt="muxData",st=function(){var w;try{w=Ot.parse(at().get(dt)||"")}catch{w={}}return w},xt=function(w){try{at().set(dt,Ot.stringify(w),{expires:7300})}catch{}},Et=function(){var w=st();return w.mux_viewer_id=w.mux_viewer_id||y(),w.msn=w.msn||Math.random(),xt(w),{mux_viewer_id:w.mux_viewer_id,mux_sample_number:w.msn}};function cr(w,C){var F=C.beaconCollectionDomain,N=C.beaconDomain;if(F)return"https://"+F;var K=N||"litix.io";return(w=w||"inferred").match(/^[a-z0-9]+$/)?"https://"+w+"."+K:"https://img.litix.io/a.gif"}var Ut=function(){var w;switch(Rt()){case"cellular":w="cellular";break;case"ethernet":w="wired";break;case"wifi":w="wifi";break;case void 0:break;default:w="other"}return w},Rt=function(){var w=_().navigator,C=w&&(w.connection||w.mozConnection||w.webkitConnection);return C&&C.type};Ut.getConnectionFromAPI=Rt;var $e=Ut,er=tr({a:"env",b:"beacon",c:"custom",d:"ad",e:"event",f:"experiment",i:"internal",m:"mux",n:"response",p:"player",q:"request",r:"retry",s:"session",t:"timestamp",u:"viewer",v:"video",w:"page",x:"view",y:"sub"}),Nt=tr({ad:"ad",ag:"aggregate",ap:"api",al:"application",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",br:"break",bw:"browser",by:"bytes",ca:"cached",cb:"cancel",cd:"code",cg:"category",ch:"changed",cn:"config",co:"count",ce:"counter",cp:"complete",cr:"creative",ct:"content",cu:"current",cx:"connection",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",du:"duration",dv:"device",ec:"encoding",ed:"edge",en:"end",eg:"engine",em:"embed",er:"error",es:"errorcode",et:"errortext",ee:"event",ev:"events",ex:"expires",ep:"experiments",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",hb:"holdback",he:"headers",ho:"host",hn:"hostname",ht:"height",id:"id",ii:"init",in:"instance",ip:"ip",is:"is",ke:"key",la:"language",lb:"labeled",le:"level",li:"live",ld:"loaded",lo:"load",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pr:"preload",ps:"position",pt:"part",py:"property",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",se:"session",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",st:"start",su:"startup",sv:"server",sw:"software",ta:"tag",tc:"tech",te:"text",tg:"target",th:"throughput",ti:"time",tl:"total",to:"to",tt:"title",ty:"type",ug:"upscaling",up:"upscale",ur:"url",us:"user",va:"variant",vd:"viewed",vi:"video",ve:"version",vw:"view",vr:"viewer",wd:"width",wa:"watch",wt:"waiting"});function tr(w){var C={};for(var F in w)w.hasOwnProperty(F)&&(C[w[F]]=F);return C}function Kt(w){var C={},F={};return Object.keys(w).forEach(function(N){var K=!1;if(w.hasOwnProperty(N)&&w[N]!==void 0){var V=N.split("_"),H=V[0],Q=er[H];Q||(e.info("Data key word `"+V[0]+"` not expected in "+N),Q=H+"_"),V.splice(1).forEach(function(J){J==="url"&&(K=!0),Nt[J]?Q+=Nt[J]:Number(J)&&Math.floor(Number(J))===Number(J)?Q+=J:(e.info("Data key word `"+J+"` not expected in "+N),Q+="_"+J+"_")}),K?F[Q]=w[N]:C[Q]=w[N]}}),i()(C,F)}var hr={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},vr=["hb","requestcompleted","requestfailed","requestcanceled"],ot=function(w,C){this._beaconUrl=w||"https://img.litix.io",this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=i()({},hr,C)};ot.prototype.queueEvent=function(w,C){var F=i()({},C);return(this._eventQueue.length<=this._options.maxQueueLength||w==="eventrateexceeded")&&(this._eventQueue.push(F),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},ot.prototype.flushEvents=function(){this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending()},ot.prototype.destroy=function(){var w=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,w?this._clearBeaconQueue():this.flushEvents(),_().clearTimeout(this._sendTimeout)},ot.prototype._clearBeaconQueue=function(){var w=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,C=this._eventQueue.slice(w);w>0&&i()(C[C.length-1],Kt({mux_view_message:"event queue truncated"}));var F=this._createPayload(C);It(this._beaconUrl,F,!0,function(){})},ot.prototype._sendBeaconQueue=function(){var w=this;if(!this._postInFlight){var C=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var F=this._createPayload(C),N=h.now();It(this._beaconUrl,F,!1,function(K,V){V?(w._eventQueue=C.concat(w._eventQueue),w._failureCount+=1,e.info("Error sending beacon: "+V)):w._failureCount=0,w._roundTripTime=h.now()-N,w._postInFlight=!1})}},ot.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var w=Math.pow(2,this._failureCount-1);return(1+(w*=Math.random()))*this._options.baseTimeBetweenBeacons},ot.prototype._startBeaconSending=function(){var w=this;_().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=_().setTimeout(function(){w._eventQueue.length&&w._sendBeaconQueue(),w._startBeaconSending()},this._getNextBeaconTime()))},ot.prototype._createPayload=function(w){var C,F,N,K=this,V={transmission_timestamp:Math.round(h.now())};this._roundTripTime&&(V.rtt_ms=Math.round(this._roundTripTime));var H=function(){C=JSON.stringify({metadata:V,events:F||w}),N=C.length/1024},Q=function(){return N<=K._options.maxPayloadKBSize};return H(),Q()||(e.info("Payload size is too big ("+N+" kb). Removing unnecessary events."),F=w.filter(function(J){return vr.indexOf(J.e)===-1}),H()),Q()||(e.info("Payload size still too big ("+N+" kb). Cropping fields.."),F.forEach(function(J){for(var X in J){var ee=J[X];typeof ee=="string"&&ee.length>51200&&(J[X]=ee.substring(0,51200))}}),H()),C};var It=function(w,C,F,N){if(F&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(w,C))N();else if(_().fetch)_().fetch(w,{method:"POST",body:C,headers:{"Content-Type":"text/plain"},keepalive:!0}).then(function(V){return N(null,V.ok?null:"Error")}).catch(function(V){return N(null,V)});else{if(_().XMLHttpRequest){var K=new(_()).XMLHttpRequest;return K.onreadystatechange=function(){if(K.readyState===4)return N(null,K.status!==200?"error":void 0)},K.open("POST",w),K.setRequestHeader("Content-Type","text/plain"),void K.send(C)}N()}},rr=ot;function St(w){return St=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},St(w)}var gr=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id"],Ei=["viewstart","error","ended","viewend"],ir=function(w,C){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.mux=w,this.envKey=C,this.eventQueue=new rr(cr(C,F)),this.previousBeaconData=null,this.lastEventTime=null,this.sampleRate=F.sampleRate,this.disableCookies=F.disableCookies,this.respectDoNotTrack=F.respectDoNotTrack;var N=F.platform||{};this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:N.name,viewer_application_version:N.version,viewer_application_engine:N.layout,viewer_device_name:N.product,viewer_device_category:"",viewer_device_manufacturer:N.manufacturer,viewer_os_family:N.os&&N.os.family,viewer_os_architecture:N.os&&N.os.architecture,viewer_os_version:N.os&&N.os.version};var K=$e();K&&(this.pageLevelData=i()(this.pageLevelData,{viewer_connection_type:K})),_()!==void 0&&_().location&&_().location.href&&(this.pageLevelData.page_url=_().location.href),this.viewerData=this.disableCookies?{}:Et()};ir.prototype.send=function(w,C){if(w){if(this.respectDoNotTrack&&s())return e.info("Not sending `"+w+"` because Do Not Track is enabled");if(!C||St(C)!=="object")return e.error("A data object was expected in send() but was not provided");var F,N,K=this.disableCookies?{}:(F=st(),N=h.now(),F.session_start&&(F.sst=F.session_start,delete F.session_start),F.session_id&&(F.sid=F.session_id,delete F.session_id),F.session_expires&&(F.sex=F.session_expires,delete F.session_expires),(!F.sex||F.sex<N)&&(F.sid=y(),F.sst=N),F.sex=N+15e5,xt(F),{session_id:F.sid,session_start:F.sst,session_expires:F.sex}),V={};i()(V,this.pageLevelData),i()(V,C),i()(V,K),i()(V,this.viewerData),V.event=w,V.env_key=this.envKey,V.user_id&&(V.viewer_user_id=V.user_id,delete V.user_id);var H=V.mux_sample_number>=this.sampleRate,Q=Kt(this._deduplicateBeaconData(w,V));if(this.lastEventTime=this.mux.utils.now(),H)return e.info("Not sending event due to sample rate restriction",w,V,Q);if(this.envKey||e.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",w,V,Q),!this.rateLimited){if(e.info("Sending event",w,V,Q),this.rateLimited=!this.eventQueue.queueEvent(w,Q),this.mux.WINDOW_UNLOADING&&w==="viewend")this.eventQueue.destroy(!0);else if((Ei.indexOf(w)>=0||this.mux.WINDOW_HIDDEN&&w==="hb")&&this.eventQueue.flushEvents(),this.rateLimited)return V.event="eventrateexceeded",Q=Kt(V),this.eventQueue.queueEvent(V.event,Q),e.error("Beaconing disabled due to rate limit.")}}},ir.prototype.destroy=function(){this.eventQueue.destroy(!1)},ir.prototype._deduplicateBeaconData=function(w,C){var F=this,N={},K=C.view_id;if(!K||w==="viewstart"||w==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)N=i()({},C),K&&(this.previousBeaconData=N),K&&w==="viewend"&&(this.previousBeaconData=null);else{var V=w.indexOf("request")===0;Object.keys(C).forEach(function(H){var Q=C[H];(Q!==F.previousBeaconData[H]||gr.indexOf(H)>-1||function(J,X,ee,ce){return!(!J||X.indexOf("request_")!==0||X!=="request_response_headers"&&St(ee)==="object"&&St(ce)==="object"&&Object.keys(ee||{}).length===Object.keys(ce||{}).length)}(V,H,Q,F.previousBeaconData[H])||function(J,X){return J==="renditionchange"&&X.indexOf("video_source_")===0}(w,H))&&(N[H]=Q,F.previousBeaconData[H]=Q)})}return N};var yi=ir;function Br(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function Ti(w,C,F){return C&&Br(w.prototype,C),F&&Br(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var xi=Ti(function w(C){(function(X,ee){if(!(X instanceof ee))throw new TypeError("Cannot call a class as a function")})(this,w);var F=0,N=0,K=0,V=0,H=0,Q=0,J=0;C.on("requestcompleted",function(X,ee){var ce,ye,ve=ee.request_start,se=ee.request_response_start,le=ee.request_response_end,xe=ee.request_bytes_loaded;if(V++,se?(ce=se-ve,ye=le-se):ye=le-ve,ye>0&&xe>0){var Ye=xe/ye*8e3;H++,N+=xe,K+=ye,C.data.view_min_request_throughput=Math.min(C.data.view_min_request_throughput||1/0,Ye),C.data.view_average_request_throughput=N/K*8e3,C.data.view_request_count=V,ce>0&&(F+=ce,C.data.view_max_request_latency=Math.max(C.data.view_max_request_latency||0,ce),C.data.view_average_request_latency=F/H)}}),C.on("requestfailed",function(X,ee){V++,Q++,C.data.view_request_count=V,C.data.view_request_failed_count=Q}),C.on("requestcanceled",function(X,ee){V++,J++,C.data.view_request_count=V,C.data.view_request_canceled_count=J})});function Ur(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function Si(w,C,F){return C&&Ur(w.prototype,C),F&&Ur(w,F),Object.defineProperty(w,"prototype",{writable:!1}),w}var Di=Si(function w(C){var F=this;(function(N,K){if(!(N instanceof K))throw new TypeError("Cannot call a class as a function")})(this,w),C.on("before*",function(N,K){var V=K.viewer_time,H=h.now(),Q=F._lastEventTime;if(F._lastEventTime=H,Q&&H-Q>36e5){var J=Object.keys(C.data).reduce(function(X,ee){return ee.indexOf("video_")===0?i()(X,function(ce,ye,ve){return ye in ce?Object.defineProperty(ce,ye,{value:ve,enumerable:!0,configurable:!0,writable:!0}):ce[ye]=ve,ce}({},ee,C.data[ee])):X},{});C.mux.log.info("Received event after at least an hour inactivity, creating a new view"),C.emit("viewinit",i()({viewer_time:V},J)),C.playbackHeartbeat._playheadShouldBeProgressing&&N.type!=="play"&&N.type!=="adbreakstart"&&(C.emit("play",{viewer_time:V}),N.type!=="playing"&&C.emit("playing",{viewer_time:V}))}})});function mr(w){return mr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},mr(w)}function Ai(w,C){return function(F){if(Array.isArray(F))return F}(w)||function(F,N){var K=F==null?null:typeof Symbol!="undefined"&&F[Symbol.iterator]||F["@@iterator"];if(K!=null){var V,H,Q=[],J=!0,X=!1;try{for(K=K.call(F);!(J=(V=K.next()).done)&&(Q.push(V.value),!N||Q.length!==N);J=!0);}catch(ee){X=!0,H=ee}finally{try{J||K.return==null||K.return()}finally{if(X)throw H}}return Q}}(w,C)||function(F,N){if(F){if(typeof F=="string")return Nr(F,N);var K=Object.prototype.toString.call(F).slice(8,-1);return K==="Object"&&F.constructor&&(K=F.constructor.name),K==="Map"||K==="Set"?Array.from(F):K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K)?Nr(F,N):void 0}}(w,C)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Nr(w,C){(C==null||C>w.length)&&(C=w.length);for(var F=0,N=new Array(C);F<C;F++)N[F]=w[F];return N}function Kr(w,C){for(var F=0;F<C.length;F++){var N=C[F];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(w,N.key,N)}}function pr(w,C){return pr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(F,N){return F.__proto__=N,F},pr(w,C)}function Li(w){var C=function(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var F,N=nr(w);if(C){var K=nr(this).constructor;F=Reflect.construct(N,arguments,K)}else F=N.apply(this,arguments);return _i(this,F)}}function _i(w,C){if(C&&(mr(C)==="object"||typeof C=="function"))return C;if(C!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return we(w)}function we(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function nr(w){return nr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(C){return C.__proto__||Object.getPrototypeOf(C)},nr(w)}var bi=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange"],Oi=function(w){(function(H,Q){if(typeof Q!="function"&&Q!==null)throw new TypeError("Super expression must either be null or a function");H.prototype=Object.create(Q&&Q.prototype,{constructor:{value:H,writable:!0,configurable:!0}}),Object.defineProperty(H,"prototype",{writable:!1}),Q&&pr(H,Q)})(V,w);var C,F,N,K=Li(V);function V(H,Q,J){var X;(function(se,le){if(!(se instanceof le))throw new TypeError("Cannot call a class as a function")})(this,V),(X=K.call(this)).DOM_CONTENT_LOADED_EVENT_END=c.domContentLoadedEventEnd(),X.NAVIGATION_START=c.navigationStart(),X.mux=H,X.id=Q,(J=i()({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(se){return se}},J)).data=J.data||{},J.data.property_key&&(J.data.env_key=J.data.property_key,delete J.data.property_key),e.setLevel(J.debug?"debug":"warn"),X.getPlayheadTime=J.getPlayheadTime,X.getStateData=J.getStateData||function(){return{}},X.getAdData=J.getAdData||function(){},X.minimumRebufferDuration=J.minimumRebufferDuration,X.sustainedRebufferThreshold=J.sustainedRebufferThreshold,X.playbackHeartbeatTime=J.playbackHeartbeatTime,X.disableRebufferTracking=J.disableRebufferTracking,X.disableRebufferTracking&&X.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),X.disablePlayheadRebufferTracking=J.disablePlayheadRebufferTracking,X.errorTranslator=J.errorTranslator,X.playbackEventDispatcher=new yi(H,J.data.env_key,J),X.data={player_instance_id:y(),mux_sample_rate:J.sampleRate,beacon_domain:J.beaconCollectionDomain?J.beaconCollectionDomain:J.beaconDomain},X.data.view_sequence_number=1,X.data.player_sequence_number=1,X.oldEmit=X.emit,X.emit=function(se,le){le=i()({viewer_time:this.mux.utils.now()},le),this.oldEmit(se,le)};var ee=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(we(X));X.on("viewinit",function(se,le){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),i()(this.data,le),this._initializeViewData(),this.one("play",ee),this.one("adbreakstart",ee)});var ce=function(se){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",se)}.bind(we(X));if(X.on("videochange",function(se,le){ce(le)}),X.on("programchange",function(se,le){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),ce(i()(le,{view_program_changed:!0})),ee(),this.emit("play"),this.emit("playing")}),X.on("fragmentchange",function(se,le){this.currentFragmentPDT=le.currentFragmentPDT,this.currentFragmentStart=le.currentFragmentStart}),X.on("destroy",X.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var ye=function(){var se=X.data.view_start!==void 0;X.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",se&&X.mux.WINDOW_HIDDEN&&(X.data.player_is_paused||X.emit("hb"))};window.addEventListener("visibilitychange",ye,!1);var ve=function(se){se.persisted||X.destroy()};window.addEventListener("pagehide",ve,!1),X.on("destroy",function(){window.removeEventListener("visibilitychange",ye),window.removeEventListener("pagehide",ve)})}return X.on("playerready",function(se,le){i()(this.data,le)}),bi.forEach(function(se){X.on(se,function(le,xe){se.indexOf("ad")!==0&&this._updateStateData(),i()(this.data,xe),this._sanitizeData()}),X.on("after"+se,function(){(se!=="error"||this.errorTracker.viewErrored)&&this.send(se)})}),X.on("viewend",function(se,le){i()(X.data,le)}),X.one("playerready",function(se){var le=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=le-this.data.player_init_time),!this.mux.PLAYER_TRACKED&&this.NAVIGATION_START&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.DOM_CONTENT_LOADED_EVENT_END)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.DOM_CONTENT_LOADED_EVENT_END||1/0)-this.NAVIGATION_START)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time}),X.longResumeTracker=new Di(we(X)),X.errorTracker=new ie(we(X)),new Qe(we(X)),X.seekingTracker=new et(we(X)),X.playheadTime=new re(we(X)),X.playbackHeartbeat=new $(we(X)),new Ke(we(X)),X.watchTimeTracker=new ae(we(X)),new fe(we(X)),X.adTracker=new Ce(we(X)),new ke(we(X)),new Te(we(X)),new Be(we(X)),new We(we(X)),new xi(we(X)),J.hlsjs&&X.addHLSJS(J),J.dashjs&&X.addDashJS(J),X.emit("viewinit",J.data),X}return C=V,F=[{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,this.data.view_start!==void 0&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(H){var Q=i()({},this.data);if(Q.video_source_is_live===void 0&&(Q.player_source_duration===1/0||Q.video_source_duration===1/0?Q.video_source_is_live=!0:(Q.player_source_duration>0||Q.video_source_duration>0)&&(Q.video_source_is_live=!1)),Q.video_source_is_live||["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"].forEach(function(ce){Q[ce]=void 0}),Q.video_source_url=Q.video_source_url||Q.player_source_url,Q.video_source_url){var J=Ai(o(Q.video_source_url),2),X=J[0],ee=J[1];Q.video_source_domain=ee,Q.video_source_hostname=X}delete Q.ad_request_id,this.playbackEventDispatcher.send(H,Q),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat()}},{key:"_updateStateData",value:function(){i()(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var H=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(Q){var J=parseInt(H.data[Q],10);H.data[Q]=isNaN(J)?void 0:J}),["player_source_url","video_source_url"].forEach(function(Q){if(H.data[Q]){var J=H.data[Q].toLowerCase();J.indexOf("data:")!==0&&J.indexOf("blob:")!==0||(H.data[Q]="MSE style URL")}})}},{key:"_resetVideoData",value:function(H,Q){var J=this;Object.keys(this.data).forEach(function(X){X.indexOf("video_")===0&&delete J.data[X]})}},{key:"_resetViewData",value:function(){var H=this;Object.keys(this.data).forEach(function(Q){Q.indexOf("view_")===0&&delete H.data[Q]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(H,Q){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var H=this,Q=this.data.view_id=y(),J=function(){Q===H.data.view_id&&t(H.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",J):J()}},{key:"_restartHeartBeat",value:function(){var H=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){H.data.player_is_paused||H.emit("hb")},1e4))}},{key:"addHLSJS",value:function(H){H.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=H.hlsjs,function(Q,J,X){var ee=arguments.length>4?arguments[4]:void 0,ce=Q.log,ye=Q.utils.secondsToMs,ve=function(pe){var oe,he=parseInt(ee.version);return he===1&&pe.programDateTime!==null&&(oe=pe.programDateTime),he===0&&pe.pdt!==null&&(oe=pe.pdt),oe};if(c.exists()){var se=function(pe,oe){return Q.emit(J,pe,oe)},le=function(pe,oe){var he=oe.levels,ue=oe.audioTracks,ge=oe.url,Re=oe.stats,Ae=oe.networkDetails,it=oe.sessionData,qe={},ct={};he.forEach(function(gt,Gt){qe[Gt]={width:gt.width,height:gt.height,bitrate:gt.bitrate,attrs:gt.attrs}}),ue.forEach(function(gt,Gt){ct[Gt]={name:gt.name,language:gt.lang,bitrate:gt.bitrate}});var ht=T(Re),vt=ht.bytesLoaded,He=ht.requestStart,xr=ht.responseStart,Sr=ht.responseEnd;se("requestcompleted",v(v({},a(it)),{},{request_event_type:pe,request_bytes_loaded:vt,request_start:He,request_response_start:xr,request_response_end:Sr,request_type:"manifest",request_hostname:r(ge),request_response_headers:I(Ae),request_rendition_lists:{media:qe,audio:ct,video:{}}}))};X.on(ee.Events.MANIFEST_LOADED,le);var xe=function(pe,oe){var he=oe.details,ue=oe.level,ge=oe.networkDetails,Re=oe.stats,Ae=T(Re),it=Ae.bytesLoaded,qe=Ae.requestStart,ct=Ae.responseStart,ht=Ae.responseEnd,vt=he.fragments[he.fragments.length-1],He=ve(vt)+ye(vt.duration);se("requestcompleted",{request_event_type:pe,request_bytes_loaded:it,request_start:qe,request_response_start:ct,request_response_end:ht,request_current_level:ue,request_type:"manifest",request_hostname:r(he.url),request_response_headers:I(ge),video_holdback:he.holdBack&&ye(he.holdBack),video_part_holdback:he.partHoldBack&&ye(he.partHoldBack),video_part_target_duration:he.partTarget&&ye(he.partTarget),video_target_duration:he.targetduration&&ye(he.targetduration),video_source_is_live:he.live,player_manifest_newest_program_time:isNaN(He)?void 0:He})};X.on(ee.Events.LEVEL_LOADED,xe);var Ye=function(pe,oe){var he=oe.details,ue=oe.networkDetails,ge=oe.stats,Re=T(ge),Ae=Re.bytesLoaded,it=Re.requestStart,qe=Re.responseStart,ct=Re.responseEnd;se("requestcompleted",{request_event_type:pe,request_bytes_loaded:Ae,request_start:it,request_response_start:qe,request_response_end:ct,request_type:"manifest",request_hostname:r(he.url),request_response_headers:I(ue)})};X.on(ee.Events.AUDIO_TRACK_LOADED,Ye);var Je=function(pe,oe){var he=oe.stats,ue=oe.networkDetails,ge=oe.frag;he=he||ge.stats;var Re=T(he),Ae={request_event_type:pe,request_bytes_loaded:Re.bytesLoaded,request_start:Re.requestStart,request_response_start:Re.responseStart,request_response_end:Re.responseEnd,request_hostname:ue?r(ue.responseURL):void 0,request_response_headers:I(ue),request_media_duration:ge.duration};ge.type==="main"?(Ae.request_type="media",Ae.request_current_level=ge.level,Ae.request_video_width=(X.levels[ge.level]||{}).width,Ae.request_video_height=(X.levels[ge.level]||{}).height):Ae.request_type=ge.type,se("requestcompleted",Ae)};X.on(ee.Events.FRAG_LOADED,Je);var Dt=function(pe,oe){var he=oe.frag,ue=he.start,ge={currentFragmentPDT:ve(he),currentFragmentStart:ye(ue)};se("fragmentchange",ge)};X.on(ee.Events.FRAG_CHANGED,Dt);var Se=function(pe,oe){var he=oe.type,ue=oe.details,ge=oe.response,Re=oe.fatal,Ae=oe.context,it=oe.frag;if(ue===ee.ErrorDetails.MANIFEST_LOAD_ERROR||ue===ee.ErrorDetails.MANIFEST_LOAD_TIMEOUT||ue===ee.ErrorDetails.FRAG_LOAD_ERROR||ue===ee.ErrorDetails.FRAG_LOAD_TIMEOUT||ue===ee.ErrorDetails.LEVEL_LOAD_ERROR||ue===ee.ErrorDetails.LEVEL_LOAD_TIMEOUT){var qe=it&&it.url||Ae&&Ae.url||"";se("requestfailed",{request_error:ue,request_url:qe,request_hostname:r(qe),request_type:ue===ee.ErrorDetails.FRAG_LOAD_ERROR||ue===ee.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":"manifest",request_error_code:ge&&ge.code,request_error_text:ge&&ge.text})}Re&&se("error",{player_error_code:he,player_error_message:ue})};X.on(ee.Events.ERROR,Se);var Ze=function(pe,oe){var he=oe.frag,ue=he&&he._url||"";se("requestcanceled",{request_event_type:pe,request_url:ue,request_type:"media",request_hostname:r(ue)})};X.on(ee.Events.FRAG_LOAD_EMERGENCY_ABORTED,Ze);var Ge=function(pe,oe){var he=oe.level,ue=X.levels[he];if(ue&&ue.attrs&&ue.attrs.BANDWIDTH){var ge,Re=ue.attrs.BANDWIDTH,Ae=parseFloat(ue.attrs["FRAME-RATE"]);isNaN(Ae)||(ge=Ae),Re?se("renditionchange",{video_source_fps:ge,video_source_bitrate:Re,video_source_width:ue.width,video_source_height:ue.height}):ce.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};X.on(ee.Events.LEVEL_SWITCHED,Ge),X._stopMuxMonitor=function(){X.off(ee.Events.MANIFEST_LOADED,le),X.off(ee.Events.LEVEL_LOADED,xe),X.off(ee.Events.AUDIO_TRACK_LOADED,Ye),X.off(ee.Events.FRAG_LOADED,Je),X.off(ee.Events.FRAG_CHANGED,Dt),X.off(ee.Events.ERROR,Se),X.off(ee.Events.FRAG_LOAD_EMERGENCY_ABORTED,Ze),X.off(ee.Events.LEVEL_SWITCHED,Ge),X.off(ee.Events.DESTROYING,X._stopMuxMonitor),delete X._stopMuxMonitor},X.on(ee.Events.DESTROYING,X._stopMuxMonitor)}else ce.warn("performance timing not supported. Not tracking HLS.js.")}(this.mux,this.id,H.hlsjs,{},H.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){var H;this.hlsjs&&((H=this.hlsjs)&&typeof H._stopMuxMonitor=="function"&&H._stopMuxMonitor(),this.hlsjs=void 0)}},{key:"addDashJS",value:function(H){H.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=H.dashjs,function(Q,J,X){var ee=Q.log;if(X&&X.on){var ce=function(Se,Ze){return Q.emit(J,Se,Ze)},ye=function(Se){var Ze=Se.type,Ge=(Se.data||{}).url;ce("requestcompleted",{request_event_type:Ze,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:r(Ge)})};X.on("manifestLoaded",ye);var ve={},se=function(Se){var Ze=Se.type,Ge=Se.fragmentModel,pe=(Se.chunk||{}).mediaInfo||{},oe=pe.type,he=pe.bitrateList,ue={};(he=he||[]).forEach(function(vt,He){ue[He]={},ue[He].width=vt.width,ue[He].height=vt.height,ue[He].bitrate=vt.bandwidth,ue[He].attrs={}}),oe==="video"?ve.video=ue:oe==="audio"?ve.audio=ue:ve.media=ue;var ge=k(Ge,X),Re=ge.requestStart,Ae=ge.requestResponseStart,it=ge.requestResponseEnd,qe=ge.requestResponseHeaders,ct=ge.requestMediaDuration,ht=ge.requestHostname;ce("requestcompleted",{request_event_type:Ze,request_start:Re,request_response_start:Ae,request_response_end:it,request_bytes_loaded:-1,request_type:oe+"_init",request_response_headers:qe,request_hostname:ht,request_media_duration:ct,request_rendition_lists:ve})};X.on("initFragmentLoaded",se);var le=function(Se){var Ze=Se.type,Ge=Se.fragmentModel,pe=Se.chunk||{},oe=pe.mediaInfo,he=pe.start,ue=(oe||{}).type,ge=k(Ge,X),Re=ge.requestStart,Ae=ge.requestResponseStart,it=ge.requestResponseEnd,qe=ge.requestBytesLoaded,ct=ge.requestResponseHeaders,ht=ge.requestMediaDuration,vt=ge.requestHostname,He=B(ue,X),xr=He.currentLevel,Sr=He.renditionWidth,gt=He.renditionHeight,Gt=He.renditionBitrate;ce("requestcompleted",{request_event_type:Ze,request_start:Re,request_response_start:Ae,request_response_end:it,request_bytes_loaded:qe,request_type:ue,request_response_headers:ct,request_hostname:vt,request_media_start_time:he,request_media_duration:ht,request_current_level:xr,request_labeled_bitrate:Gt,request_video_width:Sr,request_video_height:gt})};X.on("mediaFragmentLoaded",le);var xe={video:void 0,audio:void 0,totalBitrate:void 0},Ye=function(){if(xe.video&&typeof xe.video.bitrate=="number"){if(xe.video.width&&xe.video.height){var Se=xe.video.bitrate;return xe.audio&&typeof xe.audio.bitrate=="number"&&(Se+=xe.audio.bitrate),Se!==xe.totalBitrate?(xe.totalBitrate=Se,{video_source_bitrate:Se,video_source_height:xe.video.height,video_source_width:xe.video.width}):void 0}ee.warn("have bitrate info for video but missing width/height")}},Je=function(Se,Ze,Ge){if(typeof Se.newQuality=="number"){var pe=Se.mediaType;if(pe==="audio"||pe==="video"){var oe=X.getBitrateInfoListFor(pe).find(function(ue){return ue.qualityIndex===Se.newQuality});if(oe&&typeof oe.bitrate=="number"){xe[pe]=oe;var he=Ye();he&&ce("renditionchange",he)}else ee.warn("missing bitrate info for ".concat(pe))}}else ee.warn("missing evt.newQuality in qualityChangeRendered event",Se)};X.on("qualityChangeRendered",Je);var Dt=function(Se){var Ze=Se.error,Ge=Se.event,pe=(Ge=Ge||{}).request||{},oe=_().event&&_().event.currentTarget||{};ce("requestfailed",{request_error:Ze+"_"+Ge.id+"_"+pe.type,request_url:Ge.url,request_hostname:r(Ge.url),request_type:pe.mediaType,request_error_code:oe.status,request_error_type:oe.statusText})};X.on("error",Dt),X._stopMuxMonitor=function(){X.off("manifestLoaded",ye),X.off("initFragmentLoaded",se),X.off("mediaFragmentLoaded",le),X.off("qualityChangeRendered",Je),X.off("error",Dt),delete X._stopMuxMonitor}}else ee.warn("Invalid dash.js player reference. Monitoring blocked.")}(this.mux,this.id,H.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){var H;this.dashjs&&((H=this.dashjs)&&typeof H._stopMuxMonitor=="function"&&H._stopMuxMonitor(),this.dashjs=void 0)}}],F&&Kr(C.prototype,F),N&&Kr(C,N),Object.defineProperty(C,"prototype",{writable:!1}),V}(z),Ri=Oi,Ii=O(153),jt=O.n(Ii);function Er(w){return Er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},Er(w)}function jr(w,C){return function(F){if(Array.isArray(F))return F}(w)||function(F,N){var K=F==null?null:typeof Symbol!="undefined"&&F[Symbol.iterator]||F["@@iterator"];if(K!=null){var V,H,Q=[],J=!0,X=!1;try{for(K=K.call(F);!(J=(V=K.next()).done)&&(Q.push(V.value),!N||Q.length!==N);J=!0);}catch(ee){X=!0,H=ee}finally{try{J||K.return==null||K.return()}finally{if(X)throw H}}return Q}}(w,C)||function(F,N){if(F){if(typeof F=="string")return Wr(F,N);var K=Object.prototype.toString.call(F).slice(8,-1);return K==="Object"&&F.constructor&&(K=F.constructor.name),K==="Map"||K==="Set"?Array.from(F):K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K)?Wr(F,N):void 0}}(w,C)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Wr(w,C){(C==null||C>w.length)&&(C=w.length);for(var F=0,N=new Array(C);F<C;F++)N[F]=w[F];return N}var Pt,Pi=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],Ci={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};_()&&_().WeakMap&&(Pt=new WeakMap);var Mi="#EXT-X-TARGETDURATION",Fi="#EXT-X-PART-INF",wi="#EXT-X-SERVER-CONTROL",ki="#EXTINF",Bi="#EXT-X-PROGRAM-DATE-TIME",Ui="#EXT-X-VERSION",Ni="#EXT-X-SESSION-DATA",ar=function(w){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(w),this.manifest};ar.prototype.process=function(w){var C;for(this.buffer+=w,C=this.buffer.indexOf(`
5
5
  `);C>-1;C=this.buffer.indexOf(`
6
- `))this.processLine(this.buffer.substring(0,C)),this.buffer=this.buffer.substring(C+1)},Jt.prototype.processLine=function(w){var C=w.indexOf(":"),F=Bi(w,C),N=F[0],K=F.length===2?gr(F[1]):void 0;if(N[0]!=="#")this.currentUri.uri=N,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(N){case bi:if(!isFinite(K)||K<0)return;this.manifest.targetDuration=K,this.setHoldBack();break;case Oi:vr(this.manifest,F),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case Ri:vr(this.manifest,F),this.setHoldBack();break;case Ii:K===0?this.currentUri.duration=.01:K>0&&(this.currentUri.duration=K);break;case Pi:var V=K,H=new Date(V);this.manifest.dateTimeString||(this.manifest.dateTimeString=V,this.manifest.dateTimeObject=H),this.currentUri.dateTimeString=V,this.currentUri.dateTimeObject=H;break;case Ci:vr(this.manifest,F);break;case Mi:var Q=Ui(F[1]),J=a(Q);i()(this.manifest.sessionData,J)}},Jt.prototype.setHoldBack=function(){var w=this.manifest,C=w.serverControl,F=w.targetDuration,N=w.partTargetDuration;if(C){var K="holdBack",V="partHoldBack",H=F&&3*F,Q=N&&2*N;F&&!C.hasOwnProperty(K)&&(C[K]=H),H&&C[K]<H&&(C[K]=H),N&&!C.hasOwnProperty(V)&&(C[V]=3*N),N&&C[V]<Q&&(C[V]=Q)}};var vr=function(w,C){var F,N=Br(C[0].replace("#EXT-X-",""));ki(C[1])?(F={},F=i()(wi(C[1]),F)):F=gr(C[1]),w[N]=F},Br=function(w){return w.toLowerCase().replace(/-(\w)/g,function(C){return C[1].toUpperCase()})},gr=function(w){if(w.toLowerCase()==="yes"||w.toLowerCase()==="no")return w.toLowerCase()==="yes";var C=w.indexOf(":")!==-1?w:parseFloat(w);return isNaN(C)?w:C},Fi=function(w){var C={},F=w.split("=");return F.length>1&&(C[Br(F[0])]=gr(F[1])),C},wi=function(w){for(var C=w.split(","),F={},N=0;C.length>N;N++){var K=C[N],V=Fi(K);F=i()(V,F)}return F},ki=function(w){return w.indexOf("=")>-1},Bi=function(w,C){return C===-1?[w]:[w.substring(0,C),w.substring(C+1)]},Ui=function(w){var C={};if(w){var F=w.search(",");return[w.slice(0,F),w.slice(F+1)].forEach(function(N,K){for(var V=N.replace(/['"]+/g,"").split("="),H=0;H<V.length;H++)V[H]==="DATA-ID"&&(C["DATA-ID"]=V[1-H]),V[H]==="VALUE"&&(C.VALUE=V[1-H])}),{data:C}}},Ni=Jt,Ki={safeCall:function(w,C,F,N){var K=N;if(w&&typeof w[C]=="function")try{K=w[C].apply(w,F)}catch(V){e.info("safeCall error",V)}return K},safeIncrement:t,getComputedStyle:function(w,C){var F;if(w&&C&&_()&&typeof _().getComputedStyle=="function")return _t&&_t.has(w)&&(F=_t.get(w)),F||(F=_().getComputedStyle(w,null),_t&&_t.set(w,F)),F.getPropertyValue(C)},secondsToMs:function(w){return Math.floor(1e3*w)},assign:i(),headersStringToObject:u,extractHostnameAndDomain:o,extractHostname:r,manifestParser:Ni,generateShortID:x,generateUUID:y,now:h.now},ji={PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled"};function Wi(w,C){return function(F){if(Array.isArray(F))return F}(w)||function(F,N){var K=F==null?null:typeof Symbol!="undefined"&&F[Symbol.iterator]||F["@@iterator"];if(K!=null){var V,H,Q=[],J=!0,X=!1;try{for(K=K.call(F);!(J=(V=K.next()).done)&&(Q.push(V.value),!N||Q.length!==N);J=!0);}catch(ee){X=!0,H=ee}finally{try{J||K.return==null||K.return()}finally{if(X)throw H}}return Q}}(w,C)||function(F,N){if(F){if(typeof F=="string")return Ur(F,N);var K=Object.prototype.toString.call(F).slice(8,-1);return K==="Object"&&F.constructor&&(K=F.constructor.name),K==="Map"||K==="Set"?Array.from(F):K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K)?Ur(F,N):void 0}}(w,C)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ur(w,C){(C==null||C>w.length)&&(C=w.length);for(var F=0,N=new Array(C);F<C;F++)N[F]=w[F];return N}var tt={},wt=function w(C){var F=arguments;typeof C=="string"?w.hasOwnProperty(C)?_().setTimeout(function(){F=Array.prototype.splice.call(F,1),w[C].apply(null,F)},0):e.warn("`"+C+"` is an unknown task"):typeof C=="function"?_().setTimeout(function(){C(w)},0):e.warn("`"+C+"` is invalid.")},Gi={loaded:h.now(),NAME:"mux-embed",VERSION:"4.14.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(w,C){return function(F,N,K){var V=wr(E(N),3),H=V[0],Q=V[1],J=V[2],X=F.log,ee=F.utils.getComputedStyle,ce=F.utils.secondsToMs;if(!H)return X.error("No element was found with the `"+Q+"` query selector.");if(J!=="video"&&J!=="audio")return X.error("The element of `"+Q+"` was not a media element.");H.mux&&(H.mux.destroy(),delete H.mux,X.warn("Already monitoring this video element, replacing existing event listeners")),(K=i()({automaticErrorTracking:!0},K)).data=i()({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:F.VERSION},K.data),K.getPlayheadTime=function(){return ce(H.currentTime)},K.getStateData=function(){var ve=this.hlsjs&&this.hlsjs.url,se=this.dashjs&&hr(this.dashjs.getSource==="function")&&this.dashjs.getSource(),le={player_is_paused:H.paused,player_playhead_time:ce(H.currentTime),player_width:parseInt(ee(H,"width")),player_height:parseInt(ee(H,"height")),player_autoplay_on:H.autoplay,player_preload_on:H.preload,player_language_code:H.lang,player_is_fullscreen:Ft()&&!!(Ft().fullscreenElement||Ft().webkitFullscreenElement||Ft().mozFullScreenElement||Ft().msFullscreenElement),video_poster_url:H.poster,video_source_url:ve||se||H.currentSrc,video_source_duration:ce(H.duration),video_source_height:H.videoHeight,video_source_width:H.videoWidth},xe=K.getPlayheadTime();if(H.getStartDate&&xe>0){var Ye=H.getStartDate();if(Ye&&typeof Ye.getTime=="function"&&Ye.getTime()){var $e=Ye.getTime();if(le.player_program_time=$e+xe,H.seekable.length>0){var yt=$e+H.seekable.end(H.seekable.length-1);le.player_live_edge_program_time=yt}}}return le},H.mux=H.mux||{},H.mux.deleted=!1,H.mux.emit=function(ve,se){F.emit(Q,ve,se)};var ye=function(){X.error("The monitor for this video element has already been destroyed.")};H.mux.destroy=function(){Object.keys(H.mux.listeners).forEach(function(ve){H.removeEventListener(ve,H.mux.listeners[ve],!1)}),delete H.mux.listeners,H.mux.destroy=ye,H.mux.swapElement=ye,H.mux.emit=ye,H.mux.addHLSJS=ye,H.mux.addDashJS=ye,H.mux.removeHLSJS=ye,H.mux.removeDashJS=ye,H.mux.deleted=!0,F.emit(Q,"destroy")},H.mux.swapElement=function(ve){var se=wr(E(ve),3),le=se[0],xe=se[1],Ye=se[2];return le?Ye!=="video"&&Ye!=="audio"?F.log.error("The element of `"+xe+"` was not a media element."):(le.muxId=H.muxId,delete H.muxId,le.mux=le.mux||{},le.mux.listeners=i()({},H.mux.listeners),delete H.mux.listeners,Object.keys(le.mux.listeners).forEach(function($e){H.removeEventListener($e,le.mux.listeners[$e],!1),le.addEventListener($e,le.mux.listeners[$e],!1)}),le.mux.swapElement=H.mux.swapElement,le.mux.destroy=H.mux.destroy,delete H.mux,void(H=le)):F.log.error("No element was found with the `"+xe+"` query selector.")},H.mux.addHLSJS=function(ve){F.addHLSJS(Q,ve)},H.mux.addDashJS=function(ve){F.addDashJS(Q,ve)},H.mux.removeHLSJS=function(){F.removeHLSJS(Q)},H.mux.removeDashJS=function(){F.removeDashJS(Q)},F.init(Q,K),F.emit(Q,"playerready"),H.paused||(F.emit(Q,"play"),H.readyState>2&&F.emit(Q,"playing")),H.mux.listeners={},Li.forEach(function(ve){(ve!=="error"||K.automaticErrorTracking)&&(H.mux.listeners[ve]=function(){var se={};if(ve==="error"){if(!H.error||H.error.code===1)return;se.player_error_code=H.error.code,se.player_error_message=_i[H.error.code]||H.error.message}F.emit(Q,ve,se)},H.addEventListener(ve,H.mux.listeners[ve],!1))})}(wt,w,C)},destroyMonitor:function(w){var C=Wi(E(w),1)[0];C&&C.mux&&typeof C.mux.destroy=="function"?C.mux.destroy():e.error("A video element monitor for `"+w+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(w,C){var F=D(w);tt[F]?tt[F].addHLSJS(C):e.error("A monitor for `"+F+"` has not been initialized.")},addDashJS:function(w,C){var F=D(w);tt[F]?tt[F].addDashJS(C):e.error("A monitor for `"+F+"` has not been initialized.")},removeHLSJS:function(w){var C=D(w);tt[C]?tt[C].removeHLSJS():e.error("A monitor for `"+C+"` has not been initialized.")},removeDashJS:function(w){var C=D(w);tt[C]?tt[C].removeDashJS():e.error("A monitor for `"+C+"` has not been initialized.")},init:function(w,C){s()&&C&&C.respectDoNotTrack&&e.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var F=D(w);tt[F]=new Di(wt,F,C)},emit:function(w,C,F){var N=D(w);tt[N]?(tt[N].emit(C,F),C==="destroy"&&delete tt[N]):e.error("A monitor for `"+N+"` has not been initialized.")},checkDoNotTrack:s,log:e,utils:Ki,events:ji,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(wt,Gi),_()!==void 0&&typeof _().addEventListener=="function"&&_().addEventListener("pagehide",function(w){w.persisted||(wt.WINDOW_UNLOADING=!0)},!1);var Hi=wt},655:function(A,M,O){var b,_;function y(x){return y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},y(x);}(function(x){var D=!1;if((_=typeof(b=x)=="function"?b.call(M,O,M,A):b)===void 0||(A.exports=_),D=!0,y(M)==="object"&&(A.exports=x(),D=!0),!D){var E=window.Cookies,m=window.Cookies=x();m.noConflict=function(){return window.Cookies=E,m}}})(function(){var x=function(){for(var D=0,E={};D<arguments.length;D++){var m=arguments[D];for(var p in m)E[p]=m[p]}return E};return function D(E){function m(p,f,e){var s;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(e=x({path:"/"},m.defaults,e)).expires=="number"){var h=new Date;h.setMilliseconds(h.getMilliseconds()+864e5*e.expires),e.expires=h}try{s=JSON.stringify(f),/^[\{\[]/.test(s)&&(f=s)}catch{}return f=E.write?E.write(f,p):encodeURIComponent(String(f)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),p=(p=(p=encodeURIComponent(String(p))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[p,"=",f,e.expires?"; expires="+e.expires.toUTCString():"",e.path?"; path="+e.path:"",e.domain?"; domain="+e.domain:"",e.secure?"; secure":""].join("")}p||(s={});for(var g=document.cookie?document.cookie.split("; "):[],i=/(%[0-9A-Z]{2})+/g,r=0;r<g.length;r++){var o=g[r].split("="),c=o.slice(1).join("=");c.charAt(0)==='"'&&(c=c.slice(1,-1));try{var t=o[0].replace(i,decodeURIComponent);if(c=E.read?E.read(c,t):E(c,t)||c.replace(i,decodeURIComponent),this.json)try{c=JSON.parse(c)}catch{}if(p===t){s=c;break}p||(s[t]=c)}catch{}}return s}}return m.set=m,m.get=function(p){return m.call(m,p)},m.getJSON=function(){return m.apply({json:!0},[].slice.call(arguments))},m.defaults={},m.remove=function(p,f){m(p,"",x(f,{expires:-1}))},m.withConverter=D,m}(function(){})})},153:function(A,M,O){var b,_=O.g!==void 0?O.g:typeof window!="undefined"?window:{},y=O(558);typeof document!="undefined"?b=document:(b=_["__GLOBAL_DOCUMENT_CACHE@4"])||(b=_["__GLOBAL_DOCUMENT_CACHE@4"]=y),A.exports=b},48:function(A,M,O){var b;b=typeof window!="undefined"?window:O.g!==void 0?O.g:typeof self!="undefined"?self:{},A.exports=b},678:function(A){var M=9007199254740991,O="[object Arguments]",b="[object Function]",_="[object GeneratorFunction]",y=/^(?:0|[1-9]\d*)$/;function x(S,T,I){switch(I.length){case 0:return S.call(T);case 1:return S.call(T,I[0]);case 2:return S.call(T,I[0],I[1]);case 3:return S.call(T,I[0],I[1],I[2])}return S.apply(T,I)}var D,E,m=Object.prototype,p=m.hasOwnProperty,f=m.toString,e=m.propertyIsEnumerable,s=(D=Object.keys,E=Object,function(S){return D(E(S))}),h=Math.max,g=!e.call({valueOf:1},"valueOf");function i(S,T){var I=n(S)||function(W){return function(G){return function(z){return!!z&&typeof z=="object"}(G)&&u(G)}(W)&&p.call(W,"callee")&&(!e.call(W,"callee")||f.call(W)==O)}(S)?function(W,G){for(var z=-1,Y=Array(W);++z<W;)Y[z]=G(z);return Y}(S.length,String):[],k=I.length,B=!!k;for(var U in S)!T&&!p.call(S,U)||B&&(U=="length"||o(U,k))||I.push(U);return I}function r(S,T,I){var k=S[T];p.call(S,T)&&t(k,I)&&(I!==void 0||T in S)||(S[T]=I)}function o(S,T){return!!(T=T==null?M:T)&&(typeof S=="number"||y.test(S))&&S>-1&&S%1==0&&S<T}function c(S){var T=S&&S.constructor;return S===(typeof T=="function"&&T.prototype||m)}function t(S,T){return S===T||S!=S&&T!=T}var n=Array.isArray;function u(S){return S!=null&&function(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=M}(S.length)&&!function(T){var I=a(T)?f.call(T):"";return I==b||I==_}(S)}function a(S){var T=typeof S;return!!S&&(T=="object"||T=="function")}var d,v=(d=function(S,T){if(g||c(T)||u(T))(function(k,B,U,W){U||(U={});for(var G=-1,z=B.length;++G<z;){var Y=B[G],$=W?W(U[Y],k[Y],Y,U,k):void 0;r(U,Y,$===void 0?k[Y]:$)}})(T,function(k){return u(k)?i(k):function(B){if(!c(B))return s(B);var U=[];for(var W in Object(B))p.call(B,W)&&W!="constructor"&&U.push(W);return U}(k)}(T),S);else for(var I in T)p.call(T,I)&&r(S,I,T[I])},function(S,T){return T=h(T===void 0?S.length-1:T,0),function(){for(var I=arguments,k=-1,B=h(I.length-T,0),U=Array(B);++k<B;)U[k]=I[T+k];k=-1;for(var W=Array(T+1);++k<T;)W[k]=I[k];return W[T]=U,x(S,this,W)}}(function(S,T){var I=-1,k=T.length,B=k>1?T[k-1]:void 0,U=k>2?T[2]:void 0;for(B=d.length>3&&typeof B=="function"?(k--,B):void 0,U&&function(G,z,Y){if(!a(Y))return!1;var $=typeof z;return!!($=="number"?u(Y)&&o(z,Y.length):$=="string"&&z in Y)&&t(Y[z],G)}(T[0],T[1],U)&&(B=k<3?void 0:B,k=1),S=Object(S);++I<k;){var W=T[I];W&&d(S,W,I,B)}return S}));A.exports=v},640:function(A,M,O){var b,_;(function(y,x){"use strict";b=function(){var D=function(){},E="undefined",m=typeof window!==E&&typeof window.navigator!==E&&/Trident\/|MSIE /.test(window.navigator.userAgent),p=["trace","debug","info","warn","error"];function f(n,u){var a=n[u];if(typeof a.bind=="function")return a.bind(n);try{return Function.prototype.bind.call(a,n)}catch{return function(){return Function.prototype.apply.apply(a,[n,arguments])}}}function e(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(n){return n==="debug"&&(n="log"),typeof console!==E&&(n==="trace"&&m?e:console[n]!==void 0?f(console,n):console.log!==void 0?f(console,"log"):D)}function h(n,u){for(var a=0;a<p.length;a++){var d=p[a];this[d]=a<n?D:this.methodFactory(d,n,u)}this.log=this.debug}function g(n,u,a){return function(){typeof console!==E&&(h.call(this,u,a),this[n].apply(this,arguments))}}function i(n,u,a){return s(n)||g.apply(this,arguments)}function r(n,u,a){var d,v=this;u=u==null?"WARN":u;var S="loglevel";function T(U){var W=(p[U]||"silent").toUpperCase();if(typeof window!==E&&S){try{return void(window.localStorage[S]=W)}catch{}try{window.document.cookie=encodeURIComponent(S)+"="+W+";"}catch{}}}function I(){var U;if(typeof window!==E&&S){try{U=window.localStorage[S]}catch{}if(typeof U===E)try{var W=window.document.cookie,G=W.indexOf(encodeURIComponent(S)+"=");G!==-1&&(U=/^([^;]+)/.exec(W.slice(G))[1])}catch{}return v.levels[U]===void 0&&(U=void 0),U}}function k(){if(typeof window!==E&&S){try{return void window.localStorage.removeItem(S)}catch{}try{window.document.cookie=encodeURIComponent(S)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof n=="string"?S+=":"+n:typeof n=="symbol"&&(S=void 0),v.name=n,v.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},v.methodFactory=a||i,v.getLevel=function(){return d},v.setLevel=function(U,W){if(typeof U=="string"&&v.levels[U.toUpperCase()]!==void 0&&(U=v.levels[U.toUpperCase()]),!(typeof U=="number"&&U>=0&&U<=v.levels.SILENT))throw"log.setLevel() called with invalid level: "+U;if(d=U,W!==!1&&T(U),h.call(v,U,n),typeof console===E&&U<v.levels.SILENT)return"No console available for logging"},v.setDefaultLevel=function(U){u=U,I()||v.setLevel(U,!1)},v.resetLevel=function(){v.setLevel(u,!1),k()},v.enableAll=function(U){v.setLevel(v.levels.TRACE,U)},v.disableAll=function(U){v.setLevel(v.levels.SILENT,U)};var B=I();B==null&&(B=u),v.setLevel(B,!1)}var o=new r,c={};o.getLogger=function(n){if(typeof n!="symbol"&&typeof n!="string"||n==="")throw new TypeError("You must supply a name when creating a logger.");var u=c[n];return u||(u=c[n]=new r(n,o.getLevel(),o.methodFactory)),u};var t=typeof window!==E?window.log:void 0;return o.noConflict=function(){return typeof window!==E&&window.log===o&&(window.log=t),o},o.getLoggers=function(){return c},o.default=o,o},(_=typeof b=="function"?b.call(M,O,M,A):b)===void 0||(A.exports=_)})()},375:function(A,M){"use strict";var O=Object.prototype.hasOwnProperty;function b(y){try{return decodeURIComponent(y.replace(/\+/g," "))}catch{return null}}function _(y){try{return encodeURIComponent(y)}catch{return null}}M.stringify=function(y,x){x=x||"";var D,E,m=[];for(E in typeof x!="string"&&(x="?"),y)if(O.call(y,E)){if((D=y[E])||D!=null&&!isNaN(D)||(D=""),E=_(E),D=_(D),E===null||D===null)continue;m.push(E+"="+D)}return m.length?x+m.join("&"):""},M.parse=function(y){for(var x,D=/([^=?#&]+)=?([^&]*)/g,E={};x=D.exec(y);){var m=b(x[1]),p=b(x[2]);m===null||p===null||m in E||(E[m]=p)}return E}},558:function(){}},P={};function L(A){var M=P[A];if(M!==void 0)return M.exports;var O=P[A]={exports:{}};return l[A].call(O.exports,O,O.exports,L),O.exports}return L.n=function(A){var M=A&&A.__esModule?function(){return A.default}:function(){return A};return L.d(M,{a:M}),M},L.d=function(A,M){for(var O in M)L.o(M,O)&&!L.o(A,O)&&Object.defineProperty(A,O,{enumerable:!0,get:M[O]})},L.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),L.o=function(A,M){return Object.prototype.hasOwnProperty.call(A,M)},L(80)}()},typeof rr=="object"&&typeof Sr=="object"?Sr.exports=R():typeof rr=="object"?rr.mux=R():j.mux=R()})()});var ir=Kr((Kt,Dr)=>{typeof window!="undefined"&&function(R,l){typeof Kt=="object"&&typeof Dr=="object"?Dr.exports=l():typeof define=="function"&&define.amd?define([],l):typeof Kt=="object"?Kt.Hls=l():R.Hls=l()}(Kt,function(){return function(j){var R={};function l(P){if(R[P])return R[P].exports;var L=R[P]={i:P,l:!1,exports:{}};return j[P].call(L.exports,L,L.exports,l),L.l=!0,L.exports}return l.m=j,l.c=R,l.d=function(P,L,A){l.o(P,L)||Object.defineProperty(P,L,{enumerable:!0,get:A})},l.r=function(P){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(P,"__esModule",{value:!0})},l.t=function(P,L){if(L&1&&(P=l(P)),L&8||L&4&&typeof P=="object"&&P&&P.__esModule)return P;var A=Object.create(null);if(l.r(A),Object.defineProperty(A,"default",{enumerable:!0,value:P}),L&2&&typeof P!="string")for(var M in P)l.d(A,M,function(O){return P[O]}.bind(null,M));return A},l.n=function(P){var L=P&&P.__esModule?function(){return P.default}:function(){return P};return l.d(L,"a",L),L},l.o=function(P,L){return Object.prototype.hasOwnProperty.call(P,L)},l.p="/dist/",l(l.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(j,R,l){"use strict";var P=Object.prototype.hasOwnProperty,L="~";function A(){}Object.create&&(A.prototype=Object.create(null),new A().__proto__||(L=!1));function M(y,x,D){this.fn=y,this.context=x,this.once=D||!1}function O(y,x,D,E,m){if(typeof D!="function")throw new TypeError("The listener must be a function");var p=new M(D,E||y,m),f=L?L+x:x;return y._events[f]?y._events[f].fn?y._events[f]=[y._events[f],p]:y._events[f].push(p):(y._events[f]=p,y._eventsCount++),y}function b(y,x){--y._eventsCount===0?y._events=new A:delete y._events[x]}function _(){this._events=new A,this._eventsCount=0}_.prototype.eventNames=function(){var x=[],D,E;if(this._eventsCount===0)return x;for(E in D=this._events)P.call(D,E)&&x.push(L?E.slice(1):E);return Object.getOwnPropertySymbols?x.concat(Object.getOwnPropertySymbols(D)):x},_.prototype.listeners=function(x){var D=L?L+x:x,E=this._events[D];if(!E)return[];if(E.fn)return[E.fn];for(var m=0,p=E.length,f=new Array(p);m<p;m++)f[m]=E[m].fn;return f},_.prototype.listenerCount=function(x){var D=L?L+x:x,E=this._events[D];return E?E.fn?1:E.length:0},_.prototype.emit=function(x,D,E,m,p,f){var e=L?L+x:x;if(!this._events[e])return!1;var s=this._events[e],h=arguments.length,g,i;if(s.fn){switch(s.once&&this.removeListener(x,s.fn,void 0,!0),h){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,D),!0;case 3:return s.fn.call(s.context,D,E),!0;case 4:return s.fn.call(s.context,D,E,m),!0;case 5:return s.fn.call(s.context,D,E,m,p),!0;case 6:return s.fn.call(s.context,D,E,m,p,f),!0}for(i=1,g=new Array(h-1);i<h;i++)g[i-1]=arguments[i];s.fn.apply(s.context,g)}else{var r=s.length,o;for(i=0;i<r;i++)switch(s[i].once&&this.removeListener(x,s[i].fn,void 0,!0),h){case 1:s[i].fn.call(s[i].context);break;case 2:s[i].fn.call(s[i].context,D);break;case 3:s[i].fn.call(s[i].context,D,E);break;case 4:s[i].fn.call(s[i].context,D,E,m);break;default:if(!g)for(o=1,g=new Array(h-1);o<h;o++)g[o-1]=arguments[o];s[i].fn.apply(s[i].context,g)}}return!0},_.prototype.on=function(x,D,E){return O(this,x,D,E,!1)},_.prototype.once=function(x,D,E){return O(this,x,D,E,!0)},_.prototype.removeListener=function(x,D,E,m){var p=L?L+x:x;if(!this._events[p])return this;if(!D)return b(this,p),this;var f=this._events[p];if(f.fn)f.fn===D&&(!m||f.once)&&(!E||f.context===E)&&b(this,p);else{for(var e=0,s=[],h=f.length;e<h;e++)(f[e].fn!==D||m&&!f[e].once||E&&f[e].context!==E)&&s.push(f[e]);s.length?this._events[p]=s.length===1?s[0]:s:b(this,p)}return this},_.prototype.removeAllListeners=function(x){var D;return x?(D=L?L+x:x,this._events[D]&&b(this,D)):(this._events=new A,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=L,_.EventEmitter=_,j.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(j,R,l){(function(P){var L=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,A=/^(?=([^\/?#]*))\1([^]*)$/,M=/(?:\/|^)\.(?=\/)/g,O=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,b={buildAbsoluteURL:function(_,y,x){if(x=x||{},_=_.trim(),y=y.trim(),!y){if(!x.alwaysNormalize)return _;var D=b.parseURL(_);if(!D)throw new Error("Error trying to parse base URL.");return D.path=b.normalizePath(D.path),b.buildURLFromParts(D)}var E=b.parseURL(y);if(!E)throw new Error("Error trying to parse relative URL.");if(E.scheme)return x.alwaysNormalize?(E.path=b.normalizePath(E.path),b.buildURLFromParts(E)):y;var m=b.parseURL(_);if(!m)throw new Error("Error trying to parse base URL.");if(!m.netLoc&&m.path&&m.path[0]!=="/"){var p=A.exec(m.path);m.netLoc=p[1],m.path=p[2]}m.netLoc&&!m.path&&(m.path="/");var f={scheme:m.scheme,netLoc:E.netLoc,path:null,params:E.params,query:E.query,fragment:E.fragment};if(!E.netLoc&&(f.netLoc=m.netLoc,E.path[0]!=="/"))if(!E.path)f.path=m.path,E.params||(f.params=m.params,E.query||(f.query=m.query));else{var e=m.path,s=e.substring(0,e.lastIndexOf("/")+1)+E.path;f.path=b.normalizePath(s)}return f.path===null&&(f.path=x.alwaysNormalize?b.normalizePath(E.path):E.path),b.buildURLFromParts(f)},parseURL:function(_){var y=L.exec(_);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(M,"");_.length!==(_=_.replace(O,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};j.exports=b})(this)},"./node_modules/webworkify-webpack/index.js":function(j,R,l){function P(x){var D={};function E(p){if(D[p])return D[p].exports;var f=D[p]={i:p,l:!1,exports:{}};return x[p].call(f.exports,f,f.exports,E),f.l=!0,f.exports}E.m=x,E.c=D,E.i=function(p){return p},E.d=function(p,f,e){E.o(p,f)||Object.defineProperty(p,f,{configurable:!1,enumerable:!0,get:e})},E.r=function(p){Object.defineProperty(p,"__esModule",{value:!0})},E.n=function(p){var f=p&&p.__esModule?function(){return p.default}:function(){return p};return E.d(f,"a",f),f},E.o=function(p,f){return Object.prototype.hasOwnProperty.call(p,f)},E.p="/",E.oe=function(p){throw console.error(p),p};var m=E(E.s=ENTRY_MODULE);return m.default||m}var L="[\\.|\\-|\\+|\\w|/|@]+",A="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+L+").*?\\)";function M(x){return(x+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function O(x){return!isNaN(1*x)}function b(x,D,E){var m={};m[E]=[];var p=D.toString(),f=p.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!f)return m;for(var e=f[1],s=new RegExp("(\\\\n|\\W)"+M(e)+A,"g"),h;h=s.exec(p);)h[3]!=="dll-reference"&&m[E].push(h[3]);for(s=new RegExp("\\("+M(e)+'\\("(dll-reference\\s('+L+'))"\\)\\)'+A,"g");h=s.exec(p);)x[h[2]]||(m[E].push(h[1]),x[h[2]]=l(h[1]).m),m[h[2]]=m[h[2]]||[],m[h[2]].push(h[4]);for(var g=Object.keys(m),i=0;i<g.length;i++)for(var r=0;r<m[g[i]].length;r++)O(m[g[i]][r])&&(m[g[i]][r]=1*m[g[i]][r]);return m}function _(x){var D=Object.keys(x);return D.reduce(function(E,m){return E||x[m].length>0},!1)}function y(x,D){for(var E={main:[D]},m={main:[]},p={main:{}};_(E);)for(var f=Object.keys(E),e=0;e<f.length;e++){var s=f[e],h=E[s],g=h.pop();if(p[s]=p[s]||{},!(p[s][g]||!x[s][g])){p[s][g]=!0,m[s]=m[s]||[],m[s].push(g);for(var i=b(x,x[s][g],s),r=Object.keys(i),o=0;o<r.length;o++)E[r[o]]=E[r[o]]||[],E[r[o]]=E[r[o]].concat(i[r[o]])}}return m}j.exports=function(x,D){D=D||{};var E={main:l.m},m=D.all?{main:Object.keys(E.main)}:y(E,x),p="";Object.keys(m).filter(function(g){return g!=="main"}).forEach(function(g){for(var i=0;m[g][i];)i++;m[g].push(i),E[g][i]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",p=p+"var "+g+" = ("+P.toString().replace("ENTRY_MODULE",JSON.stringify(i))+")({"+m[g].map(function(r){return""+JSON.stringify(r)+": "+E[g][r].toString()}).join(",")+`});
6
+ `))this.processLine(this.buffer.substring(0,C)),this.buffer=this.buffer.substring(C+1)},ar.prototype.processLine=function(w){var C=w.indexOf(":"),F=Gi(w,C),N=F[0],K=F.length===2?Tr(F[1]):void 0;if(N[0]!=="#")this.currentUri.uri=N,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(N){case Mi:if(!isFinite(K)||K<0)return;this.manifest.targetDuration=K,this.setHoldBack();break;case Fi:yr(this.manifest,F),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case wi:yr(this.manifest,F),this.setHoldBack();break;case ki:K===0?this.currentUri.duration=.01:K>0&&(this.currentUri.duration=K);break;case Bi:var V=K,H=new Date(V);this.manifest.dateTimeString||(this.manifest.dateTimeString=V,this.manifest.dateTimeObject=H),this.currentUri.dateTimeString=V,this.currentUri.dateTimeObject=H;break;case Ui:yr(this.manifest,F);break;case Ni:var Q=Hi(F[1]),J=a(Q);i()(this.manifest.sessionData,J)}},ar.prototype.setHoldBack=function(){var w=this.manifest,C=w.serverControl,F=w.targetDuration,N=w.partTargetDuration;if(C){var K="holdBack",V="partHoldBack",H=F&&3*F,Q=N&&2*N;F&&!C.hasOwnProperty(K)&&(C[K]=H),H&&C[K]<H&&(C[K]=H),N&&!C.hasOwnProperty(V)&&(C[V]=3*N),N&&C[V]<Q&&(C[V]=Q)}};var yr=function(w,C){var F,N=Gr(C[0].replace("#EXT-X-",""));Wi(C[1])?(F={},F=i()(ji(C[1]),F)):F=Tr(C[1]),w[N]=F},Gr=function(w){return w.toLowerCase().replace(/-(\w)/g,function(C){return C[1].toUpperCase()})},Tr=function(w){if(w.toLowerCase()==="yes"||w.toLowerCase()==="no")return w.toLowerCase()==="yes";var C=w.indexOf(":")!==-1?w:parseFloat(w);return isNaN(C)?w:C},Ki=function(w){var C={},F=w.split("=");return F.length>1&&(C[Gr(F[0])]=Tr(F[1])),C},ji=function(w){for(var C=w.split(","),F={},N=0;C.length>N;N++){var K=C[N],V=Ki(K);F=i()(V,F)}return F},Wi=function(w){return w.indexOf("=")>-1},Gi=function(w,C){return C===-1?[w]:[w.substring(0,C),w.substring(C+1)]},Hi=function(w){var C={};if(w){var F=w.search(",");return[w.slice(0,F),w.slice(F+1)].forEach(function(N,K){for(var V=N.replace(/['"]+/g,"").split("="),H=0;H<V.length;H++)V[H]==="DATA-ID"&&(C["DATA-ID"]=V[1-H]),V[H]==="VALUE"&&(C.VALUE=V[1-H])}),{data:C}}},Vi=ar,Yi={safeCall:function(w,C,F,N){var K=N;if(w&&typeof w[C]=="function")try{K=w[C].apply(w,F)}catch(V){e.info("safeCall error",V)}return K},safeIncrement:t,getComputedStyle:function(w,C){var F;if(w&&C&&_()&&typeof _().getComputedStyle=="function")return Pt&&Pt.has(w)&&(F=Pt.get(w)),F||(F=_().getComputedStyle(w,null),Pt&&Pt.set(w,F)),F.getPropertyValue(C)},secondsToMs:function(w){return Math.floor(1e3*w)},assign:i(),headersStringToObject:u,extractHostnameAndDomain:o,extractHostname:r,manifestParser:Vi,generateShortID:x,generateUUID:y,now:h.now},zi={PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled"};function Xi(w,C){return function(F){if(Array.isArray(F))return F}(w)||function(F,N){var K=F==null?null:typeof Symbol!="undefined"&&F[Symbol.iterator]||F["@@iterator"];if(K!=null){var V,H,Q=[],J=!0,X=!1;try{for(K=K.call(F);!(J=(V=K.next()).done)&&(Q.push(V.value),!N||Q.length!==N);J=!0);}catch(ee){X=!0,H=ee}finally{try{J||K.return==null||K.return()}finally{if(X)throw H}}return Q}}(w,C)||function(F,N){if(F){if(typeof F=="string")return Hr(F,N);var K=Object.prototype.toString.call(F).slice(8,-1);return K==="Object"&&F.constructor&&(K=F.constructor.name),K==="Map"||K==="Set"?Array.from(F):K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K)?Hr(F,N):void 0}}(w,C)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Hr(w,C){(C==null||C>w.length)&&(C=w.length);for(var F=0,N=new Array(C);F<C;F++)N[F]=w[F];return N}var rt={},Wt=function w(C){var F=arguments;typeof C=="string"?w.hasOwnProperty(C)?_().setTimeout(function(){F=Array.prototype.splice.call(F,1),w[C].apply(null,F)},0):e.warn("`"+C+"` is an unknown task"):typeof C=="function"?_().setTimeout(function(){C(w)},0):e.warn("`"+C+"` is invalid.")},Qi={loaded:h.now(),NAME:"mux-embed",VERSION:"4.14.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(w,C){return function(F,N,K){var V=jr(E(N),3),H=V[0],Q=V[1],J=V[2],X=F.log,ee=F.utils.getComputedStyle,ce=F.utils.secondsToMs;if(!H)return X.error("No element was found with the `"+Q+"` query selector.");if(J!=="video"&&J!=="audio")return X.error("The element of `"+Q+"` was not a media element.");H.mux&&(H.mux.destroy(),delete H.mux,X.warn("Already monitoring this video element, replacing existing event listeners")),(K=i()({automaticErrorTracking:!0},K)).data=i()({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:F.VERSION},K.data),K.getPlayheadTime=function(){return ce(H.currentTime)},K.getStateData=function(){var ve=this.hlsjs&&this.hlsjs.url,se=this.dashjs&&Er(this.dashjs.getSource==="function")&&this.dashjs.getSource(),le={player_is_paused:H.paused,player_playhead_time:ce(H.currentTime),player_width:parseInt(ee(H,"width")),player_height:parseInt(ee(H,"height")),player_autoplay_on:H.autoplay,player_preload_on:H.preload,player_language_code:H.lang,player_is_fullscreen:jt()&&!!(jt().fullscreenElement||jt().webkitFullscreenElement||jt().mozFullScreenElement||jt().msFullscreenElement),video_poster_url:H.poster,video_source_url:ve||se||H.currentSrc,video_source_duration:ce(H.duration),video_source_height:H.videoHeight,video_source_width:H.videoWidth},xe=K.getPlayheadTime();if(H.getStartDate&&xe>0){var Ye=H.getStartDate();if(Ye&&typeof Ye.getTime=="function"&&Ye.getTime()){var Je=Ye.getTime();if(le.player_program_time=Je+xe,H.seekable.length>0){var Dt=Je+H.seekable.end(H.seekable.length-1);le.player_live_edge_program_time=Dt}}}return le},H.mux=H.mux||{},H.mux.deleted=!1,H.mux.emit=function(ve,se){F.emit(Q,ve,se)};var ye=function(){X.error("The monitor for this video element has already been destroyed.")};H.mux.destroy=function(){Object.keys(H.mux.listeners).forEach(function(ve){H.removeEventListener(ve,H.mux.listeners[ve],!1)}),delete H.mux.listeners,H.mux.destroy=ye,H.mux.swapElement=ye,H.mux.emit=ye,H.mux.addHLSJS=ye,H.mux.addDashJS=ye,H.mux.removeHLSJS=ye,H.mux.removeDashJS=ye,H.mux.deleted=!0,F.emit(Q,"destroy")},H.mux.swapElement=function(ve){var se=jr(E(ve),3),le=se[0],xe=se[1],Ye=se[2];return le?Ye!=="video"&&Ye!=="audio"?F.log.error("The element of `"+xe+"` was not a media element."):(le.muxId=H.muxId,delete H.muxId,le.mux=le.mux||{},le.mux.listeners=i()({},H.mux.listeners),delete H.mux.listeners,Object.keys(le.mux.listeners).forEach(function(Je){H.removeEventListener(Je,le.mux.listeners[Je],!1),le.addEventListener(Je,le.mux.listeners[Je],!1)}),le.mux.swapElement=H.mux.swapElement,le.mux.destroy=H.mux.destroy,delete H.mux,void(H=le)):F.log.error("No element was found with the `"+xe+"` query selector.")},H.mux.addHLSJS=function(ve){F.addHLSJS(Q,ve)},H.mux.addDashJS=function(ve){F.addDashJS(Q,ve)},H.mux.removeHLSJS=function(){F.removeHLSJS(Q)},H.mux.removeDashJS=function(){F.removeDashJS(Q)},F.init(Q,K),F.emit(Q,"playerready"),H.paused||(F.emit(Q,"play"),H.readyState>2&&F.emit(Q,"playing")),H.mux.listeners={},Pi.forEach(function(ve){(ve!=="error"||K.automaticErrorTracking)&&(H.mux.listeners[ve]=function(){var se={};if(ve==="error"){if(!H.error||H.error.code===1)return;se.player_error_code=H.error.code,se.player_error_message=Ci[H.error.code]||H.error.message}F.emit(Q,ve,se)},H.addEventListener(ve,H.mux.listeners[ve],!1))})}(Wt,w,C)},destroyMonitor:function(w){var C=Xi(E(w),1)[0];C&&C.mux&&typeof C.mux.destroy=="function"?C.mux.destroy():e.error("A video element monitor for `"+w+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(w,C){var F=D(w);rt[F]?rt[F].addHLSJS(C):e.error("A monitor for `"+F+"` has not been initialized.")},addDashJS:function(w,C){var F=D(w);rt[F]?rt[F].addDashJS(C):e.error("A monitor for `"+F+"` has not been initialized.")},removeHLSJS:function(w){var C=D(w);rt[C]?rt[C].removeHLSJS():e.error("A monitor for `"+C+"` has not been initialized.")},removeDashJS:function(w){var C=D(w);rt[C]?rt[C].removeDashJS():e.error("A monitor for `"+C+"` has not been initialized.")},init:function(w,C){s()&&C&&C.respectDoNotTrack&&e.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var F=D(w);rt[F]=new Ri(Wt,F,C)},emit:function(w,C,F){var N=D(w);rt[N]?(rt[N].emit(C,F),C==="destroy"&&delete rt[N]):e.error("A monitor for `"+N+"` has not been initialized.")},checkDoNotTrack:s,log:e,utils:Yi,events:zi,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Wt,Qi),_()!==void 0&&typeof _().addEventListener=="function"&&_().addEventListener("pagehide",function(w){w.persisted||(Wt.WINDOW_UNLOADING=!0)},!1);var $i=Wt},655:function(A,M,O){var b,_;function y(x){return y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},y(x);}(function(x){var D=!1;if((_=typeof(b=x)=="function"?b.call(M,O,M,A):b)===void 0||(A.exports=_),D=!0,y(M)==="object"&&(A.exports=x(),D=!0),!D){var E=window.Cookies,m=window.Cookies=x();m.noConflict=function(){return window.Cookies=E,m}}})(function(){var x=function(){for(var D=0,E={};D<arguments.length;D++){var m=arguments[D];for(var p in m)E[p]=m[p]}return E};return function D(E){function m(p,f,e){var s;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(e=x({path:"/"},m.defaults,e)).expires=="number"){var h=new Date;h.setMilliseconds(h.getMilliseconds()+864e5*e.expires),e.expires=h}try{s=JSON.stringify(f),/^[\{\[]/.test(s)&&(f=s)}catch{}return f=E.write?E.write(f,p):encodeURIComponent(String(f)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),p=(p=(p=encodeURIComponent(String(p))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[p,"=",f,e.expires?"; expires="+e.expires.toUTCString():"",e.path?"; path="+e.path:"",e.domain?"; domain="+e.domain:"",e.secure?"; secure":""].join("")}p||(s={});for(var g=document.cookie?document.cookie.split("; "):[],i=/(%[0-9A-Z]{2})+/g,r=0;r<g.length;r++){var o=g[r].split("="),c=o.slice(1).join("=");c.charAt(0)==='"'&&(c=c.slice(1,-1));try{var t=o[0].replace(i,decodeURIComponent);if(c=E.read?E.read(c,t):E(c,t)||c.replace(i,decodeURIComponent),this.json)try{c=JSON.parse(c)}catch{}if(p===t){s=c;break}p||(s[t]=c)}catch{}}return s}}return m.set=m,m.get=function(p){return m.call(m,p)},m.getJSON=function(){return m.apply({json:!0},[].slice.call(arguments))},m.defaults={},m.remove=function(p,f){m(p,"",x(f,{expires:-1}))},m.withConverter=D,m}(function(){})})},153:function(A,M,O){var b,_=O.g!==void 0?O.g:typeof window!="undefined"?window:{},y=O(558);typeof document!="undefined"?b=document:(b=_["__GLOBAL_DOCUMENT_CACHE@4"])||(b=_["__GLOBAL_DOCUMENT_CACHE@4"]=y),A.exports=b},48:function(A,M,O){var b;b=typeof window!="undefined"?window:O.g!==void 0?O.g:typeof self!="undefined"?self:{},A.exports=b},678:function(A){var M=9007199254740991,O="[object Arguments]",b="[object Function]",_="[object GeneratorFunction]",y=/^(?:0|[1-9]\d*)$/;function x(S,T,I){switch(I.length){case 0:return S.call(T);case 1:return S.call(T,I[0]);case 2:return S.call(T,I[0],I[1]);case 3:return S.call(T,I[0],I[1],I[2])}return S.apply(T,I)}var D,E,m=Object.prototype,p=m.hasOwnProperty,f=m.toString,e=m.propertyIsEnumerable,s=(D=Object.keys,E=Object,function(S){return D(E(S))}),h=Math.max,g=!e.call({valueOf:1},"valueOf");function i(S,T){var I=n(S)||function(W){return function(G){return function(z){return!!z&&typeof z=="object"}(G)&&u(G)}(W)&&p.call(W,"callee")&&(!e.call(W,"callee")||f.call(W)==O)}(S)?function(W,G){for(var z=-1,Y=Array(W);++z<W;)Y[z]=G(z);return Y}(S.length,String):[],k=I.length,B=!!k;for(var U in S)!T&&!p.call(S,U)||B&&(U=="length"||o(U,k))||I.push(U);return I}function r(S,T,I){var k=S[T];p.call(S,T)&&t(k,I)&&(I!==void 0||T in S)||(S[T]=I)}function o(S,T){return!!(T=T==null?M:T)&&(typeof S=="number"||y.test(S))&&S>-1&&S%1==0&&S<T}function c(S){var T=S&&S.constructor;return S===(typeof T=="function"&&T.prototype||m)}function t(S,T){return S===T||S!=S&&T!=T}var n=Array.isArray;function u(S){return S!=null&&function(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=M}(S.length)&&!function(T){var I=a(T)?f.call(T):"";return I==b||I==_}(S)}function a(S){var T=typeof S;return!!S&&(T=="object"||T=="function")}var d,v=(d=function(S,T){if(g||c(T)||u(T))(function(k,B,U,W){U||(U={});for(var G=-1,z=B.length;++G<z;){var Y=B[G],$=W?W(U[Y],k[Y],Y,U,k):void 0;r(U,Y,$===void 0?k[Y]:$)}})(T,function(k){return u(k)?i(k):function(B){if(!c(B))return s(B);var U=[];for(var W in Object(B))p.call(B,W)&&W!="constructor"&&U.push(W);return U}(k)}(T),S);else for(var I in T)p.call(T,I)&&r(S,I,T[I])},function(S,T){return T=h(T===void 0?S.length-1:T,0),function(){for(var I=arguments,k=-1,B=h(I.length-T,0),U=Array(B);++k<B;)U[k]=I[T+k];k=-1;for(var W=Array(T+1);++k<T;)W[k]=I[k];return W[T]=U,x(S,this,W)}}(function(S,T){var I=-1,k=T.length,B=k>1?T[k-1]:void 0,U=k>2?T[2]:void 0;for(B=d.length>3&&typeof B=="function"?(k--,B):void 0,U&&function(G,z,Y){if(!a(Y))return!1;var $=typeof z;return!!($=="number"?u(Y)&&o(z,Y.length):$=="string"&&z in Y)&&t(Y[z],G)}(T[0],T[1],U)&&(B=k<3?void 0:B,k=1),S=Object(S);++I<k;){var W=T[I];W&&d(S,W,I,B)}return S}));A.exports=v},640:function(A,M,O){var b,_;(function(y,x){"use strict";b=function(){var D=function(){},E="undefined",m=typeof window!==E&&typeof window.navigator!==E&&/Trident\/|MSIE /.test(window.navigator.userAgent),p=["trace","debug","info","warn","error"];function f(n,u){var a=n[u];if(typeof a.bind=="function")return a.bind(n);try{return Function.prototype.bind.call(a,n)}catch{return function(){return Function.prototype.apply.apply(a,[n,arguments])}}}function e(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(n){return n==="debug"&&(n="log"),typeof console!==E&&(n==="trace"&&m?e:console[n]!==void 0?f(console,n):console.log!==void 0?f(console,"log"):D)}function h(n,u){for(var a=0;a<p.length;a++){var d=p[a];this[d]=a<n?D:this.methodFactory(d,n,u)}this.log=this.debug}function g(n,u,a){return function(){typeof console!==E&&(h.call(this,u,a),this[n].apply(this,arguments))}}function i(n,u,a){return s(n)||g.apply(this,arguments)}function r(n,u,a){var d,v=this;u=u==null?"WARN":u;var S="loglevel";function T(U){var W=(p[U]||"silent").toUpperCase();if(typeof window!==E&&S){try{return void(window.localStorage[S]=W)}catch{}try{window.document.cookie=encodeURIComponent(S)+"="+W+";"}catch{}}}function I(){var U;if(typeof window!==E&&S){try{U=window.localStorage[S]}catch{}if(typeof U===E)try{var W=window.document.cookie,G=W.indexOf(encodeURIComponent(S)+"=");G!==-1&&(U=/^([^;]+)/.exec(W.slice(G))[1])}catch{}return v.levels[U]===void 0&&(U=void 0),U}}function k(){if(typeof window!==E&&S){try{return void window.localStorage.removeItem(S)}catch{}try{window.document.cookie=encodeURIComponent(S)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof n=="string"?S+=":"+n:typeof n=="symbol"&&(S=void 0),v.name=n,v.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},v.methodFactory=a||i,v.getLevel=function(){return d},v.setLevel=function(U,W){if(typeof U=="string"&&v.levels[U.toUpperCase()]!==void 0&&(U=v.levels[U.toUpperCase()]),!(typeof U=="number"&&U>=0&&U<=v.levels.SILENT))throw"log.setLevel() called with invalid level: "+U;if(d=U,W!==!1&&T(U),h.call(v,U,n),typeof console===E&&U<v.levels.SILENT)return"No console available for logging"},v.setDefaultLevel=function(U){u=U,I()||v.setLevel(U,!1)},v.resetLevel=function(){v.setLevel(u,!1),k()},v.enableAll=function(U){v.setLevel(v.levels.TRACE,U)},v.disableAll=function(U){v.setLevel(v.levels.SILENT,U)};var B=I();B==null&&(B=u),v.setLevel(B,!1)}var o=new r,c={};o.getLogger=function(n){if(typeof n!="symbol"&&typeof n!="string"||n==="")throw new TypeError("You must supply a name when creating a logger.");var u=c[n];return u||(u=c[n]=new r(n,o.getLevel(),o.methodFactory)),u};var t=typeof window!==E?window.log:void 0;return o.noConflict=function(){return typeof window!==E&&window.log===o&&(window.log=t),o},o.getLoggers=function(){return c},o.default=o,o},(_=typeof b=="function"?b.call(M,O,M,A):b)===void 0||(A.exports=_)})()},375:function(A,M){"use strict";var O=Object.prototype.hasOwnProperty;function b(y){try{return decodeURIComponent(y.replace(/\+/g," "))}catch{return null}}function _(y){try{return encodeURIComponent(y)}catch{return null}}M.stringify=function(y,x){x=x||"";var D,E,m=[];for(E in typeof x!="string"&&(x="?"),y)if(O.call(y,E)){if((D=y[E])||D!=null&&!isNaN(D)||(D=""),E=_(E),D=_(D),E===null||D===null)continue;m.push(E+"="+D)}return m.length?x+m.join("&"):""},M.parse=function(y){for(var x,D=/([^=?#&]+)=?([^&]*)/g,E={};x=D.exec(y);){var m=b(x[1]),p=b(x[2]);m===null||p===null||m in E||(E[m]=p)}return E}},558:function(){}},P={};function L(A){var M=P[A];if(M!==void 0)return M.exports;var O=P[A]={exports:{}};return l[A].call(O.exports,O,O.exports,L),O.exports}return L.n=function(A){var M=A&&A.__esModule?function(){return A.default}:function(){return A};return L.d(M,{a:M}),M},L.d=function(A,M){for(var O in M)L.o(M,O)&&!L.o(A,O)&&Object.defineProperty(A,O,{enumerable:!0,get:M[O]})},L.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),L.o=function(A,M){return Object.prototype.hasOwnProperty.call(A,M)},L(80)}()},typeof or=="object"&&typeof br=="object"?br.exports=R():typeof or=="object"?or.mux=R():j.mux=R()})()});var lr=Yr((Yt,Or)=>{typeof window!="undefined"&&function(R,l){typeof Yt=="object"&&typeof Or=="object"?Or.exports=l():typeof define=="function"&&define.amd?define([],l):typeof Yt=="object"?Yt.Hls=l():R.Hls=l()}(Yt,function(){return function(j){var R={};function l(P){if(R[P])return R[P].exports;var L=R[P]={i:P,l:!1,exports:{}};return j[P].call(L.exports,L,L.exports,l),L.l=!0,L.exports}return l.m=j,l.c=R,l.d=function(P,L,A){l.o(P,L)||Object.defineProperty(P,L,{enumerable:!0,get:A})},l.r=function(P){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(P,"__esModule",{value:!0})},l.t=function(P,L){if(L&1&&(P=l(P)),L&8||L&4&&typeof P=="object"&&P&&P.__esModule)return P;var A=Object.create(null);if(l.r(A),Object.defineProperty(A,"default",{enumerable:!0,value:P}),L&2&&typeof P!="string")for(var M in P)l.d(A,M,function(O){return P[O]}.bind(null,M));return A},l.n=function(P){var L=P&&P.__esModule?function(){return P.default}:function(){return P};return l.d(L,"a",L),L},l.o=function(P,L){return Object.prototype.hasOwnProperty.call(P,L)},l.p="/dist/",l(l.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(j,R,l){"use strict";var P=Object.prototype.hasOwnProperty,L="~";function A(){}Object.create&&(A.prototype=Object.create(null),new A().__proto__||(L=!1));function M(y,x,D){this.fn=y,this.context=x,this.once=D||!1}function O(y,x,D,E,m){if(typeof D!="function")throw new TypeError("The listener must be a function");var p=new M(D,E||y,m),f=L?L+x:x;return y._events[f]?y._events[f].fn?y._events[f]=[y._events[f],p]:y._events[f].push(p):(y._events[f]=p,y._eventsCount++),y}function b(y,x){--y._eventsCount===0?y._events=new A:delete y._events[x]}function _(){this._events=new A,this._eventsCount=0}_.prototype.eventNames=function(){var x=[],D,E;if(this._eventsCount===0)return x;for(E in D=this._events)P.call(D,E)&&x.push(L?E.slice(1):E);return Object.getOwnPropertySymbols?x.concat(Object.getOwnPropertySymbols(D)):x},_.prototype.listeners=function(x){var D=L?L+x:x,E=this._events[D];if(!E)return[];if(E.fn)return[E.fn];for(var m=0,p=E.length,f=new Array(p);m<p;m++)f[m]=E[m].fn;return f},_.prototype.listenerCount=function(x){var D=L?L+x:x,E=this._events[D];return E?E.fn?1:E.length:0},_.prototype.emit=function(x,D,E,m,p,f){var e=L?L+x:x;if(!this._events[e])return!1;var s=this._events[e],h=arguments.length,g,i;if(s.fn){switch(s.once&&this.removeListener(x,s.fn,void 0,!0),h){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,D),!0;case 3:return s.fn.call(s.context,D,E),!0;case 4:return s.fn.call(s.context,D,E,m),!0;case 5:return s.fn.call(s.context,D,E,m,p),!0;case 6:return s.fn.call(s.context,D,E,m,p,f),!0}for(i=1,g=new Array(h-1);i<h;i++)g[i-1]=arguments[i];s.fn.apply(s.context,g)}else{var r=s.length,o;for(i=0;i<r;i++)switch(s[i].once&&this.removeListener(x,s[i].fn,void 0,!0),h){case 1:s[i].fn.call(s[i].context);break;case 2:s[i].fn.call(s[i].context,D);break;case 3:s[i].fn.call(s[i].context,D,E);break;case 4:s[i].fn.call(s[i].context,D,E,m);break;default:if(!g)for(o=1,g=new Array(h-1);o<h;o++)g[o-1]=arguments[o];s[i].fn.apply(s[i].context,g)}}return!0},_.prototype.on=function(x,D,E){return O(this,x,D,E,!1)},_.prototype.once=function(x,D,E){return O(this,x,D,E,!0)},_.prototype.removeListener=function(x,D,E,m){var p=L?L+x:x;if(!this._events[p])return this;if(!D)return b(this,p),this;var f=this._events[p];if(f.fn)f.fn===D&&(!m||f.once)&&(!E||f.context===E)&&b(this,p);else{for(var e=0,s=[],h=f.length;e<h;e++)(f[e].fn!==D||m&&!f[e].once||E&&f[e].context!==E)&&s.push(f[e]);s.length?this._events[p]=s.length===1?s[0]:s:b(this,p)}return this},_.prototype.removeAllListeners=function(x){var D;return x?(D=L?L+x:x,this._events[D]&&b(this,D)):(this._events=new A,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=L,_.EventEmitter=_,j.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(j,R,l){(function(P){var L=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,A=/^(?=([^\/?#]*))\1([^]*)$/,M=/(?:\/|^)\.(?=\/)/g,O=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,b={buildAbsoluteURL:function(_,y,x){if(x=x||{},_=_.trim(),y=y.trim(),!y){if(!x.alwaysNormalize)return _;var D=b.parseURL(_);if(!D)throw new Error("Error trying to parse base URL.");return D.path=b.normalizePath(D.path),b.buildURLFromParts(D)}var E=b.parseURL(y);if(!E)throw new Error("Error trying to parse relative URL.");if(E.scheme)return x.alwaysNormalize?(E.path=b.normalizePath(E.path),b.buildURLFromParts(E)):y;var m=b.parseURL(_);if(!m)throw new Error("Error trying to parse base URL.");if(!m.netLoc&&m.path&&m.path[0]!=="/"){var p=A.exec(m.path);m.netLoc=p[1],m.path=p[2]}m.netLoc&&!m.path&&(m.path="/");var f={scheme:m.scheme,netLoc:E.netLoc,path:null,params:E.params,query:E.query,fragment:E.fragment};if(!E.netLoc&&(f.netLoc=m.netLoc,E.path[0]!=="/"))if(!E.path)f.path=m.path,E.params||(f.params=m.params,E.query||(f.query=m.query));else{var e=m.path,s=e.substring(0,e.lastIndexOf("/")+1)+E.path;f.path=b.normalizePath(s)}return f.path===null&&(f.path=x.alwaysNormalize?b.normalizePath(E.path):E.path),b.buildURLFromParts(f)},parseURL:function(_){var y=L.exec(_);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(M,"");_.length!==(_=_.replace(O,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};j.exports=b})(this)},"./node_modules/webworkify-webpack/index.js":function(j,R,l){function P(x){var D={};function E(p){if(D[p])return D[p].exports;var f=D[p]={i:p,l:!1,exports:{}};return x[p].call(f.exports,f,f.exports,E),f.l=!0,f.exports}E.m=x,E.c=D,E.i=function(p){return p},E.d=function(p,f,e){E.o(p,f)||Object.defineProperty(p,f,{configurable:!1,enumerable:!0,get:e})},E.r=function(p){Object.defineProperty(p,"__esModule",{value:!0})},E.n=function(p){var f=p&&p.__esModule?function(){return p.default}:function(){return p};return E.d(f,"a",f),f},E.o=function(p,f){return Object.prototype.hasOwnProperty.call(p,f)},E.p="/",E.oe=function(p){throw console.error(p),p};var m=E(E.s=ENTRY_MODULE);return m.default||m}var L="[\\.|\\-|\\+|\\w|/|@]+",A="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+L+").*?\\)";function M(x){return(x+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function O(x){return!isNaN(1*x)}function b(x,D,E){var m={};m[E]=[];var p=D.toString(),f=p.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!f)return m;for(var e=f[1],s=new RegExp("(\\\\n|\\W)"+M(e)+A,"g"),h;h=s.exec(p);)h[3]!=="dll-reference"&&m[E].push(h[3]);for(s=new RegExp("\\("+M(e)+'\\("(dll-reference\\s('+L+'))"\\)\\)'+A,"g");h=s.exec(p);)x[h[2]]||(m[E].push(h[1]),x[h[2]]=l(h[1]).m),m[h[2]]=m[h[2]]||[],m[h[2]].push(h[4]);for(var g=Object.keys(m),i=0;i<g.length;i++)for(var r=0;r<m[g[i]].length;r++)O(m[g[i]][r])&&(m[g[i]][r]=1*m[g[i]][r]);return m}function _(x){var D=Object.keys(x);return D.reduce(function(E,m){return E||x[m].length>0},!1)}function y(x,D){for(var E={main:[D]},m={main:[]},p={main:{}};_(E);)for(var f=Object.keys(E),e=0;e<f.length;e++){var s=f[e],h=E[s],g=h.pop();if(p[s]=p[s]||{},!(p[s][g]||!x[s][g])){p[s][g]=!0,m[s]=m[s]||[],m[s].push(g);for(var i=b(x,x[s][g],s),r=Object.keys(i),o=0;o<r.length;o++)E[r[o]]=E[r[o]]||[],E[r[o]]=E[r[o]].concat(i[r[o]])}}return m}j.exports=function(x,D){D=D||{};var E={main:l.m},m=D.all?{main:Object.keys(E.main)}:y(E,x),p="";Object.keys(m).filter(function(g){return g!=="main"}).forEach(function(g){for(var i=0;m[g][i];)i++;m[g].push(i),E[g][i]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",p=p+"var "+g+" = ("+P.toString().replace("ENTRY_MODULE",JSON.stringify(i))+")({"+m[g].map(function(r){return""+JSON.stringify(r)+": "+E[g][r].toString()}).join(",")+`});
8
8
  `}),p=p+"new (("+P.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+m.main.map(function(g){return""+JSON.stringify(g)+": "+E.main[g].toString()}).join(",")+"}))(self);";var f=new window.Blob([p],{type:"text/javascript"});if(D.bare)return f;var e=window.URL||window.webkitURL||window.mozURL||window.msURL,s=e.createObjectURL(f),h=new window.Worker(s);return h.objectURL=s,h}},"./src/config.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"hlsDefaultConfig",function(){return o}),l.d(R,"mergeConfig",function(){return t}),l.d(R,"enableStreamingMode",function(){return n});var P=l("./src/controller/abr-controller.ts"),L=l("./src/controller/audio-stream-controller.ts"),A=l("./src/controller/audio-track-controller.ts"),M=l("./src/controller/subtitle-stream-controller.ts"),O=l("./src/controller/subtitle-track-controller.ts"),b=l("./src/controller/buffer-controller.ts"),_=l("./src/controller/timeline-controller.ts"),y=l("./src/controller/cap-level-controller.ts"),x=l("./src/controller/fps-controller.ts"),D=l("./src/controller/eme-controller.ts"),E=l("./src/controller/cmcd-controller.ts"),m=l("./src/utils/xhr-loader.ts"),p=l("./src/utils/fetch-loader.ts"),f=l("./src/utils/cues.ts"),e=l("./src/utils/mediakeys-helper.ts"),s=l("./src/utils/logger.ts");function h(){return h=Object.assign?Object.assign.bind():function(u){for(var a=1;a<arguments.length;a++){var d=arguments[a];for(var v in d)Object.prototype.hasOwnProperty.call(d,v)&&(u[v]=d[v])}return u},h.apply(this,arguments)}function g(u,a){var d=Object.keys(u);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(u);a&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(u,S).enumerable})),d.push.apply(d,v)}return d}function i(u){for(var a=1;a<arguments.length;a++){var d=arguments[a]!=null?arguments[a]:{};a%2?g(Object(d),!0).forEach(function(v){r(u,v,d[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(d)):g(Object(d)).forEach(function(v){Object.defineProperty(u,v,Object.getOwnPropertyDescriptor(d,v))})}return u}function r(u,a,d){return a in u?Object.defineProperty(u,a,{value:d,enumerable:!0,configurable:!0,writable:!0}):u[a]=d,u}var o=i(i({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:m.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:P.default,bufferController:b.default,capLevelController:y.default,fpsController:x.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:e.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0},c()),{},{subtitleStreamController:M.SubtitleStreamController,subtitleTrackController:O.default,timelineController:_.TimelineController,audioStreamController:L.default,audioTrackController:A.default,emeController:D.default,cmcdController:E.default});function c(){return{cueHandler:f.default,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function t(u,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},u,a)}function n(u){var a=u.loader;if(a!==p.default&&a!==m.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var d=Object(p.fetchSupported)();d&&(u.loader=p.default,u.progressive=!0,u.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(j,R,l){"use strict";l.r(R);var P=l("./src/polyfills/number.ts"),L=l("./src/utils/ewma-bandwidth-estimator.ts"),A=l("./src/events.ts"),M=l("./src/utils/buffer-helper.ts"),O=l("./src/errors.ts"),b=l("./src/types/loader.ts"),_=l("./src/utils/logger.ts");function y(E,m){for(var p=0;p<m.length;p++){var f=m[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(E,f.key,f)}}function x(E,m,p){return m&&y(E.prototype,m),p&&y(E,p),Object.defineProperty(E,"prototype",{writable:!1}),E}var D=function(){function E(p){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=p;var f=p.config;this.bwEstimator=new L.default(f.abrEwmaSlowVoD,f.abrEwmaFastVoD,f.abrEwmaDefaultEstimate),this.registerListeners()}var m=E.prototype;return m.registerListeners=function(){var f=this.hls;f.on(A.Events.FRAG_LOADING,this.onFragLoading,this),f.on(A.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(A.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(A.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){var f=this.hls;f.off(A.Events.FRAG_LOADING,this.onFragLoading,this),f.off(A.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(A.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(A.Events.ERROR,this.onError,this)},m.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},m.onFragLoading=function(f,e){var s=e.frag;if(s.type===b.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=s,this.partCurrent=(h=e.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},m.onLevelLoaded=function(f,e){var s=this.hls.config;e.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},m._abandonRulesCheck=function(){var f=this.fragCurrent,e=this.partCurrent,s=this.hls,h=s.autoLevelEnabled,g=s.config,i=s.media;if(!(!f||!i)){var r=e?e.stats:f.stats,o=e?e.duration:f.duration;if(r.aborted){_.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!(!h||i.paused||!i.playbackRate||!i.readyState)){var c=performance.now()-r.loading.start,t=Math.abs(i.playbackRate);if(!(c<=500*o/t)){var n=s.levels,u=s.minAutoLevel,a=n[f.level],d=r.total||Math.max(r.loaded,Math.round(o*a.maxBitrate/8)),v=Math.max(1,r.bwEstimate?r.bwEstimate/8:r.loaded*1e3/c),S=(d-r.loaded)/v,T=i.currentTime,I=(M.BufferHelper.bufferInfo(i,T,g.maxBufferHole).end-T)/t;if(!(I>=2*o/t||S<=I)){var k=Number.POSITIVE_INFINITY,B;for(B=f.level-1;B>u;B--){var U=n[B].maxBitrate;if(k=o*U/(8*.8*v),k<I)break}if(!(k>=S)){var W=this.bwEstimator.getEstimate();_.logger.warn("Fragment "+f.sn+(e?" part "+e.index:"")+" of level "+f.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+B+`
9
9
  Current BW estimate: `+(Object(P.isFiniteNumber)(W)?(W/1024).toFixed(3):"Unknown")+` Kb/s
10
10
  Estimated load time for current fragment: `+S.toFixed(3)+` s
@@ -16,9 +16,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
16
16
  contiguous: `+Y+`
17
17
  accurateTimeOffset: `+c+`
18
18
  timeOffset: `+T+`
19
- initSegmentChange: `+Z);var ie=new M.TransmuxConfig(h,g,s,o,n);this.configureTransmuxer(ie)}if(this.frag=i,this.part=r,S)S.postMessage({cmd:"demux",data:e,decryptdata:I,chunkMeta:t,state:q},e instanceof ArrayBuffer?[e]:[]);else if(v){var ne=v.push(e,I,t,q);Object(M.isPromise)(ne)?ne.then(function(ae){d.handleTransmuxComplete(ae)}):this.handleTransmuxComplete(ne)}},p.flush=function(e){var s=this;e.transmuxing.start=self.performance.now();var h=this.transmuxer,g=this.worker;if(g)g.postMessage({cmd:"flush",chunkMeta:e});else if(h){var i=h.flush(e);Object(M.isPromise)(i)?i.then(function(r){s.handleFlushResult(r,e)}):this.handleFlushResult(i,e)}},p.handleFlushResult=function(e,s){var h=this;e.forEach(function(g){h.handleTransmuxComplete(g)}),this.onFlush(s)},p.onWorkerMessage=function(e){var s=e.data,h=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}case"workerLog":O.logger[s.data.logType]&&O.logger[s.data.logType](s.data.message);break;default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,h.trigger(s.event,s.data);break}}},p.configureTransmuxer=function(e){var s=this.worker,h=this.transmuxer;s?s.postMessage({cmd:"configure",config:e}):h&&h.configure(e)},p.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},m}()},"./src/demux/transmuxer-worker.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return b});var P=l("./src/demux/transmuxer.ts"),L=l("./src/events.ts"),A=l("./src/utils/logger.ts"),M=l("./node_modules/eventemitter3/index.js"),O=l.n(M);function b(E){var m=new M.EventEmitter,p=function(s,h){E.postMessage({event:s,data:h})};m.on(L.Events.FRAG_DECRYPTED,p),m.on(L.Events.ERROR,p);var f=function(){var s=function(i){var r=function(c){p("workerLog",{logType:i,message:c})};A.logger[i]=r};for(var h in A.logger)s(h)};E.addEventListener("message",function(e){var s=e.data;switch(s.cmd){case"init":{var h=JSON.parse(s.config);E.transmuxer=new P.default(m,s.typeSupported,h,s.vendor,s.id),Object(A.enableLogs)(h.debug),f(),p("init",null);break}case"configure":{E.transmuxer.configure(s.config);break}case"demux":{var g=E.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(P.isPromise)(g)?g.then(function(o){_(E,o)}):_(E,g);break}case"flush":{var i=s.chunkMeta,r=E.transmuxer.flush(i);Object(P.isPromise)(r)?r.then(function(o){x(E,o,i)}):x(E,r,i);break}default:break}})}function _(E,m){if(D(m.remuxResult))return!1;var p=[],f=m.remuxResult,e=f.audio,s=f.video;return e&&y(p,e),s&&y(p,s),E.postMessage({event:"transmuxComplete",data:m},p),!0}function y(E,m){m.data1&&E.push(m.data1.buffer),m.data2&&E.push(m.data2.buffer)}function x(E,m,p){var f=m.reduce(function(e,s){return _(E,s)||e},!1);f||E.postMessage({event:"transmuxComplete",data:m[0]}),E.postMessage({event:"flush",data:p})}function D(E){return!E.audio&&!E.video&&!E.text&&!E.id3&&!E.initSegment}},"./src/demux/transmuxer.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return p}),l.d(R,"isPromise",function(){return s}),l.d(R,"TransmuxConfig",function(){return h}),l.d(R,"TransmuxState",function(){return g});var P=l("./src/events.ts"),L=l("./src/errors.ts"),A=l("./src/crypt/decrypter.ts"),M=l("./src/demux/aacdemuxer.ts"),O=l("./src/demux/mp4demuxer.ts"),b=l("./src/demux/tsdemuxer.ts"),_=l("./src/demux/mp3demuxer.ts"),y=l("./src/remux/mp4-remuxer.ts"),x=l("./src/remux/passthrough-remuxer.ts"),D=l("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch{D.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var m=[{demux:b.default,remux:y.default},{demux:O.default,remux:x.default},{demux:M.default,remux:y.default},{demux:_.default,remux:y.default}],p=function(){function i(o,c,t,n,u){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=o,this.typeSupported=c,this.config=t,this.vendor=n,this.id=u}var r=i.prototype;return r.configure=function(c){this.transmuxConfig=c,this.decrypter&&this.decrypter.reset()},r.push=function(c,t,n,u){var a=this,d=n.transmuxing;d.executeStart=E();var v=new Uint8Array(c),S=this.config,T=this.currentTransmuxState,I=this.transmuxConfig;u&&(this.currentTransmuxState=u);var k=u||T,B=k.contiguous,U=k.discontinuity,W=k.trackSwitch,G=k.accurateTimeOffset,z=k.timeOffset,Y=k.initSegmentChange,$=I.audioCodec,Z=I.videoCodec,q=I.defaultInitPts,ie=I.duration,ne=I.initSegmentData;(U||W||Y)&&this.resetInitSegment(ne,$,Z,ie),(U||Y)&&this.resetInitialTimestamp(q),B||this.resetContiguity();var ae=f(v,t);if(ae&&ae.method==="AES-128"){var te=this.getDecrypter();if(S.enableSoftwareAES){var fe=te.softwareDecrypt(v,ae.key.buffer,ae.iv.buffer);if(!fe)return d.executeEnd=E(),e(n);v=new Uint8Array(fe)}else return this.decryptionPromise=te.webCryptoDecrypt(v,ae.key.buffer,ae.iv.buffer).then(function(Ee){var me=a.push(Ee,null,n);return a.decryptionPromise=null,me}),this.decryptionPromise}this.needsProbing(v,U,W)&&this.configureTransmuxer(v,I);var de=this.transmux(v,ae,z,G,n),re=this.currentTransmuxState;return re.contiguous=!0,re.discontinuity=!1,re.trackSwitch=!1,d.executeEnd=E(),de},r.flush=function(c){var t=this,n=c.transmuxing;n.executeStart=E();var u=this.decrypter,a=this.currentTransmuxState,d=this.decryptionPromise;if(d)return d.then(function(){return t.flush(c)});var v=[],S=a.timeOffset;if(u){var T=u.flush();T&&v.push(this.push(T,null,c))}var I=this.demuxer,k=this.remuxer;if(!I||!k)return this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),n.executeEnd=E(),[e(c)];var B=I.flush(S);return s(B)?B.then(function(U){return t.flushRemux(v,U,c),v}):(this.flushRemux(v,B,c),v)},r.flushRemux=function(c,t,n){var u=t.audioTrack,a=t.videoTrack,d=t.id3Track,v=t.textTrack,S=this.currentTransmuxState,T=S.accurateTimeOffset,I=S.timeOffset;D.logger.log("[transmuxer.ts]: Flushed fragment "+n.sn+(n.part>-1?" p: "+n.part:"")+" of level "+n.level);var k=this.remuxer.remux(u,a,d,v,I,T,!0,this.id);c.push({remuxResult:k,chunkMeta:n}),n.transmuxing.executeEnd=E()},r.resetInitialTimestamp=function(c){var t=this.demuxer,n=this.remuxer;!t||!n||(t.resetTimeStamp(c),n.resetTimeStamp(c))},r.resetContiguity=function(){var c=this.demuxer,t=this.remuxer;!c||!t||(c.resetContiguity(),t.resetNextTimestamp())},r.resetInitSegment=function(c,t,n,u){var a=this.demuxer,d=this.remuxer;!a||!d||(a.resetInitSegment(c,t,n,u),d.resetInitSegment(c,t,n))},r.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},r.transmux=function(c,t,n,u,a){var d;return t&&t.method==="SAMPLE-AES"?d=this.transmuxSampleAes(c,t,n,u,a):d=this.transmuxUnencrypted(c,n,u,a),d},r.transmuxUnencrypted=function(c,t,n,u){var a=this.demuxer.demux(c,t,!1,!this.config.progressive),d=a.audioTrack,v=a.videoTrack,S=a.id3Track,T=a.textTrack,I=this.remuxer.remux(d,v,S,T,t,n,!1,this.id);return{remuxResult:I,chunkMeta:u}},r.transmuxSampleAes=function(c,t,n,u,a){var d=this;return this.demuxer.demuxSampleAes(c,t,n).then(function(v){var S=d.remuxer.remux(v.audioTrack,v.videoTrack,v.id3Track,v.textTrack,n,u,!1,d.id);return{remuxResult:S,chunkMeta:a}})},r.configureTransmuxer=function(c,t){for(var n=this.config,u=this.observer,a=this.typeSupported,d=this.vendor,v=t.audioCodec,S=t.defaultInitPts,T=t.duration,I=t.initSegmentData,k=t.videoCodec,B,U=0,W=m.length;U<W;U++)if(m[U].demux.probe(c)){B=m[U];break}B||(D.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),B={demux:O.default,remux:x.default});var G=this.demuxer,z=this.remuxer,Y=B.remux,$=B.demux;(!z||!(z instanceof Y))&&(this.remuxer=new Y(u,n,a,d)),(!G||!(G instanceof $))&&(this.demuxer=new $(u,n,a),this.probe=$.probe),this.resetInitSegment(I,v,k,T),this.resetInitialTimestamp(S)},r.needsProbing=function(c,t,n){return!this.demuxer||!this.remuxer||t||n},r.getDecrypter=function(){var c=this.decrypter;return c||(c=this.decrypter=new A.default(this.observer,this.config)),c},i}();function f(i,r){var o=null;return i.byteLength>0&&r!=null&&r.key!=null&&r.iv!==null&&r.method!=null&&(o=r),o}var e=function(r){return{remuxResult:{},chunkMeta:r}};function s(i){return"then"in i&&i.then instanceof Function}var h=function(r,o,c,t,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=r,this.videoCodec=o,this.initSegmentData=c,this.duration=t,this.defaultInitPts=n},g=function(r,o,c,t,n,u){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=r,this.contiguous=o,this.accurateTimeOffset=c,this.trackSwitch=t,this.timeOffset=n,this.initSegmentChange=u}},"./src/demux/tsdemuxer.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"discardEPB",function(){return h});var P=l("./src/demux/adts.ts"),L=l("./src/demux/mpegaudio.ts"),A=l("./src/demux/exp-golomb.ts"),M=l("./src/demux/sample-aes.ts"),O=l("./src/events.ts"),b=l("./src/utils/mp4-tools.ts"),_=l("./src/utils/logger.ts"),y=l("./src/errors.ts"),x=l("./src/types/demuxer.ts");function D(){return D=Object.assign?Object.assign.bind():function(g){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(g[o]=r[o])}return g},D.apply(this,arguments)}var E=function(){function g(r,o,c){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=r,this.config=o,this.typeSupported=c}g.probe=function(o){return o[0]===71&&o[188]===71},g.createTrack=function(o,c){return{container:o==="video"||o==="audio"?"video/mp2t":void 0,type:o,id:b.RemuxerTrackIdConfig[o],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:o==="audio"?c:void 0}};var i=g.prototype;return i.resetInitSegment=function(o,c,t,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video"),this._audioTrack=g.createTrack("audio",n),this._id3Track=g.createTrack("id3"),this._txtTrack=g.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=c,this.videoCodec=t,this._duration=n},i.resetTimeStamp=function(){},i.resetContiguity=function(){var o=this._audioTrack,c=this._avcTrack,t=this._id3Track;o&&(o.pesData=null),c&&(c.pesData=null),t&&(t.pesData=null),this.aacOverFlow=null},i.demux=function(o,c,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1),t||(this.sampleAes=null);var u,a=this._avcTrack,d=this._audioTrack,v=this._id3Track,S=this._txtTrack,T=a.pid,I=a.pesData,k=d.pid,B=v.pid,U=d.pesData,W=v.pesData,G=null,z=this.pmtParsed,Y=this._pmtId,$=o.length;if(this.remainderData&&(o=Object(b.appendUint8Array)(this.remainderData,o),$=o.length,this.remainderData=null),$<188&&!n)return this.remainderData=o,{audioTrack:d,videoTrack:a,id3Track:v,textTrack:S};$-=$%188,$<o.byteLength&&!n&&(this.remainderData=new Uint8Array(o.buffer,$,o.buffer.byteLength-$));for(var Z=0,q=0;q<$;q+=188)if(o[q]===71){var ie=!!(o[q+1]&64),ne=((o[q+1]&31)<<8)+o[q+2],ae=(o[q+3]&48)>>4,te=void 0;if(ae>1){if(te=q+5+o[q+4],te===q+188)continue}else te=q+4;switch(ne){case T:ie&&(I&&(u=e(I))&&this.parseAVCPES(a,S,u,!1),I={data:[],size:0}),I&&(I.data.push(o.subarray(te,q+188)),I.size+=q+188-te);break;case k:if(ie){if(U&&(u=e(U)))switch(d.segmentCodec){case"aac":this.parseAACPES(d,u);break;case"mp3":this.parseMPEGPES(d,u);break}U={data:[],size:0}}U&&(U.data.push(o.subarray(te,q+188)),U.size+=q+188-te);break;case B:ie&&(W&&(u=e(W))&&this.parseID3PES(v,u),W={data:[],size:0}),W&&(W.data.push(o.subarray(te,q+188)),W.size+=q+188-te);break;case 0:ie&&(te+=o[te]+1),Y=this._pmtId=p(o,te);break;case Y:{ie&&(te+=o[te]+1);var fe=f(o,te,this.typeSupported,t);T=fe.avc,T>0&&(a.pid=T),k=fe.audio,k>0&&(d.pid=k,d.segmentCodec=fe.segmentCodec),B=fe.id3,B>0&&(v.pid=B),G!==null&&!z&&(_.logger.log("unknown PID '"+G+"' in TS found"),G=null),z=this.pmtParsed=!0;break}case 17:case 8191:break;default:G=ne;break}}else Z++;Z>0&&this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:y.ErrorTypes.MEDIA_ERROR,details:y.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+Z+" TS packet/s that do not start with 0x47"}),a.pesData=I,d.pesData=U,v.pesData=W;var de={audioTrack:d,videoTrack:a,id3Track:v,textTrack:S};return n&&this.extractRemainingSamples(de),de},i.flush=function(){var o=this.remainderData;this.remainderData=null;var c;return o?c=this.demux(o,-1,!1,!0):c={videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},i.extractRemainingSamples=function(o){var c=o.audioTrack,t=o.videoTrack,n=o.id3Track,u=o.textTrack,a=t.pesData,d=c.pesData,v=n.pesData,S;if(a&&(S=e(a))?(this.parseAVCPES(t,u,S,!0),t.pesData=null):t.pesData=a,d&&(S=e(d))){switch(c.segmentCodec){case"aac":this.parseAACPES(c,S);break;case"mp3":this.parseMPEGPES(c,S);break}c.pesData=null}else d!=null&&d.size&&_.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=d;v&&(S=e(v))?(this.parseID3PES(n,S),n.pesData=null):n.pesData=v},i.demuxSampleAes=function(o,c,t){var n=this.demux(o,t,!0,!this.config.progressive),u=this.sampleAes=new M.default(this.observer,this.config,c);return this.decrypt(n,u)},i.decrypt=function(o,c){return new Promise(function(t){var n=o.audioTrack,u=o.videoTrack;n.samples&&n.segmentCodec==="aac"?c.decryptAacSamples(n.samples,0,function(){u.samples?c.decryptAvcSamples(u.samples,0,0,function(){t(o)}):t(o)}):u.samples&&c.decryptAvcSamples(u.samples,0,0,function(){t(o)})})},i.destroy=function(){this._duration=0},i.parseAVCPES=function(o,c,t,n){var u=this,a=this.parseAVCNALu(o,t.data),d=!1,v=this.avcSample,S,T=!1;t.data=null,v&&a.length&&!o.audFound&&(s(v,o),v=this.avcSample=m(!1,t.pts,t.dts,"")),a.forEach(function(I){switch(I.type){case 1:{S=!0,v||(v=u.avcSample=m(!0,t.pts,t.dts,"")),d&&(v.debug+="NDR "),v.frame=!0;var k=I.data;if(T&&k.length>4){var B=new A.default(k).readSliceType();(B===2||B===4||B===7||B===9)&&(v.key=!0)}break}case 5:S=!0,v||(v=u.avcSample=m(!0,t.pts,t.dts,"")),d&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{S=!0,d&&v&&(v.debug+="SEI "),Object(b.parseSEIMessageFromNALu)(h(I.data),t.pts,c.samples);break}case 7:if(S=!0,T=!0,d&&v&&(v.debug+="SPS "),!o.sps){var U=new A.default(I.data),W=U.readSPS();o.width=W.width,o.height=W.height,o.pixelRatio=W.pixelRatio,o.sps=[I.data],o.duration=u._duration;for(var G=I.data.subarray(1,4),z="avc1.",Y=0;Y<3;Y++){var $=G[Y].toString(16);$.length<2&&($="0"+$),z+=$}o.codec=z}break;case 8:S=!0,d&&v&&(v.debug+="PPS "),o.pps||(o.pps=[I.data]);break;case 9:S=!1,o.audFound=!0,v&&s(v,o),v=u.avcSample=m(!1,t.pts,t.dts,d?"AUD ":"");break;case 12:S=!0;break;default:S=!1,v&&(v.debug+="unknown NAL "+I.type+" ");break}if(v&&S){var Z=v.units;Z.push(I)}}),n&&v&&(s(v,o),this.avcSample=null)},i.getLastNalUnit=function(o){var c,t=this.avcSample,n;if((!t||t.units.length===0)&&(t=o[o.length-1]),(c=t)!==null&&c!==void 0&&c.units){var u=t.units;n=u[u.length-1]}return n},i.parseAVCNALu=function(o,c){var t=c.byteLength,n=o.naluState||0,u=n,a=[],d=0,v,S,T,I=-1,k=0;for(n===-1&&(I=0,k=c[0]&31,n=0,d=1);d<t;){if(v=c[d++],!n){n=v?0:1;continue}if(n===1){n=v?0:2;continue}if(!v)n=3;else if(v===1){if(I>=0){var B={data:c.subarray(I,d-n-1),type:k};a.push(B)}else{var U=this.getLastNalUnit(o.samples);if(U&&(u&&d<=4-u&&U.state&&(U.data=U.data.subarray(0,U.data.byteLength-u)),S=d-n-1,S>0)){var W=new Uint8Array(U.data.byteLength+S);W.set(U.data,0),W.set(c.subarray(0,S),U.data.byteLength),U.data=W,U.state=0}}d<t?(T=c[d]&31,I=d,k=T,n=0):n=-1}else n=0}if(I>=0&&n>=0){var G={data:c.subarray(I,t),type:k,state:n};a.push(G)}if(a.length===0){var z=this.getLastNalUnit(o.samples);if(z){var Y=new Uint8Array(z.data.byteLength+c.byteLength);Y.set(z.data,0),Y.set(c,z.data.byteLength),z.data=Y}}return o.naluState=n,a},i.parseAACPES=function(o,c){var t=0,n=this.aacOverFlow,u=c.data;if(n){this.aacOverFlow=null;var a=n.missing,d=n.sample.unit.byteLength;if(a===-1){var v=new Uint8Array(d+u.byteLength);v.set(n.sample.unit,0),v.set(u,d),u=v}else{var S=d-a;n.sample.unit.set(u.subarray(0,a),S),o.samples.push(n.sample),t=n.missing}}var T,I;for(T=t,I=u.length;T<I-1&&!P.isHeader(u,T);T++);if(T!==t){var k,B;if(T<I-1?(k="AAC PES did not start with ADTS header,offset:"+T,B=!1):(k="no ADTS header found in AAC PES",B=!0),_.logger.warn("parsing error:"+k),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:y.ErrorTypes.MEDIA_ERROR,details:y.ErrorDetails.FRAG_PARSING_ERROR,fatal:B,reason:k}),B)return}P.initTrackConfig(o,this.observer,u,T,this.audioCodec);var U;if(c.pts!==void 0)U=c.pts;else if(n){var W=P.getFrameDuration(o.samplerate);U=n.sample.pts+W}else{_.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var G=0,z;T<I;)if(z=P.appendFrame(o,u,T,U,G),T+=z.length,z.missing){this.aacOverFlow=z;break}else for(G++;T<I-1&&!P.isHeader(u,T);T++);},i.parseMPEGPES=function(o,c){var t=c.data,n=t.length,u=0,a=0,d=c.pts;if(d===void 0){_.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<n;)if(L.isHeader(t,a)){var v=L.appendFrame(o,t,a,d,u);if(v)a+=v.length,u++;else break}else a++},i.parseID3PES=function(o,c){if(c.pts===void 0){_.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}var t=D({},c,{type:this._avcTrack?x.MetadataSchema.emsg:x.MetadataSchema.audioId3});o.samples.push(t)},g}();function m(g,i,r,o){return{key:g,frame:!1,pts:i,dts:r,units:[],debug:o,length:0}}function p(g,i){return(g[i+10]&31)<<8|g[i+11]}function f(g,i,r,o){var c={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},t=(g[i+1]&15)<<8|g[i+2],n=i+3+t-4,u=(g[i+10]&15)<<8|g[i+11];for(i+=12+u;i<n;){var a=(g[i+1]&31)<<8|g[i+2];switch(g[i]){case 207:if(!o){_.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=a);break;case 21:c.id3===-1&&(c.id3=a);break;case 219:if(!o){_.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=a);break;case 3:case 4:r.mpeg!==!0&&r.mp3!==!0?_.logger.log("MPEG audio found, not supported in this browser"):c.audio===-1&&(c.audio=a,c.segmentCodec="mp3");break;case 36:_.logger.warn("Unsupported HEVC stream type found");break;default:break}i+=((g[i+3]&15)<<8|g[i+4])+5}return c}function e(g){var i=0,r,o,c,t,n,u=g.data;if(!g||g.size===0)return null;for(;u[0].length<19&&u.length>1;){var a=new Uint8Array(u[0].length+u[1].length);a.set(u[0]),a.set(u[1],u[0].length),u[0]=a,u.splice(1,1)}r=u[0];var d=(r[0]<<16)+(r[1]<<8)+r[2];if(d===1){if(o=(r[4]<<8)+r[5],o&&o>g.size-6)return null;var v=r[7];v&192&&(t=(r[9]&14)*536870912+(r[10]&255)*4194304+(r[11]&254)*16384+(r[12]&255)*128+(r[13]&254)/2,v&64?(n=(r[14]&14)*536870912+(r[15]&255)*4194304+(r[16]&254)*16384+(r[17]&255)*128+(r[18]&254)/2,t-n>60*9e4&&(_.logger.warn(Math.round((t-n)/9e4)+"s delta between PTS and DTS, align them"),t=n)):n=t),c=r[8];var S=c+9;if(g.size<=S)return null;g.size-=S;for(var T=new Uint8Array(g.size),I=0,k=u.length;I<k;I++){r=u[I];var B=r.byteLength;if(S)if(S>B){S-=B;continue}else r=r.subarray(S),B-=S,S=0;T.set(r,i),i+=B}return o&&(o-=c+3),{data:T,pts:t,dts:n,len:o}}return null}function s(g,i){if(g.units.length&&g.frame){if(g.pts===void 0){var r=i.samples,o=r.length;if(o){var c=r[o-1];g.pts=c.pts,g.dts=c.dts}else{i.dropped++;return}}i.samples.push(g)}g.debug.length&&_.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function h(g){for(var i=g.byteLength,r=[],o=1;o<i-2;)g[o]===0&&g[o+1]===0&&g[o+2]===3?(r.push(o+2),o+=2):o++;if(r.length===0)return g;var c=i-r.length,t=new Uint8Array(c),n=0;for(o=0;o<c;n++,o++)n===r[0]&&(n++,r.shift()),t[o]=g[n];return t}R.default=E},"./src/errors.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"ErrorTypes",function(){return P}),l.d(R,"ErrorDetails",function(){return L});var P;(function(A){A.NETWORK_ERROR="networkError",A.MEDIA_ERROR="mediaError",A.KEY_SYSTEM_ERROR="keySystemError",A.MUX_ERROR="muxError",A.OTHER_ERROR="otherError"})(P||(P={}));var L;(function(A){A.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",A.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",A.KEY_SYSTEM_NO_SESSION="keySystemNoSession",A.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",A.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",A.MANIFEST_LOAD_ERROR="manifestLoadError",A.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",A.MANIFEST_PARSING_ERROR="manifestParsingError",A.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",A.LEVEL_EMPTY_ERROR="levelEmptyError",A.LEVEL_LOAD_ERROR="levelLoadError",A.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",A.LEVEL_SWITCH_ERROR="levelSwitchError",A.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",A.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",A.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",A.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",A.FRAG_LOAD_ERROR="fragLoadError",A.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",A.FRAG_DECRYPT_ERROR="fragDecryptError",A.FRAG_PARSING_ERROR="fragParsingError",A.REMUX_ALLOC_ERROR="remuxAllocError",A.KEY_LOAD_ERROR="keyLoadError",A.KEY_LOAD_TIMEOUT="keyLoadTimeOut",A.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",A.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",A.BUFFER_APPEND_ERROR="bufferAppendError",A.BUFFER_APPENDING_ERROR="bufferAppendingError",A.BUFFER_STALLED_ERROR="bufferStalledError",A.BUFFER_FULL_ERROR="bufferFullError",A.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",A.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",A.INTERNAL_EXCEPTION="internalException",A.INTERNAL_ABORTED="aborted",A.UNKNOWN="unknown"})(L||(L={}))},"./src/events.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"Events",function(){return P});var P;(function(L){L.MEDIA_ATTACHING="hlsMediaAttaching",L.MEDIA_ATTACHED="hlsMediaAttached",L.MEDIA_DETACHING="hlsMediaDetaching",L.MEDIA_DETACHED="hlsMediaDetached",L.BUFFER_RESET="hlsBufferReset",L.BUFFER_CODECS="hlsBufferCodecs",L.BUFFER_CREATED="hlsBufferCreated",L.BUFFER_APPENDING="hlsBufferAppending",L.BUFFER_APPENDED="hlsBufferAppended",L.BUFFER_EOS="hlsBufferEos",L.BUFFER_FLUSHING="hlsBufferFlushing",L.BUFFER_FLUSHED="hlsBufferFlushed",L.MANIFEST_LOADING="hlsManifestLoading",L.MANIFEST_LOADED="hlsManifestLoaded",L.MANIFEST_PARSED="hlsManifestParsed",L.LEVEL_SWITCHING="hlsLevelSwitching",L.LEVEL_SWITCHED="hlsLevelSwitched",L.LEVEL_LOADING="hlsLevelLoading",L.LEVEL_LOADED="hlsLevelLoaded",L.LEVEL_UPDATED="hlsLevelUpdated",L.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",L.LEVELS_UPDATED="hlsLevelsUpdated",L.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",L.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",L.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",L.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",L.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",L.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",L.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",L.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",L.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",L.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",L.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",L.CUES_PARSED="hlsCuesParsed",L.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",L.INIT_PTS_FOUND="hlsInitPtsFound",L.FRAG_LOADING="hlsFragLoading",L.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",L.FRAG_LOADED="hlsFragLoaded",L.FRAG_DECRYPTED="hlsFragDecrypted",L.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",L.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",L.FRAG_PARSING_METADATA="hlsFragParsingMetadata",L.FRAG_PARSED="hlsFragParsed",L.FRAG_BUFFERED="hlsFragBuffered",L.FRAG_CHANGED="hlsFragChanged",L.FPS_DROP="hlsFpsDrop",L.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",L.ERROR="hlsError",L.DESTROYING="hlsDestroying",L.KEY_LOADING="hlsKeyLoading",L.KEY_LOADED="hlsKeyLoaded",L.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",L.BACK_BUFFER_REACHED="hlsBackBufferReached"})(P||(P={}))},"./src/hls.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return i});var P=l("./node_modules/url-toolkit/src/url-toolkit.js"),L=l.n(P),A=l("./src/loader/playlist-loader.ts"),M=l("./src/loader/key-loader.ts"),O=l("./src/controller/id3-track-controller.ts"),b=l("./src/controller/latency-controller.ts"),_=l("./src/controller/level-controller.ts"),y=l("./src/controller/fragment-tracker.ts"),x=l("./src/controller/stream-controller.ts"),D=l("./src/is-supported.ts"),E=l("./src/utils/logger.ts"),m=l("./src/config.ts"),p=l("./node_modules/eventemitter3/index.js"),f=l.n(p),e=l("./src/events.ts"),s=l("./src/errors.ts");function h(r,o){for(var c=0;c<o.length;c++){var t=o[c];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,t.key,t)}}function g(r,o,c){return o&&h(r.prototype,o),c&&h(r,c),Object.defineProperty(r,"prototype",{writable:!1}),r}var i=function(){r.isSupported=function(){return Object(D.isSupported)()};function r(c){c===void 0&&(c={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var t=this.config=Object(m.mergeConfig)(r.DefaultConfig,c);this.userConfig=c,Object(E.enableLogs)(t.debug),this._autoLevelCapping=-1,t.progressive&&Object(m.enableStreamingMode)(t);var n=t.abrController,u=t.bufferController,a=t.capLevelController,d=t.fpsController,v=this.abrController=new n(this),S=this.bufferController=new u(this),T=this.capLevelController=new a(this),I=new d(this),k=new A.default(this),B=new M.default(this),U=new O.default(this),W=this.levelController=new _.default(this),G=new y.FragmentTracker(this),z=this.streamController=new x.default(this,G);T.setStreamController(z),I.setStreamController(z);var Y=[k,B,W,z];this.networkControllers=Y;var $=[v,S,T,I,U,G];this.audioTrackController=this.createController(t.audioTrackController,null,Y),this.createController(t.audioStreamController,G,Y),this.subtitleTrackController=this.createController(t.subtitleTrackController,null,Y),this.createController(t.subtitleStreamController,G,Y),this.createController(t.timelineController,null,$),this.emeController=this.createController(t.emeController,null,$),this.cmcdController=this.createController(t.cmcdController,null,$),this.latencyController=this.createController(b.default,null,$),this.coreComponents=$}var o=r.prototype;return o.createController=function(t,n,u){if(t){var a=n?new t(this,n):new t(this);return u&&u.push(a),a}return null},o.on=function(t,n,u){u===void 0&&(u=this),this._emitter.on(t,n,u)},o.once=function(t,n,u){u===void 0&&(u=this),this._emitter.once(t,n,u)},o.removeAllListeners=function(t){this._emitter.removeAllListeners(t)},o.off=function(t,n,u,a){u===void 0&&(u=this),this._emitter.off(t,n,u,a)},o.listeners=function(t){return this._emitter.listeners(t)},o.emit=function(t,n,u){return this._emitter.emit(t,n,u)},o.trigger=function(t,n){if(this.config.debug)return this.emit(t,t,n);try{return this.emit(t,t,n)}catch(u){E.logger.error("An internal error happened while handling event "+t+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(e.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:t,error:u})}return!1},o.listenerCount=function(t){return this._emitter.listenerCount(t)},o.destroy=function(){E.logger.log("destroy"),this.trigger(e.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(t){return t.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(t){return t.destroy()}),this.coreComponents.length=0},o.attachMedia=function(t){E.logger.log("attachMedia"),this._media=t,this.trigger(e.Events.MEDIA_ATTACHING,{media:t})},o.detachMedia=function(){E.logger.log("detachMedia"),this.trigger(e.Events.MEDIA_DETACHING,void 0),this._media=null},o.loadSource=function(t){this.stopLoad();var n=this.media,u=this.url,a=this.url=P.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});E.logger.log("loadSource:"+a),n&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(n)),this.trigger(e.Events.MANIFEST_LOADING,{url:t})},o.startLoad=function(t){t===void 0&&(t=-1),E.logger.log("startLoad("+t+")"),this.networkControllers.forEach(function(n){n.startLoad(t)})},o.stopLoad=function(){E.logger.log("stopLoad"),this.networkControllers.forEach(function(t){t.stopLoad()})},o.swapAudioCodec=function(){E.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},o.recoverMediaError=function(){E.logger.log("recoverMediaError");var t=this._media;this.detachMedia(),t&&this.attachMedia(t)},o.removeLevel=function(t,n){n===void 0&&(n=0),this.levelController.removeLevel(t,n)},g(r,[{key:"levels",get:function(){var t=this.levelController.levels;return t||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){E.logger.log("set currentLevel:"+t),this.loadLevel=t,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){E.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){E.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){E.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){E.logger.log("set startLevel:"+t),t!==-1&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(t){var n=!!t;n!==this.config.capLevelToPlayerSize&&(n?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=n)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){this._autoLevelCapping!==t&&(E.logger.log("set autoLevelCapping:"+t),this._autoLevelCapping=t)}},{key:"bandwidthEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var t=this.levels,n=this.config.minAutoBitrate;if(!t)return 0;for(var u=t.length,a=0;a<u;a++)if(t[a].maxBitrate>=n)return a;return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,n=this.autoLevelCapping,u;return n===-1&&t&&t.length?u=t.length-1:u=n,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var n=this.audioTrackController;n&&(n.audioTrack=t)}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var n=this.subtitleTrackController;n&&(n.subtitleTrack=t)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return t?t.subtitleDisplay:!1},set:function(t){var n=this.subtitleTrackController;n&&(n.subtitleDisplay=t)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(t){this.config.lowLatencyMode=t}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.2.3"}},{key:"Events",get:function(){return e.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return r.defaultConfig?r.defaultConfig:m.hlsDefaultConfig},set:function(t){r.defaultConfig=t}}]),r}();i.defaultConfig=void 0},"./src/is-supported.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"isSupported",function(){return A}),l.d(R,"changeTypeSupported",function(){return M});var P=l("./src/utils/mediasource-helper.ts");function L(){return self.SourceBuffer||self.WebKitSourceBuffer}function A(){var O=Object(P.getMediaSource)();if(!O)return!1;var b=L(),_=O&&typeof O.isTypeSupported=="function"&&O.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!b||b.prototype&&typeof b.prototype.appendBuffer=="function"&&typeof b.prototype.remove=="function";return!!_&&!!y}function M(){var O,b=L();return typeof(b==null||(O=b.prototype)===null||O===void 0?void 0:O.changeType)=="function"}},"./src/loader/date-range.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"DateRangeAttribute",function(){return _}),l.d(R,"DateRange",function(){return y});var P=l("./src/polyfills/number.ts"),L=l("./src/utils/attr-list.ts"),A=l("./src/utils/logger.ts");function M(){return M=Object.assign?Object.assign.bind():function(x){for(var D=1;D<arguments.length;D++){var E=arguments[D];for(var m in E)Object.prototype.hasOwnProperty.call(E,m)&&(x[m]=E[m])}return x},M.apply(this,arguments)}function O(x,D){for(var E=0;E<D.length;E++){var m=D[E];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(x,m.key,m)}}function b(x,D,E){return D&&O(x.prototype,D),E&&O(x,E),Object.defineProperty(x,"prototype",{writable:!1}),x}var _;(function(x){x.ID="ID",x.CLASS="CLASS",x.START_DATE="START-DATE",x.DURATION="DURATION",x.END_DATE="END-DATE",x.END_ON_NEXT="END-ON-NEXT",x.PLANNED_DURATION="PLANNED-DURATION",x.SCTE35_OUT="SCTE35-OUT",x.SCTE35_IN="SCTE35-IN"})(_||(_={}));var y=function(){function x(D,E){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,E){var m=E.attr;for(var p in m)if(Object.prototype.hasOwnProperty.call(D,p)&&D[p]!==m[p]){A.logger.warn('DATERANGE tag attribute: "'+p+'" does not match for tags with ID: "'+D.ID+'"'),this._badValueForSameId=p;break}D=M(new L.AttrList({}),m,D)}if(this.attr=D,this._startDate=new Date(D[_.START_DATE]),_.END_DATE in this.attr){var f=new Date(this.attr[_.END_DATE]);Object(P.isFiniteNumber)(f.getTime())&&(this._endDate=f)}}return b(x,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){if(this._endDate)return this._endDate;var E=this.duration;return E!==null?new Date(this._startDate.getTime()+E*1e3):null}},{key:"duration",get:function(){if(_.DURATION in this.attr){var E=this.attr.decimalFloatingPoint(_.DURATION);if(Object(P.isFiniteNumber)(E))return E}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return _.PLANNED_DURATION in this.attr?this.attr.decimalFloatingPoint(_.PLANNED_DURATION):null}},{key:"endOnNext",get:function(){return this.attr.bool(_.END_ON_NEXT)}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&Object(P.isFiniteNumber)(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),x}()},"./src/loader/fragment-loader.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return E}),l.d(R,"LoadError",function(){return p});var P=l("./src/polyfills/number.ts"),L=l("./src/errors.ts");function A(f,e){f.prototype=Object.create(e.prototype),f.prototype.constructor=f,y(f,e)}function M(f){var e=typeof Map=="function"?new Map:void 0;return M=function(h){if(h===null||!_(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(h))return e.get(h);e.set(h,g)}function g(){return O(h,arguments,x(this).constructor)}return g.prototype=Object.create(h.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),y(g,h)},M(f)}function O(f,e,s){return b()?O=Reflect.construct.bind():O=function(g,i,r){var o=[null];o.push.apply(o,i);var c=Function.bind.apply(g,o),t=new c;return r&&y(t,r.prototype),t},O.apply(null,arguments)}function b(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _(f){return Function.toString.call(f).indexOf("[native code]")!==-1}function y(f,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(h,g){return h.__proto__=g,h},y(f,e)}function x(f){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},x(f)}var D=Math.pow(2,17),E=function(){function f(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var e=f.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(h,g){var i=this,r=h.url;if(!r)return Promise.reject(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var o=this.config,c=o.fLoader,t=o.loader;return new Promise(function(n,u){i.loader&&i.loader.destroy();var a=i.loader=h.loader=c?new c(o):new t(o),d=m(h),v={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:h.sn==="initSegment"?1/0:D};h.stats=a.stats,a.load(d,v,{onSuccess:function(T,I,k,B){i.resetLoader(h,a),n({frag:h,part:null,payload:T.data,networkDetails:B})},onError:function(T,I,k){i.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:T,networkDetails:k}))},onAbort:function(T,I,k){i.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:k}))},onTimeout:function(T,I,k){i.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:k}))},onProgress:function(T,I,k,B){g&&g({frag:h,part:null,payload:k,networkDetails:B})}})})},e.loadPart=function(h,g,i){var r=this;this.abort();var o=this.config,c=o.fLoader,t=o.loader;return new Promise(function(n,u){r.loader&&r.loader.destroy();var a=r.loader=h.loader=c?new c(o):new t(o),d=m(h,g),v={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:D};g.stats=a.stats,a.load(d,v,{onSuccess:function(T,I,k,B){r.resetLoader(h,a),r.updateStatsFromPart(h,g);var U={frag:h,part:g,payload:T.data,networkDetails:B};i(U),n(U)},onError:function(T,I,k){r.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:g,response:T,networkDetails:k}))},onAbort:function(T,I,k){h.stats.aborted=g.stats.aborted,r.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:g,networkDetails:k}))},onTimeout:function(T,I,k){r.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:g,networkDetails:k}))}})})},e.updateStatsFromPart=function(h,g){var i=h.stats,r=g.stats,o=r.total;if(i.loaded+=r.loaded,o){var c=Math.round(h.duration/g.duration),t=Math.min(Math.round(i.loaded/o),c),n=c-t,u=n*Math.round(i.loaded/t);i.total=i.loaded+u}else i.total=Math.max(i.loaded,i.total);var a=i.loading,d=r.loading;a.start?a.first+=d.first-d.start:(a.start=d.start,a.first=d.first),a.end=d.end},e.resetLoader=function(h,g){h.loader=null,this.loader===g&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),g.destroy()},f}();function m(f,e){e===void 0&&(e=null);var s=e||f,h={frag:f,part:e,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},g=s.byteRangeStartOffset,i=s.byteRangeEndOffset;return Object(P.isFiniteNumber)(g)&&Object(P.isFiniteNumber)(i)&&(h.rangeStart=g,h.rangeEnd=i),h}var p=function(f){A(e,f);function e(s){for(var h,g=arguments.length,i=new Array(g>1?g-1:0),r=1;r<g;r++)i[r-1]=arguments[r];return h=f.call.apply(f,[this].concat(i))||this,h.data=void 0,h.data=s,h}return e}(M(Error))},"./src/loader/fragment.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"ElementaryStreamTypes",function(){return E}),l.d(R,"BaseSegment",function(){return m}),l.d(R,"Fragment",function(){return p}),l.d(R,"Part",function(){return f});var P=l("./src/polyfills/number.ts"),L=l("./node_modules/url-toolkit/src/url-toolkit.js"),A=l.n(L),M=l("./src/utils/logger.ts"),O=l("./src/loader/level-key.ts"),b=l("./src/loader/load-stats.ts");function _(e,s){e.prototype=Object.create(s.prototype),e.prototype.constructor=e,y(e,s)}function y(e,s){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(g,i){return g.__proto__=i,g},y(e,s)}function x(e,s){for(var h=0;h<s.length;h++){var g=s[h];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(e,g.key,g)}}function D(e,s,h){return s&&x(e.prototype,s),h&&x(e,h),Object.defineProperty(e,"prototype",{writable:!1}),e}var E;(function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"})(E||(E={}));var m=function(){function e(h){var g;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(g={},g[E.AUDIO]=null,g[E.VIDEO]=null,g[E.AUDIOVIDEO]=null,g),this.baseurl=h}var s=e.prototype;return s.setByteRange=function(g,i){var r=g.split("@",2),o=[];r.length===1?o[0]=i?i.byteRangeEndOffset:0:o[0]=parseInt(r[1]),o[1]=parseInt(r[0])+o[0],this._byteRange=o},D(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(L.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(g){this._url=g}}]),e}(),p=function(e){_(s,e);function s(g,i){var r;return r=e.call(this,i)||this,r._decryptdata=null,r.rawProgramDateTime=null,r.programDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkey=void 0,r.type=void 0,r.loader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.appendedPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.stats=new b.LoadStats,r.urlId=0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.type=g,r}var h=s.prototype;return h.createInitializationVector=function(i){for(var r=new Uint8Array(16),o=12;o<16;o++)r[o]=i>>8*(15-o)&255;return r},h.setDecryptDataFromLevelKey=function(i,r){var o=i;return(i==null?void 0:i.method)==="AES-128"&&i.uri&&!i.iv&&(o=O.LevelKey.fromURI(i.uri),o.method=i.method,o.iv=this.createInitializationVector(r),o.keyFormat="identity"),o},h.setElementaryStreamInfo=function(i,r,o,c,t,n){n===void 0&&(n=!1);var u=this.elementaryStreams,a=u[i];if(!a){u[i]={startPTS:r,endPTS:o,startDTS:c,endDTS:t,partial:n};return}a.startPTS=Math.min(a.startPTS,r),a.endPTS=Math.max(a.endPTS,o),a.startDTS=Math.min(a.startDTS,c),a.endDTS=Math.max(a.endDTS,t)},h.clearElementaryStreamInfo=function(){var i=this.elementaryStreams;i[E.AUDIO]=null,i[E.VIDEO]=null,i[E.AUDIOVIDEO]=null},D(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var i=this.sn;typeof i!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&M.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),i=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,i)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!Object(P.isFiniteNumber)(this.programDateTime))return null;var i=Object(P.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+i*1e3}},{key:"encrypted",get:function(){var i;return!!((i=this.decryptdata)!==null&&i!==void 0&&i.keyFormat&&this.decryptdata.uri)}}]),s}(m),f=function(e){_(s,e);function s(h,g,i,r,o){var c;c=e.call(this,i)||this,c.fragOffset=0,c.duration=0,c.gap=!1,c.independent=!1,c.relurl=void 0,c.fragment=void 0,c.index=void 0,c.stats=new b.LoadStats,c.duration=h.decimalFloatingPoint("DURATION"),c.gap=h.bool("GAP"),c.independent=h.bool("INDEPENDENT"),c.relurl=h.enumeratedString("URI"),c.fragment=g,c.index=r;var t=h.enumeratedString("BYTERANGE");return t&&c.setByteRange(t,o),o&&(c.fragOffset=o.fragOffset+o.duration),c}return D(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var g=this.elementaryStreams;return!!(g.audio||g.video||g.audiovideo)}}]),s}(m)},"./src/loader/key-loader.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return M});var P=l("./src/events.ts"),L=l("./src/errors.ts"),A=l("./src/utils/logger.ts"),M=function(){function O(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this.registerListeners()}var b=O.prototype;return b.startLoad=function(y){},b.stopLoad=function(){this.destroyInternalLoaders()},b.registerListeners=function(){this.hls.on(P.Events.KEY_LOADING,this.onKeyLoading,this)},b.unregisterListeners=function(){this.hls.off(P.Events.KEY_LOADING,this.onKeyLoading)},b.destroyInternalLoaders=function(){for(var y in this.loaders){var x=this.loaders[y];x&&x.destroy()}this.loaders={}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onKeyLoading=function(y,x){var D=x.frag,E=D.type,m=this.loaders[E];if(!D.decryptdata){A.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var p=D.decryptdata.uri;if(p!==this.decrypturl||this.decryptkey===null){var f=this.hls.config;if(m&&(A.logger.warn("abort previous key loader for type:"+E),m.abort()),!p){A.logger.warn("key uri is falsy");return}var e=f.loader,s=D.loader=this.loaders[E]=new e(f);this.decrypturl=p,this.decryptkey=null;var h={url:p,frag:D,responseType:"arraybuffer"},g={timeout:f.fragLoadingTimeOut,maxRetry:0,retryDelay:f.fragLoadingRetryDelay,maxRetryDelay:f.fragLoadingMaxRetryTimeout,highWaterMark:0},i={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(h,g,i)}else this.decryptkey&&(D.decryptdata.key=this.decryptkey,this.hls.trigger(P.Events.KEY_LOADED,{frag:D}))},b.loadsuccess=function(y,x,D){var E=D.frag;if(!E.decryptdata){A.logger.error("after key load, decryptdata unset");return}this.decryptkey=E.decryptdata.key=new Uint8Array(y.data),E.loader=null,delete this.loaders[E.type],this.hls.trigger(P.Events.KEY_LOADED,{frag:E})},b.loaderror=function(y,x){var D=x.frag,E=D.loader;E&&E.abort(),delete this.loaders[D.type],this.hls.trigger(P.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:D,response:y})},b.loadtimeout=function(y,x){var D=x.frag,E=D.loader;E&&E.abort(),delete this.loaders[D.type],this.hls.trigger(P.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:D})},O}()},"./src/loader/level-details.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"LevelDetails",function(){return O});var P=l("./src/polyfills/number.ts");function L(b,_){for(var y=0;y<_.length;y++){var x=_[y];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(b,x.key,x)}}function A(b,_,y){return _&&L(b.prototype,_),y&&L(b,y),Object.defineProperty(b,"prototype",{writable:!1}),b}var M=10,O=function(){function b(y){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.dateRanges={},this.url=y}var _=b.prototype;return _.reloaded=function(x){if(!x){this.advanced=!0,this.updated=!0;return}var D=this.lastPartSn-x.lastPartSn,E=this.lastPartIndex-x.lastPartIndex;this.updated=this.endSN!==x.endSN||!!E||!!D,this.advanced=this.endSN>x.endSN||D>0||D===0&&E>0,this.updated||this.advanced?this.misses=Math.floor(x.misses*.6):this.misses=x.misses+1,this.availabilityDelay=x.availabilityDelay},A(b,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(P.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||M}},{key:"drift",get:function(){var x=this.driftEndTime-this.driftStartTime;if(x>0){var D=this.driftEnd-this.driftStart;return D*1e3/x}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var x;return(x=this.fragments)!==null&&x!==void 0&&x.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),b}()},"./src/loader/level-key.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"LevelKey",function(){return O});var P=l("./node_modules/url-toolkit/src/url-toolkit.js"),L=l.n(P);function A(b,_){for(var y=0;y<_.length;y++){var x=_[y];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(b,x.key,x)}}function M(b,_,y){return _&&A(b.prototype,_),y&&A(b,y),Object.defineProperty(b,"prototype",{writable:!1}),b}var O=function(){b.fromURL=function(y,x){return new b(y,x)},b.fromURI=function(y){return new b(y)};function b(_,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(P.buildAbsoluteURL)(_,y,{alwaysNormalize:!0}):this._uri=_}return M(b,[{key:"uri",get:function(){return this._uri}}]),b}()},"./src/loader/load-stats.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"LoadStats",function(){return P});var P=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return h});var P=l("./src/polyfills/number.ts"),L=l("./node_modules/url-toolkit/src/url-toolkit.js"),A=l.n(L),M=l("./src/loader/date-range.ts"),O=l("./src/loader/fragment.ts"),b=l("./src/loader/level-details.ts"),_=l("./src/loader/level-key.ts"),y=l("./src/utils/attr-list.ts"),x=l("./src/utils/logger.ts"),D=l("./src/utils/codecs.ts"),E=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,m=/#EXT-X-MEDIA:(.*)/g,p=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),f=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),e=/\.(mp4|m4s|m4v|m4a)$/i;function s(t){var n,u;return e.test((n=(u=L.parseURL(t))===null||u===void 0?void 0:u.path)!=null?n:"")}var h=function(){function t(){}return t.findGroup=function(u,a){for(var d=0;d<u.length;d++){var v=u[d];if(v.id===a)return v}},t.convertAVC1ToAVCOTI=function(u){var a=u.split(".");if(a.length>2){var d=a.shift()+".";return d+=parseInt(a.shift()).toString(16),d+=("000"+parseInt(a.shift()).toString(16)).slice(-4),d}return u},t.resolve=function(u,a){return L.buildAbsoluteURL(a,u,{alwaysNormalize:!0})},t.parseMasterPlaylist=function(u,a){var d=[],v={},S=!1;E.lastIndex=0;for(var T;(T=E.exec(u))!=null;)if(T[1]){var I=new y.AttrList(T[1]),k={attrs:I,bitrate:I.decimalInteger("AVERAGE-BANDWIDTH")||I.decimalInteger("BANDWIDTH"),name:I.NAME,url:t.resolve(T[2],a)},B=I.decimalResolution("RESOLUTION");B&&(k.width=B.width,k.height=B.height),g((I.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=t.convertAVC1ToAVCOTI(k.videoCodec)),d.push(k)}else if(T[3]){var U=new y.AttrList(T[3]);U["DATA-ID"]&&(S=!0,v[U["DATA-ID"]]=U)}return{levels:d,sessionData:S?v:null}},t.parseMasterPlaylistMedia=function(u,a,d,v){v===void 0&&(v=[]);var S,T=[],I=0;for(m.lastIndex=0;(S=m.exec(u))!==null;){var k=new y.AttrList(S[1]);if(k.TYPE===d){var B={attrs:k,bitrate:0,id:I++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:d,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?t.resolve(k.URI,a):""};if(v.length){var U=t.findGroup(v,B.groupId)||v[0];i(B,U,"audioCodec"),i(B,U,"textCodec")}T.push(B)}}return T},t.parseLevelPlaylist=function(u,a,d,v,S){var T=new b.LevelDetails(a),I=T.fragments,k=null,B=0,U=0,W=0,G=0,z=null,Y=new O.Fragment(v,a),$,Z,q,ie=-1,ne=!1;for(p.lastIndex=0,T.m3u8=u;($=p.exec(u))!==null;){ne&&(ne=!1,Y=new O.Fragment(v,a),Y.start=W,Y.sn=B,Y.cc=G,Y.level=d,k&&(Y.initSegment=k,Y.rawProgramDateTime=k.rawProgramDateTime,k.rawProgramDateTime=null));var ae=$[1];if(ae){Y.duration=parseFloat(ae);var te=(" "+$[2]).slice(1);Y.title=te||null,Y.tagList.push(te?["INF",ae,te]:["INF",ae])}else if($[3])Object(P.isFiniteNumber)(Y.duration)&&(Y.start=W,q&&(Y.levelkey=q),Y.sn=B,Y.level=d,Y.cc=G,Y.urlId=S,I.push(Y),Y.relurl=(" "+$[3]).slice(1),o(Y,z),z=Y,W+=Y.duration,B++,U=0,ne=!0);else if($[4]){var fe=(" "+$[4]).slice(1);z?Y.setByteRange(fe,z):Y.setByteRange(fe)}else if($[5])Y.rawProgramDateTime=(" "+$[5]).slice(1),Y.tagList.push(["PROGRAM-DATE-TIME",Y.rawProgramDateTime]),ie===-1&&(ie=I.length);else{if($=$[0].match(f),!$){x.logger.warn("No matches on slow regex match for level playlist!");continue}for(Z=1;Z<$.length&&typeof $[Z]=="undefined";Z++);var de=(" "+$[Z]).slice(1),re=(" "+$[Z+1]).slice(1),Ee=$[Z+2]?(" "+$[Z+2]).slice(1):"";switch(de){case"PLAYLIST-TYPE":T.type=re.toUpperCase();break;case"MEDIA-SEQUENCE":B=T.startSN=parseInt(re);break;case"SKIP":{var me=new y.AttrList(re),Te=me.decimalInteger("SKIPPED-SEGMENTS");if(Object(P.isFiniteNumber)(Te)){T.skippedSegments=Te;for(var Me=Te;Me--;)I.unshift(null);B+=Te}var _e=me.enumeratedString("RECENTLY-REMOVED-DATERANGES");_e&&(T.recentlyRemovedDateranges=_e.split(" "));break}case"TARGETDURATION":T.targetduration=parseFloat(re);break;case"VERSION":T.version=parseInt(re);break;case"EXTM3U":break;case"ENDLIST":T.live=!1;break;case"#":(re||Ee)&&Y.tagList.push(Ee?[re,Ee]:[re]);break;case"DISCONTINUITY":G++,Y.tagList.push(["DIS"]);break;case"GAP":Y.tagList.push([de]);break;case"BITRATE":Y.tagList.push([de,re]);break;case"DATERANGE":{var ke=new y.AttrList(re),Ie=new M.DateRange(ke,T.dateRanges[ke.ID]);Ie.isValid||T.skippedSegments?T.dateRanges[Ie.id]=Ie:x.logger.warn('Ignoring invalid DATERANGE tag: "'+re+'"'),Y.tagList.push(["EXT-X-DATERANGE",re]);break}case"DISCONTINUITY-SEQUENCE":G=parseInt(re);break;case"KEY":{var Be,be=new y.AttrList(re),Ue=be.enumeratedString("METHOD"),Ke=be.URI,je=be.hexadecimalInteger("IV"),Ne=be.enumeratedString("KEYFORMATVERSIONS"),qe=be.enumeratedString("KEYID"),Fe=(Be=be.enumeratedString("KEYFORMAT"))!=null?Be:"identity",et=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(et.indexOf(Fe)>-1){x.logger.warn("Keyformat "+Fe+" is not supported from the manifest");continue}else if(Fe!=="identity")continue;Ue&&(q=_.LevelKey.fromURL(a,Ke),Ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ue)>=0&&(q.method=Ue,q.keyFormat=Fe,qe&&(q.keyID=qe),Ne&&(q.keyFormatVersions=Ne),q.iv=je));break}case"START":{var Oe=new y.AttrList(re),Pe=Oe.decimalFloatingPoint("TIME-OFFSET");Object(P.isFiniteNumber)(Pe)&&(T.startTimeOffset=Pe);break}case"MAP":{var Ve=new y.AttrList(re);if(Y.duration){var Ce=new O.Fragment(v,a);c(Ce,Ve,d,q),k=Ce,Y.initSegment=k,k.rawProgramDateTime&&!Y.rawProgramDateTime&&(Y.rawProgramDateTime=k.rawProgramDateTime)}else c(Y,Ve,d,q),k=Y,ne=!0;break}case"SERVER-CONTROL":{var Le=new y.AttrList(re);T.canBlockReload=Le.bool("CAN-BLOCK-RELOAD"),T.canSkipUntil=Le.optionalFloat("CAN-SKIP-UNTIL",0),T.canSkipDateRanges=T.canSkipUntil>0&&Le.bool("CAN-SKIP-DATERANGES"),T.partHoldBack=Le.optionalFloat("PART-HOLD-BACK",0),T.holdBack=Le.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var it=new y.AttrList(re);T.partTarget=it.decimalFloatingPoint("PART-TARGET");break}case"PART":{var We=T.partList;We||(We=T.partList=[]);var ot=U>0?We[We.length-1]:void 0,gt=U++,Xe=new O.Part(new y.AttrList(re),Y,a,gt,ot);We.push(Xe),Y.duration+=Xe.duration;break}case"PRELOAD-HINT":{var Dt=new y.AttrList(re);T.preloadHint=Dt;break}case"RENDITION-REPORT":{var mt=new y.AttrList(re);T.renditionReports=T.renditionReports||[],T.renditionReports.push(mt);break}default:x.logger.warn("line parsed but not handled: "+$);break}}}z&&!z.relurl?(I.pop(),W-=z.duration,T.partList&&(T.fragmentHint=z)):T.partList&&(o(Y,z),Y.cc=G,T.fragmentHint=Y);var nt=I.length,lt=I[0],at=I[nt-1];if(W+=T.skippedSegments*T.targetduration,W>0&&nt&&at){T.averagetargetduration=W/nt;var pt=at.sn;T.endSN=pt!=="initSegment"?pt:0,lt&&(T.startCC=lt.cc,lt.initSegment||T.fragments.every(function(vt){return vt.relurl&&s(vt.relurl)})&&(x.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Y=new O.Fragment(v,a),Y.relurl=at.relurl,Y.level=d,Y.sn="initSegment",lt.initSegment=Y,T.needSidxRanges=!0))}else T.endSN=0,T.startCC=0;return T.fragmentHint&&(W+=T.fragmentHint.duration),T.totalduration=W,T.endCC=G,ie>0&&r(I,ie),T},t}();function g(t,n){["video","audio","text"].forEach(function(u){var a=t.filter(function(v){return Object(D.isCodecType)(v,u)});if(a.length){var d=a.filter(function(v){return v.lastIndexOf("avc1",0)===0||v.lastIndexOf("mp4a",0)===0});n[u+"Codec"]=d.length>0?d[0]:a[0],t=t.filter(function(v){return a.indexOf(v)===-1})}}),n.unknownCodecs=t}function i(t,n,u){var a=n[u];a&&(t[u]=a)}function r(t,n){for(var u=t[n],a=n;a--;){var d=t[a];if(!d)return;d.programDateTime=u.programDateTime-d.duration*1e3,u=d}}function o(t,n){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):n!=null&&n.programDateTime&&(t.programDateTime=n.endProgramDateTime),Object(P.isFiniteNumber)(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}function c(t,n,u,a){t.relurl=n.URI,n.BYTERANGE&&t.setByteRange(n.BYTERANGE),t.level=u,t.sn="initSegment",a&&(t.levelkey=a),t.initSegment=null}},"./src/loader/playlist-loader.ts":function(j,R,l){"use strict";l.r(R);var P=l("./src/polyfills/number.ts"),L=l("./src/events.ts"),A=l("./src/errors.ts"),M=l("./src/utils/logger.ts"),O=l("./src/utils/mp4-tools.ts"),b=l("./src/loader/m3u8-parser.ts"),_=l("./src/types/loader.ts"),y=l("./src/utils/attr-list.ts");function x(m){var p=m.type;switch(p){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function D(m,p){var f=m.url;return(f===void 0||f.indexOf("data:")===0)&&(f=p.url),f}var E=function(){function m(f){this.hls=void 0,this.loaders=Object.create(null),this.hls=f,this.registerListeners()}var p=m.prototype;return p.startLoad=function(e){},p.stopLoad=function(){this.destroyInternalLoaders()},p.registerListeners=function(){var e=this.hls;e.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(L.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(L.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(L.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.unregisterListeners=function(){var e=this.hls;e.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(L.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(L.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(L.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.createInternalLoader=function(e){var s=this.hls.config,h=s.pLoader,g=s.loader,i=h||g,r=new i(s);return e.loader=r,this.loaders[e.type]=r,r},p.getInternalLoader=function(e){return this.loaders[e.type]},p.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},p.destroyInternalLoaders=function(){for(var e in this.loaders){var s=this.loaders[e];s&&s.destroy(),this.resetInternalLoader(e)}},p.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},p.onManifestLoading=function(e,s){var h=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},p.onLevelLoading=function(e,s){var h=s.id,g=s.level,i=s.url,r=s.deliveryDirectives;this.load({id:h,groupId:null,level:g,responseType:"text",type:_.PlaylistContextType.LEVEL,url:i,deliveryDirectives:r})},p.onAudioTrackLoading=function(e,s){var h=s.id,g=s.groupId,i=s.url,r=s.deliveryDirectives;this.load({id:h,groupId:g,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:i,deliveryDirectives:r})},p.onSubtitleTrackLoading=function(e,s){var h=s.id,g=s.groupId,i=s.url,r=s.deliveryDirectives;this.load({id:h,groupId:g,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:i,deliveryDirectives:r})},p.load=function(e){var s,h=this.hls.config,g=this.getInternalLoader(e);if(g){var i=g.context;if(i&&i.url===e.url){M.logger.trace("[playlist-loader]: playlist request ongoing");return}M.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),g.abort()}var r,o,c,t;switch(e.type){case _.PlaylistContextType.MANIFEST:r=h.manifestLoadingMaxRetry,o=h.manifestLoadingTimeOut,c=h.manifestLoadingRetryDelay,t=h.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:r=0,o=h.levelLoadingTimeOut;break;default:r=h.levelLoadingMaxRetry,o=h.levelLoadingTimeOut,c=h.levelLoadingRetryDelay,t=h.levelLoadingMaxRetryTimeout;break}if(g=this.createInternalLoader(e),(s=e.deliveryDirectives)!==null&&s!==void 0&&s.part){var n;if(e.type===_.PlaylistContextType.LEVEL&&e.level!==null?n=this.hls.levels[e.level].details:e.type===_.PlaylistContextType.AUDIO_TRACK&&e.id!==null?n=this.hls.audioTracks[e.id].details:e.type===_.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(n=this.hls.subtitleTracks[e.id].details),n){var u=n.partTarget,a=n.targetduration;u&&a&&(o=Math.min(Math.max(u*3,a*.8)*1e3,o))}}var d={timeout:o,maxRetry:r,retryDelay:c,maxRetryDelay:t,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};g.load(e,d,v)},p.loadsuccess=function(e,s,h,g){if(g===void 0&&(g=null),h.isSidxRequest){this.handleSidxRequest(e,h),this.handlePlaylistLoaded(e,s,h,g);return}this.resetInternalLoader(h.type);var i=e.data;if(i.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(e,h,"no EXTM3U delimiter",g);return}s.parsing.start=performance.now(),i.indexOf("#EXTINF:")>0||i.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,s,h,g):this.handleMasterPlaylist(e,s,h,g)},p.loaderror=function(e,s,h){h===void 0&&(h=null),this.handleNetworkError(s,h,!1,e)},p.loadtimeout=function(e,s,h){h===void 0&&(h=null),this.handleNetworkError(s,h,!0)},p.handleMasterPlaylist=function(e,s,h,g){var i=this.hls,r=e.data,o=D(e,h),c=b.default.parseMasterPlaylist(r,o),t=c.levels,n=c.sessionData;if(!t.length){this.handleManifestParsingError(e,h,"no level found in manifest",g);return}var u=t.map(function(I){return{id:I.attrs.AUDIO,audioCodec:I.audioCodec}}),a=t.map(function(I){return{id:I.attrs.SUBTITLES,textCodec:I.textCodec}}),d=b.default.parseMasterPlaylistMedia(r,o,"AUDIO",u),v=b.default.parseMasterPlaylistMedia(r,o,"SUBTITLES",a),S=b.default.parseMasterPlaylistMedia(r,o,"CLOSED-CAPTIONS");if(d.length){var T=d.some(function(I){return!I.url});!T&&t[0].audioCodec&&!t[0].attrs.AUDIO&&(M.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),d.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}i.trigger(L.Events.MANIFEST_LOADED,{levels:t,audioTracks:d,subtitles:v,captions:S,url:o,stats:s,networkDetails:g,sessionData:n})},p.handleTrackOrLevelPlaylist=function(e,s,h,g){var i=this.hls,r=h.id,o=h.level,c=h.type,t=D(e,h),n=Object(P.isFiniteNumber)(r)?r:0,u=Object(P.isFiniteNumber)(o)?o:n,a=x(h),d=b.default.parseLevelPlaylist(e.data,t,u,a,n);if(!d.fragments.length){i.trigger(L.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:t,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(c===_.PlaylistContextType.MANIFEST){var v={attrs:new y.AttrList({}),bitrate:0,details:d,name:"",url:t};i.trigger(L.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:t,stats:s,networkDetails:g,sessionData:null})}if(s.parsing.end=performance.now(),d.needSidxRanges){var S,T=(S=d.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:T,isSidxRequest:!0,type:c,level:o,levelDetails:d,id:r,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=d,this.handlePlaylistLoaded(e,s,h,g)},p.handleSidxRequest=function(e,s){var h=new Uint8Array(e.data),g=Object(O.findBox)(h,["sidx"])[0];if(!!g){var i=Object(O.parseSegmentIndex)(g);if(!!i){var r=i.references,o=s.levelDetails;r.forEach(function(c,t){var n=c.info,u=o.fragments[t];if(u.byteRange.length===0&&u.setByteRange(String(1+n.end-n.start)+"@"+String(n.start)),u.initSegment){var a=Object(O.findBox)(h,["moov"])[0],d=a?a.length:null;u.initSegment.setByteRange(String(d)+"@0")}})}}},p.handleManifestParsingError=function(e,s,h,g){this.hls.trigger(L.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===_.PlaylistContextType.MANIFEST,url:e.url,reason:h,response:e,context:s,networkDetails:g})},p.handleNetworkError=function(e,s,h,g){h===void 0&&(h=!1),M.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var i=A.ErrorDetails.UNKNOWN,r=!1,o=this.getInternalLoader(e);switch(e.type){case _.PlaylistContextType.MANIFEST:i=h?A.ErrorDetails.MANIFEST_LOAD_TIMEOUT:A.ErrorDetails.MANIFEST_LOAD_ERROR,r=!0;break;case _.PlaylistContextType.LEVEL:i=h?A.ErrorDetails.LEVEL_LOAD_TIMEOUT:A.ErrorDetails.LEVEL_LOAD_ERROR,r=!1;break;case _.PlaylistContextType.AUDIO_TRACK:i=h?A.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:A.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,r=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:i=h?A.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:A.ErrorDetails.SUBTITLE_LOAD_ERROR,r=!1;break}o&&this.resetInternalLoader(e.type);var c={type:A.ErrorTypes.NETWORK_ERROR,details:i,fatal:r,url:e.url,loader:o,context:e,networkDetails:s};g&&(c.response=g),this.hls.trigger(L.Events.ERROR,c)},p.handlePlaylistLoaded=function(e,s,h,g){var i=h.type,r=h.level,o=h.id,c=h.groupId,t=h.loader,n=h.levelDetails,u=h.deliveryDirectives;if(!(n!=null&&n.targetduration)){this.handleManifestParsingError(e,h,"invalid target duration",g);return}if(!!t)switch(n.live&&(t.getCacheAge&&(n.ageHeader=t.getCacheAge()||0),(!t.getCacheAge||isNaN(n.ageHeader))&&(n.ageHeader=0)),i){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(L.Events.LEVEL_LOADED,{details:n,level:r||0,id:o||0,stats:s,networkDetails:g,deliveryDirectives:u});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(L.Events.AUDIO_TRACK_LOADED,{details:n,id:o||0,groupId:c||"",stats:s,networkDetails:g,deliveryDirectives:u});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(L.Events.SUBTITLE_TRACK_LOADED,{details:n,id:o||0,groupId:c||"",stats:s,networkDetails:g,deliveryDirectives:u});break}},m}();R.default=E},"./src/polyfills/number.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"isFiniteNumber",function(){return P}),l.d(R,"MAX_SAFE_INTEGER",function(){return L});var P=Number.isFinite||function(A){return typeof A=="number"&&isFinite(A)},L=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(j,R,l){"use strict";l.r(R);var P=function(){function L(){}return L.getSilentFrame=function(M,O){switch(M){case"mp4a.40.2":if(O===1)return new Uint8Array([0,200,0,128,35,128]);if(O===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(O===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(O===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(O===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(O===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(O===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(O===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(O===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}},L}();R.default=P},"./src/remux/mp4-generator.ts":function(j,R,l){"use strict";l.r(R);var P=Math.pow(2,32)-1,L=function(){function A(){}return A.init=function(){A.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var O;for(O in A.types)A.types.hasOwnProperty(O)&&(A.types[O]=[O.charCodeAt(0),O.charCodeAt(1),O.charCodeAt(2),O.charCodeAt(3)]);var b=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),_=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);A.HDLR_TYPES={video:b,audio:_};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]);A.STTS=A.STSC=A.STCO=x,A.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),A.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),A.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),A.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var D=new Uint8Array([105,115,111,109]),E=new Uint8Array([97,118,99,49]),m=new Uint8Array([0,0,0,1]);A.FTYP=A.box(A.types.ftyp,D,m,D,E),A.DINF=A.box(A.types.dinf,A.box(A.types.dref,y))},A.box=function(O){for(var b=8,_=arguments.length,y=new Array(_>1?_-1:0),x=1;x<_;x++)y[x-1]=arguments[x];for(var D=y.length,E=D;D--;)b+=y[D].byteLength;var m=new Uint8Array(b);for(m[0]=b>>24&255,m[1]=b>>16&255,m[2]=b>>8&255,m[3]=b&255,m.set(O,4),D=0,b=8;D<E;D++)m.set(y[D],b),b+=y[D].byteLength;return m},A.hdlr=function(O){return A.box(A.types.hdlr,A.HDLR_TYPES[O])},A.mdat=function(O){return A.box(A.types.mdat,O)},A.mdhd=function(O,b){b*=O;var _=Math.floor(b/(P+1)),y=Math.floor(b%(P+1));return A.box(A.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,_>>24,_>>16&255,_>>8&255,_&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},A.mdia=function(O){return A.box(A.types.mdia,A.mdhd(O.timescale,O.duration),A.hdlr(O.type),A.minf(O))},A.mfhd=function(O){return A.box(A.types.mfhd,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255]))},A.minf=function(O){return O.type==="audio"?A.box(A.types.minf,A.box(A.types.smhd,A.SMHD),A.DINF,A.stbl(O)):A.box(A.types.minf,A.box(A.types.vmhd,A.VMHD),A.DINF,A.stbl(O))},A.moof=function(O,b,_){return A.box(A.types.moof,A.mfhd(O),A.traf(_,b))},A.moov=function(O){for(var b=O.length,_=[];b--;)_[b]=A.trak(O[b]);return A.box.apply(null,[A.types.moov,A.mvhd(O[0].timescale,O[0].duration)].concat(_).concat(A.mvex(O)))},A.mvex=function(O){for(var b=O.length,_=[];b--;)_[b]=A.trex(O[b]);return A.box.apply(null,[A.types.mvex].concat(_))},A.mvhd=function(O,b){b*=O;var _=Math.floor(b/(P+1)),y=Math.floor(b%(P+1)),x=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,_>>24,_>>16&255,_>>8&255,_&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return A.box(A.types.mvhd,x)},A.sdtp=function(O){var b=O.samples||[],_=new Uint8Array(4+b.length),y,x;for(y=0;y<b.length;y++)x=b[y].flags,_[y+4]=x.dependsOn<<4|x.isDependedOn<<2|x.hasRedundancy;return A.box(A.types.sdtp,_)},A.stbl=function(O){return A.box(A.types.stbl,A.stsd(O),A.box(A.types.stts,A.STTS),A.box(A.types.stsc,A.STSC),A.box(A.types.stsz,A.STSZ),A.box(A.types.stco,A.STCO))},A.avc1=function(O){var b=[],_=[],y,x,D;for(y=0;y<O.sps.length;y++)x=O.sps[y],D=x.byteLength,b.push(D>>>8&255),b.push(D&255),b=b.concat(Array.prototype.slice.call(x));for(y=0;y<O.pps.length;y++)x=O.pps[y],D=x.byteLength,_.push(D>>>8&255),_.push(D&255),_=_.concat(Array.prototype.slice.call(x));var E=A.box(A.types.avcC,new Uint8Array([1,b[3],b[4],b[5],255,224|O.sps.length].concat(b).concat([O.pps.length]).concat(_))),m=O.width,p=O.height,f=O.pixelRatio[0],e=O.pixelRatio[1];return A.box(A.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,m>>8&255,m&255,p>>8&255,p&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),E,A.box(A.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),A.box(A.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,e>>24,e>>16&255,e>>8&255,e&255])))},A.esds=function(O){var b=O.config.length;return new Uint8Array([0,0,0,0,3,23+b,0,1,0,4,15+b,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([b]).concat(O.config).concat([6,1,2]))},A.mp4a=function(O){var b=O.samplerate;return A.box(A.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,b>>8&255,b&255,0,0]),A.box(A.types.esds,A.esds(O)))},A.mp3=function(O){var b=O.samplerate;return A.box(A.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,b>>8&255,b&255,0,0]))},A.stsd=function(O){return O.type==="audio"?O.segmentCodec==="mp3"&&O.codec==="mp3"?A.box(A.types.stsd,A.STSD,A.mp3(O)):A.box(A.types.stsd,A.STSD,A.mp4a(O)):A.box(A.types.stsd,A.STSD,A.avc1(O))},A.tkhd=function(O){var b=O.id,_=O.duration*O.timescale,y=O.width,x=O.height,D=Math.floor(_/(P+1)),E=Math.floor(_%(P+1));return A.box(A.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,b>>24&255,b>>16&255,b>>8&255,b&255,0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,E>>24,E>>16&255,E>>8&255,E&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,x>>8&255,x&255,0,0]))},A.traf=function(O,b){var _=A.sdtp(O),y=O.id,x=Math.floor(b/(P+1)),D=Math.floor(b%(P+1));return A.box(A.types.traf,A.box(A.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),A.box(A.types.tfdt,new Uint8Array([1,0,0,0,x>>24,x>>16&255,x>>8&255,x&255,D>>24,D>>16&255,D>>8&255,D&255])),A.trun(O,_.length+16+20+8+16+8+8),_)},A.trak=function(O){return O.duration=O.duration||4294967295,A.box(A.types.trak,A.tkhd(O),A.mdia(O))},A.trex=function(O){var b=O.id;return A.box(A.types.trex,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},A.trun=function(O,b){var _=O.samples||[],y=_.length,x=12+16*y,D=new Uint8Array(x),E,m,p,f,e,s;for(b+=8+x,D.set([O.type==="video"?1:0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255],0),E=0;E<y;E++)m=_[E],p=m.duration,f=m.size,e=m.flags,s=m.cts,D.set([p>>>24&255,p>>>16&255,p>>>8&255,p&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,e.isLeading<<2|e.dependsOn,e.isDependedOn<<6|e.hasRedundancy<<4|e.paddingValue<<1|e.isNonSync,e.degradPrio&240<<8,e.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*E);return A.box(A.types.trun,D)},A.initSegment=function(O){A.types||A.init();var b=A.moov(O),_=new Uint8Array(A.FTYP.byteLength+b.byteLength);return _.set(A.FTYP),_.set(b,A.FTYP.byteLength),_},A}();L.types=void 0,L.HDLR_TYPES=void 0,L.STTS=void 0,L.STSC=void 0,L.STCO=void 0,L.STSZ=void 0,L.VMHD=void 0,L.SMHD=void 0,L.STSD=void 0,L.FTYP=void 0,L.DINF=void 0,R.default=L},"./src/remux/mp4-remuxer.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return e}),l.d(R,"normalizePts",function(){return s}),l.d(R,"flushTextTrackMetadataCueSamples",function(){return g}),l.d(R,"flushTextTrackUserdataCueSamples",function(){return i});var P=l("./src/polyfills/number.ts"),L=l("./src/remux/aac-helper.ts"),A=l("./src/remux/mp4-generator.ts"),M=l("./src/events.ts"),O=l("./src/errors.ts"),b=l("./src/utils/logger.ts"),_=l("./src/types/loader.ts"),y=l("./src/utils/timescale-conversion.ts");function x(){return x=Object.assign?Object.assign.bind():function(c){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(c[u]=n[u])}return c},x.apply(this,arguments)}var D=10*1e3,E=1024,m=1152,p=null,f=null,e=function(){function c(n,u,a,d){if(d===void 0&&(d=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=n,this.config=u,this.typeSupported=a,this.ISGenerated=!1,p===null){var v=navigator.userAgent||"",S=v.match(/Chrome\/(\d+)/i);p=S?parseInt(S[1]):0}if(f===null){var T=navigator.userAgent.match(/Safari\/(\d+)/i);f=T?parseInt(T[1]):0}}var t=c.prototype;return t.destroy=function(){},t.resetTimeStamp=function(u){b.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=u},t.resetNextTimestamp=function(){b.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){b.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},t.getVideoStartPts=function(u){var a=!1,d=u.reduce(function(v,S){var T=S.pts-v;return T<-4294967296?(a=!0,s(v,S.pts)):T>0?v:S.pts},u[0].pts);return a&&b.logger.debug("PTS rollover detected"),d},t.remux=function(u,a,d,v,S,T,I,k){var B,U,W,G,z,Y,$=S,Z=S,q=u.pid>-1,ie=a.pid>-1,ne=a.samples.length,ae=u.samples.length>0,te=I&&ne>0||ne>1,fe=(!q||ae)&&(!ie||te)||this.ISGenerated||I;if(fe){this.ISGenerated||(W=this.generateIS(u,a,S));var de=this.isVideoContiguous,re=-1,Ee;if(te&&(re=h(a.samples),!de&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,re>0){b.logger.warn("[mp4-remuxer]: Dropped "+re+" out of "+ne+" video samples due to a missing keyframe");var me=this.getVideoStartPts(a.samples);a.samples=a.samples.slice(re),a.dropped+=re,Z+=(a.samples[0].pts-me)/a.inputTimeScale,Ee=Z}else re===-1&&(b.logger.warn("[mp4-remuxer]: No keyframe found out of "+ne+" video samples"),Y=!1);if(this.ISGenerated){if(ae&&te){var Te=this.getVideoStartPts(a.samples),Me=s(u.samples[0].pts,Te)-Te,_e=Me/a.inputTimeScale;$+=Math.max(0,_e),Z+=Math.max(0,-_e)}if(ae){if(u.samplerate||(b.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),W=this.generateIS(u,a,S)),U=this.remuxAudio(u,$,this.isAudioContiguous,T,ie||te||k===_.PlaylistLevelType.AUDIO?Z:void 0),te){var ke=U?U.endPTS-U.startPTS:0;a.inputTimeScale||(b.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),W=this.generateIS(u,a,S)),B=this.remuxVideo(a,Z,de,ke)}}else te&&(B=this.remuxVideo(a,Z,de,0));B&&(B.firstKeyFrame=re,B.independent=re!==-1,B.firstKeyFramePTS=Ee)}}return this.ISGenerated&&(d.samples.length&&(z=g(d,S,this._initPTS,this._initDTS)),v.samples.length&&(G=i(v,S,this._initPTS))),{audio:U,video:B,initSegment:W,independent:Y,text:G,id3:z}},t.generateIS=function(u,a,d){var v=u.samples,S=a.samples,T=this.typeSupported,I={},k=!Object(P.isFiniteNumber)(this._initPTS),B="audio/mp4",U,W,G;if(k&&(U=W=1/0),u.config&&v.length){switch(u.timescale=u.samplerate,u.segmentCodec){case"mp3":T.mpeg?(B="audio/mpeg",u.codec=""):T.mp3&&(u.codec="mp3");break}I.audio={id:"audio",container:B,codec:u.codec,initSegment:u.segmentCodec==="mp3"&&T.mpeg?new Uint8Array(0):A.default.initSegment([u]),metadata:{channelCount:u.channelCount}},k&&(G=u.inputTimeScale,U=W=v[0].pts-Math.round(G*d))}if(a.sps&&a.pps&&S.length&&(a.timescale=a.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:a.codec,initSegment:A.default.initSegment([a]),metadata:{width:a.width,height:a.height}},k)){G=a.inputTimeScale;var z=this.getVideoStartPts(S),Y=Math.round(G*d);W=Math.min(W,s(S[0].dts,z)-Y),U=Math.min(U,z-Y)}if(Object.keys(I).length)return this.ISGenerated=!0,k&&(this._initPTS=U,this._initDTS=W),{tracks:I,initPTS:U,timescale:G}},t.remuxVideo=function(u,a,d,v){var S=u.inputTimeScale,T=u.samples,I=[],k=T.length,B=this._initPTS,U=this.nextAvcDts,W=8,G=this.videoSampleDuration,z,Y,$=Number.POSITIVE_INFINITY,Z=Number.NEGATIVE_INFINITY,q=!1;if(!d||U===null){var ie=a*S,ne=T[0].pts-s(T[0].dts,T[0].pts);U=ie-ne}for(var ae=0;ae<k;ae++){var te=T[ae];te.pts=s(te.pts-B,U),te.dts=s(te.dts-B,U),te.dts<T[ae>0?ae-1:ae].dts&&(q=!0)}q&&T.sort(function(Lt,Xt){var Et=Lt.dts-Xt.dts,fr=Lt.pts-Xt.pts;return Et||fr}),z=T[0].dts,Y=T[T.length-1].dts;var fe=Y-z,de=fe?Math.round(fe/(k-1)):G||u.inputTimeScale/30;if(d){var re=z-U,Ee=re>de,me=re<-1;if(Ee||me){Ee?b.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(re,!0)+" ms ("+re+"dts) hole between fragments detected, filling it"):b.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-re,!0)+" ms ("+re+"dts) overlapping between fragments detected"),z=U;var Te=T[0].pts-re;T[0].dts=z,T[0].pts=Te,b.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Te,!0)+"/"+Object(y.toMsFromMpegTsClock)(z,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(re,!0)+" ms")}}z=Math.max(0,z);for(var Me=0,_e=0,ke=0;ke<k;ke++){for(var Ie=T[ke],Be=Ie.units,be=Be.length,Ue=0,Ke=0;Ke<be;Ke++)Ue+=Be[Ke].data.length;_e+=Ue,Me+=be,Ie.length=Ue,Ie.dts=Math.max(Ie.dts,z),$=Math.min(Ie.pts,$),Z=Math.max(Ie.pts,Z)}Y=T[k-1].dts;var je=_e+4*Me+8,Ne;try{Ne=new Uint8Array(je)}catch{this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:O.ErrorTypes.MUX_ERROR,details:O.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating video mdat "+je});return}var qe=new DataView(Ne.buffer);qe.setUint32(0,je),Ne.set(A.default.types.mdat,4);for(var Fe=!1,et=Number.POSITIVE_INFINITY,Oe=Number.POSITIVE_INFINITY,Pe=Number.NEGATIVE_INFINITY,Ve=Number.NEGATIVE_INFINITY,Ce=0;Ce<k;Ce++){for(var Le=T[Ce],it=Le.units,We=0,ot=0,gt=it.length;ot<gt;ot++){var Xe=it[ot],Dt=Xe.data,mt=Xe.data.byteLength;qe.setUint32(W,mt),W+=4,Ne.set(Dt,W),W+=mt,We+=4+mt}var nt=void 0;if(Ce<k-1)G=T[Ce+1].dts-Le.dts,nt=T[Ce+1].pts-Le.pts;else{var lt=this.config,at=Ce>0?Le.dts-T[Ce-1].dts:de;if(nt=Ce>0?Le.pts-T[Ce-1].pts:de,lt.stretchShortVideoTrack&&this.nextAudioPts!==null){var pt=Math.floor(lt.maxBufferHole*S),vt=(v?$+v*S:this.nextAudioPts)-Le.pts;vt>pt?(G=vt-at,G<0?G=at:Fe=!0,b.logger.log("[mp4-remuxer]: It is approximately "+vt/90+" ms to the next segment; using duration "+G/90+" ms for the last video frame.")):G=at}else G=at}var or=Math.round(Le.pts-Le.dts);et=Math.min(et,G),Pe=Math.max(Pe,G),Oe=Math.min(Oe,nt),Ve=Math.max(Ve,nt),I.push(new r(Le.key,G,We,or))}if(I.length){if(p){if(p<70){var Pt=I[0].flags;Pt.dependsOn=2,Pt.isNonSync=0}}else if(f&&Ve-Oe<Pe-et&&de/Pe<.025&&I[0].cts===0){b.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var At=z,Qe=0,Yt=I.length;Qe<Yt;Qe++){var Ct=At+I[Qe].duration,zt=At+I[Qe].cts;if(Qe<Yt-1){var Mt=Ct+I[Qe+1].cts;I[Qe].duration=Mt-zt}else I[Qe].duration=Qe?I[Qe-1].duration:de;I[Qe].cts=0,At=Ct}}}console.assert(G!==null,"mp4SampleDuration must be computed"),G=Fe||!G?de:G,this.nextAvcDts=U=Y+G,this.videoSampleDuration=G,this.isVideoContiguous=!0;var lr=A.default.moof(u.sequenceNumber++,z,x({},u,{samples:I})),ur="video",st={data1:lr,data2:Ne,startPTS:$/S,endPTS:(Z+G)/S,startDTS:z/S,endDTS:U/S,type:ur,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:u.dropped};return u.samples=[],u.dropped=0,console.assert(Ne.length,"MDAT length must not be zero"),st},t.remuxAudio=function(u,a,d,v,S){var T=u.inputTimeScale,I=u.samplerate?u.samplerate:T,k=T/I,B=u.segmentCodec==="aac"?E:m,U=B*k,W=this._initPTS,G=u.segmentCodec==="mp3"&&this.typeSupported.mpeg,z=[],Y=S!==void 0,$=u.samples,Z=G?0:8,q=this.nextAudioPts||-1,ie=a*T;if(this.isAudioContiguous=d=d||$.length&&q>0&&(v&&Math.abs(ie-q)<9e3||Math.abs(s($[0].pts-W,ie)-q)<20*U),$.forEach(function(Xe){Xe.pts=s(Xe.pts-W,ie)}),!d||q<0){if($=$.filter(function(Xe){return Xe.pts>=0}),!$.length)return;S===0?q=0:v&&!Y?q=Math.max(0,ie):q=$[0].pts}if(u.segmentCodec==="aac")for(var ne=this.config.maxAudioFramesDrift,ae=0,te=q;ae<$.length;ae++){var fe=$[ae],de=fe.pts,re=de-te,Ee=Math.abs(1e3*re/T);if(re<=-ne*U&&Y)ae===0&&(b.logger.warn("Audio frame @ "+(de/T).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*re/T)+" ms."),this.nextAudioPts=q=te=de);else if(re>=ne*U&&Ee<D&&Y){var me=Math.round(re/U);te=de-me*U,te<0&&(me--,te+=U),ae===0&&(this.nextAudioPts=q=te),b.logger.warn("[mp4-remuxer]: Injecting "+me+" audio frame @ "+(te/T).toFixed(3)+"s due to "+Math.round(1e3*re/T)+" ms gap.");for(var Te=0;Te<me;Te++){var Me=Math.max(te,0),_e=L.default.getSilentFrame(u.manifestCodec||u.codec,u.channelCount);_e||(b.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),_e=fe.unit.subarray()),$.splice(ae,0,{unit:_e,pts:Me}),te+=U,ae++}}fe.pts=te,te+=U}for(var ke=null,Ie=null,Be,be=0,Ue=$.length;Ue--;)be+=$[Ue].unit.byteLength;for(var Ke=0,je=$.length;Ke<je;Ke++){var Ne=$[Ke],qe=Ne.unit,Fe=Ne.pts;if(Ie!==null){var et=z[Ke-1];et.duration=Math.round((Fe-Ie)/k)}else if(d&&u.segmentCodec==="aac"&&(Fe=q),ke=Fe,be>0){be+=Z;try{Be=new Uint8Array(be)}catch{this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:O.ErrorTypes.MUX_ERROR,details:O.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:be,reason:"fail allocating audio mdat "+be});return}if(!G){var Oe=new DataView(Be.buffer);Oe.setUint32(0,be),Be.set(A.default.types.mdat,4)}}else return;Be.set(qe,Z);var Pe=qe.byteLength;Z+=Pe,z.push(new r(!0,B,Pe,0)),Ie=Fe}var Ve=z.length;if(!!Ve){var Ce=z[z.length-1];this.nextAudioPts=q=Ie+k*Ce.duration;var Le=G?new Uint8Array(0):A.default.moof(u.sequenceNumber++,ke/k,x({},u,{samples:z}));u.samples=[];var it=ke/T,We=q/T,ot="audio",gt={data1:Le,data2:Be,startPTS:it,endPTS:We,startDTS:it,endDTS:We,type:ot,hasAudio:!0,hasVideo:!1,nb:Ve};return this.isAudioContiguous=!0,console.assert(Be.length,"MDAT length must not be zero"),gt}},t.remuxEmptyAudio=function(u,a,d,v){var S=u.inputTimeScale,T=u.samplerate?u.samplerate:S,I=S/T,k=this.nextAudioPts,B=(k!==null?k:v.startDTS*S)+this._initDTS,U=v.endDTS*S+this._initDTS,W=I*E,G=Math.ceil((U-B)/W),z=L.default.getSilentFrame(u.manifestCodec||u.codec,u.channelCount);if(b.logger.warn("[mp4-remuxer]: remux empty Audio"),!z){b.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],$=0;$<G;$++){var Z=B+$*W;Y.push({unit:z,pts:Z,dts:Z})}return u.samples=Y,this.remuxAudio(u,a,d,!1)},c}();function s(c,t){var n;if(t===null)return c;for(t<c?n=-8589934592:n=8589934592;Math.abs(c-t)>4294967296;)c+=n;return c}function h(c){for(var t=0;t<c.length;t++)if(c[t].key)return t;return-1}function g(c,t,n,u){var a=c.samples.length;if(!!a){for(var d=c.inputTimeScale,v=0;v<a;v++){var S=c.samples[v];S.pts=s(S.pts-n,t*d)/d,S.dts=s(S.dts-u,t*d)/d}var T=c.samples;return c.samples=[],{samples:T}}}function i(c,t,n){var u=c.samples.length;if(!!u){for(var a=c.inputTimeScale,d=0;d<u;d++){var v=c.samples[d];v.pts=s(v.pts-n,t*a)/a}c.samples.sort(function(T,I){return T.pts-I.pts});var S=c.samples;return c.samples=[],{samples:S}}}var r=function(t,n,u,a){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=n,this.size=u,this.cts=a,this.flags=new o(t)},o=function(t){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=t?2:1,this.isNonSync=t?0:1}},"./src/remux/passthrough-remuxer.ts":function(j,R,l){"use strict";l.r(R);var P=l("./src/polyfills/number.ts"),L=l("./src/remux/mp4-remuxer.ts"),A=l("./src/utils/mp4-tools.ts"),M=l("./src/loader/fragment.ts"),O=l("./src/utils/logger.ts"),b=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndTime=null}var x=y.prototype;return x.destroy=function(){},x.resetTimeStamp=function(E){this.initPTS=E,this.lastEndTime=null},x.resetNextTimestamp=function(){this.lastEndTime=null},x.resetInitSegment=function(E,m,p){this.audioCodec=m,this.videoCodec=p,this.generateInitSegment(E),this.emitInitSegment=!0},x.generateInitSegment=function(E){var m=this.audioCodec,p=this.videoCodec;if(!E||!E.byteLength){this.initTracks=void 0,this.initData=void 0;return}var f=this.initData=Object(A.parseInitSegment)(E);m||(m=_(f.audio,M.ElementaryStreamTypes.AUDIO)),p||(p=_(f.video,M.ElementaryStreamTypes.VIDEO));var e={};f.audio&&f.video?e.audiovideo={container:"video/mp4",codec:m+","+p,initSegment:E,id:"main"}:f.audio?e.audio={container:"audio/mp4",codec:m,initSegment:E,id:"audio"}:f.video?e.video={container:"video/mp4",codec:p,initSegment:E,id:"main"}:O.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=e},x.remux=function(E,m,p,f,e){var s,h=this.initPTS,g=this.lastEndTime,i={audio:void 0,video:void 0,text:f,id3:p,initSegment:void 0};Object(P.isFiniteNumber)(g)||(g=this.lastEndTime=e||0);var r=m.samples;if(!r||!r.length)return i;var o={initPTS:void 0,timescale:1},c=this.initData;if((!c||!c.length)&&(this.generateInitSegment(r),c=this.initData),!c||!c.length)return O.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),i;this.emitInitSegment&&(o.tracks=this.initTracks,this.emitInitSegment=!1);var t=Object(A.getStartDTS)(c,r);Object(P.isFiniteNumber)(h)||(this.initPTS=o.initPTS=h=t-e);var n=Object(A.getDuration)(r,c),u=E?t-h:g,a=u+n;Object(A.offsetStartDTS)(c,r,h),n>0?this.lastEndTime=a:(O.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!c.audio,v=!!c.video,S="";d&&(S+="audio"),v&&(S+="video");var T={data1:r,startPTS:u,startDTS:u,endPTS:a,endDTS:a,type:S,hasAudio:d,hasVideo:v,nb:1,dropped:0};i.audio=T.type==="audio"?T:void 0,i.video=T.type!=="audio"?T:void 0,i.initSegment=o;var I=(s=this.initPTS)!=null?s:0;return i.id3=Object(L.flushTextTrackMetadataCueSamples)(p,e,I,I),f.samples.length&&(i.text=Object(L.flushTextTrackUserdataCueSamples)(f,e,I)),i},y}();function _(y,x){var D=y==null?void 0:y.codec;return D&&D.length>4?D:D==="hvc1"||D==="hev1"?"hvc1.1.c.L120.90":D==="av01"?"av01.0.04M.08":D==="avc1"||x===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}R.default=b},"./src/task-loop.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return P});var P=function(){function L(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var A=L.prototype;return A.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},A.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},A.onHandlerDestroyed=function(){},A.hasInterval=function(){return!!this._tickInterval},A.hasNextTick=function(){return!!this._tickTimer},A.setInterval=function(O){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,O),!0)},A.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},A.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},A.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},A.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},A.doTick=function(){},L}()},"./src/types/cmcd.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"CMCDVersion",function(){return P}),l.d(R,"CMCDObjectType",function(){return L}),l.d(R,"CMCDStreamingFormat",function(){return A}),l.d(R,"CMCDStreamType",function(){return M});var P=1,L;(function(O){O.MANIFEST="m",O.AUDIO="a",O.VIDEO="v",O.MUXED="av",O.INIT="i",O.CAPTION="c",O.TIMED_TEXT="tt",O.KEY="k",O.OTHER="o"})(L||(L={}));var A;(function(O){O.DASH="d",O.HLS="h",O.SMOOTH="s",O.OTHER="o"})(A||(A={}));var M;(function(O){O.VOD="v",O.LIVE="l"})(M||(M={}))},"./src/types/demuxer.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"MetadataSchema",function(){return P});var P;(function(L){L.audioId3="org.id3",L.dateRange="com.apple.quicktime.HLS",L.emsg="https://aomedia.org/emsg/ID3"})(P||(P={}))},"./src/types/level.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"HlsSkip",function(){return A}),l.d(R,"getSkipValue",function(){return M}),l.d(R,"HlsUrlParameters",function(){return O}),l.d(R,"Level",function(){return b});function P(_,y){for(var x=0;x<y.length;x++){var D=y[x];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(_,D.key,D)}}function L(_,y,x){return y&&P(_.prototype,y),x&&P(_,x),Object.defineProperty(_,"prototype",{writable:!1}),_}var A;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(A||(A={}));function M(_,y){var x=_.canSkipUntil,D=_.canSkipDateRanges,E=_.endSN,m=y!==void 0?y-E:0;return x&&m<x?D?A.v2:A.Yes:A.No}var O=function(){function _(x,D,E){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=x,this.part=D,this.skip=E}var y=_.prototype;return y.addDirectives=function(D){var E=new self.URL(D);return this.msn!==void 0&&E.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&E.searchParams.set("_HLS_part",this.part.toString()),this.skip&&E.searchParams.set("_HLS_skip",this.skip),E.toString()},_}(),b=function(){function _(y){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(x){return x}).join(",").replace(/\.[^.,]+/g,"")}return L(_,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(x){var D=x%this.url.length;this._urlId!==D&&(this.details=void 0,this._urlId=D)}}]),_}()},"./src/types/loader.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"PlaylistContextType",function(){return P}),l.d(R,"PlaylistLevelType",function(){return L});var P;(function(A){A.MANIFEST="manifest",A.LEVEL="level",A.AUDIO_TRACK="audioTrack",A.SUBTITLE_TRACK="subtitleTrack"})(P||(P={}));var L;(function(A){A.MAIN="main",A.AUDIO="audio",A.SUBTITLE="subtitle"})(L||(L={}))},"./src/types/transmuxer.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"ChunkMetadata",function(){return P});var P=function(M,O,b,_,y,x){_===void 0&&(_=0),y===void 0&&(y=-1),x===void 0&&(x=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=L(),this.buffering={audio:L(),video:L(),audiovideo:L()},this.level=M,this.sn=O,this.id=b,this.size=_,this.part=y,this.partial=x};function L(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"AttrList",function(){return A});var P=/^(\d+)x(\d+)$/,L=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,A=function(){function M(b){typeof b=="string"&&(b=M.parseAttrList(b));for(var _ in b)b.hasOwnProperty(_)&&(this[_]=b[_])}var O=M.prototype;return O.decimalInteger=function(_){var y=parseInt(this[_],10);return y>Number.MAX_SAFE_INTEGER?1/0:y},O.hexadecimalInteger=function(_){if(this[_]){var y=(this[_]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var x=new Uint8Array(y.length/2),D=0;D<y.length/2;D++)x[D]=parseInt(y.slice(D*2,D*2+2),16);return x}else return null},O.hexadecimalIntegerAsNumber=function(_){var y=parseInt(this[_],16);return y>Number.MAX_SAFE_INTEGER?1/0:y},O.decimalFloatingPoint=function(_){return parseFloat(this[_])},O.optionalFloat=function(_,y){var x=this[_];return x?parseFloat(x):y},O.enumeratedString=function(_){return this[_]},O.bool=function(_){return this[_]==="YES"},O.decimalResolution=function(_){var y=P.exec(this[_]);if(y!==null)return{width:parseInt(y[1],10),height:parseInt(y[2],10)}},M.parseAttrList=function(_){var y,x={},D='"';for(L.lastIndex=0;(y=L.exec(_))!==null;){var E=y[2];E.indexOf(D)===0&&E.lastIndexOf(D)===E.length-1&&(E=E.slice(1,-1)),x[y[1]]=E}return x},M}()},"./src/utils/binary-search.ts":function(j,R,l){"use strict";l.r(R);var P={search:function(A,M){for(var O=0,b=A.length-1,_=null,y=null;O<=b;){_=(O+b)/2|0,y=A[_];var x=M(y);if(x>0)O=_+1;else if(x<0)b=_-1;else return y}return null}};R.default=P},"./src/utils/buffer-helper.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"BufferHelper",function(){return A});var P=l("./src/utils/logger.ts"),L={length:0,start:function(){return 0},end:function(){return 0}},A=function(){function M(){}return M.isBuffered=function(b,_){try{if(b){for(var y=M.getBuffered(b),x=0;x<y.length;x++)if(_>=y.start(x)&&_<=y.end(x))return!0}}catch{}return!1},M.bufferInfo=function(b,_,y){try{if(b){var x=M.getBuffered(b),D=[],E;for(E=0;E<x.length;E++)D.push({start:x.start(E),end:x.end(E)});return this.bufferedInfo(D,_,y)}}catch{}return{len:0,start:_,end:_,nextStart:void 0}},M.bufferedInfo=function(b,_,y){_=Math.max(0,_),b.sort(function(r,o){var c=r.start-o.start;return c||o.end-r.end});var x=[];if(y)for(var D=0;D<b.length;D++){var E=x.length;if(E){var m=x[E-1].end;b[D].start-m<y?b[D].end>m&&(x[E-1].end=b[D].end):x.push(b[D])}else x.push(b[D])}else x=b;for(var p=0,f,e=_,s=_,h=0;h<x.length;h++){var g=x[h].start,i=x[h].end;if(_+y>=g&&_<i)e=g,s=i,p=s-_;else if(_+y<g){f=g;break}}return{len:p,start:e||0,end:s||0,nextStart:f}},M.getBuffered=function(b){try{return b.buffered}catch(_){return P.logger.log("failed to get media.buffered",_),L}},M}()},"./src/utils/cea-608-parser.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"Row",function(){return s}),l.d(R,"CaptionScreen",function(){return h});var P=l("./src/utils/logger.ts"),L={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},A=function(n){var u=n;return L.hasOwnProperty(n)&&(u=L[n]),String.fromCharCode(u)},M=15,O=100,b={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},x={25:2,26:4,29:6,30:8,31:10,27:13,28:15},D=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],E;(function(t){t[t.ERROR=0]="ERROR",t[t.TEXT=1]="TEXT",t[t.WARNING=2]="WARNING",t[t.INFO=2]="INFO",t[t.DEBUG=3]="DEBUG",t[t.DATA=3]="DATA"})(E||(E={}));var m=function(){function t(){this.time=null,this.verboseLevel=E.ERROR}var n=t.prototype;return n.log=function(a,d){this.verboseLevel>=a&&P.logger.log(this.time+" ["+a+"] "+d)},t}(),p=function(n){for(var u=[],a=0;a<n.length;a++)u.push(n[a].toString(16));return u},f=function(){function t(u,a,d,v,S){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=d||!1,this.background=v||"black",this.flash=S||!1}var n=t.prototype;return n.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},n.setStyles=function(a){for(var d=["foreground","underline","italics","background","flash"],v=0;v<d.length;v++){var S=d[v];a.hasOwnProperty(S)&&(this[S]=a[S])}},n.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},n.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},n.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},n.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},t}(),e=function(){function t(u,a,d,v,S,T){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new f(a,d,v,S,T)}var n=t.prototype;return n.reset=function(){this.uchar=" ",this.penState.reset()},n.setChar=function(a,d){this.uchar=a,this.penState.copy(d)},n.setPenState=function(a){this.penState.copy(a)},n.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},n.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},n.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},t}(),s=function(){function t(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<O;a++)this.chars.push(new e);this.logger=u,this.pos=0,this.currPenState=new f}var n=t.prototype;return n.equals=function(a){for(var d=!0,v=0;v<O;v++)if(!this.chars[v].equals(a.chars[v])){d=!1;break}return d},n.copy=function(a){for(var d=0;d<O;d++)this.chars[d].copy(a.chars[d])},n.isEmpty=function(){for(var a=!0,d=0;d<O;d++)if(!this.chars[d].isEmpty()){a=!1;break}return a},n.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(E.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>O&&(this.logger.log(E.DEBUG,"Too large cursor position "+this.pos),this.pos=O)},n.moveCursor=function(a){var d=this.pos+a;if(a>1)for(var v=this.pos+1;v<d+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(d)},n.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},n.insertChar=function(a){a>=144&&this.backSpace();var d=A(a);if(this.pos>=O){this.logger.log(E.ERROR,"Cannot insert "+a.toString(16)+" ("+d+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(d,this.currPenState),this.moveCursor(1)},n.clearFromPos=function(a){var d;for(d=a;d<O;d++)this.chars[d].reset()},n.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},n.clearToEndOfRow=function(){this.clearFromPos(this.pos)},n.getTextString=function(){for(var a=[],d=!0,v=0;v<O;v++){var S=this.chars[v].uchar;S!==" "&&(d=!1),a.push(S)}return d?"":a.join("")},n.setPenStyles=function(a){this.currPenState.setStyles(a);var d=this.chars[this.pos];d.setPenState(this.currPenState)},t}(),h=function(){function t(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<M;a++)this.rows.push(new s(u));this.logger=u,this.currRow=M-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var n=t.prototype;return n.reset=function(){for(var a=0;a<M;a++)this.rows[a].clear();this.currRow=M-1},n.equals=function(a){for(var d=!0,v=0;v<M;v++)if(!this.rows[v].equals(a.rows[v])){d=!1;break}return d},n.copy=function(a){for(var d=0;d<M;d++)this.rows[d].copy(a.rows[d])},n.isEmpty=function(){for(var a=!0,d=0;d<M;d++)if(!this.rows[d].isEmpty()){a=!1;break}return a},n.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},n.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},n.insertChar=function(a){var d=this.rows[this.currRow];d.insertChar(a)},n.setPen=function(a){var d=this.rows[this.currRow];d.setPenStyles(a)},n.moveCursor=function(a){var d=this.rows[this.currRow];d.moveCursor(a)},n.setCursor=function(a){this.logger.log(E.INFO,"setCursor: "+a);var d=this.rows[this.currRow];d.setCursor(a)},n.setPAC=function(a){this.logger.log(E.INFO,"pacData = "+JSON.stringify(a));var d=a.row-1;if(this.nrRollUpRows&&d<this.nrRollUpRows-1&&(d=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==d){for(var v=0;v<M;v++)this.rows[v].clear();var S=this.currRow+1-this.nrRollUpRows,T=this.lastOutputScreen;if(T){var I=T.rows[S].cueStartTime,k=this.logger.time;if(I&&k!==null&&I<k)for(var B=0;B<this.nrRollUpRows;B++)this.rows[d-this.nrRollUpRows+B+1].copy(T.rows[S+B])}}this.currRow=d;var U=this.rows[this.currRow];if(a.indent!==null){var W=a.indent,G=Math.max(W-1,0);U.setCursor(a.indent),a.color=U.chars[G].penState.foreground}var z={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(z)},n.setBkgData=function(a){this.logger.log(E.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},n.setRollUpRows=function(a){this.nrRollUpRows=a},n.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(E.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(E.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,d=this.rows.splice(a,1)[0];d.clear(),this.rows.splice(this.currRow,0,d),this.logger.log(E.INFO,"Rolling up")},n.getDisplayText=function(a){a=a||!1;for(var d=[],v="",S=-1,T=0;T<M;T++){var I=this.rows[T].getTextString();I&&(S=T+1,a?d.push("Row "+S+": '"+I+"'"):d.push(I.trim()))}return d.length>0&&(a?v="["+d.join(" | ")+"]":v=d.join(`
19
+ initSegmentChange: `+Z);var ie=new M.TransmuxConfig(h,g,s,o,n);this.configureTransmuxer(ie)}if(this.frag=i,this.part=r,S)S.postMessage({cmd:"demux",data:e,decryptdata:I,chunkMeta:t,state:q},e instanceof ArrayBuffer?[e]:[]);else if(v){var ne=v.push(e,I,t,q);Object(M.isPromise)(ne)?ne.then(function(ae){d.handleTransmuxComplete(ae)}):this.handleTransmuxComplete(ne)}},p.flush=function(e){var s=this;e.transmuxing.start=self.performance.now();var h=this.transmuxer,g=this.worker;if(g)g.postMessage({cmd:"flush",chunkMeta:e});else if(h){var i=h.flush(e);Object(M.isPromise)(i)?i.then(function(r){s.handleFlushResult(r,e)}):this.handleFlushResult(i,e)}},p.handleFlushResult=function(e,s){var h=this;e.forEach(function(g){h.handleTransmuxComplete(g)}),this.onFlush(s)},p.onWorkerMessage=function(e){var s=e.data,h=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}case"workerLog":O.logger[s.data.logType]&&O.logger[s.data.logType](s.data.message);break;default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,h.trigger(s.event,s.data);break}}},p.configureTransmuxer=function(e){var s=this.worker,h=this.transmuxer;s?s.postMessage({cmd:"configure",config:e}):h&&h.configure(e)},p.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},m}()},"./src/demux/transmuxer-worker.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return b});var P=l("./src/demux/transmuxer.ts"),L=l("./src/events.ts"),A=l("./src/utils/logger.ts"),M=l("./node_modules/eventemitter3/index.js"),O=l.n(M);function b(E){var m=new M.EventEmitter,p=function(s,h){E.postMessage({event:s,data:h})};m.on(L.Events.FRAG_DECRYPTED,p),m.on(L.Events.ERROR,p);var f=function(){var s=function(i){var r=function(c){p("workerLog",{logType:i,message:c})};A.logger[i]=r};for(var h in A.logger)s(h)};E.addEventListener("message",function(e){var s=e.data;switch(s.cmd){case"init":{var h=JSON.parse(s.config);E.transmuxer=new P.default(m,s.typeSupported,h,s.vendor,s.id),Object(A.enableLogs)(h.debug),f(),p("init",null);break}case"configure":{E.transmuxer.configure(s.config);break}case"demux":{var g=E.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(P.isPromise)(g)?g.then(function(o){_(E,o)}):_(E,g);break}case"flush":{var i=s.chunkMeta,r=E.transmuxer.flush(i);Object(P.isPromise)(r)?r.then(function(o){x(E,o,i)}):x(E,r,i);break}default:break}})}function _(E,m){if(D(m.remuxResult))return!1;var p=[],f=m.remuxResult,e=f.audio,s=f.video;return e&&y(p,e),s&&y(p,s),E.postMessage({event:"transmuxComplete",data:m},p),!0}function y(E,m){m.data1&&E.push(m.data1.buffer),m.data2&&E.push(m.data2.buffer)}function x(E,m,p){var f=m.reduce(function(e,s){return _(E,s)||e},!1);f||E.postMessage({event:"transmuxComplete",data:m[0]}),E.postMessage({event:"flush",data:p})}function D(E){return!E.audio&&!E.video&&!E.text&&!E.id3&&!E.initSegment}},"./src/demux/transmuxer.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return p}),l.d(R,"isPromise",function(){return s}),l.d(R,"TransmuxConfig",function(){return h}),l.d(R,"TransmuxState",function(){return g});var P=l("./src/events.ts"),L=l("./src/errors.ts"),A=l("./src/crypt/decrypter.ts"),M=l("./src/demux/aacdemuxer.ts"),O=l("./src/demux/mp4demuxer.ts"),b=l("./src/demux/tsdemuxer.ts"),_=l("./src/demux/mp3demuxer.ts"),y=l("./src/remux/mp4-remuxer.ts"),x=l("./src/remux/passthrough-remuxer.ts"),D=l("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch{D.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var m=[{demux:b.default,remux:y.default},{demux:O.default,remux:x.default},{demux:M.default,remux:y.default},{demux:_.default,remux:y.default}],p=function(){function i(o,c,t,n,u){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=o,this.typeSupported=c,this.config=t,this.vendor=n,this.id=u}var r=i.prototype;return r.configure=function(c){this.transmuxConfig=c,this.decrypter&&this.decrypter.reset()},r.push=function(c,t,n,u){var a=this,d=n.transmuxing;d.executeStart=E();var v=new Uint8Array(c),S=this.config,T=this.currentTransmuxState,I=this.transmuxConfig;u&&(this.currentTransmuxState=u);var k=u||T,B=k.contiguous,U=k.discontinuity,W=k.trackSwitch,G=k.accurateTimeOffset,z=k.timeOffset,Y=k.initSegmentChange,$=I.audioCodec,Z=I.videoCodec,q=I.defaultInitPts,ie=I.duration,ne=I.initSegmentData;(U||W||Y)&&this.resetInitSegment(ne,$,Z,ie),(U||Y)&&this.resetInitialTimestamp(q),B||this.resetContiguity();var ae=f(v,t);if(ae&&ae.method==="AES-128"){var te=this.getDecrypter();if(S.enableSoftwareAES){var fe=te.softwareDecrypt(v,ae.key.buffer,ae.iv.buffer);if(!fe)return d.executeEnd=E(),e(n);v=new Uint8Array(fe)}else return this.decryptionPromise=te.webCryptoDecrypt(v,ae.key.buffer,ae.iv.buffer).then(function(Ee){var me=a.push(Ee,null,n);return a.decryptionPromise=null,me}),this.decryptionPromise}this.needsProbing(v,U,W)&&this.configureTransmuxer(v,I);var de=this.transmux(v,ae,z,G,n),re=this.currentTransmuxState;return re.contiguous=!0,re.discontinuity=!1,re.trackSwitch=!1,d.executeEnd=E(),de},r.flush=function(c){var t=this,n=c.transmuxing;n.executeStart=E();var u=this.decrypter,a=this.currentTransmuxState,d=this.decryptionPromise;if(d)return d.then(function(){return t.flush(c)});var v=[],S=a.timeOffset;if(u){var T=u.flush();T&&v.push(this.push(T,null,c))}var I=this.demuxer,k=this.remuxer;if(!I||!k)return this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),n.executeEnd=E(),[e(c)];var B=I.flush(S);return s(B)?B.then(function(U){return t.flushRemux(v,U,c),v}):(this.flushRemux(v,B,c),v)},r.flushRemux=function(c,t,n){var u=t.audioTrack,a=t.videoTrack,d=t.id3Track,v=t.textTrack,S=this.currentTransmuxState,T=S.accurateTimeOffset,I=S.timeOffset;D.logger.log("[transmuxer.ts]: Flushed fragment "+n.sn+(n.part>-1?" p: "+n.part:"")+" of level "+n.level);var k=this.remuxer.remux(u,a,d,v,I,T,!0,this.id);c.push({remuxResult:k,chunkMeta:n}),n.transmuxing.executeEnd=E()},r.resetInitialTimestamp=function(c){var t=this.demuxer,n=this.remuxer;!t||!n||(t.resetTimeStamp(c),n.resetTimeStamp(c))},r.resetContiguity=function(){var c=this.demuxer,t=this.remuxer;!c||!t||(c.resetContiguity(),t.resetNextTimestamp())},r.resetInitSegment=function(c,t,n,u){var a=this.demuxer,d=this.remuxer;!a||!d||(a.resetInitSegment(c,t,n,u),d.resetInitSegment(c,t,n))},r.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},r.transmux=function(c,t,n,u,a){var d;return t&&t.method==="SAMPLE-AES"?d=this.transmuxSampleAes(c,t,n,u,a):d=this.transmuxUnencrypted(c,n,u,a),d},r.transmuxUnencrypted=function(c,t,n,u){var a=this.demuxer.demux(c,t,!1,!this.config.progressive),d=a.audioTrack,v=a.videoTrack,S=a.id3Track,T=a.textTrack,I=this.remuxer.remux(d,v,S,T,t,n,!1,this.id);return{remuxResult:I,chunkMeta:u}},r.transmuxSampleAes=function(c,t,n,u,a){var d=this;return this.demuxer.demuxSampleAes(c,t,n).then(function(v){var S=d.remuxer.remux(v.audioTrack,v.videoTrack,v.id3Track,v.textTrack,n,u,!1,d.id);return{remuxResult:S,chunkMeta:a}})},r.configureTransmuxer=function(c,t){for(var n=this.config,u=this.observer,a=this.typeSupported,d=this.vendor,v=t.audioCodec,S=t.defaultInitPts,T=t.duration,I=t.initSegmentData,k=t.videoCodec,B,U=0,W=m.length;U<W;U++)if(m[U].demux.probe(c)){B=m[U];break}B||(D.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),B={demux:O.default,remux:x.default});var G=this.demuxer,z=this.remuxer,Y=B.remux,$=B.demux;(!z||!(z instanceof Y))&&(this.remuxer=new Y(u,n,a,d)),(!G||!(G instanceof $))&&(this.demuxer=new $(u,n,a),this.probe=$.probe),this.resetInitSegment(I,v,k,T),this.resetInitialTimestamp(S)},r.needsProbing=function(c,t,n){return!this.demuxer||!this.remuxer||t||n},r.getDecrypter=function(){var c=this.decrypter;return c||(c=this.decrypter=new A.default(this.observer,this.config)),c},i}();function f(i,r){var o=null;return i.byteLength>0&&r!=null&&r.key!=null&&r.iv!==null&&r.method!=null&&(o=r),o}var e=function(r){return{remuxResult:{},chunkMeta:r}};function s(i){return"then"in i&&i.then instanceof Function}var h=function(r,o,c,t,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=r,this.videoCodec=o,this.initSegmentData=c,this.duration=t,this.defaultInitPts=n},g=function(r,o,c,t,n,u){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=r,this.contiguous=o,this.accurateTimeOffset=c,this.trackSwitch=t,this.timeOffset=n,this.initSegmentChange=u}},"./src/demux/tsdemuxer.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"discardEPB",function(){return h});var P=l("./src/demux/adts.ts"),L=l("./src/demux/mpegaudio.ts"),A=l("./src/demux/exp-golomb.ts"),M=l("./src/demux/sample-aes.ts"),O=l("./src/events.ts"),b=l("./src/utils/mp4-tools.ts"),_=l("./src/utils/logger.ts"),y=l("./src/errors.ts"),x=l("./src/types/demuxer.ts");function D(){return D=Object.assign?Object.assign.bind():function(g){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(g[o]=r[o])}return g},D.apply(this,arguments)}var E=function(){function g(r,o,c){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=r,this.config=o,this.typeSupported=c}g.probe=function(o){return o[0]===71&&o[188]===71},g.createTrack=function(o,c){return{container:o==="video"||o==="audio"?"video/mp2t":void 0,type:o,id:b.RemuxerTrackIdConfig[o],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:o==="audio"?c:void 0}};var i=g.prototype;return i.resetInitSegment=function(o,c,t,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video"),this._audioTrack=g.createTrack("audio",n),this._id3Track=g.createTrack("id3"),this._txtTrack=g.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=c,this.videoCodec=t,this._duration=n},i.resetTimeStamp=function(){},i.resetContiguity=function(){var o=this._audioTrack,c=this._avcTrack,t=this._id3Track;o&&(o.pesData=null),c&&(c.pesData=null),t&&(t.pesData=null),this.aacOverFlow=null},i.demux=function(o,c,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1),t||(this.sampleAes=null);var u,a=this._avcTrack,d=this._audioTrack,v=this._id3Track,S=this._txtTrack,T=a.pid,I=a.pesData,k=d.pid,B=v.pid,U=d.pesData,W=v.pesData,G=null,z=this.pmtParsed,Y=this._pmtId,$=o.length;if(this.remainderData&&(o=Object(b.appendUint8Array)(this.remainderData,o),$=o.length,this.remainderData=null),$<188&&!n)return this.remainderData=o,{audioTrack:d,videoTrack:a,id3Track:v,textTrack:S};$-=$%188,$<o.byteLength&&!n&&(this.remainderData=new Uint8Array(o.buffer,$,o.buffer.byteLength-$));for(var Z=0,q=0;q<$;q+=188)if(o[q]===71){var ie=!!(o[q+1]&64),ne=((o[q+1]&31)<<8)+o[q+2],ae=(o[q+3]&48)>>4,te=void 0;if(ae>1){if(te=q+5+o[q+4],te===q+188)continue}else te=q+4;switch(ne){case T:ie&&(I&&(u=e(I))&&this.parseAVCPES(a,S,u,!1),I={data:[],size:0}),I&&(I.data.push(o.subarray(te,q+188)),I.size+=q+188-te);break;case k:if(ie){if(U&&(u=e(U)))switch(d.segmentCodec){case"aac":this.parseAACPES(d,u);break;case"mp3":this.parseMPEGPES(d,u);break}U={data:[],size:0}}U&&(U.data.push(o.subarray(te,q+188)),U.size+=q+188-te);break;case B:ie&&(W&&(u=e(W))&&this.parseID3PES(v,u),W={data:[],size:0}),W&&(W.data.push(o.subarray(te,q+188)),W.size+=q+188-te);break;case 0:ie&&(te+=o[te]+1),Y=this._pmtId=p(o,te);break;case Y:{ie&&(te+=o[te]+1);var fe=f(o,te,this.typeSupported,t);T=fe.avc,T>0&&(a.pid=T),k=fe.audio,k>0&&(d.pid=k,d.segmentCodec=fe.segmentCodec),B=fe.id3,B>0&&(v.pid=B),G!==null&&!z&&(_.logger.log("unknown PID '"+G+"' in TS found"),G=null),z=this.pmtParsed=!0;break}case 17:case 8191:break;default:G=ne;break}}else Z++;Z>0&&this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:y.ErrorTypes.MEDIA_ERROR,details:y.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+Z+" TS packet/s that do not start with 0x47"}),a.pesData=I,d.pesData=U,v.pesData=W;var de={audioTrack:d,videoTrack:a,id3Track:v,textTrack:S};return n&&this.extractRemainingSamples(de),de},i.flush=function(){var o=this.remainderData;this.remainderData=null;var c;return o?c=this.demux(o,-1,!1,!0):c={videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},i.extractRemainingSamples=function(o){var c=o.audioTrack,t=o.videoTrack,n=o.id3Track,u=o.textTrack,a=t.pesData,d=c.pesData,v=n.pesData,S;if(a&&(S=e(a))?(this.parseAVCPES(t,u,S,!0),t.pesData=null):t.pesData=a,d&&(S=e(d))){switch(c.segmentCodec){case"aac":this.parseAACPES(c,S);break;case"mp3":this.parseMPEGPES(c,S);break}c.pesData=null}else d!=null&&d.size&&_.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=d;v&&(S=e(v))?(this.parseID3PES(n,S),n.pesData=null):n.pesData=v},i.demuxSampleAes=function(o,c,t){var n=this.demux(o,t,!0,!this.config.progressive),u=this.sampleAes=new M.default(this.observer,this.config,c);return this.decrypt(n,u)},i.decrypt=function(o,c){return new Promise(function(t){var n=o.audioTrack,u=o.videoTrack;n.samples&&n.segmentCodec==="aac"?c.decryptAacSamples(n.samples,0,function(){u.samples?c.decryptAvcSamples(u.samples,0,0,function(){t(o)}):t(o)}):u.samples&&c.decryptAvcSamples(u.samples,0,0,function(){t(o)})})},i.destroy=function(){this._duration=0},i.parseAVCPES=function(o,c,t,n){var u=this,a=this.parseAVCNALu(o,t.data),d=!1,v=this.avcSample,S,T=!1;t.data=null,v&&a.length&&!o.audFound&&(s(v,o),v=this.avcSample=m(!1,t.pts,t.dts,"")),a.forEach(function(I){switch(I.type){case 1:{S=!0,v||(v=u.avcSample=m(!0,t.pts,t.dts,"")),d&&(v.debug+="NDR "),v.frame=!0;var k=I.data;if(T&&k.length>4){var B=new A.default(k).readSliceType();(B===2||B===4||B===7||B===9)&&(v.key=!0)}break}case 5:S=!0,v||(v=u.avcSample=m(!0,t.pts,t.dts,"")),d&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{S=!0,d&&v&&(v.debug+="SEI "),Object(b.parseSEIMessageFromNALu)(h(I.data),t.pts,c.samples);break}case 7:if(S=!0,T=!0,d&&v&&(v.debug+="SPS "),!o.sps){var U=new A.default(I.data),W=U.readSPS();o.width=W.width,o.height=W.height,o.pixelRatio=W.pixelRatio,o.sps=[I.data],o.duration=u._duration;for(var G=I.data.subarray(1,4),z="avc1.",Y=0;Y<3;Y++){var $=G[Y].toString(16);$.length<2&&($="0"+$),z+=$}o.codec=z}break;case 8:S=!0,d&&v&&(v.debug+="PPS "),o.pps||(o.pps=[I.data]);break;case 9:S=!1,o.audFound=!0,v&&s(v,o),v=u.avcSample=m(!1,t.pts,t.dts,d?"AUD ":"");break;case 12:S=!0;break;default:S=!1,v&&(v.debug+="unknown NAL "+I.type+" ");break}if(v&&S){var Z=v.units;Z.push(I)}}),n&&v&&(s(v,o),this.avcSample=null)},i.getLastNalUnit=function(o){var c,t=this.avcSample,n;if((!t||t.units.length===0)&&(t=o[o.length-1]),(c=t)!==null&&c!==void 0&&c.units){var u=t.units;n=u[u.length-1]}return n},i.parseAVCNALu=function(o,c){var t=c.byteLength,n=o.naluState||0,u=n,a=[],d=0,v,S,T,I=-1,k=0;for(n===-1&&(I=0,k=c[0]&31,n=0,d=1);d<t;){if(v=c[d++],!n){n=v?0:1;continue}if(n===1){n=v?0:2;continue}if(!v)n=3;else if(v===1){if(I>=0){var B={data:c.subarray(I,d-n-1),type:k};a.push(B)}else{var U=this.getLastNalUnit(o.samples);if(U&&(u&&d<=4-u&&U.state&&(U.data=U.data.subarray(0,U.data.byteLength-u)),S=d-n-1,S>0)){var W=new Uint8Array(U.data.byteLength+S);W.set(U.data,0),W.set(c.subarray(0,S),U.data.byteLength),U.data=W,U.state=0}}d<t?(T=c[d]&31,I=d,k=T,n=0):n=-1}else n=0}if(I>=0&&n>=0){var G={data:c.subarray(I,t),type:k,state:n};a.push(G)}if(a.length===0){var z=this.getLastNalUnit(o.samples);if(z){var Y=new Uint8Array(z.data.byteLength+c.byteLength);Y.set(z.data,0),Y.set(c,z.data.byteLength),z.data=Y}}return o.naluState=n,a},i.parseAACPES=function(o,c){var t=0,n=this.aacOverFlow,u=c.data;if(n){this.aacOverFlow=null;var a=n.missing,d=n.sample.unit.byteLength;if(a===-1){var v=new Uint8Array(d+u.byteLength);v.set(n.sample.unit,0),v.set(u,d),u=v}else{var S=d-a;n.sample.unit.set(u.subarray(0,a),S),o.samples.push(n.sample),t=n.missing}}var T,I;for(T=t,I=u.length;T<I-1&&!P.isHeader(u,T);T++);if(T!==t){var k,B;if(T<I-1?(k="AAC PES did not start with ADTS header,offset:"+T,B=!1):(k="no ADTS header found in AAC PES",B=!0),_.logger.warn("parsing error:"+k),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:y.ErrorTypes.MEDIA_ERROR,details:y.ErrorDetails.FRAG_PARSING_ERROR,fatal:B,reason:k}),B)return}P.initTrackConfig(o,this.observer,u,T,this.audioCodec);var U;if(c.pts!==void 0)U=c.pts;else if(n){var W=P.getFrameDuration(o.samplerate);U=n.sample.pts+W}else{_.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var G=0,z;T<I;)if(z=P.appendFrame(o,u,T,U,G),T+=z.length,z.missing){this.aacOverFlow=z;break}else for(G++;T<I-1&&!P.isHeader(u,T);T++);},i.parseMPEGPES=function(o,c){var t=c.data,n=t.length,u=0,a=0,d=c.pts;if(d===void 0){_.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<n;)if(L.isHeader(t,a)){var v=L.appendFrame(o,t,a,d,u);if(v)a+=v.length,u++;else break}else a++},i.parseID3PES=function(o,c){if(c.pts===void 0){_.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}var t=D({},c,{type:this._avcTrack?x.MetadataSchema.emsg:x.MetadataSchema.audioId3});o.samples.push(t)},g}();function m(g,i,r,o){return{key:g,frame:!1,pts:i,dts:r,units:[],debug:o,length:0}}function p(g,i){return(g[i+10]&31)<<8|g[i+11]}function f(g,i,r,o){var c={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},t=(g[i+1]&15)<<8|g[i+2],n=i+3+t-4,u=(g[i+10]&15)<<8|g[i+11];for(i+=12+u;i<n;){var a=(g[i+1]&31)<<8|g[i+2];switch(g[i]){case 207:if(!o){_.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=a);break;case 21:c.id3===-1&&(c.id3=a);break;case 219:if(!o){_.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=a);break;case 3:case 4:r.mpeg!==!0&&r.mp3!==!0?_.logger.log("MPEG audio found, not supported in this browser"):c.audio===-1&&(c.audio=a,c.segmentCodec="mp3");break;case 36:_.logger.warn("Unsupported HEVC stream type found");break;default:break}i+=((g[i+3]&15)<<8|g[i+4])+5}return c}function e(g){var i=0,r,o,c,t,n,u=g.data;if(!g||g.size===0)return null;for(;u[0].length<19&&u.length>1;){var a=new Uint8Array(u[0].length+u[1].length);a.set(u[0]),a.set(u[1],u[0].length),u[0]=a,u.splice(1,1)}r=u[0];var d=(r[0]<<16)+(r[1]<<8)+r[2];if(d===1){if(o=(r[4]<<8)+r[5],o&&o>g.size-6)return null;var v=r[7];v&192&&(t=(r[9]&14)*536870912+(r[10]&255)*4194304+(r[11]&254)*16384+(r[12]&255)*128+(r[13]&254)/2,v&64?(n=(r[14]&14)*536870912+(r[15]&255)*4194304+(r[16]&254)*16384+(r[17]&255)*128+(r[18]&254)/2,t-n>60*9e4&&(_.logger.warn(Math.round((t-n)/9e4)+"s delta between PTS and DTS, align them"),t=n)):n=t),c=r[8];var S=c+9;if(g.size<=S)return null;g.size-=S;for(var T=new Uint8Array(g.size),I=0,k=u.length;I<k;I++){r=u[I];var B=r.byteLength;if(S)if(S>B){S-=B;continue}else r=r.subarray(S),B-=S,S=0;T.set(r,i),i+=B}return o&&(o-=c+3),{data:T,pts:t,dts:n,len:o}}return null}function s(g,i){if(g.units.length&&g.frame){if(g.pts===void 0){var r=i.samples,o=r.length;if(o){var c=r[o-1];g.pts=c.pts,g.dts=c.dts}else{i.dropped++;return}}i.samples.push(g)}g.debug.length&&_.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function h(g){for(var i=g.byteLength,r=[],o=1;o<i-2;)g[o]===0&&g[o+1]===0&&g[o+2]===3?(r.push(o+2),o+=2):o++;if(r.length===0)return g;var c=i-r.length,t=new Uint8Array(c),n=0;for(o=0;o<c;n++,o++)n===r[0]&&(n++,r.shift()),t[o]=g[n];return t}R.default=E},"./src/errors.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"ErrorTypes",function(){return P}),l.d(R,"ErrorDetails",function(){return L});var P;(function(A){A.NETWORK_ERROR="networkError",A.MEDIA_ERROR="mediaError",A.KEY_SYSTEM_ERROR="keySystemError",A.MUX_ERROR="muxError",A.OTHER_ERROR="otherError"})(P||(P={}));var L;(function(A){A.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",A.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",A.KEY_SYSTEM_NO_SESSION="keySystemNoSession",A.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",A.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",A.MANIFEST_LOAD_ERROR="manifestLoadError",A.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",A.MANIFEST_PARSING_ERROR="manifestParsingError",A.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",A.LEVEL_EMPTY_ERROR="levelEmptyError",A.LEVEL_LOAD_ERROR="levelLoadError",A.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",A.LEVEL_SWITCH_ERROR="levelSwitchError",A.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",A.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",A.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",A.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",A.FRAG_LOAD_ERROR="fragLoadError",A.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",A.FRAG_DECRYPT_ERROR="fragDecryptError",A.FRAG_PARSING_ERROR="fragParsingError",A.REMUX_ALLOC_ERROR="remuxAllocError",A.KEY_LOAD_ERROR="keyLoadError",A.KEY_LOAD_TIMEOUT="keyLoadTimeOut",A.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",A.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",A.BUFFER_APPEND_ERROR="bufferAppendError",A.BUFFER_APPENDING_ERROR="bufferAppendingError",A.BUFFER_STALLED_ERROR="bufferStalledError",A.BUFFER_FULL_ERROR="bufferFullError",A.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",A.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",A.INTERNAL_EXCEPTION="internalException",A.INTERNAL_ABORTED="aborted",A.UNKNOWN="unknown"})(L||(L={}))},"./src/events.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"Events",function(){return P});var P;(function(L){L.MEDIA_ATTACHING="hlsMediaAttaching",L.MEDIA_ATTACHED="hlsMediaAttached",L.MEDIA_DETACHING="hlsMediaDetaching",L.MEDIA_DETACHED="hlsMediaDetached",L.BUFFER_RESET="hlsBufferReset",L.BUFFER_CODECS="hlsBufferCodecs",L.BUFFER_CREATED="hlsBufferCreated",L.BUFFER_APPENDING="hlsBufferAppending",L.BUFFER_APPENDED="hlsBufferAppended",L.BUFFER_EOS="hlsBufferEos",L.BUFFER_FLUSHING="hlsBufferFlushing",L.BUFFER_FLUSHED="hlsBufferFlushed",L.MANIFEST_LOADING="hlsManifestLoading",L.MANIFEST_LOADED="hlsManifestLoaded",L.MANIFEST_PARSED="hlsManifestParsed",L.LEVEL_SWITCHING="hlsLevelSwitching",L.LEVEL_SWITCHED="hlsLevelSwitched",L.LEVEL_LOADING="hlsLevelLoading",L.LEVEL_LOADED="hlsLevelLoaded",L.LEVEL_UPDATED="hlsLevelUpdated",L.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",L.LEVELS_UPDATED="hlsLevelsUpdated",L.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",L.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",L.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",L.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",L.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",L.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",L.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",L.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",L.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",L.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",L.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",L.CUES_PARSED="hlsCuesParsed",L.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",L.INIT_PTS_FOUND="hlsInitPtsFound",L.FRAG_LOADING="hlsFragLoading",L.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",L.FRAG_LOADED="hlsFragLoaded",L.FRAG_DECRYPTED="hlsFragDecrypted",L.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",L.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",L.FRAG_PARSING_METADATA="hlsFragParsingMetadata",L.FRAG_PARSED="hlsFragParsed",L.FRAG_BUFFERED="hlsFragBuffered",L.FRAG_CHANGED="hlsFragChanged",L.FPS_DROP="hlsFpsDrop",L.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",L.ERROR="hlsError",L.DESTROYING="hlsDestroying",L.KEY_LOADING="hlsKeyLoading",L.KEY_LOADED="hlsKeyLoaded",L.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",L.BACK_BUFFER_REACHED="hlsBackBufferReached"})(P||(P={}))},"./src/hls.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return i});var P=l("./node_modules/url-toolkit/src/url-toolkit.js"),L=l.n(P),A=l("./src/loader/playlist-loader.ts"),M=l("./src/loader/key-loader.ts"),O=l("./src/controller/id3-track-controller.ts"),b=l("./src/controller/latency-controller.ts"),_=l("./src/controller/level-controller.ts"),y=l("./src/controller/fragment-tracker.ts"),x=l("./src/controller/stream-controller.ts"),D=l("./src/is-supported.ts"),E=l("./src/utils/logger.ts"),m=l("./src/config.ts"),p=l("./node_modules/eventemitter3/index.js"),f=l.n(p),e=l("./src/events.ts"),s=l("./src/errors.ts");function h(r,o){for(var c=0;c<o.length;c++){var t=o[c];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,t.key,t)}}function g(r,o,c){return o&&h(r.prototype,o),c&&h(r,c),Object.defineProperty(r,"prototype",{writable:!1}),r}var i=function(){r.isSupported=function(){return Object(D.isSupported)()};function r(c){c===void 0&&(c={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var t=this.config=Object(m.mergeConfig)(r.DefaultConfig,c);this.userConfig=c,Object(E.enableLogs)(t.debug),this._autoLevelCapping=-1,t.progressive&&Object(m.enableStreamingMode)(t);var n=t.abrController,u=t.bufferController,a=t.capLevelController,d=t.fpsController,v=this.abrController=new n(this),S=this.bufferController=new u(this),T=this.capLevelController=new a(this),I=new d(this),k=new A.default(this),B=new M.default(this),U=new O.default(this),W=this.levelController=new _.default(this),G=new y.FragmentTracker(this),z=this.streamController=new x.default(this,G);T.setStreamController(z),I.setStreamController(z);var Y=[k,B,W,z];this.networkControllers=Y;var $=[v,S,T,I,U,G];this.audioTrackController=this.createController(t.audioTrackController,null,Y),this.createController(t.audioStreamController,G,Y),this.subtitleTrackController=this.createController(t.subtitleTrackController,null,Y),this.createController(t.subtitleStreamController,G,Y),this.createController(t.timelineController,null,$),this.emeController=this.createController(t.emeController,null,$),this.cmcdController=this.createController(t.cmcdController,null,$),this.latencyController=this.createController(b.default,null,$),this.coreComponents=$}var o=r.prototype;return o.createController=function(t,n,u){if(t){var a=n?new t(this,n):new t(this);return u&&u.push(a),a}return null},o.on=function(t,n,u){u===void 0&&(u=this),this._emitter.on(t,n,u)},o.once=function(t,n,u){u===void 0&&(u=this),this._emitter.once(t,n,u)},o.removeAllListeners=function(t){this._emitter.removeAllListeners(t)},o.off=function(t,n,u,a){u===void 0&&(u=this),this._emitter.off(t,n,u,a)},o.listeners=function(t){return this._emitter.listeners(t)},o.emit=function(t,n,u){return this._emitter.emit(t,n,u)},o.trigger=function(t,n){if(this.config.debug)return this.emit(t,t,n);try{return this.emit(t,t,n)}catch(u){E.logger.error("An internal error happened while handling event "+t+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(e.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:t,error:u})}return!1},o.listenerCount=function(t){return this._emitter.listenerCount(t)},o.destroy=function(){E.logger.log("destroy"),this.trigger(e.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(t){return t.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(t){return t.destroy()}),this.coreComponents.length=0},o.attachMedia=function(t){E.logger.log("attachMedia"),this._media=t,this.trigger(e.Events.MEDIA_ATTACHING,{media:t})},o.detachMedia=function(){E.logger.log("detachMedia"),this.trigger(e.Events.MEDIA_DETACHING,void 0),this._media=null},o.loadSource=function(t){this.stopLoad();var n=this.media,u=this.url,a=this.url=P.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});E.logger.log("loadSource:"+a),n&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(n)),this.trigger(e.Events.MANIFEST_LOADING,{url:t})},o.startLoad=function(t){t===void 0&&(t=-1),E.logger.log("startLoad("+t+")"),this.networkControllers.forEach(function(n){n.startLoad(t)})},o.stopLoad=function(){E.logger.log("stopLoad"),this.networkControllers.forEach(function(t){t.stopLoad()})},o.swapAudioCodec=function(){E.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},o.recoverMediaError=function(){E.logger.log("recoverMediaError");var t=this._media;this.detachMedia(),t&&this.attachMedia(t)},o.removeLevel=function(t,n){n===void 0&&(n=0),this.levelController.removeLevel(t,n)},g(r,[{key:"levels",get:function(){var t=this.levelController.levels;return t||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){E.logger.log("set currentLevel:"+t),this.loadLevel=t,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){E.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){E.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){E.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){E.logger.log("set startLevel:"+t),t!==-1&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(t){var n=!!t;n!==this.config.capLevelToPlayerSize&&(n?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=n)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){this._autoLevelCapping!==t&&(E.logger.log("set autoLevelCapping:"+t),this._autoLevelCapping=t)}},{key:"bandwidthEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var t=this.levels,n=this.config.minAutoBitrate;if(!t)return 0;for(var u=t.length,a=0;a<u;a++)if(t[a].maxBitrate>=n)return a;return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,n=this.autoLevelCapping,u;return n===-1&&t&&t.length?u=t.length-1:u=n,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var n=this.audioTrackController;n&&(n.audioTrack=t)}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var n=this.subtitleTrackController;n&&(n.subtitleTrack=t)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return t?t.subtitleDisplay:!1},set:function(t){var n=this.subtitleTrackController;n&&(n.subtitleDisplay=t)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(t){this.config.lowLatencyMode=t}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.2.3"}},{key:"Events",get:function(){return e.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return r.defaultConfig?r.defaultConfig:m.hlsDefaultConfig},set:function(t){r.defaultConfig=t}}]),r}();i.defaultConfig=void 0},"./src/is-supported.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"isSupported",function(){return A}),l.d(R,"changeTypeSupported",function(){return M});var P=l("./src/utils/mediasource-helper.ts");function L(){return self.SourceBuffer||self.WebKitSourceBuffer}function A(){var O=Object(P.getMediaSource)();if(!O)return!1;var b=L(),_=O&&typeof O.isTypeSupported=="function"&&O.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!b||b.prototype&&typeof b.prototype.appendBuffer=="function"&&typeof b.prototype.remove=="function";return!!_&&!!y}function M(){var O,b=L();return typeof(b==null||(O=b.prototype)===null||O===void 0?void 0:O.changeType)=="function"}},"./src/loader/date-range.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"DateRangeAttribute",function(){return _}),l.d(R,"DateRange",function(){return y});var P=l("./src/polyfills/number.ts"),L=l("./src/utils/attr-list.ts"),A=l("./src/utils/logger.ts");function M(){return M=Object.assign?Object.assign.bind():function(x){for(var D=1;D<arguments.length;D++){var E=arguments[D];for(var m in E)Object.prototype.hasOwnProperty.call(E,m)&&(x[m]=E[m])}return x},M.apply(this,arguments)}function O(x,D){for(var E=0;E<D.length;E++){var m=D[E];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(x,m.key,m)}}function b(x,D,E){return D&&O(x.prototype,D),E&&O(x,E),Object.defineProperty(x,"prototype",{writable:!1}),x}var _;(function(x){x.ID="ID",x.CLASS="CLASS",x.START_DATE="START-DATE",x.DURATION="DURATION",x.END_DATE="END-DATE",x.END_ON_NEXT="END-ON-NEXT",x.PLANNED_DURATION="PLANNED-DURATION",x.SCTE35_OUT="SCTE35-OUT",x.SCTE35_IN="SCTE35-IN"})(_||(_={}));var y=function(){function x(D,E){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,E){var m=E.attr;for(var p in m)if(Object.prototype.hasOwnProperty.call(D,p)&&D[p]!==m[p]){A.logger.warn('DATERANGE tag attribute: "'+p+'" does not match for tags with ID: "'+D.ID+'"'),this._badValueForSameId=p;break}D=M(new L.AttrList({}),m,D)}if(this.attr=D,this._startDate=new Date(D[_.START_DATE]),_.END_DATE in this.attr){var f=new Date(this.attr[_.END_DATE]);Object(P.isFiniteNumber)(f.getTime())&&(this._endDate=f)}}return b(x,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){if(this._endDate)return this._endDate;var E=this.duration;return E!==null?new Date(this._startDate.getTime()+E*1e3):null}},{key:"duration",get:function(){if(_.DURATION in this.attr){var E=this.attr.decimalFloatingPoint(_.DURATION);if(Object(P.isFiniteNumber)(E))return E}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return _.PLANNED_DURATION in this.attr?this.attr.decimalFloatingPoint(_.PLANNED_DURATION):null}},{key:"endOnNext",get:function(){return this.attr.bool(_.END_ON_NEXT)}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&Object(P.isFiniteNumber)(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),x}()},"./src/loader/fragment-loader.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return E}),l.d(R,"LoadError",function(){return p});var P=l("./src/polyfills/number.ts"),L=l("./src/errors.ts");function A(f,e){f.prototype=Object.create(e.prototype),f.prototype.constructor=f,y(f,e)}function M(f){var e=typeof Map=="function"?new Map:void 0;return M=function(h){if(h===null||!_(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(h))return e.get(h);e.set(h,g)}function g(){return O(h,arguments,x(this).constructor)}return g.prototype=Object.create(h.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),y(g,h)},M(f)}function O(f,e,s){return b()?O=Reflect.construct.bind():O=function(g,i,r){var o=[null];o.push.apply(o,i);var c=Function.bind.apply(g,o),t=new c;return r&&y(t,r.prototype),t},O.apply(null,arguments)}function b(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _(f){return Function.toString.call(f).indexOf("[native code]")!==-1}function y(f,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(h,g){return h.__proto__=g,h},y(f,e)}function x(f){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},x(f)}var D=Math.pow(2,17),E=function(){function f(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var e=f.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(h,g){var i=this,r=h.url;if(!r)return Promise.reject(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var o=this.config,c=o.fLoader,t=o.loader;return new Promise(function(n,u){i.loader&&i.loader.destroy();var a=i.loader=h.loader=c?new c(o):new t(o),d=m(h),v={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:h.sn==="initSegment"?1/0:D};h.stats=a.stats,a.load(d,v,{onSuccess:function(T,I,k,B){i.resetLoader(h,a),n({frag:h,part:null,payload:T.data,networkDetails:B})},onError:function(T,I,k){i.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:T,networkDetails:k}))},onAbort:function(T,I,k){i.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:k}))},onTimeout:function(T,I,k){i.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:k}))},onProgress:function(T,I,k,B){g&&g({frag:h,part:null,payload:k,networkDetails:B})}})})},e.loadPart=function(h,g,i){var r=this;this.abort();var o=this.config,c=o.fLoader,t=o.loader;return new Promise(function(n,u){r.loader&&r.loader.destroy();var a=r.loader=h.loader=c?new c(o):new t(o),d=m(h,g),v={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:D};g.stats=a.stats,a.load(d,v,{onSuccess:function(T,I,k,B){r.resetLoader(h,a),r.updateStatsFromPart(h,g);var U={frag:h,part:g,payload:T.data,networkDetails:B};i(U),n(U)},onError:function(T,I,k){r.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:g,response:T,networkDetails:k}))},onAbort:function(T,I,k){h.stats.aborted=g.stats.aborted,r.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:g,networkDetails:k}))},onTimeout:function(T,I,k){r.resetLoader(h,a),u(new p({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:g,networkDetails:k}))}})})},e.updateStatsFromPart=function(h,g){var i=h.stats,r=g.stats,o=r.total;if(i.loaded+=r.loaded,o){var c=Math.round(h.duration/g.duration),t=Math.min(Math.round(i.loaded/o),c),n=c-t,u=n*Math.round(i.loaded/t);i.total=i.loaded+u}else i.total=Math.max(i.loaded,i.total);var a=i.loading,d=r.loading;a.start?a.first+=d.first-d.start:(a.start=d.start,a.first=d.first),a.end=d.end},e.resetLoader=function(h,g){h.loader=null,this.loader===g&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),g.destroy()},f}();function m(f,e){e===void 0&&(e=null);var s=e||f,h={frag:f,part:e,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},g=s.byteRangeStartOffset,i=s.byteRangeEndOffset;return Object(P.isFiniteNumber)(g)&&Object(P.isFiniteNumber)(i)&&(h.rangeStart=g,h.rangeEnd=i),h}var p=function(f){A(e,f);function e(s){for(var h,g=arguments.length,i=new Array(g>1?g-1:0),r=1;r<g;r++)i[r-1]=arguments[r];return h=f.call.apply(f,[this].concat(i))||this,h.data=void 0,h.data=s,h}return e}(M(Error))},"./src/loader/fragment.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"ElementaryStreamTypes",function(){return E}),l.d(R,"BaseSegment",function(){return m}),l.d(R,"Fragment",function(){return p}),l.d(R,"Part",function(){return f});var P=l("./src/polyfills/number.ts"),L=l("./node_modules/url-toolkit/src/url-toolkit.js"),A=l.n(L),M=l("./src/utils/logger.ts"),O=l("./src/loader/level-key.ts"),b=l("./src/loader/load-stats.ts");function _(e,s){e.prototype=Object.create(s.prototype),e.prototype.constructor=e,y(e,s)}function y(e,s){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(g,i){return g.__proto__=i,g},y(e,s)}function x(e,s){for(var h=0;h<s.length;h++){var g=s[h];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(e,g.key,g)}}function D(e,s,h){return s&&x(e.prototype,s),h&&x(e,h),Object.defineProperty(e,"prototype",{writable:!1}),e}var E;(function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"})(E||(E={}));var m=function(){function e(h){var g;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(g={},g[E.AUDIO]=null,g[E.VIDEO]=null,g[E.AUDIOVIDEO]=null,g),this.baseurl=h}var s=e.prototype;return s.setByteRange=function(g,i){var r=g.split("@",2),o=[];r.length===1?o[0]=i?i.byteRangeEndOffset:0:o[0]=parseInt(r[1]),o[1]=parseInt(r[0])+o[0],this._byteRange=o},D(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(L.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(g){this._url=g}}]),e}(),p=function(e){_(s,e);function s(g,i){var r;return r=e.call(this,i)||this,r._decryptdata=null,r.rawProgramDateTime=null,r.programDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkey=void 0,r.type=void 0,r.loader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.appendedPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.stats=new b.LoadStats,r.urlId=0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.type=g,r}var h=s.prototype;return h.createInitializationVector=function(i){for(var r=new Uint8Array(16),o=12;o<16;o++)r[o]=i>>8*(15-o)&255;return r},h.setDecryptDataFromLevelKey=function(i,r){var o=i;return(i==null?void 0:i.method)==="AES-128"&&i.uri&&!i.iv&&(o=O.LevelKey.fromURI(i.uri),o.method=i.method,o.iv=this.createInitializationVector(r),o.keyFormat="identity"),o},h.setElementaryStreamInfo=function(i,r,o,c,t,n){n===void 0&&(n=!1);var u=this.elementaryStreams,a=u[i];if(!a){u[i]={startPTS:r,endPTS:o,startDTS:c,endDTS:t,partial:n};return}a.startPTS=Math.min(a.startPTS,r),a.endPTS=Math.max(a.endPTS,o),a.startDTS=Math.min(a.startDTS,c),a.endDTS=Math.max(a.endDTS,t)},h.clearElementaryStreamInfo=function(){var i=this.elementaryStreams;i[E.AUDIO]=null,i[E.VIDEO]=null,i[E.AUDIOVIDEO]=null},D(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var i=this.sn;typeof i!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&M.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),i=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,i)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!Object(P.isFiniteNumber)(this.programDateTime))return null;var i=Object(P.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+i*1e3}},{key:"encrypted",get:function(){var i;return!!((i=this.decryptdata)!==null&&i!==void 0&&i.keyFormat&&this.decryptdata.uri)}}]),s}(m),f=function(e){_(s,e);function s(h,g,i,r,o){var c;c=e.call(this,i)||this,c.fragOffset=0,c.duration=0,c.gap=!1,c.independent=!1,c.relurl=void 0,c.fragment=void 0,c.index=void 0,c.stats=new b.LoadStats,c.duration=h.decimalFloatingPoint("DURATION"),c.gap=h.bool("GAP"),c.independent=h.bool("INDEPENDENT"),c.relurl=h.enumeratedString("URI"),c.fragment=g,c.index=r;var t=h.enumeratedString("BYTERANGE");return t&&c.setByteRange(t,o),o&&(c.fragOffset=o.fragOffset+o.duration),c}return D(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var g=this.elementaryStreams;return!!(g.audio||g.video||g.audiovideo)}}]),s}(m)},"./src/loader/key-loader.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return M});var P=l("./src/events.ts"),L=l("./src/errors.ts"),A=l("./src/utils/logger.ts"),M=function(){function O(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this.registerListeners()}var b=O.prototype;return b.startLoad=function(y){},b.stopLoad=function(){this.destroyInternalLoaders()},b.registerListeners=function(){this.hls.on(P.Events.KEY_LOADING,this.onKeyLoading,this)},b.unregisterListeners=function(){this.hls.off(P.Events.KEY_LOADING,this.onKeyLoading)},b.destroyInternalLoaders=function(){for(var y in this.loaders){var x=this.loaders[y];x&&x.destroy()}this.loaders={}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onKeyLoading=function(y,x){var D=x.frag,E=D.type,m=this.loaders[E];if(!D.decryptdata){A.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var p=D.decryptdata.uri;if(p!==this.decrypturl||this.decryptkey===null){var f=this.hls.config;if(m&&(A.logger.warn("abort previous key loader for type:"+E),m.abort()),!p){A.logger.warn("key uri is falsy");return}var e=f.loader,s=D.loader=this.loaders[E]=new e(f);this.decrypturl=p,this.decryptkey=null;var h={url:p,frag:D,responseType:"arraybuffer"},g={timeout:f.fragLoadingTimeOut,maxRetry:0,retryDelay:f.fragLoadingRetryDelay,maxRetryDelay:f.fragLoadingMaxRetryTimeout,highWaterMark:0},i={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(h,g,i)}else this.decryptkey&&(D.decryptdata.key=this.decryptkey,this.hls.trigger(P.Events.KEY_LOADED,{frag:D}))},b.loadsuccess=function(y,x,D){var E=D.frag;if(!E.decryptdata){A.logger.error("after key load, decryptdata unset");return}this.decryptkey=E.decryptdata.key=new Uint8Array(y.data),E.loader=null,delete this.loaders[E.type],this.hls.trigger(P.Events.KEY_LOADED,{frag:E})},b.loaderror=function(y,x){var D=x.frag,E=D.loader;E&&E.abort(),delete this.loaders[D.type],this.hls.trigger(P.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:D,response:y})},b.loadtimeout=function(y,x){var D=x.frag,E=D.loader;E&&E.abort(),delete this.loaders[D.type],this.hls.trigger(P.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:D})},O}()},"./src/loader/level-details.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"LevelDetails",function(){return O});var P=l("./src/polyfills/number.ts");function L(b,_){for(var y=0;y<_.length;y++){var x=_[y];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(b,x.key,x)}}function A(b,_,y){return _&&L(b.prototype,_),y&&L(b,y),Object.defineProperty(b,"prototype",{writable:!1}),b}var M=10,O=function(){function b(y){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.dateRanges={},this.url=y}var _=b.prototype;return _.reloaded=function(x){if(!x){this.advanced=!0,this.updated=!0;return}var D=this.lastPartSn-x.lastPartSn,E=this.lastPartIndex-x.lastPartIndex;this.updated=this.endSN!==x.endSN||!!E||!!D,this.advanced=this.endSN>x.endSN||D>0||D===0&&E>0,this.updated||this.advanced?this.misses=Math.floor(x.misses*.6):this.misses=x.misses+1,this.availabilityDelay=x.availabilityDelay},A(b,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(P.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||M}},{key:"drift",get:function(){var x=this.driftEndTime-this.driftStartTime;if(x>0){var D=this.driftEnd-this.driftStart;return D*1e3/x}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var x;return(x=this.fragments)!==null&&x!==void 0&&x.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),b}()},"./src/loader/level-key.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"LevelKey",function(){return O});var P=l("./node_modules/url-toolkit/src/url-toolkit.js"),L=l.n(P);function A(b,_){for(var y=0;y<_.length;y++){var x=_[y];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(b,x.key,x)}}function M(b,_,y){return _&&A(b.prototype,_),y&&A(b,y),Object.defineProperty(b,"prototype",{writable:!1}),b}var O=function(){b.fromURL=function(y,x){return new b(y,x)},b.fromURI=function(y){return new b(y)};function b(_,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(P.buildAbsoluteURL)(_,y,{alwaysNormalize:!0}):this._uri=_}return M(b,[{key:"uri",get:function(){return this._uri}}]),b}()},"./src/loader/load-stats.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"LoadStats",function(){return P});var P=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return h});var P=l("./src/polyfills/number.ts"),L=l("./node_modules/url-toolkit/src/url-toolkit.js"),A=l.n(L),M=l("./src/loader/date-range.ts"),O=l("./src/loader/fragment.ts"),b=l("./src/loader/level-details.ts"),_=l("./src/loader/level-key.ts"),y=l("./src/utils/attr-list.ts"),x=l("./src/utils/logger.ts"),D=l("./src/utils/codecs.ts"),E=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,m=/#EXT-X-MEDIA:(.*)/g,p=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),f=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),e=/\.(mp4|m4s|m4v|m4a)$/i;function s(t){var n,u;return e.test((n=(u=L.parseURL(t))===null||u===void 0?void 0:u.path)!=null?n:"")}var h=function(){function t(){}return t.findGroup=function(u,a){for(var d=0;d<u.length;d++){var v=u[d];if(v.id===a)return v}},t.convertAVC1ToAVCOTI=function(u){var a=u.split(".");if(a.length>2){var d=a.shift()+".";return d+=parseInt(a.shift()).toString(16),d+=("000"+parseInt(a.shift()).toString(16)).slice(-4),d}return u},t.resolve=function(u,a){return L.buildAbsoluteURL(a,u,{alwaysNormalize:!0})},t.parseMasterPlaylist=function(u,a){var d=[],v={},S=!1;E.lastIndex=0;for(var T;(T=E.exec(u))!=null;)if(T[1]){var I=new y.AttrList(T[1]),k={attrs:I,bitrate:I.decimalInteger("AVERAGE-BANDWIDTH")||I.decimalInteger("BANDWIDTH"),name:I.NAME,url:t.resolve(T[2],a)},B=I.decimalResolution("RESOLUTION");B&&(k.width=B.width,k.height=B.height),g((I.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=t.convertAVC1ToAVCOTI(k.videoCodec)),d.push(k)}else if(T[3]){var U=new y.AttrList(T[3]);U["DATA-ID"]&&(S=!0,v[U["DATA-ID"]]=U)}return{levels:d,sessionData:S?v:null}},t.parseMasterPlaylistMedia=function(u,a,d,v){v===void 0&&(v=[]);var S,T=[],I=0;for(m.lastIndex=0;(S=m.exec(u))!==null;){var k=new y.AttrList(S[1]);if(k.TYPE===d){var B={attrs:k,bitrate:0,id:I++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:d,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?t.resolve(k.URI,a):""};if(v.length){var U=t.findGroup(v,B.groupId)||v[0];i(B,U,"audioCodec"),i(B,U,"textCodec")}T.push(B)}}return T},t.parseLevelPlaylist=function(u,a,d,v,S){var T=new b.LevelDetails(a),I=T.fragments,k=null,B=0,U=0,W=0,G=0,z=null,Y=new O.Fragment(v,a),$,Z,q,ie=-1,ne=!1;for(p.lastIndex=0,T.m3u8=u;($=p.exec(u))!==null;){ne&&(ne=!1,Y=new O.Fragment(v,a),Y.start=W,Y.sn=B,Y.cc=G,Y.level=d,k&&(Y.initSegment=k,Y.rawProgramDateTime=k.rawProgramDateTime,k.rawProgramDateTime=null));var ae=$[1];if(ae){Y.duration=parseFloat(ae);var te=(" "+$[2]).slice(1);Y.title=te||null,Y.tagList.push(te?["INF",ae,te]:["INF",ae])}else if($[3])Object(P.isFiniteNumber)(Y.duration)&&(Y.start=W,q&&(Y.levelkey=q),Y.sn=B,Y.level=d,Y.cc=G,Y.urlId=S,I.push(Y),Y.relurl=(" "+$[3]).slice(1),o(Y,z),z=Y,W+=Y.duration,B++,U=0,ne=!0);else if($[4]){var fe=(" "+$[4]).slice(1);z?Y.setByteRange(fe,z):Y.setByteRange(fe)}else if($[5])Y.rawProgramDateTime=(" "+$[5]).slice(1),Y.tagList.push(["PROGRAM-DATE-TIME",Y.rawProgramDateTime]),ie===-1&&(ie=I.length);else{if($=$[0].match(f),!$){x.logger.warn("No matches on slow regex match for level playlist!");continue}for(Z=1;Z<$.length&&typeof $[Z]=="undefined";Z++);var de=(" "+$[Z]).slice(1),re=(" "+$[Z+1]).slice(1),Ee=$[Z+2]?(" "+$[Z+2]).slice(1):"";switch(de){case"PLAYLIST-TYPE":T.type=re.toUpperCase();break;case"MEDIA-SEQUENCE":B=T.startSN=parseInt(re);break;case"SKIP":{var me=new y.AttrList(re),Te=me.decimalInteger("SKIPPED-SEGMENTS");if(Object(P.isFiniteNumber)(Te)){T.skippedSegments=Te;for(var Me=Te;Me--;)I.unshift(null);B+=Te}var _e=me.enumeratedString("RECENTLY-REMOVED-DATERANGES");_e&&(T.recentlyRemovedDateranges=_e.split(" "));break}case"TARGETDURATION":T.targetduration=parseFloat(re);break;case"VERSION":T.version=parseInt(re);break;case"EXTM3U":break;case"ENDLIST":T.live=!1;break;case"#":(re||Ee)&&Y.tagList.push(Ee?[re,Ee]:[re]);break;case"DISCONTINUITY":G++,Y.tagList.push(["DIS"]);break;case"GAP":Y.tagList.push([de]);break;case"BITRATE":Y.tagList.push([de,re]);break;case"DATERANGE":{var ke=new y.AttrList(re),Ie=new M.DateRange(ke,T.dateRanges[ke.ID]);Ie.isValid||T.skippedSegments?T.dateRanges[Ie.id]=Ie:x.logger.warn('Ignoring invalid DATERANGE tag: "'+re+'"'),Y.tagList.push(["EXT-X-DATERANGE",re]);break}case"DISCONTINUITY-SEQUENCE":G=parseInt(re);break;case"KEY":{var Be,be=new y.AttrList(re),Ue=be.enumeratedString("METHOD"),Ke=be.URI,je=be.hexadecimalInteger("IV"),Ne=be.enumeratedString("KEYFORMATVERSIONS"),et=be.enumeratedString("KEYID"),Fe=(Be=be.enumeratedString("KEYFORMAT"))!=null?Be:"identity",tt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(tt.indexOf(Fe)>-1){x.logger.warn("Keyformat "+Fe+" is not supported from the manifest");continue}else if(Fe!=="identity")continue;Ue&&(q=_.LevelKey.fromURL(a,Ke),Ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ue)>=0&&(q.method=Ue,q.keyFormat=Fe,et&&(q.keyID=et),Ne&&(q.keyFormatVersions=Ne),q.iv=je));break}case"START":{var Oe=new y.AttrList(re),Pe=Oe.decimalFloatingPoint("TIME-OFFSET");Object(P.isFiniteNumber)(Pe)&&(T.startTimeOffset=Pe);break}case"MAP":{var Ve=new y.AttrList(re);if(Y.duration){var Ce=new O.Fragment(v,a);c(Ce,Ve,d,q),k=Ce,Y.initSegment=k,k.rawProgramDateTime&&!Y.rawProgramDateTime&&(Y.rawProgramDateTime=k.rawProgramDateTime)}else c(Y,Ve,d,q),k=Y,ne=!0;break}case"SERVER-CONTROL":{var Le=new y.AttrList(re);T.canBlockReload=Le.bool("CAN-BLOCK-RELOAD"),T.canSkipUntil=Le.optionalFloat("CAN-SKIP-UNTIL",0),T.canSkipDateRanges=T.canSkipUntil>0&&Le.bool("CAN-SKIP-DATERANGES"),T.partHoldBack=Le.optionalFloat("PART-HOLD-BACK",0),T.holdBack=Le.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var nt=new y.AttrList(re);T.partTarget=nt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var We=T.partList;We||(We=T.partList=[]);var ft=U>0?We[We.length-1]:void 0,yt=U++,Qe=new O.Part(new y.AttrList(re),Y,a,yt,ft);We.push(Qe),Y.duration+=Qe.duration;break}case"PRELOAD-HINT":{var Ot=new y.AttrList(re);T.preloadHint=Ot;break}case"RENDITION-REPORT":{var Tt=new y.AttrList(re);T.renditionReports=T.renditionReports||[],T.renditionReports.push(Tt);break}default:x.logger.warn("line parsed but not handled: "+$);break}}}z&&!z.relurl?(I.pop(),W-=z.duration,T.partList&&(T.fragmentHint=z)):T.partList&&(o(Y,z),Y.cc=G,T.fragmentHint=Y);var at=I.length,dt=I[0],st=I[at-1];if(W+=T.skippedSegments*T.targetduration,W>0&&at&&st){T.averagetargetduration=W/at;var xt=st.sn;T.endSN=xt!=="initSegment"?xt:0,dt&&(T.startCC=dt.cc,dt.initSegment||T.fragments.every(function(Et){return Et.relurl&&s(Et.relurl)})&&(x.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Y=new O.Fragment(v,a),Y.relurl=st.relurl,Y.level=d,Y.sn="initSegment",dt.initSegment=Y,T.needSidxRanges=!0))}else T.endSN=0,T.startCC=0;return T.fragmentHint&&(W+=T.fragmentHint.duration),T.totalduration=W,T.endCC=G,ie>0&&r(I,ie),T},t}();function g(t,n){["video","audio","text"].forEach(function(u){var a=t.filter(function(v){return Object(D.isCodecType)(v,u)});if(a.length){var d=a.filter(function(v){return v.lastIndexOf("avc1",0)===0||v.lastIndexOf("mp4a",0)===0});n[u+"Codec"]=d.length>0?d[0]:a[0],t=t.filter(function(v){return a.indexOf(v)===-1})}}),n.unknownCodecs=t}function i(t,n,u){var a=n[u];a&&(t[u]=a)}function r(t,n){for(var u=t[n],a=n;a--;){var d=t[a];if(!d)return;d.programDateTime=u.programDateTime-d.duration*1e3,u=d}}function o(t,n){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):n!=null&&n.programDateTime&&(t.programDateTime=n.endProgramDateTime),Object(P.isFiniteNumber)(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}function c(t,n,u,a){t.relurl=n.URI,n.BYTERANGE&&t.setByteRange(n.BYTERANGE),t.level=u,t.sn="initSegment",a&&(t.levelkey=a),t.initSegment=null}},"./src/loader/playlist-loader.ts":function(j,R,l){"use strict";l.r(R);var P=l("./src/polyfills/number.ts"),L=l("./src/events.ts"),A=l("./src/errors.ts"),M=l("./src/utils/logger.ts"),O=l("./src/utils/mp4-tools.ts"),b=l("./src/loader/m3u8-parser.ts"),_=l("./src/types/loader.ts"),y=l("./src/utils/attr-list.ts");function x(m){var p=m.type;switch(p){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function D(m,p){var f=m.url;return(f===void 0||f.indexOf("data:")===0)&&(f=p.url),f}var E=function(){function m(f){this.hls=void 0,this.loaders=Object.create(null),this.hls=f,this.registerListeners()}var p=m.prototype;return p.startLoad=function(e){},p.stopLoad=function(){this.destroyInternalLoaders()},p.registerListeners=function(){var e=this.hls;e.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(L.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(L.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(L.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.unregisterListeners=function(){var e=this.hls;e.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(L.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(L.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(L.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.createInternalLoader=function(e){var s=this.hls.config,h=s.pLoader,g=s.loader,i=h||g,r=new i(s);return e.loader=r,this.loaders[e.type]=r,r},p.getInternalLoader=function(e){return this.loaders[e.type]},p.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},p.destroyInternalLoaders=function(){for(var e in this.loaders){var s=this.loaders[e];s&&s.destroy(),this.resetInternalLoader(e)}},p.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},p.onManifestLoading=function(e,s){var h=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},p.onLevelLoading=function(e,s){var h=s.id,g=s.level,i=s.url,r=s.deliveryDirectives;this.load({id:h,groupId:null,level:g,responseType:"text",type:_.PlaylistContextType.LEVEL,url:i,deliveryDirectives:r})},p.onAudioTrackLoading=function(e,s){var h=s.id,g=s.groupId,i=s.url,r=s.deliveryDirectives;this.load({id:h,groupId:g,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:i,deliveryDirectives:r})},p.onSubtitleTrackLoading=function(e,s){var h=s.id,g=s.groupId,i=s.url,r=s.deliveryDirectives;this.load({id:h,groupId:g,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:i,deliveryDirectives:r})},p.load=function(e){var s,h=this.hls.config,g=this.getInternalLoader(e);if(g){var i=g.context;if(i&&i.url===e.url){M.logger.trace("[playlist-loader]: playlist request ongoing");return}M.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),g.abort()}var r,o,c,t;switch(e.type){case _.PlaylistContextType.MANIFEST:r=h.manifestLoadingMaxRetry,o=h.manifestLoadingTimeOut,c=h.manifestLoadingRetryDelay,t=h.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:r=0,o=h.levelLoadingTimeOut;break;default:r=h.levelLoadingMaxRetry,o=h.levelLoadingTimeOut,c=h.levelLoadingRetryDelay,t=h.levelLoadingMaxRetryTimeout;break}if(g=this.createInternalLoader(e),(s=e.deliveryDirectives)!==null&&s!==void 0&&s.part){var n;if(e.type===_.PlaylistContextType.LEVEL&&e.level!==null?n=this.hls.levels[e.level].details:e.type===_.PlaylistContextType.AUDIO_TRACK&&e.id!==null?n=this.hls.audioTracks[e.id].details:e.type===_.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(n=this.hls.subtitleTracks[e.id].details),n){var u=n.partTarget,a=n.targetduration;u&&a&&(o=Math.min(Math.max(u*3,a*.8)*1e3,o))}}var d={timeout:o,maxRetry:r,retryDelay:c,maxRetryDelay:t,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};g.load(e,d,v)},p.loadsuccess=function(e,s,h,g){if(g===void 0&&(g=null),h.isSidxRequest){this.handleSidxRequest(e,h),this.handlePlaylistLoaded(e,s,h,g);return}this.resetInternalLoader(h.type);var i=e.data;if(i.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(e,h,"no EXTM3U delimiter",g);return}s.parsing.start=performance.now(),i.indexOf("#EXTINF:")>0||i.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,s,h,g):this.handleMasterPlaylist(e,s,h,g)},p.loaderror=function(e,s,h){h===void 0&&(h=null),this.handleNetworkError(s,h,!1,e)},p.loadtimeout=function(e,s,h){h===void 0&&(h=null),this.handleNetworkError(s,h,!0)},p.handleMasterPlaylist=function(e,s,h,g){var i=this.hls,r=e.data,o=D(e,h),c=b.default.parseMasterPlaylist(r,o),t=c.levels,n=c.sessionData;if(!t.length){this.handleManifestParsingError(e,h,"no level found in manifest",g);return}var u=t.map(function(I){return{id:I.attrs.AUDIO,audioCodec:I.audioCodec}}),a=t.map(function(I){return{id:I.attrs.SUBTITLES,textCodec:I.textCodec}}),d=b.default.parseMasterPlaylistMedia(r,o,"AUDIO",u),v=b.default.parseMasterPlaylistMedia(r,o,"SUBTITLES",a),S=b.default.parseMasterPlaylistMedia(r,o,"CLOSED-CAPTIONS");if(d.length){var T=d.some(function(I){return!I.url});!T&&t[0].audioCodec&&!t[0].attrs.AUDIO&&(M.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),d.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}i.trigger(L.Events.MANIFEST_LOADED,{levels:t,audioTracks:d,subtitles:v,captions:S,url:o,stats:s,networkDetails:g,sessionData:n})},p.handleTrackOrLevelPlaylist=function(e,s,h,g){var i=this.hls,r=h.id,o=h.level,c=h.type,t=D(e,h),n=Object(P.isFiniteNumber)(r)?r:0,u=Object(P.isFiniteNumber)(o)?o:n,a=x(h),d=b.default.parseLevelPlaylist(e.data,t,u,a,n);if(!d.fragments.length){i.trigger(L.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:t,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(c===_.PlaylistContextType.MANIFEST){var v={attrs:new y.AttrList({}),bitrate:0,details:d,name:"",url:t};i.trigger(L.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:t,stats:s,networkDetails:g,sessionData:null})}if(s.parsing.end=performance.now(),d.needSidxRanges){var S,T=(S=d.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:T,isSidxRequest:!0,type:c,level:o,levelDetails:d,id:r,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=d,this.handlePlaylistLoaded(e,s,h,g)},p.handleSidxRequest=function(e,s){var h=new Uint8Array(e.data),g=Object(O.findBox)(h,["sidx"])[0];if(!!g){var i=Object(O.parseSegmentIndex)(g);if(!!i){var r=i.references,o=s.levelDetails;r.forEach(function(c,t){var n=c.info,u=o.fragments[t];if(u.byteRange.length===0&&u.setByteRange(String(1+n.end-n.start)+"@"+String(n.start)),u.initSegment){var a=Object(O.findBox)(h,["moov"])[0],d=a?a.length:null;u.initSegment.setByteRange(String(d)+"@0")}})}}},p.handleManifestParsingError=function(e,s,h,g){this.hls.trigger(L.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===_.PlaylistContextType.MANIFEST,url:e.url,reason:h,response:e,context:s,networkDetails:g})},p.handleNetworkError=function(e,s,h,g){h===void 0&&(h=!1),M.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var i=A.ErrorDetails.UNKNOWN,r=!1,o=this.getInternalLoader(e);switch(e.type){case _.PlaylistContextType.MANIFEST:i=h?A.ErrorDetails.MANIFEST_LOAD_TIMEOUT:A.ErrorDetails.MANIFEST_LOAD_ERROR,r=!0;break;case _.PlaylistContextType.LEVEL:i=h?A.ErrorDetails.LEVEL_LOAD_TIMEOUT:A.ErrorDetails.LEVEL_LOAD_ERROR,r=!1;break;case _.PlaylistContextType.AUDIO_TRACK:i=h?A.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:A.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,r=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:i=h?A.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:A.ErrorDetails.SUBTITLE_LOAD_ERROR,r=!1;break}o&&this.resetInternalLoader(e.type);var c={type:A.ErrorTypes.NETWORK_ERROR,details:i,fatal:r,url:e.url,loader:o,context:e,networkDetails:s};g&&(c.response=g),this.hls.trigger(L.Events.ERROR,c)},p.handlePlaylistLoaded=function(e,s,h,g){var i=h.type,r=h.level,o=h.id,c=h.groupId,t=h.loader,n=h.levelDetails,u=h.deliveryDirectives;if(!(n!=null&&n.targetduration)){this.handleManifestParsingError(e,h,"invalid target duration",g);return}if(!!t)switch(n.live&&(t.getCacheAge&&(n.ageHeader=t.getCacheAge()||0),(!t.getCacheAge||isNaN(n.ageHeader))&&(n.ageHeader=0)),i){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(L.Events.LEVEL_LOADED,{details:n,level:r||0,id:o||0,stats:s,networkDetails:g,deliveryDirectives:u});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(L.Events.AUDIO_TRACK_LOADED,{details:n,id:o||0,groupId:c||"",stats:s,networkDetails:g,deliveryDirectives:u});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(L.Events.SUBTITLE_TRACK_LOADED,{details:n,id:o||0,groupId:c||"",stats:s,networkDetails:g,deliveryDirectives:u});break}},m}();R.default=E},"./src/polyfills/number.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"isFiniteNumber",function(){return P}),l.d(R,"MAX_SAFE_INTEGER",function(){return L});var P=Number.isFinite||function(A){return typeof A=="number"&&isFinite(A)},L=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(j,R,l){"use strict";l.r(R);var P=function(){function L(){}return L.getSilentFrame=function(M,O){switch(M){case"mp4a.40.2":if(O===1)return new Uint8Array([0,200,0,128,35,128]);if(O===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(O===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(O===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(O===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(O===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(O===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(O===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(O===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}},L}();R.default=P},"./src/remux/mp4-generator.ts":function(j,R,l){"use strict";l.r(R);var P=Math.pow(2,32)-1,L=function(){function A(){}return A.init=function(){A.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var O;for(O in A.types)A.types.hasOwnProperty(O)&&(A.types[O]=[O.charCodeAt(0),O.charCodeAt(1),O.charCodeAt(2),O.charCodeAt(3)]);var b=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),_=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);A.HDLR_TYPES={video:b,audio:_};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]);A.STTS=A.STSC=A.STCO=x,A.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),A.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),A.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),A.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var D=new Uint8Array([105,115,111,109]),E=new Uint8Array([97,118,99,49]),m=new Uint8Array([0,0,0,1]);A.FTYP=A.box(A.types.ftyp,D,m,D,E),A.DINF=A.box(A.types.dinf,A.box(A.types.dref,y))},A.box=function(O){for(var b=8,_=arguments.length,y=new Array(_>1?_-1:0),x=1;x<_;x++)y[x-1]=arguments[x];for(var D=y.length,E=D;D--;)b+=y[D].byteLength;var m=new Uint8Array(b);for(m[0]=b>>24&255,m[1]=b>>16&255,m[2]=b>>8&255,m[3]=b&255,m.set(O,4),D=0,b=8;D<E;D++)m.set(y[D],b),b+=y[D].byteLength;return m},A.hdlr=function(O){return A.box(A.types.hdlr,A.HDLR_TYPES[O])},A.mdat=function(O){return A.box(A.types.mdat,O)},A.mdhd=function(O,b){b*=O;var _=Math.floor(b/(P+1)),y=Math.floor(b%(P+1));return A.box(A.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,_>>24,_>>16&255,_>>8&255,_&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},A.mdia=function(O){return A.box(A.types.mdia,A.mdhd(O.timescale,O.duration),A.hdlr(O.type),A.minf(O))},A.mfhd=function(O){return A.box(A.types.mfhd,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255]))},A.minf=function(O){return O.type==="audio"?A.box(A.types.minf,A.box(A.types.smhd,A.SMHD),A.DINF,A.stbl(O)):A.box(A.types.minf,A.box(A.types.vmhd,A.VMHD),A.DINF,A.stbl(O))},A.moof=function(O,b,_){return A.box(A.types.moof,A.mfhd(O),A.traf(_,b))},A.moov=function(O){for(var b=O.length,_=[];b--;)_[b]=A.trak(O[b]);return A.box.apply(null,[A.types.moov,A.mvhd(O[0].timescale,O[0].duration)].concat(_).concat(A.mvex(O)))},A.mvex=function(O){for(var b=O.length,_=[];b--;)_[b]=A.trex(O[b]);return A.box.apply(null,[A.types.mvex].concat(_))},A.mvhd=function(O,b){b*=O;var _=Math.floor(b/(P+1)),y=Math.floor(b%(P+1)),x=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,_>>24,_>>16&255,_>>8&255,_&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return A.box(A.types.mvhd,x)},A.sdtp=function(O){var b=O.samples||[],_=new Uint8Array(4+b.length),y,x;for(y=0;y<b.length;y++)x=b[y].flags,_[y+4]=x.dependsOn<<4|x.isDependedOn<<2|x.hasRedundancy;return A.box(A.types.sdtp,_)},A.stbl=function(O){return A.box(A.types.stbl,A.stsd(O),A.box(A.types.stts,A.STTS),A.box(A.types.stsc,A.STSC),A.box(A.types.stsz,A.STSZ),A.box(A.types.stco,A.STCO))},A.avc1=function(O){var b=[],_=[],y,x,D;for(y=0;y<O.sps.length;y++)x=O.sps[y],D=x.byteLength,b.push(D>>>8&255),b.push(D&255),b=b.concat(Array.prototype.slice.call(x));for(y=0;y<O.pps.length;y++)x=O.pps[y],D=x.byteLength,_.push(D>>>8&255),_.push(D&255),_=_.concat(Array.prototype.slice.call(x));var E=A.box(A.types.avcC,new Uint8Array([1,b[3],b[4],b[5],255,224|O.sps.length].concat(b).concat([O.pps.length]).concat(_))),m=O.width,p=O.height,f=O.pixelRatio[0],e=O.pixelRatio[1];return A.box(A.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,m>>8&255,m&255,p>>8&255,p&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),E,A.box(A.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),A.box(A.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,e>>24,e>>16&255,e>>8&255,e&255])))},A.esds=function(O){var b=O.config.length;return new Uint8Array([0,0,0,0,3,23+b,0,1,0,4,15+b,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([b]).concat(O.config).concat([6,1,2]))},A.mp4a=function(O){var b=O.samplerate;return A.box(A.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,b>>8&255,b&255,0,0]),A.box(A.types.esds,A.esds(O)))},A.mp3=function(O){var b=O.samplerate;return A.box(A.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,b>>8&255,b&255,0,0]))},A.stsd=function(O){return O.type==="audio"?O.segmentCodec==="mp3"&&O.codec==="mp3"?A.box(A.types.stsd,A.STSD,A.mp3(O)):A.box(A.types.stsd,A.STSD,A.mp4a(O)):A.box(A.types.stsd,A.STSD,A.avc1(O))},A.tkhd=function(O){var b=O.id,_=O.duration*O.timescale,y=O.width,x=O.height,D=Math.floor(_/(P+1)),E=Math.floor(_%(P+1));return A.box(A.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,b>>24&255,b>>16&255,b>>8&255,b&255,0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,E>>24,E>>16&255,E>>8&255,E&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,x>>8&255,x&255,0,0]))},A.traf=function(O,b){var _=A.sdtp(O),y=O.id,x=Math.floor(b/(P+1)),D=Math.floor(b%(P+1));return A.box(A.types.traf,A.box(A.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),A.box(A.types.tfdt,new Uint8Array([1,0,0,0,x>>24,x>>16&255,x>>8&255,x&255,D>>24,D>>16&255,D>>8&255,D&255])),A.trun(O,_.length+16+20+8+16+8+8),_)},A.trak=function(O){return O.duration=O.duration||4294967295,A.box(A.types.trak,A.tkhd(O),A.mdia(O))},A.trex=function(O){var b=O.id;return A.box(A.types.trex,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},A.trun=function(O,b){var _=O.samples||[],y=_.length,x=12+16*y,D=new Uint8Array(x),E,m,p,f,e,s;for(b+=8+x,D.set([O.type==="video"?1:0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255],0),E=0;E<y;E++)m=_[E],p=m.duration,f=m.size,e=m.flags,s=m.cts,D.set([p>>>24&255,p>>>16&255,p>>>8&255,p&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,e.isLeading<<2|e.dependsOn,e.isDependedOn<<6|e.hasRedundancy<<4|e.paddingValue<<1|e.isNonSync,e.degradPrio&240<<8,e.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*E);return A.box(A.types.trun,D)},A.initSegment=function(O){A.types||A.init();var b=A.moov(O),_=new Uint8Array(A.FTYP.byteLength+b.byteLength);return _.set(A.FTYP),_.set(b,A.FTYP.byteLength),_},A}();L.types=void 0,L.HDLR_TYPES=void 0,L.STTS=void 0,L.STSC=void 0,L.STCO=void 0,L.STSZ=void 0,L.VMHD=void 0,L.SMHD=void 0,L.STSD=void 0,L.FTYP=void 0,L.DINF=void 0,R.default=L},"./src/remux/mp4-remuxer.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return e}),l.d(R,"normalizePts",function(){return s}),l.d(R,"flushTextTrackMetadataCueSamples",function(){return g}),l.d(R,"flushTextTrackUserdataCueSamples",function(){return i});var P=l("./src/polyfills/number.ts"),L=l("./src/remux/aac-helper.ts"),A=l("./src/remux/mp4-generator.ts"),M=l("./src/events.ts"),O=l("./src/errors.ts"),b=l("./src/utils/logger.ts"),_=l("./src/types/loader.ts"),y=l("./src/utils/timescale-conversion.ts");function x(){return x=Object.assign?Object.assign.bind():function(c){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(c[u]=n[u])}return c},x.apply(this,arguments)}var D=10*1e3,E=1024,m=1152,p=null,f=null,e=function(){function c(n,u,a,d){if(d===void 0&&(d=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=n,this.config=u,this.typeSupported=a,this.ISGenerated=!1,p===null){var v=navigator.userAgent||"",S=v.match(/Chrome\/(\d+)/i);p=S?parseInt(S[1]):0}if(f===null){var T=navigator.userAgent.match(/Safari\/(\d+)/i);f=T?parseInt(T[1]):0}}var t=c.prototype;return t.destroy=function(){},t.resetTimeStamp=function(u){b.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=u},t.resetNextTimestamp=function(){b.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){b.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},t.getVideoStartPts=function(u){var a=!1,d=u.reduce(function(v,S){var T=S.pts-v;return T<-4294967296?(a=!0,s(v,S.pts)):T>0?v:S.pts},u[0].pts);return a&&b.logger.debug("PTS rollover detected"),d},t.remux=function(u,a,d,v,S,T,I,k){var B,U,W,G,z,Y,$=S,Z=S,q=u.pid>-1,ie=a.pid>-1,ne=a.samples.length,ae=u.samples.length>0,te=I&&ne>0||ne>1,fe=(!q||ae)&&(!ie||te)||this.ISGenerated||I;if(fe){this.ISGenerated||(W=this.generateIS(u,a,S));var de=this.isVideoContiguous,re=-1,Ee;if(te&&(re=h(a.samples),!de&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,re>0){b.logger.warn("[mp4-remuxer]: Dropped "+re+" out of "+ne+" video samples due to a missing keyframe");var me=this.getVideoStartPts(a.samples);a.samples=a.samples.slice(re),a.dropped+=re,Z+=(a.samples[0].pts-me)/a.inputTimeScale,Ee=Z}else re===-1&&(b.logger.warn("[mp4-remuxer]: No keyframe found out of "+ne+" video samples"),Y=!1);if(this.ISGenerated){if(ae&&te){var Te=this.getVideoStartPts(a.samples),Me=s(u.samples[0].pts,Te)-Te,_e=Me/a.inputTimeScale;$+=Math.max(0,_e),Z+=Math.max(0,-_e)}if(ae){if(u.samplerate||(b.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),W=this.generateIS(u,a,S)),U=this.remuxAudio(u,$,this.isAudioContiguous,T,ie||te||k===_.PlaylistLevelType.AUDIO?Z:void 0),te){var ke=U?U.endPTS-U.startPTS:0;a.inputTimeScale||(b.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),W=this.generateIS(u,a,S)),B=this.remuxVideo(a,Z,de,ke)}}else te&&(B=this.remuxVideo(a,Z,de,0));B&&(B.firstKeyFrame=re,B.independent=re!==-1,B.firstKeyFramePTS=Ee)}}return this.ISGenerated&&(d.samples.length&&(z=g(d,S,this._initPTS,this._initDTS)),v.samples.length&&(G=i(v,S,this._initPTS))),{audio:U,video:B,initSegment:W,independent:Y,text:G,id3:z}},t.generateIS=function(u,a,d){var v=u.samples,S=a.samples,T=this.typeSupported,I={},k=!Object(P.isFiniteNumber)(this._initPTS),B="audio/mp4",U,W,G;if(k&&(U=W=1/0),u.config&&v.length){switch(u.timescale=u.samplerate,u.segmentCodec){case"mp3":T.mpeg?(B="audio/mpeg",u.codec=""):T.mp3&&(u.codec="mp3");break}I.audio={id:"audio",container:B,codec:u.codec,initSegment:u.segmentCodec==="mp3"&&T.mpeg?new Uint8Array(0):A.default.initSegment([u]),metadata:{channelCount:u.channelCount}},k&&(G=u.inputTimeScale,U=W=v[0].pts-Math.round(G*d))}if(a.sps&&a.pps&&S.length&&(a.timescale=a.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:a.codec,initSegment:A.default.initSegment([a]),metadata:{width:a.width,height:a.height}},k)){G=a.inputTimeScale;var z=this.getVideoStartPts(S),Y=Math.round(G*d);W=Math.min(W,s(S[0].dts,z)-Y),U=Math.min(U,z-Y)}if(Object.keys(I).length)return this.ISGenerated=!0,k&&(this._initPTS=U,this._initDTS=W),{tracks:I,initPTS:U,timescale:G}},t.remuxVideo=function(u,a,d,v){var S=u.inputTimeScale,T=u.samples,I=[],k=T.length,B=this._initPTS,U=this.nextAvcDts,W=8,G=this.videoSampleDuration,z,Y,$=Number.POSITIVE_INFINITY,Z=Number.NEGATIVE_INFINITY,q=!1;if(!d||U===null){var ie=a*S,ne=T[0].pts-s(T[0].dts,T[0].pts);U=ie-ne}for(var ae=0;ae<k;ae++){var te=T[ae];te.pts=s(te.pts-B,U),te.dts=s(te.dts-B,U),te.dts<T[ae>0?ae-1:ae].dts&&(q=!0)}q&&T.sort(function(It,rr){var St=It.dts-rr.dts,gr=It.pts-rr.pts;return St||gr}),z=T[0].dts,Y=T[T.length-1].dts;var fe=Y-z,de=fe?Math.round(fe/(k-1)):G||u.inputTimeScale/30;if(d){var re=z-U,Ee=re>de,me=re<-1;if(Ee||me){Ee?b.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(re,!0)+" ms ("+re+"dts) hole between fragments detected, filling it"):b.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-re,!0)+" ms ("+re+"dts) overlapping between fragments detected"),z=U;var Te=T[0].pts-re;T[0].dts=z,T[0].pts=Te,b.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Te,!0)+"/"+Object(y.toMsFromMpegTsClock)(z,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(re,!0)+" ms")}}z=Math.max(0,z);for(var Me=0,_e=0,ke=0;ke<k;ke++){for(var Ie=T[ke],Be=Ie.units,be=Be.length,Ue=0,Ke=0;Ke<be;Ke++)Ue+=Be[Ke].data.length;_e+=Ue,Me+=be,Ie.length=Ue,Ie.dts=Math.max(Ie.dts,z),$=Math.min(Ie.pts,$),Z=Math.max(Ie.pts,Z)}Y=T[k-1].dts;var je=_e+4*Me+8,Ne;try{Ne=new Uint8Array(je)}catch{this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:O.ErrorTypes.MUX_ERROR,details:O.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating video mdat "+je});return}var et=new DataView(Ne.buffer);et.setUint32(0,je),Ne.set(A.default.types.mdat,4);for(var Fe=!1,tt=Number.POSITIVE_INFINITY,Oe=Number.POSITIVE_INFINITY,Pe=Number.NEGATIVE_INFINITY,Ve=Number.NEGATIVE_INFINITY,Ce=0;Ce<k;Ce++){for(var Le=T[Ce],nt=Le.units,We=0,ft=0,yt=nt.length;ft<yt;ft++){var Qe=nt[ft],Ot=Qe.data,Tt=Qe.data.byteLength;et.setUint32(W,Tt),W+=4,Ne.set(Ot,W),W+=Tt,We+=4+Tt}var at=void 0;if(Ce<k-1)G=T[Ce+1].dts-Le.dts,at=T[Ce+1].pts-Le.pts;else{var dt=this.config,st=Ce>0?Le.dts-T[Ce-1].dts:de;if(at=Ce>0?Le.pts-T[Ce-1].pts:de,dt.stretchShortVideoTrack&&this.nextAudioPts!==null){var xt=Math.floor(dt.maxBufferHole*S),Et=(v?$+v*S:this.nextAudioPts)-Le.pts;Et>xt?(G=Et-st,G<0?G=st:Fe=!0,b.logger.log("[mp4-remuxer]: It is approximately "+Et/90+" ms to the next segment; using duration "+G/90+" ms for the last video frame.")):G=st}else G=st}var cr=Math.round(Le.pts-Le.dts);tt=Math.min(tt,G),Pe=Math.max(Pe,G),Oe=Math.min(Oe,at),Ve=Math.max(Ve,at),I.push(new r(Le.key,G,We,cr))}if(I.length){if(p){if(p<70){var Ut=I[0].flags;Ut.dependsOn=2,Ut.isNonSync=0}}else if(f&&Ve-Oe<Pe-tt&&de/Pe<.025&&I[0].cts===0){b.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var Rt=z,$e=0,er=I.length;$e<er;$e++){var Nt=Rt+I[$e].duration,tr=Rt+I[$e].cts;if($e<er-1){var Kt=Nt+I[$e+1].cts;I[$e].duration=Kt-tr}else I[$e].duration=$e?I[$e-1].duration:de;I[$e].cts=0,Rt=Nt}}}console.assert(G!==null,"mp4SampleDuration must be computed"),G=Fe||!G?de:G,this.nextAvcDts=U=Y+G,this.videoSampleDuration=G,this.isVideoContiguous=!0;var hr=A.default.moof(u.sequenceNumber++,z,x({},u,{samples:I})),vr="video",ot={data1:hr,data2:Ne,startPTS:$/S,endPTS:(Z+G)/S,startDTS:z/S,endDTS:U/S,type:vr,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:u.dropped};return u.samples=[],u.dropped=0,console.assert(Ne.length,"MDAT length must not be zero"),ot},t.remuxAudio=function(u,a,d,v,S){var T=u.inputTimeScale,I=u.samplerate?u.samplerate:T,k=T/I,B=u.segmentCodec==="aac"?E:m,U=B*k,W=this._initPTS,G=u.segmentCodec==="mp3"&&this.typeSupported.mpeg,z=[],Y=S!==void 0,$=u.samples,Z=G?0:8,q=this.nextAudioPts||-1,ie=a*T;if(this.isAudioContiguous=d=d||$.length&&q>0&&(v&&Math.abs(ie-q)<9e3||Math.abs(s($[0].pts-W,ie)-q)<20*U),$.forEach(function(Qe){Qe.pts=s(Qe.pts-W,ie)}),!d||q<0){if($=$.filter(function(Qe){return Qe.pts>=0}),!$.length)return;S===0?q=0:v&&!Y?q=Math.max(0,ie):q=$[0].pts}if(u.segmentCodec==="aac")for(var ne=this.config.maxAudioFramesDrift,ae=0,te=q;ae<$.length;ae++){var fe=$[ae],de=fe.pts,re=de-te,Ee=Math.abs(1e3*re/T);if(re<=-ne*U&&Y)ae===0&&(b.logger.warn("Audio frame @ "+(de/T).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*re/T)+" ms."),this.nextAudioPts=q=te=de);else if(re>=ne*U&&Ee<D&&Y){var me=Math.round(re/U);te=de-me*U,te<0&&(me--,te+=U),ae===0&&(this.nextAudioPts=q=te),b.logger.warn("[mp4-remuxer]: Injecting "+me+" audio frame @ "+(te/T).toFixed(3)+"s due to "+Math.round(1e3*re/T)+" ms gap.");for(var Te=0;Te<me;Te++){var Me=Math.max(te,0),_e=L.default.getSilentFrame(u.manifestCodec||u.codec,u.channelCount);_e||(b.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),_e=fe.unit.subarray()),$.splice(ae,0,{unit:_e,pts:Me}),te+=U,ae++}}fe.pts=te,te+=U}for(var ke=null,Ie=null,Be,be=0,Ue=$.length;Ue--;)be+=$[Ue].unit.byteLength;for(var Ke=0,je=$.length;Ke<je;Ke++){var Ne=$[Ke],et=Ne.unit,Fe=Ne.pts;if(Ie!==null){var tt=z[Ke-1];tt.duration=Math.round((Fe-Ie)/k)}else if(d&&u.segmentCodec==="aac"&&(Fe=q),ke=Fe,be>0){be+=Z;try{Be=new Uint8Array(be)}catch{this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:O.ErrorTypes.MUX_ERROR,details:O.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:be,reason:"fail allocating audio mdat "+be});return}if(!G){var Oe=new DataView(Be.buffer);Oe.setUint32(0,be),Be.set(A.default.types.mdat,4)}}else return;Be.set(et,Z);var Pe=et.byteLength;Z+=Pe,z.push(new r(!0,B,Pe,0)),Ie=Fe}var Ve=z.length;if(!!Ve){var Ce=z[z.length-1];this.nextAudioPts=q=Ie+k*Ce.duration;var Le=G?new Uint8Array(0):A.default.moof(u.sequenceNumber++,ke/k,x({},u,{samples:z}));u.samples=[];var nt=ke/T,We=q/T,ft="audio",yt={data1:Le,data2:Be,startPTS:nt,endPTS:We,startDTS:nt,endDTS:We,type:ft,hasAudio:!0,hasVideo:!1,nb:Ve};return this.isAudioContiguous=!0,console.assert(Be.length,"MDAT length must not be zero"),yt}},t.remuxEmptyAudio=function(u,a,d,v){var S=u.inputTimeScale,T=u.samplerate?u.samplerate:S,I=S/T,k=this.nextAudioPts,B=(k!==null?k:v.startDTS*S)+this._initDTS,U=v.endDTS*S+this._initDTS,W=I*E,G=Math.ceil((U-B)/W),z=L.default.getSilentFrame(u.manifestCodec||u.codec,u.channelCount);if(b.logger.warn("[mp4-remuxer]: remux empty Audio"),!z){b.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],$=0;$<G;$++){var Z=B+$*W;Y.push({unit:z,pts:Z,dts:Z})}return u.samples=Y,this.remuxAudio(u,a,d,!1)},c}();function s(c,t){var n;if(t===null)return c;for(t<c?n=-8589934592:n=8589934592;Math.abs(c-t)>4294967296;)c+=n;return c}function h(c){for(var t=0;t<c.length;t++)if(c[t].key)return t;return-1}function g(c,t,n,u){var a=c.samples.length;if(!!a){for(var d=c.inputTimeScale,v=0;v<a;v++){var S=c.samples[v];S.pts=s(S.pts-n,t*d)/d,S.dts=s(S.dts-u,t*d)/d}var T=c.samples;return c.samples=[],{samples:T}}}function i(c,t,n){var u=c.samples.length;if(!!u){for(var a=c.inputTimeScale,d=0;d<u;d++){var v=c.samples[d];v.pts=s(v.pts-n,t*a)/a}c.samples.sort(function(T,I){return T.pts-I.pts});var S=c.samples;return c.samples=[],{samples:S}}}var r=function(t,n,u,a){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=n,this.size=u,this.cts=a,this.flags=new o(t)},o=function(t){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=t?2:1,this.isNonSync=t?0:1}},"./src/remux/passthrough-remuxer.ts":function(j,R,l){"use strict";l.r(R);var P=l("./src/polyfills/number.ts"),L=l("./src/remux/mp4-remuxer.ts"),A=l("./src/utils/mp4-tools.ts"),M=l("./src/loader/fragment.ts"),O=l("./src/utils/logger.ts"),b=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndTime=null}var x=y.prototype;return x.destroy=function(){},x.resetTimeStamp=function(E){this.initPTS=E,this.lastEndTime=null},x.resetNextTimestamp=function(){this.lastEndTime=null},x.resetInitSegment=function(E,m,p){this.audioCodec=m,this.videoCodec=p,this.generateInitSegment(E),this.emitInitSegment=!0},x.generateInitSegment=function(E){var m=this.audioCodec,p=this.videoCodec;if(!E||!E.byteLength){this.initTracks=void 0,this.initData=void 0;return}var f=this.initData=Object(A.parseInitSegment)(E);m||(m=_(f.audio,M.ElementaryStreamTypes.AUDIO)),p||(p=_(f.video,M.ElementaryStreamTypes.VIDEO));var e={};f.audio&&f.video?e.audiovideo={container:"video/mp4",codec:m+","+p,initSegment:E,id:"main"}:f.audio?e.audio={container:"audio/mp4",codec:m,initSegment:E,id:"audio"}:f.video?e.video={container:"video/mp4",codec:p,initSegment:E,id:"main"}:O.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=e},x.remux=function(E,m,p,f,e){var s,h=this.initPTS,g=this.lastEndTime,i={audio:void 0,video:void 0,text:f,id3:p,initSegment:void 0};Object(P.isFiniteNumber)(g)||(g=this.lastEndTime=e||0);var r=m.samples;if(!r||!r.length)return i;var o={initPTS:void 0,timescale:1},c=this.initData;if((!c||!c.length)&&(this.generateInitSegment(r),c=this.initData),!c||!c.length)return O.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),i;this.emitInitSegment&&(o.tracks=this.initTracks,this.emitInitSegment=!1);var t=Object(A.getStartDTS)(c,r);Object(P.isFiniteNumber)(h)||(this.initPTS=o.initPTS=h=t-e);var n=Object(A.getDuration)(r,c),u=E?t-h:g,a=u+n;Object(A.offsetStartDTS)(c,r,h),n>0?this.lastEndTime=a:(O.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!c.audio,v=!!c.video,S="";d&&(S+="audio"),v&&(S+="video");var T={data1:r,startPTS:u,startDTS:u,endPTS:a,endDTS:a,type:S,hasAudio:d,hasVideo:v,nb:1,dropped:0};i.audio=T.type==="audio"?T:void 0,i.video=T.type!=="audio"?T:void 0,i.initSegment=o;var I=(s=this.initPTS)!=null?s:0;return i.id3=Object(L.flushTextTrackMetadataCueSamples)(p,e,I,I),f.samples.length&&(i.text=Object(L.flushTextTrackUserdataCueSamples)(f,e,I)),i},y}();function _(y,x){var D=y==null?void 0:y.codec;return D&&D.length>4?D:D==="hvc1"||D==="hev1"?"hvc1.1.c.L120.90":D==="av01"?"av01.0.04M.08":D==="avc1"||x===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}R.default=b},"./src/task-loop.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return P});var P=function(){function L(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var A=L.prototype;return A.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},A.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},A.onHandlerDestroyed=function(){},A.hasInterval=function(){return!!this._tickInterval},A.hasNextTick=function(){return!!this._tickTimer},A.setInterval=function(O){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,O),!0)},A.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},A.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},A.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},A.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},A.doTick=function(){},L}()},"./src/types/cmcd.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"CMCDVersion",function(){return P}),l.d(R,"CMCDObjectType",function(){return L}),l.d(R,"CMCDStreamingFormat",function(){return A}),l.d(R,"CMCDStreamType",function(){return M});var P=1,L;(function(O){O.MANIFEST="m",O.AUDIO="a",O.VIDEO="v",O.MUXED="av",O.INIT="i",O.CAPTION="c",O.TIMED_TEXT="tt",O.KEY="k",O.OTHER="o"})(L||(L={}));var A;(function(O){O.DASH="d",O.HLS="h",O.SMOOTH="s",O.OTHER="o"})(A||(A={}));var M;(function(O){O.VOD="v",O.LIVE="l"})(M||(M={}))},"./src/types/demuxer.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"MetadataSchema",function(){return P});var P;(function(L){L.audioId3="org.id3",L.dateRange="com.apple.quicktime.HLS",L.emsg="https://aomedia.org/emsg/ID3"})(P||(P={}))},"./src/types/level.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"HlsSkip",function(){return A}),l.d(R,"getSkipValue",function(){return M}),l.d(R,"HlsUrlParameters",function(){return O}),l.d(R,"Level",function(){return b});function P(_,y){for(var x=0;x<y.length;x++){var D=y[x];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(_,D.key,D)}}function L(_,y,x){return y&&P(_.prototype,y),x&&P(_,x),Object.defineProperty(_,"prototype",{writable:!1}),_}var A;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(A||(A={}));function M(_,y){var x=_.canSkipUntil,D=_.canSkipDateRanges,E=_.endSN,m=y!==void 0?y-E:0;return x&&m<x?D?A.v2:A.Yes:A.No}var O=function(){function _(x,D,E){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=x,this.part=D,this.skip=E}var y=_.prototype;return y.addDirectives=function(D){var E=new self.URL(D);return this.msn!==void 0&&E.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&E.searchParams.set("_HLS_part",this.part.toString()),this.skip&&E.searchParams.set("_HLS_skip",this.skip),E.toString()},_}(),b=function(){function _(y){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(x){return x}).join(",").replace(/\.[^.,]+/g,"")}return L(_,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(x){var D=x%this.url.length;this._urlId!==D&&(this.details=void 0,this._urlId=D)}}]),_}()},"./src/types/loader.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"PlaylistContextType",function(){return P}),l.d(R,"PlaylistLevelType",function(){return L});var P;(function(A){A.MANIFEST="manifest",A.LEVEL="level",A.AUDIO_TRACK="audioTrack",A.SUBTITLE_TRACK="subtitleTrack"})(P||(P={}));var L;(function(A){A.MAIN="main",A.AUDIO="audio",A.SUBTITLE="subtitle"})(L||(L={}))},"./src/types/transmuxer.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"ChunkMetadata",function(){return P});var P=function(M,O,b,_,y,x){_===void 0&&(_=0),y===void 0&&(y=-1),x===void 0&&(x=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=L(),this.buffering={audio:L(),video:L(),audiovideo:L()},this.level=M,this.sn=O,this.id=b,this.size=_,this.part=y,this.partial=x};function L(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"AttrList",function(){return A});var P=/^(\d+)x(\d+)$/,L=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,A=function(){function M(b){typeof b=="string"&&(b=M.parseAttrList(b));for(var _ in b)b.hasOwnProperty(_)&&(this[_]=b[_])}var O=M.prototype;return O.decimalInteger=function(_){var y=parseInt(this[_],10);return y>Number.MAX_SAFE_INTEGER?1/0:y},O.hexadecimalInteger=function(_){if(this[_]){var y=(this[_]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var x=new Uint8Array(y.length/2),D=0;D<y.length/2;D++)x[D]=parseInt(y.slice(D*2,D*2+2),16);return x}else return null},O.hexadecimalIntegerAsNumber=function(_){var y=parseInt(this[_],16);return y>Number.MAX_SAFE_INTEGER?1/0:y},O.decimalFloatingPoint=function(_){return parseFloat(this[_])},O.optionalFloat=function(_,y){var x=this[_];return x?parseFloat(x):y},O.enumeratedString=function(_){return this[_]},O.bool=function(_){return this[_]==="YES"},O.decimalResolution=function(_){var y=P.exec(this[_]);if(y!==null)return{width:parseInt(y[1],10),height:parseInt(y[2],10)}},M.parseAttrList=function(_){var y,x={},D='"';for(L.lastIndex=0;(y=L.exec(_))!==null;){var E=y[2];E.indexOf(D)===0&&E.lastIndexOf(D)===E.length-1&&(E=E.slice(1,-1)),x[y[1]]=E}return x},M}()},"./src/utils/binary-search.ts":function(j,R,l){"use strict";l.r(R);var P={search:function(A,M){for(var O=0,b=A.length-1,_=null,y=null;O<=b;){_=(O+b)/2|0,y=A[_];var x=M(y);if(x>0)O=_+1;else if(x<0)b=_-1;else return y}return null}};R.default=P},"./src/utils/buffer-helper.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"BufferHelper",function(){return A});var P=l("./src/utils/logger.ts"),L={length:0,start:function(){return 0},end:function(){return 0}},A=function(){function M(){}return M.isBuffered=function(b,_){try{if(b){for(var y=M.getBuffered(b),x=0;x<y.length;x++)if(_>=y.start(x)&&_<=y.end(x))return!0}}catch{}return!1},M.bufferInfo=function(b,_,y){try{if(b){var x=M.getBuffered(b),D=[],E;for(E=0;E<x.length;E++)D.push({start:x.start(E),end:x.end(E)});return this.bufferedInfo(D,_,y)}}catch{}return{len:0,start:_,end:_,nextStart:void 0}},M.bufferedInfo=function(b,_,y){_=Math.max(0,_),b.sort(function(r,o){var c=r.start-o.start;return c||o.end-r.end});var x=[];if(y)for(var D=0;D<b.length;D++){var E=x.length;if(E){var m=x[E-1].end;b[D].start-m<y?b[D].end>m&&(x[E-1].end=b[D].end):x.push(b[D])}else x.push(b[D])}else x=b;for(var p=0,f,e=_,s=_,h=0;h<x.length;h++){var g=x[h].start,i=x[h].end;if(_+y>=g&&_<i)e=g,s=i,p=s-_;else if(_+y<g){f=g;break}}return{len:p,start:e||0,end:s||0,nextStart:f}},M.getBuffered=function(b){try{return b.buffered}catch(_){return P.logger.log("failed to get media.buffered",_),L}},M}()},"./src/utils/cea-608-parser.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"Row",function(){return s}),l.d(R,"CaptionScreen",function(){return h});var P=l("./src/utils/logger.ts"),L={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},A=function(n){var u=n;return L.hasOwnProperty(n)&&(u=L[n]),String.fromCharCode(u)},M=15,O=100,b={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},x={25:2,26:4,29:6,30:8,31:10,27:13,28:15},D=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],E;(function(t){t[t.ERROR=0]="ERROR",t[t.TEXT=1]="TEXT",t[t.WARNING=2]="WARNING",t[t.INFO=2]="INFO",t[t.DEBUG=3]="DEBUG",t[t.DATA=3]="DATA"})(E||(E={}));var m=function(){function t(){this.time=null,this.verboseLevel=E.ERROR}var n=t.prototype;return n.log=function(a,d){this.verboseLevel>=a&&P.logger.log(this.time+" ["+a+"] "+d)},t}(),p=function(n){for(var u=[],a=0;a<n.length;a++)u.push(n[a].toString(16));return u},f=function(){function t(u,a,d,v,S){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=d||!1,this.background=v||"black",this.flash=S||!1}var n=t.prototype;return n.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},n.setStyles=function(a){for(var d=["foreground","underline","italics","background","flash"],v=0;v<d.length;v++){var S=d[v];a.hasOwnProperty(S)&&(this[S]=a[S])}},n.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},n.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},n.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},n.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},t}(),e=function(){function t(u,a,d,v,S,T){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new f(a,d,v,S,T)}var n=t.prototype;return n.reset=function(){this.uchar=" ",this.penState.reset()},n.setChar=function(a,d){this.uchar=a,this.penState.copy(d)},n.setPenState=function(a){this.penState.copy(a)},n.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},n.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},n.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},t}(),s=function(){function t(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<O;a++)this.chars.push(new e);this.logger=u,this.pos=0,this.currPenState=new f}var n=t.prototype;return n.equals=function(a){for(var d=!0,v=0;v<O;v++)if(!this.chars[v].equals(a.chars[v])){d=!1;break}return d},n.copy=function(a){for(var d=0;d<O;d++)this.chars[d].copy(a.chars[d])},n.isEmpty=function(){for(var a=!0,d=0;d<O;d++)if(!this.chars[d].isEmpty()){a=!1;break}return a},n.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(E.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>O&&(this.logger.log(E.DEBUG,"Too large cursor position "+this.pos),this.pos=O)},n.moveCursor=function(a){var d=this.pos+a;if(a>1)for(var v=this.pos+1;v<d+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(d)},n.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},n.insertChar=function(a){a>=144&&this.backSpace();var d=A(a);if(this.pos>=O){this.logger.log(E.ERROR,"Cannot insert "+a.toString(16)+" ("+d+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(d,this.currPenState),this.moveCursor(1)},n.clearFromPos=function(a){var d;for(d=a;d<O;d++)this.chars[d].reset()},n.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},n.clearToEndOfRow=function(){this.clearFromPos(this.pos)},n.getTextString=function(){for(var a=[],d=!0,v=0;v<O;v++){var S=this.chars[v].uchar;S!==" "&&(d=!1),a.push(S)}return d?"":a.join("")},n.setPenStyles=function(a){this.currPenState.setStyles(a);var d=this.chars[this.pos];d.setPenState(this.currPenState)},t}(),h=function(){function t(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<M;a++)this.rows.push(new s(u));this.logger=u,this.currRow=M-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var n=t.prototype;return n.reset=function(){for(var a=0;a<M;a++)this.rows[a].clear();this.currRow=M-1},n.equals=function(a){for(var d=!0,v=0;v<M;v++)if(!this.rows[v].equals(a.rows[v])){d=!1;break}return d},n.copy=function(a){for(var d=0;d<M;d++)this.rows[d].copy(a.rows[d])},n.isEmpty=function(){for(var a=!0,d=0;d<M;d++)if(!this.rows[d].isEmpty()){a=!1;break}return a},n.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},n.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},n.insertChar=function(a){var d=this.rows[this.currRow];d.insertChar(a)},n.setPen=function(a){var d=this.rows[this.currRow];d.setPenStyles(a)},n.moveCursor=function(a){var d=this.rows[this.currRow];d.moveCursor(a)},n.setCursor=function(a){this.logger.log(E.INFO,"setCursor: "+a);var d=this.rows[this.currRow];d.setCursor(a)},n.setPAC=function(a){this.logger.log(E.INFO,"pacData = "+JSON.stringify(a));var d=a.row-1;if(this.nrRollUpRows&&d<this.nrRollUpRows-1&&(d=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==d){for(var v=0;v<M;v++)this.rows[v].clear();var S=this.currRow+1-this.nrRollUpRows,T=this.lastOutputScreen;if(T){var I=T.rows[S].cueStartTime,k=this.logger.time;if(I&&k!==null&&I<k)for(var B=0;B<this.nrRollUpRows;B++)this.rows[d-this.nrRollUpRows+B+1].copy(T.rows[S+B])}}this.currRow=d;var U=this.rows[this.currRow];if(a.indent!==null){var W=a.indent,G=Math.max(W-1,0);U.setCursor(a.indent),a.color=U.chars[G].penState.foreground}var z={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(z)},n.setBkgData=function(a){this.logger.log(E.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},n.setRollUpRows=function(a){this.nrRollUpRows=a},n.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(E.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(E.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,d=this.rows.splice(a,1)[0];d.clear(),this.rows.splice(this.currRow,0,d),this.logger.log(E.INFO,"Rolling up")},n.getDisplayText=function(a){a=a||!1;for(var d=[],v="",S=-1,T=0;T<M;T++){var I=this.rows[T].getTextString();I&&(S=T+1,a?d.push("Row "+S+": '"+I+"'"):d.push(I.trim()))}return d.length>0&&(a?v="["+d.join(" | ")+"]":v=d.join(`
20
20
  `)),v},n.getTextAndFormat=function(){return this.rows},t}(),g=function(){function t(u,a,d){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new h(d),this.nonDisplayedMemory=new h(d),this.lastOutputScreen=new h(d),this.currRollUpRow=this.displayedMemory.rows[M-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=d}var n=t.prototype;return n.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[M-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},n.getHandler=function(){return this.outputFilter},n.setHandler=function(a){this.outputFilter=a},n.setPAC=function(a){this.writeScreen.setPAC(a)},n.setBkgData=function(a){this.writeScreen.setBkgData(a)},n.setMode=function(a){a!==this.mode&&(this.mode=a,this.logger.log(E.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a)},n.insertChars=function(a){for(var d=0;d<a.length;d++)this.writeScreen.insertChar(a[d]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(E.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(E.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},n.ccRCL=function(){this.logger.log(E.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},n.ccBS=function(){this.logger.log(E.INFO,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},n.ccAOF=function(){},n.ccAON=function(){},n.ccDER=function(){this.logger.log(E.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},n.ccRU=function(a){this.logger.log(E.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},n.ccFON=function(){this.logger.log(E.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},n.ccRDC=function(){this.logger.log(E.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},n.ccTR=function(){this.logger.log(E.INFO,"TR"),this.setMode("MODE_TEXT")},n.ccRTD=function(){this.logger.log(E.INFO,"RTD"),this.setMode("MODE_TEXT")},n.ccEDM=function(){this.logger.log(E.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},n.ccCR=function(){this.logger.log(E.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},n.ccENM=function(){this.logger.log(E.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},n.ccEOC=function(){if(this.logger.log(E.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(E.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},n.ccTO=function(a){this.logger.log(E.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},n.ccMIDROW=function(a){var d={flash:!1};if(d.underline=a%2===1,d.italics=a>=46,d.italics)d.foreground="white";else{var v=Math.floor(a/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];d.foreground=S[v]}this.logger.log(E.INFO,"MIDROW: "+JSON.stringify(d)),this.writeScreen.setPen(d)},n.outputDataUpdate=function(a){a===void 0&&(a=!1);var d=this.logger.time;d!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=d:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,d,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:d),this.lastOutputScreen.copy(this.displayedMemory))},n.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},t}(),i=function(){function t(u,a,d){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new m;this.channels=[null,new g(u,a,v),new g(u+1,d,v)],this.cmdHistory=c(),this.logger=v}var n=t.prototype;return n.getHandler=function(a){return this.channels[a].getHandler()},n.setHandler=function(a,d){this.channels[a].setHandler(d)},n.addData=function(a,d){var v,S,T,I=!1;this.logger.time=a;for(var k=0;k<d.length;k+=2)if(S=d[k]&127,T=d[k+1]&127,!(S===0&&T===0)){if(this.logger.log(E.DATA,"["+p([d[k],d[k+1]])+"] -> ("+p([S,T])+")"),v=this.parseCmd(S,T),v||(v=this.parseMidrow(S,T)),v||(v=this.parsePAC(S,T)),v||(v=this.parseBackgroundAttributes(S,T)),!v&&(I=this.parseChars(S,T),I)){var B=this.currentChannel;if(B&&B>0){var U=this.channels[B];U.insertChars(I)}else this.logger.log(E.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!I&&this.logger.log(E.WARNING,"Couldn't parse cleaned data "+p([S,T])+" orig: "+p([d[k],d[k+1]]))}},n.parseCmd=function(a,d){var v=this.cmdHistory,S=(a===20||a===28||a===21||a===29)&&d>=32&&d<=47,T=(a===23||a===31)&&d>=33&&d<=35;if(!(S||T))return!1;if(o(a,d,v))return r(null,null,v),this.logger.log(E.DEBUG,"Repeated command ("+p([a,d])+") is dropped"),!0;var I=a===20||a===21||a===23?1:2,k=this.channels[I];return a===20||a===21||a===28||a===29?d===32?k.ccRCL():d===33?k.ccBS():d===34?k.ccAOF():d===35?k.ccAON():d===36?k.ccDER():d===37?k.ccRU(2):d===38?k.ccRU(3):d===39?k.ccRU(4):d===40?k.ccFON():d===41?k.ccRDC():d===42?k.ccTR():d===43?k.ccRTD():d===44?k.ccEDM():d===45?k.ccCR():d===46?k.ccENM():d===47&&k.ccEOC():k.ccTO(d-32),r(a,d,v),this.currentChannel=I,!0},n.parseMidrow=function(a,d){var v=0;if((a===17||a===25)&&d>=32&&d<=47){if(a===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(E.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[v];return S?(S.ccMIDROW(d),this.logger.log(E.DEBUG,"MIDROW ("+p([a,d])+")"),!0):!1}return!1},n.parsePAC=function(a,d){var v,S=this.cmdHistory,T=(a>=17&&a<=23||a>=25&&a<=31)&&d>=64&&d<=127,I=(a===16||a===24)&&d>=64&&d<=95;if(!(T||I))return!1;if(o(a,d,S))return r(null,null,S),!0;var k=a<=23?1:2;d>=64&&d<=95?v=k===1?b[a]:y[a]:v=k===1?_[a]:x[a];var B=this.channels[k];return B?(B.setPAC(this.interpretPAC(v,d)),r(a,d,S),this.currentChannel=k,!0):!1},n.interpretPAC=function(a,d){var v,S={color:null,italics:!1,indent:null,underline:!1,row:a};return d>95?v=d-96:v=d-64,S.underline=(v&1)===1,v<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((v-16)/2)*4,S},n.parseChars=function(a,d){var v,S=null,T=null;if(a>=25?(v=2,T=a-8):(v=1,T=a),T>=17&&T<=19){var I;T===17?I=d+80:T===18?I=d+112:I=d+144,this.logger.log(E.INFO,"Special char '"+A(I)+"' in channel "+v),S=[I]}else a>=32&&a<=127&&(S=d===0?[a]:[a,d]);if(S){var k=p(S);this.logger.log(E.DEBUG,"Char codes = "+k.join(",")),r(a,d,this.cmdHistory)}return S},n.parseBackgroundAttributes=function(a,d){var v=(a===16||a===24)&&d>=32&&d<=47,S=(a===23||a===31)&&d>=45&&d<=47;if(!(v||S))return!1;var T,I={};a===16||a===24?(T=Math.floor((d-32)/2),I.background=D[T],d%2===1&&(I.background=I.background+"_semi")):d===45?I.background="transparent":(I.foreground="black",d===47&&(I.underline=!0));var k=a<=23?1:2,B=this.channels[k];return B.setBkgData(I),r(a,d,this.cmdHistory),!0},n.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var d=this.channels[a];d&&d.reset()}this.cmdHistory=c()},n.cueSplitAtTime=function(a){for(var d=0;d<this.channels.length;d++){var v=this.channels[d];v&&v.cueSplitAtTime(a)}},t}();function r(t,n,u){u.a=t,u.b=n}function o(t,n,u){return u.a===t&&u.b===n}function c(){return{a:null,b:null}}R.default=i},"./src/utils/codecs.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"isCodecType",function(){return L}),l.d(R,"isCodecSupportedInMp4",function(){return A});var P={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function L(M,O){var b=P[O];return!!b&&b[M.slice(0,4)]===!0}function A(M,O){return MediaSource.isTypeSupported((O||"video")+'/mp4;codecs="'+M+'"')}},"./src/utils/cues.ts":function(j,R,l){"use strict";l.r(R);var P=l("./src/utils/vttparser.ts"),L=l("./src/utils/webvtt-parser.ts"),A=l("./src/utils/texttrack-utils.ts"),M=/\s/,O={newCue:function(_,y,x,D){for(var E=[],m,p,f,e,s,h=self.VTTCue||self.TextTrackCue,g=0;g<D.rows.length;g++)if(m=D.rows[g],f=!0,e=0,s="",!m.isEmpty()){for(var i=0;i<m.chars.length;i++)M.test(m.chars[i].uchar)&&f?e++:(s+=m.chars[i].uchar,f=!1);m.cueStartTime=y,y===x&&(x+=1e-4),e>=16?e--:e++;var r=Object(P.fixLineBreaks)(s.trim()),o=Object(L.generateCueId)(y,x,r);(!_||!_.cues||!_.cues.getCueById(o))&&(p=new h(y,x,r),p.id=o,p.line=g+1,p.align="left",p.position=10+Math.min(80,Math.floor(e*8/32)*10),E.push(p))}return _&&E.length&&(E.sort(function(c,t){return c.line==="auto"||t.line==="auto"?0:c.line>8&&t.line>8?t.line-c.line:c.line-t.line}),E.forEach(function(c){return Object(A.addCueToTrack)(_,c)})),E}};R.default=O},"./src/utils/discontinuities.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"findFirstFragWithCC",function(){return M}),l.d(R,"shouldAlignOnDiscontinuities",function(){return O}),l.d(R,"findDiscontinuousReferenceFrag",function(){return b}),l.d(R,"adjustSlidingStart",function(){return y}),l.d(R,"alignStream",function(){return x}),l.d(R,"alignPDT",function(){return E}),l.d(R,"alignFragmentByPDTDelta",function(){return m}),l.d(R,"alignMediaPlaylistByPDT",function(){return p});var P=l("./src/polyfills/number.ts"),L=l("./src/utils/logger.ts"),A=l("./src/controller/level-helper.ts");function M(f,e){for(var s=null,h=0,g=f.length;h<g;h++){var i=f[h];if(i&&i.cc===e){s=i;break}}return s}function O(f,e,s){return!!(e.details&&(s.endCC>s.startCC||f&&f.cc<s.startCC))}function b(f,e){var s=f.fragments,h=e.fragments;if(!h.length||!s.length){L.logger.log("No fragments to align");return}var g=M(s,h[0].cc);if(!g||g&&!g.startPTS){L.logger.log("No frag in previous level to align on");return}return g}function _(f,e){if(f){var s=f.start+e;f.start=f.startPTS=s,f.endPTS=s+f.duration}}function y(f,e){for(var s=e.fragments,h=0,g=s.length;h<g;h++)_(s[h],f);e.fragmentHint&&_(e.fragmentHint,f),e.alignedSliding=!0}function x(f,e,s){!e||(D(f,s,e),!s.alignedSliding&&e.details&&E(s,e.details),!s.alignedSliding&&e.details&&!s.skippedSegments&&Object(A.adjustSliding)(e.details,s))}function D(f,e,s){if(O(f,s,e)){var h=b(s.details,e);h&&Object(P.isFiniteNumber)(h.start)&&(L.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),y(h.start,e))}}function E(f,e){if(!(!e.fragments.length||!f.hasProgramDateTime||!e.hasProgramDateTime)){var s=e.fragments[0].programDateTime,h=f.fragments[0].programDateTime,g=(h-s)/1e3+e.fragments[0].start;g&&Object(P.isFiniteNumber)(g)&&(L.logger.log("Adjusting PTS using programDateTime delta "+(h-s)+"ms, sliding:"+g.toFixed(3)+" "+f.url+" "),y(g,f))}}function m(f,e){var s=f.programDateTime;if(!!s){var h=(s-e)/1e3;f.start=f.startPTS=h,f.endPTS=h+f.duration}}function p(f,e){if(!(!e.fragments.length||!f.hasProgramDateTime||!e.hasProgramDateTime)){var s=e.fragments[0].programDateTime,h=e.fragments[0].start,g=s-h*1e3;f.fragments.forEach(function(i){m(i,g)}),f.fragmentHint&&m(f.fragmentHint,g),f.alignedSliding=!0}}},"./src/utils/ewma-bandwidth-estimator.ts":function(j,R,l){"use strict";l.r(R);var P=l("./src/utils/ewma.ts"),L=function(){function A(O,b,_){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=_,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new P.default(O),this.fast_=new P.default(b)}var M=A.prototype;return M.update=function(b,_){var y=this.slow_,x=this.fast_;this.slow_.halfLife!==b&&(this.slow_=new P.default(b,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==_&&(this.fast_=new P.default(_,x.getEstimate(),x.getTotalWeight()))},M.sample=function(b,_){b=Math.max(b,this.minDelayMs_);var y=8*_,x=b/1e3,D=y/x;this.fast_.sample(x,D),this.slow_.sample(x,D)},M.canEstimate=function(){var b=this.fast_;return b&&b.getTotalWeight()>=this.minWeight_},M.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},M.destroy=function(){},A}();R.default=L},"./src/utils/ewma.ts":function(j,R,l){"use strict";l.r(R);var P=function(){function L(M,O,b){O===void 0&&(O=0),b===void 0&&(b=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=M,this.alpha_=M?Math.exp(Math.log(.5)/M):0,this.estimate_=O,this.totalWeight_=b}var A=L.prototype;return A.sample=function(O,b){var _=Math.pow(this.alpha_,O);this.estimate_=b*(1-_)+_*this.estimate_,this.totalWeight_+=O},A.getTotalWeight=function(){return this.totalWeight_},A.getEstimate=function(){if(this.alpha_){var O=1-Math.pow(this.alpha_,this.totalWeight_);if(O)return this.estimate_/O}return this.estimate_},L}();R.default=P},"./src/utils/fetch-loader.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"fetchSupported",function(){return m});var P=l("./src/polyfills/number.ts"),L=l("./src/loader/load-stats.ts"),A=l("./src/demux/chunk-cache.ts");function M(h,g){h.prototype=Object.create(g.prototype),h.prototype.constructor=h,x(h,g)}function O(h){var g=typeof Map=="function"?new Map:void 0;return O=function(r){if(r===null||!y(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof g!="undefined"){if(g.has(r))return g.get(r);g.set(r,o)}function o(){return b(r,arguments,D(this).constructor)}return o.prototype=Object.create(r.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),x(o,r)},O(h)}function b(h,g,i){return _()?b=Reflect.construct.bind():b=function(o,c,t){var n=[null];n.push.apply(n,c);var u=Function.bind.apply(o,n),a=new u;return t&&x(a,t.prototype),a},b.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function y(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function x(h,g){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},x(h,g)}function D(h){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(i){return i.__proto__||Object.getPrototypeOf(i)},D(h)}function E(){return E=Object.assign?Object.assign.bind():function(h){for(var g=1;g<arguments.length;g++){var i=arguments[g];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(h[r]=i[r])}return h},E.apply(this,arguments)}function m(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}var p=function(){function h(i){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=i.fetchSetup||e,this.controller=new self.AbortController,this.stats=new L.LoadStats}var g=h.prototype;return g.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},g.abortInternal=function(){var r=this.response;(!r||!r.ok)&&(this.stats.aborted=!0,this.controller.abort())},g.abort=function(){var r;this.abortInternal(),(r=this.callbacks)!==null&&r!==void 0&&r.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},g.load=function(r,o,c){var t=this,n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();var u=f(r,this.controller.signal),a=c.onProgress,d=r.responseType==="arraybuffer",v=d?"byteLength":"length";this.context=r,this.config=o,this.callbacks=c,this.request=this.fetchSetup(r,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){t.abortInternal(),c.onTimeout(n,r,t.response)},o.timeout),self.fetch(this.request).then(function(S){if(t.response=t.loader=S,!S.ok){var T=S.status,I=S.statusText;throw new s(I||"fetch, bad network response",T,S)}return n.loading.first=Math.max(self.performance.now(),n.loading.start),n.total=parseInt(S.headers.get("Content-Length")||"0"),a&&Object(P.isFiniteNumber)(o.highWaterMark)?t.loadProgressively(S,n,r,o.highWaterMark,a):d?S.arrayBuffer():S.text()}).then(function(S){var T=t.response;self.clearTimeout(t.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first),n.loaded=n.total=S[v];var I={url:T.url,data:S};a&&!Object(P.isFiniteNumber)(o.highWaterMark)&&a(n,r,S,T),c.onSuccess(I,n,r,T)}).catch(function(S){if(self.clearTimeout(t.requestTimeout),!n.aborted){var T=S&&S.code||0,I=S?S.message:null;c.onError({code:T,text:I},r,S?S.details:null)}})},g.getCacheAge=function(){var r=null;if(this.response){var o=this.response.headers.get("age");r=o?parseFloat(o):null}return r},g.loadProgressively=function(r,o,c,t,n){t===void 0&&(t=0);var u=new A.default,a=r.body.getReader(),d=function v(){return a.read().then(function(S){if(S.done)return u.dataLength&&n(o,c,u.flush(),r),Promise.resolve(new ArrayBuffer(0));var T=S.value,I=T.length;return o.loaded+=I,I<t||u.dataLength?(u.push(T),u.dataLength>=t&&n(o,c,u.flush(),r)):n(o,c,T,r),v()}).catch(function(){return Promise.reject()})};return d()},h}();function f(h,g){var i={method:"GET",mode:"cors",credentials:"same-origin",signal:g,headers:new self.Headers(E({},h.headers))};return h.rangeEnd&&i.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),i}function e(h,g){return new self.Request(h.url,g)}var s=function(h){M(g,h);function g(i,r,o){var c;return c=h.call(this,i)||this,c.code=void 0,c.details=void 0,c.code=r,c.details=o,c}return g}(O(Error));R.default=p},"./src/utils/imsc1-ttml-parser.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"IMSC1_CODEC",function(){return y}),l.d(R,"parseIMSC1",function(){return m});var P=l("./src/utils/mp4-tools.ts"),L=l("./src/utils/vttparser.ts"),A=l("./src/utils/vttcue.ts"),M=l("./src/demux/id3.ts"),O=l("./src/utils/timescale-conversion.ts"),b=l("./src/utils/webvtt-parser.ts");function _(){return _=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var u=arguments[n];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(t[a]=u[a])}return t},_.apply(this,arguments)}var y="stpp.ttml.im1t",x=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,D=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,E={left:"start",center:"center",right:"end",start:"start",end:"end"};function m(t,n,u,a,d){var v=Object(P.findBox)(new Uint8Array(t),["mdat"]);if(v.length===0){d(new Error("Could not parse IMSC1 mdat"));return}var S=v.map(function(I){return Object(M.utf8ArrayToStr)(I)}),T=Object(O.toTimescaleFromScale)(n,1,u);try{S.forEach(function(I){return a(p(I,T))})}catch(I){d(I)}}function p(t,n){var u=new DOMParser,a=u.parseFromString(t,"text/xml"),d=a.getElementsByTagName("tt")[0];if(!d)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(v).reduce(function(U,W){return U[W]=d.getAttribute("ttp:"+W)||v[W],U},{}),T=d.getAttribute("xml:space")!=="preserve",I=e(f(d,"styling","style")),k=e(f(d,"layout","region")),B=f(d,"body","[begin]");return[].map.call(B,function(U){var W=s(U,T);if(!W||!U.hasAttribute("begin"))return null;var G=r(U.getAttribute("begin"),S),z=r(U.getAttribute("dur"),S),Y=r(U.getAttribute("end"),S);if(G===null)throw i(U);if(Y===null){if(z===null)throw i(U);Y=G+z}var $=new A.default(G-n,Y-n,W);$.id=Object(b.generateCueId)($.startTime,$.endTime,$.text);var Z=k[U.getAttribute("region")],q=I[U.getAttribute("style")];$.position=10,$.size=80;var ie=h(Z,q,I),ne=ie.textAlign;if(ne){var ae=E[ne];ae&&($.lineAlign=ae),$.align=ne}return _($,ie),$}).filter(function(U){return U!==null})}function f(t,n,u){var a=t.getElementsByTagName(n)[0];return a?[].slice.call(a.querySelectorAll(u)):[]}function e(t){return t.reduce(function(n,u){var a=u.getAttribute("xml:id");return a&&(n[a]=u),n},{})}function s(t,n){return[].slice.call(t.childNodes).reduce(function(u,a,d){var v;return a.nodeName==="br"&&d?u+`
21
- `:(v=a.childNodes)!==null&&v!==void 0&&v.length?s(a,n):n?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function h(t,n,u){var a="http://www.w3.org/ns/ttml#styling",d=null,v=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],S=t!=null&&t.hasAttribute("style")?t.getAttribute("style"):null;return S&&u.hasOwnProperty(S)&&(d=u[S]),v.reduce(function(T,I){var k=g(n,a,I)||g(t,a,I)||g(d,a,I);return k&&(T[I]=k),T},{})}function g(t,n,u){return t&&t.hasAttributeNS(n,u)?t.getAttributeNS(n,u):null}function i(t){return new Error("Could not parse ttml timestamp "+t)}function r(t,n){if(!t)return null;var u=Object(L.parseTimeStamp)(t);return u===null&&(x.test(t)?u=o(t,n):D.test(t)&&(u=c(t,n))),u}function o(t,n){var u=x.exec(t),a=(u[4]|0)+(u[5]|0)/n.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/n.frameRate}function c(t,n){var u=D.exec(t),a=Number(u[1]),d=u[2];switch(d){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/n.frameRate;case"t":return a/n.tickRate}return a}},"./src/utils/logger.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"enableLogs",function(){return b}),l.d(R,"logger",function(){return _});var P=function(){},L={trace:P,debug:P,log:P,warn:P,info:P,error:P},A=L;function M(y){var x=self.console[y];return x?x.bind(self.console,"["+y+"] >"):P}function O(y){for(var x=arguments.length,D=new Array(x>1?x-1:0),E=1;E<x;E++)D[E-1]=arguments[E];D.forEach(function(m){A[m]=y[m]?y[m].bind(y):M(m)})}function b(y){if(self.console&&y===!0||typeof y=="object"){O(y,"debug","log","info","warn","error");try{A.log()}catch{A=L}}else A=L}var _=A},"./src/utils/mediakeys-helper.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"KeySystems",function(){return P}),l.d(R,"requestMediaKeySystemAccess",function(){return L});var P;(function(A){A.WIDEVINE="com.widevine.alpha",A.PLAYREADY="com.microsoft.playready"})(P||(P={}));var L=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"getMediaSource",function(){return P});function P(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"RemuxerTrackIdConfig",function(){return b}),l.d(R,"bin2str",function(){return _}),l.d(R,"readUint16",function(){return y}),l.d(R,"readUint32",function(){return x}),l.d(R,"readSint32",function(){return D}),l.d(R,"writeUint32",function(){return E}),l.d(R,"findBox",function(){return m}),l.d(R,"parseSegmentIndex",function(){return p}),l.d(R,"parseInitSegment",function(){return f}),l.d(R,"getStartDTS",function(){return e}),l.d(R,"getDuration",function(){return s}),l.d(R,"computeRawDurationFromSamples",function(){return h}),l.d(R,"offsetStartDTS",function(){return g}),l.d(R,"segmentValidRange",function(){return i}),l.d(R,"appendUint8Array",function(){return r}),l.d(R,"parseSamples",function(){return o}),l.d(R,"parseSEIMessageFromNALu",function(){return n}),l.d(R,"parseEmsg",function(){return a});var P=l("./src/utils/typed-array.ts"),L=l("./src/loader/fragment.ts"),A=l("./src/demux/id3.ts"),M=Math.pow(2,32)-1,O=[].push,b={video:1,audio:2,id3:3,text:4};function _(d){return String.fromCharCode.apply(null,d)}function y(d,v){var S=d[v]<<8|d[v+1];return S<0?65536+S:S}function x(d,v){var S=D(d,v);return S<0?4294967296+S:S}function D(d,v){return d[v]<<24|d[v+1]<<16|d[v+2]<<8|d[v+3]}function E(d,v,S){d[v]=S>>24,d[v+1]=S>>16&255,d[v+2]=S>>8&255,d[v+3]=S&255}function m(d,v){var S=[];if(!v.length)return S;for(var T=d.byteLength,I=0;I<T;){var k=x(d,I),B=_(d.subarray(I+4,I+8)),U=k>1?I+k:T;if(B===v[0])if(v.length===1)S.push(d.subarray(I+8,U));else{var W=m(d.subarray(I+8,U),v.slice(1));W.length&&O.apply(S,W)}I=U}return S}function p(d){var v=[],S=d[0],T=8,I=x(d,T);T+=4;var k=0,B=0;S===0?T+=8:T+=16,T+=2;var U=d.length+B,W=y(d,T);T+=2;for(var G=0;G<W;G++){var z=T,Y=x(d,z);z+=4;var $=Y&2147483647,Z=(Y&2147483648)>>>31;if(Z===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=x(d,z);z+=4,v.push({referenceSize:$,subsegmentDuration:q,info:{duration:q/I,start:U,end:U+$-1}}),U+=$,z+=4,T=z}return{earliestPresentationTime:k,timescale:I,version:S,referencesCount:W,references:v}}function f(d){for(var v=[],S=m(d,["moov","trak"]),T=0;T<S.length;T++){var I=S[T],k=m(I,["tkhd"])[0];if(k){var B=k[0],U=B===0?12:20,W=x(k,U),G=m(I,["mdia","mdhd"])[0];if(G){B=G[0],U=B===0?12:20;var z=x(G,U),Y=m(I,["mdia","hdlr"])[0];if(Y){var $=_(Y.subarray(8,12)),Z={soun:L.ElementaryStreamTypes.AUDIO,vide:L.ElementaryStreamTypes.VIDEO}[$];if(Z){var q=m(I,["mdia","minf","stbl","stsd"])[0],ie=void 0;q&&(ie=_(q.subarray(12,16))),v[W]={timescale:z,type:Z},v[Z]={timescale:z,id:W,codec:ie}}}}}}var ne=m(d,["moov","mvex","trex"]);return ne.forEach(function(ae){var te=x(ae,4),fe=v[te];fe&&(fe.default={duration:x(ae,12),flags:x(ae,20)})}),v}function e(d,v){return m(v,["moof","traf"]).reduce(function(S,T){var I=m(T,["tfdt"])[0],k=I[0],B=m(T,["tfhd"]).reduce(function(U,W){var G=x(W,4),z=d[G];if(z){var Y=x(I,4);k===1&&(Y*=Math.pow(2,32),Y+=x(I,8));var $=z.timescale||9e4,Z=Y/$;if(isFinite(Z)&&(U===null||Z<U))return Z}return U},null);return B!==null&&isFinite(B)&&(S===null||B<S)?B:S},null)||0}function s(d,v){for(var S=0,T=0,I=0,k=m(d,["moof","traf"]),B=0;B<k.length;B++){var U=k[B],W=m(U,["tfhd"])[0],G=x(W,4),z=v[G];if(!!z){var Y=z.default,$=x(W,0)|(Y==null?void 0:Y.flags),Z=Y==null?void 0:Y.duration;$&8&&($&2?Z=x(W,12):Z=x(W,8));for(var q=z.timescale||9e4,ie=m(U,["trun"]),ne=0;ne<ie.length;ne++){if(S=h(ie[ne]),!S&&Z){var ae=x(ie[ne],4);S=Z*ae}z.type===L.ElementaryStreamTypes.VIDEO?T+=S/q:z.type===L.ElementaryStreamTypes.AUDIO&&(I+=S/q)}}}if(T===0&&I===0){for(var te=0,fe=m(d,["sidx"]),de=0;de<fe.length;de++){var re=p(fe[de]);re!=null&&re.references&&(te+=re.references.reduce(function(Ee,me){return Ee+me.info.duration||0},0))}return te}return T||I}function h(d){var v=x(d,0),S=8;v&1&&(S+=4),v&4&&(S+=4);for(var T=0,I=x(d,4),k=0;k<I;k++){if(v&256){var B=x(d,S);T+=B,S+=4}v&512&&(S+=4),v&1024&&(S+=4),v&2048&&(S+=4)}return T}function g(d,v,S){m(v,["moof","traf"]).forEach(function(T){m(T,["tfhd"]).forEach(function(I){var k=x(I,4),B=d[k];if(!!B){var U=B.timescale||9e4;m(T,["tfdt"]).forEach(function(W){var G=W[0],z=x(W,4);if(G===0)z-=S*U,z=Math.max(z,0),E(W,4,z);else{z*=Math.pow(2,32),z+=x(W,8),z-=S*U,z=Math.max(z,0);var Y=Math.floor(z/(M+1)),$=Math.floor(z%(M+1));E(W,4,Y),E(W,8,$)}})}})})}function i(d){var v={valid:null,remainder:null},S=m(d,["moof"]);if(S){if(S.length<2)return v.remainder=d,v}else return v;var T=S[S.length-1];return v.valid=Object(P.sliceUint8)(d,0,T.byteOffset-8),v.remainder=Object(P.sliceUint8)(d,T.byteOffset-8),v}function r(d,v){var S=new Uint8Array(d.length+v.length);return S.set(d),S.set(v,d.length),S}function o(d,v){var S=[],T=v.samples,I=v.timescale,k=v.id,B=!1,U=m(T,["moof"]);return U.map(function(W){var G=W.byteOffset-8,z=m(W,["traf"]);z.map(function(Y){var $=m(Y,["tfdt"]).map(function(Z){var q=Z[0],ie=x(Z,4);return q===1&&(ie*=Math.pow(2,32),ie+=x(Z,8)),ie/I})[0];return $!==void 0&&(d=$),m(Y,["tfhd"]).map(function(Z){var q=x(Z,4),ie=x(Z,0)&16777215,ne=(ie&1)!==0,ae=(ie&2)!==0,te=(ie&8)!==0,fe=0,de=(ie&16)!==0,re=0,Ee=(ie&32)!==0,me=8;q===k&&(ne&&(me+=8),ae&&(me+=4),te&&(fe=x(Z,me),me+=4),de&&(re=x(Z,me),me+=4),Ee&&(me+=4),v.type==="video"&&(B=c(v.codec)),m(Y,["trun"]).map(function(Te){var Me=Te[0],_e=x(Te,0)&16777215,ke=(_e&1)!==0,Ie=0,Be=(_e&4)!==0,be=(_e&256)!==0,Ue=0,Ke=(_e&512)!==0,je=0,Ne=(_e&1024)!==0,qe=(_e&2048)!==0,Fe=0,et=x(Te,4),Oe=8;ke&&(Ie=x(Te,Oe),Oe+=4),Be&&(Oe+=4);for(var Pe=Ie+G,Ve=0;Ve<et;Ve++){if(be?(Ue=x(Te,Oe),Oe+=4):Ue=fe,Ke?(je=x(Te,Oe),Oe+=4):je=re,Ne&&(Oe+=4),qe&&(Me===0?Fe=x(Te,Oe):Fe=D(Te,Oe),Oe+=4),v.type===L.ElementaryStreamTypes.VIDEO)for(var Ce=0;Ce<je;){var Le=x(T,Pe);Pe+=4;var it=T[Pe]&31;if(t(B,it)){var We=T.subarray(Pe,Pe+Le);n(We,d+Fe/I,S)}Pe+=Le,Ce+=Le+4}d+=Ue/I}}))})})}),S}function c(d){if(!d)return!1;var v=d.indexOf("."),S=v<0?d:d.substring(0,v);return S==="hvc1"||S==="hev1"||S==="dvh1"||S==="dvhe"}function t(d,v){return d?v===39||v===40:v===6}function n(d,v,S){var T=u(d),I=0;I++;for(var k=0,B=0,U=!1,W=0;I<T.length;){k=0;do{if(I>=T.length)break;W=T[I++],k+=W}while(W===255);B=0;do{if(I>=T.length)break;W=T[I++],B+=W}while(W===255);var G=T.length-I;if(!U&&k===4&&I<T.length){U=!0;var z=T[I++];if(z===181){var Y=y(T,I);if(I+=2,Y===49){var $=x(T,I);if(I+=4,$===1195456820){var Z=T[I++];if(Z===3){var q=T[I++],ie=31&q,ne=64&q,ae=ne?2+ie*3:0,te=new Uint8Array(ae);if(ne){te[0]=q;for(var fe=1;fe<ae;fe++)te[fe]=T[I++]}S.push({type:Z,payloadType:k,pts:v,bytes:te})}}}}}else if(k===5&&B<G){if(U=!0,B>16){for(var de=[],re=0;re<16;re++){var Ee=T[I++].toString(16);de.push(Ee.length==1?"0"+Ee:Ee),(re===3||re===5||re===7||re===9)&&de.push("-")}for(var me=B-16,Te=new Uint8Array(me),Me=0;Me<me;Me++)Te[Me]=T[I++];S.push({payloadType:k,pts:v,uuid:de.join(""),userData:Object(A.utf8ArrayToStr)(Te),userDataBytes:Te})}}else if(B<G)I+=B;else if(B>G)break}}function u(d){for(var v=d.byteLength,S=[],T=1;T<v-2;)d[T]===0&&d[T+1]===0&&d[T+2]===3?(S.push(T+2),T+=2):T++;if(S.length===0)return d;var I=v-S.length,k=new Uint8Array(I),B=0;for(T=0;T<I;B++,T++)B===S[0]&&(B++,S.shift()),k[T]=d[B];return k}function a(d){var v=d[0],S="",T="",I=0,k=0,B=0,U=0,W=0,G=0;if(v===0){for(;_(d.subarray(G,G+1))!=="\0";)S+=_(d.subarray(G,G+1)),G+=1;for(S+=_(d.subarray(G,G+1)),G+=1;_(d.subarray(G,G+1))!=="\0";)T+=_(d.subarray(G,G+1)),G+=1;T+=_(d.subarray(G,G+1)),G+=1,I=x(d,12),k=x(d,16),U=x(d,20),W=x(d,24),G=28}else if(v===1){G+=4,I=x(d,G),G+=4;var z=x(d,G);G+=4;var Y=x(d,G);for(G+=4,B=Math.pow(2,32)*z+Y,Number.isSafeInteger(B)||(B=Number.MAX_SAFE_INTEGER,console.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),U=x(d,G),G+=4,W=x(d,G),G+=4;_(d.subarray(G,G+1))!=="\0";)S+=_(d.subarray(G,G+1)),G+=1;for(S+=_(d.subarray(G,G+1)),G+=1;_(d.subarray(G,G+1))!=="\0";)T+=_(d.subarray(G,G+1)),G+=1;T+=_(d.subarray(G,G+1)),G+=1}var $=d.subarray(G,d.byteLength);return{schemeIdUri:S,value:T,timeScale:I,presentationTime:B,presentationTimeDelta:k,eventDuration:U,id:W,payload:$}}},"./src/utils/output-filter.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return P});var P=function(){function L(M,O){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=M,this.trackName=O}var A=L.prototype;return A.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},A.newCue=function(O,b,_){(this.startTime===null||this.startTime>O)&&(this.startTime=O),this.endTime=b,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},A.reset=function(){this.cueRanges=[],this.startTime=null},L}()},"./src/utils/texttrack-utils.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"sendAddTrackEvent",function(){return L}),l.d(R,"addCueToTrack",function(){return A}),l.d(R,"clearCurrentCues",function(){return M}),l.d(R,"removeCuesInRange",function(){return O}),l.d(R,"getCuesInRange",function(){return _});var P=l("./src/utils/logger.ts");function L(y,x){var D;try{D=new Event("addtrack")}catch{D=document.createEvent("Event"),D.initEvent("addtrack",!1,!1)}D.track=y,x.dispatchEvent(D)}function A(y,x){var D=y.mode;if(D==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(x.id))try{if(y.addCue(x),!y.cues.getCueById(x.id))throw new Error("addCue is failed for: "+x)}catch(m){P.logger.debug("[texttrack-utils]: "+m);var E=new self.TextTrackCue(x.startTime,x.endTime,x.text);E.id=x.id,y.addCue(E)}D==="disabled"&&(y.mode=D)}function M(y){var x=y.mode;if(x==="disabled"&&(y.mode="hidden"),y.cues)for(var D=y.cues.length;D--;)y.removeCue(y.cues[D]);x==="disabled"&&(y.mode=x)}function O(y,x,D,E){var m=y.mode;if(m==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var p=_(y.cues,x,D),f=0;f<p.length;f++)(!E||E(p[f]))&&y.removeCue(p[f]);m==="disabled"&&(y.mode=m)}function b(y,x){if(x<y[0].startTime)return 0;var D=y.length-1;if(x>y[D].endTime)return-1;for(var E=0,m=D;E<=m;){var p=Math.floor((m+E)/2);if(x<y[p].startTime)m=p-1;else if(x>y[p].startTime&&E<D)E=p+1;else return p}return y[E].startTime-x<x-y[m].startTime?E:m}function _(y,x,D){var E=[],m=b(y,x);if(m>-1)for(var p=m,f=y.length;p<f;p++){var e=y[p];if(e.startTime>=x&&e.endTime<=D)E.push(e);else if(e.startTime>D)return E}return E}},"./src/utils/time-ranges.ts":function(j,R,l){"use strict";l.r(R);var P={toString:function(A){for(var M="",O=A.length,b=0;b<O;b++)M+="["+A.start(b).toFixed(3)+","+A.end(b).toFixed(3)+"]";return M}};R.default=P},"./src/utils/timescale-conversion.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"toTimescaleFromBase",function(){return L}),l.d(R,"toTimescaleFromScale",function(){return A}),l.d(R,"toMsFromMpegTsClock",function(){return M}),l.d(R,"toMpegTsClockFromTimescale",function(){return O});var P=9e4;function L(b,_,y,x){y===void 0&&(y=1),x===void 0&&(x=!1);var D=b*_*y;return x?Math.round(D):D}function A(b,_,y,x){return y===void 0&&(y=1),x===void 0&&(x=!1),L(b,_,1/y,x)}function M(b,_){return _===void 0&&(_=!1),L(b,1e3,1/P,_)}function O(b,_){return _===void 0&&(_=1),L(b,P,1/_)}},"./src/utils/typed-array.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"sliceUint8",function(){return P});function P(L,A,M){return Uint8Array.prototype.slice?L.slice(A,M):new Uint8Array(Array.prototype.slice.call(L,A,M))}},"./src/utils/vttcue.ts":function(j,R,l){"use strict";l.r(R),R.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var P=["","lr","rl"],L=["start","middle","end","left","right"];function A(y,x){if(typeof x!="string"||!Array.isArray(y))return!1;var D=x.toLowerCase();return~y.indexOf(D)?D:!1}function M(y){return A(P,y)}function O(y){return A(L,y)}function b(y){for(var x=arguments.length,D=new Array(x>1?x-1:0),E=1;E<x;E++)D[E-1]=arguments[E];for(var m=1;m<arguments.length;m++){var p=arguments[m];for(var f in p)y[f]=p[f]}return y}function _(y,x,D){var E=this,m={enumerable:!0};E.hasBeenReset=!1;var p="",f=!1,e=y,s=x,h=D,g=null,i="",r=!0,o="auto",c="start",t=50,n="middle",u=50,a="middle";Object.defineProperty(E,"id",b({},m,{get:function(){return p},set:function(v){p=""+v}})),Object.defineProperty(E,"pauseOnExit",b({},m,{get:function(){return f},set:function(v){f=!!v}})),Object.defineProperty(E,"startTime",b({},m,{get:function(){return e},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");e=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"endTime",b({},m,{get:function(){return s},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");s=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"text",b({},m,{get:function(){return h},set:function(v){h=""+v,this.hasBeenReset=!0}})),Object.defineProperty(E,"region",b({},m,{get:function(){return g},set:function(v){g=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"vertical",b({},m,{get:function(){return i},set:function(v){var S=M(v);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");i=S,this.hasBeenReset=!0}})),Object.defineProperty(E,"snapToLines",b({},m,{get:function(){return r},set:function(v){r=!!v,this.hasBeenReset=!0}})),Object.defineProperty(E,"line",b({},m,{get:function(){return o},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");o=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"lineAlign",b({},m,{get:function(){return c},set:function(v){var S=O(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");c=S,this.hasBeenReset=!0}})),Object.defineProperty(E,"position",b({},m,{get:function(){return t},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");t=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"positionAlign",b({},m,{get:function(){return n},set:function(v){var S=O(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");n=S,this.hasBeenReset=!0}})),Object.defineProperty(E,"size",b({},m,{get:function(){return u},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");u=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"align",b({},m,{get:function(){return a},set:function(v){var S=O(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");a=S,this.hasBeenReset=!0}})),E.displayState=void 0}return _.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"parseTimeStamp",function(){return A}),l.d(R,"fixLineBreaks",function(){return x}),l.d(R,"VTTParser",function(){return D});var P=l("./src/utils/vttcue.ts"),L=function(){function E(){}var m=E.prototype;return m.decode=function(f,e){if(!f)return"";if(typeof f!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(f))},E}();function A(E){function m(f,e,s,h){return(f|0)*3600+(e|0)*60+(s|0)+parseFloat(h||0)}var p=E.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return p?parseFloat(p[2])>59?m(p[2],p[3],0,p[4]):m(p[1],p[2],p[3],p[4]):null}var M=function(){function E(){this.values=Object.create(null)}var m=E.prototype;return m.set=function(f,e){!this.get(f)&&e!==""&&(this.values[f]=e)},m.get=function(f,e,s){return s?this.has(f)?this.values[f]:e[s]:this.has(f)?this.values[f]:e},m.has=function(f){return f in this.values},m.alt=function(f,e,s){for(var h=0;h<s.length;++h)if(e===s[h]){this.set(f,e);break}},m.integer=function(f,e){/^-?\d+$/.test(e)&&this.set(f,parseInt(e,10))},m.percent=function(f,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var s=parseFloat(e);if(s>=0&&s<=100)return this.set(f,s),!0}return!1},E}();function O(E,m,p,f){var e=f?E.split(f):[E];for(var s in e)if(typeof e[s]=="string"){var h=e[s].split(p);if(h.length===2){var g=h[0],i=h[1];m(g,i)}}}var b=new P.default(0,0,""),_=b.align==="middle"?"middle":"center";function y(E,m,p){var f=E;function e(){var g=A(E);if(g===null)throw new Error("Malformed timestamp: "+f);return E=E.replace(/^[^\sa-zA-Z-]+/,""),g}function s(g,i){var r=new M;O(g,function(t,n){var u;switch(t){case"region":for(var a=p.length-1;a>=0;a--)if(p[a].id===n){r.set(t,p[a].region);break}break;case"vertical":r.alt(t,n,["rl","lr"]);break;case"line":u=n.split(","),r.integer(t,u[0]),r.percent(t,u[0])&&r.set("snapToLines",!1),r.alt(t,u[0],["auto"]),u.length===2&&r.alt("lineAlign",u[1],["start",_,"end"]);break;case"position":u=n.split(","),r.percent(t,u[0]),u.length===2&&r.alt("positionAlign",u[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":r.percent(t,n);break;case"align":r.alt(t,n,["start",_,"end","left","right"]);break}},/:/,/\s/),i.region=r.get("region",null),i.vertical=r.get("vertical","");var o=r.get("line","auto");o==="auto"&&b.line===-1&&(o=-1),i.line=o,i.lineAlign=r.get("lineAlign","start"),i.snapToLines=r.get("snapToLines",!0),i.size=r.get("size",100),i.align=r.get("align",_);var c=r.get("position","auto");c==="auto"&&b.position===50&&(c=i.align==="start"||i.align==="left"?0:i.align==="end"||i.align==="right"?100:50),i.position=c}function h(){E=E.replace(/^\s+/,"")}if(h(),m.startTime=e(),h(),E.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+f);E=E.slice(3),h(),m.endTime=e(),h(),s(E,m)}function x(E){return E.replace(/<br(?: \/)?>/gi,`
21
+ `:(v=a.childNodes)!==null&&v!==void 0&&v.length?s(a,n):n?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function h(t,n,u){var a="http://www.w3.org/ns/ttml#styling",d=null,v=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],S=t!=null&&t.hasAttribute("style")?t.getAttribute("style"):null;return S&&u.hasOwnProperty(S)&&(d=u[S]),v.reduce(function(T,I){var k=g(n,a,I)||g(t,a,I)||g(d,a,I);return k&&(T[I]=k),T},{})}function g(t,n,u){return t&&t.hasAttributeNS(n,u)?t.getAttributeNS(n,u):null}function i(t){return new Error("Could not parse ttml timestamp "+t)}function r(t,n){if(!t)return null;var u=Object(L.parseTimeStamp)(t);return u===null&&(x.test(t)?u=o(t,n):D.test(t)&&(u=c(t,n))),u}function o(t,n){var u=x.exec(t),a=(u[4]|0)+(u[5]|0)/n.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/n.frameRate}function c(t,n){var u=D.exec(t),a=Number(u[1]),d=u[2];switch(d){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/n.frameRate;case"t":return a/n.tickRate}return a}},"./src/utils/logger.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"enableLogs",function(){return b}),l.d(R,"logger",function(){return _});var P=function(){},L={trace:P,debug:P,log:P,warn:P,info:P,error:P},A=L;function M(y){var x=self.console[y];return x?x.bind(self.console,"["+y+"] >"):P}function O(y){for(var x=arguments.length,D=new Array(x>1?x-1:0),E=1;E<x;E++)D[E-1]=arguments[E];D.forEach(function(m){A[m]=y[m]?y[m].bind(y):M(m)})}function b(y){if(self.console&&y===!0||typeof y=="object"){O(y,"debug","log","info","warn","error");try{A.log()}catch{A=L}}else A=L}var _=A},"./src/utils/mediakeys-helper.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"KeySystems",function(){return P}),l.d(R,"requestMediaKeySystemAccess",function(){return L});var P;(function(A){A.WIDEVINE="com.widevine.alpha",A.PLAYREADY="com.microsoft.playready"})(P||(P={}));var L=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"getMediaSource",function(){return P});function P(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"RemuxerTrackIdConfig",function(){return b}),l.d(R,"bin2str",function(){return _}),l.d(R,"readUint16",function(){return y}),l.d(R,"readUint32",function(){return x}),l.d(R,"readSint32",function(){return D}),l.d(R,"writeUint32",function(){return E}),l.d(R,"findBox",function(){return m}),l.d(R,"parseSegmentIndex",function(){return p}),l.d(R,"parseInitSegment",function(){return f}),l.d(R,"getStartDTS",function(){return e}),l.d(R,"getDuration",function(){return s}),l.d(R,"computeRawDurationFromSamples",function(){return h}),l.d(R,"offsetStartDTS",function(){return g}),l.d(R,"segmentValidRange",function(){return i}),l.d(R,"appendUint8Array",function(){return r}),l.d(R,"parseSamples",function(){return o}),l.d(R,"parseSEIMessageFromNALu",function(){return n}),l.d(R,"parseEmsg",function(){return a});var P=l("./src/utils/typed-array.ts"),L=l("./src/loader/fragment.ts"),A=l("./src/demux/id3.ts"),M=Math.pow(2,32)-1,O=[].push,b={video:1,audio:2,id3:3,text:4};function _(d){return String.fromCharCode.apply(null,d)}function y(d,v){var S=d[v]<<8|d[v+1];return S<0?65536+S:S}function x(d,v){var S=D(d,v);return S<0?4294967296+S:S}function D(d,v){return d[v]<<24|d[v+1]<<16|d[v+2]<<8|d[v+3]}function E(d,v,S){d[v]=S>>24,d[v+1]=S>>16&255,d[v+2]=S>>8&255,d[v+3]=S&255}function m(d,v){var S=[];if(!v.length)return S;for(var T=d.byteLength,I=0;I<T;){var k=x(d,I),B=_(d.subarray(I+4,I+8)),U=k>1?I+k:T;if(B===v[0])if(v.length===1)S.push(d.subarray(I+8,U));else{var W=m(d.subarray(I+8,U),v.slice(1));W.length&&O.apply(S,W)}I=U}return S}function p(d){var v=[],S=d[0],T=8,I=x(d,T);T+=4;var k=0,B=0;S===0?T+=8:T+=16,T+=2;var U=d.length+B,W=y(d,T);T+=2;for(var G=0;G<W;G++){var z=T,Y=x(d,z);z+=4;var $=Y&2147483647,Z=(Y&2147483648)>>>31;if(Z===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=x(d,z);z+=4,v.push({referenceSize:$,subsegmentDuration:q,info:{duration:q/I,start:U,end:U+$-1}}),U+=$,z+=4,T=z}return{earliestPresentationTime:k,timescale:I,version:S,referencesCount:W,references:v}}function f(d){for(var v=[],S=m(d,["moov","trak"]),T=0;T<S.length;T++){var I=S[T],k=m(I,["tkhd"])[0];if(k){var B=k[0],U=B===0?12:20,W=x(k,U),G=m(I,["mdia","mdhd"])[0];if(G){B=G[0],U=B===0?12:20;var z=x(G,U),Y=m(I,["mdia","hdlr"])[0];if(Y){var $=_(Y.subarray(8,12)),Z={soun:L.ElementaryStreamTypes.AUDIO,vide:L.ElementaryStreamTypes.VIDEO}[$];if(Z){var q=m(I,["mdia","minf","stbl","stsd"])[0],ie=void 0;q&&(ie=_(q.subarray(12,16))),v[W]={timescale:z,type:Z},v[Z]={timescale:z,id:W,codec:ie}}}}}}var ne=m(d,["moov","mvex","trex"]);return ne.forEach(function(ae){var te=x(ae,4),fe=v[te];fe&&(fe.default={duration:x(ae,12),flags:x(ae,20)})}),v}function e(d,v){return m(v,["moof","traf"]).reduce(function(S,T){var I=m(T,["tfdt"])[0],k=I[0],B=m(T,["tfhd"]).reduce(function(U,W){var G=x(W,4),z=d[G];if(z){var Y=x(I,4);k===1&&(Y*=Math.pow(2,32),Y+=x(I,8));var $=z.timescale||9e4,Z=Y/$;if(isFinite(Z)&&(U===null||Z<U))return Z}return U},null);return B!==null&&isFinite(B)&&(S===null||B<S)?B:S},null)||0}function s(d,v){for(var S=0,T=0,I=0,k=m(d,["moof","traf"]),B=0;B<k.length;B++){var U=k[B],W=m(U,["tfhd"])[0],G=x(W,4),z=v[G];if(!!z){var Y=z.default,$=x(W,0)|(Y==null?void 0:Y.flags),Z=Y==null?void 0:Y.duration;$&8&&($&2?Z=x(W,12):Z=x(W,8));for(var q=z.timescale||9e4,ie=m(U,["trun"]),ne=0;ne<ie.length;ne++){if(S=h(ie[ne]),!S&&Z){var ae=x(ie[ne],4);S=Z*ae}z.type===L.ElementaryStreamTypes.VIDEO?T+=S/q:z.type===L.ElementaryStreamTypes.AUDIO&&(I+=S/q)}}}if(T===0&&I===0){for(var te=0,fe=m(d,["sidx"]),de=0;de<fe.length;de++){var re=p(fe[de]);re!=null&&re.references&&(te+=re.references.reduce(function(Ee,me){return Ee+me.info.duration||0},0))}return te}return T||I}function h(d){var v=x(d,0),S=8;v&1&&(S+=4),v&4&&(S+=4);for(var T=0,I=x(d,4),k=0;k<I;k++){if(v&256){var B=x(d,S);T+=B,S+=4}v&512&&(S+=4),v&1024&&(S+=4),v&2048&&(S+=4)}return T}function g(d,v,S){m(v,["moof","traf"]).forEach(function(T){m(T,["tfhd"]).forEach(function(I){var k=x(I,4),B=d[k];if(!!B){var U=B.timescale||9e4;m(T,["tfdt"]).forEach(function(W){var G=W[0],z=x(W,4);if(G===0)z-=S*U,z=Math.max(z,0),E(W,4,z);else{z*=Math.pow(2,32),z+=x(W,8),z-=S*U,z=Math.max(z,0);var Y=Math.floor(z/(M+1)),$=Math.floor(z%(M+1));E(W,4,Y),E(W,8,$)}})}})})}function i(d){var v={valid:null,remainder:null},S=m(d,["moof"]);if(S){if(S.length<2)return v.remainder=d,v}else return v;var T=S[S.length-1];return v.valid=Object(P.sliceUint8)(d,0,T.byteOffset-8),v.remainder=Object(P.sliceUint8)(d,T.byteOffset-8),v}function r(d,v){var S=new Uint8Array(d.length+v.length);return S.set(d),S.set(v,d.length),S}function o(d,v){var S=[],T=v.samples,I=v.timescale,k=v.id,B=!1,U=m(T,["moof"]);return U.map(function(W){var G=W.byteOffset-8,z=m(W,["traf"]);z.map(function(Y){var $=m(Y,["tfdt"]).map(function(Z){var q=Z[0],ie=x(Z,4);return q===1&&(ie*=Math.pow(2,32),ie+=x(Z,8)),ie/I})[0];return $!==void 0&&(d=$),m(Y,["tfhd"]).map(function(Z){var q=x(Z,4),ie=x(Z,0)&16777215,ne=(ie&1)!==0,ae=(ie&2)!==0,te=(ie&8)!==0,fe=0,de=(ie&16)!==0,re=0,Ee=(ie&32)!==0,me=8;q===k&&(ne&&(me+=8),ae&&(me+=4),te&&(fe=x(Z,me),me+=4),de&&(re=x(Z,me),me+=4),Ee&&(me+=4),v.type==="video"&&(B=c(v.codec)),m(Y,["trun"]).map(function(Te){var Me=Te[0],_e=x(Te,0)&16777215,ke=(_e&1)!==0,Ie=0,Be=(_e&4)!==0,be=(_e&256)!==0,Ue=0,Ke=(_e&512)!==0,je=0,Ne=(_e&1024)!==0,et=(_e&2048)!==0,Fe=0,tt=x(Te,4),Oe=8;ke&&(Ie=x(Te,Oe),Oe+=4),Be&&(Oe+=4);for(var Pe=Ie+G,Ve=0;Ve<tt;Ve++){if(be?(Ue=x(Te,Oe),Oe+=4):Ue=fe,Ke?(je=x(Te,Oe),Oe+=4):je=re,Ne&&(Oe+=4),et&&(Me===0?Fe=x(Te,Oe):Fe=D(Te,Oe),Oe+=4),v.type===L.ElementaryStreamTypes.VIDEO)for(var Ce=0;Ce<je;){var Le=x(T,Pe);Pe+=4;var nt=T[Pe]&31;if(t(B,nt)){var We=T.subarray(Pe,Pe+Le);n(We,d+Fe/I,S)}Pe+=Le,Ce+=Le+4}d+=Ue/I}}))})})}),S}function c(d){if(!d)return!1;var v=d.indexOf("."),S=v<0?d:d.substring(0,v);return S==="hvc1"||S==="hev1"||S==="dvh1"||S==="dvhe"}function t(d,v){return d?v===39||v===40:v===6}function n(d,v,S){var T=u(d),I=0;I++;for(var k=0,B=0,U=!1,W=0;I<T.length;){k=0;do{if(I>=T.length)break;W=T[I++],k+=W}while(W===255);B=0;do{if(I>=T.length)break;W=T[I++],B+=W}while(W===255);var G=T.length-I;if(!U&&k===4&&I<T.length){U=!0;var z=T[I++];if(z===181){var Y=y(T,I);if(I+=2,Y===49){var $=x(T,I);if(I+=4,$===1195456820){var Z=T[I++];if(Z===3){var q=T[I++],ie=31&q,ne=64&q,ae=ne?2+ie*3:0,te=new Uint8Array(ae);if(ne){te[0]=q;for(var fe=1;fe<ae;fe++)te[fe]=T[I++]}S.push({type:Z,payloadType:k,pts:v,bytes:te})}}}}}else if(k===5&&B<G){if(U=!0,B>16){for(var de=[],re=0;re<16;re++){var Ee=T[I++].toString(16);de.push(Ee.length==1?"0"+Ee:Ee),(re===3||re===5||re===7||re===9)&&de.push("-")}for(var me=B-16,Te=new Uint8Array(me),Me=0;Me<me;Me++)Te[Me]=T[I++];S.push({payloadType:k,pts:v,uuid:de.join(""),userData:Object(A.utf8ArrayToStr)(Te),userDataBytes:Te})}}else if(B<G)I+=B;else if(B>G)break}}function u(d){for(var v=d.byteLength,S=[],T=1;T<v-2;)d[T]===0&&d[T+1]===0&&d[T+2]===3?(S.push(T+2),T+=2):T++;if(S.length===0)return d;var I=v-S.length,k=new Uint8Array(I),B=0;for(T=0;T<I;B++,T++)B===S[0]&&(B++,S.shift()),k[T]=d[B];return k}function a(d){var v=d[0],S="",T="",I=0,k=0,B=0,U=0,W=0,G=0;if(v===0){for(;_(d.subarray(G,G+1))!=="\0";)S+=_(d.subarray(G,G+1)),G+=1;for(S+=_(d.subarray(G,G+1)),G+=1;_(d.subarray(G,G+1))!=="\0";)T+=_(d.subarray(G,G+1)),G+=1;T+=_(d.subarray(G,G+1)),G+=1,I=x(d,12),k=x(d,16),U=x(d,20),W=x(d,24),G=28}else if(v===1){G+=4,I=x(d,G),G+=4;var z=x(d,G);G+=4;var Y=x(d,G);for(G+=4,B=Math.pow(2,32)*z+Y,Number.isSafeInteger(B)||(B=Number.MAX_SAFE_INTEGER,console.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),U=x(d,G),G+=4,W=x(d,G),G+=4;_(d.subarray(G,G+1))!=="\0";)S+=_(d.subarray(G,G+1)),G+=1;for(S+=_(d.subarray(G,G+1)),G+=1;_(d.subarray(G,G+1))!=="\0";)T+=_(d.subarray(G,G+1)),G+=1;T+=_(d.subarray(G,G+1)),G+=1}var $=d.subarray(G,d.byteLength);return{schemeIdUri:S,value:T,timeScale:I,presentationTime:B,presentationTimeDelta:k,eventDuration:U,id:W,payload:$}}},"./src/utils/output-filter.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"default",function(){return P});var P=function(){function L(M,O){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=M,this.trackName=O}var A=L.prototype;return A.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},A.newCue=function(O,b,_){(this.startTime===null||this.startTime>O)&&(this.startTime=O),this.endTime=b,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},A.reset=function(){this.cueRanges=[],this.startTime=null},L}()},"./src/utils/texttrack-utils.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"sendAddTrackEvent",function(){return L}),l.d(R,"addCueToTrack",function(){return A}),l.d(R,"clearCurrentCues",function(){return M}),l.d(R,"removeCuesInRange",function(){return O}),l.d(R,"getCuesInRange",function(){return _});var P=l("./src/utils/logger.ts");function L(y,x){var D;try{D=new Event("addtrack")}catch{D=document.createEvent("Event"),D.initEvent("addtrack",!1,!1)}D.track=y,x.dispatchEvent(D)}function A(y,x){var D=y.mode;if(D==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(x.id))try{if(y.addCue(x),!y.cues.getCueById(x.id))throw new Error("addCue is failed for: "+x)}catch(m){P.logger.debug("[texttrack-utils]: "+m);var E=new self.TextTrackCue(x.startTime,x.endTime,x.text);E.id=x.id,y.addCue(E)}D==="disabled"&&(y.mode=D)}function M(y){var x=y.mode;if(x==="disabled"&&(y.mode="hidden"),y.cues)for(var D=y.cues.length;D--;)y.removeCue(y.cues[D]);x==="disabled"&&(y.mode=x)}function O(y,x,D,E){var m=y.mode;if(m==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var p=_(y.cues,x,D),f=0;f<p.length;f++)(!E||E(p[f]))&&y.removeCue(p[f]);m==="disabled"&&(y.mode=m)}function b(y,x){if(x<y[0].startTime)return 0;var D=y.length-1;if(x>y[D].endTime)return-1;for(var E=0,m=D;E<=m;){var p=Math.floor((m+E)/2);if(x<y[p].startTime)m=p-1;else if(x>y[p].startTime&&E<D)E=p+1;else return p}return y[E].startTime-x<x-y[m].startTime?E:m}function _(y,x,D){var E=[],m=b(y,x);if(m>-1)for(var p=m,f=y.length;p<f;p++){var e=y[p];if(e.startTime>=x&&e.endTime<=D)E.push(e);else if(e.startTime>D)return E}return E}},"./src/utils/time-ranges.ts":function(j,R,l){"use strict";l.r(R);var P={toString:function(A){for(var M="",O=A.length,b=0;b<O;b++)M+="["+A.start(b).toFixed(3)+","+A.end(b).toFixed(3)+"]";return M}};R.default=P},"./src/utils/timescale-conversion.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"toTimescaleFromBase",function(){return L}),l.d(R,"toTimescaleFromScale",function(){return A}),l.d(R,"toMsFromMpegTsClock",function(){return M}),l.d(R,"toMpegTsClockFromTimescale",function(){return O});var P=9e4;function L(b,_,y,x){y===void 0&&(y=1),x===void 0&&(x=!1);var D=b*_*y;return x?Math.round(D):D}function A(b,_,y,x){return y===void 0&&(y=1),x===void 0&&(x=!1),L(b,_,1/y,x)}function M(b,_){return _===void 0&&(_=!1),L(b,1e3,1/P,_)}function O(b,_){return _===void 0&&(_=1),L(b,P,1/_)}},"./src/utils/typed-array.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"sliceUint8",function(){return P});function P(L,A,M){return Uint8Array.prototype.slice?L.slice(A,M):new Uint8Array(Array.prototype.slice.call(L,A,M))}},"./src/utils/vttcue.ts":function(j,R,l){"use strict";l.r(R),R.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var P=["","lr","rl"],L=["start","middle","end","left","right"];function A(y,x){if(typeof x!="string"||!Array.isArray(y))return!1;var D=x.toLowerCase();return~y.indexOf(D)?D:!1}function M(y){return A(P,y)}function O(y){return A(L,y)}function b(y){for(var x=arguments.length,D=new Array(x>1?x-1:0),E=1;E<x;E++)D[E-1]=arguments[E];for(var m=1;m<arguments.length;m++){var p=arguments[m];for(var f in p)y[f]=p[f]}return y}function _(y,x,D){var E=this,m={enumerable:!0};E.hasBeenReset=!1;var p="",f=!1,e=y,s=x,h=D,g=null,i="",r=!0,o="auto",c="start",t=50,n="middle",u=50,a="middle";Object.defineProperty(E,"id",b({},m,{get:function(){return p},set:function(v){p=""+v}})),Object.defineProperty(E,"pauseOnExit",b({},m,{get:function(){return f},set:function(v){f=!!v}})),Object.defineProperty(E,"startTime",b({},m,{get:function(){return e},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");e=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"endTime",b({},m,{get:function(){return s},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");s=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"text",b({},m,{get:function(){return h},set:function(v){h=""+v,this.hasBeenReset=!0}})),Object.defineProperty(E,"region",b({},m,{get:function(){return g},set:function(v){g=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"vertical",b({},m,{get:function(){return i},set:function(v){var S=M(v);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");i=S,this.hasBeenReset=!0}})),Object.defineProperty(E,"snapToLines",b({},m,{get:function(){return r},set:function(v){r=!!v,this.hasBeenReset=!0}})),Object.defineProperty(E,"line",b({},m,{get:function(){return o},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");o=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"lineAlign",b({},m,{get:function(){return c},set:function(v){var S=O(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");c=S,this.hasBeenReset=!0}})),Object.defineProperty(E,"position",b({},m,{get:function(){return t},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");t=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"positionAlign",b({},m,{get:function(){return n},set:function(v){var S=O(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");n=S,this.hasBeenReset=!0}})),Object.defineProperty(E,"size",b({},m,{get:function(){return u},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");u=v,this.hasBeenReset=!0}})),Object.defineProperty(E,"align",b({},m,{get:function(){return a},set:function(v){var S=O(v);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");a=S,this.hasBeenReset=!0}})),E.displayState=void 0}return _.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"parseTimeStamp",function(){return A}),l.d(R,"fixLineBreaks",function(){return x}),l.d(R,"VTTParser",function(){return D});var P=l("./src/utils/vttcue.ts"),L=function(){function E(){}var m=E.prototype;return m.decode=function(f,e){if(!f)return"";if(typeof f!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(f))},E}();function A(E){function m(f,e,s,h){return(f|0)*3600+(e|0)*60+(s|0)+parseFloat(h||0)}var p=E.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return p?parseFloat(p[2])>59?m(p[2],p[3],0,p[4]):m(p[1],p[2],p[3],p[4]):null}var M=function(){function E(){this.values=Object.create(null)}var m=E.prototype;return m.set=function(f,e){!this.get(f)&&e!==""&&(this.values[f]=e)},m.get=function(f,e,s){return s?this.has(f)?this.values[f]:e[s]:this.has(f)?this.values[f]:e},m.has=function(f){return f in this.values},m.alt=function(f,e,s){for(var h=0;h<s.length;++h)if(e===s[h]){this.set(f,e);break}},m.integer=function(f,e){/^-?\d+$/.test(e)&&this.set(f,parseInt(e,10))},m.percent=function(f,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var s=parseFloat(e);if(s>=0&&s<=100)return this.set(f,s),!0}return!1},E}();function O(E,m,p,f){var e=f?E.split(f):[E];for(var s in e)if(typeof e[s]=="string"){var h=e[s].split(p);if(h.length===2){var g=h[0],i=h[1];m(g,i)}}}var b=new P.default(0,0,""),_=b.align==="middle"?"middle":"center";function y(E,m,p){var f=E;function e(){var g=A(E);if(g===null)throw new Error("Malformed timestamp: "+f);return E=E.replace(/^[^\sa-zA-Z-]+/,""),g}function s(g,i){var r=new M;O(g,function(t,n){var u;switch(t){case"region":for(var a=p.length-1;a>=0;a--)if(p[a].id===n){r.set(t,p[a].region);break}break;case"vertical":r.alt(t,n,["rl","lr"]);break;case"line":u=n.split(","),r.integer(t,u[0]),r.percent(t,u[0])&&r.set("snapToLines",!1),r.alt(t,u[0],["auto"]),u.length===2&&r.alt("lineAlign",u[1],["start",_,"end"]);break;case"position":u=n.split(","),r.percent(t,u[0]),u.length===2&&r.alt("positionAlign",u[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":r.percent(t,n);break;case"align":r.alt(t,n,["start",_,"end","left","right"]);break}},/:/,/\s/),i.region=r.get("region",null),i.vertical=r.get("vertical","");var o=r.get("line","auto");o==="auto"&&b.line===-1&&(o=-1),i.line=o,i.lineAlign=r.get("lineAlign","start"),i.snapToLines=r.get("snapToLines",!0),i.size=r.get("size",100),i.align=r.get("align",_);var c=r.get("position","auto");c==="auto"&&b.position===50&&(c=i.align==="start"||i.align==="left"?0:i.align==="end"||i.align==="right"?100:50),i.position=c}function h(){E=E.replace(/^\s+/,"")}if(h(),m.startTime=e(),h(),E.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+f);E=E.slice(3),h(),m.endTime=e(),h(),s(E,m)}function x(E){return E.replace(/<br(?: \/)?>/gi,`
22
22
  `)}var D=function(){function E(){this.state="INITIAL",this.buffer="",this.decoder=new L,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var m=E.prototype;return m.parse=function(f){var e=this;f&&(e.buffer+=e.decoder.decode(f,{stream:!0}));function s(){var c=e.buffer,t=0;for(c=x(c);t<c.length&&c[t]!=="\r"&&c[t]!==`
23
23
  `;)++t;var n=c.slice(0,t);return c[t]==="\r"&&++t,c[t]===`
24
24
  `&&++t,e.buffer=c.slice(t),n}function h(c){O(c,function(t,n){},/:/)}try{var g="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;g=s();var i=g.match(/^()?WEBVTT([ \t].*)?$/);if(!i||!i[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var r=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(r?r=!1:g=s(),e.state){case"HEADER":/:/.test(g)?h(g):g||(e.state="ID");continue;case"NOTE":g||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(g)){e.state="NOTE";break}if(!g)continue;if(e.cue=new P.default(0,0,""),e.state="CUE",g.indexOf("-->")===-1){e.cue.id=g;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{y(g,e.cue,e.regionList)}catch{e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var o=g.indexOf("-->")!==-1;if(!g||o&&(r=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(e.cue===null)continue;e.cue.text&&(e.cue.text+=`
@@ -27,7 +27,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
27
27
  `,f.parse()),f.state==="INITIAL"||f.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){f.onparsingerror&&f.onparsingerror(e)}return f.onflush&&f.onflush(),this},E}()},"./src/utils/webvtt-parser.ts":function(j,R,l){"use strict";l.r(R),l.d(R,"generateCueId",function(){return D}),l.d(R,"parseWebVTT",function(){return m});var P=l("./src/polyfills/number.ts"),L=l("./src/utils/vttparser.ts"),A=l("./src/demux/id3.ts"),M=l("./src/utils/timescale-conversion.ts"),O=l("./src/remux/mp4-remuxer.ts"),b=/\r\n|\n\r|\n|\r/g,_=function(f,e,s){return s===void 0&&(s=0),f.slice(s,s+e.length)===e},y=function(f){var e=parseInt(f.slice(-3)),s=parseInt(f.slice(-6,-4)),h=parseInt(f.slice(-9,-7)),g=f.length>9?parseInt(f.substring(0,f.indexOf(":"))):0;if(!Object(P.isFiniteNumber)(e)||!Object(P.isFiniteNumber)(s)||!Object(P.isFiniteNumber)(h)||!Object(P.isFiniteNumber)(g))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+f);return e+=1e3*s,e+=60*1e3*h,e+=60*60*1e3*g,e},x=function(f){for(var e=5381,s=f.length;s;)e=e*33^f.charCodeAt(--s);return(e>>>0).toString()};function D(p,f,e){return x(p.toString())+x(f.toString())+x(e)}var E=function(f,e,s){var h=f[e],g=f[h.prevCC];if(!g||!g.new&&h.new){f.ccOffset=f.presentationOffset=h.start,h.new=!1;return}for(;(i=g)!==null&&i!==void 0&&i.new;){var i;f.ccOffset+=h.start-g.start,h.new=!1,h=g,g=f[h.prevCC]}f.presentationOffset=s};function m(p,f,e,s,h,g,i,r){var o=new L.VTTParser,c=Object(A.utf8ArrayToStr)(new Uint8Array(p)).trim().replace(b,`
28
28
  `).split(`
29
29
  `),t=[],n=Object(M.toMpegTsClockFromTimescale)(f,e),u="00:00.000",a=0,d=0,v,S=!0;o.oncue=function(T){var I=s[h],k=s.ccOffset,B=(a-n)/9e4;I!=null&&I.new&&(d!==void 0?k=s.ccOffset=I.start:E(s,h,B)),B&&(k=B-s.presentationOffset);var U=T.endTime-T.startTime,W=Object(O.normalizePts)((T.startTime+k-d)*9e4,g*9e4)/9e4;T.startTime=Math.max(W,0),T.endTime=Math.max(W+U,0);var G=T.text.trim();T.text=decodeURIComponent(encodeURIComponent(G)),T.id||(T.id=D(T.startTime,T.endTime,G)),T.endTime>0&&t.push(T)},o.onparsingerror=function(T){v=T},o.onflush=function(){if(v){r(v);return}i(t)},c.forEach(function(T){if(S)if(_(T,"X-TIMESTAMP-MAP=")){S=!1,T.slice(16).split(",").forEach(function(I){_(I,"LOCAL:")?u=I.slice(6):_(I,"MPEGTS:")&&(a=parseInt(I.slice(7)))});try{d=y(u)/1e3}catch(I){v=I}return}else T===""&&(S=!1);o.parse(T+`
30
- `)}),o.flush()}},"./src/utils/xhr-loader.ts":function(j,R,l){"use strict";l.r(R);var P=l("./src/utils/logger.ts"),L=l("./src/loader/load-stats.ts"),A=/^age:\s*[\d.]+\s*$/m,M=function(){function O(_){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=_?_.xhrSetup:null,this.stats=new L.LoadStats,this.retryDelay=0}var b=O.prototype;return b.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},b.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},b.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},b.load=function(y,x,D){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=x,this.callbacks=D,this.retryDelay=x.retryDelay,this.loadInternal()},b.loadInternal=function(){var y=this.config,x=this.context;if(!!y){var D=this.loader=new self.XMLHttpRequest,E=this.stats;E.loading.first=0,E.loaded=0;var m=this.xhrSetup;try{if(m)try{m(D,x.url)}catch{D.open("GET",x.url,!0),m(D,x.url)}D.readyState||D.open("GET",x.url,!0);var p=this.context.headers;if(p)for(var f in p)D.setRequestHeader(f,p[f])}catch(e){this.callbacks.onError({code:D.status,text:e.message},x,D);return}x.rangeEnd&&D.setRequestHeader("Range","bytes="+x.rangeStart+"-"+(x.rangeEnd-1)),D.onreadystatechange=this.readystatechange.bind(this),D.onprogress=this.loadprogress.bind(this),D.responseType=x.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),D.send()}},b.readystatechange=function(){var y=this.context,x=this.loader,D=this.stats;if(!(!y||!x)){var E=x.readyState,m=this.config;if(!D.aborted&&E>=2)if(self.clearTimeout(this.requestTimeout),D.loading.first===0&&(D.loading.first=Math.max(self.performance.now(),D.loading.start)),E===4){x.onreadystatechange=null,x.onprogress=null;var p=x.status;if(p>=200&&p<300){D.loading.end=Math.max(self.performance.now(),D.loading.first);var f,e;if(y.responseType==="arraybuffer"?(f=x.response,e=f.byteLength):(f=x.responseText,e=f.length),D.loaded=D.total=e,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(D,y,f,x),!this.callbacks)return;var h={url:x.responseURL,data:f};this.callbacks.onSuccess(h,D,y,x)}else D.retry>=m.maxRetry||p>=400&&p<499?(P.logger.error(p+" while loading "+y.url),this.callbacks.onError({code:p,text:x.statusText},y,x)):(P.logger.warn(p+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,m.maxRetryDelay),D.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout)}},b.loadtimeout=function(){P.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},b.loadprogress=function(y){var x=this.stats;x.loaded=y.loaded,y.lengthComputable&&(x.total=y.total)},b.getCacheAge=function(){var y=null;if(this.loader&&A.test(this.loader.getAllResponseHeaders())){var x=this.loader.getResponseHeader("age");y=x?parseFloat(x):null}return y},O}();R.default=M}}).default})});var bt=class{addEventListener(){}removeEventListener(){}dispatchEvent(R){return!0}};if(typeof DocumentFragment=="undefined"){class j extends bt{}globalThis.DocumentFragment=j}var Ut=class extends bt{},yr=class extends bt{},Ji={get(j){},define(j,R,l){},upgrade(j){},whenDefined(j){return Promise.resolve(Ut)}},Nt,Tr=class{constructor(R,l={}){Bt(this,Nt,void 0);er(this,Nt,l==null?void 0:l.detail)}get detail(){return qt(this,Nt)}initCustomEvent(){}};Nt=new WeakMap;function Zi(j,R){return new Ut}var jr={document:{createElement:Zi},DocumentFragment,customElements:Ji,CustomEvent:Tr,EventTarget:bt,HTMLElement:Ut,HTMLVideoElement:yr},Wr=typeof window=="undefined"||typeof globalThis.customElements=="undefined",ht=Wr?jr:globalThis,xr=Wr?jr.document:globalThis.document;var ar=Zt(Gr(),1),Tt=Zt(ir(),1),Lr=Zt(ir(),1),Ot=Zt(ir(),1),jt=class extends Error{constructor(j,R=jt.MEDIA_ERR_CUSTOM,l){var P;super(j),this.name="MediaError",this.code=R,this.fatal=l!=null?l:R>=jt.MEDIA_ERR_NETWORK&&R<=jt.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(P=jt.defaultMessages[this.code])!=null?P:"")}},ze=jt;ze.MEDIA_ERR_ABORTED=1,ze.MEDIA_ERR_NETWORK=2,ze.MEDIA_ERR_DECODE=3,ze.MEDIA_ERR_SRC_NOT_SUPPORTED=4,ze.MEDIA_ERR_ENCRYPTED=5,ze.MEDIA_ERR_CUSTOM=100,ze.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var Qr=(j,R)=>j in R,_r={ANY:"any",MUTED:"muted"},nr={VOD:"on-demand",ON_DEMAND:"on-demand",LIVE:"live",LL_LIVE:"ll-live",DVR:"live:dvr",LL_DVR:"ll-live:dvr"},xt={MSE:"mse",NATIVE:"native"},Rt={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},br={HLS:Rt.M3U8},bn=Object.keys(br),On=[...Object.values(Rt),"hls","HLS"],Wt=(j,R,l,P)=>{j.addEventListener(R,l,P),j.addEventListener("teardown",()=>{j.removeEventListener(R,l)},{once:!0})};function qi(j,R,l){R&&l>R&&(l=R);for(let P=0;P<j.length;P++)if(j.start(P)<=l&&j.end(P)>=l)return!0;return!1}var en=j=>{let R=j.indexOf("?");if(R<0)return[j];let l=j.slice(0,R),P=j.slice(R);return[l,P]},$r=j=>{let R=j.type;if(R){let P=R.toUpperCase();return Qr(P,br)?br[P]:R}let{src:l}=j;return l?tn(l):""},tn=j=>{let R="";try{R=new URL(j).pathname}catch{console.error("invalid url")}let l=R.lastIndexOf(".");if(l<0)return"";let P=R.slice(l+1).toUpperCase();return Qr(P,Rt)?Rt[P]:""},rn=Object.values(_r),Hr=j=>typeof j=="boolean"||typeof j=="string"&&rn.includes(j),nn=({autoplay:j},R,l)=>{if(!R)return()=>{};let P=!1,L=!1,A=Hr(j)?j:!!j,M=()=>{P||Wt(R,"playing",()=>{P=!0},{once:!0})};if(M(),Wt(R,"loadstart",()=>{P=!1,M(),Ar(R,A)},{once:!0}),Wt(R,"loadstart",()=>{l||(L=!Number.isFinite(R.duration)),Ar(R,A)},{once:!0}),l&&l.once(Lr.default.Events.LEVEL_LOADED,(O,b)=>{var _;L=(_=b.details.live)!=null?_:!1}),!A){let O=()=>{!L||(l!=null&&l.liveSyncPosition?R.currentTime=l.liveSyncPosition:Number.isFinite(R.seekable.end(0))&&(R.currentTime=R.seekable.end(0)))};l&&Wt(R,"play",()=>{R.preload==="metadata"?l.once(Lr.default.Events.LEVEL_UPDATED,O):O()},{once:!0})}return O=>{P||(A=Hr(O)?O:!!O,Ar(R,A))}},Ar=(j,R)=>{if(!R)return;let l=j.muted,P=()=>j.muted=l;switch(R){case _r.ANY:j.play().catch(()=>{j.muted=!0,j.play().catch(P)});break;case _r.MUTED:j.muted=!0,j.play().catch(P);break;default:j.play().catch(()=>{});break}},an=({preload:j,src:R},l,P)=>{if(!l)return()=>{};let L=x=>{x!=null&&["","none","metadata","auto"].includes(x)?l.setAttribute("preload",x):l.removeAttribute("preload")};if(!P)return L(j),L;let A=!1,M=!1,O=P.config.maxBufferLength,b=P.config.maxBufferSize,_=x=>{L(x);let D=x!=null?x:l.preload;M||D==="none"||(D==="metadata"?(P.config.maxBufferLength=1,P.config.maxBufferSize=1):(P.config.maxBufferLength=O,P.config.maxBufferSize=b),y())},y=()=>{!A&&R&&(A=!0,P.loadSource(R))};return Wt(l,"play",()=>{M=!0,P.config.maxBufferLength=O,P.config.maxBufferSize=b,y()},{once:!0}),_(j),_};function sn(j,R){R.on(Ot.default.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(L,{tracks:A})=>{A.forEach(M=>{var O;let b=(O=M.subtitleTrack)!=null?O:M.closedCaptions,_=R.subtitleTracks.findIndex(({lang:y,name:x,type:D})=>y==(b==null?void 0:b.lang)&&x===M.label&&D.toLowerCase()===M.kind);on(j,M.kind,M.label,b==null?void 0:b.lang,`${M.kind}${_}`)})});let l=()=>{var L;if(!R.subtitleTracks.length)return;let A=Array.from(j.textTracks).find(O=>O.id&&O.mode==="showing"&&["subtitles","captions"].includes(O.kind)),M=`${(L=R.subtitleTracks[R.subtitleTrack])==null?void 0:L.type.toLowerCase()}${R.subtitleTrack}`;if(A&&(R.subtitleTrack<0||(A==null?void 0:A.id)!==M)){let O=R.subtitleTracks.findIndex(({lang:b,name:_,type:y})=>b==A.language&&_===A.label&&y.toLowerCase()===A.kind);R.subtitleTrack=O}A&&(A==null?void 0:A.id)===M&&A.cues&&Array.from(A.cues).forEach(O=>{A.addCue(O)})};j.textTracks.addEventListener("change",l),R.on(Ot.default.Events.CUES_PARSED,(L,{track:A,cues:M})=>{let O=j.textTracks.getTrackById(A);if(!O)return;let b=O.mode==="disabled";b&&(O.mode="hidden"),M.forEach(_=>{var y;(y=O.cues)!=null&&y.getCueById(_.id)||O.addCue(_)}),b&&(O.mode="disabled")}),R.once(Ot.default.Events.DESTROYING,()=>{j.textTracks.removeEventListener("change",l),j.querySelectorAll("track[data-removeondestroy]").forEach(L=>{L.remove()})});let P=()=>{Array.from(j.textTracks).forEach(L=>{var A,M;if(!["subtitles","caption"].includes(L.kind)&&L.label==="thumbnails"){if(!((A=L.cues)!=null&&A.length)){let O=j.querySelector('track[label="thumbnails"]'),b=(M=O==null?void 0:O.getAttribute("src"))!=null?M:"";O==null||O.removeAttribute("src"),setTimeout(()=>{O==null||O.setAttribute("src",b)},0)}L.mode!=="hidden"&&(L.mode="hidden")}})};R.once(Ot.default.Events.MANIFEST_LOADED,P),R.once(Ot.default.Events.MEDIA_ATTACHED,P)}function on(j,R,l,P,L){let A=document.createElement("track");return A.kind=R,A.label=l,P&&(A.srclang=P),L&&(A.id=L),A.track.mode="disabled",A.setAttribute("data-removeondestroy",""),j.append(A),A.track}var Vr,Yr,ln=(Yr=(Vr=globalThis==null?void 0:globalThis.navigator)==null?void 0:Vr.userAgent)!=null?Yr:"",un=ln.toLowerCase().indexOf("android")!==-1,Gt=new WeakMap,Jr="mux.com",zr,Xr,Zr=(Xr=(zr=Tt.default).isSupported)==null?void 0:Xr.call(zr),fn=un,qr=()=>ar.default.utils.now(),ei=ar.default.utils.generateUUID,ti=(j,{domain:R=Jr}={})=>{if(!j)return;let[l,P=""]=en(j);return`https://stream.${R}/${l}.m3u8${P}`},dn=j=>{if(!j)return;let[R]=j.split("?");return R||void 0},cn=j=>{if(!j||!j.startsWith("https://stream."))return;let[R]=new URL(j).pathname.slice(1).split(".m3u8");return R||void 0},hn=j=>{var R,l,P;return(R=j==null?void 0:j.metadata)!=null&&R.video_id?j.metadata.video_id:ni(j)&&(P=(l=dn(j.playbackId))!=null?l:cn(j.src))!=null?P:ei()};var ri=(j,R,l)=>{Rr(R,l);let{metadata:P={}}=j,{view_session_id:L=ei()}=P,A=hn(j);P.view_session_id=L,P.video_id=A,j.metadata=P,Gt.set(R,{});let M=vn(j,R);mn(j,R,M),pn(j,R,M);let O=nn(j,R,M),b=an(j,R,M);return{engine:M,setAutoplay:O,setPreload:b}},Rr=(j,R)=>{let l=R==null?void 0:R.engine;l&&(l.detachMedia(),l.destroy()),(j==null?void 0:j.mux)&&!j.mux.deleted&&(j.mux.destroy(),delete j.mux),j&&(j.removeAttribute("src"),j.load(),j.removeEventListener("error",si),j.removeEventListener("error",Or),j.removeEventListener("durationchange",ai),Gt.delete(j),j.dispatchEvent(new Event("teardown")))};function ii(j,R){var l;let P=$r(j);if(P!==Rt.M3U8)return!0;let L=!P||((l=R==null?void 0:R.canPlayType(P))!=null?l:!0),{preferPlayback:A}=j,M=A===xt.MSE,O=A===xt.NATIVE;return L&&(O||!(Zr&&(M||fn)))}var vn=(j,R)=>{let{debug:l,streamType:P,startTime:L=-1,metadata:A,experimentalCmcd:M}=j,O=$r(j)===Rt.M3U8,b=ii(j,R);if(O&&!b&&Zr){let _={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0},y=gn(P),x=M?{useHeaders:!0,sessionId:A.view_session_id,contentId:A.video_id}:void 0;return new Tt.default({debug:l,startPosition:L,cmcd:x,..._,...y})}},gn=j=>[nr.LIVE,nr.DVR].includes(j)?{backBufferLength:8}:[nr.LL_LIVE,nr.LL_DVR].includes(j)?{backBufferLength:4,maxFragLookUpTolerance:.001}:{},ni=({playbackId:j,src:R,customDomain:l})=>{if(j)return!0;if(typeof R!="string")return!1;let P=window==null?void 0:window.location.href,L=new URL(R,P).hostname.toLocaleLowerCase();return L.includes(Jr)||!!l&&L.includes(l.toLocaleLowerCase())},mn=(j,R,l)=>{var P;let{envKey:L}=j,A=ni(j);if((L||A)&&R){let{playerInitTime:M,playerSoftwareName:O,playerSoftwareVersion:b,beaconCollectionDomain:_,debug:y,disableCookies:x}=j,D={...j.metadata,video_title:((P=j==null?void 0:j.metadata)==null?void 0:P.video_title)||void 0},E=m=>typeof m.player_error_code=="string"?!1:typeof j.errorTranslator=="function"?j.errorTranslator(m):m;ar.default.monitor(R,{debug:y,beaconCollectionDomain:_,hlsjs:l,Hls:l?Tt.default:void 0,automaticErrorTracking:!1,errorTranslator:E,disableCookies:x,data:{...L?{env_key:L}:{},player_software_name:O,player_software:O,player_software_version:b,player_init_time:M,...D}})}},pn=(j,R,l)=>{var P;if(!R){console.warn("attempting to load media before mediaEl exists");return}let L=ii(j,R),{src:A}=j;R&&L?(typeof A=="string"?(R.setAttribute("src",A),j.startTime&&(((P=Gt.get(R))!=null?P:{}).startTime=j.startTime,R.addEventListener("durationchange",ai,{once:!0}))):R.removeAttribute("src"),R.addEventListener("error",si),R.addEventListener("error",Or)):l&&A?(l.on(Tt.default.Events.ERROR,(M,O)=>{let b={[Tt.default.ErrorTypes.NETWORK_ERROR]:ze.MEDIA_ERR_NETWORK,[Tt.default.ErrorTypes.MEDIA_ERROR]:ze.MEDIA_ERR_DECODE},_=new ze("",b[O.type]);_.fatal=O.fatal,_.data=O,R.dispatchEvent(new CustomEvent("error",{detail:_}))}),R.addEventListener("error",Or),sn(R,l),l.attachMedia(R)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function ai(j){var R;let l=j.target,P=(R=Gt.get(l))==null?void 0:R.startTime;if(!!P&&qi(l.seekable,l.duration,P)){let L=l.preload==="auto";L&&(l.preload="none"),l.currentTime=P,L&&(l.preload="auto")}}async function si(j){if(!j.isTrusted)return;j.stopImmediatePropagation();let R=j.target;if(!(R!=null&&R.error))return;let{message:l,code:P}=R.error,L=new ze(l,P);if(R.src&&(P!==ze.MEDIA_ERR_DECODE||P!==void 0))try{let{status:A}=await fetch(R.src);L.data={response:{code:A}}}catch{}R.dispatchEvent(new CustomEvent("error",{detail:L}))}function Or(j){var R,l;if(!(j instanceof CustomEvent)||!(j.detail instanceof ze))return;let P=j.target,L=j.detail;!L||!L.fatal||(((R=Gt.get(P))!=null?R:{}).error=L,(l=P.mux)==null||l.emit("error",{player_error_code:L.code,player_error_message:L.message}))}var En=()=>{try{return"0.8.0"}catch{}return"UNKNOWN"},yn=En(),oi=()=>yn;var li=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],ui=xr.createElement("template");ui.innerHTML=`
30
+ `)}),o.flush()}},"./src/utils/xhr-loader.ts":function(j,R,l){"use strict";l.r(R);var P=l("./src/utils/logger.ts"),L=l("./src/loader/load-stats.ts"),A=/^age:\s*[\d.]+\s*$/m,M=function(){function O(_){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=_?_.xhrSetup:null,this.stats=new L.LoadStats,this.retryDelay=0}var b=O.prototype;return b.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},b.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},b.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},b.load=function(y,x,D){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=x,this.callbacks=D,this.retryDelay=x.retryDelay,this.loadInternal()},b.loadInternal=function(){var y=this.config,x=this.context;if(!!y){var D=this.loader=new self.XMLHttpRequest,E=this.stats;E.loading.first=0,E.loaded=0;var m=this.xhrSetup;try{if(m)try{m(D,x.url)}catch{D.open("GET",x.url,!0),m(D,x.url)}D.readyState||D.open("GET",x.url,!0);var p=this.context.headers;if(p)for(var f in p)D.setRequestHeader(f,p[f])}catch(e){this.callbacks.onError({code:D.status,text:e.message},x,D);return}x.rangeEnd&&D.setRequestHeader("Range","bytes="+x.rangeStart+"-"+(x.rangeEnd-1)),D.onreadystatechange=this.readystatechange.bind(this),D.onprogress=this.loadprogress.bind(this),D.responseType=x.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),D.send()}},b.readystatechange=function(){var y=this.context,x=this.loader,D=this.stats;if(!(!y||!x)){var E=x.readyState,m=this.config;if(!D.aborted&&E>=2)if(self.clearTimeout(this.requestTimeout),D.loading.first===0&&(D.loading.first=Math.max(self.performance.now(),D.loading.start)),E===4){x.onreadystatechange=null,x.onprogress=null;var p=x.status;if(p>=200&&p<300){D.loading.end=Math.max(self.performance.now(),D.loading.first);var f,e;if(y.responseType==="arraybuffer"?(f=x.response,e=f.byteLength):(f=x.responseText,e=f.length),D.loaded=D.total=e,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(D,y,f,x),!this.callbacks)return;var h={url:x.responseURL,data:f};this.callbacks.onSuccess(h,D,y,x)}else D.retry>=m.maxRetry||p>=400&&p<499?(P.logger.error(p+" while loading "+y.url),this.callbacks.onError({code:p,text:x.statusText},y,x)):(P.logger.warn(p+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,m.maxRetryDelay),D.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout)}},b.loadtimeout=function(){P.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},b.loadprogress=function(y){var x=this.stats;x.loaded=y.loaded,y.lengthComputable&&(x.total=y.total)},b.getCacheAge=function(){var y=null;if(this.loader&&A.test(this.loader.getAllResponseHeaders())){var x=this.loader.getResponseHeader("age");y=x?parseFloat(x):null}return y},O}();R.default=M}}).default})});var Ct=class{addEventListener(){}removeEventListener(){}dispatchEvent(R){return!0}};if(typeof DocumentFragment=="undefined"){class j extends Ct{}globalThis.DocumentFragment=j}var Ht=class extends Ct{},Ar=class extends Ct{},nn={get(j){},define(j,R,l){},upgrade(j){},whenDefined(j){return Promise.resolve(Ht)}},Vt,Lr=class{constructor(R,l={}){lt(this,Vt,void 0);ut(this,Vt,l==null?void 0:l.detail)}get detail(){return ze(this,Vt)}initCustomEvent(){}};Vt=new WeakMap;function an(j,R){return new Ht}var zr={document:{createElement:an},DocumentFragment,customElements:nn,CustomEvent:Lr,EventTarget:Ct,HTMLElement:Ht,HTMLVideoElement:Ar},Xr=typeof window=="undefined"||typeof globalThis.customElements=="undefined",mt=Xr?zr:globalThis,_r=Xr?zr.document:globalThis.document;var fr=sr(Qr(),1),Lt=sr(lr(),1),Ir=sr(lr(),1),Mt=sr(lr(),1),zt=class extends Error{constructor(j,R=zt.MEDIA_ERR_CUSTOM,l){var P;super(j),this.name="MediaError",this.code=R,this.fatal=l!=null?l:R>=zt.MEDIA_ERR_NETWORK&&R<=zt.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(P=zt.defaultMessages[this.code])!=null?P:"")}},Xe=zt;Xe.MEDIA_ERR_ABORTED=1,Xe.MEDIA_ERR_NETWORK=2,Xe.MEDIA_ERR_DECODE=3,Xe.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Xe.MEDIA_ERR_ENCRYPTED=5,Xe.MEDIA_ERR_CUSTOM=100,Xe.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var ti=(j,R)=>j in R,Pr={ANY:"any",MUTED:"muted"},ur={VOD:"on-demand",ON_DEMAND:"on-demand",LIVE:"live",LL_LIVE:"ll-live",DVR:"live:dvr",LL_DVR:"ll-live:dvr"},_t={MSE:"mse",NATIVE:"native"},ri={HEADER:"header",QUERY:"query"},Fn=Object.values(ri),Ft={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Cr={HLS:Ft.M3U8},wn=Object.keys(Cr),kn=[...Object.values(Ft),"hls","HLS"],Xt=(j,R,l,P)=>{j.addEventListener(R,l,P),j.addEventListener("teardown",()=>{j.removeEventListener(R,l)},{once:!0})};function sn(j,R,l){R&&l>R&&(l=R);for(let P=0;P<j.length;P++)if(j.start(P)<=l&&j.end(P)>=l)return!0;return!1}var on=j=>{let R=j.indexOf("?");if(R<0)return[j];let l=j.slice(0,R),P=j.slice(R);return[l,P]},ii=j=>{let R=j.type;if(R){let P=R.toUpperCase();return ti(P,Cr)?Cr[P]:R}let{src:l}=j;return l?ln(l):""},ln=j=>{let R="";try{R=new URL(j).pathname}catch{console.error("invalid url")}let l=R.lastIndexOf(".");if(l<0)return"";let P=R.slice(l+1).toUpperCase();return ti(P,Ft)?Ft[P]:""},un=Object.values(Pr),$r=j=>typeof j=="boolean"||typeof j=="string"&&un.includes(j),fn=({autoplay:j},R,l)=>{let P=!1,L=!1,A=$r(j)?j:!!j,M=()=>{P||Xt(R,"playing",()=>{P=!0},{once:!0})};if(M(),Xt(R,"loadstart",()=>{P=!1,M(),Rr(R,A)},{once:!0}),Xt(R,"loadstart",()=>{l||(L=!Number.isFinite(R.duration)),Rr(R,A)},{once:!0}),l&&l.once(Ir.default.Events.LEVEL_LOADED,(O,b)=>{var _;L=(_=b.details.live)!=null?_:!1}),!A){let O=()=>{!L||(l!=null&&l.liveSyncPosition?R.currentTime=l.liveSyncPosition:Number.isFinite(R.seekable.end(0))&&(R.currentTime=R.seekable.end(0)))};l&&Xt(R,"play",()=>{R.preload==="metadata"?l.once(Ir.default.Events.LEVEL_UPDATED,O):O()},{once:!0})}return O=>{P||(A=$r(O)?O:!!O,Rr(R,A))}},Rr=(j,R)=>{if(!R)return;let l=j.muted,P=()=>j.muted=l;switch(R){case Pr.ANY:j.play().catch(()=>{j.muted=!0,j.play().catch(P)});break;case Pr.MUTED:j.muted=!0,j.play().catch(P);break;default:j.play().catch(()=>{});break}},dn=({preload:j,src:R},l,P)=>{let L=x=>{x!=null&&["","none","metadata","auto"].includes(x)?l.setAttribute("preload",x):l.removeAttribute("preload")};if(!P)return L(j),L;let A=!1,M=!1,O=P.config.maxBufferLength,b=P.config.maxBufferSize,_=x=>{L(x);let D=x!=null?x:l.preload;M||D==="none"||(D==="metadata"?(P.config.maxBufferLength=1,P.config.maxBufferSize=1):(P.config.maxBufferLength=O,P.config.maxBufferSize=b),y())},y=()=>{!A&&R&&(A=!0,P.loadSource(R))};return Xt(l,"play",()=>{M=!0,P.config.maxBufferLength=O,P.config.maxBufferSize=b,y()},{once:!0}),_(j),_};function cn(j,R){R.on(Mt.default.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(L,{tracks:A})=>{A.forEach(M=>{var O;let b=(O=M.subtitleTrack)!=null?O:M.closedCaptions,_=R.subtitleTracks.findIndex(({lang:y,name:x,type:D})=>y==(b==null?void 0:b.lang)&&x===M.label&&D.toLowerCase()===M.kind);hn(j,M.kind,M.label,b==null?void 0:b.lang,`${M.kind}${_}`)})});let l=()=>{var L;if(!R.subtitleTracks.length)return;let A=Array.from(j.textTracks).find(O=>O.id&&O.mode==="showing"&&["subtitles","captions"].includes(O.kind)),M=`${(L=R.subtitleTracks[R.subtitleTrack])==null?void 0:L.type.toLowerCase()}${R.subtitleTrack}`;if(A&&(R.subtitleTrack<0||(A==null?void 0:A.id)!==M)){let O=R.subtitleTracks.findIndex(({lang:b,name:_,type:y})=>b==A.language&&_===A.label&&y.toLowerCase()===A.kind);R.subtitleTrack=O}A&&(A==null?void 0:A.id)===M&&A.cues&&Array.from(A.cues).forEach(O=>{A.addCue(O)})};j.textTracks.addEventListener("change",l),R.on(Mt.default.Events.CUES_PARSED,(L,{track:A,cues:M})=>{let O=j.textTracks.getTrackById(A);if(!O)return;let b=O.mode==="disabled";b&&(O.mode="hidden"),M.forEach(_=>{var y;(y=O.cues)!=null&&y.getCueById(_.id)||O.addCue(_)}),b&&(O.mode="disabled")}),R.once(Mt.default.Events.DESTROYING,()=>{j.textTracks.removeEventListener("change",l),j.querySelectorAll("track[data-removeondestroy]").forEach(L=>{L.remove()})});let P=()=>{Array.from(j.textTracks).forEach(L=>{var A,M;if(!["subtitles","caption"].includes(L.kind)&&L.label==="thumbnails"){if(!((A=L.cues)!=null&&A.length)){let O=j.querySelector('track[label="thumbnails"]'),b=(M=O==null?void 0:O.getAttribute("src"))!=null?M:"";O==null||O.removeAttribute("src"),setTimeout(()=>{O==null||O.setAttribute("src",b)},0)}L.mode!=="hidden"&&(L.mode="hidden")}})};R.once(Mt.default.Events.MANIFEST_LOADED,P),R.once(Mt.default.Events.MEDIA_ATTACHED,P)}function hn(j,R,l,P,L){let A=document.createElement("track");return A.kind=R,A.label=l,P&&(A.srclang=P),L&&(A.id=L),A.track.mode="disabled",A.setAttribute("data-removeondestroy",""),j.append(A),A.track}var Jr,Zr,vn=(Zr=(Jr=globalThis==null?void 0:globalThis.navigator)==null?void 0:Jr.userAgent)!=null?Zr:"",gn=vn.toLowerCase().indexOf("android")!==-1,Qt=new WeakMap,ni="mux.com",qr,ei,ai=(ei=(qr=Lt.default).isSupported)==null?void 0:ei.call(qr),mn=gn,si=()=>fr.default.utils.now(),pn=fr.default.utils.generateUUID,oi=(j,{domain:R=ni}={})=>{if(!j)return;let[l,P=""]=on(j);return`https://stream.${R}/${l}.m3u8${P}`},En=j=>{if(!j)return;let[R]=j.split("?");return R||void 0},yn=j=>{if(!j||!j.startsWith("https://stream."))return;let[R]=new URL(j).pathname.slice(1).split(".m3u8");return R||void 0},Tn=j=>{var R,l,P;return(R=j==null?void 0:j.metadata)!=null&&R.video_id?j.metadata.video_id:fi(j)&&(P=(l=En(j.playbackId))!=null?l:yn(j.src))!=null?P:j.src};var li=(j,R,l)=>{Fr(R,l);let{metadata:P={}}=j,{view_session_id:L=pn()}=P,A=Tn(j);P.view_session_id=L,P.video_id=A,j.metadata=P,Qt.set(R,{});let M=xn(j,R);Dn(j,R,M),An(j,R,M);let O=fn(j,R,M),b=dn(j,R,M);return{engine:M,setAutoplay:O,setPreload:b}},Fr=(j,R)=>{let l=R==null?void 0:R.engine;l&&(l.detachMedia(),l.destroy()),(j==null?void 0:j.mux)&&!j.mux.deleted&&(j.mux.destroy(),delete j.mux),j&&(j.removeAttribute("src"),j.load(),j.removeEventListener("error",ci),j.removeEventListener("error",Mr),j.removeEventListener("durationchange",di),Qt.delete(j),j.dispatchEvent(new Event("teardown")))};function ui(j,R){var l;let P=ii(j);if(P!==Ft.M3U8)return!0;let L=!P||((l=R.canPlayType(P))!=null?l:!0),{preferPlayback:A}=j,M=A===_t.MSE,O=A===_t.NATIVE;return L&&(O||!(ai&&(M||mn)))}var xn=(j,R)=>{let{debug:l,streamType:P,startTime:L=-1,metadata:A,experimentalCmcd:M,preferCmcd:O}=j,b=ii(j)===Ft.M3U8,_=ui(j,R);if(b&&!_&&ai){let y={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0},x=Sn(P),D=M?{useHeaders:O===ri.HEADER,sessionId:A.view_session_id,contentId:A.video_id}:void 0;return new Lt.default({debug:l,startPosition:L,cmcd:D,...y,...x})}},Sn=j=>[ur.LIVE,ur.DVR].includes(j)?{backBufferLength:8}:[ur.LL_LIVE,ur.LL_DVR].includes(j)?{backBufferLength:4,maxFragLookUpTolerance:.001}:{},fi=({playbackId:j,src:R,customDomain:l})=>{if(j)return!0;if(typeof R!="string")return!1;let P=window==null?void 0:window.location.href,L=new URL(R,P).hostname.toLocaleLowerCase();return L.includes(ni)||!!l&&L.includes(l.toLocaleLowerCase())},Dn=(j,R,l)=>{var P;let{envKey:L}=j,A=fi(j);if(L||A){let{playerInitTime:M,playerSoftwareName:O,playerSoftwareVersion:b,beaconCollectionDomain:_,debug:y,disableCookies:x}=j,D={...j.metadata,video_title:((P=j==null?void 0:j.metadata)==null?void 0:P.video_title)||void 0},E=m=>typeof m.player_error_code=="string"?!1:typeof j.errorTranslator=="function"?j.errorTranslator(m):m;fr.default.monitor(R,{debug:y,beaconCollectionDomain:_,hlsjs:l,Hls:l?Lt.default:void 0,automaticErrorTracking:!1,errorTranslator:E,disableCookies:x,data:{...L?{env_key:L}:{},player_software_name:O,player_software:O,player_software_version:b,player_init_time:M,...D}})}},An=(j,R,l)=>{var P;let L=ui(j,R),{src:A}=j;R&&L?(typeof A=="string"?(R.setAttribute("src",A),j.startTime&&(((P=Qt.get(R))!=null?P:{}).startTime=j.startTime,R.addEventListener("durationchange",di,{once:!0}))):R.removeAttribute("src"),R.addEventListener("error",ci),R.addEventListener("error",Mr)):l&&A?(l.on(Lt.default.Events.ERROR,(M,O)=>{let b={[Lt.default.ErrorTypes.NETWORK_ERROR]:Xe.MEDIA_ERR_NETWORK,[Lt.default.ErrorTypes.MEDIA_ERROR]:Xe.MEDIA_ERR_DECODE},_=new Xe("",b[O.type]);_.fatal=O.fatal,_.data=O,R.dispatchEvent(new CustomEvent("error",{detail:_}))}),R.addEventListener("error",Mr),cn(R,l),l.attachMedia(R)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function di(j){var R;let l=j.target,P=(R=Qt.get(l))==null?void 0:R.startTime;if(!!P&&sn(l.seekable,l.duration,P)){let L=l.preload==="auto";L&&(l.preload="none"),l.currentTime=P,L&&(l.preload="auto")}}async function ci(j){if(!j.isTrusted)return;j.stopImmediatePropagation();let R=j.target;if(!(R!=null&&R.error))return;let{message:l,code:P}=R.error,L=new Xe(l,P);if(R.src&&(P!==Xe.MEDIA_ERR_DECODE||P!==void 0))try{let{status:A}=await fetch(R.src);L.data={response:{code:A}}}catch{}R.dispatchEvent(new CustomEvent("error",{detail:L}))}function Mr(j){var R,l;if(!(j instanceof CustomEvent)||!(j.detail instanceof Xe))return;let P=j.target,L=j.detail;!L||!L.fatal||(((R=Qt.get(P))!=null?R:{}).error=L,(l=P.mux)==null||l.emit("error",{player_error_code:L.code,player_error_message:L.message}))}var Ln=()=>{try{return"0.8.1"}catch{}return"UNKNOWN"},_n=Ln(),hi=()=>_n;var vi=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],gi=_r.createElement("template");gi.innerHTML=`
31
31
  <style>
32
32
  :host {
33
33
  /* display:inline (like the native el) makes it so you can't fill
@@ -50,7 +50,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
50
50
 
51
51
  <audio part="audio" crossorigin></audio>
52
52
  <slot></slot>
53
- `;var Ht,It,sr,St=class extends ht.HTMLElement{constructor(){super();Bt(this,It);Bt(this,Ht,void 0);this.attachShadow({mode:"open"}),this.isConnected&&tr(this,It,sr).call(this)}static get observedAttributes(){let l=[];Object.getOwnPropertyNames(this.prototype).forEach(L=>{let A=!1;try{typeof this.prototype[L]=="function"&&(A=!0)}catch{}!A&&L!==L.toUpperCase()&&l.push(L.toLowerCase())});let P=Object.getPrototypeOf(this).observedAttributes;return P&&(l=l.concat(P)),l}attributeChangedCallback(l,P,L){tr(this,It,sr).call(this),this.forwardAttribute(l,P,L)}forwardAttribute(l,P,L){let A=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),M=xn(A,l),O=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;M&&!O?typeof this[M]=="boolean"?L===null?this[M]=!1:this[M]=!0:this[M]=L:L===null?this.nativeEl.removeAttribute(l):["id","class"].indexOf(l)===-1&&this.nativeEl.setAttribute(l,L)}connectedCallback(){tr(this,It,sr).call(this)}};Ht=new WeakMap,It=new WeakSet,sr=function(){if(qt(this,Ht))return;er(this,Ht,!0),this.shadowRoot.append(ui.content.cloneNode(!0));let l=this.nativeEl=this.shadowRoot.querySelector("audio");li.forEach(L=>{l.addEventListener(L,A=>{this.dispatchEvent(new CustomEvent(A.type,{detail:A.detail}))})});let P=this.shadowRoot.querySelector("slot");P.addEventListener("slotchange",()=>{P.assignedElements().forEach(L=>{!["track","source"].includes(L.localName)||l.append(L)})}),Array.from(this.attributes).forEach(L=>{this.forwardAttribute(L.name,null,L.value)}),l.defaultMuted&&(l.muted=!0)};var fi=[],di=xr.createElement("audio"),Tn=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let j=Object.getPrototypeOf(di);j&&j!==ht.HTMLElement.prototype;j=Object.getPrototypeOf(j))Object.keys(j).forEach(R=>{Tn.indexOf(R)===-1&&fi.push(R)});fi.forEach(j=>{if(typeof di[j]=="function")St.prototype[j]=function(){return this.nativeEl[j].apply(this.nativeEl,arguments)};else{let l={get(){return this.nativeEl[j]}};j!==j.toUpperCase()&&(l.set=function(P){this.nativeEl[j]=P}),Object.defineProperty(St.prototype,j,l)}});function xn(j,R){let l=null;return j.forEach(P=>{P.toLowerCase()==R.toLowerCase()&&(l=P)}),l}ht.customElements.get("custom-audio")||(ht.customElements.define("custom-audio",St),ht.CustomAudioElement=St);var Ir=St;var De={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},Sn=Object.values(De),Dn=oi(),An="mux-audio",Vt=class extends Ir{constructor(){super();this.__metadata={};this.__playerInitTime=qr()}static get observedAttributes(){var l;return[...Sn,...(l=Ir.observedAttributes)!=null?l:[]]}get playerInitTime(){return this.__playerInitTime}get playerSoftwareName(){return An}get playerSoftwareVersion(){return Dn}get _hls(){var l;return(l=this.__core)==null?void 0:l.engine}get mux(){return this.nativeEl.mux}get src(){return this.getAttribute("src")}set src(l){l!==this.src&&(l==null?this.removeAttribute("src"):this.setAttribute("src",l))}get preload(){let l=this.getAttribute("preload");return l===""?"auto":["none","metadata","auto"].includes(l)?l:super.preload}set preload(l){l!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(l)?this.setAttribute("preload",l):this.removeAttribute("preload"))}get debug(){return this.getAttribute(De.DEBUG)!=null}set debug(l){l!==this.debug&&(l?this.setAttribute(De.DEBUG,""):this.removeAttribute(De.DEBUG))}get disableCookies(){return this.hasAttribute(De.DISABLE_COOKIES)}set disableCookies(l){l!==this.disableCookies&&(l?this.setAttribute(De.DISABLE_COOKIES,""):this.removeAttribute(De.DISABLE_COOKIES))}get startTime(){let l=this.getAttribute(De.START_TIME);if(l==null)return;let P=+l;return Number.isNaN(P)?void 0:P}set startTime(l){l!==this.startTime&&(l==null?this.removeAttribute(De.START_TIME):this.setAttribute(De.START_TIME,`${l}`))}get playbackId(){var l;return(l=this.getAttribute(De.PLAYBACK_ID))!=null?l:void 0}set playbackId(l){l!==this.playbackId&&(l?this.setAttribute(De.PLAYBACK_ID,l):this.removeAttribute(De.PLAYBACK_ID))}get envKey(){var l;return(l=this.getAttribute(De.ENV_KEY))!=null?l:void 0}set envKey(l){l!==this.envKey&&(l?this.setAttribute(De.ENV_KEY,l):this.removeAttribute(De.ENV_KEY))}get beaconCollectionDomain(){var l;return(l=this.getAttribute(De.BEACON_COLLECTION_DOMAIN))!=null?l:void 0}set beaconCollectionDomain(l){l!==this.beaconCollectionDomain&&(l?this.setAttribute(De.BEACON_COLLECTION_DOMAIN,l):this.removeAttribute(De.BEACON_COLLECTION_DOMAIN))}get streamType(){var l;return(l=this.getAttribute(De.STREAM_TYPE))!=null?l:void 0}set streamType(l){l!==this.streamType&&(l?this.setAttribute(De.STREAM_TYPE,l):this.removeAttribute(De.STREAM_TYPE))}get preferPlayback(){let l=this.getAttribute(De.PREFER_PLAYBACK);if(l===xt.MSE||l===xt.NATIVE)return l}set preferPlayback(l){l!==this.preferPlayback&&(l===xt.MSE||l===xt.NATIVE?this.setAttribute(De.PREFER_PLAYBACK,l):this.removeAttribute(De.PREFER_PLAYBACK))}get metadata(){return this.__metadata}set metadata(l){this.__metadata=l!=null?l:{},this.mux&&(console.info("Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src."),this.mux.emit("hb",this.__metadata))}load(){this.__core=ri(this,this.nativeEl,this.__core)}unload(){Rr(this.nativeEl,this.__core),this.__core=void 0}attributeChangedCallback(l,P,L){var A,M;switch(super.attributeChangedCallback(l,P,L),l){case"src":{let O=!!P,b=!!L;!O&&b?this.load():O&&!b?this.unload():O&&b&&(this.unload(),this.load());break}case"autoplay":if(L===P)break;(A=this.__core)==null||A.setAutoplay(this.autoplay);break;case"preload":if(L===P)break;(M=this.__core)==null||M.setPreload(L);break;case De.PLAYBACK_ID:this.src=ti(L!=null?L:void 0);break;case De.DEBUG:{let O=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=O);break}case De.METADATA_URL:L&&fetch(L).then(O=>O.json()).then(O=>this.metadata=O).catch(O=>console.error(`Unable to load or parse metadata JSON from metadata-url ${L}!`));break;default:break}}disconnectedCallback(){this.unload()}};ht.customElements.get("mux-audio")||(ht.customElements.define("mux-audio",Vt),ht.MuxAudioElement=Vt);var Wn=Vt;})();
53
+ `;var $t,wt,dr,bt=class extends mt.HTMLElement{constructor(){super();lt(this,wt);lt(this,$t,void 0);this.attachShadow({mode:"open"}),this.isConnected&&At(this,wt,dr).call(this)}static get observedAttributes(){let l=[];Object.getOwnPropertyNames(this.prototype).forEach(L=>{let A=!1;try{typeof this.prototype[L]=="function"&&(A=!0)}catch{}!A&&L!==L.toUpperCase()&&l.push(L.toLowerCase())});let P=Object.getPrototypeOf(this).observedAttributes;return P&&(l=l.concat(P)),l}attributeChangedCallback(l,P,L){At(this,wt,dr).call(this),this.forwardAttribute(l,P,L)}forwardAttribute(l,P,L){let A=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),M=On(A,l),O=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;M&&!O?typeof this[M]=="boolean"?L===null?this[M]=!1:this[M]=!0:this[M]=L:L===null?this.nativeEl.removeAttribute(l):["id","class"].indexOf(l)===-1&&this.nativeEl.setAttribute(l,L)}connectedCallback(){At(this,wt,dr).call(this)}};$t=new WeakMap,wt=new WeakSet,dr=function(){if(ze(this,$t))return;ut(this,$t,!0),this.shadowRoot.append(gi.content.cloneNode(!0));let l=this.nativeEl=this.shadowRoot.querySelector("audio");vi.forEach(L=>{l.addEventListener(L,A=>{this.dispatchEvent(new CustomEvent(A.type,{detail:A.detail}))})});let P=this.shadowRoot.querySelector("slot");P.addEventListener("slotchange",()=>{P.assignedElements().forEach(L=>{!["track","source"].includes(L.localName)||l.append(L)})}),Array.from(this.attributes).forEach(L=>{this.forwardAttribute(L.name,null,L.value)}),l.defaultMuted&&(l.muted=!0)};var mi=[],pi=_r.createElement("audio"),bn=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let j=Object.getPrototypeOf(pi);j&&j!==mt.HTMLElement.prototype;j=Object.getPrototypeOf(j))Object.keys(j).forEach(R=>{bn.indexOf(R)===-1&&mi.push(R)});mi.forEach(j=>{if(typeof pi[j]=="function")bt.prototype[j]=function(){return this.nativeEl[j].apply(this.nativeEl,arguments)};else{let l={get(){return this.nativeEl[j]}};j!==j.toUpperCase()&&(l.set=function(P){this.nativeEl[j]=P}),Object.defineProperty(bt.prototype,j,l)}});function On(j,R){let l=null;return j.forEach(P=>{P.toLowerCase()==R.toLowerCase()&&(l=P)}),l}mt.customElements.get("custom-audio")||(mt.customElements.define("custom-audio",bt),mt.CustomAudioElement=bt);var wr=bt;var De={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},Rn=Object.values(De),In=hi(),Pn="mux-audio",pt,kt,Zt,Bt,qt,kr,Jt=class extends wr{constructor(){super();lt(this,qt);lt(this,pt,void 0);lt(this,kt,void 0);lt(this,Zt,void 0);lt(this,Bt,{});ut(this,Zt,si())}static get observedAttributes(){var l;return[...Rn,...(l=wr.observedAttributes)!=null?l:[]]}get playerInitTime(){return ze(this,Zt)}get playerSoftwareName(){return Pn}get playerSoftwareVersion(){return In}get _hls(){var l;return(l=ze(this,pt))==null?void 0:l.engine}get mux(){return this.nativeEl.mux}get src(){return this.getAttribute("src")}set src(l){l!==this.src&&(l==null?this.removeAttribute("src"):this.setAttribute("src",l))}get preload(){let l=this.getAttribute("preload");return l===""?"auto":["none","metadata","auto"].includes(l)?l:super.preload}set preload(l){l!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(l)?this.setAttribute("preload",l):this.removeAttribute("preload"))}get debug(){return this.getAttribute(De.DEBUG)!=null}set debug(l){l!==this.debug&&(l?this.setAttribute(De.DEBUG,""):this.removeAttribute(De.DEBUG))}get disableCookies(){return this.hasAttribute(De.DISABLE_COOKIES)}set disableCookies(l){l!==this.disableCookies&&(l?this.setAttribute(De.DISABLE_COOKIES,""):this.removeAttribute(De.DISABLE_COOKIES))}get startTime(){let l=this.getAttribute(De.START_TIME);if(l==null)return;let P=+l;return Number.isNaN(P)?void 0:P}set startTime(l){l!==this.startTime&&(l==null?this.removeAttribute(De.START_TIME):this.setAttribute(De.START_TIME,`${l}`))}get playbackId(){var l;return(l=this.getAttribute(De.PLAYBACK_ID))!=null?l:void 0}set playbackId(l){l!==this.playbackId&&(l?this.setAttribute(De.PLAYBACK_ID,l):this.removeAttribute(De.PLAYBACK_ID))}get envKey(){var l;return(l=this.getAttribute(De.ENV_KEY))!=null?l:void 0}set envKey(l){l!==this.envKey&&(l?this.setAttribute(De.ENV_KEY,l):this.removeAttribute(De.ENV_KEY))}get beaconCollectionDomain(){var l;return(l=this.getAttribute(De.BEACON_COLLECTION_DOMAIN))!=null?l:void 0}set beaconCollectionDomain(l){l!==this.beaconCollectionDomain&&(l?this.setAttribute(De.BEACON_COLLECTION_DOMAIN,l):this.removeAttribute(De.BEACON_COLLECTION_DOMAIN))}get streamType(){var l;return(l=this.getAttribute(De.STREAM_TYPE))!=null?l:void 0}set streamType(l){l!==this.streamType&&(l?this.setAttribute(De.STREAM_TYPE,l):this.removeAttribute(De.STREAM_TYPE))}get preferPlayback(){let l=this.getAttribute(De.PREFER_PLAYBACK);if(l===_t.MSE||l===_t.NATIVE)return l}set preferPlayback(l){l!==this.preferPlayback&&(l===_t.MSE||l===_t.NATIVE?this.setAttribute(De.PREFER_PLAYBACK,l):this.removeAttribute(De.PREFER_PLAYBACK))}get metadata(){return ze(this,Bt)}set metadata(l){ut(this,Bt,l!=null?l:{}),this.mux&&(console.info("Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src."),this.mux.emit("hb",ze(this,Bt)))}load(){ut(this,pt,li(this,this.nativeEl,ze(this,pt)))}unload(){Fr(this.nativeEl,ze(this,pt)),ut(this,pt,void 0)}attributeChangedCallback(l,P,L){var A,M;switch(super.attributeChangedCallback(l,P,L),l){case"src":{let O=!!P,b=!!L;!O&&b?At(this,qt,kr).call(this):O&&!b?this.unload():O&&b&&(this.unload(),At(this,qt,kr).call(this));break}case"autoplay":if(L===P)break;(A=ze(this,pt))==null||A.setAutoplay(this.autoplay);break;case"preload":if(L===P)break;(M=ze(this,pt))==null||M.setPreload(L);break;case De.PLAYBACK_ID:this.src=oi(L!=null?L:void 0);break;case De.DEBUG:{let O=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=O);break}case De.METADATA_URL:L&&fetch(L).then(O=>O.json()).then(O=>this.metadata=O).catch(O=>console.error(`Unable to load or parse metadata JSON from metadata-url ${L}!`));break;default:break}}disconnectedCallback(){this.unload()}};pt=new WeakMap,kt=new WeakMap,Zt=new WeakMap,Bt=new WeakMap,qt=new WeakSet,kr=async function(){ze(this,kt)||(await ut(this,kt,Promise.resolve()),ut(this,kt,null),this.load())};mt.customElements.get("mux-audio")||(mt.customElements.define("mux-audio",Jt),mt.MuxAudioElement=Jt);var $n=Jt;})();
54
54
  /*!
55
55
  * JavaScript Cookie v2.1.3
56
56
  * https://github.com/js-cookie/js-cookie