@mux/mux-player 1.7.2 → 1.8.0

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.
@@ -1,35 +1,35 @@
1
- "use strict";(()=>{var _m=Object.create;var nc=Object.defineProperty;var Am=Object.getOwnPropertyDescriptor;var Sm=Object.getOwnPropertyNames;var km=Object.getPrototypeOf,wm=Object.prototype.hasOwnProperty;var sc=(a,t)=>()=>(t||a((t={exports:{}}).exports,t),t.exports);var Im=(a,t,i,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let v of Sm(t))!wm.call(a,v)&&v!==i&&nc(a,v,{get:()=>t[v],enumerable:!(d=Am(t,v))||d.enumerable});return a};var oc=(a,t,i)=>(i=a!=null?_m(km(a)):{},Im(t||!a||!a.__esModule?nc(i,"default",{value:a,enumerable:!0}):i,a));var jl=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)};var Nt=(a,t,i)=>(jl(a,t,"read from private field"),i?i.call(a):t.get(a)),lr=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},$r=(a,t,i,d)=>(jl(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i);var _r=(a,t,i)=>(jl(a,t,"access private method"),i);var Fh=sc((Ko,dd)=>{(function(){var a,t;a=this,t=function(){return function(){var i={80:function(g,b,L){g.exports=L(728).default},728:function(g,b,L){"use strict";L.d(b,{default:function(){return Cl}});var M=L(48),R=L.n(M),y=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(A){var E=16*Math.random()|0;return(A==="x"?E:3&E|8).toString(16)})},P=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},O=function(A){return A&&A.nodeName!==void 0?(A.muxId||(A.muxId=A.id||P()),A.muxId):A},ue=function(A){var E;A&&A.nodeName!==void 0?A=O(E=A):E=document.querySelector(A);var T=E&&E.nodeName?E.nodeName.toLowerCase():"";return[E,A,T]},Q=L(640),de=L.n(Q),he=de().methodFactory;de().methodFactory=function(A,E,T){var k=he(A,E,T);return function(){for(var D=["[mux]"],V=0;V<arguments.length;V++)D.push(arguments[V]);k.apply(void 0,D)}},de().setLevel(de().getLevel());var Y=de();function pe(){return(R().doNotTrack||R().navigator&&R().navigator.doNotTrack)==="1"}var X={now:function(){var A=R().performance,E=A&&A.timing,T=E&&E.navigationStart,k=typeof T=="number"&&typeof A.now=="function"?T+A.now():Date.now();return Math.round(k)}},oe=L(678),z=L.n(oe),be=function(A){return ke(A)[0]},ke=function(A){if(typeof A!="string"||A==="")return["localhost"];var E,T=(A.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return T&&(E=(T.match(/[^\.]+\.[^\.]+$/)||[])[0]),[T,E]},He={exists:function(){var A=R().performance;return(A&&A.timing)!==void 0},domContentLoadedEventEnd:function(){var A=R().performance,E=A&&A.timing;return E&&E.domContentLoadedEventEnd},navigationStart:function(){var A=R().performance,E=A&&A.timing;return E&&E.navigationStart}};function Z(A,E,T){T=T===void 0?1:T,A[E]=A[E]||0,A[E]+=T}var w=["x-cdn","content-type","x-request-id"];function q(A){var E={};return(A=A||"").trim().split(/[\r\n]+/).forEach(function(T){if(T){var k=T.split(": "),D=k.shift();D&&(w.indexOf(D.toLowerCase())>=0||D.toLowerCase().indexOf("x-litix-")===0)&&(E[D]=k.join(": "))}}),E}var N=function(A){var E={};for(var T in A){var k=A[T];k["DATA-ID"].search("io.litix.data.")!==-1&&(E[k["DATA-ID"].replace("io.litix.data.","")]=k.VALUE)}return E};function fe(A,E){var T=Object.keys(A);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(A);E&&(k=k.filter(function(D){return Object.getOwnPropertyDescriptor(A,D).enumerable})),T.push.apply(T,k)}return T}function _e(A){for(var E=1;E<arguments.length;E++){var T=arguments[E]!=null?arguments[E]:{};E%2?fe(Object(T),!0).forEach(function(k){te(A,k,T[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(T)):fe(Object(T)).forEach(function(k){Object.defineProperty(A,k,Object.getOwnPropertyDescriptor(T,k))})}return A}function te(A,E,T){return E in A?Object.defineProperty(A,E,{value:T,enumerable:!0,configurable:!0,writable:!0}):A[E]=T,A}var re=function(A){if(!A)return{};var E=He.navigationStart(),T=A.loading,k=T?T.start:A.trequest,D=T?T.first:A.tfirst,V=T?T.end:A.tload;return{bytesLoaded:A.total,requestStart:Math.round(E+k),responseStart:Math.round(E+D),responseEnd:Math.round(E+V)}},Re=function(A){if(A&&typeof A.getAllResponseHeaders=="function")return q(A.getAllResponseHeaders())};function Pe(A,E){var T=Object.keys(A);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(A);E&&(k=k.filter(function(D){return Object.getOwnPropertyDescriptor(A,D).enumerable})),T.push.apply(T,k)}return T}function Fe(A){for(var E=1;E<arguments.length;E++){var T=arguments[E]!=null?arguments[E]:{};E%2?Pe(Object(T),!0).forEach(function(k){Se(A,k,T[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(T)):Pe(Object(T)).forEach(function(k){Object.defineProperty(A,k,Object.getOwnPropertyDescriptor(T,k))})}return A}function Se(A,E,T){return E in A?Object.defineProperty(A,E,{value:T,enumerable:!0,configurable:!0,writable:!0}):A[E]=T,A}var Ye=function(A,E){if(!A||typeof A.getRequests!="function")return{};var T=A.getRequests({state:"executed"});if(T.length===0)return{};var k,D=T[T.length-1],V=be(D.url),B=D.url,J=D.bytesLoaded,ge=new Date(D.requestStartDate).getTime(),ne=new Date(D.firstByteDate).getTime(),Be=new Date(D.requestEndDate).getTime(),mt=isNaN(D.duration)?0:D.duration,nt=typeof E.getMetricsFor=="function"?E.getMetricsFor(D.mediaType).HttpList:E.getDashMetrics().getHttpRequests(D.mediaType);return nt.length>0&&(k=q(nt[nt.length-1]._responseHeaders||"")),{requestStart:ge,requestResponseStart:ne,requestResponseEnd:Be,requestBytesLoaded:J,requestResponseHeaders:k,requestMediaDuration:mt,requestHostname:V,requestUrl:B}},ot=function(A,E){var T=E.getQualityFor(A),k=E.getCurrentTrackFor(A).bitrateList;return k?{currentLevel:T,renditionWidth:k[T].width||null,renditionHeight:k[T].height||null,renditionBitrate:k[T].bandwidth}:{}},le=function(A){var E;return(E=A.match(/.*codecs\*?="(.*)"/))===null||E===void 0?void 0:E[1]};function Ee(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var U=0,ve=function(){function A(){(function(D,V){if(!(D instanceof V))throw new TypeError("Cannot call a class as a function")})(this,A)}var E,T,k;return E=A,T=[{key:"on",value:function(D,V,B){return V._eventEmitterGuid=V._eventEmitterGuid||++U,this._listeners=this._listeners||{},this._listeners[D]=this._listeners[D]||[],B&&(V=V.bind(B)),this._listeners[D].push(V),V}},{key:"off",value:function(D,V){var B=this._listeners&&this._listeners[D];B&&B.forEach(function(J,ge){J._eventEmitterGuid===V._eventEmitterGuid&&B.splice(ge,1)})}},{key:"one",value:function(D,V,B){var J=this;V._eventEmitterGuid=V._eventEmitterGuid||++U;var ge=function ne(){J.off(D,ne),V.apply(B||this,arguments)};ge._eventEmitterGuid=V._eventEmitterGuid,this.on(D,ge)}},{key:"emit",value:function(D,V){var B=this;if(this._listeners){V=V||{};var J=this._listeners["before*"]||[],ge=this._listeners[D]||[],ne=this._listeners["after"+D]||[],Be=function(mt,nt){(mt=mt.slice()).forEach(function(ht){ht.call(B,{type:D},nt)})};Be(J,V),Be(ge,V),Be(ne,V)}}}],T&&Ee(E.prototype,T),k&&Ee(E,k),Object.defineProperty(E,"prototype",{writable:!1}),A}(),Le=ve;function Ne(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var Ue=function(){function A(D){var V=this;(function(B,J){if(!(B instanceof J))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,D.on("playing",function(){V._playheadShouldBeProgressing=!0}),D.on("play",this._startPlaybackHeartbeatInterval.bind(this)),D.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),D.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),D.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),D.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),D.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),D.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),D.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),D.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),D.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("seeked",function(){D.data.player_is_paused?V._stopPlaybackHeartbeatInterval():V._startPlaybackHeartbeatInterval()}),D.on("timeupdate",function(){V._playbackHeartbeatInterval!==null&&D.emit("playbackheartbeat")}),D.on("devicesleep",function(B,J){V._playbackHeartbeatInterval!==null&&(R().clearInterval(V._playbackHeartbeatInterval),D.emit("playbackheartbeatend",{viewer_time:J.viewer_time}),V._playbackHeartbeatInterval=null)})}var E,T,k;return E=A,(T=[{key:"_startPlaybackHeartbeatInterval",value:function(){var D=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=R().setInterval(function(){D.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(R().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&Ne(E.prototype,T),k&&Ne(E,k),Object.defineProperty(E,"prototype",{writable:!1}),A}();function Ge(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Te(A,E,T){return E&&Ge(A.prototype,E),T&&Ge(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var xe=Te(function A(E){var T=this;(function(k,D){if(!(k instanceof D))throw new TypeError("Cannot call a class as a function")})(this,A),E.on("viewinit",function(){T.viewErrored=!1}),E.on("error",function(k,D){try{var V=E.errorTranslator({player_error_code:D.player_error_code,player_error_message:D.player_error_message,player_error_context:D.player_error_context});V?(E.data.player_error_code=V.player_error_code||D.player_error_code,E.data.player_error_message=V.player_error_message||D.player_error_message,E.data.player_error_context=V.player_error_context||D.player_error_context,T.viewErrored=!0):(delete E.data.player_error_code,delete E.data.player_error_message,delete E.data.player_error_context)}catch(B){E.mux.log.warn("Exception in error translator callback.",B),T.viewErrored=!0}})});function $e(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var rt=function(){function A(D){(function(V,B){if(!(V instanceof B))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,this._watchTimeTrackerLastCheckedTime=null,D.on("playbackheartbeat",this._updateWatchTime.bind(this)),D.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var E,T,k;return E=A,(T=[{key:"_updateWatchTime",value:function(D,V){var B=V.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=B),Z(this.pm.data,"view_watch_time",B-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=B}},{key:"_clearWatchTimeState",value:function(D,V){this._updateWatchTime(D,V),this._watchTimeTrackerLastCheckedTime=null}}])&&$e(E.prototype,T),k&&$e(E,k),Object.defineProperty(E,"prototype",{writable:!1}),A}();function _t(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var gt=function(){function A(D){(function(V,B){if(!(V instanceof B))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,this._playbackTimeTrackerLastPlayheadPosition=-1,D.on("playbackheartbeat",this._updatePlaybackTime.bind(this)),D.on("playbackheartbeatend",this._clearPlaybackTimeState.bind(this)),D.on("seeking",this._clearPlaybackTimeState.bind(this))}var E,T,k;return E=A,(T=[{key:"_updatePlaybackTime",value:function(){var D=this.pm.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&D>this._playbackTimeTrackerLastPlayheadPosition){var V=D-this._playbackTimeTrackerLastPlayheadPosition;V<=1e3&&Z(this.pm.data,"view_content_playback_time",V)}this._playbackTimeTrackerLastPlayheadPosition=D}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&_t(E.prototype,T),k&&_t(E,k),Object.defineProperty(E,"prototype",{writable:!1}),A}();function Lt(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var lt=function(){function A(D){(function(B,J){if(!(B instanceof J))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D;var V=this._updatePlayheadTime.bind(this);D.on("playbackheartbeat",V),D.on("playbackheartbeatend",V),D.on("timeupdate",V),D.on("destroy",function(){D.off("timeupdate",V)})}var E,T,k;return E=A,(T=[{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(D,V){var B=this,J=function(){B.pm.currentFragmentPDT&&B.pm.currentFragmentStart&&(B.pm.data.player_program_time=B.pm.currentFragmentPDT+B.pm.data.player_playhead_time-B.pm.currentFragmentStart)};if(V&&V.player_playhead_time)this.pm.data.player_playhead_time=V.player_playhead_time,J(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var ge=this.pm.getPlayheadTime();ge!==void 0&&(this.pm.data.player_playhead_time=ge,J(),this._updateMaxPlayheadPosition())}}}])&&Lt(E.prototype,T),k&&Lt(E,k),Object.defineProperty(E,"prototype",{writable:!1}),A}();function wt(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Rt(A,E,T){return E&&wt(A.prototype,E),T&&wt(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var At=Rt(function A(E){if(function(V,B){if(!(V instanceof B))throw new TypeError("Cannot call a class as a function")}(this,A),!E.disableRebufferTracking){var T,k=function(V,B){D(B),T=void 0},D=function(V){if(T){var B=V.viewer_time-T;Z(E.data,"view_rebuffer_duration",B),T=V.viewer_time}E.data.view_watch_time>=0&&E.data.view_rebuffer_count>0&&(E.data.view_rebuffer_frequency=E.data.view_rebuffer_count/E.data.view_watch_time,E.data.view_rebuffer_percentage=E.data.view_rebuffer_duration/E.data.view_watch_time)};E.on("playbackheartbeat",function(V,B){return D(B)}),E.on("rebufferstart",function(V,B){T||(Z(E.data,"view_rebuffer_count",1),T=B.viewer_time,E.one("rebufferend",k))}),E.on("viewinit",function(){T=void 0,E.off("rebufferend",k)})}});function pt(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var Ut=function(){function A(D){var V=this;(function(B,J){if(!(B instanceof J))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,D.disableRebufferTracking||D.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,D.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),D.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),D.on("seeking",function(){V._cleanupRebufferTracker(null,{viewer_time:X.now()})}))}var E,T,k;return E=A,T=[{key:"_checkIfRebuffering",value:function(D,V){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(D,V);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var B=V.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&B>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=V.viewer_time}else this._cleanupRebufferTracker(D,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(D){this._lastCheckedTime=D,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=D}},{key:"_cleanupRebufferTracker",value:function(D,V){var B=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 J=this.pm.data.player_playhead_time-this._lastPlayheadTime,ge=V.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&J>0&&ge-J>this.pm.minimumRebufferDuration&&(this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+ge-J}))}B?this._prepareRebufferTrackerState(V.viewer_time):this._clearRebufferTrackerState()}}],T&&pt(E.prototype,T),k&&pt(E,k),Object.defineProperty(E,"prototype",{writable:!1}),A}(),Vt=Ut;function ir(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var vr=function(){function A(D){var V=this;(function(B,J){if(!(B instanceof J))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,D.on("viewinit",function(){var B=D.data,J=B.view_id;if(!B.view_program_changed){var ge=function(ne,Be){var mt=Be.viewer_time;ne.type==="playing"&&D.data.view_time_to_first_frame===void 0?V.calculateTimeToFirstFrame(mt||X.now(),J):ne.type!=="adplaying"||D.data.view_time_to_first_frame!==void 0&&!V._inPrerollPosition()||V.calculateTimeToFirstFrame(mt||X.now(),J)};D.one("playing",ge),D.one("adplaying",ge),D.one("viewend",function(){D.off("playing",ge),D.off("adplaying",ge)})}})}var E,T,k;return E=A,(T=[{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(D,V){V===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:D}),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))}}])&&ir(E.prototype,T),k&&ir(E,k),Object.defineProperty(E,"prototype",{writable:!1}),A}();function Qt(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Fr(A,E,T){return E&&Qt(A.prototype,E),T&&Qt(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var se=Fr(function A(E){var T=this;(function(k,D){if(!(k instanceof D))throw new TypeError("Cannot call a class as a function")})(this,A),E.on("viewinit",function(){T._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(k){E.on(k,function(){if(T._lastPlayheadPosition>=0&&E.data.player_playhead_time>=0&&T._lastPlayerWidth>=0&&T._lastSourceWidth>0&&T._lastPlayerHeight>=0&&T._lastSourceHeight>0){var D=E.data.player_playhead_time-T._lastPlayheadPosition;if(D<0)return void(T._lastPlayheadPosition=-1);var V=Math.min(T._lastPlayerWidth/T._lastSourceWidth,T._lastPlayerHeight/T._lastSourceHeight),B=Math.max(0,V-1),J=Math.max(0,1-V);E.data.view_max_upscale_percentage=Math.max(E.data.view_max_upscale_percentage||0,B),E.data.view_max_downscale_percentage=Math.max(E.data.view_max_downscale_percentage||0,J),Z(E.data,"view_total_content_playback_time",D),Z(E.data,"view_total_upscaling",B*D),Z(E.data,"view_total_downscaling",J*D)}T._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(k){E.on(k,function(){T._lastPlayheadPosition=E.data.player_playhead_time,T._lastPlayerWidth=E.data.player_width,T._lastPlayerHeight=E.data.player_height,T._lastSourceWidth=E.data.video_source_width,T._lastSourceHeight=E.data.video_source_height})})});function j(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function I(A,E,T){return E&&j(A.prototype,E),T&&j(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var G=I(function A(E){var T=this;(function(k,D){if(!(k instanceof D))throw new TypeError("Cannot call a class as a function")})(this,A),this.isSeeking=!1,E.on("seeking",function(k,D){z()(E.data,D),T._lastSeekingTime=X.now(),T.isSeeking===!1&&(T.isSeeking=!0,E.send("seeking"))}),E.on("seeked",function(){T.isSeeking=!1;var k=T._lastSeekingTime||X.now(),D=X.now()-k;Z(E.data,"view_seek_count",1),Z(E.data,"view_seek_duration",D);var V=E.data.view_max_seek_time||0;E.data.view_max_seek_time=Math.max(V,D)}),E.on("viewend",function(){T.isSeeking=!1})});function H(A,E){return function(T){if(Array.isArray(T))return T}(A)||function(T,k){var D=T==null?null:typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(D!=null){var V,B,J=[],ge=!0,ne=!1;try{for(D=D.call(T);!(ge=(V=D.next()).done)&&(J.push(V.value),!k||J.length!==k);ge=!0);}catch(Be){ne=!0,B=Be}finally{try{ge||D.return==null||D.return()}finally{if(ne)throw B}}return J}}(A,E)||function(T,k){if(T){if(typeof T=="string")return $(T,k);var D=Object.prototype.toString.call(T).slice(8,-1);return D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set"?Array.from(T):D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)?$(T,k):void 0}}(A,E)||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 $(A,E){(E==null||E>A.length)&&(E=A.length);for(var T=0,k=new Array(E);T<E;T++)k[T]=A[T];return k}function ie(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var ae=function(A,E){A.push(E),A.sort(function(T,k){return T.viewer_time-k.viewer_time})},Ae=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Ce=function(){function A(D){var V=this;(function(J,ge){if(!(J instanceof ge))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,D.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}),Ae.forEach(function(J){return D.on(J,V._updateAdData.bind(V))});var B=function(){V.isAdBreak=!1};D.on("adbreakstart",function(){V.isAdBreak=!0}),D.on("play",B),D.on("playing",B),D.on("viewend",B),D.on("adrequest",function(J,ge){ge=z()({ad_request_id:"generatedAdRequestId"+V._currentAdRequestNumber++},ge),ae(V._adRequests,ge),Z(D.data,"view_ad_request_count"),V.inPrerollPosition()&&(D.data.view_preroll_requested=!0,V._adHasPlayed||Z(D.data,"view_preroll_request_count"))}),D.on("adresponse",function(J,ge){ge=z()({ad_request_id:"generatedAdRequestId"+V._currentAdResponseNumber++},ge),ae(V._adResponses,ge);var ne=V.findAdRequest(ge.ad_request_id);ne&&Z(D.data,"view_ad_request_time",Math.max(0,ge.viewer_time-ne.viewer_time))}),D.on("adplay",function(J,ge){V._adHasPlayed=!0,V._wouldBeNewAdPlay&&(V._wouldBeNewAdPlay=!1,Z(D.data,"view_ad_played_count")),V.inPrerollPosition()&&!D.data.view_preroll_played&&(D.data.view_preroll_played=!0,V._adRequests.length>0&&(D.data.view_preroll_request_time=Math.max(0,ge.viewer_time-V._adRequests[0].viewer_time)),D.data.view_start&&(D.data.view_startup_preroll_request_time=Math.max(0,ge.viewer_time-D.data.view_start)),V._prerollPlayTime=ge.viewer_time)}),D.on("adplaying",function(J,ge){V.inPrerollPosition()&&D.data.view_preroll_load_time===void 0&&V._prerollPlayTime!==void 0&&(D.data.view_preroll_load_time=ge.viewer_time-V._prerollPlayTime,D.data.view_startup_preroll_load_time=ge.viewer_time-V._prerollPlayTime)}),D.on("adended",function(){V._wouldBeNewAdPlay=!0}),D.on("aderror",function(){V._wouldBeNewAdPlay=!0})}var E,T,k;return E=A,(T=[{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(D){for(var V=0;V<this._adRequests.length;V++)if(this._adRequests[V].ad_request_id===D)return this._adRequests[V]}},{key:"_updateAdData",value:function(D,V){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&V.ad_tag_url){var B=H(ke(V.ad_tag_url),2),J=B[0],ge=B[1];this.pm.data.view_preroll_ad_tag_domain=ge,this.pm.data.view_preroll_ad_tag_hostname=J}if(!this.pm.data.view_preroll_ad_asset_hostname&&V.ad_asset_url){var ne=H(ke(V.ad_asset_url),2),Be=ne[0],mt=ne[1];this.pm.data.view_preroll_ad_asset_domain=mt,this.pm.data.view_preroll_ad_asset_hostname=Be}}}}])&&ie(E.prototype,T),k&&ie(E,k),Object.defineProperty(E,"prototype",{writable:!1}),A}();function Oe(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Ke(A,E,T){return E&&Oe(A.prototype,E),T&&Oe(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var Qe=Ke(function A(E){var T,k;(function(J,ge){if(!(J instanceof ge))throw new TypeError("Cannot call a class as a function")})(this,A);var D=function(){E.disableRebufferTracking||T&&(Z(E.data,"view_waiting_rebuffer_duration",X.now()-T),T=!1,R().clearInterval(k))},V=!1,B=function(){V=!1,D()};E.on("waiting",function(){V&&(E.disableRebufferTracking||(Z(E.data,"view_waiting_rebuffer_count",1),T=X.now(),k=R().setInterval(function(){if(T){var J=X.now();Z(E.data,"view_waiting_rebuffer_duration",J-T),T=J}},250)))}),E.on("playing",function(){D(),V=!0}),E.on("pause",B),E.on("seeking",B)});function We(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function at(A,E,T){return E&&We(A.prototype,E),T&&We(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var Et=at(function A(E){var T=this;(function(V,B){if(!(V instanceof B))throw new TypeError("Cannot call a class as a function")})(this,A);var k=function(){T.lastWallClockTime=X.now(),E.on("before*",D)},D=function(V){var B=X.now(),J=T.lastWallClockTime;T.lastWallClockTime=B,B-J>3e4&&(E.emit("devicesleep",{viewer_time:J}),z()(E.data,{viewer_time:J}),E.send("devicesleep"),E.emit("devicewake",{viewer_time:B}),z()(E.data,{viewer_time:B}),E.send("devicewake"))};E.one("playbackheartbeat",k),E.on("playbackheartbeatend",function(){E.off("before*",D),E.one("playbackheartbeat",k)})}),Ot=L(375),Ze=L(655),Ht=L.n(Ze),gr="muxData",Yt=function(){var A;try{A=Ot.parse(Ht().get(gr)||"")}catch{A={}}return A},jt=function(A){try{Ht().set(gr,Ot.stringify(A),{expires:7300})}catch{}},Xt=function(){var A=Yt();return A.mux_viewer_id=A.mux_viewer_id||y(),A.msn=A.msn||Math.random(),jt(A),{mux_viewer_id:A.mux_viewer_id,mux_sample_number:A.msn}};function ut(A,E){var T=E.beaconCollectionDomain,k=E.beaconDomain;if(T)return"https://"+T;var D=k||"litix.io";return(A=A||"inferred").match(/^[a-z0-9]+$/)?"https://"+A+"."+D:"https://img.litix.io/a.gif"}var Lr=function(){var A;switch(ti()){case"cellular":A="cellular";break;case"ethernet":A="wired";break;case"wifi":A="wifi";break;case void 0:break;default:A="other"}return A},ti=function(){var A=R().navigator,E=A&&(A.connection||A.mozConnection||A.webkitConnection);return E&&E.type};Lr.getConnectionFromAPI=ti;var zt=Lr,dr=gi({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"}),Vr=gi({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",cc:"codec",cd:"code",cg:"category",ch:"changed",cn:"config",co:"count",ce:"counter",cp:"complete",cr:"creative",ct:"content",cu:"current",cx:"connection",cz:"context",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",dr:"drm",dp:"dropped",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",un:"universal",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 gi(A){var E={};for(var T in A)A.hasOwnProperty(T)&&(E[A[T]]=T);return E}function Br(A){var E={},T={};return Object.keys(A).forEach(function(k){var D=!1;if(A.hasOwnProperty(k)&&A[k]!==void 0){var V=k.split("_"),B=V[0],J=dr[B];J||(Y.info("Data key word `"+V[0]+"` not expected in "+k),J=B+"_"),V.splice(1).forEach(function(ge){ge==="url"&&(D=!0),Vr[ge]?J+=Vr[ge]:Number(ge)&&Math.floor(Number(ge))===Number(ge)?J+=ge:(Y.info("Data key word `"+ge+"` not expected in "+k),J+="_"+ge+"_")}),D?T[J]=A[k]:E[J]=A[k]}}),z()(E,T)}var $t={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},xn=["hb","requestcompleted","requestfailed","requestcanceled"],Gs="https://img.litix.io",ri=function(A){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=A||Gs,this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=z()({},$t,E)};ri.prototype.queueEvent=function(A,E){var T=z()({},E);return(this._eventQueue.length<=this._options.maxQueueLength||A==="eventrateexceeded")&&(this._eventQueue.push(T),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},ri.prototype.flushEvents=function(){var A=arguments.length>0&&arguments[0]!==void 0&&arguments[0];A&&this._eventQueue.length===1?this._eventQueue.pop():(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},ri.prototype.destroy=function(){var A=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,A?this._clearBeaconQueue():this.flushEvents(),R().clearTimeout(this._sendTimeout)},ri.prototype._clearBeaconQueue=function(){var A=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,E=this._eventQueue.slice(A);A>0&&z()(E[E.length-1],Br({mux_view_message:"event queue truncated"}));var T=this._createPayload(E);qa(this._beaconUrl,T,!0,function(){})},ri.prototype._sendBeaconQueue=function(){var A=this;if(!this._postInFlight){var E=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var T=this._createPayload(E),k=X.now();qa(this._beaconUrl,T,!1,function(D,V){V?(A._eventQueue=E.concat(A._eventQueue),A._failureCount+=1,Y.info("Error sending beacon: "+V)):A._failureCount=0,A._roundTripTime=X.now()-k,A._postInFlight=!1})}},ri.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var A=Math.pow(2,this._failureCount-1);return(1+(A*=Math.random()))*this._options.baseTimeBetweenBeacons},ri.prototype._startBeaconSending=function(){var A=this;R().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=R().setTimeout(function(){A._eventQueue.length&&A._sendBeaconQueue(),A._startBeaconSending()},this._getNextBeaconTime()))},ri.prototype._createPayload=function(A){var E,T,k,D=this,V={transmission_timestamp:Math.round(X.now())};this._roundTripTime&&(V.rtt_ms=Math.round(this._roundTripTime));var B=function(){E=JSON.stringify({metadata:V,events:T||A}),k=E.length/1024},J=function(){return k<=D._options.maxPayloadKBSize};return B(),J()||(Y.info("Payload size is too big ("+k+" kb). Removing unnecessary events."),T=A.filter(function(ge){return xn.indexOf(ge.e)===-1}),B()),J()||(Y.info("Payload size still too big ("+k+" kb). Cropping fields.."),T.forEach(function(ge){for(var ne in ge){var Be=ge[ne];typeof Be=="string"&&Be.length>51200&&(ge[ne]=Be.substring(0,51200))}}),B()),E};var qa=function(A,E,T,k){if(T&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(A,E))k();else if(R().fetch)R().fetch(A,{method:"POST",body:E,headers:{"Content-Type":"text/plain"},keepalive:!0}).then(function(V){return k(null,V.ok?null:"Error")}).catch(function(V){return k(null,V)});else{if(R().XMLHttpRequest){var D=new(R()).XMLHttpRequest;return D.onreadystatechange=function(){if(D.readyState===4)return k(null,D.status!==200?"error":void 0)},D.open("POST",A),D.setRequestHeader("Content-Type","text/plain"),void D.send(E)}k()}},Vs=ri;function Ws(A,E){return function(T){if(Array.isArray(T))return T}(A)||function(T,k){var D=T==null?null:typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(D!=null){var V,B,J=[],ge=!0,ne=!1;try{for(D=D.call(T);!(ge=(V=D.next()).done)&&(J.push(V.value),!k||J.length!==k);ge=!0);}catch(Be){ne=!0,B=Be}finally{try{ge||D.return==null||D.return()}finally{if(ne)throw B}}return J}}(A,E)||function(T,k){if(T){if(typeof T=="string")return Ya(T,k);var D=Object.prototype.toString.call(T).slice(8,-1);return D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set"?Array.from(T):D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)?Ya(T,k):void 0}}(A,E)||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 Ya(A,E){(E==null||E>A.length)&&(E=A.length);for(var T=0,k=new Array(E);T<E;T++)k[T]=A[T];return k}function $a(A,E){var T=Object.keys(A);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(A);E&&(k=k.filter(function(D){return Object.getOwnPropertyDescriptor(A,D).enumerable})),T.push.apply(T,k)}return T}function Ki(A){for(var E=1;E<arguments.length;E++){var T=arguments[E]!=null?arguments[E]:{};E%2?$a(Object(T),!0).forEach(function(k){Gi(A,k,T[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(T)):$a(Object(T)).forEach(function(k){Object.defineProperty(A,k,Object.getOwnPropertyDescriptor(T,k))})}return A}function pa(A){return pa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(E){return typeof E}:function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},pa(A)}function yl(A,E){if(!(A instanceof E))throw new TypeError("Cannot call a class as a function")}function js(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Gi(A,E,T){return E in A?Object.defineProperty(A,E,{value:T,enumerable:!0,configurable:!0,writable:!0}):A[E]=T,A}var Xr=["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"],Ct=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended"],qs=["viewstart","error","ended","viewend"],Vi=function(){function A(D,V){var B,J,ge,ne,Be,mt,nt,ht,Je,ft,Kt,Zt,Er,Dr,Dt,hr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};yl(this,A),Gi(this,"previousBeaconData",null),Gi(this,"lastEventTime",0),Gi(this,"rateLimited",!1),this.mux=D,this.envKey=V,this.options=hr,this.eventQueue=new Vs(ut(this.envKey,this.options)),this.sampleRate=(B=this.options.sampleRate)!==null&&B!==void 0?B:1,this.disableCookies=(J=this.options.disableCookies)!==null&&J!==void 0&&J,this.respectDoNotTrack=(ge=this.options.respectDoNotTrack)!==null&&ge!==void 0&&ge,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:(ne=this.options.platform)===null||ne===void 0?void 0:ne.name,viewer_application_version:(Be=this.options.platform)===null||Be===void 0?void 0:Be.version,viewer_application_engine:(mt=this.options.platform)===null||mt===void 0?void 0:mt.layout,viewer_device_name:(nt=this.options.platform)===null||nt===void 0?void 0:nt.product,viewer_device_category:"",viewer_device_manufacturer:(ht=this.options.platform)===null||ht===void 0?void 0:ht.manufacturer,viewer_os_family:(Je=this.options.platform)===null||Je===void 0||(ft=Je.os)===null||ft===void 0?void 0:ft.family,viewer_os_architecture:(Kt=this.options.platform)===null||Kt===void 0||(Zt=Kt.os)===null||Zt===void 0?void 0:Zt.architecture,viewer_os_version:(Er=this.options.platform)===null||Er===void 0||(Dr=Er.os)===null||Dr===void 0?void 0:Dr.version,viewer_connection_type:zt(),page_url:R()===null||R()===void 0||(Dt=R().location)===null||Dt===void 0?void 0:Dt.href},this.viewerData=this.disableCookies?{}:Xt()}var E,T,k;return E=A,(T=[{key:"send",value:function(D,V){var B;if(D){if(this.respectDoNotTrack&&pe())return Y.info("Not sending `"+D+"` because Do Not Track is enabled");if(!V||pa(V)!=="object")return Y.error("A data object was expected in send() but was not provided");var J,ge,ne=this.disableCookies?{}:(J=Yt(),ge=X.now(),J.session_start&&(J.sst=J.session_start,delete J.session_start),J.session_id&&(J.sid=J.session_id,delete J.session_id),J.session_expires&&(J.sex=J.session_expires,delete J.session_expires),(!J.sex||J.sex<ge)&&(J.sid=y(),J.sst=ge),J.sex=ge+15e5,jt(J),{session_id:J.sid,session_start:J.sst,session_expires:J.sex}),Be=Ki(Ki(Ki(Ki(Ki({},this.pageLevelData),V),ne),this.viewerData),{},{event:D,env_key:this.envKey});Be.user_id&&(Be.viewer_user_id=Be.user_id,delete Be.user_id);var mt=((B=Be.mux_sample_number)!==null&&B!==void 0?B:0)>=this.sampleRate,nt=Br(this._deduplicateBeaconData(D,Be));if(this.lastEventTime=this.mux.utils.now(),mt)return Y.info("Not sending event due to sample rate restriction",D,Be,nt);if(this.envKey||Y.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",D,Be,nt),!this.rateLimited){if(Y.info("Sending event",D,Be,nt),this.rateLimited=!this.eventQueue.queueEvent(D,nt),this.mux.WINDOW_UNLOADING&&D==="viewend")this.eventQueue.destroy(!0);else if(this.mux.WINDOW_HIDDEN&&D==="hb"?this.eventQueue.flushEvents(!0):qs.indexOf(D)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return Be.event="eventrateexceeded",nt=Br(Be),this.eventQueue.queueEvent(Be.event,nt),Y.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(D,V){var B=this,J={},ge=V.view_id;if(!ge||D==="viewstart"||D==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)J=Ki({},V),ge&&(this.previousBeaconData=J),ge&&D==="viewend"&&(this.previousBeaconData=null);else{var ne=D.indexOf("request")===0;Object.entries(V).forEach(function(Be){var mt=Ws(Be,2),nt=mt[0],ht=mt[1];B.previousBeaconData&&(ht!==B.previousBeaconData[nt]||Xr.indexOf(nt)>-1||B.objectHasChanged(ne,nt,ht,B.previousBeaconData[nt])||B.eventRequiresKey(D,nt))&&(J[nt]=ht,B.previousBeaconData[nt]=ht)})}return J}},{key:"objectHasChanged",value:function(D,V,B,J){return!(!D||V.indexOf("request_")!==0||V!=="request_response_headers"&&pa(B)==="object"&&pa(J)==="object"&&Object.keys(B||{}).length===Object.keys(J||{}).length)}},{key:"eventRequiresKey",value:function(D,V){return D==="renditionchange"&&V.indexOf("video_source_")===0||!(V.indexOf("ad_")!==0||!Ct.includes(D))}}])&&js(E.prototype,T),k&&js(E,k),Object.defineProperty(E,"prototype",{writable:!1}),A}();function Ai(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function za(A,E,T){return E&&Ai(A.prototype,E),T&&Ai(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var ii=za(function A(E){(function(ne,Be){if(!(ne instanceof Be))throw new TypeError("Cannot call a class as a function")})(this,A);var T=0,k=0,D=0,V=0,B=0,J=0,ge=0;E.on("requestcompleted",function(ne,Be){var mt,nt,ht=Be.request_start,Je=Be.request_response_start,ft=Be.request_response_end,Kt=Be.request_bytes_loaded;if(V++,Je?(mt=Je-ht,nt=ft-Je):nt=ft-ht,nt>0&&Kt>0){var Zt=Kt/nt*8e3;B++,k+=Kt,D+=nt,E.data.view_min_request_throughput=Math.min(E.data.view_min_request_throughput||1/0,Zt),E.data.view_average_request_throughput=k/D*8e3,E.data.view_request_count=V,mt>0&&(T+=mt,E.data.view_max_request_latency=Math.max(E.data.view_max_request_latency||0,mt),E.data.view_average_request_latency=T/B)}}),E.on("requestfailed",function(ne,Be){V++,J++,E.data.view_request_count=V,E.data.view_request_failed_count=J}),E.on("requestcanceled",function(ne,Be){V++,ge++,E.data.view_request_count=V,E.data.view_request_canceled_count=ge})});function Wi(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function va(A,E,T){return E&&Wi(A.prototype,E),T&&Wi(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var li=va(function A(E){var T=this;(function(k,D){if(!(k instanceof D))throw new TypeError("Cannot call a class as a function")})(this,A),E.on("before*",function(k,D){var V=D.viewer_time,B=X.now(),J=T._lastEventTime;if(T._lastEventTime=B,J&&B-J>36e5){var ge=Object.keys(E.data).reduce(function(ne,Be){return Be.indexOf("video_")===0?z()(ne,function(mt,nt,ht){return nt in mt?Object.defineProperty(mt,nt,{value:ht,enumerable:!0,configurable:!0,writable:!0}):mt[nt]=ht,mt}({},Be,E.data[Be])):ne},{});E.mux.log.info("Received event after at least an hour inactivity, creating a new view"),E.emit("viewinit",z()({viewer_time:V},ge)),E.playbackHeartbeat._playheadShouldBeProgressing&&k.type!=="play"&&k.type!=="adbreakstart"&&(E.emit("play",{viewer_time:V}),k.type!=="playing"&&E.emit("playing",{viewer_time:V}))}})});function Si(A){return Si=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(E){return typeof E}:function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},Si(A)}function ji(A,E){return function(T){if(Array.isArray(T))return T}(A)||function(T,k){var D=T==null?null:typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(D!=null){var V,B,J=[],ge=!0,ne=!1;try{for(D=D.call(T);!(ge=(V=D.next()).done)&&(J.push(V.value),!k||J.length!==k);ge=!0);}catch(Be){ne=!0,B=Be}finally{try{ge||D.return==null||D.return()}finally{if(ne)throw B}}return J}}(A,E)||function(T,k){if(T){if(typeof T=="string")return Qa(T,k);var D=Object.prototype.toString.call(T).slice(8,-1);return D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set"?Array.from(T):D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)?Qa(T,k):void 0}}(A,E)||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 Qa(A,E){(E==null||E>A.length)&&(E=A.length);for(var T=0,k=new Array(E);T<E;T++)k[T]=A[T];return k}function Xa(A,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Za(A,E){return Za=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(T,k){return T.__proto__=k,T},Za(A,E)}function On(A){var E=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 T,k=Ja(A);if(E){var D=Ja(this).constructor;T=Reflect.construct(k,arguments,D)}else T=k.apply(this,arguments);return Ys(this,T)}}function Ys(A,E){if(E&&(Si(E)==="object"||typeof E=="function"))return E;if(E!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cr(A)}function cr(A){if(A===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function Ja(A){return Ja=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(E){return E.__proto__||Object.getPrototypeOf(E)},Ja(A)}var bl=["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"],$s=function(A){(function(B,J){if(typeof J!="function"&&J!==null)throw new TypeError("Super expression must either be null or a function");B.prototype=Object.create(J&&J.prototype,{constructor:{value:B,writable:!0,configurable:!0}}),Object.defineProperty(B,"prototype",{writable:!1}),J&&Za(B,J)})(V,A);var E,T,k,D=On(V);function V(B,J,ge){var ne;(function(Je,ft){if(!(Je instanceof ft))throw new TypeError("Cannot call a class as a function")})(this,V),(ne=D.call(this)).DOM_CONTENT_LOADED_EVENT_END=He.domContentLoadedEventEnd(),ne.NAVIGATION_START=He.navigationStart(),ne.mux=B,ne.id=J,(ge=z()({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(Je){return Je}},ge)).data=ge.data||{},ge.data.property_key&&(ge.data.env_key=ge.data.property_key,delete ge.data.property_key),Y.setLevel(ge.debug?"debug":"warn"),ne.getPlayheadTime=ge.getPlayheadTime,ne.getStateData=ge.getStateData||function(){return{}},ne.getAdData=ge.getAdData||function(){},ne.minimumRebufferDuration=ge.minimumRebufferDuration,ne.sustainedRebufferThreshold=ge.sustainedRebufferThreshold,ne.playbackHeartbeatTime=ge.playbackHeartbeatTime,ne.disableRebufferTracking=ge.disableRebufferTracking,ne.disableRebufferTracking&&ne.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."),ne.disablePlayheadRebufferTracking=ge.disablePlayheadRebufferTracking,ne.errorTranslator=ge.errorTranslator,ne.playbackEventDispatcher=new Vi(B,ge.data.env_key,ge),ne.data={player_instance_id:y(),mux_sample_rate:ge.sampleRate,beacon_domain:ge.beaconCollectionDomain?ge.beaconCollectionDomain:ge.beaconDomain},ne.data.view_sequence_number=1,ne.data.player_sequence_number=1,ne.oldEmit=ne.emit,ne.emit=function(Je,ft){ft=z()({viewer_time:this.mux.utils.now()},ft),this.oldEmit(Je,ft)};var Be=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(cr(ne));ne.on("viewinit",function(Je,ft){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),z()(this.data,ft),this._initializeViewData(),this.one("play",Be),this.one("adbreakstart",Be)});var mt=function(Je){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",Je)}.bind(cr(ne));if(ne.on("videochange",function(Je,ft){mt(ft)}),ne.on("programchange",function(Je,ft){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."),mt(z()(ft,{view_program_changed:!0})),Be(),this.emit("play"),this.emit("playing")}),ne.on("fragmentchange",function(Je,ft){this.currentFragmentPDT=ft.currentFragmentPDT,this.currentFragmentStart=ft.currentFragmentStart}),ne.on("destroy",ne.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var nt=function(){var Je=ne.data.view_start!==void 0;ne.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",Je&&ne.mux.WINDOW_HIDDEN&&(ne.data.player_is_paused||ne.emit("hb"))};window.addEventListener("visibilitychange",nt,!1);var ht=function(Je){Je.persisted||ne.destroy()};window.addEventListener("pagehide",ht,!1),ne.on("destroy",function(){window.removeEventListener("visibilitychange",nt),window.removeEventListener("pagehide",ht)})}return ne.on("playerready",function(Je,ft){z()(this.data,ft)}),bl.forEach(function(Je){ne.on(Je,function(ft,Kt){Je.indexOf("ad")!==0&&this._updateStateData(),z()(this.data,Kt),this._sanitizeData()}),ne.on("after"+Je,function(){(Je!=="error"||this.errorTracker.viewErrored)&&this.send(Je)})}),ne.on("viewend",function(Je,ft){z()(ne.data,ft)}),ne.one("playerready",function(Je){var ft=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=ft-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}),ne.longResumeTracker=new li(cr(ne)),ne.errorTracker=new xe(cr(ne)),new Et(cr(ne)),ne.seekingTracker=new G(cr(ne)),ne.playheadTime=new lt(cr(ne)),ne.playbackHeartbeat=new Ue(cr(ne)),new se(cr(ne)),ne.watchTimeTracker=new rt(cr(ne)),new gt(cr(ne)),ne.adTracker=new Ce(cr(ne)),new Vt(cr(ne)),new At(cr(ne)),new vr(cr(ne)),new Qe(cr(ne)),new ii(cr(ne)),ge.hlsjs&&ne.addHLSJS(ge),ge.dashjs&&ne.addDashJS(ge),ne.emit("viewinit",ge.data),ne}return E=V,T=[{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(B){var J=z()({},this.data);if(J.video_source_is_live===void 0&&(J.player_source_duration===1/0||J.video_source_duration===1/0?J.video_source_is_live=!0:(J.player_source_duration>0||J.video_source_duration>0)&&(J.video_source_is_live=!1)),J.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(mt){J[mt]=void 0}),J.video_source_url=J.video_source_url||J.player_source_url,J.video_source_url){var ge=ji(ke(J.video_source_url),2),ne=ge[0],Be=ge[1];J.video_source_domain=Be,J.video_source_hostname=ne}delete J.ad_request_id,this.playbackEventDispatcher.send(B,J),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat()}},{key:"_updateStateData",value:function(){z()(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var B=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(J){var ge=parseInt(B.data[J],10);B.data[J]=isNaN(ge)?void 0:ge}),["player_source_url","video_source_url"].forEach(function(J){if(B.data[J]){var ge=B.data[J].toLowerCase();ge.indexOf("data:")!==0&&ge.indexOf("blob:")!==0||(B.data[J]="MSE style URL")}})}},{key:"_resetVideoData",value:function(B,J){var ge=this;Object.keys(this.data).forEach(function(ne){ne.indexOf("video_")===0&&delete ge.data[ne]})}},{key:"_resetViewData",value:function(){var B=this;Object.keys(this.data).forEach(function(J){J.indexOf("view_")===0&&delete B.data[J]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(B,J){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var B=this,J=this.data.view_id=y(),ge=function(){J===B.data.view_id&&Z(B.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",ge):ge()}},{key:"_restartHeartBeat",value:function(){var B=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){B.data.player_is_paused||B.emit("hb")},1e4))}},{key:"addHLSJS",value:function(B){B.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=B.hlsjs,function(J,ge,ne){var Be=arguments.length>4?arguments[4]:void 0,mt=J.log,nt=J.utils.secondsToMs,ht=function(Pt){var dt,bt=parseInt(Be.version);return bt===1&&Pt.programDateTime!==null&&(dt=Pt.programDateTime),bt===0&&Pt.pdt!==null&&(dt=Pt.pdt),dt};if(He.exists()){var Je=function(Pt,dt){return J.emit(ge,Pt,dt)},ft=function(Pt,dt){var bt=dt.levels,st=dt.audioTracks,yt=dt.url,Jt=dt.stats,ar=dt.networkDetails,Cr=dt.sessionData,wr={},jr={};bt.forEach(function(Yr,$i){wr[$i]={width:Yr.width,height:Yr.height,bitrate:Yr.bitrate,attrs:Yr.attrs}}),st.forEach(function(Yr,$i){jr[$i]={name:Yr.name,language:Yr.lang,bitrate:Yr.bitrate}});var Mr=re(Jt),qr=Mr.bytesLoaded,or=Mr.requestStart,xr=Mr.responseStart,ba=Mr.responseEnd;Je("requestcompleted",_e(_e({},N(Cr)),{},{request_event_type:Pt,request_bytes_loaded:qr,request_start:or,request_response_start:xr,request_response_end:ba,request_type:"manifest",request_hostname:be(yt),request_response_headers:Re(ar),request_rendition_lists:{media:wr,audio:jr,video:{}}}))};ne.on(Be.Events.MANIFEST_LOADED,ft);var Kt=function(Pt,dt){var bt=dt.details,st=dt.level,yt=dt.networkDetails,Jt=dt.stats,ar=re(Jt),Cr=ar.bytesLoaded,wr=ar.requestStart,jr=ar.responseStart,Mr=ar.responseEnd,qr=bt.fragments[bt.fragments.length-1],or=ht(qr)+nt(qr.duration);Je("requestcompleted",{request_event_type:Pt,request_bytes_loaded:Cr,request_start:wr,request_response_start:jr,request_response_end:Mr,request_current_level:st,request_type:"manifest",request_hostname:be(bt.url),request_response_headers:Re(yt),video_holdback:bt.holdBack&&nt(bt.holdBack),video_part_holdback:bt.partHoldBack&&nt(bt.partHoldBack),video_part_target_duration:bt.partTarget&&nt(bt.partTarget),video_target_duration:bt.targetduration&&nt(bt.targetduration),video_source_is_live:bt.live,player_manifest_newest_program_time:isNaN(or)?void 0:or})};ne.on(Be.Events.LEVEL_LOADED,Kt);var Zt=function(Pt,dt){var bt=dt.details,st=dt.networkDetails,yt=dt.stats,Jt=re(yt),ar=Jt.bytesLoaded,Cr=Jt.requestStart,wr=Jt.responseStart,jr=Jt.responseEnd;Je("requestcompleted",{request_event_type:Pt,request_bytes_loaded:ar,request_start:Cr,request_response_start:wr,request_response_end:jr,request_type:"manifest",request_hostname:be(bt.url),request_response_headers:Re(st)})};ne.on(Be.Events.AUDIO_TRACK_LOADED,Zt);var Er=function(Pt,dt){var bt=dt.stats,st=dt.networkDetails,yt=dt.frag;bt=bt||yt.stats;var Jt=re(bt),ar=Jt.bytesLoaded,Cr=Jt.requestStart,wr=Jt.responseStart,jr=Jt.responseEnd,Mr=Re(st),qr=Mr==null?void 0:Mr["x-request-id"],or={request_event_type:Pt,request_bytes_loaded:ar,request_start:Cr,request_response_start:wr,request_response_end:jr,request_hostname:st?be(st.responseURL):void 0,request_id:qr,request_response_headers:Mr,request_media_duration:yt.duration,request_url:st==null?void 0:st.responseURL};yt.type==="main"?(or.request_type="media",or.request_current_level=yt.level,or.request_video_width=(ne.levels[yt.level]||{}).width,or.request_video_height=(ne.levels[yt.level]||{}).height,or.request_labeled_bitrate=(ne.levels[yt.level]||{}).bitrate):or.request_type=yt.type,Je("requestcompleted",or)};ne.on(Be.Events.FRAG_LOADED,Er);var Dr=function(Pt,dt){var bt=dt.frag,st=bt.start,yt={currentFragmentPDT:ht(bt),currentFragmentStart:nt(st)};Je("fragmentchange",yt)};ne.on(Be.Events.FRAG_CHANGED,Dr);var Dt=function(Pt,dt){var bt=dt.type,st=dt.details,yt=dt.response,Jt=dt.fatal,ar=dt.context,Cr=dt.frag;if(st===Be.ErrorDetails.MANIFEST_LOAD_ERROR||st===Be.ErrorDetails.MANIFEST_LOAD_TIMEOUT||st===Be.ErrorDetails.FRAG_LOAD_ERROR||st===Be.ErrorDetails.FRAG_LOAD_TIMEOUT||st===Be.ErrorDetails.LEVEL_LOAD_ERROR||st===Be.ErrorDetails.LEVEL_LOAD_TIMEOUT){var wr=Cr&&Cr.url||ar&&ar.url||"";Je("requestfailed",{request_error:st,request_url:wr,request_hostname:be(wr),request_type:st===Be.ErrorDetails.FRAG_LOAD_ERROR||st===Be.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":"manifest",request_error_code:yt&&yt.code,request_error_text:yt&&yt.text})}Jt&&Je("error",{player_error_code:bt,player_error_message:st})};ne.on(Be.Events.ERROR,Dt);var hr=function(Pt,dt){var bt=dt.frag,st=bt&&bt._url||"";Je("requestcanceled",{request_event_type:Pt,request_url:st,request_type:"media",request_hostname:be(st)})};ne.on(Be.Events.FRAG_LOAD_EMERGENCY_ABORTED,hr);var kr=function(Pt,dt){var bt=dt.level,st=ne.levels[bt];if(st&&st.attrs&&st.attrs.BANDWIDTH){var yt,Jt=st.attrs.BANDWIDTH,ar=parseFloat(st.attrs["FRAME-RATE"]);isNaN(ar)||(yt=ar),Jt?Je("renditionchange",{video_source_fps:yt,video_source_bitrate:Jt,video_source_width:st.width,video_source_height:st.height,video_source_rendition_name:st.name,video_source_codec:st==null?void 0:st.videoCodec}):mt.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};ne.on(Be.Events.LEVEL_SWITCHED,kr),ne._stopMuxMonitor=function(){ne.off(Be.Events.MANIFEST_LOADED,ft),ne.off(Be.Events.LEVEL_LOADED,Kt),ne.off(Be.Events.AUDIO_TRACK_LOADED,Zt),ne.off(Be.Events.FRAG_LOADED,Er),ne.off(Be.Events.FRAG_CHANGED,Dr),ne.off(Be.Events.ERROR,Dt),ne.off(Be.Events.FRAG_LOAD_EMERGENCY_ABORTED,hr),ne.off(Be.Events.LEVEL_SWITCHED,kr),ne.off(Be.Events.DESTROYING,ne._stopMuxMonitor),delete ne._stopMuxMonitor},ne.on(Be.Events.DESTROYING,ne._stopMuxMonitor)}else mt.warn("performance timing not supported. Not tracking HLS.js.")}(this.mux,this.id,B.hlsjs,{},B.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){var B;this.hlsjs&&((B=this.hlsjs)&&typeof B._stopMuxMonitor=="function"&&B._stopMuxMonitor(),this.hlsjs=void 0)}},{key:"addDashJS",value:function(B){B.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=B.dashjs,function(J,ge,ne){var Be=J.log;if(ne&&ne.on){var mt=function(Dt,hr){return J.emit(ge,Dt,hr)},nt=function(Dt){var hr=Dt.type,kr=(Dt.data||{}).url;mt("requestcompleted",{request_event_type:hr,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:be(kr),request_url:kr})};ne.on("manifestLoaded",nt);var ht={},Je=function(Dt){var hr=Dt.type,kr=Dt.fragmentModel,Pt=(Dt.chunk||{}).mediaInfo||{},dt=Pt.type,bt=Pt.bitrateList,st={};(bt=bt||[]).forEach(function(or,xr){st[xr]={},st[xr].width=or.width,st[xr].height=or.height,st[xr].bitrate=or.bandwidth,st[xr].attrs={}}),dt==="video"?ht.video=st:dt==="audio"?ht.audio=st:ht.media=st;var yt=Ye(kr,ne),Jt=yt.requestStart,ar=yt.requestResponseStart,Cr=yt.requestResponseEnd,wr=yt.requestResponseHeaders,jr=yt.requestMediaDuration,Mr=yt.requestHostname,qr=yt.requestUrl;mt("requestcompleted",{request_event_type:hr,request_start:Jt,request_response_start:ar,request_response_end:Cr,request_bytes_loaded:-1,request_type:dt+"_init",request_response_headers:wr,request_hostname:Mr,request_url:qr,request_media_duration:jr,request_rendition_lists:ht})};ne.on("initFragmentLoaded",Je);var ft=function(Dt){var hr=Dt.type,kr=Dt.fragmentModel,Pt=Dt.chunk||{},dt=Pt.mediaInfo,bt=Pt.start,st=(dt||{}).type,yt=Ye(kr,ne),Jt=yt.requestStart,ar=yt.requestResponseStart,Cr=yt.requestResponseEnd,wr=yt.requestBytesLoaded,jr=yt.requestResponseHeaders,Mr=yt.requestMediaDuration,qr=yt.requestHostname,or=yt.requestUrl,xr=ot(st,ne),ba=xr.currentLevel,Yr=xr.renditionWidth,$i=xr.renditionHeight,Js=xr.renditionBitrate;mt("requestcompleted",{request_event_type:hr,request_start:Jt,request_response_start:ar,request_response_end:Cr,request_bytes_loaded:wr,request_type:st,request_response_headers:jr,request_hostname:qr,request_url:or,request_media_start_time:bt,request_media_duration:Mr,request_current_level:ba,request_labeled_bitrate:Js,request_video_width:Yr,request_video_height:$i})};ne.on("mediaFragmentLoaded",ft);var Kt={video:void 0,audio:void 0,totalBitrate:void 0},Zt=function(){if(Kt.video&&typeof Kt.video.bitrate=="number"){if(Kt.video.width&&Kt.video.height){var Dt=Kt.video.bitrate;return Kt.audio&&typeof Kt.audio.bitrate=="number"&&(Dt+=Kt.audio.bitrate),Dt!==Kt.totalBitrate?(Kt.totalBitrate=Dt,{video_source_bitrate:Dt,video_source_height:Kt.video.height,video_source_width:Kt.video.width,video_source_codec:le(Kt.video.codec)}):void 0}Be.warn("have bitrate info for video but missing width/height")}},Er=function(Dt,hr,kr){if(typeof Dt.newQuality=="number"){var Pt=Dt.mediaType;if(Pt==="audio"||Pt==="video"){var dt=ne.getBitrateInfoListFor(Pt).find(function(st){return st.qualityIndex===Dt.newQuality});if(dt&&typeof dt.bitrate=="number"){Kt[Pt]=Fe(Fe({},dt),{},{codec:ne.getCurrentTrackFor(Pt).codec});var bt=Zt();bt&&mt("renditionchange",bt)}else Be.warn("missing bitrate info for ".concat(Pt))}}else Be.warn("missing evt.newQuality in qualityChangeRendered event",Dt)};ne.on("qualityChangeRendered",Er);var Dr=function(Dt){var hr=Dt.error,kr=Dt.event,Pt=(kr=kr||{}).request||{},dt=R().event&&R().event.currentTarget||{};mt("requestfailed",{request_error:hr+"_"+kr.id+"_"+Pt.type,request_url:kr.url,request_hostname:be(kr.url),request_type:Pt.mediaType,request_error_code:dt.status,request_error_type:dt.statusText})};ne.on("error",Dr),ne._stopMuxMonitor=function(){ne.off("manifestLoaded",nt),ne.off("initFragmentLoaded",Je),ne.off("mediaFragmentLoaded",ft),ne.off("qualityChangeRendered",Er),ne.off("error",Dr),delete ne._stopMuxMonitor}}else Be.warn("Invalid dash.js player reference. Monitoring blocked.")}(this.mux,this.id,B.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){var B;this.dashjs&&((B=this.dashjs)&&typeof B._stopMuxMonitor=="function"&&B._stopMuxMonitor(),this.dashjs=void 0)}}],T&&Xa(E.prototype,T),k&&Xa(E,k),Object.defineProperty(E,"prototype",{writable:!1}),V}(Le),ki=$s,Pn=L(153),ga=L.n(Pn);function Ea(A){return Ea=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(E){return typeof E}:function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},Ea(A)}function Nn(A,E){return function(T){if(Array.isArray(T))return T}(A)||function(T,k){var D=T==null?null:typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(D!=null){var V,B,J=[],ge=!0,ne=!1;try{for(D=D.call(T);!(ge=(V=D.next()).done)&&(J.push(V.value),!k||J.length!==k);ge=!0);}catch(Be){ne=!0,B=Be}finally{try{ge||D.return==null||D.return()}finally{if(ne)throw B}}return J}}(A,E)||function(T,k){if(T){if(typeof T=="string")return zs(T,k);var D=Object.prototype.toString.call(T).slice(8,-1);return D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set"?Array.from(T):D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)?zs(T,k):void 0}}(A,E)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
5
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function zs(A,E){(E==null||E>A.length)&&(E=A.length);for(var T=0,k=new Array(E);T<E;T++)k[T]=A[T];return k}var qi,Un=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],Tl={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};R()&&R().WeakMap&&(qi=new WeakMap);var en="#EXT-X-TARGETDURATION",_l="#EXT-X-PART-INF",Al="#EXT-X-SERVER-CONTROL",Sl="#EXTINF",Qs="#EXT-X-PROGRAM-DATE-TIME",tn="#EXT-X-VERSION",Fn="#EXT-X-SESSION-DATA",rn=function(A){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(A),this.manifest};rn.prototype.process=function(A){var E;for(this.buffer+=A,E=this.buffer.indexOf(`
6
- `);E>-1;E=this.buffer.indexOf(`
7
- `))this.processLine(this.buffer.substring(0,E)),this.buffer=this.buffer.substring(E+1)},rn.prototype.processLine=function(A){var E=A.indexOf(":"),T=Il(A,E),k=T[0],D=T.length===2?ya(T[1]):void 0;if(k[0]!=="#")this.currentUri.uri=k,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(k){case en:if(!isFinite(D)||D<0)return;this.manifest.targetDuration=D,this.setHoldBack();break;case _l:Bn(this.manifest,T),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case Al:Bn(this.manifest,T),this.setHoldBack();break;case Sl:D===0?this.currentUri.duration=.01:D>0&&(this.currentUri.duration=D);break;case Qs:var V=D,B=new Date(V);this.manifest.dateTimeString||(this.manifest.dateTimeString=V,this.manifest.dateTimeObject=B),this.currentUri.dateTimeString=V,this.currentUri.dateTimeObject=B;break;case tn:Bn(this.manifest,T);break;case Fn:var J=Ll(T[1]),ge=N(J);z()(this.manifest.sessionData,ge)}},rn.prototype.setHoldBack=function(){var A=this.manifest,E=A.serverControl,T=A.targetDuration,k=A.partTargetDuration;if(E){var D="holdBack",V="partHoldBack",B=T&&3*T,J=k&&2*k;T&&!E.hasOwnProperty(D)&&(E[D]=B),B&&E[D]<B&&(E[D]=B),k&&!E.hasOwnProperty(V)&&(E[V]=3*k),k&&E[V]<J&&(E[V]=J)}};var Bn=function(A,E){var T,k=Xs(E[0].replace("#EXT-X-",""));Hn(E[1])?(T={},T=z()(wl(E[1]),T)):T=ya(E[1]),A[k]=T},Xs=function(A){return A.toLowerCase().replace(/-(\w)/g,function(E){return E[1].toUpperCase()})},ya=function(A){if(A.toLowerCase()==="yes"||A.toLowerCase()==="no")return A.toLowerCase()==="yes";var E=A.indexOf(":")!==-1?A:parseFloat(A);return isNaN(E)?A:E},kl=function(A){var E={},T=A.split("=");return T.length>1&&(E[Xs(T[0])]=ya(T[1])),E},wl=function(A){for(var E=A.split(","),T={},k=0;E.length>k;k++){var D=E[k],V=kl(D);T=z()(V,T)}return T},Hn=function(A){return A.indexOf("=")>-1},Il=function(A,E){return E===-1?[A]:[A.substring(0,E),A.substring(E+1)]},Ll=function(A){var E={};if(A){var T=A.search(",");return[A.slice(0,T),A.slice(T+1)].forEach(function(k,D){for(var V=k.replace(/['"]+/g,"").split("="),B=0;B<V.length;B++)V[B]==="DATA-ID"&&(E["DATA-ID"]=V[1-B]),V[B]==="VALUE"&&(E.VALUE=V[1-B])}),{data:E}}},Dl=rn,Kn={safeCall:function(A,E,T,k){var D=k;if(A&&typeof A[E]=="function")try{D=A[E].apply(A,T)}catch(V){Y.info("safeCall error",V)}return D},safeIncrement:Z,getComputedStyle:function(A,E){var T;if(A&&E&&R()&&typeof R().getComputedStyle=="function")return qi&&qi.has(A)&&(T=qi.get(A)),T||(T=R().getComputedStyle(A,null),qi&&qi.set(A,T)),T.getPropertyValue(E)},secondsToMs:function(A){return Math.floor(1e3*A)},assign:z(),headersStringToObject:q,extractHostnameAndDomain:ke,extractHostname:be,manifestParser:Dl,generateShortID:P,generateUUID:y,now:X.now},Gn={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 Rl(A,E){return function(T){if(Array.isArray(T))return T}(A)||function(T,k){var D=T==null?null:typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(D!=null){var V,B,J=[],ge=!0,ne=!1;try{for(D=D.call(T);!(ge=(V=D.next()).done)&&(J.push(V.value),!k||J.length!==k);ge=!0);}catch(Be){ne=!0,B=Be}finally{try{ge||D.return==null||D.return()}finally{if(ne)throw B}}return J}}(A,E)||function(T,k){if(T){if(typeof T=="string")return It(T,k);var D=Object.prototype.toString.call(T).slice(8,-1);return D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set"?Array.from(T):D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)?It(T,k):void 0}}(A,E)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
8
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function It(A,E){(E==null||E>A.length)&&(E=A.length);for(var T=0,k=new Array(E);T<E;T++)k[T]=A[T];return k}var Wr={},Yi=function A(E){var T=arguments;typeof E=="string"?A.hasOwnProperty(E)?R().setTimeout(function(){T=Array.prototype.splice.call(T,1),A[E].apply(null,T)},0):Y.warn("`"+E+"` is an unknown task"):typeof E=="function"?R().setTimeout(function(){E(A)},0):Y.warn("`"+E+"` is invalid.")},Zs={loaded:X.now(),NAME:"mux-embed",VERSION:"4.17.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(A,E){return function(T,k,D){var V=Nn(ue(k),3),B=V[0],J=V[1],ge=V[2],ne=T.log,Be=T.utils.getComputedStyle,mt=T.utils.secondsToMs;if(!B)return ne.error("No element was found with the `"+J+"` query selector.");if(ge!=="video"&&ge!=="audio")return ne.error("The element of `"+J+"` was not a media element.");B.mux&&(B.mux.destroy(),delete B.mux,ne.warn("Already monitoring this video element, replacing existing event listeners")),(D=z()({automaticErrorTracking:!0},D)).data=z()({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:T.VERSION},D.data),D.getPlayheadTime=function(){return mt(B.currentTime)},D.getStateData=function(){var ht,Je,ft=this.hlsjs&&this.hlsjs.url,Kt=this.dashjs&&Ea(this.dashjs.getSource==="function")&&this.dashjs.getSource(),Zt={player_is_paused:B.paused,player_playhead_time:mt(B.currentTime),player_width:parseInt(Be(B,"width")),player_height:parseInt(Be(B,"height")),player_autoplay_on:B.autoplay,player_preload_on:B.preload,player_language_code:B.lang,player_is_fullscreen:ga()&&!!(ga().fullscreenElement||ga().webkitFullscreenElement||ga().mozFullScreenElement||ga().msFullscreenElement),video_poster_url:B.poster,video_source_url:ft||Kt||B.currentSrc,video_source_duration:mt(B.duration),video_source_height:B.videoHeight,video_source_width:B.videoWidth,view_dropped_frame_count:(ht=B)===null||ht===void 0||(Je=ht.getVideoPlaybackQuality)===null||Je===void 0?void 0:Je.call(ht).droppedVideoFrames},Er=D.getPlayheadTime();if(B.getStartDate&&Er>0){var Dr=B.getStartDate();if(Dr&&typeof Dr.getTime=="function"&&Dr.getTime()){var Dt=Dr.getTime();if(Zt.player_program_time=Dt+Er,B.seekable.length>0){var hr=Dt+B.seekable.end(B.seekable.length-1);Zt.player_live_edge_program_time=hr}}}return Zt},B.mux=B.mux||{},B.mux.deleted=!1,B.mux.emit=function(ht,Je){T.emit(J,ht,Je)};var nt=function(){ne.error("The monitor for this video element has already been destroyed.")};B.mux.destroy=function(){Object.keys(B.mux.listeners).forEach(function(ht){B.removeEventListener(ht,B.mux.listeners[ht],!1)}),delete B.mux.listeners,B.mux.destroy=nt,B.mux.swapElement=nt,B.mux.emit=nt,B.mux.addHLSJS=nt,B.mux.addDashJS=nt,B.mux.removeHLSJS=nt,B.mux.removeDashJS=nt,B.mux.deleted=!0,T.emit(J,"destroy")},B.mux.swapElement=function(ht){var Je=Nn(ue(ht),3),ft=Je[0],Kt=Je[1],Zt=Je[2];return ft?Zt!=="video"&&Zt!=="audio"?T.log.error("The element of `"+Kt+"` was not a media element."):(ft.muxId=B.muxId,delete B.muxId,ft.mux=ft.mux||{},ft.mux.listeners=z()({},B.mux.listeners),delete B.mux.listeners,Object.keys(ft.mux.listeners).forEach(function(Er){B.removeEventListener(Er,ft.mux.listeners[Er],!1),ft.addEventListener(Er,ft.mux.listeners[Er],!1)}),ft.mux.swapElement=B.mux.swapElement,ft.mux.destroy=B.mux.destroy,delete B.mux,void(B=ft)):T.log.error("No element was found with the `"+Kt+"` query selector.")},B.mux.addHLSJS=function(ht){T.addHLSJS(J,ht)},B.mux.addDashJS=function(ht){T.addDashJS(J,ht)},B.mux.removeHLSJS=function(){T.removeHLSJS(J)},B.mux.removeDashJS=function(){T.removeDashJS(J)},T.init(J,D),T.emit(J,"playerready"),B.paused||(T.emit(J,"play"),B.readyState>2&&T.emit(J,"playing")),B.mux.listeners={},Un.forEach(function(ht){(ht!=="error"||D.automaticErrorTracking)&&(B.mux.listeners[ht]=function(){var Je={};if(ht==="error"){if(!B.error||B.error.code===1)return;Je.player_error_code=B.error.code,Je.player_error_message=Tl[B.error.code]||B.error.message}T.emit(J,ht,Je)},B.addEventListener(ht,B.mux.listeners[ht],!1))})}(Yi,A,E)},destroyMonitor:function(A){var E=Rl(ue(A),1)[0];E&&E.mux&&typeof E.mux.destroy=="function"?E.mux.destroy():Y.error("A video element monitor for `"+A+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(A,E){var T=O(A);Wr[T]?Wr[T].addHLSJS(E):Y.error("A monitor for `"+T+"` has not been initialized.")},addDashJS:function(A,E){var T=O(A);Wr[T]?Wr[T].addDashJS(E):Y.error("A monitor for `"+T+"` has not been initialized.")},removeHLSJS:function(A){var E=O(A);Wr[E]?Wr[E].removeHLSJS():Y.error("A monitor for `"+E+"` has not been initialized.")},removeDashJS:function(A){var E=O(A);Wr[E]?Wr[E].removeDashJS():Y.error("A monitor for `"+E+"` has not been initialized.")},init:function(A,E){pe()&&E&&E.respectDoNotTrack&&Y.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var T=O(A);Wr[T]=new ki(Yi,T,E)},emit:function(A,E,T){var k=O(A);Wr[k]?(Wr[k].emit(E,T),E==="destroy"&&delete Wr[k]):Y.error("A monitor for `"+k+"` has not been initialized.")},checkDoNotTrack:pe,log:Y,utils:Kn,events:Gn,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Yi,Zs),R()!==void 0&&typeof R().addEventListener=="function"&&R().addEventListener("pagehide",function(A){A.persisted||(Yi.WINDOW_UNLOADING=!0)},!1);var Cl=Yi},655:function(g,b,L){var M,R;function y(P){return y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(O){return typeof O}:function(O){return O&&typeof Symbol=="function"&&O.constructor===Symbol&&O!==Symbol.prototype?"symbol":typeof O},y(P);}(function(P){var O=!1;if((R=typeof(M=P)=="function"?M.call(b,L,b,g):M)===void 0||(g.exports=R),O=!0,y(b)==="object"&&(g.exports=P(),O=!0),!O){var ue=window.Cookies,Q=window.Cookies=P();Q.noConflict=function(){return window.Cookies=ue,Q}}})(function(){var P=function(){for(var O=0,ue={};O<arguments.length;O++){var Q=arguments[O];for(var de in Q)ue[de]=Q[de]}return ue};return function O(ue){function Q(de,he,Y){var pe;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(Y=P({path:"/"},Q.defaults,Y)).expires=="number"){var X=new Date;X.setMilliseconds(X.getMilliseconds()+864e5*Y.expires),Y.expires=X}try{pe=JSON.stringify(he),/^[\{\[]/.test(pe)&&(he=pe)}catch{}return he=ue.write?ue.write(he,de):encodeURIComponent(String(he)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),de=(de=(de=encodeURIComponent(String(de))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[de,"=",he,Y.expires?"; expires="+Y.expires.toUTCString():"",Y.path?"; path="+Y.path:"",Y.domain?"; domain="+Y.domain:"",Y.secure?"; secure":""].join("")}de||(pe={});for(var oe=document.cookie?document.cookie.split("; "):[],z=/(%[0-9A-Z]{2})+/g,be=0;be<oe.length;be++){var ke=oe[be].split("="),He=ke.slice(1).join("=");He.charAt(0)==='"'&&(He=He.slice(1,-1));try{var Z=ke[0].replace(z,decodeURIComponent);if(He=ue.read?ue.read(He,Z):ue(He,Z)||He.replace(z,decodeURIComponent),this.json)try{He=JSON.parse(He)}catch{}if(de===Z){pe=He;break}de||(pe[Z]=He)}catch{}}return pe}}return Q.set=Q,Q.get=function(de){return Q.call(Q,de)},Q.getJSON=function(){return Q.apply({json:!0},[].slice.call(arguments))},Q.defaults={},Q.remove=function(de,he){Q(de,"",P(he,{expires:-1}))},Q.withConverter=O,Q}(function(){})})},153:function(g,b,L){var M,R=L.g!==void 0?L.g:typeof window!="undefined"?window:{},y=L(558);typeof document!="undefined"?M=document:(M=R["__GLOBAL_DOCUMENT_CACHE@4"])||(M=R["__GLOBAL_DOCUMENT_CACHE@4"]=y),g.exports=M},48:function(g,b,L){var M;M=typeof window!="undefined"?window:L.g!==void 0?L.g:typeof self!="undefined"?self:{},g.exports=M},678:function(g){var b=9007199254740991,L="[object Arguments]",M="[object Function]",R="[object GeneratorFunction]",y=/^(?:0|[1-9]\d*)$/;function P(te,re,Re){switch(Re.length){case 0:return te.call(re);case 1:return te.call(re,Re[0]);case 2:return te.call(re,Re[0],Re[1]);case 3:return te.call(re,Re[0],Re[1],Re[2])}return te.apply(re,Re)}var O,ue,Q=Object.prototype,de=Q.hasOwnProperty,he=Q.toString,Y=Q.propertyIsEnumerable,pe=(O=Object.keys,ue=Object,function(te){return O(ue(te))}),X=Math.max,oe=!Y.call({valueOf:1},"valueOf");function z(te,re){var Re=w(te)||function(Ye){return function(ot){return function(le){return!!le&&typeof le=="object"}(ot)&&q(ot)}(Ye)&&de.call(Ye,"callee")&&(!Y.call(Ye,"callee")||he.call(Ye)==L)}(te)?function(Ye,ot){for(var le=-1,Ee=Array(Ye);++le<Ye;)Ee[le]=ot(le);return Ee}(te.length,String):[],Pe=Re.length,Fe=!!Pe;for(var Se in te)!re&&!de.call(te,Se)||Fe&&(Se=="length"||ke(Se,Pe))||Re.push(Se);return Re}function be(te,re,Re){var Pe=te[re];de.call(te,re)&&Z(Pe,Re)&&(Re!==void 0||re in te)||(te[re]=Re)}function ke(te,re){return!!(re=re==null?b:re)&&(typeof te=="number"||y.test(te))&&te>-1&&te%1==0&&te<re}function He(te){var re=te&&te.constructor;return te===(typeof re=="function"&&re.prototype||Q)}function Z(te,re){return te===re||te!=te&&re!=re}var w=Array.isArray;function q(te){return te!=null&&function(re){return typeof re=="number"&&re>-1&&re%1==0&&re<=b}(te.length)&&!function(re){var Re=N(re)?he.call(re):"";return Re==M||Re==R}(te)}function N(te){var re=typeof te;return!!te&&(re=="object"||re=="function")}var fe,_e=(fe=function(te,re){if(oe||He(re)||q(re))(function(Pe,Fe,Se,Ye){Se||(Se={});for(var ot=-1,le=Fe.length;++ot<le;){var Ee=Fe[ot],U=Ye?Ye(Se[Ee],Pe[Ee],Ee,Se,Pe):void 0;be(Se,Ee,U===void 0?Pe[Ee]:U)}})(re,function(Pe){return q(Pe)?z(Pe):function(Fe){if(!He(Fe))return pe(Fe);var Se=[];for(var Ye in Object(Fe))de.call(Fe,Ye)&&Ye!="constructor"&&Se.push(Ye);return Se}(Pe)}(re),te);else for(var Re in re)de.call(re,Re)&&be(te,Re,re[Re])},function(te,re){return re=X(re===void 0?te.length-1:re,0),function(){for(var Re=arguments,Pe=-1,Fe=X(Re.length-re,0),Se=Array(Fe);++Pe<Fe;)Se[Pe]=Re[re+Pe];Pe=-1;for(var Ye=Array(re+1);++Pe<re;)Ye[Pe]=Re[Pe];return Ye[re]=Se,P(te,this,Ye)}}(function(te,re){var Re=-1,Pe=re.length,Fe=Pe>1?re[Pe-1]:void 0,Se=Pe>2?re[2]:void 0;for(Fe=fe.length>3&&typeof Fe=="function"?(Pe--,Fe):void 0,Se&&function(ot,le,Ee){if(!N(Ee))return!1;var U=typeof le;return!!(U=="number"?q(Ee)&&ke(le,Ee.length):U=="string"&&le in Ee)&&Z(Ee[le],ot)}(re[0],re[1],Se)&&(Fe=Pe<3?void 0:Fe,Pe=1),te=Object(te);++Re<Pe;){var Ye=re[Re];Ye&&fe(te,Ye,Re,Fe)}return te}));g.exports=_e},640:function(g,b,L){var M,R;(function(y,P){"use strict";M=function(){var O=function(){},ue="undefined",Q=typeof window!==ue&&typeof window.navigator!==ue&&/Trident\/|MSIE /.test(window.navigator.userAgent),de=["trace","debug","info","warn","error"];function he(w,q){var N=w[q];if(typeof N.bind=="function")return N.bind(w);try{return Function.prototype.bind.call(N,w)}catch{return function(){return Function.prototype.apply.apply(N,[w,arguments])}}}function Y(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function pe(w){return w==="debug"&&(w="log"),typeof console!==ue&&(w==="trace"&&Q?Y:console[w]!==void 0?he(console,w):console.log!==void 0?he(console,"log"):O)}function X(w,q){for(var N=0;N<de.length;N++){var fe=de[N];this[fe]=N<w?O:this.methodFactory(fe,w,q)}this.log=this.debug}function oe(w,q,N){return function(){typeof console!==ue&&(X.call(this,q,N),this[w].apply(this,arguments))}}function z(w,q,N){return pe(w)||oe.apply(this,arguments)}function be(w,q,N){var fe,_e=this;q=q==null?"WARN":q;var te="loglevel";function re(Se){var Ye=(de[Se]||"silent").toUpperCase();if(typeof window!==ue&&te){try{return void(window.localStorage[te]=Ye)}catch{}try{window.document.cookie=encodeURIComponent(te)+"="+Ye+";"}catch{}}}function Re(){var Se;if(typeof window!==ue&&te){try{Se=window.localStorage[te]}catch{}if(typeof Se===ue)try{var Ye=window.document.cookie,ot=Ye.indexOf(encodeURIComponent(te)+"=");ot!==-1&&(Se=/^([^;]+)/.exec(Ye.slice(ot))[1])}catch{}return _e.levels[Se]===void 0&&(Se=void 0),Se}}function Pe(){if(typeof window!==ue&&te){try{return void window.localStorage.removeItem(te)}catch{}try{window.document.cookie=encodeURIComponent(te)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof w=="string"?te+=":"+w:typeof w=="symbol"&&(te=void 0),_e.name=w,_e.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},_e.methodFactory=N||z,_e.getLevel=function(){return fe},_e.setLevel=function(Se,Ye){if(typeof Se=="string"&&_e.levels[Se.toUpperCase()]!==void 0&&(Se=_e.levels[Se.toUpperCase()]),!(typeof Se=="number"&&Se>=0&&Se<=_e.levels.SILENT))throw"log.setLevel() called with invalid level: "+Se;if(fe=Se,Ye!==!1&&re(Se),X.call(_e,Se,w),typeof console===ue&&Se<_e.levels.SILENT)return"No console available for logging"},_e.setDefaultLevel=function(Se){q=Se,Re()||_e.setLevel(Se,!1)},_e.resetLevel=function(){_e.setLevel(q,!1),Pe()},_e.enableAll=function(Se){_e.setLevel(_e.levels.TRACE,Se)},_e.disableAll=function(Se){_e.setLevel(_e.levels.SILENT,Se)};var Fe=Re();Fe==null&&(Fe=q),_e.setLevel(Fe,!1)}var ke=new be,He={};ke.getLogger=function(w){if(typeof w!="symbol"&&typeof w!="string"||w==="")throw new TypeError("You must supply a name when creating a logger.");var q=He[w];return q||(q=He[w]=new be(w,ke.getLevel(),ke.methodFactory)),q};var Z=typeof window!==ue?window.log:void 0;return ke.noConflict=function(){return typeof window!==ue&&window.log===ke&&(window.log=Z),ke},ke.getLoggers=function(){return He},ke.default=ke,ke},(R=typeof M=="function"?M.call(b,L,b,g):M)===void 0||(g.exports=R)})()},375:function(g,b){"use strict";var L=Object.prototype.hasOwnProperty;function M(y){try{return decodeURIComponent(y.replace(/\+/g," "))}catch{return null}}function R(y){try{return encodeURIComponent(y)}catch{return null}}b.stringify=function(y,P){P=P||"";var O,ue,Q=[];for(ue in typeof P!="string"&&(P="?"),y)if(L.call(y,ue)){if((O=y[ue])||O!=null&&!isNaN(O)||(O=""),ue=R(ue),O=R(O),ue===null||O===null)continue;Q.push(ue+"="+O)}return Q.length?P+Q.join("&"):""},b.parse=function(y){for(var P,O=/([^=?#&]+)=?([^&]*)/g,ue={};P=O.exec(y);){var Q=M(P[1]),de=M(P[2]);Q===null||de===null||Q in ue||(ue[Q]=de)}return ue}},558:function(){}},d={};function v(g){var b=d[g];if(b!==void 0)return b.exports;var L=d[g]={exports:{}};return i[g].call(L.exports,L,L.exports,v),L.exports}return v.n=function(g){var b=g&&g.__esModule?function(){return g.default}:function(){return g};return v.d(b,{a:b}),b},v.d=function(g,b){for(var L in b)v.o(b,L)&&!v.o(g,L)&&Object.defineProperty(g,L,{enumerable:!0,get:b[L]})},v.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),v.o=function(g,b){return Object.prototype.hasOwnProperty.call(g,b)},v(80)}()},typeof Ko=="object"&&typeof dd=="object"?dd.exports=t():typeof Ko=="object"?Ko.mux=t():a.mux=t()})()});var Bh=sc((Ts,cd)=>{typeof window!="undefined"&&function(a,t){typeof Ts=="object"&&typeof cd=="object"?cd.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Ts=="object"?Ts.Hls=t():a.Hls=t()}(Ts,()=>(()=>{var a={21:(v,g,b)=>{"use strict";b.r(g),b.d(g,{default:()=>ue});var L=function(){function Q(de,he){this.subtle=void 0,this.aesIV=void 0,this.subtle=de,this.aesIV=he}return Q.prototype.decrypt=function(de,he){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},he,de)},Q}(),M=function(){function Q(de,he){this.subtle=void 0,this.key=void 0,this.subtle=de,this.key=he}return Q.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},Q}(),R=b(145),y=function(){function Q(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var de=Q.prototype;return de.uint8ArrayToUint32Array_=function(he){for(var Y=new DataView(he),pe=new Uint32Array(4),X=0;X<4;X++)pe[X]=Y.getUint32(4*X);return pe},de.initTable=function(){var he=this.sBox,Y=this.invSBox,pe=this.subMix,X=pe[0],oe=pe[1],z=pe[2],be=pe[3],ke=this.invSubMix,He=ke[0],Z=ke[1],w=ke[2],q=ke[3],N=new Uint32Array(256),fe=0,_e=0,te=0;for(te=0;te<256;te++)N[te]=te<128?te<<1:te<<1^283;for(te=0;te<256;te++){var re=_e^_e<<1^_e<<2^_e<<3^_e<<4;re=re>>>8^255&re^99,he[fe]=re,Y[re]=fe;var Re=N[fe],Pe=N[Re],Fe=N[Pe],Se=257*N[re]^16843008*re;X[fe]=Se<<24|Se>>>8,oe[fe]=Se<<16|Se>>>16,z[fe]=Se<<8|Se>>>24,be[fe]=Se,Se=16843009*Fe^65537*Pe^257*Re^16843008*fe,He[re]=Se<<24|Se>>>8,Z[re]=Se<<16|Se>>>16,w[re]=Se<<8|Se>>>24,q[re]=Se,fe?(fe=Re^N[N[N[Fe^Re]]],_e^=N[N[_e]]):fe=_e=1}},de.expandKey=function(he){for(var Y=this.uint8ArrayToUint32Array_(he),pe=!0,X=0;X<Y.length&&pe;)pe=Y[X]===this.key[X],X++;if(!pe){this.key=Y;var oe=this.keySize=Y.length;if(oe!==4&&oe!==6&&oe!==8)throw new Error("Invalid aes key size="+oe);var z,be,ke,He,Z=this.ksRows=4*(oe+6+1),w=this.keySchedule=new Uint32Array(Z),q=this.invKeySchedule=new Uint32Array(Z),N=this.sBox,fe=this.rcon,_e=this.invSubMix,te=_e[0],re=_e[1],Re=_e[2],Pe=_e[3];for(z=0;z<Z;z++)z<oe?ke=w[z]=Y[z]:(He=ke,z%oe==0?(He=N[(He=He<<8|He>>>24)>>>24]<<24|N[He>>>16&255]<<16|N[He>>>8&255]<<8|N[255&He],He^=fe[z/oe|0]<<24):oe>6&&z%oe==4&&(He=N[He>>>24]<<24|N[He>>>16&255]<<16|N[He>>>8&255]<<8|N[255&He]),w[z]=ke=(w[z-oe]^He)>>>0);for(be=0;be<Z;be++)z=Z-be,He=3&be?w[z]:w[z-4],q[be]=be<4||z<=4?He:te[N[He>>>24]]^re[N[He>>>16&255]]^Re[N[He>>>8&255]]^Pe[N[255&He]],q[be]=q[be]>>>0}},de.networkToHostOrderSwap=function(he){return he<<24|(65280&he)<<8|(16711680&he)>>8|he>>>24},de.decrypt=function(he,Y,pe){for(var X,oe,z,be,ke,He,Z,w,q,N,fe,_e,te,re,Re=this.keySize+6,Pe=this.invKeySchedule,Fe=this.invSBox,Se=this.invSubMix,Ye=Se[0],ot=Se[1],le=Se[2],Ee=Se[3],U=this.uint8ArrayToUint32Array_(pe),ve=U[0],Le=U[1],Ne=U[2],Ue=U[3],Ge=new Int32Array(he),Te=new Int32Array(Ge.length),xe=this.networkToHostOrderSwap;Y<Ge.length;){for(q=xe(Ge[Y]),N=xe(Ge[Y+1]),fe=xe(Ge[Y+2]),_e=xe(Ge[Y+3]),ke=q^Pe[0],He=_e^Pe[1],Z=fe^Pe[2],w=N^Pe[3],te=4,re=1;re<Re;re++)X=Ye[ke>>>24]^ot[He>>16&255]^le[Z>>8&255]^Ee[255&w]^Pe[te],oe=Ye[He>>>24]^ot[Z>>16&255]^le[w>>8&255]^Ee[255&ke]^Pe[te+1],z=Ye[Z>>>24]^ot[w>>16&255]^le[ke>>8&255]^Ee[255&He]^Pe[te+2],be=Ye[w>>>24]^ot[ke>>16&255]^le[He>>8&255]^Ee[255&Z]^Pe[te+3],ke=X,He=oe,Z=z,w=be,te+=4;X=Fe[ke>>>24]<<24^Fe[He>>16&255]<<16^Fe[Z>>8&255]<<8^Fe[255&w]^Pe[te],oe=Fe[He>>>24]<<24^Fe[Z>>16&255]<<16^Fe[w>>8&255]<<8^Fe[255&ke]^Pe[te+1],z=Fe[Z>>>24]<<24^Fe[w>>16&255]<<16^Fe[ke>>8&255]<<8^Fe[255&He]^Pe[te+2],be=Fe[w>>>24]<<24^Fe[ke>>16&255]<<16^Fe[He>>8&255]<<8^Fe[255&Z]^Pe[te+3],Te[Y]=xe(X^ve),Te[Y+1]=xe(be^Le),Te[Y+2]=xe(z^Ne),Te[Y+3]=xe(oe^Ue),ve=q,Le=N,Ne=fe,Ue=_e,Y+=4}return Te.buffer},Q}(),P=b(93),O=b(63),ue=function(){function Q(he,Y){var pe=(Y===void 0?{}:Y).removePKCS7Padding,X=pe===void 0||pe;if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=he.enableSoftwareAES,this.removePKCS7Padding=X,X)try{var oe=self.crypto;oe&&(this.subtle=oe.subtle||oe.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}var de=Q.prototype;return de.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},de.isSync=function(){return this.useSoftware},de.flush=function(){var he=this.currentResult,Y=this.remainderData;if(!he||Y)return P.logger.error("[softwareDecrypt] "+(Y?"overflow bytes: "+Y.byteLength:"no result")),this.reset(),null;var pe,X,oe,z=new Uint8Array(he);return this.reset(),this.removePKCS7Padding?(oe=(X=(pe=z).byteLength)&&new DataView(pe.buffer).getUint8(X-1))?(0,R.sliceUint8)(pe,0,X-oe):pe:z},de.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},de.decrypt=function(he,Y,pe){var X=this;return this.useSoftware?new Promise(function(oe,z){X.softwareDecrypt(new Uint8Array(he),Y,pe);var be=X.flush();be?oe(be.buffer):z(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(he),Y,pe)},de.softwareDecrypt=function(he,Y,pe){var X=this.currentIV,oe=this.currentResult,z=this.remainderData;this.logOnce("JS AES decrypt"),z&&(he=(0,O.appendUint8Array)(z,he),this.remainderData=null);var be=this.getValidChunk(he);if(!be.length)return null;X&&(pe=X);var ke=this.softwareDecrypter;ke||(ke=this.softwareDecrypter=new y),ke.expandKey(Y);var He=oe;return this.currentResult=ke.decrypt(be.buffer,0,pe),this.currentIV=(0,R.sliceUint8)(be,-16).buffer,He||null},de.webCryptoDecrypt=function(he,Y,pe){var X=this,oe=this.subtle;return this.key===Y&&this.fastAesKey||(this.key=Y,this.fastAesKey=new M(oe,Y)),this.fastAesKey.expandKey().then(function(z){return oe?(X.logOnce("WebCrypto AES decrypt"),new L(oe,new Uint8Array(pe)).decrypt(he.buffer,z)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(z){return P.logger.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+z.name+": "+z.message),X.onWebCryptoError(he,Y,pe)})},de.onWebCryptoError=function(he,Y,pe){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(he,Y,pe);var X=this.flush();if(X)return X.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},de.getValidChunk=function(he){var Y=he,pe=he.length-he.length%16;return pe!==he.length&&(Y=(0,R.sliceUint8)(he,0,pe),this.remainderData=(0,R.sliceUint8)(he,pe)),Y},de.logOnce=function(he){this.logEnabled&&(P.logger.log("[decrypter]: "+he),this.logEnabled=!1)},Q}()},181:(v,g,b)=>{"use strict";b.r(g),b.d(g,{canParse:()=>O,decodeFrame:()=>Y,getID3Data:()=>y,getID3Frames:()=>he,getTimeStamp:()=>ue,isFooter:()=>R,isHeader:()=>M,isTimeStampFrame:()=>Q,testables:()=>ke,utf8ArrayToStr:()=>be});var L,M=function(Z,w){return w+10<=Z.length&&Z[w]===73&&Z[w+1]===68&&Z[w+2]===51&&Z[w+3]<255&&Z[w+4]<255&&Z[w+6]<128&&Z[w+7]<128&&Z[w+8]<128&&Z[w+9]<128},R=function(Z,w){return w+10<=Z.length&&Z[w]===51&&Z[w+1]===68&&Z[w+2]===73&&Z[w+3]<255&&Z[w+4]<255&&Z[w+6]<128&&Z[w+7]<128&&Z[w+8]<128&&Z[w+9]<128},y=function(Z,w){for(var q=w,N=0;M(Z,w);)N+=10,N+=P(Z,w+6),R(Z,w+10)&&(N+=10),w+=N;if(N>0)return Z.subarray(q,q+N)},P=function(Z,w){var q=0;return q=(127&Z[w])<<21,q|=(127&Z[w+1])<<14,(q|=(127&Z[w+2])<<7)|127&Z[w+3]},O=function(Z,w){return M(Z,w)&&P(Z,w+6)+10<=Z.length-w},ue=function(Z){for(var w=he(Z),q=0;q<w.length;q++){var N=w[q];if(Q(N))return z(N)}},Q=function(Z){return Z&&Z.key==="PRIV"&&Z.info==="com.apple.streaming.transportStreamTimestamp"},de=function(Z){var w=String.fromCharCode(Z[0],Z[1],Z[2],Z[3]),q=P(Z,4);return{type:w,size:q,data:Z.subarray(10,10+q)}},he=function(Z){for(var w=0,q=[];M(Z,w);){for(var N=P(Z,w+6),fe=(w+=10)+N;w+8<fe;){var _e=de(Z.subarray(w)),te=Y(_e);te&&q.push(te),w+=_e.size+10}R(Z,w)&&(w+=10)}return q},Y=function(Z){return Z.type==="PRIV"?pe(Z):Z.type[0]==="W"?oe(Z):X(Z)},pe=function(Z){if(!(Z.size<2)){var w=be(Z.data,!0),q=new Uint8Array(Z.data.subarray(w.length+1));return{key:Z.type,info:w,data:q.buffer}}},X=function(Z){if(!(Z.size<2)){if(Z.type==="TXXX"){var w=1,q=be(Z.data.subarray(w),!0);w+=q.length+1;var N=be(Z.data.subarray(w));return{key:Z.type,info:q,data:N}}var fe=be(Z.data.subarray(1));return{key:Z.type,data:fe}}},oe=function(Z){if(Z.type==="WXXX"){if(Z.size<2)return;var w=1,q=be(Z.data.subarray(w),!0);w+=q.length+1;var N=be(Z.data.subarray(w));return{key:Z.type,info:q,data:N}}var fe=be(Z.data);return{key:Z.type,data:fe}},z=function(Z){if(Z.data.byteLength===8){var w=new Uint8Array(Z.data),q=1&w[3],N=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return N/=45,q&&(N+=4772185884e-2),Math.round(N)}},be=function(Z,w){w===void 0&&(w=!1);var q=He();if(q){var N=q.decode(Z);if(w){var fe=N.indexOf("\0");return fe!==-1?N.substring(0,fe):N}return N.replace(/\0/g,"")}for(var _e,te,re,Re=Z.length,Pe="",Fe=0;Fe<Re;){if((_e=Z[Fe++])===0&&w)return Pe;if(_e!==0&&_e!==3)switch(_e>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:Pe+=String.fromCharCode(_e);break;case 12:case 13:te=Z[Fe++],Pe+=String.fromCharCode((31&_e)<<6|63&te);break;case 14:te=Z[Fe++],re=Z[Fe++],Pe+=String.fromCharCode((15&_e)<<12|(63&te)<<6|(63&re)<<0)}}return Pe},ke={decodeTextFrame:X};function He(){return L||self.TextDecoder===void 0||(L=new self.TextDecoder("utf-8")),L}},182:(v,g,b)=>{"use strict";b.r(g),b.d(g,{default:()=>O});var L=b(544),M=b(851),R=b(93),y=b(729),P=b(973);function O(he){var Y=new y.EventEmitter,pe=function(X,oe){he.postMessage({event:X,data:oe})};Y.on(M.Events.FRAG_DECRYPTED,pe),Y.on(M.Events.ERROR,pe),he.addEventListener("message",function(X){var oe=X.data;switch(oe.cmd){case"init":var z=JSON.parse(oe.config);he.transmuxer=new L.default(Y,oe.typeSupported,z,oe.vendor,oe.id),(0,R.enableLogs)(z.debug,oe.id),function(){var Z=function(q){R.logger[q]=function(N){pe("workerLog",{logType:q,message:N})}};for(var w in R.logger)Z(w)}(),pe("init",null);break;case"configure":he.transmuxer.configure(oe.config);break;case"demux":var be=he.transmuxer.push(oe.data,oe.decryptdata,oe.chunkMeta,oe.state);(0,L.isPromise)(be)?(he.transmuxer.async=!0,be.then(function(Z){ue(he,Z)}).catch(function(Z){pe(M.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:oe.chunkMeta,fatal:!1,error:Z,err:Z,reason:"transmuxer-worker push error"})})):(he.transmuxer.async=!1,ue(he,be));break;case"flush":var ke=oe.chunkMeta,He=he.transmuxer.flush(ke);(0,L.isPromise)(He)||he.transmuxer.async?((0,L.isPromise)(He)||(He=Promise.resolve(He)),He.then(function(Z){de(he,Z,ke)}).catch(function(Z){pe(M.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:oe.chunkMeta,fatal:!1,error:Z,err:Z,reason:"transmuxer-worker flush error"})})):de(he,He,ke)}})}function ue(he,Y){if(!((pe=Y.remuxResult).audio||pe.video||pe.text||pe.id3||pe.initSegment))return!1;var pe,X=[],oe=Y.remuxResult,z=oe.audio,be=oe.video;return z&&Q(X,z),be&&Q(X,be),he.postMessage({event:"transmuxComplete",data:Y},X),!0}function Q(he,Y){Y.data1&&he.push(Y.data1.buffer),Y.data2&&he.push(Y.data2.buffer)}function de(he,Y,pe){Y.reduce(function(X,oe){return ue(he,oe)||X},!1)||he.postMessage({event:"transmuxComplete",data:Y[0]}),he.postMessage({event:"flush",data:pe})}},544:(v,g,b)=>{"use strict";b.r(g),b.d(g,{TransmuxConfig:()=>Qt,TransmuxState:()=>Fr,default:()=>Vt,isPromise:()=>vr});var L=b(851),M=b(973),R=b(21),y=b(965),P=b(181),O=b(856);function ue(se,j){return se===void 0&&(se=""),j===void 0&&(j=9e4),{type:se,id:-1,pid:-1,inputTimeScale:j,sequenceNumber:-1,samples:[],dropped:0}}var Q=b(63),de=b(145),he=function(){function se(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var j=se.prototype;return j.resetInitSegment=function(I,G,H,$){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},j.resetTimeStamp=function(I){this.initPTS=I,this.resetContiguity()},j.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},j.canParse=function(I,G){return!1},j.appendFrame=function(I,G,H){},j.demux=function(I,G){this.cachedData&&(I=(0,Q.appendUint8Array)(this.cachedData,I),this.cachedData=null);var H,$=P.getID3Data(I,0),ie=$?$.length:0,ae=this._audioTrack,Ae=this._id3Track,Ce=$?P.getTimeStamp($):void 0,Oe=I.length;for((this.basePTS===null||this.frameIndex===0&&(0,y.isFiniteNumber)(Ce))&&(this.basePTS=Y(Ce,G,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),$&&$.length>0&&Ae.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:$,type:O.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});ie<Oe;){if(this.canParse(I,ie)){var Ke=this.appendFrame(ae,I,ie);Ke?(this.frameIndex++,this.lastPTS=Ke.sample.pts,H=ie+=Ke.length):ie=Oe}else P.canParse(I,ie)?($=P.getID3Data(I,ie),Ae.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:$,type:O.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY}),H=ie+=$.length):ie++;if(ie===Oe&&H!==Oe){var Qe=(0,de.sliceUint8)(I,H);this.cachedData?this.cachedData=(0,Q.appendUint8Array)(this.cachedData,Qe):this.cachedData=Qe}}return{audioTrack:ae,videoTrack:ue(),id3Track:Ae,textTrack:ue()}},j.demuxSampleAes=function(I,G,H){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},j.flush=function(I){var G=this.cachedData;return G&&(this.cachedData=null,this.demux(G,0)),{audioTrack:this._audioTrack,videoTrack:ue(),id3Track:this._id3Track,textTrack:ue()}},j.destroy=function(){},se}(),Y=function(se,j,I){return(0,y.isFiniteNumber)(se)?90*se:9e4*j+(I||0)};let pe=he;var X=b(93);function oe(se,j){return se[j]===255&&(246&se[j+1])==240}function z(se,j){return 1&se[j+1]?7:9}function be(se,j){return(3&se[j+3])<<11|se[j+4]<<3|(224&se[j+5])>>>5}function ke(se,j){return j+1<se.length&&oe(se,j)}function He(se,j){if(ke(se,j)){var I=z(se,j);if(j+I>=se.length)return!1;var G=be(se,j);if(G<=I)return!1;var H=j+G;return H===se.length||ke(se,H)}return!1}function Z(se,j,I,G,H){if(!se.samplerate){var $=function(ie,ae,Ae,Ce){var Oe,Ke,Qe,We,at=navigator.userAgent.toLowerCase(),Et=Ce,Ot=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Oe=1+((192&ae[Ae+2])>>>6);var Ze=(60&ae[Ae+2])>>>2;if(!(Ze>Ot.length-1))return Qe=(1&ae[Ae+2])<<2,Qe|=(192&ae[Ae+3])>>>6,X.logger.log("manifest codec:"+Ce+", ADTS type:"+Oe+", samplingIndex:"+Ze),/firefox/i.test(at)?Ze>=6?(Oe=5,We=new Array(4),Ke=Ze-3):(Oe=2,We=new Array(2),Ke=Ze):at.indexOf("android")!==-1?(Oe=2,We=new Array(2),Ke=Ze):(Oe=5,We=new Array(4),Ce&&(Ce.indexOf("mp4a.40.29")!==-1||Ce.indexOf("mp4a.40.5")!==-1)||!Ce&&Ze>=6?Ke=Ze-3:((Ce&&Ce.indexOf("mp4a.40.2")!==-1&&(Ze>=6&&Qe===1||/vivaldi/i.test(at))||!Ce&&Qe===1)&&(Oe=2,We=new Array(2)),Ke=Ze)),We[0]=Oe<<3,We[0]|=(14&Ze)>>1,We[1]|=(1&Ze)<<7,We[1]|=Qe<<3,Oe===5&&(We[1]|=(14&Ke)>>1,We[2]=(1&Ke)<<7,We[2]|=8,We[3]=0),{config:We,samplerate:Ot[Ze],channelCount:Qe,codec:"mp4a.40."+Oe,manifestCodec:Et};ie.trigger(L.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+Ze})}(j,I,G,H);if(!$)return;se.config=$.config,se.samplerate=$.samplerate,se.channelCount=$.channelCount,se.codec=$.codec,se.manifestCodec=$.manifestCodec,X.logger.log("parsed codec:"+se.codec+", rate:"+$.samplerate+", channels:"+$.channelCount)}}function w(se){return 9216e4/se}function q(se,j,I,G,H){var $,ie=G+H*w(se.samplerate),ae=function(at,Et){var Ot=z(at,Et);if(Et+Ot<=at.length){var Ze=be(at,Et)-Ot;if(Ze>0)return{headerLength:Ot,frameLength:Ze}}}(j,I);if(ae){var Ae=ae.frameLength,Ce=ae.headerLength,Oe=Ce+Ae,Ke=Math.max(0,I+Oe-j.length);Ke?($=new Uint8Array(Oe-Ce)).set(j.subarray(I+Ce,j.length),0):$=j.subarray(I+Ce,I+Oe);var Qe={unit:$,pts:ie};return Ke||se.samples.push(Qe),{sample:Qe,length:Oe,missing:Ke}}var We=j.length-I;return($=new Uint8Array(We)).set(j.subarray(I,j.length),0),{sample:{unit:$,pts:ie},length:We,missing:-1}}function N(se,j){return N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(I,G){return I.__proto__=G,I},N(se,j)}let fe=function(se){var j,I;function G($,ie){var ae;return(ae=se.call(this)||this).observer=void 0,ae.config=void 0,ae.observer=$,ae.config=ie,ae}I=se,(j=G).prototype=Object.create(I.prototype),j.prototype.constructor=j,N(j,I);var H=G.prototype;return H.resetInitSegment=function($,ie,ae,Ae){se.prototype.resetInitSegment.call(this,$,ie,ae,Ae),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:ie,duration:Ae,inputTimeScale:9e4,dropped:0}},G.probe=function($){if(!$)return!1;for(var ie=(P.getID3Data($,0)||[]).length,ae=$.length;ie<ae;ie++)if(He($,ie))return X.logger.log("ADTS sync word found !"),!0;return!1},H.canParse=function($,ie){return function(ae,Ae){return function(Ce,Oe){return Oe+5<Ce.length}(ae,Ae)&&oe(ae,Ae)&&be(ae,Ae)<=ae.length-Ae}($,ie)},H.appendFrame=function($,ie,ae){Z($,this.observer,ie,ae,$.manifestCodec);var Ae=q($,ie,ae,this.basePTS,this.frameIndex);if(Ae&&Ae.missing===0)return Ae},G}(pe);var _e=/\/emsg[-/]ID3/i;let te=function(){function se(I,G){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=G}var j=se.prototype;return j.resetTimeStamp=function(){},j.resetInitSegment=function(I,G,H,$){var ie=this.videoTrack=ue("video",1),ae=this.audioTrack=ue("audio",1),Ae=this.txtTrack=ue("text",1);if(this.id3Track=ue("id3",1),this.timeOffset=0,I&&I.byteLength){var Ce=(0,Q.parseInitSegment)(I);if(Ce.video){var Oe=Ce.video,Ke=Oe.id,Qe=Oe.timescale,We=Oe.codec;ie.id=Ke,ie.timescale=Ae.timescale=Qe,ie.codec=We}if(Ce.audio){var at=Ce.audio,Et=at.id,Ot=at.timescale,Ze=at.codec;ae.id=Et,ae.timescale=Ot,ae.codec=Ze}Ae.id=Q.RemuxerTrackIdConfig.text,ie.sampleDuration=0,ie.duration=ae.duration=$}},j.resetContiguity=function(){},se.probe=function(I){return I=I.length>16384?I.subarray(0,16384):I,(0,Q.findBox)(I,["moof"]).length>0},j.demux=function(I,G){this.timeOffset=G;var H=I,$=this.videoTrack,ie=this.txtTrack;if(this.config.progressive){this.remainderData&&(H=(0,Q.appendUint8Array)(this.remainderData,I));var ae=(0,Q.segmentValidRange)(H);this.remainderData=ae.remainder,$.samples=ae.valid||new Uint8Array}else $.samples=H;var Ae=this.extractID3Track($,G);return ie.samples=(0,Q.parseSamples)(G,$),{videoTrack:$,audioTrack:this.audioTrack,id3Track:Ae,textTrack:this.txtTrack}},j.flush=function(){var I=this.timeOffset,G=this.videoTrack,H=this.txtTrack;G.samples=this.remainderData||new Uint8Array,this.remainderData=null;var $=this.extractID3Track(G,this.timeOffset);return H.samples=(0,Q.parseSamples)(I,G),{videoTrack:G,audioTrack:ue(),id3Track:$,textTrack:ue()}},j.extractID3Track=function(I,G){var H=this.id3Track;if(I.samples.length){var $=(0,Q.findBox)(I.samples,["emsg"]);$&&$.forEach(function(ie){var ae=(0,Q.parseEmsg)(ie);if(_e.test(ae.schemeIdUri)){var Ae=(0,y.isFiniteNumber)(ae.presentationTime)?ae.presentationTime/ae.timeScale:G+ae.presentationTimeDelta/ae.timeScale,Ce=ae.eventDuration===4294967295?Number.POSITIVE_INFINITY:ae.eventDuration/ae.timeScale;Ce<=.001&&(Ce=Number.POSITIVE_INFINITY);var Oe=ae.payload;H.samples.push({data:Oe,len:Oe.byteLength,dts:Ae,pts:Ae,type:O.MetadataSchema.emsg,duration:Ce})}})}return H},j.demuxSampleAes=function(I,G,H){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},j.destroy=function(){},se}();var re=null,Re=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Pe=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Fe=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Se=[0,1,1,4];function Ye(se,j,I,G,H){if(!(I+24>j.length)){var $=ot(j,I);if($&&I+$.frameLength<=j.length){var ie=G+H*(9e4*$.samplesPerFrame/$.sampleRate),ae={unit:j.subarray(I,I+$.frameLength),pts:ie,dts:ie};return se.config=[],se.channelCount=$.channelCount,se.samplerate=$.sampleRate,se.samples.push(ae),{sample:ae,length:$.frameLength,missing:0}}}}function ot(se,j){var I=se[j+1]>>3&3,G=se[j+1]>>1&3,H=se[j+2]>>4&15,$=se[j+2]>>2&3;if(I!==1&&H!==0&&H!==15&&$!==3){var ie=se[j+2]>>1&1,ae=se[j+3]>>6,Ae=1e3*Re[14*(I===3?3-G:G===3?3:4)+H-1],Ce=Pe[3*(I===3?0:I===2?1:2)+$],Oe=ae===3?1:2,Ke=Fe[I][G],Qe=Se[G],We=8*Ke*Qe,at=Math.floor(Ke*Ae/Ce+ie)*Qe;if(re===null){var Et=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);re=Et?parseInt(Et[1]):0}return!!re&&re<=87&&G===2&&Ae>=224e3&&ae===0&&(se[j+3]=128|se[j+3]),{sampleRate:Ce,channelCount:Oe,frameLength:at,samplesPerFrame:We}}}function le(se,j){return se[j]===255&&(224&se[j+1])==224&&(6&se[j+1])!=0}function Ee(se,j){return j+1<se.length&&le(se,j)}function U(se,j){if(j+1<se.length&&le(se,j)){var I=ot(se,j),G=4;I!=null&&I.frameLength&&(G=I.frameLength);var H=j+G;return H===se.length||Ee(se,H)}return!1}let ve=function(){function se(I){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=I,this.bytesAvailable=I.byteLength,this.word=0,this.bitsAvailable=0}var j=se.prototype;return j.loadWord=function(){var I=this.data,G=this.bytesAvailable,H=I.byteLength-G,$=new Uint8Array(4),ie=Math.min(4,G);if(ie===0)throw new Error("no bytes available");$.set(I.subarray(H,H+ie)),this.word=new DataView($.buffer).getUint32(0),this.bitsAvailable=8*ie,this.bytesAvailable-=ie},j.skipBits=function(I){var G;I=Math.min(I,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>I?(this.word<<=I,this.bitsAvailable-=I):(I-=this.bitsAvailable,I-=(G=I>>3)<<3,this.bytesAvailable-=G,this.loadWord(),this.word<<=I,this.bitsAvailable-=I)},j.readBits=function(I){var G=Math.min(this.bitsAvailable,I),H=this.word>>>32-G;if(I>32&&X.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=G,this.bitsAvailable>0)this.word<<=G;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(G=I-G)>0&&this.bitsAvailable?H<<G|this.readBits(G):H},j.skipLZ=function(){var I;for(I=0;I<this.bitsAvailable;++I)if((this.word&2147483648>>>I)!=0)return this.word<<=I,this.bitsAvailable-=I,I;return this.loadWord(),I+this.skipLZ()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var I=this.skipLZ();return this.readBits(I+1)-1},j.readEG=function(){var I=this.readUEG();return 1&I?1+I>>>1:-1*(I>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(I){for(var G=8,H=8,$=0;$<I;$++)H!==0&&(H=(G+this.readEG()+256)%256),G=H===0?G:H},j.readSPS=function(){var I,G,H,$=0,ie=0,ae=0,Ae=0,Ce=this.readUByte.bind(this),Oe=this.readBits.bind(this),Ke=this.readUEG.bind(this),Qe=this.readBoolean.bind(this),We=this.skipBits.bind(this),at=this.skipEG.bind(this),Et=this.skipUEG.bind(this),Ot=this.skipScalingList.bind(this);Ce();var Ze=Ce();if(Oe(5),We(3),Ce(),Et(),Ze===100||Ze===110||Ze===122||Ze===244||Ze===44||Ze===83||Ze===86||Ze===118||Ze===128){var Ht=Ke();if(Ht===3&&We(1),Et(),Et(),We(1),Qe())for(G=Ht!==3?8:12,H=0;H<G;H++)Qe()&&Ot(H<6?16:64)}Et();var gr=Ke();if(gr===0)Ke();else if(gr===1)for(We(1),at(),at(),I=Ke(),H=0;H<I;H++)at();Et(),We(1);var Yt=Ke(),jt=Ke(),Xt=Oe(1);Xt===0&&We(1),We(1),Qe()&&($=Ke(),ie=Ke(),ae=Ke(),Ae=Ke());var ut=[1,1];if(Qe()&&Qe())switch(Ce()){case 1:ut=[1,1];break;case 2:ut=[12,11];break;case 3:ut=[10,11];break;case 4:ut=[16,11];break;case 5:ut=[40,33];break;case 6:ut=[24,11];break;case 7:ut=[20,11];break;case 8:ut=[32,11];break;case 9:ut=[80,33];break;case 10:ut=[18,11];break;case 11:ut=[15,11];break;case 12:ut=[64,33];break;case 13:ut=[160,99];break;case 14:ut=[4,3];break;case 15:ut=[3,2];break;case 16:ut=[2,1];break;case 255:ut=[Ce()<<8|Ce(),Ce()<<8|Ce()]}return{width:Math.ceil(16*(Yt+1)-2*$-2*ie),height:(2-Xt)*(jt+1)*16-(Xt?2:4)*(ae+Ae),pixelRatio:ut}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},se}(),Le=function(){function se(I,G,H){this.keyData=void 0,this.decrypter=void 0,this.keyData=H,this.decrypter=new R.default(G,{removePKCS7Padding:!1})}var j=se.prototype;return j.decryptBuffer=function(I){return this.decrypter.decrypt(I,this.keyData.key.buffer,this.keyData.iv.buffer)},j.decryptAacSample=function(I,G,H){var $=this,ie=I[G].unit;if(!(ie.length<=16)){var ae=ie.subarray(16,ie.length-ie.length%16),Ae=ae.buffer.slice(ae.byteOffset,ae.byteOffset+ae.length);this.decryptBuffer(Ae).then(function(Ce){var Oe=new Uint8Array(Ce);ie.set(Oe,16),$.decrypter.isSync()||$.decryptAacSamples(I,G+1,H)})}},j.decryptAacSamples=function(I,G,H){for(;;G++){if(G>=I.length)return void H();if(!(I[G].unit.length<32||(this.decryptAacSample(I,G,H),this.decrypter.isSync())))return}},j.getAvcEncryptedData=function(I){for(var G=16*Math.floor((I.length-48)/160)+16,H=new Int8Array(G),$=0,ie=32;ie<I.length-16;ie+=160,$+=16)H.set(I.subarray(ie,ie+16),$);return H},j.getAvcDecryptedUnit=function(I,G){for(var H=new Uint8Array(G),$=0,ie=32;ie<I.length-16;ie+=160,$+=16)I.set(H.subarray($,$+16),ie);return I},j.decryptAvcSample=function(I,G,H,$,ie){var ae=this,Ae=(0,Q.discardEPB)(ie.data),Ce=this.getAvcEncryptedData(Ae);this.decryptBuffer(Ce.buffer).then(function(Oe){ie.data=ae.getAvcDecryptedUnit(Ae,Oe),ae.decrypter.isSync()||ae.decryptAvcSamples(I,G,H+1,$)})},j.decryptAvcSamples=function(I,G,H,$){if(I instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;G++,H=0){if(G>=I.length)return void $();for(var ie=I[G].units;!(H>=ie.length);H++){var ae=ie[H];if(!(ae.data.length<=48||ae.type!==1&&ae.type!==5||(this.decryptAvcSample(I,G,H,$,ae),this.decrypter.isSync())))return}}},se}();function Ne(){return Ne=Object.assign?Object.assign.bind():function(se){for(var j=1;j<arguments.length;j++){var I=arguments[j];for(var G in I)Object.prototype.hasOwnProperty.call(I,G)&&(se[G]=I[G])}return se},Ne.apply(this,arguments)}var Ue=188;function Ge(se,j,I,G){return{key:se,frame:!1,pts:j,dts:I,units:[],debug:G,length:0}}function Te(se,j){return(31&se[j+10])<<8|se[j+11]}function xe(se,j,I,G){var H={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},$=j+3+((15&se[j+1])<<8|se[j+2])-4;for(j+=12+((15&se[j+10])<<8|se[j+11]);j<$;){var ie=(31&se[j+1])<<8|se[j+2];switch(se[j]){case 207:if(!G){X.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:H.audio===-1&&(H.audio=ie);break;case 21:H.id3===-1&&(H.id3=ie);break;case 219:if(!G){X.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:H.avc===-1&&(H.avc=ie);break;case 3:case 4:I.mpeg!==!0&&I.mp3!==!0?X.logger.log("MPEG audio found, not supported in this browser"):H.audio===-1&&(H.audio=ie,H.segmentCodec="mp3");break;case 36:X.logger.warn("Unsupported HEVC stream type found")}j+=5+((15&se[j+3])<<8|se[j+4])}return H}function $e(se){var j,I,G,H,$,ie=0,ae=se.data;if(!se||se.size===0)return null;for(;ae[0].length<19&&ae.length>1;){var Ae=new Uint8Array(ae[0].length+ae[1].length);Ae.set(ae[0]),Ae.set(ae[1],ae[0].length),ae[0]=Ae,ae.splice(1,1)}if(((j=ae[0])[0]<<16)+(j[1]<<8)+j[2]===1){if((I=(j[4]<<8)+j[5])&&I>se.size-6)return null;var Ce=j[7];192&Ce&&(H=536870912*(14&j[9])+4194304*(255&j[10])+16384*(254&j[11])+128*(255&j[12])+(254&j[13])/2,64&Ce?H-($=536870912*(14&j[14])+4194304*(255&j[15])+16384*(254&j[16])+128*(255&j[17])+(254&j[18])/2)>54e5&&(X.logger.warn(Math.round((H-$)/9e4)+"s delta between PTS and DTS, align them"),H=$):$=H);var Oe=(G=j[8])+9;if(se.size<=Oe)return null;se.size-=Oe;for(var Ke=new Uint8Array(se.size),Qe=0,We=ae.length;Qe<We;Qe++){var at=(j=ae[Qe]).byteLength;if(Oe){if(Oe>at){Oe-=at;continue}j=j.subarray(Oe),at-=Oe,Oe=0}Ke.set(j,ie),ie+=at}return I&&(I-=G+3),{data:Ke,pts:H,dts:$,len:I}}return null}function rt(se,j){if(se.units.length&&se.frame){if(se.pts===void 0){var I=j.samples,G=I.length;if(!G)return void j.dropped++;var H=I[G-1];se.pts=H.pts,se.dts=H.dts}j.samples.push(se)}se.debug.length&&X.logger.log(se.pts+"/"+se.dts+":"+se.debug)}let _t=function(){function se(I,G,H){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=I,this.config=G,this.typeSupported=H}se.probe=function(I){var G=se.syncOffset(I);return G>0&&X.logger.warn("MPEG2-TS detected but first sync word found @ offset "+G),G!==-1},se.syncOffset=function(I){for(var G=Math.min(940,I.length-376)+1,H=0;H<G;){if(I[H]===71&&I[H+Ue]===71)return H;H++}return-1},se.createTrack=function(I,G){return{container:I==="video"||I==="audio"?"video/mp2t":void 0,type:I,id:Q.RemuxerTrackIdConfig[I],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:I==="audio"?G:void 0}};var j=se.prototype;return j.resetInitSegment=function(I,G,H,$){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=se.createTrack("video"),this._audioTrack=se.createTrack("audio",$),this._id3Track=se.createTrack("id3"),this._txtTrack=se.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=G,this.videoCodec=H,this._duration=$},j.resetTimeStamp=function(){},j.resetContiguity=function(){var I=this._audioTrack,G=this._avcTrack,H=this._id3Track;I&&(I.pesData=null),G&&(G.pesData=null),H&&(H.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},j.demux=function(I,G,H,$){var ie;H===void 0&&(H=!1),$===void 0&&($=!1),H||(this.sampleAes=null);var ae=this._avcTrack,Ae=this._audioTrack,Ce=this._id3Track,Oe=this._txtTrack,Ke=ae.pid,Qe=ae.pesData,We=Ae.pid,at=Ce.pid,Et=Ae.pesData,Ot=Ce.pesData,Ze=null,Ht=this.pmtParsed,gr=this._pmtId,Yt=I.length;if(this.remainderData&&(Yt=(I=(0,Q.appendUint8Array)(this.remainderData,I)).length,this.remainderData=null),Yt<Ue&&!$)return this.remainderData=I,{audioTrack:Ae,videoTrack:ae,id3Track:Ce,textTrack:Oe};var jt=Math.max(0,se.syncOffset(I));(Yt-=(Yt-jt)%Ue)<I.byteLength&&!$&&(this.remainderData=new Uint8Array(I.buffer,Yt,I.buffer.byteLength-Yt));for(var Xt=0,ut=jt;ut<Yt;ut+=Ue)if(I[ut]===71){var Lr=!!(64&I[ut+1]),ti=((31&I[ut+1])<<8)+I[ut+2],zt=void 0;if((48&I[ut+3])>>4>1){if((zt=ut+5+I[ut+4])===ut+Ue)continue}else zt=ut+4;switch(ti){case Ke:Lr&&(Qe&&(ie=$e(Qe))&&this.parseAVCPES(ae,Oe,ie,!1),Qe={data:[],size:0}),Qe&&(Qe.data.push(I.subarray(zt,ut+Ue)),Qe.size+=ut+Ue-zt);break;case We:if(Lr){if(Et&&(ie=$e(Et)))switch(Ae.segmentCodec){case"aac":this.parseAACPES(Ae,ie);break;case"mp3":this.parseMPEGPES(Ae,ie)}Et={data:[],size:0}}Et&&(Et.data.push(I.subarray(zt,ut+Ue)),Et.size+=ut+Ue-zt);break;case at:Lr&&(Ot&&(ie=$e(Ot))&&this.parseID3PES(Ce,ie),Ot={data:[],size:0}),Ot&&(Ot.data.push(I.subarray(zt,ut+Ue)),Ot.size+=ut+Ue-zt);break;case 0:Lr&&(zt+=I[zt]+1),gr=this._pmtId=Te(I,zt);break;case gr:Lr&&(zt+=I[zt]+1);var dr=xe(I,zt,this.typeSupported,H);(Ke=dr.avc)>0&&(ae.pid=Ke),(We=dr.audio)>0&&(Ae.pid=We,Ae.segmentCodec=dr.segmentCodec),(at=dr.id3)>0&&(Ce.pid=at),Ze===null||Ht||(X.logger.log("unknown PID '"+Ze+"' in TS found"),Ze=null,ut=jt-188),Ht=this.pmtParsed=!0;break;case 17:case 8191:break;default:Ze=ti}}else Xt++;Xt>0&&this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+Xt+" TS packet/s that do not start with 0x47"}),ae.pesData=Qe,Ae.pesData=Et,Ce.pesData=Ot;var Vr={audioTrack:Ae,videoTrack:ae,id3Track:Ce,textTrack:Oe};return $&&this.extractRemainingSamples(Vr),Vr},j.flush=function(){var I,G=this.remainderData;return this.remainderData=null,I=G?this.demux(G,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(I),this.sampleAes?this.decrypt(I,this.sampleAes):I},j.extractRemainingSamples=function(I){var G,H=I.audioTrack,$=I.videoTrack,ie=I.id3Track,ae=I.textTrack,Ae=$.pesData,Ce=H.pesData,Oe=ie.pesData;if(Ae&&(G=$e(Ae))?(this.parseAVCPES($,ae,G,!0),$.pesData=null):$.pesData=Ae,Ce&&(G=$e(Ce))){switch(H.segmentCodec){case"aac":this.parseAACPES(H,G);break;case"mp3":this.parseMPEGPES(H,G)}H.pesData=null}else Ce!=null&&Ce.size&&X.logger.log("last AAC PES packet truncated,might overlap between fragments"),H.pesData=Ce;Oe&&(G=$e(Oe))?(this.parseID3PES(ie,G),ie.pesData=null):ie.pesData=Oe},j.demuxSampleAes=function(I,G,H){var $=this.demux(I,H,!0,!this.config.progressive),ie=this.sampleAes=new Le(this.observer,this.config,G);return this.decrypt($,ie)},j.decrypt=function(I,G){return new Promise(function(H){var $=I.audioTrack,ie=I.videoTrack;$.samples&&$.segmentCodec==="aac"?G.decryptAacSamples($.samples,0,function(){ie.samples?G.decryptAvcSamples(ie.samples,0,0,function(){H(I)}):H(I)}):ie.samples&&G.decryptAvcSamples(ie.samples,0,0,function(){H(I)})})},j.destroy=function(){this._duration=0},j.parseAVCPES=function(I,G,H,$){var ie,ae=this,Ae=this.parseAVCNALu(I,H.data),Ce=this.avcSample,Oe=!1;H.data=null,Ce&&Ae.length&&!I.audFound&&(rt(Ce,I),Ce=this.avcSample=Ge(!1,H.pts,H.dts,"")),Ae.forEach(function(Ke){switch(Ke.type){case 1:ie=!0,Ce||(Ce=ae.avcSample=Ge(!0,H.pts,H.dts,"")),Ce.frame=!0;var Qe=Ke.data;if(Oe&&Qe.length>4){var We=new ve(Qe).readSliceType();We!==2&&We!==4&&We!==7&&We!==9||(Ce.key=!0)}break;case 5:ie=!0,Ce||(Ce=ae.avcSample=Ge(!0,H.pts,H.dts,"")),Ce.key=!0,Ce.frame=!0;break;case 6:ie=!0,(0,Q.parseSEIMessageFromNALu)(Ke.data,1,H.pts,G.samples);break;case 7:if(ie=!0,Oe=!0,!I.sps){var at=new ve(Ke.data).readSPS();I.width=at.width,I.height=at.height,I.pixelRatio=at.pixelRatio,I.sps=[Ke.data],I.duration=ae._duration;for(var Et=Ke.data.subarray(1,4),Ot="avc1.",Ze=0;Ze<3;Ze++){var Ht=Et[Ze].toString(16);Ht.length<2&&(Ht="0"+Ht),Ot+=Ht}I.codec=Ot}break;case 8:ie=!0,I.pps||(I.pps=[Ke.data]);break;case 9:ie=!1,I.audFound=!0,Ce&&rt(Ce,I),Ce=ae.avcSample=Ge(!1,H.pts,H.dts,"");break;case 12:ie=!0;break;default:ie=!1,Ce&&(Ce.debug+="unknown NAL "+Ke.type+" ")}Ce&&ie&&Ce.units.push(Ke)}),$&&Ce&&(rt(Ce,I),this.avcSample=null)},j.getLastNalUnit=function(I){var G,H,$=this.avcSample;if($&&$.units.length!==0||($=I[I.length-1]),(G=$)!==null&&G!==void 0&&G.units){var ie=$.units;H=ie[ie.length-1]}return H},j.parseAVCNALu=function(I,G){var H,$,ie=G.byteLength,ae=I.naluState||0,Ae=ae,Ce=[],Oe=0,Ke=-1,Qe=0;for(ae===-1&&(Ke=0,Qe=31&G[0],ae=0,Oe=1);Oe<ie;)if(H=G[Oe++],ae)if(ae!==1)if(H)if(H===1){if(Ke>=0){var We={data:G.subarray(Ke,Oe-ae-1),type:Qe};Ce.push(We)}else{var at=this.getLastNalUnit(I.samples);if(at&&(Ae&&Oe<=4-Ae&&at.state&&(at.data=at.data.subarray(0,at.data.byteLength-Ae)),($=Oe-ae-1)>0)){var Et=new Uint8Array(at.data.byteLength+$);Et.set(at.data,0),Et.set(G.subarray(0,$),at.data.byteLength),at.data=Et,at.state=0}}Oe<ie?(Ke=Oe,Qe=31&G[Oe],ae=0):ae=-1}else ae=0;else ae=3;else ae=H?0:2;else ae=H?0:1;if(Ke>=0&&ae>=0){var Ot={data:G.subarray(Ke,ie),type:Qe,state:ae};Ce.push(Ot)}if(Ce.length===0){var Ze=this.getLastNalUnit(I.samples);if(Ze){var Ht=new Uint8Array(Ze.data.byteLength+G.byteLength);Ht.set(Ze.data,0),Ht.set(G,Ze.data.byteLength),Ze.data=Ht}}return I.naluState=ae,Ce},j.parseAACPES=function(I,G){var H,$,ie,ae,Ae,Ce=0,Oe=this.aacOverFlow,Ke=G.data;if(Oe){this.aacOverFlow=null;var Qe=Oe.missing,We=Oe.sample.unit.byteLength;if(Qe===-1){var at=new Uint8Array(We+Ke.byteLength);at.set(Oe.sample.unit,0),at.set(Ke,We),Ke=at}else{var Et=We-Qe;Oe.sample.unit.set(Ke.subarray(0,Qe),Et),I.samples.push(Oe.sample),Ce=Oe.missing}}for(H=Ce,$=Ke.length;H<$-1&&!ke(Ke,H);H++);if(H===Ce||(H<$-1?(ie="AAC PES did not start with ADTS header,offset:"+H,ae=!1):(ie="no ADTS header found in AAC PES",ae=!0),X.logger.warn("parsing error:"+ie),this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:ae,reason:ie}),!ae)){if(Z(I,this.observer,Ke,H,this.audioCodec),G.pts!==void 0)Ae=G.pts;else{if(!Oe)return void X.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var Ot=w(I.samplerate);Ae=Oe.sample.pts+Ot}for(var Ze,Ht=0;H<$;){if(H+=(Ze=q(I,Ke,H,Ae,Ht)).length,Ze.missing){this.aacOverFlow=Ze;break}for(Ht++;H<$-1&&!ke(Ke,H);H++);}}},j.parseMPEGPES=function(I,G){var H=G.data,$=H.length,ie=0,ae=0,Ae=G.pts;if(Ae!==void 0)for(;ae<$;)if(Ee(H,ae)){var Ce=Ye(I,H,ae,Ae,ie);if(!Ce)break;ae+=Ce.length,ie++}else ae++;else X.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},j.parseID3PES=function(I,G){if(G.pts!==void 0){var H=Ne({},G,{type:this._avcTrack?O.MetadataSchema.emsg:O.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});I.samples.push(H)}else X.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},se}();function gt(se,j){return gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(I,G){return I.__proto__=G,I},gt(se,j)}let Lt=function(se){var j,I;function G(){return se.apply(this,arguments)||this}I=se,(j=G).prototype=Object.create(I.prototype),j.prototype.constructor=j,gt(j,I);var H=G.prototype;return H.resetInitSegment=function($,ie,ae,Ae){se.prototype.resetInitSegment.call(this,$,ie,ae,Ae),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:ie,duration:Ae,inputTimeScale:9e4,dropped:0}},G.probe=function($){if(!$)return!1;for(var ie=(P.getID3Data($,0)||[]).length,ae=$.length;ie<ae;ie++)if(U($,ie))return X.logger.log("MPEG Audio sync word found !"),!0;return!1},H.canParse=function($,ie){return function(ae,Ae){return le(ae,Ae)&&4<=ae.length-Ae}($,ie)},H.appendFrame=function($,ie,ae){if(this.basePTS!==null)return Ye($,ie,ae,this.basePTS,this.frameIndex)},G}(pe);var lt=b(524),wt=b(923);function Rt(se,j){var I=se==null?void 0:se.codec;return I&&I.length>4?I:I==="hvc1"||I==="hev1"?"hvc1.1.c.L120.90":I==="av01"?"av01.0.04M.08":I==="avc1"||j===wt.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}let At=function(){function se(){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 j=se.prototype;return j.destroy=function(){},j.resetTimeStamp=function(I){this.initPTS=I,this.lastEndTime=null},j.resetNextTimestamp=function(){this.lastEndTime=null},j.resetInitSegment=function(I,G,H,$){this.audioCodec=G,this.videoCodec=H,this.generateInitSegment((0,Q.patchEncyptionData)(I,$)),this.emitInitSegment=!0},j.generateInitSegment=function(I){var G=this.audioCodec,H=this.videoCodec;if(!I||!I.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var $=this.initData=(0,Q.parseInitSegment)(I);G||(G=Rt($.audio,wt.ElementaryStreamTypes.AUDIO)),H||(H=Rt($.video,wt.ElementaryStreamTypes.VIDEO));var ie={};$.audio&&$.video?ie.audiovideo={container:"video/mp4",codec:G+","+H,initSegment:I,id:"main"}:$.audio?ie.audio={container:"audio/mp4",codec:G,initSegment:I,id:"audio"}:$.video?ie.video={container:"video/mp4",codec:H,initSegment:I,id:"main"}:X.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=ie},j.remux=function(I,G,H,$,ie){var ae,Ae=this.initPTS,Ce=this.lastEndTime,Oe={audio:void 0,video:void 0,text:$,id3:H,initSegment:void 0};(0,y.isFiniteNumber)(Ce)||(Ce=this.lastEndTime=ie||0);var Ke=G.samples;if(!Ke||!Ke.length)return Oe;var Qe={initPTS:void 0,timescale:1},We=this.initData;if(We&&We.length||(this.generateInitSegment(Ke),We=this.initData),!We||!We.length)return X.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),Oe;this.emitInitSegment&&(Qe.tracks=this.initTracks,this.emitInitSegment=!1);var at=(0,Q.getStartDTS)(We,Ke);(0,y.isFiniteNumber)(Ae)||(this.initPTS=Qe.initPTS=Ae=at-ie);var Et=(0,Q.getDuration)(Ke,We),Ot=I?at-Ae:Ce,Ze=Ot+Et;(0,Q.offsetStartDTS)(We,Ke,Ae),Et>0?this.lastEndTime=Ze:(X.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var Ht=!!We.audio,gr=!!We.video,Yt="";Ht&&(Yt+="audio"),gr&&(Yt+="video");var jt={data1:Ke,startPTS:Ot,startDTS:Ot,endPTS:Ze,endDTS:Ze,type:Yt,hasAudio:Ht,hasVideo:gr,nb:1,dropped:0};Oe.audio=jt.type==="audio"?jt:void 0,Oe.video=jt.type!=="audio"?jt:void 0,Oe.initSegment=Qe;var Xt=(ae=this.initPTS)!=null?ae:0;return Oe.id3=(0,lt.flushTextTrackMetadataCueSamples)(H,ie,Xt,Xt),$.samples.length&&(Oe.text=(0,lt.flushTextTrackUserdataCueSamples)($,ie,Xt)),Oe},se}();var pt;try{pt=self.performance.now.bind(self.performance)}catch{X.logger.debug("Unable to use Performance API on this environment"),pt=self.Date.now}var Ut=[{demux:te,remux:At},{demux:_t,remux:lt.default},{demux:fe,remux:lt.default},{demux:Lt,remux:lt.default}],Vt=function(){function se(I,G,H,$,ie){this.async=!1,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=I,this.typeSupported=G,this.config=H,this.vendor=$,this.id=ie}var j=se.prototype;return j.configure=function(I){this.transmuxConfig=I,this.decrypter&&this.decrypter.reset()},j.push=function(I,G,H,$){var ie=this,ae=H.transmuxing;ae.executeStart=pt();var Ae=new Uint8Array(I),Ce=this.currentTransmuxState,Oe=this.transmuxConfig;$&&(this.currentTransmuxState=$);var Ke=$||Ce,Qe=Ke.contiguous,We=Ke.discontinuity,at=Ke.trackSwitch,Et=Ke.accurateTimeOffset,Ot=Ke.timeOffset,Ze=Ke.initSegmentChange,Ht=Oe.audioCodec,gr=Oe.videoCodec,Yt=Oe.defaultInitPts,jt=Oe.duration,Xt=Oe.initSegmentData,ut=function(gi,Br){var $t=null;return gi.byteLength>0&&Br!=null&&Br.key!=null&&Br.iv!==null&&Br.method!=null&&($t=Br),$t}(Ae,G);if(ut&&ut.method==="AES-128"){var Lr=this.getDecrypter();if(!Lr.isSync())return this.decryptionPromise=Lr.webCryptoDecrypt(Ae,ut.key.buffer,ut.iv.buffer).then(function(gi){var Br=ie.push(gi,null,H);return ie.decryptionPromise=null,Br}),this.decryptionPromise;var ti=Lr.softwareDecrypt(Ae,ut.key.buffer,ut.iv.buffer);if(!ti)return ae.executeEnd=pt(),ir(H);Ae=new Uint8Array(ti)}var zt=this.needsProbing(We,at);zt&&this.configureTransmuxer(Ae),(We||at||Ze||zt)&&this.resetInitSegment(Xt,Ht,gr,jt,G),(We||Ze||zt)&&this.resetInitialTimestamp(Yt),Qe||this.resetContiguity();var dr=this.transmux(Ae,ut,Ot,Et,H),Vr=this.currentTransmuxState;return Vr.contiguous=!0,Vr.discontinuity=!1,Vr.trackSwitch=!1,ae.executeEnd=pt(),dr},j.flush=function(I){var G=this,H=I.transmuxing;H.executeStart=pt();var $=this.decrypter,ie=this.currentTransmuxState,ae=this.decryptionPromise;if(ae)return ae.then(function(){return G.flush(I)});var Ae=[],Ce=ie.timeOffset;if($){var Oe=$.flush();Oe&&Ae.push(this.push(Oe,null,I))}var Ke=this.demuxer,Qe=this.remuxer;if(!Ke||!Qe)return this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),H.executeEnd=pt(),[ir(I)];var We=Ke.flush(Ce);return vr(We)?We.then(function(at){return G.flushRemux(Ae,at,I),Ae}):(this.flushRemux(Ae,We,I),Ae)},j.flushRemux=function(I,G,H){var $=G.audioTrack,ie=G.videoTrack,ae=G.id3Track,Ae=G.textTrack,Ce=this.currentTransmuxState,Oe=Ce.accurateTimeOffset,Ke=Ce.timeOffset;X.logger.log("[transmuxer.ts]: Flushed fragment "+H.sn+(H.part>-1?" p: "+H.part:"")+" of level "+H.level);var Qe=this.remuxer.remux($,ie,ae,Ae,Ke,Oe,!0,this.id);I.push({remuxResult:Qe,chunkMeta:H}),H.transmuxing.executeEnd=pt()},j.resetInitialTimestamp=function(I){var G=this.demuxer,H=this.remuxer;G&&H&&(G.resetTimeStamp(I),H.resetTimeStamp(I))},j.resetContiguity=function(){var I=this.demuxer,G=this.remuxer;I&&G&&(I.resetContiguity(),G.resetNextTimestamp())},j.resetInitSegment=function(I,G,H,$,ie){var ae=this.demuxer,Ae=this.remuxer;ae&&Ae&&(ae.resetInitSegment(I,G,H,$),Ae.resetInitSegment(I,G,H,ie))},j.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},j.transmux=function(I,G,H,$,ie){return G&&G.method==="SAMPLE-AES"?this.transmuxSampleAes(I,G,H,$,ie):this.transmuxUnencrypted(I,H,$,ie)},j.transmuxUnencrypted=function(I,G,H,$){var ie=this.demuxer.demux(I,G,!1,!this.config.progressive),ae=ie.audioTrack,Ae=ie.videoTrack,Ce=ie.id3Track,Oe=ie.textTrack;return{remuxResult:this.remuxer.remux(ae,Ae,Ce,Oe,G,H,!1,this.id),chunkMeta:$}},j.transmuxSampleAes=function(I,G,H,$,ie){var ae=this;return this.demuxer.demuxSampleAes(I,G,H).then(function(Ae){return{remuxResult:ae.remuxer.remux(Ae.audioTrack,Ae.videoTrack,Ae.id3Track,Ae.textTrack,H,$,!1,ae.id),chunkMeta:ie}})},j.configureTransmuxer=function(I){for(var G,H=this.config,$=this.observer,ie=this.typeSupported,ae=this.vendor,Ae=0,Ce=Ut.length;Ae<Ce;Ae++)if(Ut[Ae].demux.probe(I)){G=Ut[Ae];break}G||(X.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),G={demux:te,remux:At});var Oe=this.demuxer,Ke=this.remuxer,Qe=G.remux,We=G.demux;Ke&&Ke instanceof Qe||(this.remuxer=new Qe($,H,ie,ae)),Oe&&Oe instanceof We||(this.demuxer=new We($,H,ie),this.probe=We.probe)},j.needsProbing=function(I,G){return!this.demuxer||!this.remuxer||I||G},j.getDecrypter=function(){var I=this.decrypter;return I||(I=this.decrypter=new R.default(this.config)),I},se}(),ir=function(se){return{remuxResult:{},chunkMeta:se}};function vr(se){return"then"in se&&se.then instanceof Function}var Qt=function(se,j,I,G,H){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=se,this.videoCodec=j,this.initSegmentData=I,this.duration=G,this.defaultInitPts=H},Fr=function(se,j,I,G,H,$){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=se,this.contiguous=j,this.accurateTimeOffset=I,this.trackSwitch=G,this.timeOffset=H,this.initSegmentChange=$}},973:(v,g,b)=>{"use strict";var L,M;b.r(g),b.d(g,{ErrorDetails:()=>M,ErrorTypes:()=>L}),function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"}(L||(L={})),function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",R.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",R.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",R.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",R.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"}(M||(M={}))},851:(v,g,b)=>{"use strict";var L;b.r(g),b.d(g,{Events:()=>L}),function(M){M.MEDIA_ATTACHING="hlsMediaAttaching",M.MEDIA_ATTACHED="hlsMediaAttached",M.MEDIA_DETACHING="hlsMediaDetaching",M.MEDIA_DETACHED="hlsMediaDetached",M.BUFFER_RESET="hlsBufferReset",M.BUFFER_CODECS="hlsBufferCodecs",M.BUFFER_CREATED="hlsBufferCreated",M.BUFFER_APPENDING="hlsBufferAppending",M.BUFFER_APPENDED="hlsBufferAppended",M.BUFFER_EOS="hlsBufferEos",M.BUFFER_FLUSHING="hlsBufferFlushing",M.BUFFER_FLUSHED="hlsBufferFlushed",M.MANIFEST_LOADING="hlsManifestLoading",M.MANIFEST_LOADED="hlsManifestLoaded",M.MANIFEST_PARSED="hlsManifestParsed",M.LEVEL_SWITCHING="hlsLevelSwitching",M.LEVEL_SWITCHED="hlsLevelSwitched",M.LEVEL_LOADING="hlsLevelLoading",M.LEVEL_LOADED="hlsLevelLoaded",M.LEVEL_UPDATED="hlsLevelUpdated",M.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",M.LEVELS_UPDATED="hlsLevelsUpdated",M.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",M.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",M.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",M.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",M.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",M.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",M.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",M.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",M.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",M.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",M.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",M.CUES_PARSED="hlsCuesParsed",M.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",M.INIT_PTS_FOUND="hlsInitPtsFound",M.FRAG_LOADING="hlsFragLoading",M.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",M.FRAG_LOADED="hlsFragLoaded",M.FRAG_DECRYPTED="hlsFragDecrypted",M.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",M.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",M.FRAG_PARSING_METADATA="hlsFragParsingMetadata",M.FRAG_PARSED="hlsFragParsed",M.FRAG_BUFFERED="hlsFragBuffered",M.FRAG_CHANGED="hlsFragChanged",M.FPS_DROP="hlsFpsDrop",M.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",M.ERROR="hlsError",M.DESTROYING="hlsDestroying",M.KEY_LOADING="hlsKeyLoading",M.KEY_LOADED="hlsKeyLoaded",M.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",M.BACK_BUFFER_REACHED="hlsBackBufferReached"}(L||(L={}))},76:(v,g,b)=>{"use strict";b.r(g),b.d(g,{default:()=>ac});var L,M=b(945),R=b(965),y=b(851),P=b(973),O=b(93),ue=/^(\d+)x(\d+)$/,Q=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,de=function(){function m(e){for(var r in typeof e=="string"&&(e=m.parseAttrList(e)),e)e.hasOwnProperty(r)&&(this[r]=e[r])}var c=m.prototype;return c.decimalInteger=function(e){var r=parseInt(this[e],10);return r>Number.MAX_SAFE_INTEGER?1/0:r},c.hexadecimalInteger=function(e){if(this[e]){var r=(this[e]||"0x").slice(2);r=(1&r.length?"0":"")+r;for(var s=new Uint8Array(r.length/2),o=0;o<r.length/2;o++)s[o]=parseInt(r.slice(2*o,2*o+2),16);return s}return null},c.hexadecimalIntegerAsNumber=function(e){var r=parseInt(this[e],16);return r>Number.MAX_SAFE_INTEGER?1/0:r},c.decimalFloatingPoint=function(e){return parseFloat(this[e])},c.optionalFloat=function(e,r){var s=this[e];return s?parseFloat(s):r},c.enumeratedString=function(e){return this[e]},c.bool=function(e){return this[e]==="YES"},c.decimalResolution=function(e){var r=ue.exec(this[e]);if(r!==null)return{width:parseInt(r[1],10),height:parseInt(r[2],10)}},m.parseAttrList=function(e){var r,s={};for(Q.lastIndex=0;(r=Q.exec(e))!==null;){var o=r[2];o.indexOf('"')===0&&o.lastIndexOf('"')===o.length-1&&(o=o.slice(1,-1)),s[r[1]]=o}return s},m}();function he(){return he=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(m[r]=e[r])}return m},he.apply(this,arguments)}function Y(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}(function(m){m.ID="ID",m.CLASS="CLASS",m.START_DATE="START-DATE",m.DURATION="DURATION",m.END_DATE="END-DATE",m.END_ON_NEXT="END-ON-NEXT",m.PLANNED_DURATION="PLANNED-DURATION",m.SCTE35_OUT="SCTE35-OUT",m.SCTE35_IN="SCTE35-IN"})(L||(L={}));var pe=function(){function m(r,s){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,s){var o=s.attr;for(var l in o)if(Object.prototype.hasOwnProperty.call(r,l)&&r[l]!==o[l]){O.logger.warn('DATERANGE tag attribute: "'+l+'" does not match for tags with ID: "'+r.ID+'"'),this._badValueForSameId=l;break}r=he(new de({}),o,r)}if(this.attr=r,this._startDate=new Date(r[L.START_DATE]),L.END_DATE in this.attr){var n=new Date(this.attr[L.END_DATE]);(0,R.isFiniteNumber)(n.getTime())&&(this._endDate=n)}}var c,e;return c=m,(e=[{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 r=this.duration;return r!==null?new Date(this._startDate.getTime()+1e3*r):null}},{key:"duration",get:function(){if(L.DURATION in this.attr){var r=this.attr.decimalFloatingPoint(L.DURATION);if((0,R.isFiniteNumber)(r))return r}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return L.PLANNED_DURATION in this.attr?this.attr.decimalFloatingPoint(L.PLANNED_DURATION):null}},{key:"endOnNext",get:function(){return this.attr.bool(L.END_ON_NEXT)}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&(0,R.isFiniteNumber)(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}])&&Y(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}(),X=b(923);function oe(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}var z,be,ke,He=function(){function m(r){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.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.encryptedFragments=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=r}var c,e;return m.prototype.reloaded=function(r){if(!r)return this.advanced=!0,void(this.updated=!0);var s=this.lastPartSn-r.lastPartSn,o=this.lastPartIndex-r.lastPartIndex;this.updated=this.endSN!==r.endSN||!!o||!!s,this.advanced=this.endSN>r.endSN||s>0||s===0&&o>0,this.updated||this.advanced?this.misses=Math.floor(.6*r.misses):this.misses=r.misses+1,this.availabilityDelay=r.availabilityDelay},c=m,(e=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&(0,R.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var r=this.driftEndTime-this.driftStartTime;return r>0?1e3*(this.driftEnd-this.driftStart)/r:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var r;return(r=this.partList)!==null&&r!==void 0&&r.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var r;return(r=this.fragments)!==null&&r!==void 0&&r.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 r;return(r=this.partList)!==null&&r!==void 0&&r.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var r;return(r=this.partList)!==null&&r!==void 0&&r.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&oe(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}();function Z(m){return Uint8Array.from(atob(m),function(c){return c.charCodeAt(0)})}function w(m){return Uint8Array.from(unescape(encodeURIComponent(m)),function(c){return c.charCodeAt(0)})}function q(m){switch(m){case be.FAIRPLAY:return z.FAIRPLAY;case be.PLAYREADY:return z.PLAYREADY;case be.WIDEVINE:return z.WIDEVINE;case be.CLEARKEY:return z.CLEARKEY}}function N(m){switch(m){case z.FAIRPLAY:return be.FAIRPLAY;case z.PLAYREADY:return be.PLAYREADY;case z.WIDEVINE:return be.WIDEVINE;case z.CLEARKEY:return be.CLEARKEY}}function fe(m){var c=m.drmSystems,e=m.widevineLicenseUrl,r=c?[z.FAIRPLAY,z.WIDEVINE,z.PLAYREADY,z.CLEARKEY].filter(function(s){return!!c[s]}):[];return!r[z.WIDEVINE]&&e&&r.push(z.WIDEVINE),r}(function(m){m.CLEARKEY="org.w3.clearkey",m.FAIRPLAY="com.apple.fps",m.PLAYREADY="com.microsoft.playready",m.WIDEVINE="com.widevine.alpha"})(z||(z={})),function(m){m.CLEARKEY="org.w3.clearkey",m.FAIRPLAY="com.apple.streamingkeydelivery",m.PLAYREADY="com.microsoft.playready",m.WIDEVINE="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"}(be||(be={})),function(m){m.WIDEVINE="edef8ba979d64acea3c827dcd51d21ed"}(ke||(ke={}));var _e=typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null,te=b(63),re={},Re=function(){function m(e,r,s,o,l){o===void 0&&(o=[1]),l===void 0&&(l=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=r,this.keyFormat=s,this.keyFormatVersions=o,this.iv=l,this.encrypted=!!e&&e!=="NONE",this.isCommonEncryption=this.encrypted&&e!=="AES-128"}m.clearKeyUriToKeyIdMap=function(){re={}};var c=m.prototype;return c.isSupported=function(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;switch(this.keyFormat){case"identity":return this.method==="SAMPLE-AES";case be.FAIRPLAY:case be.WIDEVINE:case be.PLAYREADY:case be.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1},c.getDecryptData=function(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method!=="AES-128"||this.iv||O.logger.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),e=0);var r=function(W){for(var K=new Uint8Array(16),ee=12;ee<16;ee++)K[ee]=W>>8*(15-ee)&255;return K}(e);return new m(this.method,this.uri,"identity",this.keyFormatVersions,r)}var s=function(W){var K,ee,me=W.split(":"),we=null;if(me[0]==="data"&&me.length===2){var ye=me[1].split(";"),De=ye[ye.length-1].split(",");if(De.length===2){var qe=De[0]==="base64",it=De[1];qe?(ye.splice(-1,1),we=Z(it)):(K=w(it).subarray(0,16),(ee=new Uint8Array(16)).set(K,16-K.length),we=ee)}}return we}(this.uri);if(s)switch(this.keyFormat){case be.WIDEVINE:this.pssh=s,s.length>=22&&(this.keyId=s.subarray(s.length-22,s.length-6));break;case be.PLAYREADY:var o=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=(0,te.mp4pssh)(o,null,s);var l=new Uint16Array(s.buffer,s.byteOffset,s.byteLength/2),n=String.fromCharCode.apply(null,Array.from(l)),u=n.substring(n.indexOf("<"),n.length),h=new DOMParser().parseFromString(u,"text/xml").getElementsByTagName("KID")[0];if(h){var f=h.childNodes[0]?h.childNodes[0].nodeValue:h.getAttribute("VALUE");if(f){var p=Z(f).subarray(0,16);(function(W){var K=function(ee,me,we){var ye=ee[me];ee[me]=ee[we],ee[we]=ye};K(W,0,3),K(W,1,2),K(W,4,5),K(W,6,7)})(p),this.keyId=p}}break;default:var _=s.subarray(0,16);if(_.length!==16){var S=new Uint8Array(16);S.set(_,16-_.length),_=S}this.keyId=_}if(!this.keyId||this.keyId.byteLength!==16){var C=re[this.uri];if(!C){var x=Object.keys(re).length%Number.MAX_SAFE_INTEGER;C=new Uint8Array(16),new DataView(C.buffer,12,4).setUint32(0,x),re[this.uri]=C}this.keyId=C}return this},m}(),Pe={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,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,dva1:!0,dvav:!0,dvh1:!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 Fe(m,c){return MediaSource.isTypeSupported((c||"video")+'/mp4;codecs="'+m+'"')}function Se(){return Se=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(m[r]=e[r])}return m},Se.apply(this,arguments)}var Ye=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+|#EXT-X-SESSION-KEY:([^\n\r]*)[\r\n]+/g,ot=/#EXT-X-MEDIA:(.*)/g,le=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Ee=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("|")),U=function(){function m(){}return m.findGroup=function(c,e){for(var r=0;r<c.length;r++){var s=c[r];if(s.id===e)return s}},m.convertAVC1ToAVCOTI=function(c){var e=c.split(".");if(e.length>2){var r=e.shift()+".";return(r+=parseInt(e.shift()).toString(16))+("000"+parseInt(e.shift()).toString(16)).slice(-4)}return c},m.resolve=function(c,e){return(0,M.buildAbsoluteURL)(e,c,{alwaysNormalize:!0})},m.parseMasterPlaylist=function(c,e){var r,s=[],o=[],l={},n=[],u=!1;for(Ye.lastIndex=0;(r=Ye.exec(c))!=null;)if(r[1]){var h,f=new de(r[1]),p={attrs:f,bitrate:f.decimalInteger("AVERAGE-BANDWIDTH")||f.decimalInteger("BANDWIDTH"),name:f.NAME,url:m.resolve(r[2],e)},_=f.decimalResolution("RESOLUTION");_&&(p.width=_.width,p.height=_.height),Le((f.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),p),p.videoCodec&&p.videoCodec.indexOf("avc1")!==-1&&(p.videoCodec=m.convertAVC1ToAVCOTI(p.videoCodec)),(h=p.unknownCodecs)!==null&&h!==void 0&&h.length||o.push(p),s.push(p)}else if(r[3]){var S=new de(r[3]);S["DATA-ID"]&&(u=!0,l[S["DATA-ID"]]=S)}else if(r[4]){var C=r[4],x=ve(C,e);x.encrypted&&x.isSupported()?n.push(x):O.logger.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+C+'"')}return{levels:o.length>0&&o.length<s.length?o:s,sessionData:u?l:null,sessionKeys:n.length?n:null}},m.parseMasterPlaylistMedia=function(c,e,r,s){var o;s===void 0&&(s=[]);var l=[],n=0;for(ot.lastIndex=0;(o=ot.exec(c))!==null;){var u=new de(o[1]);if(u.TYPE===r){var h={attrs:u,bitrate:0,id:n++,groupId:u["GROUP-ID"],instreamId:u["INSTREAM-ID"],name:u.NAME||u.LANGUAGE||"",type:r,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:u.LANGUAGE,url:u.URI?m.resolve(u.URI,e):""};if(s.length){var f=m.findGroup(s,h.groupId)||s[0];Ne(h,f,"audioCodec"),Ne(h,f,"textCodec")}l.push(h)}}return l},m.parseLevelPlaylist=function(c,e,r,s,o){var l,n,u,h=new He(e),f=h.fragments,p=null,_=0,S=0,C=0,x=0,W=null,K=new X.Fragment(s,e),ee=-1,me=!1;for(le.lastIndex=0,h.m3u8=c;(l=le.exec(c))!==null;){me&&(me=!1,(K=new X.Fragment(s,e)).start=C,K.sn=_,K.cc=x,K.level=r,p&&(K.initSegment=p,K.rawProgramDateTime=p.rawProgramDateTime,p.rawProgramDateTime=null));var we=l[1];if(we){K.duration=parseFloat(we);var ye=(" "+l[2]).slice(1);K.title=ye||null,K.tagList.push(ye?["INF",we,ye]:["INF",we])}else if(l[3]){if((0,R.isFiniteNumber)(K.duration)){if(K.start=C,u){K.levelkeys=u;var De=h.encryptedFragments;!K.levelkeys||!Object.keys(K.levelkeys).some(function(di){return K.levelkeys[di].isCommonEncryption})||De.length&&De[De.length-1].levelkeys===u||De.push(K)}K.sn=_,K.level=r,K.cc=x,K.urlId=o,f.push(K),K.relurl=(" "+l[3]).slice(1),Ue(K,W),W=K,C+=K.duration,_++,S=0,me=!0}}else if(l[4]){var qe=(" "+l[4]).slice(1);W?K.setByteRange(qe,W):K.setByteRange(qe)}else if(l[5])K.rawProgramDateTime=(" "+l[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),ee===-1&&(ee=f.length);else{if(!(l=l[0].match(Ee))){O.logger.warn("No matches on slow regex match for level playlist!");continue}for(n=1;n<l.length&&l[n]===void 0;n++);var it=(" "+l[n]).slice(1),Ie=(" "+l[n+1]).slice(1),je=l[n+2]?(" "+l[n+2]).slice(1):"";switch(it){case"PLAYLIST-TYPE":h.type=Ie.toUpperCase();break;case"MEDIA-SEQUENCE":_=h.startSN=parseInt(Ie);break;case"SKIP":var Ve=new de(Ie),Tt=Ve.decimalInteger("SKIPPED-SEGMENTS");if((0,R.isFiniteNumber)(Tt)){h.skippedSegments=Tt;for(var Wt=Tt;Wt--;)f.unshift(null);_+=Tt}var St=Ve.enumeratedString("RECENTLY-REMOVED-DATERANGES");St&&(h.recentlyRemovedDateranges=St.split(" "));break;case"TARGETDURATION":h.targetduration=parseFloat(Ie);break;case"VERSION":h.version=parseInt(Ie);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"#":(Ie||je)&&K.tagList.push(je?[Ie,je]:[Ie]);break;case"DISCONTINUITY":x++,K.tagList.push(["DIS"]);break;case"GAP":K.tagList.push([it]);break;case"BITRATE":K.tagList.push([it,Ie]);break;case"DATERANGE":var Mt=new de(Ie),Gt=new pe(Mt,h.dateRanges[Mt.ID]);Gt.isValid||h.skippedSegments?h.dateRanges[Gt.id]=Gt:O.logger.warn('Ignoring invalid DATERANGE tag: "'+Ie+'"'),K.tagList.push(["EXT-X-DATERANGE",Ie]);break;case"DISCONTINUITY-SEQUENCE":x=parseInt(Ie);break;case"KEY":var yr=ve(Ie,e);if(yr.isSupported()){if(yr.method==="NONE"){u=void 0;break}u||(u={}),u[yr.keyFormat]&&(u=Se({},u)),u[yr.keyFormat]=yr}else O.logger.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+Ie+'"');break;case"START":var fr=new de(Ie).decimalFloatingPoint("TIME-OFFSET");(0,R.isFiniteNumber)(fr)&&(h.startTimeOffset=fr);break;case"MAP":var er=new de(Ie);if(K.duration){var br=new X.Fragment(s,e);Ge(br,er,r,u),p=br,K.initSegment=p,p.rawProgramDateTime&&!K.rawProgramDateTime&&(K.rawProgramDateTime=p.rawProgramDateTime)}else Ge(K,er,r,u),p=K,me=!0;break;case"SERVER-CONTROL":var Zr=new de(Ie);h.canBlockReload=Zr.bool("CAN-BLOCK-RELOAD"),h.canSkipUntil=Zr.optionalFloat("CAN-SKIP-UNTIL",0),h.canSkipDateRanges=h.canSkipUntil>0&&Zr.bool("CAN-SKIP-DATERANGES"),h.partHoldBack=Zr.optionalFloat("PART-HOLD-BACK",0),h.holdBack=Zr.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Wl=new de(Ie);h.partTarget=Wl.decimalFloatingPoint("PART-TARGET");break;case"PART":var Ei=h.partList;Ei||(Ei=h.partList=[]);var jn=S>0?Ei[Ei.length-1]:void 0,qn=S++,Yn=new X.Part(new de(Ie),K,e,qn,jn);Ei.push(Yn),K.duration+=Yn.duration;break;case"PRELOAD-HINT":var vt=new de(Ie);h.preloadHint=vt;break;case"RENDITION-REPORT":var kt=new de(Ie);h.renditionReports=h.renditionReports||[],h.renditionReports.push(kt);break;default:O.logger.warn("line parsed but not handled: "+l)}}}W&&!W.relurl?(f.pop(),C-=W.duration,h.partList&&(h.fragmentHint=W)):h.partList&&(Ue(K,W),K.cc=x,h.fragmentHint=K);var an=f.length,wi=f[0],yi=f[an-1];if((C+=h.skippedSegments*h.targetduration)>0&&an&&yi){h.averagetargetduration=C/an;var nn=yi.sn;h.endSN=nn!=="initSegment"?nn:0,h.live||(yi.endList=!0),wi&&(h.startCC=wi.cc)}else h.endSN=0,h.startCC=0;return h.fragmentHint&&(C+=h.fragmentHint.duration),h.totalduration=C,h.endCC=x,ee>0&&function(di,Ii){for(var zi=di[Ii],ai=Ii;ai--;){var Qi=di[ai];if(!Qi)return;Qi.programDateTime=zi.programDateTime-1e3*Qi.duration,zi=Qi}}(f,ee),h},m}();function ve(m,c){var e,r,s=new de(m),o=(e=s.enumeratedString("METHOD"))!=null?e:"",l=s.URI,n=s.hexadecimalInteger("IV"),u=s.enumeratedString("KEYFORMATVERSIONS"),h=(r=s.enumeratedString("KEYFORMAT"))!=null?r:"identity";l&&s.IV&&!n&&O.logger.error("Invalid IV: "+s.IV);var f=l?U.resolve(l,c):"",p=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Re(o,f,h,p,n)}function Le(m,c){["video","audio","text"].forEach(function(e){var r=m.filter(function(o){return function(l,n){var u=Pe[n];return!!u&&u[l.slice(0,4)]===!0}(o,e)});if(r.length){var s=r.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});c[e+"Codec"]=s.length>0?s[0]:r[0],m=m.filter(function(o){return r.indexOf(o)===-1})}}),c.unknownCodecs=m}function Ne(m,c,e){var r=c[e];r&&(m[e]=r)}function Ue(m,c){m.rawProgramDateTime?m.programDateTime=Date.parse(m.rawProgramDateTime):c!=null&&c.programDateTime&&(m.programDateTime=c.endProgramDateTime),(0,R.isFiniteNumber)(m.programDateTime)||(m.programDateTime=null,m.rawProgramDateTime=null)}function Ge(m,c,e,r){m.relurl=c.URI,c.BYTERANGE&&m.setByteRange(c.BYTERANGE),m.level=e,m.sn="initSegment",r&&(m.levelkeys=r),m.initSegment=null}var Te=b(308);function xe(m,c){var e=m.url;return e!==void 0&&e.indexOf("data:")!==0||(e=c.url),e}let $e=function(){function m(e){this.hls=void 0,this.loaders=Object.create(null),this.hls=e,this.registerListeners()}var c=m.prototype;return c.startLoad=function(e){},c.stopLoad=function(){this.destroyInternalLoaders()},c.registerListeners=function(){var e=this.hls;e.on(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(y.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(y.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.unregisterListeners=function(){var e=this.hls;e.off(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(y.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(y.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.createInternalLoader=function(e){var r=this.hls.config,s=r.pLoader,o=r.loader,l=new(s||o)(r);return e.loader=l,this.loaders[e.type]=l,l},c.getInternalLoader=function(e){return this.loaders[e.type]},c.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},c.destroyInternalLoaders=function(){for(var e in this.loaders){var r=this.loaders[e];r&&r.destroy(),this.resetInternalLoader(e)}},c.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},c.onManifestLoading=function(e,r){var s=r.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:Te.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},c.onLevelLoading=function(e,r){var s=r.id,o=r.level,l=r.url,n=r.deliveryDirectives;this.load({id:s,groupId:null,level:o,responseType:"text",type:Te.PlaylistContextType.LEVEL,url:l,deliveryDirectives:n})},c.onAudioTrackLoading=function(e,r){var s=r.id,o=r.groupId,l=r.url,n=r.deliveryDirectives;this.load({id:s,groupId:o,level:null,responseType:"text",type:Te.PlaylistContextType.AUDIO_TRACK,url:l,deliveryDirectives:n})},c.onSubtitleTrackLoading=function(e,r){var s=r.id,o=r.groupId,l=r.url,n=r.deliveryDirectives;this.load({id:s,groupId:o,level:null,responseType:"text",type:Te.PlaylistContextType.SUBTITLE_TRACK,url:l,deliveryDirectives:n})},c.load=function(e){var r,s,o,l,n,u,h=this.hls.config,f=this.getInternalLoader(e);if(f){var p=f.context;if(p&&p.url===e.url)return void O.logger.trace("[playlist-loader]: playlist request ongoing");O.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),f.abort()}switch(e.type){case Te.PlaylistContextType.MANIFEST:s=h.manifestLoadingMaxRetry,o=h.manifestLoadingTimeOut,l=h.manifestLoadingRetryDelay,n=h.manifestLoadingMaxRetryTimeout;break;case Te.PlaylistContextType.LEVEL:case Te.PlaylistContextType.AUDIO_TRACK:case Te.PlaylistContextType.SUBTITLE_TRACK:s=0,o=h.levelLoadingTimeOut;break;default:s=h.levelLoadingMaxRetry,o=h.levelLoadingTimeOut,l=h.levelLoadingRetryDelay,n=h.levelLoadingMaxRetryTimeout}if(f=this.createInternalLoader(e),(r=e.deliveryDirectives)!==null&&r!==void 0&&r.part&&(e.type===Te.PlaylistContextType.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===Te.PlaylistContextType.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===Te.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u)){var _=u.partTarget,S=u.targetduration;_&&S&&(o=Math.min(1e3*Math.max(3*_,.8*S),o))}var C={timeout:o,maxRetry:s,retryDelay:l,maxRetryDelay:n,highWaterMark:0},x={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};f.load(e,C,x)},c.loadsuccess=function(e,r,s,o){o===void 0&&(o=null),this.resetInternalLoader(s.type);var l=e.data;l.indexOf("#EXTM3U")===0?(r.parsing.start=performance.now(),l.indexOf("#EXTINF:")>0||l.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,r,s,o):this.handleMasterPlaylist(e,r,s,o)):this.handleManifestParsingError(e,s,"no EXTM3U delimiter",o)},c.loaderror=function(e,r,s){s===void 0&&(s=null),this.handleNetworkError(r,s,!1,e)},c.loadtimeout=function(e,r,s){s===void 0&&(s=null),this.handleNetworkError(r,s,!0)},c.handleMasterPlaylist=function(e,r,s,o){var l=this.hls,n=e.data,u=xe(e,s),h=U.parseMasterPlaylist(n,u),f=h.levels,p=h.sessionData,_=h.sessionKeys;if(f.length){var S=f.map(function(ee){return{id:ee.attrs.AUDIO,audioCodec:ee.audioCodec}}),C=f.map(function(ee){return{id:ee.attrs.SUBTITLES,textCodec:ee.textCodec}}),x=U.parseMasterPlaylistMedia(n,u,"AUDIO",S),W=U.parseMasterPlaylistMedia(n,u,"SUBTITLES",C),K=U.parseMasterPlaylistMedia(n,u,"CLOSED-CAPTIONS");x.length&&(x.some(function(ee){return!ee.url})||!f[0].audioCodec||f[0].attrs.AUDIO||(O.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new de({}),bitrate:0,url:""}))),l.trigger(y.Events.MANIFEST_LOADED,{levels:f,audioTracks:x,subtitles:W,captions:K,url:u,stats:r,networkDetails:o,sessionData:p,sessionKeys:_})}else this.handleManifestParsingError(e,s,"no level found in manifest",o)},c.handleTrackOrLevelPlaylist=function(e,r,s,o){var l=this.hls,n=s.id,u=s.level,h=s.type,f=xe(e,s),p=(0,R.isFiniteNumber)(n)?n:0,_=(0,R.isFiniteNumber)(u)?u:p,S=function(W){switch(W.type){case Te.PlaylistContextType.AUDIO_TRACK:return Te.PlaylistLevelType.AUDIO;case Te.PlaylistContextType.SUBTITLE_TRACK:return Te.PlaylistLevelType.SUBTITLE;default:return Te.PlaylistLevelType.MAIN}}(s),C=U.parseLevelPlaylist(e.data,f,_,S,p);if(C.fragments.length){if(h===Te.PlaylistContextType.MANIFEST){var x={attrs:new de({}),bitrate:0,details:C,name:"",url:f};l.trigger(y.Events.MANIFEST_LOADED,{levels:[x],audioTracks:[],url:f,stats:r,networkDetails:o,sessionData:null,sessionKeys:null})}r.parsing.end=performance.now(),s.levelDetails=C,this.handlePlaylistLoaded(e,r,s,o)}else l.trigger(y.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0})},c.handleManifestParsingError=function(e,r,s,o){this.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:r.type===Te.PlaylistContextType.MANIFEST,url:e.url,reason:s,response:e,context:r,networkDetails:o})},c.handleNetworkError=function(e,r,s,o){s===void 0&&(s=!1),O.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var l=P.ErrorDetails.UNKNOWN,n=!1,u=this.getInternalLoader(e);switch(e.type){case Te.PlaylistContextType.MANIFEST:l=s?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,n=!0;break;case Te.PlaylistContextType.LEVEL:l=s?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,n=!1;break;case Te.PlaylistContextType.AUDIO_TRACK:l=s?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,n=!1;break;case Te.PlaylistContextType.SUBTITLE_TRACK:l=s?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,n=!1}u&&this.resetInternalLoader(e.type);var h={type:P.ErrorTypes.NETWORK_ERROR,details:l,fatal:n,url:e.url,loader:u,context:e,networkDetails:r};o&&(h.response=o),this.hls.trigger(y.Events.ERROR,h)},c.handlePlaylistLoaded=function(e,r,s,o){var l=s.type,n=s.level,u=s.id,h=s.groupId,f=s.loader,p=s.levelDetails,_=s.deliveryDirectives;if(p!=null&&p.targetduration){if(f)switch(p.live&&(f.getCacheAge&&(p.ageHeader=f.getCacheAge()||0),f.getCacheAge&&!isNaN(p.ageHeader)||(p.ageHeader=0)),l){case Te.PlaylistContextType.MANIFEST:case Te.PlaylistContextType.LEVEL:this.hls.trigger(y.Events.LEVEL_LOADED,{details:p,level:n||0,id:u||0,stats:r,networkDetails:o,deliveryDirectives:_});break;case Te.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(y.Events.AUDIO_TRACK_LOADED,{details:p,id:u||0,groupId:h||"",stats:r,networkDetails:o,deliveryDirectives:_});break;case Te.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(y.Events.SUBTITLE_TRACK_LOADED,{details:p,id:u||0,groupId:h||"",stats:r,networkDetails:o,deliveryDirectives:_})}}else this.handleManifestParsingError(e,s,"invalid target duration",o)},m}();function rt(m,c){var e;try{e=new Event("addtrack")}catch{(e=document.createEvent("Event")).initEvent("addtrack",!1,!1)}e.track=m,c.dispatchEvent(e)}function _t(m,c){var e=m.mode;if(e==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(c.id))try{if(m.addCue(c),!m.cues.getCueById(c.id))throw new Error("addCue is failed for: "+c)}catch(s){O.logger.debug("[texttrack-utils]: "+s);var r=new self.TextTrackCue(c.startTime,c.endTime,c.text);r.id=c.id,m.addCue(r)}e==="disabled"&&(m.mode=e)}function gt(m){var c=m.mode;if(c==="disabled"&&(m.mode="hidden"),m.cues)for(var e=m.cues.length;e--;)m.removeCue(m.cues[e]);c==="disabled"&&(m.mode=c)}function Lt(m,c,e,r){var s=m.mode;if(s==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var o=function(n,u,h){var f=[],p=function(x,W){if(W<x[0].startTime)return 0;var K=x.length-1;if(W>x[K].endTime)return-1;for(var ee=0,me=K;ee<=me;){var we=Math.floor((me+ee)/2);if(W<x[we].startTime)me=we-1;else{if(!(W>x[we].startTime&&ee<K))return we;ee=we+1}}return x[ee].startTime-W<W-x[me].startTime?ee:me}(n,u);if(p>-1)for(var _=p,S=n.length;_<S;_++){var C=n[_];if(C.startTime>=u&&C.endTime<=h)f.push(C);else if(C.startTime>h)return f}return f}(m.cues,c,e),l=0;l<o.length;l++)r&&!r(o[l])||m.removeCue(o[l]);s==="disabled"&&(m.mode=s)}var lt=b(181),wt=b(856);function Rt(){return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var At=function(){var m=Rt();try{new m(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function pt(m,c){return m.getTime()/1e3-c}let Ut=function(){function m(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var c=m.prototype;return c.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},c._registerListeners=function(){var e=this.hls;e.on(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(y.Events.LEVEL_UPDATED,this.onLevelUpdated,this)},c._unregisterListeners=function(){var e=this.hls;e.off(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(y.Events.LEVEL_UPDATED,this.onLevelUpdated,this)},c.onMediaAttached=function(e,r){this.media=r.media},c.onMediaDetaching=function(){this.id3Track&&(gt(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})},c.onManifestLoading=function(){this.dateRangeCuesAppended={}},c.createTrack=function(e){var r=this.getID3Track(e.textTracks);return r.mode="hidden",r},c.getID3Track=function(e){if(this.media){for(var r=0;r<e.length;r++){var s=e[r];if(s.kind==="metadata"&&s.label==="id3")return rt(s,this.media),s}return this.media.addTextTrack("metadata","id3")}},c.onFragParsingMetadata=function(e,r){if(this.media){var s=this.hls.config,o=s.enableEmsgMetadataCues,l=s.enableID3MetadataCues;if(o||l){var n=r.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var u=Rt(),h=0;h<n.length;h++){var f=n[h].type;if((f!==wt.MetadataSchema.emsg||o)&&l){var p=lt.getID3Frames(n[h].data);if(p){var _=n[h].pts,S=_+n[h].duration;S>At&&(S=At),S-_<=0&&(S=_+.25);for(var C=0;C<p.length;C++){var x=p[C];if(!lt.isTimeStampFrame(x)){this.updateId3CueEnds(_);var W=new u(_,S,"");W.value=x,f&&(W.type=f),this.id3Track.addCue(W)}}}}}}}},c.updateId3CueEnds=function(e){var r,s=(r=this.id3Track)===null||r===void 0?void 0:r.cues;if(s)for(var o=s.length;o--;){var l=s[o];l.startTime<e&&l.endTime===At&&(l.endTime=e)}},c.onBufferFlushing=function(e,r){var s=r.startOffset,o=r.endOffset,l=r.type,n=this.id3Track,u=this.hls;if(u){var h=u.config,f=h.enableEmsgMetadataCues,p=h.enableID3MetadataCues;n&&(f||p)&&Lt(n,s,o,l==="audio"?function(_){return _.type===wt.MetadataSchema.audioId3&&p}:l==="video"?function(_){return _.type===wt.MetadataSchema.emsg&&f}:function(_){return _.type===wt.MetadataSchema.audioId3&&p||_.type===wt.MetadataSchema.emsg&&f})}},c.onLevelUpdated=function(e,r){var s=this,o=r.details;if(this.media&&o.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var l=this.dateRangeCuesAppended,n=this.id3Track,u=o.dateRanges,h=Object.keys(u);if(n)for(var f=Object.keys(l).filter(function(ee){return!h.includes(ee)}),p=function(ee){var me=f[ee];Object.keys(l[me].cues).forEach(function(we){n.removeCue(l[me].cues[we])}),delete l[me]},_=f.length;_--;)p(_);var S=o.fragments[o.fragments.length-1];if(h.length!==0&&(0,R.isFiniteNumber)(S==null?void 0:S.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var C=S.programDateTime/1e3-S.start,x=Rt(),W=function(ee){var me=h[ee],we=u[me],ye=l[me],De=(ye==null?void 0:ye.cues)||{},qe=(ye==null?void 0:ye.durationKnown)||!1,it=pt(we.startDate,C),Ie=At,je=we.endDate;if(je)Ie=pt(je,C),qe=!0;else if(we.endOnNext&&!qe){var Ve=h.reduce(function(fr,er){var br=u[er];return br.class===we.class&&br.id!==er&&br.startDate>we.startDate&&fr.push(br),fr},[]).sort(function(fr,er){return fr.startDate.getTime()-er.startDate.getTime()})[0];Ve&&(Ie=pt(Ve.startDate,C),qe=!0)}for(var Tt,Wt=Object.keys(we.attr),St=0;St<Wt.length;St++){var Mt=Wt[St];if(Mt!==L.ID&&Mt!==L.CLASS&&Mt!==L.START_DATE&&Mt!==L.DURATION&&Mt!==L.END_DATE&&Mt!==L.END_ON_NEXT){var Gt=De[Mt];if(Gt)qe&&!ye.durationKnown&&(Gt.endTime=Ie);else{var yr=we.attr[Mt];Gt=new x(it,Ie,""),Mt!==L.SCTE35_OUT&&Mt!==L.SCTE35_IN||(Tt=yr,yr=Uint8Array.from(Tt.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),Gt.value={key:Mt,data:yr},Gt.type=wt.MetadataSchema.dateRange,s.id3Track.addCue(Gt),De[Mt]=Gt}}}l[me]={cues:De,dateRange:we,durationKnown:qe}},K=0;K<h.length;K++)W(K)}}},m}();function Vt(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}var ir=function(){function m(s){var o=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return o.timeupdate()},this.hls=s,this.config=s.config,this.registerListeners()}var c,e,r=m.prototype;return r.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},r.registerListeners=function(){this.hls.on(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(y.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(y.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){this.hls.off(y.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(y.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(y.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(y.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(y.Events.ERROR,this.onError)},r.onMediaAttached=function(s,o){this.media=o.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},r.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},r.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},r.onLevelUpdated=function(s,o){var l=o.details;this.levelDetails=l,l.advanced&&this.timeupdate(),!l.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},r.onError=function(s,o){o.details===P.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},r.timeupdate=function(){var s=this.media,o=this.levelDetails;if(s&&o){this.currentTime=s.currentTime;var l=this.computeLatency();if(l!==null){this._latency=l;var n=this.config,u=n.lowLatencyMode,h=n.maxLiveSyncPlaybackRate;if(u&&h!==1){var f=this.targetLatency;if(f!==null){var p=l-f,_=p<Math.min(this.maxLatency,f+o.targetduration);if(o.live&&_&&p>.05&&this.forwardBufferLength>1){var S=Math.min(2,Math.max(1,h)),C=Math.round(2/(1+Math.exp(-.75*p-this.edgeStalled))*20)/20;s.playbackRate=Math.min(S,Math.max(1,C))}else s.playbackRate!==1&&s.playbackRate!==0&&(s.playbackRate=1)}}}}},r.estimateLiveEdge=function(){var s=this.levelDetails;return s===null?null:s.edge+s.age},r.computeLatency=function(){var s=this.estimateLiveEdge();return s===null?null:s-this.currentTime},c=m,(e=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var s=this.config,o=this.levelDetails;return s.liveMaxLatencyDuration!==void 0?s.liveMaxLatencyDuration:o?s.liveMaxLatencyDurationCount*o.targetduration:0}},{key:"targetLatency",get:function(){var s=this.levelDetails;if(s===null)return null;var o=s.holdBack,l=s.partHoldBack,n=s.targetduration,u=this.config,h=u.liveSyncDuration,f=u.liveSyncDurationCount,p=u.lowLatencyMode,_=this.hls.userConfig,S=p&&l||o;(_.liveSyncDuration||_.liveSyncDurationCount||S===0)&&(S=h!==void 0?h:f*n);var C=n;return S+Math.min(1*this.stallCount,C)}},{key:"liveSyncPosition",get:function(){var s=this.estimateLiveEdge(),o=this.targetLatency,l=this.levelDetails;if(s===null||o===null||l===null)return null;var n=l.edge,u=s-o-this.edgeStalled,h=n-l.totalduration,f=n-(this.config.lowLatencyMode&&l.partTarget||l.targetduration);return Math.min(Math.max(h,u),f)}},{key:"drift",get:function(){var s=this.levelDetails;return s===null?1:s.drift}},{key:"edgeStalled",get:function(){var s=this.levelDetails;if(s===null)return 0;var o=3*(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.max(s.age-o,0)}},{key:"forwardBufferLength",get:function(){var s=this.media,o=this.levelDetails;if(!s||!o)return 0;var l=s.buffered.length;return(l?s.buffered.end(l-1):o.edge)-this.currentTime}}])&&Vt(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}();function vr(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}var Qt,Fr=["NONE","TYPE-0","TYPE-1","TYPE-2",null];(function(m){m.No="",m.Yes="YES",m.v2="v2"})(Qt||(Qt={}));var se=function(){function m(c,e,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=c,this.part=e,this.skip=r}return m.prototype.addDirectives=function(c){var e=new self.URL(c);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.href},m}(),j=function(){function m(r){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=[r.url],this.attrs=r.attrs,this.bitrate=r.bitrate,r.details&&(this.details=r.details),this.id=r.id||0,this.name=r.name,this.width=r.width||0,this.height=r.height||0,this.audioCodec=r.audioCodec,this.videoCodec=r.videoCodec,this.unknownCodecs=r.unknownCodecs,this.codecSet=[r.videoCodec,r.audioCodec].filter(function(s){return s}).join(",").replace(/\.[^.,]+/g,"")}var c,e;return c=m,(e=[{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(r){var s=r%this.url.length;this._urlId!==s&&(this.details=void 0,this._urlId=s)}}])&&vr(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}();function I(){return I=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(m[r]=e[r])}return m},I.apply(this,arguments)}function G(m,c,e){switch(c){case"audio":m.audioGroupIds||(m.audioGroupIds=[]),m.audioGroupIds.push(e);break;case"text":m.textGroupIds||(m.textGroupIds=[]),m.textGroupIds.push(e)}}function H(m){var c={};m.forEach(function(e){var r=e.groupId||"";e.id=c[r]=c[r]||0,c[r]++})}function $(m,c){var e=c.startPTS;if((0,R.isFiniteNumber)(e)){var r,s=0;c.sn>m.sn?(s=e-m.start,r=m):(s=m.start-e,r=c),r.duration!==s&&(r.duration=s)}else c.sn>m.sn?m.cc===c.cc&&m.minEndPTS?c.start=m.start+(m.minEndPTS-m.start):c.start=m.start+m.duration:c.start=Math.max(m.start-c.duration,0)}function ie(m,c,e,r,s,o){r-e<=0&&(O.logger.warn("Fragment should have a positive duration",c),r=e+c.duration,o=s+c.duration);var l=e,n=r,u=c.startPTS,h=c.endPTS;if((0,R.isFiniteNumber)(u)){var f=Math.abs(u-e);(0,R.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(f,c.deltaPTS):c.deltaPTS=f,l=Math.max(e,u),e=Math.min(e,u),s=Math.min(s,c.startDTS),n=Math.min(r,h),r=Math.max(r,h),o=Math.max(o,c.endDTS)}c.duration=r-e;var p=e-c.start;c.start=c.startPTS=e,c.maxStartPTS=l,c.startDTS=s,c.endPTS=r,c.minEndPTS=n,c.endDTS=o;var _,S=c.sn;if(!m||S<m.startSN||S>m.endSN)return 0;var C=S-m.startSN,x=m.fragments;for(x[C]=c,_=C;_>0;_--)$(x[_],x[_-1]);for(_=C;_<x.length-1;_++)$(x[_],x[_+1]);return m.fragmentHint&&$(x[x.length-1],m.fragmentHint),m.PTSKnown=m.alignedSliding=!0,p}function ae(m,c){var e=c.startSN+c.skippedSegments-m.startSN,r=m.fragments;e<0||e>=r.length||Ae(c,r[e].start)}function Ae(m,c){if(c){for(var e=m.fragments,r=m.skippedSegments;r<e.length;r++)e[r].start+=c;m.fragmentHint&&(m.fragmentHint.start+=c)}}var Ce=function(){function m(e,r){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=O.logger.log.bind(O.logger,r+":"),this.warn=O.logger.warn.bind(O.logger,r+":"),this.hls=e}var c=m.prototype;return c.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},c.onError=function(e,r){!r.fatal||r.type!==P.ErrorTypes.NETWORK_ERROR&&r.type!==P.ErrorTypes.KEY_SYSTEM_ERROR||this.stopLoad()},c.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},c.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.requestScheduled=-1,this.loadPlaylist()},c.stopLoad=function(){this.canLoad=!1,this.clearTimer()},c.switchParams=function(e,r){var s=r==null?void 0:r.renditionReports;if(s)for(var o=0;o<s.length;o++){var l=s[o],n=void 0;try{n=new self.URL(l.URI,r.url).href}catch(p){O.logger.warn("Could not construct new URL for Rendition Report: "+p),n=l.URI||""}if(n===e.slice(-n.length)){var u=parseInt(l["LAST-MSN"])||(r==null?void 0:r.lastPartSn),h=parseInt(l["LAST-PART"])||(r==null?void 0:r.lastPartIndex);if(this.hls.config.lowLatencyMode){var f=Math.min(r.age-r.partTarget,r.targetduration);h>=0&&f>r.partTarget&&(h+=1)}return new se(u,h>=0?h:void 0,Qt.No)}}},c.loadPlaylist=function(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())},c.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},c.playlistLoaded=function(e,r,s){var o=this,l=r.details,n=r.stats,u=self.performance.now(),h=n.loading.first?Math.max(0,u-n.loading.first):0;if(l.advancedDateTime=Date.now()-h,l.live||s!=null&&s.live){if(l.reloaded(s),s&&this.log("live playlist "+e+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),s&&l.fragments.length>0&&function(je,Ve){for(var Tt=null,Wt=je.fragments,St=Wt.length-1;St>=0;St--){var Mt=Wt[St].initSegment;if(Mt){Tt=Mt;break}}je.fragmentHint&&delete je.fragmentHint.endPTS;var Gt,yr,fr,er,br,Zr=0;if(function(vt,kt,an){for(var wi=kt.skippedSegments,yi=Math.max(vt.startSN,kt.startSN)-kt.startSN,nn=(vt.fragmentHint?1:0)+(wi?kt.endSN:Math.min(vt.endSN,kt.endSN))-kt.startSN,di=kt.startSN-vt.startSN,Ii=kt.fragmentHint?kt.fragments.concat(kt.fragmentHint):kt.fragments,zi=vt.fragmentHint?vt.fragments.concat(vt.fragmentHint):vt.fragments,ai=yi;ai<=nn;ai++){var Qi=zi[di+ai],ro=Ii[ai];wi&&!ro&&ai<wi&&(ro=kt.fragments[ai]=Qi),Qi&&ro&&an(Qi,ro)}}(je,Ve,function(vt,kt){vt.relurl&&(Zr=vt.cc-kt.cc),(0,R.isFiniteNumber)(vt.startPTS)&&(0,R.isFiniteNumber)(vt.endPTS)&&(kt.start=kt.startPTS=vt.startPTS,kt.startDTS=vt.startDTS,kt.appendedPTS=vt.appendedPTS,kt.maxStartPTS=vt.maxStartPTS,kt.endPTS=vt.endPTS,kt.endDTS=vt.endDTS,kt.minEndPTS=vt.minEndPTS,kt.duration=vt.endPTS-vt.startPTS,kt.duration&&(Gt=kt),Ve.PTSKnown=Ve.alignedSliding=!0),kt.elementaryStreams=vt.elementaryStreams,kt.loader=vt.loader,kt.stats=vt.stats,kt.urlId=vt.urlId,vt.initSegment&&(kt.initSegment=vt.initSegment,Tt=vt.initSegment)}),Tt&&(Ve.fragmentHint?Ve.fragments.concat(Ve.fragmentHint):Ve.fragments).forEach(function(vt){var kt;vt.initSegment&&vt.initSegment.relurl!==((kt=Tt)===null||kt===void 0?void 0:kt.relurl)||(vt.initSegment=Tt)}),Ve.skippedSegments)if(Ve.deltaUpdateFailed=Ve.fragments.some(function(vt){return!vt}),Ve.deltaUpdateFailed){O.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var Wl=Ve.skippedSegments;Wl--;)Ve.fragments.shift();Ve.startSN=Ve.fragments[0].sn,Ve.startCC=Ve.fragments[0].cc}else Ve.canSkipDateRanges&&(Ve.dateRanges=(yr=je.dateRanges,fr=Ve.dateRanges,er=Ve.recentlyRemovedDateranges,br=I({},yr),er&&er.forEach(function(vt){delete br[vt]}),Object.keys(fr).forEach(function(vt){var kt=new pe(fr[vt].attr,br[vt]);kt.isValid?br[vt]=kt:O.logger.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(fr[vt].attr)+'"')}),br));var Ei=Ve.fragments;if(Zr){O.logger.warn("discontinuity sliding from playlist, take drift into account");for(var jn=0;jn<Ei.length;jn++)Ei[jn].cc+=Zr}Ve.skippedSegments&&(Ve.startCC=Ve.fragments[0].cc),function(vt,kt,an){if(vt&&kt)for(var wi=0,yi=0,nn=vt.length;yi<=nn;yi++){var di=vt[yi],Ii=kt[yi+wi];di&&Ii&&di.index===Ii.index&&di.fragment.sn===Ii.fragment.sn?(zi=di,(ai=Ii).elementaryStreams=zi.elementaryStreams,ai.stats=zi.stats):wi--}var zi,ai}(je.partList,Ve.partList),Gt?ie(Ve,Gt,Gt.startPTS,Gt.endPTS,Gt.startDTS,Gt.endDTS):ae(je,Ve),Ei.length&&(Ve.totalduration=Ve.edge-Ei[0].start),Ve.driftStartTime=je.driftStartTime,Ve.driftStart=je.driftStart;var qn=Ve.advancedDateTime;if(Ve.advanced&&qn){var Yn=Ve.edge;Ve.driftStart||(Ve.driftStartTime=qn,Ve.driftStart=Yn),Ve.driftEndTime=qn,Ve.driftEnd=Yn}else Ve.driftEndTime=je.driftEndTime,Ve.driftEnd=je.driftEnd,Ve.advancedDateTime=je.advancedDateTime}(s,l),!this.canLoad||!l.live)return;var f,p=void 0,_=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var S=this.hls.config.lowLatencyMode,C=l.lastPartSn,x=l.endSN,W=l.lastPartIndex,K=C===x;W!==-1?(p=K?x+1:C,_=K?S?0:W:W+1):p=x+1;var ee=l.age,me=ee+l.ageHeader,we=Math.min(me-l.partTarget,1.5*l.targetduration);if(we>0){if(s&&we>s.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+s.tuneInGoal+" to: "+we+" with playlist age: "+l.age),we=0;else{var ye=Math.floor(we/l.targetduration);p+=ye,_!==void 0&&(_+=Math.round(we%l.targetduration/l.partTarget)),this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+ee.toFixed(2)+"s goal: "+we+" skip sn "+ye+" to part "+_)}l.tuneInGoal=we}if(f=this.getDeliveryDirectives(l,r.deliveryDirectives,p,_),S||!K)return void this.loadPlaylist(f)}else f=this.getDeliveryDirectives(l,r.deliveryDirectives,p,_);var De=this.hls.mainForwardBufferInfo,qe=De?De.end-De.len:0,it=function(je,Ve){Ve===void 0&&(Ve=1/0);var Tt=1e3*je.targetduration;if(je.updated){var Wt=je.fragments;if(Wt.length&&4*Tt>Ve){var St=1e3*Wt[Wt.length-1].duration;St<Tt&&(Tt=St)}}else Tt/=2;return Math.round(Tt)}(l,1e3*(l.edge-qe));l.updated?u>this.requestScheduled+it&&(this.requestScheduled=n.loading.start):this.requestScheduled=-1,p!==void 0&&l.canBlockReload?this.requestScheduled=n.loading.first+it-(1e3*l.partTarget||1e3):this.requestScheduled=(this.requestScheduled===-1?u:this.requestScheduled)+it;var Ie=this.requestScheduled-u;Ie=Math.max(0,Ie),this.log("reload live playlist "+e+" in "+Math.round(Ie)+" ms"),this.timer=self.setTimeout(function(){return o.loadPlaylist(f)},Ie)}else this.clearTimer()},c.getDeliveryDirectives=function(e,r,s,o){var l=function(n,u){var h=n.canSkipUntil,f=n.canSkipDateRanges,p=n.endSN;return h&&(u!==void 0?u-p:0)<h?f?Qt.v2:Qt.Yes:Qt.No}(e,s);return r!=null&&r.skip&&e.deltaUpdateFailed&&(s=r.msn,o=r.part,l=Qt.No),new se(s,o,l)},c.retryLoadingOrFail=function(e){var r,s=this,o=this.hls.config,l=this.retryCount<o.levelLoadingMaxRetry;if(l)if(this.requestScheduled=-1,this.retryCount++,e.details.indexOf("LoadTimeOut")>-1&&(r=e.context)!==null&&r!==void 0&&r.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+e.details+'"'),this.loadPlaylist();else{var n=Math.min(Math.pow(2,this.retryCount)*o.levelLoadingRetryDelay,o.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return s.loadPlaylist()},n),this.warn("retry playlist loading #"+this.retryCount+" in "+n+' ms after "'+e.details+'"')}else this.warn('cannot recover from error "'+e.details+'"'),this.clearTimer(),e.fatal=!0;return l},m}();function Oe(){return Oe=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(m[r]=e[r])}return m},Oe.apply(this,arguments)}function Ke(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}function Qe(m,c){return Qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Qe(m,c)}var We,at=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),Et=function(m){var c,e;function r(n){var u;return(u=m.call(this,n,"[level-controller]")||this)._levels=[],u._firstLevel=-1,u._startLevel=void 0,u.currentLevelIndex=-1,u.manualLevelIndex=-1,u.onParsedComplete=void 0,u._registerListeners(),u}e=m,(c=r).prototype=Object.create(e.prototype),c.prototype.constructor=c,Qe(c,e);var s,o,l=r.prototype;return l._registerListeners=function(){var n=this.hls;n.on(y.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.on(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(y.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.on(y.Events.FRAG_LOADED,this.onFragLoaded,this),n.on(y.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var n=this.hls;n.off(y.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.off(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(y.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.off(y.Events.FRAG_LOADED,this.onFragLoaded,this),n.off(y.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,m.prototype.destroy.call(this)},l.startLoad=function(){this._levels.forEach(function(n){n.loadError=0}),m.prototype.startLoad.call(this)},l.onManifestLoaded=function(n,u){var h,f,p=[],_=[],S=[],C={},x=!1,W=!1,K=!1;if(u.levels.forEach(function(ye){var De=ye.attrs;x=x||!(!ye.width||!ye.height),W=W||!!ye.videoCodec,K=K||!!ye.audioCodec,at&&ye.audioCodec&&ye.audioCodec.indexOf("mp4a.40.34")!==-1&&(ye.audioCodec=void 0);var qe=ye.bitrate+"-"+ye.attrs.RESOLUTION+"-"+ye.attrs.CODECS;(f=C[qe])?f.url.push(ye.url):(f=new j(ye),C[qe]=f,p.push(f)),De&&(De.AUDIO&&G(f,"audio",De.AUDIO),De.SUBTITLES&&G(f,"text",De.SUBTITLES))}),(x||W)&&K&&(p=p.filter(function(ye){var De=ye.videoCodec,qe=ye.width,it=ye.height;return!!De||!(!qe||!it)})),p=p.filter(function(ye){var De=ye.audioCodec,qe=ye.videoCodec;return(!De||Fe(De,"audio"))&&(!qe||Fe(qe,"video"))}),u.audioTracks&&H(_=u.audioTracks.filter(function(ye){return!ye.audioCodec||Fe(ye.audioCodec,"audio")})),u.subtitles&&H(S=u.subtitles),p.length>0){h=p[0].bitrate,p.sort(function(ye,De){return ye.attrs["HDCP-LEVEL"]!==De.attrs["HDCP-LEVEL"]?(ye.attrs["HDCP-LEVEL"]||"")>(De.attrs["HDCP-LEVEL"]||"")?1:-1:ye.bitrate!==De.bitrate?ye.bitrate-De.bitrate:ye.attrs.SCORE!==De.attrs.SCORE?ye.attrs.decimalFloatingPoint("SCORE")-De.attrs.decimalFloatingPoint("SCORE"):x&&ye.height!==De.height?ye.height-De.height:0}),this._levels=p;for(var ee=0;ee<p.length;ee++)if(p[ee].bitrate===h){this._firstLevel=ee,this.log("manifest loaded, "+p.length+" level(s) found, first bitrate: "+h);break}var me=K&&!W,we={levels:p,audioTracks:_,subtitleTracks:S,sessionData:u.sessionData,sessionKeys:u.sessionKeys,firstLevel:this._firstLevel,stats:u.stats,audio:K,video:W,altAudio:!me&&_.some(function(ye){return!!ye.url})};this.hls.trigger(y.Events.MANIFEST_PARSED,we),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:u.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(n,u){var h,f;if(m.prototype.onError.call(this,n,u),!u.fatal){var p=u.context,_=this._levels[this.currentLevelIndex];if(p&&(p.type===Te.PlaylistContextType.AUDIO_TRACK&&_.audioGroupIds&&p.groupId===_.audioGroupIds[_.urlId]||p.type===Te.PlaylistContextType.SUBTITLE_TRACK&&_.textGroupIds&&p.groupId===_.textGroupIds[_.urlId]))this.redundantFailover(this.currentLevelIndex);else{var S,C=!1,x=!0;switch(u.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(u.frag){var W=u.frag.type===Te.PlaylistLevelType.MAIN?u.frag.level:this.currentLevelIndex,K=this._levels[W];K?(K.fragmentError++,K.fragmentError>this.hls.config.fragLoadingMaxRetry&&(S=W)):S=W}break;case P.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var ee=_.attrs["HDCP-LEVEL"];ee&&(this.hls.maxHdcpLevel=Fr[Fr.indexOf(ee)-1],this.warn('Restricting playback to HDCP-LEVEL of "'+this.hls.maxHdcpLevel+'" or lower'));case P.ErrorDetails.FRAG_PARSING_ERROR:case P.ErrorDetails.KEY_SYSTEM_NO_SESSION:S=((h=u.frag)===null||h===void 0?void 0:h.type)===Te.PlaylistLevelType.MAIN?u.frag.level:this.currentLevelIndex,u.levelRetry=!1;break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:p&&(p.deliveryDirectives&&(x=!1),S=p.level),C=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:S=(f=u.level)!=null?f:this.currentLevelIndex,C=!0}S!==void 0&&this.recoverLevel(u,S,C,x)}}},l.recoverLevel=function(n,u,h,f){var p=n.details,_=this._levels[u];if(_.loadError++,h){if(!this.retryLoadingOrFail(n))return void(this.currentLevelIndex=-1);n.levelRetry=!0}if(f){var S=_.url.length;if(S>1&&_.loadError<S)n.levelRetry=!0,this.redundantFailover(u);else if(this.manualLevelIndex===-1){for(var C=-1,x=this._levels,W=x.length;W--;){var K=(W+this.currentLevelIndex)%x.length;if(K!==this.currentLevelIndex&&x[K].loadError===0){C=K;break}}C>-1&&this.currentLevelIndex!==C?(this.warn(p+": switch to "+C),n.levelRetry=!0,this.hls.nextAutoLevel=C):n.levelRetry===!1&&(n.fatal=!0)}}},l.redundantFailover=function(n){var u=this._levels[n],h=u.url.length;if(h>1){var f=(u.urlId+1)%h;this.warn("Switching to redundant URL-id "+f),this._levels.forEach(function(p){p.urlId=f}),this.level=n}},l.onFragLoaded=function(n,u){var h=u.frag;if(h!==void 0&&h.type===Te.PlaylistLevelType.MAIN){var f=this._levels[h.level];f!==void 0&&(f.fragmentError=0,f.loadError=0)}},l.onLevelLoaded=function(n,u){var h,f,p=u.level,_=u.details,S=this._levels[p];if(!S)return this.warn("Invalid level index "+p),void((f=u.deliveryDirectives)!==null&&f!==void 0&&f.skip&&(_.deltaUpdateFailed=!0));p===this.currentLevelIndex?(S.fragmentError===0&&(S.loadError=0,this.retryCount=0),this.playlistLoaded(p,u,S.details)):(h=u.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(_.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(n,u){var h=this.hls.levels[this.currentLevelIndex];if(h&&h.audioGroupIds){for(var f=-1,p=this.hls.audioTracks[u.id].groupId,_=0;_<h.audioGroupIds.length;_++)if(h.audioGroupIds[_]===p){f=_;break}f!==h.urlId&&(h.urlId=f,this.startLoad())}},l.loadPlaylist=function(n){m.prototype.loadPlaylist.call(this);var u=this.currentLevelIndex,h=this._levels[u];if(this.canLoad&&h&&h.url.length>0){var f=h.urlId,p=h.url[f];if(n)try{p=n.addDirectives(p)}catch(_){this.warn("Could not construct new URL with HLS Delivery Directives: "+_)}this.log("Attempt loading level index "+u+(n?" at sn "+n.msn+" part "+n.part:"")+" with URL-id "+f+" "+p),this.clearTimer(),this.hls.trigger(y.Events.LEVEL_LOADING,{url:p,level:u,id:f,deliveryDirectives:n||null})}},l.removeLevel=function(n,u){var h=function(p,_){return _!==u},f=this._levels.filter(function(p,_){return _!==n||p.url.length>1&&u!==void 0&&(p.url=p.url.filter(h),p.audioGroupIds&&(p.audioGroupIds=p.audioGroupIds.filter(h)),p.textGroupIds&&(p.textGroupIds=p.textGroupIds.filter(h)),p.urlId=0,!0)}).map(function(p,_){var S=p.details;return S!=null&&S.fragments&&S.fragments.forEach(function(C){C.level=_}),p});this._levels=f,this.hls.trigger(y.Events.LEVELS_UPDATED,{levels:f})},s=r,(o=[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(n){var u,h=this._levels;if(h.length!==0&&(this.currentLevelIndex!==n||(u=h[n])===null||u===void 0||!u.details)){if(n<0||n>=h.length){var f=n<0;if(this.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:n,fatal:f,reason:"invalid level idx"}),f)return;n=Math.min(n,h.length-1)}this.clearTimer();var p=this.currentLevelIndex,_=h[p],S=h[n];this.log("switching to level "+n+" from "+p),this.currentLevelIndex=n;var C=Oe({},S,{level:n,maxBitrate:S.maxBitrate,uri:S.uri,urlId:S.urlId});delete C._urlId,this.hls.trigger(y.Events.LEVEL_SWITCHING,C);var x=S.details;if(!x||x.live){var W=this.switchParams(S.uri,_==null?void 0:_.details);this.loadPlaylist(W)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(n){this.manualLevelIndex=n,this._startLevel===void 0&&(this._startLevel=n),n!==-1&&(this.level=n)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(n){this._firstLevel=n}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var n=this.hls.config.startLevel;return n!==void 0?n:this._firstLevel}return this._startLevel},set:function(n){this._startLevel=n}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(n){this.level=n,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=n)}}])&&Ke(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),r}(Ce);(function(m){m.NOT_LOADED="NOT_LOADED",m.APPENDING="APPENDING",m.PARTIAL="PARTIAL",m.OK="OK"})(We||(We={}));var Ot=function(){function m(e){this.activeFragment=null,this.activeParts=null,this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=e,this._registerListeners()}var c=m.prototype;return c._registerListeners=function(){var e=this.hls;e.on(y.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(y.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(y.Events.FRAG_LOADED,this.onFragLoaded,this)},c._unregisterListeners=function(){var e=this.hls;e.off(y.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(y.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(y.Events.FRAG_LOADED,this.onFragLoaded,this)},c.destroy=function(){this._unregisterListeners(),this.fragments=this.endListFragments=this.timeRanges=this.activeFragment=this.activeParts=null},c.getAppendedFrag=function(e,r){if(r===Te.PlaylistLevelType.MAIN){var s=this.activeFragment,o=this.activeParts;if(!s)return null;if(o)for(var l=o.length;l--;){var n=o[l],u=n?n.end:s.appendedPTS;if(n.start<=e&&u!==void 0&&e<=u)return l>9&&(this.activeParts=o.slice(l-9)),n}else if(s.start<=e&&s.appendedPTS!==void 0&&e<=s.appendedPTS)return s}return this.getBufferedFrag(e,r)},c.getBufferedFrag=function(e,r){for(var s=this.fragments,o=Object.keys(s),l=o.length;l--;){var n=s[o[l]];if((n==null?void 0:n.body.type)===r&&n.buffered){var u=n.body;if(u.start<=e&&e<=u.end)return u}}return null},c.detectEvictedFragments=function(e,r,s){var o=this;this.timeRanges&&(this.timeRanges[e]=r),Object.keys(this.fragments).forEach(function(l){var n=o.fragments[l];if(n)if(n.buffered||n.loaded){var u=n.range[e];u&&u.time.some(function(h){var f=!o.isTimeBuffered(h.startPTS,h.endPTS,r);return f&&o.removeFragment(n.body),f})}else n.body.type===s&&o.removeFragment(n.body)})},c.detectPartialFragments=function(e){var r=this,s=this.timeRanges,o=e.frag,l=e.part;if(s&&o.sn!=="initSegment"){var n=Ht(o),u=this.fragments[n];u&&(Object.keys(s).forEach(function(h){var f=o.elementaryStreams[h];if(f){var p=s[h],_=l!==null||f.partial===!0;u.range[h]=r.getBufferedTimes(o,l,_,p)}}),u.loaded=null,Object.keys(u.range).length?(u.buffered=!0,u.body.endList&&(this.endListFragments[u.body.type]=u)):this.removeFragment(u.body))}},c.fragBuffered=function(e){var r=Ht(e),s=this.fragments[r];s&&(s.loaded=null,s.buffered=!0)},c.getBufferedTimes=function(e,r,s,o){for(var l={time:[],partial:s},n=r?r.start:e.start,u=r?r.end:e.end,h=e.minEndPTS||u,f=e.maxStartPTS||n,p=0;p<o.length;p++){var _=o.start(p)-this.bufferPadding,S=o.end(p)+this.bufferPadding;if(f>=_&&h<=S){l.time.push({startPTS:Math.max(n,o.start(p)),endPTS:Math.min(u,o.end(p))});break}if(n<S&&u>_)l.partial=!0,l.time.push({startPTS:Math.max(n,o.start(p)),endPTS:Math.min(u,o.end(p))});else if(u<=_)break}return l},c.getPartialFragment=function(e){var r,s,o,l=null,n=0,u=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(f){var p=h[f];p&&Ze(p)&&(s=p.body.start-u,o=p.body.end+u,e>=s&&e<=o&&(r=Math.min(e-s,o-e),n<=r&&(l=p.body,n=r)))}),l},c.isEndListAppended=function(e){var r=this.endListFragments[e];return r!==void 0&&(r.buffered||Ze(r))},c.getState=function(e){var r=Ht(e),s=this.fragments[r];return s?s.buffered?Ze(s)?We.PARTIAL:We.OK:We.APPENDING:We.NOT_LOADED},c.isTimeBuffered=function(e,r,s){for(var o,l,n=0;n<s.length;n++){if(o=s.start(n)-this.bufferPadding,l=s.end(n)+this.bufferPadding,e>=o&&r<=l)return!0;if(r<=o)return!1}return!1},c.onFragLoaded=function(e,r){var s=r.frag,o=r.part;if(s.sn!=="initSegment"&&!s.bitrateTest&&!o){var l=Ht(s);this.fragments[l]={body:s,loaded:r,buffered:!1,range:Object.create(null)}}},c.onBufferAppended=function(e,r){var s=this,o=r.frag,l=r.part,n=r.timeRanges;if(o.type===Te.PlaylistLevelType.MAIN)if(this.activeFragment!==o&&(this.activeFragment=o,o.appendedPTS=void 0),l){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(l)}else this.activeParts=null;this.timeRanges=n,Object.keys(n).forEach(function(h){var f=n[h];if(s.detectEvictedFragments(h,f),!l&&o.type===Te.PlaylistLevelType.MAIN){var p=o.elementaryStreams[h];if(!p)return;for(var _=0;_<f.length;_++){var S=f.end(_);S<=p.endPTS&&S>p.startPTS?o.appendedPTS=Math.max(S,o.appendedPTS||0):o.appendedPTS=p.endPTS}}})},c.onFragBuffered=function(e,r){this.detectPartialFragments(r)},c.hasFragment=function(e){var r=Ht(e);return!!this.fragments[r]},c.removeFragmentsInRange=function(e,r,s){var o=this;Object.keys(this.fragments).forEach(function(l){var n=o.fragments[l];if(n&&n.buffered){var u=n.body;u.type===s&&u.start<r&&u.end>e&&o.removeFragment(u)}})},c.removeFragment=function(e){var r=Ht(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),e.appendedPTS=void 0,delete this.fragments[r],e.endList&&delete this.endListFragments[e.type]},c.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activeFragment=null,this.activeParts=null},m}();function Ze(m){var c,e;return m.buffered&&(((c=m.range.video)===null||c===void 0?void 0:c.partial)||((e=m.range.audio)===null||e===void 0?void 0:e.partial))}function Ht(m){return m.type+"_"+m.level+"_"+m.urlId+"_"+m.sn}function gr(m){var c=typeof Map=="function"?new Map:void 0;return gr=function(e){if(e===null||(r=e,Function.toString.call(r).indexOf("[native code]")===-1))return e;var r;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(c!==void 0){if(c.has(e))return c.get(e);c.set(e,s)}function s(){return Yt(e,arguments,ut(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),Xt(s,e)},gr(m)}function Yt(m,c,e){return Yt=jt()?Reflect.construct.bind():function(r,s,o){var l=[null];l.push.apply(l,s);var n=new(Function.bind.apply(r,l));return o&&Xt(n,o.prototype),n},Yt.apply(null,arguments)}function jt(){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 Xt(m,c){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Xt(m,c)}function ut(m){return ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(c){return c.__proto__||Object.getPrototypeOf(c)},ut(m)}var Lr=Math.pow(2,17),ti=function(){function m(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var c=m.prototype;return c.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},c.abort=function(){this.loader&&this.loader.abort()},c.load=function(e,r){var s=this,o=e.url;if(!o)return Promise.reject(new dr({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(o?"part list":"url")));this.abort();var l=this.config,n=l.fLoader,u=l.loader;return new Promise(function(h,f){s.loader&&s.loader.destroy();var p=s.loader=e.loader=n?new n(l):new u(l),_=zt(e),S={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:e.sn==="initSegment"?1/0:Lr};e.stats=p.stats,p.load(_,S,{onSuccess:function(C,x,W,K){s.resetLoader(e,p);var ee=C.data;W.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(ee.slice(0,16)),ee=ee.slice(16)),h({frag:e,part:null,payload:ee,networkDetails:K})},onError:function(C,x,W){s.resetLoader(e,p),f(new dr({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:C,networkDetails:W}))},onAbort:function(C,x,W){s.resetLoader(e,p),f(new dr({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:W}))},onTimeout:function(C,x,W){s.resetLoader(e,p),f(new dr({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:W}))},onProgress:function(C,x,W,K){r&&r({frag:e,part:null,payload:W,networkDetails:K})}})})},c.loadPart=function(e,r,s){var o=this;this.abort();var l=this.config,n=l.fLoader,u=l.loader;return new Promise(function(h,f){o.loader&&o.loader.destroy();var p=o.loader=e.loader=n?new n(l):new u(l),_=zt(e,r),S={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:Lr};r.stats=p.stats,p.load(_,S,{onSuccess:function(C,x,W,K){o.resetLoader(e,p),o.updateStatsFromPart(e,r);var ee={frag:e,part:r,payload:C.data,networkDetails:K};s(ee),h(ee)},onError:function(C,x,W){o.resetLoader(e,p),f(new dr({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:r,response:C,networkDetails:W}))},onAbort:function(C,x,W){e.stats.aborted=r.stats.aborted,o.resetLoader(e,p),f(new dr({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:r,networkDetails:W}))},onTimeout:function(C,x,W){o.resetLoader(e,p),f(new dr({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:r,networkDetails:W}))}})})},c.updateStatsFromPart=function(e,r){var s=e.stats,o=r.stats,l=o.total;if(s.loaded+=o.loaded,l){var n=Math.round(e.duration/r.duration),u=Math.min(Math.round(s.loaded/l),n),h=(n-u)*Math.round(s.loaded/u);s.total=s.loaded+h}else s.total=Math.max(s.loaded,s.total);var f=s.loading,p=o.loading;f.start?f.first+=p.first-p.start:(f.start=p.start,f.first=p.first),f.end=p.end},c.resetLoader=function(e,r){e.loader=null,this.loader===r&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),r.destroy()},m}();function zt(m,c){c===void 0&&(c=null);var e=c||m,r={frag:m,part:c,responseType:"arraybuffer",url:e.url,headers:{},rangeStart:0,rangeEnd:0},s=e.byteRangeStartOffset,o=e.byteRangeEndOffset;if((0,R.isFiniteNumber)(s)&&(0,R.isFiniteNumber)(o)){var l,n=s,u=o;if(m.sn==="initSegment"&&((l=m.decryptdata)===null||l===void 0?void 0:l.method)==="AES-128"){var h=o-s;h%16&&(u=o+(16-h%16)),s!==0&&(r.resetIV=!0,n=s-16)}r.rangeStart=n,r.rangeEnd=u}return r}var dr=function(m){var c,e;function r(s){for(var o,l=arguments.length,n=new Array(l>1?l-1:0),u=1;u<l;u++)n[u-1]=arguments[u];return(o=m.call.apply(m,[this].concat(n))||this).data=void 0,o.data=s,o}return e=m,(c=r).prototype=Object.create(e.prototype),c.prototype.constructor=c,Xt(c,e),r}(gr(Error)),Vr=function(){function m(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var c=m.prototype;return c.abort=function(){for(var e in this.keyUriToKeyInfo){var r=this.keyUriToKeyInfo[e].loader;r&&r.abort()}},c.detach=function(){for(var e in this.keyUriToKeyInfo){var r=this.keyUriToKeyInfo[e];(r.mediaKeySessionContext||r.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},c.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var r=this.keyUriToKeyInfo[e].loader;r&&r.destroy()}this.keyUriToKeyInfo={}},c.createKeyLoadError=function(e,r,s,o){return r===void 0&&(r=P.ErrorDetails.KEY_LOAD_ERROR),new dr({type:P.ErrorTypes.NETWORK_ERROR,details:r,fatal:!1,frag:e,networkDetails:s})},c.loadClear=function(e,r){var s=this;if(this.emeController&&this.config.emeEnabled)for(var o=e.sn,l=e.cc,n=function(h){var f=r[h];if(l<=f.cc&&(o==="initSegment"||o<f.sn))return s.emeController.selectKeySystemFormat(f).then(function(p){f.setKeyFormat(p)}),"break"},u=0;u<r.length&&n(u)!=="break";u++);},c.load=function(e){var r=this;return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(function(s){return r.loadInternal(e,s)}):this.loadInternal(e)},c.loadInternal=function(e,r){var s,o;r&&e.setKeyFormat(r);var l=e.decryptdata;if(!l){var n=r?"Expected frag.decryptdata to be defined after setting format "+r:"Missing decryption data on fragment in onKeyLoading";return Promise.reject(this.createKeyLoadError(e,P.ErrorDetails.KEY_LOAD_ERROR,null,n))}var u=l.uri;if(!u)return Promise.reject(this.createKeyLoadError(e,P.ErrorDetails.KEY_LOAD_ERROR,null,'Invalid key URI: "'+u+'"'));var h,f=this.keyUriToKeyInfo[u];if((s=f)!==null&&s!==void 0&&s.decryptdata.key)return l.key=f.decryptdata.key,Promise.resolve({frag:e,keyInfo:f});if((o=f)!==null&&o!==void 0&&o.keyLoadPromise)switch((h=f.mediaKeySessionContext)===null||h===void 0?void 0:h.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return f.keyLoadPromise}switch(f=this.keyUriToKeyInfo[u]={decryptdata:l,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},l.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return l.keyFormat==="identity"?this.loadKeyHTTP(f,e):this.loadKeyEME(f,e);case"AES-128":return this.loadKeyHTTP(f,e);default:return Promise.reject(this.createKeyLoadError(e,P.ErrorDetails.KEY_LOAD_ERROR,null,'Key supplied with unsupported METHOD: "'+l.method+'"'))}},c.loadKeyEME=function(e,r){var s={frag:r,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var o=this.emeController.loadKey(s);if(o)return(e.keyLoadPromise=o.then(function(l){return e.mediaKeySessionContext=l,s})).catch(function(l){throw e.keyLoadPromise=null,l})}return Promise.resolve(s)},c.loadKeyHTTP=function(e,r){var s=this,o=this.config,l=new o.loader(o);return r.keyLoader=e.loader=l,e.keyLoadPromise=new Promise(function(n,u){var h={keyInfo:e,frag:r,responseType:"arraybuffer",url:e.decryptdata.uri},f={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:function(_,S,C,x){var W=C.frag,K=C.keyInfo,ee=C.url;if(!W.decryptdata||K!==s.keyUriToKeyInfo[ee])return u(s.createKeyLoadError(W,P.ErrorDetails.KEY_LOAD_ERROR,x,"after key load, decryptdata unset or changed"));K.decryptdata.key=W.decryptdata.key=new Uint8Array(_.data),W.keyLoader=null,K.loader=null,n({frag:W,keyInfo:K})},onError:function(_,S,C){s.resetLoader(S),u(s.createKeyLoadError(r,P.ErrorDetails.KEY_LOAD_ERROR,C))},onTimeout:function(_,S,C){s.resetLoader(S),u(s.createKeyLoadError(r,P.ErrorDetails.KEY_LOAD_TIMEOUT,C))},onAbort:function(_,S,C){s.resetLoader(S),u(s.createKeyLoadError(r,P.ErrorDetails.INTERNAL_ABORTED,C))}};l.load(h,f,p)})},c.resetLoader=function(e){var r=e.frag,s=e.keyInfo,o=e.url,l=s.loader;r.keyLoader===l&&(r.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[o],l&&l.destroy()},m}(),gi=function(){function m(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var c=m.prototype;return c.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},c.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},c.onHandlerDestroyed=function(){},c.hasInterval=function(){return!!this._tickInterval},c.hasNextTick=function(){return!!this._tickTimer},c.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},c.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},c.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},c.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},c.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},c.doTick=function(){},m}(),Br={length:0,start:function(){return 0},end:function(){return 0}},$t=function(){function m(){}return m.isBuffered=function(c,e){try{if(c){for(var r=m.getBuffered(c),s=0;s<r.length;s++)if(e>=r.start(s)&&e<=r.end(s))return!0}}catch{}return!1},m.bufferInfo=function(c,e,r){try{if(c){var s,o=m.getBuffered(c),l=[];for(s=0;s<o.length;s++)l.push({start:o.start(s),end:o.end(s)});return this.bufferedInfo(l,e,r)}}catch{}return{len:0,start:e,end:e,nextStart:void 0}},m.bufferedInfo=function(c,e,r){e=Math.max(0,e),c.sort(function(x,W){return x.start-W.start||W.end-x.end});var s=[];if(r)for(var o=0;o<c.length;o++){var l=s.length;if(l){var n=s[l-1].end;c[o].start-n<r?c[o].end>n&&(s[l-1].end=c[o].end):s.push(c[o])}else s.push(c[o])}else s=c;for(var u,h=0,f=e,p=e,_=0;_<s.length;_++){var S=s[_].start,C=s[_].end;if(e+r>=S&&e<C)f=S,h=(p=C)-e;else if(e+r<S){u=S;break}}return{len:h,start:f||0,end:p||0,nextStart:u}},m.getBuffered=function(c){try{return c.buffered}catch(e){return O.logger.log("failed to get media.buffered",e),Br}},m}(),xn=function(m,c,e,r,s,o){r===void 0&&(r=0),s===void 0&&(s=-1),o===void 0&&(o=!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={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=m,this.sn=c,this.id=e,this.size=r,this.part=s,this.partial=o};function Gs(m,c){for(var e=null,r=0,s=m.length;r<s;r++){var o=m[r];if(o&&o.cc===c){e=o;break}}return e}function ri(m,c){if(m){var e=m.start+c;m.start=m.startPTS=e,m.endPTS=e+m.duration}}function qa(m,c){for(var e=c.fragments,r=0,s=e.length;r<s;r++)ri(e[r],m);c.fragmentHint&&ri(c.fragmentHint,m),c.alignedSliding=!0}function Vs(m,c){if(m.hasProgramDateTime&&c.hasProgramDateTime){var e=m.fragments,r=c.fragments;if(e.length&&r.length){var s=r[Math.round(r.length/2)-1],o=Gs(e,s.cc)||e[Math.round(e.length/2)-1],l=s.programDateTime,n=o.programDateTime;l!==null&&n!==null&&qa((n-l)/1e3-(o.start-s.start),m)}}}let Ws=function(m,c){for(var e=0,r=m.length-1,s=null,o=null;e<=r;){var l=c(o=m[s=(e+r)/2|0]);if(l>0)e=s+1;else{if(!(l<0))return o;r=s-1}}return null};function Ya(m,c,e,r){e===void 0&&(e=0),r===void 0&&(r=0);var s=null;if(m?s=c[m.sn-c[0].sn+1]||null:e===0&&c[0].start===0&&(s=c[0]),s&&$a(e,r,s)===0)return s;var o=Ws(c,$a.bind(null,e,r));return!o||o===m&&s?s:o}function $a(m,c,e){if(m===void 0&&(m=0),c===void 0&&(c=0),e.start<=m&&e.start+e.duration>m)return 0;var r=Math.min(c,e.duration+(e.deltaPTS?e.deltaPTS:0));return e.start+e.duration-r<=m?1:e.start-r>m&&e.start?-1:0}function Ki(m,c,e){var r=1e3*Math.min(c,e.duration+(e.deltaPTS?e.deltaPTS:0));return(e.endProgramDateTime||0)-r>m}var pa=b(21);let yl=function(m){for(var c="",e=m.length,r=0;r<e;r++)c+="["+m.start(r).toFixed(3)+","+m.end(r).toFixed(3)+"]";return c};function js(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}function Gi(m,c){return Gi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Gi(m,c)}var Xr="STOPPED",Ct="IDLE",qs="KEY_LOADING",Vi="FRAG_LOADING",Ai="FRAG_LOADING_WAITING_RETRY",za="WAITING_TRACK",ii="PARSING",Wi="PARSED",va="ENDED",li="ERROR",Si="WAITING_INIT_PTS",ji="WAITING_LEVEL",Qa=function(m){var c,e;function r(n,u,h,f){var p;return(p=m.call(this)||this).hls=void 0,p.fragPrevious=null,p.fragCurrent=null,p.fragmentTracker=void 0,p.transmuxer=null,p._state=Xr,p.media=null,p.mediaBuffer=null,p.config=void 0,p.bitrateTest=!1,p.lastCurrentTime=0,p.nextLoadPosition=0,p.startPosition=0,p.loadedmetadata=!1,p.fragLoadError=0,p.retryDate=0,p.levels=null,p.fragmentLoader=void 0,p.keyLoader=void 0,p.levelLastLoaded=null,p.startFragRequested=!1,p.decrypter=void 0,p.initPTS=[],p.onvseeking=null,p.onvended=null,p.logPrefix="",p.log=void 0,p.warn=void 0,p.logPrefix=f,p.log=O.logger.log.bind(O.logger,f+":"),p.warn=O.logger.warn.bind(O.logger,f+":"),p.hls=n,p.fragmentLoader=new ti(n.config),p.keyLoader=h,p.fragmentTracker=u,p.config=n.config,p.decrypter=new pa.default(n.config),n.on(y.Events.LEVEL_SWITCHING,p.onLevelSwitching,function(_){if(_===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _}(p)),p}e=m,(c=r).prototype=Object.create(e.prototype),c.prototype.constructor=c,Gi(c,e);var s,o,l=r.prototype;return l.doTick=function(){this.onTickEnd()},l.onTickEnd=function(){},l.startLoad=function(n){},l.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort();var n=this.fragCurrent;n&&(n.abortRequests(),this.fragmentTracker.removeFragment(n)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Xr},l._streamEnded=function(n,u){if(u.live||n.nextStart||!n.end||!this.media)return!1;var h=u.partList;if(h!=null&&h.length){var f=h[h.length-1];return $t.isBuffered(this.media,f.start+f.duration/2)}var p=u.fragments[u.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(p)},l.getLevelDetails=function(){var n;if(this.levels&&this.levelLastLoaded!==null)return(n=this.levels[this.levelLastLoaded])===null||n===void 0?void 0:n.details},l.onMediaAttached=function(n,u){var h=this.media=this.mediaBuffer=u.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),h.addEventListener("seeking",this.onvseeking),h.addEventListener("ended",this.onvended);var f=this.config;this.levels&&f.autoStartLoad&&this.state===Xr&&this.startLoad(f.startPosition)},l.onMediaDetaching=function(){var n=this.media;n!=null&&n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),n&&this.onvseeking&&this.onvended&&(n.removeEventListener("seeking",this.onvseeking),n.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},l.onMediaSeeking=function(){var n=this.config,u=this.fragCurrent,h=this.media,f=this.mediaBuffer,p=this.state,_=h?h.currentTime:0,S=$t.bufferInfo(f||h,_,n.maxBufferHole);if(this.log("media seeking to "+((0,R.isFiniteNumber)(_)?_.toFixed(3):_)+", state: "+p),this.state===va)this.resetLoadingState();else if(u){var C=n.maxFragLookUpTolerance,x=u.start-C,W=u.start+u.duration+C;if(!S.len||W<S.start||x>S.end){var K=_>W;(_<x||K)&&(K&&u.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),u.abortRequests()),this.resetLoadingState())}}h&&(this.lastCurrentTime=_),this.loadedmetadata||S.len||(this.nextLoadPosition=this.startPosition=_),this.tickImmediate()},l.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},l.onLevelSwitching=function(n,u){this.fragLoadError=0},l.onHandlerDestroying=function(){this.stopLoad(),m.prototype.onHandlerDestroying.call(this)},l.onHandlerDestroyed=function(){this.state=Xr,this.hls.off(y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,m.prototype.onHandlerDestroyed.call(this)},l.loadFragment=function(n,u,h){this._loadFragForPlayback(n,u,h)},l._loadFragForPlayback=function(n,u,h){var f=this;this._doFragLoad(n,u,h,function(p){if(f.fragContextChanged(n))return f.warn("Fragment "+n.sn+(p.part?" p: "+p.part.index:"")+" of level "+n.level+" was dropped during download."),void f.fragmentTracker.removeFragment(n);n.stats.chunkCount++,f._handleFragmentLoadProgress(p)}).then(function(p){if(p){f.fragLoadError=0;var _=f.state;f.fragContextChanged(n)?(_===Vi||!f.fragCurrent&&_===ii)&&(f.fragmentTracker.removeFragment(n),f.state=Ct):("payload"in p&&(f.log("Loaded fragment "+n.sn+" of level "+n.level),f.hls.trigger(y.Events.FRAG_LOADED,p)),f._handleFragmentLoadComplete(p))}}).catch(function(p){f.state!==Xr&&f.state!==li&&(f.warn(p),f.resetFragmentLoading(n))})},l.flushMainBuffer=function(n,u,h){if(h===void 0&&(h=null),n-u){var f={startOffset:n,endOffset:u,type:h};this.fragLoadError=0,this.hls.trigger(y.Events.BUFFER_FLUSHING,f)}},l._loadInitSegment=function(n,u){var h=this;this._doFragLoad(n,u).then(function(f){if(!f||h.fragContextChanged(n)||!h.levels)throw new Error("init load aborted");return f}).then(function(f){var p=h.hls,_=f.payload,S=n.decryptdata;if(_&&_.byteLength>0&&S&&S.key&&S.iv&&S.method==="AES-128"){var C=self.performance.now();return h.decrypter.decrypt(new Uint8Array(_),S.key.buffer,S.iv.buffer).then(function(x){var W=self.performance.now();return p.trigger(y.Events.FRAG_DECRYPTED,{frag:n,payload:x,stats:{tstart:C,tdecrypt:W}}),f.payload=x,f})}return f}).then(function(f){var p=h.fragCurrent,_=h.hls,S=h.levels;if(!S)throw new Error("init load aborted, missing levels");S[n.level].details;var C=n.stats;h.state=Ct,h.fragLoadError=0,n.data=new Uint8Array(f.payload),C.parsing.start=C.buffering.start=self.performance.now(),C.parsing.end=C.buffering.end=self.performance.now(),f.frag===p&&_.trigger(y.Events.FRAG_BUFFERED,{stats:C,frag:p,part:null,id:n.type}),h.tick()}).catch(function(f){h.state!==Xr&&h.state!==li&&(h.warn(f),h.resetFragmentLoading(n))})},l.fragContextChanged=function(n){var u=this.fragCurrent;return!n||!u||n.level!==u.level||n.sn!==u.sn||n.urlId!==u.urlId},l.fragBufferedComplete=function(n,u){var h,f,p=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+n.type+" sn: "+n.sn+(u?" part: "+u.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+n.level+" "+(p?yl($t.getBuffered(p)):"(detached)")),this.state=Ct,p&&(!this.loadedmetadata&&n.type==Te.PlaylistLevelType.MAIN&&p.buffered.length&&((h=this.fragCurrent)===null||h===void 0?void 0:h.sn)===((f=this.fragPrevious)===null||f===void 0?void 0:f.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},l.seekToStartPos=function(){},l._handleFragmentLoadComplete=function(n){var u=this.transmuxer;if(u){var h=n.frag,f=n.part,p=n.partsLoaded,_=!p||p.length===0||p.some(function(C){return!C}),S=new xn(h.level,h.sn,h.stats.chunkCount+1,0,f?f.index:-1,!_);u.flush(S)}},l._handleFragmentLoadProgress=function(n){},l._doFragLoad=function(n,u,h,f){var p,_=this;if(h===void 0&&(h=null),!this.levels)throw new Error("frag load aborted, missing levels");var S=null;if(!n.encrypted||(p=n.decryptdata)!==null&&p!==void 0&&p.key?!n.encrypted&&u.encryptedFragments.length&&this.keyLoader.loadClear(n,u.encryptedFragments):(this.log("Loading key for "+n.sn+" of ["+u.startSN+"-"+u.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+n.level),this.state=qs,this.fragCurrent=n,S=this.keyLoader.load(n).then(function(ee){if(!_.fragContextChanged(ee.frag))return _.hls.trigger(y.Events.KEY_LOADED,ee),ee}),this.hls.trigger(y.Events.KEY_LOADING,{frag:n}),this.throwIfFragContextChanged("KEY_LOADING")),h=Math.max(n.start,h||0),this.config.lowLatencyMode&&u){var C=u.partList;if(C&&f){h>n.end&&u.fragmentHint&&(n=u.fragmentHint);var x=this.getNextPart(C,n,h);if(x>-1){var W=C[x];return this.log("Loading part sn: "+n.sn+" p: "+W.index+" cc: "+n.cc+" of playlist ["+u.startSN+"-"+u.endSN+"] parts [0-"+x+"-"+(C.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+n.level+", target: "+parseFloat(h.toFixed(3))),this.nextLoadPosition=W.start+W.duration,this.state=Vi,this.hls.trigger(y.Events.FRAG_LOADING,{frag:n,part:C[x],targetBufferTime:h}),this.throwIfFragContextChanged("FRAG_LOADING parts"),S?S.then(function(ee){return!ee||_.fragContextChanged(ee.frag)?null:_.doFragPartsLoad(n,C,x,f)}).catch(function(ee){return _.handleFragLoadError(ee)}):this.doFragPartsLoad(n,C,x,f).catch(function(ee){return _.handleFragLoadError(ee)})}if(!n.url||this.loadedEndOfParts(C,h))return Promise.resolve(null)}}this.log("Loading fragment "+n.sn+" cc: "+n.cc+" "+(u?"of ["+u.startSN+"-"+u.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+n.level+", target: "+parseFloat(h.toFixed(3))),(0,R.isFiniteNumber)(n.sn)&&!this.bitrateTest&&(this.nextLoadPosition=n.start+n.duration),this.state=Vi,this.hls.trigger(y.Events.FRAG_LOADING,{frag:n,targetBufferTime:h}),this.throwIfFragContextChanged("FRAG_LOADING");var K=this.config.progressive;return K&&S?S.then(function(ee){return!ee||_.fragContextChanged(ee==null?void 0:ee.frag)?null:_.fragmentLoader.load(n,f)}).catch(function(ee){return _.handleFragLoadError(ee)}):Promise.all([this.fragmentLoader.load(n,K?f:void 0),S]).then(function(ee){var me=ee[0];return!K&&me&&f&&f(me),me}).catch(function(ee){return _.handleFragLoadError(ee)})},l.throwIfFragContextChanged=function(n){if(this.fragCurrent===null)throw new Error("frag load aborted, context changed in "+n)},l.doFragPartsLoad=function(n,u,h,f){var p=this;return new Promise(function(_,S){var C=[];(function x(W){var K=u[W];p.fragmentLoader.loadPart(n,K,f).then(function(ee){C[K.index]=ee;var me=ee.part;p.hls.trigger(y.Events.FRAG_LOADED,ee);var we=u[W+1];if(!we||we.fragment!==n)return _({frag:n,part:me,partsLoaded:C});x(W+1)}).catch(S)})(h)})},l.handleFragLoadError=function(n){if("data"in n){var u=n.data;n.data&&u.details===P.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(u.frag,u.part):this.hls.trigger(y.Events.ERROR,u)}else this.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,err:n,fatal:!0});return null},l._handleTransmuxerFlush=function(n){var u=this.getCurrentContext(n);if(u&&this.state===ii){var h=u.frag,f=u.part,p=u.level,_=self.performance.now();h.stats.parsing.end=_,f&&(f.stats.parsing.end=_),this.updateLevelTiming(h,f,p,n.partial)}else this.fragCurrent||this.state===Xr||this.state===li||(this.state=Ct)},l.getCurrentContext=function(n){var u=this.levels,h=n.level,f=n.sn,p=n.part;if(!u||!u[h])return this.warn("Levels object was unset while buffering fragment "+f+" of level "+h+". The current chunk will not be buffered."),null;var _=u[h],S=p>-1?function(x,W,K){if(!x||!x.details)return null;var ee=x.details.partList;if(ee)for(var me=ee.length;me--;){var we=ee[me];if(we.index===K&&we.fragment.sn===W)return we}return null}(_,f,p):null,C=S?S.fragment:function(x,W,K){if(!x||!x.details)return null;var ee=x.details,me=ee.fragments[W-ee.startSN];return me||((me=ee.fragmentHint)&&me.sn===W?me:W<ee.startSN&&K&&K.sn===W?K:null)}(_,f,this.fragCurrent);return C?{frag:C,part:S,level:_}:null},l.bufferFragmentData=function(n,u,h,f){if(n&&this.state===ii){var p=n.data1,_=n.data2,S=p;if(p&&_&&(S=(0,te.appendUint8Array)(p,_)),S&&S.length){var C={type:n.type,frag:u,part:h,chunkMeta:f,parent:u.type,data:S};this.hls.trigger(y.Events.BUFFER_APPENDING,C),n.dropped&&n.independent&&!h&&this.flushBufferGap(u)}}},l.flushBufferGap=function(n){var u=this.media;if(u)if($t.isBuffered(u,u.currentTime)){var h=u.currentTime,f=$t.bufferInfo(u,h,0),p=n.duration,_=Math.min(2*this.config.maxFragLookUpTolerance,.25*p),S=Math.max(Math.min(n.start-_,f.end-_),h+_);n.start-S>_&&this.flushMainBuffer(S,n.start)}else this.flushMainBuffer(0,n.start)},l.getFwdBufferInfo=function(n,u){var h=this.config,f=this.getLoadPosition();if(!(0,R.isFiniteNumber)(f))return null;var p=$t.bufferInfo(n,f,h.maxBufferHole);if(p.len===0&&p.nextStart!==void 0){var _=this.fragmentTracker.getBufferedFrag(f,u);if(_&&p.nextStart<_.end)return $t.bufferInfo(n,f,Math.max(p.nextStart,h.maxBufferHole))}return p},l.getMaxBufferLength=function(n){var u,h=this.config;return u=n?Math.max(8*h.maxBufferSize/n,h.maxBufferLength):h.maxBufferLength,Math.min(u,h.maxMaxBufferLength)},l.reduceMaxBufferLength=function(n){var u=this.config,h=n||u.maxBufferLength;return u.maxMaxBufferLength>=h&&(u.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+u.maxMaxBufferLength+"s"),!0)},l.getNextFragment=function(n,u){var h=u.fragments,f=h.length;if(!f)return null;var p,_=this.config,S=h[0].start;if(u.live){var C=_.initialLiveManifestSize;if(f<C)return this.warn("Not enough fragments to start playback (have: "+f+", need: "+C+")"),null;u.PTSKnown||this.startFragRequested||this.startPosition!==-1||(p=this.getInitialLiveFragment(u,h),this.startPosition=p?this.hls.liveSyncPosition||p.start:n)}else n<=S&&(p=h[0]);if(!p){var x=_.lowLatencyMode?u.partEnd:u.fragmentEnd;p=this.getFragmentAtPosition(n,x,u)}return this.mapToInitFragWhenRequired(p)},l.mapToInitFragWhenRequired=function(n){return n==null||!n.initSegment||n!=null&&n.initSegment.data||this.bitrateTest?n:n.initSegment},l.getNextPart=function(n,u,h){for(var f=-1,p=!1,_=!0,S=0,C=n.length;S<C;S++){var x=n[S];if(_=_&&!x.independent,f>-1&&h<x.start)break;var W=x.loaded;W?f=-1:(p||x.independent||_)&&x.fragment===u&&(f=S),p=W}return f},l.loadedEndOfParts=function(n,u){var h=n[n.length-1];return h&&u>h.start&&h.loaded},l.getInitialLiveFragment=function(n,u){var h=this.fragPrevious,f=null;if(h){if(n.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+h.programDateTime),f=function(C,x,W){if(x===null||!Array.isArray(C)||!C.length||!(0,R.isFiniteNumber)(x)||x<(C[0].programDateTime||0)||x>=(C[C.length-1].endProgramDateTime||0))return null;W=W||0;for(var K=0;K<C.length;++K){var ee=C[K];if(Ki(x,W,ee))return ee}return null}(u,h.endProgramDateTime,this.config.maxFragLookUpTolerance)),!f){var p=h.sn+1;if(p>=n.startSN&&p<=n.endSN){var _=u[p-n.startSN];h.cc===_.cc&&(f=_,this.log("Live playlist, switching playlist, load frag with next SN: "+f.sn))}f||(f=function(C,x){return Ws(C,function(W){return W.cc<x?1:W.cc>x?-1:0})}(u,h.cc),f&&this.log("Live playlist, switching playlist, load frag with same CC: "+f.sn))}}else{var S=this.hls.liveSyncPosition;S!==null&&(f=this.getFragmentAtPosition(S,this.bitrateTest?n.fragmentEnd:n.edge,n))}return f},l.getFragmentAtPosition=function(n,u,h){var f,p=this.config,_=this.fragPrevious,S=h.fragments,C=h.endSN,x=h.fragmentHint,W=p.maxFragLookUpTolerance,K=!!(p.lowLatencyMode&&h.partList&&x);if(K&&x&&!this.bitrateTest&&(S=S.concat(x),C=x.sn),f=n<u?Ya(_,S,n,n>u-W?0:W):S[S.length-1]){var ee=f.sn-h.startSN;if(this.fragmentTracker.getState(f)===We.OK&&(_=f),_&&f.sn===_.sn&&!K&&_&&f.level===_.level){var me=S[ee+1];f.sn<C&&this.fragmentTracker.getState(me)!==We.OK?(this.log("SN "+f.sn+" just loaded, load next one: "+me.sn),f=me):f=null}}return f},l.synchronizeToLiveEdge=function(n){var u=this.config,h=this.media;if(h){var f=this.hls.liveSyncPosition,p=h.currentTime,_=n.fragments[0].start,S=n.edge,C=p>=_-u.maxFragLookUpTolerance&&p<=S;if(f!==null&&h.duration>f&&(p<f||!C)){var x=u.liveMaxLatencyDuration!==void 0?u.liveMaxLatencyDuration:u.liveMaxLatencyDurationCount*n.targetduration;(!C&&h.readyState<4||p<S-x)&&(this.loadedmetadata||(this.nextLoadPosition=f),h.readyState&&(this.warn("Playback: "+p.toFixed(3)+" is located too far from the end of live sliding playlist: "+S+", reset currentTime to : "+f.toFixed(3)),h.currentTime=f))}}},l.alignPlaylists=function(n,u){var h=this.levels,f=this.levelLastLoaded,p=this.fragPrevious,_=f!==null?h[f]:null,S=n.fragments.length;if(!S)return this.warn("No fragments in live playlist"),0;var C=n.fragments[0].start,x=!u,W=n.alignedSliding&&(0,R.isFiniteNumber)(C);if(x||!W&&!C){(function(ee,me,we){me&&(function(ye,De,qe){if(function(Ie,je,Ve){return!(!je.details||!(Ve.endCC>Ve.startCC||Ie&&Ie.cc<Ve.startCC))}(ye,qe,De)){var it=function(Ie,je,Ve){Ve===void 0&&(Ve=0);var Tt=Ie.fragments,Wt=je.fragments;if(Wt.length&&Tt.length){var St=Gs(Tt,Wt[0].cc);if(St&&(!St||St.startPTS))return St;O.logger.log("No frag in previous level to align on")}else O.logger.log("No fragments to align")}(qe.details,De);it&&(0,R.isFiniteNumber)(it.start)&&(O.logger.log("Adjusting PTS using last level due to CC increase within current level "+De.url),qa(it.start,De))}}(ee,we,me),!we.alignedSliding&&me.details&&function(ye,De){if(De.fragments.length&&ye.hasProgramDateTime&&De.hasProgramDateTime){var qe=De.fragments[0].programDateTime,it=ye.fragments[0].programDateTime,Ie=(it-qe)/1e3+De.fragments[0].start;Ie&&(0,R.isFiniteNumber)(Ie)&&(O.logger.log("Adjusting PTS using programDateTime delta "+(it-qe)+"ms, sliding:"+Ie.toFixed(3)+" "+ye.url+" "),qa(Ie,ye))}}(we,me.details),we.alignedSliding||!me.details||we.skippedSegments||ae(me.details,we))})(p,_,n);var K=n.fragments[0].start;return this.log("Live playlist sliding: "+K.toFixed(2)+" start-sn: "+(u?u.startSN:"na")+"->"+n.startSN+" prev-sn: "+(p?p.sn:"na")+" fragments: "+S),K}return C},l.waitForCdnTuneIn=function(n){return n.live&&n.canBlockReload&&n.partTarget&&n.tuneInGoal>Math.max(n.partHoldBack,3*n.partTarget)},l.setStartPosition=function(n,u){var h=this.startPosition;if(h<u&&(h=-1),h===-1||this.lastCurrentTime===-1){var f=n.startTimeOffset;(0,R.isFiniteNumber)(f)?(h=u+f,f<0&&(h+=n.totalduration),h=Math.min(Math.max(u,h),u+n.totalduration),this.log("Start time offset "+f+" found in playlist, adjust startPosition to "+h),this.startPosition=h):n.live?h=this.hls.liveSyncPosition||u:this.startPosition=h=0,this.lastCurrentTime=h}this.nextLoadPosition=h},l.getLoadPosition=function(){var n=this.media,u=0;return this.loadedmetadata&&n?u=n.currentTime:this.nextLoadPosition&&(u=this.nextLoadPosition),u},l.handleFragLoadAborted=function(n,u){this.transmuxer&&n.sn!=="initSegment"&&n.stats.aborted&&(this.warn("Fragment "+n.sn+(u?" part"+u.index:"")+" of level "+n.level+" was aborted"),this.resetFragmentLoading(n))},l.resetFragmentLoading=function(n){this.fragCurrent&&(this.fragContextChanged(n)||this.state===Ai)||(this.state=Ct)},l.onFragmentOrKeyLoadError=function(n,u){if(u.fatal)return this.stopLoad(),void(this.state=li);var h=this.config;if(u.chunkMeta){var f=this.getCurrentContext(u.chunkMeta);f&&(u.frag=f.frag,u.levelRetry=!0,this.fragLoadError=h.fragLoadingMaxRetry)}var p=u.frag;if(p&&p.type===n)if(this.fragCurrent,this.fragLoadError+1<=h.fragLoadingMaxRetry){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var _=Math.min(Math.pow(2,this.fragLoadError)*h.fragLoadingRetryDelay,h.fragLoadingMaxRetryTimeout);this.warn("Fragment "+p.sn+" of "+n+" "+p.level+" failed to load, retrying in "+_+"ms"),this.retryDate=self.performance.now()+_,this.fragLoadError++,this.state=Ai}else u.levelRetry?(n===Te.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=Ct):(O.logger.error(u.details+" reaches max retry, redispatch as fatal ..."),u.fatal=!0,this.hls.stopLoad(),this.state=li)},l.afterBufferFlushed=function(n,u,h){if(n){var f=$t.getBuffered(n);this.fragmentTracker.detectEvictedFragments(u,f,h),this.state===va&&this.resetLoadingState()}},l.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Ct},l.resetStartWhenNotLoaded=function(n){if(!this.loadedmetadata){this.startFragRequested=!1;var u=this.levels?this.levels[n].details:null;u!=null&&u.live?(this.startPosition=-1,this.setStartPosition(u,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},l.updateLevelTiming=function(n,u,h,f){var p=this,_=h.details;Object.keys(n.elementaryStreams).reduce(function(S,C){var x=n.elementaryStreams[C];if(x){var W=x.endPTS-x.startPTS;if(W<=0)return p.warn("Could not parse fragment "+n.sn+" "+C+" duration reliably ("+W+")"),S||!1;var K=f?0:ie(_,n,x.startPTS,x.endPTS,x.startDTS,x.endDTS);return p.hls.trigger(y.Events.LEVEL_PTS_UPDATED,{details:_,level:h,drift:K,type:C,frag:n,start:x.startPTS,end:x.endPTS}),!0}return S},!1)||(this.warn("Found no media in fragment "+n.sn+" of level "+h.id+" resetting transmuxer to fallback to playlist timing"),this.resetTransmuxer()),this.state=Wi,this.hls.trigger(y.Events.FRAG_PARSED,{frag:n,part:u})},l.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},s=r,(o=[{key:"state",get:function(){return this._state},set:function(n){var u=this._state;u!==n&&(this._state=n,this.log(u+"->"+n))}}])&&js(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),r}(gi);function Xa(){return self.MediaSource||self.WebKitMediaSource}function Za(){return self.SourceBuffer||self.WebKitSourceBuffer}var On=function(){var m=ENTRY_MODULE,c={},e=function s(o){var l=c[o];if(l!==void 0)return l.exports;var n=c[o]={exports:{}};return m[o].call(n.exports,n,n.exports,s),n.exports};e.m=m,e.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return e.d(o,{a:o}),o},e.d=function(s,o){for(var l in o)e.o(o,l)&&!e.o(s,l)&&Object.defineProperty(s,l,{enumerable:!0,get:o[l]})},e.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},e.r=function(s){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var r=e(ENTRY_MODULE);return r.default||r}.toString().split("ENTRY_MODULE"),Ys="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function cr(m){return(m+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function Ja(m,c,e){var r={};r[e]=[];var s=c.toString().replace(/^"[^"]+"/,"function"),o=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)||s.match(/^\(\w+,\s*\w+,\s*(\w+)\)\s?\=\s?\>/);if(!o)return r;for(var l,n=o[1],u=new RegExp("(\\\\n|\\W)"+cr(n)+Ys,"g");l=u.exec(s);)l[3]!=="dll-reference"&&r[e].push(l[3]);for(u=new RegExp("\\("+cr(n)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)'+Ys,"g");l=u.exec(s);)m[l[2]]||(r[e].push(l[1]),m[l[2]]=b(l[1]).m),r[l[2]]=r[l[2]]||[],r[l[2]].push(l[4]);for(var h,f=Object.keys(r),p=0;p<f.length;p++)for(var _=0;_<r[f[p]].length;_++)h=r[f[p]][_],isNaN(1*h)||(r[f[p]][_]=1*r[f[p]][_]);return r}function bl(m){return Object.keys(m).reduce(function(c,e){return c||m[e].length>0},!1)}function $s(m,c,e,r){var s=m[r].map(function(o){return'"'+o+'": '+c[r][o].toString().replace(/^"[^"]+"/,"function")}).join(",");return On[0]+"{"+s+"}"+On[1]+'"'+e+'"'+On[2]}var ki=b(544),Pn=b(729),ga=b.n(Pn),Ea=Xa()||{isTypeSupported:function(){return!1}},Nn=function(){function m(e,r,s,o){var l=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var n=e.config;this.hls=e,this.id=r,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=s,this.onFlush=o;var u=function(_,S){(S=S||{}).frag=l.frag,S.id=l.id,l.hls.trigger(_,S)};this.observer=new Pn.EventEmitter,this.observer.on(y.Events.FRAG_DECRYPTED,u),this.observer.on(y.Events.ERROR,u);var h={mp4:Ea.isTypeSupported("video/mp4"),mpeg:Ea.isTypeSupported("audio/mpeg"),mp3:Ea.isTypeSupported('audio/mp4; codecs="mp3"')},f=navigator.vendor;if(this.useWorker&&typeof Worker!="undefined"){var p;O.logger.log("demuxing in webworker");try{p=this.worker=function(_,S){S=S||{};var C={main:b.m},x=S.all?{main:Object.keys(C.main)}:function(we,ye){for(var De={main:[ye]},qe={main:[]},it={main:{}};bl(De);)for(var Ie=Object.keys(De),je=0;je<Ie.length;je++){var Ve=Ie[je],Tt=De[Ve].pop();if(it[Ve]=it[Ve]||{},!it[Ve][Tt]&&we[Ve][Tt]){it[Ve][Tt]=!0,qe[Ve]=qe[Ve]||[],qe[Ve].push(Tt);for(var Wt=Ja(we,we[Ve][Tt],Ve),St=Object.keys(Wt),Mt=0;Mt<St.length;Mt++)De[St[Mt]]=De[St[Mt]]||[],De[St[Mt]]=De[St[Mt]].concat(Wt[St[Mt]])}}return qe}(C,_),W="";Object.keys(x).filter(function(we){return we!=="main"}).forEach(function(we){for(var ye=0;x[we][ye];)ye++;x[we].push(ye),C[we][ye]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",W=W+"var "+we+" = ("+$s(x,C,ye,modules)+`)();
9
- `}),W=W+"new (("+$s(x,C,_,"main")+")())(self);";var K=new window.Blob([W],{type:"text/javascript"}),ee=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(K),me=new window.Worker(ee);return me.objectURL=ee,me}(182),this.onwmsg=this.onWorkerMessage.bind(this),p.addEventListener("message",this.onwmsg),p.onerror=function(_){l.useWorker=!1,O.logger.warn("Exception in webworker, fallback to inline"),l.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:new Error(_.message+" ("+_.filename+":"+_.lineno+")")})},p.postMessage({cmd:"init",typeSupported:h,vendor:f,id:r,config:JSON.stringify(n)})}catch(_){O.logger.warn("Error in worker:",_),O.logger.error("Error while initializing DemuxerWorker, fallback to inline"),p&&self.URL.revokeObjectURL(p.objectURL),this.transmuxer=new ki.default(this.observer,h,n,f,r),this.worker=null}}else this.transmuxer=new ki.default(this.observer,h,n,f,r)}var c=m.prototype;return c.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null,this.onwmsg=void 0;else{var r=this.transmuxer;r&&(r.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},c.push=function(e,r,s,o,l,n,u,h,f,p){var _,S,C=this;f.transmuxing.start=self.performance.now();var x=this.transmuxer,W=this.worker,K=n?n.start:l.start,ee=l.decryptdata,me=this.frag,we=!(me&&l.cc===me.cc),ye=!(me&&f.level===me.level),De=me?f.sn-me.sn:-1,qe=this.part?f.part-this.part.index:-1,it=De===0&&f.id>1&&f.id===(me==null?void 0:me.stats.chunkCount),Ie=!ye&&(De===1||De===0&&(qe===1||it&&qe<=0)),je=self.performance.now();(ye||De||l.stats.parsing.start===0)&&(l.stats.parsing.start=je),!n||!qe&&Ie||(n.stats.parsing.start=je);var Ve=!(me&&((_=l.initSegment)===null||_===void 0?void 0:_.url)===((S=me.initSegment)===null||S===void 0?void 0:S.url)),Tt=new ki.TransmuxState(we,Ie,h,ye,K,Ve);if(!Ie||we||Ve){O.logger.log("[transmuxer-interface, "+l.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
10
- discontinuity: `+we+`
1
+ "use strict";(()=>{var _m=Object.create;var nc=Object.defineProperty;var Am=Object.getOwnPropertyDescriptor;var Sm=Object.getOwnPropertyNames;var km=Object.getPrototypeOf,Im=Object.prototype.hasOwnProperty;var sc=(a,t)=>()=>(t||a((t={exports:{}}).exports,t),t.exports);var wm=(a,t,r,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let v of Sm(t))!Im.call(a,v)&&v!==r&&nc(a,v,{get:()=>t[v],enumerable:!(d=Am(t,v))||d.enumerable});return a};var oc=(a,t,r)=>(r=a!=null?_m(km(a)):{},wm(t||!a||!a.__esModule?nc(r,"default",{value:a,enumerable:!0}):r,a));var jl=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)};var Nt=(a,t,r)=>(jl(a,t,"read from private field"),r?r.call(a):t.get(a)),li=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},$i=(a,t,r,d)=>(jl(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r);var _i=(a,t,r)=>(jl(a,t,"access private method"),r);var Fh=sc((Ko,dd)=>{(function(){var a,t;a=this,t=function(){return function(){var r={80:function(g,E,L){g.exports=L(728).default},728:function(g,E,L){"use strict";L.d(E,{default:function(){return Cl}});var M=L(48),R=L.n(M),b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(A){var y=16*Math.random()|0;return(A==="x"?y:3&y|8).toString(16)})},P=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},O=function(A){return A&&A.nodeName!==void 0?(A.muxId||(A.muxId=A.id||P()),A.muxId):A},ue=function(A){var y;A&&A.nodeName!==void 0?A=O(y=A):y=document.querySelector(A);var T=y&&y.nodeName?y.nodeName.toLowerCase():"";return[y,A,T]},Q=L(640),de=L.n(Q),he=de().methodFactory;de().methodFactory=function(A,y,T){var k=he(A,y,T);return function(){for(var D=["[mux]"],V=0;V<arguments.length;V++)D.push(arguments[V]);k.apply(void 0,D)}},de().setLevel(de().getLevel());var Y=de();function pe(){return(R().doNotTrack||R().navigator&&R().navigator.doNotTrack)==="1"}var X={now:function(){var A=R().performance,y=A&&A.timing,T=y&&y.navigationStart,k=typeof T=="number"&&typeof A.now=="function"?T+A.now():Date.now();return Math.round(k)}},oe=L(678),z=L.n(oe),be=function(A){return ke(A)[0]},ke=function(A){if(typeof A!="string"||A==="")return["localhost"];var y,T=(A.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return T&&(y=(T.match(/[^\.]+\.[^\.]+$/)||[])[0]),[T,y]},He={exists:function(){var A=R().performance;return(A&&A.timing)!==void 0},domContentLoadedEventEnd:function(){var A=R().performance,y=A&&A.timing;return y&&y.domContentLoadedEventEnd},navigationStart:function(){var A=R().performance,y=A&&A.timing;return y&&y.navigationStart}};function Z(A,y,T){T=T===void 0?1:T,A[y]=A[y]||0,A[y]+=T}var I=["x-cdn","content-type","x-request-id"];function q(A){var y={};return(A=A||"").trim().split(/[\r\n]+/).forEach(function(T){if(T){var k=T.split(": "),D=k.shift();D&&(I.indexOf(D.toLowerCase())>=0||D.toLowerCase().indexOf("x-litix-")===0)&&(y[D]=k.join(": "))}}),y}var N=function(A){var y={};for(var T in A){var k=A[T];k["DATA-ID"].search("io.litix.data.")!==-1&&(y[k["DATA-ID"].replace("io.litix.data.","")]=k.VALUE)}return y};function fe(A,y){var T=Object.keys(A);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(A);y&&(k=k.filter(function(D){return Object.getOwnPropertyDescriptor(A,D).enumerable})),T.push.apply(T,k)}return T}function _e(A){for(var y=1;y<arguments.length;y++){var T=arguments[y]!=null?arguments[y]:{};y%2?fe(Object(T),!0).forEach(function(k){te(A,k,T[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(T)):fe(Object(T)).forEach(function(k){Object.defineProperty(A,k,Object.getOwnPropertyDescriptor(T,k))})}return A}function te(A,y,T){return y in A?Object.defineProperty(A,y,{value:T,enumerable:!0,configurable:!0,writable:!0}):A[y]=T,A}var ie=function(A){if(!A)return{};var y=He.navigationStart(),T=A.loading,k=T?T.start:A.trequest,D=T?T.first:A.tfirst,V=T?T.end:A.tload;return{bytesLoaded:A.total,requestStart:Math.round(y+k),responseStart:Math.round(y+D),responseEnd:Math.round(y+V)}},Re=function(A){if(A&&typeof A.getAllResponseHeaders=="function")return q(A.getAllResponseHeaders())};function Pe(A,y){var T=Object.keys(A);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(A);y&&(k=k.filter(function(D){return Object.getOwnPropertyDescriptor(A,D).enumerable})),T.push.apply(T,k)}return T}function Fe(A){for(var y=1;y<arguments.length;y++){var T=arguments[y]!=null?arguments[y]:{};y%2?Pe(Object(T),!0).forEach(function(k){Se(A,k,T[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(T)):Pe(Object(T)).forEach(function(k){Object.defineProperty(A,k,Object.getOwnPropertyDescriptor(T,k))})}return A}function Se(A,y,T){return y in A?Object.defineProperty(A,y,{value:T,enumerable:!0,configurable:!0,writable:!0}):A[y]=T,A}var Ye=function(A,y){if(!A||typeof A.getRequests!="function")return{};var T=A.getRequests({state:"executed"});if(T.length===0)return{};var k,D=T[T.length-1],V=be(D.url),B=D.url,J=D.bytesLoaded,ge=new Date(D.requestStartDate).getTime(),ne=new Date(D.firstByteDate).getTime(),Be=new Date(D.requestEndDate).getTime(),mt=isNaN(D.duration)?0:D.duration,nt=typeof y.getMetricsFor=="function"?y.getMetricsFor(D.mediaType).HttpList:y.getDashMetrics().getHttpRequests(D.mediaType);return nt.length>0&&(k=q(nt[nt.length-1]._responseHeaders||"")),{requestStart:ge,requestResponseStart:ne,requestResponseEnd:Be,requestBytesLoaded:J,requestResponseHeaders:k,requestMediaDuration:mt,requestHostname:V,requestUrl:B}},ot=function(A,y){var T=y.getQualityFor(A),k=y.getCurrentTrackFor(A).bitrateList;return k?{currentLevel:T,renditionWidth:k[T].width||null,renditionHeight:k[T].height||null,renditionBitrate:k[T].bandwidth}:{}},le=function(A){var y;return(y=A.match(/.*codecs\*?="(.*)"/))===null||y===void 0?void 0:y[1]};function Ee(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var U=0,ve=function(){function A(){(function(D,V){if(!(D instanceof V))throw new TypeError("Cannot call a class as a function")})(this,A)}var y,T,k;return y=A,T=[{key:"on",value:function(D,V,B){return V._eventEmitterGuid=V._eventEmitterGuid||++U,this._listeners=this._listeners||{},this._listeners[D]=this._listeners[D]||[],B&&(V=V.bind(B)),this._listeners[D].push(V),V}},{key:"off",value:function(D,V){var B=this._listeners&&this._listeners[D];B&&B.forEach(function(J,ge){J._eventEmitterGuid===V._eventEmitterGuid&&B.splice(ge,1)})}},{key:"one",value:function(D,V,B){var J=this;V._eventEmitterGuid=V._eventEmitterGuid||++U;var ge=function ne(){J.off(D,ne),V.apply(B||this,arguments)};ge._eventEmitterGuid=V._eventEmitterGuid,this.on(D,ge)}},{key:"emit",value:function(D,V){var B=this;if(this._listeners){V=V||{};var J=this._listeners["before*"]||[],ge=this._listeners[D]||[],ne=this._listeners["after"+D]||[],Be=function(mt,nt){(mt=mt.slice()).forEach(function(ht){ht.call(B,{type:D},nt)})};Be(J,V),Be(ge,V),Be(ne,V)}}}],T&&Ee(y.prototype,T),k&&Ee(y,k),Object.defineProperty(y,"prototype",{writable:!1}),A}(),Le=ve;function Ne(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var Ue=function(){function A(D){var V=this;(function(B,J){if(!(B instanceof J))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,D.on("playing",function(){V._playheadShouldBeProgressing=!0}),D.on("play",this._startPlaybackHeartbeatInterval.bind(this)),D.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),D.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),D.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),D.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),D.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),D.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),D.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),D.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),D.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),D.on("seeked",function(){D.data.player_is_paused?V._stopPlaybackHeartbeatInterval():V._startPlaybackHeartbeatInterval()}),D.on("timeupdate",function(){V._playbackHeartbeatInterval!==null&&D.emit("playbackheartbeat")}),D.on("devicesleep",function(B,J){V._playbackHeartbeatInterval!==null&&(R().clearInterval(V._playbackHeartbeatInterval),D.emit("playbackheartbeatend",{viewer_time:J.viewer_time}),V._playbackHeartbeatInterval=null)})}var y,T,k;return y=A,(T=[{key:"_startPlaybackHeartbeatInterval",value:function(){var D=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=R().setInterval(function(){D.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(R().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&Ne(y.prototype,T),k&&Ne(y,k),Object.defineProperty(y,"prototype",{writable:!1}),A}();function Ge(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Te(A,y,T){return y&&Ge(A.prototype,y),T&&Ge(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var xe=Te(function A(y){var T=this;(function(k,D){if(!(k instanceof D))throw new TypeError("Cannot call a class as a function")})(this,A),y.on("viewinit",function(){T.viewErrored=!1}),y.on("error",function(k,D){try{var V=y.errorTranslator({player_error_code:D.player_error_code,player_error_message:D.player_error_message,player_error_context:D.player_error_context});V?(y.data.player_error_code=V.player_error_code||D.player_error_code,y.data.player_error_message=V.player_error_message||D.player_error_message,y.data.player_error_context=V.player_error_context||D.player_error_context,T.viewErrored=!0):(delete y.data.player_error_code,delete y.data.player_error_message,delete y.data.player_error_context)}catch(B){y.mux.log.warn("Exception in error translator callback.",B),T.viewErrored=!0}})});function ze(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var it=function(){function A(D){(function(V,B){if(!(V instanceof B))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,this._watchTimeTrackerLastCheckedTime=null,D.on("playbackheartbeat",this._updateWatchTime.bind(this)),D.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var y,T,k;return y=A,(T=[{key:"_updateWatchTime",value:function(D,V){var B=V.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=B),Z(this.pm.data,"view_watch_time",B-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=B}},{key:"_clearWatchTimeState",value:function(D,V){this._updateWatchTime(D,V),this._watchTimeTrackerLastCheckedTime=null}}])&&ze(y.prototype,T),k&&ze(y,k),Object.defineProperty(y,"prototype",{writable:!1}),A}();function _t(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var gt=function(){function A(D){(function(V,B){if(!(V instanceof B))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,this._playbackTimeTrackerLastPlayheadPosition=-1,D.on("playbackheartbeat",this._updatePlaybackTime.bind(this)),D.on("playbackheartbeatend",this._clearPlaybackTimeState.bind(this)),D.on("seeking",this._clearPlaybackTimeState.bind(this))}var y,T,k;return y=A,(T=[{key:"_updatePlaybackTime",value:function(){var D=this.pm.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&D>this._playbackTimeTrackerLastPlayheadPosition){var V=D-this._playbackTimeTrackerLastPlayheadPosition;V<=1e3&&Z(this.pm.data,"view_content_playback_time",V)}this._playbackTimeTrackerLastPlayheadPosition=D}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&_t(y.prototype,T),k&&_t(y,k),Object.defineProperty(y,"prototype",{writable:!1}),A}();function Lt(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var lt=function(){function A(D){(function(B,J){if(!(B instanceof J))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D;var V=this._updatePlayheadTime.bind(this);D.on("playbackheartbeat",V),D.on("playbackheartbeatend",V),D.on("timeupdate",V),D.on("destroy",function(){D.off("timeupdate",V)})}var y,T,k;return y=A,(T=[{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(D,V){var B=this,J=function(){B.pm.currentFragmentPDT&&B.pm.currentFragmentStart&&(B.pm.data.player_program_time=B.pm.currentFragmentPDT+B.pm.data.player_playhead_time-B.pm.currentFragmentStart)};if(V&&V.player_playhead_time)this.pm.data.player_playhead_time=V.player_playhead_time,J(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var ge=this.pm.getPlayheadTime();ge!==void 0&&(this.pm.data.player_playhead_time=ge,J(),this._updateMaxPlayheadPosition())}}}])&&Lt(y.prototype,T),k&&Lt(y,k),Object.defineProperty(y,"prototype",{writable:!1}),A}();function It(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Rt(A,y,T){return y&&It(A.prototype,y),T&&It(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var At=Rt(function A(y){if(function(V,B){if(!(V instanceof B))throw new TypeError("Cannot call a class as a function")}(this,A),!y.disableRebufferTracking){var T,k=function(V,B){D(B),T=void 0},D=function(V){if(T){var B=V.viewer_time-T;Z(y.data,"view_rebuffer_duration",B),T=V.viewer_time}y.data.view_watch_time>=0&&y.data.view_rebuffer_count>0&&(y.data.view_rebuffer_frequency=y.data.view_rebuffer_count/y.data.view_watch_time,y.data.view_rebuffer_percentage=y.data.view_rebuffer_duration/y.data.view_watch_time)};y.on("playbackheartbeat",function(V,B){return D(B)}),y.on("rebufferstart",function(V,B){T||(Z(y.data,"view_rebuffer_count",1),T=B.viewer_time,y.one("rebufferend",k))}),y.on("viewinit",function(){T=void 0,y.off("rebufferend",k)})}});function pt(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var Ut=function(){function A(D){var V=this;(function(B,J){if(!(B instanceof J))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,D.disableRebufferTracking||D.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,D.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),D.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),D.on("seeking",function(){V._cleanupRebufferTracker(null,{viewer_time:X.now()})}))}var y,T,k;return y=A,T=[{key:"_checkIfRebuffering",value:function(D,V){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(D,V);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var B=V.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&B>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=V.viewer_time}else this._cleanupRebufferTracker(D,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(D){this._lastCheckedTime=D,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=D}},{key:"_cleanupRebufferTracker",value:function(D,V){var B=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 J=this.pm.data.player_playhead_time-this._lastPlayheadTime,ge=V.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&J>0&&ge-J>this.pm.minimumRebufferDuration&&(this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+ge-J}))}B?this._prepareRebufferTrackerState(V.viewer_time):this._clearRebufferTrackerState()}}],T&&pt(y.prototype,T),k&&pt(y,k),Object.defineProperty(y,"prototype",{writable:!1}),A}(),Vt=Ut;function ri(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var vi=function(){function A(D){var V=this;(function(B,J){if(!(B instanceof J))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,D.on("viewinit",function(){var B=D.data,J=B.view_id;if(!B.view_program_changed){var ge=function(ne,Be){var mt=Be.viewer_time;ne.type==="playing"&&D.data.view_time_to_first_frame===void 0?V.calculateTimeToFirstFrame(mt||X.now(),J):ne.type!=="adplaying"||D.data.view_time_to_first_frame!==void 0&&!V._inPrerollPosition()||V.calculateTimeToFirstFrame(mt||X.now(),J)};D.one("playing",ge),D.one("adplaying",ge),D.one("viewend",function(){D.off("playing",ge),D.off("adplaying",ge)})}})}var y,T,k;return y=A,(T=[{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(D,V){V===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:D}),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))}}])&&ri(y.prototype,T),k&&ri(y,k),Object.defineProperty(y,"prototype",{writable:!1}),A}();function Qt(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Fi(A,y,T){return y&&Qt(A.prototype,y),T&&Qt(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var se=Fi(function A(y){var T=this;(function(k,D){if(!(k instanceof D))throw new TypeError("Cannot call a class as a function")})(this,A),y.on("viewinit",function(){T._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(k){y.on(k,function(){if(T._lastPlayheadPosition>=0&&y.data.player_playhead_time>=0&&T._lastPlayerWidth>=0&&T._lastSourceWidth>0&&T._lastPlayerHeight>=0&&T._lastSourceHeight>0){var D=y.data.player_playhead_time-T._lastPlayheadPosition;if(D<0)return void(T._lastPlayheadPosition=-1);var V=Math.min(T._lastPlayerWidth/T._lastSourceWidth,T._lastPlayerHeight/T._lastSourceHeight),B=Math.max(0,V-1),J=Math.max(0,1-V);y.data.view_max_upscale_percentage=Math.max(y.data.view_max_upscale_percentage||0,B),y.data.view_max_downscale_percentage=Math.max(y.data.view_max_downscale_percentage||0,J),Z(y.data,"view_total_content_playback_time",D),Z(y.data,"view_total_upscaling",B*D),Z(y.data,"view_total_downscaling",J*D)}T._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(k){y.on(k,function(){T._lastPlayheadPosition=y.data.player_playhead_time,T._lastPlayerWidth=y.data.player_width,T._lastPlayerHeight=y.data.player_height,T._lastSourceWidth=y.data.video_source_width,T._lastSourceHeight=y.data.video_source_height})})});function j(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function w(A,y,T){return y&&j(A.prototype,y),T&&j(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var G=w(function A(y){var T=this;(function(k,D){if(!(k instanceof D))throw new TypeError("Cannot call a class as a function")})(this,A),this.isSeeking=!1,y.on("seeking",function(k,D){z()(y.data,D),T._lastSeekingTime=X.now(),T.isSeeking===!1&&(T.isSeeking=!0,y.send("seeking"))}),y.on("seeked",function(){T.isSeeking=!1;var k=T._lastSeekingTime||X.now(),D=X.now()-k;Z(y.data,"view_seek_count",1),Z(y.data,"view_seek_duration",D);var V=y.data.view_max_seek_time||0;y.data.view_max_seek_time=Math.max(V,D)}),y.on("viewend",function(){T.isSeeking=!1})});function H(A,y){return function(T){if(Array.isArray(T))return T}(A)||function(T,k){var D=T==null?null:typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(D!=null){var V,B,J=[],ge=!0,ne=!1;try{for(D=D.call(T);!(ge=(V=D.next()).done)&&(J.push(V.value),!k||J.length!==k);ge=!0);}catch(Be){ne=!0,B=Be}finally{try{ge||D.return==null||D.return()}finally{if(ne)throw B}}return J}}(A,y)||function(T,k){if(T){if(typeof T=="string")return $(T,k);var D=Object.prototype.toString.call(T).slice(8,-1);return D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set"?Array.from(T):D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)?$(T,k):void 0}}(A,y)||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 $(A,y){(y==null||y>A.length)&&(y=A.length);for(var T=0,k=new Array(y);T<y;T++)k[T]=A[T];return k}function re(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}var ae=function(A,y){A.push(y),A.sort(function(T,k){return T.viewer_time-k.viewer_time})},Ae=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Ce=function(){function A(D){var V=this;(function(J,ge){if(!(J instanceof ge))throw new TypeError("Cannot call a class as a function")})(this,A),this.pm=D,D.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}),Ae.forEach(function(J){return D.on(J,V._updateAdData.bind(V))});var B=function(){V.isAdBreak=!1};D.on("adbreakstart",function(){V.isAdBreak=!0}),D.on("play",B),D.on("playing",B),D.on("viewend",B),D.on("adrequest",function(J,ge){ge=z()({ad_request_id:"generatedAdRequestId"+V._currentAdRequestNumber++},ge),ae(V._adRequests,ge),Z(D.data,"view_ad_request_count"),V.inPrerollPosition()&&(D.data.view_preroll_requested=!0,V._adHasPlayed||Z(D.data,"view_preroll_request_count"))}),D.on("adresponse",function(J,ge){ge=z()({ad_request_id:"generatedAdRequestId"+V._currentAdResponseNumber++},ge),ae(V._adResponses,ge);var ne=V.findAdRequest(ge.ad_request_id);ne&&Z(D.data,"view_ad_request_time",Math.max(0,ge.viewer_time-ne.viewer_time))}),D.on("adplay",function(J,ge){V._adHasPlayed=!0,V._wouldBeNewAdPlay&&(V._wouldBeNewAdPlay=!1,Z(D.data,"view_ad_played_count")),V.inPrerollPosition()&&!D.data.view_preroll_played&&(D.data.view_preroll_played=!0,V._adRequests.length>0&&(D.data.view_preroll_request_time=Math.max(0,ge.viewer_time-V._adRequests[0].viewer_time)),D.data.view_start&&(D.data.view_startup_preroll_request_time=Math.max(0,ge.viewer_time-D.data.view_start)),V._prerollPlayTime=ge.viewer_time)}),D.on("adplaying",function(J,ge){V.inPrerollPosition()&&D.data.view_preroll_load_time===void 0&&V._prerollPlayTime!==void 0&&(D.data.view_preroll_load_time=ge.viewer_time-V._prerollPlayTime,D.data.view_startup_preroll_load_time=ge.viewer_time-V._prerollPlayTime)}),D.on("adended",function(){V._wouldBeNewAdPlay=!0}),D.on("aderror",function(){V._wouldBeNewAdPlay=!0})}var y,T,k;return y=A,(T=[{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(D){for(var V=0;V<this._adRequests.length;V++)if(this._adRequests[V].ad_request_id===D)return this._adRequests[V]}},{key:"_updateAdData",value:function(D,V){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&V.ad_tag_url){var B=H(ke(V.ad_tag_url),2),J=B[0],ge=B[1];this.pm.data.view_preroll_ad_tag_domain=ge,this.pm.data.view_preroll_ad_tag_hostname=J}if(!this.pm.data.view_preroll_ad_asset_hostname&&V.ad_asset_url){var ne=H(ke(V.ad_asset_url),2),Be=ne[0],mt=ne[1];this.pm.data.view_preroll_ad_asset_domain=mt,this.pm.data.view_preroll_ad_asset_hostname=Be}}}}])&&re(y.prototype,T),k&&re(y,k),Object.defineProperty(y,"prototype",{writable:!1}),A}();function Oe(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Ke(A,y,T){return y&&Oe(A.prototype,y),T&&Oe(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var Qe=Ke(function A(y){var T,k;(function(J,ge){if(!(J instanceof ge))throw new TypeError("Cannot call a class as a function")})(this,A);var D=function(){y.disableRebufferTracking||T&&(Z(y.data,"view_waiting_rebuffer_duration",X.now()-T),T=!1,R().clearInterval(k))},V=!1,B=function(){V=!1,D()};y.on("waiting",function(){V&&(y.disableRebufferTracking||(Z(y.data,"view_waiting_rebuffer_count",1),T=X.now(),k=R().setInterval(function(){if(T){var J=X.now();Z(y.data,"view_waiting_rebuffer_duration",J-T),T=J}},250)))}),y.on("playing",function(){D(),V=!0}),y.on("pause",B),y.on("seeking",B)});function We(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function at(A,y,T){return y&&We(A.prototype,y),T&&We(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var Et=at(function A(y){var T=this;(function(V,B){if(!(V instanceof B))throw new TypeError("Cannot call a class as a function")})(this,A);var k=function(){T.lastWallClockTime=X.now(),y.on("before*",D)},D=function(V){var B=X.now(),J=T.lastWallClockTime;T.lastWallClockTime=B,B-J>3e4&&(y.emit("devicesleep",{viewer_time:J}),z()(y.data,{viewer_time:J}),y.send("devicesleep"),y.emit("devicewake",{viewer_time:B}),z()(y.data,{viewer_time:B}),y.send("devicewake"))};y.one("playbackheartbeat",k),y.on("playbackheartbeatend",function(){y.off("before*",D),y.one("playbackheartbeat",k)})}),Ot=L(375),Ze=L(655),Ht=L.n(Ze),gi="muxData",Yt=function(){var A;try{A=Ot.parse(Ht().get(gi)||"")}catch{A={}}return A},jt=function(A){try{Ht().set(gi,Ot.stringify(A),{expires:7300})}catch{}},Xt=function(){var A=Yt();return A.mux_viewer_id=A.mux_viewer_id||b(),A.msn=A.msn||Math.random(),jt(A),{mux_viewer_id:A.mux_viewer_id,mux_sample_number:A.msn}};function ut(A,y){var T=y.beaconCollectionDomain,k=y.beaconDomain;if(T)return"https://"+T;var D=k||"litix.io";return(A=A||"inferred").match(/^[a-z0-9]+$/)?"https://"+A+"."+D:"https://img.litix.io/a.gif"}var Li=function(){var A;switch(tr()){case"cellular":A="cellular";break;case"ethernet":A="wired";break;case"wifi":A="wifi";break;case void 0:break;default:A="other"}return A},tr=function(){var A=R().navigator,y=A&&(A.connection||A.mozConnection||A.webkitConnection);return y&&y.type};Li.getConnectionFromAPI=tr;var zt=Li,di=gr({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"}),Vi=gr({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",cc:"codec",cd:"code",cg:"category",ch:"changed",cn:"config",co:"count",ce:"counter",cp:"complete",cr:"creative",ct:"content",cu:"current",cx:"connection",cz:"context",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",dr:"drm",dp:"dropped",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",un:"universal",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 gr(A){var y={};for(var T in A)A.hasOwnProperty(T)&&(y[A[T]]=T);return y}function Bi(A){var y={},T={};return Object.keys(A).forEach(function(k){var D=!1;if(A.hasOwnProperty(k)&&A[k]!==void 0){var V=k.split("_"),B=V[0],J=di[B];J||(Y.info("Data key word `"+V[0]+"` not expected in "+k),J=B+"_"),V.splice(1).forEach(function(ge){ge==="url"&&(D=!0),Vi[ge]?J+=Vi[ge]:Number(ge)&&Math.floor(Number(ge))===Number(ge)?J+=ge:(Y.info("Data key word `"+ge+"` not expected in "+k),J+="_"+ge+"_")}),D?T[J]=A[k]:y[J]=A[k]}}),z()(y,T)}var $t={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},xn=["hb","requestcompleted","requestfailed","requestcanceled"],Gs="https://img.litix.io",ir=function(A){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=A||Gs,this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=z()({},$t,y)};ir.prototype.queueEvent=function(A,y){var T=z()({},y);return(this._eventQueue.length<=this._options.maxQueueLength||A==="eventrateexceeded")&&(this._eventQueue.push(T),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},ir.prototype.flushEvents=function(){var A=arguments.length>0&&arguments[0]!==void 0&&arguments[0];A&&this._eventQueue.length===1?this._eventQueue.pop():(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},ir.prototype.destroy=function(){var A=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,A?this._clearBeaconQueue():this.flushEvents(),R().clearTimeout(this._sendTimeout)},ir.prototype._clearBeaconQueue=function(){var A=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,y=this._eventQueue.slice(A);A>0&&z()(y[y.length-1],Bi({mux_view_message:"event queue truncated"}));var T=this._createPayload(y);qa(this._beaconUrl,T,!0,function(){})},ir.prototype._sendBeaconQueue=function(){var A=this;if(!this._postInFlight){var y=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var T=this._createPayload(y),k=X.now();qa(this._beaconUrl,T,!1,function(D,V){V?(A._eventQueue=y.concat(A._eventQueue),A._failureCount+=1,Y.info("Error sending beacon: "+V)):A._failureCount=0,A._roundTripTime=X.now()-k,A._postInFlight=!1})}},ir.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var A=Math.pow(2,this._failureCount-1);return(1+(A*=Math.random()))*this._options.baseTimeBetweenBeacons},ir.prototype._startBeaconSending=function(){var A=this;R().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=R().setTimeout(function(){A._eventQueue.length&&A._sendBeaconQueue(),A._startBeaconSending()},this._getNextBeaconTime()))},ir.prototype._createPayload=function(A){var y,T,k,D=this,V={transmission_timestamp:Math.round(X.now())};this._roundTripTime&&(V.rtt_ms=Math.round(this._roundTripTime));var B=function(){y=JSON.stringify({metadata:V,events:T||A}),k=y.length/1024},J=function(){return k<=D._options.maxPayloadKBSize};return B(),J()||(Y.info("Payload size is too big ("+k+" kb). Removing unnecessary events."),T=A.filter(function(ge){return xn.indexOf(ge.e)===-1}),B()),J()||(Y.info("Payload size still too big ("+k+" kb). Cropping fields.."),T.forEach(function(ge){for(var ne in ge){var Be=ge[ne];typeof Be=="string"&&Be.length>51200&&(ge[ne]=Be.substring(0,51200))}}),B()),y};var qa=function(A,y,T,k){if(T&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(A,y))k();else if(R().fetch)R().fetch(A,{method:"POST",body:y,headers:{"Content-Type":"text/plain"},keepalive:!0}).then(function(V){return k(null,V.ok?null:"Error")}).catch(function(V){return k(null,V)});else{if(R().XMLHttpRequest){var D=new(R()).XMLHttpRequest;return D.onreadystatechange=function(){if(D.readyState===4)return k(null,D.status!==200?"error":void 0)},D.open("POST",A),D.setRequestHeader("Content-Type","text/plain"),void D.send(y)}k()}},Vs=ir;function Ws(A,y){return function(T){if(Array.isArray(T))return T}(A)||function(T,k){var D=T==null?null:typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(D!=null){var V,B,J=[],ge=!0,ne=!1;try{for(D=D.call(T);!(ge=(V=D.next()).done)&&(J.push(V.value),!k||J.length!==k);ge=!0);}catch(Be){ne=!0,B=Be}finally{try{ge||D.return==null||D.return()}finally{if(ne)throw B}}return J}}(A,y)||function(T,k){if(T){if(typeof T=="string")return Ya(T,k);var D=Object.prototype.toString.call(T).slice(8,-1);return D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set"?Array.from(T):D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)?Ya(T,k):void 0}}(A,y)||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 Ya(A,y){(y==null||y>A.length)&&(y=A.length);for(var T=0,k=new Array(y);T<y;T++)k[T]=A[T];return k}function $a(A,y){var T=Object.keys(A);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(A);y&&(k=k.filter(function(D){return Object.getOwnPropertyDescriptor(A,D).enumerable})),T.push.apply(T,k)}return T}function Kr(A){for(var y=1;y<arguments.length;y++){var T=arguments[y]!=null?arguments[y]:{};y%2?$a(Object(T),!0).forEach(function(k){Gr(A,k,T[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(T)):$a(Object(T)).forEach(function(k){Object.defineProperty(A,k,Object.getOwnPropertyDescriptor(T,k))})}return A}function pa(A){return pa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},pa(A)}function yl(A,y){if(!(A instanceof y))throw new TypeError("Cannot call a class as a function")}function js(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Gr(A,y,T){return y in A?Object.defineProperty(A,y,{value:T,enumerable:!0,configurable:!0,writable:!0}):A[y]=T,A}var Xi=["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"],Ct=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended"],qs=["viewstart","error","ended","viewend"],Vr=function(){function A(D,V){var B,J,ge,ne,Be,mt,nt,ht,Je,ft,Kt,Zt,Ei,Di,Dt,hi=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};yl(this,A),Gr(this,"previousBeaconData",null),Gr(this,"lastEventTime",0),Gr(this,"rateLimited",!1),this.mux=D,this.envKey=V,this.options=hi,this.eventQueue=new Vs(ut(this.envKey,this.options)),this.sampleRate=(B=this.options.sampleRate)!==null&&B!==void 0?B:1,this.disableCookies=(J=this.options.disableCookies)!==null&&J!==void 0&&J,this.respectDoNotTrack=(ge=this.options.respectDoNotTrack)!==null&&ge!==void 0&&ge,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:(ne=this.options.platform)===null||ne===void 0?void 0:ne.name,viewer_application_version:(Be=this.options.platform)===null||Be===void 0?void 0:Be.version,viewer_application_engine:(mt=this.options.platform)===null||mt===void 0?void 0:mt.layout,viewer_device_name:(nt=this.options.platform)===null||nt===void 0?void 0:nt.product,viewer_device_category:"",viewer_device_manufacturer:(ht=this.options.platform)===null||ht===void 0?void 0:ht.manufacturer,viewer_os_family:(Je=this.options.platform)===null||Je===void 0||(ft=Je.os)===null||ft===void 0?void 0:ft.family,viewer_os_architecture:(Kt=this.options.platform)===null||Kt===void 0||(Zt=Kt.os)===null||Zt===void 0?void 0:Zt.architecture,viewer_os_version:(Ei=this.options.platform)===null||Ei===void 0||(Di=Ei.os)===null||Di===void 0?void 0:Di.version,viewer_connection_type:zt(),page_url:R()===null||R()===void 0||(Dt=R().location)===null||Dt===void 0?void 0:Dt.href},this.viewerData=this.disableCookies?{}:Xt()}var y,T,k;return y=A,(T=[{key:"send",value:function(D,V){var B;if(D){if(this.respectDoNotTrack&&pe())return Y.info("Not sending `"+D+"` because Do Not Track is enabled");if(!V||pa(V)!=="object")return Y.error("A data object was expected in send() but was not provided");var J,ge,ne=this.disableCookies?{}:(J=Yt(),ge=X.now(),J.session_start&&(J.sst=J.session_start,delete J.session_start),J.session_id&&(J.sid=J.session_id,delete J.session_id),J.session_expires&&(J.sex=J.session_expires,delete J.session_expires),(!J.sex||J.sex<ge)&&(J.sid=b(),J.sst=ge),J.sex=ge+15e5,jt(J),{session_id:J.sid,session_start:J.sst,session_expires:J.sex}),Be=Kr(Kr(Kr(Kr(Kr({},this.pageLevelData),V),ne),this.viewerData),{},{event:D,env_key:this.envKey});Be.user_id&&(Be.viewer_user_id=Be.user_id,delete Be.user_id);var mt=((B=Be.mux_sample_number)!==null&&B!==void 0?B:0)>=this.sampleRate,nt=Bi(this._deduplicateBeaconData(D,Be));if(this.lastEventTime=this.mux.utils.now(),mt)return Y.info("Not sending event due to sample rate restriction",D,Be,nt);if(this.envKey||Y.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",D,Be,nt),!this.rateLimited){if(Y.info("Sending event",D,Be,nt),this.rateLimited=!this.eventQueue.queueEvent(D,nt),this.mux.WINDOW_UNLOADING&&D==="viewend")this.eventQueue.destroy(!0);else if(this.mux.WINDOW_HIDDEN&&D==="hb"?this.eventQueue.flushEvents(!0):qs.indexOf(D)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return Be.event="eventrateexceeded",nt=Bi(Be),this.eventQueue.queueEvent(Be.event,nt),Y.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(D,V){var B=this,J={},ge=V.view_id;if(!ge||D==="viewstart"||D==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)J=Kr({},V),ge&&(this.previousBeaconData=J),ge&&D==="viewend"&&(this.previousBeaconData=null);else{var ne=D.indexOf("request")===0;Object.entries(V).forEach(function(Be){var mt=Ws(Be,2),nt=mt[0],ht=mt[1];B.previousBeaconData&&(ht!==B.previousBeaconData[nt]||Xi.indexOf(nt)>-1||B.objectHasChanged(ne,nt,ht,B.previousBeaconData[nt])||B.eventRequiresKey(D,nt))&&(J[nt]=ht,B.previousBeaconData[nt]=ht)})}return J}},{key:"objectHasChanged",value:function(D,V,B,J){return!(!D||V.indexOf("request_")!==0||V!=="request_response_headers"&&pa(B)==="object"&&pa(J)==="object"&&Object.keys(B||{}).length===Object.keys(J||{}).length)}},{key:"eventRequiresKey",value:function(D,V){return D==="renditionchange"&&V.indexOf("video_source_")===0||!(V.indexOf("ad_")!==0||!Ct.includes(D))}}])&&js(y.prototype,T),k&&js(y,k),Object.defineProperty(y,"prototype",{writable:!1}),A}();function Ar(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function za(A,y,T){return y&&Ar(A.prototype,y),T&&Ar(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var rr=za(function A(y){(function(ne,Be){if(!(ne instanceof Be))throw new TypeError("Cannot call a class as a function")})(this,A);var T=0,k=0,D=0,V=0,B=0,J=0,ge=0;y.on("requestcompleted",function(ne,Be){var mt,nt,ht=Be.request_start,Je=Be.request_response_start,ft=Be.request_response_end,Kt=Be.request_bytes_loaded;if(V++,Je?(mt=Je-ht,nt=ft-Je):nt=ft-ht,nt>0&&Kt>0){var Zt=Kt/nt*8e3;B++,k+=Kt,D+=nt,y.data.view_min_request_throughput=Math.min(y.data.view_min_request_throughput||1/0,Zt),y.data.view_average_request_throughput=k/D*8e3,y.data.view_request_count=V,mt>0&&(T+=mt,y.data.view_max_request_latency=Math.max(y.data.view_max_request_latency||0,mt),y.data.view_average_request_latency=T/B)}}),y.on("requestfailed",function(ne,Be){V++,J++,y.data.view_request_count=V,y.data.view_request_failed_count=J}),y.on("requestcanceled",function(ne,Be){V++,ge++,y.data.view_request_count=V,y.data.view_request_canceled_count=ge})});function Wr(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function va(A,y,T){return y&&Wr(A.prototype,y),T&&Wr(A,T),Object.defineProperty(A,"prototype",{writable:!1}),A}var lr=va(function A(y){var T=this;(function(k,D){if(!(k instanceof D))throw new TypeError("Cannot call a class as a function")})(this,A),y.on("before*",function(k,D){var V=D.viewer_time,B=X.now(),J=T._lastEventTime;if(T._lastEventTime=B,J&&B-J>36e5){var ge=Object.keys(y.data).reduce(function(ne,Be){return Be.indexOf("video_")===0?z()(ne,function(mt,nt,ht){return nt in mt?Object.defineProperty(mt,nt,{value:ht,enumerable:!0,configurable:!0,writable:!0}):mt[nt]=ht,mt}({},Be,y.data[Be])):ne},{});y.mux.log.info("Received event after at least an hour inactivity, creating a new view"),y.emit("viewinit",z()({viewer_time:V},ge)),y.playbackHeartbeat._playheadShouldBeProgressing&&k.type!=="play"&&k.type!=="adbreakstart"&&(y.emit("play",{viewer_time:V}),k.type!=="playing"&&y.emit("playing",{viewer_time:V}))}})});function Sr(A){return Sr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},Sr(A)}function jr(A,y){return function(T){if(Array.isArray(T))return T}(A)||function(T,k){var D=T==null?null:typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(D!=null){var V,B,J=[],ge=!0,ne=!1;try{for(D=D.call(T);!(ge=(V=D.next()).done)&&(J.push(V.value),!k||J.length!==k);ge=!0);}catch(Be){ne=!0,B=Be}finally{try{ge||D.return==null||D.return()}finally{if(ne)throw B}}return J}}(A,y)||function(T,k){if(T){if(typeof T=="string")return Qa(T,k);var D=Object.prototype.toString.call(T).slice(8,-1);return D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set"?Array.from(T):D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)?Qa(T,k):void 0}}(A,y)||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 Qa(A,y){(y==null||y>A.length)&&(y=A.length);for(var T=0,k=new Array(y);T<y;T++)k[T]=A[T];return k}function Xa(A,y){for(var T=0;T<y.length;T++){var k=y[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(A,k.key,k)}}function Za(A,y){return Za=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(T,k){return T.__proto__=k,T},Za(A,y)}function On(A){var y=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 T,k=Ja(A);if(y){var D=Ja(this).constructor;T=Reflect.construct(k,arguments,D)}else T=k.apply(this,arguments);return Ys(this,T)}}function Ys(A,y){if(y&&(Sr(y)==="object"||typeof y=="function"))return y;if(y!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ci(A)}function ci(A){if(A===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function Ja(A){return Ja=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(y){return y.__proto__||Object.getPrototypeOf(y)},Ja(A)}var bl=["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"],$s=function(A){(function(B,J){if(typeof J!="function"&&J!==null)throw new TypeError("Super expression must either be null or a function");B.prototype=Object.create(J&&J.prototype,{constructor:{value:B,writable:!0,configurable:!0}}),Object.defineProperty(B,"prototype",{writable:!1}),J&&Za(B,J)})(V,A);var y,T,k,D=On(V);function V(B,J,ge){var ne;(function(Je,ft){if(!(Je instanceof ft))throw new TypeError("Cannot call a class as a function")})(this,V),(ne=D.call(this)).DOM_CONTENT_LOADED_EVENT_END=He.domContentLoadedEventEnd(),ne.NAVIGATION_START=He.navigationStart(),ne.mux=B,ne.id=J,(ge=z()({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(Je){return Je}},ge)).data=ge.data||{},ge.data.property_key&&(ge.data.env_key=ge.data.property_key,delete ge.data.property_key),Y.setLevel(ge.debug?"debug":"warn"),ne.getPlayheadTime=ge.getPlayheadTime,ne.getStateData=ge.getStateData||function(){return{}},ne.getAdData=ge.getAdData||function(){},ne.minimumRebufferDuration=ge.minimumRebufferDuration,ne.sustainedRebufferThreshold=ge.sustainedRebufferThreshold,ne.playbackHeartbeatTime=ge.playbackHeartbeatTime,ne.disableRebufferTracking=ge.disableRebufferTracking,ne.disableRebufferTracking&&ne.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."),ne.disablePlayheadRebufferTracking=ge.disablePlayheadRebufferTracking,ne.errorTranslator=ge.errorTranslator,ne.playbackEventDispatcher=new Vr(B,ge.data.env_key,ge),ne.data={player_instance_id:b(),mux_sample_rate:ge.sampleRate,beacon_domain:ge.beaconCollectionDomain?ge.beaconCollectionDomain:ge.beaconDomain},ne.data.view_sequence_number=1,ne.data.player_sequence_number=1,ne.oldEmit=ne.emit,ne.emit=function(Je,ft){ft=z()({viewer_time:this.mux.utils.now()},ft),this.oldEmit(Je,ft)};var Be=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(ci(ne));ne.on("viewinit",function(Je,ft){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),z()(this.data,ft),this._initializeViewData(),this.one("play",Be),this.one("adbreakstart",Be)});var mt=function(Je){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",Je)}.bind(ci(ne));if(ne.on("videochange",function(Je,ft){mt(ft)}),ne.on("programchange",function(Je,ft){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."),mt(z()(ft,{view_program_changed:!0})),Be(),this.emit("play"),this.emit("playing")}),ne.on("fragmentchange",function(Je,ft){this.currentFragmentPDT=ft.currentFragmentPDT,this.currentFragmentStart=ft.currentFragmentStart}),ne.on("destroy",ne.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var nt=function(){var Je=ne.data.view_start!==void 0;ne.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",Je&&ne.mux.WINDOW_HIDDEN&&(ne.data.player_is_paused||ne.emit("hb"))};window.addEventListener("visibilitychange",nt,!1);var ht=function(Je){Je.persisted||ne.destroy()};window.addEventListener("pagehide",ht,!1),ne.on("destroy",function(){window.removeEventListener("visibilitychange",nt),window.removeEventListener("pagehide",ht)})}return ne.on("playerready",function(Je,ft){z()(this.data,ft)}),bl.forEach(function(Je){ne.on(Je,function(ft,Kt){Je.indexOf("ad")!==0&&this._updateStateData(),z()(this.data,Kt),this._sanitizeData()}),ne.on("after"+Je,function(){(Je!=="error"||this.errorTracker.viewErrored)&&this.send(Je)})}),ne.on("viewend",function(Je,ft){z()(ne.data,ft)}),ne.one("playerready",function(Je){var ft=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=ft-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}),ne.longResumeTracker=new lr(ci(ne)),ne.errorTracker=new xe(ci(ne)),new Et(ci(ne)),ne.seekingTracker=new G(ci(ne)),ne.playheadTime=new lt(ci(ne)),ne.playbackHeartbeat=new Ue(ci(ne)),new se(ci(ne)),ne.watchTimeTracker=new it(ci(ne)),new gt(ci(ne)),ne.adTracker=new Ce(ci(ne)),new Vt(ci(ne)),new At(ci(ne)),new vi(ci(ne)),new Qe(ci(ne)),new rr(ci(ne)),ge.hlsjs&&ne.addHLSJS(ge),ge.dashjs&&ne.addDashJS(ge),ne.emit("viewinit",ge.data),ne}return y=V,T=[{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(B){var J=z()({},this.data);if(J.video_source_is_live===void 0&&(J.player_source_duration===1/0||J.video_source_duration===1/0?J.video_source_is_live=!0:(J.player_source_duration>0||J.video_source_duration>0)&&(J.video_source_is_live=!1)),J.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(mt){J[mt]=void 0}),J.video_source_url=J.video_source_url||J.player_source_url,J.video_source_url){var ge=jr(ke(J.video_source_url),2),ne=ge[0],Be=ge[1];J.video_source_domain=Be,J.video_source_hostname=ne}delete J.ad_request_id,this.playbackEventDispatcher.send(B,J),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat()}},{key:"_updateStateData",value:function(){z()(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var B=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(J){var ge=parseInt(B.data[J],10);B.data[J]=isNaN(ge)?void 0:ge}),["player_source_url","video_source_url"].forEach(function(J){if(B.data[J]){var ge=B.data[J].toLowerCase();ge.indexOf("data:")!==0&&ge.indexOf("blob:")!==0||(B.data[J]="MSE style URL")}})}},{key:"_resetVideoData",value:function(B,J){var ge=this;Object.keys(this.data).forEach(function(ne){ne.indexOf("video_")===0&&delete ge.data[ne]})}},{key:"_resetViewData",value:function(){var B=this;Object.keys(this.data).forEach(function(J){J.indexOf("view_")===0&&delete B.data[J]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(B,J){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var B=this,J=this.data.view_id=b(),ge=function(){J===B.data.view_id&&Z(B.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",ge):ge()}},{key:"_restartHeartBeat",value:function(){var B=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){B.data.player_is_paused||B.emit("hb")},1e4))}},{key:"addHLSJS",value:function(B){B.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=B.hlsjs,function(J,ge,ne){var Be=arguments.length>4?arguments[4]:void 0,mt=J.log,nt=J.utils.secondsToMs,ht=function(Pt){var dt,bt=parseInt(Be.version);return bt===1&&Pt.programDateTime!==null&&(dt=Pt.programDateTime),bt===0&&Pt.pdt!==null&&(dt=Pt.pdt),dt};if(He.exists()){var Je=function(Pt,dt){return J.emit(ge,Pt,dt)},ft=function(Pt,dt){var bt=dt.levels,st=dt.audioTracks,yt=dt.url,Jt=dt.stats,ai=dt.networkDetails,Ci=dt.sessionData,Ii={},ji={};bt.forEach(function(Yi,$r){Ii[$r]={width:Yi.width,height:Yi.height,bitrate:Yi.bitrate,attrs:Yi.attrs}}),st.forEach(function(Yi,$r){ji[$r]={name:Yi.name,language:Yi.lang,bitrate:Yi.bitrate}});var Mi=ie(Jt),qi=Mi.bytesLoaded,oi=Mi.requestStart,xi=Mi.responseStart,ba=Mi.responseEnd;Je("requestcompleted",_e(_e({},N(Ci)),{},{request_event_type:Pt,request_bytes_loaded:qi,request_start:oi,request_response_start:xi,request_response_end:ba,request_type:"manifest",request_hostname:be(yt),request_response_headers:Re(ai),request_rendition_lists:{media:Ii,audio:ji,video:{}}}))};ne.on(Be.Events.MANIFEST_LOADED,ft);var Kt=function(Pt,dt){var bt=dt.details,st=dt.level,yt=dt.networkDetails,Jt=dt.stats,ai=ie(Jt),Ci=ai.bytesLoaded,Ii=ai.requestStart,ji=ai.responseStart,Mi=ai.responseEnd,qi=bt.fragments[bt.fragments.length-1],oi=ht(qi)+nt(qi.duration);Je("requestcompleted",{request_event_type:Pt,request_bytes_loaded:Ci,request_start:Ii,request_response_start:ji,request_response_end:Mi,request_current_level:st,request_type:"manifest",request_hostname:be(bt.url),request_response_headers:Re(yt),video_holdback:bt.holdBack&&nt(bt.holdBack),video_part_holdback:bt.partHoldBack&&nt(bt.partHoldBack),video_part_target_duration:bt.partTarget&&nt(bt.partTarget),video_target_duration:bt.targetduration&&nt(bt.targetduration),video_source_is_live:bt.live,player_manifest_newest_program_time:isNaN(oi)?void 0:oi})};ne.on(Be.Events.LEVEL_LOADED,Kt);var Zt=function(Pt,dt){var bt=dt.details,st=dt.networkDetails,yt=dt.stats,Jt=ie(yt),ai=Jt.bytesLoaded,Ci=Jt.requestStart,Ii=Jt.responseStart,ji=Jt.responseEnd;Je("requestcompleted",{request_event_type:Pt,request_bytes_loaded:ai,request_start:Ci,request_response_start:Ii,request_response_end:ji,request_type:"manifest",request_hostname:be(bt.url),request_response_headers:Re(st)})};ne.on(Be.Events.AUDIO_TRACK_LOADED,Zt);var Ei=function(Pt,dt){var bt=dt.stats,st=dt.networkDetails,yt=dt.frag;bt=bt||yt.stats;var Jt=ie(bt),ai=Jt.bytesLoaded,Ci=Jt.requestStart,Ii=Jt.responseStart,ji=Jt.responseEnd,Mi=Re(st),qi=Mi==null?void 0:Mi["x-request-id"],oi={request_event_type:Pt,request_bytes_loaded:ai,request_start:Ci,request_response_start:Ii,request_response_end:ji,request_hostname:st?be(st.responseURL):void 0,request_id:qi,request_response_headers:Mi,request_media_duration:yt.duration,request_url:st==null?void 0:st.responseURL};yt.type==="main"?(oi.request_type="media",oi.request_current_level=yt.level,oi.request_video_width=(ne.levels[yt.level]||{}).width,oi.request_video_height=(ne.levels[yt.level]||{}).height,oi.request_labeled_bitrate=(ne.levels[yt.level]||{}).bitrate):oi.request_type=yt.type,Je("requestcompleted",oi)};ne.on(Be.Events.FRAG_LOADED,Ei);var Di=function(Pt,dt){var bt=dt.frag,st=bt.start,yt={currentFragmentPDT:ht(bt),currentFragmentStart:nt(st)};Je("fragmentchange",yt)};ne.on(Be.Events.FRAG_CHANGED,Di);var Dt=function(Pt,dt){var bt=dt.type,st=dt.details,yt=dt.response,Jt=dt.fatal,ai=dt.context,Ci=dt.frag;if(st===Be.ErrorDetails.MANIFEST_LOAD_ERROR||st===Be.ErrorDetails.MANIFEST_LOAD_TIMEOUT||st===Be.ErrorDetails.FRAG_LOAD_ERROR||st===Be.ErrorDetails.FRAG_LOAD_TIMEOUT||st===Be.ErrorDetails.LEVEL_LOAD_ERROR||st===Be.ErrorDetails.LEVEL_LOAD_TIMEOUT){var Ii=Ci&&Ci.url||ai&&ai.url||"";Je("requestfailed",{request_error:st,request_url:Ii,request_hostname:be(Ii),request_type:st===Be.ErrorDetails.FRAG_LOAD_ERROR||st===Be.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":"manifest",request_error_code:yt&&yt.code,request_error_text:yt&&yt.text})}Jt&&Je("error",{player_error_code:bt,player_error_message:st})};ne.on(Be.Events.ERROR,Dt);var hi=function(Pt,dt){var bt=dt.frag,st=bt&&bt._url||"";Je("requestcanceled",{request_event_type:Pt,request_url:st,request_type:"media",request_hostname:be(st)})};ne.on(Be.Events.FRAG_LOAD_EMERGENCY_ABORTED,hi);var ki=function(Pt,dt){var bt=dt.level,st=ne.levels[bt];if(st&&st.attrs&&st.attrs.BANDWIDTH){var yt,Jt=st.attrs.BANDWIDTH,ai=parseFloat(st.attrs["FRAME-RATE"]);isNaN(ai)||(yt=ai),Jt?Je("renditionchange",{video_source_fps:yt,video_source_bitrate:Jt,video_source_width:st.width,video_source_height:st.height,video_source_rendition_name:st.name,video_source_codec:st==null?void 0:st.videoCodec}):mt.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};ne.on(Be.Events.LEVEL_SWITCHED,ki),ne._stopMuxMonitor=function(){ne.off(Be.Events.MANIFEST_LOADED,ft),ne.off(Be.Events.LEVEL_LOADED,Kt),ne.off(Be.Events.AUDIO_TRACK_LOADED,Zt),ne.off(Be.Events.FRAG_LOADED,Ei),ne.off(Be.Events.FRAG_CHANGED,Di),ne.off(Be.Events.ERROR,Dt),ne.off(Be.Events.FRAG_LOAD_EMERGENCY_ABORTED,hi),ne.off(Be.Events.LEVEL_SWITCHED,ki),ne.off(Be.Events.DESTROYING,ne._stopMuxMonitor),delete ne._stopMuxMonitor},ne.on(Be.Events.DESTROYING,ne._stopMuxMonitor)}else mt.warn("performance timing not supported. Not tracking HLS.js.")}(this.mux,this.id,B.hlsjs,{},B.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){var B;this.hlsjs&&((B=this.hlsjs)&&typeof B._stopMuxMonitor=="function"&&B._stopMuxMonitor(),this.hlsjs=void 0)}},{key:"addDashJS",value:function(B){B.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=B.dashjs,function(J,ge,ne){var Be=J.log;if(ne&&ne.on){var mt=function(Dt,hi){return J.emit(ge,Dt,hi)},nt=function(Dt){var hi=Dt.type,ki=(Dt.data||{}).url;mt("requestcompleted",{request_event_type:hi,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:be(ki),request_url:ki})};ne.on("manifestLoaded",nt);var ht={},Je=function(Dt){var hi=Dt.type,ki=Dt.fragmentModel,Pt=(Dt.chunk||{}).mediaInfo||{},dt=Pt.type,bt=Pt.bitrateList,st={};(bt=bt||[]).forEach(function(oi,xi){st[xi]={},st[xi].width=oi.width,st[xi].height=oi.height,st[xi].bitrate=oi.bandwidth,st[xi].attrs={}}),dt==="video"?ht.video=st:dt==="audio"?ht.audio=st:ht.media=st;var yt=Ye(ki,ne),Jt=yt.requestStart,ai=yt.requestResponseStart,Ci=yt.requestResponseEnd,Ii=yt.requestResponseHeaders,ji=yt.requestMediaDuration,Mi=yt.requestHostname,qi=yt.requestUrl;mt("requestcompleted",{request_event_type:hi,request_start:Jt,request_response_start:ai,request_response_end:Ci,request_bytes_loaded:-1,request_type:dt+"_init",request_response_headers:Ii,request_hostname:Mi,request_url:qi,request_media_duration:ji,request_rendition_lists:ht})};ne.on("initFragmentLoaded",Je);var ft=function(Dt){var hi=Dt.type,ki=Dt.fragmentModel,Pt=Dt.chunk||{},dt=Pt.mediaInfo,bt=Pt.start,st=(dt||{}).type,yt=Ye(ki,ne),Jt=yt.requestStart,ai=yt.requestResponseStart,Ci=yt.requestResponseEnd,Ii=yt.requestBytesLoaded,ji=yt.requestResponseHeaders,Mi=yt.requestMediaDuration,qi=yt.requestHostname,oi=yt.requestUrl,xi=ot(st,ne),ba=xi.currentLevel,Yi=xi.renditionWidth,$r=xi.renditionHeight,Js=xi.renditionBitrate;mt("requestcompleted",{request_event_type:hi,request_start:Jt,request_response_start:ai,request_response_end:Ci,request_bytes_loaded:Ii,request_type:st,request_response_headers:ji,request_hostname:qi,request_url:oi,request_media_start_time:bt,request_media_duration:Mi,request_current_level:ba,request_labeled_bitrate:Js,request_video_width:Yi,request_video_height:$r})};ne.on("mediaFragmentLoaded",ft);var Kt={video:void 0,audio:void 0,totalBitrate:void 0},Zt=function(){if(Kt.video&&typeof Kt.video.bitrate=="number"){if(Kt.video.width&&Kt.video.height){var Dt=Kt.video.bitrate;return Kt.audio&&typeof Kt.audio.bitrate=="number"&&(Dt+=Kt.audio.bitrate),Dt!==Kt.totalBitrate?(Kt.totalBitrate=Dt,{video_source_bitrate:Dt,video_source_height:Kt.video.height,video_source_width:Kt.video.width,video_source_codec:le(Kt.video.codec)}):void 0}Be.warn("have bitrate info for video but missing width/height")}},Ei=function(Dt,hi,ki){if(typeof Dt.newQuality=="number"){var Pt=Dt.mediaType;if(Pt==="audio"||Pt==="video"){var dt=ne.getBitrateInfoListFor(Pt).find(function(st){return st.qualityIndex===Dt.newQuality});if(dt&&typeof dt.bitrate=="number"){Kt[Pt]=Fe(Fe({},dt),{},{codec:ne.getCurrentTrackFor(Pt).codec});var bt=Zt();bt&&mt("renditionchange",bt)}else Be.warn("missing bitrate info for ".concat(Pt))}}else Be.warn("missing evt.newQuality in qualityChangeRendered event",Dt)};ne.on("qualityChangeRendered",Ei);var Di=function(Dt){var hi=Dt.error,ki=Dt.event,Pt=(ki=ki||{}).request||{},dt=R().event&&R().event.currentTarget||{};mt("requestfailed",{request_error:hi+"_"+ki.id+"_"+Pt.type,request_url:ki.url,request_hostname:be(ki.url),request_type:Pt.mediaType,request_error_code:dt.status,request_error_type:dt.statusText})};ne.on("error",Di),ne._stopMuxMonitor=function(){ne.off("manifestLoaded",nt),ne.off("initFragmentLoaded",Je),ne.off("mediaFragmentLoaded",ft),ne.off("qualityChangeRendered",Ei),ne.off("error",Di),delete ne._stopMuxMonitor}}else Be.warn("Invalid dash.js player reference. Monitoring blocked.")}(this.mux,this.id,B.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){var B;this.dashjs&&((B=this.dashjs)&&typeof B._stopMuxMonitor=="function"&&B._stopMuxMonitor(),this.dashjs=void 0)}}],T&&Xa(y.prototype,T),k&&Xa(y,k),Object.defineProperty(y,"prototype",{writable:!1}),V}(Le),kr=$s,Pn=L(153),ga=L.n(Pn);function Ea(A){return Ea=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},Ea(A)}function Nn(A,y){return function(T){if(Array.isArray(T))return T}(A)||function(T,k){var D=T==null?null:typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(D!=null){var V,B,J=[],ge=!0,ne=!1;try{for(D=D.call(T);!(ge=(V=D.next()).done)&&(J.push(V.value),!k||J.length!==k);ge=!0);}catch(Be){ne=!0,B=Be}finally{try{ge||D.return==null||D.return()}finally{if(ne)throw B}}return J}}(A,y)||function(T,k){if(T){if(typeof T=="string")return zs(T,k);var D=Object.prototype.toString.call(T).slice(8,-1);return D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set"?Array.from(T):D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)?zs(T,k):void 0}}(A,y)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
5
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function zs(A,y){(y==null||y>A.length)&&(y=A.length);for(var T=0,k=new Array(y);T<y;T++)k[T]=A[T];return k}var qr,Un=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],Tl={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};R()&&R().WeakMap&&(qr=new WeakMap);var en="#EXT-X-TARGETDURATION",_l="#EXT-X-PART-INF",Al="#EXT-X-SERVER-CONTROL",Sl="#EXTINF",Qs="#EXT-X-PROGRAM-DATE-TIME",tn="#EXT-X-VERSION",Fn="#EXT-X-SESSION-DATA",rn=function(A){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(A),this.manifest};rn.prototype.process=function(A){var y;for(this.buffer+=A,y=this.buffer.indexOf(`
6
+ `);y>-1;y=this.buffer.indexOf(`
7
+ `))this.processLine(this.buffer.substring(0,y)),this.buffer=this.buffer.substring(y+1)},rn.prototype.processLine=function(A){var y=A.indexOf(":"),T=wl(A,y),k=T[0],D=T.length===2?ya(T[1]):void 0;if(k[0]!=="#")this.currentUri.uri=k,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(k){case en:if(!isFinite(D)||D<0)return;this.manifest.targetDuration=D,this.setHoldBack();break;case _l:Bn(this.manifest,T),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case Al:Bn(this.manifest,T),this.setHoldBack();break;case Sl:D===0?this.currentUri.duration=.01:D>0&&(this.currentUri.duration=D);break;case Qs:var V=D,B=new Date(V);this.manifest.dateTimeString||(this.manifest.dateTimeString=V,this.manifest.dateTimeObject=B),this.currentUri.dateTimeString=V,this.currentUri.dateTimeObject=B;break;case tn:Bn(this.manifest,T);break;case Fn:var J=Ll(T[1]),ge=N(J);z()(this.manifest.sessionData,ge)}},rn.prototype.setHoldBack=function(){var A=this.manifest,y=A.serverControl,T=A.targetDuration,k=A.partTargetDuration;if(y){var D="holdBack",V="partHoldBack",B=T&&3*T,J=k&&2*k;T&&!y.hasOwnProperty(D)&&(y[D]=B),B&&y[D]<B&&(y[D]=B),k&&!y.hasOwnProperty(V)&&(y[V]=3*k),k&&y[V]<J&&(y[V]=J)}};var Bn=function(A,y){var T,k=Xs(y[0].replace("#EXT-X-",""));Hn(y[1])?(T={},T=z()(Il(y[1]),T)):T=ya(y[1]),A[k]=T},Xs=function(A){return A.toLowerCase().replace(/-(\w)/g,function(y){return y[1].toUpperCase()})},ya=function(A){if(A.toLowerCase()==="yes"||A.toLowerCase()==="no")return A.toLowerCase()==="yes";var y=A.indexOf(":")!==-1?A:parseFloat(A);return isNaN(y)?A:y},kl=function(A){var y={},T=A.split("=");return T.length>1&&(y[Xs(T[0])]=ya(T[1])),y},Il=function(A){for(var y=A.split(","),T={},k=0;y.length>k;k++){var D=y[k],V=kl(D);T=z()(V,T)}return T},Hn=function(A){return A.indexOf("=")>-1},wl=function(A,y){return y===-1?[A]:[A.substring(0,y),A.substring(y+1)]},Ll=function(A){var y={};if(A){var T=A.search(",");return[A.slice(0,T),A.slice(T+1)].forEach(function(k,D){for(var V=k.replace(/['"]+/g,"").split("="),B=0;B<V.length;B++)V[B]==="DATA-ID"&&(y["DATA-ID"]=V[1-B]),V[B]==="VALUE"&&(y.VALUE=V[1-B])}),{data:y}}},Dl=rn,Kn={safeCall:function(A,y,T,k){var D=k;if(A&&typeof A[y]=="function")try{D=A[y].apply(A,T)}catch(V){Y.info("safeCall error",V)}return D},safeIncrement:Z,getComputedStyle:function(A,y){var T;if(A&&y&&R()&&typeof R().getComputedStyle=="function")return qr&&qr.has(A)&&(T=qr.get(A)),T||(T=R().getComputedStyle(A,null),qr&&qr.set(A,T)),T.getPropertyValue(y)},secondsToMs:function(A){return Math.floor(1e3*A)},assign:z(),headersStringToObject:q,extractHostnameAndDomain:ke,extractHostname:be,manifestParser:Dl,generateShortID:P,generateUUID:b,now:X.now},Gn={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 Rl(A,y){return function(T){if(Array.isArray(T))return T}(A)||function(T,k){var D=T==null?null:typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(D!=null){var V,B,J=[],ge=!0,ne=!1;try{for(D=D.call(T);!(ge=(V=D.next()).done)&&(J.push(V.value),!k||J.length!==k);ge=!0);}catch(Be){ne=!0,B=Be}finally{try{ge||D.return==null||D.return()}finally{if(ne)throw B}}return J}}(A,y)||function(T,k){if(T){if(typeof T=="string")return wt(T,k);var D=Object.prototype.toString.call(T).slice(8,-1);return D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set"?Array.from(T):D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)?wt(T,k):void 0}}(A,y)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
8
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function wt(A,y){(y==null||y>A.length)&&(y=A.length);for(var T=0,k=new Array(y);T<y;T++)k[T]=A[T];return k}var Wi={},Yr=function A(y){var T=arguments;typeof y=="string"?A.hasOwnProperty(y)?R().setTimeout(function(){T=Array.prototype.splice.call(T,1),A[y].apply(null,T)},0):Y.warn("`"+y+"` is an unknown task"):typeof y=="function"?R().setTimeout(function(){y(A)},0):Y.warn("`"+y+"` is invalid.")},Zs={loaded:X.now(),NAME:"mux-embed",VERSION:"4.17.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(A,y){return function(T,k,D){var V=Nn(ue(k),3),B=V[0],J=V[1],ge=V[2],ne=T.log,Be=T.utils.getComputedStyle,mt=T.utils.secondsToMs;if(!B)return ne.error("No element was found with the `"+J+"` query selector.");if(ge!=="video"&&ge!=="audio")return ne.error("The element of `"+J+"` was not a media element.");B.mux&&(B.mux.destroy(),delete B.mux,ne.warn("Already monitoring this video element, replacing existing event listeners")),(D=z()({automaticErrorTracking:!0},D)).data=z()({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:T.VERSION},D.data),D.getPlayheadTime=function(){return mt(B.currentTime)},D.getStateData=function(){var ht,Je,ft=this.hlsjs&&this.hlsjs.url,Kt=this.dashjs&&Ea(this.dashjs.getSource==="function")&&this.dashjs.getSource(),Zt={player_is_paused:B.paused,player_playhead_time:mt(B.currentTime),player_width:parseInt(Be(B,"width")),player_height:parseInt(Be(B,"height")),player_autoplay_on:B.autoplay,player_preload_on:B.preload,player_language_code:B.lang,player_is_fullscreen:ga()&&!!(ga().fullscreenElement||ga().webkitFullscreenElement||ga().mozFullScreenElement||ga().msFullscreenElement),video_poster_url:B.poster,video_source_url:ft||Kt||B.currentSrc,video_source_duration:mt(B.duration),video_source_height:B.videoHeight,video_source_width:B.videoWidth,view_dropped_frame_count:(ht=B)===null||ht===void 0||(Je=ht.getVideoPlaybackQuality)===null||Je===void 0?void 0:Je.call(ht).droppedVideoFrames},Ei=D.getPlayheadTime();if(B.getStartDate&&Ei>0){var Di=B.getStartDate();if(Di&&typeof Di.getTime=="function"&&Di.getTime()){var Dt=Di.getTime();if(Zt.player_program_time=Dt+Ei,B.seekable.length>0){var hi=Dt+B.seekable.end(B.seekable.length-1);Zt.player_live_edge_program_time=hi}}}return Zt},B.mux=B.mux||{},B.mux.deleted=!1,B.mux.emit=function(ht,Je){T.emit(J,ht,Je)};var nt=function(){ne.error("The monitor for this video element has already been destroyed.")};B.mux.destroy=function(){Object.keys(B.mux.listeners).forEach(function(ht){B.removeEventListener(ht,B.mux.listeners[ht],!1)}),delete B.mux.listeners,B.mux.destroy=nt,B.mux.swapElement=nt,B.mux.emit=nt,B.mux.addHLSJS=nt,B.mux.addDashJS=nt,B.mux.removeHLSJS=nt,B.mux.removeDashJS=nt,B.mux.deleted=!0,T.emit(J,"destroy")},B.mux.swapElement=function(ht){var Je=Nn(ue(ht),3),ft=Je[0],Kt=Je[1],Zt=Je[2];return ft?Zt!=="video"&&Zt!=="audio"?T.log.error("The element of `"+Kt+"` was not a media element."):(ft.muxId=B.muxId,delete B.muxId,ft.mux=ft.mux||{},ft.mux.listeners=z()({},B.mux.listeners),delete B.mux.listeners,Object.keys(ft.mux.listeners).forEach(function(Ei){B.removeEventListener(Ei,ft.mux.listeners[Ei],!1),ft.addEventListener(Ei,ft.mux.listeners[Ei],!1)}),ft.mux.swapElement=B.mux.swapElement,ft.mux.destroy=B.mux.destroy,delete B.mux,void(B=ft)):T.log.error("No element was found with the `"+Kt+"` query selector.")},B.mux.addHLSJS=function(ht){T.addHLSJS(J,ht)},B.mux.addDashJS=function(ht){T.addDashJS(J,ht)},B.mux.removeHLSJS=function(){T.removeHLSJS(J)},B.mux.removeDashJS=function(){T.removeDashJS(J)},T.init(J,D),T.emit(J,"playerready"),B.paused||(T.emit(J,"play"),B.readyState>2&&T.emit(J,"playing")),B.mux.listeners={},Un.forEach(function(ht){(ht!=="error"||D.automaticErrorTracking)&&(B.mux.listeners[ht]=function(){var Je={};if(ht==="error"){if(!B.error||B.error.code===1)return;Je.player_error_code=B.error.code,Je.player_error_message=Tl[B.error.code]||B.error.message}T.emit(J,ht,Je)},B.addEventListener(ht,B.mux.listeners[ht],!1))})}(Yr,A,y)},destroyMonitor:function(A){var y=Rl(ue(A),1)[0];y&&y.mux&&typeof y.mux.destroy=="function"?y.mux.destroy():Y.error("A video element monitor for `"+A+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(A,y){var T=O(A);Wi[T]?Wi[T].addHLSJS(y):Y.error("A monitor for `"+T+"` has not been initialized.")},addDashJS:function(A,y){var T=O(A);Wi[T]?Wi[T].addDashJS(y):Y.error("A monitor for `"+T+"` has not been initialized.")},removeHLSJS:function(A){var y=O(A);Wi[y]?Wi[y].removeHLSJS():Y.error("A monitor for `"+y+"` has not been initialized.")},removeDashJS:function(A){var y=O(A);Wi[y]?Wi[y].removeDashJS():Y.error("A monitor for `"+y+"` has not been initialized.")},init:function(A,y){pe()&&y&&y.respectDoNotTrack&&Y.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var T=O(A);Wi[T]=new kr(Yr,T,y)},emit:function(A,y,T){var k=O(A);Wi[k]?(Wi[k].emit(y,T),y==="destroy"&&delete Wi[k]):Y.error("A monitor for `"+k+"` has not been initialized.")},checkDoNotTrack:pe,log:Y,utils:Kn,events:Gn,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Yr,Zs),R()!==void 0&&typeof R().addEventListener=="function"&&R().addEventListener("pagehide",function(A){A.persisted||(Yr.WINDOW_UNLOADING=!0)},!1);var Cl=Yr},655:function(g,E,L){var M,R;function b(P){return b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(O){return typeof O}:function(O){return O&&typeof Symbol=="function"&&O.constructor===Symbol&&O!==Symbol.prototype?"symbol":typeof O},b(P);}(function(P){var O=!1;if((R=typeof(M=P)=="function"?M.call(E,L,E,g):M)===void 0||(g.exports=R),O=!0,b(E)==="object"&&(g.exports=P(),O=!0),!O){var ue=window.Cookies,Q=window.Cookies=P();Q.noConflict=function(){return window.Cookies=ue,Q}}})(function(){var P=function(){for(var O=0,ue={};O<arguments.length;O++){var Q=arguments[O];for(var de in Q)ue[de]=Q[de]}return ue};return function O(ue){function Q(de,he,Y){var pe;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(Y=P({path:"/"},Q.defaults,Y)).expires=="number"){var X=new Date;X.setMilliseconds(X.getMilliseconds()+864e5*Y.expires),Y.expires=X}try{pe=JSON.stringify(he),/^[\{\[]/.test(pe)&&(he=pe)}catch{}return he=ue.write?ue.write(he,de):encodeURIComponent(String(he)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),de=(de=(de=encodeURIComponent(String(de))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[de,"=",he,Y.expires?"; expires="+Y.expires.toUTCString():"",Y.path?"; path="+Y.path:"",Y.domain?"; domain="+Y.domain:"",Y.secure?"; secure":""].join("")}de||(pe={});for(var oe=document.cookie?document.cookie.split("; "):[],z=/(%[0-9A-Z]{2})+/g,be=0;be<oe.length;be++){var ke=oe[be].split("="),He=ke.slice(1).join("=");He.charAt(0)==='"'&&(He=He.slice(1,-1));try{var Z=ke[0].replace(z,decodeURIComponent);if(He=ue.read?ue.read(He,Z):ue(He,Z)||He.replace(z,decodeURIComponent),this.json)try{He=JSON.parse(He)}catch{}if(de===Z){pe=He;break}de||(pe[Z]=He)}catch{}}return pe}}return Q.set=Q,Q.get=function(de){return Q.call(Q,de)},Q.getJSON=function(){return Q.apply({json:!0},[].slice.call(arguments))},Q.defaults={},Q.remove=function(de,he){Q(de,"",P(he,{expires:-1}))},Q.withConverter=O,Q}(function(){})})},153:function(g,E,L){var M,R=L.g!==void 0?L.g:typeof window!="undefined"?window:{},b=L(558);typeof document!="undefined"?M=document:(M=R["__GLOBAL_DOCUMENT_CACHE@4"])||(M=R["__GLOBAL_DOCUMENT_CACHE@4"]=b),g.exports=M},48:function(g,E,L){var M;M=typeof window!="undefined"?window:L.g!==void 0?L.g:typeof self!="undefined"?self:{},g.exports=M},678:function(g){var E=9007199254740991,L="[object Arguments]",M="[object Function]",R="[object GeneratorFunction]",b=/^(?:0|[1-9]\d*)$/;function P(te,ie,Re){switch(Re.length){case 0:return te.call(ie);case 1:return te.call(ie,Re[0]);case 2:return te.call(ie,Re[0],Re[1]);case 3:return te.call(ie,Re[0],Re[1],Re[2])}return te.apply(ie,Re)}var O,ue,Q=Object.prototype,de=Q.hasOwnProperty,he=Q.toString,Y=Q.propertyIsEnumerable,pe=(O=Object.keys,ue=Object,function(te){return O(ue(te))}),X=Math.max,oe=!Y.call({valueOf:1},"valueOf");function z(te,ie){var Re=I(te)||function(Ye){return function(ot){return function(le){return!!le&&typeof le=="object"}(ot)&&q(ot)}(Ye)&&de.call(Ye,"callee")&&(!Y.call(Ye,"callee")||he.call(Ye)==L)}(te)?function(Ye,ot){for(var le=-1,Ee=Array(Ye);++le<Ye;)Ee[le]=ot(le);return Ee}(te.length,String):[],Pe=Re.length,Fe=!!Pe;for(var Se in te)!ie&&!de.call(te,Se)||Fe&&(Se=="length"||ke(Se,Pe))||Re.push(Se);return Re}function be(te,ie,Re){var Pe=te[ie];de.call(te,ie)&&Z(Pe,Re)&&(Re!==void 0||ie in te)||(te[ie]=Re)}function ke(te,ie){return!!(ie=ie==null?E:ie)&&(typeof te=="number"||b.test(te))&&te>-1&&te%1==0&&te<ie}function He(te){var ie=te&&te.constructor;return te===(typeof ie=="function"&&ie.prototype||Q)}function Z(te,ie){return te===ie||te!=te&&ie!=ie}var I=Array.isArray;function q(te){return te!=null&&function(ie){return typeof ie=="number"&&ie>-1&&ie%1==0&&ie<=E}(te.length)&&!function(ie){var Re=N(ie)?he.call(ie):"";return Re==M||Re==R}(te)}function N(te){var ie=typeof te;return!!te&&(ie=="object"||ie=="function")}var fe,_e=(fe=function(te,ie){if(oe||He(ie)||q(ie))(function(Pe,Fe,Se,Ye){Se||(Se={});for(var ot=-1,le=Fe.length;++ot<le;){var Ee=Fe[ot],U=Ye?Ye(Se[Ee],Pe[Ee],Ee,Se,Pe):void 0;be(Se,Ee,U===void 0?Pe[Ee]:U)}})(ie,function(Pe){return q(Pe)?z(Pe):function(Fe){if(!He(Fe))return pe(Fe);var Se=[];for(var Ye in Object(Fe))de.call(Fe,Ye)&&Ye!="constructor"&&Se.push(Ye);return Se}(Pe)}(ie),te);else for(var Re in ie)de.call(ie,Re)&&be(te,Re,ie[Re])},function(te,ie){return ie=X(ie===void 0?te.length-1:ie,0),function(){for(var Re=arguments,Pe=-1,Fe=X(Re.length-ie,0),Se=Array(Fe);++Pe<Fe;)Se[Pe]=Re[ie+Pe];Pe=-1;for(var Ye=Array(ie+1);++Pe<ie;)Ye[Pe]=Re[Pe];return Ye[ie]=Se,P(te,this,Ye)}}(function(te,ie){var Re=-1,Pe=ie.length,Fe=Pe>1?ie[Pe-1]:void 0,Se=Pe>2?ie[2]:void 0;for(Fe=fe.length>3&&typeof Fe=="function"?(Pe--,Fe):void 0,Se&&function(ot,le,Ee){if(!N(Ee))return!1;var U=typeof le;return!!(U=="number"?q(Ee)&&ke(le,Ee.length):U=="string"&&le in Ee)&&Z(Ee[le],ot)}(ie[0],ie[1],Se)&&(Fe=Pe<3?void 0:Fe,Pe=1),te=Object(te);++Re<Pe;){var Ye=ie[Re];Ye&&fe(te,Ye,Re,Fe)}return te}));g.exports=_e},640:function(g,E,L){var M,R;(function(b,P){"use strict";M=function(){var O=function(){},ue="undefined",Q=typeof window!==ue&&typeof window.navigator!==ue&&/Trident\/|MSIE /.test(window.navigator.userAgent),de=["trace","debug","info","warn","error"];function he(I,q){var N=I[q];if(typeof N.bind=="function")return N.bind(I);try{return Function.prototype.bind.call(N,I)}catch{return function(){return Function.prototype.apply.apply(N,[I,arguments])}}}function Y(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function pe(I){return I==="debug"&&(I="log"),typeof console!==ue&&(I==="trace"&&Q?Y:console[I]!==void 0?he(console,I):console.log!==void 0?he(console,"log"):O)}function X(I,q){for(var N=0;N<de.length;N++){var fe=de[N];this[fe]=N<I?O:this.methodFactory(fe,I,q)}this.log=this.debug}function oe(I,q,N){return function(){typeof console!==ue&&(X.call(this,q,N),this[I].apply(this,arguments))}}function z(I,q,N){return pe(I)||oe.apply(this,arguments)}function be(I,q,N){var fe,_e=this;q=q==null?"WARN":q;var te="loglevel";function ie(Se){var Ye=(de[Se]||"silent").toUpperCase();if(typeof window!==ue&&te){try{return void(window.localStorage[te]=Ye)}catch{}try{window.document.cookie=encodeURIComponent(te)+"="+Ye+";"}catch{}}}function Re(){var Se;if(typeof window!==ue&&te){try{Se=window.localStorage[te]}catch{}if(typeof Se===ue)try{var Ye=window.document.cookie,ot=Ye.indexOf(encodeURIComponent(te)+"=");ot!==-1&&(Se=/^([^;]+)/.exec(Ye.slice(ot))[1])}catch{}return _e.levels[Se]===void 0&&(Se=void 0),Se}}function Pe(){if(typeof window!==ue&&te){try{return void window.localStorage.removeItem(te)}catch{}try{window.document.cookie=encodeURIComponent(te)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof I=="string"?te+=":"+I:typeof I=="symbol"&&(te=void 0),_e.name=I,_e.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},_e.methodFactory=N||z,_e.getLevel=function(){return fe},_e.setLevel=function(Se,Ye){if(typeof Se=="string"&&_e.levels[Se.toUpperCase()]!==void 0&&(Se=_e.levels[Se.toUpperCase()]),!(typeof Se=="number"&&Se>=0&&Se<=_e.levels.SILENT))throw"log.setLevel() called with invalid level: "+Se;if(fe=Se,Ye!==!1&&ie(Se),X.call(_e,Se,I),typeof console===ue&&Se<_e.levels.SILENT)return"No console available for logging"},_e.setDefaultLevel=function(Se){q=Se,Re()||_e.setLevel(Se,!1)},_e.resetLevel=function(){_e.setLevel(q,!1),Pe()},_e.enableAll=function(Se){_e.setLevel(_e.levels.TRACE,Se)},_e.disableAll=function(Se){_e.setLevel(_e.levels.SILENT,Se)};var Fe=Re();Fe==null&&(Fe=q),_e.setLevel(Fe,!1)}var ke=new be,He={};ke.getLogger=function(I){if(typeof I!="symbol"&&typeof I!="string"||I==="")throw new TypeError("You must supply a name when creating a logger.");var q=He[I];return q||(q=He[I]=new be(I,ke.getLevel(),ke.methodFactory)),q};var Z=typeof window!==ue?window.log:void 0;return ke.noConflict=function(){return typeof window!==ue&&window.log===ke&&(window.log=Z),ke},ke.getLoggers=function(){return He},ke.default=ke,ke},(R=typeof M=="function"?M.call(E,L,E,g):M)===void 0||(g.exports=R)})()},375:function(g,E){"use strict";var L=Object.prototype.hasOwnProperty;function M(b){try{return decodeURIComponent(b.replace(/\+/g," "))}catch{return null}}function R(b){try{return encodeURIComponent(b)}catch{return null}}E.stringify=function(b,P){P=P||"";var O,ue,Q=[];for(ue in typeof P!="string"&&(P="?"),b)if(L.call(b,ue)){if((O=b[ue])||O!=null&&!isNaN(O)||(O=""),ue=R(ue),O=R(O),ue===null||O===null)continue;Q.push(ue+"="+O)}return Q.length?P+Q.join("&"):""},E.parse=function(b){for(var P,O=/([^=?#&]+)=?([^&]*)/g,ue={};P=O.exec(b);){var Q=M(P[1]),de=M(P[2]);Q===null||de===null||Q in ue||(ue[Q]=de)}return ue}},558:function(){}},d={};function v(g){var E=d[g];if(E!==void 0)return E.exports;var L=d[g]={exports:{}};return r[g].call(L.exports,L,L.exports,v),L.exports}return v.n=function(g){var E=g&&g.__esModule?function(){return g.default}:function(){return g};return v.d(E,{a:E}),E},v.d=function(g,E){for(var L in E)v.o(E,L)&&!v.o(g,L)&&Object.defineProperty(g,L,{enumerable:!0,get:E[L]})},v.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),v.o=function(g,E){return Object.prototype.hasOwnProperty.call(g,E)},v(80)}()},typeof Ko=="object"&&typeof dd=="object"?dd.exports=t():typeof Ko=="object"?Ko.mux=t():a.mux=t()})()});var Bh=sc((Ts,cd)=>{typeof window!="undefined"&&function(a,t){typeof Ts=="object"&&typeof cd=="object"?cd.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Ts=="object"?Ts.Hls=t():a.Hls=t()}(Ts,()=>(()=>{var a={21:(v,g,E)=>{"use strict";E.r(g),E.d(g,{default:()=>ue});var L=function(){function Q(de,he){this.subtle=void 0,this.aesIV=void 0,this.subtle=de,this.aesIV=he}return Q.prototype.decrypt=function(de,he){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},he,de)},Q}(),M=function(){function Q(de,he){this.subtle=void 0,this.key=void 0,this.subtle=de,this.key=he}return Q.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},Q}(),R=E(145),b=function(){function Q(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var de=Q.prototype;return de.uint8ArrayToUint32Array_=function(he){for(var Y=new DataView(he),pe=new Uint32Array(4),X=0;X<4;X++)pe[X]=Y.getUint32(4*X);return pe},de.initTable=function(){var he=this.sBox,Y=this.invSBox,pe=this.subMix,X=pe[0],oe=pe[1],z=pe[2],be=pe[3],ke=this.invSubMix,He=ke[0],Z=ke[1],I=ke[2],q=ke[3],N=new Uint32Array(256),fe=0,_e=0,te=0;for(te=0;te<256;te++)N[te]=te<128?te<<1:te<<1^283;for(te=0;te<256;te++){var ie=_e^_e<<1^_e<<2^_e<<3^_e<<4;ie=ie>>>8^255&ie^99,he[fe]=ie,Y[ie]=fe;var Re=N[fe],Pe=N[Re],Fe=N[Pe],Se=257*N[ie]^16843008*ie;X[fe]=Se<<24|Se>>>8,oe[fe]=Se<<16|Se>>>16,z[fe]=Se<<8|Se>>>24,be[fe]=Se,Se=16843009*Fe^65537*Pe^257*Re^16843008*fe,He[ie]=Se<<24|Se>>>8,Z[ie]=Se<<16|Se>>>16,I[ie]=Se<<8|Se>>>24,q[ie]=Se,fe?(fe=Re^N[N[N[Fe^Re]]],_e^=N[N[_e]]):fe=_e=1}},de.expandKey=function(he){for(var Y=this.uint8ArrayToUint32Array_(he),pe=!0,X=0;X<Y.length&&pe;)pe=Y[X]===this.key[X],X++;if(!pe){this.key=Y;var oe=this.keySize=Y.length;if(oe!==4&&oe!==6&&oe!==8)throw new Error("Invalid aes key size="+oe);var z,be,ke,He,Z=this.ksRows=4*(oe+6+1),I=this.keySchedule=new Uint32Array(Z),q=this.invKeySchedule=new Uint32Array(Z),N=this.sBox,fe=this.rcon,_e=this.invSubMix,te=_e[0],ie=_e[1],Re=_e[2],Pe=_e[3];for(z=0;z<Z;z++)z<oe?ke=I[z]=Y[z]:(He=ke,z%oe==0?(He=N[(He=He<<8|He>>>24)>>>24]<<24|N[He>>>16&255]<<16|N[He>>>8&255]<<8|N[255&He],He^=fe[z/oe|0]<<24):oe>6&&z%oe==4&&(He=N[He>>>24]<<24|N[He>>>16&255]<<16|N[He>>>8&255]<<8|N[255&He]),I[z]=ke=(I[z-oe]^He)>>>0);for(be=0;be<Z;be++)z=Z-be,He=3&be?I[z]:I[z-4],q[be]=be<4||z<=4?He:te[N[He>>>24]]^ie[N[He>>>16&255]]^Re[N[He>>>8&255]]^Pe[N[255&He]],q[be]=q[be]>>>0}},de.networkToHostOrderSwap=function(he){return he<<24|(65280&he)<<8|(16711680&he)>>8|he>>>24},de.decrypt=function(he,Y,pe){for(var X,oe,z,be,ke,He,Z,I,q,N,fe,_e,te,ie,Re=this.keySize+6,Pe=this.invKeySchedule,Fe=this.invSBox,Se=this.invSubMix,Ye=Se[0],ot=Se[1],le=Se[2],Ee=Se[3],U=this.uint8ArrayToUint32Array_(pe),ve=U[0],Le=U[1],Ne=U[2],Ue=U[3],Ge=new Int32Array(he),Te=new Int32Array(Ge.length),xe=this.networkToHostOrderSwap;Y<Ge.length;){for(q=xe(Ge[Y]),N=xe(Ge[Y+1]),fe=xe(Ge[Y+2]),_e=xe(Ge[Y+3]),ke=q^Pe[0],He=_e^Pe[1],Z=fe^Pe[2],I=N^Pe[3],te=4,ie=1;ie<Re;ie++)X=Ye[ke>>>24]^ot[He>>16&255]^le[Z>>8&255]^Ee[255&I]^Pe[te],oe=Ye[He>>>24]^ot[Z>>16&255]^le[I>>8&255]^Ee[255&ke]^Pe[te+1],z=Ye[Z>>>24]^ot[I>>16&255]^le[ke>>8&255]^Ee[255&He]^Pe[te+2],be=Ye[I>>>24]^ot[ke>>16&255]^le[He>>8&255]^Ee[255&Z]^Pe[te+3],ke=X,He=oe,Z=z,I=be,te+=4;X=Fe[ke>>>24]<<24^Fe[He>>16&255]<<16^Fe[Z>>8&255]<<8^Fe[255&I]^Pe[te],oe=Fe[He>>>24]<<24^Fe[Z>>16&255]<<16^Fe[I>>8&255]<<8^Fe[255&ke]^Pe[te+1],z=Fe[Z>>>24]<<24^Fe[I>>16&255]<<16^Fe[ke>>8&255]<<8^Fe[255&He]^Pe[te+2],be=Fe[I>>>24]<<24^Fe[ke>>16&255]<<16^Fe[He>>8&255]<<8^Fe[255&Z]^Pe[te+3],Te[Y]=xe(X^ve),Te[Y+1]=xe(be^Le),Te[Y+2]=xe(z^Ne),Te[Y+3]=xe(oe^Ue),ve=q,Le=N,Ne=fe,Ue=_e,Y+=4}return Te.buffer},Q}(),P=E(93),O=E(63),ue=function(){function Q(he,Y){var pe=(Y===void 0?{}:Y).removePKCS7Padding,X=pe===void 0||pe;if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=he.enableSoftwareAES,this.removePKCS7Padding=X,X)try{var oe=self.crypto;oe&&(this.subtle=oe.subtle||oe.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}var de=Q.prototype;return de.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},de.isSync=function(){return this.useSoftware},de.flush=function(){var he=this.currentResult,Y=this.remainderData;if(!he||Y)return P.logger.error("[softwareDecrypt] "+(Y?"overflow bytes: "+Y.byteLength:"no result")),this.reset(),null;var pe,X,oe,z=new Uint8Array(he);return this.reset(),this.removePKCS7Padding?(oe=(X=(pe=z).byteLength)&&new DataView(pe.buffer).getUint8(X-1))?(0,R.sliceUint8)(pe,0,X-oe):pe:z},de.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},de.decrypt=function(he,Y,pe){var X=this;return this.useSoftware?new Promise(function(oe,z){X.softwareDecrypt(new Uint8Array(he),Y,pe);var be=X.flush();be?oe(be.buffer):z(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(he),Y,pe)},de.softwareDecrypt=function(he,Y,pe){var X=this.currentIV,oe=this.currentResult,z=this.remainderData;this.logOnce("JS AES decrypt"),z&&(he=(0,O.appendUint8Array)(z,he),this.remainderData=null);var be=this.getValidChunk(he);if(!be.length)return null;X&&(pe=X);var ke=this.softwareDecrypter;ke||(ke=this.softwareDecrypter=new b),ke.expandKey(Y);var He=oe;return this.currentResult=ke.decrypt(be.buffer,0,pe),this.currentIV=(0,R.sliceUint8)(be,-16).buffer,He||null},de.webCryptoDecrypt=function(he,Y,pe){var X=this,oe=this.subtle;return this.key===Y&&this.fastAesKey||(this.key=Y,this.fastAesKey=new M(oe,Y)),this.fastAesKey.expandKey().then(function(z){return oe?(X.logOnce("WebCrypto AES decrypt"),new L(oe,new Uint8Array(pe)).decrypt(he.buffer,z)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(z){return P.logger.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+z.name+": "+z.message),X.onWebCryptoError(he,Y,pe)})},de.onWebCryptoError=function(he,Y,pe){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(he,Y,pe);var X=this.flush();if(X)return X.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},de.getValidChunk=function(he){var Y=he,pe=he.length-he.length%16;return pe!==he.length&&(Y=(0,R.sliceUint8)(he,0,pe),this.remainderData=(0,R.sliceUint8)(he,pe)),Y},de.logOnce=function(he){this.logEnabled&&(P.logger.log("[decrypter]: "+he),this.logEnabled=!1)},Q}()},181:(v,g,E)=>{"use strict";E.r(g),E.d(g,{canParse:()=>O,decodeFrame:()=>Y,getID3Data:()=>b,getID3Frames:()=>he,getTimeStamp:()=>ue,isFooter:()=>R,isHeader:()=>M,isTimeStampFrame:()=>Q,testables:()=>ke,utf8ArrayToStr:()=>be});var L,M=function(Z,I){return I+10<=Z.length&&Z[I]===73&&Z[I+1]===68&&Z[I+2]===51&&Z[I+3]<255&&Z[I+4]<255&&Z[I+6]<128&&Z[I+7]<128&&Z[I+8]<128&&Z[I+9]<128},R=function(Z,I){return I+10<=Z.length&&Z[I]===51&&Z[I+1]===68&&Z[I+2]===73&&Z[I+3]<255&&Z[I+4]<255&&Z[I+6]<128&&Z[I+7]<128&&Z[I+8]<128&&Z[I+9]<128},b=function(Z,I){for(var q=I,N=0;M(Z,I);)N+=10,N+=P(Z,I+6),R(Z,I+10)&&(N+=10),I+=N;if(N>0)return Z.subarray(q,q+N)},P=function(Z,I){var q=0;return q=(127&Z[I])<<21,q|=(127&Z[I+1])<<14,(q|=(127&Z[I+2])<<7)|127&Z[I+3]},O=function(Z,I){return M(Z,I)&&P(Z,I+6)+10<=Z.length-I},ue=function(Z){for(var I=he(Z),q=0;q<I.length;q++){var N=I[q];if(Q(N))return z(N)}},Q=function(Z){return Z&&Z.key==="PRIV"&&Z.info==="com.apple.streaming.transportStreamTimestamp"},de=function(Z){var I=String.fromCharCode(Z[0],Z[1],Z[2],Z[3]),q=P(Z,4);return{type:I,size:q,data:Z.subarray(10,10+q)}},he=function(Z){for(var I=0,q=[];M(Z,I);){for(var N=P(Z,I+6),fe=(I+=10)+N;I+8<fe;){var _e=de(Z.subarray(I)),te=Y(_e);te&&q.push(te),I+=_e.size+10}R(Z,I)&&(I+=10)}return q},Y=function(Z){return Z.type==="PRIV"?pe(Z):Z.type[0]==="W"?oe(Z):X(Z)},pe=function(Z){if(!(Z.size<2)){var I=be(Z.data,!0),q=new Uint8Array(Z.data.subarray(I.length+1));return{key:Z.type,info:I,data:q.buffer}}},X=function(Z){if(!(Z.size<2)){if(Z.type==="TXXX"){var I=1,q=be(Z.data.subarray(I),!0);I+=q.length+1;var N=be(Z.data.subarray(I));return{key:Z.type,info:q,data:N}}var fe=be(Z.data.subarray(1));return{key:Z.type,data:fe}}},oe=function(Z){if(Z.type==="WXXX"){if(Z.size<2)return;var I=1,q=be(Z.data.subarray(I),!0);I+=q.length+1;var N=be(Z.data.subarray(I));return{key:Z.type,info:q,data:N}}var fe=be(Z.data);return{key:Z.type,data:fe}},z=function(Z){if(Z.data.byteLength===8){var I=new Uint8Array(Z.data),q=1&I[3],N=(I[4]<<23)+(I[5]<<15)+(I[6]<<7)+I[7];return N/=45,q&&(N+=4772185884e-2),Math.round(N)}},be=function(Z,I){I===void 0&&(I=!1);var q=He();if(q){var N=q.decode(Z);if(I){var fe=N.indexOf("\0");return fe!==-1?N.substring(0,fe):N}return N.replace(/\0/g,"")}for(var _e,te,ie,Re=Z.length,Pe="",Fe=0;Fe<Re;){if((_e=Z[Fe++])===0&&I)return Pe;if(_e!==0&&_e!==3)switch(_e>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:Pe+=String.fromCharCode(_e);break;case 12:case 13:te=Z[Fe++],Pe+=String.fromCharCode((31&_e)<<6|63&te);break;case 14:te=Z[Fe++],ie=Z[Fe++],Pe+=String.fromCharCode((15&_e)<<12|(63&te)<<6|(63&ie)<<0)}}return Pe},ke={decodeTextFrame:X};function He(){return L||self.TextDecoder===void 0||(L=new self.TextDecoder("utf-8")),L}},182:(v,g,E)=>{"use strict";E.r(g),E.d(g,{default:()=>O});var L=E(544),M=E(851),R=E(93),b=E(729),P=E(973);function O(he){var Y=new b.EventEmitter,pe=function(X,oe){he.postMessage({event:X,data:oe})};Y.on(M.Events.FRAG_DECRYPTED,pe),Y.on(M.Events.ERROR,pe),he.addEventListener("message",function(X){var oe=X.data;switch(oe.cmd){case"init":var z=JSON.parse(oe.config);he.transmuxer=new L.default(Y,oe.typeSupported,z,oe.vendor,oe.id),(0,R.enableLogs)(z.debug,oe.id),function(){var Z=function(q){R.logger[q]=function(N){pe("workerLog",{logType:q,message:N})}};for(var I in R.logger)Z(I)}(),pe("init",null);break;case"configure":he.transmuxer.configure(oe.config);break;case"demux":var be=he.transmuxer.push(oe.data,oe.decryptdata,oe.chunkMeta,oe.state);(0,L.isPromise)(be)?(he.transmuxer.async=!0,be.then(function(Z){ue(he,Z)}).catch(function(Z){pe(M.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:oe.chunkMeta,fatal:!1,error:Z,err:Z,reason:"transmuxer-worker push error"})})):(he.transmuxer.async=!1,ue(he,be));break;case"flush":var ke=oe.chunkMeta,He=he.transmuxer.flush(ke);(0,L.isPromise)(He)||he.transmuxer.async?((0,L.isPromise)(He)||(He=Promise.resolve(He)),He.then(function(Z){de(he,Z,ke)}).catch(function(Z){pe(M.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:oe.chunkMeta,fatal:!1,error:Z,err:Z,reason:"transmuxer-worker flush error"})})):de(he,He,ke)}})}function ue(he,Y){if(!((pe=Y.remuxResult).audio||pe.video||pe.text||pe.id3||pe.initSegment))return!1;var pe,X=[],oe=Y.remuxResult,z=oe.audio,be=oe.video;return z&&Q(X,z),be&&Q(X,be),he.postMessage({event:"transmuxComplete",data:Y},X),!0}function Q(he,Y){Y.data1&&he.push(Y.data1.buffer),Y.data2&&he.push(Y.data2.buffer)}function de(he,Y,pe){Y.reduce(function(X,oe){return ue(he,oe)||X},!1)||he.postMessage({event:"transmuxComplete",data:Y[0]}),he.postMessage({event:"flush",data:pe})}},544:(v,g,E)=>{"use strict";E.r(g),E.d(g,{TransmuxConfig:()=>Qt,TransmuxState:()=>Fi,default:()=>Vt,isPromise:()=>vi});var L=E(851),M=E(973),R=E(21),b=E(965),P=E(181),O=E(856);function ue(se,j){return se===void 0&&(se=""),j===void 0&&(j=9e4),{type:se,id:-1,pid:-1,inputTimeScale:j,sequenceNumber:-1,samples:[],dropped:0}}var Q=E(63),de=E(145),he=function(){function se(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var j=se.prototype;return j.resetInitSegment=function(w,G,H,$){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},j.resetTimeStamp=function(w){this.initPTS=w,this.resetContiguity()},j.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},j.canParse=function(w,G){return!1},j.appendFrame=function(w,G,H){},j.demux=function(w,G){this.cachedData&&(w=(0,Q.appendUint8Array)(this.cachedData,w),this.cachedData=null);var H,$=P.getID3Data(w,0),re=$?$.length:0,ae=this._audioTrack,Ae=this._id3Track,Ce=$?P.getTimeStamp($):void 0,Oe=w.length;for((this.basePTS===null||this.frameIndex===0&&(0,b.isFiniteNumber)(Ce))&&(this.basePTS=Y(Ce,G,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),$&&$.length>0&&Ae.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:$,type:O.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});re<Oe;){if(this.canParse(w,re)){var Ke=this.appendFrame(ae,w,re);Ke?(this.frameIndex++,this.lastPTS=Ke.sample.pts,H=re+=Ke.length):re=Oe}else P.canParse(w,re)?($=P.getID3Data(w,re),Ae.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:$,type:O.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY}),H=re+=$.length):re++;if(re===Oe&&H!==Oe){var Qe=(0,de.sliceUint8)(w,H);this.cachedData?this.cachedData=(0,Q.appendUint8Array)(this.cachedData,Qe):this.cachedData=Qe}}return{audioTrack:ae,videoTrack:ue(),id3Track:Ae,textTrack:ue()}},j.demuxSampleAes=function(w,G,H){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},j.flush=function(w){var G=this.cachedData;return G&&(this.cachedData=null,this.demux(G,0)),{audioTrack:this._audioTrack,videoTrack:ue(),id3Track:this._id3Track,textTrack:ue()}},j.destroy=function(){},se}(),Y=function(se,j,w){return(0,b.isFiniteNumber)(se)?90*se:9e4*j+(w||0)};let pe=he;var X=E(93);function oe(se,j){return se[j]===255&&(246&se[j+1])==240}function z(se,j){return 1&se[j+1]?7:9}function be(se,j){return(3&se[j+3])<<11|se[j+4]<<3|(224&se[j+5])>>>5}function ke(se,j){return j+1<se.length&&oe(se,j)}function He(se,j){if(ke(se,j)){var w=z(se,j);if(j+w>=se.length)return!1;var G=be(se,j);if(G<=w)return!1;var H=j+G;return H===se.length||ke(se,H)}return!1}function Z(se,j,w,G,H){if(!se.samplerate){var $=function(re,ae,Ae,Ce){var Oe,Ke,Qe,We,at=navigator.userAgent.toLowerCase(),Et=Ce,Ot=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Oe=1+((192&ae[Ae+2])>>>6);var Ze=(60&ae[Ae+2])>>>2;if(!(Ze>Ot.length-1))return Qe=(1&ae[Ae+2])<<2,Qe|=(192&ae[Ae+3])>>>6,X.logger.log("manifest codec:"+Ce+", ADTS type:"+Oe+", samplingIndex:"+Ze),/firefox/i.test(at)?Ze>=6?(Oe=5,We=new Array(4),Ke=Ze-3):(Oe=2,We=new Array(2),Ke=Ze):at.indexOf("android")!==-1?(Oe=2,We=new Array(2),Ke=Ze):(Oe=5,We=new Array(4),Ce&&(Ce.indexOf("mp4a.40.29")!==-1||Ce.indexOf("mp4a.40.5")!==-1)||!Ce&&Ze>=6?Ke=Ze-3:((Ce&&Ce.indexOf("mp4a.40.2")!==-1&&(Ze>=6&&Qe===1||/vivaldi/i.test(at))||!Ce&&Qe===1)&&(Oe=2,We=new Array(2)),Ke=Ze)),We[0]=Oe<<3,We[0]|=(14&Ze)>>1,We[1]|=(1&Ze)<<7,We[1]|=Qe<<3,Oe===5&&(We[1]|=(14&Ke)>>1,We[2]=(1&Ke)<<7,We[2]|=8,We[3]=0),{config:We,samplerate:Ot[Ze],channelCount:Qe,codec:"mp4a.40."+Oe,manifestCodec:Et};re.trigger(L.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+Ze})}(j,w,G,H);if(!$)return;se.config=$.config,se.samplerate=$.samplerate,se.channelCount=$.channelCount,se.codec=$.codec,se.manifestCodec=$.manifestCodec,X.logger.log("parsed codec:"+se.codec+", rate:"+$.samplerate+", channels:"+$.channelCount)}}function I(se){return 9216e4/se}function q(se,j,w,G,H){var $,re=G+H*I(se.samplerate),ae=function(at,Et){var Ot=z(at,Et);if(Et+Ot<=at.length){var Ze=be(at,Et)-Ot;if(Ze>0)return{headerLength:Ot,frameLength:Ze}}}(j,w);if(ae){var Ae=ae.frameLength,Ce=ae.headerLength,Oe=Ce+Ae,Ke=Math.max(0,w+Oe-j.length);Ke?($=new Uint8Array(Oe-Ce)).set(j.subarray(w+Ce,j.length),0):$=j.subarray(w+Ce,w+Oe);var Qe={unit:$,pts:re};return Ke||se.samples.push(Qe),{sample:Qe,length:Oe,missing:Ke}}var We=j.length-w;return($=new Uint8Array(We)).set(j.subarray(w,j.length),0),{sample:{unit:$,pts:re},length:We,missing:-1}}function N(se,j){return N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(w,G){return w.__proto__=G,w},N(se,j)}let fe=function(se){var j,w;function G($,re){var ae;return(ae=se.call(this)||this).observer=void 0,ae.config=void 0,ae.observer=$,ae.config=re,ae}w=se,(j=G).prototype=Object.create(w.prototype),j.prototype.constructor=j,N(j,w);var H=G.prototype;return H.resetInitSegment=function($,re,ae,Ae){se.prototype.resetInitSegment.call(this,$,re,ae,Ae),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:re,duration:Ae,inputTimeScale:9e4,dropped:0}},G.probe=function($){if(!$)return!1;for(var re=(P.getID3Data($,0)||[]).length,ae=$.length;re<ae;re++)if(He($,re))return X.logger.log("ADTS sync word found !"),!0;return!1},H.canParse=function($,re){return function(ae,Ae){return function(Ce,Oe){return Oe+5<Ce.length}(ae,Ae)&&oe(ae,Ae)&&be(ae,Ae)<=ae.length-Ae}($,re)},H.appendFrame=function($,re,ae){Z($,this.observer,re,ae,$.manifestCodec);var Ae=q($,re,ae,this.basePTS,this.frameIndex);if(Ae&&Ae.missing===0)return Ae},G}(pe);var _e=/\/emsg[-/]ID3/i;let te=function(){function se(w,G){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=G}var j=se.prototype;return j.resetTimeStamp=function(){},j.resetInitSegment=function(w,G,H,$){var re=this.videoTrack=ue("video",1),ae=this.audioTrack=ue("audio",1),Ae=this.txtTrack=ue("text",1);if(this.id3Track=ue("id3",1),this.timeOffset=0,w&&w.byteLength){var Ce=(0,Q.parseInitSegment)(w);if(Ce.video){var Oe=Ce.video,Ke=Oe.id,Qe=Oe.timescale,We=Oe.codec;re.id=Ke,re.timescale=Ae.timescale=Qe,re.codec=We}if(Ce.audio){var at=Ce.audio,Et=at.id,Ot=at.timescale,Ze=at.codec;ae.id=Et,ae.timescale=Ot,ae.codec=Ze}Ae.id=Q.RemuxerTrackIdConfig.text,re.sampleDuration=0,re.duration=ae.duration=$}},j.resetContiguity=function(){},se.probe=function(w){return w=w.length>16384?w.subarray(0,16384):w,(0,Q.findBox)(w,["moof"]).length>0},j.demux=function(w,G){this.timeOffset=G;var H=w,$=this.videoTrack,re=this.txtTrack;if(this.config.progressive){this.remainderData&&(H=(0,Q.appendUint8Array)(this.remainderData,w));var ae=(0,Q.segmentValidRange)(H);this.remainderData=ae.remainder,$.samples=ae.valid||new Uint8Array}else $.samples=H;var Ae=this.extractID3Track($,G);return re.samples=(0,Q.parseSamples)(G,$),{videoTrack:$,audioTrack:this.audioTrack,id3Track:Ae,textTrack:this.txtTrack}},j.flush=function(){var w=this.timeOffset,G=this.videoTrack,H=this.txtTrack;G.samples=this.remainderData||new Uint8Array,this.remainderData=null;var $=this.extractID3Track(G,this.timeOffset);return H.samples=(0,Q.parseSamples)(w,G),{videoTrack:G,audioTrack:ue(),id3Track:$,textTrack:ue()}},j.extractID3Track=function(w,G){var H=this.id3Track;if(w.samples.length){var $=(0,Q.findBox)(w.samples,["emsg"]);$&&$.forEach(function(re){var ae=(0,Q.parseEmsg)(re);if(_e.test(ae.schemeIdUri)){var Ae=(0,b.isFiniteNumber)(ae.presentationTime)?ae.presentationTime/ae.timeScale:G+ae.presentationTimeDelta/ae.timeScale,Ce=ae.eventDuration===4294967295?Number.POSITIVE_INFINITY:ae.eventDuration/ae.timeScale;Ce<=.001&&(Ce=Number.POSITIVE_INFINITY);var Oe=ae.payload;H.samples.push({data:Oe,len:Oe.byteLength,dts:Ae,pts:Ae,type:O.MetadataSchema.emsg,duration:Ce})}})}return H},j.demuxSampleAes=function(w,G,H){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},j.destroy=function(){},se}();var ie=null,Re=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Pe=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Fe=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Se=[0,1,1,4];function Ye(se,j,w,G,H){if(!(w+24>j.length)){var $=ot(j,w);if($&&w+$.frameLength<=j.length){var re=G+H*(9e4*$.samplesPerFrame/$.sampleRate),ae={unit:j.subarray(w,w+$.frameLength),pts:re,dts:re};return se.config=[],se.channelCount=$.channelCount,se.samplerate=$.sampleRate,se.samples.push(ae),{sample:ae,length:$.frameLength,missing:0}}}}function ot(se,j){var w=se[j+1]>>3&3,G=se[j+1]>>1&3,H=se[j+2]>>4&15,$=se[j+2]>>2&3;if(w!==1&&H!==0&&H!==15&&$!==3){var re=se[j+2]>>1&1,ae=se[j+3]>>6,Ae=1e3*Re[14*(w===3?3-G:G===3?3:4)+H-1],Ce=Pe[3*(w===3?0:w===2?1:2)+$],Oe=ae===3?1:2,Ke=Fe[w][G],Qe=Se[G],We=8*Ke*Qe,at=Math.floor(Ke*Ae/Ce+re)*Qe;if(ie===null){var Et=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ie=Et?parseInt(Et[1]):0}return!!ie&&ie<=87&&G===2&&Ae>=224e3&&ae===0&&(se[j+3]=128|se[j+3]),{sampleRate:Ce,channelCount:Oe,frameLength:at,samplesPerFrame:We}}}function le(se,j){return se[j]===255&&(224&se[j+1])==224&&(6&se[j+1])!=0}function Ee(se,j){return j+1<se.length&&le(se,j)}function U(se,j){if(j+1<se.length&&le(se,j)){var w=ot(se,j),G=4;w!=null&&w.frameLength&&(G=w.frameLength);var H=j+G;return H===se.length||Ee(se,H)}return!1}let ve=function(){function se(w){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=w,this.bytesAvailable=w.byteLength,this.word=0,this.bitsAvailable=0}var j=se.prototype;return j.loadWord=function(){var w=this.data,G=this.bytesAvailable,H=w.byteLength-G,$=new Uint8Array(4),re=Math.min(4,G);if(re===0)throw new Error("no bytes available");$.set(w.subarray(H,H+re)),this.word=new DataView($.buffer).getUint32(0),this.bitsAvailable=8*re,this.bytesAvailable-=re},j.skipBits=function(w){var G;w=Math.min(w,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>w?(this.word<<=w,this.bitsAvailable-=w):(w-=this.bitsAvailable,w-=(G=w>>3)<<3,this.bytesAvailable-=G,this.loadWord(),this.word<<=w,this.bitsAvailable-=w)},j.readBits=function(w){var G=Math.min(this.bitsAvailable,w),H=this.word>>>32-G;if(w>32&&X.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=G,this.bitsAvailable>0)this.word<<=G;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(G=w-G)>0&&this.bitsAvailable?H<<G|this.readBits(G):H},j.skipLZ=function(){var w;for(w=0;w<this.bitsAvailable;++w)if((this.word&2147483648>>>w)!=0)return this.word<<=w,this.bitsAvailable-=w,w;return this.loadWord(),w+this.skipLZ()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var w=this.skipLZ();return this.readBits(w+1)-1},j.readEG=function(){var w=this.readUEG();return 1&w?1+w>>>1:-1*(w>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(w){for(var G=8,H=8,$=0;$<w;$++)H!==0&&(H=(G+this.readEG()+256)%256),G=H===0?G:H},j.readSPS=function(){var w,G,H,$=0,re=0,ae=0,Ae=0,Ce=this.readUByte.bind(this),Oe=this.readBits.bind(this),Ke=this.readUEG.bind(this),Qe=this.readBoolean.bind(this),We=this.skipBits.bind(this),at=this.skipEG.bind(this),Et=this.skipUEG.bind(this),Ot=this.skipScalingList.bind(this);Ce();var Ze=Ce();if(Oe(5),We(3),Ce(),Et(),Ze===100||Ze===110||Ze===122||Ze===244||Ze===44||Ze===83||Ze===86||Ze===118||Ze===128){var Ht=Ke();if(Ht===3&&We(1),Et(),Et(),We(1),Qe())for(G=Ht!==3?8:12,H=0;H<G;H++)Qe()&&Ot(H<6?16:64)}Et();var gi=Ke();if(gi===0)Ke();else if(gi===1)for(We(1),at(),at(),w=Ke(),H=0;H<w;H++)at();Et(),We(1);var Yt=Ke(),jt=Ke(),Xt=Oe(1);Xt===0&&We(1),We(1),Qe()&&($=Ke(),re=Ke(),ae=Ke(),Ae=Ke());var ut=[1,1];if(Qe()&&Qe())switch(Ce()){case 1:ut=[1,1];break;case 2:ut=[12,11];break;case 3:ut=[10,11];break;case 4:ut=[16,11];break;case 5:ut=[40,33];break;case 6:ut=[24,11];break;case 7:ut=[20,11];break;case 8:ut=[32,11];break;case 9:ut=[80,33];break;case 10:ut=[18,11];break;case 11:ut=[15,11];break;case 12:ut=[64,33];break;case 13:ut=[160,99];break;case 14:ut=[4,3];break;case 15:ut=[3,2];break;case 16:ut=[2,1];break;case 255:ut=[Ce()<<8|Ce(),Ce()<<8|Ce()]}return{width:Math.ceil(16*(Yt+1)-2*$-2*re),height:(2-Xt)*(jt+1)*16-(Xt?2:4)*(ae+Ae),pixelRatio:ut}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},se}(),Le=function(){function se(w,G,H){this.keyData=void 0,this.decrypter=void 0,this.keyData=H,this.decrypter=new R.default(G,{removePKCS7Padding:!1})}var j=se.prototype;return j.decryptBuffer=function(w){return this.decrypter.decrypt(w,this.keyData.key.buffer,this.keyData.iv.buffer)},j.decryptAacSample=function(w,G,H){var $=this,re=w[G].unit;if(!(re.length<=16)){var ae=re.subarray(16,re.length-re.length%16),Ae=ae.buffer.slice(ae.byteOffset,ae.byteOffset+ae.length);this.decryptBuffer(Ae).then(function(Ce){var Oe=new Uint8Array(Ce);re.set(Oe,16),$.decrypter.isSync()||$.decryptAacSamples(w,G+1,H)})}},j.decryptAacSamples=function(w,G,H){for(;;G++){if(G>=w.length)return void H();if(!(w[G].unit.length<32||(this.decryptAacSample(w,G,H),this.decrypter.isSync())))return}},j.getAvcEncryptedData=function(w){for(var G=16*Math.floor((w.length-48)/160)+16,H=new Int8Array(G),$=0,re=32;re<w.length-16;re+=160,$+=16)H.set(w.subarray(re,re+16),$);return H},j.getAvcDecryptedUnit=function(w,G){for(var H=new Uint8Array(G),$=0,re=32;re<w.length-16;re+=160,$+=16)w.set(H.subarray($,$+16),re);return w},j.decryptAvcSample=function(w,G,H,$,re){var ae=this,Ae=(0,Q.discardEPB)(re.data),Ce=this.getAvcEncryptedData(Ae);this.decryptBuffer(Ce.buffer).then(function(Oe){re.data=ae.getAvcDecryptedUnit(Ae,Oe),ae.decrypter.isSync()||ae.decryptAvcSamples(w,G,H+1,$)})},j.decryptAvcSamples=function(w,G,H,$){if(w instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;G++,H=0){if(G>=w.length)return void $();for(var re=w[G].units;!(H>=re.length);H++){var ae=re[H];if(!(ae.data.length<=48||ae.type!==1&&ae.type!==5||(this.decryptAvcSample(w,G,H,$,ae),this.decrypter.isSync())))return}}},se}();function Ne(){return Ne=Object.assign?Object.assign.bind():function(se){for(var j=1;j<arguments.length;j++){var w=arguments[j];for(var G in w)Object.prototype.hasOwnProperty.call(w,G)&&(se[G]=w[G])}return se},Ne.apply(this,arguments)}var Ue=188;function Ge(se,j,w,G){return{key:se,frame:!1,pts:j,dts:w,units:[],debug:G,length:0}}function Te(se,j){return(31&se[j+10])<<8|se[j+11]}function xe(se,j,w,G){var H={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},$=j+3+((15&se[j+1])<<8|se[j+2])-4;for(j+=12+((15&se[j+10])<<8|se[j+11]);j<$;){var re=(31&se[j+1])<<8|se[j+2];switch(se[j]){case 207:if(!G){X.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:H.audio===-1&&(H.audio=re);break;case 21:H.id3===-1&&(H.id3=re);break;case 219:if(!G){X.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:H.avc===-1&&(H.avc=re);break;case 3:case 4:w.mpeg!==!0&&w.mp3!==!0?X.logger.log("MPEG audio found, not supported in this browser"):H.audio===-1&&(H.audio=re,H.segmentCodec="mp3");break;case 36:X.logger.warn("Unsupported HEVC stream type found")}j+=5+((15&se[j+3])<<8|se[j+4])}return H}function ze(se){var j,w,G,H,$,re=0,ae=se.data;if(!se||se.size===0)return null;for(;ae[0].length<19&&ae.length>1;){var Ae=new Uint8Array(ae[0].length+ae[1].length);Ae.set(ae[0]),Ae.set(ae[1],ae[0].length),ae[0]=Ae,ae.splice(1,1)}if(((j=ae[0])[0]<<16)+(j[1]<<8)+j[2]===1){if((w=(j[4]<<8)+j[5])&&w>se.size-6)return null;var Ce=j[7];192&Ce&&(H=536870912*(14&j[9])+4194304*(255&j[10])+16384*(254&j[11])+128*(255&j[12])+(254&j[13])/2,64&Ce?H-($=536870912*(14&j[14])+4194304*(255&j[15])+16384*(254&j[16])+128*(255&j[17])+(254&j[18])/2)>54e5&&(X.logger.warn(Math.round((H-$)/9e4)+"s delta between PTS and DTS, align them"),H=$):$=H);var Oe=(G=j[8])+9;if(se.size<=Oe)return null;se.size-=Oe;for(var Ke=new Uint8Array(se.size),Qe=0,We=ae.length;Qe<We;Qe++){var at=(j=ae[Qe]).byteLength;if(Oe){if(Oe>at){Oe-=at;continue}j=j.subarray(Oe),at-=Oe,Oe=0}Ke.set(j,re),re+=at}return w&&(w-=G+3),{data:Ke,pts:H,dts:$,len:w}}return null}function it(se,j){if(se.units.length&&se.frame){if(se.pts===void 0){var w=j.samples,G=w.length;if(!G)return void j.dropped++;var H=w[G-1];se.pts=H.pts,se.dts=H.dts}j.samples.push(se)}se.debug.length&&X.logger.log(se.pts+"/"+se.dts+":"+se.debug)}let _t=function(){function se(w,G,H){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=w,this.config=G,this.typeSupported=H}se.probe=function(w){var G=se.syncOffset(w);return G>0&&X.logger.warn("MPEG2-TS detected but first sync word found @ offset "+G),G!==-1},se.syncOffset=function(w){for(var G=Math.min(940,w.length-376)+1,H=0;H<G;){if(w[H]===71&&w[H+Ue]===71)return H;H++}return-1},se.createTrack=function(w,G){return{container:w==="video"||w==="audio"?"video/mp2t":void 0,type:w,id:Q.RemuxerTrackIdConfig[w],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:w==="audio"?G:void 0}};var j=se.prototype;return j.resetInitSegment=function(w,G,H,$){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=se.createTrack("video"),this._audioTrack=se.createTrack("audio",$),this._id3Track=se.createTrack("id3"),this._txtTrack=se.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=G,this.videoCodec=H,this._duration=$},j.resetTimeStamp=function(){},j.resetContiguity=function(){var w=this._audioTrack,G=this._avcTrack,H=this._id3Track;w&&(w.pesData=null),G&&(G.pesData=null),H&&(H.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},j.demux=function(w,G,H,$){var re;H===void 0&&(H=!1),$===void 0&&($=!1),H||(this.sampleAes=null);var ae=this._avcTrack,Ae=this._audioTrack,Ce=this._id3Track,Oe=this._txtTrack,Ke=ae.pid,Qe=ae.pesData,We=Ae.pid,at=Ce.pid,Et=Ae.pesData,Ot=Ce.pesData,Ze=null,Ht=this.pmtParsed,gi=this._pmtId,Yt=w.length;if(this.remainderData&&(Yt=(w=(0,Q.appendUint8Array)(this.remainderData,w)).length,this.remainderData=null),Yt<Ue&&!$)return this.remainderData=w,{audioTrack:Ae,videoTrack:ae,id3Track:Ce,textTrack:Oe};var jt=Math.max(0,se.syncOffset(w));(Yt-=(Yt-jt)%Ue)<w.byteLength&&!$&&(this.remainderData=new Uint8Array(w.buffer,Yt,w.buffer.byteLength-Yt));for(var Xt=0,ut=jt;ut<Yt;ut+=Ue)if(w[ut]===71){var Li=!!(64&w[ut+1]),tr=((31&w[ut+1])<<8)+w[ut+2],zt=void 0;if((48&w[ut+3])>>4>1){if((zt=ut+5+w[ut+4])===ut+Ue)continue}else zt=ut+4;switch(tr){case Ke:Li&&(Qe&&(re=ze(Qe))&&this.parseAVCPES(ae,Oe,re,!1),Qe={data:[],size:0}),Qe&&(Qe.data.push(w.subarray(zt,ut+Ue)),Qe.size+=ut+Ue-zt);break;case We:if(Li){if(Et&&(re=ze(Et)))switch(Ae.segmentCodec){case"aac":this.parseAACPES(Ae,re);break;case"mp3":this.parseMPEGPES(Ae,re)}Et={data:[],size:0}}Et&&(Et.data.push(w.subarray(zt,ut+Ue)),Et.size+=ut+Ue-zt);break;case at:Li&&(Ot&&(re=ze(Ot))&&this.parseID3PES(Ce,re),Ot={data:[],size:0}),Ot&&(Ot.data.push(w.subarray(zt,ut+Ue)),Ot.size+=ut+Ue-zt);break;case 0:Li&&(zt+=w[zt]+1),gi=this._pmtId=Te(w,zt);break;case gi:Li&&(zt+=w[zt]+1);var di=xe(w,zt,this.typeSupported,H);(Ke=di.avc)>0&&(ae.pid=Ke),(We=di.audio)>0&&(Ae.pid=We,Ae.segmentCodec=di.segmentCodec),(at=di.id3)>0&&(Ce.pid=at),Ze===null||Ht||(X.logger.log("unknown PID '"+Ze+"' in TS found"),Ze=null,ut=jt-188),Ht=this.pmtParsed=!0;break;case 17:case 8191:break;default:Ze=tr}}else Xt++;Xt>0&&this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+Xt+" TS packet/s that do not start with 0x47"}),ae.pesData=Qe,Ae.pesData=Et,Ce.pesData=Ot;var Vi={audioTrack:Ae,videoTrack:ae,id3Track:Ce,textTrack:Oe};return $&&this.extractRemainingSamples(Vi),Vi},j.flush=function(){var w,G=this.remainderData;return this.remainderData=null,w=G?this.demux(G,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(w),this.sampleAes?this.decrypt(w,this.sampleAes):w},j.extractRemainingSamples=function(w){var G,H=w.audioTrack,$=w.videoTrack,re=w.id3Track,ae=w.textTrack,Ae=$.pesData,Ce=H.pesData,Oe=re.pesData;if(Ae&&(G=ze(Ae))?(this.parseAVCPES($,ae,G,!0),$.pesData=null):$.pesData=Ae,Ce&&(G=ze(Ce))){switch(H.segmentCodec){case"aac":this.parseAACPES(H,G);break;case"mp3":this.parseMPEGPES(H,G)}H.pesData=null}else Ce!=null&&Ce.size&&X.logger.log("last AAC PES packet truncated,might overlap between fragments"),H.pesData=Ce;Oe&&(G=ze(Oe))?(this.parseID3PES(re,G),re.pesData=null):re.pesData=Oe},j.demuxSampleAes=function(w,G,H){var $=this.demux(w,H,!0,!this.config.progressive),re=this.sampleAes=new Le(this.observer,this.config,G);return this.decrypt($,re)},j.decrypt=function(w,G){return new Promise(function(H){var $=w.audioTrack,re=w.videoTrack;$.samples&&$.segmentCodec==="aac"?G.decryptAacSamples($.samples,0,function(){re.samples?G.decryptAvcSamples(re.samples,0,0,function(){H(w)}):H(w)}):re.samples&&G.decryptAvcSamples(re.samples,0,0,function(){H(w)})})},j.destroy=function(){this._duration=0},j.parseAVCPES=function(w,G,H,$){var re,ae=this,Ae=this.parseAVCNALu(w,H.data),Ce=this.avcSample,Oe=!1;H.data=null,Ce&&Ae.length&&!w.audFound&&(it(Ce,w),Ce=this.avcSample=Ge(!1,H.pts,H.dts,"")),Ae.forEach(function(Ke){switch(Ke.type){case 1:re=!0,Ce||(Ce=ae.avcSample=Ge(!0,H.pts,H.dts,"")),Ce.frame=!0;var Qe=Ke.data;if(Oe&&Qe.length>4){var We=new ve(Qe).readSliceType();We!==2&&We!==4&&We!==7&&We!==9||(Ce.key=!0)}break;case 5:re=!0,Ce||(Ce=ae.avcSample=Ge(!0,H.pts,H.dts,"")),Ce.key=!0,Ce.frame=!0;break;case 6:re=!0,(0,Q.parseSEIMessageFromNALu)(Ke.data,1,H.pts,G.samples);break;case 7:if(re=!0,Oe=!0,!w.sps){var at=new ve(Ke.data).readSPS();w.width=at.width,w.height=at.height,w.pixelRatio=at.pixelRatio,w.sps=[Ke.data],w.duration=ae._duration;for(var Et=Ke.data.subarray(1,4),Ot="avc1.",Ze=0;Ze<3;Ze++){var Ht=Et[Ze].toString(16);Ht.length<2&&(Ht="0"+Ht),Ot+=Ht}w.codec=Ot}break;case 8:re=!0,w.pps||(w.pps=[Ke.data]);break;case 9:re=!1,w.audFound=!0,Ce&&it(Ce,w),Ce=ae.avcSample=Ge(!1,H.pts,H.dts,"");break;case 12:re=!0;break;default:re=!1,Ce&&(Ce.debug+="unknown NAL "+Ke.type+" ")}Ce&&re&&Ce.units.push(Ke)}),$&&Ce&&(it(Ce,w),this.avcSample=null)},j.getLastNalUnit=function(w){var G,H,$=this.avcSample;if($&&$.units.length!==0||($=w[w.length-1]),(G=$)!==null&&G!==void 0&&G.units){var re=$.units;H=re[re.length-1]}return H},j.parseAVCNALu=function(w,G){var H,$,re=G.byteLength,ae=w.naluState||0,Ae=ae,Ce=[],Oe=0,Ke=-1,Qe=0;for(ae===-1&&(Ke=0,Qe=31&G[0],ae=0,Oe=1);Oe<re;)if(H=G[Oe++],ae)if(ae!==1)if(H)if(H===1){if(Ke>=0){var We={data:G.subarray(Ke,Oe-ae-1),type:Qe};Ce.push(We)}else{var at=this.getLastNalUnit(w.samples);if(at&&(Ae&&Oe<=4-Ae&&at.state&&(at.data=at.data.subarray(0,at.data.byteLength-Ae)),($=Oe-ae-1)>0)){var Et=new Uint8Array(at.data.byteLength+$);Et.set(at.data,0),Et.set(G.subarray(0,$),at.data.byteLength),at.data=Et,at.state=0}}Oe<re?(Ke=Oe,Qe=31&G[Oe],ae=0):ae=-1}else ae=0;else ae=3;else ae=H?0:2;else ae=H?0:1;if(Ke>=0&&ae>=0){var Ot={data:G.subarray(Ke,re),type:Qe,state:ae};Ce.push(Ot)}if(Ce.length===0){var Ze=this.getLastNalUnit(w.samples);if(Ze){var Ht=new Uint8Array(Ze.data.byteLength+G.byteLength);Ht.set(Ze.data,0),Ht.set(G,Ze.data.byteLength),Ze.data=Ht}}return w.naluState=ae,Ce},j.parseAACPES=function(w,G){var H,$,re,ae,Ae,Ce=0,Oe=this.aacOverFlow,Ke=G.data;if(Oe){this.aacOverFlow=null;var Qe=Oe.missing,We=Oe.sample.unit.byteLength;if(Qe===-1){var at=new Uint8Array(We+Ke.byteLength);at.set(Oe.sample.unit,0),at.set(Ke,We),Ke=at}else{var Et=We-Qe;Oe.sample.unit.set(Ke.subarray(0,Qe),Et),w.samples.push(Oe.sample),Ce=Oe.missing}}for(H=Ce,$=Ke.length;H<$-1&&!ke(Ke,H);H++);if(H===Ce||(H<$-1?(re="AAC PES did not start with ADTS header,offset:"+H,ae=!1):(re="no ADTS header found in AAC PES",ae=!0),X.logger.warn("parsing error:"+re),this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:ae,reason:re}),!ae)){if(Z(w,this.observer,Ke,H,this.audioCodec),G.pts!==void 0)Ae=G.pts;else{if(!Oe)return void X.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var Ot=I(w.samplerate);Ae=Oe.sample.pts+Ot}for(var Ze,Ht=0;H<$;){if(H+=(Ze=q(w,Ke,H,Ae,Ht)).length,Ze.missing){this.aacOverFlow=Ze;break}for(Ht++;H<$-1&&!ke(Ke,H);H++);}}},j.parseMPEGPES=function(w,G){var H=G.data,$=H.length,re=0,ae=0,Ae=G.pts;if(Ae!==void 0)for(;ae<$;)if(Ee(H,ae)){var Ce=Ye(w,H,ae,Ae,re);if(!Ce)break;ae+=Ce.length,re++}else ae++;else X.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},j.parseID3PES=function(w,G){if(G.pts!==void 0){var H=Ne({},G,{type:this._avcTrack?O.MetadataSchema.emsg:O.MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});w.samples.push(H)}else X.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},se}();function gt(se,j){return gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(w,G){return w.__proto__=G,w},gt(se,j)}let Lt=function(se){var j,w;function G(){return se.apply(this,arguments)||this}w=se,(j=G).prototype=Object.create(w.prototype),j.prototype.constructor=j,gt(j,w);var H=G.prototype;return H.resetInitSegment=function($,re,ae,Ae){se.prototype.resetInitSegment.call(this,$,re,ae,Ae),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:re,duration:Ae,inputTimeScale:9e4,dropped:0}},G.probe=function($){if(!$)return!1;for(var re=(P.getID3Data($,0)||[]).length,ae=$.length;re<ae;re++)if(U($,re))return X.logger.log("MPEG Audio sync word found !"),!0;return!1},H.canParse=function($,re){return function(ae,Ae){return le(ae,Ae)&&4<=ae.length-Ae}($,re)},H.appendFrame=function($,re,ae){if(this.basePTS!==null)return Ye($,re,ae,this.basePTS,this.frameIndex)},G}(pe);var lt=E(524),It=E(923);function Rt(se,j){var w=se==null?void 0:se.codec;return w&&w.length>4?w:w==="hvc1"||w==="hev1"?"hvc1.1.c.L120.90":w==="av01"?"av01.0.04M.08":w==="avc1"||j===It.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}let At=function(){function se(){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 j=se.prototype;return j.destroy=function(){},j.resetTimeStamp=function(w){this.initPTS=w,this.lastEndTime=null},j.resetNextTimestamp=function(){this.lastEndTime=null},j.resetInitSegment=function(w,G,H,$){this.audioCodec=G,this.videoCodec=H,this.generateInitSegment((0,Q.patchEncyptionData)(w,$)),this.emitInitSegment=!0},j.generateInitSegment=function(w){var G=this.audioCodec,H=this.videoCodec;if(!w||!w.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var $=this.initData=(0,Q.parseInitSegment)(w);G||(G=Rt($.audio,It.ElementaryStreamTypes.AUDIO)),H||(H=Rt($.video,It.ElementaryStreamTypes.VIDEO));var re={};$.audio&&$.video?re.audiovideo={container:"video/mp4",codec:G+","+H,initSegment:w,id:"main"}:$.audio?re.audio={container:"audio/mp4",codec:G,initSegment:w,id:"audio"}:$.video?re.video={container:"video/mp4",codec:H,initSegment:w,id:"main"}:X.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=re},j.remux=function(w,G,H,$,re){var ae,Ae=this.initPTS,Ce=this.lastEndTime,Oe={audio:void 0,video:void 0,text:$,id3:H,initSegment:void 0};(0,b.isFiniteNumber)(Ce)||(Ce=this.lastEndTime=re||0);var Ke=G.samples;if(!Ke||!Ke.length)return Oe;var Qe={initPTS:void 0,timescale:1},We=this.initData;if(We&&We.length||(this.generateInitSegment(Ke),We=this.initData),!We||!We.length)return X.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),Oe;this.emitInitSegment&&(Qe.tracks=this.initTracks,this.emitInitSegment=!1);var at=(0,Q.getStartDTS)(We,Ke);(0,b.isFiniteNumber)(Ae)||(this.initPTS=Qe.initPTS=Ae=at-re);var Et=(0,Q.getDuration)(Ke,We),Ot=w?at-Ae:Ce,Ze=Ot+Et;(0,Q.offsetStartDTS)(We,Ke,Ae),Et>0?this.lastEndTime=Ze:(X.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var Ht=!!We.audio,gi=!!We.video,Yt="";Ht&&(Yt+="audio"),gi&&(Yt+="video");var jt={data1:Ke,startPTS:Ot,startDTS:Ot,endPTS:Ze,endDTS:Ze,type:Yt,hasAudio:Ht,hasVideo:gi,nb:1,dropped:0};Oe.audio=jt.type==="audio"?jt:void 0,Oe.video=jt.type!=="audio"?jt:void 0,Oe.initSegment=Qe;var Xt=(ae=this.initPTS)!=null?ae:0;return Oe.id3=(0,lt.flushTextTrackMetadataCueSamples)(H,re,Xt,Xt),$.samples.length&&(Oe.text=(0,lt.flushTextTrackUserdataCueSamples)($,re,Xt)),Oe},se}();var pt;try{pt=self.performance.now.bind(self.performance)}catch{X.logger.debug("Unable to use Performance API on this environment"),pt=self.Date.now}var Ut=[{demux:te,remux:At},{demux:_t,remux:lt.default},{demux:fe,remux:lt.default},{demux:Lt,remux:lt.default}],Vt=function(){function se(w,G,H,$,re){this.async=!1,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=w,this.typeSupported=G,this.config=H,this.vendor=$,this.id=re}var j=se.prototype;return j.configure=function(w){this.transmuxConfig=w,this.decrypter&&this.decrypter.reset()},j.push=function(w,G,H,$){var re=this,ae=H.transmuxing;ae.executeStart=pt();var Ae=new Uint8Array(w),Ce=this.currentTransmuxState,Oe=this.transmuxConfig;$&&(this.currentTransmuxState=$);var Ke=$||Ce,Qe=Ke.contiguous,We=Ke.discontinuity,at=Ke.trackSwitch,Et=Ke.accurateTimeOffset,Ot=Ke.timeOffset,Ze=Ke.initSegmentChange,Ht=Oe.audioCodec,gi=Oe.videoCodec,Yt=Oe.defaultInitPts,jt=Oe.duration,Xt=Oe.initSegmentData,ut=function(gr,Bi){var $t=null;return gr.byteLength>0&&Bi!=null&&Bi.key!=null&&Bi.iv!==null&&Bi.method!=null&&($t=Bi),$t}(Ae,G);if(ut&&ut.method==="AES-128"){var Li=this.getDecrypter();if(!Li.isSync())return this.decryptionPromise=Li.webCryptoDecrypt(Ae,ut.key.buffer,ut.iv.buffer).then(function(gr){var Bi=re.push(gr,null,H);return re.decryptionPromise=null,Bi}),this.decryptionPromise;var tr=Li.softwareDecrypt(Ae,ut.key.buffer,ut.iv.buffer);if(!tr)return ae.executeEnd=pt(),ri(H);Ae=new Uint8Array(tr)}var zt=this.needsProbing(We,at);zt&&this.configureTransmuxer(Ae),(We||at||Ze||zt)&&this.resetInitSegment(Xt,Ht,gi,jt,G),(We||Ze||zt)&&this.resetInitialTimestamp(Yt),Qe||this.resetContiguity();var di=this.transmux(Ae,ut,Ot,Et,H),Vi=this.currentTransmuxState;return Vi.contiguous=!0,Vi.discontinuity=!1,Vi.trackSwitch=!1,ae.executeEnd=pt(),di},j.flush=function(w){var G=this,H=w.transmuxing;H.executeStart=pt();var $=this.decrypter,re=this.currentTransmuxState,ae=this.decryptionPromise;if(ae)return ae.then(function(){return G.flush(w)});var Ae=[],Ce=re.timeOffset;if($){var Oe=$.flush();Oe&&Ae.push(this.push(Oe,null,w))}var Ke=this.demuxer,Qe=this.remuxer;if(!Ke||!Qe)return this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),H.executeEnd=pt(),[ri(w)];var We=Ke.flush(Ce);return vi(We)?We.then(function(at){return G.flushRemux(Ae,at,w),Ae}):(this.flushRemux(Ae,We,w),Ae)},j.flushRemux=function(w,G,H){var $=G.audioTrack,re=G.videoTrack,ae=G.id3Track,Ae=G.textTrack,Ce=this.currentTransmuxState,Oe=Ce.accurateTimeOffset,Ke=Ce.timeOffset;X.logger.log("[transmuxer.ts]: Flushed fragment "+H.sn+(H.part>-1?" p: "+H.part:"")+" of level "+H.level);var Qe=this.remuxer.remux($,re,ae,Ae,Ke,Oe,!0,this.id);w.push({remuxResult:Qe,chunkMeta:H}),H.transmuxing.executeEnd=pt()},j.resetInitialTimestamp=function(w){var G=this.demuxer,H=this.remuxer;G&&H&&(G.resetTimeStamp(w),H.resetTimeStamp(w))},j.resetContiguity=function(){var w=this.demuxer,G=this.remuxer;w&&G&&(w.resetContiguity(),G.resetNextTimestamp())},j.resetInitSegment=function(w,G,H,$,re){var ae=this.demuxer,Ae=this.remuxer;ae&&Ae&&(ae.resetInitSegment(w,G,H,$),Ae.resetInitSegment(w,G,H,re))},j.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},j.transmux=function(w,G,H,$,re){return G&&G.method==="SAMPLE-AES"?this.transmuxSampleAes(w,G,H,$,re):this.transmuxUnencrypted(w,H,$,re)},j.transmuxUnencrypted=function(w,G,H,$){var re=this.demuxer.demux(w,G,!1,!this.config.progressive),ae=re.audioTrack,Ae=re.videoTrack,Ce=re.id3Track,Oe=re.textTrack;return{remuxResult:this.remuxer.remux(ae,Ae,Ce,Oe,G,H,!1,this.id),chunkMeta:$}},j.transmuxSampleAes=function(w,G,H,$,re){var ae=this;return this.demuxer.demuxSampleAes(w,G,H).then(function(Ae){return{remuxResult:ae.remuxer.remux(Ae.audioTrack,Ae.videoTrack,Ae.id3Track,Ae.textTrack,H,$,!1,ae.id),chunkMeta:re}})},j.configureTransmuxer=function(w){for(var G,H=this.config,$=this.observer,re=this.typeSupported,ae=this.vendor,Ae=0,Ce=Ut.length;Ae<Ce;Ae++)if(Ut[Ae].demux.probe(w)){G=Ut[Ae];break}G||(X.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),G={demux:te,remux:At});var Oe=this.demuxer,Ke=this.remuxer,Qe=G.remux,We=G.demux;Ke&&Ke instanceof Qe||(this.remuxer=new Qe($,H,re,ae)),Oe&&Oe instanceof We||(this.demuxer=new We($,H,re),this.probe=We.probe)},j.needsProbing=function(w,G){return!this.demuxer||!this.remuxer||w||G},j.getDecrypter=function(){var w=this.decrypter;return w||(w=this.decrypter=new R.default(this.config)),w},se}(),ri=function(se){return{remuxResult:{},chunkMeta:se}};function vi(se){return"then"in se&&se.then instanceof Function}var Qt=function(se,j,w,G,H){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=se,this.videoCodec=j,this.initSegmentData=w,this.duration=G,this.defaultInitPts=H},Fi=function(se,j,w,G,H,$){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=se,this.contiguous=j,this.accurateTimeOffset=w,this.trackSwitch=G,this.timeOffset=H,this.initSegmentChange=$}},973:(v,g,E)=>{"use strict";var L,M;E.r(g),E.d(g,{ErrorDetails:()=>M,ErrorTypes:()=>L}),function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"}(L||(L={})),function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",R.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",R.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",R.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",R.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"}(M||(M={}))},851:(v,g,E)=>{"use strict";var L;E.r(g),E.d(g,{Events:()=>L}),function(M){M.MEDIA_ATTACHING="hlsMediaAttaching",M.MEDIA_ATTACHED="hlsMediaAttached",M.MEDIA_DETACHING="hlsMediaDetaching",M.MEDIA_DETACHED="hlsMediaDetached",M.BUFFER_RESET="hlsBufferReset",M.BUFFER_CODECS="hlsBufferCodecs",M.BUFFER_CREATED="hlsBufferCreated",M.BUFFER_APPENDING="hlsBufferAppending",M.BUFFER_APPENDED="hlsBufferAppended",M.BUFFER_EOS="hlsBufferEos",M.BUFFER_FLUSHING="hlsBufferFlushing",M.BUFFER_FLUSHED="hlsBufferFlushed",M.MANIFEST_LOADING="hlsManifestLoading",M.MANIFEST_LOADED="hlsManifestLoaded",M.MANIFEST_PARSED="hlsManifestParsed",M.LEVEL_SWITCHING="hlsLevelSwitching",M.LEVEL_SWITCHED="hlsLevelSwitched",M.LEVEL_LOADING="hlsLevelLoading",M.LEVEL_LOADED="hlsLevelLoaded",M.LEVEL_UPDATED="hlsLevelUpdated",M.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",M.LEVELS_UPDATED="hlsLevelsUpdated",M.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",M.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",M.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",M.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",M.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",M.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",M.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",M.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",M.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",M.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",M.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",M.CUES_PARSED="hlsCuesParsed",M.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",M.INIT_PTS_FOUND="hlsInitPtsFound",M.FRAG_LOADING="hlsFragLoading",M.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",M.FRAG_LOADED="hlsFragLoaded",M.FRAG_DECRYPTED="hlsFragDecrypted",M.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",M.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",M.FRAG_PARSING_METADATA="hlsFragParsingMetadata",M.FRAG_PARSED="hlsFragParsed",M.FRAG_BUFFERED="hlsFragBuffered",M.FRAG_CHANGED="hlsFragChanged",M.FPS_DROP="hlsFpsDrop",M.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",M.ERROR="hlsError",M.DESTROYING="hlsDestroying",M.KEY_LOADING="hlsKeyLoading",M.KEY_LOADED="hlsKeyLoaded",M.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",M.BACK_BUFFER_REACHED="hlsBackBufferReached"}(L||(L={}))},76:(v,g,E)=>{"use strict";E.r(g),E.d(g,{default:()=>ac});var L,M=E(945),R=E(965),b=E(851),P=E(973),O=E(93),ue=/^(\d+)x(\d+)$/,Q=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,de=function(){function m(e){for(var i in typeof e=="string"&&(e=m.parseAttrList(e)),e)e.hasOwnProperty(i)&&(this[i]=e[i])}var c=m.prototype;return c.decimalInteger=function(e){var i=parseInt(this[e],10);return i>Number.MAX_SAFE_INTEGER?1/0:i},c.hexadecimalInteger=function(e){if(this[e]){var i=(this[e]||"0x").slice(2);i=(1&i.length?"0":"")+i;for(var s=new Uint8Array(i.length/2),o=0;o<i.length/2;o++)s[o]=parseInt(i.slice(2*o,2*o+2),16);return s}return null},c.hexadecimalIntegerAsNumber=function(e){var i=parseInt(this[e],16);return i>Number.MAX_SAFE_INTEGER?1/0:i},c.decimalFloatingPoint=function(e){return parseFloat(this[e])},c.optionalFloat=function(e,i){var s=this[e];return s?parseFloat(s):i},c.enumeratedString=function(e){return this[e]},c.bool=function(e){return this[e]==="YES"},c.decimalResolution=function(e){var i=ue.exec(this[e]);if(i!==null)return{width:parseInt(i[1],10),height:parseInt(i[2],10)}},m.parseAttrList=function(e){var i,s={};for(Q.lastIndex=0;(i=Q.exec(e))!==null;){var o=i[2];o.indexOf('"')===0&&o.lastIndexOf('"')===o.length-1&&(o=o.slice(1,-1)),s[i[1]]=o}return s},m}();function he(){return he=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(m[i]=e[i])}return m},he.apply(this,arguments)}function Y(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}(function(m){m.ID="ID",m.CLASS="CLASS",m.START_DATE="START-DATE",m.DURATION="DURATION",m.END_DATE="END-DATE",m.END_ON_NEXT="END-ON-NEXT",m.PLANNED_DURATION="PLANNED-DURATION",m.SCTE35_OUT="SCTE35-OUT",m.SCTE35_IN="SCTE35-IN"})(L||(L={}));var pe=function(){function m(i,s){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,s){var o=s.attr;for(var l in o)if(Object.prototype.hasOwnProperty.call(i,l)&&i[l]!==o[l]){O.logger.warn('DATERANGE tag attribute: "'+l+'" does not match for tags with ID: "'+i.ID+'"'),this._badValueForSameId=l;break}i=he(new de({}),o,i)}if(this.attr=i,this._startDate=new Date(i[L.START_DATE]),L.END_DATE in this.attr){var n=new Date(this.attr[L.END_DATE]);(0,R.isFiniteNumber)(n.getTime())&&(this._endDate=n)}}var c,e;return c=m,(e=[{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 i=this.duration;return i!==null?new Date(this._startDate.getTime()+1e3*i):null}},{key:"duration",get:function(){if(L.DURATION in this.attr){var i=this.attr.decimalFloatingPoint(L.DURATION);if((0,R.isFiniteNumber)(i))return i}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return L.PLANNED_DURATION in this.attr?this.attr.decimalFloatingPoint(L.PLANNED_DURATION):null}},{key:"endOnNext",get:function(){return this.attr.bool(L.END_ON_NEXT)}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&(0,R.isFiniteNumber)(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}])&&Y(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}(),X=E(923);function oe(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}var z,be,ke,He=function(){function m(i){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.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.encryptedFragments=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=i}var c,e;return m.prototype.reloaded=function(i){if(!i)return this.advanced=!0,void(this.updated=!0);var s=this.lastPartSn-i.lastPartSn,o=this.lastPartIndex-i.lastPartIndex;this.updated=this.endSN!==i.endSN||!!o||!!s,this.advanced=this.endSN>i.endSN||s>0||s===0&&o>0,this.updated||this.advanced?this.misses=Math.floor(.6*i.misses):this.misses=i.misses+1,this.availabilityDelay=i.availabilityDelay},c=m,(e=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&(0,R.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var i=this.driftEndTime-this.driftStartTime;return i>0?1e3*(this.driftEnd-this.driftStart)/i:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var i;return(i=this.partList)!==null&&i!==void 0&&i.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var i;return(i=this.fragments)!==null&&i!==void 0&&i.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 i;return(i=this.partList)!==null&&i!==void 0&&i.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var i;return(i=this.partList)!==null&&i!==void 0&&i.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&oe(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}();function Z(m){return Uint8Array.from(atob(m),function(c){return c.charCodeAt(0)})}function I(m){return Uint8Array.from(unescape(encodeURIComponent(m)),function(c){return c.charCodeAt(0)})}function q(m){switch(m){case be.FAIRPLAY:return z.FAIRPLAY;case be.PLAYREADY:return z.PLAYREADY;case be.WIDEVINE:return z.WIDEVINE;case be.CLEARKEY:return z.CLEARKEY}}function N(m){switch(m){case z.FAIRPLAY:return be.FAIRPLAY;case z.PLAYREADY:return be.PLAYREADY;case z.WIDEVINE:return be.WIDEVINE;case z.CLEARKEY:return be.CLEARKEY}}function fe(m){var c=m.drmSystems,e=m.widevineLicenseUrl,i=c?[z.FAIRPLAY,z.WIDEVINE,z.PLAYREADY,z.CLEARKEY].filter(function(s){return!!c[s]}):[];return!i[z.WIDEVINE]&&e&&i.push(z.WIDEVINE),i}(function(m){m.CLEARKEY="org.w3.clearkey",m.FAIRPLAY="com.apple.fps",m.PLAYREADY="com.microsoft.playready",m.WIDEVINE="com.widevine.alpha"})(z||(z={})),function(m){m.CLEARKEY="org.w3.clearkey",m.FAIRPLAY="com.apple.streamingkeydelivery",m.PLAYREADY="com.microsoft.playready",m.WIDEVINE="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"}(be||(be={})),function(m){m.WIDEVINE="edef8ba979d64acea3c827dcd51d21ed"}(ke||(ke={}));var _e=typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null,te=E(63),ie={},Re=function(){function m(e,i,s,o,l){o===void 0&&(o=[1]),l===void 0&&(l=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=i,this.keyFormat=s,this.keyFormatVersions=o,this.iv=l,this.encrypted=!!e&&e!=="NONE",this.isCommonEncryption=this.encrypted&&e!=="AES-128"}m.clearKeyUriToKeyIdMap=function(){ie={}};var c=m.prototype;return c.isSupported=function(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;switch(this.keyFormat){case"identity":return this.method==="SAMPLE-AES";case be.FAIRPLAY:case be.WIDEVINE:case be.PLAYREADY:case be.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1},c.getDecryptData=function(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method!=="AES-128"||this.iv||O.logger.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),e=0);var i=function(W){for(var K=new Uint8Array(16),ee=12;ee<16;ee++)K[ee]=W>>8*(15-ee)&255;return K}(e);return new m(this.method,this.uri,"identity",this.keyFormatVersions,i)}var s=function(W){var K,ee,me=W.split(":"),Ie=null;if(me[0]==="data"&&me.length===2){var ye=me[1].split(";"),De=ye[ye.length-1].split(",");if(De.length===2){var qe=De[0]==="base64",rt=De[1];qe?(ye.splice(-1,1),Ie=Z(rt)):(K=I(rt).subarray(0,16),(ee=new Uint8Array(16)).set(K,16-K.length),Ie=ee)}}return Ie}(this.uri);if(s)switch(this.keyFormat){case be.WIDEVINE:this.pssh=s,s.length>=22&&(this.keyId=s.subarray(s.length-22,s.length-6));break;case be.PLAYREADY:var o=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=(0,te.mp4pssh)(o,null,s);var l=new Uint16Array(s.buffer,s.byteOffset,s.byteLength/2),n=String.fromCharCode.apply(null,Array.from(l)),u=n.substring(n.indexOf("<"),n.length),h=new DOMParser().parseFromString(u,"text/xml").getElementsByTagName("KID")[0];if(h){var f=h.childNodes[0]?h.childNodes[0].nodeValue:h.getAttribute("VALUE");if(f){var p=Z(f).subarray(0,16);(function(W){var K=function(ee,me,Ie){var ye=ee[me];ee[me]=ee[Ie],ee[Ie]=ye};K(W,0,3),K(W,1,2),K(W,4,5),K(W,6,7)})(p),this.keyId=p}}break;default:var _=s.subarray(0,16);if(_.length!==16){var S=new Uint8Array(16);S.set(_,16-_.length),_=S}this.keyId=_}if(!this.keyId||this.keyId.byteLength!==16){var C=ie[this.uri];if(!C){var x=Object.keys(ie).length%Number.MAX_SAFE_INTEGER;C=new Uint8Array(16),new DataView(C.buffer,12,4).setUint32(0,x),ie[this.uri]=C}this.keyId=C}return this},m}(),Pe={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,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,dva1:!0,dvav:!0,dvh1:!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 Fe(m,c){return MediaSource.isTypeSupported((c||"video")+'/mp4;codecs="'+m+'"')}function Se(){return Se=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(m[i]=e[i])}return m},Se.apply(this,arguments)}var Ye=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+|#EXT-X-SESSION-KEY:([^\n\r]*)[\r\n]+/g,ot=/#EXT-X-MEDIA:(.*)/g,le=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Ee=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("|")),U=function(){function m(){}return m.findGroup=function(c,e){for(var i=0;i<c.length;i++){var s=c[i];if(s.id===e)return s}},m.convertAVC1ToAVCOTI=function(c){var e=c.split(".");if(e.length>2){var i=e.shift()+".";return(i+=parseInt(e.shift()).toString(16))+("000"+parseInt(e.shift()).toString(16)).slice(-4)}return c},m.resolve=function(c,e){return(0,M.buildAbsoluteURL)(e,c,{alwaysNormalize:!0})},m.parseMasterPlaylist=function(c,e){var i,s=[],o=[],l={},n=[],u=!1;for(Ye.lastIndex=0;(i=Ye.exec(c))!=null;)if(i[1]){var h,f=new de(i[1]),p={attrs:f,bitrate:f.decimalInteger("AVERAGE-BANDWIDTH")||f.decimalInteger("BANDWIDTH"),name:f.NAME,url:m.resolve(i[2],e)},_=f.decimalResolution("RESOLUTION");_&&(p.width=_.width,p.height=_.height),Le((f.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),p),p.videoCodec&&p.videoCodec.indexOf("avc1")!==-1&&(p.videoCodec=m.convertAVC1ToAVCOTI(p.videoCodec)),(h=p.unknownCodecs)!==null&&h!==void 0&&h.length||o.push(p),s.push(p)}else if(i[3]){var S=new de(i[3]);S["DATA-ID"]&&(u=!0,l[S["DATA-ID"]]=S)}else if(i[4]){var C=i[4],x=ve(C,e);x.encrypted&&x.isSupported()?n.push(x):O.logger.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+C+'"')}return{levels:o.length>0&&o.length<s.length?o:s,sessionData:u?l:null,sessionKeys:n.length?n:null}},m.parseMasterPlaylistMedia=function(c,e,i,s){var o;s===void 0&&(s=[]);var l=[],n=0;for(ot.lastIndex=0;(o=ot.exec(c))!==null;){var u=new de(o[1]);if(u.TYPE===i){var h={attrs:u,bitrate:0,id:n++,groupId:u["GROUP-ID"],instreamId:u["INSTREAM-ID"],name:u.NAME||u.LANGUAGE||"",type:i,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:u.LANGUAGE,url:u.URI?m.resolve(u.URI,e):""};if(s.length){var f=m.findGroup(s,h.groupId)||s[0];Ne(h,f,"audioCodec"),Ne(h,f,"textCodec")}l.push(h)}}return l},m.parseLevelPlaylist=function(c,e,i,s,o){var l,n,u,h=new He(e),f=h.fragments,p=null,_=0,S=0,C=0,x=0,W=null,K=new X.Fragment(s,e),ee=-1,me=!1;for(le.lastIndex=0,h.m3u8=c;(l=le.exec(c))!==null;){me&&(me=!1,(K=new X.Fragment(s,e)).start=C,K.sn=_,K.cc=x,K.level=i,p&&(K.initSegment=p,K.rawProgramDateTime=p.rawProgramDateTime,p.rawProgramDateTime=null));var Ie=l[1];if(Ie){K.duration=parseFloat(Ie);var ye=(" "+l[2]).slice(1);K.title=ye||null,K.tagList.push(ye?["INF",Ie,ye]:["INF",Ie])}else if(l[3]){if((0,R.isFiniteNumber)(K.duration)){if(K.start=C,u){K.levelkeys=u;var De=h.encryptedFragments;!K.levelkeys||!Object.keys(K.levelkeys).some(function(dr){return K.levelkeys[dr].isCommonEncryption})||De.length&&De[De.length-1].levelkeys===u||De.push(K)}K.sn=_,K.level=i,K.cc=x,K.urlId=o,f.push(K),K.relurl=(" "+l[3]).slice(1),Ue(K,W),W=K,C+=K.duration,_++,S=0,me=!0}}else if(l[4]){var qe=(" "+l[4]).slice(1);W?K.setByteRange(qe,W):K.setByteRange(qe)}else if(l[5])K.rawProgramDateTime=(" "+l[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),ee===-1&&(ee=f.length);else{if(!(l=l[0].match(Ee))){O.logger.warn("No matches on slow regex match for level playlist!");continue}for(n=1;n<l.length&&l[n]===void 0;n++);var rt=(" "+l[n]).slice(1),we=(" "+l[n+1]).slice(1),je=l[n+2]?(" "+l[n+2]).slice(1):"";switch(rt){case"PLAYLIST-TYPE":h.type=we.toUpperCase();break;case"MEDIA-SEQUENCE":_=h.startSN=parseInt(we);break;case"SKIP":var Ve=new de(we),Tt=Ve.decimalInteger("SKIPPED-SEGMENTS");if((0,R.isFiniteNumber)(Tt)){h.skippedSegments=Tt;for(var Wt=Tt;Wt--;)f.unshift(null);_+=Tt}var St=Ve.enumeratedString("RECENTLY-REMOVED-DATERANGES");St&&(h.recentlyRemovedDateranges=St.split(" "));break;case"TARGETDURATION":h.targetduration=parseFloat(we);break;case"VERSION":h.version=parseInt(we);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"#":(we||je)&&K.tagList.push(je?[we,je]:[we]);break;case"DISCONTINUITY":x++,K.tagList.push(["DIS"]);break;case"GAP":K.tagList.push([rt]);break;case"BITRATE":K.tagList.push([rt,we]);break;case"DATERANGE":var Mt=new de(we),Gt=new pe(Mt,h.dateRanges[Mt.ID]);Gt.isValid||h.skippedSegments?h.dateRanges[Gt.id]=Gt:O.logger.warn('Ignoring invalid DATERANGE tag: "'+we+'"'),K.tagList.push(["EXT-X-DATERANGE",we]);break;case"DISCONTINUITY-SEQUENCE":x=parseInt(we);break;case"KEY":var yi=ve(we,e);if(yi.isSupported()){if(yi.method==="NONE"){u=void 0;break}u||(u={}),u[yi.keyFormat]&&(u=Se({},u)),u[yi.keyFormat]=yi}else O.logger.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+we+'"');break;case"START":var fi=new de(we).decimalFloatingPoint("TIME-OFFSET");(0,R.isFiniteNumber)(fi)&&(h.startTimeOffset=fi);break;case"MAP":var ei=new de(we);if(K.duration){var bi=new X.Fragment(s,e);Ge(bi,ei,i,u),p=bi,K.initSegment=p,p.rawProgramDateTime&&!K.rawProgramDateTime&&(K.rawProgramDateTime=p.rawProgramDateTime)}else Ge(K,ei,i,u),p=K,me=!0;break;case"SERVER-CONTROL":var Zi=new de(we);h.canBlockReload=Zi.bool("CAN-BLOCK-RELOAD"),h.canSkipUntil=Zi.optionalFloat("CAN-SKIP-UNTIL",0),h.canSkipDateRanges=h.canSkipUntil>0&&Zi.bool("CAN-SKIP-DATERANGES"),h.partHoldBack=Zi.optionalFloat("PART-HOLD-BACK",0),h.holdBack=Zi.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Wl=new de(we);h.partTarget=Wl.decimalFloatingPoint("PART-TARGET");break;case"PART":var Er=h.partList;Er||(Er=h.partList=[]);var jn=S>0?Er[Er.length-1]:void 0,qn=S++,Yn=new X.Part(new de(we),K,e,qn,jn);Er.push(Yn),K.duration+=Yn.duration;break;case"PRELOAD-HINT":var vt=new de(we);h.preloadHint=vt;break;case"RENDITION-REPORT":var kt=new de(we);h.renditionReports=h.renditionReports||[],h.renditionReports.push(kt);break;default:O.logger.warn("line parsed but not handled: "+l)}}}W&&!W.relurl?(f.pop(),C-=W.duration,h.partList&&(h.fragmentHint=W)):h.partList&&(Ue(K,W),K.cc=x,h.fragmentHint=K);var an=f.length,Ir=f[0],yr=f[an-1];if((C+=h.skippedSegments*h.targetduration)>0&&an&&yr){h.averagetargetduration=C/an;var nn=yr.sn;h.endSN=nn!=="initSegment"?nn:0,h.live||(yr.endList=!0),Ir&&(h.startCC=Ir.cc)}else h.endSN=0,h.startCC=0;return h.fragmentHint&&(C+=h.fragmentHint.duration),h.totalduration=C,h.endCC=x,ee>0&&function(dr,wr){for(var zr=dr[wr],ar=wr;ar--;){var Qr=dr[ar];if(!Qr)return;Qr.programDateTime=zr.programDateTime-1e3*Qr.duration,zr=Qr}}(f,ee),h},m}();function ve(m,c){var e,i,s=new de(m),o=(e=s.enumeratedString("METHOD"))!=null?e:"",l=s.URI,n=s.hexadecimalInteger("IV"),u=s.enumeratedString("KEYFORMATVERSIONS"),h=(i=s.enumeratedString("KEYFORMAT"))!=null?i:"identity";l&&s.IV&&!n&&O.logger.error("Invalid IV: "+s.IV);var f=l?U.resolve(l,c):"",p=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Re(o,f,h,p,n)}function Le(m,c){["video","audio","text"].forEach(function(e){var i=m.filter(function(o){return function(l,n){var u=Pe[n];return!!u&&u[l.slice(0,4)]===!0}(o,e)});if(i.length){var s=i.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});c[e+"Codec"]=s.length>0?s[0]:i[0],m=m.filter(function(o){return i.indexOf(o)===-1})}}),c.unknownCodecs=m}function Ne(m,c,e){var i=c[e];i&&(m[e]=i)}function Ue(m,c){m.rawProgramDateTime?m.programDateTime=Date.parse(m.rawProgramDateTime):c!=null&&c.programDateTime&&(m.programDateTime=c.endProgramDateTime),(0,R.isFiniteNumber)(m.programDateTime)||(m.programDateTime=null,m.rawProgramDateTime=null)}function Ge(m,c,e,i){m.relurl=c.URI,c.BYTERANGE&&m.setByteRange(c.BYTERANGE),m.level=e,m.sn="initSegment",i&&(m.levelkeys=i),m.initSegment=null}var Te=E(308);function xe(m,c){var e=m.url;return e!==void 0&&e.indexOf("data:")!==0||(e=c.url),e}let ze=function(){function m(e){this.hls=void 0,this.loaders=Object.create(null),this.hls=e,this.registerListeners()}var c=m.prototype;return c.startLoad=function(e){},c.stopLoad=function(){this.destroyInternalLoaders()},c.registerListeners=function(){var e=this.hls;e.on(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(b.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(b.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(b.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.unregisterListeners=function(){var e=this.hls;e.off(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(b.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(b.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(b.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.createInternalLoader=function(e){var i=this.hls.config,s=i.pLoader,o=i.loader,l=new(s||o)(i);return e.loader=l,this.loaders[e.type]=l,l},c.getInternalLoader=function(e){return this.loaders[e.type]},c.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},c.destroyInternalLoaders=function(){for(var e in this.loaders){var i=this.loaders[e];i&&i.destroy(),this.resetInternalLoader(e)}},c.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},c.onManifestLoading=function(e,i){var s=i.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:Te.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},c.onLevelLoading=function(e,i){var s=i.id,o=i.level,l=i.url,n=i.deliveryDirectives;this.load({id:s,groupId:null,level:o,responseType:"text",type:Te.PlaylistContextType.LEVEL,url:l,deliveryDirectives:n})},c.onAudioTrackLoading=function(e,i){var s=i.id,o=i.groupId,l=i.url,n=i.deliveryDirectives;this.load({id:s,groupId:o,level:null,responseType:"text",type:Te.PlaylistContextType.AUDIO_TRACK,url:l,deliveryDirectives:n})},c.onSubtitleTrackLoading=function(e,i){var s=i.id,o=i.groupId,l=i.url,n=i.deliveryDirectives;this.load({id:s,groupId:o,level:null,responseType:"text",type:Te.PlaylistContextType.SUBTITLE_TRACK,url:l,deliveryDirectives:n})},c.load=function(e){var i,s,o,l,n,u,h=this.hls.config,f=this.getInternalLoader(e);if(f){var p=f.context;if(p&&p.url===e.url)return void O.logger.trace("[playlist-loader]: playlist request ongoing");O.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),f.abort()}switch(e.type){case Te.PlaylistContextType.MANIFEST:s=h.manifestLoadingMaxRetry,o=h.manifestLoadingTimeOut,l=h.manifestLoadingRetryDelay,n=h.manifestLoadingMaxRetryTimeout;break;case Te.PlaylistContextType.LEVEL:case Te.PlaylistContextType.AUDIO_TRACK:case Te.PlaylistContextType.SUBTITLE_TRACK:s=0,o=h.levelLoadingTimeOut;break;default:s=h.levelLoadingMaxRetry,o=h.levelLoadingTimeOut,l=h.levelLoadingRetryDelay,n=h.levelLoadingMaxRetryTimeout}if(f=this.createInternalLoader(e),(i=e.deliveryDirectives)!==null&&i!==void 0&&i.part&&(e.type===Te.PlaylistContextType.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===Te.PlaylistContextType.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===Te.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u)){var _=u.partTarget,S=u.targetduration;_&&S&&(o=Math.min(1e3*Math.max(3*_,.8*S),o))}var C={timeout:o,maxRetry:s,retryDelay:l,maxRetryDelay:n,highWaterMark:0},x={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};f.load(e,C,x)},c.loadsuccess=function(e,i,s,o){o===void 0&&(o=null),this.resetInternalLoader(s.type);var l=e.data;l.indexOf("#EXTM3U")===0?(i.parsing.start=performance.now(),l.indexOf("#EXTINF:")>0||l.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,i,s,o):this.handleMasterPlaylist(e,i,s,o)):this.handleManifestParsingError(e,s,"no EXTM3U delimiter",o)},c.loaderror=function(e,i,s){s===void 0&&(s=null),this.handleNetworkError(i,s,!1,e)},c.loadtimeout=function(e,i,s){s===void 0&&(s=null),this.handleNetworkError(i,s,!0)},c.handleMasterPlaylist=function(e,i,s,o){var l=this.hls,n=e.data,u=xe(e,s),h=U.parseMasterPlaylist(n,u),f=h.levels,p=h.sessionData,_=h.sessionKeys;if(f.length){var S=f.map(function(ee){return{id:ee.attrs.AUDIO,audioCodec:ee.audioCodec}}),C=f.map(function(ee){return{id:ee.attrs.SUBTITLES,textCodec:ee.textCodec}}),x=U.parseMasterPlaylistMedia(n,u,"AUDIO",S),W=U.parseMasterPlaylistMedia(n,u,"SUBTITLES",C),K=U.parseMasterPlaylistMedia(n,u,"CLOSED-CAPTIONS");x.length&&(x.some(function(ee){return!ee.url})||!f[0].audioCodec||f[0].attrs.AUDIO||(O.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new de({}),bitrate:0,url:""}))),l.trigger(b.Events.MANIFEST_LOADED,{levels:f,audioTracks:x,subtitles:W,captions:K,url:u,stats:i,networkDetails:o,sessionData:p,sessionKeys:_})}else this.handleManifestParsingError(e,s,"no level found in manifest",o)},c.handleTrackOrLevelPlaylist=function(e,i,s,o){var l=this.hls,n=s.id,u=s.level,h=s.type,f=xe(e,s),p=(0,R.isFiniteNumber)(n)?n:0,_=(0,R.isFiniteNumber)(u)?u:p,S=function(W){switch(W.type){case Te.PlaylistContextType.AUDIO_TRACK:return Te.PlaylistLevelType.AUDIO;case Te.PlaylistContextType.SUBTITLE_TRACK:return Te.PlaylistLevelType.SUBTITLE;default:return Te.PlaylistLevelType.MAIN}}(s),C=U.parseLevelPlaylist(e.data,f,_,S,p);if(C.fragments.length){if(h===Te.PlaylistContextType.MANIFEST){var x={attrs:new de({}),bitrate:0,details:C,name:"",url:f};l.trigger(b.Events.MANIFEST_LOADED,{levels:[x],audioTracks:[],url:f,stats:i,networkDetails:o,sessionData:null,sessionKeys:null})}i.parsing.end=performance.now(),s.levelDetails=C,this.handlePlaylistLoaded(e,i,s,o)}else l.trigger(b.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0})},c.handleManifestParsingError=function(e,i,s,o){this.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:i.type===Te.PlaylistContextType.MANIFEST,url:e.url,reason:s,response:e,context:i,networkDetails:o})},c.handleNetworkError=function(e,i,s,o){s===void 0&&(s=!1),O.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var l=P.ErrorDetails.UNKNOWN,n=!1,u=this.getInternalLoader(e);switch(e.type){case Te.PlaylistContextType.MANIFEST:l=s?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,n=!0;break;case Te.PlaylistContextType.LEVEL:l=s?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,n=!1;break;case Te.PlaylistContextType.AUDIO_TRACK:l=s?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,n=!1;break;case Te.PlaylistContextType.SUBTITLE_TRACK:l=s?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,n=!1}u&&this.resetInternalLoader(e.type);var h={type:P.ErrorTypes.NETWORK_ERROR,details:l,fatal:n,url:e.url,loader:u,context:e,networkDetails:i};o&&(h.response=o),this.hls.trigger(b.Events.ERROR,h)},c.handlePlaylistLoaded=function(e,i,s,o){var l=s.type,n=s.level,u=s.id,h=s.groupId,f=s.loader,p=s.levelDetails,_=s.deliveryDirectives;if(p!=null&&p.targetduration){if(f)switch(p.live&&(f.getCacheAge&&(p.ageHeader=f.getCacheAge()||0),f.getCacheAge&&!isNaN(p.ageHeader)||(p.ageHeader=0)),l){case Te.PlaylistContextType.MANIFEST:case Te.PlaylistContextType.LEVEL:this.hls.trigger(b.Events.LEVEL_LOADED,{details:p,level:n||0,id:u||0,stats:i,networkDetails:o,deliveryDirectives:_});break;case Te.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(b.Events.AUDIO_TRACK_LOADED,{details:p,id:u||0,groupId:h||"",stats:i,networkDetails:o,deliveryDirectives:_});break;case Te.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(b.Events.SUBTITLE_TRACK_LOADED,{details:p,id:u||0,groupId:h||"",stats:i,networkDetails:o,deliveryDirectives:_})}}else this.handleManifestParsingError(e,s,"invalid target duration",o)},m}();function it(m,c){var e;try{e=new Event("addtrack")}catch{(e=document.createEvent("Event")).initEvent("addtrack",!1,!1)}e.track=m,c.dispatchEvent(e)}function _t(m,c){var e=m.mode;if(e==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(c.id))try{if(m.addCue(c),!m.cues.getCueById(c.id))throw new Error("addCue is failed for: "+c)}catch(s){O.logger.debug("[texttrack-utils]: "+s);var i=new self.TextTrackCue(c.startTime,c.endTime,c.text);i.id=c.id,m.addCue(i)}e==="disabled"&&(m.mode=e)}function gt(m){var c=m.mode;if(c==="disabled"&&(m.mode="hidden"),m.cues)for(var e=m.cues.length;e--;)m.removeCue(m.cues[e]);c==="disabled"&&(m.mode=c)}function Lt(m,c,e,i){var s=m.mode;if(s==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var o=function(n,u,h){var f=[],p=function(x,W){if(W<x[0].startTime)return 0;var K=x.length-1;if(W>x[K].endTime)return-1;for(var ee=0,me=K;ee<=me;){var Ie=Math.floor((me+ee)/2);if(W<x[Ie].startTime)me=Ie-1;else{if(!(W>x[Ie].startTime&&ee<K))return Ie;ee=Ie+1}}return x[ee].startTime-W<W-x[me].startTime?ee:me}(n,u);if(p>-1)for(var _=p,S=n.length;_<S;_++){var C=n[_];if(C.startTime>=u&&C.endTime<=h)f.push(C);else if(C.startTime>h)return f}return f}(m.cues,c,e),l=0;l<o.length;l++)i&&!i(o[l])||m.removeCue(o[l]);s==="disabled"&&(m.mode=s)}var lt=E(181),It=E(856);function Rt(){return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var At=function(){var m=Rt();try{new m(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function pt(m,c){return m.getTime()/1e3-c}let Ut=function(){function m(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var c=m.prototype;return c.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},c._registerListeners=function(){var e=this.hls;e.on(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(b.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(b.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(b.Events.LEVEL_UPDATED,this.onLevelUpdated,this)},c._unregisterListeners=function(){var e=this.hls;e.off(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(b.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(b.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(b.Events.LEVEL_UPDATED,this.onLevelUpdated,this)},c.onMediaAttached=function(e,i){this.media=i.media},c.onMediaDetaching=function(){this.id3Track&&(gt(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})},c.onManifestLoading=function(){this.dateRangeCuesAppended={}},c.createTrack=function(e){var i=this.getID3Track(e.textTracks);return i.mode="hidden",i},c.getID3Track=function(e){if(this.media){for(var i=0;i<e.length;i++){var s=e[i];if(s.kind==="metadata"&&s.label==="id3")return it(s,this.media),s}return this.media.addTextTrack("metadata","id3")}},c.onFragParsingMetadata=function(e,i){if(this.media){var s=this.hls.config,o=s.enableEmsgMetadataCues,l=s.enableID3MetadataCues;if(o||l){var n=i.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var u=Rt(),h=0;h<n.length;h++){var f=n[h].type;if((f!==It.MetadataSchema.emsg||o)&&l){var p=lt.getID3Frames(n[h].data);if(p){var _=n[h].pts,S=_+n[h].duration;S>At&&(S=At),S-_<=0&&(S=_+.25);for(var C=0;C<p.length;C++){var x=p[C];if(!lt.isTimeStampFrame(x)){this.updateId3CueEnds(_);var W=new u(_,S,"");W.value=x,f&&(W.type=f),this.id3Track.addCue(W)}}}}}}}},c.updateId3CueEnds=function(e){var i,s=(i=this.id3Track)===null||i===void 0?void 0:i.cues;if(s)for(var o=s.length;o--;){var l=s[o];l.startTime<e&&l.endTime===At&&(l.endTime=e)}},c.onBufferFlushing=function(e,i){var s=i.startOffset,o=i.endOffset,l=i.type,n=this.id3Track,u=this.hls;if(u){var h=u.config,f=h.enableEmsgMetadataCues,p=h.enableID3MetadataCues;n&&(f||p)&&Lt(n,s,o,l==="audio"?function(_){return _.type===It.MetadataSchema.audioId3&&p}:l==="video"?function(_){return _.type===It.MetadataSchema.emsg&&f}:function(_){return _.type===It.MetadataSchema.audioId3&&p||_.type===It.MetadataSchema.emsg&&f})}},c.onLevelUpdated=function(e,i){var s=this,o=i.details;if(this.media&&o.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var l=this.dateRangeCuesAppended,n=this.id3Track,u=o.dateRanges,h=Object.keys(u);if(n)for(var f=Object.keys(l).filter(function(ee){return!h.includes(ee)}),p=function(ee){var me=f[ee];Object.keys(l[me].cues).forEach(function(Ie){n.removeCue(l[me].cues[Ie])}),delete l[me]},_=f.length;_--;)p(_);var S=o.fragments[o.fragments.length-1];if(h.length!==0&&(0,R.isFiniteNumber)(S==null?void 0:S.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var C=S.programDateTime/1e3-S.start,x=Rt(),W=function(ee){var me=h[ee],Ie=u[me],ye=l[me],De=(ye==null?void 0:ye.cues)||{},qe=(ye==null?void 0:ye.durationKnown)||!1,rt=pt(Ie.startDate,C),we=At,je=Ie.endDate;if(je)we=pt(je,C),qe=!0;else if(Ie.endOnNext&&!qe){var Ve=h.reduce(function(fi,ei){var bi=u[ei];return bi.class===Ie.class&&bi.id!==ei&&bi.startDate>Ie.startDate&&fi.push(bi),fi},[]).sort(function(fi,ei){return fi.startDate.getTime()-ei.startDate.getTime()})[0];Ve&&(we=pt(Ve.startDate,C),qe=!0)}for(var Tt,Wt=Object.keys(Ie.attr),St=0;St<Wt.length;St++){var Mt=Wt[St];if(Mt!==L.ID&&Mt!==L.CLASS&&Mt!==L.START_DATE&&Mt!==L.DURATION&&Mt!==L.END_DATE&&Mt!==L.END_ON_NEXT){var Gt=De[Mt];if(Gt)qe&&!ye.durationKnown&&(Gt.endTime=we);else{var yi=Ie.attr[Mt];Gt=new x(rt,we,""),Mt!==L.SCTE35_OUT&&Mt!==L.SCTE35_IN||(Tt=yi,yi=Uint8Array.from(Tt.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),Gt.value={key:Mt,data:yi},Gt.type=It.MetadataSchema.dateRange,s.id3Track.addCue(Gt),De[Mt]=Gt}}}l[me]={cues:De,dateRange:Ie,durationKnown:qe}},K=0;K<h.length;K++)W(K)}}},m}();function Vt(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}var ri=function(){function m(s){var o=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return o.timeupdate()},this.hls=s,this.config=s.config,this.registerListeners()}var c,e,i=m.prototype;return i.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},i.registerListeners=function(){this.hls.on(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(b.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(b.Events.ERROR,this.onError,this)},i.unregisterListeners=function(){this.hls.off(b.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(b.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(b.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(b.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(b.Events.ERROR,this.onError)},i.onMediaAttached=function(s,o){this.media=o.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},i.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},i.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},i.onLevelUpdated=function(s,o){var l=o.details;this.levelDetails=l,l.advanced&&this.timeupdate(),!l.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},i.onError=function(s,o){o.details===P.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},i.timeupdate=function(){var s=this.media,o=this.levelDetails;if(s&&o){this.currentTime=s.currentTime;var l=this.computeLatency();if(l!==null){this._latency=l;var n=this.config,u=n.lowLatencyMode,h=n.maxLiveSyncPlaybackRate;if(u&&h!==1){var f=this.targetLatency;if(f!==null){var p=l-f,_=p<Math.min(this.maxLatency,f+o.targetduration);if(o.live&&_&&p>.05&&this.forwardBufferLength>1){var S=Math.min(2,Math.max(1,h)),C=Math.round(2/(1+Math.exp(-.75*p-this.edgeStalled))*20)/20;s.playbackRate=Math.min(S,Math.max(1,C))}else s.playbackRate!==1&&s.playbackRate!==0&&(s.playbackRate=1)}}}}},i.estimateLiveEdge=function(){var s=this.levelDetails;return s===null?null:s.edge+s.age},i.computeLatency=function(){var s=this.estimateLiveEdge();return s===null?null:s-this.currentTime},c=m,(e=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var s=this.config,o=this.levelDetails;return s.liveMaxLatencyDuration!==void 0?s.liveMaxLatencyDuration:o?s.liveMaxLatencyDurationCount*o.targetduration:0}},{key:"targetLatency",get:function(){var s=this.levelDetails;if(s===null)return null;var o=s.holdBack,l=s.partHoldBack,n=s.targetduration,u=this.config,h=u.liveSyncDuration,f=u.liveSyncDurationCount,p=u.lowLatencyMode,_=this.hls.userConfig,S=p&&l||o;(_.liveSyncDuration||_.liveSyncDurationCount||S===0)&&(S=h!==void 0?h:f*n);var C=n;return S+Math.min(1*this.stallCount,C)}},{key:"liveSyncPosition",get:function(){var s=this.estimateLiveEdge(),o=this.targetLatency,l=this.levelDetails;if(s===null||o===null||l===null)return null;var n=l.edge,u=s-o-this.edgeStalled,h=n-l.totalduration,f=n-(this.config.lowLatencyMode&&l.partTarget||l.targetduration);return Math.min(Math.max(h,u),f)}},{key:"drift",get:function(){var s=this.levelDetails;return s===null?1:s.drift}},{key:"edgeStalled",get:function(){var s=this.levelDetails;if(s===null)return 0;var o=3*(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.max(s.age-o,0)}},{key:"forwardBufferLength",get:function(){var s=this.media,o=this.levelDetails;if(!s||!o)return 0;var l=s.buffered.length;return(l?s.buffered.end(l-1):o.edge)-this.currentTime}}])&&Vt(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}();function vi(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}var Qt,Fi=["NONE","TYPE-0","TYPE-1","TYPE-2",null];(function(m){m.No="",m.Yes="YES",m.v2="v2"})(Qt||(Qt={}));var se=function(){function m(c,e,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=c,this.part=e,this.skip=i}return m.prototype.addDirectives=function(c){var e=new self.URL(c);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.href},m}(),j=function(){function m(i){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=[i.url],this.attrs=i.attrs,this.bitrate=i.bitrate,i.details&&(this.details=i.details),this.id=i.id||0,this.name=i.name,this.width=i.width||0,this.height=i.height||0,this.audioCodec=i.audioCodec,this.videoCodec=i.videoCodec,this.unknownCodecs=i.unknownCodecs,this.codecSet=[i.videoCodec,i.audioCodec].filter(function(s){return s}).join(",").replace(/\.[^.,]+/g,"")}var c,e;return c=m,(e=[{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(i){var s=i%this.url.length;this._urlId!==s&&(this.details=void 0,this._urlId=s)}}])&&vi(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}();function w(){return w=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(m[i]=e[i])}return m},w.apply(this,arguments)}function G(m,c,e){switch(c){case"audio":m.audioGroupIds||(m.audioGroupIds=[]),m.audioGroupIds.push(e);break;case"text":m.textGroupIds||(m.textGroupIds=[]),m.textGroupIds.push(e)}}function H(m){var c={};m.forEach(function(e){var i=e.groupId||"";e.id=c[i]=c[i]||0,c[i]++})}function $(m,c){var e=c.startPTS;if((0,R.isFiniteNumber)(e)){var i,s=0;c.sn>m.sn?(s=e-m.start,i=m):(s=m.start-e,i=c),i.duration!==s&&(i.duration=s)}else c.sn>m.sn?m.cc===c.cc&&m.minEndPTS?c.start=m.start+(m.minEndPTS-m.start):c.start=m.start+m.duration:c.start=Math.max(m.start-c.duration,0)}function re(m,c,e,i,s,o){i-e<=0&&(O.logger.warn("Fragment should have a positive duration",c),i=e+c.duration,o=s+c.duration);var l=e,n=i,u=c.startPTS,h=c.endPTS;if((0,R.isFiniteNumber)(u)){var f=Math.abs(u-e);(0,R.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(f,c.deltaPTS):c.deltaPTS=f,l=Math.max(e,u),e=Math.min(e,u),s=Math.min(s,c.startDTS),n=Math.min(i,h),i=Math.max(i,h),o=Math.max(o,c.endDTS)}c.duration=i-e;var p=e-c.start;c.start=c.startPTS=e,c.maxStartPTS=l,c.startDTS=s,c.endPTS=i,c.minEndPTS=n,c.endDTS=o;var _,S=c.sn;if(!m||S<m.startSN||S>m.endSN)return 0;var C=S-m.startSN,x=m.fragments;for(x[C]=c,_=C;_>0;_--)$(x[_],x[_-1]);for(_=C;_<x.length-1;_++)$(x[_],x[_+1]);return m.fragmentHint&&$(x[x.length-1],m.fragmentHint),m.PTSKnown=m.alignedSliding=!0,p}function ae(m,c){var e=c.startSN+c.skippedSegments-m.startSN,i=m.fragments;e<0||e>=i.length||Ae(c,i[e].start)}function Ae(m,c){if(c){for(var e=m.fragments,i=m.skippedSegments;i<e.length;i++)e[i].start+=c;m.fragmentHint&&(m.fragmentHint.start+=c)}}var Ce=function(){function m(e,i){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=O.logger.log.bind(O.logger,i+":"),this.warn=O.logger.warn.bind(O.logger,i+":"),this.hls=e}var c=m.prototype;return c.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},c.onError=function(e,i){!i.fatal||i.type!==P.ErrorTypes.NETWORK_ERROR&&i.type!==P.ErrorTypes.KEY_SYSTEM_ERROR||this.stopLoad()},c.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},c.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.requestScheduled=-1,this.loadPlaylist()},c.stopLoad=function(){this.canLoad=!1,this.clearTimer()},c.switchParams=function(e,i){var s=i==null?void 0:i.renditionReports;if(s)for(var o=0;o<s.length;o++){var l=s[o],n=void 0;try{n=new self.URL(l.URI,i.url).href}catch(p){O.logger.warn("Could not construct new URL for Rendition Report: "+p),n=l.URI||""}if(n===e.slice(-n.length)){var u=parseInt(l["LAST-MSN"])||(i==null?void 0:i.lastPartSn),h=parseInt(l["LAST-PART"])||(i==null?void 0:i.lastPartIndex);if(this.hls.config.lowLatencyMode){var f=Math.min(i.age-i.partTarget,i.targetduration);h>=0&&f>i.partTarget&&(h+=1)}return new se(u,h>=0?h:void 0,Qt.No)}}},c.loadPlaylist=function(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())},c.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},c.playlistLoaded=function(e,i,s){var o=this,l=i.details,n=i.stats,u=self.performance.now(),h=n.loading.first?Math.max(0,u-n.loading.first):0;if(l.advancedDateTime=Date.now()-h,l.live||s!=null&&s.live){if(l.reloaded(s),s&&this.log("live playlist "+e+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),s&&l.fragments.length>0&&function(je,Ve){for(var Tt=null,Wt=je.fragments,St=Wt.length-1;St>=0;St--){var Mt=Wt[St].initSegment;if(Mt){Tt=Mt;break}}je.fragmentHint&&delete je.fragmentHint.endPTS;var Gt,yi,fi,ei,bi,Zi=0;if(function(vt,kt,an){for(var Ir=kt.skippedSegments,yr=Math.max(vt.startSN,kt.startSN)-kt.startSN,nn=(vt.fragmentHint?1:0)+(Ir?kt.endSN:Math.min(vt.endSN,kt.endSN))-kt.startSN,dr=kt.startSN-vt.startSN,wr=kt.fragmentHint?kt.fragments.concat(kt.fragmentHint):kt.fragments,zr=vt.fragmentHint?vt.fragments.concat(vt.fragmentHint):vt.fragments,ar=yr;ar<=nn;ar++){var Qr=zr[dr+ar],io=wr[ar];Ir&&!io&&ar<Ir&&(io=kt.fragments[ar]=Qr),Qr&&io&&an(Qr,io)}}(je,Ve,function(vt,kt){vt.relurl&&(Zi=vt.cc-kt.cc),(0,R.isFiniteNumber)(vt.startPTS)&&(0,R.isFiniteNumber)(vt.endPTS)&&(kt.start=kt.startPTS=vt.startPTS,kt.startDTS=vt.startDTS,kt.appendedPTS=vt.appendedPTS,kt.maxStartPTS=vt.maxStartPTS,kt.endPTS=vt.endPTS,kt.endDTS=vt.endDTS,kt.minEndPTS=vt.minEndPTS,kt.duration=vt.endPTS-vt.startPTS,kt.duration&&(Gt=kt),Ve.PTSKnown=Ve.alignedSliding=!0),kt.elementaryStreams=vt.elementaryStreams,kt.loader=vt.loader,kt.stats=vt.stats,kt.urlId=vt.urlId,vt.initSegment&&(kt.initSegment=vt.initSegment,Tt=vt.initSegment)}),Tt&&(Ve.fragmentHint?Ve.fragments.concat(Ve.fragmentHint):Ve.fragments).forEach(function(vt){var kt;vt.initSegment&&vt.initSegment.relurl!==((kt=Tt)===null||kt===void 0?void 0:kt.relurl)||(vt.initSegment=Tt)}),Ve.skippedSegments)if(Ve.deltaUpdateFailed=Ve.fragments.some(function(vt){return!vt}),Ve.deltaUpdateFailed){O.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var Wl=Ve.skippedSegments;Wl--;)Ve.fragments.shift();Ve.startSN=Ve.fragments[0].sn,Ve.startCC=Ve.fragments[0].cc}else Ve.canSkipDateRanges&&(Ve.dateRanges=(yi=je.dateRanges,fi=Ve.dateRanges,ei=Ve.recentlyRemovedDateranges,bi=w({},yi),ei&&ei.forEach(function(vt){delete bi[vt]}),Object.keys(fi).forEach(function(vt){var kt=new pe(fi[vt].attr,bi[vt]);kt.isValid?bi[vt]=kt:O.logger.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(fi[vt].attr)+'"')}),bi));var Er=Ve.fragments;if(Zi){O.logger.warn("discontinuity sliding from playlist, take drift into account");for(var jn=0;jn<Er.length;jn++)Er[jn].cc+=Zi}Ve.skippedSegments&&(Ve.startCC=Ve.fragments[0].cc),function(vt,kt,an){if(vt&&kt)for(var Ir=0,yr=0,nn=vt.length;yr<=nn;yr++){var dr=vt[yr],wr=kt[yr+Ir];dr&&wr&&dr.index===wr.index&&dr.fragment.sn===wr.fragment.sn?(zr=dr,(ar=wr).elementaryStreams=zr.elementaryStreams,ar.stats=zr.stats):Ir--}var zr,ar}(je.partList,Ve.partList),Gt?re(Ve,Gt,Gt.startPTS,Gt.endPTS,Gt.startDTS,Gt.endDTS):ae(je,Ve),Er.length&&(Ve.totalduration=Ve.edge-Er[0].start),Ve.driftStartTime=je.driftStartTime,Ve.driftStart=je.driftStart;var qn=Ve.advancedDateTime;if(Ve.advanced&&qn){var Yn=Ve.edge;Ve.driftStart||(Ve.driftStartTime=qn,Ve.driftStart=Yn),Ve.driftEndTime=qn,Ve.driftEnd=Yn}else Ve.driftEndTime=je.driftEndTime,Ve.driftEnd=je.driftEnd,Ve.advancedDateTime=je.advancedDateTime}(s,l),!this.canLoad||!l.live)return;var f,p=void 0,_=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var S=this.hls.config.lowLatencyMode,C=l.lastPartSn,x=l.endSN,W=l.lastPartIndex,K=C===x;W!==-1?(p=K?x+1:C,_=K?S?0:W:W+1):p=x+1;var ee=l.age,me=ee+l.ageHeader,Ie=Math.min(me-l.partTarget,1.5*l.targetduration);if(Ie>0){if(s&&Ie>s.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+s.tuneInGoal+" to: "+Ie+" with playlist age: "+l.age),Ie=0;else{var ye=Math.floor(Ie/l.targetduration);p+=ye,_!==void 0&&(_+=Math.round(Ie%l.targetduration/l.partTarget)),this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+ee.toFixed(2)+"s goal: "+Ie+" skip sn "+ye+" to part "+_)}l.tuneInGoal=Ie}if(f=this.getDeliveryDirectives(l,i.deliveryDirectives,p,_),S||!K)return void this.loadPlaylist(f)}else f=this.getDeliveryDirectives(l,i.deliveryDirectives,p,_);var De=this.hls.mainForwardBufferInfo,qe=De?De.end-De.len:0,rt=function(je,Ve){Ve===void 0&&(Ve=1/0);var Tt=1e3*je.targetduration;if(je.updated){var Wt=je.fragments;if(Wt.length&&4*Tt>Ve){var St=1e3*Wt[Wt.length-1].duration;St<Tt&&(Tt=St)}}else Tt/=2;return Math.round(Tt)}(l,1e3*(l.edge-qe));l.updated?u>this.requestScheduled+rt&&(this.requestScheduled=n.loading.start):this.requestScheduled=-1,p!==void 0&&l.canBlockReload?this.requestScheduled=n.loading.first+rt-(1e3*l.partTarget||1e3):this.requestScheduled=(this.requestScheduled===-1?u:this.requestScheduled)+rt;var we=this.requestScheduled-u;we=Math.max(0,we),this.log("reload live playlist "+e+" in "+Math.round(we)+" ms"),this.timer=self.setTimeout(function(){return o.loadPlaylist(f)},we)}else this.clearTimer()},c.getDeliveryDirectives=function(e,i,s,o){var l=function(n,u){var h=n.canSkipUntil,f=n.canSkipDateRanges,p=n.endSN;return h&&(u!==void 0?u-p:0)<h?f?Qt.v2:Qt.Yes:Qt.No}(e,s);return i!=null&&i.skip&&e.deltaUpdateFailed&&(s=i.msn,o=i.part,l=Qt.No),new se(s,o,l)},c.retryLoadingOrFail=function(e){var i,s=this,o=this.hls.config,l=this.retryCount<o.levelLoadingMaxRetry;if(l)if(this.requestScheduled=-1,this.retryCount++,e.details.indexOf("LoadTimeOut")>-1&&(i=e.context)!==null&&i!==void 0&&i.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+e.details+'"'),this.loadPlaylist();else{var n=Math.min(Math.pow(2,this.retryCount)*o.levelLoadingRetryDelay,o.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return s.loadPlaylist()},n),this.warn("retry playlist loading #"+this.retryCount+" in "+n+' ms after "'+e.details+'"')}else this.warn('cannot recover from error "'+e.details+'"'),this.clearTimer(),e.fatal=!0;return l},m}();function Oe(){return Oe=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(m[i]=e[i])}return m},Oe.apply(this,arguments)}function Ke(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}function Qe(m,c){return Qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},Qe(m,c)}var We,at=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),Et=function(m){var c,e;function i(n){var u;return(u=m.call(this,n,"[level-controller]")||this)._levels=[],u._firstLevel=-1,u._startLevel=void 0,u.currentLevelIndex=-1,u.manualLevelIndex=-1,u.onParsedComplete=void 0,u._registerListeners(),u}e=m,(c=i).prototype=Object.create(e.prototype),c.prototype.constructor=c,Qe(c,e);var s,o,l=i.prototype;return l._registerListeners=function(){var n=this.hls;n.on(b.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.on(b.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(b.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.on(b.Events.FRAG_LOADED,this.onFragLoaded,this),n.on(b.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var n=this.hls;n.off(b.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.off(b.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(b.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.off(b.Events.FRAG_LOADED,this.onFragLoaded,this),n.off(b.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,m.prototype.destroy.call(this)},l.startLoad=function(){this._levels.forEach(function(n){n.loadError=0}),m.prototype.startLoad.call(this)},l.onManifestLoaded=function(n,u){var h,f,p=[],_=[],S=[],C={},x=!1,W=!1,K=!1;if(u.levels.forEach(function(ye){var De=ye.attrs;x=x||!(!ye.width||!ye.height),W=W||!!ye.videoCodec,K=K||!!ye.audioCodec,at&&ye.audioCodec&&ye.audioCodec.indexOf("mp4a.40.34")!==-1&&(ye.audioCodec=void 0);var qe=ye.bitrate+"-"+ye.attrs.RESOLUTION+"-"+ye.attrs.CODECS;(f=C[qe])?f.url.push(ye.url):(f=new j(ye),C[qe]=f,p.push(f)),De&&(De.AUDIO&&G(f,"audio",De.AUDIO),De.SUBTITLES&&G(f,"text",De.SUBTITLES))}),(x||W)&&K&&(p=p.filter(function(ye){var De=ye.videoCodec,qe=ye.width,rt=ye.height;return!!De||!(!qe||!rt)})),p=p.filter(function(ye){var De=ye.audioCodec,qe=ye.videoCodec;return(!De||Fe(De,"audio"))&&(!qe||Fe(qe,"video"))}),u.audioTracks&&H(_=u.audioTracks.filter(function(ye){return!ye.audioCodec||Fe(ye.audioCodec,"audio")})),u.subtitles&&H(S=u.subtitles),p.length>0){h=p[0].bitrate,p.sort(function(ye,De){return ye.attrs["HDCP-LEVEL"]!==De.attrs["HDCP-LEVEL"]?(ye.attrs["HDCP-LEVEL"]||"")>(De.attrs["HDCP-LEVEL"]||"")?1:-1:ye.bitrate!==De.bitrate?ye.bitrate-De.bitrate:ye.attrs.SCORE!==De.attrs.SCORE?ye.attrs.decimalFloatingPoint("SCORE")-De.attrs.decimalFloatingPoint("SCORE"):x&&ye.height!==De.height?ye.height-De.height:0}),this._levels=p;for(var ee=0;ee<p.length;ee++)if(p[ee].bitrate===h){this._firstLevel=ee,this.log("manifest loaded, "+p.length+" level(s) found, first bitrate: "+h);break}var me=K&&!W,Ie={levels:p,audioTracks:_,subtitleTracks:S,sessionData:u.sessionData,sessionKeys:u.sessionKeys,firstLevel:this._firstLevel,stats:u.stats,audio:K,video:W,altAudio:!me&&_.some(function(ye){return!!ye.url})};this.hls.trigger(b.Events.MANIFEST_PARSED,Ie),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:u.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(n,u){var h,f;if(m.prototype.onError.call(this,n,u),!u.fatal){var p=u.context,_=this._levels[this.currentLevelIndex];if(p&&(p.type===Te.PlaylistContextType.AUDIO_TRACK&&_.audioGroupIds&&p.groupId===_.audioGroupIds[_.urlId]||p.type===Te.PlaylistContextType.SUBTITLE_TRACK&&_.textGroupIds&&p.groupId===_.textGroupIds[_.urlId]))this.redundantFailover(this.currentLevelIndex);else{var S,C=!1,x=!0;switch(u.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(u.frag){var W=u.frag.type===Te.PlaylistLevelType.MAIN?u.frag.level:this.currentLevelIndex,K=this._levels[W];K?(K.fragmentError++,K.fragmentError>this.hls.config.fragLoadingMaxRetry&&(S=W)):S=W}break;case P.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var ee=_.attrs["HDCP-LEVEL"];ee&&(this.hls.maxHdcpLevel=Fi[Fi.indexOf(ee)-1],this.warn('Restricting playback to HDCP-LEVEL of "'+this.hls.maxHdcpLevel+'" or lower'));case P.ErrorDetails.FRAG_PARSING_ERROR:case P.ErrorDetails.KEY_SYSTEM_NO_SESSION:S=((h=u.frag)===null||h===void 0?void 0:h.type)===Te.PlaylistLevelType.MAIN?u.frag.level:this.currentLevelIndex,u.levelRetry=!1;break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:p&&(p.deliveryDirectives&&(x=!1),S=p.level),C=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:S=(f=u.level)!=null?f:this.currentLevelIndex,C=!0}S!==void 0&&this.recoverLevel(u,S,C,x)}}},l.recoverLevel=function(n,u,h,f){var p=n.details,_=this._levels[u];if(_.loadError++,h){if(!this.retryLoadingOrFail(n))return void(this.currentLevelIndex=-1);n.levelRetry=!0}if(f){var S=_.url.length;if(S>1&&_.loadError<S)n.levelRetry=!0,this.redundantFailover(u);else if(this.manualLevelIndex===-1){for(var C=-1,x=this._levels,W=x.length;W--;){var K=(W+this.currentLevelIndex)%x.length;if(K!==this.currentLevelIndex&&x[K].loadError===0){C=K;break}}C>-1&&this.currentLevelIndex!==C?(this.warn(p+": switch to "+C),n.levelRetry=!0,this.hls.nextAutoLevel=C):n.levelRetry===!1&&(n.fatal=!0)}}},l.redundantFailover=function(n){var u=this._levels[n],h=u.url.length;if(h>1){var f=(u.urlId+1)%h;this.warn("Switching to redundant URL-id "+f),this._levels.forEach(function(p){p.urlId=f}),this.level=n}},l.onFragLoaded=function(n,u){var h=u.frag;if(h!==void 0&&h.type===Te.PlaylistLevelType.MAIN){var f=this._levels[h.level];f!==void 0&&(f.fragmentError=0,f.loadError=0)}},l.onLevelLoaded=function(n,u){var h,f,p=u.level,_=u.details,S=this._levels[p];if(!S)return this.warn("Invalid level index "+p),void((f=u.deliveryDirectives)!==null&&f!==void 0&&f.skip&&(_.deltaUpdateFailed=!0));p===this.currentLevelIndex?(S.fragmentError===0&&(S.loadError=0,this.retryCount=0),this.playlistLoaded(p,u,S.details)):(h=u.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(_.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(n,u){var h=this.hls.levels[this.currentLevelIndex];if(h&&h.audioGroupIds){for(var f=-1,p=this.hls.audioTracks[u.id].groupId,_=0;_<h.audioGroupIds.length;_++)if(h.audioGroupIds[_]===p){f=_;break}f!==h.urlId&&(h.urlId=f,this.startLoad())}},l.loadPlaylist=function(n){m.prototype.loadPlaylist.call(this);var u=this.currentLevelIndex,h=this._levels[u];if(this.canLoad&&h&&h.url.length>0){var f=h.urlId,p=h.url[f];if(n)try{p=n.addDirectives(p)}catch(_){this.warn("Could not construct new URL with HLS Delivery Directives: "+_)}this.log("Attempt loading level index "+u+(n?" at sn "+n.msn+" part "+n.part:"")+" with URL-id "+f+" "+p),this.clearTimer(),this.hls.trigger(b.Events.LEVEL_LOADING,{url:p,level:u,id:f,deliveryDirectives:n||null})}},l.removeLevel=function(n,u){var h=function(p,_){return _!==u},f=this._levels.filter(function(p,_){return _!==n||p.url.length>1&&u!==void 0&&(p.url=p.url.filter(h),p.audioGroupIds&&(p.audioGroupIds=p.audioGroupIds.filter(h)),p.textGroupIds&&(p.textGroupIds=p.textGroupIds.filter(h)),p.urlId=0,!0)}).map(function(p,_){var S=p.details;return S!=null&&S.fragments&&S.fragments.forEach(function(C){C.level=_}),p});this._levels=f,this.hls.trigger(b.Events.LEVELS_UPDATED,{levels:f})},s=i,(o=[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(n){var u,h=this._levels;if(h.length!==0&&(this.currentLevelIndex!==n||(u=h[n])===null||u===void 0||!u.details)){if(n<0||n>=h.length){var f=n<0;if(this.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:n,fatal:f,reason:"invalid level idx"}),f)return;n=Math.min(n,h.length-1)}this.clearTimer();var p=this.currentLevelIndex,_=h[p],S=h[n];this.log("switching to level "+n+" from "+p),this.currentLevelIndex=n;var C=Oe({},S,{level:n,maxBitrate:S.maxBitrate,uri:S.uri,urlId:S.urlId});delete C._urlId,this.hls.trigger(b.Events.LEVEL_SWITCHING,C);var x=S.details;if(!x||x.live){var W=this.switchParams(S.uri,_==null?void 0:_.details);this.loadPlaylist(W)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(n){this.manualLevelIndex=n,this._startLevel===void 0&&(this._startLevel=n),n!==-1&&(this.level=n)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(n){this._firstLevel=n}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var n=this.hls.config.startLevel;return n!==void 0?n:this._firstLevel}return this._startLevel},set:function(n){this._startLevel=n}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(n){this.level=n,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=n)}}])&&Ke(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),i}(Ce);(function(m){m.NOT_LOADED="NOT_LOADED",m.APPENDING="APPENDING",m.PARTIAL="PARTIAL",m.OK="OK"})(We||(We={}));var Ot=function(){function m(e){this.activeFragment=null,this.activeParts=null,this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=e,this._registerListeners()}var c=m.prototype;return c._registerListeners=function(){var e=this.hls;e.on(b.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(b.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(b.Events.FRAG_LOADED,this.onFragLoaded,this)},c._unregisterListeners=function(){var e=this.hls;e.off(b.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(b.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(b.Events.FRAG_LOADED,this.onFragLoaded,this)},c.destroy=function(){this._unregisterListeners(),this.fragments=this.endListFragments=this.timeRanges=this.activeFragment=this.activeParts=null},c.getAppendedFrag=function(e,i){if(i===Te.PlaylistLevelType.MAIN){var s=this.activeFragment,o=this.activeParts;if(!s)return null;if(o)for(var l=o.length;l--;){var n=o[l],u=n?n.end:s.appendedPTS;if(n.start<=e&&u!==void 0&&e<=u)return l>9&&(this.activeParts=o.slice(l-9)),n}else if(s.start<=e&&s.appendedPTS!==void 0&&e<=s.appendedPTS)return s}return this.getBufferedFrag(e,i)},c.getBufferedFrag=function(e,i){for(var s=this.fragments,o=Object.keys(s),l=o.length;l--;){var n=s[o[l]];if((n==null?void 0:n.body.type)===i&&n.buffered){var u=n.body;if(u.start<=e&&e<=u.end)return u}}return null},c.detectEvictedFragments=function(e,i,s){var o=this;this.timeRanges&&(this.timeRanges[e]=i),Object.keys(this.fragments).forEach(function(l){var n=o.fragments[l];if(n)if(n.buffered||n.loaded){var u=n.range[e];u&&u.time.some(function(h){var f=!o.isTimeBuffered(h.startPTS,h.endPTS,i);return f&&o.removeFragment(n.body),f})}else n.body.type===s&&o.removeFragment(n.body)})},c.detectPartialFragments=function(e){var i=this,s=this.timeRanges,o=e.frag,l=e.part;if(s&&o.sn!=="initSegment"){var n=Ht(o),u=this.fragments[n];u&&(Object.keys(s).forEach(function(h){var f=o.elementaryStreams[h];if(f){var p=s[h],_=l!==null||f.partial===!0;u.range[h]=i.getBufferedTimes(o,l,_,p)}}),u.loaded=null,Object.keys(u.range).length?(u.buffered=!0,u.body.endList&&(this.endListFragments[u.body.type]=u)):this.removeFragment(u.body))}},c.fragBuffered=function(e){var i=Ht(e),s=this.fragments[i];s&&(s.loaded=null,s.buffered=!0)},c.getBufferedTimes=function(e,i,s,o){for(var l={time:[],partial:s},n=i?i.start:e.start,u=i?i.end:e.end,h=e.minEndPTS||u,f=e.maxStartPTS||n,p=0;p<o.length;p++){var _=o.start(p)-this.bufferPadding,S=o.end(p)+this.bufferPadding;if(f>=_&&h<=S){l.time.push({startPTS:Math.max(n,o.start(p)),endPTS:Math.min(u,o.end(p))});break}if(n<S&&u>_)l.partial=!0,l.time.push({startPTS:Math.max(n,o.start(p)),endPTS:Math.min(u,o.end(p))});else if(u<=_)break}return l},c.getPartialFragment=function(e){var i,s,o,l=null,n=0,u=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(f){var p=h[f];p&&Ze(p)&&(s=p.body.start-u,o=p.body.end+u,e>=s&&e<=o&&(i=Math.min(e-s,o-e),n<=i&&(l=p.body,n=i)))}),l},c.isEndListAppended=function(e){var i=this.endListFragments[e];return i!==void 0&&(i.buffered||Ze(i))},c.getState=function(e){var i=Ht(e),s=this.fragments[i];return s?s.buffered?Ze(s)?We.PARTIAL:We.OK:We.APPENDING:We.NOT_LOADED},c.isTimeBuffered=function(e,i,s){for(var o,l,n=0;n<s.length;n++){if(o=s.start(n)-this.bufferPadding,l=s.end(n)+this.bufferPadding,e>=o&&i<=l)return!0;if(i<=o)return!1}return!1},c.onFragLoaded=function(e,i){var s=i.frag,o=i.part;if(s.sn!=="initSegment"&&!s.bitrateTest&&!o){var l=Ht(s);this.fragments[l]={body:s,loaded:i,buffered:!1,range:Object.create(null)}}},c.onBufferAppended=function(e,i){var s=this,o=i.frag,l=i.part,n=i.timeRanges;if(o.type===Te.PlaylistLevelType.MAIN)if(this.activeFragment!==o&&(this.activeFragment=o,o.appendedPTS=void 0),l){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(l)}else this.activeParts=null;this.timeRanges=n,Object.keys(n).forEach(function(h){var f=n[h];if(s.detectEvictedFragments(h,f),!l&&o.type===Te.PlaylistLevelType.MAIN){var p=o.elementaryStreams[h];if(!p)return;for(var _=0;_<f.length;_++){var S=f.end(_);S<=p.endPTS&&S>p.startPTS?o.appendedPTS=Math.max(S,o.appendedPTS||0):o.appendedPTS=p.endPTS}}})},c.onFragBuffered=function(e,i){this.detectPartialFragments(i)},c.hasFragment=function(e){var i=Ht(e);return!!this.fragments[i]},c.removeFragmentsInRange=function(e,i,s){var o=this;Object.keys(this.fragments).forEach(function(l){var n=o.fragments[l];if(n&&n.buffered){var u=n.body;u.type===s&&u.start<i&&u.end>e&&o.removeFragment(u)}})},c.removeFragment=function(e){var i=Ht(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),e.appendedPTS=void 0,delete this.fragments[i],e.endList&&delete this.endListFragments[e.type]},c.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activeFragment=null,this.activeParts=null},m}();function Ze(m){var c,e;return m.buffered&&(((c=m.range.video)===null||c===void 0?void 0:c.partial)||((e=m.range.audio)===null||e===void 0?void 0:e.partial))}function Ht(m){return m.type+"_"+m.level+"_"+m.urlId+"_"+m.sn}function gi(m){var c=typeof Map=="function"?new Map:void 0;return gi=function(e){if(e===null||(i=e,Function.toString.call(i).indexOf("[native code]")===-1))return e;var i;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(c!==void 0){if(c.has(e))return c.get(e);c.set(e,s)}function s(){return Yt(e,arguments,ut(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),Xt(s,e)},gi(m)}function Yt(m,c,e){return Yt=jt()?Reflect.construct.bind():function(i,s,o){var l=[null];l.push.apply(l,s);var n=new(Function.bind.apply(i,l));return o&&Xt(n,o.prototype),n},Yt.apply(null,arguments)}function jt(){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 Xt(m,c){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},Xt(m,c)}function ut(m){return ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(c){return c.__proto__||Object.getPrototypeOf(c)},ut(m)}var Li=Math.pow(2,17),tr=function(){function m(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var c=m.prototype;return c.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},c.abort=function(){this.loader&&this.loader.abort()},c.load=function(e,i){var s=this,o=e.url;if(!o)return Promise.reject(new di({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(o?"part list":"url")));this.abort();var l=this.config,n=l.fLoader,u=l.loader;return new Promise(function(h,f){s.loader&&s.loader.destroy();var p=s.loader=e.loader=n?new n(l):new u(l),_=zt(e),S={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:e.sn==="initSegment"?1/0:Li};e.stats=p.stats,p.load(_,S,{onSuccess:function(C,x,W,K){s.resetLoader(e,p);var ee=C.data;W.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(ee.slice(0,16)),ee=ee.slice(16)),h({frag:e,part:null,payload:ee,networkDetails:K})},onError:function(C,x,W){s.resetLoader(e,p),f(new di({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:C,networkDetails:W}))},onAbort:function(C,x,W){s.resetLoader(e,p),f(new di({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:W}))},onTimeout:function(C,x,W){s.resetLoader(e,p),f(new di({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:W}))},onProgress:function(C,x,W,K){i&&i({frag:e,part:null,payload:W,networkDetails:K})}})})},c.loadPart=function(e,i,s){var o=this;this.abort();var l=this.config,n=l.fLoader,u=l.loader;return new Promise(function(h,f){o.loader&&o.loader.destroy();var p=o.loader=e.loader=n?new n(l):new u(l),_=zt(e,i),S={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:Li};i.stats=p.stats,p.load(_,S,{onSuccess:function(C,x,W,K){o.resetLoader(e,p),o.updateStatsFromPart(e,i);var ee={frag:e,part:i,payload:C.data,networkDetails:K};s(ee),h(ee)},onError:function(C,x,W){o.resetLoader(e,p),f(new di({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:i,response:C,networkDetails:W}))},onAbort:function(C,x,W){e.stats.aborted=i.stats.aborted,o.resetLoader(e,p),f(new di({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:i,networkDetails:W}))},onTimeout:function(C,x,W){o.resetLoader(e,p),f(new di({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:i,networkDetails:W}))}})})},c.updateStatsFromPart=function(e,i){var s=e.stats,o=i.stats,l=o.total;if(s.loaded+=o.loaded,l){var n=Math.round(e.duration/i.duration),u=Math.min(Math.round(s.loaded/l),n),h=(n-u)*Math.round(s.loaded/u);s.total=s.loaded+h}else s.total=Math.max(s.loaded,s.total);var f=s.loading,p=o.loading;f.start?f.first+=p.first-p.start:(f.start=p.start,f.first=p.first),f.end=p.end},c.resetLoader=function(e,i){e.loader=null,this.loader===i&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),i.destroy()},m}();function zt(m,c){c===void 0&&(c=null);var e=c||m,i={frag:m,part:c,responseType:"arraybuffer",url:e.url,headers:{},rangeStart:0,rangeEnd:0},s=e.byteRangeStartOffset,o=e.byteRangeEndOffset;if((0,R.isFiniteNumber)(s)&&(0,R.isFiniteNumber)(o)){var l,n=s,u=o;if(m.sn==="initSegment"&&((l=m.decryptdata)===null||l===void 0?void 0:l.method)==="AES-128"){var h=o-s;h%16&&(u=o+(16-h%16)),s!==0&&(i.resetIV=!0,n=s-16)}i.rangeStart=n,i.rangeEnd=u}return i}var di=function(m){var c,e;function i(s){for(var o,l=arguments.length,n=new Array(l>1?l-1:0),u=1;u<l;u++)n[u-1]=arguments[u];return(o=m.call.apply(m,[this].concat(n))||this).data=void 0,o.data=s,o}return e=m,(c=i).prototype=Object.create(e.prototype),c.prototype.constructor=c,Xt(c,e),i}(gi(Error)),Vi=function(){function m(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var c=m.prototype;return c.abort=function(){for(var e in this.keyUriToKeyInfo){var i=this.keyUriToKeyInfo[e].loader;i&&i.abort()}},c.detach=function(){for(var e in this.keyUriToKeyInfo){var i=this.keyUriToKeyInfo[e];(i.mediaKeySessionContext||i.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},c.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var i=this.keyUriToKeyInfo[e].loader;i&&i.destroy()}this.keyUriToKeyInfo={}},c.createKeyLoadError=function(e,i,s,o){return i===void 0&&(i=P.ErrorDetails.KEY_LOAD_ERROR),new di({type:P.ErrorTypes.NETWORK_ERROR,details:i,fatal:!1,frag:e,networkDetails:s})},c.loadClear=function(e,i){var s=this;if(this.emeController&&this.config.emeEnabled)for(var o=e.sn,l=e.cc,n=function(h){var f=i[h];if(l<=f.cc&&(o==="initSegment"||o<f.sn))return s.emeController.selectKeySystemFormat(f).then(function(p){f.setKeyFormat(p)}),"break"},u=0;u<i.length&&n(u)!=="break";u++);},c.load=function(e){var i=this;return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(function(s){return i.loadInternal(e,s)}):this.loadInternal(e)},c.loadInternal=function(e,i){var s,o;i&&e.setKeyFormat(i);var l=e.decryptdata;if(!l){var n=i?"Expected frag.decryptdata to be defined after setting format "+i:"Missing decryption data on fragment in onKeyLoading";return Promise.reject(this.createKeyLoadError(e,P.ErrorDetails.KEY_LOAD_ERROR,null,n))}var u=l.uri;if(!u)return Promise.reject(this.createKeyLoadError(e,P.ErrorDetails.KEY_LOAD_ERROR,null,'Invalid key URI: "'+u+'"'));var h,f=this.keyUriToKeyInfo[u];if((s=f)!==null&&s!==void 0&&s.decryptdata.key)return l.key=f.decryptdata.key,Promise.resolve({frag:e,keyInfo:f});if((o=f)!==null&&o!==void 0&&o.keyLoadPromise)switch((h=f.mediaKeySessionContext)===null||h===void 0?void 0:h.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return f.keyLoadPromise}switch(f=this.keyUriToKeyInfo[u]={decryptdata:l,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},l.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return l.keyFormat==="identity"?this.loadKeyHTTP(f,e):this.loadKeyEME(f,e);case"AES-128":return this.loadKeyHTTP(f,e);default:return Promise.reject(this.createKeyLoadError(e,P.ErrorDetails.KEY_LOAD_ERROR,null,'Key supplied with unsupported METHOD: "'+l.method+'"'))}},c.loadKeyEME=function(e,i){var s={frag:i,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var o=this.emeController.loadKey(s);if(o)return(e.keyLoadPromise=o.then(function(l){return e.mediaKeySessionContext=l,s})).catch(function(l){throw e.keyLoadPromise=null,l})}return Promise.resolve(s)},c.loadKeyHTTP=function(e,i){var s=this,o=this.config,l=new o.loader(o);return i.keyLoader=e.loader=l,e.keyLoadPromise=new Promise(function(n,u){var h={keyInfo:e,frag:i,responseType:"arraybuffer",url:e.decryptdata.uri},f={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:function(_,S,C,x){var W=C.frag,K=C.keyInfo,ee=C.url;if(!W.decryptdata||K!==s.keyUriToKeyInfo[ee])return u(s.createKeyLoadError(W,P.ErrorDetails.KEY_LOAD_ERROR,x,"after key load, decryptdata unset or changed"));K.decryptdata.key=W.decryptdata.key=new Uint8Array(_.data),W.keyLoader=null,K.loader=null,n({frag:W,keyInfo:K})},onError:function(_,S,C){s.resetLoader(S),u(s.createKeyLoadError(i,P.ErrorDetails.KEY_LOAD_ERROR,C))},onTimeout:function(_,S,C){s.resetLoader(S),u(s.createKeyLoadError(i,P.ErrorDetails.KEY_LOAD_TIMEOUT,C))},onAbort:function(_,S,C){s.resetLoader(S),u(s.createKeyLoadError(i,P.ErrorDetails.INTERNAL_ABORTED,C))}};l.load(h,f,p)})},c.resetLoader=function(e){var i=e.frag,s=e.keyInfo,o=e.url,l=s.loader;i.keyLoader===l&&(i.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[o],l&&l.destroy()},m}(),gr=function(){function m(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var c=m.prototype;return c.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},c.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},c.onHandlerDestroyed=function(){},c.hasInterval=function(){return!!this._tickInterval},c.hasNextTick=function(){return!!this._tickTimer},c.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},c.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},c.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},c.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},c.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},c.doTick=function(){},m}(),Bi={length:0,start:function(){return 0},end:function(){return 0}},$t=function(){function m(){}return m.isBuffered=function(c,e){try{if(c){for(var i=m.getBuffered(c),s=0;s<i.length;s++)if(e>=i.start(s)&&e<=i.end(s))return!0}}catch{}return!1},m.bufferInfo=function(c,e,i){try{if(c){var s,o=m.getBuffered(c),l=[];for(s=0;s<o.length;s++)l.push({start:o.start(s),end:o.end(s)});return this.bufferedInfo(l,e,i)}}catch{}return{len:0,start:e,end:e,nextStart:void 0}},m.bufferedInfo=function(c,e,i){e=Math.max(0,e),c.sort(function(x,W){return x.start-W.start||W.end-x.end});var s=[];if(i)for(var o=0;o<c.length;o++){var l=s.length;if(l){var n=s[l-1].end;c[o].start-n<i?c[o].end>n&&(s[l-1].end=c[o].end):s.push(c[o])}else s.push(c[o])}else s=c;for(var u,h=0,f=e,p=e,_=0;_<s.length;_++){var S=s[_].start,C=s[_].end;if(e+i>=S&&e<C)f=S,h=(p=C)-e;else if(e+i<S){u=S;break}}return{len:h,start:f||0,end:p||0,nextStart:u}},m.getBuffered=function(c){try{return c.buffered}catch(e){return O.logger.log("failed to get media.buffered",e),Bi}},m}(),xn=function(m,c,e,i,s,o){i===void 0&&(i=0),s===void 0&&(s=-1),o===void 0&&(o=!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={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=m,this.sn=c,this.id=e,this.size=i,this.part=s,this.partial=o};function Gs(m,c){for(var e=null,i=0,s=m.length;i<s;i++){var o=m[i];if(o&&o.cc===c){e=o;break}}return e}function ir(m,c){if(m){var e=m.start+c;m.start=m.startPTS=e,m.endPTS=e+m.duration}}function qa(m,c){for(var e=c.fragments,i=0,s=e.length;i<s;i++)ir(e[i],m);c.fragmentHint&&ir(c.fragmentHint,m),c.alignedSliding=!0}function Vs(m,c){if(m.hasProgramDateTime&&c.hasProgramDateTime){var e=m.fragments,i=c.fragments;if(e.length&&i.length){var s=i[Math.round(i.length/2)-1],o=Gs(e,s.cc)||e[Math.round(e.length/2)-1],l=s.programDateTime,n=o.programDateTime;l!==null&&n!==null&&qa((n-l)/1e3-(o.start-s.start),m)}}}let Ws=function(m,c){for(var e=0,i=m.length-1,s=null,o=null;e<=i;){var l=c(o=m[s=(e+i)/2|0]);if(l>0)e=s+1;else{if(!(l<0))return o;i=s-1}}return null};function Ya(m,c,e,i){e===void 0&&(e=0),i===void 0&&(i=0);var s=null;if(m?s=c[m.sn-c[0].sn+1]||null:e===0&&c[0].start===0&&(s=c[0]),s&&$a(e,i,s)===0)return s;var o=Ws(c,$a.bind(null,e,i));return!o||o===m&&s?s:o}function $a(m,c,e){if(m===void 0&&(m=0),c===void 0&&(c=0),e.start<=m&&e.start+e.duration>m)return 0;var i=Math.min(c,e.duration+(e.deltaPTS?e.deltaPTS:0));return e.start+e.duration-i<=m?1:e.start-i>m&&e.start?-1:0}function Kr(m,c,e){var i=1e3*Math.min(c,e.duration+(e.deltaPTS?e.deltaPTS:0));return(e.endProgramDateTime||0)-i>m}var pa=E(21);let yl=function(m){for(var c="",e=m.length,i=0;i<e;i++)c+="["+m.start(i).toFixed(3)+","+m.end(i).toFixed(3)+"]";return c};function js(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}function Gr(m,c){return Gr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},Gr(m,c)}var Xi="STOPPED",Ct="IDLE",qs="KEY_LOADING",Vr="FRAG_LOADING",Ar="FRAG_LOADING_WAITING_RETRY",za="WAITING_TRACK",rr="PARSING",Wr="PARSED",va="ENDED",lr="ERROR",Sr="WAITING_INIT_PTS",jr="WAITING_LEVEL",Qa=function(m){var c,e;function i(n,u,h,f){var p;return(p=m.call(this)||this).hls=void 0,p.fragPrevious=null,p.fragCurrent=null,p.fragmentTracker=void 0,p.transmuxer=null,p._state=Xi,p.media=null,p.mediaBuffer=null,p.config=void 0,p.bitrateTest=!1,p.lastCurrentTime=0,p.nextLoadPosition=0,p.startPosition=0,p.loadedmetadata=!1,p.fragLoadError=0,p.retryDate=0,p.levels=null,p.fragmentLoader=void 0,p.keyLoader=void 0,p.levelLastLoaded=null,p.startFragRequested=!1,p.decrypter=void 0,p.initPTS=[],p.onvseeking=null,p.onvended=null,p.logPrefix="",p.log=void 0,p.warn=void 0,p.logPrefix=f,p.log=O.logger.log.bind(O.logger,f+":"),p.warn=O.logger.warn.bind(O.logger,f+":"),p.hls=n,p.fragmentLoader=new tr(n.config),p.keyLoader=h,p.fragmentTracker=u,p.config=n.config,p.decrypter=new pa.default(n.config),n.on(b.Events.LEVEL_SWITCHING,p.onLevelSwitching,function(_){if(_===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _}(p)),p}e=m,(c=i).prototype=Object.create(e.prototype),c.prototype.constructor=c,Gr(c,e);var s,o,l=i.prototype;return l.doTick=function(){this.onTickEnd()},l.onTickEnd=function(){},l.startLoad=function(n){},l.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort();var n=this.fragCurrent;n&&(n.abortRequests(),this.fragmentTracker.removeFragment(n)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Xi},l._streamEnded=function(n,u){if(u.live||n.nextStart||!n.end||!this.media)return!1;var h=u.partList;if(h!=null&&h.length){var f=h[h.length-1];return $t.isBuffered(this.media,f.start+f.duration/2)}var p=u.fragments[u.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(p)},l.getLevelDetails=function(){var n;if(this.levels&&this.levelLastLoaded!==null)return(n=this.levels[this.levelLastLoaded])===null||n===void 0?void 0:n.details},l.onMediaAttached=function(n,u){var h=this.media=this.mediaBuffer=u.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),h.addEventListener("seeking",this.onvseeking),h.addEventListener("ended",this.onvended);var f=this.config;this.levels&&f.autoStartLoad&&this.state===Xi&&this.startLoad(f.startPosition)},l.onMediaDetaching=function(){var n=this.media;n!=null&&n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),n&&this.onvseeking&&this.onvended&&(n.removeEventListener("seeking",this.onvseeking),n.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},l.onMediaSeeking=function(){var n=this.config,u=this.fragCurrent,h=this.media,f=this.mediaBuffer,p=this.state,_=h?h.currentTime:0,S=$t.bufferInfo(f||h,_,n.maxBufferHole);if(this.log("media seeking to "+((0,R.isFiniteNumber)(_)?_.toFixed(3):_)+", state: "+p),this.state===va)this.resetLoadingState();else if(u){var C=n.maxFragLookUpTolerance,x=u.start-C,W=u.start+u.duration+C;if(!S.len||W<S.start||x>S.end){var K=_>W;(_<x||K)&&(K&&u.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),u.abortRequests()),this.resetLoadingState())}}h&&(this.lastCurrentTime=_),this.loadedmetadata||S.len||(this.nextLoadPosition=this.startPosition=_),this.tickImmediate()},l.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},l.onLevelSwitching=function(n,u){this.fragLoadError=0},l.onHandlerDestroying=function(){this.stopLoad(),m.prototype.onHandlerDestroying.call(this)},l.onHandlerDestroyed=function(){this.state=Xi,this.hls.off(b.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,m.prototype.onHandlerDestroyed.call(this)},l.loadFragment=function(n,u,h){this._loadFragForPlayback(n,u,h)},l._loadFragForPlayback=function(n,u,h){var f=this;this._doFragLoad(n,u,h,function(p){if(f.fragContextChanged(n))return f.warn("Fragment "+n.sn+(p.part?" p: "+p.part.index:"")+" of level "+n.level+" was dropped during download."),void f.fragmentTracker.removeFragment(n);n.stats.chunkCount++,f._handleFragmentLoadProgress(p)}).then(function(p){if(p){f.fragLoadError=0;var _=f.state;f.fragContextChanged(n)?(_===Vr||!f.fragCurrent&&_===rr)&&(f.fragmentTracker.removeFragment(n),f.state=Ct):("payload"in p&&(f.log("Loaded fragment "+n.sn+" of level "+n.level),f.hls.trigger(b.Events.FRAG_LOADED,p)),f._handleFragmentLoadComplete(p))}}).catch(function(p){f.state!==Xi&&f.state!==lr&&(f.warn(p),f.resetFragmentLoading(n))})},l.flushMainBuffer=function(n,u,h){if(h===void 0&&(h=null),n-u){var f={startOffset:n,endOffset:u,type:h};this.fragLoadError=0,this.hls.trigger(b.Events.BUFFER_FLUSHING,f)}},l._loadInitSegment=function(n,u){var h=this;this._doFragLoad(n,u).then(function(f){if(!f||h.fragContextChanged(n)||!h.levels)throw new Error("init load aborted");return f}).then(function(f){var p=h.hls,_=f.payload,S=n.decryptdata;if(_&&_.byteLength>0&&S&&S.key&&S.iv&&S.method==="AES-128"){var C=self.performance.now();return h.decrypter.decrypt(new Uint8Array(_),S.key.buffer,S.iv.buffer).then(function(x){var W=self.performance.now();return p.trigger(b.Events.FRAG_DECRYPTED,{frag:n,payload:x,stats:{tstart:C,tdecrypt:W}}),f.payload=x,f})}return f}).then(function(f){var p=h.fragCurrent,_=h.hls,S=h.levels;if(!S)throw new Error("init load aborted, missing levels");S[n.level].details;var C=n.stats;h.state=Ct,h.fragLoadError=0,n.data=new Uint8Array(f.payload),C.parsing.start=C.buffering.start=self.performance.now(),C.parsing.end=C.buffering.end=self.performance.now(),f.frag===p&&_.trigger(b.Events.FRAG_BUFFERED,{stats:C,frag:p,part:null,id:n.type}),h.tick()}).catch(function(f){h.state!==Xi&&h.state!==lr&&(h.warn(f),h.resetFragmentLoading(n))})},l.fragContextChanged=function(n){var u=this.fragCurrent;return!n||!u||n.level!==u.level||n.sn!==u.sn||n.urlId!==u.urlId},l.fragBufferedComplete=function(n,u){var h,f,p=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+n.type+" sn: "+n.sn+(u?" part: "+u.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+n.level+" "+(p?yl($t.getBuffered(p)):"(detached)")),this.state=Ct,p&&(!this.loadedmetadata&&n.type==Te.PlaylistLevelType.MAIN&&p.buffered.length&&((h=this.fragCurrent)===null||h===void 0?void 0:h.sn)===((f=this.fragPrevious)===null||f===void 0?void 0:f.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},l.seekToStartPos=function(){},l._handleFragmentLoadComplete=function(n){var u=this.transmuxer;if(u){var h=n.frag,f=n.part,p=n.partsLoaded,_=!p||p.length===0||p.some(function(C){return!C}),S=new xn(h.level,h.sn,h.stats.chunkCount+1,0,f?f.index:-1,!_);u.flush(S)}},l._handleFragmentLoadProgress=function(n){},l._doFragLoad=function(n,u,h,f){var p,_=this;if(h===void 0&&(h=null),!this.levels)throw new Error("frag load aborted, missing levels");var S=null;if(!n.encrypted||(p=n.decryptdata)!==null&&p!==void 0&&p.key?!n.encrypted&&u.encryptedFragments.length&&this.keyLoader.loadClear(n,u.encryptedFragments):(this.log("Loading key for "+n.sn+" of ["+u.startSN+"-"+u.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+n.level),this.state=qs,this.fragCurrent=n,S=this.keyLoader.load(n).then(function(ee){if(!_.fragContextChanged(ee.frag))return _.hls.trigger(b.Events.KEY_LOADED,ee),ee}),this.hls.trigger(b.Events.KEY_LOADING,{frag:n}),this.throwIfFragContextChanged("KEY_LOADING")),h=Math.max(n.start,h||0),this.config.lowLatencyMode&&u){var C=u.partList;if(C&&f){h>n.end&&u.fragmentHint&&(n=u.fragmentHint);var x=this.getNextPart(C,n,h);if(x>-1){var W=C[x];return this.log("Loading part sn: "+n.sn+" p: "+W.index+" cc: "+n.cc+" of playlist ["+u.startSN+"-"+u.endSN+"] parts [0-"+x+"-"+(C.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+n.level+", target: "+parseFloat(h.toFixed(3))),this.nextLoadPosition=W.start+W.duration,this.state=Vr,this.hls.trigger(b.Events.FRAG_LOADING,{frag:n,part:C[x],targetBufferTime:h}),this.throwIfFragContextChanged("FRAG_LOADING parts"),S?S.then(function(ee){return!ee||_.fragContextChanged(ee.frag)?null:_.doFragPartsLoad(n,C,x,f)}).catch(function(ee){return _.handleFragLoadError(ee)}):this.doFragPartsLoad(n,C,x,f).catch(function(ee){return _.handleFragLoadError(ee)})}if(!n.url||this.loadedEndOfParts(C,h))return Promise.resolve(null)}}this.log("Loading fragment "+n.sn+" cc: "+n.cc+" "+(u?"of ["+u.startSN+"-"+u.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+n.level+", target: "+parseFloat(h.toFixed(3))),(0,R.isFiniteNumber)(n.sn)&&!this.bitrateTest&&(this.nextLoadPosition=n.start+n.duration),this.state=Vr,this.hls.trigger(b.Events.FRAG_LOADING,{frag:n,targetBufferTime:h}),this.throwIfFragContextChanged("FRAG_LOADING");var K=this.config.progressive;return K&&S?S.then(function(ee){return!ee||_.fragContextChanged(ee==null?void 0:ee.frag)?null:_.fragmentLoader.load(n,f)}).catch(function(ee){return _.handleFragLoadError(ee)}):Promise.all([this.fragmentLoader.load(n,K?f:void 0),S]).then(function(ee){var me=ee[0];return!K&&me&&f&&f(me),me}).catch(function(ee){return _.handleFragLoadError(ee)})},l.throwIfFragContextChanged=function(n){if(this.fragCurrent===null)throw new Error("frag load aborted, context changed in "+n)},l.doFragPartsLoad=function(n,u,h,f){var p=this;return new Promise(function(_,S){var C=[];(function x(W){var K=u[W];p.fragmentLoader.loadPart(n,K,f).then(function(ee){C[K.index]=ee;var me=ee.part;p.hls.trigger(b.Events.FRAG_LOADED,ee);var Ie=u[W+1];if(!Ie||Ie.fragment!==n)return _({frag:n,part:me,partsLoaded:C});x(W+1)}).catch(S)})(h)})},l.handleFragLoadError=function(n){if("data"in n){var u=n.data;n.data&&u.details===P.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(u.frag,u.part):this.hls.trigger(b.Events.ERROR,u)}else this.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,err:n,fatal:!0});return null},l._handleTransmuxerFlush=function(n){var u=this.getCurrentContext(n);if(u&&this.state===rr){var h=u.frag,f=u.part,p=u.level,_=self.performance.now();h.stats.parsing.end=_,f&&(f.stats.parsing.end=_),this.updateLevelTiming(h,f,p,n.partial)}else this.fragCurrent||this.state===Xi||this.state===lr||(this.state=Ct)},l.getCurrentContext=function(n){var u=this.levels,h=n.level,f=n.sn,p=n.part;if(!u||!u[h])return this.warn("Levels object was unset while buffering fragment "+f+" of level "+h+". The current chunk will not be buffered."),null;var _=u[h],S=p>-1?function(x,W,K){if(!x||!x.details)return null;var ee=x.details.partList;if(ee)for(var me=ee.length;me--;){var Ie=ee[me];if(Ie.index===K&&Ie.fragment.sn===W)return Ie}return null}(_,f,p):null,C=S?S.fragment:function(x,W,K){if(!x||!x.details)return null;var ee=x.details,me=ee.fragments[W-ee.startSN];return me||((me=ee.fragmentHint)&&me.sn===W?me:W<ee.startSN&&K&&K.sn===W?K:null)}(_,f,this.fragCurrent);return C?{frag:C,part:S,level:_}:null},l.bufferFragmentData=function(n,u,h,f){if(n&&this.state===rr){var p=n.data1,_=n.data2,S=p;if(p&&_&&(S=(0,te.appendUint8Array)(p,_)),S&&S.length){var C={type:n.type,frag:u,part:h,chunkMeta:f,parent:u.type,data:S};this.hls.trigger(b.Events.BUFFER_APPENDING,C),n.dropped&&n.independent&&!h&&this.flushBufferGap(u)}}},l.flushBufferGap=function(n){var u=this.media;if(u)if($t.isBuffered(u,u.currentTime)){var h=u.currentTime,f=$t.bufferInfo(u,h,0),p=n.duration,_=Math.min(2*this.config.maxFragLookUpTolerance,.25*p),S=Math.max(Math.min(n.start-_,f.end-_),h+_);n.start-S>_&&this.flushMainBuffer(S,n.start)}else this.flushMainBuffer(0,n.start)},l.getFwdBufferInfo=function(n,u){var h=this.config,f=this.getLoadPosition();if(!(0,R.isFiniteNumber)(f))return null;var p=$t.bufferInfo(n,f,h.maxBufferHole);if(p.len===0&&p.nextStart!==void 0){var _=this.fragmentTracker.getBufferedFrag(f,u);if(_&&p.nextStart<_.end)return $t.bufferInfo(n,f,Math.max(p.nextStart,h.maxBufferHole))}return p},l.getMaxBufferLength=function(n){var u,h=this.config;return u=n?Math.max(8*h.maxBufferSize/n,h.maxBufferLength):h.maxBufferLength,Math.min(u,h.maxMaxBufferLength)},l.reduceMaxBufferLength=function(n){var u=this.config,h=n||u.maxBufferLength;return u.maxMaxBufferLength>=h&&(u.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+u.maxMaxBufferLength+"s"),!0)},l.getNextFragment=function(n,u){var h=u.fragments,f=h.length;if(!f)return null;var p,_=this.config,S=h[0].start;if(u.live){var C=_.initialLiveManifestSize;if(f<C)return this.warn("Not enough fragments to start playback (have: "+f+", need: "+C+")"),null;u.PTSKnown||this.startFragRequested||this.startPosition!==-1||(p=this.getInitialLiveFragment(u,h),this.startPosition=p?this.hls.liveSyncPosition||p.start:n)}else n<=S&&(p=h[0]);if(!p){var x=_.lowLatencyMode?u.partEnd:u.fragmentEnd;p=this.getFragmentAtPosition(n,x,u)}return this.mapToInitFragWhenRequired(p)},l.mapToInitFragWhenRequired=function(n){return n==null||!n.initSegment||n!=null&&n.initSegment.data||this.bitrateTest?n:n.initSegment},l.getNextPart=function(n,u,h){for(var f=-1,p=!1,_=!0,S=0,C=n.length;S<C;S++){var x=n[S];if(_=_&&!x.independent,f>-1&&h<x.start)break;var W=x.loaded;W?f=-1:(p||x.independent||_)&&x.fragment===u&&(f=S),p=W}return f},l.loadedEndOfParts=function(n,u){var h=n[n.length-1];return h&&u>h.start&&h.loaded},l.getInitialLiveFragment=function(n,u){var h=this.fragPrevious,f=null;if(h){if(n.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+h.programDateTime),f=function(C,x,W){if(x===null||!Array.isArray(C)||!C.length||!(0,R.isFiniteNumber)(x)||x<(C[0].programDateTime||0)||x>=(C[C.length-1].endProgramDateTime||0))return null;W=W||0;for(var K=0;K<C.length;++K){var ee=C[K];if(Kr(x,W,ee))return ee}return null}(u,h.endProgramDateTime,this.config.maxFragLookUpTolerance)),!f){var p=h.sn+1;if(p>=n.startSN&&p<=n.endSN){var _=u[p-n.startSN];h.cc===_.cc&&(f=_,this.log("Live playlist, switching playlist, load frag with next SN: "+f.sn))}f||(f=function(C,x){return Ws(C,function(W){return W.cc<x?1:W.cc>x?-1:0})}(u,h.cc),f&&this.log("Live playlist, switching playlist, load frag with same CC: "+f.sn))}}else{var S=this.hls.liveSyncPosition;S!==null&&(f=this.getFragmentAtPosition(S,this.bitrateTest?n.fragmentEnd:n.edge,n))}return f},l.getFragmentAtPosition=function(n,u,h){var f,p=this.config,_=this.fragPrevious,S=h.fragments,C=h.endSN,x=h.fragmentHint,W=p.maxFragLookUpTolerance,K=!!(p.lowLatencyMode&&h.partList&&x);if(K&&x&&!this.bitrateTest&&(S=S.concat(x),C=x.sn),f=n<u?Ya(_,S,n,n>u-W?0:W):S[S.length-1]){var ee=f.sn-h.startSN;if(this.fragmentTracker.getState(f)===We.OK&&(_=f),_&&f.sn===_.sn&&!K&&_&&f.level===_.level){var me=S[ee+1];f.sn<C&&this.fragmentTracker.getState(me)!==We.OK?(this.log("SN "+f.sn+" just loaded, load next one: "+me.sn),f=me):f=null}}return f},l.synchronizeToLiveEdge=function(n){var u=this.config,h=this.media;if(h){var f=this.hls.liveSyncPosition,p=h.currentTime,_=n.fragments[0].start,S=n.edge,C=p>=_-u.maxFragLookUpTolerance&&p<=S;if(f!==null&&h.duration>f&&(p<f||!C)){var x=u.liveMaxLatencyDuration!==void 0?u.liveMaxLatencyDuration:u.liveMaxLatencyDurationCount*n.targetduration;(!C&&h.readyState<4||p<S-x)&&(this.loadedmetadata||(this.nextLoadPosition=f),h.readyState&&(this.warn("Playback: "+p.toFixed(3)+" is located too far from the end of live sliding playlist: "+S+", reset currentTime to : "+f.toFixed(3)),h.currentTime=f))}}},l.alignPlaylists=function(n,u){var h=this.levels,f=this.levelLastLoaded,p=this.fragPrevious,_=f!==null?h[f]:null,S=n.fragments.length;if(!S)return this.warn("No fragments in live playlist"),0;var C=n.fragments[0].start,x=!u,W=n.alignedSliding&&(0,R.isFiniteNumber)(C);if(x||!W&&!C){(function(ee,me,Ie){me&&(function(ye,De,qe){if(function(we,je,Ve){return!(!je.details||!(Ve.endCC>Ve.startCC||we&&we.cc<Ve.startCC))}(ye,qe,De)){var rt=function(we,je,Ve){Ve===void 0&&(Ve=0);var Tt=we.fragments,Wt=je.fragments;if(Wt.length&&Tt.length){var St=Gs(Tt,Wt[0].cc);if(St&&(!St||St.startPTS))return St;O.logger.log("No frag in previous level to align on")}else O.logger.log("No fragments to align")}(qe.details,De);rt&&(0,R.isFiniteNumber)(rt.start)&&(O.logger.log("Adjusting PTS using last level due to CC increase within current level "+De.url),qa(rt.start,De))}}(ee,Ie,me),!Ie.alignedSliding&&me.details&&function(ye,De){if(De.fragments.length&&ye.hasProgramDateTime&&De.hasProgramDateTime){var qe=De.fragments[0].programDateTime,rt=ye.fragments[0].programDateTime,we=(rt-qe)/1e3+De.fragments[0].start;we&&(0,R.isFiniteNumber)(we)&&(O.logger.log("Adjusting PTS using programDateTime delta "+(rt-qe)+"ms, sliding:"+we.toFixed(3)+" "+ye.url+" "),qa(we,ye))}}(Ie,me.details),Ie.alignedSliding||!me.details||Ie.skippedSegments||ae(me.details,Ie))})(p,_,n);var K=n.fragments[0].start;return this.log("Live playlist sliding: "+K.toFixed(2)+" start-sn: "+(u?u.startSN:"na")+"->"+n.startSN+" prev-sn: "+(p?p.sn:"na")+" fragments: "+S),K}return C},l.waitForCdnTuneIn=function(n){return n.live&&n.canBlockReload&&n.partTarget&&n.tuneInGoal>Math.max(n.partHoldBack,3*n.partTarget)},l.setStartPosition=function(n,u){var h=this.startPosition;if(h<u&&(h=-1),h===-1||this.lastCurrentTime===-1){var f=n.startTimeOffset;(0,R.isFiniteNumber)(f)?(h=u+f,f<0&&(h+=n.totalduration),h=Math.min(Math.max(u,h),u+n.totalduration),this.log("Start time offset "+f+" found in playlist, adjust startPosition to "+h),this.startPosition=h):n.live?h=this.hls.liveSyncPosition||u:this.startPosition=h=0,this.lastCurrentTime=h}this.nextLoadPosition=h},l.getLoadPosition=function(){var n=this.media,u=0;return this.loadedmetadata&&n?u=n.currentTime:this.nextLoadPosition&&(u=this.nextLoadPosition),u},l.handleFragLoadAborted=function(n,u){this.transmuxer&&n.sn!=="initSegment"&&n.stats.aborted&&(this.warn("Fragment "+n.sn+(u?" part"+u.index:"")+" of level "+n.level+" was aborted"),this.resetFragmentLoading(n))},l.resetFragmentLoading=function(n){this.fragCurrent&&(this.fragContextChanged(n)||this.state===Ar)||(this.state=Ct)},l.onFragmentOrKeyLoadError=function(n,u){if(u.fatal)return this.stopLoad(),void(this.state=lr);var h=this.config;if(u.chunkMeta){var f=this.getCurrentContext(u.chunkMeta);f&&(u.frag=f.frag,u.levelRetry=!0,this.fragLoadError=h.fragLoadingMaxRetry)}var p=u.frag;if(p&&p.type===n)if(this.fragCurrent,this.fragLoadError+1<=h.fragLoadingMaxRetry){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var _=Math.min(Math.pow(2,this.fragLoadError)*h.fragLoadingRetryDelay,h.fragLoadingMaxRetryTimeout);this.warn("Fragment "+p.sn+" of "+n+" "+p.level+" failed to load, retrying in "+_+"ms"),this.retryDate=self.performance.now()+_,this.fragLoadError++,this.state=Ar}else u.levelRetry?(n===Te.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=Ct):(O.logger.error(u.details+" reaches max retry, redispatch as fatal ..."),u.fatal=!0,this.hls.stopLoad(),this.state=lr)},l.afterBufferFlushed=function(n,u,h){if(n){var f=$t.getBuffered(n);this.fragmentTracker.detectEvictedFragments(u,f,h),this.state===va&&this.resetLoadingState()}},l.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Ct},l.resetStartWhenNotLoaded=function(n){if(!this.loadedmetadata){this.startFragRequested=!1;var u=this.levels?this.levels[n].details:null;u!=null&&u.live?(this.startPosition=-1,this.setStartPosition(u,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},l.updateLevelTiming=function(n,u,h,f){var p=this,_=h.details;Object.keys(n.elementaryStreams).reduce(function(S,C){var x=n.elementaryStreams[C];if(x){var W=x.endPTS-x.startPTS;if(W<=0)return p.warn("Could not parse fragment "+n.sn+" "+C+" duration reliably ("+W+")"),S||!1;var K=f?0:re(_,n,x.startPTS,x.endPTS,x.startDTS,x.endDTS);return p.hls.trigger(b.Events.LEVEL_PTS_UPDATED,{details:_,level:h,drift:K,type:C,frag:n,start:x.startPTS,end:x.endPTS}),!0}return S},!1)||(this.warn("Found no media in fragment "+n.sn+" of level "+h.id+" resetting transmuxer to fallback to playlist timing"),this.resetTransmuxer()),this.state=Wr,this.hls.trigger(b.Events.FRAG_PARSED,{frag:n,part:u})},l.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},s=i,(o=[{key:"state",get:function(){return this._state},set:function(n){var u=this._state;u!==n&&(this._state=n,this.log(u+"->"+n))}}])&&js(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),i}(gr);function Xa(){return self.MediaSource||self.WebKitMediaSource}function Za(){return self.SourceBuffer||self.WebKitSourceBuffer}var On=function(){var m=ENTRY_MODULE,c={},e=function s(o){var l=c[o];if(l!==void 0)return l.exports;var n=c[o]={exports:{}};return m[o].call(n.exports,n,n.exports,s),n.exports};e.m=m,e.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return e.d(o,{a:o}),o},e.d=function(s,o){for(var l in o)e.o(o,l)&&!e.o(s,l)&&Object.defineProperty(s,l,{enumerable:!0,get:o[l]})},e.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},e.r=function(s){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var i=e(ENTRY_MODULE);return i.default||i}.toString().split("ENTRY_MODULE"),Ys="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function ci(m){return(m+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function Ja(m,c,e){var i={};i[e]=[];var s=c.toString().replace(/^"[^"]+"/,"function"),o=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)||s.match(/^\(\w+,\s*\w+,\s*(\w+)\)\s?\=\s?\>/);if(!o)return i;for(var l,n=o[1],u=new RegExp("(\\\\n|\\W)"+ci(n)+Ys,"g");l=u.exec(s);)l[3]!=="dll-reference"&&i[e].push(l[3]);for(u=new RegExp("\\("+ci(n)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)'+Ys,"g");l=u.exec(s);)m[l[2]]||(i[e].push(l[1]),m[l[2]]=E(l[1]).m),i[l[2]]=i[l[2]]||[],i[l[2]].push(l[4]);for(var h,f=Object.keys(i),p=0;p<f.length;p++)for(var _=0;_<i[f[p]].length;_++)h=i[f[p]][_],isNaN(1*h)||(i[f[p]][_]=1*i[f[p]][_]);return i}function bl(m){return Object.keys(m).reduce(function(c,e){return c||m[e].length>0},!1)}function $s(m,c,e,i){var s=m[i].map(function(o){return'"'+o+'": '+c[i][o].toString().replace(/^"[^"]+"/,"function")}).join(",");return On[0]+"{"+s+"}"+On[1]+'"'+e+'"'+On[2]}var kr=E(544),Pn=E(729),ga=E.n(Pn),Ea=Xa()||{isTypeSupported:function(){return!1}},Nn=function(){function m(e,i,s,o){var l=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var n=e.config;this.hls=e,this.id=i,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=s,this.onFlush=o;var u=function(_,S){(S=S||{}).frag=l.frag,S.id=l.id,l.hls.trigger(_,S)};this.observer=new Pn.EventEmitter,this.observer.on(b.Events.FRAG_DECRYPTED,u),this.observer.on(b.Events.ERROR,u);var h={mp4:Ea.isTypeSupported("video/mp4"),mpeg:Ea.isTypeSupported("audio/mpeg"),mp3:Ea.isTypeSupported('audio/mp4; codecs="mp3"')},f=navigator.vendor;if(this.useWorker&&typeof Worker!="undefined"){var p;O.logger.log("demuxing in webworker");try{p=this.worker=function(_,S){S=S||{};var C={main:E.m},x=S.all?{main:Object.keys(C.main)}:function(Ie,ye){for(var De={main:[ye]},qe={main:[]},rt={main:{}};bl(De);)for(var we=Object.keys(De),je=0;je<we.length;je++){var Ve=we[je],Tt=De[Ve].pop();if(rt[Ve]=rt[Ve]||{},!rt[Ve][Tt]&&Ie[Ve][Tt]){rt[Ve][Tt]=!0,qe[Ve]=qe[Ve]||[],qe[Ve].push(Tt);for(var Wt=Ja(Ie,Ie[Ve][Tt],Ve),St=Object.keys(Wt),Mt=0;Mt<St.length;Mt++)De[St[Mt]]=De[St[Mt]]||[],De[St[Mt]]=De[St[Mt]].concat(Wt[St[Mt]])}}return qe}(C,_),W="";Object.keys(x).filter(function(Ie){return Ie!=="main"}).forEach(function(Ie){for(var ye=0;x[Ie][ye];)ye++;x[Ie].push(ye),C[Ie][ye]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",W=W+"var "+Ie+" = ("+$s(x,C,ye,modules)+`)();
9
+ `}),W=W+"new (("+$s(x,C,_,"main")+")())(self);";var K=new window.Blob([W],{type:"text/javascript"}),ee=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(K),me=new window.Worker(ee);return me.objectURL=ee,me}(182),this.onwmsg=this.onWorkerMessage.bind(this),p.addEventListener("message",this.onwmsg),p.onerror=function(_){l.useWorker=!1,O.logger.warn("Exception in webworker, fallback to inline"),l.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:new Error(_.message+" ("+_.filename+":"+_.lineno+")")})},p.postMessage({cmd:"init",typeSupported:h,vendor:f,id:i,config:JSON.stringify(n)})}catch(_){O.logger.warn("Error in worker:",_),O.logger.error("Error while initializing DemuxerWorker, fallback to inline"),p&&self.URL.revokeObjectURL(p.objectURL),this.transmuxer=new kr.default(this.observer,h,n,f,i),this.worker=null}}else this.transmuxer=new kr.default(this.observer,h,n,f,i)}var c=m.prototype;return c.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null,this.onwmsg=void 0;else{var i=this.transmuxer;i&&(i.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},c.push=function(e,i,s,o,l,n,u,h,f,p){var _,S,C=this;f.transmuxing.start=self.performance.now();var x=this.transmuxer,W=this.worker,K=n?n.start:l.start,ee=l.decryptdata,me=this.frag,Ie=!(me&&l.cc===me.cc),ye=!(me&&f.level===me.level),De=me?f.sn-me.sn:-1,qe=this.part?f.part-this.part.index:-1,rt=De===0&&f.id>1&&f.id===(me==null?void 0:me.stats.chunkCount),we=!ye&&(De===1||De===0&&(qe===1||rt&&qe<=0)),je=self.performance.now();(ye||De||l.stats.parsing.start===0)&&(l.stats.parsing.start=je),!n||!qe&&we||(n.stats.parsing.start=je);var Ve=!(me&&((_=l.initSegment)===null||_===void 0?void 0:_.url)===((S=me.initSegment)===null||S===void 0?void 0:S.url)),Tt=new kr.TransmuxState(Ie,we,h,ye,K,Ve);if(!we||Ie||Ve){O.logger.log("[transmuxer-interface, "+l.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
10
+ discontinuity: `+Ie+`
11
11
  trackSwitch: `+ye+`
12
- contiguous: `+Ie+`
12
+ contiguous: `+we+`
13
13
  accurateTimeOffset: `+h+`
14
14
  timeOffset: `+K+`
15
- initSegmentChange: `+Ve);var Wt=new ki.TransmuxConfig(s,o,r,u,p);this.configureTransmuxer(Wt)}if(this.frag=l,this.part=n,W)W.postMessage({cmd:"demux",data:e,decryptdata:ee,chunkMeta:f,state:Tt},e instanceof ArrayBuffer?[e]:[]);else if(x){var St=x.push(e,ee,f,Tt);(0,ki.isPromise)(St)?(x.async=!0,St.then(function(Mt){C.handleTransmuxComplete(Mt)}).catch(function(Mt){C.transmuxerError(Mt,f,"transmuxer-interface push error")})):(x.async=!1,this.handleTransmuxComplete(St))}},c.flush=function(e){var r=this;e.transmuxing.start=self.performance.now();var s=this.transmuxer,o=this.worker;if(o)o.postMessage({cmd:"flush",chunkMeta:e});else if(s){var l=s.flush(e);(0,ki.isPromise)(l)||s.async?((0,ki.isPromise)(l)||(l=Promise.resolve(l)),l.then(function(n){r.handleFlushResult(n,e)}).catch(function(n){r.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(l,e)}},c.transmuxerError=function(e,r,s){this.hls&&this.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:r,fatal:!1,error:e,err:e,reason:s})},c.handleFlushResult=function(e,r){var s=this;e.forEach(function(o){s.handleTransmuxComplete(o)}),this.onFlush(r)},c.onWorkerMessage=function(e){var r=e.data,s=this.hls;switch(r.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(r.data);break;case"flush":this.onFlush(r.data);break;case"workerLog":O.logger[r.data.logType]&&O.logger[r.data.logType](r.data.message);break;default:r.data=r.data||{},r.data.frag=this.frag,r.data.id=this.id,s.trigger(r.event,r.data)}},c.configureTransmuxer=function(e){var r=this.worker,s=this.transmuxer;r?r.postMessage({cmd:"configure",config:e}):s&&s.configure(e)},c.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},m}(),zs=function(){function m(e,r,s,o){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=r,this.fragmentTracker=s,this.hls=o}var c=m.prototype;return c.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},c.poll=function(e,r){var s=this.config,o=this.media,l=this.stalled;if(o!==null){var n=o.currentTime,u=o.seeking,h=this.seeking&&!u,f=!this.seeking&&u;if(this.seeking=u,n===e){if((f||h)&&(this.stalled=null),!(o.paused&&!u||o.ended||o.playbackRate===0)&&$t.getBuffered(o).length){var p=$t.bufferInfo(o,n,0),_=p.len>0,S=p.nextStart||0;if(_||S){if(u){var C=p.len>2,x=!S||r&&r.start<=n||S-n>2&&!this.fragmentTracker.getPartialFragment(n);if(C||x)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var W,K=Math.max(S,p.start||0)-n,ee=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,me=!(ee==null||(W=ee.details)===null||W===void 0)&&W.live?2*ee.details.targetduration:2;if(K>0&&K<=me)return void this._trySkipBufferHole(null)}var we=self.performance.now();if(l!==null){var ye=we-l;if(u||!(ye>=250)||(this._reportStall(p),this.media)){var De=$t.bufferInfo(o,n,s.maxBufferHole);this._tryFixBufferStall(De,ye)}}else this.stalled=we}}}else if(this.moved=!0,l!==null){if(this.stallReported){var qe=self.performance.now()-l;O.logger.warn("playback not stuck anymore @"+n+", after "+Math.round(qe)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},c._tryFixBufferStall=function(e,r){var s=this.config,o=this.fragmentTracker,l=this.media;if(l!==null){var n=l.currentTime,u=o.getPartialFragment(n);if(u&&(this._trySkipBufferHole(u)||!this.media))return;e.len>s.maxBufferHole&&r>1e3*s.highBufferWatchdogPeriod&&(O.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},c._reportStall=function(e){var r=this.hls,s=this.media;!this.stallReported&&s&&(this.stallReported=!0,O.logger.warn("Playback stalling at @"+s.currentTime+" due to low buffer ("+JSON.stringify(e)+")"),r.trigger(y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e.len}))},c._trySkipBufferHole=function(e){var r=this.config,s=this.hls,o=this.media;if(o===null)return 0;for(var l=o.currentTime,n=0,u=$t.getBuffered(o),h=0;h<u.length;h++){var f=u.start(h);if(l+r.maxBufferHole>=n&&l<f){var p=Math.max(f+.05,o.currentTime+.1);return O.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+p),this.moved=!0,this.stalled=null,o.currentTime=p,e&&s.trigger(y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+p,frag:e}),p}n=u.end(h)}return 0},c._tryNudgeBuffer=function(){var e=this.config,r=this.hls,s=this.media,o=this.nudgeRetry;if(s!==null){var l=s.currentTime;if(this.nudgeRetry++,o<e.nudgeMaxRetry){var n=l+(o+1)*e.nudgeOffset;O.logger.warn("Nudging 'currentTime' from "+l+" to "+n),s.currentTime=n,r.trigger(y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else O.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+e.nudgeMaxRetry+" nudges"),r.trigger(y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})}},m}();function qi(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}function Un(m,c){return Un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Un(m,c)}var Tl=function(m){var c,e;function r(n,u,h){var f;return(f=m.call(this,n,u,h,"[stream-controller]")||this).audioCodecSwap=!1,f.gapController=null,f.level=-1,f._forceStartLoad=!1,f.altAudio=!1,f.audioOnly=!1,f.fragPlaying=null,f.onvplaying=null,f.onvseeked=null,f.fragLastKbps=0,f.couldBacktrack=!1,f.backtrackFragment=null,f.audioCodecSwitch=!1,f.videoBuffer=null,f._registerListeners(),f}e=m,(c=r).prototype=Object.create(e.prototype),c.prototype.constructor=c,Un(c,e);var s,o,l=r.prototype;return l._registerListeners=function(){var n=this.hls;n.on(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(y.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(y.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(y.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),n.on(y.Events.ERROR,this.onError,this),n.on(y.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.on(y.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.on(y.Events.BUFFER_CREATED,this.onBufferCreated,this),n.on(y.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.on(y.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),n.on(y.Events.FRAG_BUFFERED,this.onFragBuffered,this)},l._unregisterListeners=function(){var n=this.hls;n.off(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(y.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(y.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),n.off(y.Events.ERROR,this.onError,this),n.off(y.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.off(y.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.off(y.Events.BUFFER_CREATED,this.onBufferCreated,this),n.off(y.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.off(y.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),n.off(y.Events.FRAG_BUFFERED,this.onFragBuffered,this)},l.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},l.startLoad=function(n){if(this.levels){var u=this.lastCurrentTime,h=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var f=h.startLevel;f===-1&&(h.config.testBandwidth&&this.levels.length>1?(f=0,this.bitrateTest=!0):f=h.nextAutoLevel),this.level=h.nextLoadLevel=f,this.loadedmetadata=!1}u>0&&n===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),n=u),this.state=Ct,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()}else this._forceStartLoad=!0,this.state=Xr},l.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},l.doTick=function(){switch(this.state){case Ct:this.doTickIdle();break;case ji:var n,u=this.levels,h=this.level,f=u==null||(n=u[h])===null||n===void 0?void 0:n.details;if(f&&(!f.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(f))break;this.state=Ct;break}break;case Ai:var p,_=self.performance.now(),S=this.retryDate;(!S||_>=S||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.level),this.state=Ct)}this.onTickEnd()},l.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},l.doTickIdle=function(){var n=this.hls,u=this.levelLastLoaded,h=this.levels,f=this.media,p=n.config,_=n.nextLoadLevel;if(u!==null&&(f||!this.startFragRequested&&p.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&h&&h[_]){var S=h[_],C=this.getMainFwdBufferInfo();if(C!==null){var x=this.getLevelDetails();if(x&&this._streamEnded(C,x)){var W={};return this.altAudio&&(W.type="video"),this.hls.trigger(y.Events.BUFFER_EOS,W),void(this.state=va)}this.level=n.nextLoadLevel=_;var K=S.details;if(!K||this.state===ji||K.live&&this.levelLastLoaded!==_)return this.level=_,void(this.state=ji);if(!(C.len>=this.getMaxBufferLength(S.maxBitrate))){this.backtrackFragment&&this.backtrackFragment.start>C.end&&(this.backtrackFragment=null);var ee=this.backtrackFragment?this.backtrackFragment.start:C.end,me=this.getNextFragment(ee,K);if(this.couldBacktrack&&!this.fragPrevious&&me&&me.sn!=="initSegment"&&this.fragmentTracker.getState(me)!==We.OK){var we,ye=((we=this.backtrackFragment)!=null?we:me).sn-K.startSN,De=K.fragments[ye-1];De&&me.cc===De.cc&&(me=De,this.fragmentTracker.removeFragment(De))}else this.backtrackFragment&&C.len&&(this.backtrackFragment=null);if(me&&this.fragmentTracker.getState(me)===We.OK&&this.nextLoadPosition>ee){var qe=this.audioOnly&&!this.altAudio?X.ElementaryStreamTypes.AUDIO:X.ElementaryStreamTypes.VIDEO,it=(qe===X.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;it&&this.afterBufferFlushed(it,qe,Te.PlaylistLevelType.MAIN),me=this.getNextFragment(this.nextLoadPosition,K)}me&&(!me.initSegment||me.initSegment.data||this.bitrateTest||(me=me.initSegment),this.loadFragment(me,K,ee))}}}},l.loadFragment=function(n,u,h){var f,p=this.fragmentTracker.getState(n);this.fragCurrent=n,p===We.NOT_LOADED?n.sn==="initSegment"?this._loadInitSegment(n,u):this.bitrateTest?(this.log("Fragment "+n.sn+" of level "+n.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(n,u)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,n,u,h)):p===We.APPENDING?this.reduceMaxBufferLength(n.duration)&&this.fragmentTracker.removeFragment(n):((f=this.media)===null||f===void 0?void 0:f.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},l.getAppendedFrag=function(n){var u=this.fragmentTracker.getAppendedFrag(n,Te.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},l.getBufferedFrag=function(n){return this.fragmentTracker.getBufferedFrag(n,Te.PlaylistLevelType.MAIN)},l.followingBufferedFrag=function(n){return n?this.getBufferedFrag(n.end+.5):null},l.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},l.nextLevelSwitch=function(){var n=this.levels,u=this.media;if(u!=null&&u.readyState){var h,f=this.getAppendedFrag(u.currentTime);if(f&&f.start>1&&this.flushMainBuffer(0,f.start-1),!u.paused&&n){var p=n[this.hls.nextLoadLevel],_=this.fragLastKbps;h=_&&this.fragCurrent?this.fragCurrent.duration*p.maxBitrate/(1e3*_)+1:0}else h=0;var S=this.getBufferedFrag(u.currentTime+h);if(S){var C=this.followingBufferedFrag(S);if(C){this.abortCurrentFrag();var x=C.maxStartPTS?C.maxStartPTS:C.start,W=C.duration,K=Math.max(S.end,x+Math.min(Math.max(W-this.config.maxFragLookUpTolerance,.5*W),.75*W));this.flushMainBuffer(K,Number.POSITIVE_INFINITY)}}}},l.abortCurrentFrag=function(){var n=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,n&&n.abortRequests(),this.state){case qs:case Vi:case Ai:case ii:case Wi:this.state=Ct}this.nextLoadPosition=this.getLoadPosition()},l.flushMainBuffer=function(n,u){m.prototype.flushMainBuffer.call(this,n,u,this.altAudio?"video":null)},l.onMediaAttached=function(n,u){m.prototype.onMediaAttached.call(this,n,u);var h=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),h.addEventListener("playing",this.onvplaying),h.addEventListener("seeked",this.onvseeked),this.gapController=new zs(this.config,h,this.fragmentTracker,this.hls)},l.onMediaDetaching=function(){var n=this.media;n&&this.onvplaying&&this.onvseeked&&(n.removeEventListener("playing",this.onvplaying),n.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},l.onMediaPlaying=function(){this.tick()},l.onMediaSeeked=function(){var n=this.media,u=n?n.currentTime:null;(0,R.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},l.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(y.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null,this.backtrackFragment=null},l.onManifestParsed=function(n,u){var h,f,p,_=!1,S=!1;u.levels.forEach(function(C){(h=C.audioCodec)&&(h.indexOf("mp4a.40.2")!==-1&&(_=!0),h.indexOf("mp4a.40.5")!==-1&&(S=!0))}),this.audioCodecSwitch=_&&S&&typeof((p=Za())==null||(f=p.prototype)===null||f===void 0?void 0:f.changeType)!="function",this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},l.onLevelLoading=function(n,u){var h=this.levels;if(h&&this.state===Ct){var f=h[u.level];(!f.details||f.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(f.details))&&(this.state=ji)}},l.onLevelLoaded=function(n,u){var h,f=this.levels,p=u.level,_=u.details,S=_.totalduration;if(f){this.log("Level "+p+" loaded ["+_.startSN+","+_.endSN+"], cc ["+_.startCC+", "+_.endCC+"] duration:"+S);var C=this.fragCurrent;!C||this.state!==Vi&&this.state!==Ai||C.level!==u.level&&C.loader&&(this.state=Ct,this.backtrackFragment=null,C.abortRequests());var x=f[p],W=0;if(_.live||(h=x.details)!==null&&h!==void 0&&h.live){if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed)return;W=this.alignPlaylists(_,x.details)}if(x.details=_,this.levelLastLoaded=p,this.hls.trigger(y.Events.LEVEL_UPDATED,{details:_,level:p}),this.state===ji){if(this.waitForCdnTuneIn(_))return;this.state=Ct}this.startFragRequested?_.live&&this.synchronizeToLiveEdge(_):this.setStartPosition(_,W),this.tick()}else this.warn("Levels were reset while loading level "+p)},l._handleFragmentLoadProgress=function(n){var u,h=n.frag,f=n.part,p=n.payload,_=this.levels;if(_){var S=_[h.level],C=S.details;if(C){var x=S.videoCodec,W=C.PTSKnown||!C.live,K=(u=h.initSegment)===null||u===void 0?void 0:u.data,ee=this._getAudioCodec(S),me=this.transmuxer=this.transmuxer||new Nn(this.hls,Te.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),we=f?f.index:-1,ye=we!==-1,De=new xn(h.level,h.sn,h.stats.chunkCount,p.byteLength,we,ye),qe=this.initPTS[h.cc];me.push(p,K,ee,x,h,f,C.totalduration,W,De,qe)}else this.warn("Dropping fragment "+h.sn+" of level "+h.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+h.sn+" of level "+h.level+" will not be buffered")},l.onAudioTrackSwitching=function(n,u){var h=this.altAudio,f=!!u.url,p=u.id;if(!f){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var _=this.fragCurrent;_&&(this.log("Switching to main audio track, cancel main fragment load"),_.abortRequests()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var S=this.hls;h&&S.trigger(y.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),S.trigger(y.Events.AUDIO_TRACK_SWITCHED,{id:p})}},l.onAudioTrackSwitched=function(n,u){var h=u.id,f=!!this.hls.audioTracks[h].url;if(f){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=f,this.tick()},l.onBufferCreated=function(n,u){var h,f,p=u.tracks,_=!1;for(var S in p){var C=p[S];if(C.id==="main"){if(f=S,h=C,S==="video"){var x=p[S];x&&(this.videoBuffer=x.buffer)}}else _=!0}_&&h?(this.log("Alternate track found, use "+f+".buffered to schedule main fragment loading"),this.mediaBuffer=h.buffer):this.mediaBuffer=this.media},l.onFragBuffered=function(n,u){var h=u.frag,f=u.part;if(!h||h.type===Te.PlaylistLevelType.MAIN){if(this.fragContextChanged(h))return this.warn("Fragment "+h.sn+(f?" p: "+f.index:"")+" of level "+h.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Wi&&(this.state=Ct));var p=f?f.stats:h.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),h.sn!=="initSegment"&&(this.fragPrevious=h),this.fragBufferedComplete(h,f)}},l.onError=function(n,u){if(u.type!==P.ErrorTypes.KEY_SYSTEM_ERROR)switch(u.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.FRAG_PARSING_ERROR:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Te.PlaylistLevelType.MAIN,u);break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==li&&(u.fatal?(this.warn(""+u.details),this.state=li):u.levelRetry||this.state!==ji||(this.state=Ct));break;case P.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===ii||this.state===Wi)){var h=!0,f=this.getFwdBufferInfo(this.media,Te.PlaylistLevelType.MAIN);f&&f.len>.5&&(h=!this.reduceMaxBufferLength(f.len)),h&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}else this.onFragmentOrKeyLoadError(Te.PlaylistLevelType.MAIN,u)},l.checkBuffer=function(){var n=this.media,u=this.gapController;if(n&&u&&n.readyState){if(this.loadedmetadata||!$t.getBuffered(n).length){var h=this.state!==Ct?this.fragCurrent:null;u.poll(this.lastCurrentTime,h)}this.lastCurrentTime=n.currentTime}},l.onFragLoadEmergencyAborted=function(){this.state=Ct,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},l.onBufferFlushed=function(n,u){var h=u.type;if(h!==X.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var f=(h===X.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(f,h,Te.PlaylistLevelType.MAIN)}},l.onLevelsUpdated=function(n,u){this.levels=u.levels},l.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},l.seekToStartPos=function(){var n=this.media;if(n){var u=n.currentTime,h=this.startPosition;if(h>=0&&u<h){if(n.seeking)return void this.log("could not seek to "+h+", already seeking at "+u);var f=$t.getBuffered(n),p=(f.length?f.start(0):0)-h;p>0&&(p<this.config.maxBufferHole||p<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+p+" to match buffer start"),h+=p,this.startPosition=h),this.log("seek to target start position "+h+" from current time "+u),n.currentTime=h}}},l._getAudioCodec=function(n){var u=this.config.defaultAudioCodec||n.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u=u.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),u},l._loadBitrateTestFrag=function(n,u){var h=this;n.bitrateTest=!0,this._doFragLoad(n,u).then(function(f){var p=h.hls;if(f&&!p.nextLoadLevel&&!h.fragContextChanged(n)){h.fragLoadError=0,h.state=Ct,h.startFragRequested=!1,h.bitrateTest=!1;var _=n.stats;_.parsing.start=_.parsing.end=_.buffering.start=_.buffering.end=self.performance.now(),p.trigger(y.Events.FRAG_LOADED,f),n.bitrateTest=!1}})},l._handleTransmuxComplete=function(n){var u,h="main",f=this.hls,p=n.remuxResult,_=n.chunkMeta,S=this.getCurrentContext(_);if(!S)return this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),void this.resetStartWhenNotLoaded(_.level);var C=S.frag,x=S.part,W=S.level,K=p.video,ee=p.text,me=p.id3,we=p.initSegment,ye=W.details,De=this.altAudio?void 0:p.audio;if(!this.fragContextChanged(C)){if(this.state=ii,we){we.tracks&&(this._bufferInitSegment(W,we.tracks,C,_),f.trigger(y.Events.FRAG_PARSING_INIT_SEGMENT,{frag:C,id:h,tracks:we.tracks}));var qe=we.initPTS,it=we.timescale;(0,R.isFiniteNumber)(qe)&&(this.initPTS[C.cc]=qe,f.trigger(y.Events.INIT_PTS_FOUND,{frag:C,id:h,initPTS:qe,timescale:it}))}if(K&&p.independent!==!1){if(ye){var Ie=K.startPTS,je=K.endPTS,Ve=K.startDTS,Tt=K.endDTS;if(x)x.elementaryStreams[K.type]={startPTS:Ie,endPTS:je,startDTS:Ve,endDTS:Tt};else if(K.firstKeyFrame&&K.independent&&_.id===1&&(this.couldBacktrack=!0),K.dropped&&K.independent){var Wt=this.getMainFwdBufferInfo();if((Wt?Wt.end:this.getLoadPosition())+this.config.maxBufferHole<(K.firstKeyFramePTS?K.firstKeyFramePTS:Ie)-this.config.maxBufferHole)return void this.backtrack(C);C.setElementaryStreamInfo(K.type,C.start,je,C.start,Tt,!0)}C.setElementaryStreamInfo(K.type,Ie,je,Ve,Tt),this.backtrackFragment&&(this.backtrackFragment=C),this.bufferFragmentData(K,C,x,_)}}else if(p.independent===!1)return void this.backtrack(C);if(De){var St=De.startPTS,Mt=De.endPTS,Gt=De.startDTS,yr=De.endDTS;x&&(x.elementaryStreams[X.ElementaryStreamTypes.AUDIO]={startPTS:St,endPTS:Mt,startDTS:Gt,endDTS:yr}),C.setElementaryStreamInfo(X.ElementaryStreamTypes.AUDIO,St,Mt,Gt,yr),this.bufferFragmentData(De,C,x,_)}if(ye&&me!=null&&(u=me.samples)!==null&&u!==void 0&&u.length){var fr={id:h,frag:C,details:ye,samples:me.samples};f.trigger(y.Events.FRAG_PARSING_METADATA,fr)}if(ye&&ee){var er={id:h,frag:C,details:ye,samples:ee.samples};f.trigger(y.Events.FRAG_PARSING_USERDATA,er)}}},l._bufferInitSegment=function(n,u,h,f){var p=this;if(this.state===ii){this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var _=u.audio,S=u.video,C=u.audiovideo;if(_){var x=n.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(x&&(x=x.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),_.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(x="mp4a.40.5")),W.indexOf("android")!==-1&&_.container!=="audio/mpeg"&&(x="mp4a.40.2",this.log("Android: force audio codec to "+x)),n.audioCodec&&n.audioCodec!==x&&this.log('Swapping manifest audio codec "'+n.audioCodec+'" for "'+x+'"'),_.levelCodec=x,_.id="main",this.log("Init audio buffer, container:"+_.container+", codecs[selected/level/parsed]=["+(x||"")+"/"+(n.audioCodec||"")+"/"+_.codec+"]")}S&&(S.levelCodec=n.videoCodec,S.id="main",this.log("Init video buffer, container:"+S.container+", codecs[level/parsed]=["+(n.videoCodec||"")+"/"+S.codec+"]")),C&&this.log("Init audiovideo buffer, container:"+C.container+", codecs[level/parsed]=["+(n.attrs.CODECS||"")+"/"+C.codec+"]"),this.hls.trigger(y.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(K){var ee=u[K].initSegment;ee!=null&&ee.byteLength&&p.hls.trigger(y.Events.BUFFER_APPENDING,{type:K,data:ee,frag:h,part:null,chunkMeta:f,parent:h.type})}),this.tick()}},l.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Te.PlaylistLevelType.MAIN)},l.backtrack=function(n){this.couldBacktrack=!0,this.backtrackFragment=n,this.resetTransmuxer(),this.flushBufferGap(n),this.fragmentTracker.removeFragment(n),this.fragPrevious=null,this.nextLoadPosition=n.start,this.state=Ct},l.checkFragmentChanged=function(){var n=this.media,u=null;if(n&&n.readyState>1&&n.seeking===!1){var h=n.currentTime;if($t.isBuffered(n,h)?u=this.getAppendedFrag(h):$t.isBuffered(n,h+.1)&&(u=this.getAppendedFrag(h+.1)),u){this.backtrackFragment=null;var f=this.fragPlaying,p=u.level;f&&u.sn===f.sn&&f.level===p&&u.urlId===f.urlId||(this.fragPlaying=u,this.hls.trigger(y.Events.FRAG_CHANGED,{frag:u}),f&&f.level===p||this.hls.trigger(y.Events.LEVEL_SWITCHED,{level:p}))}}},s=r,(o=[{key:"nextLevel",get:function(){var n=this.nextBufferedFrag;return n?n.level:-1}},{key:"currentFrag",get:function(){var n=this.media;return n?this.fragPlaying||this.getAppendedFrag(n.currentTime):null}},{key:"currentProgramDateTime",get:function(){var n=this.media;if(n){var u=n.currentTime,h=this.currentFrag;if(h&&(0,R.isFiniteNumber)(u)&&(0,R.isFiniteNumber)(h.programDateTime)){var f=h.programDateTime+1e3*(u-h.start);return new Date(f)}}return null}},{key:"currentLevel",get:function(){var n=this.currentFrag;return n?n.level:-1}},{key:"nextBufferedFrag",get:function(){var n=this.currentFrag;return n?this.followingBufferedFrag(n):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&qi(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),r}(Qa);let en=function(){function m(e,r,s){r===void 0&&(r=0),s===void 0&&(s=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=r,this.totalWeight_=s}var c=m.prototype;return c.sample=function(e,r){var s=Math.pow(this.alpha_,e);this.estimate_=r*(1-s)+s*this.estimate_,this.totalWeight_+=e},c.getTotalWeight=function(){return this.totalWeight_},c.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},m}(),_l=function(){function m(e,r,s){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new en(e),this.fast_=new en(r)}var c=m.prototype;return c.update=function(e,r){var s=this.slow_,o=this.fast_;this.slow_.halfLife!==e&&(this.slow_=new en(e,s.getEstimate(),s.getTotalWeight())),this.fast_.halfLife!==r&&(this.fast_=new en(r,o.getEstimate(),o.getTotalWeight()))},c.sample=function(e,r){var s=(e=Math.max(e,this.minDelayMs_))/1e3,o=8*r/s;this.fast_.sample(s,o),this.slow_.sample(s,o)},c.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},c.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},c.destroy=function(){},m}();function Al(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}let Sl=function(){function m(s){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=s;var o=s.config;this.bwEstimator=new _l(o.abrEwmaSlowVoD,o.abrEwmaFastVoD,o.abrEwmaDefaultEstimate),this.registerListeners()}var c,e,r=m.prototype;return r.registerListeners=function(){var s=this.hls;s.on(y.Events.FRAG_LOADING,this.onFragLoading,this),s.on(y.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(y.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(y.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var s=this.hls;s.off(y.Events.FRAG_LOADING,this.onFragLoading,this),s.off(y.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(y.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(y.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},r.onFragLoading=function(s,o){var l,n=o.frag;n.type===Te.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=n,this.partCurrent=(l=o.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)))},r.onLevelLoaded=function(s,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},r._abandonRulesCheck=function(){var s=this.fragCurrent,o=this.partCurrent,l=this.hls,n=l.autoLevelEnabled,u=l.media;if(s&&u){var h=o?o.stats:s.stats,f=o?o.duration:s.duration;if(h.aborted||h.loaded&&h.loaded===h.total||s.level===0)return this.clearTimer(),void(this._nextAutoLevel=-1);if(n&&!u.paused&&u.playbackRate&&u.readyState){var p=l.mainForwardBufferInfo;if(p!==null){var _=performance.now()-h.loading.start,S=Math.abs(u.playbackRate);if(!(_<=500*f/S)){var C=h.loaded&&h.loading.first,x=this.bwEstimator.getEstimate(),W=l.levels,K=l.minAutoLevel,ee=W[s.level],me=h.total||Math.max(h.loaded,Math.round(f*ee.maxBitrate/8)),we=C?1e3*h.loaded/_:0,ye=we?(me-h.loaded)/we:8*me/x,De=p.len/S;if(!(ye<=De)){var qe,it=Number.POSITIVE_INFINITY;for(qe=s.level-1;qe>K;qe--){var Ie=W[qe].maxBitrate;if((it=we?f*Ie/(6.4*we):f*Ie/x)<De)break}it>=ye||(O.logger.warn("Fragment "+s.sn+(o?" part "+o.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+qe+`
15
+ initSegmentChange: `+Ve);var Wt=new kr.TransmuxConfig(s,o,i,u,p);this.configureTransmuxer(Wt)}if(this.frag=l,this.part=n,W)W.postMessage({cmd:"demux",data:e,decryptdata:ee,chunkMeta:f,state:Tt},e instanceof ArrayBuffer?[e]:[]);else if(x){var St=x.push(e,ee,f,Tt);(0,kr.isPromise)(St)?(x.async=!0,St.then(function(Mt){C.handleTransmuxComplete(Mt)}).catch(function(Mt){C.transmuxerError(Mt,f,"transmuxer-interface push error")})):(x.async=!1,this.handleTransmuxComplete(St))}},c.flush=function(e){var i=this;e.transmuxing.start=self.performance.now();var s=this.transmuxer,o=this.worker;if(o)o.postMessage({cmd:"flush",chunkMeta:e});else if(s){var l=s.flush(e);(0,kr.isPromise)(l)||s.async?((0,kr.isPromise)(l)||(l=Promise.resolve(l)),l.then(function(n){i.handleFlushResult(n,e)}).catch(function(n){i.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(l,e)}},c.transmuxerError=function(e,i,s){this.hls&&this.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:i,fatal:!1,error:e,err:e,reason:s})},c.handleFlushResult=function(e,i){var s=this;e.forEach(function(o){s.handleTransmuxComplete(o)}),this.onFlush(i)},c.onWorkerMessage=function(e){var i=e.data,s=this.hls;switch(i.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(i.data);break;case"flush":this.onFlush(i.data);break;case"workerLog":O.logger[i.data.logType]&&O.logger[i.data.logType](i.data.message);break;default:i.data=i.data||{},i.data.frag=this.frag,i.data.id=this.id,s.trigger(i.event,i.data)}},c.configureTransmuxer=function(e){var i=this.worker,s=this.transmuxer;i?i.postMessage({cmd:"configure",config:e}):s&&s.configure(e)},c.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},m}(),zs=function(){function m(e,i,s,o){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=i,this.fragmentTracker=s,this.hls=o}var c=m.prototype;return c.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},c.poll=function(e,i){var s=this.config,o=this.media,l=this.stalled;if(o!==null){var n=o.currentTime,u=o.seeking,h=this.seeking&&!u,f=!this.seeking&&u;if(this.seeking=u,n===e){if((f||h)&&(this.stalled=null),!(o.paused&&!u||o.ended||o.playbackRate===0)&&$t.getBuffered(o).length){var p=$t.bufferInfo(o,n,0),_=p.len>0,S=p.nextStart||0;if(_||S){if(u){var C=p.len>2,x=!S||i&&i.start<=n||S-n>2&&!this.fragmentTracker.getPartialFragment(n);if(C||x)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var W,K=Math.max(S,p.start||0)-n,ee=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,me=!(ee==null||(W=ee.details)===null||W===void 0)&&W.live?2*ee.details.targetduration:2;if(K>0&&K<=me)return void this._trySkipBufferHole(null)}var Ie=self.performance.now();if(l!==null){var ye=Ie-l;if(u||!(ye>=250)||(this._reportStall(p),this.media)){var De=$t.bufferInfo(o,n,s.maxBufferHole);this._tryFixBufferStall(De,ye)}}else this.stalled=Ie}}}else if(this.moved=!0,l!==null){if(this.stallReported){var qe=self.performance.now()-l;O.logger.warn("playback not stuck anymore @"+n+", after "+Math.round(qe)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},c._tryFixBufferStall=function(e,i){var s=this.config,o=this.fragmentTracker,l=this.media;if(l!==null){var n=l.currentTime,u=o.getPartialFragment(n);if(u&&(this._trySkipBufferHole(u)||!this.media))return;e.len>s.maxBufferHole&&i>1e3*s.highBufferWatchdogPeriod&&(O.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},c._reportStall=function(e){var i=this.hls,s=this.media;!this.stallReported&&s&&(this.stallReported=!0,O.logger.warn("Playback stalling at @"+s.currentTime+" due to low buffer ("+JSON.stringify(e)+")"),i.trigger(b.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e.len}))},c._trySkipBufferHole=function(e){var i=this.config,s=this.hls,o=this.media;if(o===null)return 0;for(var l=o.currentTime,n=0,u=$t.getBuffered(o),h=0;h<u.length;h++){var f=u.start(h);if(l+i.maxBufferHole>=n&&l<f){var p=Math.max(f+.05,o.currentTime+.1);return O.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+p),this.moved=!0,this.stalled=null,o.currentTime=p,e&&s.trigger(b.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+p,frag:e}),p}n=u.end(h)}return 0},c._tryNudgeBuffer=function(){var e=this.config,i=this.hls,s=this.media,o=this.nudgeRetry;if(s!==null){var l=s.currentTime;if(this.nudgeRetry++,o<e.nudgeMaxRetry){var n=l+(o+1)*e.nudgeOffset;O.logger.warn("Nudging 'currentTime' from "+l+" to "+n),s.currentTime=n,i.trigger(b.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else O.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+e.nudgeMaxRetry+" nudges"),i.trigger(b.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})}},m}();function qr(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}function Un(m,c){return Un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},Un(m,c)}var Tl=function(m){var c,e;function i(n,u,h){var f;return(f=m.call(this,n,u,h,"[stream-controller]")||this).audioCodecSwap=!1,f.gapController=null,f.level=-1,f._forceStartLoad=!1,f.altAudio=!1,f.audioOnly=!1,f.fragPlaying=null,f.onvplaying=null,f.onvseeked=null,f.fragLastKbps=0,f.couldBacktrack=!1,f.backtrackFragment=null,f.audioCodecSwitch=!1,f.videoBuffer=null,f._registerListeners(),f}e=m,(c=i).prototype=Object.create(e.prototype),c.prototype.constructor=c,Un(c,e);var s,o,l=i.prototype;return l._registerListeners=function(){var n=this.hls;n.on(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(b.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(b.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(b.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(b.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),n.on(b.Events.ERROR,this.onError,this),n.on(b.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.on(b.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.on(b.Events.BUFFER_CREATED,this.onBufferCreated,this),n.on(b.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.on(b.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),n.on(b.Events.FRAG_BUFFERED,this.onFragBuffered,this)},l._unregisterListeners=function(){var n=this.hls;n.off(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(b.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(b.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(b.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),n.off(b.Events.ERROR,this.onError,this),n.off(b.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.off(b.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.off(b.Events.BUFFER_CREATED,this.onBufferCreated,this),n.off(b.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.off(b.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),n.off(b.Events.FRAG_BUFFERED,this.onFragBuffered,this)},l.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},l.startLoad=function(n){if(this.levels){var u=this.lastCurrentTime,h=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var f=h.startLevel;f===-1&&(h.config.testBandwidth&&this.levels.length>1?(f=0,this.bitrateTest=!0):f=h.nextAutoLevel),this.level=h.nextLoadLevel=f,this.loadedmetadata=!1}u>0&&n===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),n=u),this.state=Ct,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()}else this._forceStartLoad=!0,this.state=Xi},l.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},l.doTick=function(){switch(this.state){case Ct:this.doTickIdle();break;case jr:var n,u=this.levels,h=this.level,f=u==null||(n=u[h])===null||n===void 0?void 0:n.details;if(f&&(!f.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(f))break;this.state=Ct;break}break;case Ar:var p,_=self.performance.now(),S=this.retryDate;(!S||_>=S||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.level),this.state=Ct)}this.onTickEnd()},l.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},l.doTickIdle=function(){var n=this.hls,u=this.levelLastLoaded,h=this.levels,f=this.media,p=n.config,_=n.nextLoadLevel;if(u!==null&&(f||!this.startFragRequested&&p.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&h&&h[_]){var S=h[_],C=this.getMainFwdBufferInfo();if(C!==null){var x=this.getLevelDetails();if(x&&this._streamEnded(C,x)){var W={};return this.altAudio&&(W.type="video"),this.hls.trigger(b.Events.BUFFER_EOS,W),void(this.state=va)}this.level=n.nextLoadLevel=_;var K=S.details;if(!K||this.state===jr||K.live&&this.levelLastLoaded!==_)return this.level=_,void(this.state=jr);if(!(C.len>=this.getMaxBufferLength(S.maxBitrate))){this.backtrackFragment&&this.backtrackFragment.start>C.end&&(this.backtrackFragment=null);var ee=this.backtrackFragment?this.backtrackFragment.start:C.end,me=this.getNextFragment(ee,K);if(this.couldBacktrack&&!this.fragPrevious&&me&&me.sn!=="initSegment"&&this.fragmentTracker.getState(me)!==We.OK){var Ie,ye=((Ie=this.backtrackFragment)!=null?Ie:me).sn-K.startSN,De=K.fragments[ye-1];De&&me.cc===De.cc&&(me=De,this.fragmentTracker.removeFragment(De))}else this.backtrackFragment&&C.len&&(this.backtrackFragment=null);if(me&&this.fragmentTracker.getState(me)===We.OK&&this.nextLoadPosition>ee){var qe=this.audioOnly&&!this.altAudio?X.ElementaryStreamTypes.AUDIO:X.ElementaryStreamTypes.VIDEO,rt=(qe===X.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;rt&&this.afterBufferFlushed(rt,qe,Te.PlaylistLevelType.MAIN),me=this.getNextFragment(this.nextLoadPosition,K)}me&&(!me.initSegment||me.initSegment.data||this.bitrateTest||(me=me.initSegment),this.loadFragment(me,K,ee))}}}},l.loadFragment=function(n,u,h){var f,p=this.fragmentTracker.getState(n);this.fragCurrent=n,p===We.NOT_LOADED?n.sn==="initSegment"?this._loadInitSegment(n,u):this.bitrateTest?(this.log("Fragment "+n.sn+" of level "+n.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(n,u)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,n,u,h)):p===We.APPENDING?this.reduceMaxBufferLength(n.duration)&&this.fragmentTracker.removeFragment(n):((f=this.media)===null||f===void 0?void 0:f.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},l.getAppendedFrag=function(n){var u=this.fragmentTracker.getAppendedFrag(n,Te.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},l.getBufferedFrag=function(n){return this.fragmentTracker.getBufferedFrag(n,Te.PlaylistLevelType.MAIN)},l.followingBufferedFrag=function(n){return n?this.getBufferedFrag(n.end+.5):null},l.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},l.nextLevelSwitch=function(){var n=this.levels,u=this.media;if(u!=null&&u.readyState){var h,f=this.getAppendedFrag(u.currentTime);if(f&&f.start>1&&this.flushMainBuffer(0,f.start-1),!u.paused&&n){var p=n[this.hls.nextLoadLevel],_=this.fragLastKbps;h=_&&this.fragCurrent?this.fragCurrent.duration*p.maxBitrate/(1e3*_)+1:0}else h=0;var S=this.getBufferedFrag(u.currentTime+h);if(S){var C=this.followingBufferedFrag(S);if(C){this.abortCurrentFrag();var x=C.maxStartPTS?C.maxStartPTS:C.start,W=C.duration,K=Math.max(S.end,x+Math.min(Math.max(W-this.config.maxFragLookUpTolerance,.5*W),.75*W));this.flushMainBuffer(K,Number.POSITIVE_INFINITY)}}}},l.abortCurrentFrag=function(){var n=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,n&&n.abortRequests(),this.state){case qs:case Vr:case Ar:case rr:case Wr:this.state=Ct}this.nextLoadPosition=this.getLoadPosition()},l.flushMainBuffer=function(n,u){m.prototype.flushMainBuffer.call(this,n,u,this.altAudio?"video":null)},l.onMediaAttached=function(n,u){m.prototype.onMediaAttached.call(this,n,u);var h=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),h.addEventListener("playing",this.onvplaying),h.addEventListener("seeked",this.onvseeked),this.gapController=new zs(this.config,h,this.fragmentTracker,this.hls)},l.onMediaDetaching=function(){var n=this.media;n&&this.onvplaying&&this.onvseeked&&(n.removeEventListener("playing",this.onvplaying),n.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},l.onMediaPlaying=function(){this.tick()},l.onMediaSeeked=function(){var n=this.media,u=n?n.currentTime:null;(0,R.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},l.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(b.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null,this.backtrackFragment=null},l.onManifestParsed=function(n,u){var h,f,p,_=!1,S=!1;u.levels.forEach(function(C){(h=C.audioCodec)&&(h.indexOf("mp4a.40.2")!==-1&&(_=!0),h.indexOf("mp4a.40.5")!==-1&&(S=!0))}),this.audioCodecSwitch=_&&S&&typeof((p=Za())==null||(f=p.prototype)===null||f===void 0?void 0:f.changeType)!="function",this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},l.onLevelLoading=function(n,u){var h=this.levels;if(h&&this.state===Ct){var f=h[u.level];(!f.details||f.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(f.details))&&(this.state=jr)}},l.onLevelLoaded=function(n,u){var h,f=this.levels,p=u.level,_=u.details,S=_.totalduration;if(f){this.log("Level "+p+" loaded ["+_.startSN+","+_.endSN+"], cc ["+_.startCC+", "+_.endCC+"] duration:"+S);var C=this.fragCurrent;!C||this.state!==Vr&&this.state!==Ar||C.level!==u.level&&C.loader&&(this.state=Ct,this.backtrackFragment=null,C.abortRequests());var x=f[p],W=0;if(_.live||(h=x.details)!==null&&h!==void 0&&h.live){if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed)return;W=this.alignPlaylists(_,x.details)}if(x.details=_,this.levelLastLoaded=p,this.hls.trigger(b.Events.LEVEL_UPDATED,{details:_,level:p}),this.state===jr){if(this.waitForCdnTuneIn(_))return;this.state=Ct}this.startFragRequested?_.live&&this.synchronizeToLiveEdge(_):this.setStartPosition(_,W),this.tick()}else this.warn("Levels were reset while loading level "+p)},l._handleFragmentLoadProgress=function(n){var u,h=n.frag,f=n.part,p=n.payload,_=this.levels;if(_){var S=_[h.level],C=S.details;if(C){var x=S.videoCodec,W=C.PTSKnown||!C.live,K=(u=h.initSegment)===null||u===void 0?void 0:u.data,ee=this._getAudioCodec(S),me=this.transmuxer=this.transmuxer||new Nn(this.hls,Te.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Ie=f?f.index:-1,ye=Ie!==-1,De=new xn(h.level,h.sn,h.stats.chunkCount,p.byteLength,Ie,ye),qe=this.initPTS[h.cc];me.push(p,K,ee,x,h,f,C.totalduration,W,De,qe)}else this.warn("Dropping fragment "+h.sn+" of level "+h.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+h.sn+" of level "+h.level+" will not be buffered")},l.onAudioTrackSwitching=function(n,u){var h=this.altAudio,f=!!u.url,p=u.id;if(!f){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var _=this.fragCurrent;_&&(this.log("Switching to main audio track, cancel main fragment load"),_.abortRequests()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var S=this.hls;h&&S.trigger(b.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),S.trigger(b.Events.AUDIO_TRACK_SWITCHED,{id:p})}},l.onAudioTrackSwitched=function(n,u){var h=u.id,f=!!this.hls.audioTracks[h].url;if(f){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=f,this.tick()},l.onBufferCreated=function(n,u){var h,f,p=u.tracks,_=!1;for(var S in p){var C=p[S];if(C.id==="main"){if(f=S,h=C,S==="video"){var x=p[S];x&&(this.videoBuffer=x.buffer)}}else _=!0}_&&h?(this.log("Alternate track found, use "+f+".buffered to schedule main fragment loading"),this.mediaBuffer=h.buffer):this.mediaBuffer=this.media},l.onFragBuffered=function(n,u){var h=u.frag,f=u.part;if(!h||h.type===Te.PlaylistLevelType.MAIN){if(this.fragContextChanged(h))return this.warn("Fragment "+h.sn+(f?" p: "+f.index:"")+" of level "+h.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Wr&&(this.state=Ct));var p=f?f.stats:h.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),h.sn!=="initSegment"&&(this.fragPrevious=h),this.fragBufferedComplete(h,f)}},l.onError=function(n,u){if(u.type!==P.ErrorTypes.KEY_SYSTEM_ERROR)switch(u.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.FRAG_PARSING_ERROR:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Te.PlaylistLevelType.MAIN,u);break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==lr&&(u.fatal?(this.warn(""+u.details),this.state=lr):u.levelRetry||this.state!==jr||(this.state=Ct));break;case P.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===rr||this.state===Wr)){var h=!0,f=this.getFwdBufferInfo(this.media,Te.PlaylistLevelType.MAIN);f&&f.len>.5&&(h=!this.reduceMaxBufferLength(f.len)),h&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}else this.onFragmentOrKeyLoadError(Te.PlaylistLevelType.MAIN,u)},l.checkBuffer=function(){var n=this.media,u=this.gapController;if(n&&u&&n.readyState){if(this.loadedmetadata||!$t.getBuffered(n).length){var h=this.state!==Ct?this.fragCurrent:null;u.poll(this.lastCurrentTime,h)}this.lastCurrentTime=n.currentTime}},l.onFragLoadEmergencyAborted=function(){this.state=Ct,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},l.onBufferFlushed=function(n,u){var h=u.type;if(h!==X.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var f=(h===X.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(f,h,Te.PlaylistLevelType.MAIN)}},l.onLevelsUpdated=function(n,u){this.levels=u.levels},l.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},l.seekToStartPos=function(){var n=this.media;if(n){var u=n.currentTime,h=this.startPosition;if(h>=0&&u<h){if(n.seeking)return void this.log("could not seek to "+h+", already seeking at "+u);var f=$t.getBuffered(n),p=(f.length?f.start(0):0)-h;p>0&&(p<this.config.maxBufferHole||p<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+p+" to match buffer start"),h+=p,this.startPosition=h),this.log("seek to target start position "+h+" from current time "+u),n.currentTime=h}}},l._getAudioCodec=function(n){var u=this.config.defaultAudioCodec||n.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u=u.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),u},l._loadBitrateTestFrag=function(n,u){var h=this;n.bitrateTest=!0,this._doFragLoad(n,u).then(function(f){var p=h.hls;if(f&&!p.nextLoadLevel&&!h.fragContextChanged(n)){h.fragLoadError=0,h.state=Ct,h.startFragRequested=!1,h.bitrateTest=!1;var _=n.stats;_.parsing.start=_.parsing.end=_.buffering.start=_.buffering.end=self.performance.now(),p.trigger(b.Events.FRAG_LOADED,f),n.bitrateTest=!1}})},l._handleTransmuxComplete=function(n){var u,h="main",f=this.hls,p=n.remuxResult,_=n.chunkMeta,S=this.getCurrentContext(_);if(!S)return this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),void this.resetStartWhenNotLoaded(_.level);var C=S.frag,x=S.part,W=S.level,K=p.video,ee=p.text,me=p.id3,Ie=p.initSegment,ye=W.details,De=this.altAudio?void 0:p.audio;if(!this.fragContextChanged(C)){if(this.state=rr,Ie){Ie.tracks&&(this._bufferInitSegment(W,Ie.tracks,C,_),f.trigger(b.Events.FRAG_PARSING_INIT_SEGMENT,{frag:C,id:h,tracks:Ie.tracks}));var qe=Ie.initPTS,rt=Ie.timescale;(0,R.isFiniteNumber)(qe)&&(this.initPTS[C.cc]=qe,f.trigger(b.Events.INIT_PTS_FOUND,{frag:C,id:h,initPTS:qe,timescale:rt}))}if(K&&p.independent!==!1){if(ye){var we=K.startPTS,je=K.endPTS,Ve=K.startDTS,Tt=K.endDTS;if(x)x.elementaryStreams[K.type]={startPTS:we,endPTS:je,startDTS:Ve,endDTS:Tt};else if(K.firstKeyFrame&&K.independent&&_.id===1&&(this.couldBacktrack=!0),K.dropped&&K.independent){var Wt=this.getMainFwdBufferInfo();if((Wt?Wt.end:this.getLoadPosition())+this.config.maxBufferHole<(K.firstKeyFramePTS?K.firstKeyFramePTS:we)-this.config.maxBufferHole)return void this.backtrack(C);C.setElementaryStreamInfo(K.type,C.start,je,C.start,Tt,!0)}C.setElementaryStreamInfo(K.type,we,je,Ve,Tt),this.backtrackFragment&&(this.backtrackFragment=C),this.bufferFragmentData(K,C,x,_)}}else if(p.independent===!1)return void this.backtrack(C);if(De){var St=De.startPTS,Mt=De.endPTS,Gt=De.startDTS,yi=De.endDTS;x&&(x.elementaryStreams[X.ElementaryStreamTypes.AUDIO]={startPTS:St,endPTS:Mt,startDTS:Gt,endDTS:yi}),C.setElementaryStreamInfo(X.ElementaryStreamTypes.AUDIO,St,Mt,Gt,yi),this.bufferFragmentData(De,C,x,_)}if(ye&&me!=null&&(u=me.samples)!==null&&u!==void 0&&u.length){var fi={id:h,frag:C,details:ye,samples:me.samples};f.trigger(b.Events.FRAG_PARSING_METADATA,fi)}if(ye&&ee){var ei={id:h,frag:C,details:ye,samples:ee.samples};f.trigger(b.Events.FRAG_PARSING_USERDATA,ei)}}},l._bufferInitSegment=function(n,u,h,f){var p=this;if(this.state===rr){this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var _=u.audio,S=u.video,C=u.audiovideo;if(_){var x=n.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(x&&(x=x.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),_.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(x="mp4a.40.5")),W.indexOf("android")!==-1&&_.container!=="audio/mpeg"&&(x="mp4a.40.2",this.log("Android: force audio codec to "+x)),n.audioCodec&&n.audioCodec!==x&&this.log('Swapping manifest audio codec "'+n.audioCodec+'" for "'+x+'"'),_.levelCodec=x,_.id="main",this.log("Init audio buffer, container:"+_.container+", codecs[selected/level/parsed]=["+(x||"")+"/"+(n.audioCodec||"")+"/"+_.codec+"]")}S&&(S.levelCodec=n.videoCodec,S.id="main",this.log("Init video buffer, container:"+S.container+", codecs[level/parsed]=["+(n.videoCodec||"")+"/"+S.codec+"]")),C&&this.log("Init audiovideo buffer, container:"+C.container+", codecs[level/parsed]=["+(n.attrs.CODECS||"")+"/"+C.codec+"]"),this.hls.trigger(b.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(K){var ee=u[K].initSegment;ee!=null&&ee.byteLength&&p.hls.trigger(b.Events.BUFFER_APPENDING,{type:K,data:ee,frag:h,part:null,chunkMeta:f,parent:h.type})}),this.tick()}},l.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Te.PlaylistLevelType.MAIN)},l.backtrack=function(n){this.couldBacktrack=!0,this.backtrackFragment=n,this.resetTransmuxer(),this.flushBufferGap(n),this.fragmentTracker.removeFragment(n),this.fragPrevious=null,this.nextLoadPosition=n.start,this.state=Ct},l.checkFragmentChanged=function(){var n=this.media,u=null;if(n&&n.readyState>1&&n.seeking===!1){var h=n.currentTime;if($t.isBuffered(n,h)?u=this.getAppendedFrag(h):$t.isBuffered(n,h+.1)&&(u=this.getAppendedFrag(h+.1)),u){this.backtrackFragment=null;var f=this.fragPlaying,p=u.level;f&&u.sn===f.sn&&f.level===p&&u.urlId===f.urlId||(this.fragPlaying=u,this.hls.trigger(b.Events.FRAG_CHANGED,{frag:u}),f&&f.level===p||this.hls.trigger(b.Events.LEVEL_SWITCHED,{level:p}))}}},s=i,(o=[{key:"nextLevel",get:function(){var n=this.nextBufferedFrag;return n?n.level:-1}},{key:"currentFrag",get:function(){var n=this.media;return n?this.fragPlaying||this.getAppendedFrag(n.currentTime):null}},{key:"currentProgramDateTime",get:function(){var n=this.media;if(n){var u=n.currentTime,h=this.currentFrag;if(h&&(0,R.isFiniteNumber)(u)&&(0,R.isFiniteNumber)(h.programDateTime)){var f=h.programDateTime+1e3*(u-h.start);return new Date(f)}}return null}},{key:"currentLevel",get:function(){var n=this.currentFrag;return n?n.level:-1}},{key:"nextBufferedFrag",get:function(){var n=this.currentFrag;return n?this.followingBufferedFrag(n):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&qr(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),i}(Qa);let en=function(){function m(e,i,s){i===void 0&&(i=0),s===void 0&&(s=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=i,this.totalWeight_=s}var c=m.prototype;return c.sample=function(e,i){var s=Math.pow(this.alpha_,e);this.estimate_=i*(1-s)+s*this.estimate_,this.totalWeight_+=e},c.getTotalWeight=function(){return this.totalWeight_},c.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},m}(),_l=function(){function m(e,i,s){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new en(e),this.fast_=new en(i)}var c=m.prototype;return c.update=function(e,i){var s=this.slow_,o=this.fast_;this.slow_.halfLife!==e&&(this.slow_=new en(e,s.getEstimate(),s.getTotalWeight())),this.fast_.halfLife!==i&&(this.fast_=new en(i,o.getEstimate(),o.getTotalWeight()))},c.sample=function(e,i){var s=(e=Math.max(e,this.minDelayMs_))/1e3,o=8*i/s;this.fast_.sample(s,o),this.slow_.sample(s,o)},c.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},c.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},c.destroy=function(){},m}();function Al(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}let Sl=function(){function m(s){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=s;var o=s.config;this.bwEstimator=new _l(o.abrEwmaSlowVoD,o.abrEwmaFastVoD,o.abrEwmaDefaultEstimate),this.registerListeners()}var c,e,i=m.prototype;return i.registerListeners=function(){var s=this.hls;s.on(b.Events.FRAG_LOADING,this.onFragLoading,this),s.on(b.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(b.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(b.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(b.Events.ERROR,this.onError,this)},i.unregisterListeners=function(){var s=this.hls;s.off(b.Events.FRAG_LOADING,this.onFragLoading,this),s.off(b.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(b.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(b.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(b.Events.ERROR,this.onError,this)},i.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},i.onFragLoading=function(s,o){var l,n=o.frag;n.type===Te.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=n,this.partCurrent=(l=o.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)))},i.onLevelLoaded=function(s,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},i._abandonRulesCheck=function(){var s=this.fragCurrent,o=this.partCurrent,l=this.hls,n=l.autoLevelEnabled,u=l.media;if(s&&u){var h=o?o.stats:s.stats,f=o?o.duration:s.duration;if(h.aborted||h.loaded&&h.loaded===h.total||s.level===0)return this.clearTimer(),void(this._nextAutoLevel=-1);if(n&&!u.paused&&u.playbackRate&&u.readyState){var p=l.mainForwardBufferInfo;if(p!==null){var _=performance.now()-h.loading.start,S=Math.abs(u.playbackRate);if(!(_<=500*f/S)){var C=h.loaded&&h.loading.first,x=this.bwEstimator.getEstimate(),W=l.levels,K=l.minAutoLevel,ee=W[s.level],me=h.total||Math.max(h.loaded,Math.round(f*ee.maxBitrate/8)),Ie=C?1e3*h.loaded/_:0,ye=Ie?(me-h.loaded)/Ie:8*me/x,De=p.len/S;if(!(ye<=De)){var qe,rt=Number.POSITIVE_INFINITY;for(qe=s.level-1;qe>K;qe--){var we=W[qe].maxBitrate;if((rt=Ie?f*we/(6.4*Ie):f*we/x)<De)break}rt>=ye||(O.logger.warn("Fragment "+s.sn+(o?" part "+o.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+qe+`
16
16
  Current BW estimate: `+((0,R.isFiniteNumber)(x)?(x/1024).toFixed(3):"Unknown")+` Kb/s
17
17
  Estimated load time for current fragment: `+ye.toFixed(3)+` s
18
- Estimated load time for the next fragment: `+it.toFixed(3)+` s
19
- Time to underbuffer: `+De.toFixed(3)+" s"),l.nextLoadLevel=qe,C&&this.bwEstimator.sample(_,h.loaded),this.clearTimer(),(s.loader||s.keyLoader)&&(this.fragCurrent=this.partCurrent=null,s.abortRequests()),l.trigger(y.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:o,stats:h}))}}}}}},r.onFragLoaded=function(s,o){var l=o.frag,n=o.part;if(l.type===Te.PlaylistLevelType.MAIN&&(0,R.isFiniteNumber)(l.sn)){var u=n?n.stats:l.stats,h=n?n.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[l.level],p=(f.loaded?f.loaded.bytes:0)+u.loaded,_=(f.loaded?f.loaded.duration:0)+h;f.loaded={bytes:p,duration:_},f.realBitrate=Math.round(8*p/_)}if(l.bitrateTest){var S={stats:u,frag:l,part:n,id:l.type};this.onFragBuffered(y.Events.FRAG_BUFFERED,S)}}},r.onFragBuffered=function(s,o){var l=o.frag,n=o.part,u=n?n.stats:l.stats;if(!u.aborted&&l.type===Te.PlaylistLevelType.MAIN&&l.sn!=="initSegment"){var h=u.parsing.end-u.loading.start;this.bwEstimator.sample(h,u.loaded),u.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=h/1e3:this.bitrateTestDelay=0}},r.onError=function(s,o){var l;if(((l=o.frag)===null||l===void 0?void 0:l.type)===Te.PlaylistLevelType.MAIN){if(o.type===P.ErrorTypes.KEY_SYSTEM_ERROR)return void this.clearTimer();switch(o.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:this.clearTimer()}}},r.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},r.getNextABRAutoLevel=function(){var s=this.fragCurrent,o=this.partCurrent,l=this.hls,n=l.maxAutoLevel,u=l.config,h=l.minAutoLevel,f=l.media,p=o?o.duration:s?s.duration:0,_=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,S=this.bwEstimator?this.bwEstimator.getEstimate():u.abrEwmaDefaultEstimate,C=l.mainForwardBufferInfo,x=(C?C.len:0)/_,W=this.findBestLevel(S,h,n,x,u.abrBandWidthFactor,u.abrBandWidthUpFactor);if(W>=0)return W;O.logger.trace((x?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var K=p?Math.min(p,u.maxStarvationDelay):u.maxStarvationDelay,ee=u.abrBandWidthFactor,me=u.abrBandWidthUpFactor;if(!x){var we=this.bitrateTestDelay;we&&(K=(p?Math.min(p,u.maxLoadingDelay):u.maxLoadingDelay)-we,O.logger.trace("bitrate test took "+Math.round(1e3*we)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*K)+" ms"),ee=me=1)}return W=this.findBestLevel(S,h,n,x+K,ee,me),Math.max(W,0)},r.findBestLevel=function(s,o,l,n,u,h){for(var f,p=this.fragCurrent,_=this.partCurrent,S=this.lastLoadedFragLevel,C=this.hls.levels,x=C[S],W=!(x==null||(f=x.details)===null||f===void 0||!f.live),K=x==null?void 0:x.codecSet,ee=_?_.duration:p?p.duration:0,me=l;me>=o;me--){var we=C[me];if(we&&(!K||we.codecSet===K)){var ye,De=we.details,qe=(_?De==null?void 0:De.partTarget:De==null?void 0:De.averagetargetduration)||ee;ye=me<=S?u*s:h*s;var it=C[me].maxBitrate,Ie=it*qe/ye;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+me+"/"+Math.round(ye)+"/"+it+"/"+qe+"/"+n+"/"+Ie),ye>it&&(Ie===0||!(0,R.isFiniteNumber)(Ie)||W&&!this.bitrateTestDelay||Ie<n))return me}}return-1},c=m,(e=[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,o=this.bwEstimator;if(s!==-1&&!o.canEstimate())return s;var l=this.getNextABRAutoLevel();return s!==-1&&this.hls.levels[l].loadError?s:(s!==-1&&(l=Math.min(s,l)),l)},set:function(s){this._nextAutoLevel=s}}])&&Al(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}();var Qs=function(){function m(){this.chunks=[],this.dataLength=0}var c=m.prototype;return c.push=function(e){this.chunks.push(e),this.dataLength+=e.length},c.flush=function(){var e,r=this.chunks,s=this.dataLength;return r.length?(e=r.length===1?r[0]:function(o,l){for(var n=new Uint8Array(l),u=0,h=0;h<o.length;h++){var f=o[h];n.set(f,u),u+=f.length}return n}(r,s),this.reset(),e):new Uint8Array(0)},c.reset=function(){this.chunks.length=0,this.dataLength=0},m}();function tn(){return tn=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(m[r]=e[r])}return m},tn.apply(this,arguments)}function Fn(m,c){return Fn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Fn(m,c)}var rn=function(m){var c,e;function r(o,l,n){var u;return(u=m.call(this,o,l,n,"[audio-stream-controller]")||this).videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u.cachedTrackLoadedData=null,u._registerListeners(),u}e=m,(c=r).prototype=Object.create(e.prototype),c.prototype.constructor=c,Fn(c,e);var s=r.prototype;return s.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},s._registerListeners=function(){var o=this.hls;o.on(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(y.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.on(y.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.on(y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(y.Events.ERROR,this.onError,this),o.on(y.Events.BUFFER_RESET,this.onBufferReset,this),o.on(y.Events.BUFFER_CREATED,this.onBufferCreated,this),o.on(y.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.on(y.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(y.Events.FRAG_BUFFERED,this.onFragBuffered,this)},s._unregisterListeners=function(){var o=this.hls;o.off(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(y.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.off(y.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.off(y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(y.Events.ERROR,this.onError,this),o.off(y.Events.BUFFER_RESET,this.onBufferReset,this),o.off(y.Events.BUFFER_CREATED,this.onBufferCreated,this),o.off(y.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.off(y.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.off(y.Events.FRAG_BUFFERED,this.onFragBuffered,this)},s.onInitPtsFound=function(o,l){var n=l.frag,u=l.id,h=l.initPTS;if(u==="main"){var f=n.cc;this.initPTS[n.cc]=h,this.log("InitPTS for cc: "+f+" found from main: "+h),this.videoTrackCC=f,this.state===Si&&this.tick()}},s.startLoad=function(o){if(!this.levels)return this.startPosition=o,void(this.state=Xr);var l=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,l>0&&o===-1?(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),o=l,this.state=Ct):(this.loadedmetadata=!1,this.state=za),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=o,this.tick()},s.doTick=function(){switch(this.state){case Ct:this.doTickIdle();break;case za:var o,l=this.levels,n=this.trackId,u=l==null||(o=l[n])===null||o===void 0?void 0:o.details;if(u){if(this.waitForCdnTuneIn(u))break;this.state=Si}break;case Ai:var h,f=performance.now(),p=this.retryDate;(!p||f>=p||(h=this.media)!==null&&h!==void 0&&h.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=Ct);break;case Si:var _=this.waitingData;if(_){var S=_.frag,C=_.part,x=_.cache,W=_.complete;if(this.initPTS[S.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=Vi;var K={frag:S,part:C,payload:x.flush(),networkDetails:null};this._handleFragmentLoadProgress(K),W&&m.prototype._handleFragmentLoadComplete.call(this,K)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+S.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ee=this.getLoadPosition(),me=$t.bufferInfo(this.mediaBuffer,ee,this.config.maxBufferHole);$a(me.end,this.config.maxFragLookUpTolerance,S)<0&&(this.log("Waiting fragment cc ("+S.cc+") @ "+S.start+" cancelled because another fragment at "+me.end+" is needed"),this.clearWaitingFragment())}}else this.state=Ct}this.onTickEnd()},s.clearWaitingFragment=function(){var o=this.waitingData;o&&(this.fragmentTracker.removeFragment(o.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Ct)},s.resetLoadingState=function(){this.clearWaitingFragment(),m.prototype.resetLoadingState.call(this)},s.onTickEnd=function(){var o=this.media;o&&o.readyState&&(this.lastCurrentTime=o.currentTime)},s.doTickIdle=function(){var o=this.hls,l=this.levels,n=this.media,u=this.trackId,h=o.config;if(l&&l[u]&&(n||!this.startFragRequested&&h.startFragPrefetch)){var f=l[u].details;if(!f||f.live&&this.levelLastLoaded!==u||this.waitForCdnTuneIn(f))this.state=za;else{var p=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&p&&(this.bufferFlushed=!1,this.afterBufferFlushed(p,X.ElementaryStreamTypes.AUDIO,Te.PlaylistLevelType.AUDIO));var _=this.getFwdBufferInfo(p,Te.PlaylistLevelType.AUDIO);if(_!==null){var S=this.audioSwitch;if(!S&&this._streamEnded(_,f))return o.trigger(y.Events.BUFFER_EOS,{type:"audio"}),void(this.state=va);var C=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Te.PlaylistLevelType.MAIN);if(!(_.len>=this.getMaxBufferLength(C==null?void 0:C.len))||S){var x=f.fragments[0].start,W=_.end;if(S&&n){var K=this.getLoadPosition();W=K,f.PTSKnown&&K<x&&(_.end>x||_.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=x+.05)}if(!(C&&W>C.end+f.targetduration)&&(C&&C.len||!_.len)){var ee=this.getNextFragment(W,f);ee?this.loadFragment(ee,f,W):this.bufferFlushed=!0}}}}}},s.getMaxBufferLength=function(o){var l=m.prototype.getMaxBufferLength.call(this);return o?Math.max(l,o):l},s.onMediaDetaching=function(){this.videoBuffer=null,m.prototype.onMediaDetaching.call(this)},s.onAudioTracksUpdated=function(o,l){var n=l.audioTracks;this.resetTransmuxer(),this.levels=n.map(function(u){return new j(u)})},s.onAudioTrackSwitching=function(o,l){var n=!!l.url;this.trackId=l.id;var u=this.fragCurrent;u&&u.abortRequests(),this.fragCurrent=null,this.clearWaitingFragment(),n?this.setInterval(100):this.resetTransmuxer(),n?(this.audioSwitch=!0,this.state=Ct):this.state=Xr,this.tick()},s.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},s.onLevelLoaded=function(o,l){this.mainDetails=l.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(y.Events.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},s.onAudioTrackLoaded=function(o,l){var n;if(this.mainDetails!=null){var u=this.levels,h=l.details,f=l.id;if(u){this.log("Track "+f+" loaded ["+h.startSN+","+h.endSN+"],duration:"+h.totalduration);var p=u[f],_=0;if(h.live||(n=p.details)!==null&&n!==void 0&&n.live){var S=this.mainDetails;if(h.fragments[0]||(h.deltaUpdateFailed=!0),h.deltaUpdateFailed||!S)return;!p.details&&h.hasProgramDateTime&&S.hasProgramDateTime?(Vs(h,S),_=h.fragments[0].start):_=this.alignPlaylists(h,p.details)}p.details=h,this.levelLastLoaded=f,this.startFragRequested||!this.mainDetails&&h.live||this.setStartPosition(p.details,_),this.state!==za||this.waitForCdnTuneIn(h)||(this.state=Ct),this.tick()}else this.warn("Audio tracks were reset while loading level "+f)}else this.cachedTrackLoadedData=l},s._handleFragmentLoadProgress=function(o){var l,n=o.frag,u=o.part,h=o.payload,f=this.config,p=this.trackId,_=this.levels;if(_){var S=_[p],C=S.details,x=f.defaultAudioCodec||S.audioCodec||"mp4a.40.2",W=this.transmuxer;W||(W=this.transmuxer=new Nn(this.hls,Te.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var K=this.initPTS[n.cc],ee=(l=n.initSegment)===null||l===void 0?void 0:l.data;if(K!==void 0){var me=u?u.index:-1,we=me!==-1,ye=new xn(n.level,n.sn,n.stats.chunkCount,h.byteLength,me,we);W.push(h,ee,x,"",n,u,C.totalduration,!1,ye,K)}else this.log("Unknown video PTS for cc "+n.cc+", waiting for video PTS before demuxing audio frag "+n.sn+" of ["+C.startSN+" ,"+C.endSN+"],track "+p),(this.waitingData=this.waitingData||{frag:n,part:u,cache:new Qs,complete:!1}).cache.push(new Uint8Array(h)),this.waitingVideoCC=this.videoTrackCC,this.state=Si}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+n.sn+" of level "+n.level+" will not be buffered")},s._handleFragmentLoadComplete=function(o){this.waitingData?this.waitingData.complete=!0:m.prototype._handleFragmentLoadComplete.call(this,o)},s.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},s.onBufferCreated=function(o,l){var n=l.tracks.audio;n&&(this.mediaBuffer=n.buffer||null),l.tracks.video&&(this.videoBuffer=l.tracks.video.buffer||null)},s.onFragBuffered=function(o,l){var n,u=l.frag,h=l.part;u.type===Te.PlaylistLevelType.AUDIO?this.fragContextChanged(u)?this.warn("Fragment "+u.sn+(h?" p: "+h.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):(u.sn!=="initSegment"&&(this.fragPrevious=u,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(y.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(u,h)):this.loadedmetadata||u.type!==Te.PlaylistLevelType.MAIN||(n=this.videoBuffer||this.media)!==null&&n!==void 0&&n.buffered.length&&(this.loadedmetadata=!0)},s.onError=function(o,l){if(l.type!==P.ErrorTypes.KEY_SYSTEM_ERROR)switch(l.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.FRAG_PARSING_ERROR:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Te.PlaylistLevelType.AUDIO,l);break;case P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==li&&this.state!==Xr&&(this.state=l.fatal?li:Ct,this.warn(l.details+" while loading frag, switching to "+this.state+" state"));break;case P.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="audio"&&(this.state===ii||this.state===Wi)){var n=!0,u=this.getFwdBufferInfo(this.mediaBuffer,Te.PlaylistLevelType.AUDIO);u&&u.len>.5&&(n=!this.reduceMaxBufferLength(u.len)),n&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}else this.onFragmentOrKeyLoadError(Te.PlaylistLevelType.AUDIO,l)},s.onBufferFlushed=function(o,l){l.type===X.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0,this.state===va&&(this.state=Ct))},s._handleTransmuxComplete=function(o){var l,n="audio",u=this.hls,h=o.remuxResult,f=o.chunkMeta,p=this.getCurrentContext(f);if(!p)return this.warn("The loading context changed while buffering fragment "+f.sn+" of level "+f.level+". This chunk will not be buffered."),void this.resetStartWhenNotLoaded(f.level);var _=p.frag,S=p.part,C=p.level.details,x=h.audio,W=h.text,K=h.id3,ee=h.initSegment;if(!this.fragContextChanged(_)&&C){if(this.state=ii,this.audioSwitch&&x&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,_,f),u.trigger(y.Events.FRAG_PARSING_INIT_SEGMENT,{frag:_,id:n,tracks:ee.tracks})),x){var me=x.startPTS,we=x.endPTS,ye=x.startDTS,De=x.endDTS;S&&(S.elementaryStreams[X.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:we,startDTS:ye,endDTS:De}),_.setElementaryStreamInfo(X.ElementaryStreamTypes.AUDIO,me,we,ye,De),this.bufferFragmentData(x,_,S,f)}if(K!=null&&(l=K.samples)!==null&&l!==void 0&&l.length){var qe=tn({id:n,frag:_,details:C},K);u.trigger(y.Events.FRAG_PARSING_METADATA,qe)}if(W){var it=tn({id:n,frag:_,details:C},W);u.trigger(y.Events.FRAG_PARSING_USERDATA,it)}}},s._bufferInitSegment=function(o,l,n){if(this.state===ii){o.video&&delete o.video;var u=o.audio;if(u){u.levelCodec=u.codec,u.id="audio",this.log("Init audio buffer, container:"+u.container+", codecs[parsed]=["+u.codec+"]"),this.hls.trigger(y.Events.BUFFER_CODECS,o);var h=u.initSegment;if(h!=null&&h.byteLength){var f={type:"audio",frag:l,part:null,chunkMeta:n,parent:l.type,data:h};this.hls.trigger(y.Events.BUFFER_APPENDING,f)}this.tick()}}},s.loadFragment=function(o,l,n){var u=this.fragmentTracker.getState(o);this.fragCurrent=o,(this.audioSwitch||u===We.NOT_LOADED||u===We.PARTIAL)&&(o.sn==="initSegment"?this._loadInitSegment(o,l):l.live&&!(0,R.isFiniteNumber)(this.initPTS[o.cc])?(this.log("Waiting for video PTS in continuity counter "+o.cc+" of live stream before loading audio fragment "+o.sn+" of level "+this.trackId),this.state=Si):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,o,l,n)))},s.completeAudioSwitch=function(){var o=this.hls,l=this.media,n=this.trackId;l&&(this.log("Switching audio track : flushing all audio"),m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,o.trigger(y.Events.AUDIO_TRACK_SWITCHED,{id:n})},r}(Qa);let Bn=rn;function Xs(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}function ya(m,c){return ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},ya(m,c)}let kl=function(m){var c,e;function r(n){var u;return(u=m.call(this,n,"[audio-track-controller]")||this).tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}e=m,(c=r).prototype=Object.create(e.prototype),c.prototype.constructor=c,ya(c,e);var s,o,l=r.prototype;return l.registerListeners=function(){var n=this.hls;n.on(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(y.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(y.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.on(y.Events.ERROR,this.onError,this)},l.unregisterListeners=function(){var n=this.hls;n.off(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(y.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(y.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.off(y.Events.ERROR,this.onError,this)},l.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,m.prototype.destroy.call(this)},l.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},l.onManifestParsed=function(n,u){this.tracks=u.audioTracks||[]},l.onAudioTrackLoaded=function(n,u){var h=u.id,f=u.details,p=this.tracksInGroup[h];if(p){var _=p.details;p.details=u.details,this.log("audioTrack "+h+" loaded ["+f.startSN+"-"+f.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,u,_))}else this.warn("Invalid audio track id "+h)},l.onLevelLoading=function(n,u){this.switchLevel(u.level)},l.onLevelSwitching=function(n,u){this.switchLevel(u.level)},l.switchLevel=function(n){var u=this.hls.levels[n];if(u!=null&&u.audioGroupIds){var h=u.audioGroupIds[u.urlId];if(this.groupId!==h){this.groupId=h;var f=this.tracks.filter(function(_){return!h||_.groupId===h});this.selectDefaultTrack&&!f.some(function(_){return _.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=f;var p={audioTracks:f};this.log("Updating audio tracks, "+f.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(y.Events.AUDIO_TRACKS_UPDATED,p),this.selectInitialTrack()}}},l.onError=function(n,u){m.prototype.onError.call(this,n,u),!u.fatal&&u.context&&u.context.type===Te.PlaylistContextType.AUDIO_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},l.setAudioTrack=function(n){var u=this.tracksInGroup;if(n<0||n>=u.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var h=u[this.trackId];this.log("Now switching to audio-track index "+n);var f=u[n],p=f.id,_=f.groupId,S=_===void 0?"":_,C=f.name,x=f.type,W=f.url;if(this.trackId=n,this.trackName=C,this.selectDefaultTrack=!1,this.hls.trigger(y.Events.AUDIO_TRACK_SWITCHING,{id:p,groupId:S,name:C,type:x,url:W}),!f.details||f.details.live){var K=this.switchParams(f.url,h==null?void 0:h.details);this.loadPlaylist(K)}}},l.selectInitialTrack=function(){this.tracksInGroup;var n=this.trackName,u=this.findTrackId(n)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},l.findTrackId=function(n){for(var u=this.tracksInGroup,h=0;h<u.length;h++){var f=u[h];if((!this.selectDefaultTrack||f.default)&&(!n||n===f.name))return f.id}return-1},l.loadPlaylist=function(n){m.prototype.loadPlaylist.call(this);var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var h=u.id,f=u.groupId,p=u.url;if(n)try{p=n.addDirectives(p)}catch(_){this.warn("Could not construct new URL with HLS Delivery Directives: "+_)}this.log("loading audio-track playlist for id: "+h),this.clearTimer(),this.hls.trigger(y.Events.AUDIO_TRACK_LOADING,{url:p,id:h,groupId:f,deliveryDirectives:n||null})}},s=r,(o=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1,this.setAudioTrack(n)}}])&&Xs(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),r}(Ce);function wl(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}function Hn(m,c){return Hn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Hn(m,c)}var Il=function(m){var c,e;function r(n,u,h){var f;return(f=m.call(this,n,u,h,"[subtitle-stream-controller]")||this).levels=[],f.currentTrackId=-1,f.tracksBuffered=[],f.mainDetails=null,f._registerListeners(),f}e=m,(c=r).prototype=Object.create(e.prototype),c.prototype.constructor=c,Hn(c,e);var s,o,l=r.prototype;return l.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},l._registerListeners=function(){var n=this.hls;n.on(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(y.Events.ERROR,this.onError,this),n.on(y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.on(y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),n.on(y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.on(y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),n.on(y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(y.Events.FRAG_BUFFERED,this.onFragBuffered,this)},l._unregisterListeners=function(){var n=this.hls;n.off(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(y.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(y.Events.ERROR,this.onError,this),n.off(y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.off(y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),n.off(y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.off(y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),n.off(y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(y.Events.FRAG_BUFFERED,this.onFragBuffered,this)},l.startLoad=function(n){this.stopLoad(),this.state=Ct,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()},l.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},l.onLevelLoaded=function(n,u){this.mainDetails=u.details},l.onSubtitleFragProcessed=function(n,u){var h=u.frag,f=u.success;if(this.fragPrevious=h,this.state=Ct,f){var p=this.tracksBuffered[this.currentTrackId];if(p){for(var _,S=h.start,C=0;C<p.length;C++)if(S>=p[C].start&&S<=p[C].end){_=p[C];break}var x=h.start+h.duration;_?_.end=x:(_={start:S,end:x},p.push(_)),this.fragmentTracker.fragBuffered(h)}}},l.onBufferFlushing=function(n,u){var h=u.startOffset,f=u.endOffset;if(h===0&&f!==Number.POSITIVE_INFINITY){var p=this.currentTrackId,_=this.levels;if(!_.length||!_[p]||!_[p].details)return;var S=f-_[p].details.targetduration;if(S<=0)return;u.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(C){for(var x=0;x<C.length;)if(C[x].end<=S)C.shift();else{if(!(C[x].start<S))break;C[x].start=S,x++}}),this.fragmentTracker.removeFragmentsInRange(h,S,Te.PlaylistLevelType.SUBTITLE)}},l.onFragBuffered=function(n,u){var h;this.loadedmetadata||u.frag.type!==Te.PlaylistLevelType.MAIN||(h=this.media)!==null&&h!==void 0&&h.buffered.length&&(this.loadedmetadata=!0)},l.onError=function(n,u){var h=u.frag;h&&h.type===Te.PlaylistLevelType.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state=Ct)},l.onSubtitleTracksUpdated=function(n,u){var h=this,f=u.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(p){return new j(p)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(p){h.tracksBuffered[p.id]=[]}),this.mediaBuffer=null},l.onSubtitleTrackSwitch=function(n,u){if(this.currentTrackId=u.id,this.levels.length&&this.currentTrackId!==-1){var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(500)}else this.clearInterval()},l.onSubtitleTrackLoaded=function(n,u){var h,f=u.details,p=u.id,_=this.currentTrackId,S=this.levels;if(S.length){var C=S[_];if(!(p>=S.length||p!==_)&&C){this.mediaBuffer=this.mediaBufferTimeRanges;var x=0;if(f.live||(h=C.details)!==null&&h!==void 0&&h.live){var W=this.mainDetails;if(f.deltaUpdateFailed||!W)return;var K=W.fragments[0];C.details?(x=this.alignPlaylists(f,C.details))===0&&K&&Ae(f,x=K.start):f.hasProgramDateTime&&W.hasProgramDateTime?(Vs(f,W),x=f.fragments[0].start):K&&Ae(f,x=K.start)}C.details=f,this.levelLastLoaded=p,this.startFragRequested||!this.mainDetails&&f.live||this.setStartPosition(C.details,x),this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===Ct&&(Ya(null,f.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),C.details=void 0))}}},l._handleFragmentLoadComplete=function(n){var u=this,h=n.frag,f=n.payload,p=h.decryptdata,_=this.hls;if(!this.fragContextChanged(h)&&f&&f.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var S=performance.now();this.decrypter.decrypt(new Uint8Array(f),p.key.buffer,p.iv.buffer).then(function(C){var x=performance.now();_.trigger(y.Events.FRAG_DECRYPTED,{frag:h,payload:C,stats:{tstart:S,tdecrypt:x}})}).catch(function(C){u.warn(C.name+": "+C.message),u.state=Ct})}},l.doTick=function(){if(this.media){if(this.state===Ct){var n=this.currentTrackId,u=this.levels;if(!u.length||!u[n]||!u[n].details)return;var h=u[n].details,f=h.targetduration,p=this.config,_=this.getLoadPosition(),S=$t.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],_-f,p.maxBufferHole),C=S.end,x=S.len,W=this.getFwdBufferInfo(this.media,Te.PlaylistLevelType.MAIN);if(x>this.getMaxBufferLength(W==null?void 0:W.len)+f)return;var K=h.fragments,ee=K.length,me=h.edge,we=null,ye=this.fragPrevious;if(C<me){var De=p.maxFragLookUpTolerance;!(we=Ya(ye,K,Math.max(K[0].start,C),De))&&ye&&ye.start<K[0].start&&(we=K[0])}else we=K[ee-1];if(!we)return;we=this.mapToInitFragWhenRequired(we),this.fragmentTracker.getState(we)===We.NOT_LOADED&&this.loadFragment(we,h,C)}}else this.state=Ct},l.getMaxBufferLength=function(n){var u=m.prototype.getMaxBufferLength.call(this);return n?Math.max(u,n):u},l.loadFragment=function(n,u,h){this.fragCurrent=n,n.sn==="initSegment"?this._loadInitSegment(n,u):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,n,u,h))},s=r,(o=[{key:"mediaBufferTimeRanges",get:function(){return new Ll(this.tracksBuffered[this.currentTrackId]||[])}}])&&wl(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),r}(Qa),Ll=function(m){this.buffered=void 0;var c=function(e,r,s){if((r>>>=0)>s-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+r+") is greater than the maximum bound ("+s+")");return m[r][e]};this.buffered={get length(){return m.length},end:function(e){return c("end",e,m.length)},start:function(e){return c("start",e,m.length)}}};function Dl(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}function Kn(m,c){return Kn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Kn(m,c)}function Gn(m){for(var c=[],e=0;e<m.length;e++){var r=m[e];r.kind==="subtitles"&&r.label&&c.push(m[e])}return c}let Rl=function(m){var c,e;function r(n){var u;return(u=m.call(this,n,"[subtitle-track-controller]")||this).media=null,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.selectDefaultTrack=!0,u.queuedDefaultTrack=-1,u.trackChangeListener=function(){return u.onTextTracksChanged()},u.asyncPollTrackChange=function(){return u.pollTrackChange(0)},u.useTextTrackPolling=!1,u.subtitlePollingInterval=-1,u._subtitleDisplay=!0,u.registerListeners(),u}e=m,(c=r).prototype=Object.create(e.prototype),c.prototype.constructor=c,Kn(c,e);var s,o,l=r.prototype;return l.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,m.prototype.destroy.call(this)},l.registerListeners=function(){var n=this.hls;n.on(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(y.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(y.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.on(y.Events.ERROR,this.onError,this)},l.unregisterListeners=function(){var n=this.hls;n.off(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(y.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(y.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.off(y.Events.ERROR,this.onError,this)},l.onMediaAttached=function(n,u){this.media=u.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},l.pollTrackChange=function(n){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,n)},l.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Gn(this.media.textTracks).forEach(function(n){gt(n)}),this.subtitleTrack=-1,this.media=null)},l.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},l.onManifestParsed=function(n,u){this.tracks=u.subtitleTracks},l.onSubtitleTrackLoaded=function(n,u){var h=u.id,f=u.details,p=this.trackId,_=this.tracksInGroup[p];if(_){var S=_.details;_.details=u.details,this.log("subtitle track "+h+" loaded ["+f.startSN+"-"+f.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,u,S))}else this.warn("Invalid subtitle track id "+h)},l.onLevelLoading=function(n,u){this.switchLevel(u.level)},l.onLevelSwitching=function(n,u){this.switchLevel(u.level)},l.switchLevel=function(n){var u=this.hls.levels[n];if(u!=null&&u.textGroupIds){var h=u.textGroupIds[u.urlId];if(this.groupId!==h){var f=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(C){return!h||C.groupId===h});this.tracksInGroup=p;var _=this.findTrackId(f==null?void 0:f.name)||this.findTrackId();this.groupId=h;var S={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(y.Events.SUBTITLE_TRACKS_UPDATED,S),_!==-1&&this.setSubtitleTrack(_,f)}}},l.findTrackId=function(n){for(var u=this.tracksInGroup,h=0;h<u.length;h++){var f=u[h];if((!this.selectDefaultTrack||f.default)&&(!n||n===f.name))return f.id}return-1},l.onError=function(n,u){m.prototype.onError.call(this,n,u),!u.fatal&&u.context&&u.context.type===Te.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},l.loadPlaylist=function(n){m.prototype.loadPlaylist.call(this);var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var h=u.id,f=u.groupId,p=u.url;if(n)try{p=n.addDirectives(p)}catch(_){this.warn("Could not construct new URL with HLS Delivery Directives: "+_)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(y.Events.SUBTITLE_TRACK_LOADING,{url:p,id:h,groupId:f,deliveryDirectives:n||null})}},l.toggleTrackModes=function(n){var u=this,h=this.media,f=this.trackId;if(h){var p=Gn(h.textTracks),_=p.filter(function(x){return x.groupId===u.groupId});if(n===-1)[].slice.call(p).forEach(function(x){x.mode="disabled"});else{var S=_[f];S&&(S.mode="disabled")}var C=_[n];C&&(C.mode=this.subtitleDisplay?"showing":"hidden")}},l.setSubtitleTrack=function(n,u){var h,f=this.tracksInGroup;if(this.media){if(this.trackId!==n&&this.toggleTrackModes(n),!(this.trackId===n&&(n===-1||(h=f[n])!==null&&h!==void 0&&h.details)||n<-1||n>=f.length)){this.clearTimer();var p=f[n];if(this.log("Switching to subtitle track "+n),this.trackId=n,p){var _=p.id,S=p.groupId,C=S===void 0?"":S,x=p.name,W=p.type,K=p.url;this.hls.trigger(y.Events.SUBTITLE_TRACK_SWITCH,{id:_,groupId:C,name:x,type:W,url:K});var ee=this.switchParams(p.url,u==null?void 0:u.details);this.loadPlaylist(ee)}else this.hls.trigger(y.Events.SUBTITLE_TRACK_SWITCH,{id:n})}}else this.queuedDefaultTrack=n},l.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var n=-1,u=Gn(this.media.textTracks),h=0;h<u.length;h++)if(u[h].mode==="hidden")n=h;else if(u[h].mode==="showing"){n=h;break}this.subtitleTrack!==n&&(this.subtitleTrack=n)}},s=r,(o=[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(n){this._subtitleDisplay=n,this.trackId>-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(n,u)}}])&&Dl(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),r}(Ce);var It,Wr=function(){function m(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var c=m.prototype;return c.append=function(e,r){var s=this.queues[r];s.push(e),s.length===1&&this.buffers[r]&&this.executeNext(r)},c.insertAbort=function(e,r){this.queues[r].unshift(e),this.executeNext(r)},c.appendBlocker=function(e){var r,s=new Promise(function(l){r=l}),o={execute:r,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(o,e),s},c.executeNext=function(e){var r=this.buffers,s=this.queues,o=r[e],l=s[e];if(l.length){var n=l[0];try{n.execute()}catch(u){O.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),n.onError(u),o&&o.updating||(l.shift(),this.executeNext(e))}}},c.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},c.current=function(e){return this.queues[e][0]},m}(),Yi=Xa(),Zs=/([ha]vc.)(?:\.[^.,]+)+/,Cl=function(){function m(e){var r=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=r.hls,o=r.media,l=r.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),o&&(r.updateMediaElementDuration(),s.trigger(y.Events.MEDIA_ATTACHED,{media:o})),l&&l.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var c=m.prototype;return c.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},c.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null},c.registerListeners=function(){var e=this.hls;e.on(y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(y.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(y.Events.BUFFER_RESET,this.onBufferReset,this),e.on(y.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(y.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(y.Events.BUFFER_EOS,this.onBufferEos,this),e.on(y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(y.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(y.Events.FRAG_PARSED,this.onFragParsed,this),e.on(y.Events.FRAG_CHANGED,this.onFragChanged,this)},c.unregisterListeners=function(){var e=this.hls;e.off(y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(y.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(y.Events.BUFFER_RESET,this.onBufferReset,this),e.off(y.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(y.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(y.Events.BUFFER_EOS,this.onBufferEos,this),e.off(y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(y.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(y.Events.FRAG_PARSED,this.onFragParsed,this),e.off(y.Events.FRAG_CHANGED,this.onFragChanged,this)},c._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new Wr(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null},c.onManifestParsed=function(e,r){var s=2;(r.audio&&!r.video||!r.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},c.onMediaAttaching=function(e,r){var s=this.media=r.media;if(s&&Yi){var o=this.mediaSource=new Yi;o.addEventListener("sourceopen",this._onMediaSourceOpen),o.addEventListener("sourceended",this._onMediaSourceEnded),o.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(o),this._objectUrl=s.src}},c.onMediaDetaching=function(){var e=this.media,r=this.mediaSource,s=this._objectUrl;if(r){if(O.logger.log("[buffer-controller]: media source detaching"),r.readyState==="open")try{r.endOfStream()}catch(o){O.logger.warn("[buffer-controller]: onMediaDetaching: "+o.message+" while calling endOfStream")}this.onBufferReset(),r.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("sourceended",this._onMediaSourceEnded),r.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(s&&self.URL.revokeObjectURL(s),e.src===s?(e.removeAttribute("src"),e.load()):O.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(y.Events.MEDIA_DETACHED,void 0)},c.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(r){var s=e.sourceBuffer[r];try{s&&(e.removeBufferListeners(r),e.mediaSource&&e.mediaSource.removeSourceBuffer(s),e.sourceBuffer[r]=void 0)}catch(o){O.logger.warn("[buffer-controller]: Failed to reset the "+r+" buffer",o)}}),this._initSourceBuffer()},c.onBufferCodecs=function(e,r){var s=this,o=this.getSourceBufferTypes().length;Object.keys(r).forEach(function(l){if(o){var n=s.tracks[l];if(n&&typeof n.buffer.changeType=="function"){var u=r[l],h=u.id,f=u.codec,p=u.levelCodec,_=u.container,S=u.metadata,C=(n.levelCodec||n.codec).replace(Zs,"$1"),x=(p||f).replace(Zs,"$1");if(C!==x){var W=_+";codecs="+(p||f);s.appendChangeType(l,W),O.logger.log("[buffer-controller]: switching codec "+C+" to "+x),s.tracks[l]={buffer:n.buffer,codec:f,container:_,levelCodec:p,metadata:S,id:h}}}}else s.pendingTracks[l]=r[l]}),o||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},c.appendChangeType=function(e,r){var s=this,o=this.operationQueue,l={execute:function(){var n=s.sourceBuffer[e];n&&(O.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+r),n.changeType(r)),o.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(n){O.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",n)}};o.append(l,e)},c.onBufferAppending=function(e,r){var s=this,o=this.hls,l=this.operationQueue,n=this.tracks,u=r.data,h=r.type,f=r.frag,p=r.part,_=r.chunkMeta,S=_.buffering[h],C=self.performance.now();S.start=C;var x=f.stats.buffering,W=p?p.stats.buffering:null;x.start===0&&(x.start=C),W&&W.start===0&&(W.start=C);var K=n.audio,ee=!1;h==="audio"&&(K==null?void 0:K.container)==="audio/mpeg"&&(ee=!this.lastMpegAudioChunk||_.id===1||this.lastMpegAudioChunk.sn!==_.sn,this.lastMpegAudioChunk=_);var me=f.start,we={execute:function(){if(S.executeStart=self.performance.now(),ee){var ye=s.sourceBuffer[h];if(ye){var De=me-ye.timestampOffset;Math.abs(De)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+me+" (delta: "+De+") sn: "+f.sn+")"),ye.timestampOffset=me)}}s.appendExecutor(u,h)},onStart:function(){},onComplete:function(){var ye=self.performance.now();S.executeEnd=S.end=ye,x.first===0&&(x.first=ye),W&&W.first===0&&(W.first=ye);var De=s.sourceBuffer,qe={};for(var it in De)qe[it]=$t.getBuffered(De[it]);s.appendError=0,s.hls.trigger(y.Events.BUFFER_APPENDED,{type:h,frag:f,part:p,chunkMeta:_,parent:f.type,timeRanges:qe})},onError:function(ye){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+h+" SourceBuffer",ye);var De={type:P.ErrorTypes.MEDIA_ERROR,parent:f.type,details:P.ErrorDetails.BUFFER_APPEND_ERROR,err:ye,fatal:!1};ye.code===DOMException.QUOTA_EXCEEDED_ERR?De.details=P.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,De.details=P.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>o.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+o.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),De.fatal=!0,o.stopLoad())),o.trigger(y.Events.ERROR,De)}};l.append(we,h)},c.onBufferFlushing=function(e,r){var s=this,o=this.operationQueue,l=function(n){return{execute:s.removeExecutor.bind(s,n,r.startOffset,r.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(y.Events.BUFFER_FLUSHED,{type:n})},onError:function(u){O.logger.warn("[buffer-controller]: Failed to remove from "+n+" SourceBuffer",u)}}};r.type?o.append(l(r.type),r.type):this.getSourceBufferTypes().forEach(function(n){o.append(l(n),n)})},c.onFragParsed=function(e,r){var s=this,o=r.frag,l=r.part,n=[],u=l?l.elementaryStreams:o.elementaryStreams;u[X.ElementaryStreamTypes.AUDIOVIDEO]?n.push("audiovideo"):(u[X.ElementaryStreamTypes.AUDIO]&&n.push("audio"),u[X.ElementaryStreamTypes.VIDEO]&&n.push("video")),n.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+o.type+" level: "+o.level+" sn: "+o.sn),this.blockBuffers(function(){var h=self.performance.now();o.stats.buffering.end=h,l&&(l.stats.buffering.end=h);var f=l?l.stats:o.stats;s.hls.trigger(y.Events.FRAG_BUFFERED,{frag:o,part:l,stats:f,id:o.type})},n)},c.onFragChanged=function(e,r){this.flushBackBuffer()},c.onBufferEos=function(e,r){var s=this;this.getSourceBufferTypes().reduce(function(o,l){var n=s.sourceBuffer[l];return!n||r.type&&r.type!==l||(n.ending=!0,n.ended||(n.ended=!0,O.logger.log("[buffer-controller]: "+l+" sourceBuffer now EOS"))),o&&!(n&&!n.ended)},!0)&&(O.logger.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){s.getSourceBufferTypes().forEach(function(l){var n=s.sourceBuffer[l];n&&(n.ending=!1)});var o=s.mediaSource;o&&o.readyState==="open"?(O.logger.log("[buffer-controller]: Calling mediaSource.endOfStream()"),o.endOfStream()):o&&O.logger.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+o.readyState)}))},c.onLevelUpdated=function(e,r){var s=r.details;s.fragments.length&&(this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},c.flushBackBuffer=function(){var e=this.hls,r=this.details,s=this.media,o=this.sourceBuffer;if(s&&r!==null){var l=this.getSourceBufferTypes();if(l.length){var n=r.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if((0,R.isFiniteNumber)(n)&&!(n<0)){var u=s.currentTime,h=r.levelTargetDuration,f=Math.max(n,h),p=Math.floor(u/h)*h-f;l.forEach(function(_){var S=o[_];if(S){var C=$t.getBuffered(S);if(C.length>0&&p>C.start(0)){if(e.trigger(y.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),r.live)e.trigger(y.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p});else if(S.ended&&C.end(C.length-1)-u<2*h)return void O.logger.info("[buffer-controller]: Cannot flush "+_+" back buffer while SourceBuffer is in ended state");e.trigger(y.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:_})}}})}}}},c.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&this.mediaSource.readyState==="open"){var e=this.details,r=this.hls,s=this.media,o=this.mediaSource,l=e.fragments[0].start+e.totalduration,n=s.duration,u=(0,R.isFiniteNumber)(o.duration)?o.duration:0;e.live&&r.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),o.duration=1/0,this.updateSeekableRange(e)):(l>u&&l>n||!(0,R.isFiniteNumber)(n))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+l.toFixed(3)),o.duration=l)}},c.updateSeekableRange=function(e){var r=this.mediaSource,s=e.fragments;if(s.length&&e.live&&r!=null&&r.setLiveSeekableRange){var o=Math.max(0,s[0].start),l=Math.max(o,o+e.totalduration);r.setLiveSeekableRange(o,l)}},c.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,r=this.operationQueue,s=this.pendingTracks,o=Object.keys(s).length;if(o&&!e||o===2){this.createSourceBuffers(s),this.pendingTracks={};var l=this.getSourceBufferTypes();if(l.length===0)return void this.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});l.forEach(function(n){r.executeNext(n)})}},c.createSourceBuffers=function(e){var r=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var o=0;for(var l in e)if(!r[l]){var n=e[l];if(!n)throw Error("source buffer exists for track "+l+", however track does not");var u=n.levelCodec||n.codec,h=n.container+";codecs="+u;O.logger.log("[buffer-controller]: creating sourceBuffer("+h+")");try{var f=r[l]=s.addSourceBuffer(h),p=l;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[l]={buffer:f,codec:u,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id},o++}catch(_){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+_.message),this.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:_,mimeType:h})}}o&&this.hls.trigger(y.Events.BUFFER_CREATED,{tracks:this.tracks})},c._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},c._onSBUpdateEnd=function(e){var r=this.operationQueue;r.current(e).onComplete(),r.shiftAndExecuteNext(e)},c._onSBUpdateError=function(e,r){O.logger.error("[buffer-controller]: "+e+" SourceBuffer error",r),this.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(e);s&&s.onError(r)},c.removeExecutor=function(e,r,s){var o=this.media,l=this.mediaSource,n=this.operationQueue,u=this.sourceBuffer[e];if(!o||!l||!u)return O.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void n.shiftAndExecuteNext(e);var h=(0,R.isFiniteNumber)(o.duration)?o.duration:1/0,f=(0,R.isFiniteNumber)(l.duration)?l.duration:1/0,p=Math.max(0,r),_=Math.min(s,h,f);_>p&&!u.ending?(u.ended=!1,O.logger.log("[buffer-controller]: Removing ["+p+","+_+"] from the "+e+" SourceBuffer"),u.remove(p,_)):n.shiftAndExecuteNext(e)},c.appendExecutor=function(e,r){var s=this.operationQueue,o=this.sourceBuffer[r];if(!o)return O.logger.warn("[buffer-controller]: Attempting to append to the "+r+" SourceBuffer, but it does not exist"),void s.shiftAndExecuteNext(r);o.ended=!1,o.appendBuffer(e)},c.blockBuffers=function(e,r){var s=this;if(r===void 0&&(r=this.getSourceBufferTypes()),!r.length)return O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var o=this.operationQueue,l=r.map(function(n){return o.appendBlocker(n)});Promise.all(l).then(function(){e(),r.forEach(function(n){var u=s.sourceBuffer[n];u&&u.updating||o.shiftAndExecuteNext(n)})})},c.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},c.addBufferListener=function(e,r,s){var o=this.sourceBuffer[e];if(o){var l=s.bind(this,e);this.listeners[e].push({event:r,listener:l}),o.addEventListener(r,l)}},c.removeBufferListeners=function(e){var r=this.sourceBuffer[e];r&&this.listeners[e].forEach(function(s){r.removeEventListener(s.event,s.listener)})},m}(),A={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},E=function(m){var c=m;return A.hasOwnProperty(m)&&(c=A[m]),String.fromCharCode(c)},T=15,k=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},V={17:2,18:4,21:6,22:8,23:10,19:13,20:15},B={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},J={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ge=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(It||(It={}));var ne=function(){function m(){this.time=null,this.verboseLevel=It.ERROR}return m.prototype.log=function(c,e){if(this.verboseLevel>=c){var r=typeof e=="function"?e():e;O.logger.log(this.time+" ["+c+"] "+r)}},m}(),Be=function(m){for(var c=[],e=0;e<m.length;e++)c.push(m[e].toString(16));return c},mt=function(){function m(e,r,s,o,l){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=r||!1,this.italics=s||!1,this.background=o||"black",this.flash=l||!1}var c=m.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(e){for(var r=["foreground","underline","italics","background","flash"],s=0;s<r.length;s++){var o=r[s];e.hasOwnProperty(o)&&(this[o]=e[o])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},c.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},m}(),nt=function(){function m(e,r,s,o,l,n){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new mt(r,s,o,l,n)}var c=m.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(e,r){this.uchar=e,this.penState.copy(r)},c.setPenState=function(e){this.penState.copy(e)},c.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},c.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},m}(),ht=function(){function m(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var r=0;r<k;r++)this.chars.push(new nt);this.logger=e,this.pos=0,this.currPenState=new mt}var c=m.prototype;return c.equals=function(e){for(var r=!0,s=0;s<k;s++)if(!this.chars[s].equals(e.chars[s])){r=!1;break}return r},c.copy=function(e){for(var r=0;r<k;r++)this.chars[r].copy(e.chars[r])},c.isEmpty=function(){for(var e=!0,r=0;r<k;r++)if(!this.chars[r].isEmpty()){e=!1;break}return e},c.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(It.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(It.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},c.moveCursor=function(e){var r=this.pos+e;if(e>1)for(var s=this.pos+1;s<r+1;s++)this.chars[s].setPenState(this.currPenState);this.setCursor(r)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(e){var r=this;e>=144&&this.backSpace();var s=E(e);this.pos>=k?this.logger.log(It.ERROR,function(){return"Cannot insert "+e.toString(16)+" ("+s+") at position "+r.pos+". Skipping it!"}):(this.chars[this.pos].setChar(s,this.currPenState),this.moveCursor(1))},c.clearFromPos=function(e){var r;for(r=e;r<k;r++)this.chars[r].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var e=[],r=!0,s=0;s<k;s++){var o=this.chars[s].uchar;o!==" "&&(r=!1),e.push(o)}return r?"":e.join("")},c.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},m}(),Je=function(){function m(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var r=0;r<T;r++)this.rows.push(new ht(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=m.prototype;return c.reset=function(){for(var e=0;e<T;e++)this.rows[e].clear();this.currRow=14},c.equals=function(e){for(var r=!0,s=0;s<T;s++)if(!this.rows[s].equals(e.rows[s])){r=!1;break}return r},c.copy=function(e){for(var r=0;r<T;r++)this.rows[r].copy(e.rows[r])},c.isEmpty=function(){for(var e=!0,r=0;r<T;r++)if(!this.rows[r].isEmpty()){e=!1;break}return e},c.backSpace=function(){this.rows[this.currRow].backSpace()},c.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},c.insertChar=function(e){this.rows[this.currRow].insertChar(e)},c.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},c.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},c.setCursor=function(e){this.logger.log(It.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},c.setPAC=function(e){this.logger.log(It.INFO,function(){return"pacData = "+JSON.stringify(e)});var r=e.row-1;if(this.nrRollUpRows&&r<this.nrRollUpRows-1&&(r=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==r){for(var s=0;s<T;s++)this.rows[s].clear();var o=this.currRow+1-this.nrRollUpRows,l=this.lastOutputScreen;if(l){var n=l.rows[o].cueStartTime,u=this.logger.time;if(n&&u!==null&&n<u)for(var h=0;h<this.nrRollUpRows;h++)this.rows[r-this.nrRollUpRows+h+1].copy(l.rows[o+h])}}this.currRow=r;var f=this.rows[this.currRow];if(e.indent!==null){var p=e.indent,_=Math.max(p-1,0);f.setCursor(e.indent),e.color=f.chars[_].penState.foreground}var S={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(S)},c.setBkgData=function(e){this.logger.log(It.INFO,function(){return"bkgData = "+JSON.stringify(e)}),this.backSpace(),this.setPen(e),this.insertChar(32)},c.setRollUpRows=function(e){this.nrRollUpRows=e},c.rollUp=function(){var e=this;if(this.nrRollUpRows!==null){this.logger.log(It.TEXT,function(){return e.getDisplayText()});var r=this.currRow+1-this.nrRollUpRows,s=this.rows.splice(r,1)[0];s.clear(),this.rows.splice(this.currRow,0,s),this.logger.log(It.INFO,"Rolling up")}else this.logger.log(It.DEBUG,"roll_up but nrRollUpRows not set yet")},c.getDisplayText=function(e){e=e||!1;for(var r=[],s="",o=-1,l=0;l<T;l++){var n=this.rows[l].getTextString();n&&(o=l+1,e?r.push("Row "+o+": '"+n+"'"):r.push(n.trim()))}return r.length>0&&(s=e?"["+r.join(" | ")+"]":r.join(`
20
- `)),s},c.getTextAndFormat=function(){return this.rows},m}(),ft=function(){function m(e,r,s){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=e,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new Je(s),this.nonDisplayedMemory=new Je(s),this.lastOutputScreen=new Je(s),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}var c=m.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(e){this.outputFilter=e},c.setPAC=function(e){this.writeScreen.setPAC(e)},c.setBkgData=function(e){this.writeScreen.setBkgData(e)},c.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(It.INFO,function(){return"MODE="+e}),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=e)},c.insertChars=function(e){for(var r=this,s=0;s<e.length;s++)this.writeScreen.insertChar(e[s]);var o=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(It.INFO,function(){return o+": "+r.writeScreen.getDisplayText(!0)}),this.mode!=="MODE_PAINT-ON"&&this.mode!=="MODE_ROLL-UP"||(this.logger.log(It.TEXT,function(){return"DISPLAYED: "+r.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(It.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){this.logger.log(It.INFO,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(It.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(e){this.logger.log(It.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},c.ccFON=function(){this.logger.log(It.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(It.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(It.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(It.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(It.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(It.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(It.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){var e=this;if(this.logger.log(It.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var r=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=r,this.writeScreen=this.nonDisplayedMemory,this.logger.log(It.TEXT,function(){return"DISP: "+e.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)},c.ccTO=function(e){this.logger.log(It.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},c.ccMIDROW=function(e){var r={flash:!1};if(r.underline=e%2==1,r.italics=e>=46,r.italics)r.foreground="white";else{var s=Math.floor(e/2)-16;r.foreground=["white","green","blue","cyan","red","yellow","magenta"][s]}this.logger.log(It.INFO,"MIDROW: "+JSON.stringify(r)),this.writeScreen.setPen(r)},c.outputDataUpdate=function(e){e===void 0&&(e=!1);var r=this.logger.time;r!==null&&this.outputFilter&&(this.cueStartTime!==null||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,r,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:r):this.cueStartTime=r,this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},m}(),Kt=function(){function m(e,r,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var o=new ne;this.channels=[null,new ft(e,r,o),new ft(e+1,s,o)],this.cmdHistory={a:null,b:null},this.logger=o}var c=m.prototype;return c.getHandler=function(e){return this.channels[e].getHandler()},c.setHandler=function(e,r){this.channels[e].setHandler(r)},c.addData=function(e,r){var s,o,l,n=!1;this.logger.time=e;for(var u=0;u<r.length;u+=2)if(o=127&r[u],l=127&r[u+1],o!==0||l!==0){if(this.logger.log(It.DATA,"["+Be([r[u],r[u+1]])+"] -> ("+Be([o,l])+")"),(s=this.parseCmd(o,l))||(s=this.parseMidrow(o,l)),s||(s=this.parsePAC(o,l)),s||(s=this.parseBackgroundAttributes(o,l)),!s&&(n=this.parseChars(o,l))){var h=this.currentChannel;h&&h>0?this.channels[h].insertChars(n):this.logger.log(It.WARNING,"No channel found yet. TEXT-MODE?")}s||n||this.logger.log(It.WARNING,"Couldn't parse cleaned data "+Be([o,l])+" orig: "+Be([r[u],r[u+1]]))}},c.parseCmd=function(e,r){var s=this.cmdHistory;if(!((e===20||e===28||e===21||e===29)&&r>=32&&r<=47||(e===23||e===31)&&r>=33&&r<=35))return!1;if(Er(e,r,s))return Zt(null,null,s),this.logger.log(It.DEBUG,"Repeated command ("+Be([e,r])+") is dropped"),!0;var o=e===20||e===21||e===23?1:2,l=this.channels[o];return e===20||e===21||e===28||e===29?r===32?l.ccRCL():r===33?l.ccBS():r===34?l.ccAOF():r===35?l.ccAON():r===36?l.ccDER():r===37?l.ccRU(2):r===38?l.ccRU(3):r===39?l.ccRU(4):r===40?l.ccFON():r===41?l.ccRDC():r===42?l.ccTR():r===43?l.ccRTD():r===44?l.ccEDM():r===45?l.ccCR():r===46?l.ccENM():r===47&&l.ccEOC():l.ccTO(r-32),Zt(e,r,s),this.currentChannel=o,!0},c.parseMidrow=function(e,r){var s=0;if((e===17||e===25)&&r>=32&&r<=47){if((s=e===17?1:2)!==this.currentChannel)return this.logger.log(It.ERROR,"Mismatch channel in midrow parsing"),!1;var o=this.channels[s];return!!o&&(o.ccMIDROW(r),this.logger.log(It.DEBUG,"MIDROW ("+Be([e,r])+")"),!0)}return!1},c.parsePAC=function(e,r){var s,o=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&r>=64&&r<=127||(e===16||e===24)&&r>=64&&r<=95))return!1;if(Er(e,r,o))return Zt(null,null,o),!0;var l=e<=23?1:2;s=r>=64&&r<=95?l===1?D[e]:B[e]:l===1?V[e]:J[e];var n=this.channels[l];return!!n&&(n.setPAC(this.interpretPAC(s,r)),Zt(e,r,o),this.currentChannel=l,!0)},c.interpretPAC=function(e,r){var s,o={color:null,italics:!1,indent:null,underline:!1,row:e};return s=r>95?r-96:r-64,o.underline=(1&s)==1,s<=13?o.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(o.italics=!0,o.color="white"):o.indent=4*Math.floor((s-16)/2),o},c.parseChars=function(e,r){var s,o,l=null,n=null;if(e>=25?(s=2,n=e-8):(s=1,n=e),n>=17&&n<=19?(o=n===17?r+80:n===18?r+112:r+144,this.logger.log(It.INFO,"Special char '"+E(o)+"' in channel "+s),l=[o]):e>=32&&e<=127&&(l=r===0?[e]:[e,r]),l){var u=Be(l);this.logger.log(It.DEBUG,"Char codes = "+u.join(",")),Zt(e,r,this.cmdHistory)}return l},c.parseBackgroundAttributes=function(e,r){var s;if(!((e===16||e===24)&&r>=32&&r<=47||(e===23||e===31)&&r>=45&&r<=47))return!1;var o={};e===16||e===24?(s=Math.floor((r-32)/2),o.background=ge[s],r%2==1&&(o.background=o.background+"_semi")):r===45?o.background="transparent":(o.foreground="black",r===47&&(o.underline=!0));var l=e<=23?1:2;return this.channels[l].setBkgData(o),Zt(e,r,this.cmdHistory),!0},c.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var r=this.channels[e];r&&r.reset()}this.cmdHistory={a:null,b:null}},c.cueSplitAtTime=function(e){for(var r=0;r<this.channels.length;r++){var s=this.channels[r];s&&s.cueSplitAtTime(e)}},m}();function Zt(m,c,e){e.a=m,e.b=c}function Er(m,c,e){return e.a===m&&e.b===c}let Dr=Kt;var Dt=function(){function m(e,r){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=r}var c=m.prototype;return c.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},c.newCue=function(e,r,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=r,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)},c.reset=function(){this.cueRanges=[],this.startTime=null},m}();let hr=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var m=["","lr","rl"],c=["start","middle","end","left","right"];function e(l,n){if(typeof n!="string"||!Array.isArray(l))return!1;var u=n.toLowerCase();return!!~l.indexOf(u)&&u}function r(l){return e(c,l)}function s(l){for(var n=arguments.length,u=new Array(n>1?n-1:0),h=1;h<n;h++)u[h-1]=arguments[h];for(var f=1;f<arguments.length;f++){var p=arguments[f];for(var _ in p)l[_]=p[_]}return l}function o(l,n,u){var h=this,f={enumerable:!0};h.hasBeenReset=!1;var p="",_=!1,S=l,C=n,x=u,W=null,K="",ee=!0,me="auto",we="start",ye=50,De="middle",qe=50,it="middle";Object.defineProperty(h,"id",s({},f,{get:function(){return p},set:function(Ie){p=""+Ie}})),Object.defineProperty(h,"pauseOnExit",s({},f,{get:function(){return _},set:function(Ie){_=!!Ie}})),Object.defineProperty(h,"startTime",s({},f,{get:function(){return S},set:function(Ie){if(typeof Ie!="number")throw new TypeError("Start time must be set to a number.");S=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",s({},f,{get:function(){return C},set:function(Ie){if(typeof Ie!="number")throw new TypeError("End time must be set to a number.");C=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",s({},f,{get:function(){return x},set:function(Ie){x=""+Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",s({},f,{get:function(){return W},set:function(Ie){W=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",s({},f,{get:function(){return K},set:function(Ie){var je=function(Ve){return e(m,Ve)}(Ie);if(je===!1)throw new SyntaxError("An invalid or illegal string was specified.");K=je,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",s({},f,{get:function(){return ee},set:function(Ie){ee=!!Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",s({},f,{get:function(){return me},set:function(Ie){if(typeof Ie!="number"&&Ie!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");me=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",s({},f,{get:function(){return we},set:function(Ie){var je=r(Ie);if(!je)throw new SyntaxError("An invalid or illegal string was specified.");we=je,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",s({},f,{get:function(){return ye},set:function(Ie){if(Ie<0||Ie>100)throw new Error("Position must be between 0 and 100.");ye=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",s({},f,{get:function(){return De},set:function(Ie){var je=r(Ie);if(!je)throw new SyntaxError("An invalid or illegal string was specified.");De=je,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",s({},f,{get:function(){return qe},set:function(Ie){if(Ie<0||Ie>100)throw new Error("Size must be between 0 and 100.");qe=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",s({},f,{get:function(){return it},set:function(Ie){var je=r(Ie);if(!je)throw new SyntaxError("An invalid or illegal string was specified.");it=je,this.hasBeenReset=!0}})),h.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();var kr=function(){function m(){}return m.prototype.decode=function(c,e){if(!c)return"";if(typeof c!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(c))},m}();function Pt(m){function c(r,s,o,l){return 3600*(0|r)+60*(0|s)+(0|o)+parseFloat(l||0)}var e=m.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return e?parseFloat(e[2])>59?c(e[2],e[3],0,e[4]):c(e[1],e[2],e[3],e[4]):null}var dt=function(){function m(){this.values=Object.create(null)}var c=m.prototype;return c.set=function(e,r){this.get(e)||r===""||(this.values[e]=r)},c.get=function(e,r,s){return s?this.has(e)?this.values[e]:r[s]:this.has(e)?this.values[e]:r},c.has=function(e){return e in this.values},c.alt=function(e,r,s){for(var o=0;o<s.length;++o)if(r===s[o]){this.set(e,r);break}},c.integer=function(e,r){/^-?\d+$/.test(r)&&this.set(e,parseInt(r,10))},c.percent=function(e,r){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(r)){var s=parseFloat(r);if(s>=0&&s<=100)return this.set(e,s),!0}return!1},m}();function bt(m,c,e,r){var s=r?m.split(r):[m];for(var o in s)if(typeof s[o]=="string"){var l=s[o].split(e);l.length===2&&c(l[0],l[1])}}var st=new hr(0,0,""),yt=st.align==="middle"?"middle":"center";function Jt(m,c,e){var r=m;function s(){var l=Pt(m);if(l===null)throw new Error("Malformed timestamp: "+r);return m=m.replace(/^[^\sa-zA-Z-]+/,""),l}function o(){m=m.replace(/^\s+/,"")}if(o(),c.startTime=s(),o(),m.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+r);m=m.slice(3),o(),c.endTime=s(),o(),function(l,n){var u=new dt;bt(l,function(p,_){var S;switch(p){case"region":for(var C=e.length-1;C>=0;C--)if(e[C].id===_){u.set(p,e[C].region);break}break;case"vertical":u.alt(p,_,["rl","lr"]);break;case"line":S=_.split(","),u.integer(p,S[0]),u.percent(p,S[0])&&u.set("snapToLines",!1),u.alt(p,S[0],["auto"]),S.length===2&&u.alt("lineAlign",S[1],["start",yt,"end"]);break;case"position":S=_.split(","),u.percent(p,S[0]),S.length===2&&u.alt("positionAlign",S[1],["start",yt,"end","line-left","line-right","auto"]);break;case"size":u.percent(p,_);break;case"align":u.alt(p,_,["start",yt,"end","left","right"])}},/:/,/\s/),n.region=u.get("region",null),n.vertical=u.get("vertical","");var h=u.get("line","auto");h==="auto"&&st.line===-1&&(h=-1),n.line=h,n.lineAlign=u.get("lineAlign","start"),n.snapToLines=u.get("snapToLines",!0),n.size=u.get("size",100),n.align=u.get("align",yt);var f=u.get("position","auto");f==="auto"&&st.position===50&&(f=n.align==="start"||n.align==="left"?0:n.align==="end"||n.align==="right"?100:50),n.position=f}(m,c)}function ar(m){return m.replace(/<br(?: \/)?>/gi,`
21
- `)}var Cr=function(){function m(){this.state="INITIAL",this.buffer="",this.decoder=new kr,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var c=m.prototype;return c.parse=function(e){var r=this;function s(){var h=r.buffer,f=0;for(h=ar(h);f<h.length&&h[f]!=="\r"&&h[f]!==`
18
+ Estimated load time for the next fragment: `+rt.toFixed(3)+` s
19
+ Time to underbuffer: `+De.toFixed(3)+" s"),l.nextLoadLevel=qe,C&&this.bwEstimator.sample(_,h.loaded),this.clearTimer(),(s.loader||s.keyLoader)&&(this.fragCurrent=this.partCurrent=null,s.abortRequests()),l.trigger(b.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:o,stats:h}))}}}}}},i.onFragLoaded=function(s,o){var l=o.frag,n=o.part;if(l.type===Te.PlaylistLevelType.MAIN&&(0,R.isFiniteNumber)(l.sn)){var u=n?n.stats:l.stats,h=n?n.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[l.level],p=(f.loaded?f.loaded.bytes:0)+u.loaded,_=(f.loaded?f.loaded.duration:0)+h;f.loaded={bytes:p,duration:_},f.realBitrate=Math.round(8*p/_)}if(l.bitrateTest){var S={stats:u,frag:l,part:n,id:l.type};this.onFragBuffered(b.Events.FRAG_BUFFERED,S)}}},i.onFragBuffered=function(s,o){var l=o.frag,n=o.part,u=n?n.stats:l.stats;if(!u.aborted&&l.type===Te.PlaylistLevelType.MAIN&&l.sn!=="initSegment"){var h=u.parsing.end-u.loading.start;this.bwEstimator.sample(h,u.loaded),u.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=h/1e3:this.bitrateTestDelay=0}},i.onError=function(s,o){var l;if(((l=o.frag)===null||l===void 0?void 0:l.type)===Te.PlaylistLevelType.MAIN){if(o.type===P.ErrorTypes.KEY_SYSTEM_ERROR)return void this.clearTimer();switch(o.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:this.clearTimer()}}},i.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},i.getNextABRAutoLevel=function(){var s=this.fragCurrent,o=this.partCurrent,l=this.hls,n=l.maxAutoLevel,u=l.config,h=l.minAutoLevel,f=l.media,p=o?o.duration:s?s.duration:0,_=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,S=this.bwEstimator?this.bwEstimator.getEstimate():u.abrEwmaDefaultEstimate,C=l.mainForwardBufferInfo,x=(C?C.len:0)/_,W=this.findBestLevel(S,h,n,x,u.abrBandWidthFactor,u.abrBandWidthUpFactor);if(W>=0)return W;O.logger.trace((x?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var K=p?Math.min(p,u.maxStarvationDelay):u.maxStarvationDelay,ee=u.abrBandWidthFactor,me=u.abrBandWidthUpFactor;if(!x){var Ie=this.bitrateTestDelay;Ie&&(K=(p?Math.min(p,u.maxLoadingDelay):u.maxLoadingDelay)-Ie,O.logger.trace("bitrate test took "+Math.round(1e3*Ie)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*K)+" ms"),ee=me=1)}return W=this.findBestLevel(S,h,n,x+K,ee,me),Math.max(W,0)},i.findBestLevel=function(s,o,l,n,u,h){for(var f,p=this.fragCurrent,_=this.partCurrent,S=this.lastLoadedFragLevel,C=this.hls.levels,x=C[S],W=!(x==null||(f=x.details)===null||f===void 0||!f.live),K=x==null?void 0:x.codecSet,ee=_?_.duration:p?p.duration:0,me=l;me>=o;me--){var Ie=C[me];if(Ie&&(!K||Ie.codecSet===K)){var ye,De=Ie.details,qe=(_?De==null?void 0:De.partTarget:De==null?void 0:De.averagetargetduration)||ee;ye=me<=S?u*s:h*s;var rt=C[me].maxBitrate,we=rt*qe/ye;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+me+"/"+Math.round(ye)+"/"+rt+"/"+qe+"/"+n+"/"+we),ye>rt&&(we===0||!(0,R.isFiniteNumber)(we)||W&&!this.bitrateTestDelay||we<n))return me}}return-1},c=m,(e=[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,o=this.bwEstimator;if(s!==-1&&!o.canEstimate())return s;var l=this.getNextABRAutoLevel();return s!==-1&&this.hls.levels[l].loadError?s:(s!==-1&&(l=Math.min(s,l)),l)},set:function(s){this._nextAutoLevel=s}}])&&Al(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}();var Qs=function(){function m(){this.chunks=[],this.dataLength=0}var c=m.prototype;return c.push=function(e){this.chunks.push(e),this.dataLength+=e.length},c.flush=function(){var e,i=this.chunks,s=this.dataLength;return i.length?(e=i.length===1?i[0]:function(o,l){for(var n=new Uint8Array(l),u=0,h=0;h<o.length;h++){var f=o[h];n.set(f,u),u+=f.length}return n}(i,s),this.reset(),e):new Uint8Array(0)},c.reset=function(){this.chunks.length=0,this.dataLength=0},m}();function tn(){return tn=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(m[i]=e[i])}return m},tn.apply(this,arguments)}function Fn(m,c){return Fn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},Fn(m,c)}var rn=function(m){var c,e;function i(o,l,n){var u;return(u=m.call(this,o,l,n,"[audio-stream-controller]")||this).videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u.cachedTrackLoadedData=null,u._registerListeners(),u}e=m,(c=i).prototype=Object.create(e.prototype),c.prototype.constructor=c,Fn(c,e);var s=i.prototype;return s.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},s._registerListeners=function(){var o=this.hls;o.on(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(b.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(b.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.on(b.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.on(b.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(b.Events.ERROR,this.onError,this),o.on(b.Events.BUFFER_RESET,this.onBufferReset,this),o.on(b.Events.BUFFER_CREATED,this.onBufferCreated,this),o.on(b.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.on(b.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(b.Events.FRAG_BUFFERED,this.onFragBuffered,this)},s._unregisterListeners=function(){var o=this.hls;o.off(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(b.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(b.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.off(b.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.off(b.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(b.Events.ERROR,this.onError,this),o.off(b.Events.BUFFER_RESET,this.onBufferReset,this),o.off(b.Events.BUFFER_CREATED,this.onBufferCreated,this),o.off(b.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.off(b.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.off(b.Events.FRAG_BUFFERED,this.onFragBuffered,this)},s.onInitPtsFound=function(o,l){var n=l.frag,u=l.id,h=l.initPTS;if(u==="main"){var f=n.cc;this.initPTS[n.cc]=h,this.log("InitPTS for cc: "+f+" found from main: "+h),this.videoTrackCC=f,this.state===Sr&&this.tick()}},s.startLoad=function(o){if(!this.levels)return this.startPosition=o,void(this.state=Xi);var l=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,l>0&&o===-1?(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),o=l,this.state=Ct):(this.loadedmetadata=!1,this.state=za),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=o,this.tick()},s.doTick=function(){switch(this.state){case Ct:this.doTickIdle();break;case za:var o,l=this.levels,n=this.trackId,u=l==null||(o=l[n])===null||o===void 0?void 0:o.details;if(u){if(this.waitForCdnTuneIn(u))break;this.state=Sr}break;case Ar:var h,f=performance.now(),p=this.retryDate;(!p||f>=p||(h=this.media)!==null&&h!==void 0&&h.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=Ct);break;case Sr:var _=this.waitingData;if(_){var S=_.frag,C=_.part,x=_.cache,W=_.complete;if(this.initPTS[S.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=Vr;var K={frag:S,part:C,payload:x.flush(),networkDetails:null};this._handleFragmentLoadProgress(K),W&&m.prototype._handleFragmentLoadComplete.call(this,K)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+S.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ee=this.getLoadPosition(),me=$t.bufferInfo(this.mediaBuffer,ee,this.config.maxBufferHole);$a(me.end,this.config.maxFragLookUpTolerance,S)<0&&(this.log("Waiting fragment cc ("+S.cc+") @ "+S.start+" cancelled because another fragment at "+me.end+" is needed"),this.clearWaitingFragment())}}else this.state=Ct}this.onTickEnd()},s.clearWaitingFragment=function(){var o=this.waitingData;o&&(this.fragmentTracker.removeFragment(o.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Ct)},s.resetLoadingState=function(){this.clearWaitingFragment(),m.prototype.resetLoadingState.call(this)},s.onTickEnd=function(){var o=this.media;o&&o.readyState&&(this.lastCurrentTime=o.currentTime)},s.doTickIdle=function(){var o=this.hls,l=this.levels,n=this.media,u=this.trackId,h=o.config;if(l&&l[u]&&(n||!this.startFragRequested&&h.startFragPrefetch)){var f=l[u].details;if(!f||f.live&&this.levelLastLoaded!==u||this.waitForCdnTuneIn(f))this.state=za;else{var p=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&p&&(this.bufferFlushed=!1,this.afterBufferFlushed(p,X.ElementaryStreamTypes.AUDIO,Te.PlaylistLevelType.AUDIO));var _=this.getFwdBufferInfo(p,Te.PlaylistLevelType.AUDIO);if(_!==null){var S=this.audioSwitch;if(!S&&this._streamEnded(_,f))return o.trigger(b.Events.BUFFER_EOS,{type:"audio"}),void(this.state=va);var C=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Te.PlaylistLevelType.MAIN);if(!(_.len>=this.getMaxBufferLength(C==null?void 0:C.len))||S){var x=f.fragments[0].start,W=_.end;if(S&&n){var K=this.getLoadPosition();W=K,f.PTSKnown&&K<x&&(_.end>x||_.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=x+.05)}if(!(C&&W>C.end+f.targetduration)&&(C&&C.len||!_.len)){var ee=this.getNextFragment(W,f);ee?this.loadFragment(ee,f,W):this.bufferFlushed=!0}}}}}},s.getMaxBufferLength=function(o){var l=m.prototype.getMaxBufferLength.call(this);return o?Math.max(l,o):l},s.onMediaDetaching=function(){this.videoBuffer=null,m.prototype.onMediaDetaching.call(this)},s.onAudioTracksUpdated=function(o,l){var n=l.audioTracks;this.resetTransmuxer(),this.levels=n.map(function(u){return new j(u)})},s.onAudioTrackSwitching=function(o,l){var n=!!l.url;this.trackId=l.id;var u=this.fragCurrent;u&&u.abortRequests(),this.fragCurrent=null,this.clearWaitingFragment(),n?this.setInterval(100):this.resetTransmuxer(),n?(this.audioSwitch=!0,this.state=Ct):this.state=Xi,this.tick()},s.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},s.onLevelLoaded=function(o,l){this.mainDetails=l.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(b.Events.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},s.onAudioTrackLoaded=function(o,l){var n;if(this.mainDetails!=null){var u=this.levels,h=l.details,f=l.id;if(u){this.log("Track "+f+" loaded ["+h.startSN+","+h.endSN+"],duration:"+h.totalduration);var p=u[f],_=0;if(h.live||(n=p.details)!==null&&n!==void 0&&n.live){var S=this.mainDetails;if(h.fragments[0]||(h.deltaUpdateFailed=!0),h.deltaUpdateFailed||!S)return;!p.details&&h.hasProgramDateTime&&S.hasProgramDateTime?(Vs(h,S),_=h.fragments[0].start):_=this.alignPlaylists(h,p.details)}p.details=h,this.levelLastLoaded=f,this.startFragRequested||!this.mainDetails&&h.live||this.setStartPosition(p.details,_),this.state!==za||this.waitForCdnTuneIn(h)||(this.state=Ct),this.tick()}else this.warn("Audio tracks were reset while loading level "+f)}else this.cachedTrackLoadedData=l},s._handleFragmentLoadProgress=function(o){var l,n=o.frag,u=o.part,h=o.payload,f=this.config,p=this.trackId,_=this.levels;if(_){var S=_[p],C=S.details,x=f.defaultAudioCodec||S.audioCodec||"mp4a.40.2",W=this.transmuxer;W||(W=this.transmuxer=new Nn(this.hls,Te.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var K=this.initPTS[n.cc],ee=(l=n.initSegment)===null||l===void 0?void 0:l.data;if(K!==void 0){var me=u?u.index:-1,Ie=me!==-1,ye=new xn(n.level,n.sn,n.stats.chunkCount,h.byteLength,me,Ie);W.push(h,ee,x,"",n,u,C.totalduration,!1,ye,K)}else this.log("Unknown video PTS for cc "+n.cc+", waiting for video PTS before demuxing audio frag "+n.sn+" of ["+C.startSN+" ,"+C.endSN+"],track "+p),(this.waitingData=this.waitingData||{frag:n,part:u,cache:new Qs,complete:!1}).cache.push(new Uint8Array(h)),this.waitingVideoCC=this.videoTrackCC,this.state=Sr}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+n.sn+" of level "+n.level+" will not be buffered")},s._handleFragmentLoadComplete=function(o){this.waitingData?this.waitingData.complete=!0:m.prototype._handleFragmentLoadComplete.call(this,o)},s.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},s.onBufferCreated=function(o,l){var n=l.tracks.audio;n&&(this.mediaBuffer=n.buffer||null),l.tracks.video&&(this.videoBuffer=l.tracks.video.buffer||null)},s.onFragBuffered=function(o,l){var n,u=l.frag,h=l.part;u.type===Te.PlaylistLevelType.AUDIO?this.fragContextChanged(u)?this.warn("Fragment "+u.sn+(h?" p: "+h.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):(u.sn!=="initSegment"&&(this.fragPrevious=u,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(b.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(u,h)):this.loadedmetadata||u.type!==Te.PlaylistLevelType.MAIN||(n=this.videoBuffer||this.media)!==null&&n!==void 0&&n.buffered.length&&(this.loadedmetadata=!0)},s.onError=function(o,l){if(l.type!==P.ErrorTypes.KEY_SYSTEM_ERROR)switch(l.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.FRAG_PARSING_ERROR:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Te.PlaylistLevelType.AUDIO,l);break;case P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==lr&&this.state!==Xi&&(this.state=l.fatal?lr:Ct,this.warn(l.details+" while loading frag, switching to "+this.state+" state"));break;case P.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="audio"&&(this.state===rr||this.state===Wr)){var n=!0,u=this.getFwdBufferInfo(this.mediaBuffer,Te.PlaylistLevelType.AUDIO);u&&u.len>.5&&(n=!this.reduceMaxBufferLength(u.len)),n&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}else this.onFragmentOrKeyLoadError(Te.PlaylistLevelType.AUDIO,l)},s.onBufferFlushed=function(o,l){l.type===X.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0,this.state===va&&(this.state=Ct))},s._handleTransmuxComplete=function(o){var l,n="audio",u=this.hls,h=o.remuxResult,f=o.chunkMeta,p=this.getCurrentContext(f);if(!p)return this.warn("The loading context changed while buffering fragment "+f.sn+" of level "+f.level+". This chunk will not be buffered."),void this.resetStartWhenNotLoaded(f.level);var _=p.frag,S=p.part,C=p.level.details,x=h.audio,W=h.text,K=h.id3,ee=h.initSegment;if(!this.fragContextChanged(_)&&C){if(this.state=rr,this.audioSwitch&&x&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,_,f),u.trigger(b.Events.FRAG_PARSING_INIT_SEGMENT,{frag:_,id:n,tracks:ee.tracks})),x){var me=x.startPTS,Ie=x.endPTS,ye=x.startDTS,De=x.endDTS;S&&(S.elementaryStreams[X.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:Ie,startDTS:ye,endDTS:De}),_.setElementaryStreamInfo(X.ElementaryStreamTypes.AUDIO,me,Ie,ye,De),this.bufferFragmentData(x,_,S,f)}if(K!=null&&(l=K.samples)!==null&&l!==void 0&&l.length){var qe=tn({id:n,frag:_,details:C},K);u.trigger(b.Events.FRAG_PARSING_METADATA,qe)}if(W){var rt=tn({id:n,frag:_,details:C},W);u.trigger(b.Events.FRAG_PARSING_USERDATA,rt)}}},s._bufferInitSegment=function(o,l,n){if(this.state===rr){o.video&&delete o.video;var u=o.audio;if(u){u.levelCodec=u.codec,u.id="audio",this.log("Init audio buffer, container:"+u.container+", codecs[parsed]=["+u.codec+"]"),this.hls.trigger(b.Events.BUFFER_CODECS,o);var h=u.initSegment;if(h!=null&&h.byteLength){var f={type:"audio",frag:l,part:null,chunkMeta:n,parent:l.type,data:h};this.hls.trigger(b.Events.BUFFER_APPENDING,f)}this.tick()}}},s.loadFragment=function(o,l,n){var u=this.fragmentTracker.getState(o);this.fragCurrent=o,(this.audioSwitch||u===We.NOT_LOADED||u===We.PARTIAL)&&(o.sn==="initSegment"?this._loadInitSegment(o,l):l.live&&!(0,R.isFiniteNumber)(this.initPTS[o.cc])?(this.log("Waiting for video PTS in continuity counter "+o.cc+" of live stream before loading audio fragment "+o.sn+" of level "+this.trackId),this.state=Sr):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,o,l,n)))},s.completeAudioSwitch=function(){var o=this.hls,l=this.media,n=this.trackId;l&&(this.log("Switching audio track : flushing all audio"),m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,o.trigger(b.Events.AUDIO_TRACK_SWITCHED,{id:n})},i}(Qa);let Bn=rn;function Xs(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}function ya(m,c){return ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},ya(m,c)}let kl=function(m){var c,e;function i(n){var u;return(u=m.call(this,n,"[audio-track-controller]")||this).tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}e=m,(c=i).prototype=Object.create(e.prototype),c.prototype.constructor=c,ya(c,e);var s,o,l=i.prototype;return l.registerListeners=function(){var n=this.hls;n.on(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(b.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(b.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(b.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(b.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.on(b.Events.ERROR,this.onError,this)},l.unregisterListeners=function(){var n=this.hls;n.off(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(b.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(b.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(b.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(b.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.off(b.Events.ERROR,this.onError,this)},l.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,m.prototype.destroy.call(this)},l.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},l.onManifestParsed=function(n,u){this.tracks=u.audioTracks||[]},l.onAudioTrackLoaded=function(n,u){var h=u.id,f=u.details,p=this.tracksInGroup[h];if(p){var _=p.details;p.details=u.details,this.log("audioTrack "+h+" loaded ["+f.startSN+"-"+f.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,u,_))}else this.warn("Invalid audio track id "+h)},l.onLevelLoading=function(n,u){this.switchLevel(u.level)},l.onLevelSwitching=function(n,u){this.switchLevel(u.level)},l.switchLevel=function(n){var u=this.hls.levels[n];if(u!=null&&u.audioGroupIds){var h=u.audioGroupIds[u.urlId];if(this.groupId!==h){this.groupId=h;var f=this.tracks.filter(function(_){return!h||_.groupId===h});this.selectDefaultTrack&&!f.some(function(_){return _.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=f;var p={audioTracks:f};this.log("Updating audio tracks, "+f.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(b.Events.AUDIO_TRACKS_UPDATED,p),this.selectInitialTrack()}}},l.onError=function(n,u){m.prototype.onError.call(this,n,u),!u.fatal&&u.context&&u.context.type===Te.PlaylistContextType.AUDIO_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},l.setAudioTrack=function(n){var u=this.tracksInGroup;if(n<0||n>=u.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var h=u[this.trackId];this.log("Now switching to audio-track index "+n);var f=u[n],p=f.id,_=f.groupId,S=_===void 0?"":_,C=f.name,x=f.type,W=f.url;if(this.trackId=n,this.trackName=C,this.selectDefaultTrack=!1,this.hls.trigger(b.Events.AUDIO_TRACK_SWITCHING,{id:p,groupId:S,name:C,type:x,url:W}),!f.details||f.details.live){var K=this.switchParams(f.url,h==null?void 0:h.details);this.loadPlaylist(K)}}},l.selectInitialTrack=function(){this.tracksInGroup;var n=this.trackName,u=this.findTrackId(n)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},l.findTrackId=function(n){for(var u=this.tracksInGroup,h=0;h<u.length;h++){var f=u[h];if((!this.selectDefaultTrack||f.default)&&(!n||n===f.name))return f.id}return-1},l.loadPlaylist=function(n){m.prototype.loadPlaylist.call(this);var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var h=u.id,f=u.groupId,p=u.url;if(n)try{p=n.addDirectives(p)}catch(_){this.warn("Could not construct new URL with HLS Delivery Directives: "+_)}this.log("loading audio-track playlist for id: "+h),this.clearTimer(),this.hls.trigger(b.Events.AUDIO_TRACK_LOADING,{url:p,id:h,groupId:f,deliveryDirectives:n||null})}},s=i,(o=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1,this.setAudioTrack(n)}}])&&Xs(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),i}(Ce);function Il(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}function Hn(m,c){return Hn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},Hn(m,c)}var wl=function(m){var c,e;function i(n,u,h){var f;return(f=m.call(this,n,u,h,"[subtitle-stream-controller]")||this).levels=[],f.currentTrackId=-1,f.tracksBuffered=[],f.mainDetails=null,f._registerListeners(),f}e=m,(c=i).prototype=Object.create(e.prototype),c.prototype.constructor=c,Hn(c,e);var s,o,l=i.prototype;return l.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},l._registerListeners=function(){var n=this.hls;n.on(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(b.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(b.Events.ERROR,this.onError,this),n.on(b.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.on(b.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),n.on(b.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.on(b.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),n.on(b.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(b.Events.FRAG_BUFFERED,this.onFragBuffered,this)},l._unregisterListeners=function(){var n=this.hls;n.off(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(b.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(b.Events.ERROR,this.onError,this),n.off(b.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.off(b.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),n.off(b.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.off(b.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),n.off(b.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(b.Events.FRAG_BUFFERED,this.onFragBuffered,this)},l.startLoad=function(n){this.stopLoad(),this.state=Ct,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()},l.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},l.onLevelLoaded=function(n,u){this.mainDetails=u.details},l.onSubtitleFragProcessed=function(n,u){var h=u.frag,f=u.success;if(this.fragPrevious=h,this.state=Ct,f){var p=this.tracksBuffered[this.currentTrackId];if(p){for(var _,S=h.start,C=0;C<p.length;C++)if(S>=p[C].start&&S<=p[C].end){_=p[C];break}var x=h.start+h.duration;_?_.end=x:(_={start:S,end:x},p.push(_)),this.fragmentTracker.fragBuffered(h)}}},l.onBufferFlushing=function(n,u){var h=u.startOffset,f=u.endOffset;if(h===0&&f!==Number.POSITIVE_INFINITY){var p=this.currentTrackId,_=this.levels;if(!_.length||!_[p]||!_[p].details)return;var S=f-_[p].details.targetduration;if(S<=0)return;u.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(C){for(var x=0;x<C.length;)if(C[x].end<=S)C.shift();else{if(!(C[x].start<S))break;C[x].start=S,x++}}),this.fragmentTracker.removeFragmentsInRange(h,S,Te.PlaylistLevelType.SUBTITLE)}},l.onFragBuffered=function(n,u){var h;this.loadedmetadata||u.frag.type!==Te.PlaylistLevelType.MAIN||(h=this.media)!==null&&h!==void 0&&h.buffered.length&&(this.loadedmetadata=!0)},l.onError=function(n,u){var h=u.frag;h&&h.type===Te.PlaylistLevelType.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state=Ct)},l.onSubtitleTracksUpdated=function(n,u){var h=this,f=u.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(p){return new j(p)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(p){h.tracksBuffered[p.id]=[]}),this.mediaBuffer=null},l.onSubtitleTrackSwitch=function(n,u){if(this.currentTrackId=u.id,this.levels.length&&this.currentTrackId!==-1){var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(500)}else this.clearInterval()},l.onSubtitleTrackLoaded=function(n,u){var h,f=u.details,p=u.id,_=this.currentTrackId,S=this.levels;if(S.length){var C=S[_];if(!(p>=S.length||p!==_)&&C){this.mediaBuffer=this.mediaBufferTimeRanges;var x=0;if(f.live||(h=C.details)!==null&&h!==void 0&&h.live){var W=this.mainDetails;if(f.deltaUpdateFailed||!W)return;var K=W.fragments[0];C.details?(x=this.alignPlaylists(f,C.details))===0&&K&&Ae(f,x=K.start):f.hasProgramDateTime&&W.hasProgramDateTime?(Vs(f,W),x=f.fragments[0].start):K&&Ae(f,x=K.start)}C.details=f,this.levelLastLoaded=p,this.startFragRequested||!this.mainDetails&&f.live||this.setStartPosition(C.details,x),this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===Ct&&(Ya(null,f.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),C.details=void 0))}}},l._handleFragmentLoadComplete=function(n){var u=this,h=n.frag,f=n.payload,p=h.decryptdata,_=this.hls;if(!this.fragContextChanged(h)&&f&&f.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var S=performance.now();this.decrypter.decrypt(new Uint8Array(f),p.key.buffer,p.iv.buffer).then(function(C){var x=performance.now();_.trigger(b.Events.FRAG_DECRYPTED,{frag:h,payload:C,stats:{tstart:S,tdecrypt:x}})}).catch(function(C){u.warn(C.name+": "+C.message),u.state=Ct})}},l.doTick=function(){if(this.media){if(this.state===Ct){var n=this.currentTrackId,u=this.levels;if(!u.length||!u[n]||!u[n].details)return;var h=u[n].details,f=h.targetduration,p=this.config,_=this.getLoadPosition(),S=$t.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],_-f,p.maxBufferHole),C=S.end,x=S.len,W=this.getFwdBufferInfo(this.media,Te.PlaylistLevelType.MAIN);if(x>this.getMaxBufferLength(W==null?void 0:W.len)+f)return;var K=h.fragments,ee=K.length,me=h.edge,Ie=null,ye=this.fragPrevious;if(C<me){var De=p.maxFragLookUpTolerance;!(Ie=Ya(ye,K,Math.max(K[0].start,C),De))&&ye&&ye.start<K[0].start&&(Ie=K[0])}else Ie=K[ee-1];if(!Ie)return;Ie=this.mapToInitFragWhenRequired(Ie),this.fragmentTracker.getState(Ie)===We.NOT_LOADED&&this.loadFragment(Ie,h,C)}}else this.state=Ct},l.getMaxBufferLength=function(n){var u=m.prototype.getMaxBufferLength.call(this);return n?Math.max(u,n):u},l.loadFragment=function(n,u,h){this.fragCurrent=n,n.sn==="initSegment"?this._loadInitSegment(n,u):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,n,u,h))},s=i,(o=[{key:"mediaBufferTimeRanges",get:function(){return new Ll(this.tracksBuffered[this.currentTrackId]||[])}}])&&Il(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),i}(Qa),Ll=function(m){this.buffered=void 0;var c=function(e,i,s){if((i>>>=0)>s-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+i+") is greater than the maximum bound ("+s+")");return m[i][e]};this.buffered={get length(){return m.length},end:function(e){return c("end",e,m.length)},start:function(e){return c("start",e,m.length)}}};function Dl(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}function Kn(m,c){return Kn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},Kn(m,c)}function Gn(m){for(var c=[],e=0;e<m.length;e++){var i=m[e];i.kind==="subtitles"&&i.label&&c.push(m[e])}return c}let Rl=function(m){var c,e;function i(n){var u;return(u=m.call(this,n,"[subtitle-track-controller]")||this).media=null,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.selectDefaultTrack=!0,u.queuedDefaultTrack=-1,u.trackChangeListener=function(){return u.onTextTracksChanged()},u.asyncPollTrackChange=function(){return u.pollTrackChange(0)},u.useTextTrackPolling=!1,u.subtitlePollingInterval=-1,u._subtitleDisplay=!0,u.registerListeners(),u}e=m,(c=i).prototype=Object.create(e.prototype),c.prototype.constructor=c,Kn(c,e);var s,o,l=i.prototype;return l.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,m.prototype.destroy.call(this)},l.registerListeners=function(){var n=this.hls;n.on(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(b.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(b.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(b.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(b.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.on(b.Events.ERROR,this.onError,this)},l.unregisterListeners=function(){var n=this.hls;n.off(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(b.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(b.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(b.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(b.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.off(b.Events.ERROR,this.onError,this)},l.onMediaAttached=function(n,u){this.media=u.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},l.pollTrackChange=function(n){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,n)},l.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Gn(this.media.textTracks).forEach(function(n){gt(n)}),this.subtitleTrack=-1,this.media=null)},l.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},l.onManifestParsed=function(n,u){this.tracks=u.subtitleTracks},l.onSubtitleTrackLoaded=function(n,u){var h=u.id,f=u.details,p=this.trackId,_=this.tracksInGroup[p];if(_){var S=_.details;_.details=u.details,this.log("subtitle track "+h+" loaded ["+f.startSN+"-"+f.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,u,S))}else this.warn("Invalid subtitle track id "+h)},l.onLevelLoading=function(n,u){this.switchLevel(u.level)},l.onLevelSwitching=function(n,u){this.switchLevel(u.level)},l.switchLevel=function(n){var u=this.hls.levels[n];if(u!=null&&u.textGroupIds){var h=u.textGroupIds[u.urlId];if(this.groupId!==h){var f=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(C){return!h||C.groupId===h});this.tracksInGroup=p;var _=this.findTrackId(f==null?void 0:f.name)||this.findTrackId();this.groupId=h;var S={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(b.Events.SUBTITLE_TRACKS_UPDATED,S),_!==-1&&this.setSubtitleTrack(_,f)}}},l.findTrackId=function(n){for(var u=this.tracksInGroup,h=0;h<u.length;h++){var f=u[h];if((!this.selectDefaultTrack||f.default)&&(!n||n===f.name))return f.id}return-1},l.onError=function(n,u){m.prototype.onError.call(this,n,u),!u.fatal&&u.context&&u.context.type===Te.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},l.loadPlaylist=function(n){m.prototype.loadPlaylist.call(this);var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var h=u.id,f=u.groupId,p=u.url;if(n)try{p=n.addDirectives(p)}catch(_){this.warn("Could not construct new URL with HLS Delivery Directives: "+_)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(b.Events.SUBTITLE_TRACK_LOADING,{url:p,id:h,groupId:f,deliveryDirectives:n||null})}},l.toggleTrackModes=function(n){var u=this,h=this.media,f=this.trackId;if(h){var p=Gn(h.textTracks),_=p.filter(function(x){return x.groupId===u.groupId});if(n===-1)[].slice.call(p).forEach(function(x){x.mode="disabled"});else{var S=_[f];S&&(S.mode="disabled")}var C=_[n];C&&(C.mode=this.subtitleDisplay?"showing":"hidden")}},l.setSubtitleTrack=function(n,u){var h,f=this.tracksInGroup;if(this.media){if(this.trackId!==n&&this.toggleTrackModes(n),!(this.trackId===n&&(n===-1||(h=f[n])!==null&&h!==void 0&&h.details)||n<-1||n>=f.length)){this.clearTimer();var p=f[n];if(this.log("Switching to subtitle track "+n),this.trackId=n,p){var _=p.id,S=p.groupId,C=S===void 0?"":S,x=p.name,W=p.type,K=p.url;this.hls.trigger(b.Events.SUBTITLE_TRACK_SWITCH,{id:_,groupId:C,name:x,type:W,url:K});var ee=this.switchParams(p.url,u==null?void 0:u.details);this.loadPlaylist(ee)}else this.hls.trigger(b.Events.SUBTITLE_TRACK_SWITCH,{id:n})}}else this.queuedDefaultTrack=n},l.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var n=-1,u=Gn(this.media.textTracks),h=0;h<u.length;h++)if(u[h].mode==="hidden")n=h;else if(u[h].mode==="showing"){n=h;break}this.subtitleTrack!==n&&(this.subtitleTrack=n)}},s=i,(o=[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(n){this._subtitleDisplay=n,this.trackId>-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(n,u)}}])&&Dl(s.prototype,o),Object.defineProperty(s,"prototype",{writable:!1}),i}(Ce);var wt,Wi=function(){function m(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var c=m.prototype;return c.append=function(e,i){var s=this.queues[i];s.push(e),s.length===1&&this.buffers[i]&&this.executeNext(i)},c.insertAbort=function(e,i){this.queues[i].unshift(e),this.executeNext(i)},c.appendBlocker=function(e){var i,s=new Promise(function(l){i=l}),o={execute:i,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(o,e),s},c.executeNext=function(e){var i=this.buffers,s=this.queues,o=i[e],l=s[e];if(l.length){var n=l[0];try{n.execute()}catch(u){O.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),n.onError(u),o&&o.updating||(l.shift(),this.executeNext(e))}}},c.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},c.current=function(e){return this.queues[e][0]},m}(),Yr=Xa(),Zs=/([ha]vc.)(?:\.[^.,]+)+/,Cl=function(){function m(e){var i=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=i.hls,o=i.media,l=i.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),o&&(i.updateMediaElementDuration(),s.trigger(b.Events.MEDIA_ATTACHED,{media:o})),l&&l.removeEventListener("sourceopen",i._onMediaSourceOpen),i.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var c=m.prototype;return c.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},c.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null},c.registerListeners=function(){var e=this.hls;e.on(b.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(b.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(b.Events.BUFFER_RESET,this.onBufferReset,this),e.on(b.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(b.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(b.Events.BUFFER_EOS,this.onBufferEos,this),e.on(b.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(b.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(b.Events.FRAG_PARSED,this.onFragParsed,this),e.on(b.Events.FRAG_CHANGED,this.onFragChanged,this)},c.unregisterListeners=function(){var e=this.hls;e.off(b.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(b.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(b.Events.BUFFER_RESET,this.onBufferReset,this),e.off(b.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(b.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(b.Events.BUFFER_EOS,this.onBufferEos,this),e.off(b.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(b.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(b.Events.FRAG_PARSED,this.onFragParsed,this),e.off(b.Events.FRAG_CHANGED,this.onFragChanged,this)},c._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new Wi(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null},c.onManifestParsed=function(e,i){var s=2;(i.audio&&!i.video||!i.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},c.onMediaAttaching=function(e,i){var s=this.media=i.media;if(s&&Yr){var o=this.mediaSource=new Yr;o.addEventListener("sourceopen",this._onMediaSourceOpen),o.addEventListener("sourceended",this._onMediaSourceEnded),o.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(o),this._objectUrl=s.src}},c.onMediaDetaching=function(){var e=this.media,i=this.mediaSource,s=this._objectUrl;if(i){if(O.logger.log("[buffer-controller]: media source detaching"),i.readyState==="open")try{i.endOfStream()}catch(o){O.logger.warn("[buffer-controller]: onMediaDetaching: "+o.message+" while calling endOfStream")}this.onBufferReset(),i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(s&&self.URL.revokeObjectURL(s),e.src===s?(e.removeAttribute("src"),e.load()):O.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(b.Events.MEDIA_DETACHED,void 0)},c.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(i){var s=e.sourceBuffer[i];try{s&&(e.removeBufferListeners(i),e.mediaSource&&e.mediaSource.removeSourceBuffer(s),e.sourceBuffer[i]=void 0)}catch(o){O.logger.warn("[buffer-controller]: Failed to reset the "+i+" buffer",o)}}),this._initSourceBuffer()},c.onBufferCodecs=function(e,i){var s=this,o=this.getSourceBufferTypes().length;Object.keys(i).forEach(function(l){if(o){var n=s.tracks[l];if(n&&typeof n.buffer.changeType=="function"){var u=i[l],h=u.id,f=u.codec,p=u.levelCodec,_=u.container,S=u.metadata,C=(n.levelCodec||n.codec).replace(Zs,"$1"),x=(p||f).replace(Zs,"$1");if(C!==x){var W=_+";codecs="+(p||f);s.appendChangeType(l,W),O.logger.log("[buffer-controller]: switching codec "+C+" to "+x),s.tracks[l]={buffer:n.buffer,codec:f,container:_,levelCodec:p,metadata:S,id:h}}}}else s.pendingTracks[l]=i[l]}),o||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},c.appendChangeType=function(e,i){var s=this,o=this.operationQueue,l={execute:function(){var n=s.sourceBuffer[e];n&&(O.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+i),n.changeType(i)),o.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(n){O.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",n)}};o.append(l,e)},c.onBufferAppending=function(e,i){var s=this,o=this.hls,l=this.operationQueue,n=this.tracks,u=i.data,h=i.type,f=i.frag,p=i.part,_=i.chunkMeta,S=_.buffering[h],C=self.performance.now();S.start=C;var x=f.stats.buffering,W=p?p.stats.buffering:null;x.start===0&&(x.start=C),W&&W.start===0&&(W.start=C);var K=n.audio,ee=!1;h==="audio"&&(K==null?void 0:K.container)==="audio/mpeg"&&(ee=!this.lastMpegAudioChunk||_.id===1||this.lastMpegAudioChunk.sn!==_.sn,this.lastMpegAudioChunk=_);var me=f.start,Ie={execute:function(){if(S.executeStart=self.performance.now(),ee){var ye=s.sourceBuffer[h];if(ye){var De=me-ye.timestampOffset;Math.abs(De)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+me+" (delta: "+De+") sn: "+f.sn+")"),ye.timestampOffset=me)}}s.appendExecutor(u,h)},onStart:function(){},onComplete:function(){var ye=self.performance.now();S.executeEnd=S.end=ye,x.first===0&&(x.first=ye),W&&W.first===0&&(W.first=ye);var De=s.sourceBuffer,qe={};for(var rt in De)qe[rt]=$t.getBuffered(De[rt]);s.appendError=0,s.hls.trigger(b.Events.BUFFER_APPENDED,{type:h,frag:f,part:p,chunkMeta:_,parent:f.type,timeRanges:qe})},onError:function(ye){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+h+" SourceBuffer",ye);var De={type:P.ErrorTypes.MEDIA_ERROR,parent:f.type,details:P.ErrorDetails.BUFFER_APPEND_ERROR,err:ye,fatal:!1};ye.code===DOMException.QUOTA_EXCEEDED_ERR?De.details=P.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,De.details=P.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>o.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+o.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),De.fatal=!0,o.stopLoad())),o.trigger(b.Events.ERROR,De)}};l.append(Ie,h)},c.onBufferFlushing=function(e,i){var s=this,o=this.operationQueue,l=function(n){return{execute:s.removeExecutor.bind(s,n,i.startOffset,i.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(b.Events.BUFFER_FLUSHED,{type:n})},onError:function(u){O.logger.warn("[buffer-controller]: Failed to remove from "+n+" SourceBuffer",u)}}};i.type?o.append(l(i.type),i.type):this.getSourceBufferTypes().forEach(function(n){o.append(l(n),n)})},c.onFragParsed=function(e,i){var s=this,o=i.frag,l=i.part,n=[],u=l?l.elementaryStreams:o.elementaryStreams;u[X.ElementaryStreamTypes.AUDIOVIDEO]?n.push("audiovideo"):(u[X.ElementaryStreamTypes.AUDIO]&&n.push("audio"),u[X.ElementaryStreamTypes.VIDEO]&&n.push("video")),n.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+o.type+" level: "+o.level+" sn: "+o.sn),this.blockBuffers(function(){var h=self.performance.now();o.stats.buffering.end=h,l&&(l.stats.buffering.end=h);var f=l?l.stats:o.stats;s.hls.trigger(b.Events.FRAG_BUFFERED,{frag:o,part:l,stats:f,id:o.type})},n)},c.onFragChanged=function(e,i){this.flushBackBuffer()},c.onBufferEos=function(e,i){var s=this;this.getSourceBufferTypes().reduce(function(o,l){var n=s.sourceBuffer[l];return!n||i.type&&i.type!==l||(n.ending=!0,n.ended||(n.ended=!0,O.logger.log("[buffer-controller]: "+l+" sourceBuffer now EOS"))),o&&!(n&&!n.ended)},!0)&&(O.logger.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){s.getSourceBufferTypes().forEach(function(l){var n=s.sourceBuffer[l];n&&(n.ending=!1)});var o=s.mediaSource;o&&o.readyState==="open"?(O.logger.log("[buffer-controller]: Calling mediaSource.endOfStream()"),o.endOfStream()):o&&O.logger.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+o.readyState)}))},c.onLevelUpdated=function(e,i){var s=i.details;s.fragments.length&&(this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},c.flushBackBuffer=function(){var e=this.hls,i=this.details,s=this.media,o=this.sourceBuffer;if(s&&i!==null){var l=this.getSourceBufferTypes();if(l.length){var n=i.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if((0,R.isFiniteNumber)(n)&&!(n<0)){var u=s.currentTime,h=i.levelTargetDuration,f=Math.max(n,h),p=Math.floor(u/h)*h-f;l.forEach(function(_){var S=o[_];if(S){var C=$t.getBuffered(S);if(C.length>0&&p>C.start(0)){if(e.trigger(b.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),i.live)e.trigger(b.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p});else if(S.ended&&C.end(C.length-1)-u<2*h)return void O.logger.info("[buffer-controller]: Cannot flush "+_+" back buffer while SourceBuffer is in ended state");e.trigger(b.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:_})}}})}}}},c.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&this.mediaSource.readyState==="open"){var e=this.details,i=this.hls,s=this.media,o=this.mediaSource,l=e.fragments[0].start+e.totalduration,n=s.duration,u=(0,R.isFiniteNumber)(o.duration)?o.duration:0;e.live&&i.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),o.duration=1/0,this.updateSeekableRange(e)):(l>u&&l>n||!(0,R.isFiniteNumber)(n))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+l.toFixed(3)),o.duration=l)}},c.updateSeekableRange=function(e){var i=this.mediaSource,s=e.fragments;if(s.length&&e.live&&i!=null&&i.setLiveSeekableRange){var o=Math.max(0,s[0].start),l=Math.max(o,o+e.totalduration);i.setLiveSeekableRange(o,l)}},c.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,i=this.operationQueue,s=this.pendingTracks,o=Object.keys(s).length;if(o&&!e||o===2){this.createSourceBuffers(s),this.pendingTracks={};var l=this.getSourceBufferTypes();if(l.length===0)return void this.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});l.forEach(function(n){i.executeNext(n)})}},c.createSourceBuffers=function(e){var i=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var o=0;for(var l in e)if(!i[l]){var n=e[l];if(!n)throw Error("source buffer exists for track "+l+", however track does not");var u=n.levelCodec||n.codec,h=n.container+";codecs="+u;O.logger.log("[buffer-controller]: creating sourceBuffer("+h+")");try{var f=i[l]=s.addSourceBuffer(h),p=l;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[l]={buffer:f,codec:u,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id},o++}catch(_){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+_.message),this.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:_,mimeType:h})}}o&&this.hls.trigger(b.Events.BUFFER_CREATED,{tracks:this.tracks})},c._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},c._onSBUpdateEnd=function(e){var i=this.operationQueue;i.current(e).onComplete(),i.shiftAndExecuteNext(e)},c._onSBUpdateError=function(e,i){O.logger.error("[buffer-controller]: "+e+" SourceBuffer error",i),this.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(e);s&&s.onError(i)},c.removeExecutor=function(e,i,s){var o=this.media,l=this.mediaSource,n=this.operationQueue,u=this.sourceBuffer[e];if(!o||!l||!u)return O.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void n.shiftAndExecuteNext(e);var h=(0,R.isFiniteNumber)(o.duration)?o.duration:1/0,f=(0,R.isFiniteNumber)(l.duration)?l.duration:1/0,p=Math.max(0,i),_=Math.min(s,h,f);_>p&&!u.ending?(u.ended=!1,O.logger.log("[buffer-controller]: Removing ["+p+","+_+"] from the "+e+" SourceBuffer"),u.remove(p,_)):n.shiftAndExecuteNext(e)},c.appendExecutor=function(e,i){var s=this.operationQueue,o=this.sourceBuffer[i];if(!o)return O.logger.warn("[buffer-controller]: Attempting to append to the "+i+" SourceBuffer, but it does not exist"),void s.shiftAndExecuteNext(i);o.ended=!1,o.appendBuffer(e)},c.blockBuffers=function(e,i){var s=this;if(i===void 0&&(i=this.getSourceBufferTypes()),!i.length)return O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var o=this.operationQueue,l=i.map(function(n){return o.appendBlocker(n)});Promise.all(l).then(function(){e(),i.forEach(function(n){var u=s.sourceBuffer[n];u&&u.updating||o.shiftAndExecuteNext(n)})})},c.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},c.addBufferListener=function(e,i,s){var o=this.sourceBuffer[e];if(o){var l=s.bind(this,e);this.listeners[e].push({event:i,listener:l}),o.addEventListener(i,l)}},c.removeBufferListeners=function(e){var i=this.sourceBuffer[e];i&&this.listeners[e].forEach(function(s){i.removeEventListener(s.event,s.listener)})},m}(),A={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},y=function(m){var c=m;return A.hasOwnProperty(m)&&(c=A[m]),String.fromCharCode(c)},T=15,k=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},V={17:2,18:4,21:6,22:8,23:10,19:13,20:15},B={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},J={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ge=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(wt||(wt={}));var ne=function(){function m(){this.time=null,this.verboseLevel=wt.ERROR}return m.prototype.log=function(c,e){if(this.verboseLevel>=c){var i=typeof e=="function"?e():e;O.logger.log(this.time+" ["+c+"] "+i)}},m}(),Be=function(m){for(var c=[],e=0;e<m.length;e++)c.push(m[e].toString(16));return c},mt=function(){function m(e,i,s,o,l){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=i||!1,this.italics=s||!1,this.background=o||"black",this.flash=l||!1}var c=m.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(e){for(var i=["foreground","underline","italics","background","flash"],s=0;s<i.length;s++){var o=i[s];e.hasOwnProperty(o)&&(this[o]=e[o])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},c.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},m}(),nt=function(){function m(e,i,s,o,l,n){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new mt(i,s,o,l,n)}var c=m.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(e,i){this.uchar=e,this.penState.copy(i)},c.setPenState=function(e){this.penState.copy(e)},c.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},c.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},m}(),ht=function(){function m(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var i=0;i<k;i++)this.chars.push(new nt);this.logger=e,this.pos=0,this.currPenState=new mt}var c=m.prototype;return c.equals=function(e){for(var i=!0,s=0;s<k;s++)if(!this.chars[s].equals(e.chars[s])){i=!1;break}return i},c.copy=function(e){for(var i=0;i<k;i++)this.chars[i].copy(e.chars[i])},c.isEmpty=function(){for(var e=!0,i=0;i<k;i++)if(!this.chars[i].isEmpty()){e=!1;break}return e},c.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(wt.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(wt.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},c.moveCursor=function(e){var i=this.pos+e;if(e>1)for(var s=this.pos+1;s<i+1;s++)this.chars[s].setPenState(this.currPenState);this.setCursor(i)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(e){var i=this;e>=144&&this.backSpace();var s=y(e);this.pos>=k?this.logger.log(wt.ERROR,function(){return"Cannot insert "+e.toString(16)+" ("+s+") at position "+i.pos+". Skipping it!"}):(this.chars[this.pos].setChar(s,this.currPenState),this.moveCursor(1))},c.clearFromPos=function(e){var i;for(i=e;i<k;i++)this.chars[i].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var e=[],i=!0,s=0;s<k;s++){var o=this.chars[s].uchar;o!==" "&&(i=!1),e.push(o)}return i?"":e.join("")},c.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},m}(),Je=function(){function m(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var i=0;i<T;i++)this.rows.push(new ht(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=m.prototype;return c.reset=function(){for(var e=0;e<T;e++)this.rows[e].clear();this.currRow=14},c.equals=function(e){for(var i=!0,s=0;s<T;s++)if(!this.rows[s].equals(e.rows[s])){i=!1;break}return i},c.copy=function(e){for(var i=0;i<T;i++)this.rows[i].copy(e.rows[i])},c.isEmpty=function(){for(var e=!0,i=0;i<T;i++)if(!this.rows[i].isEmpty()){e=!1;break}return e},c.backSpace=function(){this.rows[this.currRow].backSpace()},c.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},c.insertChar=function(e){this.rows[this.currRow].insertChar(e)},c.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},c.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},c.setCursor=function(e){this.logger.log(wt.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},c.setPAC=function(e){this.logger.log(wt.INFO,function(){return"pacData = "+JSON.stringify(e)});var i=e.row-1;if(this.nrRollUpRows&&i<this.nrRollUpRows-1&&(i=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==i){for(var s=0;s<T;s++)this.rows[s].clear();var o=this.currRow+1-this.nrRollUpRows,l=this.lastOutputScreen;if(l){var n=l.rows[o].cueStartTime,u=this.logger.time;if(n&&u!==null&&n<u)for(var h=0;h<this.nrRollUpRows;h++)this.rows[i-this.nrRollUpRows+h+1].copy(l.rows[o+h])}}this.currRow=i;var f=this.rows[this.currRow];if(e.indent!==null){var p=e.indent,_=Math.max(p-1,0);f.setCursor(e.indent),e.color=f.chars[_].penState.foreground}var S={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(S)},c.setBkgData=function(e){this.logger.log(wt.INFO,function(){return"bkgData = "+JSON.stringify(e)}),this.backSpace(),this.setPen(e),this.insertChar(32)},c.setRollUpRows=function(e){this.nrRollUpRows=e},c.rollUp=function(){var e=this;if(this.nrRollUpRows!==null){this.logger.log(wt.TEXT,function(){return e.getDisplayText()});var i=this.currRow+1-this.nrRollUpRows,s=this.rows.splice(i,1)[0];s.clear(),this.rows.splice(this.currRow,0,s),this.logger.log(wt.INFO,"Rolling up")}else this.logger.log(wt.DEBUG,"roll_up but nrRollUpRows not set yet")},c.getDisplayText=function(e){e=e||!1;for(var i=[],s="",o=-1,l=0;l<T;l++){var n=this.rows[l].getTextString();n&&(o=l+1,e?i.push("Row "+o+": '"+n+"'"):i.push(n.trim()))}return i.length>0&&(s=e?"["+i.join(" | ")+"]":i.join(`
20
+ `)),s},c.getTextAndFormat=function(){return this.rows},m}(),ft=function(){function m(e,i,s){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=e,this.outputFilter=i,this.mode=null,this.verbose=0,this.displayedMemory=new Je(s),this.nonDisplayedMemory=new Je(s),this.lastOutputScreen=new Je(s),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}var c=m.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(e){this.outputFilter=e},c.setPAC=function(e){this.writeScreen.setPAC(e)},c.setBkgData=function(e){this.writeScreen.setBkgData(e)},c.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(wt.INFO,function(){return"MODE="+e}),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=e)},c.insertChars=function(e){for(var i=this,s=0;s<e.length;s++)this.writeScreen.insertChar(e[s]);var o=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(wt.INFO,function(){return o+": "+i.writeScreen.getDisplayText(!0)}),this.mode!=="MODE_PAINT-ON"&&this.mode!=="MODE_ROLL-UP"||(this.logger.log(wt.TEXT,function(){return"DISPLAYED: "+i.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(wt.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){this.logger.log(wt.INFO,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(wt.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(e){this.logger.log(wt.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},c.ccFON=function(){this.logger.log(wt.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(wt.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(wt.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(wt.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(wt.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(wt.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(wt.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){var e=this;if(this.logger.log(wt.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var i=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=i,this.writeScreen=this.nonDisplayedMemory,this.logger.log(wt.TEXT,function(){return"DISP: "+e.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)},c.ccTO=function(e){this.logger.log(wt.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},c.ccMIDROW=function(e){var i={flash:!1};if(i.underline=e%2==1,i.italics=e>=46,i.italics)i.foreground="white";else{var s=Math.floor(e/2)-16;i.foreground=["white","green","blue","cyan","red","yellow","magenta"][s]}this.logger.log(wt.INFO,"MIDROW: "+JSON.stringify(i)),this.writeScreen.setPen(i)},c.outputDataUpdate=function(e){e===void 0&&(e=!1);var i=this.logger.time;i!==null&&this.outputFilter&&(this.cueStartTime!==null||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,i,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:i):this.cueStartTime=i,this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},m}(),Kt=function(){function m(e,i,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var o=new ne;this.channels=[null,new ft(e,i,o),new ft(e+1,s,o)],this.cmdHistory={a:null,b:null},this.logger=o}var c=m.prototype;return c.getHandler=function(e){return this.channels[e].getHandler()},c.setHandler=function(e,i){this.channels[e].setHandler(i)},c.addData=function(e,i){var s,o,l,n=!1;this.logger.time=e;for(var u=0;u<i.length;u+=2)if(o=127&i[u],l=127&i[u+1],o!==0||l!==0){if(this.logger.log(wt.DATA,"["+Be([i[u],i[u+1]])+"] -> ("+Be([o,l])+")"),(s=this.parseCmd(o,l))||(s=this.parseMidrow(o,l)),s||(s=this.parsePAC(o,l)),s||(s=this.parseBackgroundAttributes(o,l)),!s&&(n=this.parseChars(o,l))){var h=this.currentChannel;h&&h>0?this.channels[h].insertChars(n):this.logger.log(wt.WARNING,"No channel found yet. TEXT-MODE?")}s||n||this.logger.log(wt.WARNING,"Couldn't parse cleaned data "+Be([o,l])+" orig: "+Be([i[u],i[u+1]]))}},c.parseCmd=function(e,i){var s=this.cmdHistory;if(!((e===20||e===28||e===21||e===29)&&i>=32&&i<=47||(e===23||e===31)&&i>=33&&i<=35))return!1;if(Ei(e,i,s))return Zt(null,null,s),this.logger.log(wt.DEBUG,"Repeated command ("+Be([e,i])+") is dropped"),!0;var o=e===20||e===21||e===23?1:2,l=this.channels[o];return e===20||e===21||e===28||e===29?i===32?l.ccRCL():i===33?l.ccBS():i===34?l.ccAOF():i===35?l.ccAON():i===36?l.ccDER():i===37?l.ccRU(2):i===38?l.ccRU(3):i===39?l.ccRU(4):i===40?l.ccFON():i===41?l.ccRDC():i===42?l.ccTR():i===43?l.ccRTD():i===44?l.ccEDM():i===45?l.ccCR():i===46?l.ccENM():i===47&&l.ccEOC():l.ccTO(i-32),Zt(e,i,s),this.currentChannel=o,!0},c.parseMidrow=function(e,i){var s=0;if((e===17||e===25)&&i>=32&&i<=47){if((s=e===17?1:2)!==this.currentChannel)return this.logger.log(wt.ERROR,"Mismatch channel in midrow parsing"),!1;var o=this.channels[s];return!!o&&(o.ccMIDROW(i),this.logger.log(wt.DEBUG,"MIDROW ("+Be([e,i])+")"),!0)}return!1},c.parsePAC=function(e,i){var s,o=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&i>=64&&i<=127||(e===16||e===24)&&i>=64&&i<=95))return!1;if(Ei(e,i,o))return Zt(null,null,o),!0;var l=e<=23?1:2;s=i>=64&&i<=95?l===1?D[e]:B[e]:l===1?V[e]:J[e];var n=this.channels[l];return!!n&&(n.setPAC(this.interpretPAC(s,i)),Zt(e,i,o),this.currentChannel=l,!0)},c.interpretPAC=function(e,i){var s,o={color:null,italics:!1,indent:null,underline:!1,row:e};return s=i>95?i-96:i-64,o.underline=(1&s)==1,s<=13?o.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(o.italics=!0,o.color="white"):o.indent=4*Math.floor((s-16)/2),o},c.parseChars=function(e,i){var s,o,l=null,n=null;if(e>=25?(s=2,n=e-8):(s=1,n=e),n>=17&&n<=19?(o=n===17?i+80:n===18?i+112:i+144,this.logger.log(wt.INFO,"Special char '"+y(o)+"' in channel "+s),l=[o]):e>=32&&e<=127&&(l=i===0?[e]:[e,i]),l){var u=Be(l);this.logger.log(wt.DEBUG,"Char codes = "+u.join(",")),Zt(e,i,this.cmdHistory)}return l},c.parseBackgroundAttributes=function(e,i){var s;if(!((e===16||e===24)&&i>=32&&i<=47||(e===23||e===31)&&i>=45&&i<=47))return!1;var o={};e===16||e===24?(s=Math.floor((i-32)/2),o.background=ge[s],i%2==1&&(o.background=o.background+"_semi")):i===45?o.background="transparent":(o.foreground="black",i===47&&(o.underline=!0));var l=e<=23?1:2;return this.channels[l].setBkgData(o),Zt(e,i,this.cmdHistory),!0},c.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var i=this.channels[e];i&&i.reset()}this.cmdHistory={a:null,b:null}},c.cueSplitAtTime=function(e){for(var i=0;i<this.channels.length;i++){var s=this.channels[i];s&&s.cueSplitAtTime(e)}},m}();function Zt(m,c,e){e.a=m,e.b=c}function Ei(m,c,e){return e.a===m&&e.b===c}let Di=Kt;var Dt=function(){function m(e,i){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=i}var c=m.prototype;return c.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},c.newCue=function(e,i,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=i,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)},c.reset=function(){this.cueRanges=[],this.startTime=null},m}();let hi=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var m=["","lr","rl"],c=["start","middle","end","left","right"];function e(l,n){if(typeof n!="string"||!Array.isArray(l))return!1;var u=n.toLowerCase();return!!~l.indexOf(u)&&u}function i(l){return e(c,l)}function s(l){for(var n=arguments.length,u=new Array(n>1?n-1:0),h=1;h<n;h++)u[h-1]=arguments[h];for(var f=1;f<arguments.length;f++){var p=arguments[f];for(var _ in p)l[_]=p[_]}return l}function o(l,n,u){var h=this,f={enumerable:!0};h.hasBeenReset=!1;var p="",_=!1,S=l,C=n,x=u,W=null,K="",ee=!0,me="auto",Ie="start",ye=50,De="middle",qe=50,rt="middle";Object.defineProperty(h,"id",s({},f,{get:function(){return p},set:function(we){p=""+we}})),Object.defineProperty(h,"pauseOnExit",s({},f,{get:function(){return _},set:function(we){_=!!we}})),Object.defineProperty(h,"startTime",s({},f,{get:function(){return S},set:function(we){if(typeof we!="number")throw new TypeError("Start time must be set to a number.");S=we,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",s({},f,{get:function(){return C},set:function(we){if(typeof we!="number")throw new TypeError("End time must be set to a number.");C=we,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",s({},f,{get:function(){return x},set:function(we){x=""+we,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",s({},f,{get:function(){return W},set:function(we){W=we,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",s({},f,{get:function(){return K},set:function(we){var je=function(Ve){return e(m,Ve)}(we);if(je===!1)throw new SyntaxError("An invalid or illegal string was specified.");K=je,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",s({},f,{get:function(){return ee},set:function(we){ee=!!we,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",s({},f,{get:function(){return me},set:function(we){if(typeof we!="number"&&we!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");me=we,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",s({},f,{get:function(){return Ie},set:function(we){var je=i(we);if(!je)throw new SyntaxError("An invalid or illegal string was specified.");Ie=je,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",s({},f,{get:function(){return ye},set:function(we){if(we<0||we>100)throw new Error("Position must be between 0 and 100.");ye=we,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",s({},f,{get:function(){return De},set:function(we){var je=i(we);if(!je)throw new SyntaxError("An invalid or illegal string was specified.");De=je,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",s({},f,{get:function(){return qe},set:function(we){if(we<0||we>100)throw new Error("Size must be between 0 and 100.");qe=we,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",s({},f,{get:function(){return rt},set:function(we){var je=i(we);if(!je)throw new SyntaxError("An invalid or illegal string was specified.");rt=je,this.hasBeenReset=!0}})),h.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();var ki=function(){function m(){}return m.prototype.decode=function(c,e){if(!c)return"";if(typeof c!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(c))},m}();function Pt(m){function c(i,s,o,l){return 3600*(0|i)+60*(0|s)+(0|o)+parseFloat(l||0)}var e=m.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return e?parseFloat(e[2])>59?c(e[2],e[3],0,e[4]):c(e[1],e[2],e[3],e[4]):null}var dt=function(){function m(){this.values=Object.create(null)}var c=m.prototype;return c.set=function(e,i){this.get(e)||i===""||(this.values[e]=i)},c.get=function(e,i,s){return s?this.has(e)?this.values[e]:i[s]:this.has(e)?this.values[e]:i},c.has=function(e){return e in this.values},c.alt=function(e,i,s){for(var o=0;o<s.length;++o)if(i===s[o]){this.set(e,i);break}},c.integer=function(e,i){/^-?\d+$/.test(i)&&this.set(e,parseInt(i,10))},c.percent=function(e,i){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(i)){var s=parseFloat(i);if(s>=0&&s<=100)return this.set(e,s),!0}return!1},m}();function bt(m,c,e,i){var s=i?m.split(i):[m];for(var o in s)if(typeof s[o]=="string"){var l=s[o].split(e);l.length===2&&c(l[0],l[1])}}var st=new hi(0,0,""),yt=st.align==="middle"?"middle":"center";function Jt(m,c,e){var i=m;function s(){var l=Pt(m);if(l===null)throw new Error("Malformed timestamp: "+i);return m=m.replace(/^[^\sa-zA-Z-]+/,""),l}function o(){m=m.replace(/^\s+/,"")}if(o(),c.startTime=s(),o(),m.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);m=m.slice(3),o(),c.endTime=s(),o(),function(l,n){var u=new dt;bt(l,function(p,_){var S;switch(p){case"region":for(var C=e.length-1;C>=0;C--)if(e[C].id===_){u.set(p,e[C].region);break}break;case"vertical":u.alt(p,_,["rl","lr"]);break;case"line":S=_.split(","),u.integer(p,S[0]),u.percent(p,S[0])&&u.set("snapToLines",!1),u.alt(p,S[0],["auto"]),S.length===2&&u.alt("lineAlign",S[1],["start",yt,"end"]);break;case"position":S=_.split(","),u.percent(p,S[0]),S.length===2&&u.alt("positionAlign",S[1],["start",yt,"end","line-left","line-right","auto"]);break;case"size":u.percent(p,_);break;case"align":u.alt(p,_,["start",yt,"end","left","right"])}},/:/,/\s/),n.region=u.get("region",null),n.vertical=u.get("vertical","");var h=u.get("line","auto");h==="auto"&&st.line===-1&&(h=-1),n.line=h,n.lineAlign=u.get("lineAlign","start"),n.snapToLines=u.get("snapToLines",!0),n.size=u.get("size",100),n.align=u.get("align",yt);var f=u.get("position","auto");f==="auto"&&st.position===50&&(f=n.align==="start"||n.align==="left"?0:n.align==="end"||n.align==="right"?100:50),n.position=f}(m,c)}function ai(m){return m.replace(/<br(?: \/)?>/gi,`
21
+ `)}var Ci=function(){function m(){this.state="INITIAL",this.buffer="",this.decoder=new ki,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var c=m.prototype;return c.parse=function(e){var i=this;function s(){var h=i.buffer,f=0;for(h=ai(h);f<h.length&&h[f]!=="\r"&&h[f]!==`
22
22
  `;)++f;var p=h.slice(0,f);return h[f]==="\r"&&++f,h[f]===`
23
- `&&++f,r.buffer=h.slice(f),p}e&&(r.buffer+=r.decoder.decode(e,{stream:!0}));try{var o="";if(r.state==="INITIAL"){if(!/\r\n|\n/.test(r.buffer))return this;var l=(o=s()).match(/^()?WEBVTT([ \t].*)?$/);if(!l||!l[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}for(var n=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;switch(n?n=!1:o=s(),r.state){case"HEADER":/:/.test(o)?bt(o,function(h,f){},/:/):o||(r.state="ID");continue;case"NOTE":o||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(o)){r.state="NOTE";break}if(!o)continue;if(r.cue=new hr(0,0,""),r.state="CUE",o.indexOf("-->")===-1){r.cue.id=o;continue}case"CUE":if(!r.cue){r.state="BADCUE";continue}try{Jt(o,r.cue,r.regionList)}catch{r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":var u=o.indexOf("-->")!==-1;if(!o||u&&(n=!0)){r.oncue&&r.cue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}if(r.cue===null)continue;r.cue.text&&(r.cue.text+=`
24
- `),r.cue.text+=o;continue;case"BADCUE":o||(r.state="ID")}}}catch{r.state==="CUETEXT"&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state=r.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},c.flush=function(){var e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
23
+ `&&++f,i.buffer=h.slice(f),p}e&&(i.buffer+=i.decoder.decode(e,{stream:!0}));try{var o="";if(i.state==="INITIAL"){if(!/\r\n|\n/.test(i.buffer))return this;var l=(o=s()).match(/^()?WEBVTT([ \t].*)?$/);if(!l||!l[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var n=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;switch(n?n=!1:o=s(),i.state){case"HEADER":/:/.test(o)?bt(o,function(h,f){},/:/):o||(i.state="ID");continue;case"NOTE":o||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(o)){i.state="NOTE";break}if(!o)continue;if(i.cue=new hi(0,0,""),i.state="CUE",o.indexOf("-->")===-1){i.cue.id=o;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{Jt(o,i.cue,i.regionList)}catch{i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":var u=o.indexOf("-->")!==-1;if(!o||u&&(n=!0)){i.oncue&&i.cue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}if(i.cue===null)continue;i.cue.text&&(i.cue.text+=`
24
+ `),i.cue.text+=o;continue;case"BADCUE":o||(i.state="ID")}}}catch{i.state==="CUETEXT"&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state=i.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},c.flush=function(){var e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
25
25
 
26
- `,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(r){e.onparsingerror&&e.onparsingerror(r)}return e.onflush&&e.onflush(),this},m}(),wr=b(673),jr=b(524),Mr=/\r\n|\n\r|\n|\r/g,qr=function(m,c,e){return e===void 0&&(e=0),m.slice(e,e+c.length)===c},or=function(m){for(var c=5381,e=m.length;e;)c=33*c^m.charCodeAt(--e);return(c>>>0).toString()};function xr(m,c,e){return or(m.toString())+or(c.toString())+or(e)}function ba(){return ba=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(m[r]=e[r])}return m},ba.apply(this,arguments)}var Yr="stpp.ttml.im1t",$i=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Js=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,nm={left:"start",center:"center",right:"end",start:"start",end:"end"};function Gd(m,c,e,r,s){var o=(0,te.findBox)(new Uint8Array(m),["mdat"]);if(o.length!==0){var l=o.map(function(u){return(0,lt.utf8ArrayToStr)(u)}),n=(0,wr.toTimescaleFromScale)(c,1,e);try{l.forEach(function(u){return r(function(h,f){var p=new DOMParser().parseFromString(h,"text/xml").getElementsByTagName("tt")[0];if(!p)throw new Error("Invalid ttml");var _={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(_).reduce(function(ee,me){return ee[me]=p.getAttribute("ttp:"+me)||_[me],ee},{}),C=p.getAttribute("xml:space")!=="preserve",x=Vd(Ml(p,"styling","style")),W=Vd(Ml(p,"layout","region")),K=Ml(p,"body","[begin]");return[].map.call(K,function(ee){var me=Wd(ee,C);if(!me||!ee.hasAttribute("begin"))return null;var we=Ol(ee.getAttribute("begin"),S),ye=Ol(ee.getAttribute("dur"),S),De=Ol(ee.getAttribute("end"),S);if(we===null)throw jd(ee);if(De===null){if(ye===null)throw jd(ee);De=we+ye}var qe=new hr(we-f,De-f,me);qe.id=xr(qe.startTime,qe.endTime,qe.text);var it=function(Ve,Tt,Wt){var St="http://www.w3.org/ns/ttml#styling",Mt=null,Gt=Ve!=null&&Ve.hasAttribute("style")?Ve.getAttribute("style"):null;return Gt&&Wt.hasOwnProperty(Gt)&&(Mt=Wt[Gt]),["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce(function(yr,fr){var er=xl(Tt,St,fr)||xl(Ve,St,fr)||xl(Mt,St,fr);return er&&(yr[fr]=er),yr},{})}(W[ee.getAttribute("region")],x[ee.getAttribute("style")],x),Ie=it.textAlign;if(Ie){var je=nm[Ie];je&&(qe.lineAlign=je),qe.align=Ie}return ba(qe,it),qe}).filter(function(ee){return ee!==null})}(u,n))})}catch(u){s(u)}}else s(new Error("Could not parse IMSC1 mdat"))}function Ml(m,c,e){var r=m.getElementsByTagName(c)[0];return r?[].slice.call(r.querySelectorAll(e)):[]}function Vd(m){return m.reduce(function(c,e){var r=e.getAttribute("xml:id");return r&&(c[r]=e),c},{})}function Wd(m,c){return[].slice.call(m.childNodes).reduce(function(e,r,s){var o;return r.nodeName==="br"&&s?e+`
27
- `:(o=r.childNodes)!==null&&o!==void 0&&o.length?Wd(r,c):c?e+r.textContent.trim().replace(/\s+/g," "):e+r.textContent},"")}function xl(m,c,e){return m&&m.hasAttributeNS(c,e)?m.getAttributeNS(c,e):null}function jd(m){return new Error("Could not parse ttml timestamp "+m)}function Ol(m,c){if(!m)return null;var e=Pt(m);return e===null&&($i.test(m)?e=function(r,s){var o=$i.exec(r),l=(0|o[4])+(0|o[5])/s.subFrameRate;return 3600*(0|o[1])+60*(0|o[2])+(0|o[3])+l/s.frameRate}(m,c):Js.test(m)&&(e=function(r,s){var o=Js.exec(r),l=Number(o[1]);switch(o[2]){case"h":return 3600*l;case"m":return 60*l;case"ms":return 1e3*l;case"f":return l/s.frameRate;case"t":return l/s.tickRate}return l}(m,c))),e}var sm=function(){function m(e){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var r=new Dt(this,"textTrack1"),s=new Dt(this,"textTrack2"),o=new Dt(this,"textTrack3"),l=new Dt(this,"textTrack4");this.cea608Parser1=new Dr(1,r,s),this.cea608Parser2=new Dr(3,o,l)}e.on(y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(y.Events.FRAG_LOADING,this.onFragLoading,this),e.on(y.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(y.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(y.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(y.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(y.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var c=m.prototype;return c.destroy=function(){var e=this.hls;e.off(y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(y.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(y.Events.FRAG_LOADING,this.onFragLoading,this),e.off(y.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(y.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(y.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(y.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(y.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},c.addCues=function(e,r,s,o,l){for(var n,u,h,f,p=!1,_=l.length;_--;){var S=l[_],C=(n=S[0],u=S[1],h=r,f=s,Math.min(u,f)-Math.max(n,h));if(C>=0&&(S[0]=Math.min(S[0],r),S[1]=Math.max(S[1],s),p=!0,C/(s-r)>.5))return}if(p||l.push([r,s]),this.config.renderTextTracksNatively){var x=this.captionsTracks[e];this.Cues.newCue(x,r,s,o)}else{var W=this.Cues.newCue(null,r,s,o);this.hls.trigger(y.Events.CUES_PARSED,{type:"captions",cues:W,track:e})}},c.onInitPtsFound=function(e,r){var s=this,o=r.frag,l=r.id,n=r.initPTS,u=r.timescale,h=this.unparsedVttFrags;l==="main"&&(this.initPTS[o.cc]=n,this.timescale[o.cc]=u),h.length&&(this.unparsedVttFrags=[],h.forEach(function(f){s.onFragLoaded(y.Events.FRAG_LOADED,f)}))},c.getExistingTrack=function(e){var r=this.media;if(r)for(var s=0;s<r.textTracks.length;s++){var o=r.textTracks[s];if(o[e])return o}return null},c.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},c.createNativeTrack=function(e){if(!this.captionsTracks[e]){var r=this.captionsProperties,s=this.captionsTracks,o=this.media,l=r[e],n=l.label,u=l.languageCode,h=this.getExistingTrack(e);if(h)s[e]=h,gt(s[e]),rt(s[e],o);else{var f=this.createTextTrack("captions",n,u);f&&(f[e]=!0,s[e]=f)}}},c.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var r=this.captionsProperties[e];if(r){var s={_id:e,label:r.label,kind:"captions",default:!!r.media&&!!r.media.default,closedCaptions:r.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(y.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}}},c.createTextTrack=function(e,r,s){var o=this.media;if(o)return o.addTextTrack(e,r,s)},c.onMediaAttaching=function(e,r){this.media=r.media,this._cleanTracks()},c.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach(function(r){gt(e[r]),delete e[r]}),this.nonNativeCaptionsTracks={}},c.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},c._cleanTracks=function(){var e=this.media;if(e){var r=e.textTracks;if(r)for(var s=0;s<r.length;s++)gt(r[s])}},c.onSubtitleTracksUpdated=function(e,r){var s=this;this.textTracks=[];var o=r.subtitleTracks||[],l=o.some(function(f){return f.textCodec===Yr});if(this.config.enableWebVTT||l&&this.config.enableIMSC1){var n=this.tracks&&o&&this.tracks.length===o.length;if(this.tracks=o||[],this.config.renderTextTracksNatively){var u=this.media?this.media.textTracks:[];this.tracks.forEach(function(f,p){var _;if(p<u.length){for(var S=null,C=0;C<u.length;C++)if(om(u[C],f)){S=u[C];break}S&&(_=S)}if(_)gt(_);else{var x=s._captionsOrSubtitlesFromCharacteristics(f);(_=s.createTextTrack(x,f.name,f.lang))&&(_.mode="disabled")}_&&(_.groupId=f.groupId,s.textTracks.push(_))})}else if(!n&&this.tracks&&this.tracks.length){var h=this.tracks.map(function(f){return{label:f.name,kind:f.type.toLowerCase(),default:f.default,subtitleTrack:f}});this.hls.trigger(y.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}},c._captionsOrSubtitlesFromCharacteristics=function(e){var r;if((r=e.attrs)!==null&&r!==void 0&&r.CHARACTERISTICS){var s=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),o=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(s&&o)return"captions"}return"subtitles"},c.onManifestLoaded=function(e,r){var s=this;this.config.enableCEA708Captions&&r.captions&&r.captions.forEach(function(o){var l=/(?:CC|SERVICE)([1-4])/.exec(o.instreamId);if(l){var n="textTrack"+l[1],u=s.captionsProperties[n];u&&(u.label=o.name,o.lang&&(u.languageCode=o.lang),u.media=o)}})},c.closedCaptionsForLevel=function(e){var r=this.hls.levels[e.level];return r==null?void 0:r.attrs["CLOSED-CAPTIONS"]},c.onFragLoading=function(e,r){var s=this.cea608Parser1,o=this.cea608Parser2,l=this.lastSn,n=this.lastPartIndex;if(this.enabled&&s&&o&&r.frag.type===Te.PlaylistLevelType.MAIN){var u,h,f=r.frag.sn,p=(u=r==null||(h=r.part)===null||h===void 0?void 0:h.index)!=null?u:-1;f===l+1||f===l&&p===n+1||(s.reset(),o.reset()),this.lastSn=f,this.lastPartIndex=p}},c.onFragLoaded=function(e,r){var s=r.frag,o=r.payload,l=this.initPTS,n=this.unparsedVttFrags;if(s.type===Te.PlaylistLevelType.SUBTITLE)if(o.byteLength){if(!(0,R.isFiniteNumber)(l[s.cc]))return n.push(r),void(l.length&&this.hls.trigger(y.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Missing initial subtitle PTS")}));var u=s.decryptdata,h="stats"in r;if(u==null||!u.encrypted||h){var f=this.tracks[s.level],p=this.vttCCs;p[s.cc]||(p[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),f&&f.textCodec===Yr?this._parseIMSC1(s,o):this._parseVTTs(s,o,p)}}else this.hls.trigger(y.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})},c._parseIMSC1=function(e,r){var s=this,o=this.hls;Gd(r,this.initPTS[e.cc],this.timescale[e.cc],function(l){s._appendCues(l,e.level),o.trigger(y.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(l){O.logger.log("Failed to parse IMSC1: "+l),o.trigger(y.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:l})})},c._parseVTTs=function(e,r,s){var o,l=this,n=this.hls;(function(u,h,f,p,_,S,C,x){var W,K=new Cr,ee=(0,lt.utf8ArrayToStr)(new Uint8Array(u)).trim().replace(Mr,`
26
+ `,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(i){e.onparsingerror&&e.onparsingerror(i)}return e.onflush&&e.onflush(),this},m}(),Ii=E(673),ji=E(524),Mi=/\r\n|\n\r|\n|\r/g,qi=function(m,c,e){return e===void 0&&(e=0),m.slice(e,e+c.length)===c},oi=function(m){for(var c=5381,e=m.length;e;)c=33*c^m.charCodeAt(--e);return(c>>>0).toString()};function xi(m,c,e){return oi(m.toString())+oi(c.toString())+oi(e)}function ba(){return ba=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(m[i]=e[i])}return m},ba.apply(this,arguments)}var Yi="stpp.ttml.im1t",$r=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Js=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,nm={left:"start",center:"center",right:"end",start:"start",end:"end"};function Gd(m,c,e,i,s){var o=(0,te.findBox)(new Uint8Array(m),["mdat"]);if(o.length!==0){var l=o.map(function(u){return(0,lt.utf8ArrayToStr)(u)}),n=(0,Ii.toTimescaleFromScale)(c,1,e);try{l.forEach(function(u){return i(function(h,f){var p=new DOMParser().parseFromString(h,"text/xml").getElementsByTagName("tt")[0];if(!p)throw new Error("Invalid ttml");var _={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(_).reduce(function(ee,me){return ee[me]=p.getAttribute("ttp:"+me)||_[me],ee},{}),C=p.getAttribute("xml:space")!=="preserve",x=Vd(Ml(p,"styling","style")),W=Vd(Ml(p,"layout","region")),K=Ml(p,"body","[begin]");return[].map.call(K,function(ee){var me=Wd(ee,C);if(!me||!ee.hasAttribute("begin"))return null;var Ie=Ol(ee.getAttribute("begin"),S),ye=Ol(ee.getAttribute("dur"),S),De=Ol(ee.getAttribute("end"),S);if(Ie===null)throw jd(ee);if(De===null){if(ye===null)throw jd(ee);De=Ie+ye}var qe=new hi(Ie-f,De-f,me);qe.id=xi(qe.startTime,qe.endTime,qe.text);var rt=function(Ve,Tt,Wt){var St="http://www.w3.org/ns/ttml#styling",Mt=null,Gt=Ve!=null&&Ve.hasAttribute("style")?Ve.getAttribute("style"):null;return Gt&&Wt.hasOwnProperty(Gt)&&(Mt=Wt[Gt]),["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce(function(yi,fi){var ei=xl(Tt,St,fi)||xl(Ve,St,fi)||xl(Mt,St,fi);return ei&&(yi[fi]=ei),yi},{})}(W[ee.getAttribute("region")],x[ee.getAttribute("style")],x),we=rt.textAlign;if(we){var je=nm[we];je&&(qe.lineAlign=je),qe.align=we}return ba(qe,rt),qe}).filter(function(ee){return ee!==null})}(u,n))})}catch(u){s(u)}}else s(new Error("Could not parse IMSC1 mdat"))}function Ml(m,c,e){var i=m.getElementsByTagName(c)[0];return i?[].slice.call(i.querySelectorAll(e)):[]}function Vd(m){return m.reduce(function(c,e){var i=e.getAttribute("xml:id");return i&&(c[i]=e),c},{})}function Wd(m,c){return[].slice.call(m.childNodes).reduce(function(e,i,s){var o;return i.nodeName==="br"&&s?e+`
27
+ `:(o=i.childNodes)!==null&&o!==void 0&&o.length?Wd(i,c):c?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent},"")}function xl(m,c,e){return m&&m.hasAttributeNS(c,e)?m.getAttributeNS(c,e):null}function jd(m){return new Error("Could not parse ttml timestamp "+m)}function Ol(m,c){if(!m)return null;var e=Pt(m);return e===null&&($r.test(m)?e=function(i,s){var o=$r.exec(i),l=(0|o[4])+(0|o[5])/s.subFrameRate;return 3600*(0|o[1])+60*(0|o[2])+(0|o[3])+l/s.frameRate}(m,c):Js.test(m)&&(e=function(i,s){var o=Js.exec(i),l=Number(o[1]);switch(o[2]){case"h":return 3600*l;case"m":return 60*l;case"ms":return 1e3*l;case"f":return l/s.frameRate;case"t":return l/s.tickRate}return l}(m,c))),e}var sm=function(){function m(e){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var i=new Dt(this,"textTrack1"),s=new Dt(this,"textTrack2"),o=new Dt(this,"textTrack3"),l=new Dt(this,"textTrack4");this.cea608Parser1=new Di(1,i,s),this.cea608Parser2=new Di(3,o,l)}e.on(b.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(b.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(b.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(b.Events.FRAG_LOADING,this.onFragLoading,this),e.on(b.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(b.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(b.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(b.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(b.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(b.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var c=m.prototype;return c.destroy=function(){var e=this.hls;e.off(b.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(b.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(b.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(b.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(b.Events.FRAG_LOADING,this.onFragLoading,this),e.off(b.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(b.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(b.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(b.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(b.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(b.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},c.addCues=function(e,i,s,o,l){for(var n,u,h,f,p=!1,_=l.length;_--;){var S=l[_],C=(n=S[0],u=S[1],h=i,f=s,Math.min(u,f)-Math.max(n,h));if(C>=0&&(S[0]=Math.min(S[0],i),S[1]=Math.max(S[1],s),p=!0,C/(s-i)>.5))return}if(p||l.push([i,s]),this.config.renderTextTracksNatively){var x=this.captionsTracks[e];this.Cues.newCue(x,i,s,o)}else{var W=this.Cues.newCue(null,i,s,o);this.hls.trigger(b.Events.CUES_PARSED,{type:"captions",cues:W,track:e})}},c.onInitPtsFound=function(e,i){var s=this,o=i.frag,l=i.id,n=i.initPTS,u=i.timescale,h=this.unparsedVttFrags;l==="main"&&(this.initPTS[o.cc]=n,this.timescale[o.cc]=u),h.length&&(this.unparsedVttFrags=[],h.forEach(function(f){s.onFragLoaded(b.Events.FRAG_LOADED,f)}))},c.getExistingTrack=function(e){var i=this.media;if(i)for(var s=0;s<i.textTracks.length;s++){var o=i.textTracks[s];if(o[e])return o}return null},c.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},c.createNativeTrack=function(e){if(!this.captionsTracks[e]){var i=this.captionsProperties,s=this.captionsTracks,o=this.media,l=i[e],n=l.label,u=l.languageCode,h=this.getExistingTrack(e);if(h)s[e]=h,gt(s[e]),it(s[e],o);else{var f=this.createTextTrack("captions",n,u);f&&(f[e]=!0,s[e]=f)}}},c.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var i=this.captionsProperties[e];if(i){var s={_id:e,label:i.label,kind:"captions",default:!!i.media&&!!i.media.default,closedCaptions:i.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(b.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}}},c.createTextTrack=function(e,i,s){var o=this.media;if(o)return o.addTextTrack(e,i,s)},c.onMediaAttaching=function(e,i){this.media=i.media,this._cleanTracks()},c.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach(function(i){gt(e[i]),delete e[i]}),this.nonNativeCaptionsTracks={}},c.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},c._cleanTracks=function(){var e=this.media;if(e){var i=e.textTracks;if(i)for(var s=0;s<i.length;s++)gt(i[s])}},c.onSubtitleTracksUpdated=function(e,i){var s=this;this.textTracks=[];var o=i.subtitleTracks||[],l=o.some(function(f){return f.textCodec===Yi});if(this.config.enableWebVTT||l&&this.config.enableIMSC1){var n=this.tracks&&o&&this.tracks.length===o.length;if(this.tracks=o||[],this.config.renderTextTracksNatively){var u=this.media?this.media.textTracks:[];this.tracks.forEach(function(f,p){var _;if(p<u.length){for(var S=null,C=0;C<u.length;C++)if(om(u[C],f)){S=u[C];break}S&&(_=S)}if(_)gt(_);else{var x=s._captionsOrSubtitlesFromCharacteristics(f);(_=s.createTextTrack(x,f.name,f.lang))&&(_.mode="disabled")}_&&(_.groupId=f.groupId,s.textTracks.push(_))})}else if(!n&&this.tracks&&this.tracks.length){var h=this.tracks.map(function(f){return{label:f.name,kind:f.type.toLowerCase(),default:f.default,subtitleTrack:f}});this.hls.trigger(b.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}},c._captionsOrSubtitlesFromCharacteristics=function(e){var i;if((i=e.attrs)!==null&&i!==void 0&&i.CHARACTERISTICS){var s=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),o=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(s&&o)return"captions"}return"subtitles"},c.onManifestLoaded=function(e,i){var s=this;this.config.enableCEA708Captions&&i.captions&&i.captions.forEach(function(o){var l=/(?:CC|SERVICE)([1-4])/.exec(o.instreamId);if(l){var n="textTrack"+l[1],u=s.captionsProperties[n];u&&(u.label=o.name,o.lang&&(u.languageCode=o.lang),u.media=o)}})},c.closedCaptionsForLevel=function(e){var i=this.hls.levels[e.level];return i==null?void 0:i.attrs["CLOSED-CAPTIONS"]},c.onFragLoading=function(e,i){var s=this.cea608Parser1,o=this.cea608Parser2,l=this.lastSn,n=this.lastPartIndex;if(this.enabled&&s&&o&&i.frag.type===Te.PlaylistLevelType.MAIN){var u,h,f=i.frag.sn,p=(u=i==null||(h=i.part)===null||h===void 0?void 0:h.index)!=null?u:-1;f===l+1||f===l&&p===n+1||(s.reset(),o.reset()),this.lastSn=f,this.lastPartIndex=p}},c.onFragLoaded=function(e,i){var s=i.frag,o=i.payload,l=this.initPTS,n=this.unparsedVttFrags;if(s.type===Te.PlaylistLevelType.SUBTITLE)if(o.byteLength){if(!(0,R.isFiniteNumber)(l[s.cc]))return n.push(i),void(l.length&&this.hls.trigger(b.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Missing initial subtitle PTS")}));var u=s.decryptdata,h="stats"in i;if(u==null||!u.encrypted||h){var f=this.tracks[s.level],p=this.vttCCs;p[s.cc]||(p[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),f&&f.textCodec===Yi?this._parseIMSC1(s,o):this._parseVTTs(s,o,p)}}else this.hls.trigger(b.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})},c._parseIMSC1=function(e,i){var s=this,o=this.hls;Gd(i,this.initPTS[e.cc],this.timescale[e.cc],function(l){s._appendCues(l,e.level),o.trigger(b.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(l){O.logger.log("Failed to parse IMSC1: "+l),o.trigger(b.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:l})})},c._parseVTTs=function(e,i,s){var o,l=this,n=this.hls;(function(u,h,f,p,_,S,C,x){var W,K=new Ci,ee=(0,lt.utf8ArrayToStr)(new Uint8Array(u)).trim().replace(Mi,`
28
28
  `).split(`
29
- `),me=[],we=(0,wr.toMpegTsClockFromTimescale)(h,f),ye="00:00.000",De=0,qe=0,it=!0;K.oncue=function(Ie){var je=p[_],Ve=p.ccOffset,Tt=(De-we)/9e4;je!=null&&je.new&&(qe!==void 0?Ve=p.ccOffset=je.start:function(Gt,yr,fr){var er=Gt[yr],br=Gt[er.prevCC];if(!br||!br.new&&er.new)return Gt.ccOffset=Gt.presentationOffset=er.start,void(er.new=!1);for(;(Zr=br)!==null&&Zr!==void 0&&Zr.new;){var Zr;Gt.ccOffset+=er.start-br.start,er.new=!1,br=Gt[(er=br).prevCC]}Gt.presentationOffset=fr}(p,_,Tt)),Tt&&(Ve=Tt-p.presentationOffset);var Wt=Ie.endTime-Ie.startTime,St=(0,jr.normalizePts)(9e4*(Ie.startTime+Ve-qe),9e4*S)/9e4;Ie.startTime=Math.max(St,0),Ie.endTime=Math.max(St+Wt,0);var Mt=Ie.text.trim();Ie.text=decodeURIComponent(encodeURIComponent(Mt)),Ie.id||(Ie.id=xr(Ie.startTime,Ie.endTime,Mt)),Ie.endTime>0&&me.push(Ie)},K.onparsingerror=function(Ie){W=Ie},K.onflush=function(){W?x(W):C(me)},ee.forEach(function(Ie){if(it){if(qr(Ie,"X-TIMESTAMP-MAP=")){it=!1,Ie.slice(16).split(",").forEach(function(je){qr(je,"LOCAL:")?ye=je.slice(6):qr(je,"MPEGTS:")&&(De=parseInt(je.slice(7)))});try{qe=function(je){var Ve=parseInt(je.slice(-3)),Tt=parseInt(je.slice(-6,-4)),Wt=parseInt(je.slice(-9,-7)),St=je.length>9?parseInt(je.substring(0,je.indexOf(":"))):0;if(!((0,R.isFiniteNumber)(Ve)&&(0,R.isFiniteNumber)(Tt)&&(0,R.isFiniteNumber)(Wt)&&(0,R.isFiniteNumber)(St)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+je);return Ve+=1e3*Tt,(Ve+=6e4*Wt)+36e5*St}(ye)/1e3}catch(je){W=je}return}Ie===""&&(it=!1)}K.parse(Ie+`
30
- `)}),K.flush()})((o=e.initSegment)!==null&&o!==void 0&&o.data?(0,te.appendUint8Array)(e.initSegment.data,new Uint8Array(r)):r,this.initPTS[e.cc],this.timescale[e.cc],s,e.cc,e.start,function(u){l._appendCues(u,e.level),n.trigger(y.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(u){l._fallbackToIMSC1(e,r),O.logger.log("Failed to parse VTT cue: "+u),n.trigger(y.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:u})})},c._fallbackToIMSC1=function(e,r){var s=this,o=this.tracks[e.level];o.textCodec||Gd(r,this.initPTS[e.cc],this.timescale[e.cc],function(){o.textCodec=Yr,s._parseIMSC1(e,r)},function(){o.textCodec="wvtt"})},c._appendCues=function(e,r){var s=this.hls;if(this.config.renderTextTracksNatively){var o=this.textTracks[r];if(!o||o.mode==="disabled")return;e.forEach(function(u){return _t(o,u)})}else{var l=this.tracks[r];if(!l)return;var n=l.default?"default":"subtitles"+r;s.trigger(y.Events.CUES_PARSED,{type:"subtitles",cues:e,track:n})}},c.onFragDecrypted=function(e,r){var s=r.frag;if(s.type===Te.PlaylistLevelType.SUBTITLE){if(!(0,R.isFiniteNumber)(this.initPTS[s.cc]))return void this.unparsedVttFrags.push(r);this.onFragLoaded(y.Events.FRAG_LOADED,r)}},c.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},c.onFragParsingUserdata=function(e,r){var s=this.cea608Parser1,o=this.cea608Parser2;if(this.enabled&&s&&o){var l=r.frag,n=r.samples;if(l.type!==Te.PlaylistLevelType.MAIN||this.closedCaptionsForLevel(l)!=="NONE")for(var u=0;u<n.length;u++){var h=n[u].bytes;if(h){var f=this.extractCea608Data(h);s.addData(n[u].pts,f[0]),o.addData(n[u].pts,f[1])}}}},c.onBufferFlushing=function(e,r){var s=r.startOffset,o=r.endOffset,l=r.endOffsetSubtitles,n=r.type,u=this.media;if(u&&!(u.currentTime<o)){if(!n||n==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(p){return Lt(h[p],s,o)})}if(this.config.renderTextTracksNatively&&s===0&&l!==void 0){var f=this.textTracks;Object.keys(f).forEach(function(p){return Lt(f[p],s,l)})}}},c.extractCea608Data=function(e){for(var r=[[],[]],s=31&e[0],o=2,l=0;l<s;l++){var n=e[o++],u=127&e[o++],h=127&e[o++];if((u!==0||h!==0)&&(4&n)!=0){var f=3&n;f!==0&&f!==1||(r[f].push(u),r[f].push(h))}}return r},m}();function om(m,c){return m&&m.label===c.name&&!(m.textTrack1||m.textTrack2)}function lm(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}let um=function(){function m(s){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=s,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var c,e,r=m.prototype;return r.setStreamController=function(s){this.streamController=s},r.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},r.registerListeners=function(){var s=this.hls;s.on(y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),s.on(y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(y.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(y.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.on(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},r.unregisterListener=function(){var s=this.hls;s.off(y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),s.off(y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(y.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(y.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.off(y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},r.onFpsDropLevelCapping=function(s,o){m.isLevelAllowed(o.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(o.droppedLevel)},r.onMediaAttaching=function(s,o){this.media=o.media instanceof HTMLVideoElement?o.media:null,this.clientRect=null},r.onManifestParsed=function(s,o){var l=this.hls;this.restrictedLevels=[],this.firstLevel=o.firstLevel,l.config.capLevelToPlayerSize&&o.video&&this.startCapping()},r.onBufferCodecs=function(s,o){this.hls.config.capLevelToPlayerSize&&o.video&&this.startCapping()},r.onMediaDetaching=function(){this.stopCapping()},r.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var s=this.hls.levels;if(s.length){var o=this.hls;o.autoLevelCapping=this.getMaxLevel(s.length-1),o.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=o.autoLevelCapping}}},r.getMaxLevel=function(s){var o=this,l=this.hls.levels;if(!l.length)return-1;var n=l.filter(function(u,h){return m.isLevelAllowed(h,o.restrictedLevels)&&h<=s});return this.clientRect=null,m.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)},r.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},r.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},r.getDimensions=function(){if(this.clientRect)return this.clientRect;var s=this.media,o={width:0,height:0};if(s){var l=s.getBoundingClientRect();o.width=l.width,o.height=l.height,o.width||o.height||(o.width=l.right-l.left||s.width||0,o.height=l.bottom-l.top||s.height||0)}return this.clientRect=o,o},m.isLevelAllowed=function(s,o){return o===void 0&&(o=[]),o.indexOf(s)===-1},m.getMaxLevelByMediaSize=function(s,o,l){if(!s||!s.length)return-1;for(var n,u,h=s.length-1,f=0;f<s.length;f+=1){var p=s[f];if((p.width>=o||p.height>=l)&&(n=p,!(u=s[f+1])||n.width!==u.width||n.height!==u.height)){h=f;break}}return h},c=m,(e=[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var s=1;if(!this.hls.config.ignoreDevicePixelRatio)try{s=self.devicePixelRatio}catch{}return s}}])&&lm(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}(),dm=function(){function m(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var c=m.prototype;return c.setStreamController=function(e){this.streamController=e},c.registerListeners=function(){this.hls.on(y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},c.unregisterListeners=function(){this.hls.off(y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},c.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},c.onMediaAttaching=function(e,r){var s=this.hls.config;if(s.capLevelOnFPSDrop){var o=r.media instanceof self.HTMLVideoElement?r.media:null;this.media=o,o&&typeof o.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}},c.checkFPS=function(e,r,s){var o=performance.now();if(r){if(this.lastTime){var l=o-this.lastTime,n=s-this.lastDroppedFrames,u=r-this.lastDecodedFrames,h=1e3*n/l,f=this.hls;if(f.trigger(y.Events.FPS_DROP,{currentDropped:n,currentDecoded:u,totalDroppedFrames:s}),h>0&&n>f.config.fpsDroppedMonitoringThreshold*u){var p=f.currentLevel;O.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+p),p>0&&(f.autoLevelCapping===-1||f.autoLevelCapping>=p)&&(p-=1,f.trigger(y.Events.FPS_DROP_LEVEL_CAPPING,{level:p,droppedLevel:f.currentLevel}),f.autoLevelCapping=p,this.streamController.nextLevelSwitch())}}this.lastTime=o,this.lastDroppedFrames=s,this.lastDecodedFrames=r}},c.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var r=e.getVideoPlaybackQuality();this.checkFPS(e,r.totalVideoFrames,r.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},m}();var Ta=b(300);function Pl(m){var c=typeof Map=="function"?new Map:void 0;return Pl=function(e){if(e===null||(r=e,Function.toString.call(r).indexOf("[native code]")===-1))return e;var r;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(c!==void 0){if(c.has(e))return c.get(e);c.set(e,s)}function s(){return Nl(e,arguments,Ul(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),Vn(s,e)},Pl(m)}function Nl(m,c,e){return Nl=cm()?Reflect.construct.bind():function(r,s,o){var l=[null];l.push.apply(l,s);var n=new(Function.bind.apply(r,l));return o&&Vn(n,o.prototype),n},Nl.apply(null,arguments)}function cm(){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 Vn(m,c){return Vn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Vn(m,c)}function Ul(m){return Ul=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(c){return c.__proto__||Object.getPrototypeOf(c)},Ul(m)}var eo="[eme]",qd=function(){function m(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=m.CDMCleanupPromise?[m.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=O.logger.debug.bind(O.logger,eo),this.log=O.logger.log.bind(O.logger,eo),this.warn=O.logger.warn.bind(O.logger,eo),this.error=O.logger.error.bind(O.logger,eo),this.hls=e,this.config=e.config,this.registerListeners()}var c=m.prototype;return c.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null},c.registerListeners=function(){this.hls.on(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(y.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},c.unregisterListeners=function(){this.hls.off(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(y.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},c.getLicenseServerUrl=function(e){var r=this.config,s=r.drmSystems,o=r.widevineLicenseUrl,l=s[e];if(l)return l.licenseUrl;if(e===z.WIDEVINE&&o)return o;throw new Error('no license server URL configured for key-system "'+e+'"')},c.getServerCertificateUrl=function(e){var r=this.config.drmSystems[e];if(r)return r.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},c.attemptKeySystemAccess=function(e){var r=this,s=this.hls.levels,o=function(u,h,f){return!!u&&f.indexOf(u)===h},l=s.map(function(u){return u.audioCodec}).filter(o),n=s.map(function(u){return u.videoCodec}).filter(o);return l.length+n.length===0&&n.push("avc1.42e01e"),new Promise(function(u,h){(function f(p){var _=p.shift();r.getMediaKeysPromise(_,l,n).then(function(S){return u({keySystem:_,mediaKeys:S})}).catch(function(S){p.length?f(p):h(S instanceof ui?S:new ui({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_ACCESS,error:S,fatal:!0},S.message))})})(e)})},c.requestMediaKeySystemAccess=function(e,r){var s=this.config.requestMediaKeySystemAccessFunc;if(typeof s!="function"){var o="Configured requestMediaKeySystemAccess is not a function "+s;return _e===null&&self.location.protocol==="http:"&&(o="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(o))}return s(e,r)},c.getMediaKeysPromise=function(e,r,s){var o=this,l=function(f,p,_,S){var C;switch(f){case z.FAIRPLAY:C=["cenc","sinf"];break;case z.WIDEVINE:case z.PLAYREADY:C=["cenc"];break;case z.CLEARKEY:C=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+f)}return function(x,W,K,ee){return[{initDataTypes:x,persistentState:ee.persistentState||"not-allowed",distinctiveIdentifier:ee.distinctiveIdentifier||"not-allowed",sessionTypes:ee.sessionTypes||[ee.sessionType||"temporary"],audioCapabilities:W.map(function(me){return{contentType:'audio/mp4; codecs="'+me+'"',robustness:ee.audioRobustness||"",encryptionScheme:ee.audioEncryptionScheme||null}}),videoCapabilities:K.map(function(me){return{contentType:'video/mp4; codecs="'+me+'"',robustness:ee.videoRobustness||"",encryptionScheme:ee.videoEncryptionScheme||null}})}]}(C,p,_,S)}(e,r,s,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e],u=n==null?void 0:n.keySystemAccess;if(!u){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(l)),u=this.requestMediaKeySystemAccess(e,l);var h=this.keySystemAccessPromises[e]={keySystemAccess:u};return u.catch(function(f){o.log('Failed to obtain access to key-system "'+e+'": '+f)}),u.then(function(f){o.log('Access for key-system "'+f.keySystem+'" obtained');var p=o.fetchServerCertificate(e);return o.log('Create media-keys for "'+e+'"'),h.mediaKeys=f.createMediaKeys().then(function(_){return o.log('Media-keys created for "'+e+'"'),p.then(function(S){return S?o.setMediaKeysServerCertificate(_,e,S):_})}),h.mediaKeys.catch(function(_){o.error('Failed to create media-keys for "'+e+'"}: '+_)}),h.mediaKeys})}return u.then(function(){return n.mediaKeys})},c.createMediaKeySessionContext=function(e){var r=e.decryptdata,s=e.keySystem,o=e.mediaKeys;this.log('Creating key-system session "'+s+'" keyId: '+Ta.default.hexDump(r.keyId||[]));var l=o.createSession(),n={decryptdata:r,keySystem:s,mediaKeys:o,mediaKeysSession:l,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n},c.renewKeySession=function(e){var r=e.decryptdata;if(r.pssh){var s=this.createMediaKeySessionContext(e),o=this.getKeyIdString(r);this.keyIdToKeySessionPromise[o]=this.generateRequestWithPreferredKeySession(s,"cenc",r.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},c.getKeyIdString=function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return Ta.default.hexDump(e.keyId)},c.updateKeySession=function(e,r){var s,o=e.mediaKeysSession;return this.log('Updating key-session "'+o.sessionId+'" for keyID '+Ta.default.hexDump(((s=e.decryptdata)===null||s===void 0?void 0:s.keyId)||[])+`
31
- } (data length: `+(r&&r.byteLength)+")"),o.update(r)},c.selectKeySystemFormat=function(e){var r=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+r.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(r)),this.keyFormatPromise},c.getKeyFormatPromise=function(e){var r=this;return new Promise(function(s,o){var l=fe(r.config),n=e.map(q).filter(function(u){return!!u&&l.indexOf(u)!==-1});return r.getKeySystemSelectionPromise(n).then(function(u){var h=u.keySystem,f=N(h);f?s(f):o(new Error('Unable to find format for key-system "'+h+'"'))}).catch(o)})},c.loadKey=function(e){var r=this,s=e.keyInfo.decryptdata,o=this.getKeyIdString(s),l="(keyId: "+o+' format: "'+s.keyFormat+'" method: '+s.method+" uri: "+s.uri+")";this.log("Starting session for key "+l);var n=this.keyIdToKeySessionPromise[o];return n||(n=this.keyIdToKeySessionPromise[o]=this.getKeySystemForKeyPromise(s).then(function(u){var h=u.keySystem,f=u.mediaKeys;return r.throwIfDestroyed(),r.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+l),r.attemptSetMediaKeys(h,f).then(function(){r.throwIfDestroyed();var p=r.createMediaKeySessionContext({keySystem:h,mediaKeys:f,decryptdata:s});return r.generateRequestWithPreferredKeySession(p,"cenc",s.pssh,"playlist-key")})})).catch(function(u){return r.handleError(u)}),n},c.throwIfDestroyed=function(e){if(e===void 0&&(e="Invalid state"),!this.hls)throw new Error("invalid state")},c.handleError=function(e){this.hls&&(this.error(e.message),e instanceof ui?this.hls.trigger(y.Events.ERROR,e.data):this.hls.trigger(y.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},c.getKeySystemForKeyPromise=function(e){var r=this.getKeyIdString(e),s=this.keyIdToKeySessionPromise[r];if(!s){var o=q(e.keyFormat),l=o?[o]:fe(this.config);return this.attemptKeySystemAccess(l)}return s},c.getKeySystemSelectionPromise=function(e){if(e.length||(e=fe(this.config)),e.length===0)throw new ui({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},c._onMediaEncrypted=function(e){var r=this,s=e.initDataType,o=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+s+'"'),o!==null){var l,n;if(s==="sinf"&&this.config.drmSystems[z.FAIRPLAY]){var u=(0,te.bin2str)(new Uint8Array(o));try{var h=Z(JSON.parse(u).sinf),f=(0,te.parseSinf)(new Uint8Array(h));if(!f)return;l=f.subarray(8,24),n=z.FAIRPLAY}catch{return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var p=(0,te.parsePssh)(o);if(p===null)return;p.version===0&&p.systemId===ke.WIDEVINE&&p.data&&(l=p.data.subarray(8,24)),n=function(me){if(me===ke.WIDEVINE)return z.WIDEVINE}(p.systemId)}if(n&&l){for(var _=Ta.default.hexDump(l),S=this.keyIdToKeySessionPromise,C=this.mediaKeySessions,x=S[_],W=function(me){var we=C[me],ye=we.decryptdata;if(ye.pssh||!ye.keyId)return"continue";var De=Ta.default.hexDump(ye.keyId);return _===De||ye.uri.replace(/-/g,"").indexOf(_)!==-1?(x=S[De],delete S[De],ye.pssh=new Uint8Array(o),ye.keyId=l,x=S[_]=x.then(function(){return r.generateRequestWithPreferredKeySession(we,s,o,"encrypted-event-key-match")}),"break"):void 0},K=0;K<C.length;K++){var ee=W(K);if(ee!=="continue"&&ee==="break")break}x||(x=S[_]=this.getKeySystemSelectionPromise([n]).then(function(me){var we,ye=me.keySystem,De=me.mediaKeys;r.throwIfDestroyed();var qe=new Re("ISO-23001-7",_,(we=N(ye))!=null?we:"");return qe.pssh=new Uint8Array(o),qe.keyId=l,r.attemptSetMediaKeys(ye,De).then(function(){r.throwIfDestroyed();var it=r.createMediaKeySessionContext({decryptdata:qe,keySystem:ye,mediaKeys:De});return r.generateRequestWithPreferredKeySession(it,s,o,"encrypted-event-no-match")})})),x.catch(function(me){return r.handleError(me)})}}},c._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},c.attemptSetMediaKeys=function(e,r){var s=this,o=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var l=Promise.all(o).then(function(){if(!s.media)throw new Error("Attempted to set mediaKeys without media element attached");return s.media.setMediaKeys(r)});return this.setMediaKeysQueue.push(l),l.then(function(){s.log('Media-keys set for "'+e+'"'),o.push(l),s.setMediaKeysQueue=s.setMediaKeysQueue.filter(function(n){return o.indexOf(n)===-1})})},c.generateRequestWithPreferredKeySession=function(e,r,s,o){var l,n,u=this,h=(l=this.config.drmSystems)===null||l===void 0||(n=l[e.keySystem])===null||n===void 0?void 0:n.generateRequest;if(h)try{var f=h.call(this.hls,r,s,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");r=f.initDataType,s=e.decryptdata.pssh=f.initData?new Uint8Array(f.initData):null}catch(x){var p;if(this.warn(x.message),(p=this.hls)!==null&&p!==void 0&&p.config.debug)throw x}if(s===null)return this.log('Skipping key-session request for "'+o+'" (no initData)'),Promise.resolve(e);var _=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+o+'": '+_+" (init data type: "+r+" length: "+(s?s.byteLength:null)+")");var S=new(ga());e.mediaKeysSession.onmessage=function(x){var W=e.mediaKeysSession;if(W){var K=x.messageType,ee=x.message;u.log('"'+K+'" message event for session "'+W.sessionId+'" message size: '+ee.byteLength),K==="license-request"||K==="license-renewal"?u.renewLicense(e,ee).catch(function(me){u.handleError(me),S.emit("error",me)}):K==="license-release"?e.keySystem===z.FAIRPLAY&&(u.updateKeySession(e,w("acknowledged")),u.removeSession(e)):u.warn('unhandled media key message type "'+K+'"')}else S.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(x){if(e.mediaKeysSession){u.onKeyStatusChange(e);var W=e.keyStatus;S.emit("keyStatus",W),W==="expired"&&(u.warn(e.keySystem+" expired for key "+_),u.renewKeySession(e))}else S.emit("error",new Error("invalid state"))};var C=new Promise(function(x,W){S.on("error",W),S.on("keyStatus",function(K){K.startsWith("usable")?x():K==="output-restricted"?W(new ui({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):K==="internal-error"?W(new ui({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+K+'"')):K==="expired"?W(new Error("key expired while generating request")):u.warn('unhandled key status change "'+K+'"')})});return e.mediaKeysSession.generateRequest(r,s).then(function(){var x;u.log('Request generated for key-session "'+((x=e.mediaKeysSession)===null||x===void 0?void 0:x.sessionId)+'" keyId: '+_)}).catch(function(x){throw new ui({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_SESSION,error:x,fatal:!1},"Error generating key-session request: "+x)}).then(function(){return C}).catch(function(x){throw S.removeAllListeners(),u.removeSession(e),x}).then(function(){return S.removeAllListeners(),e})},c.onKeyStatusChange=function(e){var r=this;e.mediaKeysSession.keyStatuses.forEach(function(s,o){r.log('key status change "'+s+'" for keyStatuses keyId: '+Ta.default.hexDump("buffer"in o?new Uint8Array(o.buffer,o.byteOffset,o.byteLength):new Uint8Array(o))+" session keyId: "+Ta.default.hexDump(new Uint8Array(e.decryptdata.keyId||[]))+" uri: "+e.decryptdata.uri),e.keyStatus=s})},c.fetchServerCertificate=function(e){var r=this;return new Promise(function(s,o){var l=r.getServerCertificateUrl(e);if(!l)return s();r.log('Fetching serverCertificate for "'+e+'"');var n=new XMLHttpRequest;n.open("GET",l,!0),n.responseType="arraybuffer",n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&(n.status===200?s(n.response):o(new ui({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n},'"'+e+'" certificate request XHR failed ('+l+"). Status: "+n.status+" ("+n.statusText+")")))},n.send()})},c.setMediaKeysServerCertificate=function(e,r,s){var o=this;return new Promise(function(l,n){e.setServerCertificate(s).then(function(u){o.log("setServerCertificate "+(u?"success":"not supported by CDM")+" ("+(s==null?void 0:s.byteLength)+') on "'+r+'"'),l(e)}).catch(function(u){n(new ui({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:u,fatal:!0},u.message))})})},c.renewLicense=function(e,r){var s=this;return this.requestLicense(e,new Uint8Array(r)).then(function(o){return s.updateKeySession(e,new Uint8Array(o)).catch(function(l){throw new ui({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:l,fatal:!0},l.message)})})},c.setupLicenseXHR=function(e,r,s,o){var l=this,n=this.config.licenseXhrSetup;return n?Promise.resolve().then(function(){if(!s.decryptdata)throw new Error("Key removed");return n.call(l.hls,e,r,s,o)}).catch(function(u){if(!s.decryptdata)throw u;return e.open("POST",r,!0),n.call(l.hls,e,r,s,o)}).then(function(u){return e.readyState||e.open("POST",r,!0),{xhr:e,licenseChallenge:u||o}}):(e.open("POST",r,!0),Promise.resolve({xhr:e,licenseChallenge:o}))},c.requestLicense=function(e,r){var s=this;return new Promise(function(o,l){var n=s.getLicenseServerUrl(e.keySystem);s.log("Sending license request to URL: "+n);var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=function(){if(!s.hls||!e.mediaKeysSession)return l(new Error("invalid state"));if(u.readyState===4)if(u.status===200){s._requestLicenseFailureCount=0;var h=u.response;s.log("License received "+(h instanceof ArrayBuffer?h.byteLength:h));var f=s.config.licenseResponseCallback;if(f)try{h=f.call(s.hls,u,n,e)}catch(_){s.error(_)}o(h)}else if(s._requestLicenseFailureCount++,s._requestLicenseFailureCount>3||u.status>=400&&u.status<500)l(new ui({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:u},"License Request XHR failed ("+n+"). Status: "+u.status+" ("+u.statusText+")"));else{var p=3-s._requestLicenseFailureCount+1;s.warn("Retrying license request, "+p+" attempts left"),s.requestLicense(e,r).then(o,l)}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=u,s.setupLicenseXHR(u,n,e,r).then(function(h){var f=h.xhr,p=h.licenseChallenge;f.send(p)})})},c.onMediaAttached=function(e,r){if(this.config.emeEnabled){var s=r.media;this.media=s,s.addEventListener("encrypted",this.onMediaEncrypted),s.addEventListener("waitingforkey",this.onWaitingForKey)}},c.onMediaDetached=function(){var e=this,r=this.media,s=this.mediaKeySessions;r&&(r.removeEventListener("encrypted",this.onMediaEncrypted),r.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Re.clearKeyUriToKeyIdMap();var o=s.length;m.CDMCleanupPromise=Promise.all(s.map(function(l){return e.removeSession(l)}).concat(r==null?void 0:r.setMediaKeys(null).catch(function(l){e.log("Could not clear media keys: "+l+". media.src: "+(r==null?void 0:r.src))}))).then(function(){o&&(e.log("finished closing key sessions and clearing media keys"),s.length=0)}).catch(function(l){e.log("Could not close sessions and clear media keys: "+l+". media.src: "+(r==null?void 0:r.src))})},c.onManifestLoaded=function(e,r){var s=r.sessionKeys;if(s&&this.config.emeEnabled&&!this.keyFormatPromise){var o=s.reduce(function(l,n){return l.indexOf(n.keyFormat)===-1&&l.push(n.keyFormat),l},[]);this.log("Selecting key-system from session-keys "+o.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(o)}},c.removeSession=function(e){var r=this,s=e.mediaKeysSession,o=e.licenseXhr;if(s){this.log("Remove licenses and keys and close session "+s.sessionId),s.onmessage=null,s.onkeystatuseschange=null,o&&o.readyState!==XMLHttpRequest.DONE&&o.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var l=this.mediaKeySessions.indexOf(e);return l>-1&&this.mediaKeySessions.splice(l,1),s.remove().catch(function(n){r.log("Could not remove session: "+n)}).then(function(){return s.close()}).catch(function(n){r.log("Could not close session: "+n)})}},m}();qd.CDMCleanupPromise=void 0;var ui=function(m){var c,e;function r(s,o){var l;return(l=m.call(this,o)||this).data=void 0,l.data=s,s.err=s.error,l}return e=m,(c=r).prototype=Object.create(e.prototype),c.prototype.constructor=c,Vn(c,e),r}(Pl(Error));let hm=qd;var Or,Fl,Yd;function $d(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}function zd(m,c,e){return c&&$d(m.prototype,c),e&&$d(m,e),Object.defineProperty(m,"prototype",{writable:!1}),m}function Qd(m,c){var e=typeof Symbol!="undefined"&&m[Symbol.iterator]||m["@@iterator"];if(e)return(e=e.call(m)).next.bind(e);if(Array.isArray(m)||(e=function(s,o){if(s){if(typeof s=="string")return Xd(s,o);var l=Object.prototype.toString.call(s).slice(8,-1);return l==="Object"&&s.constructor&&(l=s.constructor.name),l==="Map"||l==="Set"?Array.from(s):l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?Xd(s,o):void 0}}(m))||c&&m&&typeof m.length=="number"){e&&(m=e);var r=0;return function(){return r>=m.length?{done:!0}:{done:!1,value:m[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
32
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xd(m,c){(c==null||c>m.length)&&(c=m.length);for(var e=0,r=new Array(c);e<c;e++)r[e]=m[e];return r}function to(){return to=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(m[r]=e[r])}return m},to.apply(this,arguments)}(function(m){m.MANIFEST="m",m.AUDIO="a",m.VIDEO="v",m.MUXED="av",m.INIT="i",m.CAPTION="c",m.TIMED_TEXT="tt",m.KEY="k",m.OTHER="o"})(Or||(Or={})),function(m){m.DASH="d",m.HLS="h",m.SMOOTH="s",m.OTHER="o"}(Fl||(Fl={})),function(m){m.VOD="v",m.LIVE="l"}(Yd||(Yd={}));var fm=function(){function m(e){var r=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(l){try{r.apply(l,{ot:Or.MANIFEST,su:!r.initialized})}catch(n){O.logger.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=function(l){try{var n=l.frag,u=r.hls.levels[n.level],h=r.getObjectType(n),f={d:1e3*n.duration,ot:h};h!==Or.VIDEO&&h!==Or.AUDIO&&h!=Or.MUXED||(f.br=u.bitrate/1e3,f.tb=r.getTopBandwidth(h)/1e3,f.bl=r.getBufferLength(h)),r.apply(l,f)}catch(p){O.logger.warn("Could not generate segment CMCD data.",p)}},this.hls=e;var s=this.config=e.config,o=s.cmcd;o!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=o.sessionId||m.uuid(),this.cid=o.contentId,this.useHeaders=o.useHeaders===!0,this.registerListeners())}var c=m.prototype;return c.registerListeners=function(){var e=this.hls;e.on(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(y.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(y.Events.BUFFER_CREATED,this.onBufferCreated,this)},c.unregisterListeners=function(){var e=this.hls;e.off(y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(y.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},c.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},c.onMediaAttached=function(e,r){this.media=r.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},c.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},c.onBufferCreated=function(e,r){var s,o;this.audioBuffer=(s=r.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(o=r.tracks.video)===null||o===void 0?void 0:o.buffer},c.createData=function(){var e;return{v:1,sf:Fl.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},c.apply=function(e,r){r===void 0&&(r={}),to(r,this.createData());var s=r.ot===Or.INIT||r.ot===Or.VIDEO||r.ot===Or.MUXED;if(this.starved&&s&&(r.bs=!0,r.su=!0,this.starved=!1),r.su==null&&(r.su=this.buffering),this.useHeaders){var o=m.toHeaders(r);if(!Object.keys(o).length)return;e.headers||(e.headers={}),to(e.headers,o)}else{var l=m.toQuery(r);if(!l)return;e.url=m.appendQueryToUri(e.url,l)}},c.getObjectType=function(e){var r=e.type;return r==="subtitle"?Or.TIMED_TEXT:e.sn==="initSegment"?Or.INIT:r==="audio"?Or.AUDIO:r==="main"?this.hls.audioTracks.length?Or.VIDEO:Or.MUXED:void 0},c.getTopBandwidth=function(e){var r,s=0,o=this.hls;if(e===Or.AUDIO)r=o.audioTracks;else{var l=o.maxAutoLevel,n=l>-1?l+1:o.levels.length;r=o.levels.slice(0,n)}for(var u,h=Qd(r);!(u=h()).done;){var f=u.value;f.bitrate>s&&(s=f.bitrate)}return s>0?s:NaN},c.getBufferLength=function(e){var r=this.hls.media,s=e===Or.AUDIO?this.audioBuffer:this.videoBuffer;return s&&r?1e3*$t.bufferInfo(s,r.currentTime,this.config.maxBufferHole).len:NaN},c.createPlaylistLoader=function(){var e=this.config.pLoader,r=this.applyPlaylistData,s=e||this.config.loader;return function(){function o(n){this.loader=void 0,this.loader=new s(n)}var l=o.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(n,u,h){r(n),this.loader.load(n,u,h)},zd(o,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),o}()},c.createFragmentLoader=function(){var e=this.config.fLoader,r=this.applyFragmentData,s=e||this.config.loader;return function(){function o(n){this.loader=void 0,this.loader=new s(n)}var l=o.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(n,u,h){r(n),this.loader.load(n,u,h)},zd(o,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),o}()},m.uuid=function(){var e=URL.createObjectURL(new Blob),r=e.toString();return URL.revokeObjectURL(e),r.slice(r.lastIndexOf("/")+1)},m.serialize=function(e){for(var r,s=[],o=function(x){return!Number.isNaN(x)&&x!=null&&x!==""&&x!==!1},l=function(x){return Math.round(x)},n=function(x){return 100*l(x/100)},u={br:l,d:l,bl:n,dl:n,mtp:n,nor:function(x){return encodeURIComponent(x)},rtp:n,tb:l},h=Qd(Object.keys(e||{}).sort());!(r=h()).done;){var f=r.value,p=e[f];if(o(p)&&!(f==="v"&&p===1||f=="pr"&&p===1)){var _=u[f];_&&(p=_(p));var S,C=typeof p;S=f==="ot"||f==="sf"||f==="st"?f+"="+p:C==="boolean"?f:C==="number"?f+"="+p:f+"="+JSON.stringify(p),s.push(S)}}return s.join(",")},m.toHeaders=function(e){for(var r={},s=["Object","Request","Session","Status"],o=[{},{},{},{}],l={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},n=0,u=Object.keys(e);n<u.length;n++){var h=u[n];o[l[h]!=null?l[h]:1][h]=e[h]}for(var f=0;f<o.length;f++){var p=m.serialize(o[f]);p&&(r["CMCD-"+s[f]]=p)}return r},m.toQuery=function(e){return"CMCD="+encodeURIComponent(m.serialize(e))},m.appendQueryToUri=function(e,r){if(!r)return e;var s=e.includes("?")?"&":"?";return""+e+s+r},m}(),Zd=b(408),mm=/^age:\s*[\d.]+\s*$/m;let Jd=function(){function m(e){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=e?e.xhrSetup:null,this.stats=new Zd.LoadStats,this.retryDelay=0}var c=m.prototype;return c.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},c.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))},c.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},c.load=function(e,r,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=r,this.callbacks=s,this.retryDelay=r.retryDelay,this.loadInternal()},c.loadInternal=function(){var e=this.config,r=this.context;if(e){var s=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0;var l=this.xhrSetup;try{if(l)try{l(s,r.url)}catch{s.open("GET",r.url,!0),l(s,r.url)}s.readyState||s.open("GET",r.url,!0);var n=this.context.headers;if(n)for(var u in n)s.setRequestHeader(u,n[u])}catch(h){return void this.callbacks.onError({code:s.status,text:h.message},r,s)}r.rangeEnd&&s.setRequestHeader("Range","bytes="+r.rangeStart+"-"+(r.rangeEnd-1)),s.onreadystatechange=this.readystatechange.bind(this),s.onprogress=this.loadprogress.bind(this),s.responseType=r.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),s.send()}},c.readystatechange=function(){var e=this.context,r=this.loader,s=this.stats;if(e&&r){var o=r.readyState,l=this.config;if(!s.aborted&&o>=2)if(self.clearTimeout(this.requestTimeout),s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start)),o===4){r.onreadystatechange=null,r.onprogress=null;var n=r.status,u=r.responseType==="arraybuffer";if(n>=200&&n<300&&(u&&r.response||r.responseText!==null)){var h,f;if(s.loading.end=Math.max(self.performance.now(),s.loading.first),f=u?(h=r.response).byteLength:(h=r.responseText).length,s.loaded=s.total=f,!this.callbacks)return;var p=this.callbacks.onProgress;if(p&&p(s,e,h,r),!this.callbacks)return;var _={url:r.responseURL,data:h};this.callbacks.onSuccess(_,s,e,r)}else s.retry>=l.maxRetry||n>=400&&n<499?(O.logger.error(n+" while loading "+e.url),this.callbacks.onError({code:n,text:r.statusText},e,r)):(O.logger.warn(n+" while loading "+e.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,l.maxRetryDelay),s.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),l.timeout)}},c.loadtimeout=function(){O.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},c.loadprogress=function(e){var r=this.stats;r.loaded=e.loaded,e.lengthComputable&&(r.total=e.total)},c.getCacheAge=function(){var e=null;if(this.loader&&mm.test(this.loader.getAllResponseHeaders())){var r=this.loader.getResponseHeader("age");e=r?parseFloat(r):null}return e},m}();function Bl(m){var c=typeof Map=="function"?new Map:void 0;return Bl=function(e){if(e===null||(r=e,Function.toString.call(r).indexOf("[native code]")===-1))return e;var r;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(c!==void 0){if(c.has(e))return c.get(e);c.set(e,s)}function s(){return Hl(e,arguments,Kl(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),Wn(s,e)},Bl(m)}function Hl(m,c,e){return Hl=pm()?Reflect.construct.bind():function(r,s,o){var l=[null];l.push.apply(l,s);var n=new(Function.bind.apply(r,l));return o&&Wn(n,o.prototype),n},Hl.apply(null,arguments)}function pm(){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 Wn(m,c){return Wn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Wn(m,c)}function Kl(m){return Kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(c){return c.__proto__||Object.getPrototypeOf(c)},Kl(m)}function Gl(){return Gl=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(m[r]=e[r])}return m},Gl.apply(this,arguments)}var vm=function(){function m(e){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=e.fetchSetup||gm,this.controller=new self.AbortController,this.stats=new Zd.LoadStats}var c=m.prototype;return c.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},c.abortInternal=function(){var e=this.response;e&&e.ok||(this.stats.aborted=!0,this.controller.abort())},c.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},c.load=function(e,r,s){var o=this,l=this.stats;if(l.loading.start)throw new Error("Loader can only be used once.");l.loading.start=self.performance.now();var n=function(p,_){var S={method:"GET",mode:"cors",credentials:"same-origin",signal:_,headers:new self.Headers(Gl({},p.headers))};return p.rangeEnd&&S.headers.set("Range","bytes="+p.rangeStart+"-"+String(p.rangeEnd-1)),S}(e,this.controller.signal),u=s.onProgress,h=e.responseType==="arraybuffer",f=h?"byteLength":"length";this.context=e,this.config=r,this.callbacks=s,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){o.abortInternal(),s.onTimeout(l,e,o.response)},r.timeout),self.fetch(this.request).then(function(p){if(o.response=o.loader=p,!p.ok){var _=p.status,S=p.statusText;throw new Em(S||"fetch, bad network response",_,p)}return l.loading.first=Math.max(self.performance.now(),l.loading.start),l.total=parseInt(p.headers.get("Content-Length")||"0"),u&&(0,R.isFiniteNumber)(r.highWaterMark)?o.loadProgressively(p,l,e,r.highWaterMark,u):h?p.arrayBuffer():p.text()}).then(function(p){var _=o.response;self.clearTimeout(o.requestTimeout),l.loading.end=Math.max(self.performance.now(),l.loading.first);var S=p[f];S&&(l.loaded=l.total=S);var C={url:_.url,data:p};u&&!(0,R.isFiniteNumber)(r.highWaterMark)&&u(l,e,p,_),s.onSuccess(C,l,e,_)}).catch(function(p){if(self.clearTimeout(o.requestTimeout),!l.aborted){var _=p&&p.code||0,S=p?p.message:null;s.onError({code:_,text:S},e,p?p.details:null)}})},c.getCacheAge=function(){var e=null;if(this.response){var r=this.response.headers.get("age");e=r?parseFloat(r):null}return e},c.loadProgressively=function(e,r,s,o,l){o===void 0&&(o=0);var n=new Qs,u=e.body.getReader();return function h(){return u.read().then(function(f){if(f.done)return n.dataLength&&l(r,s,n.flush(),e),Promise.resolve(new ArrayBuffer(0));var p=f.value,_=p.length;return r.loaded+=_,_<o||n.dataLength?(n.push(p),n.dataLength>=o&&l(r,s,n.flush(),e)):l(r,s,p,e),h()}).catch(function(){return Promise.reject()})}()},m}();function gm(m,c){return new self.Request(m.url,c)}var Em=function(m){var c,e;function r(s,o,l){var n;return(n=m.call(this,s)||this).code=void 0,n.details=void 0,n.code=o,n.details=l,n}return e=m,(c=r).prototype=Object.create(e.prototype),c.prototype.constructor=c,Wn(c,e),r}(Bl(Error));let ec=vm;var ym=/\s/;function Vl(){return Vl=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(m[r]=e[r])}return m},Vl.apply(this,arguments)}function tc(m,c){var e=Object.keys(m);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);c&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(m,s).enumerable})),e.push.apply(e,r)}return e}function rc(m){for(var c=1;c<arguments.length;c++){var e=arguments[c]!=null?arguments[c]:{};c%2?tc(Object(e),!0).forEach(function(r){bm(m,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(e)):tc(Object(e)).forEach(function(r){Object.defineProperty(m,r,Object.getOwnPropertyDescriptor(e,r))})}return m}function bm(m,c,e){return(c=function(r){var s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r,"string");return typeof s=="symbol"?s:String(s)}(c))in m?Object.defineProperty(m,c,{value:e,enumerable:!0,configurable:!0,writable:!0}):m[c]=e,m}var Tm=rc(rc({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,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:Jd,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Sl,bufferController:Cl,capLevelController:um,fpsController:dm,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,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:_e,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0},{cueHandler:{newCue:function(m,c,e,r){for(var s,o,l,n,u,h=[],f=self.VTTCue||self.TextTrackCue,p=0;p<r.rows.length;p++)if(l=!0,n=0,u="",!(s=r.rows[p]).isEmpty()){for(var _=0;_<s.chars.length;_++)ym.test(s.chars[_].uchar)&&l?n++:(u+=s.chars[_].uchar,l=!1);s.cueStartTime=c,c===e&&(e+=1e-4),n>=16?n--:n++;var S=ar(u.trim()),C=xr(c,e,S);m&&m.cues&&m.cues.getCueById(C)||((o=new f(c,e,S)).id=C,o.line=p+1,o.align="left",o.position=10+Math.min(80,10*Math.floor(8*n/32)),h.push(o))}return m&&h.length&&(h.sort(function(x,W){return x.line==="auto"||W.line==="auto"?0:x.line>8&&W.line>8?W.line-x.line:x.line-W.line}),h.forEach(function(x){return _t(m,x)})),h}},enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:Il,subtitleTrackController:Rl,timelineController:sm,audioStreamController:Bn,audioTrackController:kl,emeController:hm,cmcdController:fm});function ic(m,c){for(var e=0;e<c.length;e++){var r=c[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(r.key,"string"))=="symbol"?s:String(s),r)}var s}var ac=function(){function m(o){o===void 0&&(o={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Pn.EventEmitter,this._autoLevelCapping=void 0,this._maxHdcpLevel=null,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 l=this.config=function(Ie,je){if((je.liveSyncDurationCount||je.liveMaxLatencyDurationCount)&&(je.liveSyncDuration||je.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(je.liveMaxLatencyDurationCount!==void 0&&(je.liveSyncDurationCount===void 0||je.liveMaxLatencyDurationCount<=je.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(je.liveMaxLatencyDuration!==void 0&&(je.liveSyncDuration===void 0||je.liveMaxLatencyDuration<=je.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return Vl({},Ie,je)}(m.DefaultConfig,o);this.userConfig=o,(0,O.enableLogs)(l.debug,"Hls instance"),this._autoLevelCapping=-1,l.progressive&&function(Ie){var je=Ie.loader;je!==ec&&je!==Jd?(O.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),Ie.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(Ie.loader=ec,Ie.progressive=!0,Ie.enableSoftwareAES=!0,O.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}(l);var n=l.abrController,u=l.bufferController,h=l.capLevelController,f=l.fpsController,p=this.abrController=new n(this),_=this.bufferController=new u(this),S=this.capLevelController=new h(this),C=new f(this),x=new $e(this),W=new Ut(this),K=this.levelController=new Et(this),ee=new Ot(this),me=new Vr(this.config),we=this.streamController=new Tl(this,ee,me);S.setStreamController(we),C.setStreamController(we);var ye=[x,K,we];this.networkControllers=ye;var De=[p,_,S,C,W,ee];this.audioTrackController=this.createController(l.audioTrackController,ye);var qe=l.audioStreamController;qe&&ye.push(new qe(this,ee,me)),this.subtitleTrackController=this.createController(l.subtitleTrackController,ye);var it=l.subtitleStreamController;it&&ye.push(new it(this,ee,me)),this.createController(l.timelineController,De),me.emeController=this.emeController=this.createController(l.emeController,De),this.cmcdController=this.createController(l.cmcdController,De),this.latencyController=this.createController(ir,De),this.coreComponents=De}m.isSupported=function(){return function(){var o=Xa();if(!o)return!1;var l=Za(),n=o&&typeof o.isTypeSupported=="function"&&o.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),u=!l||l.prototype&&typeof l.prototype.appendBuffer=="function"&&typeof l.prototype.remove=="function";return!!n&&!!u}()};var c,e,r,s=m.prototype;return s.createController=function(o,l){if(o){var n=new o(this);return l&&l.push(n),n}return null},s.on=function(o,l,n){n===void 0&&(n=this),this._emitter.on(o,l,n)},s.once=function(o,l,n){n===void 0&&(n=this),this._emitter.once(o,l,n)},s.removeAllListeners=function(o){this._emitter.removeAllListeners(o)},s.off=function(o,l,n,u){n===void 0&&(n=this),this._emitter.off(o,l,n,u)},s.listeners=function(o){return this._emitter.listeners(o)},s.emit=function(o,l,n){return this._emitter.emit(o,l,n)},s.trigger=function(o,l){if(this.config.debug)return this.emit(o,o,l);try{return this.emit(o,o,l)}catch(n){O.logger.error("An internal error happened while handling event "+o+'. Error message: "'+n.message+'". Here is a stacktrace:',n),this.trigger(y.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:o,error:n})}return!1},s.listenerCount=function(o){return this._emitter.listenerCount(o)},s.destroy=function(){O.logger.log("destroy"),this.trigger(y.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(o){return o.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(o){return o.destroy()}),this.coreComponents.length=0},s.attachMedia=function(o){O.logger.log("attachMedia"),this._media=o,this.trigger(y.Events.MEDIA_ATTACHING,{media:o})},s.detachMedia=function(){O.logger.log("detachMedia"),this.trigger(y.Events.MEDIA_DETACHING,void 0),this._media=null},s.loadSource=function(o){this.stopLoad();var l=this.media,n=this.url,u=this.url=M.buildAbsoluteURL(self.location.href,o,{alwaysNormalize:!0});O.logger.log("loadSource:"+u),l&&n&&n!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(l)),this.trigger(y.Events.MANIFEST_LOADING,{url:o})},s.startLoad=function(o){o===void 0&&(o=-1),O.logger.log("startLoad("+o+")"),this.networkControllers.forEach(function(l){l.startLoad(o)})},s.stopLoad=function(){O.logger.log("stopLoad"),this.networkControllers.forEach(function(o){o.stopLoad()})},s.swapAudioCodec=function(){O.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},s.recoverMediaError=function(){O.logger.log("recoverMediaError");var o=this._media;this.detachMedia(),o&&this.attachMedia(o)},s.removeLevel=function(o,l){l===void 0&&(l=0),this.levelController.removeLevel(o,l)},c=m,r=[{key:"version",get:function(){return"1.3.1"}},{key:"Events",get:function(){return y.Events}},{key:"ErrorTypes",get:function(){return P.ErrorTypes}},{key:"ErrorDetails",get:function(){return P.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:Tm},set:function(o){m.defaultConfig=o}}],(e=[{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(o){O.logger.log("set currentLevel:"+o),this.loadLevel=o,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(o){O.logger.log("set nextLevel:"+o),this.levelController.manualLevel=o,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(o){O.logger.log("set loadLevel:"+o),this.levelController.manualLevel=o}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(o){this.levelController.nextLoadLevel=o}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(o){O.logger.log("set firstLevel:"+o),this.levelController.firstLevel=o}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(o){O.logger.log("set startLevel:"+o),o!==-1&&(o=Math.max(o,this.minAutoLevel)),this.levelController.startLevel=o}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(o){var l=!!o;l!==this.config.capLevelToPlayerSize&&(l?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=l)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(o){this._autoLevelCapping!==o&&(O.logger.log("set autoLevelCapping:"+o),this._autoLevelCapping=o)}},{key:"bandwidthEstimate",get:function(){var o=this.abrController.bwEstimator;return o?o.getEstimate():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(o){Fr.indexOf(o)>-1&&(this._maxHdcpLevel=o)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var o=this.levels,l=this.config.minAutoBitrate;if(!o)return 0;for(var n=o.length,u=0;u<n;u++)if(o[u].maxBitrate>=l)return u;return 0}},{key:"maxAutoLevel",get:function(){var o,l=this.levels,n=this.autoLevelCapping,u=this.maxHdcpLevel;if(o=n===-1&&l&&l.length?l.length-1:n,u)for(var h=o;h--;){var f=l[h].attrs["HDCP-LEVEL"];if(f&&f<=u)return h}return o}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(o){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,o)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var o=this.audioTrackController;return o?o.audioTracks:[]}},{key:"audioTrack",get:function(){var o=this.audioTrackController;return o?o.audioTrack:-1},set:function(o){var l=this.audioTrackController;l&&(l.audioTrack=o)}},{key:"subtitleTracks",get:function(){var o=this.subtitleTrackController;return o?o.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var o=this.subtitleTrackController;return o?o.subtitleTrack:-1},set:function(o){var l=this.subtitleTrackController;l&&(l.subtitleTrack=o)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var o=this.subtitleTrackController;return!!o&&o.subtitleDisplay},set:function(o){var l=this.subtitleTrackController;l&&(l.subtitleDisplay=o)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(o){this.config.lowLatencyMode=o}},{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}}])&&ic(c.prototype,e),r&&ic(c,r),Object.defineProperty(c,"prototype",{writable:!1}),m}();ac.defaultConfig=void 0},923:(v,g,b)=>{"use strict";b.r(g),b.d(g,{BaseSegment:()=>de,ElementaryStreamTypes:()=>L,Fragment:()=>he,Part:()=>Y});var L,M=b(965),R=b(945),y=b(408);function P(pe,X){pe.prototype=Object.create(X.prototype),pe.prototype.constructor=pe,O(pe,X)}function O(pe,X){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(oe,z){return oe.__proto__=z,oe},O(pe,X)}function ue(pe,X){for(var oe=0;oe<X.length;oe++){var z=X[oe];z.enumerable=z.enumerable||!1,z.configurable=!0,"value"in z&&(z.writable=!0),Object.defineProperty(pe,typeof(be=function(ke,He){if(typeof ke!="object"||ke===null)return ke;var Z=ke[Symbol.toPrimitive];if(Z!==void 0){var w=Z.call(ke,He);if(typeof w!="object")return w;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(ke)}(z.key,"string"))=="symbol"?be:String(be),z)}var be}function Q(pe,X,oe){return X&&ue(pe.prototype,X),oe&&ue(pe,oe),Object.defineProperty(pe,"prototype",{writable:!1}),pe}(function(pe){pe.AUDIO="audio",pe.VIDEO="video",pe.AUDIOVIDEO="audiovideo"})(L||(L={}));var de=function(){function pe(X){var oe;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((oe={})[L.AUDIO]=null,oe[L.VIDEO]=null,oe[L.AUDIOVIDEO]=null,oe),this.baseurl=X}return pe.prototype.setByteRange=function(X,oe){var z=X.split("@",2),be=[];z.length===1?be[0]=oe?oe.byteRangeEndOffset:0:be[0]=parseInt(z[1]),be[1]=parseInt(z[0])+be[0],this._byteRange=be},Q(pe,[{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=(0,R.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(X){this._url=X}}]),pe}(),he=function(pe){function X(z,be){var ke;return(ke=pe.call(this,be)||this)._decryptdata=null,ke.rawProgramDateTime=null,ke.programDateTime=null,ke.tagList=[],ke.duration=0,ke.sn=0,ke.levelkeys=void 0,ke.type=void 0,ke.loader=null,ke.keyLoader=null,ke.level=-1,ke.cc=0,ke.startPTS=void 0,ke.endPTS=void 0,ke.appendedPTS=void 0,ke.startDTS=void 0,ke.endDTS=void 0,ke.start=0,ke.deltaPTS=void 0,ke.maxStartPTS=void 0,ke.minEndPTS=void 0,ke.stats=new y.LoadStats,ke.urlId=0,ke.data=void 0,ke.bitrateTest=!1,ke.title=null,ke.initSegment=null,ke.endList=void 0,ke.type=z,ke}P(X,pe);var oe=X.prototype;return oe.setKeyFormat=function(z){if(this.levelkeys){var be=this.levelkeys[z];be&&!this._decryptdata&&(this._decryptdata=be.getDecryptData(this.sn))}},oe.abortRequests=function(){var z,be;(z=this.loader)===null||z===void 0||z.abort(),(be=this.keyLoader)===null||be===void 0||be.abort()},oe.setElementaryStreamInfo=function(z,be,ke,He,Z,w){w===void 0&&(w=!1);var q=this.elementaryStreams,N=q[z];N?(N.startPTS=Math.min(N.startPTS,be),N.endPTS=Math.max(N.endPTS,ke),N.startDTS=Math.min(N.startDTS,He),N.endDTS=Math.max(N.endDTS,Z)):q[z]={startPTS:be,endPTS:ke,startDTS:He,endDTS:Z,partial:w}},oe.clearElementaryStreamInfo=function(){var z=this.elementaryStreams;z[L.AUDIO]=null,z[L.VIDEO]=null,z[L.AUDIOVIDEO]=null},Q(X,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var z=this.levelkeys.identity;if(z)this._decryptdata=z.getDecryptData(this.sn);else{var be=Object.keys(this.levelkeys);if(be.length===1)return this._decryptdata=this.levelkeys[be[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!(0,M.isFiniteNumber)(this.programDateTime))return null;var z=(0,M.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*z}},{key:"encrypted",get:function(){var z;if((z=this._decryptdata)!==null&&z!==void 0&&z.encrypted)return!0;if(this.levelkeys){var be=Object.keys(this.levelkeys),ke=be.length;if(ke>1||ke===1&&this.levelkeys[be[0]].encrypted)return!0}return!1}}]),X}(de),Y=function(pe){function X(oe,z,be,ke,He){var Z;(Z=pe.call(this,be)||this).fragOffset=0,Z.duration=0,Z.gap=!1,Z.independent=!1,Z.relurl=void 0,Z.fragment=void 0,Z.index=void 0,Z.stats=new y.LoadStats,Z.duration=oe.decimalFloatingPoint("DURATION"),Z.gap=oe.bool("GAP"),Z.independent=oe.bool("INDEPENDENT"),Z.relurl=oe.enumeratedString("URI"),Z.fragment=z,Z.index=ke;var w=oe.enumeratedString("BYTERANGE");return w&&Z.setByteRange(w,He),He&&(Z.fragOffset=He.fragOffset+He.duration),Z}return P(X,pe),Q(X,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var oe=this.elementaryStreams;return!!(oe.audio||oe.video||oe.audiovideo)}}]),X}(de)},408:(v,g,b)=>{"use strict";b.r(g),b.d(g,{LoadStats:()=>L});var L=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}}},965:(v,g,b)=>{"use strict";b.r(g),b.d(g,{MAX_SAFE_INTEGER:()=>M,isFiniteNumber:()=>L});var L=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},M=Number.MAX_SAFE_INTEGER||9007199254740991},524:(v,g,b)=>{"use strict";b.r(g),b.d(g,{default:()=>oe,flushTextTrackMetadataCueSamples:()=>be,flushTextTrackUserdataCueSamples:()=>ke,normalizePts:()=>z});var L=b(965);let M=function(){function w(){}return w.getSilentFrame=function(q,N){if(q==="mp4a.40.2"){if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===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(N===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])}else{if(N===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(N===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(N===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])}},w}();var R=Math.pow(2,32)-1,y=function(){function w(){}return w.init=function(){var q;for(q in w.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:[]},w.types)w.types.hasOwnProperty(q)&&(w.types[q]=[q.charCodeAt(0),q.charCodeAt(1),q.charCodeAt(2),q.charCodeAt(3)]);var N=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]),fe=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]);w.HDLR_TYPES={video:N,audio:fe};var _e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),te=new Uint8Array([0,0,0,0,0,0,0,0]);w.STTS=w.STSC=w.STCO=te,w.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),w.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),w.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),w.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var re=new Uint8Array([105,115,111,109]),Re=new Uint8Array([97,118,99,49]),Pe=new Uint8Array([0,0,0,1]);w.FTYP=w.box(w.types.ftyp,re,Pe,re,Re),w.DINF=w.box(w.types.dinf,w.box(w.types.dref,_e))},w.box=function(q){for(var N=8,fe=arguments.length,_e=new Array(fe>1?fe-1:0),te=1;te<fe;te++)_e[te-1]=arguments[te];for(var re=_e.length,Re=re;re--;)N+=_e[re].byteLength;var Pe=new Uint8Array(N);for(Pe[0]=N>>24&255,Pe[1]=N>>16&255,Pe[2]=N>>8&255,Pe[3]=255&N,Pe.set(q,4),re=0,N=8;re<Re;re++)Pe.set(_e[re],N),N+=_e[re].byteLength;return Pe},w.hdlr=function(q){return w.box(w.types.hdlr,w.HDLR_TYPES[q])},w.mdat=function(q){return w.box(w.types.mdat,q)},w.mdhd=function(q,N){N*=q;var fe=Math.floor(N/(R+1)),_e=Math.floor(N%(R+1));return w.box(w.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,q>>24&255,q>>16&255,q>>8&255,255&q,fe>>24,fe>>16&255,fe>>8&255,255&fe,_e>>24,_e>>16&255,_e>>8&255,255&_e,85,196,0,0]))},w.mdia=function(q){return w.box(w.types.mdia,w.mdhd(q.timescale,q.duration),w.hdlr(q.type),w.minf(q))},w.mfhd=function(q){return w.box(w.types.mfhd,new Uint8Array([0,0,0,0,q>>24,q>>16&255,q>>8&255,255&q]))},w.minf=function(q){return q.type==="audio"?w.box(w.types.minf,w.box(w.types.smhd,w.SMHD),w.DINF,w.stbl(q)):w.box(w.types.minf,w.box(w.types.vmhd,w.VMHD),w.DINF,w.stbl(q))},w.moof=function(q,N,fe){return w.box(w.types.moof,w.mfhd(q),w.traf(fe,N))},w.moov=function(q){for(var N=q.length,fe=[];N--;)fe[N]=w.trak(q[N]);return w.box.apply(null,[w.types.moov,w.mvhd(q[0].timescale,q[0].duration)].concat(fe).concat(w.mvex(q)))},w.mvex=function(q){for(var N=q.length,fe=[];N--;)fe[N]=w.trex(q[N]);return w.box.apply(null,[w.types.mvex].concat(fe))},w.mvhd=function(q,N){N*=q;var fe=Math.floor(N/(R+1)),_e=Math.floor(N%(R+1)),te=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,q>>24&255,q>>16&255,q>>8&255,255&q,fe>>24,fe>>16&255,fe>>8&255,255&fe,_e>>24,_e>>16&255,_e>>8&255,255&_e,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 w.box(w.types.mvhd,te)},w.sdtp=function(q){var N,fe,_e=q.samples||[],te=new Uint8Array(4+_e.length);for(N=0;N<_e.length;N++)fe=_e[N].flags,te[N+4]=fe.dependsOn<<4|fe.isDependedOn<<2|fe.hasRedundancy;return w.box(w.types.sdtp,te)},w.stbl=function(q){return w.box(w.types.stbl,w.stsd(q),w.box(w.types.stts,w.STTS),w.box(w.types.stsc,w.STSC),w.box(w.types.stsz,w.STSZ),w.box(w.types.stco,w.STCO))},w.avc1=function(q){var N,fe,_e,te=[],re=[];for(N=0;N<q.sps.length;N++)_e=(fe=q.sps[N]).byteLength,te.push(_e>>>8&255),te.push(255&_e),te=te.concat(Array.prototype.slice.call(fe));for(N=0;N<q.pps.length;N++)_e=(fe=q.pps[N]).byteLength,re.push(_e>>>8&255),re.push(255&_e),re=re.concat(Array.prototype.slice.call(fe));var Re=w.box(w.types.avcC,new Uint8Array([1,te[3],te[4],te[5],255,224|q.sps.length].concat(te).concat([q.pps.length]).concat(re))),Pe=q.width,Fe=q.height,Se=q.pixelRatio[0],Ye=q.pixelRatio[1];return w.box(w.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,Pe>>8&255,255&Pe,Fe>>8&255,255&Fe,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]),Re,w.box(w.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),w.box(w.types.pasp,new Uint8Array([Se>>24,Se>>16&255,Se>>8&255,255&Se,Ye>>24,Ye>>16&255,Ye>>8&255,255&Ye])))},w.esds=function(q){var N=q.config.length;return new Uint8Array([0,0,0,0,3,23+N,0,1,0,4,15+N,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([N]).concat(q.config).concat([6,1,2]))},w.mp4a=function(q){var N=q.samplerate;return w.box(w.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,q.channelCount,0,16,0,0,0,0,N>>8&255,255&N,0,0]),w.box(w.types.esds,w.esds(q)))},w.mp3=function(q){var N=q.samplerate;return w.box(w.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,q.channelCount,0,16,0,0,0,0,N>>8&255,255&N,0,0]))},w.stsd=function(q){return q.type==="audio"?q.segmentCodec==="mp3"&&q.codec==="mp3"?w.box(w.types.stsd,w.STSD,w.mp3(q)):w.box(w.types.stsd,w.STSD,w.mp4a(q)):w.box(w.types.stsd,w.STSD,w.avc1(q))},w.tkhd=function(q){var N=q.id,fe=q.duration*q.timescale,_e=q.width,te=q.height,re=Math.floor(fe/(R+1)),Re=Math.floor(fe%(R+1));return w.box(w.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,255&N,0,0,0,0,re>>24,re>>16&255,re>>8&255,255&re,Re>>24,Re>>16&255,Re>>8&255,255&Re,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,_e>>8&255,255&_e,0,0,te>>8&255,255&te,0,0]))},w.traf=function(q,N){var fe=w.sdtp(q),_e=q.id,te=Math.floor(N/(R+1)),re=Math.floor(N%(R+1));return w.box(w.types.traf,w.box(w.types.tfhd,new Uint8Array([0,0,0,0,_e>>24,_e>>16&255,_e>>8&255,255&_e])),w.box(w.types.tfdt,new Uint8Array([1,0,0,0,te>>24,te>>16&255,te>>8&255,255&te,re>>24,re>>16&255,re>>8&255,255&re])),w.trun(q,fe.length+16+20+8+16+8+8),fe)},w.trak=function(q){return q.duration=q.duration||4294967295,w.box(w.types.trak,w.tkhd(q),w.mdia(q))},w.trex=function(q){var N=q.id;return w.box(w.types.trex,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,255&N,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},w.trun=function(q,N){var fe,_e,te,re,Re,Pe,Fe=q.samples||[],Se=Fe.length,Ye=12+16*Se,ot=new Uint8Array(Ye);for(N+=8+Ye,ot.set([q.type==="video"?1:0,0,15,1,Se>>>24&255,Se>>>16&255,Se>>>8&255,255&Se,N>>>24&255,N>>>16&255,N>>>8&255,255&N],0),fe=0;fe<Se;fe++)te=(_e=Fe[fe]).duration,re=_e.size,Re=_e.flags,Pe=_e.cts,ot.set([te>>>24&255,te>>>16&255,te>>>8&255,255&te,re>>>24&255,re>>>16&255,re>>>8&255,255&re,Re.isLeading<<2|Re.dependsOn,Re.isDependedOn<<6|Re.hasRedundancy<<4|Re.paddingValue<<1|Re.isNonSync,61440&Re.degradPrio,15&Re.degradPrio,Pe>>>24&255,Pe>>>16&255,Pe>>>8&255,255&Pe],12+16*fe);return w.box(w.types.trun,ot)},w.initSegment=function(q){w.types||w.init();var N=w.moov(q),fe=new Uint8Array(w.FTYP.byteLength+N.byteLength);return fe.set(w.FTYP),fe.set(N,w.FTYP.byteLength),fe},w}();y.types=void 0,y.HDLR_TYPES=void 0,y.STTS=void 0,y.STSC=void 0,y.STCO=void 0,y.STSZ=void 0,y.VMHD=void 0,y.SMHD=void 0,y.STSD=void 0,y.FTYP=void 0,y.DINF=void 0;let P=y;var O=b(851),ue=b(973),Q=b(93),de=b(308),he=b(673);function Y(){return Y=Object.assign?Object.assign.bind():function(w){for(var q=1;q<arguments.length;q++){var N=arguments[q];for(var fe in N)Object.prototype.hasOwnProperty.call(N,fe)&&(w[fe]=N[fe])}return w},Y.apply(this,arguments)}var pe=null,X=null,oe=function(){function w(N,fe,_e,te){if(te===void 0&&(te=""),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=fe,this.typeSupported=_e,this.ISGenerated=!1,pe===null){var re=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);pe=re?parseInt(re[1]):0}if(X===null){var Re=navigator.userAgent.match(/Safari\/(\d+)/i);X=Re?parseInt(Re[1]):0}}var q=w.prototype;return q.destroy=function(){},q.resetTimeStamp=function(N){Q.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=N},q.resetNextTimestamp=function(){Q.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},q.resetInitSegment=function(){Q.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},q.getVideoStartPts=function(N){var fe=!1,_e=N.reduce(function(te,re){var Re=re.pts-te;return Re<-4294967296?(fe=!0,z(te,re.pts)):Re>0?te:re.pts},N[0].pts);return fe&&Q.logger.debug("PTS rollover detected"),_e},q.remux=function(N,fe,_e,te,re,Re,Pe,Fe){var Se,Ye,ot,le,Ee,U,ve=re,Le=re,Ne=N.pid>-1,Ue=fe.pid>-1,Ge=fe.samples.length,Te=N.samples.length>0,xe=Pe&&Ge>0||Ge>1;if((!Ne||Te)&&(!Ue||xe)||this.ISGenerated||Pe){this.ISGenerated||(ot=this.generateIS(N,fe,re));var $e,rt=this.isVideoContiguous,_t=-1;if(xe&&(_t=function(Rt){for(var At=0;At<Rt.length;At++)if(Rt[At].key)return At;return-1}(fe.samples),!rt&&this.config.forceKeyFrameOnDiscontinuity))if(U=!0,_t>0){Q.logger.warn("[mp4-remuxer]: Dropped "+_t+" out of "+Ge+" video samples due to a missing keyframe");var gt=this.getVideoStartPts(fe.samples);fe.samples=fe.samples.slice(_t),fe.dropped+=_t,$e=Le+=(fe.samples[0].pts-gt)/fe.inputTimeScale}else _t===-1&&(Q.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ge+" video samples"),U=!1);if(this.ISGenerated){if(Te&&xe){var Lt=this.getVideoStartPts(fe.samples),lt=(z(N.samples[0].pts,Lt)-Lt)/fe.inputTimeScale;ve+=Math.max(0,lt),Le+=Math.max(0,-lt)}if(Te){if(N.samplerate||(Q.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),ot=this.generateIS(N,fe,re)),Ye=this.remuxAudio(N,ve,this.isAudioContiguous,Re,Ue||xe||Fe===de.PlaylistLevelType.AUDIO?Le:void 0),xe){var wt=Ye?Ye.endPTS-Ye.startPTS:0;fe.inputTimeScale||(Q.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),ot=this.generateIS(N,fe,re)),Se=this.remuxVideo(fe,Le,rt,wt)}}else xe&&(Se=this.remuxVideo(fe,Le,rt,0));Se&&(Se.firstKeyFrame=_t,Se.independent=_t!==-1,Se.firstKeyFramePTS=$e)}}return this.ISGenerated&&(_e.samples.length&&(Ee=be(_e,re,this._initPTS,this._initDTS)),te.samples.length&&(le=ke(te,re,this._initPTS))),{audio:Ye,video:Se,initSegment:ot,independent:U,text:le,id3:Ee}},q.generateIS=function(N,fe,_e){var te,re,Re,Pe=N.samples,Fe=fe.samples,Se=this.typeSupported,Ye={},ot=!(0,L.isFiniteNumber)(this._initPTS),le="audio/mp4";if(ot&&(te=re=1/0),N.config&&Pe.length&&(N.timescale=N.samplerate,N.segmentCodec==="mp3"&&(Se.mpeg?(le="audio/mpeg",N.codec=""):Se.mp3&&(N.codec="mp3")),Ye.audio={id:"audio",container:le,codec:N.codec,initSegment:N.segmentCodec==="mp3"&&Se.mpeg?new Uint8Array(0):P.initSegment([N]),metadata:{channelCount:N.channelCount}},ot&&(Re=N.inputTimeScale,te=re=Pe[0].pts-Math.round(Re*_e))),fe.sps&&fe.pps&&Fe.length&&(fe.timescale=fe.inputTimeScale,Ye.video={id:"main",container:"video/mp4",codec:fe.codec,initSegment:P.initSegment([fe]),metadata:{width:fe.width,height:fe.height}},ot)){Re=fe.inputTimeScale;var Ee=this.getVideoStartPts(Fe),U=Math.round(Re*_e);re=Math.min(re,z(Fe[0].dts,Ee)-U),te=Math.min(te,Ee-U)}if(Object.keys(Ye).length)return this.ISGenerated=!0,ot&&(this._initPTS=te,this._initDTS=re),{tracks:Ye,initPTS:te,timescale:Re}},q.remuxVideo=function(N,fe,_e,te){var re,Re,Pe=N.inputTimeScale,Fe=N.samples,Se=[],Ye=Fe.length,ot=this._initPTS,le=this.nextAvcDts,Ee=8,U=this.videoSampleDuration,ve=Number.POSITIVE_INFINITY,Le=Number.NEGATIVE_INFINITY,Ne=!1;_e&&le!==null||(le=fe*Pe-(Fe[0].pts-z(Fe[0].dts,Fe[0].pts)));for(var Ue=0;Ue<Ye;Ue++){var Ge=Fe[Ue];Ge.pts=z(Ge.pts-ot,le),Ge.dts=z(Ge.dts-ot,le),Ge.dts<Fe[Ue>0?Ue-1:Ue].dts&&(Ne=!0)}Ne&&Fe.sort(function(dr,Vr){var gi=dr.dts-Vr.dts,Br=dr.pts-Vr.pts;return gi||Br}),re=Fe[0].dts;var Te=Fe[Fe.length-1].dts-re,xe=Te?Math.round(Te/(Ye-1)):U||N.inputTimeScale/30;if(_e){var $e=re-le,rt=$e>xe,_t=$e<-1;if((rt||_t)&&(rt?Q.logger.warn("AVC: "+(0,he.toMsFromMpegTsClock)($e,!0)+" ms ("+$e+"dts) hole between fragments detected, filling it"):Q.logger.warn("AVC: "+(0,he.toMsFromMpegTsClock)(-$e,!0)+" ms ("+$e+"dts) overlapping between fragments detected"),!_t||le>Fe[0].pts)){re=le;var gt=Fe[0].pts-$e;Fe[0].dts=re,Fe[0].pts=gt,Q.logger.log("Video: First PTS/DTS adjusted: "+(0,he.toMsFromMpegTsClock)(gt,!0)+"/"+(0,he.toMsFromMpegTsClock)(re,!0)+", delta: "+(0,he.toMsFromMpegTsClock)($e,!0)+" ms")}}re=Math.max(0,re);for(var Lt=0,lt=0,wt=0;wt<Ye;wt++){for(var Rt=Fe[wt],At=Rt.units,pt=At.length,Ut=0,Vt=0;Vt<pt;Vt++)Ut+=At[Vt].data.length;lt+=Ut,Lt+=pt,Rt.length=Ut,Rt.dts=Math.max(Rt.dts,re),ve=Math.min(Rt.pts,ve),Le=Math.max(Rt.pts,Le)}Re=Fe[Ye-1].dts;var ir,vr=lt+4*Lt+8;try{ir=new Uint8Array(vr)}catch{return void this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:ue.ErrorTypes.MUX_ERROR,details:ue.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:vr,reason:"fail allocating video mdat "+vr})}var Qt=new DataView(ir.buffer);Qt.setUint32(0,vr),ir.set(P.types.mdat,4);for(var Fr=!1,se=Number.POSITIVE_INFINITY,j=Number.POSITIVE_INFINITY,I=Number.NEGATIVE_INFINITY,G=Number.NEGATIVE_INFINITY,H=0;H<Ye;H++){for(var $=Fe[H],ie=$.units,ae=0,Ae=0,Ce=ie.length;Ae<Ce;Ae++){var Oe=ie[Ae],Ke=Oe.data,Qe=Oe.data.byteLength;Qt.setUint32(Ee,Qe),Ee+=4,ir.set(Ke,Ee),Ee+=Qe,ae+=4+Qe}var We=void 0;if(H<Ye-1)U=Fe[H+1].dts-$.dts,We=Fe[H+1].pts-$.pts;else{var at=this.config,Et=H>0?$.dts-Fe[H-1].dts:xe;if(We=H>0?$.pts-Fe[H-1].pts:xe,at.stretchShortVideoTrack&&this.nextAudioPts!==null){var Ot=Math.floor(at.maxBufferHole*Pe),Ze=(te?ve+te*Pe:this.nextAudioPts)-$.pts;Ze>Ot?((U=Ze-Et)<0?U=Et:Fr=!0,Q.logger.log("[mp4-remuxer]: It is approximately "+Ze/90+" ms to the next segment; using duration "+U/90+" ms for the last video frame.")):U=Et}else U=Et}var Ht=Math.round($.pts-$.dts);se=Math.min(se,U),I=Math.max(I,U),j=Math.min(j,We),G=Math.max(G,We),Se.push(new He($.key,U,ae,Ht))}if(Se.length){if(pe){if(pe<70){var gr=Se[0].flags;gr.dependsOn=2,gr.isNonSync=0}}else if(X&&G-j<I-se&&xe/I<.025&&Se[0].cts===0){Q.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var Yt=re,jt=0,Xt=Se.length;jt<Xt;jt++){var ut=Yt+Se[jt].duration,Lr=Yt+Se[jt].cts;if(jt<Xt-1){var ti=ut+Se[jt+1].cts;Se[jt].duration=ti-Lr}else Se[jt].duration=jt?Se[jt-1].duration:xe;Se[jt].cts=0,Yt=ut}}}U=Fr||!U?xe:U,this.nextAvcDts=le=Re+U,this.videoSampleDuration=U,this.isVideoContiguous=!0;var zt={data1:P.moof(N.sequenceNumber++,re,Y({},N,{samples:Se})),data2:ir,startPTS:ve/Pe,endPTS:(Le+U)/Pe,startDTS:re/Pe,endDTS:le/Pe,type:"video",hasAudio:!1,hasVideo:!0,nb:Se.length,dropped:N.dropped};return N.samples=[],N.dropped=0,zt},q.remuxAudio=function(N,fe,_e,te,re){var Re=N.inputTimeScale,Pe=Re/(N.samplerate?N.samplerate:Re),Fe=N.segmentCodec==="aac"?1024:1152,Se=Fe*Pe,Ye=this._initPTS,ot=N.segmentCodec==="mp3"&&this.typeSupported.mpeg,le=[],Ee=re!==void 0,U=N.samples,ve=ot?0:8,Le=this.nextAudioPts||-1,Ne=fe*Re;if(this.isAudioContiguous=_e=_e||U.length&&Le>0&&(te&&Math.abs(Ne-Le)<9e3||Math.abs(z(U[0].pts-Ye,Ne)-Le)<20*Se),U.forEach(function(Ae){Ae.pts=z(Ae.pts-Ye,Ne)}),!_e||Le<0){if(U=U.filter(function(Ae){return Ae.pts>=0}),!U.length)return;Le=re===0?0:te&&!Ee?Math.max(0,Ne):U[0].pts}if(N.segmentCodec==="aac")for(var Ue=this.config.maxAudioFramesDrift,Ge=0,Te=Le;Ge<U.length;Ge++){var xe=U[Ge],$e=xe.pts,rt=$e-Te,_t=Math.abs(1e3*rt/Re);if(rt<=-Ue*Se&&Ee)Ge===0&&(Q.logger.warn("Audio frame @ "+($e/Re).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*rt/Re)+" ms."),this.nextAudioPts=Le=Te=$e);else if(rt>=Ue*Se&&_t<1e4&&Ee){var gt=Math.round(rt/Se);(Te=$e-gt*Se)<0&&(gt--,Te+=Se),Ge===0&&(this.nextAudioPts=Le=Te),Q.logger.warn("[mp4-remuxer]: Injecting "+gt+" audio frame @ "+(Te/Re).toFixed(3)+"s due to "+Math.round(1e3*rt/Re)+" ms gap.");for(var Lt=0;Lt<gt;Lt++){var lt=Math.max(Te,0),wt=M.getSilentFrame(N.manifestCodec||N.codec,N.channelCount);wt||(Q.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),wt=xe.unit.subarray()),U.splice(Ge,0,{unit:wt,pts:lt}),Te+=Se,Ge++}}xe.pts=Te,Te+=Se}for(var Rt,At=null,pt=null,Ut=0,Vt=U.length;Vt--;)Ut+=U[Vt].unit.byteLength;for(var ir=0,vr=U.length;ir<vr;ir++){var Qt=U[ir],Fr=Qt.unit,se=Qt.pts;if(pt!==null)le[ir-1].duration=Math.round((se-pt)/Pe);else{if(_e&&N.segmentCodec==="aac"&&(se=Le),At=se,!(Ut>0))return;Ut+=ve;try{Rt=new Uint8Array(Ut)}catch{return void this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:ue.ErrorTypes.MUX_ERROR,details:ue.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ut,reason:"fail allocating audio mdat "+Ut})}ot||(new DataView(Rt.buffer).setUint32(0,Ut),Rt.set(P.types.mdat,4))}Rt.set(Fr,ve);var j=Fr.byteLength;ve+=j,le.push(new He(!0,Fe,j,0)),pt=se}var I=le.length;if(I){var G=le[le.length-1];this.nextAudioPts=Le=pt+Pe*G.duration;var H=ot?new Uint8Array(0):P.moof(N.sequenceNumber++,At/Pe,Y({},N,{samples:le}));N.samples=[];var $=At/Re,ie=Le/Re,ae={data1:H,data2:Rt,startPTS:$,endPTS:ie,startDTS:$,endDTS:ie,type:"audio",hasAudio:!0,hasVideo:!1,nb:I};return this.isAudioContiguous=!0,ae}},q.remuxEmptyAudio=function(N,fe,_e,te){var re=N.inputTimeScale,Re=re/(N.samplerate?N.samplerate:re),Pe=this.nextAudioPts,Fe=(Pe!==null?Pe:te.startDTS*re)+this._initDTS,Se=te.endDTS*re+this._initDTS,Ye=1024*Re,ot=Math.ceil((Se-Fe)/Ye),le=M.getSilentFrame(N.manifestCodec||N.codec,N.channelCount);if(Q.logger.warn("[mp4-remuxer]: remux empty Audio"),le){for(var Ee=[],U=0;U<ot;U++){var ve=Fe+U*Ye;Ee.push({unit:le,pts:ve,dts:ve})}return N.samples=Ee,this.remuxAudio(N,fe,_e,!1)}Q.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},w}();function z(w,q){var N;if(q===null)return w;for(N=q<w?-8589934592:8589934592;Math.abs(w-q)>4294967296;)w+=N;return w}function be(w,q,N,fe){var _e=w.samples.length;if(_e){for(var te=w.inputTimeScale,re=0;re<_e;re++){var Re=w.samples[re];Re.pts=z(Re.pts-N,q*te)/te,Re.dts=z(Re.dts-fe,q*te)/te}var Pe=w.samples;return w.samples=[],{samples:Pe}}}function ke(w,q,N){var fe=w.samples.length;if(fe){for(var _e=w.inputTimeScale,te=0;te<fe;te++){var re=w.samples[te];re.pts=z(re.pts-N,q*_e)/_e}w.samples.sort(function(Pe,Fe){return Pe.pts-Fe.pts});var Re=w.samples;return w.samples=[],{samples:Re}}}var He=function(w,q,N,fe){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=q,this.size=N,this.cts=fe,this.flags=new Z(w)},Z=function(w){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=w?2:1,this.isNonSync=w?0:1}},856:(v,g,b)=>{"use strict";var L;b.r(g),b.d(g,{MetadataSchema:()=>L}),function(M){M.audioId3="org.id3",M.dateRange="com.apple.quicktime.HLS",M.emsg="https://aomedia.org/emsg/ID3"}(L||(L={}))},308:(v,g,b)=>{"use strict";var L,M;b.r(g),b.d(g,{PlaylistContextType:()=>L,PlaylistLevelType:()=>M}),function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"}(L||(L={})),function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"}(M||(M={}))},300:(v,g,b)=>{"use strict";b.r(g),b.d(g,{default:()=>L});let L={hexDump:function(M){for(var R="",y=0;y<M.length;y++){var P=M[y].toString(16);P.length<2&&(P="0"+P),R+=P}return R}}},93:(v,g,b)=>{"use strict";b.r(g),b.d(g,{enableLogs:()=>P,logger:()=>O});var L=function(){},M={trace:L,debug:L,log:L,warn:L,info:L,error:L},R=M;function y(ue){var Q=self.console[ue];return Q?Q.bind(self.console,"["+ue+"] >"):L}function P(ue,Q){if(self.console&&ue===!0||typeof ue=="object"){(function(de){for(var he=arguments.length,Y=new Array(he>1?he-1:0),pe=1;pe<he;pe++)Y[pe-1]=arguments[pe];Y.forEach(function(X){R[X]=de[X]?de[X].bind(de):y(X)})})(ue,"debug","log","info","warn","error");try{R.log('Debug logs enabled for "'+Q+'"')}catch{R=M}}else R=M}var O=M},63:(v,g,b)=>{"use strict";b.r(g),b.d(g,{RemuxerTrackIdConfig:()=>Q,appendUint8Array:()=>_e,bin2str:()=>de,computeRawDurationFromSamples:()=>q,discardEPB:()=>Pe,findBox:()=>oe,getDuration:()=>w,getStartDTS:()=>Z,mp4Box:()=>Se,mp4pssh:()=>Ye,offsetStartDTS:()=>N,parseEmsg:()=>Fe,parseInitSegment:()=>be,parsePssh:()=>ot,parseSEIMessageFromNALu:()=>Re,parseSamples:()=>te,parseSegmentIndex:()=>z,parseSinf:()=>He,patchEncyptionData:()=>ke,readSint32:()=>pe,readUint16:()=>he,readUint32:()=>Y,segmentValidRange:()=>fe,writeUint32:()=>X});var L=b(923),M=b(145),R=b(181),y=b(93),P=b(300),O=Math.pow(2,32)-1,ue=[].push,Q={video:1,audio:2,id3:3,text:4};function de(le){return String.fromCharCode.apply(null,le)}function he(le,Ee){var U=le[Ee]<<8|le[Ee+1];return U<0?65536+U:U}function Y(le,Ee){var U=pe(le,Ee);return U<0?4294967296+U:U}function pe(le,Ee){return le[Ee]<<24|le[Ee+1]<<16|le[Ee+2]<<8|le[Ee+3]}function X(le,Ee,U){le[Ee]=U>>24,le[Ee+1]=U>>16&255,le[Ee+2]=U>>8&255,le[Ee+3]=255&U}function oe(le,Ee){var U=[];if(!Ee.length)return U;for(var ve=le.byteLength,Le=0;Le<ve;){var Ne=Y(le,Le),Ue=Ne>1?Le+Ne:ve;if(de(le.subarray(Le+4,Le+8))===Ee[0])if(Ee.length===1)U.push(le.subarray(Le+8,Ue));else{var Ge=oe(le.subarray(Le+8,Ue),Ee.slice(1));Ge.length&&ue.apply(U,Ge)}Le=Ue}return U}function z(le){var Ee=[],U=le[0],ve=8,Le=Y(le,ve);ve+=4,ve+=U===0?8:16,ve+=2;var Ne=le.length+0,Ue=he(le,ve);ve+=2;for(var Ge=0;Ge<Ue;Ge++){var Te=ve,xe=Y(le,Te);Te+=4;var $e=2147483647&xe;if((2147483648&xe)>>>31==1)return console.warn("SIDX has hierarchical references (not supported)"),null;var rt=Y(le,Te);Te+=4,Ee.push({referenceSize:$e,subsegmentDuration:rt,info:{duration:rt/Le,start:Ne,end:Ne+$e-1}}),Ne+=$e,ve=Te+=4}return{earliestPresentationTime:0,timescale:Le,version:U,referencesCount:Ue,references:Ee}}function be(le){for(var Ee=[],U=oe(le,["moov","trak"]),ve=0;ve<U.length;ve++){var Le=U[ve],Ne=oe(Le,["tkhd"])[0];if(Ne){var Ue=Ne[0],Ge=Ue===0?12:20,Te=Y(Ne,Ge),xe=oe(Le,["mdia","mdhd"])[0];if(xe){var $e=Y(xe,Ge=(Ue=xe[0])===0?12:20),rt=oe(Le,["mdia","hdlr"])[0];if(rt){var _t=de(rt.subarray(8,12)),gt={soun:L.ElementaryStreamTypes.AUDIO,vide:L.ElementaryStreamTypes.VIDEO}[_t];if(gt){var Lt=oe(Le,["mdia","minf","stbl","stsd"])[0],lt=void 0;Lt&&(lt=de(Lt.subarray(12,16))),Ee[Te]={timescale:$e,type:gt},Ee[gt]={timescale:$e,id:Te,codec:lt}}}}}}return oe(le,["moov","mvex","trex"]).forEach(function(wt){var Rt=Y(wt,4),At=Ee[Rt];At&&(At.default={duration:Y(wt,12),flags:Y(wt,20)})}),Ee}function ke(le,Ee){if(!le||!Ee)return le;var U=Ee.keyId;return U&&Ee.isCommonEncryption&&oe(le,["moov","trak"]).forEach(function(ve){var Le=oe(ve,["mdia","minf","stbl","stsd"])[0].subarray(8),Ne=oe(Le,["enca"]),Ue=Ne.length>0;Ue||(Ne=oe(Le,["encv"])),Ne.forEach(function(Ge){oe(Ue?Ge.subarray(28):Ge.subarray(78),["sinf"]).forEach(function(Te){var xe=He(Te);if(xe){var $e=xe.subarray(8,24);$e.some(function(rt){return rt!==0})||(y.logger.log("[eme] Patching keyId in 'enc"+(Ue?"a":"v")+">sinf>>tenc' box: "+P.default.hexDump($e)+" -> "+P.default.hexDump(U)),xe.set(U,8))}})})}),le}function He(le){var Ee=oe(le,["schm"])[0];if(Ee){var U=de(Ee.subarray(4,8));if(U==="cbcs"||U==="cenc")return oe(le,["schi","tenc"])[0]}return y.logger.error("[eme] missing 'schm' box"),null}function Z(le,Ee){return oe(Ee,["moof","traf"]).reduce(function(U,ve){var Le=oe(ve,["tfdt"])[0],Ne=Le[0],Ue=oe(ve,["tfhd"]).reduce(function(Ge,Te){var xe=Y(Te,4),$e=le[xe];if($e){var rt=Y(Le,4);Ne===1&&(rt*=Math.pow(2,32),rt+=Y(Le,8));var _t=rt/($e.timescale||9e4);if(isFinite(_t)&&(Ge===null||_t<Ge))return _t}return Ge},null);return Ue!==null&&isFinite(Ue)&&(U===null||Ue<U)?Ue:U},null)||0}function w(le,Ee){for(var U=0,ve=0,Le=0,Ne=oe(le,["moof","traf"]),Ue=0;Ue<Ne.length;Ue++){var Ge=Ne[Ue],Te=oe(Ge,["tfhd"])[0],xe=Ee[Y(Te,4)];if(xe){var $e=xe.default,rt=Y(Te,0)|($e==null?void 0:$e.flags),_t=$e==null?void 0:$e.duration;8&rt&&(_t=Y(Te,2&rt?12:8));for(var gt=xe.timescale||9e4,Lt=oe(Ge,["trun"]),lt=0;lt<Lt.length;lt++)!(U=q(Lt[lt]))&&_t&&(U=_t*Y(Lt[lt],4)),xe.type===L.ElementaryStreamTypes.VIDEO?ve+=U/gt:xe.type===L.ElementaryStreamTypes.AUDIO&&(Le+=U/gt)}}if(ve===0&&Le===0){for(var wt=0,Rt=oe(le,["sidx"]),At=0;At<Rt.length;At++){var pt=z(Rt[At]);pt!=null&&pt.references&&(wt+=pt.references.reduce(function(Ut,Vt){return Ut+Vt.info.duration||0},0))}return wt}return ve||Le}function q(le){var Ee=Y(le,0),U=8;1&Ee&&(U+=4),4&Ee&&(U+=4);for(var ve=0,Le=Y(le,4),Ne=0;Ne<Le;Ne++)256&Ee&&(ve+=Y(le,U),U+=4),512&Ee&&(U+=4),1024&Ee&&(U+=4),2048&Ee&&(U+=4);return ve}function N(le,Ee,U){oe(Ee,["moof","traf"]).forEach(function(ve){oe(ve,["tfhd"]).forEach(function(Le){var Ne=Y(Le,4),Ue=le[Ne];if(Ue){var Ge=Ue.timescale||9e4;oe(ve,["tfdt"]).forEach(function(Te){var xe=Te[0],$e=Y(Te,4);if(xe===0)$e-=U*Ge,X(Te,4,$e=Math.max($e,0));else{$e*=Math.pow(2,32),$e+=Y(Te,8),$e-=U*Ge,$e=Math.max($e,0);var rt=Math.floor($e/(O+1)),_t=Math.floor($e%(O+1));X(Te,4,rt),X(Te,8,_t)}})}})})}function fe(le){var Ee={valid:null,remainder:null},U=oe(le,["moof"]);if(!U)return Ee;if(U.length<2)return Ee.remainder=le,Ee;var ve=U[U.length-1];return Ee.valid=(0,M.sliceUint8)(le,0,ve.byteOffset-8),Ee.remainder=(0,M.sliceUint8)(le,ve.byteOffset-8),Ee}function _e(le,Ee){var U=new Uint8Array(le.length+Ee.length);return U.set(le),U.set(Ee,le.length),U}function te(le,Ee){var U=[],ve=Ee.samples,Le=Ee.timescale,Ne=Ee.id,Ue=!1;return oe(ve,["moof"]).map(function(Ge){var Te=Ge.byteOffset-8;oe(Ge,["traf"]).map(function(xe){var $e=oe(xe,["tfdt"]).map(function(rt){var _t=rt[0],gt=Y(rt,4);return _t===1&&(gt*=Math.pow(2,32),gt+=Y(rt,8)),gt/Le})[0];return $e!==void 0&&(le=$e),oe(xe,["tfhd"]).map(function(rt){var _t=Y(rt,4),gt=16777215&Y(rt,0),Lt=0,lt=(16&gt)!=0,wt=0,Rt=(32&gt)!=0,At=8;_t===Ne&&((1&gt)!=0&&(At+=8),(2&gt)!=0&&(At+=4),(8&gt)!=0&&(Lt=Y(rt,At),At+=4),lt&&(wt=Y(rt,At),At+=4),Rt&&(At+=4),Ee.type==="video"&&(Ue=function(pt){if(!pt)return!1;var Ut=pt.indexOf("."),Vt=Ut<0?pt:pt.substring(0,Ut);return Vt==="hvc1"||Vt==="hev1"||Vt==="dvh1"||Vt==="dvhe"}(Ee.codec)),oe(xe,["trun"]).map(function(pt){var Ut=pt[0],Vt=16777215&Y(pt,0),ir=(1&Vt)!=0,vr=0,Qt=(4&Vt)!=0,Fr=(256&Vt)!=0,se=0,j=(512&Vt)!=0,I=0,G=(1024&Vt)!=0,H=(2048&Vt)!=0,$=0,ie=Y(pt,4),ae=8;ir&&(vr=Y(pt,ae),ae+=4),Qt&&(ae+=4);for(var Ae=vr+Te,Ce=0;Ce<ie;Ce++){if(Fr?(se=Y(pt,ae),ae+=4):se=Lt,j?(I=Y(pt,ae),ae+=4):I=wt,G&&(ae+=4),H&&($=Ut===0?Y(pt,ae):pe(pt,ae),ae+=4),Ee.type===L.ElementaryStreamTypes.VIDEO)for(var Oe=0;Oe<I;){var Ke=Y(ve,Ae);re(Ue,ve[Ae+=4])&&Re(ve.subarray(Ae,Ae+Ke),Ue?2:1,le+$/Le,U),Ae+=Ke,Oe+=Ke+4}le+=se/Le}}))})})}),U}function re(le,Ee){if(le){var U=Ee>>1&63;return U===39||U===40}return(31&Ee)==6}function Re(le,Ee,U,ve){var Le=Pe(le),Ne=0;Ne+=Ee;for(var Ue=0,Ge=0,Te=!1,xe=0;Ne<Le.length;){Ue=0;do{if(Ne>=Le.length)break;Ue+=xe=Le[Ne++]}while(xe===255);Ge=0;do{if(Ne>=Le.length)break;Ge+=xe=Le[Ne++]}while(xe===255);var $e=Le.length-Ne;if(!Te&&Ue===4&&Ne<Le.length){if(Te=!0,Le[Ne++]===181){var rt=he(Le,Ne);if(Ne+=2,rt===49){var _t=Y(Le,Ne);if(Ne+=4,_t===1195456820){var gt=Le[Ne++];if(gt===3){var Lt=Le[Ne++],lt=64&Lt,wt=lt?2+3*(31&Lt):0,Rt=new Uint8Array(wt);if(lt){Rt[0]=Lt;for(var At=1;At<wt;At++)Rt[At]=Le[Ne++]}ve.push({type:gt,payloadType:Ue,pts:U,bytes:Rt})}}}}}else if(Ue===5&&Ge<$e){if(Te=!0,Ge>16){for(var pt=[],Ut=0;Ut<16;Ut++){var Vt=Le[Ne++].toString(16);pt.push(Vt.length==1?"0"+Vt:Vt),Ut!==3&&Ut!==5&&Ut!==7&&Ut!==9||pt.push("-")}for(var ir=Ge-16,vr=new Uint8Array(ir),Qt=0;Qt<ir;Qt++)vr[Qt]=Le[Ne++];ve.push({payloadType:Ue,pts:U,uuid:pt.join(""),userData:(0,R.utf8ArrayToStr)(vr),userDataBytes:vr})}}else if(Ge<$e)Ne+=Ge;else if(Ge>$e)break}}function Pe(le){for(var Ee=le.byteLength,U=[],ve=1;ve<Ee-2;)le[ve]===0&&le[ve+1]===0&&le[ve+2]===3?(U.push(ve+2),ve+=2):ve++;if(U.length===0)return le;var Le=Ee-U.length,Ne=new Uint8Array(Le),Ue=0;for(ve=0;ve<Le;Ue++,ve++)Ue===U[0]&&(Ue++,U.shift()),Ne[ve]=le[Ue];return Ne}function Fe(le){var Ee=le[0],U="",ve="",Le=0,Ne=0,Ue=0,Ge=0,Te=0,xe=0;if(Ee===0){for(;de(le.subarray(xe,xe+1))!=="\0";)U+=de(le.subarray(xe,xe+1)),xe+=1;for(U+=de(le.subarray(xe,xe+1)),xe+=1;de(le.subarray(xe,xe+1))!=="\0";)ve+=de(le.subarray(xe,xe+1)),xe+=1;ve+=de(le.subarray(xe,xe+1)),xe+=1,Le=Y(le,12),Ne=Y(le,16),Ge=Y(le,20),Te=Y(le,24),xe=28}else if(Ee===1){Le=Y(le,xe+=4);var $e=Y(le,xe+=4),rt=Y(le,xe+=4);for(xe+=4,Ue=Math.pow(2,32)*$e+rt,Number.isSafeInteger(Ue)||(Ue=Number.MAX_SAFE_INTEGER,console.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),Ge=Y(le,xe),Te=Y(le,xe+=4),xe+=4;de(le.subarray(xe,xe+1))!=="\0";)U+=de(le.subarray(xe,xe+1)),xe+=1;for(U+=de(le.subarray(xe,xe+1)),xe+=1;de(le.subarray(xe,xe+1))!=="\0";)ve+=de(le.subarray(xe,xe+1)),xe+=1;ve+=de(le.subarray(xe,xe+1)),xe+=1}return{schemeIdUri:U,value:ve,timeScale:Le,presentationTime:Ue,presentationTimeDelta:Ne,eventDuration:Ge,id:Te,payload:le.subarray(xe,le.byteLength)}}function Se(le){for(var Ee=arguments.length,U=new Array(Ee>1?Ee-1:0),ve=1;ve<Ee;ve++)U[ve-1]=arguments[ve];for(var Le=U.length,Ne=8,Ue=Le;Ue--;)Ne+=U[Ue].byteLength;var Ge=new Uint8Array(Ne);for(Ge[0]=Ne>>24&255,Ge[1]=Ne>>16&255,Ge[2]=Ne>>8&255,Ge[3]=255&Ne,Ge.set(le,4),Ue=0,Ne=8;Ue<Le;Ue++)Ge.set(U[Ue],Ne),Ne+=U[Ue].byteLength;return Ge}function Ye(le,Ee,U){if(le.byteLength!==16)throw new RangeError("Invalid system id");var ve,Le,Ne;if(Ee){ve=1,Le=new Uint8Array(16*Ee.length);for(var Ue=0;Ue<Ee.length;Ue++){var Ge=Ee[Ue];if(Ge.byteLength!==16)throw new RangeError("Invalid key");Le.set(Ge,16*Ue)}}else ve=0,Le=new Uint8Array;ve>0?(Ne=new Uint8Array(4),Ee.length>0&&new DataView(Ne.buffer).setUint32(0,Ee.length,!1)):Ne=new Uint8Array;var Te=new Uint8Array(4);return U&&U.byteLength>0&&new DataView(Te.buffer).setUint32(0,U.byteLength,!1),Se([112,115,115,104],new Uint8Array([ve,0,0,0]),le,Ne,Le,Te,U||new Uint8Array)}function ot(le){if(!(le instanceof ArrayBuffer)||le.byteLength<32)return null;var Ee={version:0,systemId:"",kids:null,data:null},U=new DataView(le),ve=U.getUint32(0);if(le.byteLength!==ve&&ve>44||U.getUint32(4)!==1886614376||(Ee.version=U.getUint32(8)>>>24,Ee.version>1))return null;Ee.systemId=P.default.hexDump(new Uint8Array(le,12,16));var Le=U.getUint32(28);if(Ee.version===0){if(ve-32<Le)return null;Ee.data=new Uint8Array(le,32,Le)}else if(Ee.version===1){Ee.kids=[];for(var Ne=0;Ne<Le;Ne++)Ee.kids.push(new Uint8Array(le,32+16*Ne,16))}return Ee}},673:(v,g,b)=>{"use strict";function L(P,O,ue,Q){ue===void 0&&(ue=1),Q===void 0&&(Q=!1);var de=P*O*ue;return Q?Math.round(de):de}function M(P,O,ue,Q){return ue===void 0&&(ue=1),Q===void 0&&(Q=!1),L(P,O,1/ue,Q)}function R(P,O){return O===void 0&&(O=!1),L(P,1e3,11111111111111112e-21,O)}function y(P,O){return O===void 0&&(O=1),L(P,9e4,1/O)}b.r(g),b.d(g,{toMpegTsClockFromTimescale:()=>y,toMsFromMpegTsClock:()=>R,toTimescaleFromBase:()=>L,toTimescaleFromScale:()=>M})},145:(v,g,b)=>{"use strict";function L(M,R,y){return Uint8Array.prototype.slice?M.slice(R,y):new Uint8Array(Array.prototype.slice.call(M,R,y))}b.r(g),b.d(g,{sliceUint8:()=>L})},729:v=>{"use strict";var g=Object.prototype.hasOwnProperty,b="~";function L(){}function M(O,ue,Q){this.fn=O,this.context=ue,this.once=Q||!1}function R(O,ue,Q,de,he){if(typeof Q!="function")throw new TypeError("The listener must be a function");var Y=new M(Q,de||O,he),pe=b?b+ue:ue;return O._events[pe]?O._events[pe].fn?O._events[pe]=[O._events[pe],Y]:O._events[pe].push(Y):(O._events[pe]=Y,O._eventsCount++),O}function y(O,ue){--O._eventsCount==0?O._events=new L:delete O._events[ue]}function P(){this._events=new L,this._eventsCount=0}Object.create&&(L.prototype=Object.create(null),new L().__proto__||(b=!1)),P.prototype.eventNames=function(){var O,ue,Q=[];if(this._eventsCount===0)return Q;for(ue in O=this._events)g.call(O,ue)&&Q.push(b?ue.slice(1):ue);return Object.getOwnPropertySymbols?Q.concat(Object.getOwnPropertySymbols(O)):Q},P.prototype.listeners=function(O){var ue=b?b+O:O,Q=this._events[ue];if(!Q)return[];if(Q.fn)return[Q.fn];for(var de=0,he=Q.length,Y=new Array(he);de<he;de++)Y[de]=Q[de].fn;return Y},P.prototype.listenerCount=function(O){var ue=b?b+O:O,Q=this._events[ue];return Q?Q.fn?1:Q.length:0},P.prototype.emit=function(O,ue,Q,de,he,Y){var pe=b?b+O:O;if(!this._events[pe])return!1;var X,oe,z=this._events[pe],be=arguments.length;if(z.fn){switch(z.once&&this.removeListener(O,z.fn,void 0,!0),be){case 1:return z.fn.call(z.context),!0;case 2:return z.fn.call(z.context,ue),!0;case 3:return z.fn.call(z.context,ue,Q),!0;case 4:return z.fn.call(z.context,ue,Q,de),!0;case 5:return z.fn.call(z.context,ue,Q,de,he),!0;case 6:return z.fn.call(z.context,ue,Q,de,he,Y),!0}for(oe=1,X=new Array(be-1);oe<be;oe++)X[oe-1]=arguments[oe];z.fn.apply(z.context,X)}else{var ke,He=z.length;for(oe=0;oe<He;oe++)switch(z[oe].once&&this.removeListener(O,z[oe].fn,void 0,!0),be){case 1:z[oe].fn.call(z[oe].context);break;case 2:z[oe].fn.call(z[oe].context,ue);break;case 3:z[oe].fn.call(z[oe].context,ue,Q);break;case 4:z[oe].fn.call(z[oe].context,ue,Q,de);break;default:if(!X)for(ke=1,X=new Array(be-1);ke<be;ke++)X[ke-1]=arguments[ke];z[oe].fn.apply(z[oe].context,X)}}return!0},P.prototype.on=function(O,ue,Q){return R(this,O,ue,Q,!1)},P.prototype.once=function(O,ue,Q){return R(this,O,ue,Q,!0)},P.prototype.removeListener=function(O,ue,Q,de){var he=b?b+O:O;if(!this._events[he])return this;if(!ue)return y(this,he),this;var Y=this._events[he];if(Y.fn)Y.fn!==ue||de&&!Y.once||Q&&Y.context!==Q||y(this,he);else{for(var pe=0,X=[],oe=Y.length;pe<oe;pe++)(Y[pe].fn!==ue||de&&!Y[pe].once||Q&&Y[pe].context!==Q)&&X.push(Y[pe]);X.length?this._events[he]=X.length===1?X[0]:X:y(this,he)}return this},P.prototype.removeAllListeners=function(O){var ue;return O?(ue=b?b+O:O,this._events[ue]&&y(this,ue)):(this._events=new L,this._eventsCount=0),this},P.prototype.off=P.prototype.removeListener,P.prototype.addListener=P.prototype.on,P.prefixed=b,P.EventEmitter=P,v.exports=P},945:function(v){var g,b,L,M,R;g=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,b=/^(?=([^\/?#]*))\1([^]*)$/,L=/(?:\/|^)\.(?=\/)/g,M=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(y,P,O){if(O=O||{},y=y.trim(),!(P=P.trim())){if(!O.alwaysNormalize)return y;var ue=R.parseURL(y);if(!ue)throw new Error("Error trying to parse base URL.");return ue.path=R.normalizePath(ue.path),R.buildURLFromParts(ue)}var Q=R.parseURL(P);if(!Q)throw new Error("Error trying to parse relative URL.");if(Q.scheme)return O.alwaysNormalize?(Q.path=R.normalizePath(Q.path),R.buildURLFromParts(Q)):P;var de=R.parseURL(y);if(!de)throw new Error("Error trying to parse base URL.");if(!de.netLoc&&de.path&&de.path[0]!=="/"){var he=b.exec(de.path);de.netLoc=he[1],de.path=he[2]}de.netLoc&&!de.path&&(de.path="/");var Y={scheme:de.scheme,netLoc:Q.netLoc,path:null,params:Q.params,query:Q.query,fragment:Q.fragment};if(!Q.netLoc&&(Y.netLoc=de.netLoc,Q.path[0]!=="/"))if(Q.path){var pe=de.path,X=pe.substring(0,pe.lastIndexOf("/")+1)+Q.path;Y.path=R.normalizePath(X)}else Y.path=de.path,Q.params||(Y.params=de.params,Q.query||(Y.query=de.query));return Y.path===null&&(Y.path=O.alwaysNormalize?R.normalizePath(Q.path):Q.path),R.buildURLFromParts(Y)},parseURL:function(y){var P=g.exec(y);return P?{scheme:P[1]||"",netLoc:P[2]||"",path:P[3]||"",params:P[4]||"",query:P[5]||"",fragment:P[6]||""}:null},normalizePath:function(y){for(y=y.split("").reverse().join("").replace(L,"");y.length!==(y=y.replace(M,"")).length;);return y.split("").reverse().join("")},buildURLFromParts:function(y){return y.scheme+y.netLoc+y.path+y.params+y.query+y.fragment}},v.exports=R}},t={};function i(v){var g=t[v];if(g!==void 0)return g.exports;var b=t[v]={exports:{}};return a[v].call(b.exports,b,b.exports,i),b.exports}i.m=a,i.n=v=>{var g=v&&v.__esModule?()=>v.default:()=>v;return i.d(g,{a:g}),g},i.d=(v,g)=>{for(var b in g)i.o(g,b)&&!i.o(v,b)&&Object.defineProperty(v,b,{enumerable:!0,get:g[b]})},i.o=(v,g)=>Object.prototype.hasOwnProperty.call(v,g),i.r=v=>{typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})};var d=i(76);return d.default})())});var sn=class{addEventListener(){}removeEventListener(){}dispatchEvent(t){return!0}};if(typeof DocumentFragment=="undefined"){class a extends sn{}globalThis.DocumentFragment=a}var $n=class extends sn{},ql=class extends sn{},Lm={get(a){},define(a,t,i){},upgrade(a){},whenDefined(a){return Promise.resolve($n)}},zn,Yl=class{constructor(t,i={}){lr(this,zn,void 0);$r(this,zn,i==null?void 0:i.detail)}get detail(){return Nt(this,zn)}initCustomEvent(){}};zn=new WeakMap;function Dm(a,t){return new $n}var lc={document:{createElement:Dm},DocumentFragment,customElements:Lm,CustomEvent:Yl,EventTarget:sn,HTMLElement:$n,HTMLVideoElement:ql},uc=typeof window=="undefined"||typeof globalThis.customElements=="undefined",mr=uc?lc:globalThis,Hr=uc?lc.document:globalThis.document;var et={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_CAPTIONS_REQUEST:"mediashowcaptionsrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_CAPTIONS_REQUEST:"mediadisablecaptionsrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},Qn={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailablechange",MEDIA_PIP_UNAVAILABLE:"mediapipunavailablechange",MEDIA_PAUSED:"mediapausedchange",MEDIA_HAS_PLAYED:"mediahasplayedchange",MEDIA_MUTED:"mediamutedchange",MEDIA_VOLUME_LEVEL:"mediavolumelevelchange",MEDIA_VOLUME:"mediavolumechange",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailablechange",MEDIA_IS_PIP:"mediaispipchange",MEDIA_IS_CASTING:"mediaiscastingchange",MEDIA_CAPTIONS_LIST:"mediacaptionslistchange",MEDIA_SUBTITLES_LIST:"mediasubtitleslistchange",MEDIA_CAPTIONS_SHOWING:"mediacaptionsshowingchange",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowingchange",MEDIA_IS_FULLSCREEN:"mediaisfullscreenchange",MEDIA_PLAYBACK_RATE:"mediaplaybackratechange",MEDIA_CURRENT_TIME:"mediacurrenttimechange",MEDIA_DURATION:"mediadurationchange",MEDIA_SEEKABLE:"mediaseekablechange",MEDIA_PREVIEW_IMAGE:"mediapreviewimagechange",MEDIA_PREVIEW_COORDS:"mediapreviewcoordschange",MEDIA_LOADING:"medialoadingchange",USER_INACTIVE:"userinactivechange"},tt={MEDIA_CHROME_ATTRIBUTES:"media-chrome-attributes",MEDIA_CONTROLLER:"media-controller"},F={MEDIA_AIRPLAY_UNAVAILABLE:"media-airplay-unavailable",MEDIA_FULLSCREEN_UNAVAILABLE:"media-fullscreen-unavailable",MEDIA_PIP_UNAVAILABLE:"media-pip-unavailable",MEDIA_CAST_UNAVAILABLE:"media-cast-unavailable",MEDIA_PAUSED:"media-paused",MEDIA_HAS_PLAYED:"media-has-played",MEDIA_MUTED:"media-muted",MEDIA_VOLUME_LEVEL:"media-volume-level",MEDIA_VOLUME:"media-volume",MEDIA_VOLUME_UNAVAILABLE:"media-volume-unavailable",MEDIA_IS_PIP:"media-is-pip",MEDIA_IS_CASTING:"media-is-casting",MEDIA_CAPTIONS_LIST:"media-captions-list",MEDIA_SUBTITLES_LIST:"media-subtitles-list",MEDIA_CAPTIONS_SHOWING:"media-captions-showing",MEDIA_SUBTITLES_SHOWING:"media-subtitles-showing",MEDIA_IS_FULLSCREEN:"media-is-fullscreen",MEDIA_PLAYBACK_RATE:"media-playback-rate",MEDIA_CURRENT_TIME:"media-current-time",MEDIA_DURATION:"media-duration",MEDIA_SEEKABLE:"media-seekable",MEDIA_PREVIEW_TIME:"media-preview-time",MEDIA_PREVIEW_IMAGE:"media-preview-image",MEDIA_PREVIEW_COORDS:"media-preview-coords",MEDIA_LOADING:"media-loading",MEDIA_BUFFERED:"media-buffered",MEDIA_STREAM_TYPE:"media-stream-type",MEDIA_TIME_IS_LIVE:"media-time-is-live"},gg=Object.entries(Qn).reduce((a,[t,i])=>{let d=F[t];return d&&(a[i]=d),a},{userinactivechange:"user-inactive"}),dc=Object.entries(F).reduce((a,[t,i])=>{let d=Qn[t];return d&&(a[i]=d),a},{"user-inactive":"userinactivechange"}),on={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},_a={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var $l={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},ci={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Xn={LIVE:"live",ON_DEMAND:"on-demand"};var Pr={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:a=1}={})=>`current playback rate ${a}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading"},ur={PLAY:()=>"play",PAUSE:()=>"pause",MUTE:()=>"mute",UNMUTE:()=>"unmute",AIRPLAY:()=>"air play",ENTER_CAST:()=>"start casting",EXIT_CAST:()=>"stop casting",ENTER_FULLSCREEN:()=>"enter fullscreen mode",EXIT_FULLSCREEN:()=>"exit fullscreen mode",ENTER_PIP:()=>"enter picture in picture mode",EXIT_PIP:()=>"exit picture in picture mode",SEEK_FORWARD_N_SECS:({seekOffset:a=30}={})=>`seek forward ${a} seconds`,SEEK_BACK_N_SECS:({seekOffset:a=30}={})=>`seek back ${a} seconds`},Cm={...Pr,...ur};function io(a,t=!1){return a.split("_").map(function(i,d){return(d||t?i[0].toUpperCase():i[0].toLowerCase())+i.slice(1).toLowerCase()}).join("")}function cc(a){return a.replace(/[-_]([a-z])/g,(t,i)=>i.toUpperCase())}function hc(a){return typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a)}function fc(a){return typeof a!="string"?!1:!isNaN(a)&&!isNaN(parseFloat(a))}var mc=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],Mm=(a,t)=>{let i=a===1?mc[t].singular:mc[t].plural;return`${a} ${i}`},Aa=a=>{if(!hc(a))return"";let t=Math.abs(a),i=t!==a,d=new Date(0,0,0,0,0,t,0);return`${[d.getHours(),d.getMinutes(),d.getSeconds()].map((L,M)=>L&&Mm(L,M)).filter(L=>L).join(", ")}${i?" remaining":""}`};function ni(a,t){let i=!1;a<0&&(i=!0,a=0-a),a=a<0?0:a;let d=Math.floor(a%60),v=Math.floor(a/60%60),g=Math.floor(a/3600),b=Math.floor(t/60%60),L=Math.floor(t/3600);return(isNaN(a)||a===1/0)&&(g=v=d="-"),g=g>0||L>0?g+":":"",v=((g||b>=10)&&v<10?"0"+v:v)+":",d=d<10?"0"+d:d,(i?"-":"")+g+v+d}var ao=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},zl=class{observe(){}},pc={ResizeObserver:zl,HTMLElement:class extends ao{},DocumentFragment:class extends ao{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){}},Om={createElement:function(){return new pc.HTMLElement}},vc=typeof window=="undefined"||typeof window.customElements=="undefined",ce=vc?pc:window,Me=vc?Om:window.document;var Pm=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},Sa=(a,t,i)=>(Pm(a,t,"read from private field"),i?i.call(a):t.get(a)),Ql=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},no,ln,Xl,gc=Me.createElement("template");gc.innerHTML=`
29
+ `),me=[],Ie=(0,Ii.toMpegTsClockFromTimescale)(h,f),ye="00:00.000",De=0,qe=0,rt=!0;K.oncue=function(we){var je=p[_],Ve=p.ccOffset,Tt=(De-Ie)/9e4;je!=null&&je.new&&(qe!==void 0?Ve=p.ccOffset=je.start:function(Gt,yi,fi){var ei=Gt[yi],bi=Gt[ei.prevCC];if(!bi||!bi.new&&ei.new)return Gt.ccOffset=Gt.presentationOffset=ei.start,void(ei.new=!1);for(;(Zi=bi)!==null&&Zi!==void 0&&Zi.new;){var Zi;Gt.ccOffset+=ei.start-bi.start,ei.new=!1,bi=Gt[(ei=bi).prevCC]}Gt.presentationOffset=fi}(p,_,Tt)),Tt&&(Ve=Tt-p.presentationOffset);var Wt=we.endTime-we.startTime,St=(0,ji.normalizePts)(9e4*(we.startTime+Ve-qe),9e4*S)/9e4;we.startTime=Math.max(St,0),we.endTime=Math.max(St+Wt,0);var Mt=we.text.trim();we.text=decodeURIComponent(encodeURIComponent(Mt)),we.id||(we.id=xi(we.startTime,we.endTime,Mt)),we.endTime>0&&me.push(we)},K.onparsingerror=function(we){W=we},K.onflush=function(){W?x(W):C(me)},ee.forEach(function(we){if(rt){if(qi(we,"X-TIMESTAMP-MAP=")){rt=!1,we.slice(16).split(",").forEach(function(je){qi(je,"LOCAL:")?ye=je.slice(6):qi(je,"MPEGTS:")&&(De=parseInt(je.slice(7)))});try{qe=function(je){var Ve=parseInt(je.slice(-3)),Tt=parseInt(je.slice(-6,-4)),Wt=parseInt(je.slice(-9,-7)),St=je.length>9?parseInt(je.substring(0,je.indexOf(":"))):0;if(!((0,R.isFiniteNumber)(Ve)&&(0,R.isFiniteNumber)(Tt)&&(0,R.isFiniteNumber)(Wt)&&(0,R.isFiniteNumber)(St)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+je);return Ve+=1e3*Tt,(Ve+=6e4*Wt)+36e5*St}(ye)/1e3}catch(je){W=je}return}we===""&&(rt=!1)}K.parse(we+`
30
+ `)}),K.flush()})((o=e.initSegment)!==null&&o!==void 0&&o.data?(0,te.appendUint8Array)(e.initSegment.data,new Uint8Array(i)):i,this.initPTS[e.cc],this.timescale[e.cc],s,e.cc,e.start,function(u){l._appendCues(u,e.level),n.trigger(b.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(u){l._fallbackToIMSC1(e,i),O.logger.log("Failed to parse VTT cue: "+u),n.trigger(b.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:u})})},c._fallbackToIMSC1=function(e,i){var s=this,o=this.tracks[e.level];o.textCodec||Gd(i,this.initPTS[e.cc],this.timescale[e.cc],function(){o.textCodec=Yi,s._parseIMSC1(e,i)},function(){o.textCodec="wvtt"})},c._appendCues=function(e,i){var s=this.hls;if(this.config.renderTextTracksNatively){var o=this.textTracks[i];if(!o||o.mode==="disabled")return;e.forEach(function(u){return _t(o,u)})}else{var l=this.tracks[i];if(!l)return;var n=l.default?"default":"subtitles"+i;s.trigger(b.Events.CUES_PARSED,{type:"subtitles",cues:e,track:n})}},c.onFragDecrypted=function(e,i){var s=i.frag;if(s.type===Te.PlaylistLevelType.SUBTITLE){if(!(0,R.isFiniteNumber)(this.initPTS[s.cc]))return void this.unparsedVttFrags.push(i);this.onFragLoaded(b.Events.FRAG_LOADED,i)}},c.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},c.onFragParsingUserdata=function(e,i){var s=this.cea608Parser1,o=this.cea608Parser2;if(this.enabled&&s&&o){var l=i.frag,n=i.samples;if(l.type!==Te.PlaylistLevelType.MAIN||this.closedCaptionsForLevel(l)!=="NONE")for(var u=0;u<n.length;u++){var h=n[u].bytes;if(h){var f=this.extractCea608Data(h);s.addData(n[u].pts,f[0]),o.addData(n[u].pts,f[1])}}}},c.onBufferFlushing=function(e,i){var s=i.startOffset,o=i.endOffset,l=i.endOffsetSubtitles,n=i.type,u=this.media;if(u&&!(u.currentTime<o)){if(!n||n==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(p){return Lt(h[p],s,o)})}if(this.config.renderTextTracksNatively&&s===0&&l!==void 0){var f=this.textTracks;Object.keys(f).forEach(function(p){return Lt(f[p],s,l)})}}},c.extractCea608Data=function(e){for(var i=[[],[]],s=31&e[0],o=2,l=0;l<s;l++){var n=e[o++],u=127&e[o++],h=127&e[o++];if((u!==0||h!==0)&&(4&n)!=0){var f=3&n;f!==0&&f!==1||(i[f].push(u),i[f].push(h))}}return i},m}();function om(m,c){return m&&m.label===c.name&&!(m.textTrack1||m.textTrack2)}function lm(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}let um=function(){function m(s){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=s,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var c,e,i=m.prototype;return i.setStreamController=function(s){this.streamController=s},i.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},i.registerListeners=function(){var s=this.hls;s.on(b.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),s.on(b.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(b.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(b.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.on(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},i.unregisterListener=function(){var s=this.hls;s.off(b.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),s.off(b.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(b.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(b.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.off(b.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},i.onFpsDropLevelCapping=function(s,o){m.isLevelAllowed(o.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(o.droppedLevel)},i.onMediaAttaching=function(s,o){this.media=o.media instanceof HTMLVideoElement?o.media:null,this.clientRect=null},i.onManifestParsed=function(s,o){var l=this.hls;this.restrictedLevels=[],this.firstLevel=o.firstLevel,l.config.capLevelToPlayerSize&&o.video&&this.startCapping()},i.onBufferCodecs=function(s,o){this.hls.config.capLevelToPlayerSize&&o.video&&this.startCapping()},i.onMediaDetaching=function(){this.stopCapping()},i.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var s=this.hls.levels;if(s.length){var o=this.hls;o.autoLevelCapping=this.getMaxLevel(s.length-1),o.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=o.autoLevelCapping}}},i.getMaxLevel=function(s){var o=this,l=this.hls.levels;if(!l.length)return-1;var n=l.filter(function(u,h){return m.isLevelAllowed(h,o.restrictedLevels)&&h<=s});return this.clientRect=null,m.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)},i.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},i.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},i.getDimensions=function(){if(this.clientRect)return this.clientRect;var s=this.media,o={width:0,height:0};if(s){var l=s.getBoundingClientRect();o.width=l.width,o.height=l.height,o.width||o.height||(o.width=l.right-l.left||s.width||0,o.height=l.bottom-l.top||s.height||0)}return this.clientRect=o,o},m.isLevelAllowed=function(s,o){return o===void 0&&(o=[]),o.indexOf(s)===-1},m.getMaxLevelByMediaSize=function(s,o,l){if(!s||!s.length)return-1;for(var n,u,h=s.length-1,f=0;f<s.length;f+=1){var p=s[f];if((p.width>=o||p.height>=l)&&(n=p,!(u=s[f+1])||n.width!==u.width||n.height!==u.height)){h=f;break}}return h},c=m,(e=[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var s=1;if(!this.hls.config.ignoreDevicePixelRatio)try{s=self.devicePixelRatio}catch{}return s}}])&&lm(c.prototype,e),Object.defineProperty(c,"prototype",{writable:!1}),m}(),dm=function(){function m(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var c=m.prototype;return c.setStreamController=function(e){this.streamController=e},c.registerListeners=function(){this.hls.on(b.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},c.unregisterListeners=function(){this.hls.off(b.Events.MEDIA_ATTACHING,this.onMediaAttaching)},c.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},c.onMediaAttaching=function(e,i){var s=this.hls.config;if(s.capLevelOnFPSDrop){var o=i.media instanceof self.HTMLVideoElement?i.media:null;this.media=o,o&&typeof o.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}},c.checkFPS=function(e,i,s){var o=performance.now();if(i){if(this.lastTime){var l=o-this.lastTime,n=s-this.lastDroppedFrames,u=i-this.lastDecodedFrames,h=1e3*n/l,f=this.hls;if(f.trigger(b.Events.FPS_DROP,{currentDropped:n,currentDecoded:u,totalDroppedFrames:s}),h>0&&n>f.config.fpsDroppedMonitoringThreshold*u){var p=f.currentLevel;O.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+p),p>0&&(f.autoLevelCapping===-1||f.autoLevelCapping>=p)&&(p-=1,f.trigger(b.Events.FPS_DROP_LEVEL_CAPPING,{level:p,droppedLevel:f.currentLevel}),f.autoLevelCapping=p,this.streamController.nextLevelSwitch())}}this.lastTime=o,this.lastDroppedFrames=s,this.lastDecodedFrames=i}},c.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var i=e.getVideoPlaybackQuality();this.checkFPS(e,i.totalVideoFrames,i.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},m}();var Ta=E(300);function Pl(m){var c=typeof Map=="function"?new Map:void 0;return Pl=function(e){if(e===null||(i=e,Function.toString.call(i).indexOf("[native code]")===-1))return e;var i;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(c!==void 0){if(c.has(e))return c.get(e);c.set(e,s)}function s(){return Nl(e,arguments,Ul(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),Vn(s,e)},Pl(m)}function Nl(m,c,e){return Nl=cm()?Reflect.construct.bind():function(i,s,o){var l=[null];l.push.apply(l,s);var n=new(Function.bind.apply(i,l));return o&&Vn(n,o.prototype),n},Nl.apply(null,arguments)}function cm(){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 Vn(m,c){return Vn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},Vn(m,c)}function Ul(m){return Ul=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(c){return c.__proto__||Object.getPrototypeOf(c)},Ul(m)}var eo="[eme]",qd=function(){function m(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=m.CDMCleanupPromise?[m.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=O.logger.debug.bind(O.logger,eo),this.log=O.logger.log.bind(O.logger,eo),this.warn=O.logger.warn.bind(O.logger,eo),this.error=O.logger.error.bind(O.logger,eo),this.hls=e,this.config=e.config,this.registerListeners()}var c=m.prototype;return c.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null},c.registerListeners=function(){this.hls.on(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(b.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(b.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},c.unregisterListeners=function(){this.hls.off(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(b.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(b.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},c.getLicenseServerUrl=function(e){var i=this.config,s=i.drmSystems,o=i.widevineLicenseUrl,l=s[e];if(l)return l.licenseUrl;if(e===z.WIDEVINE&&o)return o;throw new Error('no license server URL configured for key-system "'+e+'"')},c.getServerCertificateUrl=function(e){var i=this.config.drmSystems[e];if(i)return i.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},c.attemptKeySystemAccess=function(e){var i=this,s=this.hls.levels,o=function(u,h,f){return!!u&&f.indexOf(u)===h},l=s.map(function(u){return u.audioCodec}).filter(o),n=s.map(function(u){return u.videoCodec}).filter(o);return l.length+n.length===0&&n.push("avc1.42e01e"),new Promise(function(u,h){(function f(p){var _=p.shift();i.getMediaKeysPromise(_,l,n).then(function(S){return u({keySystem:_,mediaKeys:S})}).catch(function(S){p.length?f(p):h(S instanceof ur?S:new ur({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_ACCESS,error:S,fatal:!0},S.message))})})(e)})},c.requestMediaKeySystemAccess=function(e,i){var s=this.config.requestMediaKeySystemAccessFunc;if(typeof s!="function"){var o="Configured requestMediaKeySystemAccess is not a function "+s;return _e===null&&self.location.protocol==="http:"&&(o="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(o))}return s(e,i)},c.getMediaKeysPromise=function(e,i,s){var o=this,l=function(f,p,_,S){var C;switch(f){case z.FAIRPLAY:C=["cenc","sinf"];break;case z.WIDEVINE:case z.PLAYREADY:C=["cenc"];break;case z.CLEARKEY:C=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+f)}return function(x,W,K,ee){return[{initDataTypes:x,persistentState:ee.persistentState||"not-allowed",distinctiveIdentifier:ee.distinctiveIdentifier||"not-allowed",sessionTypes:ee.sessionTypes||[ee.sessionType||"temporary"],audioCapabilities:W.map(function(me){return{contentType:'audio/mp4; codecs="'+me+'"',robustness:ee.audioRobustness||"",encryptionScheme:ee.audioEncryptionScheme||null}}),videoCapabilities:K.map(function(me){return{contentType:'video/mp4; codecs="'+me+'"',robustness:ee.videoRobustness||"",encryptionScheme:ee.videoEncryptionScheme||null}})}]}(C,p,_,S)}(e,i,s,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e],u=n==null?void 0:n.keySystemAccess;if(!u){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(l)),u=this.requestMediaKeySystemAccess(e,l);var h=this.keySystemAccessPromises[e]={keySystemAccess:u};return u.catch(function(f){o.log('Failed to obtain access to key-system "'+e+'": '+f)}),u.then(function(f){o.log('Access for key-system "'+f.keySystem+'" obtained');var p=o.fetchServerCertificate(e);return o.log('Create media-keys for "'+e+'"'),h.mediaKeys=f.createMediaKeys().then(function(_){return o.log('Media-keys created for "'+e+'"'),p.then(function(S){return S?o.setMediaKeysServerCertificate(_,e,S):_})}),h.mediaKeys.catch(function(_){o.error('Failed to create media-keys for "'+e+'"}: '+_)}),h.mediaKeys})}return u.then(function(){return n.mediaKeys})},c.createMediaKeySessionContext=function(e){var i=e.decryptdata,s=e.keySystem,o=e.mediaKeys;this.log('Creating key-system session "'+s+'" keyId: '+Ta.default.hexDump(i.keyId||[]));var l=o.createSession(),n={decryptdata:i,keySystem:s,mediaKeys:o,mediaKeysSession:l,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n},c.renewKeySession=function(e){var i=e.decryptdata;if(i.pssh){var s=this.createMediaKeySessionContext(e),o=this.getKeyIdString(i);this.keyIdToKeySessionPromise[o]=this.generateRequestWithPreferredKeySession(s,"cenc",i.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},c.getKeyIdString=function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return Ta.default.hexDump(e.keyId)},c.updateKeySession=function(e,i){var s,o=e.mediaKeysSession;return this.log('Updating key-session "'+o.sessionId+'" for keyID '+Ta.default.hexDump(((s=e.decryptdata)===null||s===void 0?void 0:s.keyId)||[])+`
31
+ } (data length: `+(i&&i.byteLength)+")"),o.update(i)},c.selectKeySystemFormat=function(e){var i=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+i.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(i)),this.keyFormatPromise},c.getKeyFormatPromise=function(e){var i=this;return new Promise(function(s,o){var l=fe(i.config),n=e.map(q).filter(function(u){return!!u&&l.indexOf(u)!==-1});return i.getKeySystemSelectionPromise(n).then(function(u){var h=u.keySystem,f=N(h);f?s(f):o(new Error('Unable to find format for key-system "'+h+'"'))}).catch(o)})},c.loadKey=function(e){var i=this,s=e.keyInfo.decryptdata,o=this.getKeyIdString(s),l="(keyId: "+o+' format: "'+s.keyFormat+'" method: '+s.method+" uri: "+s.uri+")";this.log("Starting session for key "+l);var n=this.keyIdToKeySessionPromise[o];return n||(n=this.keyIdToKeySessionPromise[o]=this.getKeySystemForKeyPromise(s).then(function(u){var h=u.keySystem,f=u.mediaKeys;return i.throwIfDestroyed(),i.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+l),i.attemptSetMediaKeys(h,f).then(function(){i.throwIfDestroyed();var p=i.createMediaKeySessionContext({keySystem:h,mediaKeys:f,decryptdata:s});return i.generateRequestWithPreferredKeySession(p,"cenc",s.pssh,"playlist-key")})})).catch(function(u){return i.handleError(u)}),n},c.throwIfDestroyed=function(e){if(e===void 0&&(e="Invalid state"),!this.hls)throw new Error("invalid state")},c.handleError=function(e){this.hls&&(this.error(e.message),e instanceof ur?this.hls.trigger(b.Events.ERROR,e.data):this.hls.trigger(b.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},c.getKeySystemForKeyPromise=function(e){var i=this.getKeyIdString(e),s=this.keyIdToKeySessionPromise[i];if(!s){var o=q(e.keyFormat),l=o?[o]:fe(this.config);return this.attemptKeySystemAccess(l)}return s},c.getKeySystemSelectionPromise=function(e){if(e.length||(e=fe(this.config)),e.length===0)throw new ur({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},c._onMediaEncrypted=function(e){var i=this,s=e.initDataType,o=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+s+'"'),o!==null){var l,n;if(s==="sinf"&&this.config.drmSystems[z.FAIRPLAY]){var u=(0,te.bin2str)(new Uint8Array(o));try{var h=Z(JSON.parse(u).sinf),f=(0,te.parseSinf)(new Uint8Array(h));if(!f)return;l=f.subarray(8,24),n=z.FAIRPLAY}catch{return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var p=(0,te.parsePssh)(o);if(p===null)return;p.version===0&&p.systemId===ke.WIDEVINE&&p.data&&(l=p.data.subarray(8,24)),n=function(me){if(me===ke.WIDEVINE)return z.WIDEVINE}(p.systemId)}if(n&&l){for(var _=Ta.default.hexDump(l),S=this.keyIdToKeySessionPromise,C=this.mediaKeySessions,x=S[_],W=function(me){var Ie=C[me],ye=Ie.decryptdata;if(ye.pssh||!ye.keyId)return"continue";var De=Ta.default.hexDump(ye.keyId);return _===De||ye.uri.replace(/-/g,"").indexOf(_)!==-1?(x=S[De],delete S[De],ye.pssh=new Uint8Array(o),ye.keyId=l,x=S[_]=x.then(function(){return i.generateRequestWithPreferredKeySession(Ie,s,o,"encrypted-event-key-match")}),"break"):void 0},K=0;K<C.length;K++){var ee=W(K);if(ee!=="continue"&&ee==="break")break}x||(x=S[_]=this.getKeySystemSelectionPromise([n]).then(function(me){var Ie,ye=me.keySystem,De=me.mediaKeys;i.throwIfDestroyed();var qe=new Re("ISO-23001-7",_,(Ie=N(ye))!=null?Ie:"");return qe.pssh=new Uint8Array(o),qe.keyId=l,i.attemptSetMediaKeys(ye,De).then(function(){i.throwIfDestroyed();var rt=i.createMediaKeySessionContext({decryptdata:qe,keySystem:ye,mediaKeys:De});return i.generateRequestWithPreferredKeySession(rt,s,o,"encrypted-event-no-match")})})),x.catch(function(me){return i.handleError(me)})}}},c._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},c.attemptSetMediaKeys=function(e,i){var s=this,o=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var l=Promise.all(o).then(function(){if(!s.media)throw new Error("Attempted to set mediaKeys without media element attached");return s.media.setMediaKeys(i)});return this.setMediaKeysQueue.push(l),l.then(function(){s.log('Media-keys set for "'+e+'"'),o.push(l),s.setMediaKeysQueue=s.setMediaKeysQueue.filter(function(n){return o.indexOf(n)===-1})})},c.generateRequestWithPreferredKeySession=function(e,i,s,o){var l,n,u=this,h=(l=this.config.drmSystems)===null||l===void 0||(n=l[e.keySystem])===null||n===void 0?void 0:n.generateRequest;if(h)try{var f=h.call(this.hls,i,s,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");i=f.initDataType,s=e.decryptdata.pssh=f.initData?new Uint8Array(f.initData):null}catch(x){var p;if(this.warn(x.message),(p=this.hls)!==null&&p!==void 0&&p.config.debug)throw x}if(s===null)return this.log('Skipping key-session request for "'+o+'" (no initData)'),Promise.resolve(e);var _=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+o+'": '+_+" (init data type: "+i+" length: "+(s?s.byteLength:null)+")");var S=new(ga());e.mediaKeysSession.onmessage=function(x){var W=e.mediaKeysSession;if(W){var K=x.messageType,ee=x.message;u.log('"'+K+'" message event for session "'+W.sessionId+'" message size: '+ee.byteLength),K==="license-request"||K==="license-renewal"?u.renewLicense(e,ee).catch(function(me){u.handleError(me),S.emit("error",me)}):K==="license-release"?e.keySystem===z.FAIRPLAY&&(u.updateKeySession(e,I("acknowledged")),u.removeSession(e)):u.warn('unhandled media key message type "'+K+'"')}else S.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(x){if(e.mediaKeysSession){u.onKeyStatusChange(e);var W=e.keyStatus;S.emit("keyStatus",W),W==="expired"&&(u.warn(e.keySystem+" expired for key "+_),u.renewKeySession(e))}else S.emit("error",new Error("invalid state"))};var C=new Promise(function(x,W){S.on("error",W),S.on("keyStatus",function(K){K.startsWith("usable")?x():K==="output-restricted"?W(new ur({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):K==="internal-error"?W(new ur({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+K+'"')):K==="expired"?W(new Error("key expired while generating request")):u.warn('unhandled key status change "'+K+'"')})});return e.mediaKeysSession.generateRequest(i,s).then(function(){var x;u.log('Request generated for key-session "'+((x=e.mediaKeysSession)===null||x===void 0?void 0:x.sessionId)+'" keyId: '+_)}).catch(function(x){throw new ur({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_SESSION,error:x,fatal:!1},"Error generating key-session request: "+x)}).then(function(){return C}).catch(function(x){throw S.removeAllListeners(),u.removeSession(e),x}).then(function(){return S.removeAllListeners(),e})},c.onKeyStatusChange=function(e){var i=this;e.mediaKeysSession.keyStatuses.forEach(function(s,o){i.log('key status change "'+s+'" for keyStatuses keyId: '+Ta.default.hexDump("buffer"in o?new Uint8Array(o.buffer,o.byteOffset,o.byteLength):new Uint8Array(o))+" session keyId: "+Ta.default.hexDump(new Uint8Array(e.decryptdata.keyId||[]))+" uri: "+e.decryptdata.uri),e.keyStatus=s})},c.fetchServerCertificate=function(e){var i=this;return new Promise(function(s,o){var l=i.getServerCertificateUrl(e);if(!l)return s();i.log('Fetching serverCertificate for "'+e+'"');var n=new XMLHttpRequest;n.open("GET",l,!0),n.responseType="arraybuffer",n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&(n.status===200?s(n.response):o(new ur({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n},'"'+e+'" certificate request XHR failed ('+l+"). Status: "+n.status+" ("+n.statusText+")")))},n.send()})},c.setMediaKeysServerCertificate=function(e,i,s){var o=this;return new Promise(function(l,n){e.setServerCertificate(s).then(function(u){o.log("setServerCertificate "+(u?"success":"not supported by CDM")+" ("+(s==null?void 0:s.byteLength)+') on "'+i+'"'),l(e)}).catch(function(u){n(new ur({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:u,fatal:!0},u.message))})})},c.renewLicense=function(e,i){var s=this;return this.requestLicense(e,new Uint8Array(i)).then(function(o){return s.updateKeySession(e,new Uint8Array(o)).catch(function(l){throw new ur({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:l,fatal:!0},l.message)})})},c.setupLicenseXHR=function(e,i,s,o){var l=this,n=this.config.licenseXhrSetup;return n?Promise.resolve().then(function(){if(!s.decryptdata)throw new Error("Key removed");return n.call(l.hls,e,i,s,o)}).catch(function(u){if(!s.decryptdata)throw u;return e.open("POST",i,!0),n.call(l.hls,e,i,s,o)}).then(function(u){return e.readyState||e.open("POST",i,!0),{xhr:e,licenseChallenge:u||o}}):(e.open("POST",i,!0),Promise.resolve({xhr:e,licenseChallenge:o}))},c.requestLicense=function(e,i){var s=this;return new Promise(function(o,l){var n=s.getLicenseServerUrl(e.keySystem);s.log("Sending license request to URL: "+n);var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=function(){if(!s.hls||!e.mediaKeysSession)return l(new Error("invalid state"));if(u.readyState===4)if(u.status===200){s._requestLicenseFailureCount=0;var h=u.response;s.log("License received "+(h instanceof ArrayBuffer?h.byteLength:h));var f=s.config.licenseResponseCallback;if(f)try{h=f.call(s.hls,u,n,e)}catch(_){s.error(_)}o(h)}else if(s._requestLicenseFailureCount++,s._requestLicenseFailureCount>3||u.status>=400&&u.status<500)l(new ur({type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:u},"License Request XHR failed ("+n+"). Status: "+u.status+" ("+u.statusText+")"));else{var p=3-s._requestLicenseFailureCount+1;s.warn("Retrying license request, "+p+" attempts left"),s.requestLicense(e,i).then(o,l)}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=u,s.setupLicenseXHR(u,n,e,i).then(function(h){var f=h.xhr,p=h.licenseChallenge;f.send(p)})})},c.onMediaAttached=function(e,i){if(this.config.emeEnabled){var s=i.media;this.media=s,s.addEventListener("encrypted",this.onMediaEncrypted),s.addEventListener("waitingforkey",this.onWaitingForKey)}},c.onMediaDetached=function(){var e=this,i=this.media,s=this.mediaKeySessions;i&&(i.removeEventListener("encrypted",this.onMediaEncrypted),i.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Re.clearKeyUriToKeyIdMap();var o=s.length;m.CDMCleanupPromise=Promise.all(s.map(function(l){return e.removeSession(l)}).concat(i==null?void 0:i.setMediaKeys(null).catch(function(l){e.log("Could not clear media keys: "+l+". media.src: "+(i==null?void 0:i.src))}))).then(function(){o&&(e.log("finished closing key sessions and clearing media keys"),s.length=0)}).catch(function(l){e.log("Could not close sessions and clear media keys: "+l+". media.src: "+(i==null?void 0:i.src))})},c.onManifestLoaded=function(e,i){var s=i.sessionKeys;if(s&&this.config.emeEnabled&&!this.keyFormatPromise){var o=s.reduce(function(l,n){return l.indexOf(n.keyFormat)===-1&&l.push(n.keyFormat),l},[]);this.log("Selecting key-system from session-keys "+o.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(o)}},c.removeSession=function(e){var i=this,s=e.mediaKeysSession,o=e.licenseXhr;if(s){this.log("Remove licenses and keys and close session "+s.sessionId),s.onmessage=null,s.onkeystatuseschange=null,o&&o.readyState!==XMLHttpRequest.DONE&&o.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var l=this.mediaKeySessions.indexOf(e);return l>-1&&this.mediaKeySessions.splice(l,1),s.remove().catch(function(n){i.log("Could not remove session: "+n)}).then(function(){return s.close()}).catch(function(n){i.log("Could not close session: "+n)})}},m}();qd.CDMCleanupPromise=void 0;var ur=function(m){var c,e;function i(s,o){var l;return(l=m.call(this,o)||this).data=void 0,l.data=s,s.err=s.error,l}return e=m,(c=i).prototype=Object.create(e.prototype),c.prototype.constructor=c,Vn(c,e),i}(Pl(Error));let hm=qd;var Oi,Fl,Yd;function $d(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}function zd(m,c,e){return c&&$d(m.prototype,c),e&&$d(m,e),Object.defineProperty(m,"prototype",{writable:!1}),m}function Qd(m,c){var e=typeof Symbol!="undefined"&&m[Symbol.iterator]||m["@@iterator"];if(e)return(e=e.call(m)).next.bind(e);if(Array.isArray(m)||(e=function(s,o){if(s){if(typeof s=="string")return Xd(s,o);var l=Object.prototype.toString.call(s).slice(8,-1);return l==="Object"&&s.constructor&&(l=s.constructor.name),l==="Map"||l==="Set"?Array.from(s):l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?Xd(s,o):void 0}}(m))||c&&m&&typeof m.length=="number"){e&&(m=e);var i=0;return function(){return i>=m.length?{done:!0}:{done:!1,value:m[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
32
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xd(m,c){(c==null||c>m.length)&&(c=m.length);for(var e=0,i=new Array(c);e<c;e++)i[e]=m[e];return i}function to(){return to=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(m[i]=e[i])}return m},to.apply(this,arguments)}(function(m){m.MANIFEST="m",m.AUDIO="a",m.VIDEO="v",m.MUXED="av",m.INIT="i",m.CAPTION="c",m.TIMED_TEXT="tt",m.KEY="k",m.OTHER="o"})(Oi||(Oi={})),function(m){m.DASH="d",m.HLS="h",m.SMOOTH="s",m.OTHER="o"}(Fl||(Fl={})),function(m){m.VOD="v",m.LIVE="l"}(Yd||(Yd={}));var fm=function(){function m(e){var i=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){i.initialized&&(i.starved=!0),i.buffering=!0},this.onPlaying=function(){i.initialized||(i.initialized=!0),i.buffering=!1},this.applyPlaylistData=function(l){try{i.apply(l,{ot:Oi.MANIFEST,su:!i.initialized})}catch(n){O.logger.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=function(l){try{var n=l.frag,u=i.hls.levels[n.level],h=i.getObjectType(n),f={d:1e3*n.duration,ot:h};h!==Oi.VIDEO&&h!==Oi.AUDIO&&h!=Oi.MUXED||(f.br=u.bitrate/1e3,f.tb=i.getTopBandwidth(h)/1e3,f.bl=i.getBufferLength(h)),i.apply(l,f)}catch(p){O.logger.warn("Could not generate segment CMCD data.",p)}},this.hls=e;var s=this.config=e.config,o=s.cmcd;o!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=o.sessionId||m.uuid(),this.cid=o.contentId,this.useHeaders=o.useHeaders===!0,this.registerListeners())}var c=m.prototype;return c.registerListeners=function(){var e=this.hls;e.on(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(b.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(b.Events.BUFFER_CREATED,this.onBufferCreated,this)},c.unregisterListeners=function(){var e=this.hls;e.off(b.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(b.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(b.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},c.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},c.onMediaAttached=function(e,i){this.media=i.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},c.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},c.onBufferCreated=function(e,i){var s,o;this.audioBuffer=(s=i.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(o=i.tracks.video)===null||o===void 0?void 0:o.buffer},c.createData=function(){var e;return{v:1,sf:Fl.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},c.apply=function(e,i){i===void 0&&(i={}),to(i,this.createData());var s=i.ot===Oi.INIT||i.ot===Oi.VIDEO||i.ot===Oi.MUXED;if(this.starved&&s&&(i.bs=!0,i.su=!0,this.starved=!1),i.su==null&&(i.su=this.buffering),this.useHeaders){var o=m.toHeaders(i);if(!Object.keys(o).length)return;e.headers||(e.headers={}),to(e.headers,o)}else{var l=m.toQuery(i);if(!l)return;e.url=m.appendQueryToUri(e.url,l)}},c.getObjectType=function(e){var i=e.type;return i==="subtitle"?Oi.TIMED_TEXT:e.sn==="initSegment"?Oi.INIT:i==="audio"?Oi.AUDIO:i==="main"?this.hls.audioTracks.length?Oi.VIDEO:Oi.MUXED:void 0},c.getTopBandwidth=function(e){var i,s=0,o=this.hls;if(e===Oi.AUDIO)i=o.audioTracks;else{var l=o.maxAutoLevel,n=l>-1?l+1:o.levels.length;i=o.levels.slice(0,n)}for(var u,h=Qd(i);!(u=h()).done;){var f=u.value;f.bitrate>s&&(s=f.bitrate)}return s>0?s:NaN},c.getBufferLength=function(e){var i=this.hls.media,s=e===Oi.AUDIO?this.audioBuffer:this.videoBuffer;return s&&i?1e3*$t.bufferInfo(s,i.currentTime,this.config.maxBufferHole).len:NaN},c.createPlaylistLoader=function(){var e=this.config.pLoader,i=this.applyPlaylistData,s=e||this.config.loader;return function(){function o(n){this.loader=void 0,this.loader=new s(n)}var l=o.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(n,u,h){i(n),this.loader.load(n,u,h)},zd(o,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),o}()},c.createFragmentLoader=function(){var e=this.config.fLoader,i=this.applyFragmentData,s=e||this.config.loader;return function(){function o(n){this.loader=void 0,this.loader=new s(n)}var l=o.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(n,u,h){i(n),this.loader.load(n,u,h)},zd(o,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),o}()},m.uuid=function(){var e=URL.createObjectURL(new Blob),i=e.toString();return URL.revokeObjectURL(e),i.slice(i.lastIndexOf("/")+1)},m.serialize=function(e){for(var i,s=[],o=function(x){return!Number.isNaN(x)&&x!=null&&x!==""&&x!==!1},l=function(x){return Math.round(x)},n=function(x){return 100*l(x/100)},u={br:l,d:l,bl:n,dl:n,mtp:n,nor:function(x){return encodeURIComponent(x)},rtp:n,tb:l},h=Qd(Object.keys(e||{}).sort());!(i=h()).done;){var f=i.value,p=e[f];if(o(p)&&!(f==="v"&&p===1||f=="pr"&&p===1)){var _=u[f];_&&(p=_(p));var S,C=typeof p;S=f==="ot"||f==="sf"||f==="st"?f+"="+p:C==="boolean"?f:C==="number"?f+"="+p:f+"="+JSON.stringify(p),s.push(S)}}return s.join(",")},m.toHeaders=function(e){for(var i={},s=["Object","Request","Session","Status"],o=[{},{},{},{}],l={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},n=0,u=Object.keys(e);n<u.length;n++){var h=u[n];o[l[h]!=null?l[h]:1][h]=e[h]}for(var f=0;f<o.length;f++){var p=m.serialize(o[f]);p&&(i["CMCD-"+s[f]]=p)}return i},m.toQuery=function(e){return"CMCD="+encodeURIComponent(m.serialize(e))},m.appendQueryToUri=function(e,i){if(!i)return e;var s=e.includes("?")?"&":"?";return""+e+s+i},m}(),Zd=E(408),mm=/^age:\s*[\d.]+\s*$/m;let Jd=function(){function m(e){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=e?e.xhrSetup:null,this.stats=new Zd.LoadStats,this.retryDelay=0}var c=m.prototype;return c.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},c.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))},c.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},c.load=function(e,i,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=i,this.callbacks=s,this.retryDelay=i.retryDelay,this.loadInternal()},c.loadInternal=function(){var e=this.config,i=this.context;if(e){var s=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0;var l=this.xhrSetup;try{if(l)try{l(s,i.url)}catch{s.open("GET",i.url,!0),l(s,i.url)}s.readyState||s.open("GET",i.url,!0);var n=this.context.headers;if(n)for(var u in n)s.setRequestHeader(u,n[u])}catch(h){return void this.callbacks.onError({code:s.status,text:h.message},i,s)}i.rangeEnd&&s.setRequestHeader("Range","bytes="+i.rangeStart+"-"+(i.rangeEnd-1)),s.onreadystatechange=this.readystatechange.bind(this),s.onprogress=this.loadprogress.bind(this),s.responseType=i.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),s.send()}},c.readystatechange=function(){var e=this.context,i=this.loader,s=this.stats;if(e&&i){var o=i.readyState,l=this.config;if(!s.aborted&&o>=2)if(self.clearTimeout(this.requestTimeout),s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start)),o===4){i.onreadystatechange=null,i.onprogress=null;var n=i.status,u=i.responseType==="arraybuffer";if(n>=200&&n<300&&(u&&i.response||i.responseText!==null)){var h,f;if(s.loading.end=Math.max(self.performance.now(),s.loading.first),f=u?(h=i.response).byteLength:(h=i.responseText).length,s.loaded=s.total=f,!this.callbacks)return;var p=this.callbacks.onProgress;if(p&&p(s,e,h,i),!this.callbacks)return;var _={url:i.responseURL,data:h};this.callbacks.onSuccess(_,s,e,i)}else s.retry>=l.maxRetry||n>=400&&n<499?(O.logger.error(n+" while loading "+e.url),this.callbacks.onError({code:n,text:i.statusText},e,i)):(O.logger.warn(n+" while loading "+e.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,l.maxRetryDelay),s.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),l.timeout)}},c.loadtimeout=function(){O.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},c.loadprogress=function(e){var i=this.stats;i.loaded=e.loaded,e.lengthComputable&&(i.total=e.total)},c.getCacheAge=function(){var e=null;if(this.loader&&mm.test(this.loader.getAllResponseHeaders())){var i=this.loader.getResponseHeader("age");e=i?parseFloat(i):null}return e},m}();function Bl(m){var c=typeof Map=="function"?new Map:void 0;return Bl=function(e){if(e===null||(i=e,Function.toString.call(i).indexOf("[native code]")===-1))return e;var i;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(c!==void 0){if(c.has(e))return c.get(e);c.set(e,s)}function s(){return Hl(e,arguments,Kl(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),Wn(s,e)},Bl(m)}function Hl(m,c,e){return Hl=pm()?Reflect.construct.bind():function(i,s,o){var l=[null];l.push.apply(l,s);var n=new(Function.bind.apply(i,l));return o&&Wn(n,o.prototype),n},Hl.apply(null,arguments)}function pm(){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 Wn(m,c){return Wn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},Wn(m,c)}function Kl(m){return Kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(c){return c.__proto__||Object.getPrototypeOf(c)},Kl(m)}function Gl(){return Gl=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(m[i]=e[i])}return m},Gl.apply(this,arguments)}var vm=function(){function m(e){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=e.fetchSetup||gm,this.controller=new self.AbortController,this.stats=new Zd.LoadStats}var c=m.prototype;return c.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},c.abortInternal=function(){var e=this.response;e&&e.ok||(this.stats.aborted=!0,this.controller.abort())},c.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},c.load=function(e,i,s){var o=this,l=this.stats;if(l.loading.start)throw new Error("Loader can only be used once.");l.loading.start=self.performance.now();var n=function(p,_){var S={method:"GET",mode:"cors",credentials:"same-origin",signal:_,headers:new self.Headers(Gl({},p.headers))};return p.rangeEnd&&S.headers.set("Range","bytes="+p.rangeStart+"-"+String(p.rangeEnd-1)),S}(e,this.controller.signal),u=s.onProgress,h=e.responseType==="arraybuffer",f=h?"byteLength":"length";this.context=e,this.config=i,this.callbacks=s,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){o.abortInternal(),s.onTimeout(l,e,o.response)},i.timeout),self.fetch(this.request).then(function(p){if(o.response=o.loader=p,!p.ok){var _=p.status,S=p.statusText;throw new Em(S||"fetch, bad network response",_,p)}return l.loading.first=Math.max(self.performance.now(),l.loading.start),l.total=parseInt(p.headers.get("Content-Length")||"0"),u&&(0,R.isFiniteNumber)(i.highWaterMark)?o.loadProgressively(p,l,e,i.highWaterMark,u):h?p.arrayBuffer():p.text()}).then(function(p){var _=o.response;self.clearTimeout(o.requestTimeout),l.loading.end=Math.max(self.performance.now(),l.loading.first);var S=p[f];S&&(l.loaded=l.total=S);var C={url:_.url,data:p};u&&!(0,R.isFiniteNumber)(i.highWaterMark)&&u(l,e,p,_),s.onSuccess(C,l,e,_)}).catch(function(p){if(self.clearTimeout(o.requestTimeout),!l.aborted){var _=p&&p.code||0,S=p?p.message:null;s.onError({code:_,text:S},e,p?p.details:null)}})},c.getCacheAge=function(){var e=null;if(this.response){var i=this.response.headers.get("age");e=i?parseFloat(i):null}return e},c.loadProgressively=function(e,i,s,o,l){o===void 0&&(o=0);var n=new Qs,u=e.body.getReader();return function h(){return u.read().then(function(f){if(f.done)return n.dataLength&&l(i,s,n.flush(),e),Promise.resolve(new ArrayBuffer(0));var p=f.value,_=p.length;return i.loaded+=_,_<o||n.dataLength?(n.push(p),n.dataLength>=o&&l(i,s,n.flush(),e)):l(i,s,p,e),h()}).catch(function(){return Promise.reject()})}()},m}();function gm(m,c){return new self.Request(m.url,c)}var Em=function(m){var c,e;function i(s,o,l){var n;return(n=m.call(this,s)||this).code=void 0,n.details=void 0,n.code=o,n.details=l,n}return e=m,(c=i).prototype=Object.create(e.prototype),c.prototype.constructor=c,Wn(c,e),i}(Bl(Error));let ec=vm;var ym=/\s/;function Vl(){return Vl=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(m[i]=e[i])}return m},Vl.apply(this,arguments)}function tc(m,c){var e=Object.keys(m);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(m);c&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(m,s).enumerable})),e.push.apply(e,i)}return e}function ic(m){for(var c=1;c<arguments.length;c++){var e=arguments[c]!=null?arguments[c]:{};c%2?tc(Object(e),!0).forEach(function(i){bm(m,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(e)):tc(Object(e)).forEach(function(i){Object.defineProperty(m,i,Object.getOwnPropertyDescriptor(e,i))})}return m}function bm(m,c,e){return(c=function(i){var s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i,"string");return typeof s=="symbol"?s:String(s)}(c))in m?Object.defineProperty(m,c,{value:e,enumerable:!0,configurable:!0,writable:!0}):m[c]=e,m}var Tm=ic(ic({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,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:Jd,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Sl,bufferController:Cl,capLevelController:um,fpsController:dm,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,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:_e,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0},{cueHandler:{newCue:function(m,c,e,i){for(var s,o,l,n,u,h=[],f=self.VTTCue||self.TextTrackCue,p=0;p<i.rows.length;p++)if(l=!0,n=0,u="",!(s=i.rows[p]).isEmpty()){for(var _=0;_<s.chars.length;_++)ym.test(s.chars[_].uchar)&&l?n++:(u+=s.chars[_].uchar,l=!1);s.cueStartTime=c,c===e&&(e+=1e-4),n>=16?n--:n++;var S=ai(u.trim()),C=xi(c,e,S);m&&m.cues&&m.cues.getCueById(C)||((o=new f(c,e,S)).id=C,o.line=p+1,o.align="left",o.position=10+Math.min(80,10*Math.floor(8*n/32)),h.push(o))}return m&&h.length&&(h.sort(function(x,W){return x.line==="auto"||W.line==="auto"?0:x.line>8&&W.line>8?W.line-x.line:x.line-W.line}),h.forEach(function(x){return _t(m,x)})),h}},enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:wl,subtitleTrackController:Rl,timelineController:sm,audioStreamController:Bn,audioTrackController:kl,emeController:hm,cmcdController:fm});function rc(m,c){for(var e=0;e<c.length;e++){var i=c[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(m,typeof(s=function(o,l){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var u=n.call(o,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}(i.key,"string"))=="symbol"?s:String(s),i)}var s}var ac=function(){function m(o){o===void 0&&(o={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Pn.EventEmitter,this._autoLevelCapping=void 0,this._maxHdcpLevel=null,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 l=this.config=function(we,je){if((je.liveSyncDurationCount||je.liveMaxLatencyDurationCount)&&(je.liveSyncDuration||je.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(je.liveMaxLatencyDurationCount!==void 0&&(je.liveSyncDurationCount===void 0||je.liveMaxLatencyDurationCount<=je.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(je.liveMaxLatencyDuration!==void 0&&(je.liveSyncDuration===void 0||je.liveMaxLatencyDuration<=je.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return Vl({},we,je)}(m.DefaultConfig,o);this.userConfig=o,(0,O.enableLogs)(l.debug,"Hls instance"),this._autoLevelCapping=-1,l.progressive&&function(we){var je=we.loader;je!==ec&&je!==Jd?(O.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),we.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(we.loader=ec,we.progressive=!0,we.enableSoftwareAES=!0,O.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}(l);var n=l.abrController,u=l.bufferController,h=l.capLevelController,f=l.fpsController,p=this.abrController=new n(this),_=this.bufferController=new u(this),S=this.capLevelController=new h(this),C=new f(this),x=new ze(this),W=new Ut(this),K=this.levelController=new Et(this),ee=new Ot(this),me=new Vi(this.config),Ie=this.streamController=new Tl(this,ee,me);S.setStreamController(Ie),C.setStreamController(Ie);var ye=[x,K,Ie];this.networkControllers=ye;var De=[p,_,S,C,W,ee];this.audioTrackController=this.createController(l.audioTrackController,ye);var qe=l.audioStreamController;qe&&ye.push(new qe(this,ee,me)),this.subtitleTrackController=this.createController(l.subtitleTrackController,ye);var rt=l.subtitleStreamController;rt&&ye.push(new rt(this,ee,me)),this.createController(l.timelineController,De),me.emeController=this.emeController=this.createController(l.emeController,De),this.cmcdController=this.createController(l.cmcdController,De),this.latencyController=this.createController(ri,De),this.coreComponents=De}m.isSupported=function(){return function(){var o=Xa();if(!o)return!1;var l=Za(),n=o&&typeof o.isTypeSupported=="function"&&o.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),u=!l||l.prototype&&typeof l.prototype.appendBuffer=="function"&&typeof l.prototype.remove=="function";return!!n&&!!u}()};var c,e,i,s=m.prototype;return s.createController=function(o,l){if(o){var n=new o(this);return l&&l.push(n),n}return null},s.on=function(o,l,n){n===void 0&&(n=this),this._emitter.on(o,l,n)},s.once=function(o,l,n){n===void 0&&(n=this),this._emitter.once(o,l,n)},s.removeAllListeners=function(o){this._emitter.removeAllListeners(o)},s.off=function(o,l,n,u){n===void 0&&(n=this),this._emitter.off(o,l,n,u)},s.listeners=function(o){return this._emitter.listeners(o)},s.emit=function(o,l,n){return this._emitter.emit(o,l,n)},s.trigger=function(o,l){if(this.config.debug)return this.emit(o,o,l);try{return this.emit(o,o,l)}catch(n){O.logger.error("An internal error happened while handling event "+o+'. Error message: "'+n.message+'". Here is a stacktrace:',n),this.trigger(b.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:o,error:n})}return!1},s.listenerCount=function(o){return this._emitter.listenerCount(o)},s.destroy=function(){O.logger.log("destroy"),this.trigger(b.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(o){return o.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(o){return o.destroy()}),this.coreComponents.length=0},s.attachMedia=function(o){O.logger.log("attachMedia"),this._media=o,this.trigger(b.Events.MEDIA_ATTACHING,{media:o})},s.detachMedia=function(){O.logger.log("detachMedia"),this.trigger(b.Events.MEDIA_DETACHING,void 0),this._media=null},s.loadSource=function(o){this.stopLoad();var l=this.media,n=this.url,u=this.url=M.buildAbsoluteURL(self.location.href,o,{alwaysNormalize:!0});O.logger.log("loadSource:"+u),l&&n&&n!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(l)),this.trigger(b.Events.MANIFEST_LOADING,{url:o})},s.startLoad=function(o){o===void 0&&(o=-1),O.logger.log("startLoad("+o+")"),this.networkControllers.forEach(function(l){l.startLoad(o)})},s.stopLoad=function(){O.logger.log("stopLoad"),this.networkControllers.forEach(function(o){o.stopLoad()})},s.swapAudioCodec=function(){O.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},s.recoverMediaError=function(){O.logger.log("recoverMediaError");var o=this._media;this.detachMedia(),o&&this.attachMedia(o)},s.removeLevel=function(o,l){l===void 0&&(l=0),this.levelController.removeLevel(o,l)},c=m,i=[{key:"version",get:function(){return"1.3.1"}},{key:"Events",get:function(){return b.Events}},{key:"ErrorTypes",get:function(){return P.ErrorTypes}},{key:"ErrorDetails",get:function(){return P.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:Tm},set:function(o){m.defaultConfig=o}}],(e=[{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(o){O.logger.log("set currentLevel:"+o),this.loadLevel=o,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(o){O.logger.log("set nextLevel:"+o),this.levelController.manualLevel=o,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(o){O.logger.log("set loadLevel:"+o),this.levelController.manualLevel=o}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(o){this.levelController.nextLoadLevel=o}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(o){O.logger.log("set firstLevel:"+o),this.levelController.firstLevel=o}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(o){O.logger.log("set startLevel:"+o),o!==-1&&(o=Math.max(o,this.minAutoLevel)),this.levelController.startLevel=o}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(o){var l=!!o;l!==this.config.capLevelToPlayerSize&&(l?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=l)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(o){this._autoLevelCapping!==o&&(O.logger.log("set autoLevelCapping:"+o),this._autoLevelCapping=o)}},{key:"bandwidthEstimate",get:function(){var o=this.abrController.bwEstimator;return o?o.getEstimate():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(o){Fi.indexOf(o)>-1&&(this._maxHdcpLevel=o)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var o=this.levels,l=this.config.minAutoBitrate;if(!o)return 0;for(var n=o.length,u=0;u<n;u++)if(o[u].maxBitrate>=l)return u;return 0}},{key:"maxAutoLevel",get:function(){var o,l=this.levels,n=this.autoLevelCapping,u=this.maxHdcpLevel;if(o=n===-1&&l&&l.length?l.length-1:n,u)for(var h=o;h--;){var f=l[h].attrs["HDCP-LEVEL"];if(f&&f<=u)return h}return o}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(o){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,o)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var o=this.audioTrackController;return o?o.audioTracks:[]}},{key:"audioTrack",get:function(){var o=this.audioTrackController;return o?o.audioTrack:-1},set:function(o){var l=this.audioTrackController;l&&(l.audioTrack=o)}},{key:"subtitleTracks",get:function(){var o=this.subtitleTrackController;return o?o.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var o=this.subtitleTrackController;return o?o.subtitleTrack:-1},set:function(o){var l=this.subtitleTrackController;l&&(l.subtitleTrack=o)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var o=this.subtitleTrackController;return!!o&&o.subtitleDisplay},set:function(o){var l=this.subtitleTrackController;l&&(l.subtitleDisplay=o)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(o){this.config.lowLatencyMode=o}},{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}}])&&rc(c.prototype,e),i&&rc(c,i),Object.defineProperty(c,"prototype",{writable:!1}),m}();ac.defaultConfig=void 0},923:(v,g,E)=>{"use strict";E.r(g),E.d(g,{BaseSegment:()=>de,ElementaryStreamTypes:()=>L,Fragment:()=>he,Part:()=>Y});var L,M=E(965),R=E(945),b=E(408);function P(pe,X){pe.prototype=Object.create(X.prototype),pe.prototype.constructor=pe,O(pe,X)}function O(pe,X){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(oe,z){return oe.__proto__=z,oe},O(pe,X)}function ue(pe,X){for(var oe=0;oe<X.length;oe++){var z=X[oe];z.enumerable=z.enumerable||!1,z.configurable=!0,"value"in z&&(z.writable=!0),Object.defineProperty(pe,typeof(be=function(ke,He){if(typeof ke!="object"||ke===null)return ke;var Z=ke[Symbol.toPrimitive];if(Z!==void 0){var I=Z.call(ke,He);if(typeof I!="object")return I;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(ke)}(z.key,"string"))=="symbol"?be:String(be),z)}var be}function Q(pe,X,oe){return X&&ue(pe.prototype,X),oe&&ue(pe,oe),Object.defineProperty(pe,"prototype",{writable:!1}),pe}(function(pe){pe.AUDIO="audio",pe.VIDEO="video",pe.AUDIOVIDEO="audiovideo"})(L||(L={}));var de=function(){function pe(X){var oe;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((oe={})[L.AUDIO]=null,oe[L.VIDEO]=null,oe[L.AUDIOVIDEO]=null,oe),this.baseurl=X}return pe.prototype.setByteRange=function(X,oe){var z=X.split("@",2),be=[];z.length===1?be[0]=oe?oe.byteRangeEndOffset:0:be[0]=parseInt(z[1]),be[1]=parseInt(z[0])+be[0],this._byteRange=be},Q(pe,[{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=(0,R.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(X){this._url=X}}]),pe}(),he=function(pe){function X(z,be){var ke;return(ke=pe.call(this,be)||this)._decryptdata=null,ke.rawProgramDateTime=null,ke.programDateTime=null,ke.tagList=[],ke.duration=0,ke.sn=0,ke.levelkeys=void 0,ke.type=void 0,ke.loader=null,ke.keyLoader=null,ke.level=-1,ke.cc=0,ke.startPTS=void 0,ke.endPTS=void 0,ke.appendedPTS=void 0,ke.startDTS=void 0,ke.endDTS=void 0,ke.start=0,ke.deltaPTS=void 0,ke.maxStartPTS=void 0,ke.minEndPTS=void 0,ke.stats=new b.LoadStats,ke.urlId=0,ke.data=void 0,ke.bitrateTest=!1,ke.title=null,ke.initSegment=null,ke.endList=void 0,ke.type=z,ke}P(X,pe);var oe=X.prototype;return oe.setKeyFormat=function(z){if(this.levelkeys){var be=this.levelkeys[z];be&&!this._decryptdata&&(this._decryptdata=be.getDecryptData(this.sn))}},oe.abortRequests=function(){var z,be;(z=this.loader)===null||z===void 0||z.abort(),(be=this.keyLoader)===null||be===void 0||be.abort()},oe.setElementaryStreamInfo=function(z,be,ke,He,Z,I){I===void 0&&(I=!1);var q=this.elementaryStreams,N=q[z];N?(N.startPTS=Math.min(N.startPTS,be),N.endPTS=Math.max(N.endPTS,ke),N.startDTS=Math.min(N.startDTS,He),N.endDTS=Math.max(N.endDTS,Z)):q[z]={startPTS:be,endPTS:ke,startDTS:He,endDTS:Z,partial:I}},oe.clearElementaryStreamInfo=function(){var z=this.elementaryStreams;z[L.AUDIO]=null,z[L.VIDEO]=null,z[L.AUDIOVIDEO]=null},Q(X,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var z=this.levelkeys.identity;if(z)this._decryptdata=z.getDecryptData(this.sn);else{var be=Object.keys(this.levelkeys);if(be.length===1)return this._decryptdata=this.levelkeys[be[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!(0,M.isFiniteNumber)(this.programDateTime))return null;var z=(0,M.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*z}},{key:"encrypted",get:function(){var z;if((z=this._decryptdata)!==null&&z!==void 0&&z.encrypted)return!0;if(this.levelkeys){var be=Object.keys(this.levelkeys),ke=be.length;if(ke>1||ke===1&&this.levelkeys[be[0]].encrypted)return!0}return!1}}]),X}(de),Y=function(pe){function X(oe,z,be,ke,He){var Z;(Z=pe.call(this,be)||this).fragOffset=0,Z.duration=0,Z.gap=!1,Z.independent=!1,Z.relurl=void 0,Z.fragment=void 0,Z.index=void 0,Z.stats=new b.LoadStats,Z.duration=oe.decimalFloatingPoint("DURATION"),Z.gap=oe.bool("GAP"),Z.independent=oe.bool("INDEPENDENT"),Z.relurl=oe.enumeratedString("URI"),Z.fragment=z,Z.index=ke;var I=oe.enumeratedString("BYTERANGE");return I&&Z.setByteRange(I,He),He&&(Z.fragOffset=He.fragOffset+He.duration),Z}return P(X,pe),Q(X,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var oe=this.elementaryStreams;return!!(oe.audio||oe.video||oe.audiovideo)}}]),X}(de)},408:(v,g,E)=>{"use strict";E.r(g),E.d(g,{LoadStats:()=>L});var L=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}}},965:(v,g,E)=>{"use strict";E.r(g),E.d(g,{MAX_SAFE_INTEGER:()=>M,isFiniteNumber:()=>L});var L=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},M=Number.MAX_SAFE_INTEGER||9007199254740991},524:(v,g,E)=>{"use strict";E.r(g),E.d(g,{default:()=>oe,flushTextTrackMetadataCueSamples:()=>be,flushTextTrackUserdataCueSamples:()=>ke,normalizePts:()=>z});var L=E(965);let M=function(){function I(){}return I.getSilentFrame=function(q,N){if(q==="mp4a.40.2"){if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===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(N===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])}else{if(N===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(N===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(N===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])}},I}();var R=Math.pow(2,32)-1,b=function(){function I(){}return I.init=function(){var q;for(q in I.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:[]},I.types)I.types.hasOwnProperty(q)&&(I.types[q]=[q.charCodeAt(0),q.charCodeAt(1),q.charCodeAt(2),q.charCodeAt(3)]);var N=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]),fe=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]);I.HDLR_TYPES={video:N,audio:fe};var _e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),te=new Uint8Array([0,0,0,0,0,0,0,0]);I.STTS=I.STSC=I.STCO=te,I.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),I.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),I.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),I.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var ie=new Uint8Array([105,115,111,109]),Re=new Uint8Array([97,118,99,49]),Pe=new Uint8Array([0,0,0,1]);I.FTYP=I.box(I.types.ftyp,ie,Pe,ie,Re),I.DINF=I.box(I.types.dinf,I.box(I.types.dref,_e))},I.box=function(q){for(var N=8,fe=arguments.length,_e=new Array(fe>1?fe-1:0),te=1;te<fe;te++)_e[te-1]=arguments[te];for(var ie=_e.length,Re=ie;ie--;)N+=_e[ie].byteLength;var Pe=new Uint8Array(N);for(Pe[0]=N>>24&255,Pe[1]=N>>16&255,Pe[2]=N>>8&255,Pe[3]=255&N,Pe.set(q,4),ie=0,N=8;ie<Re;ie++)Pe.set(_e[ie],N),N+=_e[ie].byteLength;return Pe},I.hdlr=function(q){return I.box(I.types.hdlr,I.HDLR_TYPES[q])},I.mdat=function(q){return I.box(I.types.mdat,q)},I.mdhd=function(q,N){N*=q;var fe=Math.floor(N/(R+1)),_e=Math.floor(N%(R+1));return I.box(I.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,q>>24&255,q>>16&255,q>>8&255,255&q,fe>>24,fe>>16&255,fe>>8&255,255&fe,_e>>24,_e>>16&255,_e>>8&255,255&_e,85,196,0,0]))},I.mdia=function(q){return I.box(I.types.mdia,I.mdhd(q.timescale,q.duration),I.hdlr(q.type),I.minf(q))},I.mfhd=function(q){return I.box(I.types.mfhd,new Uint8Array([0,0,0,0,q>>24,q>>16&255,q>>8&255,255&q]))},I.minf=function(q){return q.type==="audio"?I.box(I.types.minf,I.box(I.types.smhd,I.SMHD),I.DINF,I.stbl(q)):I.box(I.types.minf,I.box(I.types.vmhd,I.VMHD),I.DINF,I.stbl(q))},I.moof=function(q,N,fe){return I.box(I.types.moof,I.mfhd(q),I.traf(fe,N))},I.moov=function(q){for(var N=q.length,fe=[];N--;)fe[N]=I.trak(q[N]);return I.box.apply(null,[I.types.moov,I.mvhd(q[0].timescale,q[0].duration)].concat(fe).concat(I.mvex(q)))},I.mvex=function(q){for(var N=q.length,fe=[];N--;)fe[N]=I.trex(q[N]);return I.box.apply(null,[I.types.mvex].concat(fe))},I.mvhd=function(q,N){N*=q;var fe=Math.floor(N/(R+1)),_e=Math.floor(N%(R+1)),te=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,q>>24&255,q>>16&255,q>>8&255,255&q,fe>>24,fe>>16&255,fe>>8&255,255&fe,_e>>24,_e>>16&255,_e>>8&255,255&_e,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 I.box(I.types.mvhd,te)},I.sdtp=function(q){var N,fe,_e=q.samples||[],te=new Uint8Array(4+_e.length);for(N=0;N<_e.length;N++)fe=_e[N].flags,te[N+4]=fe.dependsOn<<4|fe.isDependedOn<<2|fe.hasRedundancy;return I.box(I.types.sdtp,te)},I.stbl=function(q){return I.box(I.types.stbl,I.stsd(q),I.box(I.types.stts,I.STTS),I.box(I.types.stsc,I.STSC),I.box(I.types.stsz,I.STSZ),I.box(I.types.stco,I.STCO))},I.avc1=function(q){var N,fe,_e,te=[],ie=[];for(N=0;N<q.sps.length;N++)_e=(fe=q.sps[N]).byteLength,te.push(_e>>>8&255),te.push(255&_e),te=te.concat(Array.prototype.slice.call(fe));for(N=0;N<q.pps.length;N++)_e=(fe=q.pps[N]).byteLength,ie.push(_e>>>8&255),ie.push(255&_e),ie=ie.concat(Array.prototype.slice.call(fe));var Re=I.box(I.types.avcC,new Uint8Array([1,te[3],te[4],te[5],255,224|q.sps.length].concat(te).concat([q.pps.length]).concat(ie))),Pe=q.width,Fe=q.height,Se=q.pixelRatio[0],Ye=q.pixelRatio[1];return I.box(I.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,Pe>>8&255,255&Pe,Fe>>8&255,255&Fe,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]),Re,I.box(I.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),I.box(I.types.pasp,new Uint8Array([Se>>24,Se>>16&255,Se>>8&255,255&Se,Ye>>24,Ye>>16&255,Ye>>8&255,255&Ye])))},I.esds=function(q){var N=q.config.length;return new Uint8Array([0,0,0,0,3,23+N,0,1,0,4,15+N,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([N]).concat(q.config).concat([6,1,2]))},I.mp4a=function(q){var N=q.samplerate;return I.box(I.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,q.channelCount,0,16,0,0,0,0,N>>8&255,255&N,0,0]),I.box(I.types.esds,I.esds(q)))},I.mp3=function(q){var N=q.samplerate;return I.box(I.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,q.channelCount,0,16,0,0,0,0,N>>8&255,255&N,0,0]))},I.stsd=function(q){return q.type==="audio"?q.segmentCodec==="mp3"&&q.codec==="mp3"?I.box(I.types.stsd,I.STSD,I.mp3(q)):I.box(I.types.stsd,I.STSD,I.mp4a(q)):I.box(I.types.stsd,I.STSD,I.avc1(q))},I.tkhd=function(q){var N=q.id,fe=q.duration*q.timescale,_e=q.width,te=q.height,ie=Math.floor(fe/(R+1)),Re=Math.floor(fe%(R+1));return I.box(I.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,255&N,0,0,0,0,ie>>24,ie>>16&255,ie>>8&255,255&ie,Re>>24,Re>>16&255,Re>>8&255,255&Re,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,_e>>8&255,255&_e,0,0,te>>8&255,255&te,0,0]))},I.traf=function(q,N){var fe=I.sdtp(q),_e=q.id,te=Math.floor(N/(R+1)),ie=Math.floor(N%(R+1));return I.box(I.types.traf,I.box(I.types.tfhd,new Uint8Array([0,0,0,0,_e>>24,_e>>16&255,_e>>8&255,255&_e])),I.box(I.types.tfdt,new Uint8Array([1,0,0,0,te>>24,te>>16&255,te>>8&255,255&te,ie>>24,ie>>16&255,ie>>8&255,255&ie])),I.trun(q,fe.length+16+20+8+16+8+8),fe)},I.trak=function(q){return q.duration=q.duration||4294967295,I.box(I.types.trak,I.tkhd(q),I.mdia(q))},I.trex=function(q){var N=q.id;return I.box(I.types.trex,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,255&N,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},I.trun=function(q,N){var fe,_e,te,ie,Re,Pe,Fe=q.samples||[],Se=Fe.length,Ye=12+16*Se,ot=new Uint8Array(Ye);for(N+=8+Ye,ot.set([q.type==="video"?1:0,0,15,1,Se>>>24&255,Se>>>16&255,Se>>>8&255,255&Se,N>>>24&255,N>>>16&255,N>>>8&255,255&N],0),fe=0;fe<Se;fe++)te=(_e=Fe[fe]).duration,ie=_e.size,Re=_e.flags,Pe=_e.cts,ot.set([te>>>24&255,te>>>16&255,te>>>8&255,255&te,ie>>>24&255,ie>>>16&255,ie>>>8&255,255&ie,Re.isLeading<<2|Re.dependsOn,Re.isDependedOn<<6|Re.hasRedundancy<<4|Re.paddingValue<<1|Re.isNonSync,61440&Re.degradPrio,15&Re.degradPrio,Pe>>>24&255,Pe>>>16&255,Pe>>>8&255,255&Pe],12+16*fe);return I.box(I.types.trun,ot)},I.initSegment=function(q){I.types||I.init();var N=I.moov(q),fe=new Uint8Array(I.FTYP.byteLength+N.byteLength);return fe.set(I.FTYP),fe.set(N,I.FTYP.byteLength),fe},I}();b.types=void 0,b.HDLR_TYPES=void 0,b.STTS=void 0,b.STSC=void 0,b.STCO=void 0,b.STSZ=void 0,b.VMHD=void 0,b.SMHD=void 0,b.STSD=void 0,b.FTYP=void 0,b.DINF=void 0;let P=b;var O=E(851),ue=E(973),Q=E(93),de=E(308),he=E(673);function Y(){return Y=Object.assign?Object.assign.bind():function(I){for(var q=1;q<arguments.length;q++){var N=arguments[q];for(var fe in N)Object.prototype.hasOwnProperty.call(N,fe)&&(I[fe]=N[fe])}return I},Y.apply(this,arguments)}var pe=null,X=null,oe=function(){function I(N,fe,_e,te){if(te===void 0&&(te=""),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=fe,this.typeSupported=_e,this.ISGenerated=!1,pe===null){var ie=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);pe=ie?parseInt(ie[1]):0}if(X===null){var Re=navigator.userAgent.match(/Safari\/(\d+)/i);X=Re?parseInt(Re[1]):0}}var q=I.prototype;return q.destroy=function(){},q.resetTimeStamp=function(N){Q.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=N},q.resetNextTimestamp=function(){Q.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},q.resetInitSegment=function(){Q.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},q.getVideoStartPts=function(N){var fe=!1,_e=N.reduce(function(te,ie){var Re=ie.pts-te;return Re<-4294967296?(fe=!0,z(te,ie.pts)):Re>0?te:ie.pts},N[0].pts);return fe&&Q.logger.debug("PTS rollover detected"),_e},q.remux=function(N,fe,_e,te,ie,Re,Pe,Fe){var Se,Ye,ot,le,Ee,U,ve=ie,Le=ie,Ne=N.pid>-1,Ue=fe.pid>-1,Ge=fe.samples.length,Te=N.samples.length>0,xe=Pe&&Ge>0||Ge>1;if((!Ne||Te)&&(!Ue||xe)||this.ISGenerated||Pe){this.ISGenerated||(ot=this.generateIS(N,fe,ie));var ze,it=this.isVideoContiguous,_t=-1;if(xe&&(_t=function(Rt){for(var At=0;At<Rt.length;At++)if(Rt[At].key)return At;return-1}(fe.samples),!it&&this.config.forceKeyFrameOnDiscontinuity))if(U=!0,_t>0){Q.logger.warn("[mp4-remuxer]: Dropped "+_t+" out of "+Ge+" video samples due to a missing keyframe");var gt=this.getVideoStartPts(fe.samples);fe.samples=fe.samples.slice(_t),fe.dropped+=_t,ze=Le+=(fe.samples[0].pts-gt)/fe.inputTimeScale}else _t===-1&&(Q.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ge+" video samples"),U=!1);if(this.ISGenerated){if(Te&&xe){var Lt=this.getVideoStartPts(fe.samples),lt=(z(N.samples[0].pts,Lt)-Lt)/fe.inputTimeScale;ve+=Math.max(0,lt),Le+=Math.max(0,-lt)}if(Te){if(N.samplerate||(Q.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),ot=this.generateIS(N,fe,ie)),Ye=this.remuxAudio(N,ve,this.isAudioContiguous,Re,Ue||xe||Fe===de.PlaylistLevelType.AUDIO?Le:void 0),xe){var It=Ye?Ye.endPTS-Ye.startPTS:0;fe.inputTimeScale||(Q.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),ot=this.generateIS(N,fe,ie)),Se=this.remuxVideo(fe,Le,it,It)}}else xe&&(Se=this.remuxVideo(fe,Le,it,0));Se&&(Se.firstKeyFrame=_t,Se.independent=_t!==-1,Se.firstKeyFramePTS=ze)}}return this.ISGenerated&&(_e.samples.length&&(Ee=be(_e,ie,this._initPTS,this._initDTS)),te.samples.length&&(le=ke(te,ie,this._initPTS))),{audio:Ye,video:Se,initSegment:ot,independent:U,text:le,id3:Ee}},q.generateIS=function(N,fe,_e){var te,ie,Re,Pe=N.samples,Fe=fe.samples,Se=this.typeSupported,Ye={},ot=!(0,L.isFiniteNumber)(this._initPTS),le="audio/mp4";if(ot&&(te=ie=1/0),N.config&&Pe.length&&(N.timescale=N.samplerate,N.segmentCodec==="mp3"&&(Se.mpeg?(le="audio/mpeg",N.codec=""):Se.mp3&&(N.codec="mp3")),Ye.audio={id:"audio",container:le,codec:N.codec,initSegment:N.segmentCodec==="mp3"&&Se.mpeg?new Uint8Array(0):P.initSegment([N]),metadata:{channelCount:N.channelCount}},ot&&(Re=N.inputTimeScale,te=ie=Pe[0].pts-Math.round(Re*_e))),fe.sps&&fe.pps&&Fe.length&&(fe.timescale=fe.inputTimeScale,Ye.video={id:"main",container:"video/mp4",codec:fe.codec,initSegment:P.initSegment([fe]),metadata:{width:fe.width,height:fe.height}},ot)){Re=fe.inputTimeScale;var Ee=this.getVideoStartPts(Fe),U=Math.round(Re*_e);ie=Math.min(ie,z(Fe[0].dts,Ee)-U),te=Math.min(te,Ee-U)}if(Object.keys(Ye).length)return this.ISGenerated=!0,ot&&(this._initPTS=te,this._initDTS=ie),{tracks:Ye,initPTS:te,timescale:Re}},q.remuxVideo=function(N,fe,_e,te){var ie,Re,Pe=N.inputTimeScale,Fe=N.samples,Se=[],Ye=Fe.length,ot=this._initPTS,le=this.nextAvcDts,Ee=8,U=this.videoSampleDuration,ve=Number.POSITIVE_INFINITY,Le=Number.NEGATIVE_INFINITY,Ne=!1;_e&&le!==null||(le=fe*Pe-(Fe[0].pts-z(Fe[0].dts,Fe[0].pts)));for(var Ue=0;Ue<Ye;Ue++){var Ge=Fe[Ue];Ge.pts=z(Ge.pts-ot,le),Ge.dts=z(Ge.dts-ot,le),Ge.dts<Fe[Ue>0?Ue-1:Ue].dts&&(Ne=!0)}Ne&&Fe.sort(function(di,Vi){var gr=di.dts-Vi.dts,Bi=di.pts-Vi.pts;return gr||Bi}),ie=Fe[0].dts;var Te=Fe[Fe.length-1].dts-ie,xe=Te?Math.round(Te/(Ye-1)):U||N.inputTimeScale/30;if(_e){var ze=ie-le,it=ze>xe,_t=ze<-1;if((it||_t)&&(it?Q.logger.warn("AVC: "+(0,he.toMsFromMpegTsClock)(ze,!0)+" ms ("+ze+"dts) hole between fragments detected, filling it"):Q.logger.warn("AVC: "+(0,he.toMsFromMpegTsClock)(-ze,!0)+" ms ("+ze+"dts) overlapping between fragments detected"),!_t||le>Fe[0].pts)){ie=le;var gt=Fe[0].pts-ze;Fe[0].dts=ie,Fe[0].pts=gt,Q.logger.log("Video: First PTS/DTS adjusted: "+(0,he.toMsFromMpegTsClock)(gt,!0)+"/"+(0,he.toMsFromMpegTsClock)(ie,!0)+", delta: "+(0,he.toMsFromMpegTsClock)(ze,!0)+" ms")}}ie=Math.max(0,ie);for(var Lt=0,lt=0,It=0;It<Ye;It++){for(var Rt=Fe[It],At=Rt.units,pt=At.length,Ut=0,Vt=0;Vt<pt;Vt++)Ut+=At[Vt].data.length;lt+=Ut,Lt+=pt,Rt.length=Ut,Rt.dts=Math.max(Rt.dts,ie),ve=Math.min(Rt.pts,ve),Le=Math.max(Rt.pts,Le)}Re=Fe[Ye-1].dts;var ri,vi=lt+4*Lt+8;try{ri=new Uint8Array(vi)}catch{return void this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:ue.ErrorTypes.MUX_ERROR,details:ue.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:vi,reason:"fail allocating video mdat "+vi})}var Qt=new DataView(ri.buffer);Qt.setUint32(0,vi),ri.set(P.types.mdat,4);for(var Fi=!1,se=Number.POSITIVE_INFINITY,j=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY,G=Number.NEGATIVE_INFINITY,H=0;H<Ye;H++){for(var $=Fe[H],re=$.units,ae=0,Ae=0,Ce=re.length;Ae<Ce;Ae++){var Oe=re[Ae],Ke=Oe.data,Qe=Oe.data.byteLength;Qt.setUint32(Ee,Qe),Ee+=4,ri.set(Ke,Ee),Ee+=Qe,ae+=4+Qe}var We=void 0;if(H<Ye-1)U=Fe[H+1].dts-$.dts,We=Fe[H+1].pts-$.pts;else{var at=this.config,Et=H>0?$.dts-Fe[H-1].dts:xe;if(We=H>0?$.pts-Fe[H-1].pts:xe,at.stretchShortVideoTrack&&this.nextAudioPts!==null){var Ot=Math.floor(at.maxBufferHole*Pe),Ze=(te?ve+te*Pe:this.nextAudioPts)-$.pts;Ze>Ot?((U=Ze-Et)<0?U=Et:Fi=!0,Q.logger.log("[mp4-remuxer]: It is approximately "+Ze/90+" ms to the next segment; using duration "+U/90+" ms for the last video frame.")):U=Et}else U=Et}var Ht=Math.round($.pts-$.dts);se=Math.min(se,U),w=Math.max(w,U),j=Math.min(j,We),G=Math.max(G,We),Se.push(new He($.key,U,ae,Ht))}if(Se.length){if(pe){if(pe<70){var gi=Se[0].flags;gi.dependsOn=2,gi.isNonSync=0}}else if(X&&G-j<w-se&&xe/w<.025&&Se[0].cts===0){Q.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var Yt=ie,jt=0,Xt=Se.length;jt<Xt;jt++){var ut=Yt+Se[jt].duration,Li=Yt+Se[jt].cts;if(jt<Xt-1){var tr=ut+Se[jt+1].cts;Se[jt].duration=tr-Li}else Se[jt].duration=jt?Se[jt-1].duration:xe;Se[jt].cts=0,Yt=ut}}}U=Fi||!U?xe:U,this.nextAvcDts=le=Re+U,this.videoSampleDuration=U,this.isVideoContiguous=!0;var zt={data1:P.moof(N.sequenceNumber++,ie,Y({},N,{samples:Se})),data2:ri,startPTS:ve/Pe,endPTS:(Le+U)/Pe,startDTS:ie/Pe,endDTS:le/Pe,type:"video",hasAudio:!1,hasVideo:!0,nb:Se.length,dropped:N.dropped};return N.samples=[],N.dropped=0,zt},q.remuxAudio=function(N,fe,_e,te,ie){var Re=N.inputTimeScale,Pe=Re/(N.samplerate?N.samplerate:Re),Fe=N.segmentCodec==="aac"?1024:1152,Se=Fe*Pe,Ye=this._initPTS,ot=N.segmentCodec==="mp3"&&this.typeSupported.mpeg,le=[],Ee=ie!==void 0,U=N.samples,ve=ot?0:8,Le=this.nextAudioPts||-1,Ne=fe*Re;if(this.isAudioContiguous=_e=_e||U.length&&Le>0&&(te&&Math.abs(Ne-Le)<9e3||Math.abs(z(U[0].pts-Ye,Ne)-Le)<20*Se),U.forEach(function(Ae){Ae.pts=z(Ae.pts-Ye,Ne)}),!_e||Le<0){if(U=U.filter(function(Ae){return Ae.pts>=0}),!U.length)return;Le=ie===0?0:te&&!Ee?Math.max(0,Ne):U[0].pts}if(N.segmentCodec==="aac")for(var Ue=this.config.maxAudioFramesDrift,Ge=0,Te=Le;Ge<U.length;Ge++){var xe=U[Ge],ze=xe.pts,it=ze-Te,_t=Math.abs(1e3*it/Re);if(it<=-Ue*Se&&Ee)Ge===0&&(Q.logger.warn("Audio frame @ "+(ze/Re).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*it/Re)+" ms."),this.nextAudioPts=Le=Te=ze);else if(it>=Ue*Se&&_t<1e4&&Ee){var gt=Math.round(it/Se);(Te=ze-gt*Se)<0&&(gt--,Te+=Se),Ge===0&&(this.nextAudioPts=Le=Te),Q.logger.warn("[mp4-remuxer]: Injecting "+gt+" audio frame @ "+(Te/Re).toFixed(3)+"s due to "+Math.round(1e3*it/Re)+" ms gap.");for(var Lt=0;Lt<gt;Lt++){var lt=Math.max(Te,0),It=M.getSilentFrame(N.manifestCodec||N.codec,N.channelCount);It||(Q.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),It=xe.unit.subarray()),U.splice(Ge,0,{unit:It,pts:lt}),Te+=Se,Ge++}}xe.pts=Te,Te+=Se}for(var Rt,At=null,pt=null,Ut=0,Vt=U.length;Vt--;)Ut+=U[Vt].unit.byteLength;for(var ri=0,vi=U.length;ri<vi;ri++){var Qt=U[ri],Fi=Qt.unit,se=Qt.pts;if(pt!==null)le[ri-1].duration=Math.round((se-pt)/Pe);else{if(_e&&N.segmentCodec==="aac"&&(se=Le),At=se,!(Ut>0))return;Ut+=ve;try{Rt=new Uint8Array(Ut)}catch{return void this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:ue.ErrorTypes.MUX_ERROR,details:ue.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ut,reason:"fail allocating audio mdat "+Ut})}ot||(new DataView(Rt.buffer).setUint32(0,Ut),Rt.set(P.types.mdat,4))}Rt.set(Fi,ve);var j=Fi.byteLength;ve+=j,le.push(new He(!0,Fe,j,0)),pt=se}var w=le.length;if(w){var G=le[le.length-1];this.nextAudioPts=Le=pt+Pe*G.duration;var H=ot?new Uint8Array(0):P.moof(N.sequenceNumber++,At/Pe,Y({},N,{samples:le}));N.samples=[];var $=At/Re,re=Le/Re,ae={data1:H,data2:Rt,startPTS:$,endPTS:re,startDTS:$,endDTS:re,type:"audio",hasAudio:!0,hasVideo:!1,nb:w};return this.isAudioContiguous=!0,ae}},q.remuxEmptyAudio=function(N,fe,_e,te){var ie=N.inputTimeScale,Re=ie/(N.samplerate?N.samplerate:ie),Pe=this.nextAudioPts,Fe=(Pe!==null?Pe:te.startDTS*ie)+this._initDTS,Se=te.endDTS*ie+this._initDTS,Ye=1024*Re,ot=Math.ceil((Se-Fe)/Ye),le=M.getSilentFrame(N.manifestCodec||N.codec,N.channelCount);if(Q.logger.warn("[mp4-remuxer]: remux empty Audio"),le){for(var Ee=[],U=0;U<ot;U++){var ve=Fe+U*Ye;Ee.push({unit:le,pts:ve,dts:ve})}return N.samples=Ee,this.remuxAudio(N,fe,_e,!1)}Q.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},I}();function z(I,q){var N;if(q===null)return I;for(N=q<I?-8589934592:8589934592;Math.abs(I-q)>4294967296;)I+=N;return I}function be(I,q,N,fe){var _e=I.samples.length;if(_e){for(var te=I.inputTimeScale,ie=0;ie<_e;ie++){var Re=I.samples[ie];Re.pts=z(Re.pts-N,q*te)/te,Re.dts=z(Re.dts-fe,q*te)/te}var Pe=I.samples;return I.samples=[],{samples:Pe}}}function ke(I,q,N){var fe=I.samples.length;if(fe){for(var _e=I.inputTimeScale,te=0;te<fe;te++){var ie=I.samples[te];ie.pts=z(ie.pts-N,q*_e)/_e}I.samples.sort(function(Pe,Fe){return Pe.pts-Fe.pts});var Re=I.samples;return I.samples=[],{samples:Re}}}var He=function(I,q,N,fe){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=q,this.size=N,this.cts=fe,this.flags=new Z(I)},Z=function(I){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=I?2:1,this.isNonSync=I?0:1}},856:(v,g,E)=>{"use strict";var L;E.r(g),E.d(g,{MetadataSchema:()=>L}),function(M){M.audioId3="org.id3",M.dateRange="com.apple.quicktime.HLS",M.emsg="https://aomedia.org/emsg/ID3"}(L||(L={}))},308:(v,g,E)=>{"use strict";var L,M;E.r(g),E.d(g,{PlaylistContextType:()=>L,PlaylistLevelType:()=>M}),function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"}(L||(L={})),function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"}(M||(M={}))},300:(v,g,E)=>{"use strict";E.r(g),E.d(g,{default:()=>L});let L={hexDump:function(M){for(var R="",b=0;b<M.length;b++){var P=M[b].toString(16);P.length<2&&(P="0"+P),R+=P}return R}}},93:(v,g,E)=>{"use strict";E.r(g),E.d(g,{enableLogs:()=>P,logger:()=>O});var L=function(){},M={trace:L,debug:L,log:L,warn:L,info:L,error:L},R=M;function b(ue){var Q=self.console[ue];return Q?Q.bind(self.console,"["+ue+"] >"):L}function P(ue,Q){if(self.console&&ue===!0||typeof ue=="object"){(function(de){for(var he=arguments.length,Y=new Array(he>1?he-1:0),pe=1;pe<he;pe++)Y[pe-1]=arguments[pe];Y.forEach(function(X){R[X]=de[X]?de[X].bind(de):b(X)})})(ue,"debug","log","info","warn","error");try{R.log('Debug logs enabled for "'+Q+'"')}catch{R=M}}else R=M}var O=M},63:(v,g,E)=>{"use strict";E.r(g),E.d(g,{RemuxerTrackIdConfig:()=>Q,appendUint8Array:()=>_e,bin2str:()=>de,computeRawDurationFromSamples:()=>q,discardEPB:()=>Pe,findBox:()=>oe,getDuration:()=>I,getStartDTS:()=>Z,mp4Box:()=>Se,mp4pssh:()=>Ye,offsetStartDTS:()=>N,parseEmsg:()=>Fe,parseInitSegment:()=>be,parsePssh:()=>ot,parseSEIMessageFromNALu:()=>Re,parseSamples:()=>te,parseSegmentIndex:()=>z,parseSinf:()=>He,patchEncyptionData:()=>ke,readSint32:()=>pe,readUint16:()=>he,readUint32:()=>Y,segmentValidRange:()=>fe,writeUint32:()=>X});var L=E(923),M=E(145),R=E(181),b=E(93),P=E(300),O=Math.pow(2,32)-1,ue=[].push,Q={video:1,audio:2,id3:3,text:4};function de(le){return String.fromCharCode.apply(null,le)}function he(le,Ee){var U=le[Ee]<<8|le[Ee+1];return U<0?65536+U:U}function Y(le,Ee){var U=pe(le,Ee);return U<0?4294967296+U:U}function pe(le,Ee){return le[Ee]<<24|le[Ee+1]<<16|le[Ee+2]<<8|le[Ee+3]}function X(le,Ee,U){le[Ee]=U>>24,le[Ee+1]=U>>16&255,le[Ee+2]=U>>8&255,le[Ee+3]=255&U}function oe(le,Ee){var U=[];if(!Ee.length)return U;for(var ve=le.byteLength,Le=0;Le<ve;){var Ne=Y(le,Le),Ue=Ne>1?Le+Ne:ve;if(de(le.subarray(Le+4,Le+8))===Ee[0])if(Ee.length===1)U.push(le.subarray(Le+8,Ue));else{var Ge=oe(le.subarray(Le+8,Ue),Ee.slice(1));Ge.length&&ue.apply(U,Ge)}Le=Ue}return U}function z(le){var Ee=[],U=le[0],ve=8,Le=Y(le,ve);ve+=4,ve+=U===0?8:16,ve+=2;var Ne=le.length+0,Ue=he(le,ve);ve+=2;for(var Ge=0;Ge<Ue;Ge++){var Te=ve,xe=Y(le,Te);Te+=4;var ze=2147483647&xe;if((2147483648&xe)>>>31==1)return console.warn("SIDX has hierarchical references (not supported)"),null;var it=Y(le,Te);Te+=4,Ee.push({referenceSize:ze,subsegmentDuration:it,info:{duration:it/Le,start:Ne,end:Ne+ze-1}}),Ne+=ze,ve=Te+=4}return{earliestPresentationTime:0,timescale:Le,version:U,referencesCount:Ue,references:Ee}}function be(le){for(var Ee=[],U=oe(le,["moov","trak"]),ve=0;ve<U.length;ve++){var Le=U[ve],Ne=oe(Le,["tkhd"])[0];if(Ne){var Ue=Ne[0],Ge=Ue===0?12:20,Te=Y(Ne,Ge),xe=oe(Le,["mdia","mdhd"])[0];if(xe){var ze=Y(xe,Ge=(Ue=xe[0])===0?12:20),it=oe(Le,["mdia","hdlr"])[0];if(it){var _t=de(it.subarray(8,12)),gt={soun:L.ElementaryStreamTypes.AUDIO,vide:L.ElementaryStreamTypes.VIDEO}[_t];if(gt){var Lt=oe(Le,["mdia","minf","stbl","stsd"])[0],lt=void 0;Lt&&(lt=de(Lt.subarray(12,16))),Ee[Te]={timescale:ze,type:gt},Ee[gt]={timescale:ze,id:Te,codec:lt}}}}}}return oe(le,["moov","mvex","trex"]).forEach(function(It){var Rt=Y(It,4),At=Ee[Rt];At&&(At.default={duration:Y(It,12),flags:Y(It,20)})}),Ee}function ke(le,Ee){if(!le||!Ee)return le;var U=Ee.keyId;return U&&Ee.isCommonEncryption&&oe(le,["moov","trak"]).forEach(function(ve){var Le=oe(ve,["mdia","minf","stbl","stsd"])[0].subarray(8),Ne=oe(Le,["enca"]),Ue=Ne.length>0;Ue||(Ne=oe(Le,["encv"])),Ne.forEach(function(Ge){oe(Ue?Ge.subarray(28):Ge.subarray(78),["sinf"]).forEach(function(Te){var xe=He(Te);if(xe){var ze=xe.subarray(8,24);ze.some(function(it){return it!==0})||(b.logger.log("[eme] Patching keyId in 'enc"+(Ue?"a":"v")+">sinf>>tenc' box: "+P.default.hexDump(ze)+" -> "+P.default.hexDump(U)),xe.set(U,8))}})})}),le}function He(le){var Ee=oe(le,["schm"])[0];if(Ee){var U=de(Ee.subarray(4,8));if(U==="cbcs"||U==="cenc")return oe(le,["schi","tenc"])[0]}return b.logger.error("[eme] missing 'schm' box"),null}function Z(le,Ee){return oe(Ee,["moof","traf"]).reduce(function(U,ve){var Le=oe(ve,["tfdt"])[0],Ne=Le[0],Ue=oe(ve,["tfhd"]).reduce(function(Ge,Te){var xe=Y(Te,4),ze=le[xe];if(ze){var it=Y(Le,4);Ne===1&&(it*=Math.pow(2,32),it+=Y(Le,8));var _t=it/(ze.timescale||9e4);if(isFinite(_t)&&(Ge===null||_t<Ge))return _t}return Ge},null);return Ue!==null&&isFinite(Ue)&&(U===null||Ue<U)?Ue:U},null)||0}function I(le,Ee){for(var U=0,ve=0,Le=0,Ne=oe(le,["moof","traf"]),Ue=0;Ue<Ne.length;Ue++){var Ge=Ne[Ue],Te=oe(Ge,["tfhd"])[0],xe=Ee[Y(Te,4)];if(xe){var ze=xe.default,it=Y(Te,0)|(ze==null?void 0:ze.flags),_t=ze==null?void 0:ze.duration;8&it&&(_t=Y(Te,2&it?12:8));for(var gt=xe.timescale||9e4,Lt=oe(Ge,["trun"]),lt=0;lt<Lt.length;lt++)!(U=q(Lt[lt]))&&_t&&(U=_t*Y(Lt[lt],4)),xe.type===L.ElementaryStreamTypes.VIDEO?ve+=U/gt:xe.type===L.ElementaryStreamTypes.AUDIO&&(Le+=U/gt)}}if(ve===0&&Le===0){for(var It=0,Rt=oe(le,["sidx"]),At=0;At<Rt.length;At++){var pt=z(Rt[At]);pt!=null&&pt.references&&(It+=pt.references.reduce(function(Ut,Vt){return Ut+Vt.info.duration||0},0))}return It}return ve||Le}function q(le){var Ee=Y(le,0),U=8;1&Ee&&(U+=4),4&Ee&&(U+=4);for(var ve=0,Le=Y(le,4),Ne=0;Ne<Le;Ne++)256&Ee&&(ve+=Y(le,U),U+=4),512&Ee&&(U+=4),1024&Ee&&(U+=4),2048&Ee&&(U+=4);return ve}function N(le,Ee,U){oe(Ee,["moof","traf"]).forEach(function(ve){oe(ve,["tfhd"]).forEach(function(Le){var Ne=Y(Le,4),Ue=le[Ne];if(Ue){var Ge=Ue.timescale||9e4;oe(ve,["tfdt"]).forEach(function(Te){var xe=Te[0],ze=Y(Te,4);if(xe===0)ze-=U*Ge,X(Te,4,ze=Math.max(ze,0));else{ze*=Math.pow(2,32),ze+=Y(Te,8),ze-=U*Ge,ze=Math.max(ze,0);var it=Math.floor(ze/(O+1)),_t=Math.floor(ze%(O+1));X(Te,4,it),X(Te,8,_t)}})}})})}function fe(le){var Ee={valid:null,remainder:null},U=oe(le,["moof"]);if(!U)return Ee;if(U.length<2)return Ee.remainder=le,Ee;var ve=U[U.length-1];return Ee.valid=(0,M.sliceUint8)(le,0,ve.byteOffset-8),Ee.remainder=(0,M.sliceUint8)(le,ve.byteOffset-8),Ee}function _e(le,Ee){var U=new Uint8Array(le.length+Ee.length);return U.set(le),U.set(Ee,le.length),U}function te(le,Ee){var U=[],ve=Ee.samples,Le=Ee.timescale,Ne=Ee.id,Ue=!1;return oe(ve,["moof"]).map(function(Ge){var Te=Ge.byteOffset-8;oe(Ge,["traf"]).map(function(xe){var ze=oe(xe,["tfdt"]).map(function(it){var _t=it[0],gt=Y(it,4);return _t===1&&(gt*=Math.pow(2,32),gt+=Y(it,8)),gt/Le})[0];return ze!==void 0&&(le=ze),oe(xe,["tfhd"]).map(function(it){var _t=Y(it,4),gt=16777215&Y(it,0),Lt=0,lt=(16&gt)!=0,It=0,Rt=(32&gt)!=0,At=8;_t===Ne&&((1&gt)!=0&&(At+=8),(2&gt)!=0&&(At+=4),(8&gt)!=0&&(Lt=Y(it,At),At+=4),lt&&(It=Y(it,At),At+=4),Rt&&(At+=4),Ee.type==="video"&&(Ue=function(pt){if(!pt)return!1;var Ut=pt.indexOf("."),Vt=Ut<0?pt:pt.substring(0,Ut);return Vt==="hvc1"||Vt==="hev1"||Vt==="dvh1"||Vt==="dvhe"}(Ee.codec)),oe(xe,["trun"]).map(function(pt){var Ut=pt[0],Vt=16777215&Y(pt,0),ri=(1&Vt)!=0,vi=0,Qt=(4&Vt)!=0,Fi=(256&Vt)!=0,se=0,j=(512&Vt)!=0,w=0,G=(1024&Vt)!=0,H=(2048&Vt)!=0,$=0,re=Y(pt,4),ae=8;ri&&(vi=Y(pt,ae),ae+=4),Qt&&(ae+=4);for(var Ae=vi+Te,Ce=0;Ce<re;Ce++){if(Fi?(se=Y(pt,ae),ae+=4):se=Lt,j?(w=Y(pt,ae),ae+=4):w=It,G&&(ae+=4),H&&($=Ut===0?Y(pt,ae):pe(pt,ae),ae+=4),Ee.type===L.ElementaryStreamTypes.VIDEO)for(var Oe=0;Oe<w;){var Ke=Y(ve,Ae);ie(Ue,ve[Ae+=4])&&Re(ve.subarray(Ae,Ae+Ke),Ue?2:1,le+$/Le,U),Ae+=Ke,Oe+=Ke+4}le+=se/Le}}))})})}),U}function ie(le,Ee){if(le){var U=Ee>>1&63;return U===39||U===40}return(31&Ee)==6}function Re(le,Ee,U,ve){var Le=Pe(le),Ne=0;Ne+=Ee;for(var Ue=0,Ge=0,Te=!1,xe=0;Ne<Le.length;){Ue=0;do{if(Ne>=Le.length)break;Ue+=xe=Le[Ne++]}while(xe===255);Ge=0;do{if(Ne>=Le.length)break;Ge+=xe=Le[Ne++]}while(xe===255);var ze=Le.length-Ne;if(!Te&&Ue===4&&Ne<Le.length){if(Te=!0,Le[Ne++]===181){var it=he(Le,Ne);if(Ne+=2,it===49){var _t=Y(Le,Ne);if(Ne+=4,_t===1195456820){var gt=Le[Ne++];if(gt===3){var Lt=Le[Ne++],lt=64&Lt,It=lt?2+3*(31&Lt):0,Rt=new Uint8Array(It);if(lt){Rt[0]=Lt;for(var At=1;At<It;At++)Rt[At]=Le[Ne++]}ve.push({type:gt,payloadType:Ue,pts:U,bytes:Rt})}}}}}else if(Ue===5&&Ge<ze){if(Te=!0,Ge>16){for(var pt=[],Ut=0;Ut<16;Ut++){var Vt=Le[Ne++].toString(16);pt.push(Vt.length==1?"0"+Vt:Vt),Ut!==3&&Ut!==5&&Ut!==7&&Ut!==9||pt.push("-")}for(var ri=Ge-16,vi=new Uint8Array(ri),Qt=0;Qt<ri;Qt++)vi[Qt]=Le[Ne++];ve.push({payloadType:Ue,pts:U,uuid:pt.join(""),userData:(0,R.utf8ArrayToStr)(vi),userDataBytes:vi})}}else if(Ge<ze)Ne+=Ge;else if(Ge>ze)break}}function Pe(le){for(var Ee=le.byteLength,U=[],ve=1;ve<Ee-2;)le[ve]===0&&le[ve+1]===0&&le[ve+2]===3?(U.push(ve+2),ve+=2):ve++;if(U.length===0)return le;var Le=Ee-U.length,Ne=new Uint8Array(Le),Ue=0;for(ve=0;ve<Le;Ue++,ve++)Ue===U[0]&&(Ue++,U.shift()),Ne[ve]=le[Ue];return Ne}function Fe(le){var Ee=le[0],U="",ve="",Le=0,Ne=0,Ue=0,Ge=0,Te=0,xe=0;if(Ee===0){for(;de(le.subarray(xe,xe+1))!=="\0";)U+=de(le.subarray(xe,xe+1)),xe+=1;for(U+=de(le.subarray(xe,xe+1)),xe+=1;de(le.subarray(xe,xe+1))!=="\0";)ve+=de(le.subarray(xe,xe+1)),xe+=1;ve+=de(le.subarray(xe,xe+1)),xe+=1,Le=Y(le,12),Ne=Y(le,16),Ge=Y(le,20),Te=Y(le,24),xe=28}else if(Ee===1){Le=Y(le,xe+=4);var ze=Y(le,xe+=4),it=Y(le,xe+=4);for(xe+=4,Ue=Math.pow(2,32)*ze+it,Number.isSafeInteger(Ue)||(Ue=Number.MAX_SAFE_INTEGER,console.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),Ge=Y(le,xe),Te=Y(le,xe+=4),xe+=4;de(le.subarray(xe,xe+1))!=="\0";)U+=de(le.subarray(xe,xe+1)),xe+=1;for(U+=de(le.subarray(xe,xe+1)),xe+=1;de(le.subarray(xe,xe+1))!=="\0";)ve+=de(le.subarray(xe,xe+1)),xe+=1;ve+=de(le.subarray(xe,xe+1)),xe+=1}return{schemeIdUri:U,value:ve,timeScale:Le,presentationTime:Ue,presentationTimeDelta:Ne,eventDuration:Ge,id:Te,payload:le.subarray(xe,le.byteLength)}}function Se(le){for(var Ee=arguments.length,U=new Array(Ee>1?Ee-1:0),ve=1;ve<Ee;ve++)U[ve-1]=arguments[ve];for(var Le=U.length,Ne=8,Ue=Le;Ue--;)Ne+=U[Ue].byteLength;var Ge=new Uint8Array(Ne);for(Ge[0]=Ne>>24&255,Ge[1]=Ne>>16&255,Ge[2]=Ne>>8&255,Ge[3]=255&Ne,Ge.set(le,4),Ue=0,Ne=8;Ue<Le;Ue++)Ge.set(U[Ue],Ne),Ne+=U[Ue].byteLength;return Ge}function Ye(le,Ee,U){if(le.byteLength!==16)throw new RangeError("Invalid system id");var ve,Le,Ne;if(Ee){ve=1,Le=new Uint8Array(16*Ee.length);for(var Ue=0;Ue<Ee.length;Ue++){var Ge=Ee[Ue];if(Ge.byteLength!==16)throw new RangeError("Invalid key");Le.set(Ge,16*Ue)}}else ve=0,Le=new Uint8Array;ve>0?(Ne=new Uint8Array(4),Ee.length>0&&new DataView(Ne.buffer).setUint32(0,Ee.length,!1)):Ne=new Uint8Array;var Te=new Uint8Array(4);return U&&U.byteLength>0&&new DataView(Te.buffer).setUint32(0,U.byteLength,!1),Se([112,115,115,104],new Uint8Array([ve,0,0,0]),le,Ne,Le,Te,U||new Uint8Array)}function ot(le){if(!(le instanceof ArrayBuffer)||le.byteLength<32)return null;var Ee={version:0,systemId:"",kids:null,data:null},U=new DataView(le),ve=U.getUint32(0);if(le.byteLength!==ve&&ve>44||U.getUint32(4)!==1886614376||(Ee.version=U.getUint32(8)>>>24,Ee.version>1))return null;Ee.systemId=P.default.hexDump(new Uint8Array(le,12,16));var Le=U.getUint32(28);if(Ee.version===0){if(ve-32<Le)return null;Ee.data=new Uint8Array(le,32,Le)}else if(Ee.version===1){Ee.kids=[];for(var Ne=0;Ne<Le;Ne++)Ee.kids.push(new Uint8Array(le,32+16*Ne,16))}return Ee}},673:(v,g,E)=>{"use strict";function L(P,O,ue,Q){ue===void 0&&(ue=1),Q===void 0&&(Q=!1);var de=P*O*ue;return Q?Math.round(de):de}function M(P,O,ue,Q){return ue===void 0&&(ue=1),Q===void 0&&(Q=!1),L(P,O,1/ue,Q)}function R(P,O){return O===void 0&&(O=!1),L(P,1e3,11111111111111112e-21,O)}function b(P,O){return O===void 0&&(O=1),L(P,9e4,1/O)}E.r(g),E.d(g,{toMpegTsClockFromTimescale:()=>b,toMsFromMpegTsClock:()=>R,toTimescaleFromBase:()=>L,toTimescaleFromScale:()=>M})},145:(v,g,E)=>{"use strict";function L(M,R,b){return Uint8Array.prototype.slice?M.slice(R,b):new Uint8Array(Array.prototype.slice.call(M,R,b))}E.r(g),E.d(g,{sliceUint8:()=>L})},729:v=>{"use strict";var g=Object.prototype.hasOwnProperty,E="~";function L(){}function M(O,ue,Q){this.fn=O,this.context=ue,this.once=Q||!1}function R(O,ue,Q,de,he){if(typeof Q!="function")throw new TypeError("The listener must be a function");var Y=new M(Q,de||O,he),pe=E?E+ue:ue;return O._events[pe]?O._events[pe].fn?O._events[pe]=[O._events[pe],Y]:O._events[pe].push(Y):(O._events[pe]=Y,O._eventsCount++),O}function b(O,ue){--O._eventsCount==0?O._events=new L:delete O._events[ue]}function P(){this._events=new L,this._eventsCount=0}Object.create&&(L.prototype=Object.create(null),new L().__proto__||(E=!1)),P.prototype.eventNames=function(){var O,ue,Q=[];if(this._eventsCount===0)return Q;for(ue in O=this._events)g.call(O,ue)&&Q.push(E?ue.slice(1):ue);return Object.getOwnPropertySymbols?Q.concat(Object.getOwnPropertySymbols(O)):Q},P.prototype.listeners=function(O){var ue=E?E+O:O,Q=this._events[ue];if(!Q)return[];if(Q.fn)return[Q.fn];for(var de=0,he=Q.length,Y=new Array(he);de<he;de++)Y[de]=Q[de].fn;return Y},P.prototype.listenerCount=function(O){var ue=E?E+O:O,Q=this._events[ue];return Q?Q.fn?1:Q.length:0},P.prototype.emit=function(O,ue,Q,de,he,Y){var pe=E?E+O:O;if(!this._events[pe])return!1;var X,oe,z=this._events[pe],be=arguments.length;if(z.fn){switch(z.once&&this.removeListener(O,z.fn,void 0,!0),be){case 1:return z.fn.call(z.context),!0;case 2:return z.fn.call(z.context,ue),!0;case 3:return z.fn.call(z.context,ue,Q),!0;case 4:return z.fn.call(z.context,ue,Q,de),!0;case 5:return z.fn.call(z.context,ue,Q,de,he),!0;case 6:return z.fn.call(z.context,ue,Q,de,he,Y),!0}for(oe=1,X=new Array(be-1);oe<be;oe++)X[oe-1]=arguments[oe];z.fn.apply(z.context,X)}else{var ke,He=z.length;for(oe=0;oe<He;oe++)switch(z[oe].once&&this.removeListener(O,z[oe].fn,void 0,!0),be){case 1:z[oe].fn.call(z[oe].context);break;case 2:z[oe].fn.call(z[oe].context,ue);break;case 3:z[oe].fn.call(z[oe].context,ue,Q);break;case 4:z[oe].fn.call(z[oe].context,ue,Q,de);break;default:if(!X)for(ke=1,X=new Array(be-1);ke<be;ke++)X[ke-1]=arguments[ke];z[oe].fn.apply(z[oe].context,X)}}return!0},P.prototype.on=function(O,ue,Q){return R(this,O,ue,Q,!1)},P.prototype.once=function(O,ue,Q){return R(this,O,ue,Q,!0)},P.prototype.removeListener=function(O,ue,Q,de){var he=E?E+O:O;if(!this._events[he])return this;if(!ue)return b(this,he),this;var Y=this._events[he];if(Y.fn)Y.fn!==ue||de&&!Y.once||Q&&Y.context!==Q||b(this,he);else{for(var pe=0,X=[],oe=Y.length;pe<oe;pe++)(Y[pe].fn!==ue||de&&!Y[pe].once||Q&&Y[pe].context!==Q)&&X.push(Y[pe]);X.length?this._events[he]=X.length===1?X[0]:X:b(this,he)}return this},P.prototype.removeAllListeners=function(O){var ue;return O?(ue=E?E+O:O,this._events[ue]&&b(this,ue)):(this._events=new L,this._eventsCount=0),this},P.prototype.off=P.prototype.removeListener,P.prototype.addListener=P.prototype.on,P.prefixed=E,P.EventEmitter=P,v.exports=P},945:function(v){var g,E,L,M,R;g=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,E=/^(?=([^\/?#]*))\1([^]*)$/,L=/(?:\/|^)\.(?=\/)/g,M=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(b,P,O){if(O=O||{},b=b.trim(),!(P=P.trim())){if(!O.alwaysNormalize)return b;var ue=R.parseURL(b);if(!ue)throw new Error("Error trying to parse base URL.");return ue.path=R.normalizePath(ue.path),R.buildURLFromParts(ue)}var Q=R.parseURL(P);if(!Q)throw new Error("Error trying to parse relative URL.");if(Q.scheme)return O.alwaysNormalize?(Q.path=R.normalizePath(Q.path),R.buildURLFromParts(Q)):P;var de=R.parseURL(b);if(!de)throw new Error("Error trying to parse base URL.");if(!de.netLoc&&de.path&&de.path[0]!=="/"){var he=E.exec(de.path);de.netLoc=he[1],de.path=he[2]}de.netLoc&&!de.path&&(de.path="/");var Y={scheme:de.scheme,netLoc:Q.netLoc,path:null,params:Q.params,query:Q.query,fragment:Q.fragment};if(!Q.netLoc&&(Y.netLoc=de.netLoc,Q.path[0]!=="/"))if(Q.path){var pe=de.path,X=pe.substring(0,pe.lastIndexOf("/")+1)+Q.path;Y.path=R.normalizePath(X)}else Y.path=de.path,Q.params||(Y.params=de.params,Q.query||(Y.query=de.query));return Y.path===null&&(Y.path=O.alwaysNormalize?R.normalizePath(Q.path):Q.path),R.buildURLFromParts(Y)},parseURL:function(b){var P=g.exec(b);return P?{scheme:P[1]||"",netLoc:P[2]||"",path:P[3]||"",params:P[4]||"",query:P[5]||"",fragment:P[6]||""}:null},normalizePath:function(b){for(b=b.split("").reverse().join("").replace(L,"");b.length!==(b=b.replace(M,"")).length;);return b.split("").reverse().join("")},buildURLFromParts:function(b){return b.scheme+b.netLoc+b.path+b.params+b.query+b.fragment}},v.exports=R}},t={};function r(v){var g=t[v];if(g!==void 0)return g.exports;var E=t[v]={exports:{}};return a[v].call(E.exports,E,E.exports,r),E.exports}r.m=a,r.n=v=>{var g=v&&v.__esModule?()=>v.default:()=>v;return r.d(g,{a:g}),g},r.d=(v,g)=>{for(var E in g)r.o(g,E)&&!r.o(v,E)&&Object.defineProperty(v,E,{enumerable:!0,get:g[E]})},r.o=(v,g)=>Object.prototype.hasOwnProperty.call(v,g),r.r=v=>{typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})};var d=r(76);return d.default})())});var sn=class{addEventListener(){}removeEventListener(){}dispatchEvent(t){return!0}};if(typeof DocumentFragment=="undefined"){class a extends sn{}globalThis.DocumentFragment=a}var $n=class extends sn{},ql=class extends sn{},Lm={get(a){},define(a,t,r){},upgrade(a){},whenDefined(a){return Promise.resolve($n)}},zn,Yl=class{constructor(t,r={}){li(this,zn,void 0);$i(this,zn,r==null?void 0:r.detail)}get detail(){return Nt(this,zn)}initCustomEvent(){}};zn=new WeakMap;function Dm(a,t){return new $n}var lc={document:{createElement:Dm},DocumentFragment,customElements:Lm,CustomEvent:Yl,EventTarget:sn,HTMLElement:$n,HTMLVideoElement:ql},uc=typeof window=="undefined"||typeof globalThis.customElements=="undefined",mi=uc?lc:globalThis,Hi=uc?lc.document:globalThis.document;var et={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_CAPTIONS_REQUEST:"mediashowcaptionsrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_CAPTIONS_REQUEST:"mediadisablecaptionsrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},Qn={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailablechange",MEDIA_PIP_UNAVAILABLE:"mediapipunavailablechange",MEDIA_PAUSED:"mediapausedchange",MEDIA_HAS_PLAYED:"mediahasplayedchange",MEDIA_MUTED:"mediamutedchange",MEDIA_VOLUME_LEVEL:"mediavolumelevelchange",MEDIA_VOLUME:"mediavolumechange",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailablechange",MEDIA_IS_PIP:"mediaispipchange",MEDIA_IS_CASTING:"mediaiscastingchange",MEDIA_CAPTIONS_LIST:"mediacaptionslistchange",MEDIA_SUBTITLES_LIST:"mediasubtitleslistchange",MEDIA_CAPTIONS_SHOWING:"mediacaptionsshowingchange",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowingchange",MEDIA_IS_FULLSCREEN:"mediaisfullscreenchange",MEDIA_PLAYBACK_RATE:"mediaplaybackratechange",MEDIA_CURRENT_TIME:"mediacurrenttimechange",MEDIA_DURATION:"mediadurationchange",MEDIA_SEEKABLE:"mediaseekablechange",MEDIA_PREVIEW_IMAGE:"mediapreviewimagechange",MEDIA_PREVIEW_COORDS:"mediapreviewcoordschange",MEDIA_LOADING:"medialoadingchange",USER_INACTIVE:"userinactivechange"},tt={MEDIA_CHROME_ATTRIBUTES:"media-chrome-attributes",MEDIA_CONTROLLER:"media-controller"},F={MEDIA_AIRPLAY_UNAVAILABLE:"media-airplay-unavailable",MEDIA_FULLSCREEN_UNAVAILABLE:"media-fullscreen-unavailable",MEDIA_PIP_UNAVAILABLE:"media-pip-unavailable",MEDIA_CAST_UNAVAILABLE:"media-cast-unavailable",MEDIA_PAUSED:"media-paused",MEDIA_HAS_PLAYED:"media-has-played",MEDIA_MUTED:"media-muted",MEDIA_VOLUME_LEVEL:"media-volume-level",MEDIA_VOLUME:"media-volume",MEDIA_VOLUME_UNAVAILABLE:"media-volume-unavailable",MEDIA_IS_PIP:"media-is-pip",MEDIA_IS_CASTING:"media-is-casting",MEDIA_CAPTIONS_LIST:"media-captions-list",MEDIA_SUBTITLES_LIST:"media-subtitles-list",MEDIA_CAPTIONS_SHOWING:"media-captions-showing",MEDIA_SUBTITLES_SHOWING:"media-subtitles-showing",MEDIA_IS_FULLSCREEN:"media-is-fullscreen",MEDIA_PLAYBACK_RATE:"media-playback-rate",MEDIA_CURRENT_TIME:"media-current-time",MEDIA_DURATION:"media-duration",MEDIA_SEEKABLE:"media-seekable",MEDIA_PREVIEW_TIME:"media-preview-time",MEDIA_PREVIEW_IMAGE:"media-preview-image",MEDIA_PREVIEW_COORDS:"media-preview-coords",MEDIA_LOADING:"media-loading",MEDIA_BUFFERED:"media-buffered",MEDIA_STREAM_TYPE:"media-stream-type",MEDIA_TIME_IS_LIVE:"media-time-is-live"},gg=Object.entries(Qn).reduce((a,[t,r])=>{let d=F[t];return d&&(a[r]=d),a},{userinactivechange:"user-inactive"}),dc=Object.entries(F).reduce((a,[t,r])=>{let d=Qn[t];return d&&(a[r]=d),a},{"user-inactive":"userinactivechange"}),on={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},_a={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var $l={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},cr={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Xn={LIVE:"live",ON_DEMAND:"on-demand"};var Pi={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:a=1}={})=>`current playback rate ${a}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading"},ui={PLAY:()=>"play",PAUSE:()=>"pause",MUTE:()=>"mute",UNMUTE:()=>"unmute",AIRPLAY:()=>"air play",ENTER_CAST:()=>"start casting",EXIT_CAST:()=>"stop casting",ENTER_FULLSCREEN:()=>"enter fullscreen mode",EXIT_FULLSCREEN:()=>"exit fullscreen mode",ENTER_PIP:()=>"enter picture in picture mode",EXIT_PIP:()=>"exit picture in picture mode",SEEK_FORWARD_N_SECS:({seekOffset:a=30}={})=>`seek forward ${a} seconds`,SEEK_BACK_N_SECS:({seekOffset:a=30}={})=>`seek back ${a} seconds`},Cm={...Pi,...ui};function ro(a,t=!1){return a.split("_").map(function(r,d){return(d||t?r[0].toUpperCase():r[0].toLowerCase())+r.slice(1).toLowerCase()}).join("")}function cc(a){return a.replace(/[-_]([a-z])/g,(t,r)=>r.toUpperCase())}function hc(a){return typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a)}function fc(a){return typeof a!="string"?!1:!isNaN(a)&&!isNaN(parseFloat(a))}var mc=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],Mm=(a,t)=>{let r=a===1?mc[t].singular:mc[t].plural;return`${a} ${r}`},Aa=a=>{if(!hc(a))return"";let t=Math.abs(a),r=t!==a,d=new Date(0,0,0,0,0,t,0);return`${[d.getHours(),d.getMinutes(),d.getSeconds()].map((L,M)=>L&&Mm(L,M)).filter(L=>L).join(", ")}${r?" remaining":""}`};function nr(a,t){let r=!1;a<0&&(r=!0,a=0-a),a=a<0?0:a;let d=Math.floor(a%60),v=Math.floor(a/60%60),g=Math.floor(a/3600),E=Math.floor(t/60%60),L=Math.floor(t/3600);return(isNaN(a)||a===1/0)&&(g=v=d="-"),g=g>0||L>0?g+":":"",v=((g||E>=10)&&v<10?"0"+v:v)+":",d=d<10?"0"+d:d,(r?"-":"")+g+v+d}var ao=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},zl=class{observe(){}},pc={ResizeObserver:zl,HTMLElement:class extends ao{},DocumentFragment:class extends ao{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){}},Om={createElement:function(){return new pc.HTMLElement}},vc=typeof window=="undefined"||typeof window.customElements=="undefined",ce=vc?pc:window,Me=vc?Om:window.document;var Pm=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},Sa=(a,t,r)=>(Pm(a,t,"read from private field"),r?r.call(a):t.get(a)),Ql=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},no,ln,Xl,gc=Me.createElement("template");gc.innerHTML=`
33
33
  <style>
34
34
  :host {
35
35
  display: inline-flex;
@@ -81,12 +81,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
81
81
  min-width: 100%;
82
82
  }
83
83
  </style>
84
- `;var so=class extends ce.HTMLElement{constructor(t={}){super(),Ql(this,no,g=>{this.handleClick(g)}),Ql(this,ln,g=>{let{key:b}=g;if(!this.keysUsed.includes(b)){this.removeEventListener("keyup",Sa(this,ln));return}this.handleClick(g)}),Ql(this,Xl,g=>{let{metaKey:b,altKey:L,key:M}=g;if(b||L||!this.keysUsed.includes(M)){this.removeEventListener("keyup",Sa(this,ln));return}this.addEventListener("keyup",Sa(this,ln),{once:!0})});let i=this.attachShadow({mode:"open"}),d=gc.content.cloneNode(!0);this.nativeEl=d;let v=t.slotTemplate;v||(v=Me.createElement("template"),v.innerHTML=`<slot>${t.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),i.appendChild(d)}static get observedAttributes(){return["disabled",tt.MEDIA_CONTROLLER]}enable(){this.addEventListener("click",Sa(this,no)),this.addEventListener("keydown",Sa(this,Xl)),this.setAttribute("tabindex","0")}disable(){this.removeEventListener("click",Sa(this,no)),this.removeEventListener("keyup",Sa(this,ln)),this.removeAttribute("tabindex")}attributeChangedCallback(t,i,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(i){let b=Me.getElementById(i);(v=b==null?void 0:b.unassociateElement)==null||v.call(b,this)}if(d){let b=Me.getElementById(d);(g=b==null?void 0:b.associateElement)==null||g.call(b,this)}}else t==="disabled"&&d!==i&&(d==null?this.enable():this.disable())}connectedCallback(){var t;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","button");let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;this.disable();let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}get keysUsed(){return["Enter"," "]}handleClick(t){}};no=new WeakMap;ln=new WeakMap;Xl=new WeakMap;ce.customElements.get("media-chrome-button")||ce.customElements.define("media-chrome-button",so);var nr=so;var Nm=`<svg aria-hidden="true" viewBox="0 0 26 24">
84
+ `;var so=class extends ce.HTMLElement{constructor(t={}){super(),Ql(this,no,g=>{this.handleClick(g)}),Ql(this,ln,g=>{let{key:E}=g;if(!this.keysUsed.includes(E)){this.removeEventListener("keyup",Sa(this,ln));return}this.handleClick(g)}),Ql(this,Xl,g=>{let{metaKey:E,altKey:L,key:M}=g;if(E||L||!this.keysUsed.includes(M)){this.removeEventListener("keyup",Sa(this,ln));return}this.addEventListener("keyup",Sa(this,ln),{once:!0})});let r=this.attachShadow({mode:"open"}),d=gc.content.cloneNode(!0);this.nativeEl=d;let v=t.slotTemplate;v||(v=Me.createElement("template"),v.innerHTML=`<slot>${t.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),r.appendChild(d)}static get observedAttributes(){return["disabled",tt.MEDIA_CONTROLLER]}enable(){this.addEventListener("click",Sa(this,no)),this.addEventListener("keydown",Sa(this,Xl)),this.setAttribute("tabindex","0")}disable(){this.removeEventListener("click",Sa(this,no)),this.removeEventListener("keyup",Sa(this,ln)),this.removeAttribute("tabindex")}attributeChangedCallback(t,r,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(r){let E=Me.getElementById(r);(v=E==null?void 0:E.unassociateElement)==null||v.call(E,this)}if(d){let E=Me.getElementById(d);(g=E==null?void 0:E.associateElement)==null||g.call(E,this)}}else t==="disabled"&&d!==r&&(d==null?this.enable():this.disable())}connectedCallback(){var t;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","button");let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;this.disable();let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}get keysUsed(){return["Enter"," "]}handleClick(t){}};no=new WeakMap;ln=new WeakMap;Xl=new WeakMap;ce.customElements.get("media-chrome-button")||ce.customElements.define("media-chrome-button",so);var ni=so;var Nm=`<svg aria-hidden="true" viewBox="0 0 26 24">
85
85
  <path d="M22.13 3H3.87a.87.87 0 0 0-.87.87v13.26a.87.87 0 0 0 .87.87h3.4L9 16H5V5h16v11h-4l1.72 2h3.4a.87.87 0 0 0 .87-.87V3.87a.87.87 0 0 0-.86-.87Zm-8.75 11.44a.5.5 0 0 0-.76 0l-4.91 5.73a.5.5 0 0 0 .38.83h9.82a.501.501 0 0 0 .38-.83l-4.91-5.73Z"/>
86
86
  </svg>
87
87
  `,Ec=Me.createElement("template");Ec.innerHTML=`
88
88
  <slot name="airplay">${Nm}</slot>
89
- `;var Zl=class extends nr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(t={}){super({slotTemplate:Ec,...t})}connectedCallback(){this.setAttribute("aria-label",ur.AIRPLAY()),super.connectedCallback()}handleClick(){let t=new ce.CustomEvent(et.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(t)}};ce.customElements.get("media-airplay-button")||ce.customElements.define("media-airplay-button",Zl);var Um='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg>',Fm='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg>',bc=Me.createElement("template");bc.innerHTML=`
89
+ `;var Zl=class extends ni{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(t={}){super({slotTemplate:Ec,...t})}connectedCallback(){this.setAttribute("aria-label",ui.AIRPLAY()),super.connectedCallback()}handleClick(){let t=new ce.CustomEvent(et.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(t)}};ce.customElements.get("media-airplay-button")||ce.customElements.define("media-airplay-button",Zl);var Um='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg>',Fm='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg>',bc=Me.createElement("template");bc.innerHTML=`
90
90
  <style>
91
91
  :host([${F.MEDIA_IS_CASTING}]) slot:not([name=exit]) > *,
92
92
  :host([${F.MEDIA_IS_CASTING}]) ::slotted(:not([slot=exit])) {
@@ -102,14 +102,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
102
102
 
103
103
  <slot name="enter">${Um}</slot>
104
104
  <slot name="exit">${Fm}</slot>
105
- `;var yc=a=>{let i=a.getAttribute(F.MEDIA_IS_CASTING)!=null?ur.EXIT_CAST():ur.ENTER_CAST();a.setAttribute("aria-label",i)},Jl=class extends nr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_CASTING,F.MEDIA_CAST_UNAVAILABLE]}constructor(t={}){super({slotTemplate:bc,...t})}connectedCallback(){yc(this),super.connectedCallback()}attributeChangedCallback(t,i,d){t===F.MEDIA_IS_CASTING&&yc(this),super.attributeChangedCallback(t,i,d)}handleClick(){let t=this.getAttribute(F.MEDIA_IS_CASTING)!=null?et.MEDIA_EXIT_CAST_REQUEST:et.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new ce.CustomEvent(t,{composed:!0,bubbles:!0}))}};ce.customElements.get("media-cast-button")||ce.customElements.define("media-cast-button",Jl);var oo=(a,t,i=".value")=>{let d=a.querySelector(i);!d||(d.textContent=t)},Bm=(a,t)=>{let i=`slot[name="${t}"]`,d=a.shadowRoot.querySelector(i);return d?d.children:[]},lo=(a,t)=>Bm(a,t)[0],Zn=(a,t)=>!a||!t?!1:a.contains(t)?!0:Zn(a,t.getRootNode().host),ka=(a,t)=>{if(!a)return null;let i=a.closest(t);return i||ka(a.getRootNode().host,t)};function Li(a,t){var i;let d;for(d of a.querySelectorAll("style")){let v;try{v=(i=d.sheet)==null?void 0:i.cssRules}catch{continue}for(let g of v!=null?v:[])if(g.selectorText===t)return g}return d!=null&&d.sheet?(d.sheet.insertRule(`${t}{}`,d.sheet.cssRules.length),d.sheet.cssRules[d.sheet.cssRules.length-1]):{style:{setProperty:()=>{}}}}var _c=Me.createElement("template");_c.innerHTML=`
105
+ `;var yc=a=>{let r=a.getAttribute(F.MEDIA_IS_CASTING)!=null?ui.EXIT_CAST():ui.ENTER_CAST();a.setAttribute("aria-label",r)},Jl=class extends ni{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_CASTING,F.MEDIA_CAST_UNAVAILABLE]}constructor(t={}){super({slotTemplate:bc,...t})}connectedCallback(){yc(this),super.connectedCallback()}attributeChangedCallback(t,r,d){t===F.MEDIA_IS_CASTING&&yc(this),super.attributeChangedCallback(t,r,d)}handleClick(){let t=this.getAttribute(F.MEDIA_IS_CASTING)!=null?et.MEDIA_EXIT_CAST_REQUEST:et.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new ce.CustomEvent(t,{composed:!0,bubbles:!0}))}};ce.customElements.get("media-cast-button")||ce.customElements.define("media-cast-button",Jl);var oo=(a,t,r=".value")=>{let d=a.querySelector(r);!d||(d.textContent=t)},Bm=(a,t)=>{let r=`slot[name="${t}"]`,d=a.shadowRoot.querySelector(r);return d?d.children:[]},lo=(a,t)=>Bm(a,t)[0],Zn=(a,t)=>!a||!t?!1:a.contains(t)?!0:Zn(a,t.getRootNode().host),ka=(a,t)=>{if(!a)return null;let r=a.closest(t);return r||ka(a.getRootNode().host,t)};function Lr(a,t){var r;let d;for(d of a.querySelectorAll("style")){let v;try{v=(r=d.sheet)==null?void 0:r.cssRules}catch{continue}for(let g of v!=null?v:[])if(g.selectorText===t)return g}return d!=null&&d.sheet?(d.sheet.insertRule(`${t}{}`,d.sheet.cssRules.length),d.sheet.cssRules[d.sheet.cssRules.length-1]):{style:{setProperty:()=>{}}}}var _c=Me.createElement("template");_c.innerHTML=`
106
106
  <style>
107
107
  :host {
108
108
  display: inline-block;
109
109
  box-sizing: border-box;
110
110
  }
111
111
  </style>
112
- `;var eu=class extends ce.HTMLElement{static get observedAttributes(){return[tt.MEDIA_CONTROLLER,F.MEDIA_PAUSED]}constructor(t={}){super();let i=this.attachShadow({mode:"open"}),d=_c.content.cloneNode(!0);this.nativeEl=d;let v=t.slotTemplate;v||(v=Me.createElement("template"),v.innerHTML=`<slot>${t.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),i.appendChild(d)}attributeChangedCallback(t,i,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(i){let b=Me.getElementById(i);(v=b==null?void 0:b.unassociateElement)==null||v.call(b,this)}if(d){let b=Me.getElementById(d);(g=b==null?void 0:b.associateElement)==null||g.call(b,this)}}}connectedCallback(){var t;this.setAttribute("tabindex",-1),this.setAttribute("aria-hidden",!0);let i=Tc(this);this.getAttribute(tt.MEDIA_CONTROLLER)&&((t=i==null?void 0:i.associateElement)==null||t.call(i,this)),i==null||i.addEventListener("pointerdown",this),i==null||i.addEventListener("click",this)}disconnectedCallback(){var t;let i=Tc(this);this.getAttribute(tt.MEDIA_CONTROLLER)&&((t=i==null?void 0:i.unassociateElement)==null||t.call(i,this)),i==null||i.removeEventListener("pointerdown",this),i==null||i.removeEventListener("click",this)}handleEvent(t){var i;let d=(i=t.composedPath())==null?void 0:i[0];if(!!["video","media-controller"].includes(d==null?void 0:d.localName)){if(t.type==="pointerdown")this._pointerType=t.pointerType;else if(t.type==="click"){let{clientX:g,clientY:b}=t,{left:L,top:M,width:R,height:y}=this.getBoundingClientRect(),P=g-L,O=b-M;if(P<0||O<0||P>R||O>y||R===0&&y===0)return;let{pointerType:ue=this._pointerType}=t;if(this._pointerType=void 0,ue===$l.TOUCH){this.handleTap(t);return}else if(ue===$l.MOUSE){this.handleMouseClick(t);return}}}}handleTap(t){}handleMouseClick(t){let i=this.getAttribute(F.MEDIA_PAUSED)!=null?et.MEDIA_PLAY_REQUEST:et.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new ce.CustomEvent(i,{composed:!0,bubbles:!0}))}};function Tc(a){let t=a.getAttribute(tt.MEDIA_CONTROLLER);return t?Me.getElementById(t):ka(a,"media-controller")}ce.customElements.get("media-gesture-receiver")||ce.customElements.define("media-gesture-receiver",eu);var Ac=Me.createElement("template");Ac.innerHTML=`
112
+ `;var eu=class extends ce.HTMLElement{static get observedAttributes(){return[tt.MEDIA_CONTROLLER,F.MEDIA_PAUSED]}constructor(t={}){super();let r=this.attachShadow({mode:"open"}),d=_c.content.cloneNode(!0);this.nativeEl=d;let v=t.slotTemplate;v||(v=Me.createElement("template"),v.innerHTML=`<slot>${t.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),r.appendChild(d)}attributeChangedCallback(t,r,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(r){let E=Me.getElementById(r);(v=E==null?void 0:E.unassociateElement)==null||v.call(E,this)}if(d){let E=Me.getElementById(d);(g=E==null?void 0:E.associateElement)==null||g.call(E,this)}}}connectedCallback(){var t;this.setAttribute("tabindex",-1),this.setAttribute("aria-hidden",!0);let r=Tc(this);this.getAttribute(tt.MEDIA_CONTROLLER)&&((t=r==null?void 0:r.associateElement)==null||t.call(r,this)),r==null||r.addEventListener("pointerdown",this),r==null||r.addEventListener("click",this)}disconnectedCallback(){var t;let r=Tc(this);this.getAttribute(tt.MEDIA_CONTROLLER)&&((t=r==null?void 0:r.unassociateElement)==null||t.call(r,this)),r==null||r.removeEventListener("pointerdown",this),r==null||r.removeEventListener("click",this)}handleEvent(t){var r;let d=(r=t.composedPath())==null?void 0:r[0];if(!!["video","media-controller"].includes(d==null?void 0:d.localName)){if(t.type==="pointerdown")this._pointerType=t.pointerType;else if(t.type==="click"){let{clientX:g,clientY:E}=t,{left:L,top:M,width:R,height:b}=this.getBoundingClientRect(),P=g-L,O=E-M;if(P<0||O<0||P>R||O>b||R===0&&b===0)return;let{pointerType:ue=this._pointerType}=t;if(this._pointerType=void 0,ue===$l.TOUCH){this.handleTap(t);return}else if(ue===$l.MOUSE){this.handleMouseClick(t);return}}}}handleTap(t){}handleMouseClick(t){let r=this.getAttribute(F.MEDIA_PAUSED)!=null?et.MEDIA_PLAY_REQUEST:et.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new ce.CustomEvent(r,{composed:!0,bubbles:!0}))}};function Tc(a){let t=a.getAttribute(tt.MEDIA_CONTROLLER);return t?Me.getElementById(t):ka(a,"media-controller")}ce.customElements.get("media-gesture-receiver")||ce.customElements.define("media-gesture-receiver",eu);var Ac=Me.createElement("template");Ac.innerHTML=`
113
113
  <style>
114
114
 
115
115
  :host([media-is-fullscreen]) ::slotted([slot=media]) {
@@ -224,7 +224,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
224
224
 
225
225
  <slot part="bottom chrome"></slot>
226
226
  </span>
227
- `;var Hm=Object.values(F),Km="sm:384 md:576 lg:768 xl:960",Gm=a=>{var t;for(let i of a){let d=i.target;if(!d.isConnected)continue;let v=(t=d.getAttribute("breakpoints"))!=null?t:Km,g=Vm(v),b=Wm(g,i.contentRect);Object.keys(g).forEach(L=>{if(b.includes(L)){d.hasAttribute(`breakpoint-${L}`)||d.setAttribute(`breakpoint-${L}`,"");return}d.removeAttribute(`breakpoint-${L}`)})}};function Vm(a){let t=a.split(/\s+/);return Object.fromEntries(t.map(i=>i.split(":")))}function Wm(a,t){return Object.keys(a).filter(i=>t.width>=a[i])}var uo=class extends ce.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Ac.content.cloneNode(!0));let t=b=>{let L=this.media;for(let M of b)M.type==="childList"&&(M.removedNodes.forEach(R=>{if(R.slot=="media"&&M.target==this){let y=M.previousSibling&&M.previousSibling.previousElementSibling;if(!y||!L)this.mediaUnsetCallback(R);else{let P=y.slot!=="media";for(;(y=y.previousSibling)!==null;)y.slot=="media"&&(P=!1);P&&this.mediaUnsetCallback(R)}}}),L&&M.addedNodes.forEach(R=>{R==L&&this.handleMediaUpdated(L).then(y=>this.mediaSetCallback(y))}))};new MutationObserver(t).observe(this,{childList:!0,subtree:!0}),new ResizeObserver(Gm).observe(this);let v=this.media,g=this.querySelector(":scope > slot[slot=media]");g&&g.addEventListener("slotchange",()=>{if(!g.assignedElements({flatten:!0}).length){this.mediaUnsetCallback(v);return}this.media&&(v=this.media,this.handleMediaUpdated(this.media).then(L=>this.mediaSetCallback(L)))})}static get observedAttributes(){return["autohide","gestures-disabled"].concat(Hm)}attributeChangedCallback(t,i,d){t.toLowerCase()=="autohide"&&(this.autohide=d)}get media(){let t=this.querySelector(":scope > [slot=media]");return(t==null?void 0:t.nodeName)=="SLOT"&&(t=t.assignedElements({flatten:!0})[0]),t}mediaSetCallback(t){this._mediaClickPlayToggle=()=>{let i=t.paused?et.MEDIA_PLAY_REQUEST:et.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new ce.CustomEvent(i,{composed:!0,bubbles:!0}))}}handleMediaUpdated(t){let i=g=>Promise.resolve(g),d=g=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',g),Promise.reject(g));if(!t)return d(t);let v=t.nodeName.toLowerCase();return v.includes("-")?ce.customElements.whenDefined(v).then(()=>i(t)):i(t)}mediaUnsetCallback(t){}connectedCallback(){let i=this.getAttribute("audio")!=null?Pr.AUDIO_PLAYER():Pr.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",i),this.media&&this.handleMediaUpdated(this.media).then(b=>this.mediaSetCallback(b)),this.setAttribute("user-inactive","user-inactive");let d=()=>{if(this.autohide<0)return;this.setAttribute("user-inactive","user-inactive");let b=new ce.CustomEvent(Qn.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(b)},v=()=>{this.removeAttribute("user-inactive");let b=new ce.CustomEvent(Qn.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(b)},g=()=>{v(),ce.clearTimeout(this._inactiveTimeout),!(this.autohide<0)&&(this._inactiveTimeout=ce.setTimeout(()=>{d()},this.autohide*1e3))};this.addEventListener("keyup",()=>{g()}),this.addEventListener("pointerup",b=>{b.pointerType==="touch"?[this,this.media].includes(b.target)&&!this.hasAttribute("user-inactive")?d():g():b.composedPath().some(L=>{var M;return["media-play-button","media-fullscreen-button"].includes((M=L==null?void 0:L.nodeName)==null?void 0:M.toLowerCase())})&&g()}),this.addEventListener("pointermove",b=>{b.pointerType==="mouse"&&b.target!==this&&(v(),ce.clearTimeout(this._inactiveTimeout),[this,this.media].includes(b.target)&&g())}),this.addEventListener("mouseleave",()=>{d()}),this.addEventListener("keyup",()=>{this.setAttribute("media-keyboard-control","")}),this.addEventListener("mouseup",()=>{this.removeAttribute("media-keyboard-control")})}set autohide(t){t=Number(t),this._autohide=isNaN(t)?0:t}get autohide(){return this._autohide===void 0?2:this._autohide}};ce.customElements.get("media-container-temp")||ce.customElements.define("media-container-temp",uo);var Sc=uo;var kc=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},Nr=(a,t,i)=>(kc(a,t,"read from private field"),i?i.call(a):t.get(a)),tu=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},ru=(a,t,i,d)=>(kc(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),un,dn,Jr,co=class{constructor(t,i){tu(this,un,void 0),tu(this,dn,void 0),tu(this,Jr,new Set),ru(this,un,t),ru(this,dn,i)}[Symbol.iterator](){return Nr(this,Jr).values()}get length(){return Nr(this,Jr).size}get value(){var t;return(t=[...Nr(this,Jr)].join(" "))!=null?t:""}set value(t){var i;t!==this.value&&(ru(this,Jr,new Set),this.add(...(i=t==null?void 0:t.split(" "))!=null?i:[]))}toString(){return this.value}item(t){return[...Nr(this,Jr)][t]}values(){return Nr(this,Jr).values()}keys(){return Nr(this,Jr).keys()}forEach(t){Nr(this,Jr).forEach(t)}add(...t){var i,d;t.forEach(v=>Nr(this,Jr).add(v)),!(this.value===""&&!((i=Nr(this,un))!=null&&i.hasAttribute(`${Nr(this,dn)}`)))&&((d=Nr(this,un))==null||d.setAttribute(`${Nr(this,dn)}`,`${this.value}`))}remove(...t){var i;t.forEach(d=>Nr(this,Jr).delete(d)),(i=Nr(this,un))==null||i.setAttribute(`${Nr(this,dn)}`,`${this.value}`)}contains(t){return Nr(this,Jr).has(t)}toggle(t,i){return typeof i!="undefined"?i?(this.add(t),!0):(this.remove(t),!1):this.contains(t)?(this.remove(t),!1):(this.add(t),!0)}replace(t,i){this.remove(t),this.add(i)}};un=new WeakMap;dn=new WeakMap;Jr=new WeakMap;var Ar={enter:"requestFullscreen",exit:"exitFullscreen",event:"fullscreenchange",element:"fullscreenElement",error:"fullscreenerror",enabled:"fullscreenEnabled"};Me.fullscreenElement===void 0&&(Ar.enter="webkitRequestFullScreen",Ar.exit=Me.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",Ar.event="webkitfullscreenchange",Ar.element="webkitFullscreenElement",Ar.error="webkitfullscreenerror",Ar.enabled="webkitFullscreenEnabled");var iu=(a="")=>a.split(/\s+/),wc=(a="")=>{let[t,i]=a.split(":"),d=i?decodeURIComponent(i):void 0;return{language:t,label:d}},Jn=(a="",t={})=>iu(a).map(i=>{let d=wc(i);return{...t,...d}}),jm=a=>Array.isArray(a)?a.map(t=>typeof t=="string"?wc(t):t):typeof a=="string"?Jn(a):[a],au=({label:a,language:t}={})=>a?`${t}:${encodeURIComponent(a)}`:t,hi=(a=[])=>Array.prototype.map.call(a,au).join(" "),qm=(a,t)=>i=>i[a]===t,Ic=a=>{let t=Object.entries(a).map(([i,d])=>qm(i,d));return i=>t.every(d=>d(i))},es=(a,t=[],i=[])=>{let d=jm(i).map(Ic),v=g=>d.some(b=>b(g));Array.from(t).filter(v).forEach(g=>{g.mode=a})},cn=(a,t=()=>!0)=>{if(!(a!=null&&a.textTracks))return[];let i=typeof t=="function"?t:Ic(t);return Array.from(a.textTracks).filter(i)},ts=a=>{let t=!!a.getAttribute(F.MEDIA_CAPTIONS_SHOWING),i=!a.hasAttribute("no-subtitles-fallback")&&!!a.getAttribute(F.MEDIA_SUBTITLES_SHOWING);return t||i},Xi=a=>{var t,i,d,v;if(ts(a)){let b=a.getAttribute(F.MEDIA_CAPTIONS_SHOWING);if(b){let M=new window.CustomEvent(et.MEDIA_DISABLE_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:b});a.dispatchEvent(M)}let L=a.getAttribute(F.MEDIA_SUBTITLES_SHOWING);if(L&&!a.hasAttribute("no-subtitles-fallback")){let M=new window.CustomEvent(et.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:L});a.dispatchEvent(M)}}else{let[b]=(i=iu((t=a.getAttribute(F.MEDIA_CAPTIONS_LIST))!=null?t:""))!=null?i:[];if(b){let L=new window.CustomEvent(et.MEDIA_SHOW_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:b});a.dispatchEvent(L)}else if(a.hasAttribute("no-subtitles-fallback"))console.error("Attempting to enable closed captions but none are available! Please verify your media content if this is unexpected.");else{let[L]=(v=iu((d=a.getAttribute(F.MEDIA_SUBTITLES_LIST))!=null?d:""))!=null?v:[];if(L){let M=new window.CustomEvent(et.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:L});a.dispatchEvent(M)}}}};var lu=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},Ia=(a,t,i)=>(lu(a,t,"read from private field"),i?i.call(a):t.get(a)),ho=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},Lc=(a,t,i,d)=>(lu(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),hn=(a,t,i)=>(lu(a,t,"access private method"),i),Zi,is,fn,os,mo,nu,Ym=Object.values(Xn),Mc=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],$m=10,Dc=0,vo=class extends Sc{constructor(){super(),ho(this,fn),ho(this,mo),ho(this,Zi,new co(this,"hotkeys")),ho(this,is,void 0),ip||(this._airplayUnavailable=ci.UNSUPPORTED),Cc||(this._fullscreenUnavailable=ci.UNAVAILABLE),ap||(this._castUnavailable=ci.UNSUPPORTED),tp||(this._pipUnavailable=ci.UNSUPPORTED),ss!==void 0?ss||(this._volumeUnavailable=ci.UNSUPPORTED):rp.then(()=>{ss||(this._volumeUnavailable=ci.UNSUPPORTED,this.propagateMediaState(F.MEDIA_VOLUME_UNAVAILABLE,this._volumeUnavailable))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associateElement(this);let t={MEDIA_PLAY_REQUEST:(i,d)=>{let v=rs[F.MEDIA_STREAM_TYPE](this),g=this.getAttribute("noautoseektolive")===null;v==Xn.LIVE&&g&&t.MEDIA_SEEK_TO_LIVE_REQUEST(i,d),this.media.play()},MEDIA_PAUSE_REQUEST:()=>this.media.pause(),MEDIA_MUTE_REQUEST:()=>this.media.muted=!0,MEDIA_UNMUTE_REQUEST:()=>{let i=this.media;i.muted=!1,i.volume===0&&(i.volume=.25)},MEDIA_VOLUME_REQUEST:i=>{let d=this.media,v=i.detail;d.volume=v,v>0&&d.muted&&(d.muted=!1);try{ce.localStorage.setItem("media-chrome-pref-volume",v.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:()=>{if(!Cc){console.warn("Fullscreen support is unavailable; not entering fullscreen");return}let i=this.media;Me.pictureInPictureElement&&Me.exitPictureInPicture(),super[Ar.enter]?this.fullscreenElement[Ar.enter]():i.webkitEnterFullscreen?i.webkitEnterFullscreen():i.requestFullscreen?i.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{Me[Ar.exit]()},MEDIA_ENTER_PIP_REQUEST:()=>{let i=this.media;if(!Me.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!i.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}Me[Ar.element]&&Me[Ar.exit]();let d=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};i.requestPictureInPicture().catch(v=>{if(v.code===11)if(i.readyState===0&&i.preload==="none"){let g=()=>{i.removeEventListener("loadedmetadata",b),i.preload="none"},b=()=>{i.requestPictureInPicture().catch(d),g()};i.addEventListener("loadedmetadata",b),i.preload="metadata",setTimeout(()=>{i.readyState===0&&d(),g()},1e3)}else throw v;else throw v})},MEDIA_EXIT_PIP_REQUEST:()=>{Me.pictureInPictureElement&&Me.exitPictureInPicture()},MEDIA_ENTER_CAST_REQUEST:()=>{var i;let d=this.media;!((i=globalThis.CastableVideoElement)!=null&&i.castEnabled)||(Me[Ar.element]&&Me[Ar.exit](),d.requestCast())},MEDIA_EXIT_CAST_REQUEST:async()=>{var i;(i=globalThis.CastableVideoElement)!=null&&i.castElement&&globalThis.CastableVideoElement.exitCast()},MEDIA_SEEK_REQUEST:i=>{let d=this.media,v=i.detail;(d.readyState>0||d.readyState===void 0)&&(d.currentTime=v)},MEDIA_PLAYBACK_RATE_REQUEST:i=>{this.media.playbackRate=i.detail},MEDIA_PREVIEW_REQUEST:i=>{var d;let v=this.media;if(!v)return;let g=i.detail;g===null&&this.propagateMediaState(F.MEDIA_PREVIEW_TIME,void 0),this.propagateMediaState(F.MEDIA_PREVIEW_TIME,g);let[b]=cn(v,{kind:on.METADATA,label:"thumbnails"});if(!(b&&b.cues))return;if(g===null){this.propagateMediaState(F.MEDIA_PREVIEW_IMAGE,void 0),this.propagateMediaState(F.MEDIA_PREVIEW_COORDS,void 0);return}let L=Array.prototype.find.call(b.cues,P=>P.startTime>=g);if(!L)return;let M=/'^(?:[a-z]+:)?\/\//i.test(L.text)||(d=v.querySelector('track[label="thumbnails"]'))==null?void 0:d.src,R=new URL(L.text,M),y=new URLSearchParams(R.hash).get("#xywh");this.propagateMediaState(F.MEDIA_PREVIEW_IMAGE,R.href),this.propagateMediaState(F.MEDIA_PREVIEW_COORDS,y.split(",").join(" "))},MEDIA_SHOW_CAPTIONS_REQUEST:i=>{let d=po(this),{detail:v=[]}=i;es(_a.SHOWING,d,v)},MEDIA_DISABLE_CAPTIONS_REQUEST:i=>{let d=po(this),{detail:v=[]}=i;es(_a.DISABLED,d,v)},MEDIA_SHOW_SUBTITLES_REQUEST:i=>{let d=ns(this),{detail:v=[]}=i;es(_a.SHOWING,d,v)},MEDIA_DISABLE_SUBTITLES_REQUEST:i=>{let d=ns(this),{detail:v=[]}=i;es(_a.DISABLED,d,v)},MEDIA_AIRPLAY_REQUEST:()=>{let{media:i}=this;if(!!i){if(!(i.webkitShowPlaybackTargetPicker&&ce.WebKitPlaybackTargetAvailabilityEvent)){console.warn("received a request to select AirPlay but AirPlay is not supported in this environment");return}i.webkitShowPlaybackTargetPicker()}},MEDIA_SEEK_TO_LIVE_REQUEST:(i,d)=>{let v=d.seekable;if(!v){console.warn("MediaController: Media element does not support seeking to live.");return}if(!v.length){console.warn("MediaController: Media is unable to seek to live.");return}d.currentTime=v.end(v.length-1)}};if(Object.keys(t).forEach(i=>{let d=`_handle${io(i,!0)}`;this[d]=v=>{if(v.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}t[i](v,this.media)},this.addEventListener(et[i],this[d])}),this._mediaStatePropagators={"play,pause,emptied":()=>{this.propagateMediaState(F.MEDIA_PAUSED,xc(this))},"playing,emptied":()=>{var i;this.propagateMediaState(F.MEDIA_HAS_PLAYED,!((i=this.media)!=null&&i.paused))},volumechange:()=>{this.propagateMediaState(F.MEDIA_MUTED,Oc(this)),this.propagateMediaState(F.MEDIA_VOLUME,Pc(this)),this.propagateMediaState(F.MEDIA_VOLUME_LEVEL,Nc(this))},[Ar.event]:i=>{let v=!!Me[Ar.element]&&(i==null?void 0:i.target),g=Zn(this.fullscreenElement,v);this.propagateMediaState(F.MEDIA_IS_FULLSCREEN,g)},"enterpictureinpicture,leavepictureinpicture":i=>{var d;let v;if(i)v=i.type=="enterpictureinpicture";else{let g=(d=this.getRootNode().pictureInPictureElement)!=null?d:Me.pictureInPictureElement;v=this.media&&Zn(this.media,g)}this.propagateMediaState(F.MEDIA_IS_PIP,v)},"entercast,leavecast,castchange":i=>{var d;let v=(d=globalThis.CastableVideoElement)==null?void 0:d.castElement,g=this.media&&Zn(this.media,v);(i==null?void 0:i.type)==="castchange"&&(i==null?void 0:i.detail)==="CONNECTING"&&(g="connecting"),this.propagateMediaState(F.MEDIA_IS_CASTING,g)},"timeupdate,loadedmetadata":()=>{this.propagateMediaState(F.MEDIA_CURRENT_TIME,Uc(this))},"durationchange,loadedmetadata,emptied":()=>{this.propagateMediaState(F.MEDIA_DURATION,Fc(this)),this.propagateMediaState(F.MEDIA_STREAM_TYPE)},"loadedmetadata,emptied,progress":()=>{var i;this.propagateMediaState(F.MEDIA_SEEKABLE,(i=Bc(this))==null?void 0:i.join(":"))},"progress,emptied":()=>{var i;this.propagateMediaState(F.MEDIA_BUFFERED,op((i=this.media)==null?void 0:i.buffered))},"ratechange,loadstart":()=>{this.propagateMediaState(F.MEDIA_PLAYBACK_RATE,Hc(this))},"waiting,playing,emptied":()=>{var i;let d=((i=this.media)==null?void 0:i.readyState)<3;this.propagateMediaState(F.MEDIA_LOADING,d)},"playing,timeupdate,progress,waiting,emptied":()=>{this.propagateMediaState(F.MEDIA_TIME_IS_LIVE)}},this._airplayUnavailable!==ci.UNSUPPORTED){let i=d=>{(d==null?void 0:d.availability)==="available"?this._airplayUnavailable=void 0:(d==null?void 0:d.availability)==="not-available"&&(this._airplayUnavailable=ci.UNAVAILABLE),this.propagateMediaState(F.MEDIA_AIRPLAY_UNAVAILABLE,this._airplayUnavailable)};this._mediaStatePropagators.webkitplaybacktargetavailabilitychanged=i}if(this._castUnavailable!==ci.UNSUPPORTED){let i=()=>{var d;let v=(d=globalThis.CastableVideoElement)==null?void 0:d.castState;v!=null&&v.includes("CONNECT")?this._castUnavailable=void 0:this._castUnavailable=ci.UNAVAILABLE,this.propagateMediaState(F.MEDIA_CAST_UNAVAILABLE,this._castUnavailable)};this._mediaStatePropagators.castchange=i}this._textTrackMediaStatePropagators={"addtrack,removetrack,loadstart":()=>{this.propagateMediaState(F.MEDIA_CAPTIONS_LIST,hi(po(this))||void 0),this.propagateMediaState(F.MEDIA_SUBTITLES_LIST,hi(ns(this))||void 0),this.propagateMediaState(F.MEDIA_CAPTIONS_SHOWING,hi(su(this))||void 0),this.propagateMediaState(F.MEDIA_SUBTITLES_SHOWING,hi(Rc(this))||void 0)},change:()=>{this.propagateMediaState(F.MEDIA_CAPTIONS_SHOWING,hi(su(this))||void 0),this.propagateMediaState(F.MEDIA_SUBTITLES_SHOWING,hi(Rc(this))||void 0)}},this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat("nohotkeys","hotkeys","default-stream-type")}get fullscreenElement(){var t;return(t=Ia(this,is))!=null?t:this}set fullscreenElement(t){this.hasAttribute("fullscreen-element")&&this.removeAttribute("fullscreen-element"),Lc(this,is,t)}attributeChangedCallback(t,i,d){var v;if(t==="nohotkeys")d!==i&&d===""?(this.hasAttribute("hotkeys")&&console.warn("Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):d!==i&&d===null&&this.enableHotkeys();else if(t==="hotkeys")Ia(this,Zi).value=d;else if(t==="default-stream-type")this.propagateMediaState(F.MEDIA_STREAM_TYPE);else if(t==="fullscreen-element"){let g=d?(v=this.getRootNode())==null?void 0:v.getElementById(d):void 0;Lc(this,is,g)}super.attributeChangedCallback(t,i,d)}mediaSetCallback(t){super.mediaSetCallback(t),t.hasAttribute("tabindex")||t.setAttribute("tabindex",-1),Object.keys(this._mediaStatePropagators).forEach(i=>{let d=i.split(","),v=this._mediaStatePropagators[i];d.forEach(g=>{(g==Ar.event?this.getRootNode():t).addEventListener(g,v)}),v()}),Object.entries(this._textTrackMediaStatePropagators).forEach(([i,d])=>{i.split(",").forEach(g=>{t.textTracks&&t.textTracks.addEventListener(g,d)}),d()});try{let i=ce.localStorage.getItem("media-chrome-pref-volume");i!==null&&(t.volume=i)}catch(i){console.debug("Error getting volume pref",i)}}mediaUnsetCallback(t){super.mediaUnsetCallback(t),Object.keys(this._mediaStatePropagators).forEach(i=>{let d=i.split(","),v=this._mediaStatePropagators[i];d.forEach(g=>{(g==Ar.event?this.getRootNode():t).removeEventListener(g,v)})}),Object.entries(this._textTrackMediaStatePropagators).forEach(([i,d])=>{i.split(",").forEach(g=>{t.textTracks&&t.textTracks.removeEventListener(g,d)}),d()}),this.propagateMediaState(F.MEDIA_PAUSED,!0)}propagateMediaState(t,i){arguments.length===1&&(i=rs[t](this)),wa(this.mediaStateReceivers,t,i);let d=new ce.CustomEvent(dc[t],{composed:!0,bubbles:!0,detail:i});this.dispatchEvent(d)}associateElement(t){if(!t)return;let{associatedElementSubscriptions:i}=this;if(i.has(t))return;let d=this.registerMediaStateReceiver.bind(this),v=this.unregisterMediaStateReceiver.bind(this),g=Zm(t,d,v);Object.keys(et).forEach(b=>{t.addEventListener(et[b],this[`_handle${io(b,!0)}`])}),i.set(t,g)}unassociateElement(t){if(!t)return;let{associatedElementSubscriptions:i}=this;if(!i.has(t))return;i.get(t)(),i.delete(t),Object.keys(et).forEach(v=>{t.removeEventListener(et[v],this[`_handle${io(v,!0)}`])})}registerMediaStateReceiver(t){if(!t)return;let i=this.mediaStateReceivers;i.indexOf(t)>-1||(i.push(t),wa([t],F.MEDIA_VOLUME_UNAVAILABLE,this._volumeUnavailable),wa([t],F.MEDIA_AIRPLAY_UNAVAILABLE,this._airplayUnavailable),wa([t],F.MEDIA_FULLSCREEN_UNAVAILABLE,this._fullscreenUnavailable),wa([t],F.MEDIA_CAST_UNAVAILABLE,this._castUnavailable),wa([t],F.MEDIA_PIP_UNAVAILABLE,this._pipUnavailable),this.media&&Object.keys(F).forEach(v=>{v.includes("UNAVAILABLE")||wa([t],F[v],rs[F[v]]?rs[F[v]](this):rs.default(this,F[v]))}))}unregisterMediaStateReceiver(t){let i=this.mediaStateReceivers,d=i.indexOf(t);d<0||i.splice(d,1)}enableHotkeys(){this.addEventListener("keydown",hn(this,mo,nu))}disableHotkeys(){this.removeEventListener("keydown",hn(this,mo,nu)),this.removeEventListener("keyup",hn(this,fn,os))}get hotkeys(){return Ia(this,Zi)}keyboardShortcutHandler(t){var i,d,v,g;if(((g=(v=(i=t.target.getAttribute("keysused"))==null?void 0:i.split(" "))!=null?v:(d=t.target)==null?void 0:d.keysUsed)!=null?g:[]).map(ue=>ue==="Space"?" ":ue).filter(Boolean).includes(t.key))return;let L,M,R,y,P,O=$m;if(!Ia(this,Zi).contains(`no${t.key.toLowerCase()}`)&&!(t.key===" "&&Ia(this,Zi).contains("nospace")))switch(t.key){case" ":case"k":L=this.getAttribute(F.MEDIA_PAUSED)!=null?et.MEDIA_PLAY_REQUEST:et.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new ce.CustomEvent(L,{composed:!0,bubbles:!0}));break;case"m":L=this.getAttribute(F.MEDIA_VOLUME_LEVEL)==="off"?et.MEDIA_UNMUTE_REQUEST:et.MEDIA_MUTE_REQUEST,this.dispatchEvent(new ce.CustomEvent(L,{composed:!0,bubbles:!0}));break;case"f":L=this.getAttribute(F.MEDIA_IS_FULLSCREEN)!=null?et.MEDIA_EXIT_FULLSCREEN_REQUEST:et.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new ce.CustomEvent(L,{composed:!0,bubbles:!0}));break;case"c":Xi(this);break;case"ArrowLeft":M=this.getAttribute(F.MEDIA_CURRENT_TIME),R=M&&!Number.isNaN(+M)?+M:Dc,y=Math.max(R-O,0),P=new ce.CustomEvent(et.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:y}),this.dispatchEvent(P);break;case"ArrowRight":M=this.getAttribute(F.MEDIA_CURRENT_TIME),R=M&&!Number.isNaN(+M)?+M:Dc,y=Math.max(R+O,0),P=new ce.CustomEvent(et.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:y}),this.dispatchEvent(P);break;default:break}}};Zi=new WeakMap;is=new WeakMap;fn=new WeakSet;os=function(a){let{key:t}=a;if(!Mc.includes(t)){this.removeEventListener("keyup",hn(this,fn,os));return}this.keyboardShortcutHandler(a)};mo=new WeakSet;nu=function(a){let{metaKey:t,altKey:i,key:d}=a;if(t||i||!Mc.includes(d)){this.removeEventListener("keyup",hn(this,fn,os));return}[" ","ArrowLeft","ArrowRight"].includes(d)&&!(Ia(this,Zi).contains(`no${d.toLowerCase()}`)||d===" "&&Ia(this,Zi).contains("nospace"))&&a.preventDefault(),this.addEventListener("keyup",hn(this,fn,os),{once:!0})};var rs={default(a,t){return a.getAttribute(t)},[F.MEDIA_CAPTIONS_LIST](a){return hi(po(a))||void 0},[F.MEDIA_SUBTITLES_LIST](a){return hi(ns(a))||void 0},[F.MEDIA_SUBTITLES_LIST](a){return hi(ns(a))||void 0},[F.MEDIA_CAPTIONS_SHOWING](a){return hi(su(a))||void 0},[F.MEDIA_PAUSED](a){return xc(a)},[F.MEDIA_MUTED](a){return Oc(a)},[F.MEDIA_VOLUME](a){return Pc(a)},[F.MEDIA_VOLUME_LEVEL](a){return Nc(a)},[F.MEDIA_CURRENT_TIME](a){return Uc(a)},[F.MEDIA_DURATION](a){return Fc(a)},[F.MEDIA_SEEKABLE](a){var t;return(t=Bc(a))==null?void 0:t.join(":")},[F.MEDIA_PLAYBACK_RATE](a){return Hc(a)},[F.MEDIA_STREAM_TYPE](a){let t=a.media;if(!t)return null;let i=t.duration;if(i===1/0)return Xn.LIVE;if(Number.isFinite(i))return Xn.ON_DEMAND;{let d=a.getAttribute("default-stream-type");if(Ym.includes(d))return d}return null},[F.MEDIA_TIME_IS_LIVE](a){let t=a.media;if(!t)return!1;let i=a.getAttribute(F.MEDIA_STREAM_TYPE)==="live",d=t.seekable;if(i&&!d)return!0;if(!(d!=null&&d.length))return!1;let v=10,g=a.getAttribute("livethreshold");g!==null&&(g=Number(g),Number.isNaN(g)||(v=g));let b=t.currentTime,L=d.end(d.length-1);return b>L-v}},xc=a=>a.media?a.media.paused:!0,Oc=a=>!!(a.media&&a.media.muted),Pc=a=>{let t=a.media;return t?t.volume:1},Nc=a=>{let t="high";if(!a.media)return t;let{muted:i,volume:d}=a.media;return d===0||i?t="off":d<.5?t="low":d<.75&&(t="medium"),t},Uc=a=>{let t=a.media;return t?t.currentTime:0},Fc=a=>{let t=a==null?void 0:a.media;return Number.isFinite(t==null?void 0:t.duration)?t.duration:NaN},Bc=a=>{var t;let i=a==null?void 0:a.media;if(!((t=i==null?void 0:i.seekable)!=null&&t.length))return;let d=i.seekable.start(0),v=i.seekable.end(i.seekable.length-1);if(!(!d&&!v))return[Number(d.toFixed(3)),Number(v.toFixed(3))]},Hc=a=>{let t=a.media;return t?t.playbackRate:1},ns=a=>cn(a.media,{kind:on.SUBTITLES}),po=a=>cn(a.media,{kind:on.CAPTIONS}),Rc=a=>cn(a.media,{kind:on.SUBTITLES,mode:_a.SHOWING}),su=a=>cn(a.media,{kind:on.CAPTIONS,mode:_a.SHOWING}),zm=Object.values(F),Kc=a=>{var t,i,d,v;let{observedAttributes:g}=a.constructor;!g&&((t=a.nodeName)==null?void 0:t.includes("-"))&&(ce.customElements.upgrade(a),{observedAttributes:g}=a.constructor);let b=(v=(d=(i=a==null?void 0:a.getAttribute)==null?void 0:i.call(a,tt.MEDIA_CHROME_ATTRIBUTES))==null?void 0:d.split)==null?void 0:v.call(d,/\s+/);return Array.isArray(g||b)?(g||b).filter(L=>zm.includes(L)):[]},ou=a=>!!Kc(a).length,Qm=async(a,t,i)=>(a.isConnected||await Gc(0),i==null?a.removeAttribute(t):typeof i=="boolean"?i?a.setAttribute(t,""):a.removeAttribute(t):Number.isNaN(i)?a.removeAttribute(t):a.setAttribute(t,i)),Xm=a=>{var t;return!!((t=a.closest)!=null&&t.call(a,'*[slot="media"]'))},as=(a,t)=>{if(Xm(a))return;let i=(v,g)=>{var b,L;ou(v)&&g(v);let{children:M=[]}=v!=null?v:{},R=(L=(b=v==null?void 0:v.shadowRoot)==null?void 0:b.children)!=null?L:[];[...M,...R].forEach(P=>as(P,g))},d=a==null?void 0:a.nodeName.toLowerCase();if(d.includes("-")&&!ou(a)){ce.customElements.whenDefined(d).then(()=>{i(a,t)});return}i(a,t)},wa=(a,t,i)=>{a.forEach(d=>{!Kc(d).includes(t)||Qm(d,t,i)})},Zm=(a,t,i)=>{as(a,t);let d=M=>{var R;let y=(R=M==null?void 0:M.composedPath()[0])!=null?R:M.target;t(y)},v=M=>{var R;let y=(R=M==null?void 0:M.composedPath()[0])!=null?R:M.target;i(y)};a.addEventListener(et.REGISTER_MEDIA_STATE_RECEIVER,d),a.addEventListener(et.UNREGISTER_MEDIA_STATE_RECEIVER,v);let g=M=>{M.forEach(R=>{let{addedNodes:y=[],removedNodes:P=[],type:O,target:ue,attributeName:Q}=R;O==="childList"?(Array.prototype.forEach.call(y,de=>as(de,t)),Array.prototype.forEach.call(P,de=>as(de,i))):O==="attributes"&&Q===tt.MEDIA_CHROME_ATTRIBUTES&&(ou(ue)?t(ue):i(ue))})},b=new MutationObserver(g);return b.observe(a,{childList:!0,attributes:!0,subtree:!0}),()=>{as(a,i),b.disconnect(),a.removeEventListener(et.REGISTER_MEDIA_STATE_RECEIVER,d),a.removeEventListener(et.UNREGISTER_MEDIA_STATE_RECEIVER,v)}},fo,uu=()=>{var a,t;return fo||(fo=(t=(a=Me)==null?void 0:a.createElement)==null?void 0:t.call(a,"video"),fo)},Jm=async(a=uu())=>{if(!a)return!1;let t=a.volume;return a.volume=t/2+.1,await Gc(0),a.volume!==t},Gc=a=>new Promise(t=>setTimeout(t,a)),ep=(a=uu())=>typeof(a==null?void 0:a.requestPictureInPicture)=="function",tp=ep(),ss,rp=Jm().then(a=>(ss=a,ss)),ip=!!ce.WebKitPlaybackTargetAvailabilityEvent,ap=!!ce.chrome,np=(a=uu())=>{let t=Me[Ar.enabled];return!t&&a&&(t="webkitSupportsFullscreen"in a),t},Cc=np(),sp=Object.freeze({length:0,start(a){let t=a>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(a){let t=a>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});function op(a=sp){return Array.from(a).map((t,i)=>[Number(a.start(i).toFixed(3)),Number(a.end(i).toFixed(3))].join(":")).join(" ")}ce.customElements.get("media-controller")||ce.customElements.define("media-controller",vo);var ls=vo;var Wc=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},lp=(a,t,i)=>(Wc(a,t,"read from private field"),i?i.call(a):t.get(a)),up=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},dp=(a,t,i,d)=>(Wc(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),go,jc=Me.createElement("template"),Vc=`
227
+ `;var Hm=Object.values(F),Km="sm:384 md:576 lg:768 xl:960",Gm=a=>{var t;for(let r of a){let d=r.target;if(!d.isConnected)continue;let v=(t=d.getAttribute("breakpoints"))!=null?t:Km,g=Vm(v),E=Wm(g,r.contentRect);Object.keys(g).forEach(L=>{if(E.includes(L)){d.hasAttribute(`breakpoint-${L}`)||d.setAttribute(`breakpoint-${L}`,"");return}d.removeAttribute(`breakpoint-${L}`)})}};function Vm(a){let t=a.split(/\s+/);return Object.fromEntries(t.map(r=>r.split(":")))}function Wm(a,t){return Object.keys(a).filter(r=>t.width>=a[r])}var uo=class extends ce.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Ac.content.cloneNode(!0));let t=E=>{let L=this.media;for(let M of E)M.type==="childList"&&(M.removedNodes.forEach(R=>{if(R.slot=="media"&&M.target==this){let b=M.previousSibling&&M.previousSibling.previousElementSibling;if(!b||!L)this.mediaUnsetCallback(R);else{let P=b.slot!=="media";for(;(b=b.previousSibling)!==null;)b.slot=="media"&&(P=!1);P&&this.mediaUnsetCallback(R)}}}),L&&M.addedNodes.forEach(R=>{R==L&&this.handleMediaUpdated(L).then(b=>this.mediaSetCallback(b))}))};new MutationObserver(t).observe(this,{childList:!0,subtree:!0}),new ResizeObserver(Gm).observe(this);let v=this.media,g=this.querySelector(":scope > slot[slot=media]");g&&g.addEventListener("slotchange",()=>{if(!g.assignedElements({flatten:!0}).length){this.mediaUnsetCallback(v);return}this.media&&(v=this.media,this.handleMediaUpdated(this.media).then(L=>this.mediaSetCallback(L)))})}static get observedAttributes(){return["autohide","gestures-disabled"].concat(Hm)}attributeChangedCallback(t,r,d){t.toLowerCase()=="autohide"&&(this.autohide=d)}get media(){let t=this.querySelector(":scope > [slot=media]");return(t==null?void 0:t.nodeName)=="SLOT"&&(t=t.assignedElements({flatten:!0})[0]),t}mediaSetCallback(t){this._mediaClickPlayToggle=()=>{let r=t.paused?et.MEDIA_PLAY_REQUEST:et.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new ce.CustomEvent(r,{composed:!0,bubbles:!0}))}}handleMediaUpdated(t){let r=g=>Promise.resolve(g),d=g=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',g),Promise.reject(g));if(!t)return d(t);let v=t.nodeName.toLowerCase();return v.includes("-")?ce.customElements.whenDefined(v).then(()=>r(t)):r(t)}mediaUnsetCallback(t){}connectedCallback(){let r=this.getAttribute("audio")!=null?Pi.AUDIO_PLAYER():Pi.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",r),this.media&&this.handleMediaUpdated(this.media).then(E=>this.mediaSetCallback(E)),this.setAttribute("user-inactive","user-inactive");let d=()=>{if(this.autohide<0)return;this.setAttribute("user-inactive","user-inactive");let E=new ce.CustomEvent(Qn.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(E)},v=()=>{this.removeAttribute("user-inactive");let E=new ce.CustomEvent(Qn.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(E)},g=()=>{v(),ce.clearTimeout(this._inactiveTimeout),!(this.autohide<0)&&(this._inactiveTimeout=ce.setTimeout(()=>{d()},this.autohide*1e3))};this.addEventListener("keyup",()=>{g()}),this.addEventListener("pointerup",E=>{E.pointerType==="touch"?[this,this.media].includes(E.target)&&!this.hasAttribute("user-inactive")?d():g():E.composedPath().some(L=>{var M;return["media-play-button","media-fullscreen-button"].includes((M=L==null?void 0:L.nodeName)==null?void 0:M.toLowerCase())})&&g()}),this.addEventListener("pointermove",E=>{E.pointerType==="mouse"&&E.target!==this&&(v(),ce.clearTimeout(this._inactiveTimeout),[this,this.media].includes(E.target)&&g())}),this.addEventListener("mouseleave",()=>{d()}),this.addEventListener("keyup",()=>{this.setAttribute("media-keyboard-control","")}),this.addEventListener("mouseup",()=>{this.removeAttribute("media-keyboard-control")})}set autohide(t){t=Number(t),this._autohide=isNaN(t)?0:t}get autohide(){return this._autohide===void 0?2:this._autohide}};ce.customElements.get("media-container-temp")||ce.customElements.define("media-container-temp",uo);var Sc=uo;var kc=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},Ni=(a,t,r)=>(kc(a,t,"read from private field"),r?r.call(a):t.get(a)),tu=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},iu=(a,t,r,d)=>(kc(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),un,dn,Ji,co=class{constructor(t,r){tu(this,un,void 0),tu(this,dn,void 0),tu(this,Ji,new Set),iu(this,un,t),iu(this,dn,r)}[Symbol.iterator](){return Ni(this,Ji).values()}get length(){return Ni(this,Ji).size}get value(){var t;return(t=[...Ni(this,Ji)].join(" "))!=null?t:""}set value(t){var r;t!==this.value&&(iu(this,Ji,new Set),this.add(...(r=t==null?void 0:t.split(" "))!=null?r:[]))}toString(){return this.value}item(t){return[...Ni(this,Ji)][t]}values(){return Ni(this,Ji).values()}keys(){return Ni(this,Ji).keys()}forEach(t){Ni(this,Ji).forEach(t)}add(...t){var r,d;t.forEach(v=>Ni(this,Ji).add(v)),!(this.value===""&&!((r=Ni(this,un))!=null&&r.hasAttribute(`${Ni(this,dn)}`)))&&((d=Ni(this,un))==null||d.setAttribute(`${Ni(this,dn)}`,`${this.value}`))}remove(...t){var r;t.forEach(d=>Ni(this,Ji).delete(d)),(r=Ni(this,un))==null||r.setAttribute(`${Ni(this,dn)}`,`${this.value}`)}contains(t){return Ni(this,Ji).has(t)}toggle(t,r){return typeof r!="undefined"?r?(this.add(t),!0):(this.remove(t),!1):this.contains(t)?(this.remove(t),!1):(this.add(t),!0)}replace(t,r){this.remove(t),this.add(r)}};un=new WeakMap;dn=new WeakMap;Ji=new WeakMap;var Ai={enter:"requestFullscreen",exit:"exitFullscreen",event:"fullscreenchange",element:"fullscreenElement",error:"fullscreenerror",enabled:"fullscreenEnabled"};Me.fullscreenElement===void 0&&(Ai.enter="webkitRequestFullScreen",Ai.exit=Me.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",Ai.event="webkitfullscreenchange",Ai.element="webkitFullscreenElement",Ai.error="webkitfullscreenerror",Ai.enabled="webkitFullscreenEnabled");var ru=(a="")=>a.split(/\s+/),Ic=(a="")=>{let[t,r]=a.split(":"),d=r?decodeURIComponent(r):void 0;return{language:t,label:d}},Jn=(a="",t={})=>ru(a).map(r=>{let d=Ic(r);return{...t,...d}}),jm=a=>Array.isArray(a)?a.map(t=>typeof t=="string"?Ic(t):t):typeof a=="string"?Jn(a):[a],au=({label:a,language:t}={})=>a?`${t}:${encodeURIComponent(a)}`:t,hr=(a=[])=>Array.prototype.map.call(a,au).join(" "),qm=(a,t)=>r=>r[a]===t,wc=a=>{let t=Object.entries(a).map(([r,d])=>qm(r,d));return r=>t.every(d=>d(r))},es=(a,t=[],r=[])=>{let d=jm(r).map(wc),v=g=>d.some(E=>E(g));Array.from(t).filter(v).forEach(g=>{g.mode=a})},cn=(a,t=()=>!0)=>{if(!(a!=null&&a.textTracks))return[];let r=typeof t=="function"?t:wc(t);return Array.from(a.textTracks).filter(r)},ts=a=>{let t=!!a.getAttribute(F.MEDIA_CAPTIONS_SHOWING),r=!a.hasAttribute("no-subtitles-fallback")&&!!a.getAttribute(F.MEDIA_SUBTITLES_SHOWING);return t||r},Xr=a=>{var t,r,d,v;if(ts(a)){let E=a.getAttribute(F.MEDIA_CAPTIONS_SHOWING);if(E){let M=new window.CustomEvent(et.MEDIA_DISABLE_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:E});a.dispatchEvent(M)}let L=a.getAttribute(F.MEDIA_SUBTITLES_SHOWING);if(L&&!a.hasAttribute("no-subtitles-fallback")){let M=new window.CustomEvent(et.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:L});a.dispatchEvent(M)}}else{let[E]=(r=ru((t=a.getAttribute(F.MEDIA_CAPTIONS_LIST))!=null?t:""))!=null?r:[];if(E){let L=new window.CustomEvent(et.MEDIA_SHOW_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:E});a.dispatchEvent(L)}else if(a.hasAttribute("no-subtitles-fallback"))console.error("Attempting to enable closed captions but none are available! Please verify your media content if this is unexpected.");else{let[L]=(v=ru((d=a.getAttribute(F.MEDIA_SUBTITLES_LIST))!=null?d:""))!=null?v:[];if(L){let M=new window.CustomEvent(et.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:L});a.dispatchEvent(M)}}}};var lu=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},wa=(a,t,r)=>(lu(a,t,"read from private field"),r?r.call(a):t.get(a)),ho=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},Lc=(a,t,r,d)=>(lu(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),hn=(a,t,r)=>(lu(a,t,"access private method"),r),Zr,rs,fn,os,mo,nu,Ym=Object.values(Xn),Mc=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],$m=10,Dc=0,vo=class extends Sc{constructor(){super(),ho(this,fn),ho(this,mo),ho(this,Zr,new co(this,"hotkeys")),ho(this,rs,void 0),rp||(this._airplayUnavailable=cr.UNSUPPORTED),Cc||(this._fullscreenUnavailable=cr.UNAVAILABLE),ap||(this._castUnavailable=cr.UNSUPPORTED),tp||(this._pipUnavailable=cr.UNSUPPORTED),ss!==void 0?ss||(this._volumeUnavailable=cr.UNSUPPORTED):ip.then(()=>{ss||(this._volumeUnavailable=cr.UNSUPPORTED,this.propagateMediaState(F.MEDIA_VOLUME_UNAVAILABLE,this._volumeUnavailable))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associateElement(this);let t={MEDIA_PLAY_REQUEST:(r,d)=>{let v=is[F.MEDIA_STREAM_TYPE](this),g=this.getAttribute("noautoseektolive")===null;v==Xn.LIVE&&g&&t.MEDIA_SEEK_TO_LIVE_REQUEST(r,d),this.media.play()},MEDIA_PAUSE_REQUEST:()=>this.media.pause(),MEDIA_MUTE_REQUEST:()=>this.media.muted=!0,MEDIA_UNMUTE_REQUEST:()=>{let r=this.media;r.muted=!1,r.volume===0&&(r.volume=.25)},MEDIA_VOLUME_REQUEST:r=>{let d=this.media,v=r.detail;d.volume=v,v>0&&d.muted&&(d.muted=!1);try{ce.localStorage.setItem("media-chrome-pref-volume",v.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:()=>{if(!Cc){console.warn("Fullscreen support is unavailable; not entering fullscreen");return}let r=this.media;Me.pictureInPictureElement&&Me.exitPictureInPicture(),super[Ai.enter]?this.fullscreenElement[Ai.enter]():r.webkitEnterFullscreen?r.webkitEnterFullscreen():r.requestFullscreen?r.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{Me[Ai.exit]()},MEDIA_ENTER_PIP_REQUEST:()=>{let r=this.media;if(!Me.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!r.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}Me[Ai.element]&&Me[Ai.exit]();let d=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};r.requestPictureInPicture().catch(v=>{if(v.code===11)if(r.readyState===0&&r.preload==="none"){let g=()=>{r.removeEventListener("loadedmetadata",E),r.preload="none"},E=()=>{r.requestPictureInPicture().catch(d),g()};r.addEventListener("loadedmetadata",E),r.preload="metadata",setTimeout(()=>{r.readyState===0&&d(),g()},1e3)}else throw v;else throw v})},MEDIA_EXIT_PIP_REQUEST:()=>{Me.pictureInPictureElement&&Me.exitPictureInPicture()},MEDIA_ENTER_CAST_REQUEST:()=>{var r;let d=this.media;!((r=globalThis.CastableVideoElement)!=null&&r.castEnabled)||(Me[Ai.element]&&Me[Ai.exit](),d.requestCast())},MEDIA_EXIT_CAST_REQUEST:async()=>{var r;(r=globalThis.CastableVideoElement)!=null&&r.castElement&&globalThis.CastableVideoElement.exitCast()},MEDIA_SEEK_REQUEST:r=>{let d=this.media,v=r.detail;(d.readyState>0||d.readyState===void 0)&&(d.currentTime=v)},MEDIA_PLAYBACK_RATE_REQUEST:r=>{this.media.playbackRate=r.detail},MEDIA_PREVIEW_REQUEST:r=>{var d;let v=this.media;if(!v)return;let g=r.detail;g===null&&this.propagateMediaState(F.MEDIA_PREVIEW_TIME,void 0),this.propagateMediaState(F.MEDIA_PREVIEW_TIME,g);let[E]=cn(v,{kind:on.METADATA,label:"thumbnails"});if(!(E&&E.cues))return;if(g===null){this.propagateMediaState(F.MEDIA_PREVIEW_IMAGE,void 0),this.propagateMediaState(F.MEDIA_PREVIEW_COORDS,void 0);return}let L=Array.prototype.find.call(E.cues,P=>P.startTime>=g);if(!L)return;let M=/'^(?:[a-z]+:)?\/\//i.test(L.text)||(d=v.querySelector('track[label="thumbnails"]'))==null?void 0:d.src,R=new URL(L.text,M),b=new URLSearchParams(R.hash).get("#xywh");this.propagateMediaState(F.MEDIA_PREVIEW_IMAGE,R.href),this.propagateMediaState(F.MEDIA_PREVIEW_COORDS,b.split(",").join(" "))},MEDIA_SHOW_CAPTIONS_REQUEST:r=>{let d=po(this),{detail:v=[]}=r;es(_a.SHOWING,d,v)},MEDIA_DISABLE_CAPTIONS_REQUEST:r=>{let d=po(this),{detail:v=[]}=r;es(_a.DISABLED,d,v)},MEDIA_SHOW_SUBTITLES_REQUEST:r=>{let d=ns(this),{detail:v=[]}=r;es(_a.SHOWING,d,v)},MEDIA_DISABLE_SUBTITLES_REQUEST:r=>{let d=ns(this),{detail:v=[]}=r;es(_a.DISABLED,d,v)},MEDIA_AIRPLAY_REQUEST:()=>{let{media:r}=this;if(!!r){if(!(r.webkitShowPlaybackTargetPicker&&ce.WebKitPlaybackTargetAvailabilityEvent)){console.warn("received a request to select AirPlay but AirPlay is not supported in this environment");return}r.webkitShowPlaybackTargetPicker()}},MEDIA_SEEK_TO_LIVE_REQUEST:(r,d)=>{let v=d.seekable;if(!v){console.warn("MediaController: Media element does not support seeking to live.");return}if(!v.length){console.warn("MediaController: Media is unable to seek to live.");return}d.currentTime=v.end(v.length-1)}};if(Object.keys(t).forEach(r=>{let d=`_handle${ro(r,!0)}`;this[d]=v=>{if(v.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}t[r](v,this.media)},this.addEventListener(et[r],this[d])}),this._mediaStatePropagators={"play,pause,emptied":()=>{this.propagateMediaState(F.MEDIA_PAUSED,xc(this))},"playing,emptied":()=>{var r;this.propagateMediaState(F.MEDIA_HAS_PLAYED,!((r=this.media)!=null&&r.paused))},volumechange:()=>{this.propagateMediaState(F.MEDIA_MUTED,Oc(this)),this.propagateMediaState(F.MEDIA_VOLUME,Pc(this)),this.propagateMediaState(F.MEDIA_VOLUME_LEVEL,Nc(this))},[Ai.event]:r=>{let v=!!Me[Ai.element]&&(r==null?void 0:r.target),g=Zn(this.fullscreenElement,v);this.propagateMediaState(F.MEDIA_IS_FULLSCREEN,g)},"enterpictureinpicture,leavepictureinpicture":r=>{var d;let v;if(r)v=r.type=="enterpictureinpicture";else{let g=(d=this.getRootNode().pictureInPictureElement)!=null?d:Me.pictureInPictureElement;v=this.media&&Zn(this.media,g)}this.propagateMediaState(F.MEDIA_IS_PIP,v)},"entercast,leavecast,castchange":r=>{var d;let v=(d=globalThis.CastableVideoElement)==null?void 0:d.castElement,g=this.media&&Zn(this.media,v);(r==null?void 0:r.type)==="castchange"&&(r==null?void 0:r.detail)==="CONNECTING"&&(g="connecting"),this.propagateMediaState(F.MEDIA_IS_CASTING,g)},"timeupdate,loadedmetadata":()=>{this.propagateMediaState(F.MEDIA_CURRENT_TIME,Uc(this))},"durationchange,loadedmetadata,emptied":()=>{this.propagateMediaState(F.MEDIA_DURATION,Fc(this)),this.propagateMediaState(F.MEDIA_STREAM_TYPE)},"loadedmetadata,emptied,progress":()=>{var r;this.propagateMediaState(F.MEDIA_SEEKABLE,(r=Bc(this))==null?void 0:r.join(":"))},"progress,emptied":()=>{var r;this.propagateMediaState(F.MEDIA_BUFFERED,op((r=this.media)==null?void 0:r.buffered))},"ratechange,loadstart":()=>{this.propagateMediaState(F.MEDIA_PLAYBACK_RATE,Hc(this))},"waiting,playing,emptied":()=>{var r;let d=((r=this.media)==null?void 0:r.readyState)<3;this.propagateMediaState(F.MEDIA_LOADING,d)},"playing,timeupdate,progress,waiting,emptied":()=>{this.propagateMediaState(F.MEDIA_TIME_IS_LIVE)}},this._airplayUnavailable!==cr.UNSUPPORTED){let r=d=>{(d==null?void 0:d.availability)==="available"?this._airplayUnavailable=void 0:(d==null?void 0:d.availability)==="not-available"&&(this._airplayUnavailable=cr.UNAVAILABLE),this.propagateMediaState(F.MEDIA_AIRPLAY_UNAVAILABLE,this._airplayUnavailable)};this._mediaStatePropagators.webkitplaybacktargetavailabilitychanged=r}if(this._castUnavailable!==cr.UNSUPPORTED){let r=()=>{var d;let v=(d=globalThis.CastableVideoElement)==null?void 0:d.castState;v!=null&&v.includes("CONNECT")?this._castUnavailable=void 0:this._castUnavailable=cr.UNAVAILABLE,this.propagateMediaState(F.MEDIA_CAST_UNAVAILABLE,this._castUnavailable)};this._mediaStatePropagators.castchange=r}this._textTrackMediaStatePropagators={"addtrack,removetrack,loadstart":()=>{this.propagateMediaState(F.MEDIA_CAPTIONS_LIST,hr(po(this))||void 0),this.propagateMediaState(F.MEDIA_SUBTITLES_LIST,hr(ns(this))||void 0),this.propagateMediaState(F.MEDIA_CAPTIONS_SHOWING,hr(su(this))||void 0),this.propagateMediaState(F.MEDIA_SUBTITLES_SHOWING,hr(Rc(this))||void 0)},change:()=>{this.propagateMediaState(F.MEDIA_CAPTIONS_SHOWING,hr(su(this))||void 0),this.propagateMediaState(F.MEDIA_SUBTITLES_SHOWING,hr(Rc(this))||void 0)}},this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat("nohotkeys","hotkeys","default-stream-type")}get fullscreenElement(){var t;return(t=wa(this,rs))!=null?t:this}set fullscreenElement(t){this.hasAttribute("fullscreen-element")&&this.removeAttribute("fullscreen-element"),Lc(this,rs,t)}attributeChangedCallback(t,r,d){var v;if(t==="nohotkeys")d!==r&&d===""?(this.hasAttribute("hotkeys")&&console.warn("Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):d!==r&&d===null&&this.enableHotkeys();else if(t==="hotkeys")wa(this,Zr).value=d;else if(t==="default-stream-type")this.propagateMediaState(F.MEDIA_STREAM_TYPE);else if(t==="fullscreen-element"){let g=d?(v=this.getRootNode())==null?void 0:v.getElementById(d):void 0;Lc(this,rs,g)}super.attributeChangedCallback(t,r,d)}mediaSetCallback(t){super.mediaSetCallback(t),t.hasAttribute("tabindex")||t.setAttribute("tabindex",-1),Object.keys(this._mediaStatePropagators).forEach(r=>{let d=r.split(","),v=this._mediaStatePropagators[r];d.forEach(g=>{(g==Ai.event?this.getRootNode():t).addEventListener(g,v)}),v()}),Object.entries(this._textTrackMediaStatePropagators).forEach(([r,d])=>{r.split(",").forEach(g=>{t.textTracks&&t.textTracks.addEventListener(g,d)}),d()});try{let r=ce.localStorage.getItem("media-chrome-pref-volume");r!==null&&(t.volume=r)}catch(r){console.debug("Error getting volume pref",r)}}mediaUnsetCallback(t){super.mediaUnsetCallback(t),Object.keys(this._mediaStatePropagators).forEach(r=>{let d=r.split(","),v=this._mediaStatePropagators[r];d.forEach(g=>{(g==Ai.event?this.getRootNode():t).removeEventListener(g,v)})}),Object.entries(this._textTrackMediaStatePropagators).forEach(([r,d])=>{r.split(",").forEach(g=>{t.textTracks&&t.textTracks.removeEventListener(g,d)}),d()}),this.propagateMediaState(F.MEDIA_PAUSED,!0)}propagateMediaState(t,r){arguments.length===1&&(r=is[t](this)),Ia(this.mediaStateReceivers,t,r);let d=new ce.CustomEvent(dc[t],{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(d)}associateElement(t){if(!t)return;let{associatedElementSubscriptions:r}=this;if(r.has(t))return;let d=this.registerMediaStateReceiver.bind(this),v=this.unregisterMediaStateReceiver.bind(this),g=Zm(t,d,v);Object.keys(et).forEach(E=>{t.addEventListener(et[E],this[`_handle${ro(E,!0)}`])}),r.set(t,g)}unassociateElement(t){if(!t)return;let{associatedElementSubscriptions:r}=this;if(!r.has(t))return;r.get(t)(),r.delete(t),Object.keys(et).forEach(v=>{t.removeEventListener(et[v],this[`_handle${ro(v,!0)}`])})}registerMediaStateReceiver(t){if(!t)return;let r=this.mediaStateReceivers;r.indexOf(t)>-1||(r.push(t),Ia([t],F.MEDIA_VOLUME_UNAVAILABLE,this._volumeUnavailable),Ia([t],F.MEDIA_AIRPLAY_UNAVAILABLE,this._airplayUnavailable),Ia([t],F.MEDIA_FULLSCREEN_UNAVAILABLE,this._fullscreenUnavailable),Ia([t],F.MEDIA_CAST_UNAVAILABLE,this._castUnavailable),Ia([t],F.MEDIA_PIP_UNAVAILABLE,this._pipUnavailable),this.media&&Object.keys(F).forEach(v=>{v.includes("UNAVAILABLE")||Ia([t],F[v],is[F[v]]?is[F[v]](this):is.default(this,F[v]))}))}unregisterMediaStateReceiver(t){let r=this.mediaStateReceivers,d=r.indexOf(t);d<0||r.splice(d,1)}enableHotkeys(){this.addEventListener("keydown",hn(this,mo,nu))}disableHotkeys(){this.removeEventListener("keydown",hn(this,mo,nu)),this.removeEventListener("keyup",hn(this,fn,os))}get hotkeys(){return wa(this,Zr)}keyboardShortcutHandler(t){var r,d,v,g;if(((g=(v=(r=t.target.getAttribute("keysused"))==null?void 0:r.split(" "))!=null?v:(d=t.target)==null?void 0:d.keysUsed)!=null?g:[]).map(ue=>ue==="Space"?" ":ue).filter(Boolean).includes(t.key))return;let L,M,R,b,P,O=$m;if(!wa(this,Zr).contains(`no${t.key.toLowerCase()}`)&&!(t.key===" "&&wa(this,Zr).contains("nospace")))switch(t.key){case" ":case"k":L=this.getAttribute(F.MEDIA_PAUSED)!=null?et.MEDIA_PLAY_REQUEST:et.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new ce.CustomEvent(L,{composed:!0,bubbles:!0}));break;case"m":L=this.getAttribute(F.MEDIA_VOLUME_LEVEL)==="off"?et.MEDIA_UNMUTE_REQUEST:et.MEDIA_MUTE_REQUEST,this.dispatchEvent(new ce.CustomEvent(L,{composed:!0,bubbles:!0}));break;case"f":L=this.getAttribute(F.MEDIA_IS_FULLSCREEN)!=null?et.MEDIA_EXIT_FULLSCREEN_REQUEST:et.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new ce.CustomEvent(L,{composed:!0,bubbles:!0}));break;case"c":Xr(this);break;case"ArrowLeft":M=this.getAttribute(F.MEDIA_CURRENT_TIME),R=M&&!Number.isNaN(+M)?+M:Dc,b=Math.max(R-O,0),P=new ce.CustomEvent(et.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:b}),this.dispatchEvent(P);break;case"ArrowRight":M=this.getAttribute(F.MEDIA_CURRENT_TIME),R=M&&!Number.isNaN(+M)?+M:Dc,b=Math.max(R+O,0),P=new ce.CustomEvent(et.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:b}),this.dispatchEvent(P);break;default:break}}};Zr=new WeakMap;rs=new WeakMap;fn=new WeakSet;os=function(a){let{key:t}=a;if(!Mc.includes(t)){this.removeEventListener("keyup",hn(this,fn,os));return}this.keyboardShortcutHandler(a)};mo=new WeakSet;nu=function(a){let{metaKey:t,altKey:r,key:d}=a;if(t||r||!Mc.includes(d)){this.removeEventListener("keyup",hn(this,fn,os));return}[" ","ArrowLeft","ArrowRight"].includes(d)&&!(wa(this,Zr).contains(`no${d.toLowerCase()}`)||d===" "&&wa(this,Zr).contains("nospace"))&&a.preventDefault(),this.addEventListener("keyup",hn(this,fn,os),{once:!0})};var is={default(a,t){return a.getAttribute(t)},[F.MEDIA_CAPTIONS_LIST](a){return hr(po(a))||void 0},[F.MEDIA_SUBTITLES_LIST](a){return hr(ns(a))||void 0},[F.MEDIA_SUBTITLES_LIST](a){return hr(ns(a))||void 0},[F.MEDIA_CAPTIONS_SHOWING](a){return hr(su(a))||void 0},[F.MEDIA_PAUSED](a){return xc(a)},[F.MEDIA_MUTED](a){return Oc(a)},[F.MEDIA_VOLUME](a){return Pc(a)},[F.MEDIA_VOLUME_LEVEL](a){return Nc(a)},[F.MEDIA_CURRENT_TIME](a){return Uc(a)},[F.MEDIA_DURATION](a){return Fc(a)},[F.MEDIA_SEEKABLE](a){var t;return(t=Bc(a))==null?void 0:t.join(":")},[F.MEDIA_PLAYBACK_RATE](a){return Hc(a)},[F.MEDIA_STREAM_TYPE](a){let t=a.media;if(!t)return null;let r=t.duration;if(r===1/0)return Xn.LIVE;if(Number.isFinite(r))return Xn.ON_DEMAND;{let d=a.getAttribute("default-stream-type");if(Ym.includes(d))return d}return null},[F.MEDIA_TIME_IS_LIVE](a){let t=a.media;if(!t)return!1;let r=a.getAttribute(F.MEDIA_STREAM_TYPE)==="live",d=t.seekable;if(r&&!d)return!0;if(!(d!=null&&d.length))return!1;let v=10,g=a.getAttribute("livethreshold");g!==null&&(g=Number(g),Number.isNaN(g)||(v=g));let E=t.currentTime,L=d.end(d.length-1);return E>L-v}},xc=a=>a.media?a.media.paused:!0,Oc=a=>!!(a.media&&a.media.muted),Pc=a=>{let t=a.media;return t?t.volume:1},Nc=a=>{let t="high";if(!a.media)return t;let{muted:r,volume:d}=a.media;return d===0||r?t="off":d<.5?t="low":d<.75&&(t="medium"),t},Uc=a=>{let t=a.media;return t?t.currentTime:0},Fc=a=>{let t=a==null?void 0:a.media;return Number.isFinite(t==null?void 0:t.duration)?t.duration:NaN},Bc=a=>{var t;let r=a==null?void 0:a.media;if(!((t=r==null?void 0:r.seekable)!=null&&t.length))return;let d=r.seekable.start(0),v=r.seekable.end(r.seekable.length-1);if(!(!d&&!v))return[Number(d.toFixed(3)),Number(v.toFixed(3))]},Hc=a=>{let t=a.media;return t?t.playbackRate:1},ns=a=>cn(a.media,{kind:on.SUBTITLES}),po=a=>cn(a.media,{kind:on.CAPTIONS}),Rc=a=>cn(a.media,{kind:on.SUBTITLES,mode:_a.SHOWING}),su=a=>cn(a.media,{kind:on.CAPTIONS,mode:_a.SHOWING}),zm=Object.values(F),Kc=a=>{var t,r,d,v;let{observedAttributes:g}=a.constructor;!g&&((t=a.nodeName)==null?void 0:t.includes("-"))&&(ce.customElements.upgrade(a),{observedAttributes:g}=a.constructor);let E=(v=(d=(r=a==null?void 0:a.getAttribute)==null?void 0:r.call(a,tt.MEDIA_CHROME_ATTRIBUTES))==null?void 0:d.split)==null?void 0:v.call(d,/\s+/);return Array.isArray(g||E)?(g||E).filter(L=>zm.includes(L)):[]},ou=a=>!!Kc(a).length,Qm=async(a,t,r)=>(a.isConnected||await Gc(0),r==null?a.removeAttribute(t):typeof r=="boolean"?r?a.setAttribute(t,""):a.removeAttribute(t):Number.isNaN(r)?a.removeAttribute(t):a.setAttribute(t,r)),Xm=a=>{var t;return!!((t=a.closest)!=null&&t.call(a,'*[slot="media"]'))},as=(a,t)=>{if(Xm(a))return;let r=(v,g)=>{var E,L;ou(v)&&g(v);let{children:M=[]}=v!=null?v:{},R=(L=(E=v==null?void 0:v.shadowRoot)==null?void 0:E.children)!=null?L:[];[...M,...R].forEach(P=>as(P,g))},d=a==null?void 0:a.nodeName.toLowerCase();if(d.includes("-")&&!ou(a)){ce.customElements.whenDefined(d).then(()=>{r(a,t)});return}r(a,t)},Ia=(a,t,r)=>{a.forEach(d=>{!Kc(d).includes(t)||Qm(d,t,r)})},Zm=(a,t,r)=>{as(a,t);let d=M=>{var R;let b=(R=M==null?void 0:M.composedPath()[0])!=null?R:M.target;t(b)},v=M=>{var R;let b=(R=M==null?void 0:M.composedPath()[0])!=null?R:M.target;r(b)};a.addEventListener(et.REGISTER_MEDIA_STATE_RECEIVER,d),a.addEventListener(et.UNREGISTER_MEDIA_STATE_RECEIVER,v);let g=M=>{M.forEach(R=>{let{addedNodes:b=[],removedNodes:P=[],type:O,target:ue,attributeName:Q}=R;O==="childList"?(Array.prototype.forEach.call(b,de=>as(de,t)),Array.prototype.forEach.call(P,de=>as(de,r))):O==="attributes"&&Q===tt.MEDIA_CHROME_ATTRIBUTES&&(ou(ue)?t(ue):r(ue))})},E=new MutationObserver(g);return E.observe(a,{childList:!0,attributes:!0,subtree:!0}),()=>{as(a,r),E.disconnect(),a.removeEventListener(et.REGISTER_MEDIA_STATE_RECEIVER,d),a.removeEventListener(et.UNREGISTER_MEDIA_STATE_RECEIVER,v)}},fo,uu=()=>{var a,t;return fo||(fo=(t=(a=Me)==null?void 0:a.createElement)==null?void 0:t.call(a,"video"),fo)},Jm=async(a=uu())=>{if(!a)return!1;let t=a.volume;return a.volume=t/2+.1,await Gc(0),a.volume!==t},Gc=a=>new Promise(t=>setTimeout(t,a)),ep=(a=uu())=>typeof(a==null?void 0:a.requestPictureInPicture)=="function",tp=ep(),ss,ip=Jm().then(a=>(ss=a,ss)),rp=!!ce.WebKitPlaybackTargetAvailabilityEvent,ap=!!ce.chrome,np=(a=uu())=>{let t=Me[Ai.enabled];return!t&&a&&(t="webkitSupportsFullscreen"in a),t},Cc=np(),sp=Object.freeze({length:0,start(a){let t=a>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(a){let t=a>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});function op(a=sp){return Array.from(a).map((t,r)=>[Number(a.start(r).toFixed(3)),Number(a.end(r).toFixed(3))].join(":")).join(" ")}ce.customElements.get("media-controller")||ce.customElements.define("media-controller",vo);var ls=vo;var Wc=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},lp=(a,t,r)=>(Wc(a,t,"read from private field"),r?r.call(a):t.get(a)),up=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},dp=(a,t,r,d)=>(Wc(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),go,jc=Me.createElement("template"),Vc=`
228
228
  height: var(--thumb-height);
229
229
  width: var(--media-range-thumb-width, 10px);
230
230
  border: var(--media-range-thumb-border, none);
@@ -397,7 +397,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
397
397
  <div id="hoverzone"></div>
398
398
  <input id="range" type="range" min="0" max="1000" step="any" value="0">
399
399
  </div>
400
- `;var Eo=class extends ce.HTMLElement{constructor(){super(),up(this,go,void 0),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(jc.content.cloneNode(!0)),this.container=this.shadowRoot.querySelector("#container"),this.range=this.shadowRoot.querySelector("#range"),this.range.addEventListener("input",this.updateBar.bind(this)),dp(this,go,parseInt(getComputedStyle(this).getPropertyValue("--media-range-thumb-width")||"10",10))}static get observedAttributes(){return["disabled","aria-disabled",tt.MEDIA_CONTROLLER]}attributeChangedCallback(t,i,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(i){let b=Me.getElementById(i);(v=b==null?void 0:b.unassociateElement)==null||v.call(b,this)}if(d){let b=Me.getElementById(d);(g=b==null?void 0:b.associateElement)==null||g.call(b,this)}}else(t==="disabled"||t==="aria-disabled"&&i!==d)&&(d==null?this.range.removeAttribute(t):this.range.setAttribute(t,d))}connectedCallback(){var t;let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}this.updateBar()}disconnectedCallback(){var t;let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}updatePointerBar(t){let i=this.range.getBoundingClientRect(),d=(t.clientX-i.left)/i.width;d=Math.max(0,Math.min(1,d));let{style:v}=Li(this.shadowRoot,"#pointer");v.setProperty("width",`${d*i.width}px`)}updateBar(){let t=this.getBarColors(),i="linear-gradient(to right, ",d=0;t.forEach(g=>{g[1]<d||(i=i+`${g[0]} ${d}%, ${g[0]} ${g[1]}%,`,d=g[1])}),i=i.slice(0,i.length-1)+")";let{style:v}=Li(this.shadowRoot,"#range");v.setProperty("--media-range-track-progress-internal",i)}getBarColors(){let t=this.range,i=t.value-t.min,d=t.max-t.min,v=i/d*100,g=0;return t.value>t.min&&t.value<t.max&&(g=lp(this,go)*(.5-v/100)/t.offsetWidth*100),[["var(--media-range-bar-color, #fff)",v+g],["transparent",100]]}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}};go=new WeakMap;ce.customElements.get("media-chrome-range")||ce.customElements.define("media-chrome-range",Eo);var us=Eo;var qc=Me.createElement("template");qc.innerHTML=`
400
+ `;var Eo=class extends ce.HTMLElement{constructor(){super(),up(this,go,void 0),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(jc.content.cloneNode(!0)),this.container=this.shadowRoot.querySelector("#container"),this.range=this.shadowRoot.querySelector("#range"),this.range.addEventListener("input",this.updateBar.bind(this)),dp(this,go,parseInt(getComputedStyle(this).getPropertyValue("--media-range-thumb-width")||"10",10))}static get observedAttributes(){return["disabled","aria-disabled",tt.MEDIA_CONTROLLER]}attributeChangedCallback(t,r,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(r){let E=Me.getElementById(r);(v=E==null?void 0:E.unassociateElement)==null||v.call(E,this)}if(d){let E=Me.getElementById(d);(g=E==null?void 0:E.associateElement)==null||g.call(E,this)}}else(t==="disabled"||t==="aria-disabled"&&r!==d)&&(d==null?this.range.removeAttribute(t):this.range.setAttribute(t,d))}connectedCallback(){var t;let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}this.updateBar()}disconnectedCallback(){var t;let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}updatePointerBar(t){let r=this.range.getBoundingClientRect(),d=(t.clientX-r.left)/r.width;d=Math.max(0,Math.min(1,d));let{style:v}=Lr(this.shadowRoot,"#pointer");v.setProperty("width",`${d*r.width}px`)}updateBar(){let t=this.getBarColors(),r="linear-gradient(to right, ",d=0;t.forEach(g=>{g[1]<d||(r=r+`${g[0]} ${d}%, ${g[0]} ${g[1]}%,`,d=g[1])}),r=r.slice(0,r.length-1)+")";let{style:v}=Lr(this.shadowRoot,"#range");v.setProperty("--media-range-track-progress-internal",r)}getBarColors(){let t=this.range,r=t.value-t.min,d=t.max-t.min,v=r/d*100,g=0;return t.value>t.min&&t.value<t.max&&(g=lp(this,go)*(.5-v/100)/t.offsetWidth*100),[["var(--media-range-bar-color, #fff)",v+g],["transparent",100]]}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}};go=new WeakMap;ce.customElements.get("media-chrome-range")||ce.customElements.define("media-chrome-range",Eo);var us=Eo;var qc=Me.createElement("template");qc.innerHTML=`
401
401
  <style>
402
402
  :host {
403
403
 
@@ -416,7 +416,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
416
416
  </style>
417
417
 
418
418
  <slot></slot>
419
- `;var cu=class extends ce.HTMLElement{static get observedAttributes(){return[tt.MEDIA_CONTROLLER]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(qc.content.cloneNode(!0))}attributeChangedCallback(t,i,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(i){let b=Me.getElementById(i);(v=b==null?void 0:b.unassociateElement)==null||v.call(b,this)}if(d){let b=Me.getElementById(d);(g=b==null?void 0:b.associateElement)==null||g.call(b,this)}}}connectedCallback(){var t;let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}};ce.customElements.get("media-control-bar")||ce.customElements.define("media-control-bar",cu);var Yc=Me.createElement("template");Yc.innerHTML=`
419
+ `;var cu=class extends ce.HTMLElement{static get observedAttributes(){return[tt.MEDIA_CONTROLLER]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(qc.content.cloneNode(!0))}attributeChangedCallback(t,r,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(r){let E=Me.getElementById(r);(v=E==null?void 0:E.unassociateElement)==null||v.call(E,this)}if(d){let E=Me.getElementById(d);(g=E==null?void 0:E.associateElement)==null||g.call(E,this)}}}connectedCallback(){var t;let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}};ce.customElements.get("media-control-bar")||ce.customElements.define("media-control-bar",cu);var Yc=Me.createElement("template");Yc.innerHTML=`
420
420
  <style>
421
421
  :host {
422
422
  display: inline-flex;
@@ -451,7 +451,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
451
451
  <span id="container">
452
452
  <slot></slot>
453
453
  </span>
454
- `;var yo=class extends ce.HTMLElement{static get observedAttributes(){return[tt.MEDIA_CONTROLLER]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Yc.content.cloneNode(!0)),this.container=this.shadowRoot.querySelector("#container")}attributeChangedCallback(t,i,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(i){let b=Me.getElementById(i);(v=b==null?void 0:b.unassociateElement)==null||v.call(b,this)}if(d){let b=Me.getElementById(d);(g=b==null?void 0:b.associateElement)==null||g.call(b,this)}}}connectedCallback(){var t;let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}};ce.customElements.get("media-text-display")||ce.customElements.define("media-text-display",yo);var Ji=yo;var hu=class extends Ji{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME]}constructor(){super(),this.container.innerHTML=ni(0)}attributeChangedCallback(t,i,d){t===F.MEDIA_CURRENT_TIME&&(this.container.innerHTML=ni(d)),super.attributeChangedCallback(t,i,d)}};ce.customElements.get("media-current-time-display")||ce.customElements.define("media-current-time-display",hu);var fu=class extends Ji{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_DURATION]}constructor(){super(),this.container.innerHTML=ni(0)}attributeChangedCallback(t,i,d){t===F.MEDIA_DURATION&&(this.container.innerHTML=ni(d)),super.attributeChangedCallback(t,i,d)}};ce.customElements.get("media-duration-display")||ce.customElements.define("media-duration-display",fu);var cp="&nbsp;/&nbsp;",$c=(a,{timesSep:t=cp}={})=>{var i,d,v;let g=a.getAttribute("remaining")!=null,b=a.getAttribute("show-duration")!=null,L=(i=a.mediaCurrentTime)!=null?i:0,M=(v=(d=a.mediaDuration)!=null?d:a.mediaSeekableEnd)!=null?v:0,R=g?ni(0-(M-L)):ni(L);return b?`${R}${t}${ni(M)}`:R},hp="video not loaded, unknown time.",fp=a=>{let t=a.mediaCurrentTime,i=a.mediaDuration||a.mediaSeekableEnd;if(t==null||i==null){a.setAttribute("aria-valuetext",hp);return}let d=a.hasAttribute("remaining"),v=a.hasAttribute("show-duration"),g=d?Aa(0-(i-t)):Aa(t);if(!v){a.setAttribute("aria-valuetext",g);return}let b=Aa(i),L=`${g} of ${b}`;a.setAttribute("aria-valuetext",L)},mu=class extends Ji{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME,F.MEDIA_DURATION,F.MEDIA_SEEKABLE,"remaining","show-duration","disabled"]}constructor(){super(),this.container.innerHTML=$c(this)}connectedCallback(){this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",Pr.PLAYBACK_TIME()),super.connectedCallback()}disconnectedCallback(){this.disable()}attributeChangedCallback(t,i,d){if([F.MEDIA_CURRENT_TIME,F.MEDIA_DURATION,F.MEDIA_SEEKABLE,"remaining","show-duration"].includes(t)){let v=$c(this);fp(this),this.container.innerHTML=v}else t==="disabled"&&d!==i&&(d==null?this.enable():this.disable());super.attributeChangedCallback(t,i,d)}enable(){this.setAttribute("tabindex",0)}disable(){this.removeAttribute("tabindex")}get mediaDuration(){let t=this.getAttribute(F.MEDIA_DURATION);return t!=null?+t:void 0}get mediaCurrentTime(){let t=this.getAttribute(F.MEDIA_CURRENT_TIME);return t!=null?+t:void 0}get mediaSeekable(){let t=this.getAttribute(F.MEDIA_SEEKABLE);if(!!t)return t.split(":").map(i=>+i)}get mediaSeekableEnd(){var t;let[,i]=(t=this.mediaSeekable)!=null?t:[];return i}get mediaSeekableStart(){var t;let[i]=(t=this.mediaSeekable)!=null?t:[];return i}};ce.customElements.get("media-time-display")||ce.customElements.define("media-time-display",mu);var mp=`<svg aria-hidden="true" viewBox="0 0 26 24">
454
+ `;var yo=class extends ce.HTMLElement{static get observedAttributes(){return[tt.MEDIA_CONTROLLER]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Yc.content.cloneNode(!0)),this.container=this.shadowRoot.querySelector("#container")}attributeChangedCallback(t,r,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(r){let E=Me.getElementById(r);(v=E==null?void 0:E.unassociateElement)==null||v.call(E,this)}if(d){let E=Me.getElementById(d);(g=E==null?void 0:E.associateElement)==null||g.call(E,this)}}}connectedCallback(){var t;let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}};ce.customElements.get("media-text-display")||ce.customElements.define("media-text-display",yo);var Jr=yo;var hu=class extends Jr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME]}constructor(){super(),this.container.innerHTML=nr(0)}attributeChangedCallback(t,r,d){t===F.MEDIA_CURRENT_TIME&&(this.container.innerHTML=nr(d)),super.attributeChangedCallback(t,r,d)}};ce.customElements.get("media-current-time-display")||ce.customElements.define("media-current-time-display",hu);var fu=class extends Jr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_DURATION]}constructor(){super(),this.container.innerHTML=nr(0)}attributeChangedCallback(t,r,d){t===F.MEDIA_DURATION&&(this.container.innerHTML=nr(d)),super.attributeChangedCallback(t,r,d)}};ce.customElements.get("media-duration-display")||ce.customElements.define("media-duration-display",fu);var cp="&nbsp;/&nbsp;",$c=(a,{timesSep:t=cp}={})=>{var r,d,v;let g=a.getAttribute("remaining")!=null,E=a.getAttribute("show-duration")!=null,L=(r=a.mediaCurrentTime)!=null?r:0,M=(v=(d=a.mediaDuration)!=null?d:a.mediaSeekableEnd)!=null?v:0,R=g?nr(0-(M-L)):nr(L);return E?`${R}${t}${nr(M)}`:R},hp="video not loaded, unknown time.",fp=a=>{let t=a.mediaCurrentTime,r=a.mediaDuration||a.mediaSeekableEnd;if(t==null||r==null){a.setAttribute("aria-valuetext",hp);return}let d=a.hasAttribute("remaining"),v=a.hasAttribute("show-duration"),g=d?Aa(0-(r-t)):Aa(t);if(!v){a.setAttribute("aria-valuetext",g);return}let E=Aa(r),L=`${g} of ${E}`;a.setAttribute("aria-valuetext",L)},mu=class extends Jr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME,F.MEDIA_DURATION,F.MEDIA_SEEKABLE,"remaining","show-duration","disabled"]}constructor(){super(),this.container.innerHTML=$c(this)}connectedCallback(){this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",Pi.PLAYBACK_TIME()),super.connectedCallback()}disconnectedCallback(){this.disable()}attributeChangedCallback(t,r,d){if([F.MEDIA_CURRENT_TIME,F.MEDIA_DURATION,F.MEDIA_SEEKABLE,"remaining","show-duration"].includes(t)){let v=$c(this);fp(this),this.container.innerHTML=v}else t==="disabled"&&d!==r&&(d==null?this.enable():this.disable());super.attributeChangedCallback(t,r,d)}enable(){this.setAttribute("tabindex",0)}disable(){this.removeAttribute("tabindex")}get mediaDuration(){let t=this.getAttribute(F.MEDIA_DURATION);return t!=null?+t:void 0}get mediaCurrentTime(){let t=this.getAttribute(F.MEDIA_CURRENT_TIME);return t!=null?+t:void 0}get mediaSeekable(){let t=this.getAttribute(F.MEDIA_SEEKABLE);if(!!t)return t.split(":").map(r=>+r)}get mediaSeekableEnd(){var t;let[,r]=(t=this.mediaSeekable)!=null?t:[];return r}get mediaSeekableStart(){var t;let[r]=(t=this.mediaSeekable)!=null?t:[];return r}};ce.customElements.get("media-time-display")||ce.customElements.define("media-time-display",mu);var mp=`<svg aria-hidden="true" viewBox="0 0 26 24">
455
455
  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
456
456
  </svg>`,pp=`<svg aria-hidden="true" viewBox="0 0 26 24">
457
457
  <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/>
@@ -471,9 +471,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
471
471
 
472
472
  <slot name="on">${mp}</slot>
473
473
  <slot name="off">${pp}</slot>
474
- `;var zc=a=>{a.setAttribute("aria-checked",ts(a))},pu=class extends nr{static get observedAttributes(){return[...super.observedAttributes,"no-subtitles-fallback","default-showing",F.MEDIA_CAPTIONS_LIST,F.MEDIA_CAPTIONS_SHOWING,F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}constructor(t={}){super({slotTemplate:Qc,...t}),this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",Pr.CLOSED_CAPTIONS()),zc(this)}attributeChangedCallback(t,i,d){if([F.MEDIA_CAPTIONS_SHOWING,F.MEDIA_SUBTITLES_SHOWING].includes(t)&&zc(this),this.hasAttribute("default-showing")&&this.getAttribute("aria-checked")!=="true"){let v=!this.hasAttribute("no-subtitles-fallback");if((v?[F.MEDIA_CAPTIONS_LIST,F.MEDIA_SUBTITLES_LIST]:[F.MEDIA_CAPTIONS_LIST]).includes(t)){let b=!!this.getAttribute(F.MEDIA_CAPTIONS_LIST)||!!(v&&this.getAttribute(F.MEDIA_SUBTITLES_LIST));this._captionsReady!==b&&(this._captionsReady=b,this._captionsReady&&this.handleClick())}}super.attributeChangedCallback(t,i,d)}handleClick(){Xi(this)}};ce.customElements.get("media-captions-button")||ce.customElements.define("media-captions-button",pu);var vu="30",vp=`<svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(8.9 19.87)">${vu}</text><path d="M10 6V3l5.61 4L10 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 10 6Z"/></svg>`,Jc=Me.createElement("template");Jc.innerHTML=`
474
+ `;var zc=a=>{a.setAttribute("aria-checked",ts(a))},pu=class extends ni{static get observedAttributes(){return[...super.observedAttributes,"no-subtitles-fallback","default-showing",F.MEDIA_CAPTIONS_LIST,F.MEDIA_CAPTIONS_SHOWING,F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}constructor(t={}){super({slotTemplate:Qc,...t}),this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",Pi.CLOSED_CAPTIONS()),zc(this)}attributeChangedCallback(t,r,d){if([F.MEDIA_CAPTIONS_SHOWING,F.MEDIA_SUBTITLES_SHOWING].includes(t)&&zc(this),this.hasAttribute("default-showing")&&this.getAttribute("aria-checked")!=="true"){let v=!this.hasAttribute("no-subtitles-fallback");if((v?[F.MEDIA_CAPTIONS_LIST,F.MEDIA_SUBTITLES_LIST]:[F.MEDIA_CAPTIONS_LIST]).includes(t)){let E=!!this.getAttribute(F.MEDIA_CAPTIONS_LIST)||!!(v&&this.getAttribute(F.MEDIA_SUBTITLES_LIST));this._captionsReady!==E&&(this._captionsReady=E,this._captionsReady&&this.handleClick())}}super.attributeChangedCallback(t,r,d)}handleClick(){Xr(this)}};ce.customElements.get("media-captions-button")||ce.customElements.define("media-captions-button",pu);var vu="30",vp=`<svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(8.9 19.87)">${vu}</text><path d="M10 6V3l5.61 4L10 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 10 6Z"/></svg>`,Jc=Me.createElement("template");Jc.innerHTML=`
475
475
  <slot name="forward">${vp}</slot>
476
- `;var gp=0,Xc=a=>{let t=Math.abs(+a.getAttribute("seek-offset")),i=ur.SEEK_FORWARD_N_SECS({seekOffset:t});a.setAttribute("aria-label",i)},Zc=a=>{let t=lo(a,"forward"),i=a.getAttribute("seek-offset");oo(t,i)},gu=class extends nr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME,"seek-offset"]}constructor(t={}){super({slotTemplate:Jc,...t})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",vu),Xc(this),Zc(this),super.connectedCallback()}attributeChangedCallback(t,i,d){t==="seek-offset"&&(d==null&&this.setAttribute("seek-offset",vu),Zc(this),Xc(this)),super.attributeChangedCallback(t,i,d)}handleClick(){let t=this.getAttribute(F.MEDIA_CURRENT_TIME),i=+this.getAttribute("seek-offset"),v=(t&&!Number.isNaN(+t)?+t:gp)+i,g=new ce.CustomEvent(et.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(g)}};ce.customElements.get("media-seek-forward-button")||ce.customElements.define("media-seek-forward-button",gu);var Ep=`<svg aria-hidden="true" viewBox="0 0 26 24">
476
+ `;var gp=0,Xc=a=>{let t=Math.abs(+a.getAttribute("seek-offset")),r=ui.SEEK_FORWARD_N_SECS({seekOffset:t});a.setAttribute("aria-label",r)},Zc=a=>{let t=lo(a,"forward"),r=a.getAttribute("seek-offset");oo(t,r)},gu=class extends ni{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME,"seek-offset"]}constructor(t={}){super({slotTemplate:Jc,...t})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",vu),Xc(this),Zc(this),super.connectedCallback()}attributeChangedCallback(t,r,d){t==="seek-offset"&&(d==null&&this.setAttribute("seek-offset",vu),Zc(this),Xc(this)),super.attributeChangedCallback(t,r,d)}handleClick(){let t=this.getAttribute(F.MEDIA_CURRENT_TIME),r=+this.getAttribute("seek-offset"),v=(t&&!Number.isNaN(+t)?+t:gp)+r,g=new ce.CustomEvent(et.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(g)}};ce.customElements.get("media-seek-forward-button")||ce.customElements.define("media-seek-forward-button",gu);var Ep=`<svg aria-hidden="true" viewBox="0 0 26 24">
477
477
  <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/>
478
478
  </svg>`,yp=`<svg aria-hidden="true" viewBox="0 0 26 24">
479
479
  <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/>
@@ -493,7 +493,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
493
493
 
494
494
  <slot name="enter">${Ep}</slot>
495
495
  <slot name="exit">${yp}</slot>
496
- `;var eh=a=>{let i=a.getAttribute(F.MEDIA_IS_FULLSCREEN)!=null?ur.EXIT_FULLSCREEN():ur.ENTER_FULLSCREEN();a.setAttribute("aria-label",i)},Eu=class extends nr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_FULLSCREEN,F.MEDIA_FULLSCREEN_UNAVAILABLE]}constructor(t={}){super({slotTemplate:th,...t})}connectedCallback(){eh(this),super.connectedCallback()}attributeChangedCallback(t,i,d){t===F.MEDIA_IS_FULLSCREEN&&eh(this),super.attributeChangedCallback(t,i,d)}handleClick(){let t=this.getAttribute(F.MEDIA_IS_FULLSCREEN)!=null?et.MEDIA_EXIT_FULLSCREEN_REQUEST:et.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new ce.CustomEvent(t,{composed:!0,bubbles:!0}))}};ce.customElements.get("media-fullscreen-button")||ce.customElements.define("media-fullscreen-button",Eu);var{MEDIA_TIME_IS_LIVE:ds,MEDIA_PAUSED:rh}=F,{MEDIA_SEEK_TO_LIVE_REQUEST:bp,MEDIA_PLAY_REQUEST:Tp}=et,_p='<svg viewBox="0 0 8 16"><circle cx="4" cy="8" r="2"></circle></svg>',ih=Me.createElement("template");ih.innerHTML=`
496
+ `;var eh=a=>{let r=a.getAttribute(F.MEDIA_IS_FULLSCREEN)!=null?ui.EXIT_FULLSCREEN():ui.ENTER_FULLSCREEN();a.setAttribute("aria-label",r)},Eu=class extends ni{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_FULLSCREEN,F.MEDIA_FULLSCREEN_UNAVAILABLE]}constructor(t={}){super({slotTemplate:th,...t})}connectedCallback(){eh(this),super.connectedCallback()}attributeChangedCallback(t,r,d){t===F.MEDIA_IS_FULLSCREEN&&eh(this),super.attributeChangedCallback(t,r,d)}handleClick(){let t=this.getAttribute(F.MEDIA_IS_FULLSCREEN)!=null?et.MEDIA_EXIT_FULLSCREEN_REQUEST:et.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new ce.CustomEvent(t,{composed:!0,bubbles:!0}))}};ce.customElements.get("media-fullscreen-button")||ce.customElements.define("media-fullscreen-button",Eu);var{MEDIA_TIME_IS_LIVE:ds,MEDIA_PAUSED:ih}=F,{MEDIA_SEEK_TO_LIVE_REQUEST:bp,MEDIA_PLAY_REQUEST:Tp}=et,_p='<svg viewBox="0 0 8 16"><circle cx="4" cy="8" r="2"></circle></svg>',rh=Me.createElement("template");rh.innerHTML=`
497
497
  <style>
498
498
 
499
499
  slot[name=indicator] > *,
@@ -522,7 +522,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
522
522
  between slotted items and default slots.
523
523
  -->
524
524
  <slot name="spacer">&nbsp;</slot><slot name="text">LIVE</slot>
525
- `;var yu=class extends nr{static get observedAttributes(){return[...super.observedAttributes,rh,ds]}constructor(t={}){super({slotTemplate:ih,...t}),this.setAttribute("aria-label","Seek to Live")}attributeChangedCallback(t,i,d){super.attributeChangedCallback(t,i,d)}handleClick(){this.getAttribute(ds)===null&&(this.dispatchEvent(new ce.CustomEvent(bp,{composed:!0,bubbles:!0})),this.getAttribute(rh)!==null&&this.dispatchEvent(new ce.CustomEvent(Tp,{composed:!0,bubbles:!0})))}};ce.customElements.get("media-live-button")||ce.customElements.define("media-live-button",yu);var Ap=`<svg aria-hidden="true" viewBox="0 0 24 24">
525
+ `;var yu=class extends ni{static get observedAttributes(){return[...super.observedAttributes,ih,ds]}constructor(t={}){super({slotTemplate:rh,...t}),this.setAttribute("aria-label","Seek to Live")}attributeChangedCallback(t,r,d){super.attributeChangedCallback(t,r,d)}handleClick(){this.getAttribute(ds)===null&&(this.dispatchEvent(new ce.CustomEvent(bp,{composed:!0,bubbles:!0})),this.getAttribute(ih)!==null&&this.dispatchEvent(new ce.CustomEvent(Tp,{composed:!0,bubbles:!0})))}};ce.customElements.get("media-live-button")||ce.customElements.define("media-live-button",yu);var Ap=`<svg aria-hidden="true" viewBox="0 0 24 24">
526
526
  <path d="M16.5 12A4.5 4.5 0 0 0 14 8v2.18l2.45 2.45a4.22 4.22 0 0 0 .05-.63Zm2.5 0a6.84 6.84 0 0 1-.54 2.64L20 16.15A8.8 8.8 0 0 0 21 12a9 9 0 0 0-7-8.77v2.06A7 7 0 0 1 19 12ZM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25A6.92 6.92 0 0 1 14 18.7v2.06A9 9 0 0 0 17.69 19l2 2.05L21 19.73l-9-9L4.27 3ZM12 4 9.91 6.09 12 8.18V4Z"/>
527
527
  </svg>`,ah=`<svg aria-hidden="true" viewBox="0 0 24 24">
528
528
  <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4Z"/>
@@ -558,7 +558,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
558
558
  <slot name="low">${ah}</slot>
559
559
  <slot name="medium">${ah}</slot>
560
560
  <slot name="high">${Sp}</slot>
561
- `;var nh=a=>{let i=a.getAttribute(F.MEDIA_VOLUME_LEVEL)==="off"?ur.UNMUTE():ur.MUTE();a.setAttribute("aria-label",i)},bu=class extends nr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_VOLUME_LEVEL]}constructor(t={}){super({slotTemplate:sh,...t})}connectedCallback(){nh(this),super.connectedCallback()}attributeChangedCallback(t,i,d){t===F.MEDIA_VOLUME_LEVEL&&nh(this),super.attributeChangedCallback(t,i,d)}handleClick(){let t=this.getAttribute(F.MEDIA_VOLUME_LEVEL)==="off"?et.MEDIA_UNMUTE_REQUEST:et.MEDIA_MUTE_REQUEST;this.dispatchEvent(new ce.CustomEvent(t,{composed:!0,bubbles:!0}))}};ce.customElements.get("media-mute-button")||ce.customElements.define("media-mute-button",bu);var oh=`<svg aria-hidden="true" viewBox="0 0 28 24">
561
+ `;var nh=a=>{let r=a.getAttribute(F.MEDIA_VOLUME_LEVEL)==="off"?ui.UNMUTE():ui.MUTE();a.setAttribute("aria-label",r)},bu=class extends ni{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_VOLUME_LEVEL]}constructor(t={}){super({slotTemplate:sh,...t})}connectedCallback(){nh(this),super.connectedCallback()}attributeChangedCallback(t,r,d){t===F.MEDIA_VOLUME_LEVEL&&nh(this),super.attributeChangedCallback(t,r,d)}handleClick(){let t=this.getAttribute(F.MEDIA_VOLUME_LEVEL)==="off"?et.MEDIA_UNMUTE_REQUEST:et.MEDIA_MUTE_REQUEST;this.dispatchEvent(new ce.CustomEvent(t,{composed:!0,bubbles:!0}))}};ce.customElements.get("media-mute-button")||ce.customElements.define("media-mute-button",bu);var oh=`<svg aria-hidden="true" viewBox="0 0 28 24">
562
562
  <path d="M24 3H4a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h20a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Zm-1 16H5V5h18v14Zm-3-8h-7v5h7v-5Z"/>
563
563
  </svg>`,uh=Me.createElement("template");uh.innerHTML=`
564
564
  <style>
@@ -576,9 +576,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
576
576
 
577
577
  <slot name="enter">${oh}</slot>
578
578
  <slot name="exit">${oh}</slot>
579
- `;var lh=a=>{let i=a.getAttribute(F.MEDIA_IS_PIP)!=null?ur.EXIT_PIP():ur.ENTER_PIP();a.setAttribute("aria-label",i)},Tu=class extends nr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_PIP,F.MEDIA_PIP_UNAVAILABLE]}constructor(t={}){super({slotTemplate:uh,...t})}connectedCallback(){lh(this),super.connectedCallback()}attributeChangedCallback(t,i,d){t===F.MEDIA_IS_PIP&&lh(this),super.attributeChangedCallback(t,i,d)}handleClick(){let t=this.getAttribute(F.MEDIA_IS_PIP)!=null?et.MEDIA_EXIT_PIP_REQUEST:et.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new ce.CustomEvent(t,{composed:!0,bubbles:!0}))}};ce.customElements.get("media-pip-button")||ce.customElements.define("media-pip-button",Tu);var kp=`<svg aria-hidden="true" viewBox="0 0 24 24">
579
+ `;var lh=a=>{let r=a.getAttribute(F.MEDIA_IS_PIP)!=null?ui.EXIT_PIP():ui.ENTER_PIP();a.setAttribute("aria-label",r)},Tu=class extends ni{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_PIP,F.MEDIA_PIP_UNAVAILABLE]}constructor(t={}){super({slotTemplate:uh,...t})}connectedCallback(){lh(this),super.connectedCallback()}attributeChangedCallback(t,r,d){t===F.MEDIA_IS_PIP&&lh(this),super.attributeChangedCallback(t,r,d)}handleClick(){let t=this.getAttribute(F.MEDIA_IS_PIP)!=null?et.MEDIA_EXIT_PIP_REQUEST:et.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new ce.CustomEvent(t,{composed:!0,bubbles:!0}))}};ce.customElements.get("media-pip-button")||ce.customElements.define("media-pip-button",Tu);var kp=`<svg aria-hidden="true" viewBox="0 0 24 24">
580
580
  <path d="m6 21 15-9L6 3v18Z"/>
581
- </svg>`,wp=`<svg aria-hidden="true" viewBox="0 0 24 24">
581
+ </svg>`,Ip=`<svg aria-hidden="true" viewBox="0 0 24 24">
582
582
  <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/>
583
583
  </svg>`,ch=Me.createElement("template");ch.innerHTML=`
584
584
  <style>
@@ -594,10 +594,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
594
594
  </style>
595
595
 
596
596
  <slot name="play">${kp}</slot>
597
- <slot name="pause">${wp}</slot>
598
- `;var dh=a=>{let i=a.getAttribute(F.MEDIA_PAUSED)!=null?ur.PLAY():ur.PAUSE();a.setAttribute("aria-label",i)},_u=class extends nr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PAUSED]}constructor(t={}){super({slotTemplate:ch,...t})}connectedCallback(){dh(this),super.connectedCallback()}attributeChangedCallback(t,i,d){t===F.MEDIA_PAUSED&&dh(this),super.attributeChangedCallback(t,i,d)}handleClick(){let t=this.getAttribute(F.MEDIA_PAUSED)!=null?et.MEDIA_PLAY_REQUEST:et.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new ce.CustomEvent(t,{composed:!0,bubbles:!0}))}};ce.customElements.get("media-play-button")||ce.customElements.define("media-play-button",_u);var hh=[1,1.25,1.5,1.75,2],bo=1,fh=Me.createElement("template");fh.innerHTML=`
597
+ <slot name="pause">${Ip}</slot>
598
+ `;var dh=a=>{let r=a.getAttribute(F.MEDIA_PAUSED)!=null?ui.PLAY():ui.PAUSE();a.setAttribute("aria-label",r)},_u=class extends ni{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PAUSED]}constructor(t={}){super({slotTemplate:ch,...t})}connectedCallback(){dh(this),super.connectedCallback()}attributeChangedCallback(t,r,d){t===F.MEDIA_PAUSED&&dh(this),super.attributeChangedCallback(t,r,d)}handleClick(){let t=this.getAttribute(F.MEDIA_PAUSED)!=null?et.MEDIA_PLAY_REQUEST:et.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new ce.CustomEvent(t,{composed:!0,bubbles:!0}))}};ce.customElements.get("media-play-button")||ce.customElements.define("media-play-button",_u);var hh=[1,1.25,1.5,1.75,2],bo=1,fh=Me.createElement("template");fh.innerHTML=`
599
599
  <span id="container"></span>
600
- `;var Au=class extends nr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PLAYBACK_RATE,"rates"]}constructor(t={}){super({slotTemplate:fh,...t}),this._rates=hh,this.container=this.shadowRoot.querySelector("#container"),this.container.innerHTML=`${bo}x`}attributeChangedCallback(t,i,d){if(t==="rates"){let v=(d!=null?d:"").trim().split(/\s*,?\s+/).map(g=>Number(g)).filter(g=>!Number.isNaN(g)).sort((g,b)=>g-b);this._rates=v.length?v:hh;return}if(t===F.MEDIA_PLAYBACK_RATE){let v=d?+d:Number.NaN,g=Number.isNaN(v)?bo:v;this.container.innerHTML=`${g}x`,this.setAttribute("aria-label",Pr.PLAYBACK_RATE({playbackRate:g}));return}super.attributeChangedCallback(t,i,d)}handleClick(){var t,i;let d=+this.getAttribute(F.MEDIA_PLAYBACK_RATE)||bo,v=(i=(t=this._rates.find(b=>b>d))!=null?t:this._rates[0])!=null?i:bo,g=new ce.CustomEvent(et.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(g)}};ce.customElements.get("media-playback-rate-button")||ce.customElements.define("media-playback-rate-button",Au);var mh=Me.createElement("template");mh.innerHTML=`
600
+ `;var Au=class extends ni{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PLAYBACK_RATE,"rates"]}constructor(t={}){super({slotTemplate:fh,...t}),this._rates=hh,this.container=this.shadowRoot.querySelector("#container"),this.container.innerHTML=`${bo}x`}attributeChangedCallback(t,r,d){if(t==="rates"){let v=(d!=null?d:"").trim().split(/\s*,?\s+/).map(g=>Number(g)).filter(g=>!Number.isNaN(g)).sort((g,E)=>g-E);this._rates=v.length?v:hh;return}if(t===F.MEDIA_PLAYBACK_RATE){let v=d?+d:Number.NaN,g=Number.isNaN(v)?bo:v;this.container.innerHTML=`${g}x`,this.setAttribute("aria-label",Pi.PLAYBACK_RATE({playbackRate:g}));return}super.attributeChangedCallback(t,r,d)}handleClick(){var t,r;let d=+this.getAttribute(F.MEDIA_PLAYBACK_RATE)||bo,v=(r=(t=this._rates.find(E=>E>d))!=null?t:this._rates[0])!=null?r:bo,g=new ce.CustomEvent(et.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(g)}};ce.customElements.get("media-playback-rate-button")||ce.customElements.define("media-playback-rate-button",Au);var mh=Me.createElement("template");mh.innerHTML=`
601
601
  <style>
602
602
  :host {
603
603
  pointer-events: none;
@@ -619,7 +619,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
619
619
  </style>
620
620
 
621
621
  <img aria-hidden="true" id="image"/>
622
- `;var Ip=a=>{a.style.removeProperty("background-image")},Lp=(a,t)=>{a.style["background-image"]=`url('${t}')`},Su=class extends ce.HTMLElement{static get observedAttributes(){return["placeholder-src","src"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(mh.content.cloneNode(!0)),this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(t,i,d){t==="src"&&(d==null?this.image.removeAttribute("src"):this.image.setAttribute("src",d)),t==="placeholder-src"&&(d==null?Ip(this.image):Lp(this.image,d))}};ce.customElements.get("media-poster-image")||ce.customElements.define("media-poster-image",Su);var Ru=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},Ir=(a,t,i)=>(Ru(a,t,"read from private field"),i?i.call(a):t.get(a)),zr=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},ea=(a,t,i,d)=>(Ru(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),cs=(a,t,i)=>(Ru(a,t,"access private method"),i),hs,To,fs,ko,wo,_o,wu,Ao,mn,ms,Iu,Io,Do,So,Lu,Du,ph,Dp="video not loaded, unknown time.",ku=a=>{let t=a.range,i=Aa(+t.value),d=Aa(+t.max),v=i&&d?`${i} of ${d}`:Dp;t.setAttribute("aria-valuetext",v)},vh=Me.createElement("template");vh.innerHTML=`
622
+ `;var wp=a=>{a.style.removeProperty("background-image")},Lp=(a,t)=>{a.style["background-image"]=`url('${t}')`},Su=class extends ce.HTMLElement{static get observedAttributes(){return["placeholder-src","src"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(mh.content.cloneNode(!0)),this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(t,r,d){t==="src"&&(d==null?this.image.removeAttribute("src"):this.image.setAttribute("src",d)),t==="placeholder-src"&&(d==null?wp(this.image):Lp(this.image,d))}};ce.customElements.get("media-poster-image")||ce.customElements.define("media-poster-image",Su);var Ru=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},wi=(a,t,r)=>(Ru(a,t,"read from private field"),r?r.call(a):t.get(a)),zi=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},ea=(a,t,r,d)=>(Ru(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),cs=(a,t,r)=>(Ru(a,t,"access private method"),r),hs,To,fs,ko,Io,_o,Iu,Ao,mn,ms,wu,wo,Do,So,Lu,Du,ph,Dp="video not loaded, unknown time.",ku=a=>{let t=a.range,r=Aa(+t.value),d=Aa(+t.max),v=r&&d?`${r} of ${d}`:Dp;t.setAttribute("aria-valuetext",v)},vh=Me.createElement("template");vh.innerHTML=`
623
623
  <style>
624
624
  :host {
625
625
  --media-preview-background-color: rgba(20,20,30, .5);
@@ -723,9 +723,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
723
723
 
724
724
  </slot>
725
725
  </div>
726
- `;var Lo=class extends us{constructor(){super(),zr(this,_o),zr(this,So),zr(this,Du),zr(this,hs,void 0),zr(this,To,void 0),zr(this,fs,void 0),zr(this,ko,void 0),zr(this,wo,void 0),zr(this,Ao,i=>{if([...Ir(this,hs)].some(y=>i.composedPath().includes(y)))return;this.updatePointerBar(i);let d=+this.getAttribute(F.MEDIA_DURATION);if(!d)return;let v=this.range.getBoundingClientRect(),g=(i.clientX-v.left)/v.width;g=Math.max(0,Math.min(1,g));let b=cs(this,_o,wu).call(this,Ir(this,To),g),{style:L}=Li(this.shadowRoot,"#preview-rail");L.transform=`translateX(${b})`;let M=g*d,R=new ce.CustomEvent(et.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:M});this.dispatchEvent(R)}),zr(this,mn,!1),zr(this,ms,i=>{(!i.composedPath().includes(this)||[...Ir(this,hs)].some(d=>i.composedPath().includes(d)))&&(ce.removeEventListener("pointermove",Ir(this,ms)),ea(this,mn,!1),Ir(this,Io).call(this))}),zr(this,Iu,()=>{ce.addEventListener("pointermove",Ir(this,Ao),!1)}),zr(this,Io,()=>{ce.removeEventListener("pointermove",Ir(this,Ao));let i=new ce.CustomEvent(et.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:null});this.dispatchEvent(i)}),zr(this,Do,()=>{let i=this.getAttribute(F.MEDIA_DURATION);!Ir(this,mn)&&i&&(ea(this,mn,!0),Ir(this,Iu).call(this),ce.addEventListener("pointermove",Ir(this,ms),!1))}),this.container.appendChild(vh.content.cloneNode(!0)),this.range.addEventListener("input",()=>{cancelAnimationFrame(this._refreshId);let d=this.range.value,v=new ce.CustomEvent(et.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:d});this.dispatchEvent(v)}),this._refreshBar=()=>{let i=(performance.now()-this._updateTimestamp)/1e3;this.range.value=this.mediaCurrentTime+i*this.mediaPlaybackRate,this.updateBar(),this.updateCurrentBox(),this._refreshId=requestAnimationFrame(this._refreshBar)},ea(this,hs,this.shadowRoot.querySelectorAll('[part~="box"]')),ea(this,To,this.shadowRoot.querySelector('[part~="preview-box"]')),ea(this,fs,this.shadowRoot.querySelector('[part~="current-box"]'));let t=getComputedStyle(this);ea(this,ko,parseInt(t.getPropertyValue("--media-box-padding-left"))),ea(this,wo,parseInt(t.getPropertyValue("--media-box-padding-right"))),cs(this,So,Lu).call(this)}static get observedAttributes(){return[...super.observedAttributes,"thumbnails","disabled",F.MEDIA_PAUSED,F.MEDIA_DURATION,F.MEDIA_SEEKABLE,F.MEDIA_CURRENT_TIME,F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_TIME,F.MEDIA_BUFFERED,F.MEDIA_PLAYBACK_RATE,F.MEDIA_LOADING]}connectedCallback(){this.range.setAttribute("aria-label",Pr.SEEK()),super.connectedCallback()}disconnectedCallback(){cancelAnimationFrame(this._refreshId),super.disconnectedCallback()}attributeChangedCallback(t,i,d){var v,g,b,L,M;(t===F.MEDIA_CURRENT_TIME||t===F.MEDIA_PAUSED||t===F.MEDIA_LOADING)&&(this._updateTimestamp=performance.now(),this.range.value=this.mediaCurrentTime,ku(this),this.updateBar(),this.updateCurrentBox(),cancelAnimationFrame(this._refreshId),!this.mediaPaused&&!this.mediaLoading&&(this._refreshId=requestAnimationFrame(this._refreshBar))),t===F.MEDIA_DURATION&&(this.range.max=(g=(v=this.mediaSeekableEnd)!=null?v:this.mediaDuration)!=null?g:1e3,ku(this),this.updateBar(),this.updateCurrentBox()),t===F.MEDIA_SEEKABLE&&(this.range.min=(b=this.mediaSeekableStart)!=null?b:0,this.range.max=(M=(L=this.mediaSeekableEnd)!=null?L:this.mediaDuration)!=null?M:1e3,ku(this),this.updateBar()),t===F.MEDIA_BUFFERED&&this.updateBar(),t==="disabled"&&(d==null?cs(this,So,Lu).call(this):cs(this,Du,ph).call(this)),super.attributeChangedCallback(t,i,d)}get mediaPaused(){return this.hasAttribute(F.MEDIA_PAUSED)}get mediaLoading(){return this.hasAttribute(F.MEDIA_LOADING)}get mediaDuration(){let t=this.getAttribute(F.MEDIA_DURATION);return t!=null?+t:void 0}get mediaCurrentTime(){let t=this.getAttribute(F.MEDIA_CURRENT_TIME);return t!=null?+t:void 0}get mediaPlaybackRate(){let t=this.getAttribute(F.MEDIA_PLAYBACK_RATE);return t!=null?+t:1}get mediaBuffered(){let t=this.getAttribute(F.MEDIA_BUFFERED);return t?t.split(" ").map(i=>i.split(":").map(d=>+d)):[]}get mediaSeekable(){let t=this.getAttribute(F.MEDIA_SEEKABLE);if(!!t)return t.split(":").map(i=>+i)}get mediaSeekableEnd(){var t;let[,i]=(t=this.mediaSeekable)!=null?t:[];return i}get mediaSeekableStart(){var t;let[i]=(t=this.mediaSeekable)!=null?t:[];return i}getBarColors(){var t;let i=super.getBarColors(),{range:d}=this,v=d.max-d.min,g=this.mediaBuffered;if(!g.length||!Number.isFinite(v)||v<=0)return i;let b=this.mediaCurrentTime,[,L=d.min]=(t=g.find(([y,P])=>y<=b&&b<=P))!=null?t:[],R=(L-d.min)/v*100;return i.splice(1,0,["var(--media-time-buffered-color, rgba(255,255,255, .4))",R]),i}updateCurrentBox(){if(!Ir(this,fs).assignedElements().length)return;let t=this.range.value/(this.range.max-this.range.min),i=cs(this,_o,wu).call(this,Ir(this,fs),t),{style:d}=Li(this.shadowRoot,"#current-rail");d.transform=`translateX(${i})`}};hs=new WeakMap;To=new WeakMap;fs=new WeakMap;ko=new WeakMap;wo=new WeakMap;_o=new WeakSet;wu=function(a,t){var i;let d=`${t*100*100}%`,v=a.offsetWidth;if(!v)return d;let g=(i=this.getAttribute("bounds")?ka(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?i:this,b=this.range.getBoundingClientRect(),L=g.getBoundingClientRect(),M=(Ir(this,ko)-(b.left-L.left-v/2))/b.width*100,R=(L.right-b.left-v/2-Ir(this,wo))/b.width*100;return Number.isNaN(M)||(d=`max(${M*100}%, ${d})`),Number.isNaN(R)||(d=`min(${d}, ${R*100}%)`),d};Ao=new WeakMap;mn=new WeakMap;ms=new WeakMap;Iu=new WeakMap;Io=new WeakMap;Do=new WeakMap;So=new WeakSet;Lu=function(){this.addEventListener("pointermove",Ir(this,Do),!1)};Du=new WeakSet;ph=function(){ce.removeEventListener("pointermove",Ir(this,ms)),this.removeEventListener("pointermove",Ir(this,Do)),ea(this,mn,!1),Ir(this,Io).call(this)};ce.customElements.get("media-time-range")||ce.customElements.define("media-time-range",Lo);var Cu=Lo;var Mu=class extends Cu{constructor(){super(),console.warn("MediaChrome: <media-progress-range> is deprecated. Use <media-time-range> instead.")}};ce.customElements.get("media-progress-range")||ce.customElements.define("media-progress-range",Mu);var xu="30",Rp=`<svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(2.18 19.87)">${xu}</text><path d="M10 6V3L4.37 7 10 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 10 6Z"/></svg>`,yh=Me.createElement("template");yh.innerHTML=`
726
+ `;var Lo=class extends us{constructor(){super(),zi(this,_o),zi(this,So),zi(this,Du),zi(this,hs,void 0),zi(this,To,void 0),zi(this,fs,void 0),zi(this,ko,void 0),zi(this,Io,void 0),zi(this,Ao,r=>{if([...wi(this,hs)].some(b=>r.composedPath().includes(b)))return;this.updatePointerBar(r);let d=+this.getAttribute(F.MEDIA_DURATION);if(!d)return;let v=this.range.getBoundingClientRect(),g=(r.clientX-v.left)/v.width;g=Math.max(0,Math.min(1,g));let E=cs(this,_o,Iu).call(this,wi(this,To),g),{style:L}=Lr(this.shadowRoot,"#preview-rail");L.transform=`translateX(${E})`;let M=g*d,R=new ce.CustomEvent(et.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:M});this.dispatchEvent(R)}),zi(this,mn,!1),zi(this,ms,r=>{(!r.composedPath().includes(this)||[...wi(this,hs)].some(d=>r.composedPath().includes(d)))&&(ce.removeEventListener("pointermove",wi(this,ms)),ea(this,mn,!1),wi(this,wo).call(this))}),zi(this,wu,()=>{ce.addEventListener("pointermove",wi(this,Ao),!1)}),zi(this,wo,()=>{ce.removeEventListener("pointermove",wi(this,Ao));let r=new ce.CustomEvent(et.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:null});this.dispatchEvent(r)}),zi(this,Do,()=>{let r=this.getAttribute(F.MEDIA_DURATION);!wi(this,mn)&&r&&(ea(this,mn,!0),wi(this,wu).call(this),ce.addEventListener("pointermove",wi(this,ms),!1))}),this.container.appendChild(vh.content.cloneNode(!0)),this.range.addEventListener("input",()=>{cancelAnimationFrame(this._refreshId);let d=this.range.value,v=new ce.CustomEvent(et.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:d});this.dispatchEvent(v)}),this._refreshBar=()=>{let r=(performance.now()-this._updateTimestamp)/1e3;this.range.value=this.mediaCurrentTime+r*this.mediaPlaybackRate,this.updateBar(),this.updateCurrentBox(),this._refreshId=requestAnimationFrame(this._refreshBar)},ea(this,hs,this.shadowRoot.querySelectorAll('[part~="box"]')),ea(this,To,this.shadowRoot.querySelector('[part~="preview-box"]')),ea(this,fs,this.shadowRoot.querySelector('[part~="current-box"]'));let t=getComputedStyle(this);ea(this,ko,parseInt(t.getPropertyValue("--media-box-padding-left"))),ea(this,Io,parseInt(t.getPropertyValue("--media-box-padding-right"))),cs(this,So,Lu).call(this)}static get observedAttributes(){return[...super.observedAttributes,"thumbnails","disabled",F.MEDIA_PAUSED,F.MEDIA_DURATION,F.MEDIA_SEEKABLE,F.MEDIA_CURRENT_TIME,F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_TIME,F.MEDIA_BUFFERED,F.MEDIA_PLAYBACK_RATE,F.MEDIA_LOADING]}connectedCallback(){this.range.setAttribute("aria-label",Pi.SEEK()),super.connectedCallback()}disconnectedCallback(){cancelAnimationFrame(this._refreshId),super.disconnectedCallback()}attributeChangedCallback(t,r,d){var v,g,E,L,M;(t===F.MEDIA_CURRENT_TIME||t===F.MEDIA_PAUSED||t===F.MEDIA_LOADING)&&(this._updateTimestamp=performance.now(),this.range.value=this.mediaCurrentTime,ku(this),this.updateBar(),this.updateCurrentBox(),cancelAnimationFrame(this._refreshId),!this.mediaPaused&&!this.mediaLoading&&(this._refreshId=requestAnimationFrame(this._refreshBar))),t===F.MEDIA_DURATION&&(this.range.max=(g=(v=this.mediaSeekableEnd)!=null?v:this.mediaDuration)!=null?g:1e3,ku(this),this.updateBar(),this.updateCurrentBox()),t===F.MEDIA_SEEKABLE&&(this.range.min=(E=this.mediaSeekableStart)!=null?E:0,this.range.max=(M=(L=this.mediaSeekableEnd)!=null?L:this.mediaDuration)!=null?M:1e3,ku(this),this.updateBar()),t===F.MEDIA_BUFFERED&&this.updateBar(),t==="disabled"&&(d==null?cs(this,So,Lu).call(this):cs(this,Du,ph).call(this)),super.attributeChangedCallback(t,r,d)}get mediaPaused(){return this.hasAttribute(F.MEDIA_PAUSED)}get mediaLoading(){return this.hasAttribute(F.MEDIA_LOADING)}get mediaDuration(){let t=this.getAttribute(F.MEDIA_DURATION);return t!=null?+t:void 0}get mediaCurrentTime(){let t=this.getAttribute(F.MEDIA_CURRENT_TIME);return t!=null?+t:void 0}get mediaPlaybackRate(){let t=this.getAttribute(F.MEDIA_PLAYBACK_RATE);return t!=null?+t:1}get mediaBuffered(){let t=this.getAttribute(F.MEDIA_BUFFERED);return t?t.split(" ").map(r=>r.split(":").map(d=>+d)):[]}get mediaSeekable(){let t=this.getAttribute(F.MEDIA_SEEKABLE);if(!!t)return t.split(":").map(r=>+r)}get mediaSeekableEnd(){var t;let[,r]=(t=this.mediaSeekable)!=null?t:[];return r}get mediaSeekableStart(){var t;let[r]=(t=this.mediaSeekable)!=null?t:[];return r}getBarColors(){var t;let r=super.getBarColors(),{range:d}=this,v=d.max-d.min,g=this.mediaBuffered;if(!g.length||!Number.isFinite(v)||v<=0)return r;let E=this.mediaCurrentTime,[,L=d.min]=(t=g.find(([b,P])=>b<=E&&E<=P))!=null?t:[],R=(L-d.min)/v*100;return r.splice(1,0,["var(--media-time-buffered-color, rgba(255,255,255, .4))",R]),r}updateCurrentBox(){if(!wi(this,fs).assignedElements().length)return;let t=this.range.value/(this.range.max-this.range.min),r=cs(this,_o,Iu).call(this,wi(this,fs),t),{style:d}=Lr(this.shadowRoot,"#current-rail");d.transform=`translateX(${r})`}};hs=new WeakMap;To=new WeakMap;fs=new WeakMap;ko=new WeakMap;Io=new WeakMap;_o=new WeakSet;Iu=function(a,t){var r;let d=`${t*100*100}%`,v=a.offsetWidth;if(!v)return d;let g=(r=this.getAttribute("bounds")?ka(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?r:this,E=this.range.getBoundingClientRect(),L=g.getBoundingClientRect(),M=(wi(this,ko)-(E.left-L.left-v/2))/E.width*100,R=(L.right-E.left-v/2-wi(this,Io))/E.width*100;return Number.isNaN(M)||(d=`max(${M*100}%, ${d})`),Number.isNaN(R)||(d=`min(${d}, ${R*100}%)`),d};Ao=new WeakMap;mn=new WeakMap;ms=new WeakMap;wu=new WeakMap;wo=new WeakMap;Do=new WeakMap;So=new WeakSet;Lu=function(){this.addEventListener("pointermove",wi(this,Do),!1)};Du=new WeakSet;ph=function(){ce.removeEventListener("pointermove",wi(this,ms)),this.removeEventListener("pointermove",wi(this,Do)),ea(this,mn,!1),wi(this,wo).call(this)};ce.customElements.get("media-time-range")||ce.customElements.define("media-time-range",Lo);var Cu=Lo;var Mu=class extends Cu{constructor(){super(),console.warn("MediaChrome: <media-progress-range> is deprecated. Use <media-time-range> instead.")}};ce.customElements.get("media-progress-range")||ce.customElements.define("media-progress-range",Mu);var xu="30",Rp=`<svg aria-hidden="true" viewBox="0 0 20 24"><defs><style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style></defs><text class="text value" transform="translate(2.18 19.87)">${xu}</text><path d="M10 6V3L4.37 7 10 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 10 6Z"/></svg>`,yh=Me.createElement("template");yh.innerHTML=`
727
727
  <slot name="backward">${Rp}</slot>
728
- `;var Cp=0,gh=a=>{let t=Math.abs(+a.getAttribute("seek-offset")),i=ur.SEEK_BACK_N_SECS({seekOffset:t});a.setAttribute("aria-label",i)},Eh=a=>{let t=lo(a,"backward"),i=a.getAttribute("seek-offset");oo(t,i)},Ou=class extends nr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME]}constructor(t={}){super({slotTemplate:yh,...t})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",xu),gh(this),Eh(this),super.connectedCallback()}attributeChangedCallback(t,i,d){t==="seek-offset"&&(d==null&&this.setAttribute("seek-offset",xu),Eh(this),gh(this)),super.attributeChangedCallback(t,i,d)}handleClick(){let t=this.getAttribute(F.MEDIA_CURRENT_TIME),i=+this.getAttribute("seek-offset"),d=t&&!Number.isNaN(+t)?+t:Cp,v=Math.max(d-i,0),g=new ce.CustomEvent(et.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(g)}};ce.customElements.get("media-seek-backward-button")||ce.customElements.define("media-seek-backward-button",Ou);var Pu=class extends Ji{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PREVIEW_TIME]}attributeChangedCallback(t,i,d){t===F.MEDIA_PREVIEW_TIME&&d!=null&&(this.container.textContent=ni(d)),super.attributeChangedCallback(t,i,d)}};ce.customElements.get("media-preview-time-display")||ce.customElements.define("media-preview-time-display",Pu);var bh=Me.createElement("template");bh.innerHTML=`
728
+ `;var Cp=0,gh=a=>{let t=Math.abs(+a.getAttribute("seek-offset")),r=ui.SEEK_BACK_N_SECS({seekOffset:t});a.setAttribute("aria-label",r)},Eh=a=>{let t=lo(a,"backward"),r=a.getAttribute("seek-offset");oo(t,r)},Ou=class extends ni{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME]}constructor(t={}){super({slotTemplate:yh,...t})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",xu),gh(this),Eh(this),super.connectedCallback()}attributeChangedCallback(t,r,d){t==="seek-offset"&&(d==null&&this.setAttribute("seek-offset",xu),Eh(this),gh(this)),super.attributeChangedCallback(t,r,d)}handleClick(){let t=this.getAttribute(F.MEDIA_CURRENT_TIME),r=+this.getAttribute("seek-offset"),d=t&&!Number.isNaN(+t)?+t:Cp,v=Math.max(d-r,0),g=new ce.CustomEvent(et.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(g)}};ce.customElements.get("media-seek-backward-button")||ce.customElements.define("media-seek-backward-button",Ou);var Pu=class extends Jr{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PREVIEW_TIME]}attributeChangedCallback(t,r,d){t===F.MEDIA_PREVIEW_TIME&&d!=null&&(this.container.textContent=nr(d)),super.attributeChangedCallback(t,r,d)}};ce.customElements.get("media-preview-time-display")||ce.customElements.define("media-preview-time-display",Pu);var bh=Me.createElement("template");bh.innerHTML=`
729
729
  <style>
730
730
  :host {
731
731
  box-sizing: border-box;
@@ -739,7 +739,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
739
739
  }
740
740
  </style>
741
741
  <img crossorigin loading="eager" decoding="async" />
742
- `;var Nu=class extends ce.HTMLElement{static get observedAttributes(){return[tt.MEDIA_CONTROLLER,"time",F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_COORDS]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(bh.content.cloneNode(!0))}connectedCallback(){var t;let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}attributeChangedCallback(t,i,d){var v,g;if(["time",F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_COORDS].includes(t)&&this.update(),t===tt.MEDIA_CONTROLLER){if(i){let b=Me.getElementById(i);(v=b==null?void 0:b.unassociateElement)==null||v.call(b,this)}if(d){let b=Me.getElementById(d);(g=b==null?void 0:b.associateElement)==null||g.call(b,this)}}}update(){let t=this.getAttribute(F.MEDIA_PREVIEW_COORDS),i=this.getAttribute(F.MEDIA_PREVIEW_IMAGE);if(!(t&&i))return;let[d,v,g,b]=t.split(/\s+/).map(be=>+be),L=i.split("#")[0],M=getComputedStyle(this),{maxWidth:R,maxHeight:y,minWidth:P,minHeight:O}=M,ue=Math.min(parseInt(R)/g,parseInt(y)/b),Q=Math.max(parseInt(P)/g,parseInt(O)/b),de=ue<1,he=de?ue:Q>1?Q:1,{style:Y}=Li(this.shadowRoot,":host"),pe=Li(this.shadowRoot,"img").style,X=this.shadowRoot.querySelector("img"),oe=de?"min":"max";Y.setProperty(`${oe}-width`,"initial","important"),Y.setProperty(`${oe}-height`,"initial","important"),Y.width=`${g*he}px`,Y.height=`${b*he}px`;let z=()=>{pe.width=`${this.imgWidth*he}px`,pe.height=`${this.imgHeight*he}px`,pe.display="block"};X.src!==L&&(X.onload=()=>{this.imgWidth=X.naturalWidth,this.imgHeight=X.naturalHeight,z()},X.src=L,z()),z(),pe.transform=`translate(-${d*he}px, -${v*he}px)`}};ce.customElements.get("media-preview-thumbnail")||ce.customElements.define("media-preview-thumbnail",Nu);var Th=Me.createElement("template"),Mp=`
742
+ `;var Nu=class extends ce.HTMLElement{static get observedAttributes(){return[tt.MEDIA_CONTROLLER,"time",F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_COORDS]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(bh.content.cloneNode(!0))}connectedCallback(){var t;let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}attributeChangedCallback(t,r,d){var v,g;if(["time",F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_COORDS].includes(t)&&this.update(),t===tt.MEDIA_CONTROLLER){if(r){let E=Me.getElementById(r);(v=E==null?void 0:E.unassociateElement)==null||v.call(E,this)}if(d){let E=Me.getElementById(d);(g=E==null?void 0:E.associateElement)==null||g.call(E,this)}}}update(){let t=this.getAttribute(F.MEDIA_PREVIEW_COORDS),r=this.getAttribute(F.MEDIA_PREVIEW_IMAGE);if(!(t&&r))return;let[d,v,g,E]=t.split(/\s+/).map(be=>+be),L=r.split("#")[0],M=getComputedStyle(this),{maxWidth:R,maxHeight:b,minWidth:P,minHeight:O}=M,ue=Math.min(parseInt(R)/g,parseInt(b)/E),Q=Math.max(parseInt(P)/g,parseInt(O)/E),de=ue<1,he=de?ue:Q>1?Q:1,{style:Y}=Lr(this.shadowRoot,":host"),pe=Lr(this.shadowRoot,"img").style,X=this.shadowRoot.querySelector("img"),oe=de?"min":"max";Y.setProperty(`${oe}-width`,"initial","important"),Y.setProperty(`${oe}-height`,"initial","important"),Y.width=`${g*he}px`,Y.height=`${E*he}px`;let z=()=>{pe.width=`${this.imgWidth*he}px`,pe.height=`${this.imgHeight*he}px`,pe.display="block"};X.src!==L&&(X.onload=()=>{this.imgWidth=X.naturalWidth,this.imgHeight=X.naturalHeight,z()},X.src=L,z()),z(),pe.transform=`translate(-${d*he}px, -${v*he}px)`}};ce.customElements.get("media-preview-thumbnail")||ce.customElements.define("media-preview-thumbnail",Nu);var Th=Me.createElement("template"),Mp=`
743
743
  <svg aria-hidden="true" viewBox="0 0 100 100">
744
744
  <path d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
745
745
  <animateTransform
@@ -790,14 +790,14 @@ svg, img, ::slotted(svg), ::slotted(img) {
790
790
  </style>
791
791
 
792
792
  <slot name="loading">${Mp}</slot>
793
- <div id="status" role="status" aria-live="polite">${Pr.MEDIA_LOADING()}</div>
794
- `;var xp=500,Uu=class extends ce.HTMLElement{static get observedAttributes(){return[tt.MEDIA_CONTROLLER,F.MEDIA_PAUSED,F.MEDIA_LOADING,"loading-delay"]}constructor(){super();let t=this.attachShadow({mode:"open"}),i=Th.content.cloneNode(!0);t.appendChild(i)}attributeChangedCallback(t,i,d){var v,g,b;if(t===F.MEDIA_LOADING||t===F.MEDIA_PAUSED){let L=this.getAttribute(F.MEDIA_PAUSED)!=null,M=this.getAttribute(F.MEDIA_LOADING)!=null,R=!L&&M;if(!R)this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),this.removeAttribute("is-loading");else if(!this.loadingDelayHandle&&R){let y=+((v=this.getAttribute("loading-delay"))!=null?v:xp);this.loadingDelayHandle=setTimeout(()=>{this.setAttribute("is-loading",""),this.loadingDelayHandle=void 0},y)}}else if(t===tt.MEDIA_CONTROLLER){if(i){let L=Me.getElementById(i);(g=L==null?void 0:L.unassociateElement)==null||g.call(L,this)}if(d){let L=Me.getElementById(d);(b=L==null?void 0:L.associateElement)==null||b.call(L,this)}}}connectedCallback(){var t;let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0);let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}};ce.customElements.get("media-loading-indicator")||ce.customElements.define("media-loading-indicator",Uu);var _h=Me.createElement("template");_h.innerHTML=`
793
+ <div id="status" role="status" aria-live="polite">${Pi.MEDIA_LOADING()}</div>
794
+ `;var xp=500,Uu=class extends ce.HTMLElement{static get observedAttributes(){return[tt.MEDIA_CONTROLLER,F.MEDIA_PAUSED,F.MEDIA_LOADING,"loading-delay"]}constructor(){super();let t=this.attachShadow({mode:"open"}),r=Th.content.cloneNode(!0);t.appendChild(r)}attributeChangedCallback(t,r,d){var v,g,E;if(t===F.MEDIA_LOADING||t===F.MEDIA_PAUSED){let L=this.getAttribute(F.MEDIA_PAUSED)!=null,M=this.getAttribute(F.MEDIA_LOADING)!=null,R=!L&&M;if(!R)this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),this.removeAttribute("is-loading");else if(!this.loadingDelayHandle&&R){let b=+((v=this.getAttribute("loading-delay"))!=null?v:xp);this.loadingDelayHandle=setTimeout(()=>{this.setAttribute("is-loading",""),this.loadingDelayHandle=void 0},b)}}else if(t===tt.MEDIA_CONTROLLER){if(r){let L=Me.getElementById(r);(g=L==null?void 0:L.unassociateElement)==null||g.call(L,this)}if(d){let L=Me.getElementById(d);(E=L==null?void 0:L.associateElement)==null||E.call(L,this)}}}connectedCallback(){var t;let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0);let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}};ce.customElements.get("media-loading-indicator")||ce.customElements.define("media-loading-indicator",Uu);var _h=Me.createElement("template");_h.innerHTML=`
795
795
  <style>
796
796
  :host {
797
797
  }
798
798
  </style>
799
799
  <slot></slot>
800
- `;var Fu=class extends ce.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(_h.content.cloneNode(!0))}};ce.customElements.get("media-title-bar")||ce.customElements.define("media-title-bar",Fu);var Op=100,Pp=a=>{var t;if(a.getAttribute(F.MEDIA_MUTED)!=null)return 0;let d=+((t=a.getAttribute(F.MEDIA_VOLUME))!=null?t:1);return Math.round(d*a.range.max)},Np=({value:a,max:t})=>`${Math.round(a/t*100)}%`,Bu=class extends us{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_VOLUME,F.MEDIA_MUTED,F.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=Op,this.range.addEventListener("input",()=>{let i=this.range.value/this.range.max,d=new ce.CustomEvent(et.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:i});this.dispatchEvent(d)})}connectedCallback(){this.range.setAttribute("aria-label",Pr.VOLUME()),super.connectedCallback()}attributeChangedCallback(t,i,d){if(t===F.MEDIA_VOLUME||t===F.MEDIA_MUTED){let v=Pp(this);this.range.value=v,this.range.setAttribute("aria-valuetext",Np(this.range)),this.updateBar()}super.attributeChangedCallback(t,i,d)}};ce.customElements.get("media-volume-range")||ce.customElements.define("media-volume-range",Bu);var Hu=class extends ls{};ce.customElements.get("media-chrome")||ce.customElements.define("media-chrome",Hu);var Ku=class extends ls{constructor(){super(),console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}};ce.customElements.get("media-container")||ce.customElements.define("media-container",Ku);var Wu=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},tr=(a,t,i)=>(Wu(a,t,"read from private field"),i?i.call(a):t.get(a)),fi=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},ra=(a,t,i,d)=>(Wu(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),ps=(a,t,i)=>(Wu(a,t,"access private method"),i),ta,vn,vs,Di,La,gn,Ro,pn,Gu,gs,Co,Vu,Ah,ju,Sh,kh=Me.createElement("template");kh.innerHTML=`
800
+ `;var Fu=class extends ce.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(_h.content.cloneNode(!0))}};ce.customElements.get("media-title-bar")||ce.customElements.define("media-title-bar",Fu);var Op=100,Pp=a=>{var t;if(a.getAttribute(F.MEDIA_MUTED)!=null)return 0;let d=+((t=a.getAttribute(F.MEDIA_VOLUME))!=null?t:1);return Math.round(d*a.range.max)},Np=({value:a,max:t})=>`${Math.round(a/t*100)}%`,Bu=class extends us{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_VOLUME,F.MEDIA_MUTED,F.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=Op,this.range.addEventListener("input",()=>{let r=this.range.value/this.range.max,d=new ce.CustomEvent(et.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(d)})}connectedCallback(){this.range.setAttribute("aria-label",Pi.VOLUME()),super.connectedCallback()}attributeChangedCallback(t,r,d){if(t===F.MEDIA_VOLUME||t===F.MEDIA_MUTED){let v=Pp(this);this.range.value=v,this.range.setAttribute("aria-valuetext",Np(this.range)),this.updateBar()}super.attributeChangedCallback(t,r,d)}};ce.customElements.get("media-volume-range")||ce.customElements.define("media-volume-range",Bu);var Hu=class extends ls{};ce.customElements.get("media-chrome")||ce.customElements.define("media-chrome",Hu);var Ku=class extends ls{constructor(){super(),console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}};ce.customElements.get("media-container")||ce.customElements.define("media-container",Ku);var Wu=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},ti=(a,t,r)=>(Wu(a,t,"read from private field"),r?r.call(a):t.get(a)),fr=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},ia=(a,t,r,d)=>(Wu(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),ps=(a,t,r)=>(Wu(a,t,"access private method"),r),ta,vn,vs,Dr,La,gn,Ro,pn,Gu,gs,Co,Vu,Ah,ju,Sh,kh=Me.createElement("template");kh.innerHTML=`
801
801
  <style>
802
802
  :host ul {
803
803
  list-style: none;
@@ -828,7 +828,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
828
828
  <ul tabindex="0">
829
829
  <slot></slot>
830
830
  </ul>
831
- `;var Mo=class extends ce.HTMLElement{constructor(t={}){super(),fi(this,La),fi(this,gs),fi(this,Vu),fi(this,ju),fi(this,ta,""),fi(this,vn,null),fi(this,vs,void 0),fi(this,Di,void 0),fi(this,Ro,g=>{this.handleClick(g)}),fi(this,pn,g=>{let{key:b}=g;if(b==="Escape"){this.removeEventListener("keyup",tr(this,pn));return}b==="Enter"||b===" "?this.handleSelection(g):this.handleMovement(g)}),fi(this,Gu,g=>{let{metaKey:b,altKey:L}=g;if(b||L){this.removeEventListener("keyup",tr(this,pn));return}g.preventDefault(),this.addEventListener("keyup",tr(this,pn),{once:!0})});let i=this.attachShadow({mode:"open"}),d=kh.content.cloneNode(!0);this.nativeEl=d;let v=t.slotTemplate;v||(v=Me.createElement("template"),v.innerHTML=`<slot>${t.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),i.appendChild(d),ra(this,vs,this.shadowRoot.querySelector("slot")),tr(this,vs).addEventListener("slotchange",()=>{ra(this,Di,tr(this,vs).assignedElements()),tr(this,Di).length===1&&tr(this,Di)[0].nodeName.toLowerCase()==="slot"&&ra(this,Di,tr(this,Di)[0].assignedElements());let g=tr(this,La,gn);if(g.some(M=>M.getAttribute("tabindex")==="0"))return;let L=g.filter(M=>M.getAttribute("aria-selected")==="true")[0];L||(L=g[0]),L&&(L.setAttribute("tabindex",0),L.setAttribute("aria-selected","true"))})}static get observedAttributes(){return["disabled",tt.MEDIA_CONTROLLER]}get selectedOptions(){return tr(this,La,gn).filter(t=>t.getAttribute("aria-selected")==="true")}focus(){var t;(t=this.selectedOptions[0])==null||t.focus()}enable(){this.addEventListener("click",tr(this,Ro)),this.addEventListener("keydown",tr(this,Gu))}disable(){this.removeEventListener("click",tr(this,Ro)),this.removeEventListener("keyup",tr(this,pn))}attributeChangedCallback(t,i,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(i){let b=Me.getElementById(i);(v=b==null?void 0:b.unassociateElement)==null||v.call(b,this)}if(d){let b=Me.getElementById(d);(g=b==null?void 0:b.associateElement)==null||g.call(b,this)}}else t==="disabled"&&d!==i&&(d==null?this.enable():this.disable())}connectedCallback(){var t;this.hasAttribute("disabled")||this.enable(),this.hasAttribute("role")||this.setAttribute("role","listbox");let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;this.disable();let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}get keysUsed(){return["Enter"," ","ArrowDown","ArrowUp","Home","End"]}handleSelection(t){let i=ps(this,gs,Co).call(this,t);if(!i)return;let d=i.getAttribute("aria-selected")==="true";this.getAttribute("aria-multiselectable")!=="true"&&tr(this,Di).forEach(v=>v.setAttribute("aria-selected","false")),d?i.setAttribute("aria-selected","false"):i.setAttribute("aria-selected","true"),this.dispatchEvent(new Event("change"))}handleMovement(t){let{key:i}=t,d=tr(this,La,gn),v=ps(this,gs,Co).call(this,t);v||(v=d.filter(b=>b.getAttribute("tabindex")==="0")[0]);let g;switch(i){case"ArrowDown":g=v.nextElementSibling,g!=null&&g.hasAttribute("disabled")&&(g=g.nextElementSibling);break;case"ArrowUp":g=v.previousElementSibling,g!=null&&g.hasAttribute("disabled")&&(g=g.previousElementSibling);break;case"Home":g=d[0];break;case"End":g=d[d.length-1];break;default:g=ps(this,Vu,Ah).call(this,i);break}g&&(d.forEach(b=>b.setAttribute("tabindex","-1")),g.setAttribute("tabindex","0"),g.focus())}handleClick(t){let i=ps(this,gs,Co).call(this,t);!i||i.hasAttribute("disabled")||(tr(this,La,gn).forEach(d=>d.setAttribute("tabindex","-1")),i.setAttribute("tabindex","0"),this.handleSelection(t))}};ta=new WeakMap;vn=new WeakMap;vs=new WeakMap;Di=new WeakMap;La=new WeakSet;gn=function(){return tr(this,Di).filter(a=>!a.hasAttribute("disabled"))};Ro=new WeakMap;pn=new WeakMap;Gu=new WeakMap;gs=new WeakSet;Co=function(a){if(a.target===this)return;let t=a.composedPath(),i=t.findIndex(d=>d.nodeName==="MEDIA-CHROME-LISTITEM");return t[i]};Vu=new WeakSet;Ah=function(a){ps(this,ju,Sh).call(this);let t=tr(this,La,gn),i=t.findIndex(R=>R.getAttribute("tabindex")==="0");ra(this,ta,tr(this,ta)+a);let d=tr(this,ta).split("").every(R=>R===a),v=t.slice(i+(d?1:0)).filter(R=>R.textContent.toLowerCase().startsWith(tr(this,ta))),g=t.slice(0,i-(d?1:0)).filter(R=>R.textContent.toLowerCase().startsWith(tr(this,ta))),b=[],L=[];return d&&(b=t.slice(i+(d?1:0)).filter(R=>R.textContent.startsWith(a)),L=t.slice(0,i-(d?1:0)).filter(R=>R.textContent.startsWith(a))),[...v,...g,...b,...L][0]};ju=new WeakSet;Sh=function(){ce.clearTimeout(tr(this,vn)),ra(this,vn,null),ra(this,vn,ce.setTimeout(()=>{ra(this,ta,""),ra(this,vn,null)},500))};ce.customElements.get("media-chrome-listbox")||ce.customElements.define("media-chrome-listbox",Mo);var wh=Mo;var zu=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},qt=(a,t,i)=>(zu(a,t,"read from private field"),i?i.call(a):t.get(a)),bi=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},Da=(a,t,i,d)=>(zu(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),En=(a,t,i)=>(zu(a,t,"access private method"),i),xo,Ra,Ri,Qr,ia,Es,qu,Ih,Yu,Lh,Po,Qu,Oo,Xu,Dh=Me.createElement("template");Dh.innerHTML=`
831
+ `;var Mo=class extends ce.HTMLElement{constructor(t={}){super(),fr(this,La),fr(this,gs),fr(this,Vu),fr(this,ju),fr(this,ta,""),fr(this,vn,null),fr(this,vs,void 0),fr(this,Dr,void 0),fr(this,Ro,g=>{this.handleClick(g)}),fr(this,pn,g=>{let{key:E}=g;if(E==="Escape"){this.removeEventListener("keyup",ti(this,pn));return}E==="Enter"||E===" "?this.handleSelection(g):this.handleMovement(g)}),fr(this,Gu,g=>{let{metaKey:E,altKey:L}=g;if(E||L){this.removeEventListener("keyup",ti(this,pn));return}g.preventDefault(),this.addEventListener("keyup",ti(this,pn),{once:!0})});let r=this.attachShadow({mode:"open"}),d=kh.content.cloneNode(!0);this.nativeEl=d;let v=t.slotTemplate;v||(v=Me.createElement("template"),v.innerHTML=`<slot>${t.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),r.appendChild(d),ia(this,vs,this.shadowRoot.querySelector("slot")),ti(this,vs).addEventListener("slotchange",()=>{ia(this,Dr,ti(this,vs).assignedElements()),ti(this,Dr).length===1&&ti(this,Dr)[0].nodeName.toLowerCase()==="slot"&&ia(this,Dr,ti(this,Dr)[0].assignedElements());let g=ti(this,La,gn);if(g.some(M=>M.getAttribute("tabindex")==="0"))return;let L=g.filter(M=>M.getAttribute("aria-selected")==="true")[0];L||(L=g[0]),L&&(L.setAttribute("tabindex",0),L.setAttribute("aria-selected","true"))})}static get observedAttributes(){return["disabled",tt.MEDIA_CONTROLLER]}get selectedOptions(){return ti(this,La,gn).filter(t=>t.getAttribute("aria-selected")==="true")}focus(){var t;(t=this.selectedOptions[0])==null||t.focus()}enable(){this.addEventListener("click",ti(this,Ro)),this.addEventListener("keydown",ti(this,Gu))}disable(){this.removeEventListener("click",ti(this,Ro)),this.removeEventListener("keyup",ti(this,pn))}attributeChangedCallback(t,r,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(r){let E=Me.getElementById(r);(v=E==null?void 0:E.unassociateElement)==null||v.call(E,this)}if(d){let E=Me.getElementById(d);(g=E==null?void 0:E.associateElement)==null||g.call(E,this)}}else t==="disabled"&&d!==r&&(d==null?this.enable():this.disable())}connectedCallback(){var t;this.hasAttribute("disabled")||this.enable(),this.hasAttribute("role")||this.setAttribute("role","listbox");let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;this.disable();let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}get keysUsed(){return["Enter"," ","ArrowDown","ArrowUp","Home","End"]}handleSelection(t){let r=ps(this,gs,Co).call(this,t);if(!r)return;let d=r.getAttribute("aria-selected")==="true";this.getAttribute("aria-multiselectable")!=="true"&&ti(this,Dr).forEach(v=>v.setAttribute("aria-selected","false")),d?r.setAttribute("aria-selected","false"):r.setAttribute("aria-selected","true"),this.dispatchEvent(new Event("change"))}handleMovement(t){let{key:r}=t,d=ti(this,La,gn),v=ps(this,gs,Co).call(this,t);v||(v=d.filter(E=>E.getAttribute("tabindex")==="0")[0]);let g;switch(r){case"ArrowDown":g=v.nextElementSibling,g!=null&&g.hasAttribute("disabled")&&(g=g.nextElementSibling);break;case"ArrowUp":g=v.previousElementSibling,g!=null&&g.hasAttribute("disabled")&&(g=g.previousElementSibling);break;case"Home":g=d[0];break;case"End":g=d[d.length-1];break;default:g=ps(this,Vu,Ah).call(this,r);break}g&&(d.forEach(E=>E.setAttribute("tabindex","-1")),g.setAttribute("tabindex","0"),g.focus())}handleClick(t){let r=ps(this,gs,Co).call(this,t);!r||r.hasAttribute("disabled")||(ti(this,La,gn).forEach(d=>d.setAttribute("tabindex","-1")),r.setAttribute("tabindex","0"),this.handleSelection(t))}};ta=new WeakMap;vn=new WeakMap;vs=new WeakMap;Dr=new WeakMap;La=new WeakSet;gn=function(){return ti(this,Dr).filter(a=>!a.hasAttribute("disabled"))};Ro=new WeakMap;pn=new WeakMap;Gu=new WeakMap;gs=new WeakSet;Co=function(a){if(a.target===this)return;let t=a.composedPath(),r=t.findIndex(d=>d.nodeName==="MEDIA-CHROME-LISTITEM");return t[r]};Vu=new WeakSet;Ah=function(a){ps(this,ju,Sh).call(this);let t=ti(this,La,gn),r=t.findIndex(R=>R.getAttribute("tabindex")==="0");ia(this,ta,ti(this,ta)+a);let d=ti(this,ta).split("").every(R=>R===a),v=t.slice(r+(d?1:0)).filter(R=>R.textContent.toLowerCase().startsWith(ti(this,ta))),g=t.slice(0,r-(d?1:0)).filter(R=>R.textContent.toLowerCase().startsWith(ti(this,ta))),E=[],L=[];return d&&(E=t.slice(r+(d?1:0)).filter(R=>R.textContent.startsWith(a)),L=t.slice(0,r-(d?1:0)).filter(R=>R.textContent.startsWith(a))),[...v,...g,...E,...L][0]};ju=new WeakSet;Sh=function(){ce.clearTimeout(ti(this,vn)),ia(this,vn,null),ia(this,vn,ce.setTimeout(()=>{ia(this,ta,""),ia(this,vn,null)},500))};ce.customElements.get("media-chrome-listbox")||ce.customElements.define("media-chrome-listbox",Mo);var Ih=Mo;var zu=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},qt=(a,t,r)=>(zu(a,t,"read from private field"),r?r.call(a):t.get(a)),br=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},Da=(a,t,r,d)=>(zu(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),En=(a,t,r)=>(zu(a,t,"access private method"),r),xo,Ra,Rr,Qi,ra,Es,qu,wh,Yu,Lh,Po,Qu,Oo,Xu,Dh=Me.createElement("template");Dh.innerHTML=`
832
832
  <style>
833
833
  :host {
834
834
  display: inline-block;
@@ -847,7 +847,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
847
847
  <slot></slot>
848
848
  </media-chrome-listbox>
849
849
  </slot>
850
- `;var $u=class extends ce.HTMLElement{constructor(){super(),bi(this,qu),bi(this,Yu),bi(this,Po),bi(this,Oo),bi(this,xo,void 0),bi(this,Ra,void 0),bi(this,Ri,void 0),bi(this,Qr,void 0),bi(this,ia,void 0),bi(this,Es,!1);let t=this.attachShadow({mode:"open"}),i=Dh.content.cloneNode(!0);this.nativeEl=i,t.appendChild(i),Da(this,xo,En(this,qu,Ih).bind(this)),Da(this,Ra,En(this,Yu,Lh).bind(this)),Da(this,Ri,this.shadowRoot.querySelector("media-chrome-button")),Da(this,Qr,this.shadowRoot.querySelector("media-chrome-listbox")),Da(this,ia,this.shadowRoot.querySelector("slot[name=listbox]")),qt(this,ia).addEventListener("slotchange",()=>{qt(this,Qr).removeEventListener("change",qt(this,Ra)),Da(this,Qr,qt(this,ia).assignedElements()[0]||qt(this,Qr)),qt(this,Qr).addEventListener("change",qt(this,Ra))})}static get observedAttributes(){return["disabled",tt.MEDIA_CONTROLLER]}enable(){qt(this,Ri).removeAttribute("disabled"),qt(this,Ri).handleClick=qt(this,xo),En(this,Oo,Xu).call(this),qt(this,Qr).addEventListener("change",qt(this,Ra))}disable(){qt(this,Ri).setAttribute("disabled",""),qt(this,Ri).handleClick=()=>{},qt(this,Qr).addEventListener("change",qt(this,Ra))}attributeChangedCallback(t,i,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(i){let b=Me.getElementById(i);(v=b==null?void 0:b.unassociateElement)==null||v.call(b,this),qt(this,Qr).removeAttribute(tt.MEDIA_CONTROLLER)}if(d){let b=Me.getElementById(d);(g=b==null?void 0:b.associateElement)==null||g.call(b,this),qt(this,Qr).setAttribute(tt.MEDIA_CONTROLLER,d)}}else t==="disabled"&&d!==i&&(d==null?this.enable():this.disable())}connectedCallback(){var t;this.hasAttribute("disabled")||this.enable();let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.associateElement)==null||t.call(d,this),qt(this,Qr).setAttribute(tt.MEDIA_CONTROLLER,i)}}disconnectedCallback(){var t;this.disable();let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this),qt(this,Qr).removeAttribute(tt.MEDIA_CONTROLLER)}}};xo=new WeakMap;Ra=new WeakMap;Ri=new WeakMap;Qr=new WeakMap;ia=new WeakMap;Es=new WeakMap;qu=new WeakSet;Ih=function(){En(this,Po,Qu).call(this)};Yu=new WeakSet;Lh=function(){En(this,Po,Qu).call(this)};Po=new WeakSet;Qu=function(){qt(this,ia).hidden=!qt(this,ia).hidden,En(this,Oo,Xu).call(this),qt(this,ia).hidden?qt(this,Ri).focus():qt(this,Qr).focus()};Oo=new WeakSet;Xu=function(){qt(this,Ri).setAttribute("aria-expanded",qt(this,Es)),Da(this,Es,!qt(this,Es))};ce.customElements.get("media-chrome-menu-button")||ce.customElements.define("media-chrome-menu-button",$u);var Rh=Me.createElement("template");Rh.innerHTML=`
850
+ `;var $u=class extends ce.HTMLElement{constructor(){super(),br(this,qu),br(this,Yu),br(this,Po),br(this,Oo),br(this,xo,void 0),br(this,Ra,void 0),br(this,Rr,void 0),br(this,Qi,void 0),br(this,ra,void 0),br(this,Es,!1);let t=this.attachShadow({mode:"open"}),r=Dh.content.cloneNode(!0);this.nativeEl=r,t.appendChild(r),Da(this,xo,En(this,qu,wh).bind(this)),Da(this,Ra,En(this,Yu,Lh).bind(this)),Da(this,Rr,this.shadowRoot.querySelector("media-chrome-button")),Da(this,Qi,this.shadowRoot.querySelector("media-chrome-listbox")),Da(this,ra,this.shadowRoot.querySelector("slot[name=listbox]")),qt(this,ra).addEventListener("slotchange",()=>{qt(this,Qi).removeEventListener("change",qt(this,Ra)),Da(this,Qi,qt(this,ra).assignedElements()[0]||qt(this,Qi)),qt(this,Qi).addEventListener("change",qt(this,Ra))})}static get observedAttributes(){return["disabled",tt.MEDIA_CONTROLLER]}enable(){qt(this,Rr).removeAttribute("disabled"),qt(this,Rr).handleClick=qt(this,xo),En(this,Oo,Xu).call(this),qt(this,Qi).addEventListener("change",qt(this,Ra))}disable(){qt(this,Rr).setAttribute("disabled",""),qt(this,Rr).handleClick=()=>{},qt(this,Qi).addEventListener("change",qt(this,Ra))}attributeChangedCallback(t,r,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(r){let E=Me.getElementById(r);(v=E==null?void 0:E.unassociateElement)==null||v.call(E,this),qt(this,Qi).removeAttribute(tt.MEDIA_CONTROLLER)}if(d){let E=Me.getElementById(d);(g=E==null?void 0:E.associateElement)==null||g.call(E,this),qt(this,Qi).setAttribute(tt.MEDIA_CONTROLLER,d)}}else t==="disabled"&&d!==r&&(d==null?this.enable():this.disable())}connectedCallback(){var t;this.hasAttribute("disabled")||this.enable();let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.associateElement)==null||t.call(d,this),qt(this,Qi).setAttribute(tt.MEDIA_CONTROLLER,r)}}disconnectedCallback(){var t;this.disable();let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this),qt(this,Qi).removeAttribute(tt.MEDIA_CONTROLLER)}}};xo=new WeakMap;Ra=new WeakMap;Rr=new WeakMap;Qi=new WeakMap;ra=new WeakMap;Es=new WeakMap;qu=new WeakSet;wh=function(){En(this,Po,Qu).call(this)};Yu=new WeakSet;Lh=function(){En(this,Po,Qu).call(this)};Po=new WeakSet;Qu=function(){qt(this,ra).hidden=!qt(this,ra).hidden,En(this,Oo,Xu).call(this),qt(this,ra).hidden?qt(this,Rr).focus():qt(this,Qi).focus()};Oo=new WeakSet;Xu=function(){qt(this,Rr).setAttribute("aria-expanded",qt(this,Es)),Da(this,Es,!qt(this,Es))};ce.customElements.get("media-chrome-menu-button")||ce.customElements.define("media-chrome-menu-button",$u);var Rh=Me.createElement("template");Rh.innerHTML=`
851
851
  <style>
852
852
  :host {
853
853
  display: list-item;
@@ -864,7 +864,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
864
864
  <li>
865
865
  <slot></slot>
866
866
  </li>
867
- `;var Zu=class extends ce.HTMLElement{static get observedAttributes(){return["disabled","aria-selected","value",tt.MEDIA_CONTROLLER]}constructor(){super();let t=this.attachShadow({mode:"open"}),i=Rh.content.cloneNode(!0);this.nativeEl=i,t.appendChild(i)}set value(t){this.setAttribute("value",t)}get value(){return this.getAttribute("value")}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex",-1),this.hasAttribute("aria-selected")||this.setAttribute("aria-selected","false")}disable(){this.removeAttribute("tabindex")}attributeChangedCallback(t,i,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(i){let b=Me.getElementById(i);(v=b==null?void 0:b.unassociateElement)==null||v.call(b,this)}if(d){let b=Me.getElementById(d);(g=b==null?void 0:b.associateElement)==null||g.call(b,this)}}else t==="disabled"&&d!==i&&(d==null?this.enable():this.disable())}connectedCallback(){var t;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","option");let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;this.disable();let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}handleClick(){}};ce.customElements.get("media-chrome-listitem")||ce.customElements.define("media-chrome-listitem",Zu);var id=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},Rr=(a,t,i)=>(id(a,t,"read from private field"),i?i.call(a):t.get(a)),aa=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},na=(a,t,i,d)=>(id(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),mi=(a,t,i)=>(id(a,t,"access private method"),i),bn,Tn,Ci,si,No,Ju,Fo,ed,Ca,yn,Uo,td,Mh=`
867
+ `;var Zu=class extends ce.HTMLElement{static get observedAttributes(){return["disabled","aria-selected","value",tt.MEDIA_CONTROLLER]}constructor(){super();let t=this.attachShadow({mode:"open"}),r=Rh.content.cloneNode(!0);this.nativeEl=r,t.appendChild(r)}set value(t){this.setAttribute("value",t)}get value(){return this.getAttribute("value")}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex",-1),this.hasAttribute("aria-selected")||this.setAttribute("aria-selected","false")}disable(){this.removeAttribute("tabindex")}attributeChangedCallback(t,r,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(r){let E=Me.getElementById(r);(v=E==null?void 0:E.unassociateElement)==null||v.call(E,this)}if(d){let E=Me.getElementById(d);(g=E==null?void 0:E.associateElement)==null||g.call(E,this)}}else t==="disabled"&&d!==r&&(d==null?this.enable():this.disable())}connectedCallback(){var t;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","option");let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;this.disable();let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}handleClick(){}};ce.customElements.get("media-chrome-listitem")||ce.customElements.define("media-chrome-listitem",Zu);var rd=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},Ri=(a,t,r)=>(rd(a,t,"read from private field"),r?r.call(a):t.get(a)),aa=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},na=(a,t,r,d)=>(rd(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),mr=(a,t,r)=>(rd(a,t,"access private method"),r),bn,Tn,Cr,sr,No,Ju,Fo,ed,Ca,yn,Uo,td,Mh=`
868
868
  fill: var(--media-icon-color, #eee);
869
869
  height: var(--media-captions-indicator-height, 1em);
870
870
  vertical-align: var(--media-captions-indicator-vertical-align, bottom);
@@ -874,7 +874,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
874
874
  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
875
875
  </svg>`,xh=Me.createElement("template");xh.innerHTML=`
876
876
  <slot hidden name="captions-indicator">${Up}</slot>
877
- `;var Ch=(a,t)=>a.label===t.label&&a.language===t.language,rd=class extends wh{constructor(){super({slotTemplate:xh}),aa(this,No),aa(this,Fo),aa(this,Ca),aa(this,Uo),aa(this,bn,[]),aa(this,Tn,[]),aa(this,Ci,void 0),aa(this,si,void 0);let t=Me.createElement("media-chrome-listitem");t.value="off",t.textContent="Off",na(this,Ci,t);let i=this.shadowRoot.querySelector('[name="captions-indicator"]');na(this,si,i.firstElementChild),i.addEventListener("slotchange",()=>{let d=i.assignedElements();if(d.length===1&&d[0].nodeName.toLowerCase()==="slot"){let v=d[0].assignedElements();v.length===0?na(this,si,d[0].firstElementChild):v.length===1&&na(this,si,v[0])}Rr(this,si)||na(this,si,i.firstElementChild),na(this,si,Rr(this,si).cloneNode(!0)),Rr(this,si).removeAttribute("slot"),Rr(this,si).setAttribute("style",Mh)})}static get observedAttributes(){return[...super.observedAttributes,"aria-multiselectable",F.MEDIA_CAPTIONS_LIST,F.MEDIA_CAPTIONS_SHOWING,F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(t,i,d){if(t===F.MEDIA_SUBTITLES_LIST&&i!==d)na(this,bn,mi(this,No,Ju).call(this,d,Rr(this,bn))),mi(this,Ca,yn).call(this);else if(t===F.MEDIA_CAPTIONS_LIST&&i!==d)na(this,Tn,mi(this,No,Ju).call(this,d,Rr(this,Tn))),mi(this,Ca,yn).call(this);else if(t===F.MEDIA_SUBTITLES_SHOWING&&i!==d){let v=Jn(d!=null?d:"")[0];Rr(this,bn).forEach(g=>{g.selected=g.language===v.language&&g.label===v.label}),mi(this,Ca,yn).call(this)}else if(t===F.MEDIA_CAPTIONS_SHOWING&&i!==d){let v=Jn(d!=null?d:"")[0];Rr(this,Tn).forEach(g=>{g.selected=g.language===v.language&&g.label===v.label}),mi(this,Ca,yn).call(this)}else t==="aria-multiselectable"&&(this.removeAttribute("aria-multiselectable"),console.warn("Captions List doesn't currently support multiple selections. You can enable multiple items via the media.textTrack API."));super.attributeChangedCallback(t,i,d)}connectedCallback(){mi(this,Ca,yn).call(this),this.addEventListener("change",mi(this,Uo,td)),super.connectedCallback()}disconnectedCallback(){this.removeEventListener("change",mi(this,Uo,td)),super.disconnectedCallback()}};bn=new WeakMap;Tn=new WeakMap;Ci=new WeakMap;si=new WeakMap;No=new WeakSet;Ju=function(a,t){let i=a?Jn(a!=null?a:""):[],d=[],v=[];return t.forEach(g=>{i.some(b=>Ch(b,g))||d.push(g)}),i.forEach(g=>{t.some(b=>Ch(b,g))||v.push(g)}),d.forEach(g=>g.el.remove()),t.filter(g=>!d.includes(g)).concat(v)};Fo=new WeakSet;ed=function(a,t){a.forEach(i=>{let d=i.el,v=!0;d||(d=Me.createElement("media-chrome-listitem"),v=!1,d.value=t+"!"+au(i),d.textContent=i.label,t==="cc"&&d.append(Rr(this,si).cloneNode(!0))),i.selected?d.setAttribute("aria-selected","true"):d.setAttribute("aria-selected","false"),v||(this.append(d),i.el=d)})};Ca=new WeakSet;yn=function(){this.contains(Rr(this,Ci))||this.append(Rr(this,Ci)),!this.hasAttribute(F.MEDIA_CAPTIONS_SHOWING)&&!this.hasAttribute(F.MEDIA_SUBTITLES_SHOWING)?(Rr(this,Ci).setAttribute("aria-selected","true"),Rr(this,Ci).setAttribute("tabindex","0")):(Rr(this,Ci).setAttribute("aria-selected","false"),Rr(this,Ci).setAttribute("tabindex","-1")),mi(this,Fo,ed).call(this,Rr(this,Tn),"cc"),mi(this,Fo,ed).call(this,Rr(this,bn),"subs")};Uo=new WeakSet;td=function(){var a,t,i;let[d,v]=(i=(t=(a=this.selectedOptions[0])==null?void 0:a.value)==null?void 0:t.split("!"))!=null?i:[];if(Xi(this),!v)return;let g=new ce.CustomEvent(d==="cc"?et.MEDIA_SHOW_CAPTIONS_REQUEST:et.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(g)};ce.customElements.get("media-captions-listbox")||ce.customElements.define("media-captions-listbox",rd);var ld=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},pr=(a,t,i)=>(ld(a,t,"read from private field"),i?i.call(a):t.get(a)),Mi=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},ys=(a,t,i,d)=>(ld(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),_n=(a,t,i)=>(ld(a,t,"access private method"),i),sa,Ma,An,Ti,bs,ad,Ph,ud,Nh,Bo,nd,Ho,sd,Oh=`
877
+ `;var Ch=(a,t)=>a.label===t.label&&a.language===t.language,id=class extends Ih{constructor(){super({slotTemplate:xh}),aa(this,No),aa(this,Fo),aa(this,Ca),aa(this,Uo),aa(this,bn,[]),aa(this,Tn,[]),aa(this,Cr,void 0),aa(this,sr,void 0);let t=Me.createElement("media-chrome-listitem");t.value="off",t.textContent="Off",na(this,Cr,t);let r=this.shadowRoot.querySelector('[name="captions-indicator"]');na(this,sr,r.firstElementChild),r.addEventListener("slotchange",()=>{let d=r.assignedElements();if(d.length===1&&d[0].nodeName.toLowerCase()==="slot"){let v=d[0].assignedElements();v.length===0?na(this,sr,d[0].firstElementChild):v.length===1&&na(this,sr,v[0])}Ri(this,sr)||na(this,sr,r.firstElementChild),na(this,sr,Ri(this,sr).cloneNode(!0)),Ri(this,sr).removeAttribute("slot"),Ri(this,sr).setAttribute("style",Mh)})}static get observedAttributes(){return[...super.observedAttributes,"aria-multiselectable",F.MEDIA_CAPTIONS_LIST,F.MEDIA_CAPTIONS_SHOWING,F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(t,r,d){if(t===F.MEDIA_SUBTITLES_LIST&&r!==d)na(this,bn,mr(this,No,Ju).call(this,d,Ri(this,bn))),mr(this,Ca,yn).call(this);else if(t===F.MEDIA_CAPTIONS_LIST&&r!==d)na(this,Tn,mr(this,No,Ju).call(this,d,Ri(this,Tn))),mr(this,Ca,yn).call(this);else if(t===F.MEDIA_SUBTITLES_SHOWING&&r!==d){let v=Jn(d!=null?d:"")[0];Ri(this,bn).forEach(g=>{g.selected=g.language===v.language&&g.label===v.label}),mr(this,Ca,yn).call(this)}else if(t===F.MEDIA_CAPTIONS_SHOWING&&r!==d){let v=Jn(d!=null?d:"")[0];Ri(this,Tn).forEach(g=>{g.selected=g.language===v.language&&g.label===v.label}),mr(this,Ca,yn).call(this)}else t==="aria-multiselectable"&&(this.removeAttribute("aria-multiselectable"),console.warn("Captions List doesn't currently support multiple selections. You can enable multiple items via the media.textTrack API."));super.attributeChangedCallback(t,r,d)}connectedCallback(){mr(this,Ca,yn).call(this),this.addEventListener("change",mr(this,Uo,td)),super.connectedCallback()}disconnectedCallback(){this.removeEventListener("change",mr(this,Uo,td)),super.disconnectedCallback()}};bn=new WeakMap;Tn=new WeakMap;Cr=new WeakMap;sr=new WeakMap;No=new WeakSet;Ju=function(a,t){let r=a?Jn(a!=null?a:""):[],d=[],v=[];return t.forEach(g=>{r.some(E=>Ch(E,g))||d.push(g)}),r.forEach(g=>{t.some(E=>Ch(E,g))||v.push(g)}),d.forEach(g=>g.el.remove()),t.filter(g=>!d.includes(g)).concat(v)};Fo=new WeakSet;ed=function(a,t){a.forEach(r=>{let d=r.el,v=!0;d||(d=Me.createElement("media-chrome-listitem"),v=!1,d.value=t+"!"+au(r),d.textContent=r.label,t==="cc"&&d.append(Ri(this,sr).cloneNode(!0))),r.selected?d.setAttribute("aria-selected","true"):d.setAttribute("aria-selected","false"),v||(this.append(d),r.el=d)})};Ca=new WeakSet;yn=function(){this.contains(Ri(this,Cr))||this.append(Ri(this,Cr)),!this.hasAttribute(F.MEDIA_CAPTIONS_SHOWING)&&!this.hasAttribute(F.MEDIA_SUBTITLES_SHOWING)?(Ri(this,Cr).setAttribute("aria-selected","true"),Ri(this,Cr).setAttribute("tabindex","0")):(Ri(this,Cr).setAttribute("aria-selected","false"),Ri(this,Cr).setAttribute("tabindex","-1")),mr(this,Fo,ed).call(this,Ri(this,Tn),"cc"),mr(this,Fo,ed).call(this,Ri(this,bn),"subs")};Uo=new WeakSet;td=function(){var a,t,r;let[d,v]=(r=(t=(a=this.selectedOptions[0])==null?void 0:a.value)==null?void 0:t.split("!"))!=null?r:[];if(Xr(this),!v)return;let g=new ce.CustomEvent(d==="cc"?et.MEDIA_SHOW_CAPTIONS_REQUEST:et.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(g)};ce.customElements.get("media-captions-listbox")||ce.customElements.define("media-captions-listbox",id);var ld=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},pi=(a,t,r)=>(ld(a,t,"read from private field"),r?r.call(a):t.get(a)),Mr=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},ys=(a,t,r,d)=>(ld(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),_n=(a,t,r)=>(ld(a,t,"access private method"),r),sa,Ma,An,Tr,bs,ad,Ph,ud,Nh,Bo,nd,Ho,sd,Oh=`
878
878
  <svg aria-hidden="true" viewBox="0 0 26 24">
879
879
  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
880
880
  </svg>`,Fp=`
@@ -920,7 +920,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
920
920
  <slot slot="captions-indicator" name="captions-indicator">${Oh}</slot>
921
921
  </media-captions-listbox>
922
922
  </media-chrome-menu-button>
923
- `;var od=class extends ce.HTMLElement{constructor(){super(),Mi(this,ad),Mi(this,ud),Mi(this,Bo),Mi(this,Ho),Mi(this,sa,void 0),Mi(this,Ma,void 0),Mi(this,An,void 0),Mi(this,Ti,void 0),Mi(this,bs,void 0);let t=this.attachShadow({mode:"open"}),i=Uh.content.cloneNode(!0);this.nativeEl=i,t.append(i),ys(this,sa,this.shadowRoot.querySelector("media-chrome-menu-button")),ys(this,Ma,pr(this,sa).querySelector(".enabled")),ys(this,An,pr(this,sa).querySelector(".disabled")),ys(this,Ti,pr(this,sa).querySelector("media-captions-listbox")),ys(this,bs,_n(this,ad,Ph).bind(this)),this._captionsReady=!1,_n(this,Ho,sd).call(this)}static get observedAttributes(){return["disabled",tt.MEDIA_CONTROLLER,"no-subtitles-fallback","default-showing",F.MEDIA_CAPTIONS_LIST,F.MEDIA_CAPTIONS_SHOWING,F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(t,i,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(i){let b=Me.getElementById(i);(v=b==null?void 0:b.unassociateElement)==null||v.call(b,this)}if(d){let b=Me.getElementById(d);(g=b==null?void 0:b.associateElement)==null||g.call(b,this)}}else t===F.MEDIA_CAPTIONS_SHOWING||t===F.MEDIA_SUBTITLES_SHOWING&&d!==i?d?_n(this,Bo,nd).call(this):_n(this,Ho,sd).call(this):t==="disabled"&&d!==i&&(d==null?this.enable():this.disable());if(this.hasAttribute("default-showing")&&pr(this,Ma).hidden){let b=!this.hasAttribute("no-subtitles-fallback");if((b?[F.MEDIA_CAPTIONS_LIST,F.MEDIA_SUBTITLES_LIST]:[F.MEDIA_CAPTIONS_LIST]).includes(t)){let M=!!this.getAttribute(F.MEDIA_CAPTIONS_LIST)||!!(b&&this.getAttribute(F.MEDIA_SUBTITLES_LIST));this._captionsReady!==M&&(this._captionsReady=M,this._captionsReady&&Xi(this))}}}enable(){this.addEventListener("click",pr(this,bs)),pr(this,sa).removeAttribute("disabled")}disable(){this.removeEventListener("click",pr(this,bs)),pr(this,sa).setAttribute("disabled","")}connectedCallback(){var t;this.hasAttribute("disabled")||this.enable(),ts(this)&&_n(this,Bo,nd).call(this);let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;this.disable();let i=this.getAttribute(tt.MEDIA_CONTROLLER);if(i){let d=Me.getElementById(i);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}get keysUsed(){return["Enter"," ","ArrowUp","ArrowDown","f","c","k","m"]}};sa=new WeakMap;Ma=new WeakMap;An=new WeakMap;Ti=new WeakMap;bs=new WeakMap;ad=new WeakSet;Ph=function(){_n(this,ud,Nh).call(this)};ud=new WeakSet;Nh=function(){var a,t,i;if(pr(this,Ti).offsetWidth===0)return;let d=this.shadowRoot.querySelectorAll("svg"),v=((a=pr(this,Ma).assignedElements()[0])!=null?a:d[0]).getBoundingClientRect(),g=((t=pr(this,An).assignedElements()[0])!=null?t:d[1]).getBoundingClientRect();if(this.hasAttribute("media-controller")){let b=v.width,L=g.width,M=b>0?b:L>0?L:0,R=v.height,y=g.height,P=R>0?R:y>0?y:0;pr(this,Ti).style.marginLeft=`calc(-${M}px - 10px * 2)`,pr(this,Ti).style.marginTop=`calc(${P}px + 10px * 2)`}else{let b=v.x,L=g.x,M=b>0?b:L>0?L:0,R=(i=this.getAttribute("bounds")?ka(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?i:this,y=R.getBoundingClientRect().x;pr(this,Ti).offsetWidth+M-y>R.offsetWidth?pr(this,Ti).style.translate=R.offsetWidth-pr(this,Ti).offsetWidth+"px":pr(this,Ti).style.translate=`calc(${M}px - ${y}px - 10px)`}};Bo=new WeakSet;nd=function(){pr(this,Ma).hidden=!1,pr(this,An).hidden=!0};Ho=new WeakSet;sd=function(){pr(this,Ma).hidden=!0,pr(this,An).hidden=!1};ce.customElements.get("media-captions-menu-button")||ce.customElements.define("media-captions-menu-button",od);var Go=oc(Fh(),1),jh=oc(Bh(),1),Bp=jh.default,ei=Bp,_s=class extends Error{constructor(a,t=_s.MEDIA_ERR_CUSTOM,i){var d;super(a),this.name="MediaError",this.code=t,this.fatal=i!=null?i:t>=_s.MEDIA_ERR_NETWORK&&t<=_s.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(d=_s.defaultMessages[this.code])!=null?d:"")}},sr=_s;sr.MEDIA_ERR_ABORTED=1,sr.MEDIA_ERR_NETWORK=2,sr.MEDIA_ERR_DECODE=3,sr.MEDIA_ERR_SRC_NOT_SUPPORTED=4,sr.MEDIA_ERR_ENCRYPTED=5,sr.MEDIA_ERR_CUSTOM=100,sr.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 Hp=a=>a==null,qh=(a,t)=>Hp(t)?!1:a in t,fd={ANY:"any",MUTED:"muted"},Sr={VOD:"on-demand",ON_DEMAND:"on-demand",LIVE:"live",LL_LIVE:"ll-live",DVR:"live:dvr",LL_DVR:"ll-live:dvr"},oi={MSE:"mse",NATIVE:"native"},md={HEADER:"header",QUERY:"query",NONE:"none"},kn=Object.values(md),Sn={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},pd={HLS:Sn.M3U8},Db=Object.keys(pd),Rb=[...Object.values(Sn),"hls","HLS"],xa=(a,t,i,d,v=a)=>{v.addEventListener(t,i,d),a.addEventListener("teardown",()=>{v.removeEventListener(t,i)},{once:!0})};function Kp(a,t,i){t&&i>t&&(i=t);for(let d=0;d<a.length;d++)if(a.start(d)<=i&&a.end(d)>=i)return!0;return!1}var Gp=a=>{let t=a.indexOf("?");if(t<0)return[a];let i=a.slice(0,t),d=a.slice(t);return[i,d]},Yh=a=>{let t=a.type;if(t){let d=t.toUpperCase();return qh(d,pd)?pd[d]:t}let{src:i}=a;return i?Vp(i):""},Vp=a=>{let t="";try{t=new URL(a).pathname}catch{console.error("invalid url")}let i=t.lastIndexOf(".");if(i<0)return"";let d=t.slice(i+1).toUpperCase();return qh(d,Sn)?Sn[d]:""},Wp=Object.values(fd),Hh=a=>typeof a=="boolean"||typeof a=="string"&&Wp.includes(a),jp=({autoplay:a},t,i)=>{let d=!1,v=!1,g=Hh(a)?a:!!a,b=()=>{d||xa(t,"playing",()=>{d=!0},{once:!0})};if(b(),xa(t,"loadstart",()=>{d=!1,b(),hd(t,g)},{once:!0}),xa(t,"loadstart",()=>{i||(v=!Number.isFinite(t.duration)),hd(t,g)},{once:!0}),i&&i.once(ei.Events.LEVEL_LOADED,(L,M)=>{var R;v=(R=M.details.live)!=null?R:!1}),!g){let L=()=>{!v||(i!=null&&i.liveSyncPosition?t.currentTime=i.liveSyncPosition:Number.isFinite(t.seekable.end(0))&&(t.currentTime=t.seekable.end(0)))};i&&xa(t,"play",()=>{t.preload==="metadata"?i.once(ei.Events.LEVEL_UPDATED,L):L()},{once:!0})}return L=>{d||(g=Hh(L)?L:!!L,hd(t,g))}},hd=(a,t)=>{if(!t)return;let i=a.muted,d=()=>a.muted=i;switch(t){case fd.ANY:a.play().catch(()=>{a.muted=!0,a.play().catch(d)});break;case fd.MUTED:a.muted=!0,a.play().catch(d);break;default:a.play().catch(()=>{});break}},qp=({preload:a,src:t},i,d)=>{let v=P=>{P!=null&&["","none","metadata","auto"].includes(P)?i.setAttribute("preload",P):i.removeAttribute("preload")};if(!d)return v(a),v;let g=!1,b=!1,L=d.config.maxBufferLength,M=d.config.maxBufferSize,R=P=>{v(P);let O=P!=null?P:i.preload;b||O==="none"||(O==="metadata"?(d.config.maxBufferLength=1,d.config.maxBufferSize=1):(d.config.maxBufferLength=L,d.config.maxBufferSize=M),y())},y=()=>{!g&&t&&(g=!0,d.loadSource(t))};return xa(i,"play",()=>{b=!0,d.config.maxBufferLength=L,d.config.maxBufferSize=M,y()},{once:!0}),R(a),R};function Yp(a,t){t.on(ei.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(v,{tracks:g})=>{g.forEach(b=>{var L;let M=(L=b.subtitleTrack)!=null?L:b.closedCaptions,R=t.subtitleTracks.findIndex(({lang:y,name:P,type:O})=>y==(M==null?void 0:M.lang)&&P===b.label&&O.toLowerCase()===b.kind);Vo(a,b.kind,b.label,M==null?void 0:M.lang,`${b.kind}${R}`)})});let i=()=>{var v;if(!t.subtitleTracks.length)return;let g=Array.from(a.textTracks).find(L=>L.id&&L.mode==="showing"&&["subtitles","captions"].includes(L.kind)),b=`${(v=t.subtitleTracks[t.subtitleTrack])==null?void 0:v.type.toLowerCase()}${t.subtitleTrack}`;if(g&&(t.subtitleTrack<0||(g==null?void 0:g.id)!==b)){let L=t.subtitleTracks.findIndex(({lang:M,name:R,type:y})=>M==g.language&&R===g.label&&y.toLowerCase()===g.kind);t.subtitleTrack=L}g&&(g==null?void 0:g.id)===b&&g.cues&&Array.from(g.cues).forEach(L=>{g.addCue(L)})};a.textTracks.addEventListener("change",i),t.on(ei.Events.CUES_PARSED,(v,{track:g,cues:b})=>{let L=a.textTracks.getTrackById(g);if(!L)return;let M=L.mode==="disabled";M&&(L.mode="hidden"),b.forEach(R=>{var y;(y=L.cues)!=null&&y.getCueById(R.id)||L.addCue(R)}),M&&(L.mode="disabled")}),t.once(ei.Events.DESTROYING,()=>{a.textTracks.removeEventListener("change",i),a.querySelectorAll("track[data-removeondestroy]").forEach(v=>{v.remove()})});let d=()=>{Array.from(a.textTracks).forEach(v=>{var g,b;if(!["subtitles","caption"].includes(v.kind)&&v.label==="thumbnails"){if(!((g=v.cues)!=null&&g.length)){let L=a.querySelector('track[label="thumbnails"]'),M=(b=L==null?void 0:L.getAttribute("src"))!=null?b:"";L==null||L.removeAttribute("src"),setTimeout(()=>{L==null||L.setAttribute("src",M)},0)}v.mode!=="hidden"&&(v.mode="hidden")}})};t.once(ei.Events.MANIFEST_LOADED,d),t.once(ei.Events.MEDIA_ATTACHED,d)}function Vo(a,t,i,d,v){let g=document.createElement("track");return g.kind=t,g.label=i,d&&(g.srclang=d),v&&(g.id=v),g.track.mode=["subtitles","captions"].includes(t)?"disabled":"hidden",g.setAttribute("data-removeondestroy",""),a.append(g),g.track}function $h(a,t){let i=Array.prototype.find.call(a.querySelectorAll("track"),d=>d.track===t);i==null||i.remove()}var As="cuepoints",gd=Object.freeze({label:As}),Ed=(a,{label:t=As}=gd)=>{var i;return(i=Array.from(a.querySelectorAll("track")).find(d=>d.track.label===t&&d.track.kind==="metadata"))==null?void 0:i.track};async function yd(a,t,i=gd){let d=Ed(a,i);if(!d){let{label:v=As}=i;d=Vo(a,"metadata",v),d.mode="hidden",await new Promise(g=>setTimeout(()=>g(void 0),0))}return d.mode!=="hidden"&&(d.mode="hidden"),[...t].sort(({time:v},{time:g})=>g-v).forEach(({time:v,value:g})=>{var b,L;let M=Array.prototype.findIndex.call(d==null?void 0:d.cues,ue=>ue.startTime>=v),R=(b=d==null?void 0:d.cues)==null?void 0:b[M],y=R?R.startTime:Number.isFinite(a.duration)?a.duration:Number.MAX_SAFE_INTEGER,P=(L=d==null?void 0:d.cues)==null?void 0:L[M-1];P&&(P.endTime=v);let O=new VTTCue(v,y,JSON.stringify(g!=null?g:null));d.addCue(O)}),d}var zh=a=>({time:a.startTime,value:JSON.parse(a.text)});function Qh(a,t={label:As}){let i=Ed(a,t);return i!=null&&i.cues?Array.from(i.cues,d=>zh(d)):[]}function bd(a,t={label:As}){var i;let d=Ed(a,t);if((i=d==null?void 0:d.activeCues)!=null&&i.length)return zh(d.activeCues[0])}async function $p(a,t=gd){return new Promise(i=>{xa(a,"loadstart",async()=>{let d=await yd(a,[],t);xa(a,"cuechange",()=>{let v=bd(a);if(v){let g=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:v});a.dispatchEvent(g)}},{},d),i(d)})})}var Kh,Gh,zp=(Gh=(Kh=globalThis==null?void 0:globalThis.navigator)==null?void 0:Kh.userAgent)!=null?Gh:"",Qp=zp.toLowerCase().indexOf("android")!==-1,wn=new WeakMap,Xh="mux.com",Vh,Wh,Zh=(Wh=(Vh=ei).isSupported)==null?void 0:Wh.call(Vh),Xp=Qp,Jh=()=>Go.default.utils.now(),Zp=Go.default.utils.generateUUID,ef=(a,{domain:t=Xh}={})=>{if(!a)return;let[i,d=""]=Gp(a);return`https://stream.${t}/${i}.m3u8${d}`},Jp=a=>{if(!a)return;let[t]=a.split("?");return t||void 0},ev=a=>{if(!a||!a.startsWith("https://stream."))return;let[t]=new URL(a).pathname.slice(1).split(".m3u8");return t||void 0},tv=a=>{var t,i,d;return(t=a==null?void 0:a.metadata)!=null&&t.video_id?a.metadata.video_id:nf(a)&&(d=(i=Jp(a.playbackId))!=null?i:ev(a.src))!=null?d:a.src},tf=a=>{var t;return(t=wn.get(a))==null?void 0:t.error},rf=(a,t,i)=>{Td(t,i);let{metadata:d={}}=a,{view_session_id:v=Zp()}=d,g=tv(a);d.view_session_id=v,d.video_id=g,a.metadata=d,wn.set(t,{});let b=rv(a,t);av(a,t,b),nv(a,t,b),$p(t);let L=jp(a,t,b),M=qp(a,t,b);return{engine:b,setAutoplay:L,setPreload:M}},Td=(a,t)=>{let i=t==null?void 0:t.engine;i&&(i.detachMedia(),i.destroy()),(a==null?void 0:a.mux)&&!a.mux.deleted&&(a.mux.destroy(),delete a.mux),a&&(a.removeAttribute("src"),a.load(),a.removeEventListener("error",of),a.removeEventListener("error",vd),a.removeEventListener("durationchange",sf),wn.delete(a),a.dispatchEvent(new Event("teardown")))};function af(a,t){var i;let d=Yh(a);if(d!==Sn.M3U8)return!0;let v=!d||((i=t.canPlayType(d))!=null?i:!0),{preferPlayback:g}=a,b=g===oi.MSE,L=g===oi.NATIVE;return v&&(L||!(Zh&&(b||Xp)))}var rv=(a,t)=>{let{debug:i,streamType:d,startTime:v=-1,metadata:g,preferCmcd:b}=a,L=Yh(a)===Sn.M3U8,M=af(a,t);if(L&&!M&&Zh){let R={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0},y=iv(d),P=b!==md.NONE?{useHeaders:b===md.HEADER,sessionId:g.view_session_id,contentId:g.video_id}:void 0;return new ei({debug:i,startPosition:v,cmcd:P,...R,...y})}},iv=a=>[Sr.LIVE,Sr.DVR].includes(a)?{backBufferLength:8}:[Sr.LL_LIVE,Sr.LL_DVR].includes(a)?{backBufferLength:4,maxFragLookUpTolerance:.001}:{},nf=({playbackId:a,src:t,customDomain:i})=>{if(a)return!0;if(typeof t!="string")return!1;let d=window==null?void 0:window.location.href,v=new URL(t,d).hostname.toLocaleLowerCase();return v.includes(Xh)||!!i&&v.includes(i.toLocaleLowerCase())},av=(a,t,i)=>{var d;let{envKey:v}=a,g=nf(a);if(v||g){let{playerInitTime:b,playerSoftwareName:L,playerSoftwareVersion:M,beaconCollectionDomain:R,debug:y,disableCookies:P}=a,O={...a.metadata,video_title:((d=a==null?void 0:a.metadata)==null?void 0:d.video_title)||void 0},ue=Q=>typeof Q.player_error_code=="string"?!1:typeof a.errorTranslator=="function"?a.errorTranslator(Q):Q;Go.default.monitor(t,{debug:y,beaconCollectionDomain:R,hlsjs:i,Hls:i?ei:void 0,automaticErrorTracking:!1,errorTranslator:ue,disableCookies:P,data:{...v?{env_key:v}:{},player_software_name:L,player_software:L,player_software_version:M,player_init_time:b,...O}})}},nv=(a,t,i)=>{var d;let v=af(a,t),{src:g}=a;t&&v?(typeof g=="string"?(t.setAttribute("src",g),a.startTime&&(((d=wn.get(t))!=null?d:{}).startTime=a.startTime,t.addEventListener("durationchange",sf,{once:!0}))):t.removeAttribute("src"),t.addEventListener("error",of),t.addEventListener("error",vd)):i&&g?(i.on(ei.Events.ERROR,(b,L)=>{let M={[ei.ErrorTypes.NETWORK_ERROR]:sr.MEDIA_ERR_NETWORK,[ei.ErrorTypes.MEDIA_ERROR]:sr.MEDIA_ERR_DECODE},R=new sr("",M[L.type]);R.fatal=L.fatal,R.data=L,t.dispatchEvent(new CustomEvent("error",{detail:R}))}),t.addEventListener("error",vd),Yp(t,i),i.attachMedia(t)):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 sf(a){var t;let i=a.target,d=(t=wn.get(i))==null?void 0:t.startTime;if(!!d&&Kp(i.seekable,i.duration,d)){let v=i.preload==="auto";v&&(i.preload="none"),i.currentTime=d,v&&(i.preload="auto")}}async function of(a){if(!a.isTrusted)return;a.stopImmediatePropagation();let t=a.target;if(!(t!=null&&t.error))return;let{message:i,code:d}=t.error,v=new sr(i,d);if(t.src&&(d!==sr.MEDIA_ERR_DECODE||d!==void 0))try{let{status:g}=await fetch(t.src);v.data={response:{code:g}}}catch{}t.dispatchEvent(new CustomEvent("error",{detail:v}))}function vd(a){var t,i;if(!(a instanceof CustomEvent)||!(a.detail instanceof sr))return;let d=a.target,v=a.detail;!v||!v.fatal||(((t=wn.get(d))!=null?t:{}).error=v,(i=d.mux)==null||i.emit("error",{player_error_code:v.code,player_error_message:v.message}))}var sv=Object.defineProperty,ov=(a,t,i)=>t in a?sv(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,Wo=(a,t,i)=>(ov(a,typeof t!="symbol"?t+"":t,i),i),kd=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},Xe=(a,t,i)=>(kd(a,t,"read from private field"),i?i.call(a):t.get(a)),Ft=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},rr=(a,t,i,d)=>(kd(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),Tr=(a,t,i)=>(kd(a,t,"access private method"),i),el=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class a extends el{}globalThis.DocumentFragment=a}var wd=class extends el{},lv=class extends el{},uv={get(a){},define(a,t,i){},upgrade(a){},whenDefined(a){return Promise.resolve(wd)}},jo,dv=class{constructor(a,t={}){Ft(this,jo,void 0),rr(this,jo,t==null?void 0:t.detail)}get detail(){return Xe(this,jo)}initCustomEvent(){}};jo=new WeakMap;function cv(a,t){return new wd}var uf={document:{createElement:cv},DocumentFragment,customElements:uv,CustomEvent:dv,EventTarget:el,HTMLElement:wd,HTMLVideoElement:lv},df=typeof window=="undefined"||typeof globalThis.customElements=="undefined",oa=df?uf:globalThis,cf=df?uf.document:globalThis.document,hv=()=>{try{return"0.13.2"}catch{}return"UNKNOWN"},fv=hv(),mv=()=>fv,pv=class extends Set{add(a){super.add(new WeakRef(a))}forEach(a){super.forEach(t=>{let i=t.deref();i&&a(i)})}},vv=a=>{var t,i,d,v,g,b,L,M,R,y,P,O,ue,Q,de,he,Y,pe,X,oe,z,be,ke,He,Z,w,q,N,fe,_e,te,re,Re,Pe,Fe,Se,Ye,ot,le,Ee;return t=class extends a{constructor(){super(),Ft(this,q),Ft(this,fe),Ft(this,te),Ft(this,Re),Ft(this,Fe),Ft(this,Ye),Ft(this,le),Wo(this,"castEnabled",!1),Ft(this,z,{paused:!1}),Ft(this,be,void 0),Ft(this,ke,{}),Ft(this,He,void 0),Ft(this,Z,void 0),Ft(this,w,void 0),t.instances.add(this),Tr(this,Fe,Se).call(this)}static get castElement(){return Xe(t,i)}static get castEnabled(){return Xe(t,d)}static get castState(){var U;return(U=Xe(t,R,y))==null?void 0:U.getCastState()}static async exitCast(){try{await Xe(t,R,y).endCurrentSession(!0)}catch(U){console.error(U);return}}get castPlayer(){if(t.castElement===this)return Xe(this,be)}attributeChangedCallback(U){if(this.castPlayer)switch(U){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(U={}){var ve;Tr(ve=t,X,oe).call(ve,U),rr(t,i,this),Object.entries(Xe(this,ke)).forEach(([Le,Ne])=>{Xe(this,be).controller.addEventListener(Le,Ne)});try{await Xe(t,R,y).requestSession()}catch{rr(t,i,void 0);return}Xe(this,z).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(Le){console.error(Le)}}async load(){var U,ve;if(!this.castPlayer)return super.load();let Le=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),Ne=[...this.querySelectorAll("track")].filter(({kind:xe,src:$e})=>$e&&(xe==="subtitles"||xe==="captions")),Ue=[],Ge=0;Ne.length&&(Le.tracks=Ne.map(xe=>{let $e=++Ge;Ue.length===0&&xe.track.mode==="showing"&&Ue.push($e);let rt=new chrome.cast.media.Track($e,chrome.cast.media.TrackType.TEXT);return rt.trackContentId=xe.src,rt.trackContentType="text/vtt",rt.subtype=xe.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,rt.name=xe.label,rt.language=xe.srclang,rt})),this.castStreamType==="live"?Le.streamType=chrome.cast.media.StreamType.LIVE:Le.streamType=chrome.cast.media.StreamType.BUFFERED,Le.metadata=new chrome.cast.media.GenericMediaMetadata,Le.metadata.title=this.title,Le.metadata.images=[{url:this.poster}];let Te=new chrome.cast.media.LoadRequest(Le);Te.currentTime=(U=super.currentTime)!=null?U:0,Te.autoplay=!Xe(this,z).paused,Te.activeTrackIds=Ue,await((ve=Xe(t,P,O))==null?void 0:ve.loadMedia(Te)),this.dispatchEvent(new Event("volumechange"))}play(){var U;if(this.castPlayer){this.castPlayer.isPaused&&((U=this.castPlayer.controller)==null||U.playOrPause());return}return super.play()}pause(){var U;if(this.castPlayer){this.castPlayer.isPaused||(U=this.castPlayer.controller)==null||U.playOrPause();return}super.pause()}get castSrc(){var U,ve,Le;return(Le=(ve=this.getAttribute("cast-src"))!=null?ve:(U=this.querySelector("source"))==null?void 0:U.src)!=null?Le:this.currentSrc}set castSrc(U){this.castSrc!=U&&this.setAttribute("cast-src",`${U}`)}get castContentType(){var U;return(U=this.getAttribute("cast-content-type"))!=null?U:void 0}set castContentType(U){this.setAttribute("cast-content-type",`${U}`)}get castStreamType(){var U;return(U=this.getAttribute("cast-stream-type"))!=null?U:void 0}set castStreamType(U){this.setAttribute("cast-stream-type",`${U}`)}get readyState(){if(this.castPlayer)switch(this.castPlayer.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.castPlayer?this.castPlayer.isPaused:super.paused}get muted(){var U;return this.castPlayer?(U=this.castPlayer)==null?void 0:U.isMuted:super.muted}set muted(U){var ve;if(this.castPlayer){(U&&!this.castPlayer.isMuted||!U&&this.castPlayer.isMuted)&&((ve=this.castPlayer.controller)==null||ve.muteOrUnmute());return}super.muted=U}get volume(){var U,ve;return this.castPlayer?(ve=(U=this.castPlayer)==null?void 0:U.volumeLevel)!=null?ve:1:super.volume}set volume(U){var ve;if(this.castPlayer){this.castPlayer.volumeLevel=U,(ve=this.castPlayer.controller)==null||ve.setVolumeLevel();return}super.volume=U}get duration(){var U,ve;return this.castPlayer&&Xe(this,q,N)?(ve=(U=this.castPlayer)==null?void 0:U.duration)!=null?ve:NaN:super.duration}get currentTime(){var U,ve;return this.castPlayer&&Xe(this,q,N)?(ve=(U=this.castPlayer)==null?void 0:U.currentTime)!=null?ve:0:super.currentTime}set currentTime(U){var ve;if(this.castPlayer){this.castPlayer.currentTime=U,(ve=this.castPlayer.controller)==null||ve.seek();return}super.currentTime=U}get onentercast(){return Xe(this,He)}set onentercast(U){Xe(this,He)&&(this.removeEventListener("entercast",Xe(this,He)),rr(this,He,null)),typeof U=="function"&&(rr(this,He,U),this.addEventListener("entercast",U))}get onleavecast(){return Xe(this,Z)}set onleavecast(U){Xe(this,Z)&&(this.removeEventListener("leavecast",Xe(this,Z)),rr(this,Z,null)),typeof U=="function"&&(rr(this,Z,U),this.addEventListener("leavecast",U))}get oncastchange(){return Xe(this,w)}set oncastchange(U){Xe(this,w)&&(this.removeEventListener("castchange",Xe(this,w)),rr(this,w,null)),typeof U=="function"&&(rr(this,w,U),this.addEventListener("castchange",U))}},i=new WeakMap,d=new WeakMap,v=new WeakMap,g=new WeakSet,b=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},L=new WeakSet,M=function(){return typeof cast!="undefined"&&cast.framework},R=new WeakSet,y=function(){if(Xe(t,L,M))return cast.framework.CastContext.getInstance()},P=new WeakSet,O=function(){var U;return(U=Xe(t,R,y))==null?void 0:U.getCurrentSession()},ue=new WeakSet,Q=function(){var U;return(U=Xe(t,P,O))==null?void 0:U.getSessionObj().media[0]},de=new WeakSet,he=function(U){return new Promise((ve,Le)=>{Xe(t,ue,Q).editTracksInfo(U,ve,Le)})},Y=new WeakSet,pe=function(U){return new Promise((ve,Le)=>{Xe(t,ue,Q).getStatus(U,ve,Le)})},X=new WeakSet,oe=function(U){return Xe(t,R,y).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...U})},z=new WeakMap,be=new WeakMap,ke=new WeakMap,He=new WeakMap,Z=new WeakMap,w=new WeakMap,q=new WeakSet,N=function(){var U;return(U=this.castPlayer)==null?void 0:U.isMediaLoaded},fe=new WeakSet,_e=function(){Xe(t,i)===this&&(Object.entries(Xe(this,ke)).forEach(([U,ve])=>{Xe(this,be).controller.removeEventListener(U,ve)}),rr(t,i,void 0),this.muted=Xe(this,be).isMuted,this.currentTime=Xe(this,be).savedPlayerState.currentTime,Xe(this,be).savedPlayerState.isPaused===!1&&this.play())},te=new WeakSet,re=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:Xe(t,R,y).getCastState()}))},Re=new WeakSet,Pe=async function(){var U,ve;let{SESSION_RESUMED:Le}=cast.framework.SessionState;if(Xe(t,R,y).getSessionState()===Le&&this.castSrc===((U=Xe(t,ue,Q))==null?void 0:U.media.contentId)){rr(t,i,this),Object.entries(Xe(this,ke)).forEach(([Ne,Ue])=>{Xe(this,be).controller.addEventListener(Ne,Ue)});try{await Tr(ve=t,Y,pe).call(ve,new chrome.cast.media.GetStatusRequest)}catch(Ne){console.error(Ne)}Xe(this,ke)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),Xe(this,ke)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Fe=new WeakSet,Se=function(){var U;!Xe(t,L,M)||this.castEnabled||(this.castEnabled=!0,Tr(U=t,X,oe).call(U),this.textTracks.addEventListener("change",Tr(this,le,Ee).bind(this)),Tr(this,te,re).call(this),rr(this,be,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(Xe(this,be)),rr(this,ke,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:ve})=>{ve===!1&&Tr(this,fe,_e).call(this),this.dispatchEvent(new Event(ve?"entercast":"leavecast"))},[cast.framework.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.dispatchEvent(new Event("durationchange"))},[cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{!Xe(this,q,N)||this.dispatchEvent(new Event("timeupdate"))},[cast.framework.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.dispatchEvent(new Event("resize"))},[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.dispatchEvent(new Event(this.paused?"pause":"play"))},[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var ve,Le;((ve=this.castPlayer)==null?void 0:ve.playerState)!==chrome.cast.media.PlayerState.PAUSED&&this.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(Le=this.castPlayer)==null?void 0:Le.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!Xe(this,q,N)||(await Promise.resolve(),Tr(this,Ye,ot).call(this))}}))},Ye=new WeakSet,ot=function(){Tr(this,le,Ee).call(this)},le=new WeakSet,Ee=async function(){var U,ve,Le,Ne,Ue,Ge;if(!this.castPlayer)return;let Te=((ve=(U=Xe(this,be).mediaInfo)==null?void 0:U.tracks)!=null?ve:[]).filter(({type:lt})=>lt===chrome.cast.media.TrackType.TEXT),xe=[...this.textTracks].filter(({kind:lt})=>lt==="subtitles"||lt==="captions"),$e=Te.map(({language:lt,name:wt,trackId:Rt})=>{var At;let{mode:pt}=(At=xe.find(Ut=>Ut.language===lt&&Ut.label===wt))!=null?At:{};return pt?{mode:pt,trackId:Rt}:!1}).filter(Boolean),rt=$e.filter(({mode:lt})=>lt!=="showing").map(({trackId:lt})=>lt),_t=$e.find(({mode:lt})=>lt==="showing"),gt=(Ue=(Ne=(Le=Xe(t,P,O))==null?void 0:Le.getSessionObj().media[0])==null?void 0:Ne.activeTrackIds)!=null?Ue:[],Lt=gt;if(gt.length&&(Lt=Lt.filter(lt=>!rt.includes(lt))),_t!=null&&_t.trackId&&(Lt=[...Lt,_t.trackId]),Lt=[...new Set(Lt)],!((lt,wt)=>lt.length===wt.length&&lt.every(Rt=>wt.includes(Rt)))(gt,Lt))try{let lt=new chrome.cast.media.EditTracksInfoRequest(Lt);await Tr(Ge=t,de,he).call(Ge,lt)}catch(lt){console.error(lt)}},Ft(t,g),Ft(t,L),Ft(t,R),Ft(t,P),Ft(t,ue),Ft(t,de),Ft(t,Y),Ft(t,X),Wo(t,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),Wo(t,"instances",new pv),Ft(t,i,void 0),Ft(t,d,!1),Wo(t,"initCast",()=>{var U;Xe(t,g,b)?Xe(t,L,M)?Xe(U=t,v).call(U,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var ve;return Xe(ve=t,v).call(ve,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var ve;return Xe(ve=t,v).call(ve,chrome.cast.isAvailable)})}}),Ft(t,v,U=>{if(U){rr(t,d,!0);let{CAST_STATE_CHANGED:ve}=cast.framework.CastContextEventType;Xe(t,R,y).addEventListener(ve,Ne=>{t.instances.forEach(Ue=>{var Ge;return Tr(Ge=Ue,te,re).call(Ge,Ne)})});let{SESSION_STATE_CHANGED:Le}=cast.framework.CastContextEventType;Xe(t,R,y).addEventListener(Le,Ne=>{t.instances.forEach(Ue=>{var Ge;return Tr(Ge=Ue,Re,Pe).call(Ge,Ne)})}),t.instances.forEach(Ne=>{var Ue;return Tr(Ue=Ne,Fe,Se).call(Ue)})}}),t};if(globalThis.HTMLVideoElement&&globalThis.customElements){let a=vv(HTMLVideoElement);globalThis.customElements.get("castable-video")||(globalThis.customElements.define("castable-video",a,{extends:"video"}),globalThis.CastableVideoElement=a),a.initCast()}var Id=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","castchange","entercast","leavecast"],hf=cf.createElement("template");hf.innerHTML=`
923
+ `;var od=class extends ce.HTMLElement{constructor(){super(),Mr(this,ad),Mr(this,ud),Mr(this,Bo),Mr(this,Ho),Mr(this,sa,void 0),Mr(this,Ma,void 0),Mr(this,An,void 0),Mr(this,Tr,void 0),Mr(this,bs,void 0);let t=this.attachShadow({mode:"open"}),r=Uh.content.cloneNode(!0);this.nativeEl=r,t.append(r),ys(this,sa,this.shadowRoot.querySelector("media-chrome-menu-button")),ys(this,Ma,pi(this,sa).querySelector(".enabled")),ys(this,An,pi(this,sa).querySelector(".disabled")),ys(this,Tr,pi(this,sa).querySelector("media-captions-listbox")),ys(this,bs,_n(this,ad,Ph).bind(this)),this._captionsReady=!1,_n(this,Ho,sd).call(this)}static get observedAttributes(){return["disabled",tt.MEDIA_CONTROLLER,"no-subtitles-fallback","default-showing",F.MEDIA_CAPTIONS_LIST,F.MEDIA_CAPTIONS_SHOWING,F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(t,r,d){var v,g;if(t===tt.MEDIA_CONTROLLER){if(r){let E=Me.getElementById(r);(v=E==null?void 0:E.unassociateElement)==null||v.call(E,this)}if(d){let E=Me.getElementById(d);(g=E==null?void 0:E.associateElement)==null||g.call(E,this)}}else t===F.MEDIA_CAPTIONS_SHOWING||t===F.MEDIA_SUBTITLES_SHOWING&&d!==r?d?_n(this,Bo,nd).call(this):_n(this,Ho,sd).call(this):t==="disabled"&&d!==r&&(d==null?this.enable():this.disable());if(this.hasAttribute("default-showing")&&pi(this,Ma).hidden){let E=!this.hasAttribute("no-subtitles-fallback");if((E?[F.MEDIA_CAPTIONS_LIST,F.MEDIA_SUBTITLES_LIST]:[F.MEDIA_CAPTIONS_LIST]).includes(t)){let M=!!this.getAttribute(F.MEDIA_CAPTIONS_LIST)||!!(E&&this.getAttribute(F.MEDIA_SUBTITLES_LIST));this._captionsReady!==M&&(this._captionsReady=M,this._captionsReady&&Xr(this))}}}enable(){this.addEventListener("click",pi(this,bs)),pi(this,sa).removeAttribute("disabled")}disable(){this.removeEventListener("click",pi(this,bs)),pi(this,sa).setAttribute("disabled","")}connectedCallback(){var t;this.hasAttribute("disabled")||this.enable(),ts(this)&&_n(this,Bo,nd).call(this);let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.associateElement)==null||t.call(d,this)}}disconnectedCallback(){var t;this.disable();let r=this.getAttribute(tt.MEDIA_CONTROLLER);if(r){let d=Me.getElementById(r);(t=d==null?void 0:d.unassociateElement)==null||t.call(d,this)}}get keysUsed(){return["Enter"," ","ArrowUp","ArrowDown","f","c","k","m"]}};sa=new WeakMap;Ma=new WeakMap;An=new WeakMap;Tr=new WeakMap;bs=new WeakMap;ad=new WeakSet;Ph=function(){_n(this,ud,Nh).call(this)};ud=new WeakSet;Nh=function(){var a,t,r;if(pi(this,Tr).offsetWidth===0)return;let d=this.shadowRoot.querySelectorAll("svg"),v=((a=pi(this,Ma).assignedElements()[0])!=null?a:d[0]).getBoundingClientRect(),g=((t=pi(this,An).assignedElements()[0])!=null?t:d[1]).getBoundingClientRect();if(this.hasAttribute("media-controller")){let E=v.width,L=g.width,M=E>0?E:L>0?L:0,R=v.height,b=g.height,P=R>0?R:b>0?b:0;pi(this,Tr).style.marginLeft=`calc(-${M}px - 10px * 2)`,pi(this,Tr).style.marginTop=`calc(${P}px + 10px * 2)`}else{let E=v.x,L=g.x,M=E>0?E:L>0?L:0,R=(r=this.getAttribute("bounds")?ka(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?r:this,b=R.getBoundingClientRect().x;pi(this,Tr).offsetWidth+M-b>R.offsetWidth?pi(this,Tr).style.translate=R.offsetWidth-pi(this,Tr).offsetWidth+"px":pi(this,Tr).style.translate=`calc(${M}px - ${b}px - 10px)`}};Bo=new WeakSet;nd=function(){pi(this,Ma).hidden=!1,pi(this,An).hidden=!0};Ho=new WeakSet;sd=function(){pi(this,Ma).hidden=!0,pi(this,An).hidden=!1};ce.customElements.get("media-captions-menu-button")||ce.customElements.define("media-captions-menu-button",od);var Go=oc(Fh(),1),jh=oc(Bh(),1),Bp=jh.default,er=Bp,_s=class extends Error{constructor(a,t=_s.MEDIA_ERR_CUSTOM,r){var d;super(a),this.name="MediaError",this.code=t,this.fatal=r!=null?r:t>=_s.MEDIA_ERR_NETWORK&&t<=_s.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(d=_s.defaultMessages[this.code])!=null?d:"")}},si=_s;si.MEDIA_ERR_ABORTED=1,si.MEDIA_ERR_NETWORK=2,si.MEDIA_ERR_DECODE=3,si.MEDIA_ERR_SRC_NOT_SUPPORTED=4,si.MEDIA_ERR_ENCRYPTED=5,si.MEDIA_ERR_CUSTOM=100,si.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 Hp=a=>a==null,qh=(a,t)=>Hp(t)?!1:a in t,fd={ANY:"any",MUTED:"muted"},Si={VOD:"on-demand",ON_DEMAND:"on-demand",LIVE:"live",LL_LIVE:"ll-live",DVR:"live:dvr",LL_DVR:"ll-live:dvr"},or={MSE:"mse",NATIVE:"native"},md={HEADER:"header",QUERY:"query",NONE:"none"},kn=Object.values(md),Sn={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},pd={HLS:Sn.M3U8},Db=Object.keys(pd),Rb=[...Object.values(Sn),"hls","HLS"],xa=(a,t,r,d,v=a)=>{v.addEventListener(t,r,d),a.addEventListener("teardown",()=>{v.removeEventListener(t,r)},{once:!0})};function Kp(a,t,r){t&&r>t&&(r=t);for(let d=0;d<a.length;d++)if(a.start(d)<=r&&a.end(d)>=r)return!0;return!1}var Gp=a=>{let t=a.indexOf("?");if(t<0)return[a];let r=a.slice(0,t),d=a.slice(t);return[r,d]},Yh=a=>{let t=a.type;if(t){let d=t.toUpperCase();return qh(d,pd)?pd[d]:t}let{src:r}=a;return r?Vp(r):""},Vp=a=>{let t="";try{t=new URL(a).pathname}catch{console.error("invalid url")}let r=t.lastIndexOf(".");if(r<0)return"";let d=t.slice(r+1).toUpperCase();return qh(d,Sn)?Sn[d]:""},Wp=Object.values(fd),Hh=a=>typeof a=="boolean"||typeof a=="string"&&Wp.includes(a),jp=({autoplay:a},t,r)=>{let d=!1,v=!1,g=Hh(a)?a:!!a,E=()=>{d||xa(t,"playing",()=>{d=!0},{once:!0})};if(E(),xa(t,"loadstart",()=>{d=!1,E(),hd(t,g)},{once:!0}),xa(t,"loadstart",()=>{r||(v=!Number.isFinite(t.duration)),hd(t,g)},{once:!0}),r&&r.once(er.Events.LEVEL_LOADED,(L,M)=>{var R;v=(R=M.details.live)!=null?R:!1}),!g){let L=()=>{!v||(r!=null&&r.liveSyncPosition?t.currentTime=r.liveSyncPosition:Number.isFinite(t.seekable.end(0))&&(t.currentTime=t.seekable.end(0)))};r&&xa(t,"play",()=>{t.preload==="metadata"?r.once(er.Events.LEVEL_UPDATED,L):L()},{once:!0})}return L=>{d||(g=Hh(L)?L:!!L,hd(t,g))}},hd=(a,t)=>{if(!t)return;let r=a.muted,d=()=>a.muted=r;switch(t){case fd.ANY:a.play().catch(()=>{a.muted=!0,a.play().catch(d)});break;case fd.MUTED:a.muted=!0,a.play().catch(d);break;default:a.play().catch(()=>{});break}},qp=({preload:a,src:t},r,d)=>{let v=P=>{P!=null&&["","none","metadata","auto"].includes(P)?r.setAttribute("preload",P):r.removeAttribute("preload")};if(!d)return v(a),v;let g=!1,E=!1,L=d.config.maxBufferLength,M=d.config.maxBufferSize,R=P=>{v(P);let O=P!=null?P:r.preload;E||O==="none"||(O==="metadata"?(d.config.maxBufferLength=1,d.config.maxBufferSize=1):(d.config.maxBufferLength=L,d.config.maxBufferSize=M),b())},b=()=>{!g&&t&&(g=!0,d.loadSource(t))};return xa(r,"play",()=>{E=!0,d.config.maxBufferLength=L,d.config.maxBufferSize=M,b()},{once:!0}),R(a),R};function Yp(a,t){t.on(er.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(v,{tracks:g})=>{g.forEach(E=>{var L;let M=(L=E.subtitleTrack)!=null?L:E.closedCaptions,R=t.subtitleTracks.findIndex(({lang:b,name:P,type:O})=>b==(M==null?void 0:M.lang)&&P===E.label&&O.toLowerCase()===E.kind);Vo(a,E.kind,E.label,M==null?void 0:M.lang,`${E.kind}${R}`)})});let r=()=>{var v;if(!t.subtitleTracks.length)return;let g=Array.from(a.textTracks).find(L=>L.id&&L.mode==="showing"&&["subtitles","captions"].includes(L.kind)),E=`${(v=t.subtitleTracks[t.subtitleTrack])==null?void 0:v.type.toLowerCase()}${t.subtitleTrack}`;if(g&&(t.subtitleTrack<0||(g==null?void 0:g.id)!==E)){let L=t.subtitleTracks.findIndex(({lang:M,name:R,type:b})=>M==g.language&&R===g.label&&b.toLowerCase()===g.kind);t.subtitleTrack=L}g&&(g==null?void 0:g.id)===E&&g.cues&&Array.from(g.cues).forEach(L=>{g.addCue(L)})};a.textTracks.addEventListener("change",r),t.on(er.Events.CUES_PARSED,(v,{track:g,cues:E})=>{let L=a.textTracks.getTrackById(g);if(!L)return;let M=L.mode==="disabled";M&&(L.mode="hidden"),E.forEach(R=>{var b;(b=L.cues)!=null&&b.getCueById(R.id)||L.addCue(R)}),M&&(L.mode="disabled")}),t.once(er.Events.DESTROYING,()=>{a.textTracks.removeEventListener("change",r),a.querySelectorAll("track[data-removeondestroy]").forEach(v=>{v.remove()})});let d=()=>{Array.from(a.textTracks).forEach(v=>{var g,E;if(!["subtitles","caption"].includes(v.kind)&&v.label==="thumbnails"){if(!((g=v.cues)!=null&&g.length)){let L=a.querySelector('track[label="thumbnails"]'),M=(E=L==null?void 0:L.getAttribute("src"))!=null?E:"";L==null||L.removeAttribute("src"),setTimeout(()=>{L==null||L.setAttribute("src",M)},0)}v.mode!=="hidden"&&(v.mode="hidden")}})};t.once(er.Events.MANIFEST_LOADED,d),t.once(er.Events.MEDIA_ATTACHED,d)}function Vo(a,t,r,d,v){let g=document.createElement("track");return g.kind=t,g.label=r,d&&(g.srclang=d),v&&(g.id=v),g.track.mode=["subtitles","captions"].includes(t)?"disabled":"hidden",g.setAttribute("data-removeondestroy",""),a.append(g),g.track}function $h(a,t){let r=Array.prototype.find.call(a.querySelectorAll("track"),d=>d.track===t);r==null||r.remove()}var As="cuepoints",gd=Object.freeze({label:As}),Ed=(a,{label:t=As}=gd)=>{var r;return(r=Array.from(a.querySelectorAll("track")).find(d=>d.track.label===t&&d.track.kind==="metadata"))==null?void 0:r.track};async function yd(a,t,r=gd){let d=Ed(a,r);if(!d){let{label:v=As}=r;d=Vo(a,"metadata",v),d.mode="hidden",await new Promise(g=>setTimeout(()=>g(void 0),0))}return d.mode!=="hidden"&&(d.mode="hidden"),[...t].sort(({time:v},{time:g})=>g-v).forEach(({time:v,value:g})=>{var E,L;let M=Array.prototype.findIndex.call(d==null?void 0:d.cues,ue=>ue.startTime>=v),R=(E=d==null?void 0:d.cues)==null?void 0:E[M],b=R?R.startTime:Number.isFinite(a.duration)?a.duration:Number.MAX_SAFE_INTEGER,P=(L=d==null?void 0:d.cues)==null?void 0:L[M-1];P&&(P.endTime=v);let O=new VTTCue(v,b,JSON.stringify(g!=null?g:null));d.addCue(O)}),d}var zh=a=>({time:a.startTime,value:JSON.parse(a.text)});function Qh(a,t={label:As}){let r=Ed(a,t);return r!=null&&r.cues?Array.from(r.cues,d=>zh(d)):[]}function bd(a,t={label:As}){var r;let d=Ed(a,t);if((r=d==null?void 0:d.activeCues)!=null&&r.length)return zh(d.activeCues[0])}async function $p(a,t=gd){return new Promise(r=>{xa(a,"loadstart",async()=>{let d=await yd(a,[],t);xa(a,"cuechange",()=>{let v=bd(a);if(v){let g=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:v});a.dispatchEvent(g)}},{},d),r(d)})})}var Kh,Gh,zp=(Gh=(Kh=globalThis==null?void 0:globalThis.navigator)==null?void 0:Kh.userAgent)!=null?Gh:"",Qp=zp.toLowerCase().indexOf("android")!==-1,In=new WeakMap,Xh="mux.com",Vh,Wh,Zh=(Wh=(Vh=er).isSupported)==null?void 0:Wh.call(Vh),Xp=Qp,Jh=()=>Go.default.utils.now(),Zp=Go.default.utils.generateUUID,ef=(a,{domain:t=Xh,maxResolution:r=""}={})=>{if(!a)return;let[d,v=""]=Gp(a),g=new URL(`https://stream.${t}/${d}.m3u8${v}`);return r&&g.searchParams.set("max_resolution",r),g.toString()},Jp=a=>{if(!a)return;let[t]=a.split("?");return t||void 0},ev=a=>{if(!a||!a.startsWith("https://stream."))return;let[t]=new URL(a).pathname.slice(1).split(".m3u8");return t||void 0},tv=a=>{var t,r,d;return(t=a==null?void 0:a.metadata)!=null&&t.video_id?a.metadata.video_id:nf(a)&&(d=(r=Jp(a.playbackId))!=null?r:ev(a.src))!=null?d:a.src},tf=a=>{var t;return(t=In.get(a))==null?void 0:t.error},rf=(a,t,r)=>{Td(t,r);let{metadata:d={}}=a,{view_session_id:v=Zp()}=d,g=tv(a);d.view_session_id=v,d.video_id=g,a.metadata=d,In.set(t,{});let E=iv(a,t);av(a,t,E),nv(a,t,E),$p(t);let L=jp(a,t,E),M=qp(a,t,E);return{engine:E,setAutoplay:L,setPreload:M}},Td=(a,t)=>{let r=t==null?void 0:t.engine;r&&(r.detachMedia(),r.destroy()),(a==null?void 0:a.mux)&&!a.mux.deleted&&(a.mux.destroy(),delete a.mux),a&&(a.removeAttribute("src"),a.load(),a.removeEventListener("error",of),a.removeEventListener("error",vd),a.removeEventListener("durationchange",sf),In.delete(a),a.dispatchEvent(new Event("teardown")))};function af(a,t){var r;let d=Yh(a);if(d!==Sn.M3U8)return!0;let v=!d||((r=t.canPlayType(d))!=null?r:!0),{preferPlayback:g}=a,E=g===or.MSE,L=g===or.NATIVE;return v&&(L||!(Zh&&(E||Xp)))}var iv=(a,t)=>{let{debug:r,streamType:d,startTime:v=-1,metadata:g,preferCmcd:E}=a,L=Yh(a)===Sn.M3U8,M=af(a,t);if(L&&!M&&Zh){let R={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0},b=rv(d),P=E!==md.NONE?{useHeaders:E===md.HEADER,sessionId:g.view_session_id,contentId:g.video_id}:void 0;return new er({debug:r,startPosition:v,cmcd:P,...R,...b})}},rv=a=>[Si.LIVE,Si.DVR].includes(a)?{backBufferLength:8}:[Si.LL_LIVE,Si.LL_DVR].includes(a)?{backBufferLength:4,maxFragLookUpTolerance:.001}:{},nf=({playbackId:a,src:t,customDomain:r})=>{if(a)return!0;if(typeof t!="string")return!1;let d=window==null?void 0:window.location.href,v=new URL(t,d).hostname.toLocaleLowerCase();return v.includes(Xh)||!!r&&v.includes(r.toLocaleLowerCase())},av=(a,t,r)=>{var d;let{envKey:v}=a,g=nf(a);if(v||g){let{playerInitTime:E,playerSoftwareName:L,playerSoftwareVersion:M,beaconCollectionDomain:R,debug:b,disableCookies:P}=a,O={...a.metadata,video_title:((d=a==null?void 0:a.metadata)==null?void 0:d.video_title)||void 0},ue=Q=>typeof Q.player_error_code=="string"?!1:typeof a.errorTranslator=="function"?a.errorTranslator(Q):Q;Go.default.monitor(t,{debug:b,beaconCollectionDomain:R,hlsjs:r,Hls:r?er:void 0,automaticErrorTracking:!1,errorTranslator:ue,disableCookies:P,data:{...v?{env_key:v}:{},player_software_name:L,player_software:L,player_software_version:M,player_init_time:E,...O}})}},nv=(a,t,r)=>{var d;let v=af(a,t),{src:g}=a;t&&v?(typeof g=="string"?(t.setAttribute("src",g),a.startTime&&(((d=In.get(t))!=null?d:{}).startTime=a.startTime,t.addEventListener("durationchange",sf,{once:!0}))):t.removeAttribute("src"),t.addEventListener("error",of),t.addEventListener("error",vd),t.addEventListener("emptied",()=>{t.querySelectorAll("track[data-removeondestroy]").forEach(E=>{E.remove()})},{once:!0})):r&&g?(r.on(er.Events.ERROR,(E,L)=>{let M={[er.ErrorTypes.NETWORK_ERROR]:si.MEDIA_ERR_NETWORK,[er.ErrorTypes.MEDIA_ERROR]:si.MEDIA_ERR_DECODE},R=new si("",M[L.type]);R.fatal=L.fatal,R.data=L,t.dispatchEvent(new CustomEvent("error",{detail:R}))}),t.addEventListener("error",vd),Yp(t,r),r.attachMedia(t)):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 sf(a){var t;let r=a.target,d=(t=In.get(r))==null?void 0:t.startTime;if(!!d&&Kp(r.seekable,r.duration,d)){let v=r.preload==="auto";v&&(r.preload="none"),r.currentTime=d,v&&(r.preload="auto")}}async function of(a){if(!a.isTrusted)return;a.stopImmediatePropagation();let t=a.target;if(!(t!=null&&t.error))return;let{message:r,code:d}=t.error,v=new si(r,d);if(t.src&&(d!==si.MEDIA_ERR_DECODE||d!==void 0))try{let{status:g}=await fetch(t.src);v.data={response:{code:g}}}catch{}t.dispatchEvent(new CustomEvent("error",{detail:v}))}function vd(a){var t,r;if(!(a instanceof CustomEvent)||!(a.detail instanceof si))return;let d=a.target,v=a.detail;!v||!v.fatal||(((t=In.get(d))!=null?t:{}).error=v,(r=d.mux)==null||r.emit("error",{player_error_code:v.code,player_error_message:v.message}))}var sv=Object.defineProperty,ov=(a,t,r)=>t in a?sv(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,Wo=(a,t,r)=>(ov(a,typeof t!="symbol"?t+"":t,r),r),kd=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},Xe=(a,t,r)=>(kd(a,t,"read from private field"),r?r.call(a):t.get(a)),Ft=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},ii=(a,t,r,d)=>(kd(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),Ti=(a,t,r)=>(kd(a,t,"access private method"),r),el=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class a extends el{}globalThis.DocumentFragment=a}var Id=class extends el{},lv=class extends el{},uv={get(a){},define(a,t,r){},upgrade(a){},whenDefined(a){return Promise.resolve(Id)}},jo,dv=class{constructor(a,t={}){Ft(this,jo,void 0),ii(this,jo,t==null?void 0:t.detail)}get detail(){return Xe(this,jo)}initCustomEvent(){}};jo=new WeakMap;function cv(a,t){return new Id}var uf={document:{createElement:cv},DocumentFragment,customElements:uv,CustomEvent:dv,EventTarget:el,HTMLElement:Id,HTMLVideoElement:lv},df=typeof window=="undefined"||typeof globalThis.customElements=="undefined",oa=df?uf:globalThis,cf=df?uf.document:globalThis.document,hv=()=>{try{return"0.14.0"}catch{}return"UNKNOWN"},fv=hv(),mv=()=>fv,pv=class extends Set{add(a){super.add(new WeakRef(a))}forEach(a){super.forEach(t=>{let r=t.deref();r&&a(r)})}},vv=a=>{var t,r,d,v,g,E,L,M,R,b,P,O,ue,Q,de,he,Y,pe,X,oe,z,be,ke,He,Z,I,q,N,fe,_e,te,ie,Re,Pe,Fe,Se,Ye,ot,le,Ee;return t=class extends a{constructor(){super(),Ft(this,q),Ft(this,fe),Ft(this,te),Ft(this,Re),Ft(this,Fe),Ft(this,Ye),Ft(this,le),Wo(this,"castEnabled",!1),Ft(this,z,{paused:!1}),Ft(this,be,void 0),Ft(this,ke,{}),Ft(this,He,void 0),Ft(this,Z,void 0),Ft(this,I,void 0),t.instances.add(this),Ti(this,Fe,Se).call(this)}static get castElement(){return Xe(t,r)}static get castEnabled(){return Xe(t,d)}static get castState(){var U;return(U=Xe(t,R,b))==null?void 0:U.getCastState()}static async exitCast(){try{await Xe(t,R,b).endCurrentSession(!0)}catch(U){console.error(U);return}}get castPlayer(){if(t.castElement===this)return Xe(this,be)}attributeChangedCallback(U){if(this.castPlayer)switch(U){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(U={}){var ve;Ti(ve=t,X,oe).call(ve,U),ii(t,r,this),Object.entries(Xe(this,ke)).forEach(([Le,Ne])=>{Xe(this,be).controller.addEventListener(Le,Ne)});try{await Xe(t,R,b).requestSession()}catch{ii(t,r,void 0);return}Xe(this,z).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(Le){console.error(Le)}}async load(){var U,ve;if(!this.castPlayer)return super.load();let Le=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),Ne=[...this.querySelectorAll("track")].filter(({kind:xe,src:ze})=>ze&&(xe==="subtitles"||xe==="captions")),Ue=[],Ge=0;Ne.length&&(Le.tracks=Ne.map(xe=>{let ze=++Ge;Ue.length===0&&xe.track.mode==="showing"&&Ue.push(ze);let it=new chrome.cast.media.Track(ze,chrome.cast.media.TrackType.TEXT);return it.trackContentId=xe.src,it.trackContentType="text/vtt",it.subtype=xe.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,it.name=xe.label,it.language=xe.srclang,it})),this.castStreamType==="live"?Le.streamType=chrome.cast.media.StreamType.LIVE:Le.streamType=chrome.cast.media.StreamType.BUFFERED,Le.metadata=new chrome.cast.media.GenericMediaMetadata,Le.metadata.title=this.title,Le.metadata.images=[{url:this.poster}];let Te=new chrome.cast.media.LoadRequest(Le);Te.currentTime=(U=super.currentTime)!=null?U:0,Te.autoplay=!Xe(this,z).paused,Te.activeTrackIds=Ue,await((ve=Xe(t,P,O))==null?void 0:ve.loadMedia(Te)),this.dispatchEvent(new Event("volumechange"))}play(){var U;if(this.castPlayer){this.castPlayer.isPaused&&((U=this.castPlayer.controller)==null||U.playOrPause());return}return super.play()}pause(){var U;if(this.castPlayer){this.castPlayer.isPaused||(U=this.castPlayer.controller)==null||U.playOrPause();return}super.pause()}get castSrc(){var U,ve,Le;return(Le=(ve=this.getAttribute("cast-src"))!=null?ve:(U=this.querySelector("source"))==null?void 0:U.src)!=null?Le:this.currentSrc}set castSrc(U){this.castSrc!=U&&this.setAttribute("cast-src",`${U}`)}get castContentType(){var U;return(U=this.getAttribute("cast-content-type"))!=null?U:void 0}set castContentType(U){this.setAttribute("cast-content-type",`${U}`)}get castStreamType(){var U;return(U=this.getAttribute("cast-stream-type"))!=null?U:void 0}set castStreamType(U){this.setAttribute("cast-stream-type",`${U}`)}get readyState(){if(this.castPlayer)switch(this.castPlayer.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.castPlayer?this.castPlayer.isPaused:super.paused}get muted(){var U;return this.castPlayer?(U=this.castPlayer)==null?void 0:U.isMuted:super.muted}set muted(U){var ve;if(this.castPlayer){(U&&!this.castPlayer.isMuted||!U&&this.castPlayer.isMuted)&&((ve=this.castPlayer.controller)==null||ve.muteOrUnmute());return}super.muted=U}get volume(){var U,ve;return this.castPlayer?(ve=(U=this.castPlayer)==null?void 0:U.volumeLevel)!=null?ve:1:super.volume}set volume(U){var ve;if(this.castPlayer){this.castPlayer.volumeLevel=U,(ve=this.castPlayer.controller)==null||ve.setVolumeLevel();return}super.volume=U}get duration(){var U,ve;return this.castPlayer&&Xe(this,q,N)?(ve=(U=this.castPlayer)==null?void 0:U.duration)!=null?ve:NaN:super.duration}get currentTime(){var U,ve;return this.castPlayer&&Xe(this,q,N)?(ve=(U=this.castPlayer)==null?void 0:U.currentTime)!=null?ve:0:super.currentTime}set currentTime(U){var ve;if(this.castPlayer){this.castPlayer.currentTime=U,(ve=this.castPlayer.controller)==null||ve.seek();return}super.currentTime=U}get onentercast(){return Xe(this,He)}set onentercast(U){Xe(this,He)&&(this.removeEventListener("entercast",Xe(this,He)),ii(this,He,null)),typeof U=="function"&&(ii(this,He,U),this.addEventListener("entercast",U))}get onleavecast(){return Xe(this,Z)}set onleavecast(U){Xe(this,Z)&&(this.removeEventListener("leavecast",Xe(this,Z)),ii(this,Z,null)),typeof U=="function"&&(ii(this,Z,U),this.addEventListener("leavecast",U))}get oncastchange(){return Xe(this,I)}set oncastchange(U){Xe(this,I)&&(this.removeEventListener("castchange",Xe(this,I)),ii(this,I,null)),typeof U=="function"&&(ii(this,I,U),this.addEventListener("castchange",U))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,g=new WeakSet,E=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},L=new WeakSet,M=function(){return typeof cast!="undefined"&&cast.framework},R=new WeakSet,b=function(){if(Xe(t,L,M))return cast.framework.CastContext.getInstance()},P=new WeakSet,O=function(){var U;return(U=Xe(t,R,b))==null?void 0:U.getCurrentSession()},ue=new WeakSet,Q=function(){var U;return(U=Xe(t,P,O))==null?void 0:U.getSessionObj().media[0]},de=new WeakSet,he=function(U){return new Promise((ve,Le)=>{Xe(t,ue,Q).editTracksInfo(U,ve,Le)})},Y=new WeakSet,pe=function(U){return new Promise((ve,Le)=>{Xe(t,ue,Q).getStatus(U,ve,Le)})},X=new WeakSet,oe=function(U){return Xe(t,R,b).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...U})},z=new WeakMap,be=new WeakMap,ke=new WeakMap,He=new WeakMap,Z=new WeakMap,I=new WeakMap,q=new WeakSet,N=function(){var U;return(U=this.castPlayer)==null?void 0:U.isMediaLoaded},fe=new WeakSet,_e=function(){Xe(t,r)===this&&(Object.entries(Xe(this,ke)).forEach(([U,ve])=>{Xe(this,be).controller.removeEventListener(U,ve)}),ii(t,r,void 0),this.muted=Xe(this,be).isMuted,this.currentTime=Xe(this,be).savedPlayerState.currentTime,Xe(this,be).savedPlayerState.isPaused===!1&&this.play())},te=new WeakSet,ie=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:Xe(t,R,b).getCastState()}))},Re=new WeakSet,Pe=async function(){var U,ve;let{SESSION_RESUMED:Le}=cast.framework.SessionState;if(Xe(t,R,b).getSessionState()===Le&&this.castSrc===((U=Xe(t,ue,Q))==null?void 0:U.media.contentId)){ii(t,r,this),Object.entries(Xe(this,ke)).forEach(([Ne,Ue])=>{Xe(this,be).controller.addEventListener(Ne,Ue)});try{await Ti(ve=t,Y,pe).call(ve,new chrome.cast.media.GetStatusRequest)}catch(Ne){console.error(Ne)}Xe(this,ke)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),Xe(this,ke)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Fe=new WeakSet,Se=function(){var U;!Xe(t,L,M)||this.castEnabled||(this.castEnabled=!0,Ti(U=t,X,oe).call(U),this.textTracks.addEventListener("change",Ti(this,le,Ee).bind(this)),Ti(this,te,ie).call(this),ii(this,be,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(Xe(this,be)),ii(this,ke,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:ve})=>{ve===!1&&Ti(this,fe,_e).call(this),this.dispatchEvent(new Event(ve?"entercast":"leavecast"))},[cast.framework.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.dispatchEvent(new Event("durationchange"))},[cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{!Xe(this,q,N)||this.dispatchEvent(new Event("timeupdate"))},[cast.framework.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.dispatchEvent(new Event("resize"))},[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.dispatchEvent(new Event(this.paused?"pause":"play"))},[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var ve,Le;((ve=this.castPlayer)==null?void 0:ve.playerState)!==chrome.cast.media.PlayerState.PAUSED&&this.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(Le=this.castPlayer)==null?void 0:Le.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!Xe(this,q,N)||(await Promise.resolve(),Ti(this,Ye,ot).call(this))}}))},Ye=new WeakSet,ot=function(){Ti(this,le,Ee).call(this)},le=new WeakSet,Ee=async function(){var U,ve,Le,Ne,Ue,Ge;if(!this.castPlayer)return;let Te=((ve=(U=Xe(this,be).mediaInfo)==null?void 0:U.tracks)!=null?ve:[]).filter(({type:lt})=>lt===chrome.cast.media.TrackType.TEXT),xe=[...this.textTracks].filter(({kind:lt})=>lt==="subtitles"||lt==="captions"),ze=Te.map(({language:lt,name:It,trackId:Rt})=>{var At;let{mode:pt}=(At=xe.find(Ut=>Ut.language===lt&&Ut.label===It))!=null?At:{};return pt?{mode:pt,trackId:Rt}:!1}).filter(Boolean),it=ze.filter(({mode:lt})=>lt!=="showing").map(({trackId:lt})=>lt),_t=ze.find(({mode:lt})=>lt==="showing"),gt=(Ue=(Ne=(Le=Xe(t,P,O))==null?void 0:Le.getSessionObj().media[0])==null?void 0:Ne.activeTrackIds)!=null?Ue:[],Lt=gt;if(gt.length&&(Lt=Lt.filter(lt=>!it.includes(lt))),_t!=null&&_t.trackId&&(Lt=[...Lt,_t.trackId]),Lt=[...new Set(Lt)],!((lt,It)=>lt.length===It.length&&lt.every(Rt=>It.includes(Rt)))(gt,Lt))try{let lt=new chrome.cast.media.EditTracksInfoRequest(Lt);await Ti(Ge=t,de,he).call(Ge,lt)}catch(lt){console.error(lt)}},Ft(t,g),Ft(t,L),Ft(t,R),Ft(t,P),Ft(t,ue),Ft(t,de),Ft(t,Y),Ft(t,X),Wo(t,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),Wo(t,"instances",new pv),Ft(t,r,void 0),Ft(t,d,!1),Wo(t,"initCast",()=>{var U;Xe(t,g,E)?Xe(t,L,M)?Xe(U=t,v).call(U,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var ve;return Xe(ve=t,v).call(ve,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var ve;return Xe(ve=t,v).call(ve,chrome.cast.isAvailable)})}}),Ft(t,v,U=>{if(U){ii(t,d,!0);let{CAST_STATE_CHANGED:ve}=cast.framework.CastContextEventType;Xe(t,R,b).addEventListener(ve,Ne=>{t.instances.forEach(Ue=>{var Ge;return Ti(Ge=Ue,te,ie).call(Ge,Ne)})});let{SESSION_STATE_CHANGED:Le}=cast.framework.CastContextEventType;Xe(t,R,b).addEventListener(Le,Ne=>{t.instances.forEach(Ue=>{var Ge;return Ti(Ge=Ue,Re,Pe).call(Ge,Ne)})}),t.instances.forEach(Ne=>{var Ue;return Ti(Ue=Ne,Fe,Se).call(Ue)})}}),t};if(globalThis.HTMLVideoElement&&globalThis.customElements){let a=vv(HTMLVideoElement);globalThis.customElements.get("castable-video")||(globalThis.customElements.define("castable-video",a,{extends:"video"}),globalThis.CastableVideoElement=a),a.initCast()}var wd=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","castchange","entercast","leavecast"],hf=cf.createElement("template");hf.innerHTML=`
924
924
  <style>
925
925
  :host {
926
926
  display: inline-block;
@@ -940,20 +940,20 @@ svg, img, ::slotted(svg), ::slotted(img) {
940
940
  </style>
941
941
  <video is="castable-video" part="video" crossorigin></video>
942
942
  <slot></slot>
943
- `;var qo,Ss,Yo,Jo,_d,In=class extends oa.HTMLElement{constructor(){super(),Ft(this,Ss),Ft(this,Jo),Ft(this,qo,void 0),this.attachShadow({mode:"open"}),this.isConnected&&Tr(this,Ss,Yo).call(this)}static get observedAttributes(){let a=[],t=d=>d.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(d=>{let v=!1;try{typeof this.prototype[d]=="function"&&(v=!0)}catch{}!v&&d!==d.toUpperCase()&&a.push(d.toLowerCase(),t(d))});let i=Object.getPrototypeOf(this).observedAttributes;return i&&(a=a.concat(i)),a}attributeChangedCallback(a,t,i){Tr(this,Ss,Yo).call(this),Tr(this,Jo,_d).call(this,a,t,i)}connectedCallback(){Tr(this,Ss,Yo).call(this)}};qo=new WeakMap,Ss=new WeakSet,Yo=function(){if(Xe(this,qo))return;rr(this,qo,!0),this.shadowRoot.append(hf.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),Id.forEach(t=>{this.nativeEl.addEventListener(t,i=>{this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail}))})});let a=this.shadowRoot.querySelector("slot");a.addEventListener("slotchange",()=>{a.assignedElements().forEach(t=>{!["track","source"].includes(t.localName)||this.nativeEl.append(t)})}),Array.prototype.forEach.call(this.attributes,t=>{Tr(this,Jo,_d).call(this,t.name,null,t.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},Jo=new WeakSet,_d=function(a,t,i){let d=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),v=Ev(d,a),g=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;v&&!g?typeof this[v]=="boolean"?i===null?this[v]=!1:this[v]=!0:this[v]=i:i===null?this.nativeEl.removeAttribute(a):["id","class"].indexOf(a)===-1&&this.nativeEl.setAttribute(a,i)};var ff=[],mf=cf.createElement("video",{is:"castable-video"}),gv=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let a=Object.getPrototypeOf(mf);a&&a!==oa.HTMLElement.prototype;a=Object.getPrototypeOf(a))Object.getOwnPropertyNames(a).forEach(t=>{gv.indexOf(t)===-1&&ff.push(t)});ff.forEach(a=>{if(!(a in In.prototype))if(typeof mf[a]=="function")In.prototype[a]=function(){return this.nativeEl[a].apply(this.nativeEl,arguments)};else{let t={get(){return this.nativeEl[a]}};a!==a.toUpperCase()&&(t.set=function(i){this.nativeEl[a]=i}),Object.defineProperty(In.prototype,a,t)}});function Ev(a,t){let i=null;return a.forEach(d=>{d.toLowerCase()==t.toLowerCase()&&(i=d)}),i}oa.customElements.get("custom-video")||(oa.customElements.define("custom-video",In),oa.CustomVideoElement=In);var lf=In,ze={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_SOFTWARE_NAME:"player-software-name",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time",PREFER_CMCD:"prefer-cmcd"},yv=Object.values(ze),bv=mv(),Tv="mux-video",xi,ks,$o,ws,zo,Qo,Xo,Zo,Ad,Sd=class extends lf{constructor(){super(),Ft(this,Zo),Ft(this,xi,void 0),Ft(this,ks,void 0),Ft(this,$o,void 0),Ft(this,ws,{}),Ft(this,zo,void 0),Ft(this,Qo,void 0),Ft(this,Xo,void 0),rr(this,$o,Jh())}static get observedAttributes(){var a;return[...yv,...(a=lf.observedAttributes)!=null?a:[]]}get preferCmcd(){var a;return(a=this.getAttribute(ze.PREFER_CMCD))!=null?a:void 0}set preferCmcd(a){a!==this.preferCmcd&&(a?kn.includes(a)?this.setAttribute(ze.PREFER_CMCD,a):console.warn(`Invalid value for preferCmcd. Must be one of ${kn.join()}`):this.removeAttribute(ze.PREFER_CMCD))}get playerInitTime(){return Xe(this,$o)}get playerSoftwareName(){var a;return(a=Xe(this,Qo))!=null?a:Tv}set playerSoftwareName(a){rr(this,Qo,a)}get playerSoftwareVersion(){var a;return(a=Xe(this,zo))!=null?a:bv}set playerSoftwareVersion(a){rr(this,zo,a)}get _hls(){var a;return(a=Xe(this,xi))==null?void 0:a.engine}get mux(){return this.nativeEl.mux}get error(){var a;return(a=tf(this.nativeEl))!=null?a:null}get errorTranslator(){return Xe(this,Xo)}set errorTranslator(a){rr(this,Xo,a)}get src(){return this.getAttribute("src")}set src(a){a!==this.src&&(a==null?this.removeAttribute("src"):this.setAttribute("src",a))}get type(){var a;return(a=this.getAttribute(ze.TYPE))!=null?a:void 0}set type(a){a!==this.type&&(a?this.setAttribute(ze.TYPE,a):this.removeAttribute(ze.TYPE))}get autoplay(){let a=this.getAttribute("autoplay");return a===null?!1:a===""?!0:a}set autoplay(a){let t=this.autoplay;a!==t&&(a?this.setAttribute("autoplay",typeof a=="string"?a:""):this.removeAttribute("autoplay"))}get preload(){let a=this.getAttribute("preload");return a===""?"auto":["none","metadata","auto"].includes(a)?a:super.preload}set preload(a){a!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(a)?this.setAttribute("preload",a):this.removeAttribute("preload"))}get debug(){return this.getAttribute(ze.DEBUG)!=null}set debug(a){a!==this.debug&&(a?this.setAttribute(ze.DEBUG,""):this.removeAttribute(ze.DEBUG))}get disableCookies(){return this.hasAttribute(ze.DISABLE_COOKIES)}set disableCookies(a){a!==this.disableCookies&&(a?this.setAttribute(ze.DISABLE_COOKIES,""):this.removeAttribute(ze.DISABLE_COOKIES))}get startTime(){let a=this.getAttribute(ze.START_TIME);if(a==null)return;let t=+a;return Number.isNaN(t)?void 0:t}set startTime(a){a!==this.startTime&&(a==null?this.removeAttribute(ze.START_TIME):this.setAttribute(ze.START_TIME,`${a}`))}get playbackId(){var a;return(a=this.getAttribute(ze.PLAYBACK_ID))!=null?a:void 0}set playbackId(a){a!==this.playbackId&&(a?this.setAttribute(ze.PLAYBACK_ID,a):this.removeAttribute(ze.PLAYBACK_ID))}get customDomain(){var a;return(a=this.getAttribute(ze.CUSTOM_DOMAIN))!=null?a:void 0}set customDomain(a){a!==this.customDomain&&(a?this.setAttribute(ze.CUSTOM_DOMAIN,a):this.removeAttribute(ze.CUSTOM_DOMAIN))}get envKey(){var a;return(a=this.getAttribute(ze.ENV_KEY))!=null?a:void 0}set envKey(a){a!==this.envKey&&(a?this.setAttribute(ze.ENV_KEY,a):this.removeAttribute(ze.ENV_KEY))}get beaconCollectionDomain(){var a;return(a=this.getAttribute(ze.BEACON_COLLECTION_DOMAIN))!=null?a:void 0}set beaconCollectionDomain(a){a!==this.beaconCollectionDomain&&(a?this.setAttribute(ze.BEACON_COLLECTION_DOMAIN,a):this.removeAttribute(ze.BEACON_COLLECTION_DOMAIN))}get streamType(){var a;return(a=this.getAttribute(ze.STREAM_TYPE))!=null?a:void 0}set streamType(a){a!==this.streamType&&(a?this.setAttribute(ze.STREAM_TYPE,a):this.removeAttribute(ze.STREAM_TYPE))}async addCuePoints(a){return yd(this.nativeEl,a)}get activeCuePoint(){return bd(this.nativeEl)}get cuePoints(){return Qh(this.nativeEl)}get preferPlayback(){let a=this.getAttribute(ze.PREFER_PLAYBACK);if(a===oi.MSE||a===oi.NATIVE)return a}set preferPlayback(a){a!==this.preferPlayback&&(a===oi.MSE||a===oi.NATIVE?this.setAttribute(ze.PREFER_PLAYBACK,a):this.removeAttribute(ze.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(a=>a.startsWith("metadata-")&&![ze.METADATA_URL].includes(a)).reduce((a,t)=>{let i=this.getAttribute(t);return i!=null&&(a[t.replace(/^metadata-/,"").replace(/-/g,"_")]=i),a},{}),...Xe(this,ws)}}set metadata(a){rr(this,ws,a!=null?a:{}),this.mux&&this.mux.emit("hb",Xe(this,ws))}load(){rr(this,xi,rf(this,this.nativeEl,Xe(this,xi)))}unload(){Td(this.nativeEl,Xe(this,xi)),rr(this,xi,void 0)}attributeChangedCallback(a,t,i){var d,v;switch(super.attributeChangedCallback(a,t,i),a){case ze.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=i!=null?i:void 0;break;case ze.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=i!=null?i:void 0;break;case"src":{let g=!!t,b=!!i;!g&&b?Tr(this,Zo,Ad).call(this):g&&!b?this.unload():g&&b&&(this.unload(),Tr(this,Zo,Ad).call(this));break}case"autoplay":if(i===t)break;(d=Xe(this,xi))==null||d.setAutoplay(this.autoplay);break;case"preload":if(i===t)break;(v=Xe(this,xi))==null||v.setPreload(i);break;case ze.PLAYBACK_ID:this.src=ef(i!=null?i:void 0,{domain:this.customDomain});break;case ze.DEBUG:{let g=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=g);break}case ze.METADATA_URL:i&&fetch(i).then(g=>g.json()).then(g=>this.metadata=g).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${i}!`));break;default:break}}disconnectedCallback(){this.unload()}};xi=new WeakMap,ks=new WeakMap,$o=new WeakMap,ws=new WeakMap,zo=new WeakMap,Qo=new WeakMap,Xo=new WeakMap,Zo=new WeakSet,Ad=async function(){Xe(this,ks)||(await rr(this,ks,Promise.resolve()),rr(this,ks,null),this.load())};oa.customElements.get("mux-video")||(oa.customElements.define("mux-video",Sd),oa.MuxVideoElement=Sd);var pf=Sd;var _v="en",Oa={code:_v};var vf="en";function Bt(a,t=!0){var v,g;let i=t&&(g=(v=Oa)==null?void 0:v[a])!=null?g:a,d=t?Oa.code:vf;return new Ld(i,d)}var Ld=class{constructor(t,i=(d=>(d=Oa.code)!=null?d:vf)()){this.message=t,this.locale=i}format(t){return this.message.replace(/\{(\w+)\}/g,(i,d)=>{var v;return(v=t[d])!=null?v:""})}toString(){return this.message}};function gf(a){let t="";return Object.entries(a).forEach(([i,d])=>{d!=null&&(t+=`${Av(i)}: ${d}; `)}),t?t.trim():void 0}function Av(a){return a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Ef(a){return a.replace(/[-_]([a-z])/g,(t,i)=>i.toUpperCase())}function Oi(a){if(a==null)return;let t=+a;return Number.isNaN(t)?void 0:t}function tl(a){let t=Sv(a).toString();return t?"?"+t:""}function Sv(a){let t={};for(let i in a)a[i]!=null&&(t[i]=a[i]);return new URLSearchParams(t)}function la(a){let t=(a!=null?a:"").split(".")[1];if(!t)return{};let i=t.replace(/-/g,"+").replace(/_/g,"/"),d=decodeURIComponent(atob(i).split("").map(function(v){return"%"+("00"+v.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(d)}var Dd=(a,t)=>!a||!t?!1:a.contains(t)?!0:Dd(a,t.getRootNode().host);var Rd="mux.com",kv=()=>{try{return"1.7.2"}catch{}return"UNKNOWN"},wv=kv(),il=()=>wv,Cd=(a,{token:t,domain:i=Rd}={})=>`https://stream.${i}/${a}.m3u8${tl(!!t?{token:t}:{redundant_streams:!0})}`,yf=(a,{token:t,thumbnailTime:i,domain:d=Rd}={})=>{let v=t==null?i:void 0,{aud:g}=la(t);if(!(t&&g!=="t"))return`https://image.${d}/${a}/thumbnail.webp${tl({token:t,time:v})}`},bf=(a,{token:t,domain:i=Rd}={})=>{let{aud:d}=la(t);if(!(t&&d!=="s"))return`https://image.${i}/${a}/storyboard.vtt${tl({token:t,format:"webp"})}`};var Iv={crossorigin:"crossOrigin",playsinline:"playsInline"};function Tf(a){var t;return(t=Iv[a])!=null?t:Ef(a)}var Pa,Na,Kr,rl=class{constructor(t,i){lr(this,Pa,void 0);lr(this,Na,void 0);lr(this,Kr,[]);$r(this,Pa,t),$r(this,Na,i)}[Symbol.iterator](){return Nt(this,Kr).values()}get length(){return Nt(this,Kr).length}get value(){var t;return(t=Nt(this,Kr).join(" "))!=null?t:""}set value(t){var i;t!==this.value&&($r(this,Kr,[]),this.add(...(i=t==null?void 0:t.split(" "))!=null?i:[]))}toString(){return this.value}item(t){return Nt(this,Kr)[t]}values(){return Nt(this,Kr).values()}keys(){return Nt(this,Kr).keys()}forEach(t){Nt(this,Kr).forEach(t)}add(...t){var i,d;t.forEach(v=>{this.contains(v)||Nt(this,Kr).push(v)}),!(this.value===""&&!((i=Nt(this,Pa))!=null&&i.hasAttribute(`${Nt(this,Na)}`)))&&((d=Nt(this,Pa))==null||d.setAttribute(`${Nt(this,Na)}`,`${this.value}`))}remove(...t){var i;t.forEach(d=>{Nt(this,Kr).splice(Nt(this,Kr).indexOf(d),1)}),(i=Nt(this,Pa))==null||i.setAttribute(`${Nt(this,Na)}`,`${this.value}`)}contains(t){return Nt(this,Kr).includes(t)}toggle(t,i){return typeof i!="undefined"?i?(this.add(t),!0):(this.remove(t),!1):this.contains(t)?(this.remove(t),!1):(this.add(t),!0)}replace(t,i){this.remove(t),this.add(i)}};Pa=new WeakMap,Na=new WeakMap,Kr=new WeakMap;var _f=`[mux-player ${il()}]`;function ua(...a){console.warn(_f,...a)}function pi(...a){console.error(_f,...a)}function al(a){var i;let t=(i=a.message)!=null?i:"";if(a.file){let d="https://github.com/muxinc/elements/blob/main/errors/";t+=` ${Bt("Read more: ")}
944
- ${d}${a.file}`}ua(t)}var Ur={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Ua={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Sf=Object.freeze({length:0,start(a){let t=a>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(a){let t=a>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Lv=Id.filter(a=>a!=="error"),Dv=Object.values(Ur).filter(a=>![Ur.PLAYSINLINE].includes(a)),Rv=Object.values(Ua);function kf(a){a.querySelectorAll(":scope > track").forEach(t=>{var i;(i=a.media)==null||i.append(t.cloneNode())}),Lv.forEach(t=>{var i;(i=a.media)==null||i.addEventListener(t,d=>{a.dispatchEvent(new Event(d.type))})})}var Md=class extends mr.HTMLElement{static get observedAttributes(){return[...Dv,...Rv]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(d=>{var v;(v=this.media)==null||v.append(d.cloneNode())});let t=d=>{for(let v of d)v.type==="childList"&&(v.removedNodes.forEach(g=>{var L,M;let b=(L=this.media)==null?void 0:L.querySelector(`track[src="${g.src}"]`);b&&((M=this.media)==null||M.removeChild(b))}),v.addedNodes.forEach(g=>{var b;(b=this.media)==null||b.append(g.cloneNode())}))};new MutationObserver(t).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(t,i,d){var v,g;switch(t){case Ua.MUTED:{this.media&&(this.media.muted=d!=null,this.media.defaultMuted=d!=null);return}case Ua.VOLUME:{let b=(v=Oi(d))!=null?v:1;this.media&&(this.media.volume=b);return}case Ua.PLAYBACKRATE:{let b=(g=Oi(d))!=null?g:1;this.media&&(this.media.playbackRate=b,this.media.defaultPlaybackRate=b);return}}}play(){var t,i;return(i=(t=this.media)==null?void 0:t.play())!=null?i:Promise.reject()}pause(){var t;(t=this.media)==null||t.pause()}requestCast(t){var i;return(i=this.media)==null?void 0:i.requestCast(t)}get media(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("mux-video")}get paused(){var t,i;return(i=(t=this.media)==null?void 0:t.paused)!=null?i:!0}get duration(){var t,i;return(i=(t=this.media)==null?void 0:t.duration)!=null?i:NaN}get ended(){var t,i;return(i=(t=this.media)==null?void 0:t.ended)!=null?i:!1}get buffered(){var t,i;return(i=(t=this.media)==null?void 0:t.buffered)!=null?i:Sf}get seekable(){var t,i;return(i=(t=this.media)==null?void 0:t.seekable)!=null?i:Sf}get readyState(){var t,i;return(i=(t=this.media)==null?void 0:t.readyState)!=null?i:0}get videoWidth(){var t,i;return(i=(t=this.media)==null?void 0:t.videoWidth)!=null?i:0}get videoHeight(){var t,i;return(i=(t=this.media)==null?void 0:t.videoHeight)!=null?i:0}get currentTime(){var t,i;return(i=(t=this.media)==null?void 0:t.currentTime)!=null?i:0}set currentTime(t){this.media&&(this.media.currentTime=Number(t))}get volume(){var t,i;return(i=(t=this.media)==null?void 0:t.volume)!=null?i:1}set volume(t){this.media&&(this.media.volume=Number(t))}get playbackRate(){var t,i;return(i=(t=this.media)==null?void 0:t.playbackRate)!=null?i:1}set playbackRate(t){this.media&&(this.media.playbackRate=Number(t))}get defaultPlaybackRate(){var t;return(t=Oi(this.getAttribute(Ua.PLAYBACKRATE)))!=null?t:1}set defaultPlaybackRate(t){t!=null?this.setAttribute(Ua.PLAYBACKRATE,`${t}`):this.removeAttribute(Ua.PLAYBACKRATE)}get crossOrigin(){return Is(this,Ur.CROSSORIGIN)}set crossOrigin(t){this.setAttribute(Ur.CROSSORIGIN,`${t}`)}get autoplay(){return Is(this,Ur.AUTOPLAY)!=null}set autoplay(t){t?this.setAttribute(Ur.AUTOPLAY,typeof t=="string"?t:""):this.removeAttribute(Ur.AUTOPLAY)}get loop(){return Is(this,Ur.LOOP)!=null}set loop(t){t?this.setAttribute(Ur.LOOP,""):this.removeAttribute(Ur.LOOP)}get muted(){var t,i;return(i=(t=this.media)==null?void 0:t.muted)!=null?i:!1}set muted(t){this.media&&(this.media.muted=Boolean(t))}get defaultMuted(){return Is(this,Ur.MUTED)!=null}set defaultMuted(t){t?this.setAttribute(Ur.MUTED,""):this.removeAttribute(Ur.MUTED)}get playsInline(){return Is(this,Ur.PLAYSINLINE)!=null}set playsInline(t){pi("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(t){["","none","metadata","auto"].includes(t)?this.setAttribute(Ur.PRELOAD,t):this.removeAttribute(Ur.PRELOAD)}};function Is(a,t){return a.media?a.media.getAttribute(t):a.getAttribute(t)}var xd=Md;var Cv=Object.defineProperty,Mv=(a,t,i)=>t in a?Cv(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,xv=(a,t,i)=>(Mv(a,typeof t!="symbol"?t+"":t,i),i),Rf=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},xt=(a,t,i)=>(Rf(a,t,"read from private field"),i?i.call(a):t.get(a)),_i=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},Pi=(a,t,i,d)=>(Rf(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),Ln,nl,Fa,Ls,da,ca,ha,Ba,Dn,sl,vi,wf=1,If=0,Ov=1,Pv={processCallback(a,t,i){if(!!i){for(let[d,v]of t)if(d in i){let g=i[d];typeof g=="boolean"&&v instanceof Gr&&typeof v.element[v.attributeName]=="boolean"?v.booleanValue=g:typeof g=="function"&&v instanceof Gr?v.element[v.attributeName]=g:v.value=g}}}},Ni=class extends ce.DocumentFragment{constructor(t,i,d=Pv){var v;super(),_i(this,Ln,void 0),_i(this,nl,void 0),this.append(t.content.cloneNode(!0)),Pi(this,Ln,Cf(this)),Pi(this,nl,d),(v=d.createCallback)==null||v.call(d,this,xt(this,Ln),i),d.processCallback(this,xt(this,Ln),i)}update(t){xt(this,nl).processCallback(this,xt(this,Ln),t)}};Ln=new WeakMap;nl=new WeakMap;var Cf=(a,t=[])=>{let i,d;for(let v of a.attributes||[])if(v.value.includes("{{")){let g=new Od;for([i,d]of Df(v.value))if(!i)g.append(d);else{let b=new Gr(a,v.name,v.namespaceURI);g.append(b),t.push([d,b])}v.value=g.toString()}for(let v of a.childNodes)if(v.nodeType===wf&&!(v instanceof HTMLTemplateElement))Cf(v,t);else if(v.nodeType===wf||v.data.includes("{{")){let g=[];if(v.data)for([i,d]of Df(v.data))if(!i)g.push(new Text(d));else{let b=new Ui(a);g.push(b),t.push([d,b])}else if(v instanceof HTMLTemplateElement){let b=new Ds(a,v);g.push(b),t.push([b.expression,b])}v.replaceWith(...g.flatMap(b=>b.replacementNodes||[b]))}return t},Lf={},Df=a=>{let t="",i=0,d=Lf[a],v=0,g;if(d)return d;for(d=[];g=a[v];v++)g==="{"&&a[v+1]==="{"&&a[v-1]!=="\\"&&a[v+2]&&++i==1?(t&&d.push([If,t]),t="",v++):g==="}"&&a[v+1]==="}"&&a[v-1]!=="\\"&&!--i?(d.push([Ov,t.trim()]),t="",v++):t+=g||"";return t&&d.push([If,(i>0?"{{":"")+t]),Lf[a]=d},Nv=11,ol=class{get value(){return""}set value(t){}toString(){return this.value}},Mf=new WeakMap,Od=class{constructor(){_i(this,Fa,[])}[Symbol.iterator](){return xt(this,Fa).values()}get length(){return xt(this,Fa).length}item(t){return xt(this,Fa)[t]}append(...t){for(let i of t)i instanceof Gr&&Mf.set(i,this),xt(this,Fa).push(i)}toString(){return xt(this,Fa).join("")}};Fa=new WeakMap;var Gr=class extends ol{constructor(t,i,d){super(),_i(this,Ba),_i(this,Ls,""),_i(this,da,void 0),_i(this,ca,void 0),_i(this,ha,void 0),Pi(this,da,t),Pi(this,ca,i),Pi(this,ha,d)}get attributeName(){return xt(this,ca)}get attributeNamespace(){return xt(this,ha)}get element(){return xt(this,da)}get value(){return xt(this,Ls)}set value(t){xt(this,Ls)!==t&&(Pi(this,Ls,t),!xt(this,Ba,Dn)||xt(this,Ba,Dn).length===1?t==null?xt(this,da).removeAttributeNS(xt(this,ha),xt(this,ca)):xt(this,da).setAttributeNS(xt(this,ha),xt(this,ca),t):xt(this,da).setAttributeNS(xt(this,ha),xt(this,ca),xt(this,Ba,Dn)))}get booleanValue(){return xt(this,da).hasAttributeNS(xt(this,ha),xt(this,ca))}set booleanValue(t){if(!xt(this,Ba,Dn)||xt(this,Ba,Dn).length===1)this.value=t?"":null;else throw new DOMException("Value is not fully templatized")}};Ls=new WeakMap;da=new WeakMap;ca=new WeakMap;ha=new WeakMap;Ba=new WeakSet;Dn=function(){return Mf.get(this)};var Ui=class extends ol{constructor(t,i){super(),_i(this,sl,void 0),_i(this,vi,void 0),Pi(this,sl,t),Pi(this,vi,i?[...i]:[new Text])}get replacementNodes(){return xt(this,vi)}get parentNode(){return xt(this,sl)}get nextSibling(){return xt(this,vi)[xt(this,vi).length-1].nextSibling}get previousSibling(){return xt(this,vi)[0].previousSibling}get value(){return xt(this,vi).map(t=>t.textContent).join("")}set value(t){this.replace(t)}replace(...t){let i=t.flat().flatMap(d=>d==null?[new Text]:d.forEach?[...d]:d.nodeType===Nv?[...d.childNodes]:d.nodeType?[d]:[new Text(d)]);i.length||i.push(new Text),Pi(this,vi,Uv(xt(this,vi)[0].parentNode,xt(this,vi),i,this.nextSibling))}};sl=new WeakMap;vi=new WeakMap;var Ds=class extends Ui{constructor(t,i){let d=i.getAttribute("directive")||i.getAttribute("type"),v=i.getAttribute("expression")||i.getAttribute(d)||"";v.startsWith("{{")&&(v=v.trim().slice(2,-2).trim()),super(t),xv(this,"directive"),this.expression=v,this.template=i,this.directive=d}};function Uv(a,t,i,d=null){let v=0,g,b,L,M=i.length,R=t.length;for(;v<M&&v<R&&t[v]==i[v];)v++;for(;v<M&&v<R&&i[M-1]==t[R-1];)d=i[--R,--M];if(v==R)for(;v<M;)a.insertBefore(i[v++],d);if(v==M)for(;v<R;)a.removeChild(t[v++]);else{for(g=t[v];v<M;)L=i[v++],b=g?g.nextSibling:d,g==L?g=b:v<M&&i[v]==b?(a.replaceChild(L,g),g=b):a.insertBefore(L,g);for(;g!=d;)b=g.nextSibling,a.removeChild(g),g=b}return i}var Fv=/([>&])?\s*(\w+)\s*(.*)/,Bv=/^(\?\?|\|)?\s*(['"\w]*)/,Hv={"|":{string:a=>String(a)},"??":(a,t)=>a!=null?a:t},ll=class{constructor(t){this.template=t}},Ha=new WeakMap,Ka=new WeakMap,Nd={partial:(a,t)=>{t[a.expression]=new ll(a.template)},if:(a,t)=>{var i;if(Vv(a.expression,t))if(Ha.get(a)!==a.template){Ha.set(a,a.template);let d=new Ni(a.template,t,ul);a.replace(d),Ka.set(a,d)}else(i=Ka.get(a))==null||i.update(t);else a.replace(""),Ha.delete(a),Ka.delete(a)}},Kv=Object.keys(Nd),ul={processCallback(a,t,i){var d,v,g,b;if(!!i)for(let[L,M]of t){if(M instanceof Ds){if(!M.directive){let he=Kv.find(Y=>M.template.hasAttribute(Y));he&&(M.directive=he,M.expression=M.template.getAttribute(he))}(d=Nd[M.directive])==null||d.call(Nd,M,i);continue}let[,R,y,P]=(v=L.match(Fv))!=null?v:[],O=i[y],[,ue,Q]=(g=P.match(Bv))!=null?g:[],de=Hv[ue];if(typeof de=="function")O=de(O,Rs(Q,i));else if(de&&O!=null){let he=de[Q];he&&(O=he(O))}if(O){if(O instanceof ll){if(R!==">")continue;let he={...i},Y=L.matchAll(/(\w+)\s*=\s*(['"\w]*)/g);for(let[,pe,X]of Y)he[pe]=Rs(X,i);Ha.get(M)!==O.template?(Ha.set(M,O.template),O=new Ni(O.template,he,ul),M.value=O,Ka.set(M,O)):(b=Ka.get(M))==null||b.update(he);continue}M instanceof Gr&&M.attributeName.startsWith("aria-")&&(O=String(O)),M instanceof Gr?typeof O=="boolean"?M.booleanValue=O:typeof O=="function"?M.element[M.attributeName]=O:M.value=O:(M.value=O,Ha.delete(M),Ka.delete(M))}else M instanceof Gr?M.booleanValue=!1:(M.value=void 0,Ha.delete(M),Ka.delete(M))}}},Gv={"==":(a,t)=>a==t,"!=":(a,t)=>a!=t,">":(a,t)=>a>t,">=":(a,t)=>a>=t,"<":(a,t)=>a<t,"<=":(a,t)=>a<=t};function Vv(a,t){var i;let d=Wv(a,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><]=|[><]/,ws:/\s+/,param:/[$a-z_][$\w]*/i});if(d.length===0||d.some(({type:g})=>!g))return console.warn(`Warning: invalid expression \`${a}\``),!1;if(d.length===1)return Pd(d[0])?Rs(d[0].token,t):(console.warn(`Warning: invalid expression \`${a}\``),!1);let v=d.filter(({type:g})=>g!=="ws");if(v.length===3){let g=Gv[(i=v[1])==null?void 0:i.token];return!g||!Pd(v[0])||!Pd(v[2])?(console.warn(`Warning: invalid expression \`${a}\``),!1):g(Rs(v[0].token,t),Rs(v[2].token,t))}}function Pd({type:a}){return["number","boolean","string","param"].includes(a)}function Rs(a,t){let i=a[0],d=a.slice(-1);return a==="true"||a==="false"?a==="true":i===d&&["'",'"'].includes(i)?a.slice(1,-1):fc(a)?parseFloat(a):t[a]}function Wv(a,t){let i,d,v,g=[];for(;a;){v=null,i=a.length;for(let b in t)d=t[b].exec(a),d&&d.index<i&&(v={token:d[0],type:b,matches:d.slice(1)},i=d.index);i&&g.push({token:a.substr(0,i),type:void 0}),v&&g.push(v),a=a.substr(i+(v?v.token.length:0))}return g}var jv=Object.defineProperty,qv=(a,t,i)=>t in a?jv(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,Cs=(a,t,i)=>(qv(a,typeof t!="symbol"?t+"":t,i),i),Nf=(a,t,i)=>{if(!t.has(a))throw TypeError("Cannot "+i)},xf=(a,t,i)=>(Nf(a,t,"read from private field"),i?i.call(a):t.get(a)),Of=(a,t,i)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,i)},Pf=(a,t,i,d)=>(Nf(a,t,"write to private field"),d?d.call(a,i):t.set(a,i),i),dl,cl,Ud={"media-target-live-window":"targetLiveWindow","media-stream-type":"streamType"},Rn=class extends ce.HTMLElement{constructor(){super(),Cs(this,"renderRoot"),Cs(this,"renderer"),Of(this,dl,void 0),Of(this,cl,void 0),this.renderRoot=this.attachShadow({mode:"open"});let t=new MutationObserver(i=>{i.some(d=>{let v=d.target;return v===this?!0:v.localName!=="media-controller"?!1:!!(Ud[d.attributeName]||d.attributeName.startsWith("breakpoint-"))})&&this.render()});t.observe(this,{attributes:!0}),t.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.createRenderer()}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var t,i;let d=this.getAttribute("template");if(d){let v=(t=this.getRootNode())==null?void 0:t.getElementById(d);if(v)return v}return(i=xf(this,dl))!=null?i:this.constructor.template}set template(t){Pf(this,dl,t),this.createRenderer()}get props(){var t,i,d;let v=[...Array.from((i=(t=this.mediaController)==null?void 0:t.attributes)!=null?i:[]).filter(({name:b})=>Ud[b]||b.startsWith("breakpoint-")),...Array.from(this.attributes)],g={};for(let b of v){let L=(d=Ud[b.name])!=null?d:cc(b.name);b.value!=null?g[L]=b.value===""?!0:b.value:g[L]=!1}return g}attributeChangedCallback(t,i,d){t==="template"&&i!=d&&this.createRenderer()}createRenderer(){this.template&&this.template!==xf(this,cl)&&(Pf(this,cl,this.template),this.renderer=new Ni(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(this.renderer))}render(){var t;(t=this.renderer)==null||t.update(this.props)}};dl=new WeakMap;cl=new WeakMap;Cs(Rn,"template");Cs(Rn,"observedAttributes",["template"]);Cs(Rn,"processor",ul);ce.customElements.get("media-theme")||ce.customElements.define("media-theme",Rn);var Ff=`
943
+ `;var qo,Ss,Yo,Jo,_d,wn=class extends oa.HTMLElement{constructor(){super(),Ft(this,Ss),Ft(this,Jo),Ft(this,qo,void 0),this.attachShadow({mode:"open"}),this.isConnected&&Ti(this,Ss,Yo).call(this)}static get observedAttributes(){let a=[],t=d=>d.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(d=>{let v=!1;try{typeof this.prototype[d]=="function"&&(v=!0)}catch{}!v&&d!==d.toUpperCase()&&a.push(d.toLowerCase(),t(d))});let r=Object.getPrototypeOf(this).observedAttributes;return r&&(a=a.concat(r)),a}attributeChangedCallback(a,t,r){Ti(this,Ss,Yo).call(this),Ti(this,Jo,_d).call(this,a,t,r)}connectedCallback(){Ti(this,Ss,Yo).call(this)}};qo=new WeakMap,Ss=new WeakSet,Yo=function(){if(Xe(this,qo))return;ii(this,qo,!0),this.shadowRoot.append(hf.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),wd.forEach(t=>{this.nativeEl.addEventListener(t,r=>{this.dispatchEvent(new CustomEvent(r.type,{detail:r.detail}))})});let a=this.shadowRoot.querySelector("slot");a.addEventListener("slotchange",()=>{a.assignedElements().forEach(t=>{!["track","source"].includes(t.localName)||this.nativeEl.append(t)})}),Array.prototype.forEach.call(this.attributes,t=>{Ti(this,Jo,_d).call(this,t.name,null,t.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},Jo=new WeakSet,_d=function(a,t,r){let d=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),v=Ev(d,a),g=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;v&&!g?typeof this[v]=="boolean"?r===null?this[v]=!1:this[v]=!0:this[v]=r:r===null?this.nativeEl.removeAttribute(a):["id","class"].indexOf(a)===-1&&this.nativeEl.setAttribute(a,r)};var ff=[],mf=cf.createElement("video",{is:"castable-video"}),gv=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let a=Object.getPrototypeOf(mf);a&&a!==oa.HTMLElement.prototype;a=Object.getPrototypeOf(a))Object.getOwnPropertyNames(a).forEach(t=>{gv.indexOf(t)===-1&&ff.push(t)});ff.forEach(a=>{if(!(a in wn.prototype))if(typeof mf[a]=="function")wn.prototype[a]=function(){return this.nativeEl[a].apply(this.nativeEl,arguments)};else{let t={get(){return this.nativeEl[a]}};a!==a.toUpperCase()&&(t.set=function(r){this.nativeEl[a]=r}),Object.defineProperty(wn.prototype,a,t)}});function Ev(a,t){let r=null;return a.forEach(d=>{d.toLowerCase()==t.toLowerCase()&&(r=d)}),r}oa.customElements.get("custom-video")||(oa.customElements.define("custom-video",wn),oa.CustomVideoElement=wn);var lf=wn,$e={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_COOKIES:"disable-cookies",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TYPE:"type"},yv=Object.values($e),bv=mv(),Tv="mux-video",xr,ks,$o,Is,zo,Qo,Xo,Zo,Ad,Sd=class extends lf{constructor(){super(),Ft(this,Zo),Ft(this,xr,void 0),Ft(this,ks,void 0),Ft(this,$o,void 0),Ft(this,Is,{}),Ft(this,zo,void 0),Ft(this,Qo,void 0),Ft(this,Xo,void 0),ii(this,$o,Jh())}static get observedAttributes(){var a;return[...yv,...(a=lf.observedAttributes)!=null?a:[]]}get preferCmcd(){var a;return(a=this.getAttribute($e.PREFER_CMCD))!=null?a:void 0}set preferCmcd(a){a!==this.preferCmcd&&(a?kn.includes(a)?this.setAttribute($e.PREFER_CMCD,a):console.warn(`Invalid value for preferCmcd. Must be one of ${kn.join()}`):this.removeAttribute($e.PREFER_CMCD))}get playerInitTime(){return Xe(this,$o)}get playerSoftwareName(){var a;return(a=Xe(this,Qo))!=null?a:Tv}set playerSoftwareName(a){ii(this,Qo,a)}get playerSoftwareVersion(){var a;return(a=Xe(this,zo))!=null?a:bv}set playerSoftwareVersion(a){ii(this,zo,a)}get _hls(){var a;return(a=Xe(this,xr))==null?void 0:a.engine}get mux(){return this.nativeEl.mux}get error(){var a;return(a=tf(this.nativeEl))!=null?a:null}get errorTranslator(){return Xe(this,Xo)}set errorTranslator(a){ii(this,Xo,a)}get src(){return this.getAttribute("src")}set src(a){a!==this.src&&(a==null?this.removeAttribute("src"):this.setAttribute("src",a))}get type(){var a;return(a=this.getAttribute($e.TYPE))!=null?a:void 0}set type(a){a!==this.type&&(a?this.setAttribute($e.TYPE,a):this.removeAttribute($e.TYPE))}get autoplay(){let a=this.getAttribute("autoplay");return a===null?!1:a===""?!0:a}set autoplay(a){let t=this.autoplay;a!==t&&(a?this.setAttribute("autoplay",typeof a=="string"?a:""):this.removeAttribute("autoplay"))}get preload(){let a=this.getAttribute("preload");return a===""?"auto":["none","metadata","auto"].includes(a)?a:super.preload}set preload(a){a!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(a)?this.setAttribute("preload",a):this.removeAttribute("preload"))}get debug(){return this.getAttribute($e.DEBUG)!=null}set debug(a){a!==this.debug&&(a?this.setAttribute($e.DEBUG,""):this.removeAttribute($e.DEBUG))}get disableCookies(){return this.hasAttribute($e.DISABLE_COOKIES)}set disableCookies(a){a!==this.disableCookies&&(a?this.setAttribute($e.DISABLE_COOKIES,""):this.removeAttribute($e.DISABLE_COOKIES))}get startTime(){let a=this.getAttribute($e.START_TIME);if(a==null)return;let t=+a;return Number.isNaN(t)?void 0:t}set startTime(a){a!==this.startTime&&(a==null?this.removeAttribute($e.START_TIME):this.setAttribute($e.START_TIME,`${a}`))}get playbackId(){var a;return(a=this.getAttribute($e.PLAYBACK_ID))!=null?a:void 0}set playbackId(a){a!==this.playbackId&&(a?this.setAttribute($e.PLAYBACK_ID,a):this.removeAttribute($e.PLAYBACK_ID))}get maxResolution(){var a;return(a=this.getAttribute($e.MAX_RESOLUTION))!=null?a:void 0}set maxResolution(a){a!==this.maxResolution&&(a?this.setAttribute($e.MAX_RESOLUTION,a):this.removeAttribute($e.MAX_RESOLUTION))}get customDomain(){var a;return(a=this.getAttribute($e.CUSTOM_DOMAIN))!=null?a:void 0}set customDomain(a){a!==this.customDomain&&(a?this.setAttribute($e.CUSTOM_DOMAIN,a):this.removeAttribute($e.CUSTOM_DOMAIN))}get envKey(){var a;return(a=this.getAttribute($e.ENV_KEY))!=null?a:void 0}set envKey(a){a!==this.envKey&&(a?this.setAttribute($e.ENV_KEY,a):this.removeAttribute($e.ENV_KEY))}get beaconCollectionDomain(){var a;return(a=this.getAttribute($e.BEACON_COLLECTION_DOMAIN))!=null?a:void 0}set beaconCollectionDomain(a){a!==this.beaconCollectionDomain&&(a?this.setAttribute($e.BEACON_COLLECTION_DOMAIN,a):this.removeAttribute($e.BEACON_COLLECTION_DOMAIN))}get streamType(){var a;return(a=this.getAttribute($e.STREAM_TYPE))!=null?a:void 0}set streamType(a){a!==this.streamType&&(a?this.setAttribute($e.STREAM_TYPE,a):this.removeAttribute($e.STREAM_TYPE))}async addCuePoints(a){return yd(this.nativeEl,a)}get activeCuePoint(){return bd(this.nativeEl)}get cuePoints(){return Qh(this.nativeEl)}get preferPlayback(){let a=this.getAttribute($e.PREFER_PLAYBACK);if(a===or.MSE||a===or.NATIVE)return a}set preferPlayback(a){a!==this.preferPlayback&&(a===or.MSE||a===or.NATIVE?this.setAttribute($e.PREFER_PLAYBACK,a):this.removeAttribute($e.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(a=>a.startsWith("metadata-")&&![$e.METADATA_URL].includes(a)).reduce((a,t)=>{let r=this.getAttribute(t);return r!=null&&(a[t.replace(/^metadata-/,"").replace(/-/g,"_")]=r),a},{}),...Xe(this,Is)}}set metadata(a){ii(this,Is,a!=null?a:{}),this.mux&&this.mux.emit("hb",Xe(this,Is))}load(){ii(this,xr,rf(this,this.nativeEl,Xe(this,xr)))}unload(){Td(this.nativeEl,Xe(this,xr)),ii(this,xr,void 0)}attributeChangedCallback(a,t,r){var d,v;switch(super.attributeChangedCallback(a,t,r),a){case $e.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=r!=null?r:void 0;break;case $e.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=r!=null?r:void 0;break;case"src":{let g=!!t,E=!!r;!g&&E?Ti(this,Zo,Ad).call(this):g&&!E?this.unload():g&&E&&(this.unload(),Ti(this,Zo,Ad).call(this));break}case"autoplay":if(r===t)break;(d=Xe(this,xr))==null||d.setAutoplay(this.autoplay);break;case"preload":if(r===t)break;(v=Xe(this,xr))==null||v.setPreload(r);break;case $e.PLAYBACK_ID:this.src=ef(r!=null?r:void 0,{maxResolution:this.maxResolution,domain:this.customDomain});break;case $e.DEBUG:{let g=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=g);break}case $e.METADATA_URL:r&&fetch(r).then(g=>g.json()).then(g=>this.metadata=g).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${r}!`));break;default:break}}disconnectedCallback(){this.unload()}};xr=new WeakMap,ks=new WeakMap,$o=new WeakMap,Is=new WeakMap,zo=new WeakMap,Qo=new WeakMap,Xo=new WeakMap,Zo=new WeakSet,Ad=async function(){Xe(this,ks)||(await ii(this,ks,Promise.resolve()),ii(this,ks,null),this.load())};oa.customElements.get("mux-video")||(oa.customElements.define("mux-video",Sd),oa.MuxVideoElement=Sd);var pf=Sd;var _v="en",Oa={code:_v};var vf="en";function Bt(a,t=!0){var v,g;let r=t&&(g=(v=Oa)==null?void 0:v[a])!=null?g:a,d=t?Oa.code:vf;return new Ld(r,d)}var Ld=class{constructor(t,r=(d=>(d=Oa.code)!=null?d:vf)()){this.message=t,this.locale=r}format(t){return this.message.replace(/\{(\w+)\}/g,(r,d)=>{var v;return(v=t[d])!=null?v:""})}toString(){return this.message}};function gf(a){let t="";return Object.entries(a).forEach(([r,d])=>{d!=null&&(t+=`${Av(r)}: ${d}; `)}),t?t.trim():void 0}function Av(a){return a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Ef(a){return a.replace(/[-_]([a-z])/g,(t,r)=>r.toUpperCase())}function Or(a){if(a==null)return;let t=+a;return Number.isNaN(t)?void 0:t}function tl(a){let t=Sv(a).toString();return t?"?"+t:""}function Sv(a){let t={};for(let r in a)a[r]!=null&&(t[r]=a[r]);return new URLSearchParams(t)}function la(a){let t=(a!=null?a:"").split(".")[1];if(!t)return{};let r=t.replace(/-/g,"+").replace(/_/g,"/"),d=decodeURIComponent(atob(r).split("").map(function(v){return"%"+("00"+v.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(d)}var Dd=(a,t)=>!a||!t?!1:a.contains(t)?!0:Dd(a,t.getRootNode().host);var Rd="mux.com",kv=()=>{try{return"1.8.0"}catch{}return"UNKNOWN"},Iv=kv(),rl=()=>Iv,Cd=(a,{maxResolution:t,token:r,domain:d=Rd}={})=>{let E=!!r?{token:r}:{redundant_streams:!0,...t?{max_resolution:t}:{}};return`https://stream.${d}/${a}.m3u8${tl(E)}`},yf=(a,{token:t,thumbnailTime:r,domain:d=Rd}={})=>{let v=t==null?r:void 0,{aud:g}=la(t);if(!(t&&g!=="t"))return`https://image.${d}/${a}/thumbnail.webp${tl({token:t,time:v})}`},bf=(a,{token:t,domain:r=Rd}={})=>{let{aud:d}=la(t);if(!(t&&d!=="s"))return`https://image.${r}/${a}/storyboard.vtt${tl({token:t,format:"webp"})}`};var wv={crossorigin:"crossOrigin",playsinline:"playsInline"};function Tf(a){var t;return(t=wv[a])!=null?t:Ef(a)}var Pa,Na,Ki,il=class{constructor(t,r){li(this,Pa,void 0);li(this,Na,void 0);li(this,Ki,[]);$i(this,Pa,t),$i(this,Na,r)}[Symbol.iterator](){return Nt(this,Ki).values()}get length(){return Nt(this,Ki).length}get value(){var t;return(t=Nt(this,Ki).join(" "))!=null?t:""}set value(t){var r;t!==this.value&&($i(this,Ki,[]),this.add(...(r=t==null?void 0:t.split(" "))!=null?r:[]))}toString(){return this.value}item(t){return Nt(this,Ki)[t]}values(){return Nt(this,Ki).values()}keys(){return Nt(this,Ki).keys()}forEach(t){Nt(this,Ki).forEach(t)}add(...t){var r,d;t.forEach(v=>{this.contains(v)||Nt(this,Ki).push(v)}),!(this.value===""&&!((r=Nt(this,Pa))!=null&&r.hasAttribute(`${Nt(this,Na)}`)))&&((d=Nt(this,Pa))==null||d.setAttribute(`${Nt(this,Na)}`,`${this.value}`))}remove(...t){var r;t.forEach(d=>{Nt(this,Ki).splice(Nt(this,Ki).indexOf(d),1)}),(r=Nt(this,Pa))==null||r.setAttribute(`${Nt(this,Na)}`,`${this.value}`)}contains(t){return Nt(this,Ki).includes(t)}toggle(t,r){return typeof r!="undefined"?r?(this.add(t),!0):(this.remove(t),!1):this.contains(t)?(this.remove(t),!1):(this.add(t),!0)}replace(t,r){this.remove(t),this.add(r)}};Pa=new WeakMap,Na=new WeakMap,Ki=new WeakMap;var _f=`[mux-player ${rl()}]`;function ua(...a){console.warn(_f,...a)}function pr(...a){console.error(_f,...a)}function al(a){var r;let t=(r=a.message)!=null?r:"";if(a.file){let d="https://github.com/muxinc/elements/blob/main/errors/";t+=` ${Bt("Read more: ")}
944
+ ${d}${a.file}`}ua(t)}var Ui={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Ua={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Sf=Object.freeze({length:0,start(a){let t=a>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(a){let t=a>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Lv=wd.filter(a=>a!=="error"),Dv=Object.values(Ui).filter(a=>![Ui.PLAYSINLINE].includes(a)),Rv=Object.values(Ua);function kf(a){a.querySelectorAll(":scope > track").forEach(t=>{var r;(r=a.media)==null||r.append(t.cloneNode())}),Lv.forEach(t=>{var r;(r=a.media)==null||r.addEventListener(t,d=>{a.dispatchEvent(new Event(d.type))})})}var Md=class extends mi.HTMLElement{static get observedAttributes(){return[...Dv,...Rv]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(d=>{var v;(v=this.media)==null||v.append(d.cloneNode())});let t=d=>{for(let v of d)v.type==="childList"&&(v.removedNodes.forEach(g=>{var L,M;let E=(L=this.media)==null?void 0:L.querySelector(`track[src="${g.src}"]`);E&&((M=this.media)==null||M.removeChild(E))}),v.addedNodes.forEach(g=>{var E;(E=this.media)==null||E.append(g.cloneNode())}))};new MutationObserver(t).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(t,r,d){var v,g;switch(t){case Ua.MUTED:{this.media&&(this.media.muted=d!=null,this.media.defaultMuted=d!=null);return}case Ua.VOLUME:{let E=(v=Or(d))!=null?v:1;this.media&&(this.media.volume=E);return}case Ua.PLAYBACKRATE:{let E=(g=Or(d))!=null?g:1;this.media&&(this.media.playbackRate=E,this.media.defaultPlaybackRate=E);return}}}play(){var t,r;return(r=(t=this.media)==null?void 0:t.play())!=null?r:Promise.reject()}pause(){var t;(t=this.media)==null||t.pause()}requestCast(t){var r;return(r=this.media)==null?void 0:r.requestCast(t)}get media(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("mux-video")}get paused(){var t,r;return(r=(t=this.media)==null?void 0:t.paused)!=null?r:!0}get duration(){var t,r;return(r=(t=this.media)==null?void 0:t.duration)!=null?r:NaN}get ended(){var t,r;return(r=(t=this.media)==null?void 0:t.ended)!=null?r:!1}get buffered(){var t,r;return(r=(t=this.media)==null?void 0:t.buffered)!=null?r:Sf}get seekable(){var t,r;return(r=(t=this.media)==null?void 0:t.seekable)!=null?r:Sf}get readyState(){var t,r;return(r=(t=this.media)==null?void 0:t.readyState)!=null?r:0}get videoWidth(){var t,r;return(r=(t=this.media)==null?void 0:t.videoWidth)!=null?r:0}get videoHeight(){var t,r;return(r=(t=this.media)==null?void 0:t.videoHeight)!=null?r:0}get currentTime(){var t,r;return(r=(t=this.media)==null?void 0:t.currentTime)!=null?r:0}set currentTime(t){this.media&&(this.media.currentTime=Number(t))}get volume(){var t,r;return(r=(t=this.media)==null?void 0:t.volume)!=null?r:1}set volume(t){this.media&&(this.media.volume=Number(t))}get playbackRate(){var t,r;return(r=(t=this.media)==null?void 0:t.playbackRate)!=null?r:1}set playbackRate(t){this.media&&(this.media.playbackRate=Number(t))}get defaultPlaybackRate(){var t;return(t=Or(this.getAttribute(Ua.PLAYBACKRATE)))!=null?t:1}set defaultPlaybackRate(t){t!=null?this.setAttribute(Ua.PLAYBACKRATE,`${t}`):this.removeAttribute(Ua.PLAYBACKRATE)}get crossOrigin(){return ws(this,Ui.CROSSORIGIN)}set crossOrigin(t){this.setAttribute(Ui.CROSSORIGIN,`${t}`)}get autoplay(){return ws(this,Ui.AUTOPLAY)!=null}set autoplay(t){t?this.setAttribute(Ui.AUTOPLAY,typeof t=="string"?t:""):this.removeAttribute(Ui.AUTOPLAY)}get loop(){return ws(this,Ui.LOOP)!=null}set loop(t){t?this.setAttribute(Ui.LOOP,""):this.removeAttribute(Ui.LOOP)}get muted(){var t,r;return(r=(t=this.media)==null?void 0:t.muted)!=null?r:!1}set muted(t){this.media&&(this.media.muted=Boolean(t))}get defaultMuted(){return ws(this,Ui.MUTED)!=null}set defaultMuted(t){t?this.setAttribute(Ui.MUTED,""):this.removeAttribute(Ui.MUTED)}get playsInline(){return ws(this,Ui.PLAYSINLINE)!=null}set playsInline(t){pr("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(t){["","none","metadata","auto"].includes(t)?this.setAttribute(Ui.PRELOAD,t):this.removeAttribute(Ui.PRELOAD)}};function ws(a,t){return a.media?a.media.getAttribute(t):a.getAttribute(t)}var xd=Md;var Cv=Object.defineProperty,Mv=(a,t,r)=>t in a?Cv(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,xv=(a,t,r)=>(Mv(a,typeof t!="symbol"?t+"":t,r),r),Rf=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},xt=(a,t,r)=>(Rf(a,t,"read from private field"),r?r.call(a):t.get(a)),_r=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},Pr=(a,t,r,d)=>(Rf(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),Ln,nl,Fa,Ls,da,ca,ha,Ba,Dn,sl,vr,If=1,wf=0,Ov=1,Pv={processCallback(a,t,r){if(!!r){for(let[d,v]of t)if(d in r){let g=r[d];typeof g=="boolean"&&v instanceof Gi&&typeof v.element[v.attributeName]=="boolean"?v.booleanValue=g:typeof g=="function"&&v instanceof Gi?v.element[v.attributeName]=g:v.value=g}}}},Nr=class extends ce.DocumentFragment{constructor(t,r,d=Pv){var v;super(),_r(this,Ln,void 0),_r(this,nl,void 0),this.append(t.content.cloneNode(!0)),Pr(this,Ln,Cf(this)),Pr(this,nl,d),(v=d.createCallback)==null||v.call(d,this,xt(this,Ln),r),d.processCallback(this,xt(this,Ln),r)}update(t){xt(this,nl).processCallback(this,xt(this,Ln),t)}};Ln=new WeakMap;nl=new WeakMap;var Cf=(a,t=[])=>{let r,d;for(let v of a.attributes||[])if(v.value.includes("{{")){let g=new Od;for([r,d]of Df(v.value))if(!r)g.append(d);else{let E=new Gi(a,v.name,v.namespaceURI);g.append(E),t.push([d,E])}v.value=g.toString()}for(let v of a.childNodes)if(v.nodeType===If&&!(v instanceof HTMLTemplateElement))Cf(v,t);else if(v.nodeType===If||v.data.includes("{{")){let g=[];if(v.data)for([r,d]of Df(v.data))if(!r)g.push(new Text(d));else{let E=new Ur(a);g.push(E),t.push([d,E])}else if(v instanceof HTMLTemplateElement){let E=new Ds(a,v);g.push(E),t.push([E.expression,E])}v.replaceWith(...g.flatMap(E=>E.replacementNodes||[E]))}return t},Lf={},Df=a=>{let t="",r=0,d=Lf[a],v=0,g;if(d)return d;for(d=[];g=a[v];v++)g==="{"&&a[v+1]==="{"&&a[v-1]!=="\\"&&a[v+2]&&++r==1?(t&&d.push([wf,t]),t="",v++):g==="}"&&a[v+1]==="}"&&a[v-1]!=="\\"&&!--r?(d.push([Ov,t.trim()]),t="",v++):t+=g||"";return t&&d.push([wf,(r>0?"{{":"")+t]),Lf[a]=d},Nv=11,ol=class{get value(){return""}set value(t){}toString(){return this.value}},Mf=new WeakMap,Od=class{constructor(){_r(this,Fa,[])}[Symbol.iterator](){return xt(this,Fa).values()}get length(){return xt(this,Fa).length}item(t){return xt(this,Fa)[t]}append(...t){for(let r of t)r instanceof Gi&&Mf.set(r,this),xt(this,Fa).push(r)}toString(){return xt(this,Fa).join("")}};Fa=new WeakMap;var Gi=class extends ol{constructor(t,r,d){super(),_r(this,Ba),_r(this,Ls,""),_r(this,da,void 0),_r(this,ca,void 0),_r(this,ha,void 0),Pr(this,da,t),Pr(this,ca,r),Pr(this,ha,d)}get attributeName(){return xt(this,ca)}get attributeNamespace(){return xt(this,ha)}get element(){return xt(this,da)}get value(){return xt(this,Ls)}set value(t){xt(this,Ls)!==t&&(Pr(this,Ls,t),!xt(this,Ba,Dn)||xt(this,Ba,Dn).length===1?t==null?xt(this,da).removeAttributeNS(xt(this,ha),xt(this,ca)):xt(this,da).setAttributeNS(xt(this,ha),xt(this,ca),t):xt(this,da).setAttributeNS(xt(this,ha),xt(this,ca),xt(this,Ba,Dn)))}get booleanValue(){return xt(this,da).hasAttributeNS(xt(this,ha),xt(this,ca))}set booleanValue(t){if(!xt(this,Ba,Dn)||xt(this,Ba,Dn).length===1)this.value=t?"":null;else throw new DOMException("Value is not fully templatized")}};Ls=new WeakMap;da=new WeakMap;ca=new WeakMap;ha=new WeakMap;Ba=new WeakSet;Dn=function(){return Mf.get(this)};var Ur=class extends ol{constructor(t,r){super(),_r(this,sl,void 0),_r(this,vr,void 0),Pr(this,sl,t),Pr(this,vr,r?[...r]:[new Text])}get replacementNodes(){return xt(this,vr)}get parentNode(){return xt(this,sl)}get nextSibling(){return xt(this,vr)[xt(this,vr).length-1].nextSibling}get previousSibling(){return xt(this,vr)[0].previousSibling}get value(){return xt(this,vr).map(t=>t.textContent).join("")}set value(t){this.replace(t)}replace(...t){let r=t.flat().flatMap(d=>d==null?[new Text]:d.forEach?[...d]:d.nodeType===Nv?[...d.childNodes]:d.nodeType?[d]:[new Text(d)]);r.length||r.push(new Text),Pr(this,vr,Uv(xt(this,vr)[0].parentNode,xt(this,vr),r,this.nextSibling))}};sl=new WeakMap;vr=new WeakMap;var Ds=class extends Ur{constructor(t,r){let d=r.getAttribute("directive")||r.getAttribute("type"),v=r.getAttribute("expression")||r.getAttribute(d)||"";v.startsWith("{{")&&(v=v.trim().slice(2,-2).trim()),super(t),xv(this,"directive"),this.expression=v,this.template=r,this.directive=d}};function Uv(a,t,r,d=null){let v=0,g,E,L,M=r.length,R=t.length;for(;v<M&&v<R&&t[v]==r[v];)v++;for(;v<M&&v<R&&r[M-1]==t[R-1];)d=r[--R,--M];if(v==R)for(;v<M;)a.insertBefore(r[v++],d);if(v==M)for(;v<R;)a.removeChild(t[v++]);else{for(g=t[v];v<M;)L=r[v++],E=g?g.nextSibling:d,g==L?g=E:v<M&&r[v]==E?(a.replaceChild(L,g),g=E):a.insertBefore(L,g);for(;g!=d;)E=g.nextSibling,a.removeChild(g),g=E}return r}var Fv=/([>&])?\s*(\w+)\s*(.*)/,Bv=/^(\?\?|\|)?\s*(['"\w]*)/,Hv={"|":{string:a=>String(a)},"??":(a,t)=>a!=null?a:t},ll=class{constructor(t){this.template=t}},Ha=new WeakMap,Ka=new WeakMap,Nd={partial:(a,t)=>{t[a.expression]=new ll(a.template)},if:(a,t)=>{var r;if(Vv(a.expression,t))if(Ha.get(a)!==a.template){Ha.set(a,a.template);let d=new Nr(a.template,t,ul);a.replace(d),Ka.set(a,d)}else(r=Ka.get(a))==null||r.update(t);else a.replace(""),Ha.delete(a),Ka.delete(a)}},Kv=Object.keys(Nd),ul={processCallback(a,t,r){var d,v,g,E;if(!!r)for(let[L,M]of t){if(M instanceof Ds){if(!M.directive){let he=Kv.find(Y=>M.template.hasAttribute(Y));he&&(M.directive=he,M.expression=M.template.getAttribute(he))}(d=Nd[M.directive])==null||d.call(Nd,M,r);continue}let[,R,b,P]=(v=L.match(Fv))!=null?v:[],O=r[b],[,ue,Q]=(g=P.match(Bv))!=null?g:[],de=Hv[ue];if(typeof de=="function")O=de(O,Rs(Q,r));else if(de&&O!=null){let he=de[Q];he&&(O=he(O))}if(O){if(O instanceof ll){if(R!==">")continue;let he={...r},Y=L.matchAll(/(\w+)\s*=\s*(['"\w]*)/g);for(let[,pe,X]of Y)he[pe]=Rs(X,r);Ha.get(M)!==O.template?(Ha.set(M,O.template),O=new Nr(O.template,he,ul),M.value=O,Ka.set(M,O)):(E=Ka.get(M))==null||E.update(he);continue}M instanceof Gi&&M.attributeName.startsWith("aria-")&&(O=String(O)),M instanceof Gi?typeof O=="boolean"?M.booleanValue=O:typeof O=="function"?M.element[M.attributeName]=O:M.value=O:(M.value=O,Ha.delete(M),Ka.delete(M))}else M instanceof Gi?M.booleanValue=!1:(M.value=void 0,Ha.delete(M),Ka.delete(M))}}},Gv={"==":(a,t)=>a==t,"!=":(a,t)=>a!=t,">":(a,t)=>a>t,">=":(a,t)=>a>=t,"<":(a,t)=>a<t,"<=":(a,t)=>a<=t};function Vv(a,t){var r;let d=Wv(a,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><]=|[><]/,ws:/\s+/,param:/[$a-z_][$\w]*/i});if(d.length===0||d.some(({type:g})=>!g))return console.warn(`Warning: invalid expression \`${a}\``),!1;if(d.length===1)return Pd(d[0])?Rs(d[0].token,t):(console.warn(`Warning: invalid expression \`${a}\``),!1);let v=d.filter(({type:g})=>g!=="ws");if(v.length===3){let g=Gv[(r=v[1])==null?void 0:r.token];return!g||!Pd(v[0])||!Pd(v[2])?(console.warn(`Warning: invalid expression \`${a}\``),!1):g(Rs(v[0].token,t),Rs(v[2].token,t))}}function Pd({type:a}){return["number","boolean","string","param"].includes(a)}function Rs(a,t){let r=a[0],d=a.slice(-1);return a==="true"||a==="false"?a==="true":r===d&&["'",'"'].includes(r)?a.slice(1,-1):fc(a)?parseFloat(a):t[a]}function Wv(a,t){let r,d,v,g=[];for(;a;){v=null,r=a.length;for(let E in t)d=t[E].exec(a),d&&d.index<r&&(v={token:d[0],type:E,matches:d.slice(1)},r=d.index);r&&g.push({token:a.substr(0,r),type:void 0}),v&&g.push(v),a=a.substr(r+(v?v.token.length:0))}return g}var jv=Object.defineProperty,qv=(a,t,r)=>t in a?jv(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,Cs=(a,t,r)=>(qv(a,typeof t!="symbol"?t+"":t,r),r),Nf=(a,t,r)=>{if(!t.has(a))throw TypeError("Cannot "+r)},xf=(a,t,r)=>(Nf(a,t,"read from private field"),r?r.call(a):t.get(a)),Of=(a,t,r)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,r)},Pf=(a,t,r,d)=>(Nf(a,t,"write to private field"),d?d.call(a,r):t.set(a,r),r),dl,cl,Ud={"media-target-live-window":"targetLiveWindow","media-stream-type":"streamType"},Rn=class extends ce.HTMLElement{constructor(){super(),Cs(this,"renderRoot"),Cs(this,"renderer"),Of(this,dl,void 0),Of(this,cl,void 0),this.renderRoot=this.attachShadow({mode:"open"});let t=new MutationObserver(r=>{r.some(d=>{let v=d.target;return v===this?!0:v.localName!=="media-controller"?!1:!!(Ud[d.attributeName]||d.attributeName.startsWith("breakpoint-"))})&&this.render()});t.observe(this,{attributes:!0}),t.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.createRenderer()}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var t,r;let d=this.getAttribute("template");if(d){let v=(t=this.getRootNode())==null?void 0:t.getElementById(d);if(v)return v}return(r=xf(this,dl))!=null?r:this.constructor.template}set template(t){Pf(this,dl,t),this.createRenderer()}get props(){var t,r,d;let v=[...Array.from((r=(t=this.mediaController)==null?void 0:t.attributes)!=null?r:[]).filter(({name:E})=>Ud[E]||E.startsWith("breakpoint-")),...Array.from(this.attributes)],g={};for(let E of v){let L=(d=Ud[E.name])!=null?d:cc(E.name);E.value!=null?g[L]=E.value===""?!0:E.value:g[L]=!1}return g}attributeChangedCallback(t,r,d){t==="template"&&r!=d&&this.createRenderer()}createRenderer(){this.template&&this.template!==xf(this,cl)&&(Pf(this,cl,this.template),this.renderer=new Nr(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(this.renderer))}render(){var t;(t=this.renderer)==null||t.update(this.props)}};dl=new WeakMap;cl=new WeakMap;Cs(Rn,"template");Cs(Rn,"observedAttributes",["template"]);Cs(Rn,"processor",ul);ce.customElements.get("media-theme")||ce.customElements.define("media-theme",Rn);var Ff=`
945
945
  :host {
946
946
  cursor: pointer;
947
947
  }
948
948
  media-time-display {
949
949
  color: inherit;
950
950
  }
951
- `,Bf=Hr.createElement("template");Bf.innerHTML=`
951
+ `,Bf=Hi.createElement("template");Bf.innerHTML=`
952
952
  <style>
953
953
  ${Ff}
954
954
  </style>
955
955
  <media-time-display show-duration></media-time-display>
956
- `;var Uf=["Enter"," "],Ms,Mn,hl,Cn=class extends mr.HTMLElement{constructor(){var i,d;super();lr(this,Mn);lr(this,Ms,void 0);this.attachShadow({mode:"open"}),(i=this.shadowRoot)==null||i.appendChild(this.constructor.template.content.cloneNode(!0)),this.timeDisplayEl=(d=this.shadowRoot)==null?void 0:d.querySelector("media-time-display")}static get observedAttributes(){return["hide-duration","remaining","disabled","aria-disabled"]}toggleTimeDisplay(){var i,d,v;(i=this.timeDisplayEl)!=null&&i.hasAttribute("remaining")?(d=this.timeDisplayEl)==null||d.removeAttribute("remaining"):(v=this.timeDisplayEl)==null||v.setAttribute("remaining","")}connectedCallback(){let i=d=>{let{key:v}=d;if(!Uf.includes(v)){this.removeEventListener("keyup",i);return}this.toggleTimeDisplay()};this.addEventListener("keydown",d=>{let{metaKey:v,altKey:g,key:b}=d;if(v||g||!Uf.includes(b)){this.removeEventListener("keyup",i);return}this.addEventListener("keyup",i)}),this.addEventListener("click",this.toggleTimeDisplay),$r(this,Ms,setInterval(_r(this,Mn,hl).bind(this),200)),requestAnimationFrame(()=>_r(this,Mn,hl).call(this))}disconnectedCallback(){clearInterval(Nt(this,Ms))}attributeChangedCallback(i,d,v){var g,b;i==="hide-duration"&&_r(this,Mn,hl).call(this),["remaining","disabled","aria-disabled"].includes(i)&&d!==v&&(v==null?(g=this.timeDisplayEl)==null||g.removeAttribute(i):(b=this.timeDisplayEl)==null||b.setAttribute(i,v))}};Ms=new WeakMap,Mn=new WeakSet,hl=function(){var d,v,g,b;getComputedStyle(this).getPropertyValue("--media-duration-display").trim()==="none"||this.getAttribute("hide-duration")!=null?(d=this.timeDisplayEl)!=null&&d.hasAttribute("show-duration")&&((v=this.timeDisplayEl)==null||v.removeAttribute("show-duration")):(g=this.timeDisplayEl)!=null&&g.hasAttribute("show-duration")||(b=this.timeDisplayEl)==null||b.setAttribute("show-duration","")},Cn.styles=Ff,Cn.template=Bf;mr.customElements.get("mxp-time-display")||(mr.customElements.define("mxp-time-display",Cn),mr.MxpTimeDisplay=Cn);var Hf=`:host {
956
+ `;var Uf=["Enter"," "],Ms,Mn,hl,Cn=class extends mi.HTMLElement{constructor(){var r,d;super();li(this,Mn);li(this,Ms,void 0);this.attachShadow({mode:"open"}),(r=this.shadowRoot)==null||r.appendChild(this.constructor.template.content.cloneNode(!0)),this.timeDisplayEl=(d=this.shadowRoot)==null?void 0:d.querySelector("media-time-display")}static get observedAttributes(){return["hide-duration","remaining","disabled","aria-disabled"]}toggleTimeDisplay(){var r,d,v;(r=this.timeDisplayEl)!=null&&r.hasAttribute("remaining")?(d=this.timeDisplayEl)==null||d.removeAttribute("remaining"):(v=this.timeDisplayEl)==null||v.setAttribute("remaining","")}connectedCallback(){let r=d=>{let{key:v}=d;if(!Uf.includes(v)){this.removeEventListener("keyup",r);return}this.toggleTimeDisplay()};this.addEventListener("keydown",d=>{let{metaKey:v,altKey:g,key:E}=d;if(v||g||!Uf.includes(E)){this.removeEventListener("keyup",r);return}this.addEventListener("keyup",r)}),this.addEventListener("click",this.toggleTimeDisplay),$i(this,Ms,setInterval(_i(this,Mn,hl).bind(this),200)),requestAnimationFrame(()=>_i(this,Mn,hl).call(this))}disconnectedCallback(){clearInterval(Nt(this,Ms))}attributeChangedCallback(r,d,v){var g,E;r==="hide-duration"&&_i(this,Mn,hl).call(this),["remaining","disabled","aria-disabled"].includes(r)&&d!==v&&(v==null?(g=this.timeDisplayEl)==null||g.removeAttribute(r):(E=this.timeDisplayEl)==null||E.setAttribute(r,v))}};Ms=new WeakMap,Mn=new WeakSet,hl=function(){var d,v,g,E;getComputedStyle(this).getPropertyValue("--media-duration-display").trim()==="none"||this.getAttribute("hide-duration")!=null?(d=this.timeDisplayEl)!=null&&d.hasAttribute("show-duration")&&((v=this.timeDisplayEl)==null||v.removeAttribute("show-duration")):(g=this.timeDisplayEl)!=null&&g.hasAttribute("show-duration")||(E=this.timeDisplayEl)==null||E.setAttribute("show-duration","")},Cn.styles=Ff,Cn.template=Bf;mi.customElements.get("mxp-time-display")||(mi.customElements.define("mxp-time-display",Cn),mi.MxpTimeDisplay=Cn);var Hf=`:host {
957
957
  display: inline-block;
958
958
  width: 100%;
959
959
  }
@@ -1922,7 +1922,7 @@ a {
1922
1922
  text-align: center;
1923
1923
  line-height: 1.4;
1924
1924
  }
1925
- `,Wf=Hr.createElement("template");Wf.innerHTML=`
1925
+ `,Wf=Hi.createElement("template");Wf.innerHTML=`
1926
1926
  <style>
1927
1927
  ${Vf}
1928
1928
  </style>
@@ -1930,7 +1930,7 @@ a {
1930
1930
  <div class="dialog">
1931
1931
  <slot></slot>
1932
1932
  </div>
1933
- `;var fa=class extends mr.HTMLElement{constructor(){var i;super();this.attachShadow({mode:"open"}),(i=this.shadowRoot)==null||i.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),Gf(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),zv(this))}attributeChangedCallback(i,d,v){i==="open"&&d!==v&&(v!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&Gf(this)}};fa.styles=Vf,fa.template=Wf,fa.observedAttributes=["open"];function Gf(a){let t=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(a.dispatchEvent(t),t.defaultPrevented)return;let i=a.querySelector("[autofocus]:not([disabled])");!i&&a.tabIndex>=0&&(i=a),i||(i=jf(a.shadowRoot)),a._previouslyFocusedElement=Hr.activeElement,Hr.activeElement instanceof HTMLElement&&Hr.activeElement.blur(),a.addEventListener("transitionend",()=>{i instanceof HTMLElement&&i.focus({preventScroll:!0})},{once:!0})}function jf(a){let i=["button","input","keygen","select","textarea"].map(function(v){return v+":not([disabled])"});i.push('[tabindex]:not([disabled]):not([tabindex=""])');let d=a==null?void 0:a.querySelector(i.join(", "));if(!d&&"attachShadow"in Element.prototype){let v=(a==null?void 0:a.querySelectorAll("*"))||[];for(let g=0;g<v.length&&!(v[g].tagName&&v[g].shadowRoot&&(d=jf(v[g].shadowRoot),d));g++);}return d}function zv(a){a._previouslyFocusedElement instanceof HTMLElement&&a._previouslyFocusedElement.focus()}mr.customElements.get("media-dialog")||(mr.customElements.define("media-dialog",fa),mr.MediaDialog=fa);var Fd=fa;var qf=Hr.createElement("template");qf.innerHTML=`
1933
+ `;var fa=class extends mi.HTMLElement{constructor(){var r;super();this.attachShadow({mode:"open"}),(r=this.shadowRoot)==null||r.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),Gf(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),zv(this))}attributeChangedCallback(r,d,v){r==="open"&&d!==v&&(v!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&Gf(this)}};fa.styles=Vf,fa.template=Wf,fa.observedAttributes=["open"];function Gf(a){let t=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(a.dispatchEvent(t),t.defaultPrevented)return;let r=a.querySelector("[autofocus]:not([disabled])");!r&&a.tabIndex>=0&&(r=a),r||(r=jf(a.shadowRoot)),a._previouslyFocusedElement=Hi.activeElement,Hi.activeElement instanceof HTMLElement&&Hi.activeElement.blur(),a.addEventListener("transitionend",()=>{r instanceof HTMLElement&&r.focus({preventScroll:!0})},{once:!0})}function jf(a){let r=["button","input","keygen","select","textarea"].map(function(v){return v+":not([disabled])"});r.push('[tabindex]:not([disabled]):not([tabindex=""])');let d=a==null?void 0:a.querySelector(r.join(", "));if(!d&&"attachShadow"in Element.prototype){let v=(a==null?void 0:a.querySelectorAll("*"))||[];for(let g=0;g<v.length&&!(v[g].tagName&&v[g].shadowRoot&&(d=jf(v[g].shadowRoot),d));g++);}return d}function zv(a){a._previouslyFocusedElement instanceof HTMLElement&&a._previouslyFocusedElement.focus()}mi.customElements.get("media-dialog")||(mi.customElements.define("media-dialog",fa),mi.MediaDialog=fa);var Fd=fa;var qf=Hi.createElement("template");qf.innerHTML=`
1934
1934
  <style>
1935
1935
  ${Fd.styles}
1936
1936
 
@@ -1961,12 +1961,12 @@ a {
1961
1961
  </svg>
1962
1962
  </button>
1963
1963
  </slot>
1964
- `;var xs=class extends Fd{constructor(){var t,i;super(),(i=(t=this.shadowRoot)==null?void 0:t.querySelector(".close"))==null||i.addEventListener("click",()=>{this.close()})}};xs.template=qf;mr.customElements.get("mxp-dialog")||(mr.customElements.define("mxp-dialog",xs),mr.MxpDialog=xs);var Os=new WeakMap,Ps=class{constructor(t,i){this.element=t;this.type=i;this.element.addEventListener(this.type,this);let d=Os.get(this.element);d&&d.set(this.type,this)}set(t){if(typeof t=="function")this.handleEvent=t.bind(this.element);else if(typeof t=="object"&&typeof t.handleEvent=="function")this.handleEvent=t.handleEvent.bind(t);else{this.element.removeEventListener(this.type,this);let i=Os.get(this.element);i&&i.delete(this.type)}}static for(t){Os.has(t.element)||Os.set(t.element,new Map);let i=t.attributeName.slice(2),d=Os.get(t.element);return d&&d.has(i)?d.get(i):new Ps(t.element,i)}};function Qv(a,t){return a instanceof Gr&&a.attributeName.startsWith("on")?(Ps.for(a).set(t),a.element.removeAttributeNS(a.attributeNamespace,a.attributeName),!0):!1}function Xv(a,t){return t instanceof fl&&a instanceof Ui?(t.renderInto(a),!0):!1}function Zv(a,t){return t instanceof DocumentFragment&&a instanceof Ui?(t.childNodes.length&&a.replace(...t.childNodes),!0):!1}function Jv(a,t){if(a instanceof Gr){let i=a.attributeNamespace,d=a.element.getAttributeNS(i,a.attributeName);return String(t)!==d&&(a.value=String(t)),!0}return a.value=String(t),!0}function eg(a,t){if(a instanceof Gr&&t instanceof Element){let i=a.element;return i[a.attributeName]!==t&&(a.element.removeAttributeNS(a.attributeNamespace,a.attributeName),i[a.attributeName]=t),!0}return!1}function tg(a,t){if(typeof t=="boolean"&&a instanceof Gr){let i=a.attributeNamespace,d=a.element.hasAttributeNS(i,a.attributeName);return t!==d&&(a.booleanValue=t),!0}return!1}function rg(a,t){return t===!1&&a instanceof Ui?(a.replace(""),!0):!1}function ig(a,t){eg(a,t)||tg(a,t)||Qv(a,t)||rg(a,t)||Xv(a,t)||Zv(a,t)||Jv(a,t)}var Bd=new Map,Yf=new WeakMap,$f=new WeakMap,fl=class{constructor(t,i,d){this.strings=t;this.values=i;this.processor=d;this.stringsKey=this.strings.join("")}get template(){if(Bd.has(this.stringsKey))return Bd.get(this.stringsKey);{let t=Hr.createElement("template"),i=this.strings.length-1;return t.innerHTML=this.strings.reduce((d,v,g)=>d+v+(g<i?`{{ ${g} }}`:""),""),Bd.set(this.stringsKey,t),t}}renderInto(t){let i=this.template;if(Yf.get(t)!==i){Yf.set(t,i);let v=new Ni(i,this.values,this.processor);$f.set(t,v),t instanceof Ui?t.replace(...v.children):t.appendChild(v);return}let d=$f.get(t);d&&d.update(this.values)}},ag={processCallback(a,t,i){var d;if(!!i){for(let[v,g]of t)if(v in i){let b=(d=i[v])!=null?d:"";ig(g,b)}}}};function Fi(a,...t){return new fl(a,t,ag)}function zf(a,t){a.renderInto(t)}var Hd=Hr.createElement("template");"innerHTML"in Hd&&(Hd.innerHTML=Kf);var Qf=a=>Fi`
1964
+ `;var xs=class extends Fd{constructor(){var t,r;super(),(r=(t=this.shadowRoot)==null?void 0:t.querySelector(".close"))==null||r.addEventListener("click",()=>{this.close()})}};xs.template=qf;mi.customElements.get("mxp-dialog")||(mi.customElements.define("mxp-dialog",xs),mi.MxpDialog=xs);var Os=new WeakMap,Ps=class{constructor(t,r){this.element=t;this.type=r;this.element.addEventListener(this.type,this);let d=Os.get(this.element);d&&d.set(this.type,this)}set(t){if(typeof t=="function")this.handleEvent=t.bind(this.element);else if(typeof t=="object"&&typeof t.handleEvent=="function")this.handleEvent=t.handleEvent.bind(t);else{this.element.removeEventListener(this.type,this);let r=Os.get(this.element);r&&r.delete(this.type)}}static for(t){Os.has(t.element)||Os.set(t.element,new Map);let r=t.attributeName.slice(2),d=Os.get(t.element);return d&&d.has(r)?d.get(r):new Ps(t.element,r)}};function Qv(a,t){return a instanceof Gi&&a.attributeName.startsWith("on")?(Ps.for(a).set(t),a.element.removeAttributeNS(a.attributeNamespace,a.attributeName),!0):!1}function Xv(a,t){return t instanceof fl&&a instanceof Ur?(t.renderInto(a),!0):!1}function Zv(a,t){return t instanceof DocumentFragment&&a instanceof Ur?(t.childNodes.length&&a.replace(...t.childNodes),!0):!1}function Jv(a,t){if(a instanceof Gi){let r=a.attributeNamespace,d=a.element.getAttributeNS(r,a.attributeName);return String(t)!==d&&(a.value=String(t)),!0}return a.value=String(t),!0}function eg(a,t){if(a instanceof Gi&&t instanceof Element){let r=a.element;return r[a.attributeName]!==t&&(a.element.removeAttributeNS(a.attributeNamespace,a.attributeName),r[a.attributeName]=t),!0}return!1}function tg(a,t){if(typeof t=="boolean"&&a instanceof Gi){let r=a.attributeNamespace,d=a.element.hasAttributeNS(r,a.attributeName);return t!==d&&(a.booleanValue=t),!0}return!1}function ig(a,t){return t===!1&&a instanceof Ur?(a.replace(""),!0):!1}function rg(a,t){eg(a,t)||tg(a,t)||Qv(a,t)||ig(a,t)||Xv(a,t)||Zv(a,t)||Jv(a,t)}var Bd=new Map,Yf=new WeakMap,$f=new WeakMap,fl=class{constructor(t,r,d){this.strings=t;this.values=r;this.processor=d;this.stringsKey=this.strings.join("")}get template(){if(Bd.has(this.stringsKey))return Bd.get(this.stringsKey);{let t=Hi.createElement("template"),r=this.strings.length-1;return t.innerHTML=this.strings.reduce((d,v,g)=>d+v+(g<r?`{{ ${g} }}`:""),""),Bd.set(this.stringsKey,t),t}}renderInto(t){let r=this.template;if(Yf.get(t)!==r){Yf.set(t,r);let v=new Nr(r,this.values,this.processor);$f.set(t,v),t instanceof Ur?t.replace(...v.children):t.appendChild(v);return}let d=$f.get(t);d&&d.update(this.values)}},ag={processCallback(a,t,r){var d;if(!!r){for(let[v,g]of t)if(v in r){let E=(d=r[v])!=null?d:"";rg(g,E)}}}};function Fr(a,...t){return new fl(a,t,ag)}function zf(a,t){a.renderInto(t)}var Hd=Hi.createElement("template");"innerHTML"in Hd&&(Hd.innerHTML=Kf);var Qf=a=>Fr`
1965
1965
  <style>
1966
1966
  ${Hf}
1967
1967
  </style>
1968
1968
  ${sg(a)}
1969
- `,Xf=a=>[Sr.LIVE,Sr.LL_LIVE].includes(a.streamType),Zf=a=>[Sr.DVR,Sr.LL_DVR].includes(a.streamType),Jf=a=>Xf(a)||Zf(a),ng=a=>{let t=a.hotKeys?`${a.hotKeys}`:"";return Jf(a)&&(t+=" noarrowleft noarrowright"),t},sg=a=>{var t,i,d,v,g,b,L,M,R,y,P,O,ue,Q,de,he,Y,pe,X,oe,z,be,ke,He,Z,w,q,N,fe,_e,te;return Fi`
1969
+ `,Xf=a=>[Si.LIVE,Si.LL_LIVE].includes(a.streamType),Zf=a=>[Si.DVR,Si.LL_DVR].includes(a.streamType),Jf=a=>Xf(a)||Zf(a),ng=a=>{let t=a.hotKeys?`${a.hotKeys}`:"";return Jf(a)&&(t+=" noarrowleft noarrowright"),t},sg=a=>{var t,r,d,v,g,E,L,M,R,b,P,O,ue,Q,de,he,Y,pe,X,oe,z,be,ke,He,Z,I,q,N,fe,_e,te;return Fr`
1970
1970
  <media-theme
1971
1971
  template="${(t=a.theme)!=null?t:Hd.content.children[0]}"
1972
1972
  class="${a.secondaryColor?"two-tone":!1}"
@@ -1975,16 +1975,16 @@ a {
1975
1975
  hotkeys="${ng(a)||!1}"
1976
1976
  nohotkeys="${a.noHotKeys||!a.hasSrc||a.isDialogOpen||!1}"
1977
1977
  disabled="${!a.hasSrc||a.isDialogOpen}"
1978
- audio="${(i=a.audio)!=null?i:!1}"
1978
+ audio="${(r=a.audio)!=null?r:!1}"
1979
1979
  style="${(d=gf({"--primary-color":a.primaryColor,"--secondary-color":a.secondaryColor}))!=null?d:!1}"
1980
1980
  default-showing-captions="${!a.defaultHiddenCaptions}"
1981
1981
  forward-seek-offset="${(v=a.forwardSeekOffset)!=null?v:!1}"
1982
1982
  backward-seek-offset="${(g=a.backwardSeekOffset)!=null?g:!1}"
1983
- playback-rates="${(b=a.playbackRates)!=null?b:!1}"
1983
+ playback-rates="${(E=a.playbackRates)!=null?E:!1}"
1984
1984
  default-show-remaining-time="${(L=a.defaultShowRemainingTime)!=null?L:!1}"
1985
1985
  title="${(M=a.title)!=null?M:!1}"
1986
1986
  poster="${a.poster===""?!1:(R=a.poster)!=null?R:!1}"
1987
- placeholder="${(y=a.placeholder)!=null?y:!1}"
1987
+ placeholder="${(b=a.placeholder)!=null?b:!1}"
1988
1988
  exportparts="top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, poster, seek-live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display"
1989
1989
  >
1990
1990
  <mux-video
@@ -2006,34 +2006,34 @@ a {
2006
2006
  env-key="${(ke=a.envKey)!=null?ke:!1}"
2007
2007
  stream-type="${(He=a.streamType)!=null?He:!1}"
2008
2008
  custom-domain="${(Z=a.customDomain)!=null?Z:!1}"
2009
- src="${a.src?a.src:a.playbackId?Cd(a.playbackId,{domain:a.customDomain,token:a.tokens.playback}):!1}"
2010
- cast-src="${a.src?a.src:a.playbackId?Cd(a.playbackId,{domain:a.customDomain,token:a.tokens.playback}):!1}"
2009
+ src="${a.src?a.src:a.playbackId?Cd(a.playbackId,{maxResolution:a.maxResolution,domain:a.customDomain,token:a.tokens.playback}):!1}"
2010
+ cast-src="${a.src?a.src:a.playbackId?Cd(a.playbackId,{maxResolution:a.maxResolution,domain:a.customDomain,token:a.tokens.playback}):!1}"
2011
2011
  cast-stream-type="${Xf(a)?"live":!1}"
2012
2012
  exportparts="video"
2013
2013
  >
2014
- ${a.storyboard?Fi`<track label="thumbnails" default kind="metadata" src="${a.storyboard}" />`:Fi``}
2014
+ ${a.storyboard?Fr`<track label="thumbnails" default kind="metadata" src="${a.storyboard}" />`:Fr``}
2015
2015
  </mux-video>
2016
2016
  <mxp-dialog
2017
2017
  no-auto-hide
2018
- open="${(w=a.isDialogOpen)!=null?w:!1}"
2018
+ open="${(I=a.isDialogOpen)!=null?I:!1}"
2019
2019
  onclose="${a.onCloseErrorDialog}"
2020
2020
  oninitfocus="${a.onInitFocusDialog}"
2021
2021
  >
2022
- ${(q=a.dialog)!=null&&q.title?Fi`<h3>${a.dialog.title}</h3>`:Fi``}
2022
+ ${(q=a.dialog)!=null&&q.title?Fr`<h3>${a.dialog.title}</h3>`:Fr``}
2023
2023
  <p>
2024
2024
  ${(N=a.dialog)==null?void 0:N.message}
2025
- ${(fe=a.dialog)!=null&&fe.linkUrl?Fi`<a
2025
+ ${(fe=a.dialog)!=null&&fe.linkUrl?Fr`<a
2026
2026
  href="${a.dialog.linkUrl}"
2027
2027
  target="_blank"
2028
2028
  rel="external noopener"
2029
2029
  aria-label="${(_e=a.dialog.linkText)!=null?_e:""} ${Bt("(opens in a new window)")}"
2030
2030
  >${(te=a.dialog.linkText)!=null?te:a.dialog.linkUrl}</a
2031
- >`:Fi``}
2031
+ >`:Fr``}
2032
2032
  </p>
2033
2033
  </mxp-dialog>
2034
2034
  </media-theme>
2035
- `};function ml(a,t,i,d,v){var L,M,R;let g={},b={};switch(a.code){case sr.MEDIA_ERR_NETWORK:{switch(g.title=Bt("Network Error",v),g.message=a.message,(L=a.data)==null?void 0:L.response.code){case 412:{g.title=Bt("Video is not currently available",v),g.message=Bt("The live stream or video file are not yet ready.",v),b.message=Bt("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",v),b.file="412-not-playable.md";break}case 404:{g.title=Bt("Video does not exist",v),g.message="",b.message=Bt("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",v),b.file="404-not-found.md";break}case 403:{if(g.title=Bt("Invalid playback URL",v),g.message=Bt("The video URL or playback-token are formatted with incorrect or incomplete information.",v),b.message=Bt("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",v),b.file="missing-signed-tokens.md",!d)break;let{exp:y,aud:P,sub:O}=la(d),ue=Date.now()>y*1e3,Q=O!==i,de=P!=="v",he={timeStyle:"medium",dateStyle:"medium"};if(ue){g.title=Bt("Video URL has expired",v),g.message=Bt("The video\u2019s secured playback-token has expired.",v),b.message=Bt("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",v).format({expiredDate:new Intl.DateTimeFormat(Oa.code,he).format(y*1e3),currentDate:new Intl.DateTimeFormat(Oa.code,he).format(Date.now())}),b.file="403-expired-token.md";break}if(Q){g.title=Bt("Video URL is formatted incorrectly",v),g.message=Bt("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),b.message=Bt("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",v).format({playbackId:i,tokenPlaybackId:O}),b.file="403-playback-id-mismatch.md";break}if(de){g.title=Bt("Video URL is formatted incorrectly",v),g.message=Bt("The playback-token is formatted with incorrect information.",v),b.message=Bt("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",v).format({tokenType:P}),b.file="403-incorrect-aud-value.md";break}b.message=Bt("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",v),b.file="403-malformatted-token.md";break}}break}case sr.MEDIA_ERR_DECODE:{let{message:y}=a;g={title:Bt("Media Error",v),message:y},b.file="media-decode-error.md";break}case sr.MEDIA_ERR_SRC_NOT_SUPPORTED:{let y=(R=(M=a.data)==null?void 0:M.response)==null?void 0:R.code;if(y>=400&&y<500){a.code=sr.MEDIA_ERR_NETWORK,a.data={response:{code:y}},{dialog:g,devlog:b}=ml(a,t,i,d);break}g={title:Bt("Source Not Supported",v),message:a.message},b.file="media-src-not-supported.md";break}default:g={title:Bt("Error",v),message:a.message};break}return t&&(g={title:Bt("Your device appears to be offline",v),message:Bt("Check your internet connection and try reloading this video.",v)}),{dialog:g,devlog:b}}var og=Object.values(Sr),Bi={SRC:"src",POSTER:"poster"},ct={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",TITLE:"title",PLACEHOLDER:"placeholder"};function lg(a,t){var d;return{src:!a.playbackId&&a.src,playbackId:a.playbackId,hasSrc:!!a.playbackId||!!a.src,poster:a.poster,storyboard:a.storyboard,storyboardSrc:a.getAttribute(ct.STORYBOARD_SRC),placeholder:a.getAttribute("placeholder"),theme:a.getAttribute("theme"),thumbnailTime:!a.tokens.thumbnail&&a.thumbnailTime,autoplay:a.autoplay,crossOrigin:a.crossOrigin,loop:a.loop,noHotKeys:a.hasAttribute(ct.NOHOTKEYS),hotKeys:a.getAttribute(ct.HOTKEYS),muted:a.muted,paused:a.paused,preload:a.preload,envKey:a.envKey,preferCmcd:a.preferCmcd,debug:a.debug,disableCookies:a.disableCookies,tokens:a.tokens,beaconCollectionDomain:a.beaconCollectionDomain,metadata:a.metadata,playerSoftwareName:a.playerSoftwareName,playerSoftwareVersion:a.playerSoftwareVersion,startTime:a.startTime,preferPlayback:a.preferPlayback,audio:a.audio,streamType:a.streamType,primaryColor:a.primaryColor,secondaryColor:a.secondaryColor,forwardSeekOffset:a.forwardSeekOffset,backwardSeekOffset:a.backwardSeekOffset,defaultHiddenCaptions:a.defaultHiddenCaptions,defaultShowRemainingTime:a.defaultShowRemainingTime,playbackRates:a.getAttribute(ct.PLAYBACK_RATES),customDomain:(d=a.getAttribute(ze.CUSTOM_DOMAIN))!=null?d:void 0,title:a.getAttribute(ct.TITLE),...t}}var ug=Object.values(ze),dg=Object.values(Bi),cg=Object.values(ct),hg=il(),fg="mux-player",em={dialog:void 0,isDialogOpen:!1},ma,Bs,Hi,Hs,Va,Wa,Ns,pl,tm,Ks,Kd,ja,Us,vl,rm,gl,im,El,am,Fs=class extends xd{constructor(){super();lr(this,Wa);lr(this,pl);lr(this,Ks);lr(this,ja);lr(this,vl);lr(this,gl);lr(this,El);lr(this,ma,!1);lr(this,Bs,{});lr(this,Hi,!0);lr(this,Hs,new rl(this,"hotkeys"));lr(this,Va,{...em,onCloseErrorDialog:()=>_r(this,Ks,Kd).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:i=>{Dd(this,Hr.activeElement)||i.preventDefault()}});this.attachShadow({mode:"open"}),_r(this,pl,tm).call(this),this.isConnected&&_r(this,Wa,Ns).call(this)}static get observedAttributes(){var i;return[...(i=xd.observedAttributes)!=null?i:[],...dg,...ug,...cg]}get theme(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("media-theme")}get mediaController(){var i,d;return(d=(i=this.theme)==null?void 0:i.shadowRoot)==null?void 0:d.querySelector("media-controller")}get metadataFromAttrs(){return this.getAttributeNames().filter(i=>i.startsWith("metadata-")).reduce((i,d)=>{let v=this.getAttribute(d);return v!==null&&(i[d.replace(/^metadata-/,"").replace(/-/g,"_")]=v),i},{})}connectedCallback(){var d;let i=(d=this.shadowRoot)==null?void 0:d.querySelector("mux-video");i&&(i.metadata=this.metadataFromAttrs)}attributeChangedCallback(i,d,v){switch(Nt(this,ma)||_r(this,Wa,Ns).call(this),super.attributeChangedCallback(i,d,v),i){case ct.HOTKEYS:Nt(this,Hs).value=v;break;case ct.THUMBNAIL_TIME:{v!=null&&this.tokens.thumbnail&&ua(Bt("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case ct.THUMBNAIL_TOKEN:{let{aud:b}=la(v);v&&b!=="t"&&ua(Bt("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:b}));break}case ct.STORYBOARD_TOKEN:{let{aud:b}=la(v);v&&b!=="s"&&ua(Bt("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:b}));break}case ze.PLAYBACK_ID:{v!=null&&v.includes("?token")&&pi(Bt("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:v})),this.streamType?this.streamType!=null&&!og.includes(this.streamType)&&al({file:"invalid-stream-type.md",message:Bt("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`").format({streamType:this.streamType})}):al({file:"invalid-stream-type.md",message:String(Bt("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`"))});break}}[ze.PLAYBACK_ID,Bi.SRC,ct.PLAYBACK_TOKEN].includes(i)&&d!==v&&$r(this,Va,{...Nt(this,Va),...em}),_r(this,ja,Us).call(this,{[Tf(i)]:v})}get preferCmcd(){var i;return(i=this.getAttribute(ze.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?kn.includes(i)?this.setAttribute(ze.PREFER_CMCD,i):ua(`Invalid value for preferCmcd. Must be one of ${kn.join()}`):this.removeAttribute(ze.PREFER_CMCD))}get hasPlayed(){var i,d;return(d=(i=this.mediaController)==null?void 0:i.hasAttribute("media-has-played"))!=null?d:!1}get inLiveWindow(){var i;return(i=this.mediaController)==null?void 0:i.hasAttribute("media-time-is-live")}get _hls(){var i;return(i=this.media)==null?void 0:i._hls}get mux(){var i;return(i=this.media)==null?void 0:i.mux}get playbackId(){var i;return(i=this.getAttribute(ze.PLAYBACK_ID))!=null?i:void 0}set playbackId(i){i?this.setAttribute(ze.PLAYBACK_ID,i):this.removeAttribute(ze.PLAYBACK_ID)}get src(){var i,d;return this.playbackId?(i=Ga(this,Bi.SRC))!=null?i:void 0:(d=this.getAttribute(Bi.SRC))!=null?d:void 0}set src(i){i?this.setAttribute(Bi.SRC,i):this.removeAttribute(Bi.SRC)}get poster(){var d;let i=this.getAttribute(Bi.POSTER);if(i!=null)return i;if(this.playbackId&&!this.audio)return yf(this.playbackId,{domain:this.customDomain,thumbnailTime:(d=this.thumbnailTime)!=null?d:this.startTime,token:this.tokens.thumbnail})}set poster(i){i||i===""?this.setAttribute(Bi.POSTER,i):this.removeAttribute(Bi.POSTER)}get storyboardSrc(){var i;return(i=this.getAttribute(ct.STORYBOARD_SRC))!=null?i:void 0}set storyboardSrc(i){i?this.setAttribute(ct.STORYBOARD_SRC,i):this.removeAttribute(ct.STORYBOARD_SRC)}get storyboard(){if(!this.audio&&(!this.streamType||![Sr.LIVE,Sr.LL_LIVE,Sr.DVR,Sr.LL_DVR].includes(this.streamType))){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(this.playbackId)return bf(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}}get audio(){return this.hasAttribute(ct.AUDIO)}set audio(i){if(!i){this.removeAttribute(ct.AUDIO);return}this.setAttribute(ct.AUDIO,"")}get hotkeys(){return Nt(this,Hs)}get nohotkeys(){return this.hasAttribute(ct.NOHOTKEYS)}set nohotkeys(i){if(!i){this.removeAttribute(ct.NOHOTKEYS);return}this.setAttribute(ct.NOHOTKEYS,"")}get thumbnailTime(){return Oi(this.getAttribute(ct.THUMBNAIL_TIME))}set thumbnailTime(i){this.setAttribute(ct.THUMBNAIL_TIME,`${i}`)}get title(){var i;return(i=this.getAttribute(ct.TITLE))!=null?i:""}set title(i){i!==this.title&&(i?this.setAttribute(ct.TITLE,i):this.removeAttribute("title"),super.title=i)}get placeholder(){var i;return(i=Ga(this,ct.PLACEHOLDER))!=null?i:""}set placeholder(i){this.setAttribute(ct.PLACEHOLDER,`${i}`)}get primaryColor(){var i;return(i=this.getAttribute(ct.PRIMARY_COLOR))!=null?i:void 0}set primaryColor(i){this.setAttribute(ct.PRIMARY_COLOR,`${i}`)}get secondaryColor(){var i;return(i=this.getAttribute(ct.SECONDARY_COLOR))!=null?i:"rgb(0 0 0 / .75)"}set secondaryColor(i){this.setAttribute(ct.SECONDARY_COLOR,`${i}`)}get defaultShowRemainingTime(){return this.hasAttribute(ct.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(i){i?this.setAttribute(ct.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(ct.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(ct.PLAYBACK_RATES))return this.getAttribute(ct.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(i=>Number(i)).filter(i=>!Number.isNaN(i)).sort((i,d)=>i-d)}set playbackRates(i){if(!i){this.removeAttribute(ct.PLAYBACK_RATES);return}this.setAttribute(ct.PLAYBACK_RATES,i.join(" "))}get forwardSeekOffset(){var i;return(i=Oi(this.getAttribute(ct.FORWARD_SEEK_OFFSET)))!=null?i:10}set forwardSeekOffset(i){this.setAttribute(ct.FORWARD_SEEK_OFFSET,`${i}`)}get backwardSeekOffset(){var i;return(i=Oi(this.getAttribute(ct.BACKWARD_SEEK_OFFSET)))!=null?i:10}set backwardSeekOffset(i){this.setAttribute(ct.BACKWARD_SEEK_OFFSET,`${i}`)}get defaultHiddenCaptions(){return this.hasAttribute(ct.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(i){i?this.setAttribute(ct.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(ct.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var i;return(i=this.getAttribute(ze.PLAYER_SOFTWARE_NAME))!=null?i:fg}get playerSoftwareVersion(){var i;return(i=this.getAttribute(ze.PLAYER_SOFTWARE_VERSION))!=null?i:hg}get beaconCollectionDomain(){var i;return(i=this.getAttribute(ze.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(ze.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(ze.BEACON_COLLECTION_DOMAIN))}get customDomain(){var i;return(i=this.getAttribute(ze.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(ze.CUSTOM_DOMAIN,i):this.removeAttribute(ze.CUSTOM_DOMAIN))}get envKey(){var i;return(i=Ga(this,ze.ENV_KEY))!=null?i:void 0}set envKey(i){this.setAttribute(ze.ENV_KEY,`${i}`)}get debug(){return Ga(this,ze.DEBUG)!=null}set debug(i){i?this.setAttribute(ze.DEBUG,""):this.removeAttribute(ze.DEBUG)}get disableCookies(){return Ga(this,ze.DISABLE_COOKIES)!=null}set disableCookies(i){i?this.setAttribute(ze.DISABLE_COOKIES,""):this.removeAttribute(ze.DISABLE_COOKIES)}get streamType(){return Ga(this,ze.STREAM_TYPE)}set streamType(i){this.setAttribute(ze.STREAM_TYPE,`${i}`)}get startTime(){return Oi(Ga(this,ze.START_TIME))}set startTime(i){this.setAttribute(ze.START_TIME,`${i}`)}get preferPlayback(){let i=this.getAttribute(ze.PREFER_PLAYBACK);if(i===oi.MSE||i===oi.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===oi.MSE||i===oi.NATIVE?this.setAttribute(ze.PREFER_PLAYBACK,i):this.removeAttribute(ze.PREFER_PLAYBACK))}get metadata(){var i;return(i=this.media)==null?void 0:i.metadata}set metadata(i){if(Nt(this,ma)||_r(this,Wa,Ns).call(this),!this.media){pi("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...this.metadataFromAttrs,...i}}async addCuePoints(i){var d;if(Nt(this,ma)||_r(this,Wa,Ns).call(this),!this.media){pi("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(d=this.media)==null?void 0:d.addCuePoints(i)}get activeCuePoint(){var i;return(i=this.media)==null?void 0:i.activeCuePoint}get cuePoints(){var i,d;return(d=(i=this.media)==null?void 0:i.cuePoints)!=null?d:[]}get tokens(){let i=this.getAttribute(ct.PLAYBACK_TOKEN),d=this.getAttribute(ct.THUMBNAIL_TOKEN),v=this.getAttribute(ct.STORYBOARD_TOKEN);return{...Nt(this,Bs),...i!=null?{playback:i}:{},...d!=null?{thumbnail:d}:{},...v!=null?{storyboard:v}:{}}}set tokens(i){$r(this,Bs,i!=null?i:{})}get playbackToken(){var i;return(i=this.getAttribute(ct.PLAYBACK_TOKEN))!=null?i:void 0}set playbackToken(i){this.setAttribute(ct.PLAYBACK_TOKEN,`${i}`)}get thumbnailToken(){var i;return(i=this.getAttribute(ct.THUMBNAIL_TOKEN))!=null?i:void 0}set thumbnailToken(i){this.setAttribute(ct.THUMBNAIL_TOKEN,`${i}`)}get storyboardToken(){var i;return(i=this.getAttribute(ct.STORYBOARD_TOKEN))!=null?i:void 0}set storyboardToken(i){this.setAttribute(ct.STORYBOARD_TOKEN,`${i}`)}addTextTrack(i,d,v,g){var L;let b=(L=this.media)==null?void 0:L.nativeEl;if(!!b)return Vo(b,i,d,v,g)}removeTextTrack(i){var v;let d=(v=this.media)==null?void 0:v.nativeEl;if(!!d)return $h(d,i)}get textTracks(){var i;return(i=this.media)==null?void 0:i.textTracks}};ma=new WeakMap,Bs=new WeakMap,Hi=new WeakMap,Hs=new WeakMap,Va=new WeakMap,Wa=new WeakSet,Ns=function(){var i,d;if(!Nt(this,ma)){$r(this,ma,!0),_r(this,ja,Us).call(this);try{if(customElements.upgrade(this.theme),!(this.theme instanceof mr.HTMLElement))throw""}catch{pi("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof pf))throw""}catch{pi("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof ls))throw""}catch{pi("<media-controller> failed to upgrade!")}kf(this),_r(this,vl,rm).call(this),_r(this,gl,im).call(this),$r(this,Hi,(d=(i=this.mediaController)==null?void 0:i.hasAttribute("user-inactive"))!=null?d:!0),_r(this,El,am).call(this)}},pl=new WeakSet,tm=function(){var i,d;try{(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--primary-color",syntax:"<color>",inherits:!0,initialValue:"white"}),(d=window==null?void 0:window.CSS)==null||d.registerProperty({name:"--secondary-color",syntax:"<color>",inherits:!0,initialValue:"transparent"})}catch{}},Ks=new WeakSet,Kd=function(i){Object.assign(Nt(this,Va),i),_r(this,ja,Us).call(this)},ja=new WeakSet,Us=function(i={}){zf(Qf(lg(this,{...Nt(this,Va),...i})),this.shadowRoot)},vl=new WeakSet,rm=function(){var d;let i=v=>{let{detail:g}=v;if(g instanceof sr||(g=new sr(g.message,g.code,g.fatal)),!(g!=null&&g.fatal)){ua(g),g.data&&ua(`${g.name} data:`,g.data);return}let{dialog:b,devlog:L}=ml(g,!window.navigator.onLine,this.playbackId,this.playbackToken);L.message&&al(L),pi(g),g.data&&pi(`${g.name} data:`,g.data),_r(this,Ks,Kd).call(this,{isDialogOpen:!0,dialog:b})};this.addEventListener("error",i),this.media&&(this.media.errorTranslator=(v={})=>{var b,L,M;if(!((b=this.media)!=null&&b.error))return v;let{devlog:g}=ml((L=this.media)==null?void 0:L.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(M=this.media)==null?void 0:M.error.code,player_error_message:g.message?String(g.message):v.player_error_message}}),(d=this.media)==null||d.addEventListener("error",v=>{var b,L;let{detail:g}=v;if(!g){let{message:M,code:R}=(L=(b=this.media)==null?void 0:b.error)!=null?L:{};g=new sr(M,R)}!(g!=null&&g.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:g}))})},gl=new WeakSet,im=function(){var d,v,g,b;let i=()=>_r(this,ja,Us).call(this);(v=(d=this.media)==null?void 0:d.textTracks)==null||v.addEventListener("addtrack",i),(b=(g=this.media)==null?void 0:g.textTracks)==null||b.addEventListener("removetrack",i)},El=new WeakSet,am=function(){var y,P,O;let i=this.mediaController,d=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(d)return;let v,g=new WeakMap,b=()=>this.streamType&&[Sr.LIVE,Sr.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,L=(ue,Q,de=!1)=>{if(b())return;Array.from(ue&&ue.activeCues||[]).forEach(Y=>{if(!(!Y.snapToLines||Y.line<-5||Y.line>=0&&Y.line<10))if(!Q||this.paused){let pe=Y.text.split(`
2036
- `).length,X=d?-2:-3;this.streamType&&[Sr.LIVE,Sr.LL_LIVE].includes(this.streamType)&&(X=d?-1:-2);let oe=X-pe;if(Y.line===oe&&!de)return;g.has(Y)||g.set(Y,Y.line),Y.line=oe-1,Y.line=oe}else setTimeout(()=>{Y.line=g.get(Y)||"auto"},500)})},M=()=>{var ue;L(v,(ue=i==null?void 0:i.hasAttribute("user-inactive"))!=null?ue:!1)},R=()=>{var de;let Q=Array.from(((de=i==null?void 0:i.media)==null?void 0:de.textTracks)||[]).filter(he=>["subtitles","captions"].includes(he.kind)&&he.mode==="showing")[0];Q!==v&&(v==null||v.removeEventListener("cuechange",M)),v=Q,v==null||v.addEventListener("cuechange",M),L(v,Nt(this,Hi))};if(R(),(y=i==null?void 0:i.media)==null||y.textTracks.addEventListener("change",R),(P=i==null?void 0:i.media)==null||P.textTracks.addEventListener("addtrack",R),navigator.userAgent.includes("Chrome/")){let ue=()=>{L(v,Nt(this,Hi),!0),this.paused||window.requestAnimationFrame(ue)};(O=i==null?void 0:i.media)==null||O.addEventListener("playing",()=>{ue()})}i==null||i.addEventListener("userinactivechange",()=>{let ue=i==null?void 0:i.hasAttribute("user-inactive");Nt(this,Hi)!==ue&&($r(this,Hi,ue),L(v,Nt(this,Hi)))})};function Ga(a,t){return a.media?a.media.getAttribute(t):a.getAttribute(t)}mr.customElements.get("mux-player")||(mr.customElements.define("mux-player",Fs),mr.MuxPlayerElement=Fs);var r_=Fs;})();
2035
+ `};function ml(a,t,r,d,v){var L,M,R;let g={},E={};switch(a.code){case si.MEDIA_ERR_NETWORK:{switch(g.title=Bt("Network Error",v),g.message=a.message,(L=a.data)==null?void 0:L.response.code){case 412:{g.title=Bt("Video is not currently available",v),g.message=Bt("The live stream or video file are not yet ready.",v),E.message=Bt("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",v),E.file="412-not-playable.md";break}case 404:{g.title=Bt("Video does not exist",v),g.message="",E.message=Bt("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",v),E.file="404-not-found.md";break}case 403:{if(g.title=Bt("Invalid playback URL",v),g.message=Bt("The video URL or playback-token are formatted with incorrect or incomplete information.",v),E.message=Bt("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",v),E.file="missing-signed-tokens.md",!d)break;let{exp:b,aud:P,sub:O}=la(d),ue=Date.now()>b*1e3,Q=O!==r,de=P!=="v",he={timeStyle:"medium",dateStyle:"medium"};if(ue){g.title=Bt("Video URL has expired",v),g.message=Bt("The video\u2019s secured playback-token has expired.",v),E.message=Bt("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",v).format({expiredDate:new Intl.DateTimeFormat(Oa.code,he).format(b*1e3),currentDate:new Intl.DateTimeFormat(Oa.code,he).format(Date.now())}),E.file="403-expired-token.md";break}if(Q){g.title=Bt("Video URL is formatted incorrectly",v),g.message=Bt("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),E.message=Bt("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",v).format({playbackId:r,tokenPlaybackId:O}),E.file="403-playback-id-mismatch.md";break}if(de){g.title=Bt("Video URL is formatted incorrectly",v),g.message=Bt("The playback-token is formatted with incorrect information.",v),E.message=Bt("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",v).format({tokenType:P}),E.file="403-incorrect-aud-value.md";break}E.message=Bt("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",v),E.file="403-malformatted-token.md";break}}break}case si.MEDIA_ERR_DECODE:{let{message:b}=a;g={title:Bt("Media Error",v),message:b},E.file="media-decode-error.md";break}case si.MEDIA_ERR_SRC_NOT_SUPPORTED:{let b=(R=(M=a.data)==null?void 0:M.response)==null?void 0:R.code;if(b>=400&&b<500){a.code=si.MEDIA_ERR_NETWORK,a.data={response:{code:b}},{dialog:g,devlog:E}=ml(a,t,r,d);break}g={title:Bt("Source Not Supported",v),message:a.message},E.file="media-src-not-supported.md";break}default:g={title:Bt("Error",v),message:a.message};break}return t&&(g={title:Bt("Your device appears to be offline",v),message:Bt("Check your internet connection and try reloading this video.",v)}),{dialog:g,devlog:E}}var og=Object.values(Si),Br={SRC:"src",POSTER:"poster"},ct={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",TITLE:"title",PLACEHOLDER:"placeholder"};function lg(a,t){var d;return{src:!a.playbackId&&a.src,playbackId:a.playbackId,hasSrc:!!a.playbackId||!!a.src,poster:a.poster,storyboard:a.storyboard,storyboardSrc:a.getAttribute(ct.STORYBOARD_SRC),placeholder:a.getAttribute("placeholder"),theme:a.getAttribute("theme"),thumbnailTime:!a.tokens.thumbnail&&a.thumbnailTime,autoplay:a.autoplay,crossOrigin:a.crossOrigin,loop:a.loop,noHotKeys:a.hasAttribute(ct.NOHOTKEYS),hotKeys:a.getAttribute(ct.HOTKEYS),muted:a.muted,paused:a.paused,preload:a.preload,envKey:a.envKey,preferCmcd:a.preferCmcd,debug:a.debug,disableCookies:a.disableCookies,tokens:a.tokens,beaconCollectionDomain:a.beaconCollectionDomain,maxResolution:a.maxResolution,metadata:a.metadata,playerSoftwareName:a.playerSoftwareName,playerSoftwareVersion:a.playerSoftwareVersion,startTime:a.startTime,preferPlayback:a.preferPlayback,audio:a.audio,streamType:a.streamType,primaryColor:a.primaryColor,secondaryColor:a.secondaryColor,forwardSeekOffset:a.forwardSeekOffset,backwardSeekOffset:a.backwardSeekOffset,defaultHiddenCaptions:a.defaultHiddenCaptions,defaultShowRemainingTime:a.defaultShowRemainingTime,playbackRates:a.getAttribute(ct.PLAYBACK_RATES),customDomain:(d=a.getAttribute($e.CUSTOM_DOMAIN))!=null?d:void 0,title:a.getAttribute(ct.TITLE),...t}}var ug=Object.values($e),dg=Object.values(Br),cg=Object.values(ct),hg=rl(),fg="mux-player",em={dialog:void 0,isDialogOpen:!1},ma,Bs,Hr,Hs,Va,Wa,Ns,pl,tm,Ks,Kd,ja,Us,vl,im,gl,rm,El,am,Fs=class extends xd{constructor(){super();li(this,Wa);li(this,pl);li(this,Ks);li(this,ja);li(this,vl);li(this,gl);li(this,El);li(this,ma,!1);li(this,Bs,{});li(this,Hr,!0);li(this,Hs,new il(this,"hotkeys"));li(this,Va,{...em,onCloseErrorDialog:()=>_i(this,Ks,Kd).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:r=>{Dd(this,Hi.activeElement)||r.preventDefault()}});this.attachShadow({mode:"open"}),_i(this,pl,tm).call(this),this.isConnected&&_i(this,Wa,Ns).call(this)}static get observedAttributes(){var r;return[...(r=xd.observedAttributes)!=null?r:[],...dg,...ug,...cg]}get theme(){var r;return(r=this.shadowRoot)==null?void 0:r.querySelector("media-theme")}get mediaController(){var r,d;return(d=(r=this.theme)==null?void 0:r.shadowRoot)==null?void 0:d.querySelector("media-controller")}get metadataFromAttrs(){return this.getAttributeNames().filter(r=>r.startsWith("metadata-")).reduce((r,d)=>{let v=this.getAttribute(d);return v!==null&&(r[d.replace(/^metadata-/,"").replace(/-/g,"_")]=v),r},{})}connectedCallback(){var d;let r=(d=this.shadowRoot)==null?void 0:d.querySelector("mux-video");r&&(r.metadata=this.metadataFromAttrs)}attributeChangedCallback(r,d,v){switch(Nt(this,ma)||_i(this,Wa,Ns).call(this),super.attributeChangedCallback(r,d,v),r){case ct.HOTKEYS:Nt(this,Hs).value=v;break;case ct.THUMBNAIL_TIME:{v!=null&&this.tokens.thumbnail&&ua(Bt("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case ct.THUMBNAIL_TOKEN:{let{aud:E}=la(v);v&&E!=="t"&&ua(Bt("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:E}));break}case ct.STORYBOARD_TOKEN:{let{aud:E}=la(v);v&&E!=="s"&&ua(Bt("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:E}));break}case $e.PLAYBACK_ID:{v!=null&&v.includes("?token")&&pr(Bt("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:v})),this.streamType?this.streamType!=null&&!og.includes(this.streamType)&&al({file:"invalid-stream-type.md",message:Bt("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`").format({streamType:this.streamType})}):al({file:"invalid-stream-type.md",message:String(Bt("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`"))});break}}[$e.PLAYBACK_ID,Br.SRC,ct.PLAYBACK_TOKEN].includes(r)&&d!==v&&$i(this,Va,{...Nt(this,Va),...em}),_i(this,ja,Us).call(this,{[Tf(r)]:v})}get preferCmcd(){var r;return(r=this.getAttribute($e.PREFER_CMCD))!=null?r:void 0}set preferCmcd(r){r!==this.preferCmcd&&(r?kn.includes(r)?this.setAttribute($e.PREFER_CMCD,r):ua(`Invalid value for preferCmcd. Must be one of ${kn.join()}`):this.removeAttribute($e.PREFER_CMCD))}get hasPlayed(){var r,d;return(d=(r=this.mediaController)==null?void 0:r.hasAttribute("media-has-played"))!=null?d:!1}get inLiveWindow(){var r;return(r=this.mediaController)==null?void 0:r.hasAttribute("media-time-is-live")}get _hls(){var r;return(r=this.media)==null?void 0:r._hls}get mux(){var r;return(r=this.media)==null?void 0:r.mux}get playbackId(){var r;return(r=this.getAttribute($e.PLAYBACK_ID))!=null?r:void 0}set playbackId(r){r?this.setAttribute($e.PLAYBACK_ID,r):this.removeAttribute($e.PLAYBACK_ID)}get src(){var r,d;return this.playbackId?(r=Ga(this,Br.SRC))!=null?r:void 0:(d=this.getAttribute(Br.SRC))!=null?d:void 0}set src(r){r?this.setAttribute(Br.SRC,r):this.removeAttribute(Br.SRC)}get poster(){var d;let r=this.getAttribute(Br.POSTER);if(r!=null)return r;if(this.playbackId&&!this.audio)return yf(this.playbackId,{domain:this.customDomain,thumbnailTime:(d=this.thumbnailTime)!=null?d:this.startTime,token:this.tokens.thumbnail})}set poster(r){r||r===""?this.setAttribute(Br.POSTER,r):this.removeAttribute(Br.POSTER)}get storyboardSrc(){var r;return(r=this.getAttribute(ct.STORYBOARD_SRC))!=null?r:void 0}set storyboardSrc(r){r?this.setAttribute(ct.STORYBOARD_SRC,r):this.removeAttribute(ct.STORYBOARD_SRC)}get storyboard(){if(!this.audio&&(!this.streamType||![Si.LIVE,Si.LL_LIVE,Si.DVR,Si.LL_DVR].includes(this.streamType))){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(this.playbackId)return bf(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}}get audio(){return this.hasAttribute(ct.AUDIO)}set audio(r){if(!r){this.removeAttribute(ct.AUDIO);return}this.setAttribute(ct.AUDIO,"")}get hotkeys(){return Nt(this,Hs)}get nohotkeys(){return this.hasAttribute(ct.NOHOTKEYS)}set nohotkeys(r){if(!r){this.removeAttribute(ct.NOHOTKEYS);return}this.setAttribute(ct.NOHOTKEYS,"")}get thumbnailTime(){return Or(this.getAttribute(ct.THUMBNAIL_TIME))}set thumbnailTime(r){this.setAttribute(ct.THUMBNAIL_TIME,`${r}`)}get title(){var r;return(r=this.getAttribute(ct.TITLE))!=null?r:""}set title(r){r!==this.title&&(r?this.setAttribute(ct.TITLE,r):this.removeAttribute("title"),super.title=r)}get placeholder(){var r;return(r=Ga(this,ct.PLACEHOLDER))!=null?r:""}set placeholder(r){this.setAttribute(ct.PLACEHOLDER,`${r}`)}get primaryColor(){var r;return(r=this.getAttribute(ct.PRIMARY_COLOR))!=null?r:void 0}set primaryColor(r){this.setAttribute(ct.PRIMARY_COLOR,`${r}`)}get secondaryColor(){var r;return(r=this.getAttribute(ct.SECONDARY_COLOR))!=null?r:"rgb(0 0 0 / .75)"}set secondaryColor(r){this.setAttribute(ct.SECONDARY_COLOR,`${r}`)}get defaultShowRemainingTime(){return this.hasAttribute(ct.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(r){r?this.setAttribute(ct.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(ct.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(ct.PLAYBACK_RATES))return this.getAttribute(ct.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(r=>Number(r)).filter(r=>!Number.isNaN(r)).sort((r,d)=>r-d)}set playbackRates(r){if(!r){this.removeAttribute(ct.PLAYBACK_RATES);return}this.setAttribute(ct.PLAYBACK_RATES,r.join(" "))}get forwardSeekOffset(){var r;return(r=Or(this.getAttribute(ct.FORWARD_SEEK_OFFSET)))!=null?r:10}set forwardSeekOffset(r){this.setAttribute(ct.FORWARD_SEEK_OFFSET,`${r}`)}get backwardSeekOffset(){var r;return(r=Or(this.getAttribute(ct.BACKWARD_SEEK_OFFSET)))!=null?r:10}set backwardSeekOffset(r){this.setAttribute(ct.BACKWARD_SEEK_OFFSET,`${r}`)}get defaultHiddenCaptions(){return this.hasAttribute(ct.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(r){r?this.setAttribute(ct.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(ct.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var r;return(r=this.getAttribute($e.PLAYER_SOFTWARE_NAME))!=null?r:fg}get playerSoftwareVersion(){var r;return(r=this.getAttribute($e.PLAYER_SOFTWARE_VERSION))!=null?r:hg}get beaconCollectionDomain(){var r;return(r=this.getAttribute($e.BEACON_COLLECTION_DOMAIN))!=null?r:void 0}set beaconCollectionDomain(r){r!==this.beaconCollectionDomain&&(r?this.setAttribute($e.BEACON_COLLECTION_DOMAIN,r):this.removeAttribute($e.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var r;return(r=this.getAttribute($e.MAX_RESOLUTION))!=null?r:void 0}set maxResolution(r){r!==this.maxResolution&&(r?this.setAttribute($e.MAX_RESOLUTION,r):this.removeAttribute($e.MAX_RESOLUTION))}get customDomain(){var r;return(r=this.getAttribute($e.CUSTOM_DOMAIN))!=null?r:void 0}set customDomain(r){r!==this.customDomain&&(r?this.setAttribute($e.CUSTOM_DOMAIN,r):this.removeAttribute($e.CUSTOM_DOMAIN))}get envKey(){var r;return(r=Ga(this,$e.ENV_KEY))!=null?r:void 0}set envKey(r){this.setAttribute($e.ENV_KEY,`${r}`)}get debug(){return Ga(this,$e.DEBUG)!=null}set debug(r){r?this.setAttribute($e.DEBUG,""):this.removeAttribute($e.DEBUG)}get disableCookies(){return Ga(this,$e.DISABLE_COOKIES)!=null}set disableCookies(r){r?this.setAttribute($e.DISABLE_COOKIES,""):this.removeAttribute($e.DISABLE_COOKIES)}get streamType(){return Ga(this,$e.STREAM_TYPE)}set streamType(r){this.setAttribute($e.STREAM_TYPE,`${r}`)}get startTime(){return Or(Ga(this,$e.START_TIME))}set startTime(r){this.setAttribute($e.START_TIME,`${r}`)}get preferPlayback(){let r=this.getAttribute($e.PREFER_PLAYBACK);if(r===or.MSE||r===or.NATIVE)return r}set preferPlayback(r){r!==this.preferPlayback&&(r===or.MSE||r===or.NATIVE?this.setAttribute($e.PREFER_PLAYBACK,r):this.removeAttribute($e.PREFER_PLAYBACK))}get metadata(){var r;return(r=this.media)==null?void 0:r.metadata}set metadata(r){if(Nt(this,ma)||_i(this,Wa,Ns).call(this),!this.media){pr("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...this.metadataFromAttrs,...r}}async addCuePoints(r){var d;if(Nt(this,ma)||_i(this,Wa,Ns).call(this),!this.media){pr("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(d=this.media)==null?void 0:d.addCuePoints(r)}get activeCuePoint(){var r;return(r=this.media)==null?void 0:r.activeCuePoint}get cuePoints(){var r,d;return(d=(r=this.media)==null?void 0:r.cuePoints)!=null?d:[]}get tokens(){let r=this.getAttribute(ct.PLAYBACK_TOKEN),d=this.getAttribute(ct.THUMBNAIL_TOKEN),v=this.getAttribute(ct.STORYBOARD_TOKEN);return{...Nt(this,Bs),...r!=null?{playback:r}:{},...d!=null?{thumbnail:d}:{},...v!=null?{storyboard:v}:{}}}set tokens(r){$i(this,Bs,r!=null?r:{})}get playbackToken(){var r;return(r=this.getAttribute(ct.PLAYBACK_TOKEN))!=null?r:void 0}set playbackToken(r){this.setAttribute(ct.PLAYBACK_TOKEN,`${r}`)}get thumbnailToken(){var r;return(r=this.getAttribute(ct.THUMBNAIL_TOKEN))!=null?r:void 0}set thumbnailToken(r){this.setAttribute(ct.THUMBNAIL_TOKEN,`${r}`)}get storyboardToken(){var r;return(r=this.getAttribute(ct.STORYBOARD_TOKEN))!=null?r:void 0}set storyboardToken(r){this.setAttribute(ct.STORYBOARD_TOKEN,`${r}`)}addTextTrack(r,d,v,g){var L;let E=(L=this.media)==null?void 0:L.nativeEl;if(!!E)return Vo(E,r,d,v,g)}removeTextTrack(r){var v;let d=(v=this.media)==null?void 0:v.nativeEl;if(!!d)return $h(d,r)}get textTracks(){var r;return(r=this.media)==null?void 0:r.textTracks}};ma=new WeakMap,Bs=new WeakMap,Hr=new WeakMap,Hs=new WeakMap,Va=new WeakMap,Wa=new WeakSet,Ns=function(){var r,d;if(!Nt(this,ma)){$i(this,ma,!0),_i(this,ja,Us).call(this);try{if(customElements.upgrade(this.theme),!(this.theme instanceof mi.HTMLElement))throw""}catch{pr("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof pf))throw""}catch{pr("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof ls))throw""}catch{pr("<media-controller> failed to upgrade!")}kf(this),_i(this,vl,im).call(this),_i(this,gl,rm).call(this),$i(this,Hr,(d=(r=this.mediaController)==null?void 0:r.hasAttribute("user-inactive"))!=null?d:!0),_i(this,El,am).call(this)}},pl=new WeakSet,tm=function(){var r,d;try{(r=window==null?void 0:window.CSS)==null||r.registerProperty({name:"--primary-color",syntax:"<color>",inherits:!0,initialValue:"white"}),(d=window==null?void 0:window.CSS)==null||d.registerProperty({name:"--secondary-color",syntax:"<color>",inherits:!0,initialValue:"transparent"})}catch{}},Ks=new WeakSet,Kd=function(r){Object.assign(Nt(this,Va),r),_i(this,ja,Us).call(this)},ja=new WeakSet,Us=function(r={}){zf(Qf(lg(this,{...Nt(this,Va),...r})),this.shadowRoot)},vl=new WeakSet,im=function(){var d;let r=v=>{let{detail:g}=v;if(g instanceof si||(g=new si(g.message,g.code,g.fatal)),!(g!=null&&g.fatal)){ua(g),g.data&&ua(`${g.name} data:`,g.data);return}let{dialog:E,devlog:L}=ml(g,!window.navigator.onLine,this.playbackId,this.playbackToken);L.message&&al(L),pr(g),g.data&&pr(`${g.name} data:`,g.data),_i(this,Ks,Kd).call(this,{isDialogOpen:!0,dialog:E})};this.addEventListener("error",r),this.media&&(this.media.errorTranslator=(v={})=>{var E,L,M;if(!((E=this.media)!=null&&E.error))return v;let{devlog:g}=ml((L=this.media)==null?void 0:L.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(M=this.media)==null?void 0:M.error.code,player_error_message:g.message?String(g.message):v.player_error_message}}),(d=this.media)==null||d.addEventListener("error",v=>{var E,L;let{detail:g}=v;if(!g){let{message:M,code:R}=(L=(E=this.media)==null?void 0:E.error)!=null?L:{};g=new si(M,R)}!(g!=null&&g.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:g}))})},gl=new WeakSet,rm=function(){var d,v,g,E;let r=()=>_i(this,ja,Us).call(this);(v=(d=this.media)==null?void 0:d.textTracks)==null||v.addEventListener("addtrack",r),(E=(g=this.media)==null?void 0:g.textTracks)==null||E.addEventListener("removetrack",r)},El=new WeakSet,am=function(){var b,P,O;let r=this.mediaController,d=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(d)return;let v,g=new WeakMap,E=()=>this.streamType&&[Si.LIVE,Si.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,L=(ue,Q,de=!1)=>{if(E())return;Array.from(ue&&ue.activeCues||[]).forEach(Y=>{if(!(!Y.snapToLines||Y.line<-5||Y.line>=0&&Y.line<10))if(!Q||this.paused){let pe=Y.text.split(`
2036
+ `).length,X=d?-2:-3;this.streamType&&[Si.LIVE,Si.LL_LIVE].includes(this.streamType)&&(X=d?-1:-2);let oe=X-pe;if(Y.line===oe&&!de)return;g.has(Y)||g.set(Y,Y.line),Y.line=oe-1,Y.line=oe}else setTimeout(()=>{Y.line=g.get(Y)||"auto"},500)})},M=()=>{var ue;L(v,(ue=r==null?void 0:r.hasAttribute("user-inactive"))!=null?ue:!1)},R=()=>{var de;let Q=Array.from(((de=r==null?void 0:r.media)==null?void 0:de.textTracks)||[]).filter(he=>["subtitles","captions"].includes(he.kind)&&he.mode==="showing")[0];Q!==v&&(v==null||v.removeEventListener("cuechange",M)),v=Q,v==null||v.addEventListener("cuechange",M),L(v,Nt(this,Hr))};if(R(),(b=r==null?void 0:r.media)==null||b.textTracks.addEventListener("change",R),(P=r==null?void 0:r.media)==null||P.textTracks.addEventListener("addtrack",R),navigator.userAgent.includes("Chrome/")){let ue=()=>{L(v,Nt(this,Hr),!0),this.paused||window.requestAnimationFrame(ue)};(O=r==null?void 0:r.media)==null||O.addEventListener("playing",()=>{ue()})}r==null||r.addEventListener("userinactivechange",()=>{let ue=r==null?void 0:r.hasAttribute("user-inactive");Nt(this,Hr)!==ue&&($i(this,Hr,ue),L(v,Nt(this,Hr)))})};function Ga(a,t){return a.media?a.media.getAttribute(t):a.getAttribute(t)}mi.customElements.get("mux-player")||(mi.customElements.define("mux-player",Fs),mi.MuxPlayerElement=Fs);var i_=Fs;})();
2037
2037
  /*!
2038
2038
  * JavaScript Cookie v2.1.3
2039
2039
  * https://github.com/js-cookie/js-cookie