@mux/mux-player 1.10.1 → 1.11.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.
- package/dist/index.cjs.js +176 -185
- package/dist/index.mjs +11 -9
- package/dist/mux-player.js +249 -258
- package/dist/mux-player.mjs +249 -258
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +8 -0
- package/dist/types-ts3.4/index.d.ts +7 -0
- package/package.json +5 -5
package/dist/mux-player.js
CHANGED
|
@@ -1,75 +1,71 @@
|
|
|
1
|
-
"use strict";(()=>{var Og=Object.create;var sf=Object.defineProperty;var Ng=Object.getOwnPropertyDescriptor;var Fg=Object.getOwnPropertyNames;var Ug=Object.getPrototypeOf,Bg=Object.prototype.hasOwnProperty;var of=(n,a)=>()=>(a||n((a={exports:{}}).exports,a),a.exports);var Hg=(n,a,o,m)=>{if(a&&typeof a=="object"||typeof a=="function")for(let v of Fg(a))!Bg.call(n,v)&&v!==o&&sf(n,v,{get:()=>a[v],enumerable:!(m=Ng(a,v))||m.enumerable});return n};var lf=(n,a,o)=>(o=n!=null?Og(Ug(n)):{},Hg(a||!n||!n.__esModule?sf(o,"default",{value:n,enumerable:!0}):o,n));var cu=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)};var at=(n,a,o)=>(cu(n,a,"read from private field"),o?o.call(n):a.get(n)),Rt=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},Oi=(n,a,o,m)=>(cu(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o);var Ht=(n,a,o)=>(cu(n,a,"access private method"),o);var jm=of((Hl,wc)=>{(function(){var n,a;n=this,a=function(){return function(){var o={80:function(g,L,M){g.exports=M(728).default},728:function(g,L,M){"use strict";M.d(L,{default:function(){return Xa}});var B=M(48),U=M.n(B),z=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(T){var y=16*Math.random()|0;return(T==="x"?y:3&y|8).toString(16)})},ie=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},ee=function(T){return T&&T.nodeName!==void 0?(T.muxId||(T.muxId=T.id||ie()),T.muxId):T},se=function(T){var y;T&&T.nodeName!==void 0?T=ee(y=T):y=document.querySelector(T);var _=y&&y.nodeName?y.nodeName.toLowerCase():"";return[y,T,_]},fe=M(640),_e=M.n(fe),Ae=_e().methodFactory;_e().methodFactory=function(T,y,_){var R=Ae(T,y,_);return function(){for(var C=["[mux]"],O=0;O<arguments.length;O++)C.push(arguments[O]);R.apply(void 0,C)}},_e().setLevel(_e().getLevel());var Se=_e();function st(){return(U().doNotTrack||U().navigator&&U().navigator.doNotTrack)==="1"}var Ue={now:function(){var T=U().performance,y=T&&T.timing,_=y&&y.navigationStart,R=typeof _=="number"&&typeof T.now=="function"?_+T.now():Date.now();return Math.round(R)}},le=function(T){return w(T)[0]},w=function(T){if(typeof T!="string"||T==="")return["localhost"];var y,_=(T.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return _&&(y=(_.match(/[^\.]+\.[^\.]+$/)||[])[0]),[_,y]},oe={exists:function(){var T=U().performance;return(T&&T.timing)!==void 0},domContentLoadedEventEnd:function(){var T=U().performance,y=T&&T.timing;return y&&y.domContentLoadedEventEnd},navigationStart:function(){var T=U().performance,y=T&&T.timing;return y&&y.navigationStart}};function W(T,y,_){_=_===void 0?1:_,T[y]=T[y]||0,T[y]+=_}var Ye=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],Et=["x-cdn","content-type"].concat(Ye);function Re(T){var y={};return(T=T||"").trim().split(/[\r\n]+/).forEach(function(_){if(_){var R=_.split(": "),C=R.shift();C&&(Et.indexOf(C.toLowerCase())>=0||C.toLowerCase().indexOf("x-litix-")===0)&&(y[C]=R.join(": "))}}),y}function et(T){if(T){var y=Ye.find(function(_){return T[_]!==void 0});return y?T[y]:void 0}}var ot=function(T){var y={};for(var _ in T){var R=T[_];R["DATA-ID"].search("io.litix.data.")!==-1&&(y[R["DATA-ID"].replace("io.litix.data.","")]=R.VALUE)}return y};function H(T,y){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);y&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function it(T){for(var y=1;y<arguments.length;y++){var _=arguments[y]!=null?arguments[y]:{};y%2?H(Object(_),!0).forEach(function(R){pt(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):H(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function pt(T,y,_){return y in T?Object.defineProperty(T,y,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[y]=_,T}var Je=function(T){if(!T)return{};var y=oe.navigationStart(),_=T.loading,R=_?_.start:T.trequest,C=_?_.first:T.tfirst,O=_?_.end:T.tload;return{bytesLoaded:T.total,requestStart:Math.round(y+R),responseStart:Math.round(y+C),responseEnd:Math.round(y+O)}},Vt=function(T){if(T&&typeof T.getAllResponseHeaders=="function")return Re(T.getAllResponseHeaders())};function mi(T,y){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);y&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function Mt(T){for(var y=1;y<arguments.length;y++){var _=arguments[y]!=null?arguments[y]:{};y%2?mi(Object(_),!0).forEach(function(R){Ne(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):mi(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function Ne(T,y,_){return y in T?Object.defineProperty(T,y,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[y]=_,T}var ct=function(T,y){if(!T||typeof T.getRequests!="function")return{};var _=T.getRequests({state:"executed"});if(_.length===0)return{};var R,C=_[_.length-1],O=le(C.url),x=C.url,G=C.bytesLoaded,$=new Date(C.requestStartDate).getTime(),K=new Date(C.firstByteDate).getTime(),Z=new Date(C.requestEndDate).getTime(),xe=isNaN(C.duration)?0:C.duration,me=typeof y.getMetricsFor=="function"?y.getMetricsFor(C.mediaType).HttpList:y.getDashMetrics().getHttpRequests(C.mediaType);return me.length>0&&(R=Re(me[me.length-1]._responseHeaders||"")),{requestStart:$,requestResponseStart:K,requestResponseEnd:Z,requestBytesLoaded:G,requestResponseHeaders:R,requestMediaDuration:xe,requestHostname:O,requestUrl:x,requestId:R?et(R):void 0}},pi=function(T,y){var _=y.getQualityFor(T),R=y.getCurrentTrackFor(T).bitrateList;return R?{currentLevel:_,renditionWidth:R[_].width||null,renditionHeight:R[_].height||null,renditionBitrate:R[_].bandwidth}:{}},Gi=function(T){var y;return(y=T.match(/.*codecs\*?="(.*)"/))===null||y===void 0?void 0:y[1]};function Zi(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var te=0,Te=function(){function T(){(function(C,O){if(!(C instanceof O))throw new TypeError("Cannot call a class as a function")})(this,T)}var y,_,R;return y=T,_=[{key:"on",value:function(C,O,x){return O._eventEmitterGuid=O._eventEmitterGuid||++te,this._listeners=this._listeners||{},this._listeners[C]=this._listeners[C]||[],x&&(O=O.bind(x)),this._listeners[C].push(O),O}},{key:"off",value:function(C,O){var x=this._listeners&&this._listeners[C];x&&x.forEach(function(G,$){G._eventEmitterGuid===O._eventEmitterGuid&&x.splice($,1)})}},{key:"one",value:function(C,O,x){var G=this;O._eventEmitterGuid=O._eventEmitterGuid||++te;var $=function K(){G.off(C,K),O.apply(x||this,arguments)};$._eventEmitterGuid=O._eventEmitterGuid,this.on(C,$)}},{key:"emit",value:function(C,O){var x=this;if(this._listeners){O=O||{};var G=this._listeners["before*"]||[],$=this._listeners[C]||[],K=this._listeners["after"+C]||[],Z=function(xe,me){(xe=xe.slice()).forEach(function(Ie){Ie.call(x,{type:C},me)})};Z(G,O),Z($,O),Z(K,O)}}}],_&&Zi(y.prototype,_),R&&Zi(y,R),Object.defineProperty(y,"prototype",{writable:!1}),T}(),tt=Te;function _t(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Lt=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,C.on("playing",function(){O._playheadShouldBeProgressing=!0}),C.on("play",this._startPlaybackHeartbeatInterval.bind(this)),C.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),C.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),C.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),C.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("seeked",function(){C.data.player_is_paused?O._stopPlaybackHeartbeatInterval():O._startPlaybackHeartbeatInterval()}),C.on("timeupdate",function(){O._playbackHeartbeatInterval!==null&&C.emit("playbackheartbeat")}),C.on("devicesleep",function(x,G){O._playbackHeartbeatInterval!==null&&(U().clearInterval(O._playbackHeartbeatInterval),C.emit("playbackheartbeatend",{viewer_time:G.viewer_time}),O._playbackHeartbeatInterval=null)})}var y,_,R;return y=T,(_=[{key:"_startPlaybackHeartbeatInterval",value:function(){var C=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=U().setInterval(function(){C.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(U().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&_t(y.prototype,_),R&&_t(y,R),Object.defineProperty(y,"prototype",{writable:!1}),T}();function $e(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Si(T,y,_){return y&&$e(T.prototype,y),_&&$e(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var jt=Si(function T(y){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),y.on("viewinit",function(){_.viewErrored=!1}),y.on("error",function(R,C){try{var O=y.errorTranslator({player_error_code:C.player_error_code,player_error_message:C.player_error_message,player_error_context:C.player_error_context});O?(y.data.player_error_code=O.player_error_code||C.player_error_code,y.data.player_error_message=O.player_error_message||C.player_error_message,y.data.player_error_context=O.player_error_context||C.player_error_context,_.viewErrored=!0):(delete y.data.player_error_code,delete y.data.player_error_message,delete y.data.player_error_context)}catch(x){y.mux.log.warn("Exception in error translator callback.",x),_.viewErrored=!0}})});function ii(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var ri=function(){function T(C){(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._watchTimeTrackerLastCheckedTime=null,C.on("playbackheartbeat",this._updateWatchTime.bind(this)),C.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var y,_,R;return y=T,(_=[{key:"_updateWatchTime",value:function(C,O){var x=O.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=x),W(this.pm.data,"view_watch_time",x-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=x}},{key:"_clearWatchTimeState",value:function(C,O){this._updateWatchTime(C,O),this._watchTimeTrackerLastCheckedTime=null}}])&&ii(y.prototype,_),R&&ii(y,R),Object.defineProperty(y,"prototype",{writable:!1}),T}();function pr(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Or=function(){function T(C){(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._playbackTimeTrackerLastPlayheadPosition=-1,C.on("playbackheartbeat",this._updatePlaybackTime.bind(this)),C.on("playbackheartbeatend",this._clearPlaybackTimeState.bind(this)),C.on("seeking",this._clearPlaybackTimeState.bind(this))}var y,_,R;return y=T,(_=[{key:"_updatePlaybackTime",value:function(){var C=this.pm.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&C>this._playbackTimeTrackerLastPlayheadPosition){var O=C-this._playbackTimeTrackerLastPlayheadPosition;O<=1e3&&W(this.pm.data,"view_content_playback_time",O)}this._playbackTimeTrackerLastPlayheadPosition=C}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&pr(y.prototype,_),R&&pr(y,R),Object.defineProperty(y,"prototype",{writable:!1}),T}();function oi(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var dt=function(){function T(C){(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C;var O=this._updatePlayheadTime.bind(this);C.on("playbackheartbeat",O),C.on("playbackheartbeatend",O),C.on("timeupdate",O),C.on("destroy",function(){C.off("timeupdate",O)})}var y,_,R;return y=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(C,O){var x=this,G=function(){x.pm.currentFragmentPDT&&x.pm.currentFragmentStart&&(x.pm.data.player_program_time=x.pm.currentFragmentPDT+x.pm.data.player_playhead_time-x.pm.currentFragmentStart)};if(O&&O.player_playhead_time)this.pm.data.player_playhead_time=O.player_playhead_time,G(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var $=this.pm.getPlayheadTime();$!==void 0&&(this.pm.data.player_playhead_time=$,G(),this._updateMaxPlayheadPosition())}}}])&&oi(y.prototype,_),R&&oi(y,R),Object.defineProperty(y,"prototype",{writable:!1}),T}();function Ji(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function vi(T,y,_){return y&&Ji(T.prototype,y),_&&Ji(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var vr=3e5,Nr=vi(function T(y){if(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")}(this,T),!y.disableRebufferTracking){var _,R=function(O,x){C(x),_=void 0},C=function(O){if(_){var x=O.viewer_time-_;W(y.data,"view_rebuffer_duration",x),_=O.viewer_time,y.data.view_rebuffer_duration>vr&&(y.emit("viewend"),y.send("viewend"),y.mux.log.warn("Ending view after rebuffering for longer than ".concat(vr,"ms, future events will be ignored unless a programchange or videochange occurs.")))}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(O,x){return C(x)}),y.on("rebufferstart",function(O,x){_||(W(y.data,"view_rebuffer_count",1),_=x.viewer_time,y.one("rebufferend",R))}),y.on("viewinit",function(){_=void 0,y.off("rebufferend",R)})}});function Fr(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Oa=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.disableRebufferTracking||C.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,C.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),C.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),C.on("seeking",function(){O._cleanupRebufferTracker(null,{viewer_time:Ue.now()})}))}var y,_,R;return y=T,_=[{key:"_checkIfRebuffering",value:function(C,O){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(C,O);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var x=O.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&x>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=O.viewer_time}else this._cleanupRebufferTracker(C,O,!0);else this._prepareRebufferTrackerState(O.viewer_time)}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(C){this._lastCheckedTime=C,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=C}},{key:"_cleanupRebufferTracker",value:function(C,O){var x=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:O.viewer_time});else{if(this._lastCheckedTime===null)return;var G=this.pm.data.player_playhead_time-this._lastPlayheadTime,$=O.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&G>0&&$-G>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+$-G}))}x?this._prepareRebufferTrackerState(O.viewer_time):this._clearRebufferTrackerState()}}],_&&Fr(y.prototype,_),R&&Fr(y,R),Object.defineProperty(y,"prototype",{writable:!1}),T}(),Na=Oa;function io(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var ro=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.on("viewinit",function(){var x=C.data,G=x.view_id;if(!x.view_program_changed){var $=function(K,Z){var xe=Z.viewer_time;K.type==="playing"&&C.data.view_time_to_first_frame===void 0?O.calculateTimeToFirstFrame(xe||Ue.now(),G):K.type!=="adplaying"||C.data.view_time_to_first_frame!==void 0&&!O._inPrerollPosition()||O.calculateTimeToFirstFrame(xe||Ue.now(),G)};C.one("playing",$),C.one("adplaying",$),C.one("viewend",function(){C.off("playing",$),C.off("adplaying",$)})}})}var y,_,R;return y=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(C,O){O===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:C}),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))}}])&&io(y.prototype,_),R&&io(y,R),Object.defineProperty(y,"prototype",{writable:!1}),T}();function ao(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function no(T,y,_){return y&&ao(T.prototype,y),_&&ao(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var bd=no(function T(y){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),y.on("viewinit",function(){_._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(R){y.on(R,function(){if(_._lastPlayheadPosition>=0&&y.data.player_playhead_time>=0&&_._lastPlayerWidth>=0&&_._lastSourceWidth>0&&_._lastPlayerHeight>=0&&_._lastSourceHeight>0){var C=y.data.player_playhead_time-_._lastPlayheadPosition;if(C<0)return void(_._lastPlayheadPosition=-1);var O=Math.min(_._lastPlayerWidth/_._lastSourceWidth,_._lastPlayerHeight/_._lastSourceHeight),x=Math.max(0,O-1),G=Math.max(0,1-O);y.data.view_max_upscale_percentage=Math.max(y.data.view_max_upscale_percentage||0,x),y.data.view_max_downscale_percentage=Math.max(y.data.view_max_downscale_percentage||0,G),W(y.data,"view_total_content_playback_time",C),W(y.data,"view_total_upscaling",x*C),W(y.data,"view_total_downscaling",G*C)}_._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(R){y.on(R,function(){_._lastPlayheadPosition=y.data.player_playhead_time,_._lastPlayerWidth=y.data.player_width,_._lastPlayerHeight=y.data.player_height,_._lastSourceWidth=y.data.video_source_width,_._lastSourceHeight=y.data.video_source_height})})});function so(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function _d(T,y,_){return y&&so(T.prototype,y),_&&so(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Td=_d(function T(y){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),this.isSeeking=!1,y.on("seeking",function(R,C){Object.assign(y.data,C),_._lastSeekingTime=Ue.now(),_.isSeeking===!1&&(_.isSeeking=!0,y.send("seeking"))}),y.on("seeked",function(){_.isSeeking=!1;var R=_._lastSeekingTime||Ue.now(),C=Ue.now()-R;W(y.data,"view_seek_count",1),W(y.data,"view_seek_duration",C);var O=y.data.view_max_seek_time||0;y.data.view_max_seek_time=Math.max(O,C)}),y.on("viewend",function(){_.isSeeking=!1})});function oo(T,y){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],$=!0,K=!1;try{for(C=C.call(_);!($=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);$=!0);}catch(Z){K=!0,x=Z}finally{try{$||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,y)||function(_,R){if(_){if(typeof _=="string")return gi(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?gi(_,R):void 0}}(T,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 gi(T,y){(y==null||y>T.length)&&(y=T.length);for(var _=0,R=new Array(y);_<y;_++)R[_]=T[_];return R}function lo(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var yi=function(T,y){T.push(y),T.sort(function(_,R){return _.viewer_time-R.viewer_time})},Fa=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Ad=function(){function T(C){var O=this;(function(G,$){if(!(G instanceof $))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.on("viewinit",function(){O.isAdBreak=!1,O._currentAdRequestNumber=0,O._currentAdResponseNumber=0,O._adRequests=[],O._adResponses=[],O._adHasPlayed=!1,O._wouldBeNewAdPlay=!0,O._prerollPlayTime=void 0}),Fa.forEach(function(G){return C.on(G,O._updateAdData.bind(O))});var x=function(){O.isAdBreak=!1};C.on("adbreakstart",function(){O.isAdBreak=!0}),C.on("play",x),C.on("playing",x),C.on("viewend",x),C.on("adrequest",function(G,$){$=Object.assign({ad_request_id:"generatedAdRequestId"+O._currentAdRequestNumber++},$),yi(O._adRequests,$),W(C.data,"view_ad_request_count"),O.inPrerollPosition()&&(C.data.view_preroll_requested=!0,O._adHasPlayed||W(C.data,"view_preroll_request_count"))}),C.on("adresponse",function(G,$){$=Object.assign({ad_request_id:"generatedAdRequestId"+O._currentAdResponseNumber++},$),yi(O._adResponses,$);var K=O.findAdRequest($.ad_request_id);K&&W(C.data,"view_ad_request_time",Math.max(0,$.viewer_time-K.viewer_time))}),C.on("adplay",function(G,$){O._adHasPlayed=!0,O._wouldBeNewAdPlay&&(O._wouldBeNewAdPlay=!1,W(C.data,"view_ad_played_count")),O.inPrerollPosition()&&!C.data.view_preroll_played&&(C.data.view_preroll_played=!0,O._adRequests.length>0&&(C.data.view_preroll_request_time=Math.max(0,$.viewer_time-O._adRequests[0].viewer_time)),C.data.view_start&&(C.data.view_startup_preroll_request_time=Math.max(0,$.viewer_time-C.data.view_start)),O._prerollPlayTime=$.viewer_time)}),C.on("adplaying",function(G,$){O.inPrerollPosition()&&C.data.view_preroll_load_time===void 0&&O._prerollPlayTime!==void 0&&(C.data.view_preroll_load_time=$.viewer_time-O._prerollPlayTime,C.data.view_startup_preroll_load_time=$.viewer_time-O._prerollPlayTime)}),C.on("adended",function(){O._wouldBeNewAdPlay=!0}),C.on("aderror",function(){O._wouldBeNewAdPlay=!0})}var y,_,R;return y=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(C){for(var O=0;O<this._adRequests.length;O++)if(this._adRequests[O].ad_request_id===C)return this._adRequests[O]}},{key:"_updateAdData",value:function(C,O){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&O.ad_tag_url){var x=oo(w(O.ad_tag_url),2),G=x[0],$=x[1];this.pm.data.view_preroll_ad_tag_domain=$,this.pm.data.view_preroll_ad_tag_hostname=G}if(!this.pm.data.view_preroll_ad_asset_hostname&&O.ad_asset_url){var K=oo(w(O.ad_asset_url),2),Z=K[0],xe=K[1];this.pm.data.view_preroll_ad_asset_domain=xe,this.pm.data.view_preroll_ad_asset_hostname=Z}}this.pm.data.ad_asset_url=O==null?void 0:O.ad_asset_url,this.pm.data.ad_tag_url=O==null?void 0:O.ad_tag_url,this.pm.data.ad_creative_id=O==null?void 0:O.ad_creative_id,this.pm.data.ad_id=O==null?void 0:O.ad_id,this.pm.data.ad_universal_id=O==null?void 0:O.ad_universal_id}}])&&lo(y.prototype,_),R&&lo(y,R),Object.defineProperty(y,"prototype",{writable:!1}),T}();function Un(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function xt(T,y,_){return y&&Un(T.prototype,y),_&&Un(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var uo=xt(function T(y){var _,R;(function(G,$){if(!(G instanceof $))throw new TypeError("Cannot call a class as a function")})(this,T);var C=function(){y.disableRebufferTracking||_&&(W(y.data,"view_waiting_rebuffer_duration",Ue.now()-_),_=!1,U().clearInterval(R))},O=!1,x=function(){O=!1,C()};y.on("waiting",function(){O&&(y.disableRebufferTracking||(W(y.data,"view_waiting_rebuffer_count",1),_=Ue.now(),R=U().setInterval(function(){if(_){var G=Ue.now();W(y.data,"view_waiting_rebuffer_duration",G-_),_=G}},250)))}),y.on("playing",function(){C(),O=!0}),y.on("pause",x),y.on("seeking",x)});function Be(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function co(T,y,_){return y&&Be(T.prototype,y),_&&Be(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Bn=co(function T(y){var _=this;(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T);var R=function(){_.lastWallClockTime=Ue.now(),y.on("before*",C)},C=function(O){var x=Ue.now(),G=_.lastWallClockTime;_.lastWallClockTime=x,x-G>3e4&&(y.emit("devicesleep",{viewer_time:G}),Object.assign(y.data,{viewer_time:G}),y.send("devicesleep"),y.emit("devicewake",{viewer_time:x}),Object.assign(y.data,{viewer_time:x}),y.send("devicewake"))};y.one("playbackheartbeat",R),y.on("playbackheartbeatend",function(){y.off("before*",C),y.one("playbackheartbeat",R)})}),je=M(375),Sd=M(655),Hn=M.n(Sd),Gn="muxData",ho=function(){var T;try{T=je.parse(Hn().get(Gn)||"")}catch{T={}}return T},er=function(T){try{Hn().set(Gn,je.stringify(T),{expires:7300})}catch{}},fo=function(){var T=ho();return T.mux_viewer_id=T.mux_viewer_id||z(),T.msn=T.msn||Math.random(),er(T),{mux_viewer_id:T.mux_viewer_id,mux_sample_number:T.msn}};function kd(T,y){var _=y.beaconCollectionDomain,R=y.beaconDomain;if(_)return"https://"+_;var C=R||"litix.io";return(T=T||"inferred").match(/^[a-z0-9]+$/)?"https://"+T+"."+C:"https://img.litix.io/a.gif"}var Vn=function(){var T;switch(Kn()){case"cellular":T="cellular";break;case"ethernet":T="wired";break;case"wifi":T="wifi";break;case void 0:break;default:T="other"}return T},Kn=function(){var T=U().navigator,y=T&&(T.connection||T.mozConnection||T.webkitConnection);return y&&y.type};Vn.getConnectionFromAPI=Kn;var wd=Vn,Ua=Wn({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"}),Ba=Wn({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",cl:"canceled",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",fa:"failed",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",ha:"has",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 Wn(T){var y={};for(var _ in T)T.hasOwnProperty(_)&&(y[T[_]]=_);return y}function Ha(T){var y={},_={};return Object.keys(T).forEach(function(R){var C=!1;if(T.hasOwnProperty(R)&&T[R]!==void 0){var O=R.split("_"),x=O[0],G=Ua[x];G||(Se.info("Data key word `"+O[0]+"` not expected in "+R),G=x+"_"),O.splice(1).forEach(function($){$==="url"&&(C=!0),Ba[$]?G+=Ba[$]:Number($)&&Math.floor(Number($))===Number($)?G+=$:(Se.info("Data key word `"+$+"` not expected in "+R),G+="_"+$+"_")}),C?_[G]=T[R]:y[G]=T[R]}}),Object.assign(y,_)}var zt={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},qn=["hb","requestcompleted","requestfailed","requestcanceled"],mo="https://img.litix.io",Vi=function(T){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=T||mo,this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},zt,y)};Vi.prototype.queueEvent=function(T,y){var _=Object.assign({},y);return(this._eventQueue.length<=this._options.maxQueueLength||T==="eventrateexceeded")&&(this._eventQueue.push(_),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},Vi.prototype.flushEvents=function(){var T=arguments.length>0&&arguments[0]!==void 0&&arguments[0];T&&this._eventQueue.length===1?this._eventQueue.pop():(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},Vi.prototype.destroy=function(){var T=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,T?this._clearBeaconQueue():this.flushEvents(),U().clearTimeout(this._sendTimeout)},Vi.prototype._clearBeaconQueue=function(){var T=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,y=this._eventQueue.slice(T);T>0&&Object.assign(y[y.length-1],Ha({mux_view_message:"event queue truncated"}));var _=this._createPayload(y);Ga(this._beaconUrl,_,!0,function(){})},Vi.prototype._sendBeaconQueue=function(){var T=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 _=this._createPayload(y),R=Ue.now();Ga(this._beaconUrl,_,!1,function(C,O){O?(T._eventQueue=y.concat(T._eventQueue),T._failureCount+=1,Se.info("Error sending beacon: "+O)):T._failureCount=0,T._roundTripTime=Ue.now()-R,T._postInFlight=!1})}},Vi.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var T=Math.pow(2,this._failureCount-1);return(1+(T*=Math.random()))*this._options.baseTimeBetweenBeacons},Vi.prototype._startBeaconSending=function(){var T=this;U().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=U().setTimeout(function(){T._eventQueue.length&&T._sendBeaconQueue(),T._startBeaconSending()},this._getNextBeaconTime()))},Vi.prototype._createPayload=function(T){var y,_,R,C=this,O={transmission_timestamp:Math.round(Ue.now())};this._roundTripTime&&(O.rtt_ms=Math.round(this._roundTripTime));var x=function(){y=JSON.stringify({metadata:O,events:_||T}),R=y.length/1024},G=function(){return R<=C._options.maxPayloadKBSize};return x(),G()||(Se.info("Payload size is too big ("+R+" kb). Removing unnecessary events."),_=T.filter(function($){return qn.indexOf($.e)===-1}),x()),G()||(Se.info("Payload size still too big ("+R+" kb). Cropping fields.."),_.forEach(function($){for(var K in $){var Z=$[K];typeof Z=="string"&&Z.length>51200&&($[K]=Z.substring(0,51200))}}),x()),y};var Ld=function(T){return T.length<=57344},Ga=function(T,y,_,R){if(_&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(T,y))R();else if(U().fetch)U().fetch(T,{method:"POST",body:y,headers:{"Content-Type":"text/plain"},keepalive:Ld(y)}).then(function(O){return R(null,O.ok?null:"Error")}).catch(function(O){return R(null,O)});else{if(U().XMLHttpRequest){var C=new(U()).XMLHttpRequest;return C.onreadystatechange=function(){if(C.readyState===4)return R(null,C.status!==200?"error":void 0)},C.open("POST",T),C.setRequestHeader("Content-Type","text/plain"),void C.send(y)}R()}},po=Vi;function vo(T,y){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],$=!0,K=!1;try{for(C=C.call(_);!($=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);$=!0);}catch(Z){K=!0,x=Z}finally{try{$||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,y)||function(_,R){if(_){if(typeof _=="string")return go(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?go(_,R):void 0}}(T,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
|
|
4
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ka(T,y){(y==null||y>T.length)&&(y=T.length);for(var _=0,R=new Array(y);_<y;_++)R[_]=T[_];return R}function So(T,y){for(var _=0;_<y.length;_++){var R=y[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Wa(T,y){return Wa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(_,R){return _.__proto__=R,_},Wa(T,y)}function ko(T){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 _,R=tr(T);if(y){var C=tr(this).constructor;_=Reflect.construct(R,arguments,C)}else _=R.apply(this,arguments);return Br(this,_)}}function Br(T,y){if(y&&(Ii(y)==="object"||typeof y=="function"))return y;if(y!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Tt(T)}function Tt(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}function tr(T){return tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(y){return y.__proto__||Object.getPrototypeOf(y)},tr(T)}var Id=["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"],oa=function(T){(function(x,G){if(typeof G!="function"&&G!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(G&&G.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),Object.defineProperty(x,"prototype",{writable:!1}),G&&Wa(x,G)})(O,T);var y,_,R,C=ko(O);function O(x,G,$){var K;(function(ge,De){if(!(ge instanceof De))throw new TypeError("Cannot call a class as a function")})(this,O),(K=C.call(this)).DOM_CONTENT_LOADED_EVENT_END=oe.domContentLoadedEventEnd(),K.NAVIGATION_START=oe.navigationStart(),K.mux=x,K.id=G,($=Object.assign({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(ge){return ge}},$)).data=$.data||{},$.data.property_key&&($.data.env_key=$.data.property_key,delete $.data.property_key),Se.setLevel($.debug?"debug":"warn"),K.getPlayheadTime=$.getPlayheadTime,K.getStateData=$.getStateData||function(){return{}},K.getAdData=$.getAdData||function(){},K.minimumRebufferDuration=$.minimumRebufferDuration,K.sustainedRebufferThreshold=$.sustainedRebufferThreshold,K.playbackHeartbeatTime=$.playbackHeartbeatTime,K.disableRebufferTracking=$.disableRebufferTracking,K.disableRebufferTracking&&K.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."),K.disablePlayheadRebufferTracking=$.disablePlayheadRebufferTracking,K.errorTranslator=$.errorTranslator,K.playbackEventDispatcher=new To(x,$.data.env_key,$),K.data={player_instance_id:z(),mux_sample_rate:$.sampleRate,beacon_domain:$.beaconCollectionDomain?$.beaconCollectionDomain:$.beaconDomain},K.data.view_sequence_number=1,K.data.player_sequence_number=1,K.oldEmit=K.emit,K.emit=function(ge,De){De=Object.assign({viewer_time:this.mux.utils.now()},De),this.oldEmit(ge,De)};var Z=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(Tt(K));K.on("viewinit",function(ge,De){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,De),this._initializeViewData(),this.one("play",Z),this.one("adbreakstart",Z)});var xe=function(ge){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",ge)}.bind(Tt(K));if(K.on("videochange",function(ge,De){xe(De)}),K.on("programchange",function(ge,De){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."),xe(Object.assign(De,{view_program_changed:!0})),Z(),this.emit("play"),this.emit("playing")}),K.on("fragmentchange",function(ge,De){this.currentFragmentPDT=De.currentFragmentPDT,this.currentFragmentStart=De.currentFragmentStart}),K.on("destroy",K.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var me=function(){var ge=K.data.view_start!==void 0;K.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",ge&&K.mux.WINDOW_HIDDEN&&(K.data.player_is_paused||K.emit("hb"))};window.addEventListener("visibilitychange",me,!1);var Ie=function(ge){ge.persisted||K.destroy()};window.addEventListener("pagehide",Ie,!1),K.on("destroy",function(){window.removeEventListener("visibilitychange",me),window.removeEventListener("pagehide",Ie)})}return K.on("playerready",function(ge,De){Object.assign(this.data,De)}),Id.forEach(function(ge){K.on(ge,function(De,ze){ge.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,ze),this._sanitizeData()}),K.on("after"+ge,function(){(ge!=="error"||this.errorTracker.viewErrored)&&this.send(ge)})}),K.on("viewend",function(ge,De){Object.assign(K.data,De)}),K.one("playerready",function(ge){var De=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=De-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}),K.longResumeTracker=new Li(Tt(K)),K.errorTracker=new jt(Tt(K)),new Bn(Tt(K)),K.seekingTracker=new Td(Tt(K)),K.playheadTime=new dt(Tt(K)),K.playbackHeartbeat=new Lt(Tt(K)),new bd(Tt(K)),K.watchTimeTracker=new ri(Tt(K)),new Or(Tt(K)),K.adTracker=new Ad(Tt(K)),new Na(Tt(K)),new Nr(Tt(K)),new ro(Tt(K)),new uo(Tt(K)),new ki(Tt(K)),$.hlsjs&&K.addHLSJS($),$.dashjs&&K.addDashJS($),K.emit("viewinit",$.data),K}return y=O,_=[{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(x){if(this.data.view_id){var G=Object.assign({},this.data);if(G.video_source_is_live===void 0&&(G.player_source_duration===1/0||G.video_source_duration===1/0?G.video_source_is_live=!0:(G.player_source_duration>0||G.video_source_duration>0)&&(G.video_source_is_live=!1)),G.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(xe){G[xe]=void 0}),G.video_source_url=G.video_source_url||G.player_source_url,G.video_source_url){var $=Ao(w(G.video_source_url),2),K=$[0],Z=$[1];G.video_source_domain=Z,G.video_source_hostname=K}delete G.ad_request_id,this.playbackEventDispatcher.send(x,G),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat(),x==="viewend"&&delete this.data.view_id}}},{key:"_updateStateData",value:function(){Object.assign(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var x=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(G){var $=parseInt(x.data[G],10);x.data[G]=isNaN($)?void 0:$}),["player_source_url","video_source_url"].forEach(function(G){if(x.data[G]){var $=x.data[G].toLowerCase();$.indexOf("data:")!==0&&$.indexOf("blob:")!==0||(x.data[G]="MSE style URL")}})}},{key:"_resetVideoData",value:function(x,G){var $=this;Object.keys(this.data).forEach(function(K){K.indexOf("video_")===0&&delete $.data[K]})}},{key:"_resetViewData",value:function(){var x=this;Object.keys(this.data).forEach(function(G){G.indexOf("view_")===0&&delete x.data[G]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(x,G){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var x=this,G=this.data.view_id=z(),$=function(){G===x.data.view_id&&W(x.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",$):$()}},{key:"_restartHeartBeat",value:function(){var x=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){x.data.player_is_paused||x.emit("hb")},1e4))}},{key:"addHLSJS",value:function(x){x.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=x.hlsjs,function(G,$,K){var Z=arguments.length>4?arguments[4]:void 0,xe=G.log,me=G.utils.secondsToMs,Ie=function(Qe){var de,we=parseInt(Z.version);return we===1&&Qe.programDateTime!==null&&(de=Qe.programDateTime),we===0&&Qe.pdt!==null&&(de=Qe.pdt),de};if(oe.exists()){var ge=function(Qe,de){return G.emit($,Qe,de)},De=function(Qe,de){var we=de.levels,ce=de.audioTracks,He=de.url,Ve=de.stats,At=de.networkDetails,Xt=de.sessionData,wt={},Kt={};we.forEach(function(mt,ai){wt[ai]={width:mt.width,height:mt.height,bitrate:mt.bitrate,attrs:mt.attrs}}),ce.forEach(function(mt,ai){Kt[ai]={name:mt.name,language:mt.lang,bitrate:mt.bitrate}});var nt=Je(Ve),Le=nt.bytesLoaded,Ri=nt.requestStart,Di=nt.responseStart,di=nt.responseEnd;ge("requestcompleted",it(it({},ot(Xt)),{},{request_event_type:Qe,request_bytes_loaded:Le,request_start:Ri,request_response_start:Di,request_response_end:di,request_type:"manifest",request_hostname:le(He),request_response_headers:Vt(At),request_rendition_lists:{media:wt,audio:Kt,video:{}}}))};K.on(Z.Events.MANIFEST_LOADED,De);var ze=function(Qe,de){var we=de.details,ce=de.level,He=de.networkDetails,Ve=de.stats,At=Je(Ve),Xt=At.bytesLoaded,wt=At.requestStart,Kt=At.responseStart,nt=At.responseEnd,Le=we.fragments[we.fragments.length-1],Ri=Ie(Le)+me(Le.duration);ge("requestcompleted",{request_event_type:Qe,request_bytes_loaded:Xt,request_start:wt,request_response_start:Kt,request_response_end:nt,request_current_level:ce,request_type:"manifest",request_hostname:le(we.url),request_response_headers:Vt(He),video_holdback:we.holdBack&&me(we.holdBack),video_part_holdback:we.partHoldBack&&me(we.partHoldBack),video_part_target_duration:we.partTarget&&me(we.partTarget),video_target_duration:we.targetduration&&me(we.targetduration),video_source_is_live:we.live,player_manifest_newest_program_time:isNaN(Ri)?void 0:Ri})};K.on(Z.Events.LEVEL_LOADED,ze);var ut=function(Qe,de){var we=de.details,ce=de.networkDetails,He=de.stats,Ve=Je(He),At=Ve.bytesLoaded,Xt=Ve.requestStart,wt=Ve.responseStart,Kt=Ve.responseEnd;ge("requestcompleted",{request_event_type:Qe,request_bytes_loaded:At,request_start:Xt,request_response_start:wt,request_response_end:Kt,request_type:"manifest",request_hostname:le(we.url),request_response_headers:Vt(ce)})};K.on(Z.Events.AUDIO_TRACK_LOADED,ut);var Pt=function(Qe,de){var we=de.stats,ce=de.networkDetails,He=de.frag;we=we||He.stats;var Ve=Je(we),At=Ve.bytesLoaded,Xt=Ve.requestStart,wt=Ve.responseStart,Kt=Ve.responseEnd,nt=ce?Vt(ce):void 0,Le={request_event_type:Qe,request_bytes_loaded:At,request_start:Xt,request_response_start:wt,request_response_end:Kt,request_hostname:ce?le(ce.responseURL):void 0,request_id:nt?et(nt):void 0,request_response_headers:nt,request_media_duration:He.duration,request_url:ce==null?void 0:ce.responseURL};He.type==="main"?(Le.request_type="media",Le.request_current_level=He.level,Le.request_video_width=(K.levels[He.level]||{}).width,Le.request_video_height=(K.levels[He.level]||{}).height,Le.request_labeled_bitrate=(K.levels[He.level]||{}).bitrate):Le.request_type=He.type,ge("requestcompleted",Le)};K.on(Z.Events.FRAG_LOADED,Pt);var Qt=function(Qe,de){var we=de.frag,ce=we.start,He={currentFragmentPDT:Ie(we),currentFragmentStart:me(ce)};ge("fragmentchange",He)};K.on(Z.Events.FRAG_CHANGED,Qt);var li=function(Qe,de){var we=de.type,ce=de.details,He=de.response,Ve=de.fatal,At=de.frag,Xt=de.networkDetails,wt=(At==null?void 0:At.url)||de.url||"",Kt=Xt?Vt(Xt):void 0;if(ce!==Z.ErrorDetails.MANIFEST_LOAD_ERROR&&ce!==Z.ErrorDetails.MANIFEST_LOAD_TIMEOUT&&ce!==Z.ErrorDetails.FRAG_LOAD_ERROR&&ce!==Z.ErrorDetails.FRAG_LOAD_TIMEOUT&&ce!==Z.ErrorDetails.LEVEL_LOAD_ERROR&&ce!==Z.ErrorDetails.LEVEL_LOAD_TIMEOUT&&ce!==Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&ce!==Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT&&ce!==Z.ErrorDetails.SUBTITLE_LOAD_ERROR&&ce!==Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT&&ce!==Z.ErrorDetails.KEY_LOAD_ERROR&&ce!==Z.ErrorDetails.KEY_LOAD_TIMEOUT||ge("requestfailed",{request_error:ce,request_url:wt,request_hostname:le(wt),request_id:Kt?et(Kt):void 0,request_type:ce===Z.ErrorDetails.FRAG_LOAD_ERROR||ce===Z.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":ce===Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||ce===Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":ce===Z.ErrorDetails.SUBTITLE_LOAD_ERROR||ce===Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":ce===Z.ErrorDetails.KEY_LOAD_ERROR||ce===Z.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:He==null?void 0:He.code,request_error_text:He==null?void 0:He.text}),Ve){var nt,Le="".concat(wt?"url: ".concat(wt,`
|
|
5
|
-
`):"")+"".concat(
|
|
1
|
+
"use strict";(()=>{var Bg=Object.create;var vf=Object.defineProperty;var Hg=Object.getOwnPropertyDescriptor;var Gg=Object.getOwnPropertyNames;var Vg=Object.getPrototypeOf,Kg=Object.prototype.hasOwnProperty;var gf=(n,a)=>()=>(a||n((a={exports:{}}).exports,a),a.exports);var Wg=(n,a,l,m)=>{if(a&&typeof a=="object"||typeof a=="function")for(let v of Gg(a))!Kg.call(n,v)&&v!==l&&vf(n,v,{get:()=>a[v],enumerable:!(m=Hg(a,v))||m.enumerable});return n};var yf=(n,a,l)=>(l=n!=null?Bg(Vg(n)):{},Wg(a||!n||!n.__esModule?vf(l,"default",{value:n,enumerable:!0}):l,n));var gu=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)};var at=(n,a,l)=>(gu(n,a,"read from private field"),l?l.call(n):a.get(n)),Dt=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Oi=(n,a,l,m)=>(gu(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l);var Gt=(n,a,l)=>(gu(n,a,"access private method"),l);var Jm=gf((jl,xc)=>{(function(){var n,a;n=this,a=function(){return function(){var l={80:function(E,I,M){E.exports=M(728).default},728:function(E,I,M){"use strict";M.d(I,{default:function(){return ns}});var B=M(48),F=M.n(B),Q=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(T){var g=16*Math.random()|0;return(T==="x"?g:3&g|8).toString(16)})},re=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},te=function(T){return T&&T.nodeName!==void 0?(T.muxId||(T.muxId=T.id||re()),T.muxId):T},se=function(T){var g;T&&T.nodeName!==void 0?T=te(g=T):g=document.querySelector(T);var _=g&&g.nodeName?g.nodeName.toLowerCase():"";return[g,T,_]},pe=M(640),Ae=M.n(pe),ke=Ae().methodFactory;Ae().methodFactory=function(T,g,_){var R=ke(T,g,_);return function(){for(var C=["[mux]"],O=0;O<arguments.length;O++)C.push(arguments[O]);R.apply(void 0,C)}},Ae().setLevel(Ae().getLevel());var we=Ae();function nt(){return(F().doNotTrack||F().navigator&&F().navigator.doNotTrack)==="1"}var Ue={now:function(){var T=F().performance,g=T&&T.timing,_=g&&g.navigationStart,R=typeof _=="number"&&typeof T.now=="function"?_+T.now():Date.now();return Math.round(R)}},st=function(T){return dt(T)[0]},dt=function(T){if(typeof T!="string"||T==="")return["localhost"];var g,_=(T.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return _&&(g=(_.match(/[^\.]+\.[^\.]+$/)||[])[0]),[_,g]},oe={exists:function(){var T=F().performance;return(T&&T.timing)!==void 0},domContentLoadedEventEnd:function(){var T=F().performance,g=T&&T.timing;return g&&g.domContentLoadedEventEnd},navigationStart:function(){var T=F().performance,g=T&&T.timing;return g&&g.navigationStart}};function w(T,g,_){_=_===void 0?1:_,T[g]=T[g]||0,T[g]+=_}var le=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],$=["x-cdn","content-type"].concat(le);function Ie(T){var g={};return(T=T||"").trim().split(/[\r\n]+/).forEach(function(_){if(_){var R=_.split(": "),C=R.shift();C&&($.indexOf(C.toLowerCase())>=0||C.toLowerCase().indexOf("x-litix-")===0)&&(g[C]=R.join(": "))}}),g}function $e(T){if(T){var g=le.find(function(_){return T[_]!==void 0});return g?T[g]:void 0}}var tt=function(T){var g={};for(var _ in T){var R=T[_];R["DATA-ID"].search("io.litix.data.")!==-1&&(g[R["DATA-ID"].replace("io.litix.data.","")]=R.VALUE)}return g};function Bt(T,g){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);g&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function Je(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?Bt(Object(_),!0).forEach(function(R){H(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):Bt(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function H(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var ri=function(T){if(!T)return{};var g=oe.navigationStart(),_=T.loading,R=_?_.start:T.trequest,C=_?_.first:T.tfirst,O=_?_.end:T.tload;return{bytesLoaded:T.total,requestStart:Math.round(g+R),responseStart:Math.round(g+C),responseEnd:Math.round(g+O)}},Ht=function(T){if(T&&typeof T.getAllResponseHeaders=="function")return Ie(T.getAllResponseHeaders())};function it(T,g){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);g&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function Qt(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?it(Object(_),!0).forEach(function(R){Ke(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):it(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function Ke(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var xt=function(T,g){if(!T||typeof T.getRequests!="function")return{};var _=T.getRequests({state:"executed"});if(_.length===0)return{};var R,C=_[_.length-1],O=st(C.url),x=C.url,G=C.bytesLoaded,Y=new Date(C.requestStartDate).getTime(),K=new Date(C.firstByteDate).getTime(),Z=new Date(C.requestEndDate).getTime(),Oe=isNaN(C.duration)?0:C.duration,ye=typeof g.getMetricsFor=="function"?g.getMetricsFor(C.mediaType).HttpList:g.getDashMetrics().getHttpRequests(C.mediaType);return ye.length>0&&(R=Ie(ye[ye.length-1]._responseHeaders||"")),{requestStart:Y,requestResponseStart:K,requestResponseEnd:Z,requestBytesLoaded:G,requestResponseHeaders:R,requestMediaDuration:Oe,requestHostname:O,requestUrl:x,requestId:R?$e(R):void 0}},ht=function(T,g){var _=g.getQualityFor(T),R=g.getCurrentTrackFor(T).bitrateList;return R?{currentLevel:_,renditionWidth:R[_].width||null,renditionHeight:R[_].height||null,renditionBitrate:R[_].bandwidth}:{}},Tt=function(T){var g;return(g=T.match(/.*codecs\*?="(.*)"/))===null||g===void 0?void 0:g[1]};function Qi(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var J=0,Ee=function(){function T(){(function(C,O){if(!(C instanceof O))throw new TypeError("Cannot call a class as a function")})(this,T)}var g,_,R;return g=T,_=[{key:"on",value:function(C,O,x){return O._eventEmitterGuid=O._eventEmitterGuid||++J,this._listeners=this._listeners||{},this._listeners[C]=this._listeners[C]||[],x&&(O=O.bind(x)),this._listeners[C].push(O),O}},{key:"off",value:function(C,O){var x=this._listeners&&this._listeners[C];x&&x.forEach(function(G,Y){G._eventEmitterGuid===O._eventEmitterGuid&&x.splice(Y,1)})}},{key:"one",value:function(C,O,x){var G=this;O._eventEmitterGuid=O._eventEmitterGuid||++J;var Y=function K(){G.off(C,K),O.apply(x||this,arguments)};Y._eventEmitterGuid=O._eventEmitterGuid,this.on(C,Y)}},{key:"emit",value:function(C,O){var x=this;if(this._listeners){O=O||{};var G=this._listeners["before*"]||[],Y=this._listeners[C]||[],K=this._listeners["after"+C]||[],Z=function(Oe,ye){(Oe=Oe.slice()).forEach(function(Se){Se.call(x,{type:C},ye)})};Z(G,O),Z(Y,O),Z(K,O)}}}],_&&Qi(g.prototype,_),R&&Qi(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}(),rt=Ee;function bt(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var _t=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,C.on("playing",function(){O._playheadShouldBeProgressing=!0}),C.on("play",this._startPlaybackHeartbeatInterval.bind(this)),C.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),C.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),C.on("seeking",this._startPlaybackHeartbeatInterval.bind(this)),C.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),C.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),C.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),C.on("seeked",function(){C.data.player_is_paused?O._stopPlaybackHeartbeatInterval():O._startPlaybackHeartbeatInterval()}),C.on("timeupdate",function(){O._playbackHeartbeatInterval!==null&&C.emit("playbackheartbeat")}),C.on("devicesleep",function(x,G){O._playbackHeartbeatInterval!==null&&(F().clearInterval(O._playbackHeartbeatInterval),C.emit("playbackheartbeatend",{viewer_time:G.viewer_time}),O._playbackHeartbeatInterval=null)})}var g,_,R;return g=T,(_=[{key:"_startPlaybackHeartbeatInterval",value:function(){var C=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=F().setInterval(function(){C.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(F().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&bt(g.prototype,_),R&&bt(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function ai(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Gi(T,g,_){return g&&ai(T.prototype,g),_&&ai(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var je=Gi(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),g.on("viewinit",function(){_.viewErrored=!1}),g.on("error",function(R,C){try{var O=g.errorTranslator({player_error_code:C.player_error_code,player_error_message:C.player_error_message,player_error_context:C.player_error_context});O?(g.data.player_error_code=O.player_error_code||C.player_error_code,g.data.player_error_message=O.player_error_message||C.player_error_message,g.data.player_error_context=O.player_error_context||C.player_error_context,_.viewErrored=!0):(delete g.data.player_error_code,delete g.data.player_error_message,delete g.data.player_error_context)}catch(x){g.mux.log.warn("Exception in error translator callback.",x),_.viewErrored=!0}})});function di(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var ui=function(){function T(C){(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._watchTimeTrackerLastCheckedTime=null,C.on("playbackheartbeat",this._updateWatchTime.bind(this)),C.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}var g,_,R;return g=T,(_=[{key:"_updateWatchTime",value:function(C,O){var x=O.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=x),w(this.pm.data,"view_watch_time",x-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=x}},{key:"_clearWatchTimeState",value:function(C,O){this._updateWatchTime(C,O),this._watchTimeTrackerLastCheckedTime=null}}])&&di(g.prototype,_),R&&di(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function Vi(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Xi=function(){function T(C){(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,this._playbackTimeTrackerLastPlayheadPosition=-1,C.on("playbackheartbeat",this._updatePlaybackTime.bind(this)),C.on("playbackheartbeatend",this._clearPlaybackTimeState.bind(this)),C.on("seeking",this._clearPlaybackTimeState.bind(this))}var g,_,R;return g=T,(_=[{key:"_updatePlaybackTime",value:function(){var C=this.pm.data.player_playhead_time;if(this._playbackTimeTrackerLastPlayheadPosition>=0&&C>this._playbackTimeTrackerLastPlayheadPosition){var O=C-this._playbackTimeTrackerLastPlayheadPosition;O<=1e3&&w(this.pm.data,"view_content_playback_time",O)}this._playbackTimeTrackerLastPlayheadPosition=C}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&Vi(g.prototype,_),R&&Vi(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function ci(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var ut=function(){function T(C){(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C;var O=this._updatePlayheadTime.bind(this);C.on("playbackheartbeat",O),C.on("playbackheartbeatend",O),C.on("timeupdate",O),C.on("destroy",function(){C.off("timeupdate",O)})}var g,_,R;return g=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(C,O){var x=this,G=function(){x.pm.currentFragmentPDT&&x.pm.currentFragmentStart&&(x.pm.data.player_program_time=x.pm.currentFragmentPDT+x.pm.data.player_playhead_time-x.pm.currentFragmentStart)};if(O&&O.player_playhead_time)this.pm.data.player_playhead_time=O.player_playhead_time,G(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var Y=this.pm.getPlayheadTime();Y!==void 0&&(this.pm.data.player_playhead_time=Y,G(),this._updateMaxPlayheadPosition())}}}])&&ci(g.prototype,_),R&&ci(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function Zi(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function ur(T,g,_){return g&&Zi(T.prototype,g),_&&Zi(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Nr=3e5,Li=ur(function T(g){if(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")}(this,T),!g.disableRebufferTracking){var _,R=function(O,x){C(x),_=void 0},C=function(O){if(_){var x=O.viewer_time-_;w(g.data,"view_rebuffer_duration",x),_=O.viewer_time,g.data.view_rebuffer_duration>Nr&&(g.emit("viewend"),g.send("viewend"),g.mux.log.warn("Ending view after rebuffering for longer than ".concat(Nr,"ms, future events will be ignored unless a programchange or videochange occurs.")))}g.data.view_watch_time>=0&&g.data.view_rebuffer_count>0&&(g.data.view_rebuffer_frequency=g.data.view_rebuffer_count/g.data.view_watch_time,g.data.view_rebuffer_percentage=g.data.view_rebuffer_duration/g.data.view_watch_time)};g.on("playbackheartbeat",function(O,x){return C(x)}),g.on("rebufferstart",function(O,x){_||(w(g.data,"view_rebuffer_count",1),_=x.viewer_time,g.one("rebufferend",R))}),g.on("viewinit",function(){_=void 0,g.off("rebufferend",R)})}});function cr(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Hn=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.disableRebufferTracking||C.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,C.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),C.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),C.on("seeking",function(){O._cleanupRebufferTracker(null,{viewer_time:Ue.now()})}))}var g,_,R;return g=T,_=[{key:"_checkIfRebuffering",value:function(C,O){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)this._cleanupRebufferTracker(C,O);else if(this._lastCheckedTime!==null)if(this._lastPlayheadTime===this.pm.data.player_playhead_time){var x=O.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&x>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=O.viewer_time}else this._cleanupRebufferTracker(C,O,!0);else this._prepareRebufferTrackerState(O.viewer_time)}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(C){this._lastCheckedTime=C,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=C}},{key:"_cleanupRebufferTracker",value:function(C,O){var x=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:O.viewer_time});else{if(this._lastCheckedTime===null)return;var G=this.pm.data.player_playhead_time-this._lastPlayheadTime,Y=O.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&G>0&&Y-G>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+Y-G}))}x?this._prepareRebufferTrackerState(O.viewer_time):this._clearRebufferTrackerState()}}],_&&cr(g.prototype,_),R&&cr(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}(),so=Hn;function la(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Ya=function(){function T(C){var O=this;(function(x,G){if(!(x instanceof G))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.on("viewinit",function(){var x=C.data,G=x.view_id;if(!x.view_program_changed){var Y=function(K,Z){var Oe=Z.viewer_time;K.type==="playing"&&C.data.view_time_to_first_frame===void 0?O.calculateTimeToFirstFrame(Oe||Ue.now(),G):K.type!=="adplaying"||C.data.view_time_to_first_frame!==void 0&&!O._inPrerollPosition()||O.calculateTimeToFirstFrame(Oe||Ue.now(),G)};C.one("playing",Y),C.one("adplaying",Y),C.one("viewend",function(){C.off("playing",Y),C.off("adplaying",Y)})}})}var g,_,R;return g=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(C,O){O===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:C}),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))}}])&&la(g.prototype,_),R&&la(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function oo(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function lo(T,g,_){return g&&oo(T.prototype,g),_&&oo(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Id=lo(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),g.on("viewinit",function(){_._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb"].forEach(function(R){g.on(R,function(){if(_._lastPlayheadPosition>=0&&g.data.player_playhead_time>=0&&_._lastPlayerWidth>=0&&_._lastSourceWidth>0&&_._lastPlayerHeight>=0&&_._lastSourceHeight>0){var C=g.data.player_playhead_time-_._lastPlayheadPosition;if(C<0)return void(_._lastPlayheadPosition=-1);var O=Math.min(_._lastPlayerWidth/_._lastSourceWidth,_._lastPlayerHeight/_._lastSourceHeight),x=Math.max(0,O-1),G=Math.max(0,1-O);g.data.view_max_upscale_percentage=Math.max(g.data.view_max_upscale_percentage||0,x),g.data.view_max_downscale_percentage=Math.max(g.data.view_max_downscale_percentage||0,G),w(g.data,"view_total_content_playback_time",C),w(g.data,"view_total_upscaling",x*C),w(g.data,"view_total_downscaling",G*C)}_._lastPlayheadPosition=-1})}),["playing","hb"].forEach(function(R){g.on(R,function(){_._lastPlayheadPosition=g.data.player_playhead_time,_._lastPlayerWidth=g.data.player_width,_._lastPlayerHeight=g.data.player_height,_._lastSourceWidth=g.data.video_source_width,_._lastSourceHeight=g.data.video_source_height})})});function Gn(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Rd(T,g,_){return g&&Gn(T.prototype,g),_&&Gn(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Dd=Rd(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),this.isSeeking=!1,g.on("seeking",function(R,C){Object.assign(g.data,C),_._lastSeekingTime=Ue.now(),_.isSeeking===!1&&(_.isSeeking=!0,g.send("seeking"))}),g.on("seeked",function(){_.isSeeking=!1;var R=_._lastSeekingTime||Ue.now(),C=Ue.now()-R;w(g.data,"view_seek_count",1),w(g.data,"view_seek_duration",C);var O=g.data.view_max_seek_time||0;g.data.view_max_seek_time=Math.max(O,C)}),g.on("viewend",function(){_.isSeeking=!1})});function uo(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],Y=!0,K=!1;try{for(C=C.call(_);!(Y=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);Y=!0);}catch(Z){K=!0,x=Z}finally{try{Y||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return co(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?co(_,R):void 0}}(T,g)||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 co(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function ho(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}var Ei=function(T,g){T.push(g),T.sort(function(_,R){return _.viewer_time-R.viewer_time})},Cd=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Ii=function(){function T(C){var O=this;(function(G,Y){if(!(G instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,T),this.pm=C,C.on("viewinit",function(){O.isAdBreak=!1,O._currentAdRequestNumber=0,O._currentAdResponseNumber=0,O._adRequests=[],O._adResponses=[],O._adHasPlayed=!1,O._wouldBeNewAdPlay=!0,O._prerollPlayTime=void 0}),Cd.forEach(function(G){return C.on(G,O._updateAdData.bind(O))});var x=function(){O.isAdBreak=!1};C.on("adbreakstart",function(){O.isAdBreak=!0}),C.on("play",x),C.on("playing",x),C.on("viewend",x),C.on("adrequest",function(G,Y){Y=Object.assign({ad_request_id:"generatedAdRequestId"+O._currentAdRequestNumber++},Y),Ei(O._adRequests,Y),w(C.data,"view_ad_request_count"),O.inPrerollPosition()&&(C.data.view_preroll_requested=!0,O._adHasPlayed||w(C.data,"view_preroll_request_count"))}),C.on("adresponse",function(G,Y){Y=Object.assign({ad_request_id:"generatedAdRequestId"+O._currentAdResponseNumber++},Y),Ei(O._adResponses,Y);var K=O.findAdRequest(Y.ad_request_id);K&&w(C.data,"view_ad_request_time",Math.max(0,Y.viewer_time-K.viewer_time))}),C.on("adplay",function(G,Y){O._adHasPlayed=!0,O._wouldBeNewAdPlay&&(O._wouldBeNewAdPlay=!1,w(C.data,"view_ad_played_count")),O.inPrerollPosition()&&!C.data.view_preroll_played&&(C.data.view_preroll_played=!0,O._adRequests.length>0&&(C.data.view_preroll_request_time=Math.max(0,Y.viewer_time-O._adRequests[0].viewer_time)),C.data.view_start&&(C.data.view_startup_preroll_request_time=Math.max(0,Y.viewer_time-C.data.view_start)),O._prerollPlayTime=Y.viewer_time)}),C.on("adplaying",function(G,Y){O.inPrerollPosition()&&C.data.view_preroll_load_time===void 0&&O._prerollPlayTime!==void 0&&(C.data.view_preroll_load_time=Y.viewer_time-O._prerollPlayTime,C.data.view_startup_preroll_load_time=Y.viewer_time-O._prerollPlayTime)}),C.on("adended",function(){O._wouldBeNewAdPlay=!0}),C.on("aderror",function(){O._wouldBeNewAdPlay=!0})}var g,_,R;return g=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(C){for(var O=0;O<this._adRequests.length;O++)if(this._adRequests[O].ad_request_id===C)return this._adRequests[O]}},{key:"_updateAdData",value:function(C,O){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&O.ad_tag_url){var x=uo(dt(O.ad_tag_url),2),G=x[0],Y=x[1];this.pm.data.view_preroll_ad_tag_domain=Y,this.pm.data.view_preroll_ad_tag_hostname=G}if(!this.pm.data.view_preroll_ad_asset_hostname&&O.ad_asset_url){var K=uo(dt(O.ad_asset_url),2),Z=K[0],Oe=K[1];this.pm.data.view_preroll_ad_asset_domain=Oe,this.pm.data.view_preroll_ad_asset_hostname=Z}}this.pm.data.ad_asset_url=O==null?void 0:O.ad_asset_url,this.pm.data.ad_tag_url=O==null?void 0:O.ad_tag_url,this.pm.data.ad_creative_id=O==null?void 0:O.ad_creative_id,this.pm.data.ad_id=O==null?void 0:O.ad_id,this.pm.data.ad_universal_id=O==null?void 0:O.ad_universal_id}}])&&ho(g.prototype,_),R&&ho(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function da(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Md(T,g,_){return g&&da(T.prototype,g),_&&da(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var fo=Md(function T(g){var _,R;(function(G,Y){if(!(G instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,T);var C=function(){g.disableRebufferTracking||_&&(w(g.data,"view_waiting_rebuffer_duration",Ue.now()-_),_=!1,F().clearInterval(R))},O=!1,x=function(){O=!1,C()};g.on("waiting",function(){O&&(g.disableRebufferTracking||(w(g.data,"view_waiting_rebuffer_count",1),_=Ue.now(),R=F().setInterval(function(){if(_){var G=Ue.now();w(g.data,"view_waiting_rebuffer_duration",G-_),_=G}},250)))}),g.on("playing",function(){C(),O=!0}),g.on("pause",x),g.on("seeking",x)});function At(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function mo(T,g,_){return g&&At(T.prototype,g),_&&At(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Fe=mo(function T(g){var _=this;(function(O,x){if(!(O instanceof x))throw new TypeError("Cannot call a class as a function")})(this,T);var R=function(){_.lastWallClockTime=Ue.now(),g.on("before*",C)},C=function(O){var x=Ue.now(),G=_.lastWallClockTime;_.lastWallClockTime=x,x-G>3e4&&(g.emit("devicesleep",{viewer_time:G}),Object.assign(g.data,{viewer_time:G}),g.send("devicesleep"),g.emit("devicewake",{viewer_time:x}),Object.assign(g.data,{viewer_time:x}),g.send("devicewake"))};g.one("playbackheartbeat",R),g.on("playbackheartbeatend",function(){g.off("before*",C),g.one("playbackheartbeat",R)})}),Vn=M(375),Kn=M(655),ze=M.n(Kn),po="muxData",Wn=function(){var T;try{T=Vn.parse(ze().get(po)||"")}catch{T={}}return T},qn=function(T){try{ze().set(po,Vn.stringify(T),{expires:7300})}catch{}},xd=function(){var T=Wn();return T.mux_viewer_id=T.mux_viewer_id||Q(),T.msn=T.msn||Math.random(),qn(T),{mux_viewer_id:T.mux_viewer_id,mux_sample_number:T.msn}};function hr(T,g){var _=g.beaconCollectionDomain,R=g.beaconDomain;if(_)return"https://"+_;var C=R||"litix.io";return(T=T||"inferred").match(/^[a-z0-9]+$/)?"https://"+T+"."+C:"https://img.litix.io/a.gif"}var Yn=function(){var T;switch(vo()){case"cellular":T="cellular";break;case"ethernet":T="wired";break;case"wifi":T="wifi";break;case void 0:break;default:T="other"}return T},vo=function(){var T=F().navigator,g=T&&(T.connection||T.mozConnection||T.webkitConnection);return g&&g.type};Yn.getConnectionFromAPI=vo;var go=Yn,yo=ua({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"}),Eo=ua({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",cl:"canceled",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",fa:"failed",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",ha:"has",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 ua(T){var g={};for(var _ in T)T.hasOwnProperty(_)&&(g[T[_]]=_);return g}function ca(T){var g={},_={};return Object.keys(T).forEach(function(R){var C=!1;if(T.hasOwnProperty(R)&&T[R]!==void 0){var O=R.split("_"),x=O[0],G=yo[x];G||(we.info("Data key word `"+O[0]+"` not expected in "+R),G=x+"_"),O.splice(1).forEach(function(Y){Y==="url"&&(C=!0),Eo[Y]?G+=Eo[Y]:Number(Y)&&Math.floor(Number(Y))===Number(Y)?G+=Y:(we.info("Data key word `"+Y+"` not expected in "+R),G+="_"+Y+"_")}),C?_[G]=T[R]:g[G]=T[R]}}),Object.assign(g,_)}var bo={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},_o=["hb","requestcompleted","requestfailed","requestcanceled"],Xt="https://img.litix.io",bi=function(T){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=T||Xt,this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},bo,g)};bi.prototype.queueEvent=function(T,g){var _=Object.assign({},g);return(this._eventQueue.length<=this._options.maxQueueLength||T==="eventrateexceeded")&&(this._eventQueue.push(_),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},bi.prototype.flushEvents=function(){var T=arguments.length>0&&arguments[0]!==void 0&&arguments[0];T&&this._eventQueue.length===1?this._eventQueue.pop():(this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending())},bi.prototype.destroy=function(){var T=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,T?this._clearBeaconQueue():this.flushEvents(),F().clearTimeout(this._sendTimeout)},bi.prototype._clearBeaconQueue=function(){var T=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,g=this._eventQueue.slice(T);T>0&&Object.assign(g[g.length-1],ca({mux_view_message:"event queue truncated"}));var _=this._createPayload(g);Ao(this._beaconUrl,_,!0,function(){})},bi.prototype._sendBeaconQueue=function(){var T=this;if(!this._postInFlight){var g=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var _=this._createPayload(g),R=Ue.now();Ao(this._beaconUrl,_,!1,function(C,O){O?(T._eventQueue=g.concat(T._eventQueue),T._failureCount+=1,we.info("Error sending beacon: "+O)):T._failureCount=0,T._roundTripTime=Ue.now()-R,T._postInFlight=!1})}},bi.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var T=Math.pow(2,this._failureCount-1);return(1+(T*=Math.random()))*this._options.baseTimeBetweenBeacons},bi.prototype._startBeaconSending=function(){var T=this;F().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=F().setTimeout(function(){T._eventQueue.length&&T._sendBeaconQueue(),T._startBeaconSending()},this._getNextBeaconTime()))},bi.prototype._createPayload=function(T){var g,_,R,C=this,O={transmission_timestamp:Math.round(Ue.now())};this._roundTripTime&&(O.rtt_ms=Math.round(this._roundTripTime));var x=function(){g=JSON.stringify({metadata:O,events:_||T}),R=g.length/1024},G=function(){return R<=C._options.maxPayloadKBSize};return x(),G()||(we.info("Payload size is too big ("+R+" kb). Removing unnecessary events."),_=T.filter(function(Y){return _o.indexOf(Y.e)===-1}),x()),G()||(we.info("Payload size still too big ("+R+" kb). Cropping fields.."),_.forEach(function(Y){for(var K in Y){var Z=Y[K];typeof Z=="string"&&Z.length>51200&&(Y[K]=Z.substring(0,51200))}}),x()),g};var To=function(T){return T.length<=57344},Ao=function(T,g,_,R){if(_&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(T,g))R();else if(F().fetch)F().fetch(T,{method:"POST",body:g,headers:{"Content-Type":"text/plain"},keepalive:To(g)}).then(function(O){return R(null,O.ok?null:"Error")}).catch(function(O){return R(null,O)});else{if(F().XMLHttpRequest){var C=new(F()).XMLHttpRequest;return C.onreadystatechange=function(){if(C.readyState===4)return R(null,C.status!==200?"error":void 0)},C.open("POST",T),C.setRequestHeader("Content-Type","text/plain"),void C.send(g)}R()}},$a=bi;function Pd(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],Y=!0,K=!1;try{for(C=C.call(_);!(Y=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);Y=!0);}catch(Z){K=!0,x=Z}finally{try{Y||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return $n(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?$n(_,R):void 0}}(T,g)||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 $n(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function ja(T,g){var _=Object.keys(T);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(T);g&&(R=R.filter(function(C){return Object.getOwnPropertyDescriptor(T,C).enumerable})),_.push.apply(_,R)}return _}function fr(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?ja(Object(_),!0).forEach(function(R){za(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):ja(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function Fr(T){return Fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},Fr(T)}function Od(T,g){if(!(T instanceof g))throw new TypeError("Cannot call a class as a function")}function jn(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function za(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var ha=["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"],So=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse"],ko=["viewstart","error","ended","viewend"],Nd=function(){function T(C,O){var x,G,Y,K,Z,Oe,ye,Se,be,Re,Ge,kt,Pt,Wt,ni,Be=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Od(this,T),za(this,"previousBeaconData",null),za(this,"lastEventTime",0),za(this,"rateLimited",!1),this.mux=C,this.envKey=O,this.options=Be,this.eventQueue=new $a(hr(this.envKey,this.options)),this.sampleRate=(x=this.options.sampleRate)!==null&&x!==void 0?x:1,this.disableCookies=(G=this.options.disableCookies)!==null&&G!==void 0&&G,this.respectDoNotTrack=(Y=this.options.respectDoNotTrack)!==null&&Y!==void 0&&Y,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:(K=this.options.platform)===null||K===void 0?void 0:K.name,viewer_application_version:(Z=this.options.platform)===null||Z===void 0?void 0:Z.version,viewer_application_engine:(Oe=this.options.platform)===null||Oe===void 0?void 0:Oe.layout,viewer_device_name:(ye=this.options.platform)===null||ye===void 0?void 0:ye.product,viewer_device_category:"",viewer_device_manufacturer:(Se=this.options.platform)===null||Se===void 0?void 0:Se.manufacturer,viewer_os_family:(be=this.options.platform)===null||be===void 0||(Re=be.os)===null||Re===void 0?void 0:Re.family,viewer_os_architecture:(Ge=this.options.platform)===null||Ge===void 0||(kt=Ge.os)===null||kt===void 0?void 0:kt.architecture,viewer_os_version:(Pt=this.options.platform)===null||Pt===void 0||(Wt=Pt.os)===null||Wt===void 0?void 0:Wt.version,viewer_connection_type:go(),page_url:F()===null||F()===void 0||(ni=F().location)===null||ni===void 0?void 0:ni.href},this.viewerData=this.disableCookies?{}:xd()}var g,_,R;return g=T,(_=[{key:"send",value:function(C,O){var x;if(C&&O!=null&&O.view_id){if(this.respectDoNotTrack&&nt())return we.info("Not sending `"+C+"` because Do Not Track is enabled");if(!O||Fr(O)!=="object")return we.error("A data object was expected in send() but was not provided");var G,Y,K=this.disableCookies?{}:(G=Wn(),Y=Ue.now(),G.session_start&&(G.sst=G.session_start,delete G.session_start),G.session_id&&(G.sid=G.session_id,delete G.session_id),G.session_expires&&(G.sex=G.session_expires,delete G.session_expires),(!G.sex||G.sex<Y)&&(G.sid=Q(),G.sst=Y),G.sex=Y+15e5,qn(G),{session_id:G.sid,session_start:G.sst,session_expires:G.sex}),Z=fr(fr(fr(fr(fr({},this.pageLevelData),O),K),this.viewerData),{},{event:C,env_key:this.envKey});Z.user_id&&(Z.viewer_user_id=Z.user_id,delete Z.user_id);var Oe=((x=Z.mux_sample_number)!==null&&x!==void 0?x:0)>=this.sampleRate,ye=ca(this._deduplicateBeaconData(C,Z));if(this.lastEventTime=this.mux.utils.now(),Oe)return we.info("Not sending event due to sample rate restriction",C,Z,ye);if(this.envKey||we.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",C,Z,ye),!this.rateLimited){if(we.info("Sending event",C,Z,ye),this.rateLimited=!this.eventQueue.queueEvent(C,ye),this.mux.WINDOW_UNLOADING&&C==="viewend")this.eventQueue.destroy(!0);else if(this.mux.WINDOW_HIDDEN&&C==="hb"?this.eventQueue.flushEvents(!0):ko.indexOf(C)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return Z.event="eventrateexceeded",ye=ca(Z),this.eventQueue.queueEvent(Z.event,ye),we.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(C,O){var x=this,G={},Y=O.view_id;if(Y==="-1"||C==="viewstart"||C==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)G=fr({},O),Y&&(this.previousBeaconData=G),Y&&C==="viewend"&&(this.previousBeaconData=null);else{var K=C.indexOf("request")===0;Object.entries(O).forEach(function(Z){var Oe=Pd(Z,2),ye=Oe[0],Se=Oe[1];x.previousBeaconData&&(Se!==x.previousBeaconData[ye]||ha.indexOf(ye)>-1||x.objectHasChanged(K,ye,Se,x.previousBeaconData[ye])||x.eventRequiresKey(C,ye))&&(G[ye]=Se,x.previousBeaconData[ye]=Se)})}return G}},{key:"objectHasChanged",value:function(C,O,x,G){return!(!C||O.indexOf("request_")!==0||O!=="request_response_headers"&&Fr(x)==="object"&&Fr(G)==="object"&&Object.keys(x||{}).length===Object.keys(G||{}).length)}},{key:"eventRequiresKey",value:function(C,O){return C==="renditionchange"&&O.indexOf("video_source_")===0||!(O.indexOf("ad_id")!==0||!So.includes(C))}}])&&jn(g.prototype,_),R&&jn(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function zn(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function wo(T,g,_){return g&&zn(T.prototype,g),_&&zn(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Lo=wo(function T(g){(function(K,Z){if(!(K instanceof Z))throw new TypeError("Cannot call a class as a function")})(this,T);var _=0,R=0,C=0,O=0,x=0,G=0,Y=0;g.on("requestcompleted",function(K,Z){var Oe,ye,Se=Z.request_start,be=Z.request_response_start,Re=Z.request_response_end,Ge=Z.request_bytes_loaded;if(O++,be?(Oe=be-(Se!=null?Se:0),ye=(Re!=null?Re:0)-be):ye=(Re!=null?Re:0)-(Se!=null?Se:0),ye>0&&Ge&&Ge>0){var kt=Ge/ye*8e3;x++,R+=Ge,C+=ye,g.data.view_min_request_throughput=Math.min(g.data.view_min_request_throughput||1/0,kt),g.data.view_average_request_throughput=R/C*8e3,g.data.view_request_count=O,Oe>0&&(_+=Oe,g.data.view_max_request_latency=Math.max(g.data.view_max_request_latency||0,Oe),g.data.view_average_request_latency=_/x)}}),g.on("requestfailed",function(K,Z){O++,G++,g.data.view_request_count=O,g.data.view_request_failed_count=G}),g.on("requestcanceled",function(K,Z){O++,Y++,g.data.view_request_count=O,g.data.view_request_canceled_count=Y})});function Qn(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Ur(T,g,_){return g&&Qn(T.prototype,g),_&&Qn(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var mr=Ur(function T(g){var _=this;(function(R,C){if(!(R instanceof C))throw new TypeError("Cannot call a class as a function")})(this,T),g.on("before*",function(R,C){var O=C.viewer_time,x=Ue.now(),G=_._lastEventTime;if(_._lastEventTime=x,G&&x-G>36e5){var Y=Object.keys(g.data).reduce(function(K,Z){return Z.indexOf("video_")===0?Object.assign(K,function(Oe,ye,Se){return ye in Oe?Object.defineProperty(Oe,ye,{value:Se,enumerable:!0,configurable:!0,writable:!0}):Oe[ye]=Se,Oe}({},Z,g.data[Z])):K},{});g.mux.log.info("Received event after at least an hour inactivity, creating a new view"),g.emit("viewinit",Object.assign({viewer_time:O},Y)),g.playbackHeartbeat._playheadShouldBeProgressing&&R.type!=="play"&&R.type!=="adbreakstart"&&(g.emit("play",{viewer_time:O}),R.type!=="playing"&&g.emit("playing",{viewer_time:O}))}})});function hi(T){return hi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},hi(T)}function Ki(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],Y=!0,K=!1;try{for(C=C.call(_);!(Y=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);Y=!0);}catch(Z){K=!0,x=Z}finally{try{Y||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return et(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?et(_,R):void 0}}(T,g)||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 et(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function _i(T,g){for(var _=0;_<g.length;_++){var R=g[_];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}function Ri(T,g){return Ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(_,R){return _.__proto__=R,_},Ri(T,g)}function Io(T){var g=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 _,R=fa(T);if(g){var C=fa(this).constructor;_=Reflect.construct(R,arguments,C)}else _=R.apply(this,arguments);return Xn(this,_)}}function Xn(T,g){if(g&&(hi(g)==="object"||typeof g=="function"))return g;if(g!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return St(T)}function St(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}function fa(T){return fa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(g){return g.__proto__||Object.getPrototypeOf(g)},fa(T)}var Ro=["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"],Br=function(T){(function(x,G){if(typeof G!="function"&&G!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(G&&G.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),Object.defineProperty(x,"prototype",{writable:!1}),G&&Ri(x,G)})(O,T);var g,_,R,C=Io(O);function O(x,G,Y){var K;(function(be,Re){if(!(be instanceof Re))throw new TypeError("Cannot call a class as a function")})(this,O),(K=C.call(this)).DOM_CONTENT_LOADED_EVENT_END=oe.domContentLoadedEventEnd(),K.NAVIGATION_START=oe.navigationStart(),K.mux=x,K.id=G,(Y=Object.assign({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(be){return be}},Y)).data=Y.data||{},Y.data.property_key&&(Y.data.env_key=Y.data.property_key,delete Y.data.property_key),we.setLevel(Y.debug?"debug":"warn"),K.getPlayheadTime=Y.getPlayheadTime,K.getStateData=Y.getStateData||function(){return{}},K.getAdData=Y.getAdData||function(){},K.minimumRebufferDuration=Y.minimumRebufferDuration,K.sustainedRebufferThreshold=Y.sustainedRebufferThreshold,K.playbackHeartbeatTime=Y.playbackHeartbeatTime,K.disableRebufferTracking=Y.disableRebufferTracking,K.disableRebufferTracking&&K.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."),K.disablePlayheadRebufferTracking=Y.disablePlayheadRebufferTracking,K.errorTranslator=Y.errorTranslator,K.playbackEventDispatcher=new Nd(x,Y.data.env_key,Y),K.data={player_instance_id:Q(),mux_sample_rate:Y.sampleRate,beacon_domain:Y.beaconCollectionDomain?Y.beaconCollectionDomain:Y.beaconDomain},K.data.view_sequence_number=1,K.data.player_sequence_number=1,K.oldEmit=K.emit,K.emit=function(be,Re){Re=Object.assign({viewer_time:this.mux.utils.now()},Re),this.oldEmit(be,Re)};var Z=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(St(K));K.on("viewinit",function(be,Re){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,Re),this._initializeViewData(),this.one("play",Z),this.one("adbreakstart",Z)});var Oe=function(be){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",be)}.bind(St(K));if(K.on("videochange",function(be,Re){Oe(Re)}),K.on("programchange",function(be,Re){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."),Oe(Object.assign(Re,{view_program_changed:!0})),Z(),this.emit("play"),this.emit("playing")}),K.on("fragmentchange",function(be,Re){this.currentFragmentPDT=Re.currentFragmentPDT,this.currentFragmentStart=Re.currentFragmentStart}),K.on("destroy",K.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var ye=function(){var be=K.data.view_start!==void 0;K.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",be&&K.mux.WINDOW_HIDDEN&&(K.data.player_is_paused||K.emit("hb"))};window.addEventListener("visibilitychange",ye,!1);var Se=function(be){be.persisted||K.destroy()};window.addEventListener("pagehide",Se,!1),K.on("destroy",function(){window.removeEventListener("visibilitychange",ye),window.removeEventListener("pagehide",Se)})}return K.on("playerready",function(be,Re){Object.assign(this.data,Re)}),Ro.forEach(function(be){K.on(be,function(Re,Ge){be.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,Ge),this._sanitizeData()}),K.on("after"+be,function(){(be!=="error"||this.errorTracker.viewErrored)&&this.send(be)})}),K.on("viewend",function(be,Re){Object.assign(K.data,Re)}),K.one("playerready",function(be){var Re=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=Re-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}),K.longResumeTracker=new mr(St(K)),K.errorTracker=new je(St(K)),new Fe(St(K)),K.seekingTracker=new Dd(St(K)),K.playheadTime=new ut(St(K)),K.playbackHeartbeat=new _t(St(K)),new Id(St(K)),K.watchTimeTracker=new ui(St(K)),new Xi(St(K)),K.adTracker=new Ii(St(K)),new so(St(K)),new Li(St(K)),new Ya(St(K)),new fo(St(K)),new Lo(St(K)),Y.hlsjs&&K.addHLSJS(Y),Y.dashjs&&K.addDashJS(Y),K.emit("viewinit",Y.data),K}return g=O,_=[{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(x){if(this.data.view_id){var G=Object.assign({},this.data);if(G.video_source_is_live===void 0&&(G.player_source_duration===1/0||G.video_source_duration===1/0?G.video_source_is_live=!0:(G.player_source_duration>0||G.video_source_duration>0)&&(G.video_source_is_live=!1)),G.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(Oe){G[Oe]=void 0}),G.video_source_url=G.video_source_url||G.player_source_url,G.video_source_url){var Y=Ki(dt(G.video_source_url),2),K=Y[0],Z=Y[1];G.video_source_domain=Z,G.video_source_hostname=K}delete G.ad_request_id,this.playbackEventDispatcher.send(x,G),this.data.view_sequence_number++,this.data.player_sequence_number++,this._restartHeartBeat(),x==="viewend"&&delete this.data.view_id}}},{key:"_updateStateData",value:function(){Object.assign(this.data,this.getStateData()),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var x=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(G){var Y=parseInt(x.data[G],10);x.data[G]=isNaN(Y)?void 0:Y}),["player_source_url","video_source_url"].forEach(function(G){if(x.data[G]){var Y=x.data[G].toLowerCase();Y.indexOf("data:")!==0&&Y.indexOf("blob:")!==0||(x.data[G]="MSE style URL")}})}},{key:"_resetVideoData",value:function(x,G){var Y=this;Object.keys(this.data).forEach(function(K){K.indexOf("video_")===0&&delete Y.data[K]})}},{key:"_resetViewData",value:function(){var x=this;Object.keys(this.data).forEach(function(G){G.indexOf("view_")===0&&delete x.data[G]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(x,G){delete this.data.player_error_code,delete this.data.player_error_message}},{key:"_initializeViewData",value:function(){var x=this,G=this.data.view_id=Q(),Y=function(){G===x.data.view_id&&w(x.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",Y):Y()}},{key:"_restartHeartBeat",value:function(){var x=this;window.clearTimeout(this._heartBeatTimeout),this.errorTracker.viewErrored||(this._heartBeatTimeout=window.setTimeout(function(){x.data.player_is_paused||x.emit("hb")},1e4))}},{key:"addHLSJS",value:function(x){x.hlsjs?this.hlsjs?this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):(this.hlsjs=x.hlsjs,function(G,Y,K){var Z=arguments.length>4?arguments[4]:void 0,Oe=G.log,ye=G.utils.secondsToMs,Se=function(Ze){var de,ce=parseInt(Z.version);return ce===1&&Ze.programDateTime!==null&&(de=Ze.programDateTime),ce===0&&Ze.pdt!==null&&(de=Ze.pdt),de};if(oe.exists()){var be=function(Ze,de){return G.emit(Y,Ze,de)},Re=function(Ze,de){var ce=de.levels,he=de.audioTracks,Ne=de.url,Ve=de.stats,ft=de.networkDetails,Zt=de.sessionData,wt={},qt={};ce.forEach(function(Le,gr){wt[gr]={width:Le.width,height:Le.height,bitrate:Le.bitrate,attrs:Le.attrs}}),he.forEach(function(Le,gr){qt[gr]={name:Le.name,language:Le.lang,bitrate:Le.bitrate}});var Lt=ri(Ve),It=Lt.bytesLoaded,Di=Lt.requestStart,_a=Lt.responseStart,Rt=Lt.responseEnd;be("requestcompleted",Je(Je({},tt(Zt)),{},{request_event_type:Ze,request_bytes_loaded:It,request_start:Di,request_response_start:_a,request_response_end:Rt,request_type:"manifest",request_hostname:st(Ne),request_response_headers:Ht(ft),request_rendition_lists:{media:wt,audio:qt,video:{}}}))};K.on(Z.Events.MANIFEST_LOADED,Re);var Ge=function(Ze,de){var ce=de.details,he=de.level,Ne=de.networkDetails,Ve=de.stats,ft=ri(Ve),Zt=ft.bytesLoaded,wt=ft.requestStart,qt=ft.responseStart,Lt=ft.responseEnd,It=ce.fragments[ce.fragments.length-1],Di=Se(It)+ye(It.duration);be("requestcompleted",{request_event_type:Ze,request_bytes_loaded:Zt,request_start:wt,request_response_start:qt,request_response_end:Lt,request_current_level:he,request_type:"manifest",request_hostname:st(ce.url),request_response_headers:Ht(Ne),video_holdback:ce.holdBack&&ye(ce.holdBack),video_part_holdback:ce.partHoldBack&&ye(ce.partHoldBack),video_part_target_duration:ce.partTarget&&ye(ce.partTarget),video_target_duration:ce.targetduration&&ye(ce.targetduration),video_source_is_live:ce.live,player_manifest_newest_program_time:isNaN(Di)?void 0:Di})};K.on(Z.Events.LEVEL_LOADED,Ge);var kt=function(Ze,de){var ce=de.details,he=de.networkDetails,Ne=de.stats,Ve=ri(Ne),ft=Ve.bytesLoaded,Zt=Ve.requestStart,wt=Ve.responseStart,qt=Ve.responseEnd;be("requestcompleted",{request_event_type:Ze,request_bytes_loaded:ft,request_start:Zt,request_response_start:wt,request_response_end:qt,request_type:"manifest",request_hostname:st(ce.url),request_response_headers:Ht(he)})};K.on(Z.Events.AUDIO_TRACK_LOADED,kt);var Pt=function(Ze,de){var ce=de.stats,he=de.networkDetails,Ne=de.frag;ce=ce||Ne.stats;var Ve=ri(ce),ft=Ve.bytesLoaded,Zt=Ve.requestStart,wt=Ve.responseStart,qt=Ve.responseEnd,Lt=he?Ht(he):void 0,It={request_event_type:Ze,request_bytes_loaded:ft,request_start:Zt,request_response_start:wt,request_response_end:qt,request_hostname:he?st(he.responseURL):void 0,request_id:Lt?$e(Lt):void 0,request_response_headers:Lt,request_media_duration:Ne.duration,request_url:he==null?void 0:he.responseURL};Ne.type==="main"?(It.request_type="media",It.request_current_level=Ne.level,It.request_video_width=(K.levels[Ne.level]||{}).width,It.request_video_height=(K.levels[Ne.level]||{}).height,It.request_labeled_bitrate=(K.levels[Ne.level]||{}).bitrate):It.request_type=Ne.type,be("requestcompleted",It)};K.on(Z.Events.FRAG_LOADED,Pt);var Wt=function(Ze,de){var ce=de.frag,he=ce.start,Ne={currentFragmentPDT:Se(ce),currentFragmentStart:ye(he)};be("fragmentchange",Ne)};K.on(Z.Events.FRAG_CHANGED,Wt);var ni=function(Ze,de){var ce=de.type,he=de.details,Ne=de.response,Ve=de.fatal,ft=de.frag,Zt=de.networkDetails,wt=(ft==null?void 0:ft.url)||de.url||"",qt=Zt?Ht(Zt):void 0;if(he!==Z.ErrorDetails.MANIFEST_LOAD_ERROR&&he!==Z.ErrorDetails.MANIFEST_LOAD_TIMEOUT&&he!==Z.ErrorDetails.FRAG_LOAD_ERROR&&he!==Z.ErrorDetails.FRAG_LOAD_TIMEOUT&&he!==Z.ErrorDetails.LEVEL_LOAD_ERROR&&he!==Z.ErrorDetails.LEVEL_LOAD_TIMEOUT&&he!==Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&he!==Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT&&he!==Z.ErrorDetails.SUBTITLE_LOAD_ERROR&&he!==Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT&&he!==Z.ErrorDetails.KEY_LOAD_ERROR&&he!==Z.ErrorDetails.KEY_LOAD_TIMEOUT||be("requestfailed",{request_error:he,request_url:wt,request_hostname:st(wt),request_id:qt?$e(qt):void 0,request_type:he===Z.ErrorDetails.FRAG_LOAD_ERROR||he===Z.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":he===Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||he===Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":he===Z.ErrorDetails.SUBTITLE_LOAD_ERROR||he===Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":he===Z.ErrorDetails.KEY_LOAD_ERROR||he===Z.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:Ne==null?void 0:Ne.code,request_error_text:Ne==null?void 0:Ne.text}),Ve){var Lt,It="".concat(wt?"url: ".concat(wt,`
|
|
5
|
+
`):"")+"".concat(Ne&&(Ne.code||Ne.text)?"response: ".concat(Ne.code,", ").concat(Ne.text,`
|
|
6
6
|
`):"")+"".concat(de.reason?"failure reason: ".concat(de.reason,`
|
|
7
7
|
`):"")+"".concat(de.level?"level: ".concat(de.level,`
|
|
8
8
|
`):"")+"".concat(de.parent?"parent stream controller: ".concat(de.parent,`
|
|
9
9
|
`):"")+"".concat(de.buffer?"buffer length: ".concat(de.buffer,`
|
|
10
10
|
`):"")+"".concat(de.error?"error: ".concat(de.error,`
|
|
11
11
|
`):"")+"".concat(de.event?"event: ".concat(de.event,`
|
|
12
|
-
`):"")+"".concat(de.err?"error message: ".concat((
|
|
13
|
-
`):"");
|
|
14
|
-
`):"")+"".concat(
|
|
15
|
-
`):"");
|
|
16
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function
|
|
17
|
-
`);
|
|
18
|
-
`))this.processLine(this.buffer.substring(0,
|
|
19
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Qa(T,y){(y==null||y>T.length)&&(y=T.length);for(var _=0,R=new Array(y);_<y;_++)R[_]=T[_];return R}var It={},rr=function T(y){var _=arguments;typeof y=="string"?T.hasOwnProperty(y)?U().setTimeout(function(){_=Array.prototype.splice.call(_,1),T[y].apply(null,_)},0):Se.warn("`"+y+"` is an unknown task"):typeof y=="function"?U().setTimeout(function(){y(T)},0):Se.warn("`"+y+"` is invalid.")},Hr={loaded:Ue.now(),NAME:"mux-embed",VERSION:"4.24.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(T,y){return function(_,R,C){var O=wo(se(R),3),x=O[0],G=O[1],$=O[2],K=_.log,Z=_.utils.getComputedStyle,xe=_.utils.secondsToMs;if(!x)return K.error("No element was found with the `"+G+"` query selector.");if($!=="video"&&$!=="audio")return K.error("The element of `"+G+"` was not a media element.");x.mux&&(x.mux.destroy(),delete x.mux,K.warn("Already monitoring this video element, replacing existing event listeners")),(C=Object.assign({automaticErrorTracking:!0},C)).data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:_.VERSION},C.data),C.getPlayheadTime=function(){return xe(x.currentTime)},C.getStateData=function(){var Ie,ge,De=this.hlsjs&&this.hlsjs.url,ze=this.dashjs&&zn(this.dashjs.getSource==="function")&&this.dashjs.getSource(),ut={player_is_paused:x.paused,player_playhead_time:xe(x.currentTime),player_width:parseInt(Z(x,"width")),player_height:parseInt(Z(x,"height")),player_autoplay_on:x.autoplay,player_preload_on:x.preload,player_language_code:x.lang,player_is_fullscreen:Er()&&!!(Er().fullscreenElement||Er().webkitFullscreenElement||Er().mozFullScreenElement||Er().msFullscreenElement),video_poster_url:x.poster,video_source_url:De||ze||x.currentSrc,video_source_duration:xe(x.duration),video_source_height:x.videoHeight,video_source_width:x.videoWidth,view_dropped_frame_count:(Ie=x)===null||Ie===void 0||(ge=Ie.getVideoPlaybackQuality)===null||ge===void 0?void 0:ge.call(Ie).droppedVideoFrames},Pt=C.getPlayheadTime();if(x.getStartDate&&Pt>0){var Qt=x.getStartDate();if(Qt&&typeof Qt.getTime=="function"&&Qt.getTime()){var li=Qt.getTime();if(ut.player_program_time=li+Pt,x.seekable.length>0){var ke=li+x.seekable.end(x.seekable.length-1);ut.player_live_edge_program_time=ke}}}return ut},x.mux=x.mux||{},x.mux.deleted=!1,x.mux.emit=function(Ie,ge){_.emit(G,Ie,ge)};var me=function(){K.error("The monitor for this video element has already been destroyed.")};x.mux.destroy=function(){Object.keys(x.mux.listeners).forEach(function(Ie){x.removeEventListener(Ie,x.mux.listeners[Ie],!1)}),delete x.mux.listeners,x.mux.destroy=me,x.mux.swapElement=me,x.mux.emit=me,x.mux.addHLSJS=me,x.mux.addDashJS=me,x.mux.removeHLSJS=me,x.mux.removeDashJS=me,x.mux.deleted=!0,_.emit(G,"destroy")},x.mux.swapElement=function(Ie){var ge=wo(se(Ie),3),De=ge[0],ze=ge[1],ut=ge[2];return De?ut!=="video"&&ut!=="audio"?_.log.error("The element of `"+ze+"` was not a media element."):(De.muxId=x.muxId,delete x.muxId,De.mux=De.mux||{},De.mux.listeners=Object.assign({},x.mux.listeners),delete x.mux.listeners,Object.keys(De.mux.listeners).forEach(function(Pt){x.removeEventListener(Pt,De.mux.listeners[Pt],!1),De.addEventListener(Pt,De.mux.listeners[Pt],!1)}),De.mux.swapElement=x.mux.swapElement,De.mux.destroy=x.mux.destroy,delete x.mux,void(x=De)):_.log.error("No element was found with the `"+ze+"` query selector.")},x.mux.addHLSJS=function(Ie){_.addHLSJS(G,Ie)},x.mux.addDashJS=function(Ie){_.addDashJS(G,Ie)},x.mux.removeHLSJS=function(){_.removeHLSJS(G)},x.mux.removeDashJS=function(){_.removeDashJS(G)},_.init(G,C),_.emit(G,"playerready"),x.paused||(_.emit(G,"play"),x.readyState>2&&_.emit(G,"playing")),x.mux.listeners={},Rd.forEach(function(Ie){(Ie!=="error"||C.automaticErrorTracking)&&(x.mux.listeners[Ie]=function(){var ge={};if(Ie==="error"){if(!x.error||x.error.code===1)return;ge.player_error_code=x.error.code,ge.player_error_message=Dd[x.error.code]||x.error.message}_.emit(G,Ie,ge)},x.addEventListener(Ie,x.mux.listeners[Ie],!1))})}(rr,T,y)},destroyMonitor:function(T){var y=xd(se(T),1)[0];y&&y.mux&&typeof y.mux.destroy=="function"?y.mux.destroy():Se.error("A video element monitor for `"+T+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(T,y){var _=ee(T);It[_]?It[_].addHLSJS(y):Se.error("A monitor for `"+_+"` has not been initialized.")},addDashJS:function(T,y){var _=ee(T);It[_]?It[_].addDashJS(y):Se.error("A monitor for `"+_+"` has not been initialized.")},removeHLSJS:function(T){var y=ee(T);It[y]?It[y].removeHLSJS():Se.error("A monitor for `"+y+"` has not been initialized.")},removeDashJS:function(T){var y=ee(T);It[y]?It[y].removeDashJS():Se.error("A monitor for `"+y+"` has not been initialized.")},init:function(T,y){st()&&y&&y.respectDoNotTrack&&Se.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var _=ee(T);It[_]=new jn(rr,_,y)},emit:function(T,y,_){var R=ee(T);It[R]?(It[R].emit(y,_),y==="destroy"&&delete It[R]):Se.error("A monitor for `"+R+"` has not been initialized.")},checkDoNotTrack:st,log:Se,utils:Md,events:es,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(rr,Hr),U()!==void 0&&typeof U().addEventListener=="function"&&U().addEventListener("pagehide",function(T){T.persisted||(rr.WINDOW_UNLOADING=!0)},!1);var Xa=rr},655:function(g,L,M){var B,U;function z(ie){return z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},z(ie);}(function(ie){var ee=!1;if((U=typeof(B=ie)=="function"?B.call(L,M,L,g):B)===void 0||(g.exports=U),ee=!0,z(L)==="object"&&(g.exports=ie(),ee=!0),!ee){var se=window.Cookies,fe=window.Cookies=ie();fe.noConflict=function(){return window.Cookies=se,fe}}})(function(){var ie=function(){for(var ee=0,se={};ee<arguments.length;ee++){var fe=arguments[ee];for(var _e in fe)se[_e]=fe[_e]}return se};return function ee(se){function fe(_e,Ae,Se){var st;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(Se=ie({path:"/"},fe.defaults,Se)).expires=="number"){var Ue=new Date;Ue.setMilliseconds(Ue.getMilliseconds()+864e5*Se.expires),Se.expires=Ue}try{st=JSON.stringify(Ae),/^[\{\[]/.test(st)&&(Ae=st)}catch{}return Ae=se.write?se.write(Ae,_e):encodeURIComponent(String(Ae)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),_e=(_e=(_e=encodeURIComponent(String(_e))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[_e,"=",Ae,Se.expires?"; expires="+Se.expires.toUTCString():"",Se.path?"; path="+Se.path:"",Se.domain?"; domain="+Se.domain:"",Se.secure?"; secure":""].join("")}_e||(st={});for(var le=document.cookie?document.cookie.split("; "):[],w=/(%[0-9A-Z]{2})+/g,oe=0;oe<le.length;oe++){var W=le[oe].split("="),Ye=W.slice(1).join("=");Ye.charAt(0)==='"'&&(Ye=Ye.slice(1,-1));try{var Et=W[0].replace(w,decodeURIComponent);if(Ye=se.read?se.read(Ye,Et):se(Ye,Et)||Ye.replace(w,decodeURIComponent),this.json)try{Ye=JSON.parse(Ye)}catch{}if(_e===Et){st=Ye;break}_e||(st[Et]=Ye)}catch{}}return st}}return fe.set=fe,fe.get=function(_e){return fe.call(fe,_e)},fe.getJSON=function(){return fe.apply({json:!0},[].slice.call(arguments))},fe.defaults={},fe.remove=function(_e,Ae){fe(_e,"",ie(Ae,{expires:-1}))},fe.withConverter=ee,fe}(function(){})})},153:function(g,L,M){var B,U=M.g!==void 0?M.g:typeof window!="undefined"?window:{},z=M(558);typeof document!="undefined"?B=document:(B=U["__GLOBAL_DOCUMENT_CACHE@4"])||(B=U["__GLOBAL_DOCUMENT_CACHE@4"]=z),g.exports=B},48:function(g,L,M){var B;B=typeof window!="undefined"?window:M.g!==void 0?M.g:typeof self!="undefined"?self:{},g.exports=B},640:function(g,L,M){var B,U;(function(z,ie){"use strict";B=function(){var ee=function(){},se="undefined",fe=typeof window!==se&&typeof window.navigator!==se&&/Trident\/|MSIE /.test(window.navigator.userAgent),_e=["trace","debug","info","warn","error"];function Ae(Re,et){var ot=Re[et];if(typeof ot.bind=="function")return ot.bind(Re);try{return Function.prototype.bind.call(ot,Re)}catch{return function(){return Function.prototype.apply.apply(ot,[Re,arguments])}}}function Se(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function st(Re){return Re==="debug"&&(Re="log"),typeof console!==se&&(Re==="trace"&&fe?Se:console[Re]!==void 0?Ae(console,Re):console.log!==void 0?Ae(console,"log"):ee)}function Ue(Re,et){for(var ot=0;ot<_e.length;ot++){var H=_e[ot];this[H]=ot<Re?ee:this.methodFactory(H,Re,et)}this.log=this.debug}function le(Re,et,ot){return function(){typeof console!==se&&(Ue.call(this,et,ot),this[Re].apply(this,arguments))}}function w(Re,et,ot){return st(Re)||le.apply(this,arguments)}function oe(Re,et,ot){var H,it=this;et=et==null?"WARN":et;var pt="loglevel";function Je(Ne){var ct=(_e[Ne]||"silent").toUpperCase();if(typeof window!==se&&pt){try{return void(window.localStorage[pt]=ct)}catch{}try{window.document.cookie=encodeURIComponent(pt)+"="+ct+";"}catch{}}}function Vt(){var Ne;if(typeof window!==se&&pt){try{Ne=window.localStorage[pt]}catch{}if(typeof Ne===se)try{var ct=window.document.cookie,pi=ct.indexOf(encodeURIComponent(pt)+"=");pi!==-1&&(Ne=/^([^;]+)/.exec(ct.slice(pi))[1])}catch{}return it.levels[Ne]===void 0&&(Ne=void 0),Ne}}function mi(){if(typeof window!==se&&pt){try{return void window.localStorage.removeItem(pt)}catch{}try{window.document.cookie=encodeURIComponent(pt)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof Re=="string"?pt+=":"+Re:typeof Re=="symbol"&&(pt=void 0),it.name=Re,it.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},it.methodFactory=ot||w,it.getLevel=function(){return H},it.setLevel=function(Ne,ct){if(typeof Ne=="string"&&it.levels[Ne.toUpperCase()]!==void 0&&(Ne=it.levels[Ne.toUpperCase()]),!(typeof Ne=="number"&&Ne>=0&&Ne<=it.levels.SILENT))throw"log.setLevel() called with invalid level: "+Ne;if(H=Ne,ct!==!1&&Je(Ne),Ue.call(it,Ne,Re),typeof console===se&&Ne<it.levels.SILENT)return"No console available for logging"},it.setDefaultLevel=function(Ne){et=Ne,Vt()||it.setLevel(Ne,!1)},it.resetLevel=function(){it.setLevel(et,!1),mi()},it.enableAll=function(Ne){it.setLevel(it.levels.TRACE,Ne)},it.disableAll=function(Ne){it.setLevel(it.levels.SILENT,Ne)};var Mt=Vt();Mt==null&&(Mt=et),it.setLevel(Mt,!1)}var W=new oe,Ye={};W.getLogger=function(Re){if(typeof Re!="symbol"&&typeof Re!="string"||Re==="")throw new TypeError("You must supply a name when creating a logger.");var et=Ye[Re];return et||(et=Ye[Re]=new oe(Re,W.getLevel(),W.methodFactory)),et};var Et=typeof window!==se?window.log:void 0;return W.noConflict=function(){return typeof window!==se&&window.log===W&&(window.log=Et),W},W.getLoggers=function(){return Ye},W.default=W,W},(U=typeof B=="function"?B.call(L,M,L,g):B)===void 0||(g.exports=U)})()},375:function(g,L){"use strict";var M=Object.prototype.hasOwnProperty;function B(z){try{return decodeURIComponent(z.replace(/\+/g," "))}catch{return null}}function U(z){try{return encodeURIComponent(z)}catch{return null}}L.stringify=function(z,ie){ie=ie||"";var ee,se,fe=[];for(se in typeof ie!="string"&&(ie="?"),z)if(M.call(z,se)){if((ee=z[se])||ee!=null&&!isNaN(ee)||(ee=""),se=U(se),ee=U(ee),se===null||ee===null)continue;fe.push(se+"="+ee)}return fe.length?ie+fe.join("&"):""},L.parse=function(z){for(var ie,ee=/([^=?#&]+)=?([^&]*)/g,se={};ie=ee.exec(z);){var fe=B(ie[1]),_e=B(ie[2]);fe===null||_e===null||fe in se||(se[fe]=_e)}return se}},558:function(){}},m={};function v(g){var L=m[g];if(L!==void 0)return L.exports;var M=m[g]={exports:{}};return o[g].call(M.exports,M,M.exports,v),M.exports}return v.n=function(g){var L=g&&g.__esModule?function(){return g.default}:function(){return g};return v.d(L,{a:L}),L},v.d=function(g,L){for(var M in L)v.o(L,M)&&!v.o(g,M)&&Object.defineProperty(g,M,{enumerable:!0,get:L[M]})},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,L){return Object.prototype.hasOwnProperty.call(g,L)},v(80)}()},typeof Hl=="object"&&typeof wc=="object"?wc.exports=a():typeof Hl=="object"?Hl.mux=a():n.mux=a()})()});var Qm=of((zm,Lc)=>{(function n(a){var o,m;o=this,m=function(){"use strict";function v(d,s){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(d);s&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(d,i).enumerable})),e.push.apply(e,t)}return e}function g(d){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?v(Object(e),!0).forEach(function(t){B(d,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):v(Object(e)).forEach(function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))})}return d}function L(d,s){for(var e=0;e<s.length;e++){var t=s[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,st(t.key),t)}}function M(d,s,e){return s&&L(d.prototype,s),e&&L(d,e),Object.defineProperty(d,"prototype",{writable:!1}),d}function B(d,s,e){return(s=st(s))in d?Object.defineProperty(d,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[s]=e,d}function U(){return U=Object.assign?Object.assign.bind():function(d){for(var s=1;s<arguments.length;s++){var e=arguments[s];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},U.apply(this,arguments)}function z(d,s){d.prototype=Object.create(s.prototype),d.prototype.constructor=d,ee(d,s)}function ie(d){return ie=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},ie(d)}function ee(d,s){return ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ee(d,s)}function se(){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 fe(d,s,e){return fe=se()?Reflect.construct.bind():function(t,i,r){var l=[null];l.push.apply(l,i);var u=new(Function.bind.apply(t,l));return r&&ee(u,r.prototype),u},fe.apply(null,arguments)}function _e(d){var s=typeof Map=="function"?new Map:void 0;return _e=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(s!==void 0){if(s.has(e))return s.get(e);s.set(e,i)}function i(){return fe(e,arguments,ie(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ee(i,e)},_e(d)}function Ae(d,s){(s==null||s>d.length)&&(s=d.length);for(var e=0,t=new Array(s);e<s;e++)t[e]=d[e];return t}function Se(d,s){var e=typeof Symbol!="undefined"&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(i,r){if(i){if(typeof i=="string")return Ae(i,r);var l=Object.prototype.toString.call(i).slice(8,-1);return l==="Object"&&i.constructor&&(l=i.constructor.name),l==="Map"||l==="Set"?Array.from(i):l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?Ae(i,r):void 0}}(d))||s&&d&&typeof d.length=="number"){e&&(d=e);var t=0;return function(){return t>=d.length?{done:!0}:{done:!1,value:d[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
20
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function st(d){var s=function(e,t){if(typeof e!="object"||e===null)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}(d,"string");return typeof s=="symbol"?s:String(s)}var Ue={};(function(d,s){var e,t,i,r,l;e=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,t=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,l={buildAbsoluteURL:function(u,c,f){if(f=f||{},u=u.trim(),!(c=c.trim())){if(!f.alwaysNormalize)return u;var h=l.parseURL(u);if(!h)throw new Error("Error trying to parse base URL.");return h.path=l.normalizePath(h.path),l.buildURLFromParts(h)}var p=l.parseURL(c);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return f.alwaysNormalize?(p.path=l.normalizePath(p.path),l.buildURLFromParts(p)):c;var E=l.parseURL(u);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var b=t.exec(E.path);E.netLoc=b[1],E.path=b[2]}E.netLoc&&!E.path&&(E.path="/");var A={scheme:E.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(A.netLoc=E.netLoc,p.path[0]!=="/"))if(p.path){var k=E.path,D=k.substring(0,k.lastIndexOf("/")+1)+p.path;A.path=l.normalizePath(D)}else A.path=E.path,p.params||(A.params=E.params,p.query||(A.query=E.query));return A.path===null&&(A.path=f.alwaysNormalize?l.normalizePath(p.path):p.path),l.buildURLFromParts(A)},parseURL:function(u){var c=e.exec(u);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(u){for(u=u.split("").reverse().join("").replace(i,"");u.length!==(u=u.replace(r,"")).length;);return u.split("").reverse().join("")},buildURLFromParts:function(u){return u.scheme+u.netLoc+u.path+u.params+u.query+u.fragment}},d.exports=l})({get exports(){return Ue},set exports(d){Ue=d}});var le=Number.isFinite||function(d){return typeof d=="number"&&isFinite(d)},w=function(d){return d.MEDIA_ATTACHING="hlsMediaAttaching",d.MEDIA_ATTACHED="hlsMediaAttached",d.MEDIA_DETACHING="hlsMediaDetaching",d.MEDIA_DETACHED="hlsMediaDetached",d.BUFFER_RESET="hlsBufferReset",d.BUFFER_CODECS="hlsBufferCodecs",d.BUFFER_CREATED="hlsBufferCreated",d.BUFFER_APPENDING="hlsBufferAppending",d.BUFFER_APPENDED="hlsBufferAppended",d.BUFFER_EOS="hlsBufferEos",d.BUFFER_FLUSHING="hlsBufferFlushing",d.BUFFER_FLUSHED="hlsBufferFlushed",d.MANIFEST_LOADING="hlsManifestLoading",d.MANIFEST_LOADED="hlsManifestLoaded",d.MANIFEST_PARSED="hlsManifestParsed",d.LEVEL_SWITCHING="hlsLevelSwitching",d.LEVEL_SWITCHED="hlsLevelSwitched",d.LEVEL_LOADING="hlsLevelLoading",d.LEVEL_LOADED="hlsLevelLoaded",d.LEVEL_UPDATED="hlsLevelUpdated",d.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",d.LEVELS_UPDATED="hlsLevelsUpdated",d.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",d.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",d.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",d.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",d.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",d.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",d.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",d.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",d.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",d.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",d.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",d.CUES_PARSED="hlsCuesParsed",d.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",d.INIT_PTS_FOUND="hlsInitPtsFound",d.FRAG_LOADING="hlsFragLoading",d.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",d.FRAG_LOADED="hlsFragLoaded",d.FRAG_DECRYPTED="hlsFragDecrypted",d.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",d.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",d.FRAG_PARSING_METADATA="hlsFragParsingMetadata",d.FRAG_PARSED="hlsFragParsed",d.FRAG_BUFFERED="hlsFragBuffered",d.FRAG_CHANGED="hlsFragChanged",d.FPS_DROP="hlsFpsDrop",d.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",d.ERROR="hlsError",d.DESTROYING="hlsDestroying",d.KEY_LOADING="hlsKeyLoading",d.KEY_LOADED="hlsKeyLoaded",d.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",d.BACK_BUFFER_REACHED="hlsBackBufferReached",d}({}),oe=function(d){return d.NETWORK_ERROR="networkError",d.MEDIA_ERROR="mediaError",d.KEY_SYSTEM_ERROR="keySystemError",d.MUX_ERROR="muxError",d.OTHER_ERROR="otherError",d}({}),W=function(d){return d.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",d.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",d.KEY_SYSTEM_NO_SESSION="keySystemNoSession",d.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",d.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",d.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",d.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",d.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",d.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",d.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",d.MANIFEST_LOAD_ERROR="manifestLoadError",d.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",d.MANIFEST_PARSING_ERROR="manifestParsingError",d.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",d.LEVEL_EMPTY_ERROR="levelEmptyError",d.LEVEL_LOAD_ERROR="levelLoadError",d.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",d.LEVEL_PARSING_ERROR="levelParsingError",d.LEVEL_SWITCH_ERROR="levelSwitchError",d.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",d.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",d.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",d.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",d.FRAG_LOAD_ERROR="fragLoadError",d.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",d.FRAG_DECRYPT_ERROR="fragDecryptError",d.FRAG_PARSING_ERROR="fragParsingError",d.FRAG_GAP="fragGap",d.REMUX_ALLOC_ERROR="remuxAllocError",d.KEY_LOAD_ERROR="keyLoadError",d.KEY_LOAD_TIMEOUT="keyLoadTimeOut",d.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",d.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",d.BUFFER_APPEND_ERROR="bufferAppendError",d.BUFFER_APPENDING_ERROR="bufferAppendingError",d.BUFFER_STALLED_ERROR="bufferStalledError",d.BUFFER_FULL_ERROR="bufferFullError",d.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",d.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",d.INTERNAL_EXCEPTION="internalException",d.INTERNAL_ABORTED="aborted",d.UNKNOWN="unknown",d}({}),Ye=function(){},Et={trace:Ye,debug:Ye,log:Ye,warn:Ye,info:Ye,error:Ye},Re=Et;function et(d){var s=self.console[d];return s?s.bind(self.console,"["+d+"] >"):Ye}function ot(d,s){if(self.console&&d===!0||typeof d=="object"){(function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];i.forEach(function(l){Re[l]=e[l]?e[l].bind(e):et(l)})})(d,"debug","log","info","warn","error");try{Re.log('Debug logs enabled for "'+s+'" in hls.js version 1.4.0')}catch{Re=Et}}else Re=Et}var H=Re,it=/^(\d+)x(\d+)$/,pt=/(.+?)=(".*?"|.*?)(?:,|$)/g,Je=function(){function d(e){for(var t in typeof e=="string"&&(e=d.parseAttrList(e)),e)e.hasOwnProperty(t)&&(t.substring(0,2)==="X-"&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])}var s=d.prototype;return s.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},s.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var i=new Uint8Array(t.length/2),r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(2*r,2*r+2),16);return i}return null},s.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},s.decimalFloatingPoint=function(e){return parseFloat(this[e])},s.optionalFloat=function(e,t){var i=this[e];return i?parseFloat(i):t},s.enumeratedString=function(e){return this[e]},s.bool=function(e){return this[e]==="YES"},s.decimalResolution=function(e){var t=it.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},d.parseAttrList=function(e){var t,i={};for(pt.lastIndex=0;(t=pt.exec(e))!==null;){var r=t[2];r.indexOf('"')===0&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[t[1].trim()]=r}return i},d}();function Vt(d){return d==="SCTE35-OUT"||d==="SCTE35-IN"}var mi=function(){function d(s,e){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,e){var t=e.attr;for(var i in t)if(Object.prototype.hasOwnProperty.call(s,i)&&s[i]!==t[i]){H.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+s.ID+'"'),this._badValueForSameId=i;break}s=U(new Je({}),t,s)}if(this.attr=s,this._startDate=new Date(s["START-DATE"]),"END-DATE"in this.attr){var r=new Date(this.attr["END-DATE"]);le(r.getTime())&&(this._endDate=r)}}return M(d,[{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 s=this.duration;return s!==null?new Date(this._startDate.getTime()+1e3*s):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var s=this.attr.decimalFloatingPoint("DURATION");if(le(s))return s}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&le(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),d}(),Mt=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}},Ne="audio",ct="video",pi="audiovideo",Gi=function(){function d(s){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[Ne]=null,e[ct]=null,e[pi]=null,e),this.baseurl=s}return d.prototype.setByteRange=function(s,e){var t=s.split("@",2),i=[];t.length===1?i[0]=e?e.byteRangeEndOffset:0:i[0]=parseInt(t[1]),i[1]=parseInt(t[0])+i[0],this._byteRange=i},M(d,[{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=Ue.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(s){this._url=s}}]),d}(),Zi=function(d){function s(t,i){var r;return(r=d.call(this,i)||this)._decryptdata=null,r.rawProgramDateTime=null,r.programDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkeys=void 0,r.type=void 0,r.loader=null,r.keyLoader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.stats=new Mt,r.urlId=0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.endList=void 0,r.gap=void 0,r.type=t,r}z(s,d);var e=s.prototype;return e.setKeyFormat=function(t){if(this.levelkeys){var i=this.levelkeys[t];i&&!this._decryptdata&&(this._decryptdata=i.getDecryptData(this.sn))}},e.abortRequests=function(){var t,i;(t=this.loader)==null||t.abort(),(i=this.keyLoader)==null||i.abort()},e.setElementaryStreamInfo=function(t,i,r,l,u,c){c===void 0&&(c=!1);var f=this.elementaryStreams,h=f[t];h?(h.startPTS=Math.min(h.startPTS,i),h.endPTS=Math.max(h.endPTS,r),h.startDTS=Math.min(h.startDTS,l),h.endDTS=Math.max(h.endDTS,u)):f[t]={startPTS:i,endPTS:r,startDTS:l,endDTS:u,partial:c}},e.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[Ne]=null,t[ct]=null,t[pi]=null},M(s,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{var i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!le(this.programDateTime))return null;var t=le(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){var t;if((t=this._decryptdata)!=null&&t.encrypted)return!0;if(this.levelkeys){var i=Object.keys(this.levelkeys),r=i.length;if(r>1||r===1&&this.levelkeys[i[0]].encrypted)return!0}return!1}}]),s}(Gi),te=function(d){function s(e,t,i,r,l){var u;(u=d.call(this,i)||this).fragOffset=0,u.duration=0,u.gap=!1,u.independent=!1,u.relurl=void 0,u.fragment=void 0,u.index=void 0,u.stats=new Mt,u.duration=e.decimalFloatingPoint("DURATION"),u.gap=e.bool("GAP"),u.independent=e.bool("INDEPENDENT"),u.relurl=e.enumeratedString("URI"),u.fragment=t,u.index=r;var c=e.enumeratedString("BYTERANGE");return c&&u.setByteRange(c,l),l&&(u.fragOffset=l.fragOffset+l.duration),u}return z(s,d),M(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),s}(Gi),Te=function(){function d(s){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.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=s}return d.prototype.reloaded=function(s){if(!s)return this.advanced=!0,void(this.updated=!0);var e=this.lastPartSn-s.lastPartSn,t=this.lastPartIndex-s.lastPartIndex;this.updated=this.endSN!==s.endSN||!!t||!!e,this.advanced=this.endSN>s.endSN||e>0||e===0&&t>0,this.updated||this.advanced?this.misses=Math.floor(.6*s.misses):this.misses=s.misses+1,this.availabilityDelay=s.availabilityDelay},M(d,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&le(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var s=this.driftEndTime-this.driftStartTime;return s>0?1e3*(this.driftEnd-this.driftStart)/s:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var s;return(s=this.fragments)!=null&&s.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 s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),d}();function tt(d){return Uint8Array.from(atob(d),function(s){return s.charCodeAt(0)})}function _t(d){var s,e,t=d.split(":"),i=null;if(t[0]==="data"&&t.length===2){var r=t[1].split(";"),l=r[r.length-1].split(",");if(l.length===2){var u=l[0]==="base64",c=l[1];u?(r.splice(-1,1),i=tt(c)):(s=Lt(c).subarray(0,16),(e=new Uint8Array(16)).set(s,16-s.length),i=e)}}return i}function Lt(d){return Uint8Array.from(unescape(encodeURIComponent(d)),function(s){return s.charCodeAt(0)})}var $e={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Si="org.w3.clearkey",jt="com.apple.streamingkeydelivery",ii="com.microsoft.playready",ri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function pr(d){switch(d){case jt:return $e.FAIRPLAY;case ii:return $e.PLAYREADY;case ri:return $e.WIDEVINE;case Si:return $e.CLEARKEY}}var Or="edef8ba979d64acea3c827dcd51d21ed";function oi(d){switch(d){case $e.FAIRPLAY:return jt;case $e.PLAYREADY:return ii;case $e.WIDEVINE:return ri;case $e.CLEARKEY:return Si}}function dt(d){var s=d.drmSystems,e=d.widevineLicenseUrl,t=s?[$e.FAIRPLAY,$e.WIDEVINE,$e.PLAYREADY,$e.CLEARKEY].filter(function(i){return!!s[i]}):[];return!t[$e.WIDEVINE]&&e&&t.push($e.WIDEVINE),t}var Ji=typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function vi(d,s,e){return Uint8Array.prototype.slice?d.slice(s,e):new Uint8Array(Array.prototype.slice.call(d,s,e))}var vr,Nr=function(d,s){return s+10<=d.length&&d[s]===73&&d[s+1]===68&&d[s+2]===51&&d[s+3]<255&&d[s+4]<255&&d[s+6]<128&&d[s+7]<128&&d[s+8]<128&&d[s+9]<128},Fr=function(d,s){return s+10<=d.length&&d[s]===51&&d[s+1]===68&&d[s+2]===73&&d[s+3]<255&&d[s+4]<255&&d[s+6]<128&&d[s+7]<128&&d[s+8]<128&&d[s+9]<128},Oa=function(d,s){for(var e=s,t=0;Nr(d,s);)t+=10,t+=Na(d,s+6),Fr(d,s+10)&&(t+=10),s+=t;if(t>0)return d.subarray(e,e+t)},Na=function(d,s){var e=0;return e=(127&d[s])<<21,e|=(127&d[s+1])<<14,e|=(127&d[s+2])<<7,e|=127&d[s+3]},io=function(d,s){return Nr(d,s)&&Na(d,s+6)+10<=d.length-s},ro=function(d){return d&&d.key==="PRIV"&&d.info==="com.apple.streaming.transportStreamTimestamp"},ao=function(d){var s=String.fromCharCode(d[0],d[1],d[2],d[3]),e=Na(d,4);return{type:s,size:e,data:d.subarray(10,10+e)}},no=function(d){for(var s=0,e=[];Nr(d,s);){for(var t=Na(d,s+6),i=(s+=10)+t;s+8<i;){var r=ao(d.subarray(s)),l=bd(r);l&&e.push(l),s+=r.size+10}Fr(d,s)&&(s+=10)}return e},bd=function(d){return d.type==="PRIV"?so(d):d.type[0]==="W"?Td(d):_d(d)},so=function(d){if(!(d.size<2)){var s=gi(d.data,!0),e=new Uint8Array(d.data.subarray(s.length+1));return{key:d.type,info:s,data:e.buffer}}},_d=function(d){if(!(d.size<2)){if(d.type==="TXXX"){var s=1,e=gi(d.data.subarray(s),!0);s+=e.length+1;var t=gi(d.data.subarray(s));return{key:d.type,info:e,data:t}}var i=gi(d.data.subarray(1));return{key:d.type,data:i}}},Td=function(d){if(d.type==="WXXX"){if(d.size<2)return;var s=1,e=gi(d.data.subarray(s),!0);s+=e.length+1;var t=gi(d.data.subarray(s));return{key:d.type,info:e,data:t}}var i=gi(d.data);return{key:d.type,data:i}},oo=function(d){if(d.data.byteLength===8){var s=new Uint8Array(d.data),e=1&s[3],t=(s[4]<<23)+(s[5]<<15)+(s[6]<<7)+s[7];return t/=45,e&&(t+=4772185884e-2),Math.round(t)}},gi=function(d,s){s===void 0&&(s=!1);var e=lo();if(e){var t=e.decode(d);if(s){var i=t.indexOf("\0");return i!==-1?t.substring(0,i):t}return t.replace(/\0/g,"")}for(var r,l,u,c=d.length,f="",h=0;h<c;){if((r=d[h++])===0&&s)return f;if(r!==0&&r!==3)switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:f+=String.fromCharCode(r);break;case 12:case 13:l=d[h++],f+=String.fromCharCode((31&r)<<6|63&l);break;case 14:l=d[h++],u=d[h++],f+=String.fromCharCode((15&r)<<12|(63&l)<<6|(63&u)<<0)}}return f};function lo(){return vr||self.TextDecoder===void 0||(vr=new self.TextDecoder("utf-8")),vr}var yi=function(d){for(var s="",e=0;e<d.length;e++){var t=d[e].toString(16);t.length<2&&(t="0"+t),s+=t}return s},Fa=Math.pow(2,32)-1,Ad=[].push,Un={video:1,audio:2,id3:3,text:4};function xt(d){return String.fromCharCode.apply(null,d)}function uo(d,s){var e=d[s]<<8|d[s+1];return e<0?65536+e:e}function Be(d,s){var e=co(d,s);return e<0?4294967296+e:e}function co(d,s){return d[s]<<24|d[s+1]<<16|d[s+2]<<8|d[s+3]}function Bn(d,s,e){d[s]=e>>24,d[s+1]=e>>16&255,d[s+2]=e>>8&255,d[s+3]=255&e}function je(d,s){var e=[];if(!s.length)return e;for(var t=d.byteLength,i=0;i<t;){var r=Be(d,i),l=r>1?i+r:t;if(xt(d.subarray(i+4,i+8))===s[0])if(s.length===1)e.push(d.subarray(i+8,l));else{var u=je(d.subarray(i+8,l),s.slice(1));u.length&&Ad.apply(e,u)}i=l}return e}function Sd(d){var s=[],e=d[0],t=8,i=Be(d,t);t+=4,t+=e===0?8:16,t+=2;var r=d.length+0,l=uo(d,t);t+=2;for(var u=0;u<l;u++){var c=t,f=Be(d,c);c+=4;var h=2147483647&f;if((2147483648&f)>>>31==1)return H.warn("SIDX has hierarchical references (not supported)"),null;var p=Be(d,c);c+=4,s.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/i,start:r,end:r+h-1}}),r+=h,t=c+=4}return{earliestPresentationTime:0,timescale:i,version:e,referencesCount:l,references:s}}function Hn(d){for(var s=[],e=je(d,["moov","trak"]),t=0;t<e.length;t++){var i=e[t],r=je(i,["tkhd"])[0];if(r){var l=r[0],u=l===0?12:20,c=Be(r,u),f=je(i,["mdia","mdhd"])[0];if(f){var h=Be(f,u=(l=f[0])===0?12:20),p=je(i,["mdia","hdlr"])[0];if(p){var E=xt(p.subarray(8,12)),b={soun:Ne,vide:ct}[E];if(b){var A=je(i,["mdia","minf","stbl","stsd"])[0],k=void 0;A&&(k=xt(A.subarray(12,16))),s[c]={timescale:h,type:b},s[b]={timescale:h,id:c,codec:k}}}}}}return je(d,["moov","mvex","trex"]).forEach(function(D){var S=Be(D,4),I=s[S];I&&(I.default={duration:Be(D,12),flags:Be(D,20)})}),s}function Gn(d){var s=je(d,["schm"])[0];if(s){var e=xt(s.subarray(4,8));if(e==="cbcs"||e==="cenc")return je(d,["schi","tenc"])[0]}return H.error("[eme] missing 'schm' box"),null}function ho(d){var s=Be(d,0),e=8;1&s&&(e+=4),4&s&&(e+=4);for(var t=0,i=Be(d,4),r=0;r<i;r++)256&s&&(t+=Be(d,e),e+=4),512&s&&(e+=4),1024&s&&(e+=4),2048&s&&(e+=4);return t}function er(d,s){var e=new Uint8Array(d.length+s.length);return e.set(d),e.set(s,d.length),e}function fo(d,s){var e=[],t=s.samples,i=s.timescale,r=s.id,l=!1;return je(t,["moof"]).map(function(u){var c=u.byteOffset-8;je(u,["traf"]).map(function(f){var h=je(f,["tfdt"]).map(function(p){var E=p[0],b=Be(p,4);return E===1&&(b*=Math.pow(2,32),b+=Be(p,8)),b/i})[0];return h!==void 0&&(d=h),je(f,["tfhd"]).map(function(p){var E=Be(p,4),b=16777215&Be(p,0),A=0,k=(16&b)!=0,D=0,S=(32&b)!=0,I=8;E===r&&((1&b)!=0&&(I+=8),(2&b)!=0&&(I+=4),(8&b)!=0&&(A=Be(p,I),I+=4),k&&(D=Be(p,I),I+=4),S&&(I+=4),s.type==="video"&&(l=function(F){if(!F)return!1;var N=F.indexOf("."),V=N<0?F:F.substring(0,N);return V==="hvc1"||V==="hev1"||V==="dvh1"||V==="dvhe"}(s.codec)),je(f,["trun"]).map(function(F){var N=F[0],V=16777215&Be(F,0),Y=(1&V)!=0,j=0,J=(4&V)!=0,Q=(256&V)!=0,X=0,ue=(512&V)!=0,ne=0,be=(1024&V)!=0,Fe=(2048&V)!=0,ye=0,Ce=Be(F,4),Pe=8;Y&&(j=Be(F,Pe),Pe+=4),J&&(Pe+=4);for(var Me=j+c,Ge=0;Ge<Ce;Ge++){if(Q?(X=Be(F,Pe),Pe+=4):X=A,ue?(ne=Be(F,Pe),Pe+=4):ne=D,be&&(Pe+=4),Fe&&(ye=N===0?Be(F,Pe):co(F,Pe),Pe+=4),s.type===ct)for(var Ke=0;Ke<ne;){var Xe=Be(t,Me);kd(l,t[Me+=4])&&Vn(t.subarray(Me,Me+Xe),l?2:1,d+ye/i,e),Me+=Xe,Ke+=Xe+4}d+=X/i}}))})})}),e}function kd(d,s){if(d){var e=s>>1&63;return e===39||e===40}return(31&s)==6}function Vn(d,s,e,t){var i=Kn(d),r=0;r+=s;for(var l=0,u=0,c=!1,f=0;r<i.length;){l=0;do{if(r>=i.length)break;l+=f=i[r++]}while(f===255);u=0;do{if(r>=i.length)break;u+=f=i[r++]}while(f===255);var h=i.length-r;if(!c&&l===4&&r<i.length){if(c=!0,i[r++]===181){var p=uo(i,r);if(r+=2,p===49){var E=Be(i,r);if(r+=4,E===1195456820){var b=i[r++];if(b===3){var A=i[r++],k=64&A,D=k?2+3*(31&A):0,S=new Uint8Array(D);if(k){S[0]=A;for(var I=1;I<D;I++)S[I]=i[r++]}t.push({type:b,payloadType:l,pts:e,bytes:S})}}}}}else if(l===5&&u<h){if(c=!0,u>16){for(var F=[],N=0;N<16;N++){var V=i[r++].toString(16);F.push(V.length==1?"0"+V:V),N!==3&&N!==5&&N!==7&&N!==9||F.push("-")}for(var Y=u-16,j=new Uint8Array(Y),J=0;J<Y;J++)j[J]=i[r++];t.push({payloadType:l,pts:e,uuid:F.join(""),userData:gi(j),userDataBytes:j})}}else if(u<h)r+=u;else if(u>h)break}}function Kn(d){for(var s=d.byteLength,e=[],t=1;t<s-2;)d[t]===0&&d[t+1]===0&&d[t+2]===3?(e.push(t+2),t+=2):t++;if(e.length===0)return d;var i=s-e.length,r=new Uint8Array(i),l=0;for(t=0;t<i;l++,t++)l===e[0]&&(l++,e.shift()),r[t]=d[l];return r}function wd(d,s,e){if(d.byteLength!==16)throw new RangeError("Invalid system id");var t,i,r;if(s){t=1,i=new Uint8Array(16*s.length);for(var l=0;l<s.length;l++){var u=s[l];if(u.byteLength!==16)throw new RangeError("Invalid key");i.set(u,16*l)}}else t=0,i=new Uint8Array;t>0?(r=new Uint8Array(4),s.length>0&&new DataView(r.buffer).setUint32(0,s.length,!1)):r=new Uint8Array;var c=new Uint8Array(4);return e&&e.byteLength>0&&new DataView(c.buffer).setUint32(0,e.byteLength,!1),function(f){for(var h=arguments.length,p=new Array(h>1?h-1:0),E=1;E<h;E++)p[E-1]=arguments[E];for(var b=p.length,A=8,k=b;k--;)A+=p[k].byteLength;var D=new Uint8Array(A);for(D[0]=A>>24&255,D[1]=A>>16&255,D[2]=A>>8&255,D[3]=255&A,D.set(f,4),k=0,A=8;k<b;k++)D.set(p[k],A),A+=p[k].byteLength;return D}([112,115,115,104],new Uint8Array([t,0,0,0]),d,r,i,c,e||new Uint8Array)}var Ua={},Ba=function(){function d(e,t,i,r,l){r===void 0&&(r=[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=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=l,this.encrypted=!!e&&e!=="NONE",this.isCommonEncryption=this.encrypted&&e!=="AES-128"}d.clearKeyUriToKeyIdMap=function(){Ua={}};var s=d.prototype;return s.isSupported=function(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case jt:case ri:case ii:case Si:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1},s.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||H.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),e=0);var t=function(D){for(var S=new Uint8Array(16),I=12;I<16;I++)S[I]=D>>8*(15-I)&255;return S}(e);return new d(this.method,this.uri,"identity",this.keyFormatVersions,t)}var i=_t(this.uri);if(i)switch(this.keyFormat){case ri:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case ii:var r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=wd(r,null,i);var l=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),u=String.fromCharCode.apply(null,Array.from(l)),c=u.substring(u.indexOf("<"),u.length),f=new DOMParser().parseFromString(c,"text/xml").getElementsByTagName("KID")[0];if(f){var h=f.childNodes[0]?f.childNodes[0].nodeValue:f.getAttribute("VALUE");if(h){var p=tt(h).subarray(0,16);(function(D){var S=function(I,F,N){var V=I[F];I[F]=I[N],I[N]=V};S(D,0,3),S(D,1,2),S(D,4,5),S(D,6,7)})(p),this.keyId=p}}break;default:var E=i.subarray(0,16);if(E.length!==16){var b=new Uint8Array(16);b.set(E,16-E.length),E=b}this.keyId=E}if(!this.keyId||this.keyId.byteLength!==16){var A=Ua[this.uri];if(!A){var k=Object.keys(Ua).length%Number.MAX_SAFE_INTEGER;A=new Uint8Array(16),new DataView(A.buffer,12,4).setUint32(0,k),Ua[this.uri]=A}this.keyId=A}return this},d}(),Wn=/\{\$([a-zA-Z0-9-_]+)\}/g;function Ha(d){return Wn.test(d)}function zt(d,s,e){if(d.variableList!==null||d.hasVariableRefs)for(var t=e.length;t--;){var i=e[t],r=s[i];r&&(s[i]=qn(d,r))}}function qn(d,s){if(d.variableList!==null||d.hasVariableRefs){var e=d.variableList;return s.replace(Wn,function(t){var i=t.substring(2,t.length-1),r=e==null?void 0:e[i];return r===void 0?(d.playlistParsingError||(d.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+i+'"')),t):r})}return s}function mo(d,s,e){var t,i,r=d.variableList;if(r||(d.variableList=r={}),"QUERYPARAM"in s){t=s.QUERYPARAM;try{var l=new self.URL(e).searchParams;if(!l.has(t))throw new Error('"'+t+'" does not match any query parameter in URI: "'+e+'"');i=l.get(t)}catch(u){d.playlistParsingError||(d.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+u.message))}}else t=s.NAME,i=s.VALUE;t in r?d.playlistParsingError||(d.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+t+'"')):r[t]=i||""}function Vi(d,s,e){var t=s.IMPORT;if(e&&t in e){var i=d.variableList;i||(d.variableList=i={}),i[t]=e[t]}else d.playlistParsingError||(d.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+t+'"'))}var Ld={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 Ga(d,s){return MediaSource.isTypeSupported((s||"video")+'/mp4;codecs="'+d+'"')}var po=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,vo=/#EXT-X-MEDIA:(.*)/g,go=/^#EXT(?:INF|-X-TARGETDURATION):/m,Yn=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Ur=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|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("|")),Ki=function(){function d(){}return d.findGroup=function(s,e){for(var t=0;t<s.length;t++){var i=s[t];if(i.id===e)return i}},d.convertAVC1ToAVCOTI=function(s){var e=s.split(".");if(e.length>2){var t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4)}return s},d.resolve=function(s,e){return Ue.buildAbsoluteURL(e,s,{alwaysNormalize:!0})},d.isMediaPlaylist=function(s){return go.test(s)},d.parseMasterPlaylist=function(s,e){var t,i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Ha(s)},r=[];for(po.lastIndex=0;(t=po.exec(s))!=null;)if(t[1]){var l,u=new Je(t[1]);zt(i,u,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);var c=qn(i,t[2]),f={attrs:u,bitrate:u.decimalInteger("AVERAGE-BANDWIDTH")||u.decimalInteger("BANDWIDTH"),name:u.NAME,url:d.resolve(c,e)},h=u.decimalResolution("RESOLUTION");h&&(f.width=h.width,f.height=h.height),Va((u.CODECS||"").split(/[ ,]+/).filter(function(F){return F}),f),f.videoCodec&&f.videoCodec.indexOf("avc1")!==-1&&(f.videoCodec=d.convertAVC1ToAVCOTI(f.videoCodec)),(l=f.unknownCodecs)!=null&&l.length||r.push(f),i.levels.push(f)}else if(t[3]){var p=t[3],E=t[4];switch(p){case"SESSION-DATA":var b=new Je(E);zt(i,b,["DATA-ID","LANGUAGE","VALUE","URI"]);var A=b["DATA-ID"];A&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[A]=b);break;case"SESSION-KEY":var k=yo(E,e,i);k.encrypted&&k.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(k)):H.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+E+'"');break;case"DEFINE":var D=new Je(E);zt(i,D,["NAME","VALUE","QUERYPARAM"]),mo(i,D,e);break;case"CONTENT-STEERING":var S=new Je(E);zt(i,S,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:d.resolve(S["SERVER-URI"],e),pathwayId:S["PATHWAY-ID"]||"."};break;case"START":i.startTimeOffset=$n(E)}}var I=r.length>0&&r.length<i.levels.length;return i.levels=I?r:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i},d.parseMasterPlaylistMedia=function(s,e,t){var i,r={},l=t.levels,u={AUDIO:l.map(function(k){return{id:k.attrs.AUDIO,audioCodec:k.audioCodec}}),SUBTITLES:l.map(function(k){return{id:k.attrs.SUBTITLES,textCodec:k.textCodec}}),"CLOSED-CAPTIONS":[]},c=0;for(vo.lastIndex=0;(i=vo.exec(s))!==null;){var f=new Je(i[1]),h=f.TYPE;if(h){var p=u[h],E=r[h]||[];r[h]=E,zt(t,f,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);var b={attrs:f,bitrate:0,id:c++,groupId:f["GROUP-ID"]||"",instreamId:f["INSTREAM-ID"],name:f.NAME||f.LANGUAGE||"",type:h,default:f.bool("DEFAULT"),autoselect:f.bool("AUTOSELECT"),forced:f.bool("FORCED"),lang:f.LANGUAGE,url:f.URI?d.resolve(f.URI,e):""};if(p!=null&&p.length){var A=d.findGroup(p,b.groupId)||p[0];Eo(b,A,"audioCodec"),Eo(b,A,"textCodec")}E.push(b)}}return r},d.parseLevelPlaylist=function(s,e,t,i,r,l){var u,c,f,h=new Te(e),p=h.fragments,E=null,b=0,A=0,k=0,D=0,S=null,I=new Zi(i,e),F=-1,N=!1;for(Yn.lastIndex=0,h.m3u8=s,h.hasVariableRefs=Ha(s);(u=Yn.exec(s))!==null;){N&&(N=!1,(I=new Zi(i,e)).start=k,I.sn=b,I.cc=D,I.level=t,E&&(I.initSegment=E,I.rawProgramDateTime=E.rawProgramDateTime,E.rawProgramDateTime=null));var V=u[1];if(V){I.duration=parseFloat(V);var Y=(" "+u[2]).slice(1);I.title=Y||null,I.tagList.push(Y?["INF",V,Y]:["INF",V])}else if(u[3]){if(le(I.duration)){I.start=k,f&&To(I,f,h),I.sn=b,I.level=t,I.cc=D,I.urlId=r,p.push(I);var j=(" "+u[3]).slice(1);I.relurl=qn(h,j),bo(I,S),S=I,k+=I.duration,b++,A=0,N=!0}}else if(u[4]){var J=(" "+u[4]).slice(1);S?I.setByteRange(J,S):I.setByteRange(J)}else if(u[5])I.rawProgramDateTime=(" "+u[5]).slice(1),I.tagList.push(["PROGRAM-DATE-TIME",I.rawProgramDateTime]),F===-1&&(F=p.length);else{if(!(u=u[0].match(Ur))){H.warn("No matches on slow regex match for level playlist!");continue}for(c=1;c<u.length&&u[c]===void 0;c++);var Q=(" "+u[c]).slice(1),X=(" "+u[c+1]).slice(1),ue=u[c+2]?(" "+u[c+2]).slice(1):"";switch(Q){case"PLAYLIST-TYPE":h.type=X.toUpperCase();break;case"MEDIA-SEQUENCE":b=h.startSN=parseInt(X);break;case"SKIP":var ne=new Je(X);zt(h,ne,["RECENTLY-REMOVED-DATERANGES"]);var be=ne.decimalInteger("SKIPPED-SEGMENTS");if(le(be)){h.skippedSegments=be;for(var Fe=be;Fe--;)p.unshift(null);b+=be}var ye=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");ye&&(h.recentlyRemovedDateranges=ye.split(" "));break;case"TARGETDURATION":h.targetduration=Math.max(parseInt(X),1);break;case"VERSION":h.version=parseInt(X);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"#":(X||ue)&&I.tagList.push(ue?[X,ue]:[X]);break;case"DISCONTINUITY":D++,I.tagList.push(["DIS"]);break;case"GAP":I.gap=!0,I.tagList.push([Q]);break;case"BITRATE":I.tagList.push([Q,X]);break;case"DATERANGE":var Ce=new Je(X);zt(h,Ce,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),zt(h,Ce,Ce.clientAttrs);var Pe=new mi(Ce,h.dateRanges[Ce.ID]);Pe.isValid||h.skippedSegments?h.dateRanges[Pe.id]=Pe:H.warn('Ignoring invalid DATERANGE tag: "'+X+'"'),I.tagList.push(["EXT-X-DATERANGE",X]);break;case"DEFINE":var Me=new Je(X);zt(h,Me,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in Me?Vi(h,Me,l):mo(h,Me,e);break;case"DISCONTINUITY-SEQUENCE":D=parseInt(X);break;case"KEY":var Ge=yo(X,e,h);if(Ge.isSupported()){if(Ge.method==="NONE"){f=void 0;break}f||(f={}),f[Ge.keyFormat]&&(f=U({},f)),f[Ge.keyFormat]=Ge}else H.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+X+'"');break;case"START":h.startTimeOffset=$n(X);break;case"MAP":var Ke=new Je(X);if(zt(h,Ke,["BYTERANGE","URI"]),I.duration){var Xe=new Zi(i,e);_o(Xe,Ke,t,f),E=Xe,I.initSegment=E,E.rawProgramDateTime&&!I.rawProgramDateTime&&(I.rawProgramDateTime=E.rawProgramDateTime)}else _o(I,Ke,t,f),E=I,N=!0;break;case"SERVER-CONTROL":var lt=new Je(X);h.canBlockReload=lt.bool("CAN-BLOCK-RELOAD"),h.canSkipUntil=lt.optionalFloat("CAN-SKIP-UNTIL",0),h.canSkipDateRanges=h.canSkipUntil>0&<.bool("CAN-SKIP-DATERANGES"),h.partHoldBack=lt.optionalFloat("PART-HOLD-BACK",0),h.holdBack=lt.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var ui=new Je(X);h.partTarget=ui.decimalFloatingPoint("PART-TARGET");break;case"PART":var Ot=h.partList;Ot||(Ot=h.partList=[]);var Wi=A>0?Ot[Ot.length-1]:void 0,xi=A++,Pi=new Je(X);zt(h,Pi,["BYTERANGE","URI"]);var Nt=new te(Pi,I,e,xi,Wi);Ot.push(Nt),I.duration+=Nt.duration;break;case"PRELOAD-HINT":var qt=new Je(X);zt(h,qt,["URI"]),h.preloadHint=qt;break;case"RENDITION-REPORT":var nr=new Je(X);zt(h,nr,["URI"]),h.renditionReports=h.renditionReports||[],h.renditionReports.push(nr);break;default:H.warn("line parsed but not handled: "+u)}}}S&&!S.relurl?(p.pop(),k-=S.duration,h.partList&&(h.fragmentHint=S)):h.partList&&(bo(I,S),I.cc=D,h.fragmentHint=I,f&&To(I,f,h));var Kr=p.length,bi=p[0],rs=p[Kr-1];if((k+=h.skippedSegments*h.targetduration)>0&&Kr&&rs){h.averagetargetduration=k/Kr;var as=rs.sn;h.endSN=as!=="initSegment"?as:0,h.live||(rs.endList=!0),bi&&(h.startCC=bi.cc)}else h.endSN=0,h.startCC=0;return h.fragmentHint&&(k+=h.fragmentHint.duration),h.totalduration=k,h.endCC=D,F>0&&function(Go,an){for(var va=Go[an],ns=an;ns--;){var Tr=Go[ns];if(!Tr)return;Tr.programDateTime=va.programDateTime-1e3*Tr.duration,va=Tr}}(p,F),h},d}();function yo(d,s,e){var t,i,r=new Je(d);zt(e,r,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var l=(t=r.METHOD)!=null?t:"",u=r.URI,c=r.hexadecimalInteger("IV"),f=r.KEYFORMATVERSIONS,h=(i=r.KEYFORMAT)!=null?i:"identity";u&&r.IV&&!c&&H.error("Invalid IV: "+r.IV);var p=u?Ki.resolve(u,s):"",E=(f||"1").split("/").map(Number).filter(Number.isFinite);return new Ba(l,p,h,E,c)}function $n(d){var s=new Je(d).decimalFloatingPoint("TIME-OFFSET");return le(s)?s:null}function Va(d,s){["video","audio","text"].forEach(function(e){var t=d.filter(function(r){return function(l,u){var c=Ld[u];return!!c&&c[l.slice(0,4)]===!0}(r,e)});if(t.length){var i=t.filter(function(r){return r.lastIndexOf("avc1",0)===0||r.lastIndexOf("mp4a",0)===0});s[e+"Codec"]=i.length>0?i[0]:t[0],d=d.filter(function(r){return t.indexOf(r)===-1})}}),s.unknownCodecs=d}function Eo(d,s,e){var t=s[e];t&&(d[e]=t)}function bo(d,s){d.rawProgramDateTime?d.programDateTime=Date.parse(d.rawProgramDateTime):s!=null&&s.programDateTime&&(d.programDateTime=s.endProgramDateTime),le(d.programDateTime)||(d.programDateTime=null,d.rawProgramDateTime=null)}function _o(d,s,e,t){d.relurl=s.URI,s.BYTERANGE&&d.setByteRange(s.BYTERANGE),d.level=e,d.sn="initSegment",t&&(d.levelkeys=t),d.initSegment=null}function To(d,s,e){d.levelkeys=s;var t=e.encryptedFragments;t.length&&t[t.length-1].levelkeys===s||!Object.keys(s).some(function(i){return s[i].isCommonEncryption})||t.push(d)}var gr="manifest",yr="level",ki="audioTrack",wi="subtitleTrack",rt="main",Li="audio",Ii="subtitle";function Ao(d){switch(d.type){case ki:return Li;case wi:return Ii;default:return rt}}function Ka(d,s){var e=d.url;return e!==void 0&&e.indexOf("data:")!==0||(e=s.url),e}var So=function(){function d(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}var s=d.prototype;return s.startLoad=function(e){},s.stopLoad=function(){this.destroyInternalLoaders()},s.registerListeners=function(){var e=this.hls;e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.LEVEL_LOADING,this.onLevelLoading,this),e.on(w.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(w.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.LEVEL_LOADING,this.onLevelLoading,this),e.off(w.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(w.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,r=t.loader,l=new(i||r)(t);return this.loaders[e.type]=l,l},s.getInternalLoader=function(e){return this.loaders[e.type]},s.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},s.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},s.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},s.onManifestLoading=function(e,t){var i=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:gr,url:i,deliveryDirectives:null})},s.onLevelLoading=function(e,t){var i=t.id,r=t.level,l=t.url,u=t.deliveryDirectives;this.load({id:i,level:r,responseType:"text",type:yr,url:l,deliveryDirectives:u})},s.onAudioTrackLoading=function(e,t){var i=t.id,r=t.groupId,l=t.url,u=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:ki,url:l,deliveryDirectives:u})},s.onSubtitleTrackLoading=function(e,t){var i=t.id,r=t.groupId,l=t.url,u=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:wi,url:l,deliveryDirectives:u})},s.load=function(e){var t,i,r,l=this,u=this.hls.config,c=this.getInternalLoader(e);if(c){var f=c.context;if(f&&f.url===e.url)return void H.trace("[playlist-loader]: playlist request ongoing");H.log("[playlist-loader]: aborting previous loader for type: "+e.type),c.abort()}if(i=e.type===gr?u.manifestLoadPolicy.default:U({},u.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),c=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part&&(e.type===yr&&e.level!==null?r=this.hls.levels[e.level].details:e.type===ki&&e.id!==null?r=this.hls.audioTracks[e.id].details:e.type===wi&&e.id!==null&&(r=this.hls.subtitleTracks[e.id].details),r)){var h=r.partTarget,p=r.targetduration;if(h&&p){var E=1e3*Math.max(3*h,.8*p);i=U({},i,{maxTimeToFirstByteMs:Math.min(E,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(E,i.maxTimeToFirstByteMs)})}}var b=i.errorRetry||i.timeoutRetry||{},A={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:b.maxNumRetry||0,retryDelay:b.retryDelayMs||0,maxRetryDelay:b.maxRetryDelayMs||0},k={onSuccess:function(D,S,I,F){var N=l.getInternalLoader(I);l.resetInternalLoader(I.type);var V=D.data;V.indexOf("#EXTM3U")===0?(S.parsing.start=performance.now(),Ki.isMediaPlaylist(V)?l.handleTrackOrLevelPlaylist(D,S,I,F||null,N):l.handleMasterPlaylist(D,S,I,F)):l.handleManifestParsingError(D,I,new Error("no EXTM3U delimiter"),F||null,S)},onError:function(D,S,I,F){l.handleNetworkError(S,I,!1,D,F)},onTimeout:function(D,S,I){l.handleNetworkError(S,I,!0,void 0,D)}};c.load(e,A,k)},s.handleMasterPlaylist=function(e,t,i,r){var l=this.hls,u=e.data,c=Ka(e,i),f=Ki.parseMasterPlaylist(u,c);if(f.playlistParsingError)this.handleManifestParsingError(e,i,f.playlistParsingError,r,t);else{var h=f.contentSteering,p=f.levels,E=f.sessionData,b=f.sessionKeys,A=f.startTimeOffset,k=f.variableList;this.variableList=k;var D=Ki.parseMasterPlaylistMedia(u,c,f),S=D.AUDIO,I=S===void 0?[]:S,F=D.SUBTITLES,N=D["CLOSED-CAPTIONS"];I.length&&(I.some(function(V){return!V.url})||!p[0].audioCodec||p[0].attrs.AUDIO||(H.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),I.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Je({}),bitrate:0,url:""}))),l.trigger(w.MANIFEST_LOADED,{levels:p,audioTracks:I,subtitles:F,captions:N,contentSteering:h,url:c,stats:t,networkDetails:r,sessionData:E,sessionKeys:b,startTimeOffset:A,variableList:k})}},s.handleTrackOrLevelPlaylist=function(e,t,i,r,l){var u=this.hls,c=i.id,f=i.level,h=i.type,p=Ka(e,i),E=le(c)?c:0,b=le(f)?f:E,A=Ao(i),k=Ki.parseLevelPlaylist(e.data,p,b,A,E,this.variableList);if(h===gr){var D={attrs:new Je({}),bitrate:0,details:k,name:"",url:p};u.trigger(w.MANIFEST_LOADED,{levels:[D],audioTracks:[],url:p,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=k,this.handlePlaylistLoaded(k,e,t,i,r,l)},s.handleManifestParsingError=function(e,t,i,r,l){this.hls.trigger(w.ERROR,{type:oe.NETWORK_ERROR,details:W.MANIFEST_PARSING_ERROR,fatal:t.type===gr,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:l})},s.handleNetworkError=function(e,t,i,r,l){i===void 0&&(i=!1);var u="A network "+(i?"timeout":"error"+(r?" (status "+r.code+")":""))+" occurred while loading "+e.type;e.type===yr?u+=": "+e.level+" id: "+e.id:e.type!==ki&&e.type!==wi||(u+=" id: "+e.id+' group-id: "'+e.groupId+'"');var c=new Error(u);H.warn("[playlist-loader]: "+u);var f=W.UNKNOWN,h=!1,p=this.getInternalLoader(e);switch(e.type){case gr:f=i?W.MANIFEST_LOAD_TIMEOUT:W.MANIFEST_LOAD_ERROR,h=!0;break;case yr:f=i?W.LEVEL_LOAD_TIMEOUT:W.LEVEL_LOAD_ERROR,h=!1;break;case ki:f=i?W.AUDIO_TRACK_LOAD_TIMEOUT:W.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case wi:f=i?W.SUBTITLE_TRACK_LOAD_TIMEOUT:W.SUBTITLE_LOAD_ERROR,h=!1}p&&this.resetInternalLoader(e.type);var E={type:oe.NETWORK_ERROR,details:f,fatal:h,url:e.url,loader:p,context:e,error:c,networkDetails:t,stats:l};if(r){var b=(t==null?void 0:t.url)||e.url;E.response=g({url:b,data:void 0},r)}this.hls.trigger(w.ERROR,E)},s.handlePlaylistLoaded=function(e,t,i,r,l,u){var c=this.hls,f=r.type,h=r.level,p=r.id,E=r.groupId,b=r.deliveryDirectives,A=Ka(t,r),k=Ao(r),D=typeof r.level=="number"&&k===rt?h:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var S=e.playlistParsingError;if(S)c.trigger(w.ERROR,{type:oe.NETWORK_ERROR,details:W.LEVEL_PARSING_ERROR,fatal:!1,url:A,error:S,reason:S.message,response:t,context:r,level:D,parent:k,networkDetails:l,stats:i});else switch(e.live&&u&&(u.getCacheAge&&(e.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),f){case gr:case yr:c.trigger(w.LEVEL_LOADED,{details:e,level:D||0,id:p||0,stats:i,networkDetails:l,deliveryDirectives:b});break;case ki:c.trigger(w.AUDIO_TRACK_LOADED,{details:e,id:p||0,groupId:E||"",stats:i,networkDetails:l,deliveryDirectives:b});break;case wi:c.trigger(w.SUBTITLE_TRACK_LOADED,{details:e,id:p||0,groupId:E||"",stats:i,networkDetails:l,deliveryDirectives:b})}}else{var I=new Error("No Segments found in Playlist");c.trigger(w.ERROR,{type:oe.NETWORK_ERROR,details:W.LEVEL_EMPTY_ERROR,fatal:!1,url:A,error:I,reason:I.message,response:t,context:r,level:D,parent:k,networkDetails:l,stats:i})}},d}();function Wa(d,s){var e;try{e=new Event("addtrack")}catch{(e=document.createEvent("Event")).initEvent("addtrack",!1,!1)}e.track=d,s.dispatchEvent(e)}function ko(d,s){var e=d.mode;if(e==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(s.id))try{if(d.addCue(s),!d.cues.getCueById(s.id))throw new Error("addCue is failed for: "+s)}catch(i){H.debug("[texttrack-utils]: "+i);var t=new self.TextTrackCue(s.startTime,s.endTime,s.text);t.id=s.id,d.addCue(t)}e==="disabled"&&(d.mode=e)}function Br(d){var s=d.mode;if(s==="disabled"&&(d.mode="hidden"),d.cues)for(var e=d.cues.length;e--;)d.removeCue(d.cues[e]);s==="disabled"&&(d.mode=s)}function Tt(d,s,e,t){var i=d.mode;if(i==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var r=function(u,c,f){var h=[],p=function(k,D){if(D<k[0].startTime)return 0;var S=k.length-1;if(D>k[S].endTime)return-1;for(var I=0,F=S;I<=F;){var N=Math.floor((F+I)/2);if(D<k[N].startTime)F=N-1;else{if(!(D>k[N].startTime&&I<S))return N;I=N+1}}return k[I].startTime-D<D-k[F].startTime?I:F}(u,c);if(p>-1)for(var E=p,b=u.length;E<b;E++){var A=u[E];if(A.startTime>=c&&A.endTime<=f)h.push(A);else if(A.startTime>f)return h}return h}(d.cues,s,e),l=0;l<r.length;l++)t&&!t(r[l])||d.removeCue(r[l]);i==="disabled"&&(d.mode=i)}var tr="org.id3",Id="com.apple.quicktime.HLS",oa="https://aomedia.org/emsg/ID3";function jn(){if(typeof self!="undefined")return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var qa=function(){var d=jn();try{new d(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function Er(d,s){return d.getTime()/1e3-s}var zn=function(){function d(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var s=d.prototype;return s.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},s._registerListeners=function(){var e=this.hls;e.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(w.LEVEL_UPDATED,this.onLevelUpdated,this)},s._unregisterListeners=function(){var e=this.hls;e.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(w.LEVEL_UPDATED,this.onLevelUpdated,this)},s.onMediaAttached=function(e,t){this.media=t.media},s.onMediaDetaching=function(){this.id3Track&&(Br(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})},s.onManifestLoading=function(){this.dateRangeCuesAppended={}},s.createTrack=function(e){var t=this.getID3Track(e.textTracks);return t.mode="hidden",t},s.getID3Track=function(e){if(this.media){for(var t=0;t<e.length;t++){var i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Wa(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},s.onFragParsingMetadata=function(e,t){if(this.media){var i=this.hls.config,r=i.enableEmsgMetadataCues,l=i.enableID3MetadataCues;if(r||l){var u=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var c=jn(),f=0;f<u.length;f++){var h=u[f].type;if((h!==oa||r)&&l){var p=no(u[f].data);if(p){var E=u[f].pts,b=E+u[f].duration;b>qa&&(b=qa),b-E<=0&&(b=E+.25);for(var A=0;A<p.length;A++){var k=p[A];if(!ro(k)){this.updateId3CueEnds(E);var D=new c(E,b,"");D.value=k,h&&(D.type=h),this.id3Track.addCue(D)}}}}}}}},s.updateId3CueEnds=function(e){var t,i=(t=this.id3Track)==null?void 0:t.cues;if(i)for(var r=i.length;r--;){var l=i[r];l.startTime<e&&l.endTime===qa&&(l.endTime=e)}},s.onBufferFlushing=function(e,t){var i=t.startOffset,r=t.endOffset,l=t.type,u=this.id3Track,c=this.hls;if(c){var f=c.config,h=f.enableEmsgMetadataCues,p=f.enableID3MetadataCues;u&&(h||p)&&Tt(u,i,r,l==="audio"?function(E){return E.type===tr&&p}:l==="video"?function(E){return E.type===oa&&h}:function(E){return E.type===tr&&p||E.type===oa&&h})}},s.onLevelUpdated=function(e,t){var i=this,r=t.details;if(this.media&&r.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var l=this.dateRangeCuesAppended,u=this.id3Track,c=r.dateRanges,f=Object.keys(c);if(u)for(var h=Object.keys(l).filter(function(I){return!f.includes(I)}),p=function(){var I=h[E];Object.keys(l[I].cues).forEach(function(F){u.removeCue(l[I].cues[F])}),delete l[I]},E=h.length;E--;)p();var b=r.fragments[r.fragments.length-1];if(f.length!==0&&le(b==null?void 0:b.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var A=b.programDateTime/1e3-b.start,k=jn(),D=function(){var I=f[S],F=c[I],N=l[I],V=(N==null?void 0:N.cues)||{},Y=(N==null?void 0:N.durationKnown)||!1,j=Er(F.startDate,A),J=qa,Q=F.endDate;if(Q)J=Er(Q,A),Y=!0;else if(F.endOnNext&&!Y){var X=f.reduce(function(Me,Ge){var Ke=c[Ge];return Ke.class===F.class&&Ke.id!==Ge&&Ke.startDate>F.startDate&&Me.push(Ke),Me},[]).sort(function(Me,Ge){return Me.startDate.getTime()-Ge.startDate.getTime()})[0];X&&(J=Er(X.startDate,A),Y=!0)}for(var ue,ne,be=Object.keys(F.attr),Fe=0;Fe<be.length;Fe++){var ye=be[Fe];if((ne=ye)!=="ID"&&ne!=="CLASS"&&ne!=="START-DATE"&&ne!=="DURATION"&&ne!=="END-DATE"&&ne!=="END-ON-NEXT"){var Ce=V[ye];if(Ce)Y&&!N.durationKnown&&(Ce.endTime=J);else{var Pe=F.attr[ye];Ce=new k(j,J,""),Vt(ye)&&(ue=Pe,Pe=Uint8Array.from(ue.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),Ce.value={key:ye,data:Pe},Ce.type=Id,Ce.id=I,i.id3Track.addCue(Ce),V[ye]=Ce}}}l[I]={cues:V,dateRange:F,durationKnown:Y}},S=0;S<f.length;S++)D()}}},d}(),wo=function(){function d(e){var t=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 t.timeupdate()},this.hls=e,this.config=e.config,this.registerListeners()}var s=d.prototype;return s.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},s.registerListeners=function(){this.hls.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(w.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(w.ERROR,this.onError,this)},s.unregisterListeners=function(){this.hls.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(w.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(w.ERROR,this.onError,this)},s.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},s.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},s.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},s.onLevelUpdated=function(e,t){var i=t.details;this.levelDetails=i,i.advanced&&this.timeupdate(),!i.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},s.onError=function(e,t){var i;t.details===W.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&H.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},s.timeupdate=function(){var e=this.media,t=this.levelDetails;if(e&&t){this.currentTime=e.currentTime;var i=this.computeLatency();if(i!==null){this._latency=i;var r=this.config,l=r.lowLatencyMode,u=r.maxLiveSyncPlaybackRate;if(l&&u!==1){var c=this.targetLatency;if(c!==null){var f=i-c,h=f<Math.min(this.maxLatency,c+t.targetduration);if(t.live&&h&&f>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,u)),E=Math.round(2/(1+Math.exp(-.75*f-this.edgeStalled))*20)/20;e.playbackRate=Math.min(p,Math.max(1,E))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}}}}},s.estimateLiveEdge=function(){var e=this.levelDetails;return e===null?null:e.edge+e.age},s.computeLatency=function(){var e=this.estimateLiveEdge();return e===null?null:e-this.currentTime},M(d,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e=this.levelDetails;if(e===null)return null;var t=e.holdBack,i=e.partHoldBack,r=e.targetduration,l=this.config,u=l.liveSyncDuration,c=l.liveSyncDurationCount,f=l.lowLatencyMode,h=this.hls.userConfig,p=f&&i||t;(h.liveSyncDuration||h.liveSyncDurationCount||p===0)&&(p=u!==void 0?u:c*r);var E=r;return p+Math.min(1*this.stallCount,E)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;var r=i.edge,l=e-t-this.edgeStalled,u=r-i.totalduration,c=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(u,l),c)}},{key:"drift",get:function(){var e=this.levelDetails;return e===null?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.levelDetails;if(e===null)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}}]),d}(),Ya=["NONE","TYPE-0","TYPE-1",null],ir="",Rd="YES",Dd="v2",Lo=function(){function d(s,e,t){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=s,this.part=e,this.skip=t}return d.prototype.addDirectives=function(s){var e=new self.URL(s);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},d}(),la=function(){function d(s){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=[s.url],this._attrs=[s.attrs],this.bitrate=s.bitrate,s.details&&(this.details=s.details),this.id=s.id||0,this.name=s.name,this.width=s.width||0,this.height=s.height||0,this.audioCodec=s.audioCodec,this.videoCodec=s.videoCodec,this.unknownCodecs=s.unknownCodecs,this.codecSet=[s.videoCodec,s.audioCodec].filter(function(e){return e}).join(",").replace(/\.[^.,]+/g,"")}return d.prototype.addFallback=function(s){this.url.push(s.url),this._attrs.push(s.attrs)},M(d,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"attrs",get:function(){return this._attrs[this._urlId]}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(s){var e=s%this.url.length;this._urlId!==e&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=e)}},{key:"audioGroupId",get:function(){var s;return(s=this.audioGroupIds)==null?void 0:s[this.urlId]}},{key:"textGroupId",get:function(){var s;return(s=this.textGroupIds)==null?void 0:s[this.urlId]}}]),d}();function Qn(d,s){var e=s.startPTS;if(le(e)){var t,i=0;s.sn>d.sn?(i=e-d.start,t=d):(i=d.start-e,t=s),t.duration!==i&&(t.duration=i)}else s.sn>d.sn?d.cc===s.cc&&d.minEndPTS?s.start=d.start+(d.minEndPTS-d.start):s.start=d.start+d.duration:s.start=Math.max(d.start-s.duration,0)}function Io(d,s,e,t,i,r){t-e<=0&&(H.warn("Fragment should have a positive duration",s),t=e+s.duration,r=i+s.duration);var l=e,u=t,c=s.startPTS,f=s.endPTS;if(le(c)){var h=Math.abs(c-e);le(s.deltaPTS)?s.deltaPTS=Math.max(h,s.deltaPTS):s.deltaPTS=h,l=Math.max(e,c),e=Math.min(e,c),i=Math.min(i,s.startDTS),u=Math.min(t,f),t=Math.max(t,f),r=Math.max(r,s.endDTS)}var p=e-s.start;s.start!==0&&(s.start=e),s.duration=t-s.start,s.startPTS=e,s.maxStartPTS=l,s.startDTS=i,s.endPTS=t,s.minEndPTS=u,s.endDTS=r;var E,b=s.sn;if(!d||b<d.startSN||b>d.endSN)return 0;var A=b-d.startSN,k=d.fragments;for(k[A]=s,E=A;E>0;E--)Qn(k[E],k[E-1]);for(E=A;E<k.length-1;E++)Qn(k[E],k[E+1]);return d.fragmentHint&&Qn(k[k.length-1],d.fragmentHint),d.PTSKnown=d.alignedSliding=!0,p}function Cd(d,s){for(var e=null,t=d.fragments,i=t.length-1;i>=0;i--){var r=t[i].initSegment;if(r){e=r;break}}d.fragmentHint&&delete d.fragmentHint.endPTS;var l,u,c,f,h,p=0;if(function(S,I,F){for(var N=I.skippedSegments,V=Math.max(S.startSN,I.startSN)-I.startSN,Y=(S.fragmentHint?1:0)+(N?I.endSN:Math.min(S.endSN,I.endSN))-I.startSN,j=I.startSN-S.startSN,J=I.fragmentHint?I.fragments.concat(I.fragmentHint):I.fragments,Q=S.fragmentHint?S.fragments.concat(S.fragmentHint):S.fragments,X=V;X<=Y;X++){var ue=Q[j+X],ne=J[X];N&&!ne&&X<N&&(ne=I.fragments[X]=ue),ue&&ne&&F(ue,ne)}}(d,s,function(S,I){S.relurl&&(p=S.cc-I.cc),le(S.startPTS)&&le(S.endPTS)&&(I.start=I.startPTS=S.startPTS,I.startDTS=S.startDTS,I.maxStartPTS=S.maxStartPTS,I.endPTS=S.endPTS,I.endDTS=S.endDTS,I.minEndPTS=S.minEndPTS,I.duration=S.endPTS-S.startPTS,I.duration&&(l=I),s.PTSKnown=s.alignedSliding=!0),I.elementaryStreams=S.elementaryStreams,I.loader=S.loader,I.stats=S.stats,I.urlId=S.urlId,S.initSegment&&(I.initSegment=S.initSegment,e=S.initSegment)}),e&&(s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments).forEach(function(S){var I;S.initSegment&&S.initSegment.relurl!==((I=e)==null?void 0:I.relurl)||(S.initSegment=e)}),s.skippedSegments)if(s.deltaUpdateFailed=s.fragments.some(function(S){return!S}),s.deltaUpdateFailed){H.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var E=s.skippedSegments;E--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}else s.canSkipDateRanges&&(s.dateRanges=(u=d.dateRanges,c=s.dateRanges,f=s.recentlyRemovedDateranges,h=U({},u),f&&f.forEach(function(S){delete h[S]}),Object.keys(c).forEach(function(S){var I=new mi(c[S].attr,h[S]);I.isValid?h[S]=I:H.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(c[S].attr)+'"')}),h));var b=s.fragments;if(p){H.warn("discontinuity sliding from playlist, take drift into account");for(var A=0;A<b.length;A++)b[A].cc+=p}s.skippedSegments&&(s.startCC=s.fragments[0].cc),function(S,I,F){if(S&&I)for(var N=0,V=0,Y=S.length;V<=Y;V++){var j=S[V],J=I[V+N];j&&J&&j.index===J.index&&j.fragment.sn===J.fragment.sn?F(j,J):N--}}(d.partList,s.partList,function(S,I){I.elementaryStreams=S.elementaryStreams,I.stats=S.stats}),l?Io(s,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS):Ro(d,s),b.length&&(s.totalduration=s.edge-b[0].start),s.driftStartTime=d.driftStartTime,s.driftStart=d.driftStart;var k=s.advancedDateTime;if(s.advanced&&k){var D=s.edge;s.driftStart||(s.driftStartTime=k,s.driftStart=D),s.driftEndTime=k,s.driftEnd=D}else s.driftEndTime=d.driftEndTime,s.driftEnd=d.driftEnd,s.advancedDateTime=d.advancedDateTime}function Ro(d,s){var e=s.startSN+s.skippedSegments-d.startSN,t=d.fragments;e<0||e>=t.length||Xn(s,t[e].start)}function Xn(d,s){if(s){for(var e=d.fragments,t=d.skippedSegments;t<e.length;t++)e[t].start+=s;d.fragmentHint&&(d.fragmentHint.start+=s)}}function da(d,s,e){var t;return d!=null&&d.details?$a((t=d.details)==null?void 0:t.partList,s,e):null}function $a(d,s,e){if(d)for(var t=d.length;t--;){var i=d[t];if(i.index===e&&i.fragment.sn===s)return i}return null}function ua(d){switch(d.details){case W.FRAG_LOAD_TIMEOUT:case W.KEY_LOAD_TIMEOUT:case W.LEVEL_LOAD_TIMEOUT:case W.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function ja(d,s){var e=ua(s);return d.default[(e?"timeout":"error")+"Retry"]}function Zn(d,s){var e=d.backoff==="linear"?1:Math.pow(2,s);return Math.min(e*d.retryDelayMs,d.maxRetryDelayMs)}function Do(d){return g(g({},d),{errorRetry:null,timeoutRetry:null})}function za(d,s,e,t){return!!d&&s<d.maxNumRetry&&(function(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}(t)||!!e)}var Co=function(d,s){for(var e=0,t=d.length-1,i=null,r=null;e<=t;){var l=s(r=d[i=(e+t)/2|0]);if(l>0)e=i+1;else{if(!(l<0))return r;t=i-1}}return null};function ca(d,s,e,t){e===void 0&&(e=0),t===void 0&&(t=0);var i=null;if(d?i=s[d.sn-s[0].sn+1]||null:e===0&&s[0].start===0&&(i=s[0]),i&&Jn(e,t,i)===0)return i;var r=Co(s,Jn.bind(null,e,t));return!r||r===d&&i?i:r}function Jn(d,s,e){if(d===void 0&&(d=0),s===void 0&&(s=0),e.start<=d&&e.start+e.duration>d)return 0;var t=Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return e.start+e.duration-t<=d?1:e.start-t>d&&e.start?-1:0}function Md(d,s,e){var t=1e3*Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return(e.endProgramDateTime||0)-t>d}var es,xd=3e5,Qa=0,It=2,rr=5,Hr=0,Xa=1,T=2,y=function(){function d(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=H.log.bind(H,"[info]:"),this.warn=H.warn.bind(H,"[warning]:"),this.error=H.error.bind(H,"[error]:"),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.ERROR,this.onError,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(w.ERROR,this.onError,this),e.off(w.ERROR,this.onErrorOut,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this))},s.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},s.startLoad=function(e){this.playlistError=0},s.stopLoad=function(){},s.getVariantLevelIndex=function(e){return(e==null?void 0:e.type)===rt?e.level:this.hls.loadLevel},s.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},s.onError=function(e,t){var i;if(!t.fatal){var r=this.hls,l=t.context;switch(t.details){case W.FRAG_LOAD_ERROR:case W.FRAG_LOAD_TIMEOUT:case W.KEY_LOAD_ERROR:case W.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case W.FRAG_GAP:case W.FRAG_PARSING_ERROR:case W.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=It);case W.LEVEL_EMPTY_ERROR:case W.LEVEL_PARSING_ERROR:var u,c,f=t.parent===rt?t.level:r.loadLevel;return void(t.details===W.LEVEL_EMPTY_ERROR&&(u=t.context)!=null&&(c=u.levelDetails)!=null&&c.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,f):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,f)));case W.LEVEL_LOAD_ERROR:case W.LEVEL_LOAD_TIMEOUT:return void(typeof(l==null?void 0:l.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l.level)));case W.AUDIO_TRACK_LOAD_ERROR:case W.AUDIO_TRACK_LOAD_TIMEOUT:case W.SUBTITLE_LOAD_ERROR:case W.SUBTITLE_TRACK_LOAD_TIMEOUT:if(l){var h=r.levels[r.loadLevel];if(h&&(l.type===ki&&l.groupId===h.audioGroupId||l.type===wi&&l.groupId===h.textGroupId))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=It,void(t.errorAction.flags=Xa)}return;case W.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var p=r.levels[r.loadLevel],E=p==null?void 0:p.attrs["HDCP-LEVEL"];return void(E&&(t.errorAction={action:It,flags:T,hdcpLevel:E}));case W.BUFFER_ADD_CODEC_ERROR:case W.REMUX_ALLOC_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:r.loadLevel));case W.INTERNAL_EXCEPTION:case W.BUFFER_APPENDING_ERROR:case W.BUFFER_APPEND_ERROR:case W.BUFFER_FULL_ERROR:case W.LEVEL_SWITCH_ERROR:case W.BUFFER_STALLED_ERROR:case W.BUFFER_SEEK_OVER_HOLE:case W.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:Qa,flags:Hr})}if(t.type===oe.KEY_SYSTEM_ERROR){var b=this.getVariantLevelIndex(t.frag);return t.levelRetry=!1,void(t.errorAction=this.getLevelSwitchAction(t,b))}}},s.getPlaylistRetryOrSwitchAction=function(e,t){var i,r,l=ja(this.hls.config.playlistLoadPolicy,e),u=this.playlistError++,c=(i=e.response)==null?void 0:i.code;return za(l,u,ua(e),c)?{action:rr,flags:Hr,retryConfig:l,retryCount:u}:(r=e.context)!=null&&r.deliveryDirectives?{action:Qa,flags:Hr,retryConfig:l||{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},retryCount:u}:this.getLevelSwitchAction(e,t)},s.getFragRetryOrSwitchAction=function(e){var t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],l=t.config,u=l.fragLoadPolicy,c=l.keyLoadPolicy,f=ja(e.details.startsWith("key")?c:u,e),h=t.levels.reduce(function(A,k){return A+k.fragmentError},0);if(r){var p;e.details!==W.FRAG_GAP&&r.fragmentError++;var E=(p=e.response)==null?void 0:p.code;if(za(f,h,ua(e),E))return{action:rr,flags:Hr,retryConfig:f,retryCount:h}}var b=this.getLevelSwitchAction(e,i);return f&&(b.retryConfig=f,b.retryCount=h),b},s.getLevelSwitchAction=function(e,t){var i=this.hls;t==null&&(t=i.loadLevel);var r=this.hls.levels[t];if(r&&(r.loadError++,i.autoLevelEnabled)){for(var l,u,c=-1,f=i.levels,h=(l=e.frag)==null?void 0:l.type,p=(u=e.context)!=null?u:{},E=p.type,b=p.groupId,A=f.length;A--;){var k=(A+i.loadLevel)%f.length;if(k!==i.loadLevel&&f[k].loadError===0){var D=f[k];if(e.details===W.FRAG_GAP&&e.frag){var S=f[k].details;if(S){var I=ca(e.frag,S.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else if(E===ki&&b===D.audioGroupId||E===wi&&b===D.textGroupId||h===Li&&r.audioGroupId===D.audioGroupId||h===Ii&&r.textGroupId===D.textGroupId)continue;c=k;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,{action:It,flags:Hr,nextAutoLevel:c}}return{action:It,flags:Xa}},s.onErrorOut=function(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case Qa:break;case It:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===W.FRAG_GAP||(t.fatal=!0)}t.fatal&&this.hls.stopLoad()},s.sendAlternateToPenaltyBox=function(e){var t=this.hls,i=e.errorAction;if(i){var r=i.flags,l=i.hdcpLevel,u=i.nextAutoLevel;switch(r){case Hr:this.switchLevel(e,u);break;case Xa:i.resolved||(i.resolved=this.redundantFailover(e));break;case T:l&&(t.maxHdcpLevel=Ya[Ya.indexOf(l)-1],i.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}i.resolved||this.switchLevel(e,u)}},s.switchLevel=function(e,t){t!==void 0&&e.errorAction&&(this.warn("switching to level "+t+" after "+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)},s.redundantFailover=function(e){var t=this,i=this.hls,r=this.penalizedRenditions,l=e.parent===rt?e.level:i.loadLevel,u=i.levels[l],c=u.url.length,f=e.frag?e.frag.urlId:u.urlId;u.urlId!==f||e.frag&&!u.details||this.penalizeRendition(u,e);for(var h=function(){var b=(f+p)%c,A=r[b];if(!A||function(k,D,S){if(performance.now()-k.lastErrorPerfMs>xd)return!0;var I=k.details;if(D.details===W.FRAG_GAP&&I&&D.frag){var F=D.frag.start,N=ca(null,I.fragments,F);if(N&&!N.gap)return!0}if(S&&k.errors.length<S.errors.length){var V=k.errors[k.errors.length-1];if(I&&V.frag&&D.frag&&Math.abs(V.frag.start-D.frag.start)>3*I.targetduration)return!0}return!1}(A,e,r[f]))return t.warn("Switching to Redundant Stream "+(b+1)+"/"+c+': "'+u.url[b]+'" after '+e.details),t.playlistError=0,i.levels.forEach(function(k){k.urlId=b}),i.nextLoadLevel=l,{v:!0}},p=1;p<c;p++){var E=h();if(typeof E=="object")return E.v}return!1},s.penalizeRendition=function(e,t){var i=this.penalizedRenditions,r=i[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};r.lastErrorPerfMs=performance.now(),r.errors.push(t),r.details=e.details,i[e.urlId]=r},d}(),_=function(){function d(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=H.log.bind(H,t+":"),this.warn=H.warn.bind(H,t+":"),this.hls=e}var s=d.prototype;return s.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},s.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},s.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},s.stopLoad=function(){this.canLoad=!1,this.clearTimer()},s.switchParams=function(e,t){var i=t==null?void 0:t.renditionReports;if(i){for(var r=-1,l=0;l<i.length;l++){var u=i[l],c=void 0;try{c=new self.URL(u.URI,t.url).href}catch(b){H.warn("Could not construct new URL for Rendition Report: "+b),c=u.URI||""}if(c===e){r=l;break}c===e.substring(0,c.length)&&(r=l)}if(r!==-1){var f=i[r],h=parseInt(f["LAST-MSN"])||(t==null?void 0:t.lastPartSn),p=parseInt(f["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){var E=Math.min(t.age-t.partTarget,t.targetduration);p>=0&&E>t.partTarget&&(p+=1)}return new Lo(h,p>=0?p:void 0,ir)}}},s.loadPlaylist=function(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())},s.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},s.shouldReloadPlaylist=function(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)},s.playlistLoaded=function(e,t,i){var r=this,l=t.details,u=t.stats,c=self.performance.now(),f=u.loading.first?Math.max(0,c-u.loading.first):0;if(l.advancedDateTime=Date.now()-f,l.live||i!=null&&i.live){if(l.reloaded(i),i&&this.log("live playlist "+e+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),i&&l.fragments.length>0&&Cd(i,l),!this.canLoad||!l.live)return;var h,p=void 0,E=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var b=this.hls.config.lowLatencyMode,A=l.lastPartSn,k=l.endSN,D=l.lastPartIndex,S=A===k;D!==-1?(p=S?k+1:A,E=S?b?0:D:D+1):p=k+1;var I=l.age,F=I+l.ageHeader,N=Math.min(F-l.partTarget,1.5*l.targetduration);if(N>0){if(i&&N>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+N+" with playlist age: "+l.age),N=0;else{var V=Math.floor(N/l.targetduration);p+=V,E!==void 0&&(E+=Math.round(N%l.targetduration/l.partTarget)),this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+I.toFixed(2)+"s goal: "+N+" skip sn "+V+" to part "+E)}l.tuneInGoal=N}if(h=this.getDeliveryDirectives(l,t.deliveryDirectives,p,E),b||!S)return void this.loadPlaylist(h)}else l.canBlockReload&&(h=this.getDeliveryDirectives(l,t.deliveryDirectives,p,E));var Y=this.hls.mainForwardBufferInfo,j=Y?Y.end-Y.len:0,J=function(X,ue){ue===void 0&&(ue=1/0);var ne=1e3*X.targetduration;if(X.updated){var be=X.fragments;if(be.length&&4*ne>ue){var Fe=1e3*be[be.length-1].duration;Fe<ne&&(ne=Fe)}}else ne/=2;return Math.round(ne)}(l,1e3*(l.edge-j));l.updated&&c>this.requestScheduled+J&&(this.requestScheduled=u.loading.start),p!==void 0&&l.canBlockReload?this.requestScheduled=u.loading.first+J-(1e3*l.partTarget||1e3):this.requestScheduled===-1||this.requestScheduled+J<c?this.requestScheduled=c:this.requestScheduled-c<=0&&(this.requestScheduled+=J);var Q=this.requestScheduled-c;Q=Math.max(0,Q),this.log("reload live playlist "+e+" in "+Math.round(Q)+" ms"),this.timer=self.setTimeout(function(){return r.loadPlaylist(h)},Q)}else this.clearTimer()},s.getDeliveryDirectives=function(e,t,i,r){var l=function(u,c){var f=u.canSkipUntil,h=u.canSkipDateRanges,p=u.endSN;return f&&(c!==void 0?c-p:0)<f?h?Dd:Rd:ir}(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,l=ir),new Lo(i,r,l)},s.checkRetry=function(e){var t=this,i=e.details,r=ua(e),l=e.errorAction,u=l||{},c=u.action,f=u.retryCount,h=f===void 0?0:f,p=u.retryConfig,E=c===rr&&!!l&&!!p;if(E){var b;if(this.requestScheduled=-1,r&&(b=e.context)!=null&&b.deliveryDirectives)this.warn("Retrying playlist loading "+(h+1)+"/"+p.maxNumRetry+' after "'+i+'" without delivery-directives'),this.loadPlaylist();else{var A=Zn(p,h);this.timer=self.setTimeout(function(){return t.loadPlaylist()},A),this.warn("Retrying playlist loading "+(h+1)+"/"+p.maxNumRetry+' after "'+i+'" in '+A+"ms")}e.levelRetry=!0,l.resolved=!0}return E},d}(),R=function(d){function s(t,i){var r;return(r=d.call(this,t,"[level-controller]")||this)._levels=[],r._firstLevel=-1,r._startLevel=void 0,r.currentLevel=null,r.currentLevelIndex=-1,r.manualLevelIndex=-1,r.steering=void 0,r.onParsedComplete=void 0,r.steering=i,r._registerListeners(),r}z(s,d);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(w.FRAG_LOADED,this.onFragLoaded,this),t.on(w.ERROR,this.onError,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(w.FRAG_LOADED,this.onFragLoaded,this),t.off(w.ERROR,this.onError,this)},e.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),d.prototype.destroy.call(this)},e.startLoad=function(){this._levels.forEach(function(t){t.loadError=0,t.fragmentError=0}),d.prototype.startLoad.call(this)},e.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]},e.onManifestLoading=function(t,i){this.resetLevels()},e.onManifestLoaded=function(t,i){var r,l=[],u={};i.levels.forEach(function(c){var f,h=c.attrs;((f=c.audioCodec)==null?void 0:f.indexOf("mp4a.40.34"))!==-1&&(es||(es=/chrome|firefox/i.test(navigator.userAgent)),es&&(c.audioCodec=void 0));var p=h.AUDIO,E=h.CODECS,b=h["FRAME-RATE"],A=h["PATHWAY-ID"],k=h.RESOLUTION,D=h.SUBTITLES,S=(A||".")+"-"+c.bitrate+"-"+k+"-"+b+"-"+E;(r=u[S])?r.addFallback(c):(r=new la(c),u[S]=r,l.push(r)),C(r,"audio",p),C(r,"text",D)}),this.filterAndSortMediaOptions(l,i)},e.filterAndSortMediaOptions=function(t,i){var r=this,l=[],u=[],c=!1,f=!1,h=!1,p=t.filter(function(I){var F=I.audioCodec,N=I.videoCodec,V=I.width,Y=I.height,j=I.unknownCodecs;return c||(c=!(!V||!Y)),f||(f=!!N),h||(h=!!F),!(j!=null&&j.length)&&(!F||Ga(F,"audio"))&&(!N||Ga(N,"video"))});if((c||f)&&h&&(p=p.filter(function(I){var F=I.videoCodec,N=I.width,V=I.height;return!!F||!(!N||!V)})),p.length!==0){i.audioTracks&&O(l=i.audioTracks.filter(function(I){return!I.audioCodec||Ga(I.audioCodec,"audio")})),i.subtitles&&O(u=i.subtitles);var E=p.slice(0);p.sort(function(I,F){return I.attrs["HDCP-LEVEL"]!==F.attrs["HDCP-LEVEL"]?(I.attrs["HDCP-LEVEL"]||"")>(F.attrs["HDCP-LEVEL"]||"")?1:-1:I.bitrate!==F.bitrate?I.bitrate-F.bitrate:I.attrs["FRAME-RATE"]!==F.attrs["FRAME-RATE"]?I.attrs.decimalFloatingPoint("FRAME-RATE")-F.attrs.decimalFloatingPoint("FRAME-RATE"):I.attrs.SCORE!==F.attrs.SCORE?I.attrs.decimalFloatingPoint("SCORE")-F.attrs.decimalFloatingPoint("SCORE"):c&&I.height!==F.height?I.height-F.height:0});var b=E[0];if(this.steering&&(p=this.steering.filterParsedLevels(p)).length!==E.length){for(var A=0;A<E.length;A++)if(E[A].pathwayId===p[0].pathwayId){b=E[A];break}}this._levels=p;for(var k=0;k<p.length;k++)if(p[k]===b){this._firstLevel=k,this.log("manifest loaded, "+p.length+" level(s) found, first bitrate: "+b.bitrate);break}var D=h&&!f,S={levels:p,audioTracks:l,subtitleTracks:u,sessionData:i.sessionData,sessionKeys:i.sessionKeys,firstLevel:this._firstLevel,stats:i.stats,audio:h,video:f,altAudio:!D&&l.some(function(I){return!!I.url})};this.hls.trigger(w.MANIFEST_PARSED,S),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then(function(){if(r.hls){var I=new Error("no level with compatible codecs found in manifest");r.hls.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:i.url,error:I,reason:I.message})}})},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===yr&&i.context.level===this.level&&this.checkRetry(i)},e.onFragLoaded=function(t,i){var r=i.frag;if(r!==void 0&&r.type===rt){var l=this._levels[r.level];l!==void 0&&(l.loadError=0)}},e.onLevelLoaded=function(t,i){var r,l,u=i.level,c=i.details,f=this._levels[u];if(!f)return this.warn("Invalid level index "+u),void((l=i.deliveryDirectives)!=null&&l.skip&&(c.deltaUpdateFailed=!0));u===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0),this.playlistLoaded(u,i,f.details)):(r=i.deliveryDirectives)!=null&&r.skip&&(c.deltaUpdateFailed=!0)},e.onAudioTrackSwitched=function(t,i){var r=this.currentLevel;if(r){var l=this.hls.audioTracks[i.id].groupId;if(r.audioGroupIds&&r.audioGroupId!==l){for(var u=-1,c=0;c<r.audioGroupIds.length;c++)if(r.audioGroupIds[c]===l){u=c;break}u!==-1&&u!==r.urlId&&(r.urlId=u,this.canLoad&&this.startLoad())}}},e.loadPlaylist=function(t){d.prototype.loadPlaylist.call(this);var i=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){var l=r.urlId,u=r.uri;if(t)try{u=t.addDirectives(u)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}var c=r.attrs["PATHWAY-ID"];this.log("Loading level index "+i+((t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:"")+" with"+(c?" Pathway "+c:"")+" URI "+(l+1)+"/"+r.url.length+" "+u),this.clearTimer(),this.hls.trigger(w.LEVEL_LOADING,{url:u,level:i,id:l,deliveryDirectives:t||null})}},e.removeLevel=function(t,i){var r=this,l=function(c,f){return f!==i},u=this._levels.filter(function(c,f){return f!==t||(c.url.length>1&&i!==void 0?(c.url=c.url.filter(l),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(l)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(l)),c.urlId=0,!0):(r.steering&&r.steering.removeLevel(c),!1))});this.hls.trigger(w.LEVELS_UPDATED,{levels:u})},e.onLevelsUpdated=function(t,i){var r=i.levels;r.forEach(function(l,u){var c=l.details;c!=null&&c.fragments&&c.fragments.forEach(function(f){f.level=u})}),this._levels=r},M(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var i=this._levels;if(i.length!==0){if(t<0||t>=i.length){var r=new Error("invalid level idx"),l=t<0;if(this.hls.trigger(w.ERROR,{type:oe.OTHER_ERROR,details:W.LEVEL_SWITCH_ERROR,level:t,fatal:l,error:r,reason:r.message}),l)return;t=Math.min(t,i.length-1)}var u=this.currentLevelIndex,c=this.currentLevel,f=c?c.attrs["PATHWAY-ID"]:void 0,h=i[t],p=h.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=h,u!==t||!h.details||!c||f!==p){this.log("Switching to level "+t+(p?" with Pathway "+p:"")+" from level "+u+(f?" with Pathway "+f:""));var E=U({},h,{level:t,maxBitrate:h.maxBitrate,attrs:h.attrs,uri:h.uri,urlId:h.urlId});delete E._attrs,delete E._urlId,this.hls.trigger(w.LEVEL_SWITCHING,E);var b=h.details;if(!b||b.live){var A=this.switchParams(h.uri,c==null?void 0:c.details);this.loadPlaylist(A)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,this._startLevel===void 0&&(this._startLevel=t),t!==-1&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var t=this.hls.config.startLevel;return t!==void 0?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=t)}}]),s}(_);function C(d,s,e){e&&(s==="audio"?(d.audioGroupIds||(d.audioGroupIds=[]),d.audioGroupIds[d.url.length-1]=e):s==="text"&&(d.textGroupIds||(d.textGroupIds=[]),d.textGroupIds[d.url.length-1]=e))}function O(d){var s={};d.forEach(function(e){var t=e.groupId||"";e.id=s[t]=s[t]||0,s[t]++})}var x="NOT_LOADED",G="APPENDING",$="PARTIAL",K="OK",Z=function(){function d(e){this.mainFragEntity=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.hasGaps=!1,this.hls=e,this._registerListeners()}var s=d.prototype;return s._registerListeners=function(){var e=this.hls;e.on(w.BUFFER_APPENDED,this.onBufferAppended,this),e.on(w.FRAG_BUFFERED,this.onFragBuffered,this),e.on(w.FRAG_LOADED,this.onFragLoaded,this)},s._unregisterListeners=function(){var e=this.hls;e.off(w.BUFFER_APPENDED,this.onBufferAppended,this),e.off(w.FRAG_BUFFERED,this.onFragBuffered,this),e.off(w.FRAG_LOADED,this.onFragLoaded,this)},s.destroy=function(){this._unregisterListeners(),this.fragments=this.endListFragments=this.timeRanges=this.mainFragEntity=this.activeParts=null},s.getAppendedFrag=function(e,t){if(t===rt){var i=this.mainFragEntity,r=this.activeParts;if(i){if(i&&r)for(var l=r.length;l--;){var u=r[l],c=u?u.end:i.appendedPTS;if(u.start<=e&&c!==null&&e<=c)return l>9&&(this.activeParts=r.slice(l-9)),u}else if(i.body.start<=e&&i.appendedPTS!==null&&e<=i.appendedPTS)return i.body}}return this.getBufferedFrag(e,t)},s.getBufferedFrag=function(e,t){for(var i=this.fragments,r=Object.keys(i),l=r.length;l--;){var u=i[r[l]];if((u==null?void 0:u.body.type)===t&&u.buffered){var c=u.body;if(c.start<=e&&e<=c.end)return c}}return null},s.detectEvictedFragments=function(e,t,i){var r=this;this.timeRanges&&(this.timeRanges[e]=t),Object.keys(this.fragments).forEach(function(l){var u=r.fragments[l];if(u)if(u.buffered||u.loaded){var c=u.range[e];c&&c.time.some(function(f){var h=!r.isTimeBuffered(f.startPTS,f.endPTS,t);return h&&r.removeFragment(u.body),h})}else u.body.type===i&&r.removeFragment(u.body)})},s.detectPartialFragments=function(e){var t=this,i=this.timeRanges,r=e.frag,l=e.part;if(i&&r.sn!=="initSegment"){var u=me(r),c=this.fragments[u];c&&(Object.keys(i).forEach(function(f){var h=r.elementaryStreams[f];if(h){var p=i[f],E=l!==null||h.partial===!0;c.range[f]=t.getBufferedTimes(r,l,E,p)}}),c.loaded=null,Object.keys(c.range).length?(c.buffered=!0,c.body.endList&&(this.endListFragments[c.body.type]=c)):this.removeFragment(c.body))}},s.fragBuffered=function(e,t){var i=me(e),r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)},s.getBufferedTimes=function(e,t,i,r){for(var l={time:[],partial:i},u=t?t.start:e.start,c=t?t.end:e.end,f=e.minEndPTS||c,h=e.maxStartPTS||u,p=0;p<r.length;p++){var E=r.start(p)-this.bufferPadding,b=r.end(p)+this.bufferPadding;if(h>=E&&f<=b){l.time.push({startPTS:Math.max(u,r.start(p)),endPTS:Math.min(c,r.end(p))});break}if(u<b&&c>E)l.partial=!0,l.time.push({startPTS:Math.max(u,r.start(p)),endPTS:Math.min(c,r.end(p))});else if(c<=E)break}return l},s.getPartialFragment=function(e){var t,i,r,l=null,u=0,c=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(h){var p=f[h];p&&xe(p)&&(i=p.body.start-c,r=p.body.end+c,e>=i&&e<=r&&(t=Math.min(e-i,r-e),u<=t&&(l=p.body,u=t)))}),l},s.isEndListAppended=function(e){var t=this.endListFragments[e];return t!==void 0&&(t.buffered||xe(t))},s.getState=function(e){var t=me(e),i=this.fragments[t];return i?i.buffered?xe(i)?$:K:G:x},s.isTimeBuffered=function(e,t,i){for(var r,l,u=0;u<i.length;u++){if(r=i.start(u)-this.bufferPadding,l=i.end(u)+this.bufferPadding,e>=r&&t<=l)return!0;if(t<=r)return!1}return!1},s.onFragLoaded=function(e,t){var i=t.frag,r=t.part;if(i.sn!=="initSegment"&&!i.bitrateTest&&!r){var l=me(i);this.fragments[l]={body:i,appendedPTS:null,loaded:t,buffered:!1,range:Object.create(null)}}},s.onBufferAppended=function(e,t){var i=this,r=t.frag,l=t.part,u=t.timeRanges,c=this.mainFragEntity;if(r.type===rt){var f=c?c.body:null;if(f!==r){c&&f&&f.sn!==r.sn&&(c.buffered=!0,this.fragments[me(f)]=c);var h=me(r);c=this.mainFragEntity=this.fragments[h]||{body:r,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)}}if(l){var p=this.activeParts;p||(this.activeParts=p=[]),p.push(l)}else this.activeParts=null}this.timeRanges=u,Object.keys(u).forEach(function(E){var b=u[E];if(i.detectEvictedFragments(E,b),!l&&c){var A=r.elementaryStreams[E];if(!A)return;for(var k=0;k<b.length;k++){var D=b.end(k);D<=A.endPTS&&D>A.startPTS?c.appendedPTS=Math.max(D,c.appendedPTS||0):c.appendedPTS=A.endPTS}}})},s.onFragBuffered=function(e,t){this.detectPartialFragments(t)},s.hasFragment=function(e){var t=me(e);return!!this.fragments[t]},s.removeFragmentsInRange=function(e,t,i,r,l){var u=this;r&&!this.hasGaps||Object.keys(this.fragments).forEach(function(c){var f=u.fragments[c];if(f){var h=f.body;h.type!==i||r&&!h.gap||h.start<t&&h.end>e&&(f.buffered||l)&&u.removeFragment(h)}})},s.removeFragment=function(e){var t=me(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),this.mainFragEntity===this.fragments[t]&&(this.mainFragEntity=null),delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},s.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.mainFragEntity=null,this.activeParts=null,this.hasGaps=!1},d}();function xe(d){var s,e;return d.buffered&&(d.body.gap||((s=d.range.video)==null?void 0:s.partial)||((e=d.range.audio)==null?void 0:e.partial))}function me(d){return d.type+"_"+d.level+"_"+d.urlId+"_"+d.sn}var Ie=Math.pow(2,17),ge=function(){function d(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var s=d.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(e,t){var i=this,r=e.url;if(!r)return Promise.reject(new ut({type:oe.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(r?"part list":"url")),networkDetails:null}));this.abort();var l=this.config,u=l.fLoader,c=l.loader;return new Promise(function(f,h){if(i.loader&&i.loader.destroy(),e.gap)h(ze(e));else{var p=i.loader=e.loader=u?new u(l):new c(l),E=De(e),b=Do(l.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Ie};e.stats=p.stats,p.load(E,A,{onSuccess:function(k,D,S,I){i.resetLoader(e,p);var F=k.data;S.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(F.slice(0,16)),F=F.slice(16)),f({frag:e,part:null,payload:F,networkDetails:I})},onError:function(k,D,S,I){i.resetLoader(e,p),h(new ut({type:oe.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:g({url:r,data:void 0},k),error:new Error("HTTP Error "+k.code+" "+k.text),networkDetails:S,stats:I}))},onAbort:function(k,D,S){i.resetLoader(e,p),h(new ut({type:oe.NETWORK_ERROR,details:W.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:S,stats:k}))},onTimeout:function(k,D,S){i.resetLoader(e,p),h(new ut({type:oe.NETWORK_ERROR,details:W.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:k}))},onProgress:function(k,D,S,I){t&&t({frag:e,part:null,payload:S,networkDetails:I})}})}})},s.loadPart=function(e,t,i){var r=this;this.abort();var l=this.config,u=l.fLoader,c=l.loader;return new Promise(function(f,h){if(r.loader&&r.loader.destroy(),e.gap||t.gap)h(ze(e,t));else{var p=r.loader=e.loader=u?new u(l):new c(l),E=De(e,t),b=Do(l.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Ie};t.stats=p.stats,p.load(E,A,{onSuccess:function(k,D,S,I){r.resetLoader(e,p),r.updateStatsFromPart(e,t);var F={frag:e,part:t,payload:k.data,networkDetails:I};i(F),f(F)},onError:function(k,D,S,I){r.resetLoader(e,p),h(new ut({type:oe.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:g({url:E.url,data:void 0},k),error:new Error("HTTP Error "+k.code+" "+k.text),networkDetails:S,stats:I}))},onAbort:function(k,D,S){e.stats.aborted=t.stats.aborted,r.resetLoader(e,p),h(new ut({type:oe.NETWORK_ERROR,details:W.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:S,stats:k}))},onTimeout:function(k,D,S){r.resetLoader(e,p),h(new ut({type:oe.NETWORK_ERROR,details:W.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:k}))}})}})},s.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,l=r.total;if(i.loaded+=r.loaded,l){var u=Math.round(e.duration/t.duration),c=Math.min(Math.round(i.loaded/l),u),f=(u-c)*Math.round(i.loaded/c);i.total=i.loaded+f}else i.total=Math.max(i.loaded,i.total);var h=i.loading,p=r.loading;h.start?h.first+=p.first-p.start:(h.start=p.start,h.first=p.first),h.end=p.end},s.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},d}();function De(d,s){s===void 0&&(s=null);var e=s||d,t={frag:d,part:s,responseType:"arraybuffer",url:e.url,headers:{},rangeStart:0,rangeEnd:0},i=e.byteRangeStartOffset,r=e.byteRangeEndOffset;if(le(i)&&le(r)){var l,u=i,c=r;if(d.sn==="initSegment"&&((l=d.decryptdata)==null?void 0:l.method)==="AES-128"){var f=r-i;f%16&&(c=r+(16-f%16)),i!==0&&(t.resetIV=!0,u=i-16)}t.rangeStart=u,t.rangeEnd=c}return t}function ze(d,s){var e=new Error("GAP "+(d.gap?"tag":"attribute")+" found"),t={type:oe.MEDIA_ERROR,details:W.FRAG_GAP,fatal:!1,frag:d,error:e,networkDetails:null};return s&&(t.part=s),(s||d).stats.aborted=!0,new ut(t)}var ut=function(d){function s(e){var t;return(t=d.call(this,e.error.message)||this).data=void 0,t.data=e,t}return z(s,d),s}(_e(Error)),Pt=function(){function d(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var s=d.prototype;return s.abort=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.abort()}},s.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},s.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}},s.createKeyLoadError=function(e,t,i,r,l){return t===void 0&&(t=W.KEY_LOAD_ERROR),new ut({type:oe.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:l,error:i,networkDetails:r})},s.loadClear=function(e,t){var i=this;if(this.emeController&&this.config.emeEnabled)for(var r=e.sn,l=e.cc,u=function(){var f=t[c];if(l<=f.cc&&(r==="initSegment"||f.sn==="initSegment"||r<f.sn))return i.emeController.selectKeySystemFormat(f).then(function(h){f.setKeyFormat(h)}),"break"},c=0;c<t.length&&u()!=="break";c++);},s.load=function(e){var t=this;return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(function(i){return t.loadInternal(e,i)}):this.loadInternal(e)},s.loadInternal=function(e,t){var i,r;t&&e.setKeyFormat(t);var l=e.decryptdata;if(!l){var u=new Error(t?"Expected frag.decryptdata to be defined after setting format "+t:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,W.KEY_LOAD_ERROR,u))}var c=l.uri;if(!c)return Promise.reject(this.createKeyLoadError(e,W.KEY_LOAD_ERROR,new Error('Invalid key URI: "'+c+'"')));var f,h=this.keyUriToKeyInfo[c];if((i=h)!=null&&i.decryptdata.key)return l.key=h.decryptdata.key,Promise.resolve({frag:e,keyInfo:h});if((r=h)!=null&&r.keyLoadPromise)switch((f=h.mediaKeySessionContext)==null?void 0:f.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return h.keyLoadPromise.then(function(p){return l.key=p.keyInfo.decryptdata.key,{frag:e,keyInfo:h}})}switch(h=this.keyUriToKeyInfo[c]={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(h,e):this.loadKeyEME(h,e);case"AES-128":return this.loadKeyHTTP(h,e);default:return Promise.reject(this.createKeyLoadError(e,W.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'+l.method+'"')))}},s.loadKeyEME=function(e,t){var i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(function(l){return e.mediaKeySessionContext=l,i})).catch(function(l){throw e.keyLoadPromise=null,l})}return Promise.resolve(i)},s.loadKeyHTTP=function(e,t){var i=this,r=this.config,l=new r.loader(r);return t.keyLoader=e.loader=l,e.keyLoadPromise=new Promise(function(u,c){var f={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},h=r.keyLoadPolicy.default,p={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},E={onSuccess:function(b,A,k,D){var S=k.frag,I=k.keyInfo,F=k.url;if(!S.decryptdata||I!==i.keyUriToKeyInfo[F])return c(i.createKeyLoadError(S,W.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),D));I.decryptdata.key=S.decryptdata.key=new Uint8Array(b.data),S.keyLoader=null,I.loader=null,u({frag:S,keyInfo:I})},onError:function(b,A,k,D){i.resetLoader(A),c(i.createKeyLoadError(t,W.KEY_LOAD_ERROR,new Error("HTTP Error "+b.code+" loading key "+b.text),k,g({url:f.url,data:void 0},b)))},onTimeout:function(b,A,k){i.resetLoader(A),c(i.createKeyLoadError(t,W.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),k))},onAbort:function(b,A,k){i.resetLoader(A),c(i.createKeyLoadError(t,W.INTERNAL_ABORTED,new Error("key loading aborted"),k))}};l.load(f,p,E)})},s.resetLoader=function(e){var t=e.frag,i=e.keyInfo,r=e.url,l=i.loader;t.keyLoader===l&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],l&&l.destroy()},d}(),Qt=function(){function d(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var s=d.prototype;return s.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},s.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},s.onHandlerDestroyed=function(){},s.hasInterval=function(){return!!this._tickInterval},s.hasNextTick=function(){return!!this._tickTimer},s.setInterval=function(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)},s.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},s.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},s.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},s.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},s.doTick=function(){},d}(),li={length:0,start:function(){return 0},end:function(){return 0}},ke=function(){function d(){}return d.isBuffered=function(s,e){try{if(s){for(var t=d.getBuffered(s),i=0;i<t.length;i++)if(e>=t.start(i)&&e<=t.end(i))return!0}}catch{}return!1},d.bufferInfo=function(s,e,t){try{if(s){var i,r=d.getBuffered(s),l=[];for(i=0;i<r.length;i++)l.push({start:r.start(i),end:r.end(i)});return this.bufferedInfo(l,e,t)}}catch{}return{len:0,start:e,end:e,nextStart:void 0}},d.bufferedInfo=function(s,e,t){e=Math.max(0,e),s.sort(function(k,D){var S=k.start-D.start;return S||D.end-k.end});var i=[];if(t)for(var r=0;r<s.length;r++){var l=i.length;if(l){var u=i[l-1].end;s[r].start-u<t?s[r].end>u&&(i[l-1].end=s[r].end):i.push(s[r])}else i.push(s[r])}else i=s;for(var c,f=0,h=e,p=e,E=0;E<i.length;E++){var b=i[E].start,A=i[E].end;if(e+t>=b&&e<A)h=b,f=(p=A)-e;else if(e+t<b){c=b;break}}return{len:f,start:h||0,end:p||0,nextStart:c}},d.getBuffered=function(s){try{return s.buffered}catch(e){return H.log("failed to get media.buffered",e),li}},d}(),ft=function(d,s,e,t,i,r){t===void 0&&(t=0),i===void 0&&(i=-1),r===void 0&&(r=!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=d,this.sn=s,this.id=e,this.size=t,this.part=i,this.partial=r};function Qe(d,s){for(var e=null,t=0,i=d.length;t<i;t++){var r=d[t];if(r&&r.cc===s){e=r;break}}return e}function de(d,s){if(d){var e=d.start+s;d.start=d.startPTS=e,d.endPTS=e+d.duration}}function we(d,s){for(var e=s.fragments,t=0,i=e.length;t<i;t++)de(e[t],d);s.fragmentHint&&de(s.fragmentHint,d),s.alignedSliding=!0}function ce(d,s,e){s&&(function(t,i,r){if(function(u,c,f){return!(!c.details||!(f.endCC>f.startCC||u&&u.cc<f.startCC))}(t,r,i)){var l=function(u,c,f){var h=u.fragments,p=c.fragments;if(p.length&&h.length){var E=Qe(h,p[0].cc);if(E&&(!E||E.startPTS))return E;H.log("No frag in previous level to align on")}else H.log("No fragments to align")}(r.details,i);l&&le(l.start)&&(H.log("Adjusting PTS using last level due to CC increase within current level "+i.url),we(l.start,i))}}(d,e,s),!e.alignedSliding&&s.details&&function(t,i){if(i.fragments.length&&t.hasProgramDateTime&&i.hasProgramDateTime){var r=i.fragments[0].programDateTime,l=t.fragments[0].programDateTime,u=(l-r)/1e3+i.fragments[0].start;u&&le(u)&&(H.log("Adjusting PTS using programDateTime delta "+(l-r)+"ms, sliding:"+u.toFixed(3)+" "+t.url+" "),we(u,t))}}(e,s.details),e.alignedSliding||!s.details||e.skippedSegments||Ro(s.details,e))}function He(d,s){if(d.hasProgramDateTime&&s.hasProgramDateTime){var e=d.fragments,t=s.fragments;if(e.length&&t.length){var i=t[Math.round(t.length/2)-1],r=Qe(e,i.cc)||e[Math.round(e.length/2)-1],l=i.programDateTime,u=r.programDateTime;l!==null&&u!==null&&we((u-l)/1e3-(r.start-i.start),d)}}}var Ve=function(){function d(s,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=s,this.aesIV=e}return d.prototype.decrypt=function(s,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,s)},d}(),At=function(){function d(s,e){this.subtle=void 0,this.key=void 0,this.subtle=s,this.key=e}return d.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},d}(),Xt=function(){function d(){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 s=d.prototype;return s.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),i=new Uint32Array(4),r=0;r<4;r++)i[r]=t.getUint32(4*r);return i},s.initTable=function(){var e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],l=i[1],u=i[2],c=i[3],f=this.invSubMix,h=f[0],p=f[1],E=f[2],b=f[3],A=new Uint32Array(256),k=0,D=0,S=0;for(S=0;S<256;S++)A[S]=S<128?S<<1:S<<1^283;for(S=0;S<256;S++){var I=D^D<<1^D<<2^D<<3^D<<4;I=I>>>8^255&I^99,e[k]=I,t[I]=k;var F=A[k],N=A[F],V=A[N],Y=257*A[I]^16843008*I;r[k]=Y<<24|Y>>>8,l[k]=Y<<16|Y>>>16,u[k]=Y<<8|Y>>>24,c[k]=Y,Y=16843009*V^65537*N^257*F^16843008*k,h[I]=Y<<24|Y>>>8,p[I]=Y<<16|Y>>>16,E[I]=Y<<8|Y>>>24,b[I]=Y,k?(k=F^A[A[A[V^F]]],D^=A[A[D]]):k=D=1}},s.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,r=0;r<t.length&&i;)i=t[r]===this.key[r],r++;if(!i){this.key=t;var l=this.keySize=t.length;if(l!==4&&l!==6&&l!==8)throw new Error("Invalid aes key size="+l);var u,c,f,h,p=this.ksRows=4*(l+6+1),E=this.keySchedule=new Uint32Array(p),b=this.invKeySchedule=new Uint32Array(p),A=this.sBox,k=this.rcon,D=this.invSubMix,S=D[0],I=D[1],F=D[2],N=D[3];for(u=0;u<p;u++)u<l?f=E[u]=t[u]:(h=f,u%l==0?(h=A[(h=h<<8|h>>>24)>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[255&h],h^=k[u/l|0]<<24):l>6&&u%l==4&&(h=A[h>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[255&h]),E[u]=f=(E[u-l]^h)>>>0);for(c=0;c<p;c++)u=p-c,h=3&c?E[u]:E[u-4],b[c]=c<4||u<=4?h:S[A[h>>>24]]^I[A[h>>>16&255]]^F[A[h>>>8&255]]^N[A[255&h]],b[c]=b[c]>>>0}},s.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},s.decrypt=function(e,t,i){for(var r,l,u,c,f,h,p,E,b,A,k,D,S,I,F=this.keySize+6,N=this.invKeySchedule,V=this.invSBox,Y=this.invSubMix,j=Y[0],J=Y[1],Q=Y[2],X=Y[3],ue=this.uint8ArrayToUint32Array_(i),ne=ue[0],be=ue[1],Fe=ue[2],ye=ue[3],Ce=new Int32Array(e),Pe=new Int32Array(Ce.length),Me=this.networkToHostOrderSwap;t<Ce.length;){for(b=Me(Ce[t]),A=Me(Ce[t+1]),k=Me(Ce[t+2]),D=Me(Ce[t+3]),f=b^N[0],h=D^N[1],p=k^N[2],E=A^N[3],S=4,I=1;I<F;I++)r=j[f>>>24]^J[h>>16&255]^Q[p>>8&255]^X[255&E]^N[S],l=j[h>>>24]^J[p>>16&255]^Q[E>>8&255]^X[255&f]^N[S+1],u=j[p>>>24]^J[E>>16&255]^Q[f>>8&255]^X[255&h]^N[S+2],c=j[E>>>24]^J[f>>16&255]^Q[h>>8&255]^X[255&p]^N[S+3],f=r,h=l,p=u,E=c,S+=4;r=V[f>>>24]<<24^V[h>>16&255]<<16^V[p>>8&255]<<8^V[255&E]^N[S],l=V[h>>>24]<<24^V[p>>16&255]<<16^V[E>>8&255]<<8^V[255&f]^N[S+1],u=V[p>>>24]<<24^V[E>>16&255]<<16^V[f>>8&255]<<8^V[255&h]^N[S+2],c=V[E>>>24]<<24^V[f>>16&255]<<16^V[h>>8&255]<<8^V[255&p]^N[S+3],Pe[t]=Me(r^ne),Pe[t+1]=Me(c^be),Pe[t+2]=Me(u^Fe),Pe[t+3]=Me(l^ye),ne=b,be=A,Fe=k,ye=D,t+=4}return Pe.buffer},d}(),wt=function(){function d(e,t){var i=(t===void 0?{}:t).removePKCS7Padding,r=i===void 0||i;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=e.enableSoftwareAES,this.removePKCS7Padding=r,r)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}var s=d.prototype;return s.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},s.isSync=function(){return this.useSoftware},s.flush=function(){var e=this.currentResult,t=this.remainderData;if(!e||t)return this.reset(),null;var i,r,l,u=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(r=(i=u).byteLength,(l=r&&new DataView(i.buffer).getUint8(r-1))?vi(i,0,r-l):i):u},s.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},s.decrypt=function(e,t,i){var r=this;return this.useSoftware?new Promise(function(l,u){r.softwareDecrypt(new Uint8Array(e),t,i);var c=r.flush();c?l(c.buffer):u(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)},s.softwareDecrypt=function(e,t,i){var r=this.currentIV,l=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(e=er(u,e),this.remainderData=null);var c=this.getValidChunk(e);if(!c.length)return null;r&&(i=r);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new Xt),f.expandKey(t);var h=l;return this.currentResult=f.decrypt(c.buffer,0,i),this.currentIV=vi(c,-16).buffer,h||null},s.webCryptoDecrypt=function(e,t,i){var r=this,l=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new At(l,t)),this.fastAesKey.expandKey().then(function(u){return l?(r.logOnce("WebCrypto AES decrypt"),new Ve(l,new Uint8Array(i)).decrypt(e.buffer,u)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(u){return H.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+u.name+": "+u.message),r.onWebCryptoError(e,t,i)})},s.onWebCryptoError=function(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);var r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},s.getValidChunk=function(e){var t=e,i=e.length-e.length%16;return i!==e.length&&(t=vi(e,0,i),this.remainderData=vi(e,i)),t},s.logOnce=function(e){this.logEnabled&&(H.log("[decrypter]: "+e),this.logEnabled=!1)},d}(),Kt=function(d){for(var s="",e=d.length,t=0;t<e;t++)s+="["+d.start(t).toFixed(3)+"-"+d.end(t).toFixed(3)+"]";return s},nt="STOPPED",Le="IDLE",Ri="KEY_LOADING",Di="FRAG_LOADING",di="FRAG_LOADING_WAITING_RETRY",mt="WAITING_TRACK",ai="PARSING",Za="PARSED",ha="ENDED",Gr="ERROR",ts="WAITING_INIT_PTS",Ja="WAITING_LEVEL",Pd=function(d){function s(t,i,r,l,u){var c;return(c=d.call(this)||this).hls=void 0,c.fragPrevious=null,c.fragCurrent=null,c.fragmentTracker=void 0,c.transmuxer=null,c._state=nt,c.playlistType=void 0,c.media=null,c.mediaBuffer=null,c.config=void 0,c.bitrateTest=!1,c.lastCurrentTime=0,c.nextLoadPosition=0,c.startPosition=0,c.startTimeOffset=null,c.loadedmetadata=!1,c.retryDate=0,c.levels=null,c.fragmentLoader=void 0,c.keyLoader=void 0,c.levelLastLoaded=null,c.startFragRequested=!1,c.decrypter=void 0,c.initPTS=[],c.onvseeking=null,c.onvended=null,c.logPrefix="",c.log=void 0,c.warn=void 0,c.playlistType=u,c.logPrefix=l,c.log=H.log.bind(H,l+":"),c.warn=H.warn.bind(H,l+":"),c.hls=t,c.fragmentLoader=new ge(t.config),c.keyLoader=r,c.fragmentTracker=i,c.config=t.config,c.decrypter=new wt(t.config),t.on(w.MANIFEST_LOADED,c.onManifestLoaded,function(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}(c)),c}z(s,d);var e=s.prototype;return e.doTick=function(){this.onTickEnd()},e.onTickEnd=function(){},e.startLoad=function(t){},e.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort();var t=this.fragCurrent;t!=null&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=nt},e._streamEnded=function(t,i){if(i.live||t.nextStart||!t.end||!this.media)return!1;var r=i.partList;if(r!=null&&r.length){var l=r[r.length-1];return ke.isBuffered(this.media,l.start+l.duration/2)}var u=i.fragments[i.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(u)},e.getLevelDetails=function(){var t;if(this.levels&&this.levelLastLoaded!==null)return(t=this.levels[this.levelLastLoaded])==null?void 0:t.details},e.onMediaAttached=function(t,i){var r=this.media=this.mediaBuffer=i.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),r.addEventListener("seeking",this.onvseeking),r.addEventListener("ended",this.onvended);var l=this.config;this.levels&&l.autoStartLoad&&this.state===nt&&this.startLoad(l.startPosition)},e.onMediaDetaching=function(){var t=this.media;t!=null&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&this.onvseeking&&this.onvended&&(t.removeEventListener("seeking",this.onvseeking),t.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()},e.onMediaSeeking=function(){var t=this.config,i=this.fragCurrent,r=this.media,l=this.mediaBuffer,u=this.state,c=r?r.currentTime:0,f=ke.bufferInfo(l||r,c,t.maxBufferHole);if(this.log("media seeking to "+(le(c)?c.toFixed(3):c)+", state: "+u),this.state===ha)this.resetLoadingState();else if(i){var h=t.maxFragLookUpTolerance,p=i.start-h,E=i.start+i.duration+h;if(!f.len||E<f.start||p>f.end){var b=c>E;(c<p||b)&&(b&&i.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),i.abortRequests()),this.resetLoadingState())}}r&&(this.fragmentTracker.removeFragmentsInRange(c,1/0,this.playlistType,!0),this.lastCurrentTime=c),this.loadedmetadata||f.len||(this.nextLoadPosition=this.startPosition=c),this.tickImmediate()},e.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},e.onManifestLoaded=function(t,i){this.startTimeOffset=i.startTimeOffset,this.initPTS=[]},e.onHandlerDestroying=function(){this.stopLoad(),d.prototype.onHandlerDestroying.call(this)},e.onHandlerDestroyed=function(){this.state=nt,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,d.prototype.onHandlerDestroyed.call(this)},e.loadFragment=function(t,i,r){this._loadFragForPlayback(t,i,r)},e._loadFragForPlayback=function(t,i,r){var l=this;this._doFragLoad(t,i,r,function(u){if(l.fragContextChanged(t))return l.warn("Fragment "+t.sn+(u.part?" p: "+u.part.index:"")+" of level "+t.level+" was dropped during download."),void l.fragmentTracker.removeFragment(t);t.stats.chunkCount++,l._handleFragmentLoadProgress(u)}).then(function(u){if(u){var c=l.state;l.fragContextChanged(t)?(c===Di||!l.fragCurrent&&c===ai)&&(l.fragmentTracker.removeFragment(t),l.state=Le):("payload"in u&&(l.log("Loaded fragment "+t.sn+" of level "+t.level),l.hls.trigger(w.FRAG_LOADED,u)),l._handleFragmentLoadComplete(u))}}).catch(function(u){l.state!==nt&&l.state!==Gr&&(l.warn(u),l.resetFragmentLoading(t))})},e.clearTrackerIfNeeded=function(t){var i;if(this.fragmentTracker.getState(t)===G){var r=t.type,l=this.getFwdBufferInfo(this.mediaBuffer,r),u=Math.max(t.duration,l?l.len:this.config.maxBufferLength);this.reduceMaxBufferLength(u)&&this.fragmentTracker.removeFragment(t)}else((i=this.mediaBuffer)==null?void 0:i.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},e.flushMainBuffer=function(t,i,r){if(r===void 0&&(r=null),t-i){var l={startOffset:t,endOffset:i,type:r};this.hls.trigger(w.BUFFER_FLUSHING,l)}},e._loadInitSegment=function(t,i){var r=this;this._doFragLoad(t,i).then(function(l){if(!l||r.fragContextChanged(t)||!r.levels)throw new Error("init load aborted");return l}).then(function(l){var u=r.hls,c=l.payload,f=t.decryptdata;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var h=self.performance.now();return r.decrypter.decrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).catch(function(p){throw u.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.FRAG_DECRYPT_ERROR,fatal:!1,error:p,reason:p.message,frag:t}),p}).then(function(p){var E=self.performance.now();return u.trigger(w.FRAG_DECRYPTED,{frag:t,payload:p,stats:{tstart:h,tdecrypt:E}}),l.payload=p,l})}return l}).then(function(l){var u=r.fragCurrent,c=r.hls;if(!r.levels)throw new Error("init load aborted, missing levels");var f=t.stats;r.state=Le,i.fragmentError=0,t.data=new Uint8Array(l.payload),f.parsing.start=f.buffering.start=self.performance.now(),f.parsing.end=f.buffering.end=self.performance.now(),l.frag===u&&c.trigger(w.FRAG_BUFFERED,{stats:f,frag:u,part:null,id:t.type}),r.tick()}).catch(function(l){r.state!==nt&&r.state!==Gr&&(r.warn(l),r.resetFragmentLoading(t))})},e.fragContextChanged=function(t){var i=this.fragCurrent;return!t||!i||t.level!==i.level||t.sn!==i.sn||t.urlId!==i.urlId},e.fragBufferedComplete=function(t,i){var r,l,u,c,f=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(i?" part: "+i.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+t.level+" (frag:["+((r=t.startPTS)!=null?r:NaN).toFixed(3)+"-"+((l=t.endPTS)!=null?l:NaN).toFixed(3)+"] > buffer:"+(f?Kt(ke.getBuffered(f)):"(detached)")+")"),this.state=Le,f&&(!this.loadedmetadata&&t.type==rt&&f.buffered.length&&((u=this.fragCurrent)==null?void 0:u.sn)===((c=this.fragPrevious)==null?void 0:c.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},e.seekToStartPos=function(){},e._handleFragmentLoadComplete=function(t){var i=this.transmuxer;if(i){var r=t.frag,l=t.part,u=t.partsLoaded,c=!u||u.length===0||u.some(function(h){return!h}),f=new ft(r.level,r.sn,r.stats.chunkCount+1,0,l?l.index:-1,!c);i.flush(f)}},e._handleFragmentLoadProgress=function(t){},e._doFragLoad=function(t,i,r,l){var u,c=this;r===void 0&&(r=null);var f=i==null?void 0:i.details;if(!this.levels||!f)throw new Error("frag load aborted, missing level"+(f?"":" detail")+"s");var h=null;if(!t.encrypted||(u=t.decryptdata)!=null&&u.key?!t.encrypted&&f.encryptedFragments.length&&this.keyLoader.loadClear(t,f.encryptedFragments):(this.log("Loading key for "+t.sn+" of ["+f.startSN+"-"+f.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+t.level),this.state=Ri,this.fragCurrent=t,h=this.keyLoader.load(t).then(function(S){if(!c.fragContextChanged(S.frag))return c.hls.trigger(w.KEY_LOADED,S),c.state===Ri&&(c.state=Le),S}),this.hls.trigger(w.KEY_LOADING,{frag:t}),this.fragCurrent===null&&(h=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),r=Math.max(t.start,r||0),this.config.lowLatencyMode){var p=f.partList;if(p&&l){r>t.end&&f.fragmentHint&&(t=f.fragmentHint);var E=this.getNextPart(p,t,r);if(E>-1){var b,A=p[E];return this.log("Loading part sn: "+t.sn+" p: "+A.index+" cc: "+t.cc+" of playlist ["+f.startSN+"-"+f.endSN+"] parts [0-"+E+"-"+(p.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),this.nextLoadPosition=A.start+A.duration,this.state=Di,b=h?h.then(function(S){return!S||c.fragContextChanged(S.frag)?null:c.doFragPartsLoad(t,A,i,l)}).catch(function(S){return c.handleFragLoadError(S)}):this.doFragPartsLoad(t,A,i,l).catch(function(S){return c.handleFragLoadError(S)}),this.hls.trigger(w.FRAG_LOADING,{frag:t,part:A,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):b}if(!t.url||this.loadedEndOfParts(p,r))return Promise.resolve(null)}}this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(f?"of ["+f.startSN+"-"+f.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),le(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=Di;var k,D=this.config.progressive;return k=D&&h?h.then(function(S){return!S||c.fragContextChanged(S==null?void 0:S.frag)?null:c.fragmentLoader.load(t,l)}).catch(function(S){return c.handleFragLoadError(S)}):Promise.all([this.fragmentLoader.load(t,D?l:void 0),h]).then(function(S){var I=S[0];return!D&&I&&l&&l(I),I}).catch(function(S){return c.handleFragLoadError(S)}),this.hls.trigger(w.FRAG_LOADING,{frag:t,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):k},e.doFragPartsLoad=function(t,i,r,l){var u=this;return new Promise(function(c,f){var h,p=[],E=(h=r.details)==null?void 0:h.partList;(function b(A){u.fragmentLoader.loadPart(t,A,l).then(function(k){p[A.index]=k;var D=k.part;u.hls.trigger(w.FRAG_LOADED,k);var S=da(r,t.sn,A.index+1)||$a(E,t.sn,A.index+1);if(!S)return c({frag:t,part:D,partsLoaded:p});b(S)}).catch(f)})(i)})},e.handleFragLoadError=function(t){if("data"in t){var i=t.data;t.data&&i.details===W.INTERNAL_ABORTED?this.handleFragLoadAborted(i.frag,i.part):this.hls.trigger(w.ERROR,i)}else this.hls.trigger(w.ERROR,{type:oe.OTHER_ERROR,details:W.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null},e._handleTransmuxerFlush=function(t){var i=this.getCurrentContext(t);if(i&&this.state===ai){var r=i.frag,l=i.part,u=i.level,c=self.performance.now();r.stats.parsing.end=c,l&&(l.stats.parsing.end=c),this.updateLevelTiming(r,l,u,t.partial)}else this.fragCurrent||this.state===nt||this.state===Gr||(this.state=Le)},e.getCurrentContext=function(t){var i=this.levels,r=this.fragCurrent,l=t.level,u=t.sn,c=t.part;if(i==null||!i[l])return this.warn("Levels object was unset while buffering fragment "+u+" of level "+l+". The current chunk will not be buffered."),null;var f=i[l],h=c>-1?da(f,u,c):null,p=h?h.fragment:function(E,b,A){if(E==null||!E.details)return null;var k=E.details,D=k.fragments[b-k.startSN];return D||((D=k.fragmentHint)&&D.sn===b?D:b<k.startSN&&A&&A.sn===b?A:null)}(f,u,r);return p?(r&&r!==p&&(p.stats=r.stats),{frag:p,part:h,level:f}):null},e.bufferFragmentData=function(t,i,r,l){var u;if(t&&this.state===ai){var c=t.data1,f=t.data2,h=c;if(c&&f&&(h=er(c,f)),(u=h)!=null&&u.length){var p={type:t.type,frag:i,part:r,chunkMeta:l,parent:i.type,data:h};this.hls.trigger(w.BUFFER_APPENDING,p),t.dropped&&t.independent&&!r&&this.flushBufferGap(i)}}},e.flushBufferGap=function(t){var i=this.media;if(i)if(ke.isBuffered(i,i.currentTime)){var r=i.currentTime,l=ke.bufferInfo(i,r,0),u=t.duration,c=Math.min(2*this.config.maxFragLookUpTolerance,.25*u),f=Math.max(Math.min(t.start-c,l.end-c),r+c);t.start-f>c&&this.flushMainBuffer(f,t.start)}else this.flushMainBuffer(0,t.start)},e.getFwdBufferInfo=function(t,i){var r=this.getLoadPosition();return le(r)?this.getFwdBufferInfoAtPos(t,r,i):null},e.getFwdBufferInfoAtPos=function(t,i,r){var l=this.config.maxBufferHole,u=ke.bufferInfo(t,i,l);if(u.len===0&&u.nextStart!==void 0){var c=this.fragmentTracker.getBufferedFrag(i,r);if(c&&u.nextStart<c.end)return ke.bufferInfo(t,i,Math.max(u.nextStart,l))}return u},e.getMaxBufferLength=function(t){var i,r=this.config;return i=t?Math.max(8*r.maxBufferSize/t,r.maxBufferLength):r.maxBufferLength,Math.min(i,r.maxMaxBufferLength)},e.reduceMaxBufferLength=function(t){var i=this.config,r=t||i.maxBufferLength;return i.maxMaxBufferLength>=r&&(i.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+i.maxMaxBufferLength+"s"),!0)},e.getNextFragment=function(t,i){var r=i.fragments,l=r.length;if(!l)return null;var u,c=this.config,f=r[0].start;if(i.live){var h=c.initialLiveManifestSize;if(l<h)return this.warn("Not enough fragments to start playback (have: "+l+", need: "+h+")"),null;i.PTSKnown||this.startFragRequested||this.startPosition!==-1||(u=this.getInitialLiveFragment(i,r),this.startPosition=u?this.hls.liveSyncPosition||u.start:t)}else t<=f&&(u=r[0]);if(!u){var p=c.lowLatencyMode?i.partEnd:i.fragmentEnd;u=this.getFragmentAtPosition(t,p,i)}return this.mapToInitFragWhenRequired(u)},e.isLoopLoading=function(t,i){var r=this.fragmentTracker.getState(t);return(r===K||r===$&&!!t.gap)&&this.nextLoadPosition>i},e.getNextFragmentLoopLoading=function(t,i,r,l,u){var c=t.gap,f=this.getNextFragment(this.nextLoadPosition,i);if(f===null)return f;if(t=f,c&&t&&!t.gap&&r.nextStart){var h=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,l);if(h!==null&&r.len+h.len>=u)return this.log('buffer full after gaps in "'+l+'" playlist starting at sn: '+t.sn),null}return t},e.mapToInitFragWhenRequired=function(t){return t==null||!t.initSegment||t!=null&&t.initSegment.data||this.bitrateTest?t:t.initSegment},e.getNextPart=function(t,i,r){for(var l=-1,u=!1,c=!0,f=0,h=t.length;f<h;f++){var p=t[f];if(c=c&&!p.independent,l>-1&&r<p.start)break;var E=p.loaded;E?l=-1:(u||p.independent||c)&&p.fragment===i&&(l=f),u=E}return l},e.loadedEndOfParts=function(t,i){var r=t[t.length-1];return r&&i>r.start&&r.loaded},e.getInitialLiveFragment=function(t,i){var r=this.fragPrevious,l=null;if(r){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),l=function(h,p,E){if(p===null||!Array.isArray(h)||!h.length||!le(p)||p<(h[0].programDateTime||0)||p>=(h[h.length-1].endProgramDateTime||0))return null;E=E||0;for(var b=0;b<h.length;++b){var A=h[b];if(Md(p,E,A))return A}return null}(i,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!l){var u=r.sn+1;if(u>=t.startSN&&u<=t.endSN){var c=i[u-t.startSN];r.cc===c.cc&&(l=c,this.log("Live playlist, switching playlist, load frag with next SN: "+l.sn))}l||(l=function(h,p){return Co(h,function(E){return E.cc<p?1:E.cc>p?-1:0})}(i,r.cc),l&&this.log("Live playlist, switching playlist, load frag with same CC: "+l.sn))}}else{var f=this.hls.liveSyncPosition;f!==null&&(l=this.getFragmentAtPosition(f,this.bitrateTest?t.fragmentEnd:t.edge,t))}return l},e.getFragmentAtPosition=function(t,i,r){var l,u=this.config,c=this.fragPrevious,f=r.fragments,h=r.endSN,p=r.fragmentHint,E=u.maxFragLookUpTolerance,b=!!(u.lowLatencyMode&&r.partList&&p);if(b&&p&&!this.bitrateTest&&(f=f.concat(p),h=p.sn),l=t<i?ca(c,f,t,t>i-E?0:E):f[f.length-1]){var A=l.sn-r.startSN,k=this.fragmentTracker.getState(l);if((k===K||k===$&&l.gap)&&(c=l),c&&l.sn===c.sn&&!b&&c&&l.level===c.level){var D=f[A+1];l=l.sn<h&&this.fragmentTracker.getState(D)!==K?D:null}}return l},e.synchronizeToLiveEdge=function(t){var i=this.config,r=this.media;if(r){var l=this.hls.liveSyncPosition,u=r.currentTime,c=t.fragments[0].start,f=t.edge,h=u>=c-i.maxFragLookUpTolerance&&u<=f;if(l!==null&&r.duration>l&&(u<l||!h)){var p=i.liveMaxLatencyDuration!==void 0?i.liveMaxLatencyDuration:i.liveMaxLatencyDurationCount*t.targetduration;(!h&&r.readyState<4||u<f-p)&&(this.loadedmetadata||(this.nextLoadPosition=l),r.readyState&&(this.warn("Playback: "+u.toFixed(3)+" is located too far from the end of live sliding playlist: "+f+", reset currentTime to : "+l.toFixed(3)),r.currentTime=l))}}},e.alignPlaylists=function(t,i){var r=this.levels,l=this.levelLastLoaded,u=this.fragPrevious,c=l!==null?r[l]:null,f=t.fragments.length;if(!f)return this.warn("No fragments in live playlist"),0;var h=t.fragments[0].start,p=!i,E=t.alignedSliding&&le(h);if(p||!E&&!h){ce(u,c,t);var b=t.fragments[0].start;return this.log("Live playlist sliding: "+b.toFixed(2)+" start-sn: "+(i?i.startSN:"na")+"->"+t.startSN+" prev-sn: "+(u?u.sn:"na")+" fragments: "+f),b}return h},e.waitForCdnTuneIn=function(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)},e.setStartPosition=function(t,i){var r=this.startPosition;if(r<i&&(r=-1),r===-1||this.lastCurrentTime===-1){var l=this.startTimeOffset!==null,u=l?this.startTimeOffset:t.startTimeOffset;u!==null&&le(u)?(r=i+u,u<0&&(r+=t.totalduration),r=Math.min(Math.max(i,r),i+t.totalduration),this.log("Start time offset "+u+" found in "+(l?"multivariant":"media")+" playlist, adjust startPosition to "+r),this.startPosition=r):t.live?r=this.hls.liveSyncPosition||i:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r},e.getLoadPosition=function(){var t=this.media,i=0;return this.loadedmetadata&&t?i=t.currentTime:this.nextLoadPosition&&(i=this.nextLoadPosition),i},e.handleFragLoadAborted=function(t,i){this.transmuxer&&t.sn!=="initSegment"&&t.stats.aborted&&(this.warn("Fragment "+t.sn+(i?" part"+i.index:"")+" of level "+t.level+" was aborted"),this.resetFragmentLoading(t))},e.resetFragmentLoading=function(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===di)||(this.state=Le)},e.onFragmentOrKeyLoadError=function(t,i){if(i.chunkMeta&&!i.frag){var r=this.getCurrentContext(i.chunkMeta);r&&(i.frag=r.frag)}var l=i.frag;if(l&&l.type===t&&this.levels)if(this.fragContextChanged(l)){var u;this.warn("Frag load error must match current frag to retry "+l.url+" > "+((u=this.fragCurrent)==null?void 0:u.url))}else{var c=i.details===W.FRAG_GAP;c&&this.fragmentTracker.fragBuffered(l,!0);var f=i.errorAction,h=f||{},p=h.action,E=h.retryCount,b=E===void 0?0:E,A=h.retryConfig;if(f&&p===rr&&A){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var k=Zn(A,b);this.warn("Fragment "+l.sn+" of "+t+" "+l.level+" errored with "+i.details+", retrying loading "+(b+1)+"/"+A.maxNumRetry+" in "+k+"ms"),f.resolved=!0,this.retryDate=self.performance.now()+k,this.state=di}else A&&f?(this.resetFragmentErrors(t),b<A.maxNumRetry?c||(f.resolved=!0):H.warn(i.details+" reached or exceeded max retry ("+b+")")):this.state=Gr;this.tickImmediate()}},e.reduceLengthAndFlushBuffer=function(t){if(this.state===ai||this.state===Za){var i=t.parent,r=this.getFwdBufferInfo(this.mediaBuffer,i),l=r&&r.len>.5;l&&this.reduceMaxBufferLength(r.len);var u=!l;return u&&this.warn("Buffer full error while media.currentTime is not buffered, flush "+i+" buffer"),t.frag&&(this.fragmentTracker.removeFragment(t.frag),this.nextLoadPosition=t.frag.start),this.resetLoadingState(),u}return!1},e.resetFragmentErrors=function(t){t===Li&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==nt&&(this.state=Le)},e.afterBufferFlushed=function(t,i,r){if(t){var l=ke.getBuffered(t);this.fragmentTracker.detectEvictedFragments(i,l,r),this.state===ha&&this.resetLoadingState()}},e.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Le},e.resetStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=!1;var i=this.levels?this.levels[t].details:null;i!=null&&i.live?(this.startPosition=-1,this.setStartPosition(i,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},e.resetWhenMissingContext=function(t){this.warn("The loading context changed while buffering fragment "+t.sn+" of level "+t.level+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(t.level),this.resetLoadingState()},e.removeUnbufferedFrags=function(t){t===void 0&&(t=0),this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)},e.updateLevelTiming=function(t,i,r,l){var u,c=this,f=r.details;if(f){if(Object.keys(t.elementaryStreams).reduce(function(p,E){var b=t.elementaryStreams[E];if(b){var A=b.endPTS-b.startPTS;if(A<=0)return c.warn("Could not parse fragment "+t.sn+" "+E+" duration reliably ("+A+")"),p||!1;var k=l?0:Io(f,t,b.startPTS,b.endPTS,b.startDTS,b.endDTS);return c.hls.trigger(w.LEVEL_PTS_UPDATED,{details:f,level:r,drift:k,type:E,frag:t,start:b.startPTS,end:b.endPTS}),!0}return p},!1))r.fragmentError=0;else if(((u=this.transmuxer)==null?void 0:u.error)===null){var h=new Error("Found no media in fragment "+t.sn+" of level "+r.id+" resetting transmuxer to fallback to playlist timing");if(this.warn(h.message),this.hls.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:h,frag:t,reason:"Found no media in msn "+t.sn+' of level "'+r.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=Za,this.hls.trigger(w.FRAG_PARSED,{frag:t,part:i})}else this.warn("level.details undefined")},e.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},e.recoverWorkerError=function(t){t.event==="demuxerWorker"&&(this.resetTransmuxer(),this.resetLoadingState())},M(s,[{key:"state",get:function(){return this._state},set:function(t){var i=this._state;i!==t&&(this._state=t,this.log(i+"->"+t))}}]),s}(Qt);function Od(){if(typeof self!="undefined")return self.MediaSource||self.WebKitMediaSource}function uh(){return self.SourceBuffer||self.WebKitSourceBuffer}function ar(d,s){return d===void 0&&(d=""),s===void 0&&(s=9e4),{type:d,id:-1,pid:-1,inputTimeScale:s,sequenceNumber:-1,samples:[],dropped:0}}var ch=function(){function d(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var s=d.prototype;return s.resetInitSegment=function(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},s.resetTimeStamp=function(e){this.initPTS=e,this.resetContiguity()},s.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},s.canParse=function(e,t){return!1},s.appendFrame=function(e,t,i){},s.demux=function(e,t){this.cachedData&&(e=er(this.cachedData,e),this.cachedData=null);var i,r=Oa(e,0),l=r?r.length:0,u=this._audioTrack,c=this._id3Track,f=r?function(b){for(var A=no(b),k=0;k<A.length;k++){var D=A[k];if(ro(D))return oo(D)}}(r):void 0,h=e.length;for((this.basePTS===null||this.frameIndex===0&&le(f))&&(this.basePTS=_v(f,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),r&&r.length>0&&c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:tr,duration:Number.POSITIVE_INFINITY});l<h;){if(this.canParse(e,l)){var p=this.appendFrame(u,e,l);p?(this.frameIndex++,this.lastPTS=p.sample.pts,i=l+=p.length):l=h}else io(e,l)?(r=Oa(e,l),c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:tr,duration:Number.POSITIVE_INFINITY}),i=l+=r.length):l++;if(l===h&&i!==h){var E=vi(e,i);this.cachedData?this.cachedData=er(this.cachedData,E):this.cachedData=E}}return{audioTrack:u,videoTrack:ar(),id3Track:c,textTrack:ar()}},s.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},s.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:ar(),id3Track:this._id3Track,textTrack:ar()}},s.destroy=function(){},d}(),_v=function(d,s,e){return le(d)?90*d:9e4*s+(e?9e4*e.baseTime/e.timescale:0)};function hh(d,s){return d[s]===255&&(246&d[s+1])==240}function fh(d,s){return 1&d[s+1]?7:9}function Nd(d,s){return(3&d[s+3])<<11|d[s+4]<<3|(224&d[s+5])>>>5}function Mo(d,s){return s+1<d.length&&hh(d,s)}function Tv(d,s){if(Mo(d,s)){var e=fh(d,s);if(s+e>=d.length)return!1;var t=Nd(d,s);if(t<=e)return!1;var i=s+t;return i===d.length||Mo(d,i)}return!1}function mh(d,s,e,t,i){if(!d.samplerate){var r=function(l,u,c,f){var h,p,E,b,A=navigator.userAgent.toLowerCase(),k=f,D=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=1+((192&u[c+2])>>>6);var S=(60&u[c+2])>>>2;if(!(S>D.length-1))return E=(1&u[c+2])<<2,E|=(192&u[c+3])>>>6,H.log("manifest codec:"+f+", ADTS type:"+h+", samplingIndex:"+S),/firefox/i.test(A)?S>=6?(h=5,b=new Array(4),p=S-3):(h=2,b=new Array(2),p=S):A.indexOf("android")!==-1?(h=2,b=new Array(2),p=S):(h=5,b=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&S>=6?p=S-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(S>=6&&E===1||/vivaldi/i.test(A))||!f&&E===1)&&(h=2,b=new Array(2)),p=S)),b[0]=h<<3,b[0]|=(14&S)>>1,b[1]|=(1&S)<<7,b[1]|=E<<3,h===5&&(b[1]|=(14&p)>>1,b[2]=(1&p)<<7,b[2]|=8,b[3]=0),{config:b,samplerate:D[S],channelCount:E,codec:"mp4a.40."+h,manifestCodec:k};l.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+S})}(s,e,t,i);if(!r)return;d.config=r.config,d.samplerate=r.samplerate,d.channelCount=r.channelCount,d.codec=r.codec,d.manifestCodec=r.manifestCodec,H.log("parsed codec:"+d.codec+", rate:"+r.samplerate+", channels:"+r.channelCount)}}function ph(d){return 9216e4/d}function vh(d,s,e,t,i){var r,l=t+i*ph(d.samplerate),u=function(A,k){var D=fh(A,k);if(k+D<=A.length){var S=Nd(A,k)-D;if(S>0)return{headerLength:D,frameLength:S}}}(s,e);if(u){var c=u.frameLength,f=u.headerLength,h=f+c,p=Math.max(0,e+h-s.length);p?(r=new Uint8Array(h-f)).set(s.subarray(e+f,s.length),0):r=s.subarray(e+f,e+h);var E={unit:r,pts:l};return p||d.samples.push(E),{sample:E,length:h,missing:p}}var b=s.length-e;return(r=new Uint8Array(b)).set(s.subarray(e,s.length),0),{sample:{unit:r,pts:l},length:b,missing:-1}}var Av=function(d){function s(t,i){var r;return(r=d.call(this)||this).observer=void 0,r.config=void 0,r.observer=t,r.config=i,r}z(s,d);var e=s.prototype;return e.resetInitSegment=function(t,i,r,l){d.prototype.resetInitSegment.call(this,t,i,r,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:i,duration:l,inputTimeScale:9e4,dropped:0}},s.probe=function(t){if(!t)return!1;for(var i=(Oa(t,0)||[]).length,r=t.length;i<r;i++)if(Tv(t,i))return H.log("ADTS sync word found !"),!0;return!1},e.canParse=function(t,i){return function(r,l){return function(u,c){return c+5<u.length}(r,l)&&hh(r,l)&&Nd(r,l)<=r.length-l}(t,i)},e.appendFrame=function(t,i,r){mh(t,this.observer,i,r,t.manifestCodec);var l=vh(t,i,r,this.basePTS,this.frameIndex);if(l&&l.missing===0)return l},s}(ch),Sv=/\/emsg[-/]ID3/i,kv=function(){function d(e,t){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=t}var s=d.prototype;return s.resetTimeStamp=function(){},s.resetInitSegment=function(e,t,i,r){var l=this.videoTrack=ar("video",1),u=this.audioTrack=ar("audio",1),c=this.txtTrack=ar("text",1);if(this.id3Track=ar("id3",1),this.timeOffset=0,e!=null&&e.byteLength){var f=Hn(e);if(f.video){var h=f.video,p=h.id,E=h.timescale,b=h.codec;l.id=p,l.timescale=c.timescale=E,l.codec=b}if(f.audio){var A=f.audio,k=A.id,D=A.timescale,S=A.codec;u.id=k,u.timescale=D,u.codec=S}c.id=Un.text,l.sampleDuration=0,l.duration=u.duration=r}},s.resetContiguity=function(){},d.probe=function(e){return je(e=e.length>16384?e.subarray(0,16384):e,["moof"]).length>0},s.demux=function(e,t){this.timeOffset=t;var i=e,r=this.videoTrack,l=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=er(this.remainderData,e));var u=function(f){var h={valid:null,remainder:null},p=je(f,["moof"]);if(!p)return h;if(p.length<2)return h.remainder=f,h;var E=p[p.length-1];return h.valid=vi(f,0,E.byteOffset-8),h.remainder=vi(f,E.byteOffset-8),h}(i);this.remainderData=u.remainder,r.samples=u.valid||new Uint8Array}else r.samples=i;var c=this.extractID3Track(r,t);return l.samples=fo(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:c,textTrack:this.txtTrack}},s.flush=function(){var e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;var r=this.extractID3Track(t,this.timeOffset);return i.samples=fo(e,t),{videoTrack:t,audioTrack:ar(),id3Track:r,textTrack:ar()}},s.extractID3Track=function(e,t){var i=this.id3Track;if(e.samples.length){var r=je(e.samples,["emsg"]);r&&r.forEach(function(l){var u=function(p){var E=p[0],b="",A="",k=0,D=0,S=0,I=0,F=0,N=0;if(E===0){for(;xt(p.subarray(N,N+1))!=="\0";)b+=xt(p.subarray(N,N+1)),N+=1;for(b+=xt(p.subarray(N,N+1)),N+=1;xt(p.subarray(N,N+1))!=="\0";)A+=xt(p.subarray(N,N+1)),N+=1;A+=xt(p.subarray(N,N+1)),N+=1,k=Be(p,12),D=Be(p,16),I=Be(p,20),F=Be(p,24),N=28}else if(E===1){k=Be(p,N+=4);var V=Be(p,N+=4),Y=Be(p,N+=4);for(N+=4,S=Math.pow(2,32)*V+Y,Number.isSafeInteger(S)||(S=Number.MAX_SAFE_INTEGER,H.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),I=Be(p,N),F=Be(p,N+=4),N+=4;xt(p.subarray(N,N+1))!=="\0";)b+=xt(p.subarray(N,N+1)),N+=1;for(b+=xt(p.subarray(N,N+1)),N+=1;xt(p.subarray(N,N+1))!=="\0";)A+=xt(p.subarray(N,N+1)),N+=1;A+=xt(p.subarray(N,N+1)),N+=1}return{schemeIdUri:b,value:A,timeScale:k,presentationTime:S,presentationTimeDelta:D,eventDuration:I,id:F,payload:p.subarray(N,p.byteLength)}}(l);if(Sv.test(u.schemeIdUri)){var c=le(u.presentationTime)?u.presentationTime/u.timeScale:t+u.presentationTimeDelta/u.timeScale,f=u.eventDuration===4294967295?Number.POSITIVE_INFINITY:u.eventDuration/u.timeScale;f<=.001&&(f=Number.POSITIVE_INFINITY);var h=u.payload;i.samples.push({data:h,len:h.byteLength,dts:c,pts:c,type:oa,duration:f})}})}return i},s.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},s.destroy=function(){},d}(),xo=null,wv=[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],Lv=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Iv=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Rv=[0,1,1,4];function gh(d,s,e,t,i){if(!(e+24>s.length)){var r=yh(s,e);if(r&&e+r.frameLength<=s.length){var l=t+i*(9e4*r.samplesPerFrame/r.sampleRate),u={unit:s.subarray(e,e+r.frameLength),pts:l,dts:l};return d.config=[],d.channelCount=r.channelCount,d.samplerate=r.sampleRate,d.samples.push(u),{sample:u,length:r.frameLength,missing:0}}}}function yh(d,s){var e=d[s+1]>>3&3,t=d[s+1]>>1&3,i=d[s+2]>>4&15,r=d[s+2]>>2&3;if(e!==1&&i!==0&&i!==15&&r!==3){var l=d[s+2]>>1&1,u=d[s+3]>>6,c=1e3*wv[14*(e===3?3-t:t===3?3:4)+i-1],f=Lv[3*(e===3?0:e===2?1:2)+r],h=u===3?1:2,p=Iv[e][t],E=Rv[t],b=8*p*E,A=Math.floor(p*c/f+l)*E;if(xo===null){var k=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);xo=k?parseInt(k[1]):0}return!!xo&&xo<=87&&t===2&&c>=224e3&&u===0&&(d[s+3]=128|d[s+3]),{sampleRate:f,channelCount:h,frameLength:A,samplesPerFrame:b}}}function Fd(d,s){return d[s]===255&&(224&d[s+1])==224&&(6&d[s+1])!=0}function Eh(d,s){return s+1<d.length&&Fd(d,s)}function Dv(d,s){if(s+1<d.length&&Fd(d,s)){var e=yh(d,s),t=4;e!=null&&e.frameLength&&(t=e.frameLength);var i=s+t;return i===d.length||Eh(d,i)}return!1}var bh=function(){function d(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var s=d.prototype;return s.loadWord=function(){var e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),l=Math.min(4,t);if(l===0)throw new Error("no bytes available");r.set(e.subarray(i,i+l)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*l,this.bytesAvailable-=l},s.skipBits=function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},s.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;if(e>32&&H.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?i<<t|this.readBits(t):i},s.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!=0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},s.skipUEG=function(){this.skipBits(1+this.skipLZ())},s.skipEG=function(){this.skipBits(1+this.skipLZ())},s.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},s.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},s.readBoolean=function(){return this.readBits(1)===1},s.readUByte=function(){return this.readBits(8)},s.readUShort=function(){return this.readBits(16)},s.readUInt=function(){return this.readBits(32)},s.skipScalingList=function(e){for(var t=8,i=8,r=0;r<e;r++)i!==0&&(i=(t+this.readEG()+256)%256),t=i===0?t:i},s.readSPS=function(){var e,t,i,r=0,l=0,u=0,c=0,f=this.readUByte.bind(this),h=this.readBits.bind(this),p=this.readUEG.bind(this),E=this.readBoolean.bind(this),b=this.skipBits.bind(this),A=this.skipEG.bind(this),k=this.skipUEG.bind(this),D=this.skipScalingList.bind(this);f();var S=f();if(h(5),b(3),f(),k(),S===100||S===110||S===122||S===244||S===44||S===83||S===86||S===118||S===128){var I=p();if(I===3&&b(1),k(),k(),b(1),E())for(t=I!==3?8:12,i=0;i<t;i++)E()&&D(i<6?16:64)}k();var F=p();if(F===0)p();else if(F===1)for(b(1),A(),A(),e=p(),i=0;i<e;i++)A();k(),b(1);var N=p(),V=p(),Y=h(1);Y===0&&b(1),b(1),E()&&(r=p(),l=p(),u=p(),c=p());var j=[1,1];if(E()&&E())switch(f()){case 1:j=[1,1];break;case 2:j=[12,11];break;case 3:j=[10,11];break;case 4:j=[16,11];break;case 5:j=[40,33];break;case 6:j=[24,11];break;case 7:j=[20,11];break;case 8:j=[32,11];break;case 9:j=[80,33];break;case 10:j=[18,11];break;case 11:j=[15,11];break;case 12:j=[64,33];break;case 13:j=[160,99];break;case 14:j=[4,3];break;case 15:j=[3,2];break;case 16:j=[2,1];break;case 255:j=[f()<<8|f(),f()<<8|f()]}return{width:Math.ceil(16*(N+1)-2*r-2*l),height:(2-Y)*(V+1)*16-(Y?2:4)*(u+c),pixelRatio:j}},s.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},d}(),Cv=function(){function d(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new wt(t,{removePKCS7Padding:!1})}var s=d.prototype;return s.decryptBuffer=function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)},s.decryptAacSample=function(e,t,i){var r=this,l=e[t].unit;if(!(l.length<=16)){var u=l.subarray(16,l.length-l.length%16),c=u.buffer.slice(u.byteOffset,u.byteOffset+u.length);this.decryptBuffer(c).then(function(f){var h=new Uint8Array(f);l.set(h,16),r.decrypter.isSync()||r.decryptAacSamples(e,t+1,i)})}},s.decryptAacSamples=function(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,i),this.decrypter.isSync())))return}},s.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),r=0,l=32;l<e.length-16;l+=160,r+=16)i.set(e.subarray(l,l+16),r);return i},s.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),r=0,l=32;l<e.length-16;l+=160,r+=16)e.set(i.subarray(r,r+16),l);return e},s.decryptAvcSample=function(e,t,i,r,l){var u=this,c=Kn(l.data),f=this.getAvcEncryptedData(c);this.decryptBuffer(f.buffer).then(function(h){l.data=u.getAvcDecryptedUnit(c,h),u.decrypter.isSync()||u.decryptAvcSamples(e,t,i+1,r)})},s.decryptAvcSamples=function(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();for(var l=e[t].units;!(i>=l.length);i++){var u=l[i];if(!(u.data.length<=48||u.type!==1&&u.type!==5||(this.decryptAvcSample(e,t,i,r,u),this.decrypter.isSync())))return}}},d}(),Ei=188,Mv=function(){function d(e,t,i){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=e,this.config=t,this.typeSupported=i}d.probe=function(e){var t=d.syncOffset(e);return t>0&&H.warn("MPEG2-TS detected but first sync word found @ offset "+t),t!==-1},d.syncOffset=function(e){for(var t=e.length,i=Math.min(940,e.length-Ei)+1,r=0;r<i;){for(var l=!1,u=r;u<t&&e[u]===71;u+=Ei)if(l||Ud(e,u)!==0||(l=!0),l&&u+Ei>i)return r;r++}return-1},d.createTrack=function(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Un[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}};var s=d.prototype;return s.resetInitSegment=function(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video"),this._audioTrack=d.createTrack("audio",r),this._id3Track=d.createTrack("id3"),this._txtTrack=d.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r},s.resetTimeStamp=function(){},s.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,i=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},s.demux=function(e,t,i,r){var l;i===void 0&&(i=!1),r===void 0&&(r=!1),i||(this.sampleAes=null);var u=this._avcTrack,c=this._audioTrack,f=this._id3Track,h=this._txtTrack,p=u.pid,E=u.pesData,b=c.pid,A=f.pid,k=c.pesData,D=f.pesData,S=null,I=this.pmtParsed,F=this._pmtId,N=e.length;if(this.remainderData&&(N=(e=er(this.remainderData,e)).length,this.remainderData=null),N<Ei&&!r)return this.remainderData=e,{audioTrack:c,videoTrack:u,id3Track:f,textTrack:h};var V=Math.max(0,d.syncOffset(e));(N-=(N-V)%Ei)<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,N,e.buffer.byteLength-N));for(var Y=0,j=V;j<N;j+=Ei)if(e[j]===71){var J=!!(64&e[j+1]),Q=Ud(e,j),X=void 0;if((48&e[j+3])>>4>1){if((X=j+5+e[j+4])===j+Ei)continue}else X=j+4;switch(Q){case p:J&&(E&&(l=en(E))&&this.parseAVCPES(u,h,l,!1),E={data:[],size:0}),E&&(E.data.push(e.subarray(X,j+Ei)),E.size+=j+Ei-X);break;case b:if(J){if(k&&(l=en(k)))switch(c.segmentCodec){case"aac":this.parseAACPES(c,l);break;case"mp3":this.parseMPEGPES(c,l)}k={data:[],size:0}}k&&(k.data.push(e.subarray(X,j+Ei)),k.size+=j+Ei-X);break;case A:J&&(D&&(l=en(D))&&this.parseID3PES(f,l),D={data:[],size:0}),D&&(D.data.push(e.subarray(X,j+Ei)),D.size+=j+Ei-X);break;case 0:J&&(X+=e[X]+1),F=this._pmtId=xv(e,X);break;case F:J&&(X+=e[X]+1);var ue=Pv(e,X,this.typeSupported,i);(p=ue.avc)>0&&(u.pid=p),(b=ue.audio)>0&&(c.pid=b,c.segmentCodec=ue.segmentCodec),(A=ue.id3)>0&&(f.pid=A),S===null||I||(H.warn("MPEG-TS PMT found at "+j+" after unknown PID '"+S+"'. Backtracking to sync byte @"+V+" to parse all TS packets."),S=null,j=V-188),I=this.pmtParsed=!0;break;case 17:case 8191:break;default:S=Q}}else Y++;if(Y>0){var ne=new Error("Found "+Y+" TS packet/s that do not start with 0x47");this.observer.emit(w.ERROR,w.ERROR,{type:oe.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:ne,reason:ne.message})}u.pesData=E,c.pesData=k,f.pesData=D;var be={audioTrack:c,videoTrack:u,id3Track:f,textTrack:h};return r&&this.extractRemainingSamples(be),be},s.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},s.extractRemainingSamples=function(e){var t,i=e.audioTrack,r=e.videoTrack,l=e.id3Track,u=e.textTrack,c=r.pesData,f=i.pesData,h=l.pesData;if(c&&(t=en(c))?(this.parseAVCPES(r,u,t,!0),r.pesData=null):r.pesData=c,f&&(t=en(f))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,t);break;case"mp3":this.parseMPEGPES(i,t)}i.pesData=null}else f!=null&&f.size&&H.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=f;h&&(t=en(h))?(this.parseID3PES(l,t),l.pesData=null):l.pesData=h},s.demuxSampleAes=function(e,t,i){var r=this.demux(e,i,!0,!this.config.progressive),l=this.sampleAes=new Cv(this.observer,this.config,t);return this.decrypt(r,l)},s.decrypt=function(e,t){return new Promise(function(i){var r=e.audioTrack,l=e.videoTrack;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,function(){l.samples?t.decryptAvcSamples(l.samples,0,0,function(){i(e)}):i(e)}):l.samples&&t.decryptAvcSamples(l.samples,0,0,function(){i(e)})})},s.destroy=function(){this._duration=0},s.parseAVCPES=function(e,t,i,r){var l,u=this,c=this.parseAVCNALu(e,i.data),f=this.avcSample,h=!1;i.data=null,f&&c.length&&!e.audFound&&(Bd(f,e),f=this.avcSample=Po(!1,i.pts,i.dts,"")),c.forEach(function(p){switch(p.type){case 1:l=!0,f||(f=u.avcSample=Po(!0,i.pts,i.dts,"")),f.frame=!0;var E=p.data;if(h&&E.length>4){var b=new bh(E).readSliceType();b!==2&&b!==4&&b!==7&&b!==9||(f.key=!0)}break;case 5:l=!0,f||(f=u.avcSample=Po(!0,i.pts,i.dts,"")),f.key=!0,f.frame=!0;break;case 6:l=!0,Vn(p.data,1,i.pts,t.samples);break;case 7:if(l=!0,h=!0,!e.sps){var A=p.data,k=new bh(A).readSPS();e.width=k.width,e.height=k.height,e.pixelRatio=k.pixelRatio,e.sps=[A],e.duration=u._duration;for(var D=A.subarray(1,4),S="avc1.",I=0;I<3;I++){var F=D[I].toString(16);F.length<2&&(F="0"+F),S+=F}e.codec=S}break;case 8:l=!0,e.pps||(e.pps=[p.data]);break;case 9:l=!1,e.audFound=!0,f&&Bd(f,e),f=u.avcSample=Po(!1,i.pts,i.dts,"");break;case 12:l=!0;break;default:l=!1,f&&(f.debug+="unknown NAL "+p.type+" ")}f&&l&&f.units.push(p)}),r&&f&&(Bd(f,e),this.avcSample=null)},s.getLastNalUnit=function(e){var t,i,r=this.avcSample;if(r&&r.units.length!==0||(r=e[e.length-1]),(t=r)!=null&&t.units){var l=r.units;i=l[l.length-1]}return i},s.parseAVCNALu=function(e,t){var i,r,l=t.byteLength,u=e.naluState||0,c=u,f=[],h=0,p=-1,E=0;for(u===-1&&(p=0,E=31&t[0],u=0,h=1);h<l;)if(i=t[h++],u)if(u!==1)if(i)if(i===1){if(p>=0){var b={data:t.subarray(p,h-u-1),type:E};f.push(b)}else{var A=this.getLastNalUnit(e.samples);if(A&&(c&&h<=4-c&&A.state&&(A.data=A.data.subarray(0,A.data.byteLength-c)),(r=h-u-1)>0)){var k=new Uint8Array(A.data.byteLength+r);k.set(A.data,0),k.set(t.subarray(0,r),A.data.byteLength),A.data=k,A.state=0}}h<l?(p=h,E=31&t[h],u=0):u=-1}else u=0;else u=3;else u=i?0:2;else u=i?0:1;if(p>=0&&u>=0){var D={data:t.subarray(p,l),type:E,state:u};f.push(D)}if(f.length===0){var S=this.getLastNalUnit(e.samples);if(S){var I=new Uint8Array(S.data.byteLength+t.byteLength);I.set(S.data,0),I.set(t,S.data.byteLength),S.data=I}}return e.naluState=u,f},s.parseAACPES=function(e,t){var i,r,l,u=0,c=this.aacOverFlow,f=t.data;if(c){this.aacOverFlow=null;var h=c.missing,p=c.sample.unit.byteLength;if(h===-1){var E=new Uint8Array(p+f.byteLength);E.set(c.sample.unit,0),E.set(f,p),f=E}else{var b=p-h;c.sample.unit.set(f.subarray(0,h),b),e.samples.push(c.sample),u=c.missing}}for(i=u,r=f.length;i<r-1&&!Mo(f,i);i++);if(i!==u){var A,k=i<r-1;A=k?"AAC PES did not start with ADTS header,offset:"+i:"No ADTS header found in AAC PES";var D=new Error(A);if(H.warn("parsing error: "+A),this.observer.emit(w.ERROR,w.ERROR,{type:oe.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,levelRetry:k,error:D,reason:A}),!k)return}if(mh(e,this.observer,f,i,this.audioCodec),t.pts!==void 0)l=t.pts;else{if(!c)return void H.warn("[tsdemuxer]: AAC PES unknown PTS");var S=ph(e.samplerate);l=c.sample.pts+S}for(var I,F=0;i<r;){if(i+=(I=vh(e,f,i,l,F)).length,I.missing){this.aacOverFlow=I;break}for(F++;i<r-1&&!Mo(f,i);i++);}},s.parseMPEGPES=function(e,t){var i=t.data,r=i.length,l=0,u=0,c=t.pts;if(c!==void 0)for(;u<r;)if(Eh(i,u)){var f=gh(e,i,u,c,l);if(!f)break;u+=f.length,l++}else u++;else H.warn("[tsdemuxer]: MPEG PES unknown PTS")},s.parseID3PES=function(e,t){if(t.pts!==void 0){var i=U({},t,{type:this._avcTrack?oa:tr,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}else H.warn("[tsdemuxer]: ID3 PES unknown PTS")},d}();function Po(d,s,e,t){return{key:d,frame:!1,pts:s,dts:e,units:[],debug:t,length:0}}function Ud(d,s){return((31&d[s+1])<<8)+d[s+2]}function xv(d,s){return(31&d[s+10])<<8|d[s+11]}function Pv(d,s,e,t){var i={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},r=s+3+((15&d[s+1])<<8|d[s+2])-4;for(s+=12+((15&d[s+10])<<8|d[s+11]);s<r;){var l=Ud(d,s);switch(d[s]){case 207:if(!t){H.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:i.audio===-1&&(i.audio=l);break;case 21:i.id3===-1&&(i.id3=l);break;case 219:if(!t){H.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:i.avc===-1&&(i.avc=l);break;case 3:case 4:e.mpeg!==!0&&e.mp3!==!0?H.log("MPEG audio found, not supported in this browser"):i.audio===-1&&(i.audio=l,i.segmentCodec="mp3");break;case 36:H.warn("Unsupported HEVC stream type found")}s+=5+((15&d[s+3])<<8|d[s+4])}return i}function en(d){var s,e,t,i,r,l=0,u=d.data;if(!d||d.size===0)return null;for(;u[0].length<19&&u.length>1;){var c=new Uint8Array(u[0].length+u[1].length);c.set(u[0]),c.set(u[1],u[0].length),u[0]=c,u.splice(1,1)}if(((s=u[0])[0]<<16)+(s[1]<<8)+s[2]===1){if((e=(s[4]<<8)+s[5])&&e>d.size-6)return null;var f=s[7];192&f&&(i=536870912*(14&s[9])+4194304*(255&s[10])+16384*(254&s[11])+128*(255&s[12])+(254&s[13])/2,64&f?i-(r=536870912*(14&s[14])+4194304*(255&s[15])+16384*(254&s[16])+128*(255&s[17])+(254&s[18])/2)>54e5&&(H.warn(Math.round((i-r)/9e4)+"s delta between PTS and DTS, align them"),i=r):r=i);var h=(t=s[8])+9;if(d.size<=h)return null;d.size-=h;for(var p=new Uint8Array(d.size),E=0,b=u.length;E<b;E++){var A=(s=u[E]).byteLength;if(h){if(h>A){h-=A;continue}s=s.subarray(h),A-=h,h=0}p.set(s,l),l+=A}return e&&(e-=t+3),{data:p,pts:i,dts:r,len:e}}return null}function Bd(d,s){if(d.units.length&&d.frame){if(d.pts===void 0){var e=s.samples,t=e.length;if(!t)return void s.dropped++;var i=e[t-1];d.pts=i.pts,d.dts=i.dts}s.samples.push(d)}d.debug.length&&H.log(d.pts+"/"+d.dts+":"+d.debug)}var Ov=function(d){function s(){return d.apply(this,arguments)||this}z(s,d);var e=s.prototype;return e.resetInitSegment=function(t,i,r,l){d.prototype.resetInitSegment.call(this,t,i,r,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:i,duration:l,inputTimeScale:9e4,dropped:0}},s.probe=function(t){if(!t)return!1;for(var i=(Oa(t,0)||[]).length,r=t.length;i<r;i++)if(Dv(t,i))return H.log("MPEG Audio sync word found !"),!0;return!1},e.canParse=function(t,i){return function(r,l){return Fd(r,l)&&4<=r.length-l}(t,i)},e.appendFrame=function(t,i,r){if(this.basePTS!==null)return gh(t,i,r,this.basePTS,this.frameIndex)},s}(ch),_h=function(){function d(){}return d.getSilentFrame=function(s,e){if(s==="mp4a.40.2"){if(e===1)return new Uint8Array([0,200,0,128,35,128]);if(e===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(e===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(e===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(e===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(e===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(e===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(e===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(e===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])}},d}(),Vr=Math.pow(2,32)-1,Wt=function(){function d(){}return d.init=function(){var s;for(s in d.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:[]},d.types)d.types.hasOwnProperty(s)&&(d.types[s]=[s.charCodeAt(0),s.charCodeAt(1),s.charCodeAt(2),s.charCodeAt(3)]);var e=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]),t=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]);d.HDLR_TYPES={video:e,audio:t};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);d.STTS=d.STSC=d.STCO=r,d.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),d.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),d.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),d.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var l=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);d.FTYP=d.box(d.types.ftyp,l,c,l,u),d.DINF=d.box(d.types.dinf,d.box(d.types.dref,i))},d.box=function(s){for(var e=8,t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var l=i.length,u=l;l--;)e+=i[l].byteLength;var c=new Uint8Array(e);for(c[0]=e>>24&255,c[1]=e>>16&255,c[2]=e>>8&255,c[3]=255&e,c.set(s,4),l=0,e=8;l<u;l++)c.set(i[l],e),e+=i[l].byteLength;return c},d.hdlr=function(s){return d.box(d.types.hdlr,d.HDLR_TYPES[s])},d.mdat=function(s){return d.box(d.types.mdat,s)},d.mdhd=function(s,e){e*=s;var t=Math.floor(e/(Vr+1)),i=Math.floor(e%(Vr+1));return d.box(d.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,s>>24&255,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))},d.mdia=function(s){return d.box(d.types.mdia,d.mdhd(s.timescale,s.duration),d.hdlr(s.type),d.minf(s))},d.mfhd=function(s){return d.box(d.types.mfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s]))},d.minf=function(s){return s.type==="audio"?d.box(d.types.minf,d.box(d.types.smhd,d.SMHD),d.DINF,d.stbl(s)):d.box(d.types.minf,d.box(d.types.vmhd,d.VMHD),d.DINF,d.stbl(s))},d.moof=function(s,e,t){return d.box(d.types.moof,d.mfhd(s),d.traf(t,e))},d.moov=function(s){for(var e=s.length,t=[];e--;)t[e]=d.trak(s[e]);return d.box.apply(null,[d.types.moov,d.mvhd(s[0].timescale,s[0].duration)].concat(t).concat(d.mvex(s)))},d.mvex=function(s){for(var e=s.length,t=[];e--;)t[e]=d.trex(s[e]);return d.box.apply(null,[d.types.mvex].concat(t))},d.mvhd=function(s,e){e*=s;var t=Math.floor(e/(Vr+1)),i=Math.floor(e%(Vr+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,s>>24&255,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,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 d.box(d.types.mvhd,r)},d.sdtp=function(s){var e,t,i=s.samples||[],r=new Uint8Array(4+i.length);for(e=0;e<i.length;e++)t=i[e].flags,r[e+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return d.box(d.types.sdtp,r)},d.stbl=function(s){return d.box(d.types.stbl,d.stsd(s),d.box(d.types.stts,d.STTS),d.box(d.types.stsc,d.STSC),d.box(d.types.stsz,d.STSZ),d.box(d.types.stco,d.STCO))},d.avc1=function(s){var e,t,i,r=[],l=[];for(e=0;e<s.sps.length;e++)i=(t=s.sps[e]).byteLength,r.push(i>>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(t));for(e=0;e<s.pps.length;e++)i=(t=s.pps[e]).byteLength,l.push(i>>>8&255),l.push(255&i),l=l.concat(Array.prototype.slice.call(t));var u=d.box(d.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|s.sps.length].concat(r).concat([s.pps.length]).concat(l))),c=s.width,f=s.height,h=s.pixelRatio[0],p=s.pixelRatio[1];return d.box(d.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,c>>8&255,255&c,f>>8&255,255&f,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]),u,d.box(d.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),d.box(d.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,255&h,p>>24,p>>16&255,p>>8&255,255&p])))},d.esds=function(s){var e=s.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(s.config).concat([6,1,2]))},d.mp4a=function(s){var e=s.samplerate;return d.box(d.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,s.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]),d.box(d.types.esds,d.esds(s)))},d.mp3=function(s){var e=s.samplerate;return d.box(d.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,s.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]))},d.stsd=function(s){return s.type==="audio"?s.segmentCodec==="mp3"&&s.codec==="mp3"?d.box(d.types.stsd,d.STSD,d.mp3(s)):d.box(d.types.stsd,d.STSD,d.mp4a(s)):d.box(d.types.stsd,d.STSD,d.avc1(s))},d.tkhd=function(s){var e=s.id,t=s.duration*s.timescale,i=s.width,r=s.height,l=Math.floor(t/(Vr+1)),u=Math.floor(t%(Vr+1));return d.box(d.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,l>>24,l>>16&255,l>>8&255,255&l,u>>24,u>>16&255,u>>8&255,255&u,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,i>>8&255,255&i,0,0,r>>8&255,255&r,0,0]))},d.traf=function(s,e){var t=d.sdtp(s),i=s.id,r=Math.floor(e/(Vr+1)),l=Math.floor(e%(Vr+1));return d.box(d.types.traf,d.box(d.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),d.box(d.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,l>>24,l>>16&255,l>>8&255,255&l])),d.trun(s,t.length+16+20+8+16+8+8),t)},d.trak=function(s){return s.duration=s.duration||4294967295,d.box(d.types.trak,d.tkhd(s),d.mdia(s))},d.trex=function(s){var e=s.id;return d.box(d.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},d.trun=function(s,e){var t,i,r,l,u,c,f=s.samples||[],h=f.length,p=12+16*h,E=new Uint8Array(p);for(e+=8+p,E.set([s.type==="video"?1:0,0,15,1,h>>>24&255,h>>>16&255,h>>>8&255,255&h,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),t=0;t<h;t++)r=(i=f[t]).duration,l=i.size,u=i.flags,c=i.cts,E.set([r>>>24&255,r>>>16&255,r>>>8&255,255&r,l>>>24&255,l>>>16&255,l>>>8&255,255&l,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,61440&u.degradPrio,15&u.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*t);return d.box(d.types.trun,E)},d.initSegment=function(s){d.types||d.init();var e=d.moov(s),t=new Uint8Array(d.FTYP.byteLength+e.byteLength);return t.set(d.FTYP),t.set(e,d.FTYP.byteLength),t},d}();function Hd(d,s,e,t){e===void 0&&(e=1),t===void 0&&(t=!1);var i=d*s*e;return t?Math.round(i):i}function is(d,s){return s===void 0&&(s=!1),Hd(d,1e3,1/9e4,s)}Wt.types=void 0,Wt.HDLR_TYPES=void 0,Wt.STTS=void 0,Wt.STSC=void 0,Wt.STCO=void 0,Wt.STSZ=void 0,Wt.VMHD=void 0,Wt.SMHD=void 0,Wt.STSD=void 0,Wt.FTYP=void 0,Wt.DINF=void 0;var Oo=null,Gd=null,Vd=function(){function d(e,t,i,r){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,Oo===null){var l=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Oo=l?parseInt(l[1]):0}if(Gd===null){var u=navigator.userAgent.match(/Safari\/(\d+)/i);Gd=u?parseInt(u[1]):0}}var s=d.prototype;return s.destroy=function(){},s.resetTimeStamp=function(e){H.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},s.resetNextTimestamp=function(){H.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},s.resetInitSegment=function(){H.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},s.getVideoStartPts=function(e){var t=!1,i=e.reduce(function(r,l){var u=l.pts-r;return u<-4294967296?(t=!0,Ci(r,l.pts)):u>0?r:l.pts},e[0].pts);return t&&H.debug("PTS rollover detected"),i},s.remux=function(e,t,i,r,l,u,c,f){var h,p,E,b,A,k,D=l,S=l,I=e.pid>-1,F=t.pid>-1,N=t.samples.length,V=e.samples.length>0,Y=c&&N>0||N>1;if((!I||V)&&(!F||Y)||this.ISGenerated||c){this.ISGenerated||(E=this.generateIS(e,t,l,u));var j,J=this.isVideoContiguous,Q=-1;if(Y&&(Q=function(Fe){for(var ye=0;ye<Fe.length;ye++)if(Fe[ye].key)return ye;return-1}(t.samples),!J&&this.config.forceKeyFrameOnDiscontinuity))if(k=!0,Q>0){H.warn("[mp4-remuxer]: Dropped "+Q+" out of "+N+" video samples due to a missing keyframe");var X=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(Q),t.dropped+=Q,j=S+=(t.samples[0].pts-X)/t.inputTimeScale}else Q===-1&&(H.warn("[mp4-remuxer]: No keyframe found out of "+N+" video samples"),k=!1);if(this.ISGenerated){if(V&&Y){var ue=this.getVideoStartPts(t.samples),ne=(Ci(e.samples[0].pts,ue)-ue)/t.inputTimeScale;D+=Math.max(0,ne),S+=Math.max(0,-ne)}if(V){if(e.samplerate||(H.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),E=this.generateIS(e,t,l,u)),p=this.remuxAudio(e,D,this.isAudioContiguous,u,F||Y||f===Li?S:void 0),Y){var be=p?p.endPTS-p.startPTS:0;t.inputTimeScale||(H.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),E=this.generateIS(e,t,l,u)),h=this.remuxVideo(t,S,J,be)}}else Y&&(h=this.remuxVideo(t,S,J,0));h&&(h.firstKeyFrame=Q,h.independent=Q!==-1,h.firstKeyFramePTS=j)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(A=Th(i,l,this._initPTS,this._initDTS)),r.samples.length&&(b=Ah(r,l,this._initPTS))),{audio:p,video:h,initSegment:E,independent:k,text:b,id3:A}},s.generateIS=function(e,t,i,r){var l,u,c,f=e.samples,h=t.samples,p=this.typeSupported,E={},b=this._initPTS,A=!b||r,k="audio/mp4";if(A&&(l=u=1/0),e.config&&f.length&&(e.timescale=e.samplerate,e.segmentCodec==="mp3"&&(p.mpeg?(k="audio/mpeg",e.codec=""):p.mp3&&(e.codec="mp3")),E.audio={id:"audio",container:k,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&p.mpeg?new Uint8Array(0):Wt.initSegment([e]),metadata:{channelCount:e.channelCount}},A&&(c=e.inputTimeScale,b&&c===b.timescale?A=!1:l=u=f[0].pts-Math.round(c*i))),t.sps&&t.pps&&h.length&&(t.timescale=t.inputTimeScale,E.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Wt.initSegment([t]),metadata:{width:t.width,height:t.height}},A))if(c=t.inputTimeScale,b&&c===b.timescale)A=!1;else{var D=this.getVideoStartPts(h),S=Math.round(c*i);u=Math.min(u,Ci(h[0].dts,D)-S),l=Math.min(l,D-S)}if(Object.keys(E).length)return this.ISGenerated=!0,A?(this._initPTS={baseTime:l,timescale:c},this._initDTS={baseTime:u,timescale:c}):l=c=void 0,{tracks:E,initPTS:l,timescale:c}},s.remuxVideo=function(e,t,i,r){var l,u,c=e.inputTimeScale,f=e.samples,h=[],p=f.length,E=this._initPTS,b=this.nextAvcDts,A=8,k=this.videoSampleDuration,D=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,I=!1;i&&b!==null||(b=t*c-(f[0].pts-Ci(f[0].dts,f[0].pts)));for(var F=E.baseTime*c/E.timescale,N=0;N<p;N++){var V=f[N];V.pts=Ci(V.pts-F,b),V.dts=Ci(V.dts-F,b),V.dts<f[N>0?N-1:N].dts&&(I=!0)}I&&f.sort(function(Vo,nf){var xg=Vo.dts-nf.dts,Pg=Vo.pts-nf.pts;return xg||Pg}),l=f[0].dts;var Y=(u=f[f.length-1].dts)-l,j=Y?Math.round(Y/(p-1)):k||e.inputTimeScale/30;if(i){var J=l-b,Q=J>j,X=J<-1;if((Q||X)&&(Q?H.warn("AVC: "+is(J,!0)+" ms ("+J+"dts) hole between fragments detected, filling it"):H.warn("AVC: "+is(-J,!0)+" ms ("+J+"dts) overlapping between fragments detected"),!X||b>f[0].pts)){l=b;var ue=f[0].pts-J;f[0].dts=l,f[0].pts=ue,H.log("Video: First PTS/DTS adjusted: "+is(ue,!0)+"/"+is(l,!0)+", delta: "+is(J,!0)+" ms")}}l=Math.max(0,l);for(var ne=0,be=0,Fe=0;Fe<p;Fe++){for(var ye=f[Fe],Ce=ye.units,Pe=Ce.length,Me=0,Ge=0;Ge<Pe;Ge++)Me+=Ce[Ge].data.length;be+=Me,ne+=Pe,ye.length=Me,ye.dts=Math.max(ye.dts,l),D=Math.min(ye.pts,D),S=Math.max(ye.pts,S)}u=f[p-1].dts;var Ke,Xe=be+4*ne+8;try{Ke=new Uint8Array(Xe)}catch(Vo){return void this.observer.emit(w.ERROR,w.ERROR,{type:oe.MUX_ERROR,details:W.REMUX_ALLOC_ERROR,fatal:!1,error:Vo,bytes:Xe,reason:"fail allocating video mdat "+Xe})}var lt=new DataView(Ke.buffer);lt.setUint32(0,Xe),Ke.set(Wt.types.mdat,4);for(var ui=!1,Ot=Number.POSITIVE_INFINITY,Wi=Number.POSITIVE_INFINITY,xi=Number.NEGATIVE_INFINITY,Pi=Number.NEGATIVE_INFINITY,Nt=0;Nt<p;Nt++){for(var qt=f[Nt],nr=qt.units,Kr=0,bi=0,rs=nr.length;bi<rs;bi++){var as=nr[bi],Go=as.data,an=as.data.byteLength;lt.setUint32(A,an),A+=4,Ke.set(Go,A),A+=an,Kr+=4+an}var va=void 0;if(Nt<p-1)k=f[Nt+1].dts-qt.dts,va=f[Nt+1].pts-qt.pts;else{var ns=this.config,Tr=Nt>0?qt.dts-f[Nt-1].dts:j;if(va=Nt>0?qt.pts-f[Nt-1].pts:j,ns.stretchShortVideoTrack&&this.nextAudioPts!==null){var Ig=Math.floor(ns.maxBufferHole*c),du=(r?D+r*c:this.nextAudioPts)-qt.pts;du>Ig?((k=du-Tr)<0?k=Tr:ui=!0,H.log("[mp4-remuxer]: It is approximately "+du/90+" ms to the next segment; using duration "+k/90+" ms for the last video frame.")):k=Tr}else k=Tr}var Rg=Math.round(qt.pts-qt.dts);Ot=Math.min(Ot,k),xi=Math.max(xi,k),Wi=Math.min(Wi,va),Pi=Math.max(Pi,va),h.push(new Sh(qt.key,k,Kr,Rg))}if(h.length){if(Oo){if(Oo<70){var tf=h[0].flags;tf.dependsOn=2,tf.isNonSync=0}}else if(Gd&&Pi-Wi<xi-Ot&&j/xi<.025&&h[0].cts===0){H.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var uu=l,qi=0,rf=h.length;qi<rf;qi++){var af=uu+h[qi].duration,Dg=uu+h[qi].cts;if(qi<rf-1){var Cg=af+h[qi+1].cts;h[qi].duration=Cg-Dg}else h[qi].duration=qi?h[qi-1].duration:j;h[qi].cts=0,uu=af}}}k=ui||!k?j:k,this.nextAvcDts=b=u+k,this.videoSampleDuration=k,this.isVideoContiguous=!0;var Mg={data1:Wt.moof(e.sequenceNumber++,l,U({},e,{samples:h})),data2:Ke,startPTS:D/c,endPTS:(S+k)/c,startDTS:l/c,endDTS:b/c,type:"video",hasAudio:!1,hasVideo:!0,nb:h.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Mg},s.remuxAudio=function(e,t,i,r,l){var u=e.inputTimeScale,c=u/(e.samplerate?e.samplerate:u),f=e.segmentCodec==="aac"?1024:1152,h=f*c,p=this._initPTS,E=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,b=[],A=l!==void 0,k=e.samples,D=E?0:8,S=this.nextAudioPts||-1,I=t*u,F=p.baseTime*u/p.timescale;if(this.isAudioContiguous=i=i||k.length&&S>0&&(r&&Math.abs(I-S)<9e3||Math.abs(Ci(k[0].pts-F,I)-S)<20*h),k.forEach(function(bi){bi.pts=Ci(bi.pts-F,I)}),!i||S<0){if(k=k.filter(function(bi){return bi.pts>=0}),!k.length)return;S=l===0?0:r&&!A?Math.max(0,I):k[0].pts}if(e.segmentCodec==="aac")for(var N=this.config.maxAudioFramesDrift,V=0,Y=S;V<k.length;V++){var j=k[V],J=j.pts,Q=J-Y,X=Math.abs(1e3*Q/u);if(Q<=-N*h&&A)V===0&&(H.warn("Audio frame @ "+(J/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Q/u)+" ms."),this.nextAudioPts=S=Y=J);else if(Q>=N*h&&X<1e4&&A){var ue=Math.round(Q/h);(Y=J-ue*h)<0&&(ue--,Y+=h),V===0&&(this.nextAudioPts=S=Y),H.warn("[mp4-remuxer]: Injecting "+ue+" audio frame @ "+(Y/u).toFixed(3)+"s due to "+Math.round(1e3*Q/u)+" ms gap.");for(var ne=0;ne<ue;ne++){var be=Math.max(Y,0),Fe=_h.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);Fe||(H.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Fe=j.unit.subarray()),k.splice(V,0,{unit:Fe,pts:be}),Y+=h,V++}}j.pts=Y,Y+=h}for(var ye,Ce=null,Pe=null,Me=0,Ge=k.length;Ge--;)Me+=k[Ge].unit.byteLength;for(var Ke=0,Xe=k.length;Ke<Xe;Ke++){var lt=k[Ke],ui=lt.unit,Ot=lt.pts;if(Pe!==null)b[Ke-1].duration=Math.round((Ot-Pe)/c);else{if(i&&e.segmentCodec==="aac"&&(Ot=S),Ce=Ot,!(Me>0))return;Me+=D;try{ye=new Uint8Array(Me)}catch(bi){return void this.observer.emit(w.ERROR,w.ERROR,{type:oe.MUX_ERROR,details:W.REMUX_ALLOC_ERROR,fatal:!1,error:bi,bytes:Me,reason:"fail allocating audio mdat "+Me})}E||(new DataView(ye.buffer).setUint32(0,Me),ye.set(Wt.types.mdat,4))}ye.set(ui,D);var Wi=ui.byteLength;D+=Wi,b.push(new Sh(!0,f,Wi,0)),Pe=Ot}var xi=b.length;if(xi){var Pi=b[b.length-1];this.nextAudioPts=S=Pe+c*Pi.duration;var Nt=E?new Uint8Array(0):Wt.moof(e.sequenceNumber++,Ce/c,U({},e,{samples:b}));e.samples=[];var qt=Ce/u,nr=S/u,Kr={data1:Nt,data2:ye,startPTS:qt,endPTS:nr,startDTS:qt,endDTS:nr,type:"audio",hasAudio:!0,hasVideo:!1,nb:xi};return this.isAudioContiguous=!0,Kr}},s.remuxEmptyAudio=function(e,t,i,r){var l=e.inputTimeScale,u=l/(e.samplerate?e.samplerate:l),c=this.nextAudioPts,f=this._initDTS,h=9e4*f.baseTime/f.timescale,p=(c!==null?c:r.startDTS*l)+h,E=r.endDTS*l+h,b=1024*u,A=Math.ceil((E-p)/b),k=_h.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(H.warn("[mp4-remuxer]: remux empty Audio"),k){for(var D=[],S=0;S<A;S++){var I=p+S*b;D.push({unit:k,pts:I,dts:I})}return e.samples=D,this.remuxAudio(e,t,i,!1)}H.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},d}();function Ci(d,s){var e;if(s===null)return d;for(e=s<d?-8589934592:8589934592;Math.abs(d-s)>4294967296;)d+=e;return d}function Th(d,s,e,t){var i=d.samples.length;if(i){for(var r=d.inputTimeScale,l=0;l<i;l++){var u=d.samples[l];u.pts=Ci(u.pts-9e4*e.baseTime/e.timescale,s*r)/r,u.dts=Ci(u.dts-9e4*t.baseTime/t.timescale,s*r)/r}var c=d.samples;return d.samples=[],{samples:c}}}function Ah(d,s,e){var t=d.samples.length;if(t){for(var i=d.inputTimeScale,r=0;r<t;r++){var l=d.samples[r];l.pts=Ci(l.pts-9e4*e.baseTime/e.timescale,s*i)/i}d.samples.sort(function(c,f){return c.pts-f.pts});var u=d.samples;return d.samples=[],{samples:u}}}var br,Sh=function(d,s,e,t){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=s,this.size=e,this.cts=t,this.flags=new Nv(d)},Nv=function(d){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=d?2:1,this.isNonSync=d?0:1},Fv=function(){function d(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}var s=d.prototype;return s.destroy=function(){},s.resetTimeStamp=function(e){this.initPTS=e,this.lastEndTime=null},s.resetNextTimestamp=function(){this.lastEndTime=null},s.resetInitSegment=function(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(l,u){if(!l||!u)return l;var c=u.keyId;return c&&u.isCommonEncryption&&je(l,["moov","trak"]).forEach(function(f){var h=je(f,["mdia","minf","stbl","stsd"])[0].subarray(8),p=je(h,["enca"]),E=p.length>0;E||(p=je(h,["encv"])),p.forEach(function(b){je(E?b.subarray(28):b.subarray(78),["sinf"]).forEach(function(A){var k=Gn(A);if(k){var D=k.subarray(8,24);D.some(function(S){return S!==0})||(H.log("[eme] Patching keyId in 'enc"+(E?"a":"v")+">sinf>>tenc' box: "+yi(D)+" -> "+yi(c)),k.set(c,8))}})})}),l}(e,r)),this.emitInitSegment=!0},s.generateInitSegment=function(e){var t=this.audioCodec,i=this.videoCodec;if(e==null||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var r=this.initData=Hn(e);t||(t=kh(r.audio,Ne)),i||(i=kh(r.video,ct));var l={};r.audio&&r.video?l.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?l.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?l.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:H.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=l},s.remux=function(e,t,i,r,l,u){var c,f,h=this.initPTS,p=this.lastEndTime,E={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};le(p)||(p=this.lastEndTime=l||0);var b=t.samples;if(b==null||!b.length)return E;var A={initPTS:void 0,timescale:1},k=this.initData;if((c=k)!=null&&c.length||(this.generateInitSegment(b),k=this.initData),(f=k)==null||!f.length)return H.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(A.tracks=this.initTracks,this.emitInitSegment=!1);var D=function(Q,X){return je(X,["moof","traf"]).reduce(function(ue,ne){var be=je(ne,["tfdt"])[0],Fe=be[0],ye=je(ne,["tfhd"]).reduce(function(Ce,Pe){var Me=Be(Pe,4),Ge=Q[Me];if(Ge){var Ke=Be(be,4);if(Fe===1){if(Ke===Fa)return H.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),Ce;Ke*=Fa+1,Ke+=Be(be,8)}var Xe=Ke/(Ge.timescale||9e4);if(isFinite(Xe)&&(Ce===null||Xe<Ce))return Xe}return Ce},null);return ye!==null&&isFinite(ye)&&(ue===null||ye<ue)?ye:ue},null)}(k,b),S=D===null?l:D;(function(Q,X,ue){if(Q===null)return!0;var ne=X-Q.baseTime/Q.timescale;return ne<0&&Math.abs(ne-ue)>1}(h,S,l)||A.timescale!==h.timescale&&u)&&(A.initPTS=S-l,this.initPTS=h={baseTime:A.initPTS,timescale:1});var I=function(Q,X){for(var ue=0,ne=0,be=0,Fe=je(Q,["moof","traf"]),ye=0;ye<Fe.length;ye++){var Ce=Fe[ye],Pe=je(Ce,["tfhd"])[0],Me=X[Be(Pe,4)];if(Me){var Ge=Me.default,Ke=Be(Pe,0)|(Ge==null?void 0:Ge.flags),Xe=Ge==null?void 0:Ge.duration;8&Ke&&(Xe=Be(Pe,2&Ke?12:8));for(var lt=Me.timescale||9e4,ui=je(Ce,["trun"]),Ot=0;Ot<ui.length;Ot++)!(ue=ho(ui[Ot]))&&Xe&&(ue=Xe*Be(ui[Ot],4)),Me.type===ct?ne+=ue/lt:Me.type===Ne&&(be+=ue/lt)}}if(ne===0&&be===0){for(var Wi=0,xi=je(Q,["sidx"]),Pi=0;Pi<xi.length;Pi++){var Nt=Sd(xi[Pi]);Nt!=null&&Nt.references&&(Wi+=Nt.references.reduce(function(qt,nr){return qt+nr.info.duration||0},0))}return Wi}return ne||be}(b,k),F=e?S-h.baseTime/h.timescale:p,N=F+I;(function(Q,X,ue){je(X,["moof","traf"]).forEach(function(ne){je(ne,["tfhd"]).forEach(function(be){var Fe=Be(be,4),ye=Q[Fe];if(ye){var Ce=ye.timescale||9e4;je(ne,["tfdt"]).forEach(function(Pe){var Me=Pe[0],Ge=Be(Pe,4);if(Me===0)Ge-=ue*Ce,Bn(Pe,4,Ge=Math.max(Ge,0));else{Ge*=Math.pow(2,32),Ge+=Be(Pe,8),Ge-=ue*Ce,Ge=Math.max(Ge,0);var Ke=Math.floor(Ge/(Fa+1)),Xe=Math.floor(Ge%(Fa+1));Bn(Pe,4,Ke),Bn(Pe,8,Xe)}})}})})})(k,b,h.baseTime/h.timescale),I>0?this.lastEndTime=N:(H.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var V=!!k.audio,Y=!!k.video,j="";V&&(j+="audio"),Y&&(j+="video");var J={data1:b,startPTS:F,startDTS:F,endPTS:N,endDTS:N,type:j,hasAudio:V,hasVideo:Y,nb:1,dropped:0};return E.audio=J.type==="audio"?J:void 0,E.video=J.type!=="audio"?J:void 0,E.initSegment=A,E.id3=Th(i,l,h,h),r.samples.length&&(E.text=Ah(r,l,h)),E},d}();function kh(d,s){var e=d==null?void 0:d.codec;return e&&e.length>4?e:e==="hvc1"||e==="hev1"?"hvc1.1.c.L120.90":e==="av01"?"av01.0.04M.08":e==="avc1"||s===ct?"avc1.42e01e":"mp4a.40.5"}try{br=self.performance.now.bind(self.performance)}catch{H.debug("Unable to use Performance API on this environment"),br=typeof self!="undefined"&&self.Date.now}var Kd=[{demux:kv,remux:Fv},{demux:Mv,remux:Vd},{demux:Av,remux:Vd},{demux:Ov,remux:Vd}],Wd=function(){function d(e,t,i,r,l){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=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=l}var s=d.prototype;return s.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},s.push=function(e,t,i,r){var l=this,u=i.transmuxing;u.executeStart=br();var c=new Uint8Array(e),f=this.currentTransmuxState,h=this.transmuxConfig;r&&(this.currentTransmuxState=r);var p=r||f,E=p.contiguous,b=p.discontinuity,A=p.trackSwitch,k=p.accurateTimeOffset,D=p.timeOffset,S=p.initSegmentChange,I=h.audioCodec,F=h.videoCodec,N=h.defaultInitPts,V=h.duration,Y=h.initSegmentData,j=function(Fe,ye){var Ce=null;return Fe.byteLength>0&&ye!=null&&ye.key!=null&&ye.iv!==null&&ye.method!=null&&(Ce=ye),Ce}(c,t);if(j&&j.method==="AES-128"){var J=this.getDecrypter();if(!J.isSync())return this.decryptionPromise=J.webCryptoDecrypt(c,j.key.buffer,j.iv.buffer).then(function(Fe){var ye=l.push(Fe,null,i);return l.decryptionPromise=null,ye}),this.decryptionPromise;var Q=J.softwareDecrypt(c,j.key.buffer,j.iv.buffer);if(i.part>-1&&(Q=J.flush()),!Q)return u.executeEnd=br(),qd(i);c=new Uint8Array(Q)}var X=this.needsProbing(b,A);if(X){var ue=this.configureTransmuxer(c);if(ue)return H.warn("[transmuxer] "+ue.message),this.observer.emit(w.ERROR,w.ERROR,{type:oe.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:ue,reason:ue.message}),u.executeEnd=br(),qd(i)}(b||A||S||X)&&this.resetInitSegment(Y,I,F,V,t),(b||S||X)&&this.resetInitialTimestamp(N),E||this.resetContiguity();var ne=this.transmux(c,j,D,k,i),be=this.currentTransmuxState;return be.contiguous=!0,be.discontinuity=!1,be.trackSwitch=!1,u.executeEnd=br(),ne},s.flush=function(e){var t=this,i=e.transmuxing;i.executeStart=br();var r=this.decrypter,l=this.currentTransmuxState,u=this.decryptionPromise;if(u)return u.then(function(){return t.flush(e)});var c=[],f=l.timeOffset;if(r){var h=r.flush();h&&c.push(this.push(h,null,e))}var p=this.demuxer,E=this.remuxer;if(!p||!E)return i.executeEnd=br(),[qd(e)];var b=p.flush(f);return fa(b)?b.then(function(A){return t.flushRemux(c,A,e),c}):(this.flushRemux(c,b,e),c)},s.flushRemux=function(e,t,i){var r=t.audioTrack,l=t.videoTrack,u=t.id3Track,c=t.textTrack,f=this.currentTransmuxState,h=f.accurateTimeOffset,p=f.timeOffset;H.log("[transmuxer.ts]: Flushed fragment "+i.sn+(i.part>-1?" p: "+i.part:"")+" of level "+i.level);var E=this.remuxer.remux(r,l,u,c,p,h,!0,this.id);e.push({remuxResult:E,chunkMeta:i}),i.transmuxing.executeEnd=br()},s.resetInitialTimestamp=function(e){var t=this.demuxer,i=this.remuxer;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))},s.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},s.resetInitSegment=function(e,t,i,r,l){var u=this.demuxer,c=this.remuxer;u&&c&&(u.resetInitSegment(e,t,i,r),c.resetInitSegment(e,t,i,l))},s.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},s.transmux=function(e,t,i,r,l){return t&&t.method==="SAMPLE-AES"?this.transmuxSampleAes(e,t,i,r,l):this.transmuxUnencrypted(e,i,r,l)},s.transmuxUnencrypted=function(e,t,i,r){var l=this.demuxer.demux(e,t,!1,!this.config.progressive),u=l.audioTrack,c=l.videoTrack,f=l.id3Track,h=l.textTrack;return{remuxResult:this.remuxer.remux(u,c,f,h,t,i,!1,this.id),chunkMeta:r}},s.transmuxSampleAes=function(e,t,i,r,l){var u=this;return this.demuxer.demuxSampleAes(e,t,i).then(function(c){return{remuxResult:u.remuxer.remux(c.audioTrack,c.videoTrack,c.id3Track,c.textTrack,i,r,!1,u.id),chunkMeta:l}})},s.configureTransmuxer=function(e){for(var t,i=this.config,r=this.observer,l=this.typeSupported,u=this.vendor,c=0,f=Kd.length;c<f;c++)if(Kd[c].demux.probe(e)){t=Kd[c];break}if(!t)return new Error("Failed to find demuxer by probing fragment data");var h=this.demuxer,p=this.remuxer,E=t.remux,b=t.demux;p&&p instanceof E||(this.remuxer=new E(r,i,l,u)),h&&h instanceof b||(this.demuxer=new b(r,i,l),this.probe=b.probe)},s.needsProbing=function(e,t){return!this.demuxer||!this.remuxer||e||t},s.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new wt(this.config)),e},d}(),qd=function(d){return{remuxResult:{},chunkMeta:d}};function fa(d){return"then"in d&&d.then instanceof Function}var Uv=function(d,s,e,t,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=d,this.videoCodec=s,this.initSegmentData=e,this.duration=t,this.defaultInitPts=i||null},Bv=function(d,s,e,t,i,r){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=d,this.contiguous=s,this.accurateTimeOffset=e,this.trackSwitch=t,this.timeOffset=i,this.initSegmentChange=r},Yd={};(function(d){var s=Object.prototype.hasOwnProperty,e="~";function t(){}function i(c,f,h){this.fn=c,this.context=f,this.once=h||!1}function r(c,f,h,p,E){if(typeof h!="function")throw new TypeError("The listener must be a function");var b=new i(h,p||c,E),A=e?e+f:f;return c._events[A]?c._events[A].fn?c._events[A]=[c._events[A],b]:c._events[A].push(b):(c._events[A]=b,c._eventsCount++),c}function l(c,f){--c._eventsCount==0?c._events=new t:delete c._events[f]}function u(){this._events=new t,this._eventsCount=0}Object.create&&(t.prototype=Object.create(null),new t().__proto__||(e=!1)),u.prototype.eventNames=function(){var c,f,h=[];if(this._eventsCount===0)return h;for(f in c=this._events)s.call(c,f)&&h.push(e?f.slice(1):f);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},u.prototype.listeners=function(c){var f=e?e+c:c,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,E=h.length,b=new Array(E);p<E;p++)b[p]=h[p].fn;return b},u.prototype.listenerCount=function(c){var f=e?e+c:c,h=this._events[f];return h?h.fn?1:h.length:0},u.prototype.emit=function(c,f,h,p,E,b){var A=e?e+c:c;if(!this._events[A])return!1;var k,D,S=this._events[A],I=arguments.length;if(S.fn){switch(S.once&&this.removeListener(c,S.fn,void 0,!0),I){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,f),!0;case 3:return S.fn.call(S.context,f,h),!0;case 4:return S.fn.call(S.context,f,h,p),!0;case 5:return S.fn.call(S.context,f,h,p,E),!0;case 6:return S.fn.call(S.context,f,h,p,E,b),!0}for(D=1,k=new Array(I-1);D<I;D++)k[D-1]=arguments[D];S.fn.apply(S.context,k)}else{var F,N=S.length;for(D=0;D<N;D++)switch(S[D].once&&this.removeListener(c,S[D].fn,void 0,!0),I){case 1:S[D].fn.call(S[D].context);break;case 2:S[D].fn.call(S[D].context,f);break;case 3:S[D].fn.call(S[D].context,f,h);break;case 4:S[D].fn.call(S[D].context,f,h,p);break;default:if(!k)for(F=1,k=new Array(I-1);F<I;F++)k[F-1]=arguments[F];S[D].fn.apply(S[D].context,k)}}return!0},u.prototype.on=function(c,f,h){return r(this,c,f,h,!1)},u.prototype.once=function(c,f,h){return r(this,c,f,h,!0)},u.prototype.removeListener=function(c,f,h,p){var E=e?e+c:c;if(!this._events[E])return this;if(!f)return l(this,E),this;var b=this._events[E];if(b.fn)b.fn!==f||p&&!b.once||h&&b.context!==h||l(this,E);else{for(var A=0,k=[],D=b.length;A<D;A++)(b[A].fn!==f||p&&!b[A].once||h&&b[A].context!==h)&&k.push(b[A]);k.length?this._events[E]=k.length===1?k[0]:k:l(this,E)}return this},u.prototype.removeAllListeners=function(c){var f;return c?(f=e?e+c:c,this._events[f]&&l(this,f)):(this._events=new t,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=e,u.EventEmitter=u,d.exports=u})({get exports(){return Yd},set exports(d){Yd=d}});var No=Yd;function $d(d,s){if(!((e=s.remuxResult).audio||e.video||e.text||e.id3||e.initSegment))return!1;var e,t=[],i=s.remuxResult,r=i.audio,l=i.video;return r&&wh(t,r),l&&wh(t,l),d.postMessage({event:"transmuxComplete",data:s},t),!0}function wh(d,s){s.data1&&d.push(s.data1.buffer),s.data2&&d.push(s.data2.buffer)}function Lh(d,s,e){s.reduce(function(t,i){return $d(d,i)||t},!1)||d.postMessage({event:"transmuxComplete",data:s[0]}),d.postMessage({event:"flush",data:e})}a!==void 0&&a&&function(d){var s=new No,e=function(i,r){d.postMessage({event:i,data:r})};s.on(w.FRAG_DECRYPTED,e),s.on(w.ERROR,e);var t=function(){var i=function(l){var u=function(c){e("workerLog",{logType:l,message:c})};H[l]=u};for(var r in H)i(r)};d.addEventListener("message",function(i){var r=i.data;switch(r.cmd){case"init":var l=JSON.parse(r.config);d.transmuxer=new Wd(s,r.typeSupported,l,r.vendor,r.id),ot(l.debug,r.id),t(),e("init",null);break;case"configure":d.transmuxer.configure(r.config);break;case"demux":var u=d.transmuxer.push(r.data,r.decryptdata,r.chunkMeta,r.state);fa(u)?(d.transmuxer.async=!0,u.then(function(h){$d(d,h)}).catch(function(h){e(w.ERROR,{type:oe.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,chunkMeta:r.chunkMeta,fatal:!1,error:h,err:h,reason:"transmuxer-worker push error"})})):(d.transmuxer.async=!1,$d(d,u));break;case"flush":var c=r.chunkMeta,f=d.transmuxer.flush(c);fa(f)||d.transmuxer.async?(fa(f)||(f=Promise.resolve(f)),f.then(function(h){Lh(d,h,c)}).catch(function(h){e(w.ERROR,{type:oe.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,chunkMeta:r.chunkMeta,fatal:!1,error:h,err:h,reason:"transmuxer-worker flush error"})})):Lh(d,f,c)}})}(self);var jd=Od()||{isTypeSupported:function(){return!1}},Ih=function(){function d(e,t,i,r){var l=this;this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var u=e.config;this.hls=e,this.id=t,this.useWorker=!!u.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;var c=function(D,S){(S=S||{}).frag=l.frag,S.id=l.id,D===w.ERROR&&(l.error=S.error),l.hls.trigger(D,S)};this.observer=new No,this.observer.on(w.FRAG_DECRYPTED,c),this.observer.on(w.ERROR,c);var f,h,p,E,b={mp4:jd.isTypeSupported("video/mp4"),mpeg:jd.isTypeSupported("audio/mpeg"),mp3:jd.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(!this.useWorker||typeof Worker=="undefined"||(u.workerPath,0))this.transmuxer=new Wd(this.observer,b,u,A,t);else try{u.workerPath?(H.log("loading Web Worker "+u.workerPath+' for "'+t+'"'),this.workerContext=(p=u.workerPath,E=new self.URL(p,self.location.href).href,{worker:new self.Worker(E),scriptURL:E})):(H.log('injecting Web Worker for "'+t+'"'),this.workerContext=(f=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+n.toString()+")(true);"],{type:"text/javascript"}),h=self.URL.createObjectURL(f),{worker:new self.Worker(h),objectURL:h})),this.onwmsg=function(D){return l.onWorkerMessage(D)};var k=this.workerContext.worker;k.addEventListener("message",this.onwmsg),k.onerror=function(D){var S=new Error(D.message+" ("+D.filename+":"+D.lineno+")");u.enableWorker=!1,H.warn('Error in "'+t+'" Web Worker, fallback to inline'),l.hls.trigger(w.ERROR,{type:oe.OTHER_ERROR,details:W.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:S})},k.postMessage({cmd:"init",typeSupported:b,vendor:A,id:t,config:JSON.stringify(u)})}catch(D){H.warn('Error setting up "'+t+'" Web Worker, fallback to inline',D),this.resetWorker(),this.error=null,this.transmuxer=new Wd(this.observer,b,u,A,t)}}var s=d.prototype;return s.resetWorker=function(){if(this.workerContext){var e=this.workerContext,t=e.worker,i=e.objectURL;i&&self.URL.revokeObjectURL(i),t.removeEventListener("message",this.onwmsg),t.onerror=null,t.terminate(),this.workerContext=null}},s.destroy=function(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},s.push=function(e,t,i,r,l,u,c,f,h,p){var E,b,A=this;h.transmuxing.start=self.performance.now();var k=this.transmuxer,D=u?u.start:l.start,S=l.decryptdata,I=this.frag,F=!(I&&l.cc===I.cc),N=!(I&&h.level===I.level),V=I?h.sn-I.sn:-1,Y=this.part?h.part-this.part.index:-1,j=V===0&&h.id>1&&h.id===(I==null?void 0:I.stats.chunkCount),J=!N&&(V===1||V===0&&(Y===1||j&&Y<=0)),Q=self.performance.now();(N||V||l.stats.parsing.start===0)&&(l.stats.parsing.start=Q),!u||!Y&&J||(u.stats.parsing.start=Q);var X=!(I&&((E=l.initSegment)==null?void 0:E.url)===((b=I.initSegment)==null?void 0:b.url)),ue=new Bv(F,J,f,N,D,X);if(!J||F||X){H.log("[transmuxer-interface, "+l.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
21
|
-
discontinuity: `+
|
|
22
|
-
trackSwitch: `+
|
|
23
|
-
contiguous: `+
|
|
12
|
+
`):"")+"".concat(de.err?"error message: ".concat((Lt=de.err)===null||Lt===void 0?void 0:Lt.message,`
|
|
13
|
+
`):"");be("error",{player_error_code:ce,player_error_message:he,player_error_context:It})}};K.on(Z.Events.ERROR,ni);var Be=function(Ze,de){var ce=de.frag,he=ce&&ce._url||"";be("requestcanceled",{request_event_type:Ze,request_url:he,request_type:"media",request_hostname:st(he)})};K.on(Z.Events.FRAG_LOAD_EMERGENCY_ABORTED,Be);var yt=function(Ze,de){var ce=de.level,he=K.levels[ce];if(he&&he.attrs&&he.attrs.BANDWIDTH){var Ne,Ve=he.attrs.BANDWIDTH,ft=parseFloat(he.attrs["FRAME-RATE"]);isNaN(ft)||(Ne=ft),Ve?be("renditionchange",{video_source_fps:Ne,video_source_bitrate:Ve,video_source_width:he.width,video_source_height:he.height,video_source_rendition_name:he.name,video_source_codec:he==null?void 0:he.videoCodec}):Oe.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};K.on(Z.Events.LEVEL_SWITCHED,yt),K._stopMuxMonitor=function(){K.off(Z.Events.MANIFEST_LOADED,Re),K.off(Z.Events.LEVEL_LOADED,Ge),K.off(Z.Events.AUDIO_TRACK_LOADED,kt),K.off(Z.Events.FRAG_LOADED,Pt),K.off(Z.Events.FRAG_CHANGED,Wt),K.off(Z.Events.ERROR,ni),K.off(Z.Events.FRAG_LOAD_EMERGENCY_ABORTED,Be),K.off(Z.Events.LEVEL_SWITCHED,yt),K.off(Z.Events.DESTROYING,K._stopMuxMonitor),delete K._stopMuxMonitor},K.on(Z.Events.DESTROYING,K._stopMuxMonitor)}else Oe.warn("performance timing not supported. Not tracking HLS.js.")}(this.mux,this.id,x.hlsjs,{},x.Hls||window.Hls)):this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){var x;this.hlsjs&&((x=this.hlsjs)&&typeof x._stopMuxMonitor=="function"&&x._stopMuxMonitor(),this.hlsjs=void 0)}},{key:"addDashJS",value:function(x){x.dashjs?this.dashjs?this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):(this.dashjs=x.dashjs,function(G,Y,K){var Z=G.log;if(K&&K.on){var Oe=function(Be,yt){return G.emit(Y,Be,yt)},ye=function(Be){var yt=Be.type,Ze=(Be.data||{}).url;Oe("requestcompleted",{request_event_type:yt,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:st(Ze),request_url:Ze})};K.on("manifestLoaded",ye);var Se={},be=function(Be){var yt=Be.type,Ze=Be.fragmentModel,de=(Be.chunk||{}).mediaInfo||{},ce=de.type,he=de.bitrateList,Ne={};(he=he||[]).forEach(function(Rt,Le){Ne[Le]={},Ne[Le].width=Rt.width,Ne[Le].height=Rt.height,Ne[Le].bitrate=Rt.bandwidth,Ne[Le].attrs={}}),ce==="video"?Se.video=Ne:ce==="audio"?Se.audio=Ne:Se.media=Ne;var Ve=xt(Ze,K),ft=Ve.requestStart,Zt=Ve.requestResponseStart,wt=Ve.requestResponseEnd,qt=Ve.requestResponseHeaders,Lt=Ve.requestMediaDuration,It=Ve.requestHostname,Di=Ve.requestUrl,_a=Ve.requestId;Oe("requestcompleted",{request_event_type:yt,request_start:ft,request_response_start:Zt,request_response_end:wt,request_bytes_loaded:-1,request_type:ce+"_init",request_response_headers:qt,request_hostname:It,request_id:_a,request_url:Di,request_media_duration:Lt,request_rendition_lists:Se})};K.on("initFragmentLoaded",be);var Re=function(Be){var yt=Be.type,Ze=Be.fragmentModel,de=Be.chunk||{},ce=de.mediaInfo,he=de.start,Ne=(ce||{}).type,Ve=xt(Ze,K),ft=Ve.requestStart,Zt=Ve.requestResponseStart,wt=Ve.requestResponseEnd,qt=Ve.requestBytesLoaded,Lt=Ve.requestResponseHeaders,It=Ve.requestMediaDuration,Di=Ve.requestHostname,_a=Ve.requestUrl,Rt=Ve.requestId,Le=ht(Ne,K),gr=Le.currentLevel,Hr=Le.renditionWidth,Gr=Le.renditionHeight,Ta=Le.renditionBitrate;Oe("requestcompleted",{request_event_type:yt,request_start:ft,request_response_start:Zt,request_response_end:wt,request_bytes_loaded:qt,request_type:Ne,request_response_headers:Lt,request_hostname:Di,request_id:Rt,request_url:_a,request_media_start_time:he,request_media_duration:It,request_current_level:gr,request_labeled_bitrate:Ta,request_video_width:Hr,request_video_height:Gr})};K.on("mediaFragmentLoaded",Re);var Ge={video:void 0,audio:void 0,totalBitrate:void 0},kt=function(){if(Ge.video&&typeof Ge.video.bitrate=="number"){if(Ge.video.width&&Ge.video.height){var Be=Ge.video.bitrate;return Ge.audio&&typeof Ge.audio.bitrate=="number"&&(Be+=Ge.audio.bitrate),Be!==Ge.totalBitrate?(Ge.totalBitrate=Be,{video_source_bitrate:Be,video_source_height:Ge.video.height,video_source_width:Ge.video.width,video_source_codec:Tt(Ge.video.codec)}):void 0}Z.warn("have bitrate info for video but missing width/height")}},Pt=function(Be,yt,Ze){if(typeof Be.newQuality=="number"){var de=Be.mediaType;if(de==="audio"||de==="video"){var ce=K.getBitrateInfoListFor(de).find(function(Ne){return Ne.qualityIndex===Be.newQuality});if(ce&&typeof ce.bitrate=="number"){Ge[de]=Qt(Qt({},ce),{},{codec:K.getCurrentTrackFor(de).codec});var he=kt();he&&Oe("renditionchange",he)}else Z.warn("missing bitrate info for ".concat(de))}}else Z.warn("missing evt.newQuality in qualityChangeRendered event",Be)};K.on("qualityChangeRendered",Pt);var Wt=function(Be){var yt=Be.request,Ze=Be.mediaType;Oe("requestcanceled",{request_event_type:(yt=yt||{}).type+"_"+yt.action,request_url:yt.url,request_type:Ze,request_hostname:st(yt.url)})};K.on("fragmentLoadingAbandoned",Wt);var ni=function(Be){var yt,Ze,de=Be.error,ce=(de==null||(yt=de.data)===null||yt===void 0?void 0:yt.request)||{},he=(de==null||(Ze=de.data)===null||Ze===void 0?void 0:Ze.response)||{};(de==null?void 0:de.code)===27&&Oe("requestfailed",{request_error:ce.type+"_"+ce.action,request_url:ce.url,request_hostname:st(ce.url),request_type:ce.mediaType,request_error_code:he.status,request_error_text:he.statusText});var Ne="".concat(ce!=null&&ce.url?"url: ".concat(ce.url,`
|
|
14
|
+
`):"")+"".concat(he!=null&&he.status||he!=null&&he.statusText?"response: ".concat(he==null?void 0:he.status,", ").concat(he==null?void 0:he.statusText,`
|
|
15
|
+
`):"");Oe("error",{player_error_code:de==null?void 0:de.code,player_error_message:de==null?void 0:de.message,player_error_context:Ne})};K.on("error",ni),K._stopMuxMonitor=function(){K.off("manifestLoaded",ye),K.off("initFragmentLoaded",be),K.off("mediaFragmentLoaded",Re),K.off("qualityChangeRendered",Pt),K.off("error",ni),K.off("fragmentLoadingAbandoned",Wt),delete K._stopMuxMonitor}}else Z.warn("Invalid dash.js player reference. Monitoring blocked.")}(this.mux,this.id,x.dashjs)):this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){var x;this.dashjs&&((x=this.dashjs)&&typeof x._stopMuxMonitor=="function"&&x._stopMuxMonitor(),this.dashjs=void 0)}}],_&&_i(g.prototype,_),R&&_i(g,R),Object.defineProperty(g,"prototype",{writable:!1}),O}(rt),Zn=Br,ma=M(153),pa=M.n(ma);function pr(T){return pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},pr(T)}function Qa(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],Y=!0,K=!1;try{for(C=C.call(_);!(Y=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);Y=!0);}catch(Z){K=!0,x=Z}finally{try{Y||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return va(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?va(_,R):void 0}}(T,g)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
16
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function va(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}var Ji,Fd=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],Ud={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};F()&&F().WeakMap&&(Ji=new WeakMap);var Jn="#EXT-X-TARGETDURATION",es="#EXT-X-PART-INF",Bd="#EXT-X-SERVER-CONTROL",Hd="#EXTINF",Do="#EXT-X-PROGRAM-DATE-TIME",ga="#EXT-X-VERSION",ts="#EXT-X-SESSION-DATA",ya=function(T){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(T),this.manifest};ya.prototype.process=function(T){var g;for(this.buffer+=T,g=this.buffer.indexOf(`
|
|
17
|
+
`);g>-1;g=this.buffer.indexOf(`
|
|
18
|
+
`))this.processLine(this.buffer.substring(0,g)),this.buffer=this.buffer.substring(g+1)},ya.prototype.processLine=function(T){var g=T.indexOf(":"),_=xo(T,g),R=_[0],C=_.length===2?Ea(_[1]):void 0;if(R[0]!=="#")this.currentUri.uri=R,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(R){case Jn:if(!isFinite(C)||C<0)return;this.manifest.targetDuration=C,this.setHoldBack();break;case es:is(this.manifest,_),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case Bd:is(this.manifest,_),this.setHoldBack();break;case Hd:C===0?this.currentUri.duration=.01:C>0&&(this.currentUri.duration=C);break;case Do:var O=C,x=new Date(O);this.manifest.dateTimeString||(this.manifest.dateTimeString=O,this.manifest.dateTimeObject=x),this.currentUri.dateTimeString=O,this.currentUri.dateTimeObject=x;break;case ga:is(this.manifest,_);break;case ts:var G=as(_[1]),Y=tt(G);Object.assign(this.manifest.sessionData,Y)}},ya.prototype.setHoldBack=function(){var T=this.manifest,g=T.serverControl,_=T.targetDuration,R=T.partTargetDuration;if(g){var C="holdBack",O="partHoldBack",x=_&&3*_,G=R&&2*R;_&&!g.hasOwnProperty(C)&&(g[C]=x),x&&g[C]<x&&(g[C]=x),R&&!g.hasOwnProperty(O)&&(g[O]=3*R),R&&g[O]<G&&(g[O]=G)}};var is=function(T,g){var _,R=rs(g[0].replace("#EXT-X-",""));Xa(g[1])?(_={},_=Object.assign(Mo(g[1]),_)):_=Ea(g[1]),T[R]=_},rs=function(T){return T.toLowerCase().replace(/-(\w)/g,function(g){return g[1].toUpperCase()})},Ea=function(T){if(T.toLowerCase()==="yes"||T.toLowerCase()==="no")return T.toLowerCase()==="yes";var g=T.indexOf(":")!==-1?T:parseFloat(T);return isNaN(g)?T:g},Co=function(T){var g={},_=T.split("=");return _.length>1&&(g[rs(_[0])]=Ea(_[1])),g},Mo=function(T){for(var g=T.split(","),_={},R=0;g.length>R;R++){var C=g[R],O=Co(C);_=Object.assign(O,_)}return _},Xa=function(T){return T.indexOf("=")>-1},xo=function(T,g){return g===-1?[T]:[T.substring(0,g),T.substring(g+1)]},as=function(T){var g={};if(T){var _=T.search(",");return[T.slice(0,_),T.slice(_+1)].forEach(function(R,C){for(var O=R.replace(/['"]+/g,"").split("="),x=0;x<O.length;x++)O[x]==="DATA-ID"&&(g["DATA-ID"]=O[1-x]),O[x]==="VALUE"&&(g.VALUE=O[1-x])}),{data:g}}},Po=ya,Za={safeCall:function(T,g,_,R){var C=R;if(T&&typeof T[g]=="function")try{C=T[g].apply(T,_)}catch(O){we.info("safeCall error",O)}return C},safeIncrement:w,getComputedStyle:function(T,g){var _;if(T&&g&&F()&&typeof F().getComputedStyle=="function")return Ji&&Ji.has(T)&&(_=Ji.get(T)),_||(_=F().getComputedStyle(T,null),Ji&&Ji.set(T,_)),_.getPropertyValue(g)},secondsToMs:function(T){return Math.floor(1e3*T)},assign:Object.assign,headersStringToObject:Ie,cdnHeadersToRequestId:$e,extractHostnameAndDomain:dt,extractHostname:st,manifestParser:Po,generateShortID:re,generateUUID:Q,now:Ue.now},Oo={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 ba(T,g){return function(_){if(Array.isArray(_))return _}(T)||function(_,R){var C=_==null?null:typeof Symbol!="undefined"&&_[Symbol.iterator]||_["@@iterator"];if(C!=null){var O,x,G=[],Y=!0,K=!1;try{for(C=C.call(_);!(Y=(O=C.next()).done)&&(G.push(O.value),!R||G.length!==R);Y=!0);}catch(Z){K=!0,x=Z}finally{try{Y||C.return==null||C.return()}finally{if(K)throw x}}return G}}(T,g)||function(_,R){if(_){if(typeof _=="string")return Ja(_,R);var C=Object.prototype.toString.call(_).slice(8,-1);return C==="Object"&&_.constructor&&(C=_.constructor.name),C==="Map"||C==="Set"?Array.from(_):C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?Ja(_,R):void 0}}(T,g)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
19
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ja(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}var fi={},vr=function T(g){var _=arguments;typeof g=="string"?T.hasOwnProperty(g)?F().setTimeout(function(){_=Array.prototype.splice.call(_,1),T[g].apply(null,_)},0):we.warn("`"+g+"` is an unknown task"):typeof g=="function"?F().setTimeout(function(){g(T)},0):we.warn("`"+g+"` is invalid.")},Gd={loaded:Ue.now(),NAME:"mux-embed",VERSION:"4.24.0",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(T,g){return function(_,R,C){var O=Qa(se(R),3),x=O[0],G=O[1],Y=O[2],K=_.log,Z=_.utils.getComputedStyle,Oe=_.utils.secondsToMs;if(!x)return K.error("No element was found with the `"+G+"` query selector.");if(Y!=="video"&&Y!=="audio")return K.error("The element of `"+G+"` was not a media element.");x.mux&&(x.mux.destroy(),delete x.mux,K.warn("Already monitoring this video element, replacing existing event listeners")),(C=Object.assign({automaticErrorTracking:!0},C)).data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:_.VERSION},C.data),C.getPlayheadTime=function(){return Oe(x.currentTime)},C.getStateData=function(){var Se,be,Re=this.hlsjs&&this.hlsjs.url,Ge=this.dashjs&&pr(this.dashjs.getSource==="function")&&this.dashjs.getSource(),kt={player_is_paused:x.paused,player_playhead_time:Oe(x.currentTime),player_width:parseInt(Z(x,"width")),player_height:parseInt(Z(x,"height")),player_autoplay_on:x.autoplay,player_preload_on:x.preload,player_language_code:x.lang,player_is_fullscreen:pa()&&!!(pa().fullscreenElement||pa().webkitFullscreenElement||pa().mozFullScreenElement||pa().msFullscreenElement),video_poster_url:x.poster,video_source_url:Re||Ge||x.currentSrc,video_source_duration:Oe(x.duration),video_source_height:x.videoHeight,video_source_width:x.videoWidth,view_dropped_frame_count:(Se=x)===null||Se===void 0||(be=Se.getVideoPlaybackQuality)===null||be===void 0?void 0:be.call(Se).droppedVideoFrames},Pt=C.getPlayheadTime();if(x.getStartDate&&Pt>0){var Wt=x.getStartDate();if(Wt&&typeof Wt.getTime=="function"&&Wt.getTime()){var ni=Wt.getTime();if(kt.player_program_time=ni+Pt,x.seekable.length>0){var Be=ni+x.seekable.end(x.seekable.length-1);kt.player_live_edge_program_time=Be}}}return kt},x.mux=x.mux||{},x.mux.deleted=!1,x.mux.emit=function(Se,be){_.emit(G,Se,be)};var ye=function(){K.error("The monitor for this video element has already been destroyed.")};x.mux.destroy=function(){Object.keys(x.mux.listeners).forEach(function(Se){x.removeEventListener(Se,x.mux.listeners[Se],!1)}),delete x.mux.listeners,x.mux.destroy=ye,x.mux.swapElement=ye,x.mux.emit=ye,x.mux.addHLSJS=ye,x.mux.addDashJS=ye,x.mux.removeHLSJS=ye,x.mux.removeDashJS=ye,x.mux.deleted=!0,_.emit(G,"destroy")},x.mux.swapElement=function(Se){var be=Qa(se(Se),3),Re=be[0],Ge=be[1],kt=be[2];return Re?kt!=="video"&&kt!=="audio"?_.log.error("The element of `"+Ge+"` was not a media element."):(Re.muxId=x.muxId,delete x.muxId,Re.mux=Re.mux||{},Re.mux.listeners=Object.assign({},x.mux.listeners),delete x.mux.listeners,Object.keys(Re.mux.listeners).forEach(function(Pt){x.removeEventListener(Pt,Re.mux.listeners[Pt],!1),Re.addEventListener(Pt,Re.mux.listeners[Pt],!1)}),Re.mux.swapElement=x.mux.swapElement,Re.mux.destroy=x.mux.destroy,delete x.mux,void(x=Re)):_.log.error("No element was found with the `"+Ge+"` query selector.")},x.mux.addHLSJS=function(Se){_.addHLSJS(G,Se)},x.mux.addDashJS=function(Se){_.addDashJS(G,Se)},x.mux.removeHLSJS=function(){_.removeHLSJS(G)},x.mux.removeDashJS=function(){_.removeDashJS(G)},_.init(G,C),_.emit(G,"playerready"),x.paused||(_.emit(G,"play"),x.readyState>2&&_.emit(G,"playing")),x.mux.listeners={},Fd.forEach(function(Se){(Se!=="error"||C.automaticErrorTracking)&&(x.mux.listeners[Se]=function(){var be={};if(Se==="error"){if(!x.error||x.error.code===1)return;be.player_error_code=x.error.code,be.player_error_message=Ud[x.error.code]||x.error.message}_.emit(G,Se,be)},x.addEventListener(Se,x.mux.listeners[Se],!1))})}(vr,T,g)},destroyMonitor:function(T){var g=ba(se(T),1)[0];g&&g.mux&&typeof g.mux.destroy=="function"?g.mux.destroy():we.error("A video element monitor for `"+T+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(T,g){var _=te(T);fi[_]?fi[_].addHLSJS(g):we.error("A monitor for `"+_+"` has not been initialized.")},addDashJS:function(T,g){var _=te(T);fi[_]?fi[_].addDashJS(g):we.error("A monitor for `"+_+"` has not been initialized.")},removeHLSJS:function(T){var g=te(T);fi[g]?fi[g].removeHLSJS():we.error("A monitor for `"+g+"` has not been initialized.")},removeDashJS:function(T){var g=te(T);fi[g]?fi[g].removeDashJS():we.error("A monitor for `"+g+"` has not been initialized.")},init:function(T,g){nt()&&g&&g.respectDoNotTrack&&we.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var _=te(T);fi[_]=new Zn(vr,_,g)},emit:function(T,g,_){var R=te(T);fi[R]?(fi[R].emit(g,_),g==="destroy"&&delete fi[R]):we.error("A monitor for `"+R+"` has not been initialized.")},checkDoNotTrack:nt,log:we,utils:Za,events:Oo,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(vr,Gd),F()!==void 0&&typeof F().addEventListener=="function"&&F().addEventListener("pagehide",function(T){T.persisted||(vr.WINDOW_UNLOADING=!0)},!1);var ns=vr},655:function(E,I,M){var B,F;function Q(re){return Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(te){return typeof te}:function(te){return te&&typeof Symbol=="function"&&te.constructor===Symbol&&te!==Symbol.prototype?"symbol":typeof te},Q(re);}(function(re){var te=!1;if((F=typeof(B=re)=="function"?B.call(I,M,I,E):B)===void 0||(E.exports=F),te=!0,Q(I)==="object"&&(E.exports=re(),te=!0),!te){var se=window.Cookies,pe=window.Cookies=re();pe.noConflict=function(){return window.Cookies=se,pe}}})(function(){var re=function(){for(var te=0,se={};te<arguments.length;te++){var pe=arguments[te];for(var Ae in pe)se[Ae]=pe[Ae]}return se};return function te(se){function pe(Ae,ke,we){var nt;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(we=re({path:"/"},pe.defaults,we)).expires=="number"){var Ue=new Date;Ue.setMilliseconds(Ue.getMilliseconds()+864e5*we.expires),we.expires=Ue}try{nt=JSON.stringify(ke),/^[\{\[]/.test(nt)&&(ke=nt)}catch{}return ke=se.write?se.write(ke,Ae):encodeURIComponent(String(ke)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),Ae=(Ae=(Ae=encodeURIComponent(String(Ae))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[Ae,"=",ke,we.expires?"; expires="+we.expires.toUTCString():"",we.path?"; path="+we.path:"",we.domain?"; domain="+we.domain:"",we.secure?"; secure":""].join("")}Ae||(nt={});for(var st=document.cookie?document.cookie.split("; "):[],dt=/(%[0-9A-Z]{2})+/g,oe=0;oe<st.length;oe++){var w=st[oe].split("="),le=w.slice(1).join("=");le.charAt(0)==='"'&&(le=le.slice(1,-1));try{var $=w[0].replace(dt,decodeURIComponent);if(le=se.read?se.read(le,$):se(le,$)||le.replace(dt,decodeURIComponent),this.json)try{le=JSON.parse(le)}catch{}if(Ae===$){nt=le;break}Ae||(nt[$]=le)}catch{}}return nt}}return pe.set=pe,pe.get=function(Ae){return pe.call(pe,Ae)},pe.getJSON=function(){return pe.apply({json:!0},[].slice.call(arguments))},pe.defaults={},pe.remove=function(Ae,ke){pe(Ae,"",re(ke,{expires:-1}))},pe.withConverter=te,pe}(function(){})})},153:function(E,I,M){var B,F=M.g!==void 0?M.g:typeof window!="undefined"?window:{},Q=M(558);typeof document!="undefined"?B=document:(B=F["__GLOBAL_DOCUMENT_CACHE@4"])||(B=F["__GLOBAL_DOCUMENT_CACHE@4"]=Q),E.exports=B},48:function(E,I,M){var B;B=typeof window!="undefined"?window:M.g!==void 0?M.g:typeof self!="undefined"?self:{},E.exports=B},640:function(E,I,M){var B,F;(function(Q,re){"use strict";B=function(){var te=function(){},se="undefined",pe=typeof window!==se&&typeof window.navigator!==se&&/Trident\/|MSIE /.test(window.navigator.userAgent),Ae=["trace","debug","info","warn","error"];function ke(Ie,$e){var tt=Ie[$e];if(typeof tt.bind=="function")return tt.bind(Ie);try{return Function.prototype.bind.call(tt,Ie)}catch{return function(){return Function.prototype.apply.apply(tt,[Ie,arguments])}}}function we(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function nt(Ie){return Ie==="debug"&&(Ie="log"),typeof console!==se&&(Ie==="trace"&&pe?we:console[Ie]!==void 0?ke(console,Ie):console.log!==void 0?ke(console,"log"):te)}function Ue(Ie,$e){for(var tt=0;tt<Ae.length;tt++){var Bt=Ae[tt];this[Bt]=tt<Ie?te:this.methodFactory(Bt,Ie,$e)}this.log=this.debug}function st(Ie,$e,tt){return function(){typeof console!==se&&(Ue.call(this,$e,tt),this[Ie].apply(this,arguments))}}function dt(Ie,$e,tt){return nt(Ie)||st.apply(this,arguments)}function oe(Ie,$e,tt){var Bt,Je=this;$e=$e==null?"WARN":$e;var H="loglevel";function ri(Ke){var xt=(Ae[Ke]||"silent").toUpperCase();if(typeof window!==se&&H){try{return void(window.localStorage[H]=xt)}catch{}try{window.document.cookie=encodeURIComponent(H)+"="+xt+";"}catch{}}}function Ht(){var Ke;if(typeof window!==se&&H){try{Ke=window.localStorage[H]}catch{}if(typeof Ke===se)try{var xt=window.document.cookie,ht=xt.indexOf(encodeURIComponent(H)+"=");ht!==-1&&(Ke=/^([^;]+)/.exec(xt.slice(ht))[1])}catch{}return Je.levels[Ke]===void 0&&(Ke=void 0),Ke}}function it(){if(typeof window!==se&&H){try{return void window.localStorage.removeItem(H)}catch{}try{window.document.cookie=encodeURIComponent(H)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof Ie=="string"?H+=":"+Ie:typeof Ie=="symbol"&&(H=void 0),Je.name=Ie,Je.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},Je.methodFactory=tt||dt,Je.getLevel=function(){return Bt},Je.setLevel=function(Ke,xt){if(typeof Ke=="string"&&Je.levels[Ke.toUpperCase()]!==void 0&&(Ke=Je.levels[Ke.toUpperCase()]),!(typeof Ke=="number"&&Ke>=0&&Ke<=Je.levels.SILENT))throw"log.setLevel() called with invalid level: "+Ke;if(Bt=Ke,xt!==!1&&ri(Ke),Ue.call(Je,Ke,Ie),typeof console===se&&Ke<Je.levels.SILENT)return"No console available for logging"},Je.setDefaultLevel=function(Ke){$e=Ke,Ht()||Je.setLevel(Ke,!1)},Je.resetLevel=function(){Je.setLevel($e,!1),it()},Je.enableAll=function(Ke){Je.setLevel(Je.levels.TRACE,Ke)},Je.disableAll=function(Ke){Je.setLevel(Je.levels.SILENT,Ke)};var Qt=Ht();Qt==null&&(Qt=$e),Je.setLevel(Qt,!1)}var w=new oe,le={};w.getLogger=function(Ie){if(typeof Ie!="symbol"&&typeof Ie!="string"||Ie==="")throw new TypeError("You must supply a name when creating a logger.");var $e=le[Ie];return $e||($e=le[Ie]=new oe(Ie,w.getLevel(),w.methodFactory)),$e};var $=typeof window!==se?window.log:void 0;return w.noConflict=function(){return typeof window!==se&&window.log===w&&(window.log=$),w},w.getLoggers=function(){return le},w.default=w,w},(F=typeof B=="function"?B.call(I,M,I,E):B)===void 0||(E.exports=F)})()},375:function(E,I){"use strict";var M=Object.prototype.hasOwnProperty;function B(Q){try{return decodeURIComponent(Q.replace(/\+/g," "))}catch{return null}}function F(Q){try{return encodeURIComponent(Q)}catch{return null}}I.stringify=function(Q,re){re=re||"";var te,se,pe=[];for(se in typeof re!="string"&&(re="?"),Q)if(M.call(Q,se)){if((te=Q[se])||te!=null&&!isNaN(te)||(te=""),se=F(se),te=F(te),se===null||te===null)continue;pe.push(se+"="+te)}return pe.length?re+pe.join("&"):""},I.parse=function(Q){for(var re,te=/([^=?#&]+)=?([^&]*)/g,se={};re=te.exec(Q);){var pe=B(re[1]),Ae=B(re[2]);pe===null||Ae===null||pe in se||(se[pe]=Ae)}return se}},558:function(){}},m={};function v(E){var I=m[E];if(I!==void 0)return I.exports;var M=m[E]={exports:{}};return l[E].call(M.exports,M,M.exports,v),M.exports}return v.n=function(E){var I=E&&E.__esModule?function(){return E.default}:function(){return E};return v.d(I,{a:I}),I},v.d=function(E,I){for(var M in I)v.o(I,M)&&!v.o(E,M)&&Object.defineProperty(E,M,{enumerable:!0,get:I[M]})},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(E,I){return Object.prototype.hasOwnProperty.call(E,I)},v(80)}()},typeof jl=="object"&&typeof xc=="object"?xc.exports=a():typeof jl=="object"?jl.mux=a():n.mux=a()})()});var tp=gf((ep,Pc)=>{(function n(a){var l,m;l=this,m=function(){"use strict";function v(d,s){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(d);s&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(d,i).enumerable})),e.push.apply(e,t)}return e}function E(d){for(var s=1;s<arguments.length;s++){var e=arguments[s]!=null?arguments[s]:{};s%2?v(Object(e),!0).forEach(function(t){B(d,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):v(Object(e)).forEach(function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))})}return d}function I(d,s){for(var e=0;e<s.length;e++){var t=s[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,nt(t.key),t)}}function M(d,s,e){return s&&I(d.prototype,s),e&&I(d,e),Object.defineProperty(d,"prototype",{writable:!1}),d}function B(d,s,e){return(s=nt(s))in d?Object.defineProperty(d,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[s]=e,d}function F(){return F=Object.assign?Object.assign.bind():function(d){for(var s=1;s<arguments.length;s++){var e=arguments[s];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},F.apply(this,arguments)}function Q(d,s){d.prototype=Object.create(s.prototype),d.prototype.constructor=d,te(d,s)}function re(d){return re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},re(d)}function te(d,s){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},te(d,s)}function se(){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 pe(d,s,e){return pe=se()?Reflect.construct.bind():function(t,i,r){var o=[null];o.push.apply(o,i);var u=new(Function.bind.apply(t,o));return r&&te(u,r.prototype),u},pe.apply(null,arguments)}function Ae(d){var s=typeof Map=="function"?new Map:void 0;return Ae=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(s!==void 0){if(s.has(e))return s.get(e);s.set(e,i)}function i(){return pe(e,arguments,re(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),te(i,e)},Ae(d)}function ke(d,s){(s==null||s>d.length)&&(s=d.length);for(var e=0,t=new Array(s);e<s;e++)t[e]=d[e];return t}function we(d,s){var e=typeof Symbol!="undefined"&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(i,r){if(i){if(typeof i=="string")return ke(i,r);var o=Object.prototype.toString.call(i).slice(8,-1);return o==="Object"&&i.constructor&&(o=i.constructor.name),o==="Map"||o==="Set"?Array.from(i):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?ke(i,r):void 0}}(d))||s&&d&&typeof d.length=="number"){e&&(d=e);var t=0;return function(){return t>=d.length?{done:!0}:{done:!1,value:d[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
20
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nt(d){var s=function(e,t){if(typeof e!="object"||e===null)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}(d,"string");return typeof s=="symbol"?s:String(s)}function Ue(d){return d&&d.__esModule&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d}var st={exports:{}};(function(d,s){var e,t,i,r,o;e=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,t=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(u,c,f){if(f=f||{},u=u.trim(),!(c=c.trim())){if(!f.alwaysNormalize)return u;var h=o.parseURL(u);if(!h)throw new Error("Error trying to parse base URL.");return h.path=o.normalizePath(h.path),o.buildURLFromParts(h)}var p=o.parseURL(c);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return f.alwaysNormalize?(p.path=o.normalizePath(p.path),o.buildURLFromParts(p)):c;var y=o.parseURL(u);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var b=t.exec(y.path);y.netLoc=b[1],y.path=b[2]}y.netLoc&&!y.path&&(y.path="/");var A={scheme:y.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(A.netLoc=y.netLoc,p.path[0]!=="/"))if(p.path){var k=y.path,D=k.substring(0,k.lastIndexOf("/")+1)+p.path;A.path=o.normalizePath(D)}else A.path=y.path,p.params||(A.params=y.params,p.query||(A.query=y.query));return A.path===null&&(A.path=f.alwaysNormalize?o.normalizePath(p.path):p.path),o.buildURLFromParts(A)},parseURL:function(u){var c=e.exec(u);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(u){for(u=u.split("").reverse().join("").replace(i,"");u.length!==(u=u.replace(r,"")).length;);return u.split("").reverse().join("")},buildURLFromParts:function(u){return u.scheme+u.netLoc+u.path+u.params+u.query+u.fragment}},d.exports=o})(st);var dt=st.exports,oe=Number.isFinite||function(d){return typeof d=="number"&&isFinite(d)},w=function(d){return d.MEDIA_ATTACHING="hlsMediaAttaching",d.MEDIA_ATTACHED="hlsMediaAttached",d.MEDIA_DETACHING="hlsMediaDetaching",d.MEDIA_DETACHED="hlsMediaDetached",d.BUFFER_RESET="hlsBufferReset",d.BUFFER_CODECS="hlsBufferCodecs",d.BUFFER_CREATED="hlsBufferCreated",d.BUFFER_APPENDING="hlsBufferAppending",d.BUFFER_APPENDED="hlsBufferAppended",d.BUFFER_EOS="hlsBufferEos",d.BUFFER_FLUSHING="hlsBufferFlushing",d.BUFFER_FLUSHED="hlsBufferFlushed",d.MANIFEST_LOADING="hlsManifestLoading",d.MANIFEST_LOADED="hlsManifestLoaded",d.MANIFEST_PARSED="hlsManifestParsed",d.LEVEL_SWITCHING="hlsLevelSwitching",d.LEVEL_SWITCHED="hlsLevelSwitched",d.LEVEL_LOADING="hlsLevelLoading",d.LEVEL_LOADED="hlsLevelLoaded",d.LEVEL_UPDATED="hlsLevelUpdated",d.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",d.LEVELS_UPDATED="hlsLevelsUpdated",d.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",d.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",d.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",d.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",d.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",d.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",d.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",d.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",d.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",d.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",d.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",d.CUES_PARSED="hlsCuesParsed",d.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",d.INIT_PTS_FOUND="hlsInitPtsFound",d.FRAG_LOADING="hlsFragLoading",d.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",d.FRAG_LOADED="hlsFragLoaded",d.FRAG_DECRYPTED="hlsFragDecrypted",d.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",d.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",d.FRAG_PARSING_METADATA="hlsFragParsingMetadata",d.FRAG_PARSED="hlsFragParsed",d.FRAG_BUFFERED="hlsFragBuffered",d.FRAG_CHANGED="hlsFragChanged",d.FPS_DROP="hlsFpsDrop",d.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",d.ERROR="hlsError",d.DESTROYING="hlsDestroying",d.KEY_LOADING="hlsKeyLoading",d.KEY_LOADED="hlsKeyLoaded",d.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",d.BACK_BUFFER_REACHED="hlsBackBufferReached",d}({}),le=function(d){return d.NETWORK_ERROR="networkError",d.MEDIA_ERROR="mediaError",d.KEY_SYSTEM_ERROR="keySystemError",d.MUX_ERROR="muxError",d.OTHER_ERROR="otherError",d}({}),$=function(d){return d.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",d.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",d.KEY_SYSTEM_NO_SESSION="keySystemNoSession",d.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",d.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",d.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",d.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",d.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",d.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",d.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",d.MANIFEST_LOAD_ERROR="manifestLoadError",d.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",d.MANIFEST_PARSING_ERROR="manifestParsingError",d.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",d.LEVEL_EMPTY_ERROR="levelEmptyError",d.LEVEL_LOAD_ERROR="levelLoadError",d.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",d.LEVEL_PARSING_ERROR="levelParsingError",d.LEVEL_SWITCH_ERROR="levelSwitchError",d.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",d.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",d.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",d.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",d.FRAG_LOAD_ERROR="fragLoadError",d.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",d.FRAG_DECRYPT_ERROR="fragDecryptError",d.FRAG_PARSING_ERROR="fragParsingError",d.FRAG_GAP="fragGap",d.REMUX_ALLOC_ERROR="remuxAllocError",d.KEY_LOAD_ERROR="keyLoadError",d.KEY_LOAD_TIMEOUT="keyLoadTimeOut",d.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",d.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",d.BUFFER_APPEND_ERROR="bufferAppendError",d.BUFFER_APPENDING_ERROR="bufferAppendingError",d.BUFFER_STALLED_ERROR="bufferStalledError",d.BUFFER_FULL_ERROR="bufferFullError",d.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",d.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",d.INTERNAL_EXCEPTION="internalException",d.INTERNAL_ABORTED="aborted",d.UNKNOWN="unknown",d}({}),Ie=function(){},$e={trace:Ie,debug:Ie,log:Ie,warn:Ie,info:Ie,error:Ie},tt=$e;function Bt(d){var s=self.console[d];return s?s.bind(self.console,"["+d+"] >"):Ie}function Je(d,s){if(self.console&&d===!0||typeof d=="object"){(function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];i.forEach(function(o){tt[o]=e[o]?e[o].bind(e):Bt(o)})})(d,"debug","log","info","warn","error");try{tt.log('Debug logs enabled for "'+s+'" in hls.js version 1.4.1')}catch{tt=$e}}else tt=$e}var H=tt,ri=/^(\d+)x(\d+)$/,Ht=/(.+?)=(".*?"|.*?)(?:,|$)/g,it=function(){function d(e){for(var t in typeof e=="string"&&(e=d.parseAttrList(e)),e)e.hasOwnProperty(t)&&(t.substring(0,2)==="X-"&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])}var s=d.prototype;return s.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},s.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var i=new Uint8Array(t.length/2),r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(2*r,2*r+2),16);return i}return null},s.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},s.decimalFloatingPoint=function(e){return parseFloat(this[e])},s.optionalFloat=function(e,t){var i=this[e];return i?parseFloat(i):t},s.enumeratedString=function(e){return this[e]},s.bool=function(e){return this[e]==="YES"},s.decimalResolution=function(e){var t=ri.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},d.parseAttrList=function(e){var t,i={};for(Ht.lastIndex=0;(t=Ht.exec(e))!==null;){var r=t[2];r.indexOf('"')===0&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[t[1].trim()]=r}return i},d}();function Qt(d){return d==="SCTE35-OUT"||d==="SCTE35-IN"}var Ke=function(){function d(s,e){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,e){var t=e.attr;for(var i in t)if(Object.prototype.hasOwnProperty.call(s,i)&&s[i]!==t[i]){H.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+s.ID+'"'),this._badValueForSameId=i;break}s=F(new it({}),t,s)}if(this.attr=s,this._startDate=new Date(s["START-DATE"]),"END-DATE"in this.attr){var r=new Date(this.attr["END-DATE"]);oe(r.getTime())&&(this._endDate=r)}}return M(d,[{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 s=this.duration;return s!==null?new Date(this._startDate.getTime()+1e3*s):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var s=this.attr.decimalFloatingPoint("DURATION");if(oe(s))return s}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&oe(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),d}(),xt=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}},ht="audio",Tt="video",Qi="audiovideo",J=function(){function d(s){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[ht]=null,e[Tt]=null,e[Qi]=null,e),this.baseurl=s}return d.prototype.setByteRange=function(s,e){var t=s.split("@",2),i=[];t.length===1?i[0]=e?e.byteRangeEndOffset:0:i[0]=parseInt(t[1]),i[1]=parseInt(t[0])+i[0],this._byteRange=i},M(d,[{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=dt.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(s){this._url=s}}]),d}(),Ee=function(d){function s(t,i){var r;return(r=d.call(this,i)||this)._decryptdata=null,r.rawProgramDateTime=null,r.programDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkeys=void 0,r.type=void 0,r.loader=null,r.keyLoader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.stats=new xt,r.urlId=0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.endList=void 0,r.gap=void 0,r.type=t,r}Q(s,d);var e=s.prototype;return e.setKeyFormat=function(t){if(this.levelkeys){var i=this.levelkeys[t];i&&!this._decryptdata&&(this._decryptdata=i.getDecryptData(this.sn))}},e.abortRequests=function(){var t,i;(t=this.loader)==null||t.abort(),(i=this.keyLoader)==null||i.abort()},e.setElementaryStreamInfo=function(t,i,r,o,u,c){c===void 0&&(c=!1);var f=this.elementaryStreams,h=f[t];h?(h.startPTS=Math.min(h.startPTS,i),h.endPTS=Math.max(h.endPTS,r),h.startDTS=Math.min(h.startDTS,o),h.endDTS=Math.max(h.endDTS,u)):f[t]={startPTS:i,endPTS:r,startDTS:o,endDTS:u,partial:c}},e.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[ht]=null,t[Tt]=null,t[Qi]=null},M(s,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{var i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!oe(this.programDateTime))return null;var t=oe(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){var t;if((t=this._decryptdata)!=null&&t.encrypted)return!0;if(this.levelkeys){var i=Object.keys(this.levelkeys),r=i.length;if(r>1||r===1&&this.levelkeys[i[0]].encrypted)return!0}return!1}}]),s}(J),rt=function(d){function s(e,t,i,r,o){var u;(u=d.call(this,i)||this).fragOffset=0,u.duration=0,u.gap=!1,u.independent=!1,u.relurl=void 0,u.fragment=void 0,u.index=void 0,u.stats=new xt,u.duration=e.decimalFloatingPoint("DURATION"),u.gap=e.bool("GAP"),u.independent=e.bool("INDEPENDENT"),u.relurl=e.enumeratedString("URI"),u.fragment=t,u.index=r;var c=e.enumeratedString("BYTERANGE");return c&&u.setByteRange(c,o),o&&(u.fragOffset=o.fragOffset+o.duration),u}return Q(s,d),M(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),s}(J),bt=function(){function d(s){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.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=s}return d.prototype.reloaded=function(s){if(!s)return this.advanced=!0,void(this.updated=!0);var e=this.lastPartSn-s.lastPartSn,t=this.lastPartIndex-s.lastPartIndex;this.updated=this.endSN!==s.endSN||!!t||!!e,this.advanced=this.endSN>s.endSN||e>0||e===0&&t>0,this.updated||this.advanced?this.misses=Math.floor(.6*s.misses):this.misses=s.misses+1,this.availabilityDelay=s.availabilityDelay},M(d,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&oe(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var s=this.driftEndTime-this.driftStartTime;return s>0?1e3*(this.driftEnd-this.driftStart)/s:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var s;return(s=this.fragments)!=null&&s.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 s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var s;return(s=this.partList)!=null&&s.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),d}();function _t(d){return Uint8Array.from(atob(d),function(s){return s.charCodeAt(0)})}function ai(d){var s,e,t=d.split(":"),i=null;if(t[0]==="data"&&t.length===2){var r=t[1].split(";"),o=r[r.length-1].split(",");if(o.length===2){var u=o[0]==="base64",c=o[1];u?(r.splice(-1,1),i=_t(c)):(s=Gi(c).subarray(0,16),(e=new Uint8Array(16)).set(s,16-s.length),i=e)}}return i}function Gi(d){return Uint8Array.from(unescape(encodeURIComponent(d)),function(s){return s.charCodeAt(0)})}var je={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},di="org.w3.clearkey",ui="com.apple.streamingkeydelivery",Vi="com.microsoft.playready",Xi="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function ci(d){switch(d){case ui:return je.FAIRPLAY;case Vi:return je.PLAYREADY;case Xi:return je.WIDEVINE;case di:return je.CLEARKEY}}var ut="edef8ba979d64acea3c827dcd51d21ed";function Zi(d){switch(d){case je.FAIRPLAY:return ui;case je.PLAYREADY:return Vi;case je.WIDEVINE:return Xi;case je.CLEARKEY:return di}}function ur(d){var s=d.drmSystems,e=d.widevineLicenseUrl,t=s?[je.FAIRPLAY,je.WIDEVINE,je.PLAYREADY,je.CLEARKEY].filter(function(i){return!!s[i]}):[];return!t[je.WIDEVINE]&&e&&t.push(je.WIDEVINE),t}var Nr=typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function Li(d,s,e){return Uint8Array.prototype.slice?d.slice(s,e):new Uint8Array(Array.prototype.slice.call(d,s,e))}var cr,Hn=function(d,s){return s+10<=d.length&&d[s]===73&&d[s+1]===68&&d[s+2]===51&&d[s+3]<255&&d[s+4]<255&&d[s+6]<128&&d[s+7]<128&&d[s+8]<128&&d[s+9]<128},so=function(d,s){return s+10<=d.length&&d[s]===51&&d[s+1]===68&&d[s+2]===73&&d[s+3]<255&&d[s+4]<255&&d[s+6]<128&&d[s+7]<128&&d[s+8]<128&&d[s+9]<128},la=function(d,s){for(var e=s,t=0;Hn(d,s);)t+=10,t+=Ya(d,s+6),so(d,s+10)&&(t+=10),s+=t;if(t>0)return d.subarray(e,e+t)},Ya=function(d,s){var e=0;return e=(127&d[s])<<21,e|=(127&d[s+1])<<14,e|=(127&d[s+2])<<7,e|=127&d[s+3]},oo=function(d,s){return Hn(d,s)&&Ya(d,s+6)+10<=d.length-s},lo=function(d){return d&&d.key==="PRIV"&&d.info==="com.apple.streaming.transportStreamTimestamp"},Id=function(d){var s=String.fromCharCode(d[0],d[1],d[2],d[3]),e=Ya(d,4);return{type:s,size:e,data:d.subarray(10,10+e)}},Gn=function(d){for(var s=0,e=[];Hn(d,s);){for(var t=Ya(d,s+6),i=(s+=10)+t;s+8<i;){var r=Id(d.subarray(s)),o=Rd(r);o&&e.push(o),s+=r.size+10}so(d,s)&&(s+=10)}return e},Rd=function(d){return d.type==="PRIV"?Dd(d):d.type[0]==="W"?co(d):uo(d)},Dd=function(d){if(!(d.size<2)){var s=Ei(d.data,!0),e=new Uint8Array(d.data.subarray(s.length+1));return{key:d.type,info:s,data:e.buffer}}},uo=function(d){if(!(d.size<2)){if(d.type==="TXXX"){var s=1,e=Ei(d.data.subarray(s),!0);s+=e.length+1;var t=Ei(d.data.subarray(s));return{key:d.type,info:e,data:t}}var i=Ei(d.data.subarray(1));return{key:d.type,data:i}}},co=function(d){if(d.type==="WXXX"){if(d.size<2)return;var s=1,e=Ei(d.data.subarray(s),!0);s+=e.length+1;var t=Ei(d.data.subarray(s));return{key:d.type,info:e,data:t}}var i=Ei(d.data);return{key:d.type,data:i}},ho=function(d){if(d.data.byteLength===8){var s=new Uint8Array(d.data),e=1&s[3],t=(s[4]<<23)+(s[5]<<15)+(s[6]<<7)+s[7];return t/=45,e&&(t+=4772185884e-2),Math.round(t)}},Ei=function(d,s){s===void 0&&(s=!1);var e=Cd();if(e){var t=e.decode(d);if(s){var i=t.indexOf("\0");return i!==-1?t.substring(0,i):t}return t.replace(/\0/g,"")}for(var r,o,u,c=d.length,f="",h=0;h<c;){if((r=d[h++])===0&&s)return f;if(r!==0&&r!==3)switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:f+=String.fromCharCode(r);break;case 12:case 13:o=d[h++],f+=String.fromCharCode((31&r)<<6|63&o);break;case 14:o=d[h++],u=d[h++],f+=String.fromCharCode((15&r)<<12|(63&o)<<6|(63&u)<<0)}}return f};function Cd(){return cr||self.TextDecoder===void 0||(cr=new self.TextDecoder("utf-8")),cr}var Ii=function(d){for(var s="",e=0;e<d.length;e++){var t=d[e].toString(16);t.length<2&&(t="0"+t),s+=t}return s},da=Math.pow(2,32)-1,Md=[].push,fo={video:1,audio:2,id3:3,text:4};function At(d){return String.fromCharCode.apply(null,d)}function mo(d,s){var e=d[s]<<8|d[s+1];return e<0?65536+e:e}function Fe(d,s){var e=Vn(d,s);return e<0?4294967296+e:e}function Vn(d,s){return d[s]<<24|d[s+1]<<16|d[s+2]<<8|d[s+3]}function Kn(d,s,e){d[s]=e>>24,d[s+1]=e>>16&255,d[s+2]=e>>8&255,d[s+3]=255&e}function ze(d,s){var e=[];if(!s.length)return e;for(var t=d.byteLength,i=0;i<t;){var r=Fe(d,i),o=r>1?i+r:t;if(At(d.subarray(i+4,i+8))===s[0])if(s.length===1)e.push(d.subarray(i+8,o));else{var u=ze(d.subarray(i+8,o),s.slice(1));u.length&&Md.apply(e,u)}i=o}return e}function po(d){var s=[],e=d[0],t=8,i=Fe(d,t);t+=4,t+=e===0?8:16,t+=2;var r=d.length+0,o=mo(d,t);t+=2;for(var u=0;u<o;u++){var c=t,f=Fe(d,c);c+=4;var h=2147483647&f;if((2147483648&f)>>>31==1)return H.warn("SIDX has hierarchical references (not supported)"),null;var p=Fe(d,c);c+=4,s.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/i,start:r,end:r+h-1}}),r+=h,t=c+=4}return{earliestPresentationTime:0,timescale:i,version:e,referencesCount:o,references:s}}function Wn(d){for(var s=[],e=ze(d,["moov","trak"]),t=0;t<e.length;t++){var i=e[t],r=ze(i,["tkhd"])[0];if(r){var o=r[0],u=o===0?12:20,c=Fe(r,u),f=ze(i,["mdia","mdhd"])[0];if(f){var h=Fe(f,u=(o=f[0])===0?12:20),p=ze(i,["mdia","hdlr"])[0];if(p){var y=At(p.subarray(8,12)),b={soun:ht,vide:Tt}[y];if(b){var A=ze(i,["mdia","minf","stbl","stsd"])[0],k=void 0;A&&(k=At(A.subarray(12,16))),s[c]={timescale:h,type:b},s[b]={timescale:h,id:c,codec:k}}}}}}return ze(d,["moov","mvex","trex"]).forEach(function(D){var S=Fe(D,4),L=s[S];L&&(L.default={duration:Fe(D,12),flags:Fe(D,20)})}),s}function qn(d){var s=ze(d,["schm"])[0];if(s){var e=At(s.subarray(4,8));if(e==="cbcs"||e==="cenc")return ze(d,["schi","tenc"])[0]}return H.error("[eme] missing 'schm' box"),null}function xd(d){var s=Fe(d,0),e=8;1&s&&(e+=4),4&s&&(e+=4);for(var t=0,i=Fe(d,4),r=0;r<i;r++)256&s&&(t+=Fe(d,e),e+=4),512&s&&(e+=4),1024&s&&(e+=4),2048&s&&(e+=4);return t}function hr(d,s){var e=new Uint8Array(d.length+s.length);return e.set(d),e.set(s,d.length),e}function Yn(d,s){var e=[],t=s.samples,i=s.timescale,r=s.id,o=!1;return ze(t,["moof"]).map(function(u){var c=u.byteOffset-8;ze(u,["traf"]).map(function(f){var h=ze(f,["tfdt"]).map(function(p){var y=p[0],b=Fe(p,4);return y===1&&(b*=Math.pow(2,32),b+=Fe(p,8)),b/i})[0];return h!==void 0&&(d=h),ze(f,["tfhd"]).map(function(p){var y=Fe(p,4),b=16777215&Fe(p,0),A=0,k=(16&b)!=0,D=0,S=(32&b)!=0,L=8;y===r&&((1&b)!=0&&(L+=8),(2&b)!=0&&(L+=4),(8&b)!=0&&(A=Fe(p,L),L+=4),k&&(D=Fe(p,L),L+=4),S&&(L+=4),s.type==="video"&&(o=function(N){if(!N)return!1;var P=N.indexOf("."),V=P<0?N:N.substring(0,P);return V==="hvc1"||V==="hev1"||V==="dvh1"||V==="dvhe"}(s.codec)),ze(f,["trun"]).map(function(N){var P=N[0],V=16777215&Fe(N,0),q=(1&V)!=0,j=0,ee=(4&V)!=0,z=(256&V)!=0,X=0,ue=(512&V)!=0,ne=0,Te=(1024&V)!=0,Me=(2048&V)!=0,_e=0,De=Fe(N,4),xe=8;q&&(j=Fe(N,xe),xe+=4),ee&&(xe+=4);for(var Ce=j+c,He=0;He<De;He++){if(z?(X=Fe(N,xe),xe+=4):X=A,ue?(ne=Fe(N,xe),xe+=4):ne=D,Te&&(xe+=4),Me&&(_e=P===0?Fe(N,xe):Vn(N,xe),xe+=4),s.type===Tt)for(var We=0;We<ne;){var Qe=Fe(t,Ce);vo(o,t[Ce+=4])&&go(t.subarray(Ce,Ce+Qe),o?2:1,d+_e/i,e),Ce+=Qe,We+=Qe+4}d+=X/i}}))})})}),e}function vo(d,s){if(d){var e=s>>1&63;return e===39||e===40}return(31&s)==6}function go(d,s,e,t){var i=yo(d),r=0;r+=s;for(var o=0,u=0,c=!1,f=0;r<i.length;){o=0;do{if(r>=i.length)break;o+=f=i[r++]}while(f===255);u=0;do{if(r>=i.length)break;u+=f=i[r++]}while(f===255);var h=i.length-r;if(!c&&o===4&&r<i.length){if(c=!0,i[r++]===181){var p=mo(i,r);if(r+=2,p===49){var y=Fe(i,r);if(r+=4,y===1195456820){var b=i[r++];if(b===3){var A=i[r++],k=64&A,D=k?2+3*(31&A):0,S=new Uint8Array(D);if(k){S[0]=A;for(var L=1;L<D;L++)S[L]=i[r++]}t.push({type:b,payloadType:o,pts:e,bytes:S})}}}}}else if(o===5&&u<h){if(c=!0,u>16){for(var N=[],P=0;P<16;P++){var V=i[r++].toString(16);N.push(V.length==1?"0"+V:V),P!==3&&P!==5&&P!==7&&P!==9||N.push("-")}for(var q=u-16,j=new Uint8Array(q),ee=0;ee<q;ee++)j[ee]=i[r++];t.push({payloadType:o,pts:e,uuid:N.join(""),userData:Ei(j),userDataBytes:j})}}else if(u<h)r+=u;else if(u>h)break}}function yo(d){for(var s=d.byteLength,e=[],t=1;t<s-2;)d[t]===0&&d[t+1]===0&&d[t+2]===3?(e.push(t+2),t+=2):t++;if(e.length===0)return d;var i=s-e.length,r=new Uint8Array(i),o=0;for(t=0;t<i;o++,t++)o===e[0]&&(o++,e.shift()),r[t]=d[o];return r}function Eo(d,s,e){if(d.byteLength!==16)throw new RangeError("Invalid system id");var t,i,r;if(s){t=1,i=new Uint8Array(16*s.length);for(var o=0;o<s.length;o++){var u=s[o];if(u.byteLength!==16)throw new RangeError("Invalid key");i.set(u,16*o)}}else t=0,i=new Uint8Array;t>0?(r=new Uint8Array(4),s.length>0&&new DataView(r.buffer).setUint32(0,s.length,!1)):r=new Uint8Array;var c=new Uint8Array(4);return e&&e.byteLength>0&&new DataView(c.buffer).setUint32(0,e.byteLength,!1),function(f){for(var h=arguments.length,p=new Array(h>1?h-1:0),y=1;y<h;y++)p[y-1]=arguments[y];for(var b=p.length,A=8,k=b;k--;)A+=p[k].byteLength;var D=new Uint8Array(A);for(D[0]=A>>24&255,D[1]=A>>16&255,D[2]=A>>8&255,D[3]=255&A,D.set(f,4),k=0,A=8;k<b;k++)D.set(p[k],A),A+=p[k].byteLength;return D}([112,115,115,104],new Uint8Array([t,0,0,0]),d,r,i,c,e||new Uint8Array)}var ua={},ca=function(){function d(e,t,i,r,o){r===void 0&&(r=[1]),o===void 0&&(o=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=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=o,this.encrypted=!!e&&e!=="NONE",this.isCommonEncryption=this.encrypted&&e!=="AES-128"}d.clearKeyUriToKeyIdMap=function(){ua={}};var s=d.prototype;return s.isSupported=function(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case ui:case Xi:case Vi:case di:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1},s.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||H.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),e=0);var t=function(D){for(var S=new Uint8Array(16),L=12;L<16;L++)S[L]=D>>8*(15-L)&255;return S}(e);return new d(this.method,this.uri,"identity",this.keyFormatVersions,t)}var i=ai(this.uri);if(i)switch(this.keyFormat){case Xi:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case Vi:var r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Eo(r,null,i);var o=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),u=String.fromCharCode.apply(null,Array.from(o)),c=u.substring(u.indexOf("<"),u.length),f=new DOMParser().parseFromString(c,"text/xml").getElementsByTagName("KID")[0];if(f){var h=f.childNodes[0]?f.childNodes[0].nodeValue:f.getAttribute("VALUE");if(h){var p=_t(h).subarray(0,16);(function(D){var S=function(L,N,P){var V=L[N];L[N]=L[P],L[P]=V};S(D,0,3),S(D,1,2),S(D,4,5),S(D,6,7)})(p),this.keyId=p}}break;default:var y=i.subarray(0,16);if(y.length!==16){var b=new Uint8Array(16);b.set(y,16-y.length),y=b}this.keyId=y}if(!this.keyId||this.keyId.byteLength!==16){var A=ua[this.uri];if(!A){var k=Object.keys(ua).length%Number.MAX_SAFE_INTEGER;A=new Uint8Array(16),new DataView(A.buffer,12,4).setUint32(0,k),ua[this.uri]=A}this.keyId=A}return this},d}(),bo=/\{\$([a-zA-Z0-9-_]+)\}/g;function _o(d){return bo.test(d)}function Xt(d,s,e){if(d.variableList!==null||d.hasVariableRefs)for(var t=e.length;t--;){var i=e[t],r=s[i];r&&(s[i]=bi(d,r))}}function bi(d,s){if(d.variableList!==null||d.hasVariableRefs){var e=d.variableList;return s.replace(bo,function(t){var i=t.substring(2,t.length-1),r=e==null?void 0:e[i];return r===void 0?(d.playlistParsingError||(d.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+i+'"')),t):r})}return s}function To(d,s,e){var t,i,r=d.variableList;if(r||(d.variableList=r={}),"QUERYPARAM"in s){t=s.QUERYPARAM;try{var o=new self.URL(e).searchParams;if(!o.has(t))throw new Error('"'+t+'" does not match any query parameter in URI: "'+e+'"');i=o.get(t)}catch(u){d.playlistParsingError||(d.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+u.message))}}else t=s.NAME,i=s.VALUE;t in r?d.playlistParsingError||(d.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+t+'"')):r[t]=i||""}function Ao(d,s,e){var t=s.IMPORT;if(e&&t in e){var i=d.variableList;i||(d.variableList=i={}),i[t]=e[t]}else d.playlistParsingError||(d.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+t+'"'))}function $a(){if(typeof self!="undefined")return self.MediaSource||self.WebKitMediaSource}var Pd={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}},$n=$a();function ja(d,s){var e;return(e=$n==null?void 0:$n.isTypeSupported((s||"video")+'/mp4;codecs="'+d+'"'))!=null&&e}var fr=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Fr=/#EXT-X-MEDIA:(.*)/g,Od=/^#EXT(?:INF|-X-TARGETDURATION):/m,jn=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),za=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|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("|")),ha=function(){function d(){}return d.findGroup=function(s,e){for(var t=0;t<s.length;t++){var i=s[t];if(i.id===e)return i}},d.convertAVC1ToAVCOTI=function(s){var e=s.split(".");if(e.length>2){var t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4)}return s},d.resolve=function(s,e){return dt.buildAbsoluteURL(e,s,{alwaysNormalize:!0})},d.isMediaPlaylist=function(s){return Od.test(s)},d.parseMasterPlaylist=function(s,e){var t,i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:_o(s)},r=[];for(fr.lastIndex=0;(t=fr.exec(s))!=null;)if(t[1]){var o,u=new it(t[1]);Xt(i,u,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);var c=bi(i,t[2]),f={attrs:u,bitrate:u.decimalInteger("AVERAGE-BANDWIDTH")||u.decimalInteger("BANDWIDTH"),name:u.NAME,url:d.resolve(c,e)},h=u.decimalResolution("RESOLUTION");h&&(f.width=h.width,f.height=h.height),Nd((u.CODECS||"").split(/[ ,]+/).filter(function(N){return N}),f),f.videoCodec&&f.videoCodec.indexOf("avc1")!==-1&&(f.videoCodec=d.convertAVC1ToAVCOTI(f.videoCodec)),(o=f.unknownCodecs)!=null&&o.length||r.push(f),i.levels.push(f)}else if(t[3]){var p=t[3],y=t[4];switch(p){case"SESSION-DATA":var b=new it(y);Xt(i,b,["DATA-ID","LANGUAGE","VALUE","URI"]);var A=b["DATA-ID"];A&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[A]=b);break;case"SESSION-KEY":var k=So(y,e,i);k.encrypted&&k.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(k)):H.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+y+'"');break;case"DEFINE":var D=new it(y);Xt(i,D,["NAME","VALUE","QUERYPARAM"]),To(i,D,e);break;case"CONTENT-STEERING":var S=new it(y);Xt(i,S,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:d.resolve(S["SERVER-URI"],e),pathwayId:S["PATHWAY-ID"]||"."};break;case"START":i.startTimeOffset=ko(y)}}var L=r.length>0&&r.length<i.levels.length;return i.levels=L?r:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i},d.parseMasterPlaylistMedia=function(s,e,t){var i,r={},o=t.levels,u={AUDIO:o.map(function(k){return{id:k.attrs.AUDIO,audioCodec:k.audioCodec}}),SUBTITLES:o.map(function(k){return{id:k.attrs.SUBTITLES,textCodec:k.textCodec}}),"CLOSED-CAPTIONS":[]},c=0;for(Fr.lastIndex=0;(i=Fr.exec(s))!==null;){var f=new it(i[1]),h=f.TYPE;if(h){var p=u[h],y=r[h]||[];r[h]=y,Xt(t,f,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);var b={attrs:f,bitrate:0,id:c++,groupId:f["GROUP-ID"]||"",instreamId:f["INSTREAM-ID"],name:f.NAME||f.LANGUAGE||"",type:h,default:f.bool("DEFAULT"),autoselect:f.bool("AUTOSELECT"),forced:f.bool("FORCED"),lang:f.LANGUAGE,url:f.URI?d.resolve(f.URI,e):""};if(p!=null&&p.length){var A=d.findGroup(p,b.groupId)||p[0];zn(b,A,"audioCodec"),zn(b,A,"textCodec")}y.push(b)}}return r},d.parseLevelPlaylist=function(s,e,t,i,r,o){var u,c,f,h=new bt(e),p=h.fragments,y=null,b=0,A=0,k=0,D=0,S=null,L=new Ee(i,e),N=-1,P=!1;for(jn.lastIndex=0,h.m3u8=s,h.hasVariableRefs=_o(s);(u=jn.exec(s))!==null;){P&&(P=!1,(L=new Ee(i,e)).start=k,L.sn=b,L.cc=D,L.level=t,y&&(L.initSegment=y,L.rawProgramDateTime=y.rawProgramDateTime,y.rawProgramDateTime=null));var V=u[1];if(V){L.duration=parseFloat(V);var q=(" "+u[2]).slice(1);L.title=q||null,L.tagList.push(q?["INF",V,q]:["INF",V])}else if(u[3]){if(oe(L.duration)){L.start=k,f&&Qn(L,f,h),L.sn=b,L.level=t,L.cc=D,L.urlId=r,p.push(L);var j=(" "+u[3]).slice(1);L.relurl=bi(h,j),wo(L,S),S=L,k+=L.duration,b++,A=0,P=!0}}else if(u[4]){var ee=(" "+u[4]).slice(1);S?L.setByteRange(ee,S):L.setByteRange(ee)}else if(u[5])L.rawProgramDateTime=(" "+u[5]).slice(1),L.tagList.push(["PROGRAM-DATE-TIME",L.rawProgramDateTime]),N===-1&&(N=p.length);else{if(!(u=u[0].match(za))){H.warn("No matches on slow regex match for level playlist!");continue}for(c=1;c<u.length&&u[c]===void 0;c++);var z=(" "+u[c]).slice(1),X=(" "+u[c+1]).slice(1),ue=u[c+2]?(" "+u[c+2]).slice(1):"";switch(z){case"PLAYLIST-TYPE":h.type=X.toUpperCase();break;case"MEDIA-SEQUENCE":b=h.startSN=parseInt(X);break;case"SKIP":var ne=new it(X);Xt(h,ne,["RECENTLY-REMOVED-DATERANGES"]);var Te=ne.decimalInteger("SKIPPED-SEGMENTS");if(oe(Te)){h.skippedSegments=Te;for(var Me=Te;Me--;)p.unshift(null);b+=Te}var _e=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");_e&&(h.recentlyRemovedDateranges=_e.split(" "));break;case"TARGETDURATION":h.targetduration=Math.max(parseInt(X),1);break;case"VERSION":h.version=parseInt(X);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"#":(X||ue)&&L.tagList.push(ue?[X,ue]:[X]);break;case"DISCONTINUITY":D++,L.tagList.push(["DIS"]);break;case"GAP":L.gap=!0,L.tagList.push([z]);break;case"BITRATE":L.tagList.push([z,X]);break;case"DATERANGE":var De=new it(X);Xt(h,De,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Xt(h,De,De.clientAttrs);var xe=new Ke(De,h.dateRanges[De.ID]);xe.isValid||h.skippedSegments?h.dateRanges[xe.id]=xe:H.warn('Ignoring invalid DATERANGE tag: "'+X+'"'),L.tagList.push(["EXT-X-DATERANGE",X]);break;case"DEFINE":var Ce=new it(X);Xt(h,Ce,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in Ce?Ao(h,Ce,o):To(h,Ce,e);break;case"DISCONTINUITY-SEQUENCE":D=parseInt(X);break;case"KEY":var He=So(X,e,h);if(He.isSupported()){if(He.method==="NONE"){f=void 0;break}f||(f={}),f[He.keyFormat]&&(f=F({},f)),f[He.keyFormat]=He}else H.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+X+'"');break;case"START":h.startTimeOffset=ko(X);break;case"MAP":var We=new it(X);if(Xt(h,We,["BYTERANGE","URI"]),L.duration){var Qe=new Ee(i,e);Lo(Qe,We,t,f),y=Qe,L.initSegment=y,y.rawProgramDateTime&&!L.rawProgramDateTime&&(L.rawProgramDateTime=y.rawProgramDateTime)}else Lo(L,We,t,f),y=L,P=!0;break;case"SERVER-CONTROL":var ot=new it(X);h.canBlockReload=ot.bool("CAN-BLOCK-RELOAD"),h.canSkipUntil=ot.optionalFloat("CAN-SKIP-UNTIL",0),h.canSkipDateRanges=h.canSkipUntil>0&&ot.bool("CAN-SKIP-DATERANGES"),h.partHoldBack=ot.optionalFloat("PART-HOLD-BACK",0),h.holdBack=ot.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var mi=new it(X);h.partTarget=mi.decimalFloatingPoint("PART-TARGET");break;case"PART":var Ot=h.partList;Ot||(Ot=h.partList=[]);var Wi=A>0?Ot[Ot.length-1]:void 0,xi=A++,Pi=new it(X);Xt(h,Pi,["BYTERANGE","URI"]);var Nt=new rt(Pi,L,e,xi,Wi);Ot.push(Nt),L.duration+=Nt.duration;break;case"PRELOAD-HINT":var $t=new it(X);Xt(h,$t,["URI"]),h.preloadHint=$t;break;case"RENDITION-REPORT":var tr=new it(X);Xt(h,tr,["URI"]),h.renditionReports=h.renditionReports||[],h.renditionReports.push(tr);break;default:H.warn("line parsed but not handled: "+u)}}}S&&!S.relurl?(p.pop(),k-=S.duration,h.partList&&(h.fragmentHint=S)):h.partList&&(wo(L,S),L.cc=D,h.fragmentHint=L,f&&Qn(L,f,h));var Kr=p.length,Ai=p[0],ds=p[Kr-1];if((k+=h.skippedSegments*h.targetduration)>0&&Kr&&ds){h.averagetargetduration=k/Kr;var us=ds.sn;h.endSN=us!=="initSegment"?us:0,h.live||(ds.endList=!0),Ai&&(h.startCC=Ai.cc)}else h.endSN=0,h.startCC=0;return h.fragmentHint&&(k+=h.fragmentHint.duration),h.totalduration=k,h.endCC=D,N>0&&function(Yo,sn){for(var wa=Yo[sn],cs=sn;cs--;){var _r=Yo[cs];if(!_r)return;_r.programDateTime=wa.programDateTime-1e3*_r.duration,wa=_r}}(p,N),h},d}();function So(d,s,e){var t,i,r=new it(d);Xt(e,r,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var o=(t=r.METHOD)!=null?t:"",u=r.URI,c=r.hexadecimalInteger("IV"),f=r.KEYFORMATVERSIONS,h=(i=r.KEYFORMAT)!=null?i:"identity";u&&r.IV&&!c&&H.error("Invalid IV: "+r.IV);var p=u?ha.resolve(u,s):"",y=(f||"1").split("/").map(Number).filter(Number.isFinite);return new ca(o,p,h,y,c)}function ko(d){var s=new it(d).decimalFloatingPoint("TIME-OFFSET");return oe(s)?s:null}function Nd(d,s){["video","audio","text"].forEach(function(e){var t=d.filter(function(r){return function(o,u){var c=Pd[u];return!!c&&c[o.slice(0,4)]===!0}(r,e)});if(t.length){var i=t.filter(function(r){return r.lastIndexOf("avc1",0)===0||r.lastIndexOf("mp4a",0)===0});s[e+"Codec"]=i.length>0?i[0]:t[0],d=d.filter(function(r){return t.indexOf(r)===-1})}}),s.unknownCodecs=d}function zn(d,s,e){var t=s[e];t&&(d[e]=t)}function wo(d,s){d.rawProgramDateTime?d.programDateTime=Date.parse(d.rawProgramDateTime):s!=null&&s.programDateTime&&(d.programDateTime=s.endProgramDateTime),oe(d.programDateTime)||(d.programDateTime=null,d.rawProgramDateTime=null)}function Lo(d,s,e,t){d.relurl=s.URI,s.BYTERANGE&&d.setByteRange(s.BYTERANGE),d.level=e,d.sn="initSegment",t&&(d.levelkeys=t),d.initSegment=null}function Qn(d,s,e){d.levelkeys=s;var t=e.encryptedFragments;t.length&&t[t.length-1].levelkeys===s||!Object.keys(s).some(function(i){return s[i].isCommonEncryption})||t.push(d)}var Ur="manifest",mr="level",hi="audioTrack",Ki="subtitleTrack",et="main",_i="audio",Ri="subtitle";function Io(d){switch(d.type){case hi:return _i;case Ki:return Ri;default:return et}}function Xn(d,s){var e=d.url;return e!==void 0&&e.indexOf("data:")!==0||(e=s.url),e}var St=function(){function d(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}var s=d.prototype;return s.startLoad=function(e){},s.stopLoad=function(){this.destroyInternalLoaders()},s.registerListeners=function(){var e=this.hls;e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.LEVEL_LOADING,this.onLevelLoading,this),e.on(w.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(w.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.LEVEL_LOADING,this.onLevelLoading,this),e.off(w.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(w.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,r=t.loader,o=new(i||r)(t);return this.loaders[e.type]=o,o},s.getInternalLoader=function(e){return this.loaders[e.type]},s.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},s.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},s.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},s.onManifestLoading=function(e,t){var i=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Ur,url:i,deliveryDirectives:null})},s.onLevelLoading=function(e,t){var i=t.id,r=t.level,o=t.url,u=t.deliveryDirectives;this.load({id:i,level:r,responseType:"text",type:mr,url:o,deliveryDirectives:u})},s.onAudioTrackLoading=function(e,t){var i=t.id,r=t.groupId,o=t.url,u=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:hi,url:o,deliveryDirectives:u})},s.onSubtitleTrackLoading=function(e,t){var i=t.id,r=t.groupId,o=t.url,u=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:Ki,url:o,deliveryDirectives:u})},s.load=function(e){var t,i,r,o=this,u=this.hls.config,c=this.getInternalLoader(e);if(c){var f=c.context;if(f&&f.url===e.url)return void H.trace("[playlist-loader]: playlist request ongoing");H.log("[playlist-loader]: aborting previous loader for type: "+e.type),c.abort()}if(i=e.type===Ur?u.manifestLoadPolicy.default:F({},u.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),c=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part&&(e.type===mr&&e.level!==null?r=this.hls.levels[e.level].details:e.type===hi&&e.id!==null?r=this.hls.audioTracks[e.id].details:e.type===Ki&&e.id!==null&&(r=this.hls.subtitleTracks[e.id].details),r)){var h=r.partTarget,p=r.targetduration;if(h&&p){var y=1e3*Math.max(3*h,.8*p);i=F({},i,{maxTimeToFirstByteMs:Math.min(y,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(y,i.maxTimeToFirstByteMs)})}}var b=i.errorRetry||i.timeoutRetry||{},A={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:b.maxNumRetry||0,retryDelay:b.retryDelayMs||0,maxRetryDelay:b.maxRetryDelayMs||0},k={onSuccess:function(D,S,L,N){var P=o.getInternalLoader(L);o.resetInternalLoader(L.type);var V=D.data;V.indexOf("#EXTM3U")===0?(S.parsing.start=performance.now(),ha.isMediaPlaylist(V)?o.handleTrackOrLevelPlaylist(D,S,L,N||null,P):o.handleMasterPlaylist(D,S,L,N)):o.handleManifestParsingError(D,L,new Error("no EXTM3U delimiter"),N||null,S)},onError:function(D,S,L,N){o.handleNetworkError(S,L,!1,D,N)},onTimeout:function(D,S,L){o.handleNetworkError(S,L,!0,void 0,D)}};c.load(e,A,k)},s.handleMasterPlaylist=function(e,t,i,r){var o=this.hls,u=e.data,c=Xn(e,i),f=ha.parseMasterPlaylist(u,c);if(f.playlistParsingError)this.handleManifestParsingError(e,i,f.playlistParsingError,r,t);else{var h=f.contentSteering,p=f.levels,y=f.sessionData,b=f.sessionKeys,A=f.startTimeOffset,k=f.variableList;this.variableList=k;var D=ha.parseMasterPlaylistMedia(u,c,f),S=D.AUDIO,L=S===void 0?[]:S,N=D.SUBTITLES,P=D["CLOSED-CAPTIONS"];L.length&&(L.some(function(V){return!V.url})||!p[0].audioCodec||p[0].attrs.AUDIO||(H.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),L.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new it({}),bitrate:0,url:""}))),o.trigger(w.MANIFEST_LOADED,{levels:p,audioTracks:L,subtitles:N,captions:P,contentSteering:h,url:c,stats:t,networkDetails:r,sessionData:y,sessionKeys:b,startTimeOffset:A,variableList:k})}},s.handleTrackOrLevelPlaylist=function(e,t,i,r,o){var u=this.hls,c=i.id,f=i.level,h=i.type,p=Xn(e,i),y=oe(c)?c:0,b=oe(f)?f:y,A=Io(i),k=ha.parseLevelPlaylist(e.data,p,b,A,y,this.variableList);if(h===Ur){var D={attrs:new it({}),bitrate:0,details:k,name:"",url:p};u.trigger(w.MANIFEST_LOADED,{levels:[D],audioTracks:[],url:p,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=k,this.handlePlaylistLoaded(k,e,t,i,r,o)},s.handleManifestParsingError=function(e,t,i,r,o){this.hls.trigger(w.ERROR,{type:le.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===Ur,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:o})},s.handleNetworkError=function(e,t,i,r,o){i===void 0&&(i=!1);var u="A network "+(i?"timeout":"error"+(r?" (status "+r.code+")":""))+" occurred while loading "+e.type;e.type===mr?u+=": "+e.level+" id: "+e.id:e.type!==hi&&e.type!==Ki||(u+=" id: "+e.id+' group-id: "'+e.groupId+'"');var c=new Error(u);H.warn("[playlist-loader]: "+u);var f=$.UNKNOWN,h=!1,p=this.getInternalLoader(e);switch(e.type){case Ur:f=i?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,h=!0;break;case mr:f=i?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,h=!1;break;case hi:f=i?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case Ki:f=i?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,h=!1}p&&this.resetInternalLoader(e.type);var y={type:le.NETWORK_ERROR,details:f,fatal:h,url:e.url,loader:p,context:e,error:c,networkDetails:t,stats:o};if(r){var b=(t==null?void 0:t.url)||e.url;y.response=E({url:b,data:void 0},r)}this.hls.trigger(w.ERROR,y)},s.handlePlaylistLoaded=function(e,t,i,r,o,u){var c=this.hls,f=r.type,h=r.level,p=r.id,y=r.groupId,b=r.deliveryDirectives,A=Xn(t,r),k=Io(r),D=typeof r.level=="number"&&k===et?h:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var S=e.playlistParsingError;if(S)c.trigger(w.ERROR,{type:le.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:A,error:S,reason:S.message,response:t,context:r,level:D,parent:k,networkDetails:o,stats:i});else switch(e.live&&u&&(u.getCacheAge&&(e.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),f){case Ur:case mr:c.trigger(w.LEVEL_LOADED,{details:e,level:D||0,id:p||0,stats:i,networkDetails:o,deliveryDirectives:b});break;case hi:c.trigger(w.AUDIO_TRACK_LOADED,{details:e,id:p||0,groupId:y||"",stats:i,networkDetails:o,deliveryDirectives:b});break;case Ki:c.trigger(w.SUBTITLE_TRACK_LOADED,{details:e,id:p||0,groupId:y||"",stats:i,networkDetails:o,deliveryDirectives:b})}}else{var L=new Error("No Segments found in Playlist");c.trigger(w.ERROR,{type:le.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:A,error:L,reason:L.message,response:t,context:r,level:D,parent:k,networkDetails:o,stats:i})}},d}();function fa(d,s){var e;try{e=new Event("addtrack")}catch{(e=document.createEvent("Event")).initEvent("addtrack",!1,!1)}e.track=d,s.dispatchEvent(e)}function Ro(d,s){var e=d.mode;if(e==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(s.id))try{if(d.addCue(s),!d.cues.getCueById(s.id))throw new Error("addCue is failed for: "+s)}catch(i){H.debug("[texttrack-utils]: "+i);var t=new self.TextTrackCue(s.startTime,s.endTime,s.text);t.id=s.id,d.addCue(t)}e==="disabled"&&(d.mode=e)}function Br(d){var s=d.mode;if(s==="disabled"&&(d.mode="hidden"),d.cues)for(var e=d.cues.length;e--;)d.removeCue(d.cues[e]);s==="disabled"&&(d.mode=s)}function Zn(d,s,e,t){var i=d.mode;if(i==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var r=function(u,c,f){var h=[],p=function(k,D){if(D<k[0].startTime)return 0;var S=k.length-1;if(D>k[S].endTime)return-1;for(var L=0,N=S;L<=N;){var P=Math.floor((N+L)/2);if(D<k[P].startTime)N=P-1;else{if(!(D>k[P].startTime&&L<S))return P;L=P+1}}return k[L].startTime-D<D-k[N].startTime?L:N}(u,c);if(p>-1)for(var y=p,b=u.length;y<b;y++){var A=u[y];if(A.startTime>=c&&A.endTime<=f)h.push(A);else if(A.startTime>f)return h}return h}(d.cues,s,e),o=0;o<r.length;o++)t&&!t(r[o])||d.removeCue(r[o]);i==="disabled"&&(d.mode=i)}var ma="org.id3",pa="com.apple.quicktime.HLS",pr="https://aomedia.org/emsg/ID3";function Qa(){if(typeof self!="undefined")return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var va=function(){var d=Qa();try{new d(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function Ji(d,s){return d.getTime()/1e3-s}var Fd=function(){function d(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var s=d.prototype;return s.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},s._registerListeners=function(){var e=this.hls;e.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(w.LEVEL_UPDATED,this.onLevelUpdated,this)},s._unregisterListeners=function(){var e=this.hls;e.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(w.LEVEL_UPDATED,this.onLevelUpdated,this)},s.onMediaAttached=function(e,t){this.media=t.media},s.onMediaDetaching=function(){this.id3Track&&(Br(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})},s.onManifestLoading=function(){this.dateRangeCuesAppended={}},s.createTrack=function(e){var t=this.getID3Track(e.textTracks);return t.mode="hidden",t},s.getID3Track=function(e){if(this.media){for(var t=0;t<e.length;t++){var i=e[t];if(i.kind==="metadata"&&i.label==="id3")return fa(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},s.onFragParsingMetadata=function(e,t){if(this.media){var i=this.hls.config,r=i.enableEmsgMetadataCues,o=i.enableID3MetadataCues;if(r||o){var u=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var c=Qa(),f=0;f<u.length;f++){var h=u[f].type;if((h!==pr||r)&&o){var p=Gn(u[f].data);if(p){var y=u[f].pts,b=y+u[f].duration;b>va&&(b=va),b-y<=0&&(b=y+.25);for(var A=0;A<p.length;A++){var k=p[A];if(!lo(k)){this.updateId3CueEnds(y);var D=new c(y,b,"");D.value=k,h&&(D.type=h),this.id3Track.addCue(D)}}}}}}}},s.updateId3CueEnds=function(e){var t,i=(t=this.id3Track)==null?void 0:t.cues;if(i)for(var r=i.length;r--;){var o=i[r];o.startTime<e&&o.endTime===va&&(o.endTime=e)}},s.onBufferFlushing=function(e,t){var i=t.startOffset,r=t.endOffset,o=t.type,u=this.id3Track,c=this.hls;if(c){var f=c.config,h=f.enableEmsgMetadataCues,p=f.enableID3MetadataCues;u&&(h||p)&&Zn(u,i,r,o==="audio"?function(y){return y.type===ma&&p}:o==="video"?function(y){return y.type===pr&&h}:function(y){return y.type===ma&&p||y.type===pr&&h})}},s.onLevelUpdated=function(e,t){var i=this,r=t.details;if(this.media&&r.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var o=this.dateRangeCuesAppended,u=this.id3Track,c=r.dateRanges,f=Object.keys(c);if(u)for(var h=Object.keys(o).filter(function(L){return!f.includes(L)}),p=function(){var L=h[y];Object.keys(o[L].cues).forEach(function(N){u.removeCue(o[L].cues[N])}),delete o[L]},y=h.length;y--;)p();var b=r.fragments[r.fragments.length-1];if(f.length!==0&&oe(b==null?void 0:b.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var A=b.programDateTime/1e3-b.start,k=Qa(),D=function(){var L=f[S],N=c[L],P=o[L],V=(P==null?void 0:P.cues)||{},q=(P==null?void 0:P.durationKnown)||!1,j=Ji(N.startDate,A),ee=va,z=N.endDate;if(z)ee=Ji(z,A),q=!0;else if(N.endOnNext&&!q){var X=f.reduce(function(Ce,He){var We=c[He];return We.class===N.class&&We.id!==He&&We.startDate>N.startDate&&Ce.push(We),Ce},[]).sort(function(Ce,He){return Ce.startDate.getTime()-He.startDate.getTime()})[0];X&&(ee=Ji(X.startDate,A),q=!0)}for(var ue,ne,Te=Object.keys(N.attr),Me=0;Me<Te.length;Me++){var _e=Te[Me];if((ne=_e)!=="ID"&&ne!=="CLASS"&&ne!=="START-DATE"&&ne!=="DURATION"&&ne!=="END-DATE"&&ne!=="END-ON-NEXT"){var De=V[_e];if(De)q&&!P.durationKnown&&(De.endTime=ee);else{var xe=N.attr[_e];De=new k(j,ee,""),Qt(_e)&&(ue=xe,xe=Uint8Array.from(ue.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),De.value={key:_e,data:xe},De.type=pa,De.id=L,i.id3Track.addCue(De),V[_e]=De}}}o[L]={cues:V,dateRange:N,durationKnown:q}},S=0;S<f.length;S++)D()}}},d}(),Ud=function(){function d(e){var t=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 t.timeupdate()},this.hls=e,this.config=e.config,this.registerListeners()}var s=d.prototype;return s.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},s.registerListeners=function(){this.hls.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(w.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(w.ERROR,this.onError,this)},s.unregisterListeners=function(){this.hls.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(w.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(w.ERROR,this.onError,this)},s.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},s.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},s.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},s.onLevelUpdated=function(e,t){var i=t.details;this.levelDetails=i,i.advanced&&this.timeupdate(),!i.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},s.onError=function(e,t){var i;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&H.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},s.timeupdate=function(){var e=this.media,t=this.levelDetails;if(e&&t){this.currentTime=e.currentTime;var i=this.computeLatency();if(i!==null){this._latency=i;var r=this.config,o=r.lowLatencyMode,u=r.maxLiveSyncPlaybackRate;if(o&&u!==1){var c=this.targetLatency;if(c!==null){var f=i-c,h=f<Math.min(this.maxLatency,c+t.targetduration);if(t.live&&h&&f>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,u)),y=Math.round(2/(1+Math.exp(-.75*f-this.edgeStalled))*20)/20;e.playbackRate=Math.min(p,Math.max(1,y))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}}}}},s.estimateLiveEdge=function(){var e=this.levelDetails;return e===null?null:e.edge+e.age},s.computeLatency=function(){var e=this.estimateLiveEdge();return e===null?null:e-this.currentTime},M(d,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e=this.levelDetails;if(e===null)return null;var t=e.holdBack,i=e.partHoldBack,r=e.targetduration,o=this.config,u=o.liveSyncDuration,c=o.liveSyncDurationCount,f=o.lowLatencyMode,h=this.hls.userConfig,p=f&&i||t;(h.liveSyncDuration||h.liveSyncDurationCount||p===0)&&(p=u!==void 0?u:c*r);var y=r;return p+Math.min(1*this.stallCount,y)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;var r=i.edge,o=e-t-this.edgeStalled,u=r-i.totalduration,c=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(u,o),c)}},{key:"drift",get:function(){var e=this.levelDetails;return e===null?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.levelDetails;if(e===null)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}}]),d}(),Jn=["NONE","TYPE-0","TYPE-1",null],es="",Bd="YES",Hd="v2",Do=function(){function d(s,e,t){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=s,this.part=e,this.skip=t}return d.prototype.addDirectives=function(s){var e=new self.URL(s);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},d}(),ga=function(){function d(s){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=[s.url],this._attrs=[s.attrs],this.bitrate=s.bitrate,s.details&&(this.details=s.details),this.id=s.id||0,this.name=s.name,this.width=s.width||0,this.height=s.height||0,this.audioCodec=s.audioCodec,this.videoCodec=s.videoCodec,this.unknownCodecs=s.unknownCodecs,this.codecSet=[s.videoCodec,s.audioCodec].filter(function(e){return e}).join(",").replace(/\.[^.,]+/g,"")}return d.prototype.addFallback=function(s){this.url.push(s.url),this._attrs.push(s.attrs)},M(d,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"attrs",get:function(){return this._attrs[this._urlId]}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(s){var e=s%this.url.length;this._urlId!==e&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=e)}},{key:"audioGroupId",get:function(){var s;return(s=this.audioGroupIds)==null?void 0:s[this.urlId]}},{key:"textGroupId",get:function(){var s;return(s=this.textGroupIds)==null?void 0:s[this.urlId]}}]),d}();function ts(d,s){var e=s.startPTS;if(oe(e)){var t,i=0;s.sn>d.sn?(i=e-d.start,t=d):(i=d.start-e,t=s),t.duration!==i&&(t.duration=i)}else s.sn>d.sn?d.cc===s.cc&&d.minEndPTS?s.start=d.start+(d.minEndPTS-d.start):s.start=d.start+d.duration:s.start=Math.max(d.start-s.duration,0)}function ya(d,s,e,t,i,r){t-e<=0&&(H.warn("Fragment should have a positive duration",s),t=e+s.duration,r=i+s.duration);var o=e,u=t,c=s.startPTS,f=s.endPTS;if(oe(c)){var h=Math.abs(c-e);oe(s.deltaPTS)?s.deltaPTS=Math.max(h,s.deltaPTS):s.deltaPTS=h,o=Math.max(e,c),e=Math.min(e,c),i=Math.min(i,s.startDTS),u=Math.min(t,f),t=Math.max(t,f),r=Math.max(r,s.endDTS)}var p=e-s.start;s.start!==0&&(s.start=e),s.duration=t-s.start,s.startPTS=e,s.maxStartPTS=o,s.startDTS=i,s.endPTS=t,s.minEndPTS=u,s.endDTS=r;var y,b=s.sn;if(!d||b<d.startSN||b>d.endSN)return 0;var A=b-d.startSN,k=d.fragments;for(k[A]=s,y=A;y>0;y--)ts(k[y],k[y-1]);for(y=A;y<k.length-1;y++)ts(k[y],k[y+1]);return d.fragmentHint&&ts(k[k.length-1],d.fragmentHint),d.PTSKnown=d.alignedSliding=!0,p}function is(d,s){for(var e=null,t=d.fragments,i=t.length-1;i>=0;i--){var r=t[i].initSegment;if(r){e=r;break}}d.fragmentHint&&delete d.fragmentHint.endPTS;var o,u,c,f,h,p=0;if(function(S,L,N){for(var P=L.skippedSegments,V=Math.max(S.startSN,L.startSN)-L.startSN,q=(S.fragmentHint?1:0)+(P?L.endSN:Math.min(S.endSN,L.endSN))-L.startSN,j=L.startSN-S.startSN,ee=L.fragmentHint?L.fragments.concat(L.fragmentHint):L.fragments,z=S.fragmentHint?S.fragments.concat(S.fragmentHint):S.fragments,X=V;X<=q;X++){var ue=z[j+X],ne=ee[X];P&&!ne&&X<P&&(ne=L.fragments[X]=ue),ue&&ne&&N(ue,ne)}}(d,s,function(S,L){S.relurl&&(p=S.cc-L.cc),oe(S.startPTS)&&oe(S.endPTS)&&(L.start=L.startPTS=S.startPTS,L.startDTS=S.startDTS,L.maxStartPTS=S.maxStartPTS,L.endPTS=S.endPTS,L.endDTS=S.endDTS,L.minEndPTS=S.minEndPTS,L.duration=S.endPTS-S.startPTS,L.duration&&(o=L),s.PTSKnown=s.alignedSliding=!0),L.elementaryStreams=S.elementaryStreams,L.loader=S.loader,L.stats=S.stats,L.urlId=S.urlId,S.initSegment&&(L.initSegment=S.initSegment,e=S.initSegment)}),e&&(s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments).forEach(function(S){var L;S.initSegment&&S.initSegment.relurl!==((L=e)==null?void 0:L.relurl)||(S.initSegment=e)}),s.skippedSegments)if(s.deltaUpdateFailed=s.fragments.some(function(S){return!S}),s.deltaUpdateFailed){H.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var y=s.skippedSegments;y--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}else s.canSkipDateRanges&&(s.dateRanges=(u=d.dateRanges,c=s.dateRanges,f=s.recentlyRemovedDateranges,h=F({},u),f&&f.forEach(function(S){delete h[S]}),Object.keys(c).forEach(function(S){var L=new Ke(c[S].attr,h[S]);L.isValid?h[S]=L:H.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(c[S].attr)+'"')}),h));var b=s.fragments;if(p){H.warn("discontinuity sliding from playlist, take drift into account");for(var A=0;A<b.length;A++)b[A].cc+=p}s.skippedSegments&&(s.startCC=s.fragments[0].cc),function(S,L,N){if(S&&L)for(var P=0,V=0,q=S.length;V<=q;V++){var j=S[V],ee=L[V+P];j&&ee&&j.index===ee.index&&j.fragment.sn===ee.fragment.sn?N(j,ee):P--}}(d.partList,s.partList,function(S,L){L.elementaryStreams=S.elementaryStreams,L.stats=S.stats}),o?ya(s,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS):rs(d,s),b.length&&(s.totalduration=s.edge-b[0].start),s.driftStartTime=d.driftStartTime,s.driftStart=d.driftStart;var k=s.advancedDateTime;if(s.advanced&&k){var D=s.edge;s.driftStart||(s.driftStartTime=k,s.driftStart=D),s.driftEndTime=k,s.driftEnd=D}else s.driftEndTime=d.driftEndTime,s.driftEnd=d.driftEnd,s.advancedDateTime=d.advancedDateTime}function rs(d,s){var e=s.startSN+s.skippedSegments-d.startSN,t=d.fragments;e<0||e>=t.length||Ea(s,t[e].start)}function Ea(d,s){if(s){for(var e=d.fragments,t=d.skippedSegments;t<e.length;t++)e[t].start+=s;d.fragmentHint&&(d.fragmentHint.start+=s)}}function Co(d,s,e){var t;return d!=null&&d.details?Mo((t=d.details)==null?void 0:t.partList,s,e):null}function Mo(d,s,e){if(d)for(var t=d.length;t--;){var i=d[t];if(i.index===e&&i.fragment.sn===s)return i}return null}function Xa(d){switch(d.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function xo(d,s){var e=Xa(s);return d.default[(e?"timeout":"error")+"Retry"]}function as(d,s){var e=d.backoff==="linear"?1:Math.pow(2,s);return Math.min(e*d.retryDelayMs,d.maxRetryDelayMs)}function Po(d){return E(E({},d),{errorRetry:null,timeoutRetry:null})}function Za(d,s,e,t){return!!d&&s<d.maxNumRetry&&(function(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}(t)||!!e)}var Oo=function(d,s){for(var e=0,t=d.length-1,i=null,r=null;e<=t;){var o=s(r=d[i=(e+t)/2|0]);if(o>0)e=i+1;else{if(!(o<0))return r;t=i-1}}return null};function ba(d,s,e,t){e===void 0&&(e=0),t===void 0&&(t=0);var i=null;if(d?i=s[d.sn-s[0].sn+1]||null:e===0&&s[0].start===0&&(i=s[0]),i&&Ja(e,t,i)===0)return i;var r=Oo(s,Ja.bind(null,e,t));return!r||r===d&&i?i:r}function Ja(d,s,e){if(d===void 0&&(d=0),s===void 0&&(s=0),e.start<=d&&e.start+e.duration>d)return 0;var t=Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return e.start+e.duration-t<=d?1:e.start-t>d&&e.start?-1:0}function fi(d,s,e){var t=1e3*Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return(e.endProgramDateTime||0)-t>d}var vr,Gd=3e5,ns=0,T=2,g=5,_=0,R=1,C=2,O=function(){function d(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=H.log.bind(H,"[info]:"),this.warn=H.warn.bind(H,"[warning]:"),this.error=H.error.bind(H,"[error]:"),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.ERROR,this.onError,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(w.ERROR,this.onError,this),e.off(w.ERROR,this.onErrorOut,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this))},s.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},s.startLoad=function(e){this.playlistError=0},s.stopLoad=function(){},s.getVariantLevelIndex=function(e){return(e==null?void 0:e.type)===et?e.level:this.hls.loadLevel},s.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},s.onError=function(e,t){var i;if(!t.fatal){var r=this.hls,o=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=T);case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:var u,c,f=t.parent===et?t.level:r.loadLevel;return void(t.details===$.LEVEL_EMPTY_ERROR&&(u=t.context)!=null&&(c=u.levelDetails)!=null&&c.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,f):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,f)));case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:return void(typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level)));case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){var h=r.levels[r.loadLevel];if(h&&(o.type===hi&&o.groupId===h.audioGroupId||o.type===Ki&&o.groupId===h.textGroupId))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=T,void(t.errorAction.flags=R)}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var p=r.levels[r.loadLevel],y=p==null?void 0:p.attrs["HDCP-LEVEL"];return void(y&&(t.errorAction={action:T,flags:C,hdcpLevel:y}));case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:r.loadLevel));case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_APPEND_ERROR:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:ns,flags:_})}if(t.type===le.KEY_SYSTEM_ERROR){var b=this.getVariantLevelIndex(t.frag);return t.levelRetry=!1,void(t.errorAction=this.getLevelSwitchAction(t,b))}}},s.getPlaylistRetryOrSwitchAction=function(e,t){var i,r,o=xo(this.hls.config.playlistLoadPolicy,e),u=this.playlistError++,c=(i=e.response)==null?void 0:i.code;return Za(o,u,Xa(e),c)?{action:g,flags:_,retryConfig:o,retryCount:u}:(r=e.context)!=null&&r.deliveryDirectives?{action:ns,flags:_,retryConfig:o||{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},retryCount:u}:this.getLevelSwitchAction(e,t)},s.getFragRetryOrSwitchAction=function(e){var t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],o=t.config,u=o.fragLoadPolicy,c=o.keyLoadPolicy,f=xo(e.details.startsWith("key")?c:u,e),h=t.levels.reduce(function(A,k){return A+k.fragmentError},0);if(r){var p;e.details!==$.FRAG_GAP&&r.fragmentError++;var y=(p=e.response)==null?void 0:p.code;if(Za(f,h,Xa(e),y))return{action:g,flags:_,retryConfig:f,retryCount:h}}var b=this.getLevelSwitchAction(e,i);return f&&(b.retryConfig=f,b.retryCount=h),b},s.getLevelSwitchAction=function(e,t){var i=this.hls;t==null&&(t=i.loadLevel);var r=this.hls.levels[t];if(r&&(r.loadError++,i.autoLevelEnabled)){for(var o,u,c=-1,f=i.levels,h=(o=e.frag)==null?void 0:o.type,p=(u=e.context)!=null?u:{},y=p.type,b=p.groupId,A=f.length;A--;){var k=(A+i.loadLevel)%f.length;if(k!==i.loadLevel&&f[k].loadError===0){var D=f[k];if(e.details===$.FRAG_GAP&&e.frag){var S=f[k].details;if(S){var L=ba(e.frag,S.fragments,e.frag.start);if(L!=null&&L.gap)continue}}else if(y===hi&&b===D.audioGroupId||y===Ki&&b===D.textGroupId||h===_i&&r.audioGroupId===D.audioGroupId||h===Ri&&r.textGroupId===D.textGroupId)continue;c=k;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,{action:T,flags:_,nextAutoLevel:c}}return{action:T,flags:R}},s.onErrorOut=function(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ns:break;case T:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===$.FRAG_GAP||(t.fatal=!0)}t.fatal&&this.hls.stopLoad()},s.sendAlternateToPenaltyBox=function(e){var t=this.hls,i=e.errorAction;if(i){var r=i.flags,o=i.hdcpLevel,u=i.nextAutoLevel;switch(r){case _:this.switchLevel(e,u);break;case R:i.resolved||(i.resolved=this.redundantFailover(e));break;case C:o&&(t.maxHdcpLevel=Jn[Jn.indexOf(o)-1],i.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}i.resolved||this.switchLevel(e,u)}},s.switchLevel=function(e,t){t!==void 0&&e.errorAction&&(this.warn("switching to level "+t+" after "+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)},s.redundantFailover=function(e){var t=this,i=this.hls,r=this.penalizedRenditions,o=e.parent===et?e.level:i.loadLevel,u=i.levels[o],c=u.url.length,f=e.frag?e.frag.urlId:u.urlId;u.urlId!==f||e.frag&&!u.details||this.penalizeRendition(u,e);for(var h=function(){var b=(f+p)%c,A=r[b];if(!A||function(k,D,S){if(performance.now()-k.lastErrorPerfMs>Gd)return!0;var L=k.details;if(D.details===$.FRAG_GAP&&L&&D.frag){var N=D.frag.start,P=ba(null,L.fragments,N);if(P&&!P.gap)return!0}if(S&&k.errors.length<S.errors.length){var V=k.errors[k.errors.length-1];if(L&&V.frag&&D.frag&&Math.abs(V.frag.start-D.frag.start)>3*L.targetduration)return!0}return!1}(A,e,r[f]))return t.warn("Switching to Redundant Stream "+(b+1)+"/"+c+': "'+u.url[b]+'" after '+e.details),t.playlistError=0,i.levels.forEach(function(k){k.urlId=b}),i.nextLoadLevel=o,{v:!0}},p=1;p<c;p++){var y=h();if(typeof y=="object")return y.v}return!1},s.penalizeRendition=function(e,t){var i=this.penalizedRenditions,r=i[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};r.lastErrorPerfMs=performance.now(),r.errors.push(t),r.details=e.details,i[e.urlId]=r},d}(),x=function(){function d(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=H.log.bind(H,t+":"),this.warn=H.warn.bind(H,t+":"),this.hls=e}var s=d.prototype;return s.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},s.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},s.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},s.stopLoad=function(){this.canLoad=!1,this.clearTimer()},s.switchParams=function(e,t){var i=t==null?void 0:t.renditionReports;if(i){for(var r=-1,o=0;o<i.length;o++){var u=i[o],c=void 0;try{c=new self.URL(u.URI,t.url).href}catch(b){H.warn("Could not construct new URL for Rendition Report: "+b),c=u.URI||""}if(c===e){r=o;break}c===e.substring(0,c.length)&&(r=o)}if(r!==-1){var f=i[r],h=parseInt(f["LAST-MSN"])||(t==null?void 0:t.lastPartSn),p=parseInt(f["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){var y=Math.min(t.age-t.partTarget,t.targetduration);p>=0&&y>t.partTarget&&(p+=1)}return new Do(h,p>=0?p:void 0,es)}}},s.loadPlaylist=function(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())},s.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},s.shouldReloadPlaylist=function(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)},s.playlistLoaded=function(e,t,i){var r=this,o=t.details,u=t.stats,c=self.performance.now(),f=u.loading.first?Math.max(0,c-u.loading.first):0;if(o.advancedDateTime=Date.now()-f,o.live||i!=null&&i.live){if(o.reloaded(i),i&&this.log("live playlist "+e+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),i&&o.fragments.length>0&&is(i,o),!this.canLoad||!o.live)return;var h,p=void 0,y=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var b=this.hls.config.lowLatencyMode,A=o.lastPartSn,k=o.endSN,D=o.lastPartIndex,S=A===k;D!==-1?(p=S?k+1:A,y=S?b?0:D:D+1):p=k+1;var L=o.age,N=L+o.ageHeader,P=Math.min(N-o.partTarget,1.5*o.targetduration);if(P>0){if(i&&P>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+P+" with playlist age: "+o.age),P=0;else{var V=Math.floor(P/o.targetduration);p+=V,y!==void 0&&(y+=Math.round(P%o.targetduration/o.partTarget)),this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+L.toFixed(2)+"s goal: "+P+" skip sn "+V+" to part "+y)}o.tuneInGoal=P}if(h=this.getDeliveryDirectives(o,t.deliveryDirectives,p,y),b||!S)return void this.loadPlaylist(h)}else o.canBlockReload&&(h=this.getDeliveryDirectives(o,t.deliveryDirectives,p,y));var q=this.hls.mainForwardBufferInfo,j=q?q.end-q.len:0,ee=function(X,ue){ue===void 0&&(ue=1/0);var ne=1e3*X.targetduration;if(X.updated){var Te=X.fragments;if(Te.length&&4*ne>ue){var Me=1e3*Te[Te.length-1].duration;Me<ne&&(ne=Me)}}else ne/=2;return Math.round(ne)}(o,1e3*(o.edge-j));o.updated&&c>this.requestScheduled+ee&&(this.requestScheduled=u.loading.start),p!==void 0&&o.canBlockReload?this.requestScheduled=u.loading.first+ee-(1e3*o.partTarget||1e3):this.requestScheduled===-1||this.requestScheduled+ee<c?this.requestScheduled=c:this.requestScheduled-c<=0&&(this.requestScheduled+=ee);var z=this.requestScheduled-c;z=Math.max(0,z),this.log("reload live playlist "+e+" in "+Math.round(z)+" ms"),this.timer=self.setTimeout(function(){return r.loadPlaylist(h)},z)}else this.clearTimer()},s.getDeliveryDirectives=function(e,t,i,r){var o=function(u,c){var f=u.canSkipUntil,h=u.canSkipDateRanges,p=u.endSN;return f&&(c!==void 0?c-p:0)<f?h?Hd:Bd:es}(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,o=es),new Do(i,r,o)},s.checkRetry=function(e){var t=this,i=e.details,r=Xa(e),o=e.errorAction,u=o||{},c=u.action,f=u.retryCount,h=f===void 0?0:f,p=u.retryConfig,y=!!o&&!!p&&(c===g||!o.resolved&&c===T);if(y){var b;if(this.requestScheduled=-1,r&&(b=e.context)!=null&&b.deliveryDirectives)this.warn("Retrying playlist loading "+(h+1)+"/"+p.maxNumRetry+' after "'+i+'" without delivery-directives'),this.loadPlaylist();else{var A=as(p,h);this.timer=self.setTimeout(function(){return t.loadPlaylist()},A),this.warn("Retrying playlist loading "+(h+1)+"/"+p.maxNumRetry+' after "'+i+'" in '+A+"ms")}e.levelRetry=!0,o.resolved=!0}return y},d}(),G=function(d){function s(t,i){var r;return(r=d.call(this,t,"[level-controller]")||this)._levels=[],r._firstLevel=-1,r._startLevel=void 0,r.currentLevel=null,r.currentLevelIndex=-1,r.manualLevelIndex=-1,r.steering=void 0,r.onParsedComplete=void 0,r.steering=i,r._registerListeners(),r}Q(s,d);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(w.FRAG_LOADED,this.onFragLoaded,this),t.on(w.ERROR,this.onError,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(w.FRAG_LOADED,this.onFragLoaded,this),t.off(w.ERROR,this.onError,this)},e.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),d.prototype.destroy.call(this)},e.startLoad=function(){this._levels.forEach(function(t){t.loadError=0,t.fragmentError=0}),d.prototype.startLoad.call(this)},e.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]},e.onManifestLoading=function(t,i){this.resetLevels()},e.onManifestLoaded=function(t,i){var r,o=[],u={};i.levels.forEach(function(c){var f,h=c.attrs;((f=c.audioCodec)==null?void 0:f.indexOf("mp4a.40.34"))!==-1&&(vr||(vr=/chrome|firefox/i.test(navigator.userAgent)),vr&&(c.audioCodec=void 0));var p=h.AUDIO,y=h.CODECS,b=h["FRAME-RATE"],A=h["PATHWAY-ID"],k=h.RESOLUTION,D=h.SUBTITLES,S=(A||".")+"-"+c.bitrate+"-"+k+"-"+b+"-"+y;(r=u[S])?r.addFallback(c):(r=new ga(c),u[S]=r,o.push(r)),Y(r,"audio",p),Y(r,"text",D)}),this.filterAndSortMediaOptions(o,i)},e.filterAndSortMediaOptions=function(t,i){var r=this,o=[],u=[],c=!1,f=!1,h=!1,p=t.filter(function(L){var N=L.audioCodec,P=L.videoCodec,V=L.width,q=L.height,j=L.unknownCodecs;return c||(c=!(!V||!q)),f||(f=!!P),h||(h=!!N),!(j!=null&&j.length)&&(!N||ja(N,"audio"))&&(!P||ja(P,"video"))});if((c||f)&&h&&(p=p.filter(function(L){var N=L.videoCodec,P=L.width,V=L.height;return!!N||!(!P||!V)})),p.length!==0){i.audioTracks&&K(o=i.audioTracks.filter(function(L){return!L.audioCodec||ja(L.audioCodec,"audio")})),i.subtitles&&K(u=i.subtitles);var y=p.slice(0);p.sort(function(L,N){return L.attrs["HDCP-LEVEL"]!==N.attrs["HDCP-LEVEL"]?(L.attrs["HDCP-LEVEL"]||"")>(N.attrs["HDCP-LEVEL"]||"")?1:-1:L.bitrate!==N.bitrate?L.bitrate-N.bitrate:L.attrs["FRAME-RATE"]!==N.attrs["FRAME-RATE"]?L.attrs.decimalFloatingPoint("FRAME-RATE")-N.attrs.decimalFloatingPoint("FRAME-RATE"):L.attrs.SCORE!==N.attrs.SCORE?L.attrs.decimalFloatingPoint("SCORE")-N.attrs.decimalFloatingPoint("SCORE"):c&&L.height!==N.height?L.height-N.height:0});var b=y[0];if(this.steering&&(p=this.steering.filterParsedLevels(p)).length!==y.length){for(var A=0;A<y.length;A++)if(y[A].pathwayId===p[0].pathwayId){b=y[A];break}}this._levels=p;for(var k=0;k<p.length;k++)if(p[k]===b){this._firstLevel=k,this.log("manifest loaded, "+p.length+" level(s) found, first bitrate: "+b.bitrate);break}var D=h&&!f,S={levels:p,audioTracks:o,subtitleTracks:u,sessionData:i.sessionData,sessionKeys:i.sessionKeys,firstLevel:this._firstLevel,stats:i.stats,audio:h,video:f,altAudio:!D&&o.some(function(L){return!!L.url})};this.hls.trigger(w.MANIFEST_PARSED,S),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then(function(){if(r.hls){var L=new Error("no level with compatible codecs found in manifest");r.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:i.url,error:L,reason:L.message})}})},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===mr&&i.context.level===this.level&&this.checkRetry(i)},e.onFragLoaded=function(t,i){var r=i.frag;if(r!==void 0&&r.type===et){var o=this._levels[r.level];o!==void 0&&(o.loadError=0)}},e.onLevelLoaded=function(t,i){var r,o,u=i.level,c=i.details,f=this._levels[u];if(!f)return this.warn("Invalid level index "+u),void((o=i.deliveryDirectives)!=null&&o.skip&&(c.deltaUpdateFailed=!0));u===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0),this.playlistLoaded(u,i,f.details)):(r=i.deliveryDirectives)!=null&&r.skip&&(c.deltaUpdateFailed=!0)},e.onAudioTrackSwitched=function(t,i){var r=this.currentLevel;if(r){var o=this.hls.audioTracks[i.id].groupId;if(r.audioGroupIds&&r.audioGroupId!==o){for(var u=-1,c=0;c<r.audioGroupIds.length;c++)if(r.audioGroupIds[c]===o){u=c;break}u!==-1&&u!==r.urlId&&(r.urlId=u,this.canLoad&&this.startLoad())}}},e.loadPlaylist=function(t){d.prototype.loadPlaylist.call(this);var i=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){var o=r.urlId,u=r.uri;if(t)try{u=t.addDirectives(u)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}var c=r.attrs["PATHWAY-ID"];this.log("Loading level index "+i+((t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:"")+" with"+(c?" Pathway "+c:"")+" URI "+(o+1)+"/"+r.url.length+" "+u),this.clearTimer(),this.hls.trigger(w.LEVEL_LOADING,{url:u,level:i,id:o,deliveryDirectives:t||null})}},e.removeLevel=function(t,i){var r=this,o=function(c,f){return f!==i},u=this._levels.filter(function(c,f){return f!==t||(c.url.length>1&&i!==void 0?(c.url=c.url.filter(o),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(o)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(o)),c.urlId=0,!0):(r.steering&&r.steering.removeLevel(c),!1))});this.hls.trigger(w.LEVELS_UPDATED,{levels:u})},e.onLevelsUpdated=function(t,i){var r=i.levels;r.forEach(function(o,u){var c=o.details;c!=null&&c.fragments&&c.fragments.forEach(function(f){f.level=u})}),this._levels=r},M(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var i=this._levels;if(i.length!==0){if(t<0||t>=i.length){var r=new Error("invalid level idx"),o=t<0;if(this.hls.trigger(w.ERROR,{type:le.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:t,fatal:o,error:r,reason:r.message}),o)return;t=Math.min(t,i.length-1)}var u=this.currentLevelIndex,c=this.currentLevel,f=c?c.attrs["PATHWAY-ID"]:void 0,h=i[t],p=h.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=h,u!==t||!h.details||!c||f!==p){this.log("Switching to level "+t+(p?" with Pathway "+p:"")+" from level "+u+(f?" with Pathway "+f:""));var y=F({},h,{level:t,maxBitrate:h.maxBitrate,attrs:h.attrs,uri:h.uri,urlId:h.urlId});delete y._attrs,delete y._urlId,this.hls.trigger(w.LEVEL_SWITCHING,y);var b=h.details;if(!b||b.live){var A=this.switchParams(h.uri,c==null?void 0:c.details);this.loadPlaylist(A)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,this._startLevel===void 0&&(this._startLevel=t),t!==-1&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var t=this.hls.config.startLevel;return t!==void 0?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=t)}}]),s}(x);function Y(d,s,e){e&&(s==="audio"?(d.audioGroupIds||(d.audioGroupIds=[]),d.audioGroupIds[d.url.length-1]=e):s==="text"&&(d.textGroupIds||(d.textGroupIds=[]),d.textGroupIds[d.url.length-1]=e))}function K(d){var s={};d.forEach(function(e){var t=e.groupId||"";e.id=s[t]=s[t]||0,s[t]++})}var Z="NOT_LOADED",Oe="APPENDING",ye="PARTIAL",Se="OK",be=function(){function d(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}var s=d.prototype;return s._registerListeners=function(){var e=this.hls;e.on(w.BUFFER_APPENDED,this.onBufferAppended,this),e.on(w.FRAG_BUFFERED,this.onFragBuffered,this),e.on(w.FRAG_LOADED,this.onFragLoaded,this)},s._unregisterListeners=function(){var e=this.hls;e.off(w.BUFFER_APPENDED,this.onBufferAppended,this),e.off(w.FRAG_BUFFERED,this.onFragBuffered,this),e.off(w.FRAG_LOADED,this.onFragLoaded,this)},s.destroy=function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},s.getAppendedFrag=function(e,t){var i=this.activePartLists[t];if(i)for(var r=i.length;r--;){var o=i[r];if(!o)break;var u=o.end;if(o.start<=e&&u!==null&&e<=u)return o}return this.getBufferedFrag(e,t)},s.getBufferedFrag=function(e,t){for(var i=this.fragments,r=Object.keys(i),o=r.length;o--;){var u=i[r[o]];if((u==null?void 0:u.body.type)===t&&u.buffered){var c=u.body;if(c.start<=e&&e<=c.end)return c}}return null},s.detectEvictedFragments=function(e,t,i,r){var o=this;this.timeRanges&&(this.timeRanges[e]=t);var u=(r==null?void 0:r.fragment.sn)||0;Object.keys(this.fragments).forEach(function(c){var f=o.fragments[c];if(f&&!(u>=f.body.sn))if(f.buffered||f.loaded){var h=f.range[e];h&&h.time.some(function(p){var y=!o.isTimeBuffered(p.startPTS,p.endPTS,t);return y&&o.removeFragment(f.body),y})}else f.body.type===i&&o.removeFragment(f.body)})},s.detectPartialFragments=function(e){var t=this,i=this.timeRanges,r=e.frag,o=e.part;if(i&&r.sn!=="initSegment"){var u=Ge(r),c=this.fragments[u];if(c){var f=!r.relurl;Object.keys(i).forEach(function(h){var p=r.elementaryStreams[h];if(p){var y=i[h],b=f||p.partial===!0;c.range[h]=t.getBufferedTimes(r,o,b,y)}}),c.loaded=null,Object.keys(c.range).length?(c.buffered=!0,c.body.endList&&(this.endListFragments[c.body.type]=c),Re(c)||this.removeParts(r.sn-1,r.type)):this.removeFragment(c.body)}}},s.removeParts=function(e,t){var i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(function(r){return r.fragment.sn>=e}))},s.fragBuffered=function(e,t){var i=Ge(e),r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)},s.getBufferedTimes=function(e,t,i,r){for(var o={time:[],partial:i},u=e.start,c=e.end,f=e.minEndPTS||c,h=e.maxStartPTS||u,p=0;p<r.length;p++){var y=r.start(p)-this.bufferPadding,b=r.end(p)+this.bufferPadding;if(h>=y&&f<=b){o.time.push({startPTS:Math.max(u,r.start(p)),endPTS:Math.min(c,r.end(p))});break}if(u<b&&c>y)o.partial=!0,o.time.push({startPTS:Math.max(u,r.start(p)),endPTS:Math.min(c,r.end(p))});else if(c<=y)break}return o},s.getPartialFragment=function(e){var t,i,r,o=null,u=0,c=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(h){var p=f[h];p&&Re(p)&&(i=p.body.start-c,r=p.body.end+c,e>=i&&e<=r&&(t=Math.min(e-i,r-e),u<=t&&(o=p.body,u=t)))}),o},s.isEndListAppended=function(e){var t=this.endListFragments[e];return t!==void 0&&(t.buffered||Re(t))},s.getState=function(e){var t=Ge(e),i=this.fragments[t];return i?i.buffered?Re(i)?ye:Se:Oe:Z},s.isTimeBuffered=function(e,t,i){for(var r,o,u=0;u<i.length;u++){if(r=i.start(u)-this.bufferPadding,o=i.end(u)+this.bufferPadding,e>=r&&t<=o)return!0;if(t<=r)return!1}return!1},s.onFragLoaded=function(e,t){var i=t.frag,r=t.part;if(i.sn!=="initSegment"&&!i.bitrateTest){var o=r?null:t,u=Ge(i);this.fragments[u]={body:i,appendedPTS:null,loaded:o,buffered:!1,range:Object.create(null)}}},s.onBufferAppended=function(e,t){var i=this,r=t.frag,o=t.part,u=t.timeRanges;if(r.sn!=="initSegment"){var c=r.type;if(o){var f=this.activePartLists[c];f||(this.activePartLists[c]=f=[]),f.push(o)}this.timeRanges=u,Object.keys(u).forEach(function(h){var p=u[h];i.detectEvictedFragments(h,p,c,o)})}},s.onFragBuffered=function(e,t){this.detectPartialFragments(t)},s.hasFragment=function(e){var t=Ge(e);return!!this.fragments[t]},s.hasParts=function(e){var t;return!((t=this.activePartLists[e])==null||!t.length)},s.removeFragmentsInRange=function(e,t,i,r,o){var u=this;r&&!this.hasGaps||Object.keys(this.fragments).forEach(function(c){var f=u.fragments[c];if(f){var h=f.body;h.type!==i||r&&!h.gap||h.start<t&&h.end>e&&(f.buffered||o)&&u.removeFragment(h)}})},s.removeFragment=function(e){var t=Ge(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var i=this.activePartLists[e.type];if(i){var r=e.sn;this.activePartLists[e.type]=i.filter(function(o){return o.fragment.sn!==r})}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},s.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1},d}();function Re(d){var s,e;return d.buffered&&(d.body.gap||((s=d.range.video)==null?void 0:s.partial)||((e=d.range.audio)==null?void 0:e.partial))}function Ge(d){return d.type+"_"+d.level+"_"+d.urlId+"_"+d.sn}var kt=Math.pow(2,17),Pt=function(){function d(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var s=d.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(e,t){var i=this,r=e.url;if(!r)return Promise.reject(new Be({type:le.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(r?"part list":"url")),networkDetails:null}));this.abort();var o=this.config,u=o.fLoader,c=o.loader;return new Promise(function(f,h){if(i.loader&&i.loader.destroy(),e.gap)h(ni(e));else{var p=i.loader=e.loader=u?new u(o):new c(o),y=Wt(e),b=Po(o.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:kt};e.stats=p.stats,p.load(y,A,{onSuccess:function(k,D,S,L){i.resetLoader(e,p);var N=k.data;S.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(N.slice(0,16)),N=N.slice(16)),f({frag:e,part:null,payload:N,networkDetails:L})},onError:function(k,D,S,L){i.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:E({url:r,data:void 0},k),error:new Error("HTTP Error "+k.code+" "+k.text),networkDetails:S,stats:L}))},onAbort:function(k,D,S){i.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:S,stats:k}))},onTimeout:function(k,D,S){i.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:k}))},onProgress:function(k,D,S,L){t&&t({frag:e,part:null,payload:S,networkDetails:L})}})}})},s.loadPart=function(e,t,i){var r=this;this.abort();var o=this.config,u=o.fLoader,c=o.loader;return new Promise(function(f,h){if(r.loader&&r.loader.destroy(),e.gap||t.gap)h(ni(e,t));else{var p=r.loader=e.loader=u?new u(o):new c(o),y=Wt(e,t),b=Po(o.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:kt};t.stats=p.stats,p.load(y,A,{onSuccess:function(k,D,S,L){r.resetLoader(e,p),r.updateStatsFromPart(e,t);var N={frag:e,part:t,payload:k.data,networkDetails:L};i(N),f(N)},onError:function(k,D,S,L){r.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:E({url:y.url,data:void 0},k),error:new Error("HTTP Error "+k.code+" "+k.text),networkDetails:S,stats:L}))},onAbort:function(k,D,S){e.stats.aborted=t.stats.aborted,r.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:S,stats:k}))},onTimeout:function(k,D,S){r.resetLoader(e,p),h(new Be({type:le.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:k}))}})}})},s.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,o=r.total;if(i.loaded+=r.loaded,o){var u=Math.round(e.duration/t.duration),c=Math.min(Math.round(i.loaded/o),u),f=(u-c)*Math.round(i.loaded/c);i.total=i.loaded+f}else i.total=Math.max(i.loaded,i.total);var h=i.loading,p=r.loading;h.start?h.first+=p.first-p.start:(h.start=p.start,h.first=p.first),h.end=p.end},s.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},d}();function Wt(d,s){s===void 0&&(s=null);var e=s||d,t={frag:d,part:s,responseType:"arraybuffer",url:e.url,headers:{},rangeStart:0,rangeEnd:0},i=e.byteRangeStartOffset,r=e.byteRangeEndOffset;if(oe(i)&&oe(r)){var o,u=i,c=r;if(d.sn==="initSegment"&&((o=d.decryptdata)==null?void 0:o.method)==="AES-128"){var f=r-i;f%16&&(c=r+(16-f%16)),i!==0&&(t.resetIV=!0,u=i-16)}t.rangeStart=u,t.rangeEnd=c}return t}function ni(d,s){var e=new Error("GAP "+(d.gap?"tag":"attribute")+" found"),t={type:le.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:d,error:e,networkDetails:null};return s&&(t.part=s),(s||d).stats.aborted=!0,new Be(t)}var Be=function(d){function s(e){var t;return(t=d.call(this,e.error.message)||this).data=void 0,t.data=e,t}return Q(s,d),s}(Ae(Error)),yt=function(){function d(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var s=d.prototype;return s.abort=function(e){for(var t in this.keyUriToKeyInfo){var i=this.keyUriToKeyInfo[t].loader;if(i){if(e&&e!==i.context.frag.type)return;i.abort()}}},s.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},s.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}},s.createKeyLoadError=function(e,t,i,r,o){return t===void 0&&(t=$.KEY_LOAD_ERROR),new Be({type:le.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:o,error:i,networkDetails:r})},s.loadClear=function(e,t){var i=this;if(this.emeController&&this.config.emeEnabled)for(var r=e.sn,o=e.cc,u=function(){var f=t[c];if(o<=f.cc&&(r==="initSegment"||f.sn==="initSegment"||r<f.sn))return i.emeController.selectKeySystemFormat(f).then(function(h){f.setKeyFormat(h)}),"break"},c=0;c<t.length&&u()!=="break";c++);},s.load=function(e){var t=this;return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(function(i){return t.loadInternal(e,i)}):this.loadInternal(e)},s.loadInternal=function(e,t){var i,r;t&&e.setKeyFormat(t);var o=e.decryptdata;if(!o){var u=new Error(t?"Expected frag.decryptdata to be defined after setting format "+t:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,u))}var c=o.uri;if(!c)return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error('Invalid key URI: "'+c+'"')));var f,h=this.keyUriToKeyInfo[c];if((i=h)!=null&&i.decryptdata.key)return o.key=h.decryptdata.key,Promise.resolve({frag:e,keyInfo:h});if((r=h)!=null&&r.keyLoadPromise)switch((f=h.mediaKeySessionContext)==null?void 0:f.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return h.keyLoadPromise.then(function(p){return o.key=p.keyInfo.decryptdata.key,{frag:e,keyInfo:h}})}switch(h=this.keyUriToKeyInfo[c]={decryptdata:o,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},o.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return o.keyFormat==="identity"?this.loadKeyHTTP(h,e):this.loadKeyEME(h,e);case"AES-128":return this.loadKeyHTTP(h,e);default:return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'+o.method+'"')))}},s.loadKeyEME=function(e,t){var i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(function(o){return e.mediaKeySessionContext=o,i})).catch(function(o){throw e.keyLoadPromise=null,o})}return Promise.resolve(i)},s.loadKeyHTTP=function(e,t){var i=this,r=this.config,o=new r.loader(r);return t.keyLoader=e.loader=o,e.keyLoadPromise=new Promise(function(u,c){var f={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},h=r.keyLoadPolicy.default,p={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:function(b,A,k,D){var S=k.frag,L=k.keyInfo,N=k.url;if(!S.decryptdata||L!==i.keyUriToKeyInfo[N])return c(i.createKeyLoadError(S,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),D));L.decryptdata.key=S.decryptdata.key=new Uint8Array(b.data),S.keyLoader=null,L.loader=null,u({frag:S,keyInfo:L})},onError:function(b,A,k,D){i.resetLoader(A),c(i.createKeyLoadError(t,$.KEY_LOAD_ERROR,new Error("HTTP Error "+b.code+" loading key "+b.text),k,E({url:f.url,data:void 0},b)))},onTimeout:function(b,A,k){i.resetLoader(A),c(i.createKeyLoadError(t,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),k))},onAbort:function(b,A,k){i.resetLoader(A),c(i.createKeyLoadError(t,$.INTERNAL_ABORTED,new Error("key loading aborted"),k))}};o.load(f,p,y)})},s.resetLoader=function(e){var t=e.frag,i=e.keyInfo,r=e.url,o=i.loader;t.keyLoader===o&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],o&&o.destroy()},d}(),Ze=function(){function d(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var s=d.prototype;return s.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},s.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},s.onHandlerDestroyed=function(){},s.hasInterval=function(){return!!this._tickInterval},s.hasNextTick=function(){return!!this._tickTimer},s.setInterval=function(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)},s.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},s.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},s.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},s.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},s.doTick=function(){},d}(),de={length:0,start:function(){return 0},end:function(){return 0}},ce=function(){function d(){}return d.isBuffered=function(s,e){try{if(s){for(var t=d.getBuffered(s),i=0;i<t.length;i++)if(e>=t.start(i)&&e<=t.end(i))return!0}}catch{}return!1},d.bufferInfo=function(s,e,t){try{if(s){var i,r=d.getBuffered(s),o=[];for(i=0;i<r.length;i++)o.push({start:r.start(i),end:r.end(i)});return this.bufferedInfo(o,e,t)}}catch{}return{len:0,start:e,end:e,nextStart:void 0}},d.bufferedInfo=function(s,e,t){e=Math.max(0,e),s.sort(function(k,D){var S=k.start-D.start;return S||D.end-k.end});var i=[];if(t)for(var r=0;r<s.length;r++){var o=i.length;if(o){var u=i[o-1].end;s[r].start-u<t?s[r].end>u&&(i[o-1].end=s[r].end):i.push(s[r])}else i.push(s[r])}else i=s;for(var c,f=0,h=e,p=e,y=0;y<i.length;y++){var b=i[y].start,A=i[y].end;if(e+t>=b&&e<A)h=b,f=(p=A)-e;else if(e+t<b){c=b;break}}return{len:f,start:h||0,end:p||0,nextStart:c}},d.getBuffered=function(s){try{return s.buffered}catch(e){return H.log("failed to get media.buffered",e),de}},d}(),he=function(d,s,e,t,i,r){t===void 0&&(t=0),i===void 0&&(i=-1),r===void 0&&(r=!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=d,this.sn=s,this.id=e,this.size=t,this.part=i,this.partial=r};function Ne(d,s){for(var e=null,t=0,i=d.length;t<i;t++){var r=d[t];if(r&&r.cc===s){e=r;break}}return e}function Ve(d,s){if(d){var e=d.start+s;d.start=d.startPTS=e,d.endPTS=e+d.duration}}function ft(d,s){for(var e=s.fragments,t=0,i=e.length;t<i;t++)Ve(e[t],d);s.fragmentHint&&Ve(s.fragmentHint,d),s.alignedSliding=!0}function Zt(d,s,e){s&&(function(t,i,r){if(function(u,c,f){return!(!c.details||!(f.endCC>f.startCC||u&&u.cc<f.startCC))}(t,r,i)){var o=function(u,c,f){var h=u.fragments,p=c.fragments;if(p.length&&h.length){var y=Ne(h,p[0].cc);if(y&&(!y||y.startPTS))return y;H.log("No frag in previous level to align on")}else H.log("No fragments to align")}(r.details,i);o&&oe(o.start)&&(H.log("Adjusting PTS using last level due to CC increase within current level "+i.url),ft(o.start,i))}}(d,e,s),!e.alignedSliding&&s.details&&function(t,i){if(i.fragments.length&&t.hasProgramDateTime&&i.hasProgramDateTime){var r=i.fragments[0].programDateTime,o=t.fragments[0].programDateTime,u=(o-r)/1e3+i.fragments[0].start;u&&oe(u)&&(H.log("Adjusting PTS using programDateTime delta "+(o-r)+"ms, sliding:"+u.toFixed(3)+" "+t.url+" "),ft(u,t))}}(e,s.details),e.alignedSliding||!s.details||e.skippedSegments||rs(s.details,e))}function wt(d,s){if(d.hasProgramDateTime&&s.hasProgramDateTime){var e=d.fragments,t=s.fragments;if(e.length&&t.length){var i=t[Math.round(t.length/2)-1],r=Ne(e,i.cc)||e[Math.round(e.length/2)-1],o=i.programDateTime,u=r.programDateTime;o!==null&&u!==null&&ft((u-o)/1e3-(r.start-i.start),d)}}}var qt=function(){function d(s,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=s,this.aesIV=e}return d.prototype.decrypt=function(s,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,s)},d}(),Lt=function(){function d(s,e){this.subtle=void 0,this.key=void 0,this.subtle=s,this.key=e}return d.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},d}(),It=function(){function d(){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 s=d.prototype;return s.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),i=new Uint32Array(4),r=0;r<4;r++)i[r]=t.getUint32(4*r);return i},s.initTable=function(){var e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],o=i[1],u=i[2],c=i[3],f=this.invSubMix,h=f[0],p=f[1],y=f[2],b=f[3],A=new Uint32Array(256),k=0,D=0,S=0;for(S=0;S<256;S++)A[S]=S<128?S<<1:S<<1^283;for(S=0;S<256;S++){var L=D^D<<1^D<<2^D<<3^D<<4;L=L>>>8^255&L^99,e[k]=L,t[L]=k;var N=A[k],P=A[N],V=A[P],q=257*A[L]^16843008*L;r[k]=q<<24|q>>>8,o[k]=q<<16|q>>>16,u[k]=q<<8|q>>>24,c[k]=q,q=16843009*V^65537*P^257*N^16843008*k,h[L]=q<<24|q>>>8,p[L]=q<<16|q>>>16,y[L]=q<<8|q>>>24,b[L]=q,k?(k=N^A[A[A[V^N]]],D^=A[A[D]]):k=D=1}},s.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,r=0;r<t.length&&i;)i=t[r]===this.key[r],r++;if(!i){this.key=t;var o=this.keySize=t.length;if(o!==4&&o!==6&&o!==8)throw new Error("Invalid aes key size="+o);var u,c,f,h,p=this.ksRows=4*(o+6+1),y=this.keySchedule=new Uint32Array(p),b=this.invKeySchedule=new Uint32Array(p),A=this.sBox,k=this.rcon,D=this.invSubMix,S=D[0],L=D[1],N=D[2],P=D[3];for(u=0;u<p;u++)u<o?f=y[u]=t[u]:(h=f,u%o==0?(h=A[(h=h<<8|h>>>24)>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[255&h],h^=k[u/o|0]<<24):o>6&&u%o==4&&(h=A[h>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[255&h]),y[u]=f=(y[u-o]^h)>>>0);for(c=0;c<p;c++)u=p-c,h=3&c?y[u]:y[u-4],b[c]=c<4||u<=4?h:S[A[h>>>24]]^L[A[h>>>16&255]]^N[A[h>>>8&255]]^P[A[255&h]],b[c]=b[c]>>>0}},s.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},s.decrypt=function(e,t,i){for(var r,o,u,c,f,h,p,y,b,A,k,D,S,L,N=this.keySize+6,P=this.invKeySchedule,V=this.invSBox,q=this.invSubMix,j=q[0],ee=q[1],z=q[2],X=q[3],ue=this.uint8ArrayToUint32Array_(i),ne=ue[0],Te=ue[1],Me=ue[2],_e=ue[3],De=new Int32Array(e),xe=new Int32Array(De.length),Ce=this.networkToHostOrderSwap;t<De.length;){for(b=Ce(De[t]),A=Ce(De[t+1]),k=Ce(De[t+2]),D=Ce(De[t+3]),f=b^P[0],h=D^P[1],p=k^P[2],y=A^P[3],S=4,L=1;L<N;L++)r=j[f>>>24]^ee[h>>16&255]^z[p>>8&255]^X[255&y]^P[S],o=j[h>>>24]^ee[p>>16&255]^z[y>>8&255]^X[255&f]^P[S+1],u=j[p>>>24]^ee[y>>16&255]^z[f>>8&255]^X[255&h]^P[S+2],c=j[y>>>24]^ee[f>>16&255]^z[h>>8&255]^X[255&p]^P[S+3],f=r,h=o,p=u,y=c,S+=4;r=V[f>>>24]<<24^V[h>>16&255]<<16^V[p>>8&255]<<8^V[255&y]^P[S],o=V[h>>>24]<<24^V[p>>16&255]<<16^V[y>>8&255]<<8^V[255&f]^P[S+1],u=V[p>>>24]<<24^V[y>>16&255]<<16^V[f>>8&255]<<8^V[255&h]^P[S+2],c=V[y>>>24]<<24^V[f>>16&255]<<16^V[h>>8&255]<<8^V[255&p]^P[S+3],xe[t]=Ce(r^ne),xe[t+1]=Ce(c^Te),xe[t+2]=Ce(u^Me),xe[t+3]=Ce(o^_e),ne=b,Te=A,Me=k,_e=D,t+=4}return xe.buffer},d}(),Di=function(){function d(e,t){var i=(t===void 0?{}:t).removePKCS7Padding,r=i===void 0||i;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=e.enableSoftwareAES,this.removePKCS7Padding=r,r)try{var o=self.crypto;o&&(this.subtle=o.subtle||o.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}var s=d.prototype;return s.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},s.isSync=function(){return this.useSoftware},s.flush=function(){var e=this.currentResult,t=this.remainderData;if(!e||t)return this.reset(),null;var i,r,o,u=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(r=(i=u).byteLength,(o=r&&new DataView(i.buffer).getUint8(r-1))?Li(i,0,r-o):i):u},s.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},s.decrypt=function(e,t,i){var r=this;return this.useSoftware?new Promise(function(o,u){r.softwareDecrypt(new Uint8Array(e),t,i);var c=r.flush();c?o(c.buffer):u(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)},s.softwareDecrypt=function(e,t,i){var r=this.currentIV,o=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(e=hr(u,e),this.remainderData=null);var c=this.getValidChunk(e);if(!c.length)return null;r&&(i=r);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new It),f.expandKey(t);var h=o;return this.currentResult=f.decrypt(c.buffer,0,i),this.currentIV=Li(c,-16).buffer,h||null},s.webCryptoDecrypt=function(e,t,i){var r=this,o=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new Lt(o,t)),this.fastAesKey.expandKey().then(function(u){return o?(r.logOnce("WebCrypto AES decrypt"),new qt(o,new Uint8Array(i)).decrypt(e.buffer,u)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(u){return H.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+u.name+": "+u.message),r.onWebCryptoError(e,t,i)})},s.onWebCryptoError=function(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);var r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},s.getValidChunk=function(e){var t=e,i=e.length-e.length%16;return i!==e.length&&(t=Li(e,0,i),this.remainderData=Li(e,i)),t},s.logOnce=function(e){this.logEnabled&&(H.log("[decrypter]: "+e),this.logEnabled=!1)},d}(),_a=function(d){for(var s="",e=d.length,t=0;t<e;t++)s+="["+d.start(t).toFixed(3)+"-"+d.end(t).toFixed(3)+"]";return s},Rt="STOPPED",Le="IDLE",gr="KEY_LOADING",Hr="FRAG_LOADING",Gr="FRAG_LOADING_WAITING_RETRY",Ta="WAITING_TRACK",yr="PARSING",No="PARSED",ss="ENDED",en="ERROR",os="WAITING_INIT_PTS",tn="WAITING_LEVEL",Vd=function(d){function s(t,i,r,o,u){var c;return(c=d.call(this)||this).hls=void 0,c.fragPrevious=null,c.fragCurrent=null,c.fragmentTracker=void 0,c.transmuxer=null,c._state=Rt,c.playlistType=void 0,c.media=null,c.mediaBuffer=null,c.config=void 0,c.bitrateTest=!1,c.lastCurrentTime=0,c.nextLoadPosition=0,c.startPosition=0,c.startTimeOffset=null,c.loadedmetadata=!1,c.retryDate=0,c.levels=null,c.fragmentLoader=void 0,c.keyLoader=void 0,c.levelLastLoaded=null,c.startFragRequested=!1,c.decrypter=void 0,c.initPTS=[],c.onvseeking=null,c.onvended=null,c.logPrefix="",c.log=void 0,c.warn=void 0,c.playlistType=u,c.logPrefix=o,c.log=H.log.bind(H,o+":"),c.warn=H.warn.bind(H,o+":"),c.hls=t,c.fragmentLoader=new Pt(t.config),c.keyLoader=r,c.fragmentTracker=i,c.config=t.config,c.decrypter=new Di(t.config),t.on(w.MANIFEST_LOADED,c.onManifestLoaded,function(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}(c)),c}Q(s,d);var e=s.prototype;return e.doTick=function(){this.onTickEnd()},e.onTickEnd=function(){},e.startLoad=function(t){},e.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var t=this.fragCurrent;t!=null&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Rt},e._streamEnded=function(t,i){if(i.live||t.nextStart||!t.end||!this.media)return!1;var r=i.partList;if(r!=null&&r.length){var o=r[r.length-1];return ce.isBuffered(this.media,o.start+o.duration/2)}var u=i.fragments[i.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(u)},e.getLevelDetails=function(){var t;if(this.levels&&this.levelLastLoaded!==null)return(t=this.levels[this.levelLastLoaded])==null?void 0:t.details},e.onMediaAttached=function(t,i){var r=this.media=this.mediaBuffer=i.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),r.addEventListener("seeking",this.onvseeking),r.addEventListener("ended",this.onvended);var o=this.config;this.levels&&o.autoStartLoad&&this.state===Rt&&this.startLoad(o.startPosition)},e.onMediaDetaching=function(){var t=this.media;t!=null&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&this.onvseeking&&this.onvended&&(t.removeEventListener("seeking",this.onvseeking),t.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()},e.onMediaSeeking=function(){var t=this.config,i=this.fragCurrent,r=this.media,o=this.mediaBuffer,u=this.state,c=r?r.currentTime:0,f=ce.bufferInfo(o||r,c,t.maxBufferHole);if(this.log("media seeking to "+(oe(c)?c.toFixed(3):c)+", state: "+u),this.state===ss)this.resetLoadingState();else if(i){var h=t.maxFragLookUpTolerance,p=i.start-h,y=i.start+i.duration+h;if(!f.len||y<f.start||p>f.end){var b=c>y;(c<p||b)&&(b&&i.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),i.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}r&&(this.fragmentTracker.removeFragmentsInRange(c,1/0,this.playlistType,!0),this.lastCurrentTime=c),this.loadedmetadata||f.len||(this.nextLoadPosition=this.startPosition=c),this.tickImmediate()},e.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},e.onManifestLoaded=function(t,i){this.startTimeOffset=i.startTimeOffset,this.initPTS=[]},e.onHandlerDestroying=function(){this.stopLoad(),d.prototype.onHandlerDestroying.call(this)},e.onHandlerDestroyed=function(){this.state=Rt,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,d.prototype.onHandlerDestroyed.call(this)},e.loadFragment=function(t,i,r){this._loadFragForPlayback(t,i,r)},e._loadFragForPlayback=function(t,i,r){var o=this;this._doFragLoad(t,i,r,function(u){if(o.fragContextChanged(t))return o.warn("Fragment "+t.sn+(u.part?" p: "+u.part.index:"")+" of level "+t.level+" was dropped during download."),void o.fragmentTracker.removeFragment(t);t.stats.chunkCount++,o._handleFragmentLoadProgress(u)}).then(function(u){if(u){var c=o.state;o.fragContextChanged(t)?(c===Hr||!o.fragCurrent&&c===yr)&&(o.fragmentTracker.removeFragment(t),o.state=Le):("payload"in u&&(o.log("Loaded fragment "+t.sn+" of level "+t.level),o.hls.trigger(w.FRAG_LOADED,u)),o._handleFragmentLoadComplete(u))}}).catch(function(u){o.state!==Rt&&o.state!==en&&(o.warn(u),o.resetFragmentLoading(t))})},e.clearTrackerIfNeeded=function(t){var i,r=this.fragmentTracker;if(r.getState(t)===Oe){var o=t.type,u=this.getFwdBufferInfo(this.mediaBuffer,o),c=Math.max(t.duration,u?u.len:this.config.maxBufferLength);this.reduceMaxBufferLength(c)&&r.removeFragment(t)}else((i=this.mediaBuffer)==null?void 0:i.buffered.length)===0?r.removeAllFragments():r.hasParts(t.type)&&(r.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),r.getState(t)===ye&&r.removeFragment(t))},e.flushMainBuffer=function(t,i,r){if(r===void 0&&(r=null),t-i){var o={startOffset:t,endOffset:i,type:r};this.hls.trigger(w.BUFFER_FLUSHING,o)}},e._loadInitSegment=function(t,i){var r=this;this._doFragLoad(t,i).then(function(o){if(!o||r.fragContextChanged(t)||!r.levels)throw new Error("init load aborted");return o}).then(function(o){var u=r.hls,c=o.payload,f=t.decryptdata;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var h=self.performance.now();return r.decrypter.decrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).catch(function(p){throw u.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:p,reason:p.message,frag:t}),p}).then(function(p){var y=self.performance.now();return u.trigger(w.FRAG_DECRYPTED,{frag:t,payload:p,stats:{tstart:h,tdecrypt:y}}),o.payload=p,o})}return o}).then(function(o){var u=r.fragCurrent,c=r.hls;if(!r.levels)throw new Error("init load aborted, missing levels");var f=t.stats;r.state=Le,i.fragmentError=0,t.data=new Uint8Array(o.payload),f.parsing.start=f.buffering.start=self.performance.now(),f.parsing.end=f.buffering.end=self.performance.now(),o.frag===u&&c.trigger(w.FRAG_BUFFERED,{stats:f,frag:u,part:null,id:t.type}),r.tick()}).catch(function(o){r.state!==Rt&&r.state!==en&&(r.warn(o),r.resetFragmentLoading(t))})},e.fragContextChanged=function(t){var i=this.fragCurrent;return!t||!i||t.level!==i.level||t.sn!==i.sn||t.urlId!==i.urlId},e.fragBufferedComplete=function(t,i){var r,o,u,c,f=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(i?" part: "+i.index:"")+" of "+(this.playlistType===et?"level":"track")+" "+t.level+" (frag:["+((r=t.startPTS)!=null?r:NaN).toFixed(3)+"-"+((o=t.endPTS)!=null?o:NaN).toFixed(3)+"] > buffer:"+(f?_a(ce.getBuffered(f)):"(detached)")+")"),this.state=Le,f&&(!this.loadedmetadata&&t.type==et&&f.buffered.length&&((u=this.fragCurrent)==null?void 0:u.sn)===((c=this.fragPrevious)==null?void 0:c.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},e.seekToStartPos=function(){},e._handleFragmentLoadComplete=function(t){var i=this.transmuxer;if(i){var r=t.frag,o=t.part,u=t.partsLoaded,c=!u||u.length===0||u.some(function(h){return!h}),f=new he(r.level,r.sn,r.stats.chunkCount+1,0,o?o.index:-1,!c);i.flush(f)}},e._handleFragmentLoadProgress=function(t){},e._doFragLoad=function(t,i,r,o){var u,c=this;r===void 0&&(r=null);var f=i==null?void 0:i.details;if(!this.levels||!f)throw new Error("frag load aborted, missing level"+(f?"":" detail")+"s");var h=null;if(!t.encrypted||(u=t.decryptdata)!=null&&u.key?!t.encrypted&&f.encryptedFragments.length&&this.keyLoader.loadClear(t,f.encryptedFragments):(this.log("Loading key for "+t.sn+" of ["+f.startSN+"-"+f.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+t.level),this.state=gr,this.fragCurrent=t,h=this.keyLoader.load(t).then(function(S){if(!c.fragContextChanged(S.frag))return c.hls.trigger(w.KEY_LOADED,S),c.state===gr&&(c.state=Le),S}),this.hls.trigger(w.KEY_LOADING,{frag:t}),this.fragCurrent===null&&(h=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),r=Math.max(t.start,r||0),this.config.lowLatencyMode&&t.sn!=="initSegment"){var p=f.partList;if(p&&o){r>t.end&&f.fragmentHint&&(t=f.fragmentHint);var y=this.getNextPart(p,t,r);if(y>-1){var b,A=p[y];return this.log("Loading part sn: "+t.sn+" p: "+A.index+" cc: "+t.cc+" of playlist ["+f.startSN+"-"+f.endSN+"] parts [0-"+y+"-"+(p.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),this.nextLoadPosition=A.start+A.duration,this.state=Hr,b=h?h.then(function(S){return!S||c.fragContextChanged(S.frag)?null:c.doFragPartsLoad(t,A,i,o)}).catch(function(S){return c.handleFragLoadError(S)}):this.doFragPartsLoad(t,A,i,o).catch(function(S){return c.handleFragLoadError(S)}),this.hls.trigger(w.FRAG_LOADING,{frag:t,part:A,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):b}if(!t.url||this.loadedEndOfParts(p,r))return Promise.resolve(null)}}this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(f?"of ["+f.startSN+"-"+f.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),oe(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=Hr;var k,D=this.config.progressive;return k=D&&h?h.then(function(S){return!S||c.fragContextChanged(S==null?void 0:S.frag)?null:c.fragmentLoader.load(t,o)}).catch(function(S){return c.handleFragLoadError(S)}):Promise.all([this.fragmentLoader.load(t,D?o:void 0),h]).then(function(S){var L=S[0];return!D&&L&&o&&o(L),L}).catch(function(S){return c.handleFragLoadError(S)}),this.hls.trigger(w.FRAG_LOADING,{frag:t,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):k},e.doFragPartsLoad=function(t,i,r,o){var u=this;return new Promise(function(c,f){var h,p=[],y=(h=r.details)==null?void 0:h.partList;(function b(A){u.fragmentLoader.loadPart(t,A,o).then(function(k){p[A.index]=k;var D=k.part;u.hls.trigger(w.FRAG_LOADED,k);var S=Co(r,t.sn,A.index+1)||Mo(y,t.sn,A.index+1);if(!S)return c({frag:t,part:D,partsLoaded:p});b(S)}).catch(f)})(i)})},e.handleFragLoadError=function(t){if("data"in t){var i=t.data;t.data&&i.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(i.frag,i.part):this.hls.trigger(w.ERROR,i)}else this.hls.trigger(w.ERROR,{type:le.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null},e._handleTransmuxerFlush=function(t){var i=this.getCurrentContext(t);if(i&&this.state===yr){var r=i.frag,o=i.part,u=i.level,c=self.performance.now();r.stats.parsing.end=c,o&&(o.stats.parsing.end=c),this.updateLevelTiming(r,o,u,t.partial)}else this.fragCurrent||this.state===Rt||this.state===en||(this.state=Le)},e.getCurrentContext=function(t){var i=this.levels,r=this.fragCurrent,o=t.level,u=t.sn,c=t.part;if(i==null||!i[o])return this.warn("Levels object was unset while buffering fragment "+u+" of level "+o+". The current chunk will not be buffered."),null;var f=i[o],h=c>-1?Co(f,u,c):null,p=h?h.fragment:function(y,b,A){if(y==null||!y.details)return null;var k=y.details,D=k.fragments[b-k.startSN];return D||((D=k.fragmentHint)&&D.sn===b?D:b<k.startSN&&A&&A.sn===b?A:null)}(f,u,r);return p?(r&&r!==p&&(p.stats=r.stats),{frag:p,part:h,level:f}):null},e.bufferFragmentData=function(t,i,r,o){var u;if(t&&this.state===yr){var c=t.data1,f=t.data2,h=c;if(c&&f&&(h=hr(c,f)),(u=h)!=null&&u.length){var p={type:t.type,frag:i,part:r,chunkMeta:o,parent:i.type,data:h};this.hls.trigger(w.BUFFER_APPENDING,p),t.dropped&&t.independent&&!r&&this.flushBufferGap(i)}}},e.flushBufferGap=function(t){var i=this.media;if(i)if(ce.isBuffered(i,i.currentTime)){var r=i.currentTime,o=ce.bufferInfo(i,r,0),u=t.duration,c=Math.min(2*this.config.maxFragLookUpTolerance,.25*u),f=Math.max(Math.min(t.start-c,o.end-c),r+c);t.start-f>c&&this.flushMainBuffer(f,t.start)}else this.flushMainBuffer(0,t.start)},e.getFwdBufferInfo=function(t,i){var r=this.getLoadPosition();return oe(r)?this.getFwdBufferInfoAtPos(t,r,i):null},e.getFwdBufferInfoAtPos=function(t,i,r){var o=this.config.maxBufferHole,u=ce.bufferInfo(t,i,o);if(u.len===0&&u.nextStart!==void 0){var c=this.fragmentTracker.getBufferedFrag(i,r);if(c&&u.nextStart<c.end)return ce.bufferInfo(t,i,Math.max(u.nextStart,o))}return u},e.getMaxBufferLength=function(t){var i,r=this.config;return i=t?Math.max(8*r.maxBufferSize/t,r.maxBufferLength):r.maxBufferLength,Math.min(i,r.maxMaxBufferLength)},e.reduceMaxBufferLength=function(t){var i=this.config,r=t||i.maxBufferLength;return i.maxMaxBufferLength>=r&&(i.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+i.maxMaxBufferLength+"s"),!0)},e.getAppendedFrag=function(t,i){var r=this.fragmentTracker.getAppendedFrag(t,et);return r&&"fragment"in r?r.fragment:r},e.getNextFragment=function(t,i){var r=i.fragments,o=r.length;if(!o)return null;var u,c=this.config,f=r[0].start;if(i.live){var h=c.initialLiveManifestSize;if(o<h)return this.warn("Not enough fragments to start playback (have: "+o+", need: "+h+")"),null;i.PTSKnown||this.startFragRequested||this.startPosition!==-1||(u=this.getInitialLiveFragment(i,r),this.startPosition=u?this.hls.liveSyncPosition||u.start:t)}else t<=f&&(u=r[0]);if(!u){var p=c.lowLatencyMode?i.partEnd:i.fragmentEnd;u=this.getFragmentAtPosition(t,p,i)}return this.mapToInitFragWhenRequired(u)},e.isLoopLoading=function(t,i){var r=this.fragmentTracker.getState(t);return(r===Se||r===ye&&!!t.gap)&&this.nextLoadPosition>i},e.getNextFragmentLoopLoading=function(t,i,r,o,u){var c=t.gap,f=this.getNextFragment(this.nextLoadPosition,i);if(f===null)return f;if(t=f,c&&t&&!t.gap&&r.nextStart){var h=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,o);if(h!==null&&r.len+h.len>=u)return this.log('buffer full after gaps in "'+o+'" playlist starting at sn: '+t.sn),null}return t},e.mapToInitFragWhenRequired=function(t){return t==null||!t.initSegment||t!=null&&t.initSegment.data||this.bitrateTest?t:t.initSegment},e.getNextPart=function(t,i,r){for(var o=-1,u=!1,c=!0,f=0,h=t.length;f<h;f++){var p=t[f];if(c=c&&!p.independent,o>-1&&r<p.start)break;var y=p.loaded;y?o=-1:(u||p.independent||c)&&p.fragment===i&&(o=f),u=y}return o},e.loadedEndOfParts=function(t,i){var r=t[t.length-1];return r&&i>r.start&&r.loaded},e.getInitialLiveFragment=function(t,i){var r=this.fragPrevious,o=null;if(r){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),o=function(h,p,y){if(p===null||!Array.isArray(h)||!h.length||!oe(p)||p<(h[0].programDateTime||0)||p>=(h[h.length-1].endProgramDateTime||0))return null;y=y||0;for(var b=0;b<h.length;++b){var A=h[b];if(fi(p,y,A))return A}return null}(i,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!o){var u=r.sn+1;if(u>=t.startSN&&u<=t.endSN){var c=i[u-t.startSN];r.cc===c.cc&&(o=c,this.log("Live playlist, switching playlist, load frag with next SN: "+o.sn))}o||(o=function(h,p){return Oo(h,function(y){return y.cc<p?1:y.cc>p?-1:0})}(i,r.cc),o&&this.log("Live playlist, switching playlist, load frag with same CC: "+o.sn))}}else{var f=this.hls.liveSyncPosition;f!==null&&(o=this.getFragmentAtPosition(f,this.bitrateTest?t.fragmentEnd:t.edge,t))}return o},e.getFragmentAtPosition=function(t,i,r){var o,u=this.config,c=this.fragPrevious,f=r.fragments,h=r.endSN,p=r.fragmentHint,y=u.maxFragLookUpTolerance,b=r.partList,A=!!(u.lowLatencyMode&&b!=null&&b.length&&p);if(A&&p&&!this.bitrateTest&&(f=f.concat(p),h=p.sn),o=t<i?ba(c,f,t,t>i-y?0:y):f[f.length-1]){var k=o.sn-r.startSN,D=this.fragmentTracker.getState(o);if((D===Se||D===ye&&o.gap)&&(c=o),c&&o.sn===c.sn&&(!A||b[0].fragment.sn>o.sn)&&c&&o.level===c.level){var S=f[k+1];o=o.sn<h&&this.fragmentTracker.getState(S)!==Se?S:null}}return o},e.synchronizeToLiveEdge=function(t){var i=this.config,r=this.media;if(r){var o=this.hls.liveSyncPosition,u=r.currentTime,c=t.fragments[0].start,f=t.edge,h=u>=c-i.maxFragLookUpTolerance&&u<=f;if(o!==null&&r.duration>o&&(u<o||!h)){var p=i.liveMaxLatencyDuration!==void 0?i.liveMaxLatencyDuration:i.liveMaxLatencyDurationCount*t.targetduration;(!h&&r.readyState<4||u<f-p)&&(this.loadedmetadata||(this.nextLoadPosition=o),r.readyState&&(this.warn("Playback: "+u.toFixed(3)+" is located too far from the end of live sliding playlist: "+f+", reset currentTime to : "+o.toFixed(3)),r.currentTime=o))}}},e.alignPlaylists=function(t,i){var r=this.levels,o=this.levelLastLoaded,u=this.fragPrevious,c=o!==null?r[o]:null,f=t.fragments.length;if(!f)return this.warn("No fragments in live playlist"),0;var h=t.fragments[0].start,p=!i,y=t.alignedSliding&&oe(h);if(p||!y&&!h){Zt(u,c,t);var b=t.fragments[0].start;return this.log("Live playlist sliding: "+b.toFixed(2)+" start-sn: "+(i?i.startSN:"na")+"->"+t.startSN+" prev-sn: "+(u?u.sn:"na")+" fragments: "+f),b}return h},e.waitForCdnTuneIn=function(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)},e.setStartPosition=function(t,i){var r=this.startPosition;if(r<i&&(r=-1),r===-1||this.lastCurrentTime===-1){var o=this.startTimeOffset!==null,u=o?this.startTimeOffset:t.startTimeOffset;u!==null&&oe(u)?(r=i+u,u<0&&(r+=t.totalduration),r=Math.min(Math.max(i,r),i+t.totalduration),this.log("Start time offset "+u+" found in "+(o?"multivariant":"media")+" playlist, adjust startPosition to "+r),this.startPosition=r):t.live?r=this.hls.liveSyncPosition||i:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r},e.getLoadPosition=function(){var t=this.media,i=0;return this.loadedmetadata&&t?i=t.currentTime:this.nextLoadPosition&&(i=this.nextLoadPosition),i},e.handleFragLoadAborted=function(t,i){this.transmuxer&&t.sn!=="initSegment"&&t.stats.aborted&&(this.warn("Fragment "+t.sn+(i?" part "+i.index:"")+" of level "+t.level+" was aborted"),this.resetFragmentLoading(t))},e.resetFragmentLoading=function(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===Gr)||(this.state=Le)},e.onFragmentOrKeyLoadError=function(t,i){if(i.chunkMeta&&!i.frag){var r=this.getCurrentContext(i.chunkMeta);r&&(i.frag=r.frag)}var o=i.frag;if(o&&o.type===t&&this.levels)if(this.fragContextChanged(o)){var u;this.warn("Frag load error must match current frag to retry "+o.url+" > "+((u=this.fragCurrent)==null?void 0:u.url))}else{var c=i.details===$.FRAG_GAP;c&&this.fragmentTracker.fragBuffered(o,!0);var f=i.errorAction,h=f||{},p=h.action,y=h.retryCount,b=y===void 0?0:y,A=h.retryConfig;if(f&&p===g&&A){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var k=as(A,b);this.warn("Fragment "+o.sn+" of "+t+" "+o.level+" errored with "+i.details+", retrying loading "+(b+1)+"/"+A.maxNumRetry+" in "+k+"ms"),f.resolved=!0,this.retryDate=self.performance.now()+k,this.state=Gr}else A&&f?(this.resetFragmentErrors(t),b<A.maxNumRetry?c||(f.resolved=!0):H.warn(i.details+" reached or exceeded max retry ("+b+")")):this.state=en;this.tickImmediate()}},e.reduceLengthAndFlushBuffer=function(t){if(this.state===yr||this.state===No){var i=t.parent,r=this.getFwdBufferInfo(this.mediaBuffer,i),o=r&&r.len>.5;o&&this.reduceMaxBufferLength(r.len);var u=!o;return u&&this.warn("Buffer full error while media.currentTime is not buffered, flush "+i+" buffer"),t.frag&&(this.fragmentTracker.removeFragment(t.frag),this.nextLoadPosition=t.frag.start),this.resetLoadingState(),u}return!1},e.resetFragmentErrors=function(t){t===_i&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Rt&&(this.state=Le)},e.afterBufferFlushed=function(t,i,r){if(t){var o=ce.getBuffered(t);this.fragmentTracker.detectEvictedFragments(i,o,r),this.state===ss&&this.resetLoadingState()}},e.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Le},e.resetStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=!1;var i=this.levels?this.levels[t].details:null;i!=null&&i.live?(this.startPosition=-1,this.setStartPosition(i,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},e.resetWhenMissingContext=function(t){this.warn("The loading context changed while buffering fragment "+t.sn+" of level "+t.level+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(t.level),this.resetLoadingState()},e.removeUnbufferedFrags=function(t){t===void 0&&(t=0),this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)},e.updateLevelTiming=function(t,i,r,o){var u,c=this,f=r.details;if(f){if(Object.keys(t.elementaryStreams).reduce(function(p,y){var b=t.elementaryStreams[y];if(b){var A=b.endPTS-b.startPTS;if(A<=0)return c.warn("Could not parse fragment "+t.sn+" "+y+" duration reliably ("+A+")"),p||!1;var k=o?0:ya(f,t,b.startPTS,b.endPTS,b.startDTS,b.endDTS);return c.hls.trigger(w.LEVEL_PTS_UPDATED,{details:f,level:r,drift:k,type:y,frag:t,start:b.startPTS,end:b.endPTS}),!0}return p},!1))r.fragmentError=0;else if(((u=this.transmuxer)==null?void 0:u.error)===null){var h=new Error("Found no media in fragment "+t.sn+" of level "+r.id+" resetting transmuxer to fallback to playlist timing");if(this.warn(h.message),this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:h,frag:t,reason:"Found no media in msn "+t.sn+' of level "'+r.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=No,this.hls.trigger(w.FRAG_PARSED,{frag:t,part:i})}else this.warn("level.details undefined")},e.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},e.recoverWorkerError=function(t){t.event==="demuxerWorker"&&(this.resetTransmuxer(),this.resetLoadingState())},M(s,[{key:"state",get:function(){return this._state},set:function(t){var i=this._state;i!==t&&(this._state=t,this.log(i+"->"+t))}}]),s}(Ze);function Eh(){return self.SourceBuffer||self.WebKitSourceBuffer}function er(d,s){return d===void 0&&(d=""),s===void 0&&(s=9e4),{type:d,id:-1,pid:-1,inputTimeScale:s,sequenceNumber:-1,samples:[],dropped:0}}var bh=function(){function d(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var s=d.prototype;return s.resetInitSegment=function(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},s.resetTimeStamp=function(e){this.initPTS=e,this.resetContiguity()},s.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},s.canParse=function(e,t){return!1},s.appendFrame=function(e,t,i){},s.demux=function(e,t){this.cachedData&&(e=hr(this.cachedData,e),this.cachedData=null);var i,r=la(e,0),o=r?r.length:0,u=this._audioTrack,c=this._id3Track,f=r?function(b){for(var A=Gn(b),k=0;k<A.length;k++){var D=A[k];if(lo(D))return ho(D)}}(r):void 0,h=e.length;for((this.basePTS===null||this.frameIndex===0&&oe(f))&&(this.basePTS=kv(f,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),r&&r.length>0&&c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:ma,duration:Number.POSITIVE_INFINITY});o<h;){if(this.canParse(e,o)){var p=this.appendFrame(u,e,o);p?(this.frameIndex++,this.lastPTS=p.sample.pts,i=o+=p.length):o=h}else oo(e,o)?(r=la(e,o),c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:ma,duration:Number.POSITIVE_INFINITY}),i=o+=r.length):o++;if(o===h&&i!==h){var y=Li(e,i);this.cachedData?this.cachedData=hr(this.cachedData,y):this.cachedData=y}}return{audioTrack:u,videoTrack:er(),id3Track:c,textTrack:er()}},s.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},s.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:er(),id3Track:this._id3Track,textTrack:er()}},s.destroy=function(){},d}(),kv=function(d,s,e){return oe(d)?90*d:9e4*s+(e?9e4*e.baseTime/e.timescale:0)};function _h(d,s){return d[s]===255&&(246&d[s+1])==240}function Th(d,s){return 1&d[s+1]?7:9}function Kd(d,s){return(3&d[s+3])<<11|d[s+4]<<3|(224&d[s+5])>>>5}function Fo(d,s){return s+1<d.length&&_h(d,s)}function wv(d,s){if(Fo(d,s)){var e=Th(d,s);if(s+e>=d.length)return!1;var t=Kd(d,s);if(t<=e)return!1;var i=s+t;return i===d.length||Fo(d,i)}return!1}function Ah(d,s,e,t,i){if(!d.samplerate){var r=function(o,u,c,f){var h,p,y,b,A=navigator.userAgent.toLowerCase(),k=f,D=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=1+((192&u[c+2])>>>6);var S=(60&u[c+2])>>>2;if(!(S>D.length-1))return y=(1&u[c+2])<<2,y|=(192&u[c+3])>>>6,H.log("manifest codec:"+f+", ADTS type:"+h+", samplingIndex:"+S),/firefox/i.test(A)?S>=6?(h=5,b=new Array(4),p=S-3):(h=2,b=new Array(2),p=S):A.indexOf("android")!==-1?(h=2,b=new Array(2),p=S):(h=5,b=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&S>=6?p=S-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(S>=6&&y===1||/vivaldi/i.test(A))||!f&&y===1)&&(h=2,b=new Array(2)),p=S)),b[0]=h<<3,b[0]|=(14&S)>>1,b[1]|=(1&S)<<7,b[1]|=y<<3,h===5&&(b[1]|=(14&p)>>1,b[2]=(1&p)<<7,b[2]|=8,b[3]=0),{config:b,samplerate:D[S],channelCount:y,codec:"mp4a.40."+h,manifestCodec:k};o.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+S})}(s,e,t,i);if(!r)return;d.config=r.config,d.samplerate=r.samplerate,d.channelCount=r.channelCount,d.codec=r.codec,d.manifestCodec=r.manifestCodec,H.log("parsed codec:"+d.codec+", rate:"+r.samplerate+", channels:"+r.channelCount)}}function Sh(d){return 9216e4/d}function kh(d,s,e,t,i){var r,o=t+i*Sh(d.samplerate),u=function(A,k){var D=Th(A,k);if(k+D<=A.length){var S=Kd(A,k)-D;if(S>0)return{headerLength:D,frameLength:S}}}(s,e);if(u){var c=u.frameLength,f=u.headerLength,h=f+c,p=Math.max(0,e+h-s.length);p?(r=new Uint8Array(h-f)).set(s.subarray(e+f,s.length),0):r=s.subarray(e+f,e+h);var y={unit:r,pts:o};return p||d.samples.push(y),{sample:y,length:h,missing:p}}var b=s.length-e;return(r=new Uint8Array(b)).set(s.subarray(e,s.length),0),{sample:{unit:r,pts:o},length:b,missing:-1}}var Lv=function(d){function s(t,i){var r;return(r=d.call(this)||this).observer=void 0,r.config=void 0,r.observer=t,r.config=i,r}Q(s,d);var e=s.prototype;return e.resetInitSegment=function(t,i,r,o){d.prototype.resetInitSegment.call(this,t,i,r,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:i,duration:o,inputTimeScale:9e4,dropped:0}},s.probe=function(t){if(!t)return!1;for(var i=(la(t,0)||[]).length,r=t.length;i<r;i++)if(wv(t,i))return H.log("ADTS sync word found !"),!0;return!1},e.canParse=function(t,i){return function(r,o){return function(u,c){return c+5<u.length}(r,o)&&_h(r,o)&&Kd(r,o)<=r.length-o}(t,i)},e.appendFrame=function(t,i,r){Ah(t,this.observer,i,r,t.manifestCodec);var o=kh(t,i,r,this.basePTS,this.frameIndex);if(o&&o.missing===0)return o},s}(bh),Iv=/\/emsg[-/]ID3/i,Rv=function(){function d(e,t){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=t}var s=d.prototype;return s.resetTimeStamp=function(){},s.resetInitSegment=function(e,t,i,r){var o=this.videoTrack=er("video",1),u=this.audioTrack=er("audio",1),c=this.txtTrack=er("text",1);if(this.id3Track=er("id3",1),this.timeOffset=0,e!=null&&e.byteLength){var f=Wn(e);if(f.video){var h=f.video,p=h.id,y=h.timescale,b=h.codec;o.id=p,o.timescale=c.timescale=y,o.codec=b}if(f.audio){var A=f.audio,k=A.id,D=A.timescale,S=A.codec;u.id=k,u.timescale=D,u.codec=S}c.id=fo.text,o.sampleDuration=0,o.duration=u.duration=r}},s.resetContiguity=function(){this.remainderData=null},d.probe=function(e){return ze(e=e.length>16384?e.subarray(0,16384):e,["moof"]).length>0},s.demux=function(e,t){this.timeOffset=t;var i=e,r=this.videoTrack,o=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=hr(this.remainderData,e));var u=function(f){var h={valid:null,remainder:null},p=ze(f,["moof"]);if(!p)return h;if(p.length<2)return h.remainder=f,h;var y=p[p.length-1];return h.valid=Li(f,0,y.byteOffset-8),h.remainder=Li(f,y.byteOffset-8),h}(i);this.remainderData=u.remainder,r.samples=u.valid||new Uint8Array}else r.samples=i;var c=this.extractID3Track(r,t);return o.samples=Yn(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:c,textTrack:this.txtTrack}},s.flush=function(){var e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;var r=this.extractID3Track(t,this.timeOffset);return i.samples=Yn(e,t),{videoTrack:t,audioTrack:er(),id3Track:r,textTrack:er()}},s.extractID3Track=function(e,t){var i=this.id3Track;if(e.samples.length){var r=ze(e.samples,["emsg"]);r&&r.forEach(function(o){var u=function(p){var y=p[0],b="",A="",k=0,D=0,S=0,L=0,N=0,P=0;if(y===0){for(;At(p.subarray(P,P+1))!=="\0";)b+=At(p.subarray(P,P+1)),P+=1;for(b+=At(p.subarray(P,P+1)),P+=1;At(p.subarray(P,P+1))!=="\0";)A+=At(p.subarray(P,P+1)),P+=1;A+=At(p.subarray(P,P+1)),P+=1,k=Fe(p,12),D=Fe(p,16),L=Fe(p,20),N=Fe(p,24),P=28}else if(y===1){k=Fe(p,P+=4);var V=Fe(p,P+=4),q=Fe(p,P+=4);for(P+=4,S=Math.pow(2,32)*V+q,Number.isSafeInteger(S)||(S=Number.MAX_SAFE_INTEGER,H.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),L=Fe(p,P),N=Fe(p,P+=4),P+=4;At(p.subarray(P,P+1))!=="\0";)b+=At(p.subarray(P,P+1)),P+=1;for(b+=At(p.subarray(P,P+1)),P+=1;At(p.subarray(P,P+1))!=="\0";)A+=At(p.subarray(P,P+1)),P+=1;A+=At(p.subarray(P,P+1)),P+=1}return{schemeIdUri:b,value:A,timeScale:k,presentationTime:S,presentationTimeDelta:D,eventDuration:L,id:N,payload:p.subarray(P,p.byteLength)}}(o);if(Iv.test(u.schemeIdUri)){var c=oe(u.presentationTime)?u.presentationTime/u.timeScale:t+u.presentationTimeDelta/u.timeScale,f=u.eventDuration===4294967295?Number.POSITIVE_INFINITY:u.eventDuration/u.timeScale;f<=.001&&(f=Number.POSITIVE_INFINITY);var h=u.payload;i.samples.push({data:h,len:h.byteLength,dts:c,pts:c,type:pr,duration:f})}})}return i},s.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},s.destroy=function(){},d}(),Uo=null,Dv=[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],Cv=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Mv=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],xv=[0,1,1,4];function wh(d,s,e,t,i){if(!(e+24>s.length)){var r=Lh(s,e);if(r&&e+r.frameLength<=s.length){var o=t+i*(9e4*r.samplesPerFrame/r.sampleRate),u={unit:s.subarray(e,e+r.frameLength),pts:o,dts:o};return d.config=[],d.channelCount=r.channelCount,d.samplerate=r.sampleRate,d.samples.push(u),{sample:u,length:r.frameLength,missing:0}}}}function Lh(d,s){var e=d[s+1]>>3&3,t=d[s+1]>>1&3,i=d[s+2]>>4&15,r=d[s+2]>>2&3;if(e!==1&&i!==0&&i!==15&&r!==3){var o=d[s+2]>>1&1,u=d[s+3]>>6,c=1e3*Dv[14*(e===3?3-t:t===3?3:4)+i-1],f=Cv[3*(e===3?0:e===2?1:2)+r],h=u===3?1:2,p=Mv[e][t],y=xv[t],b=8*p*y,A=Math.floor(p*c/f+o)*y;if(Uo===null){var k=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Uo=k?parseInt(k[1]):0}return!!Uo&&Uo<=87&&t===2&&c>=224e3&&u===0&&(d[s+3]=128|d[s+3]),{sampleRate:f,channelCount:h,frameLength:A,samplesPerFrame:b}}}function Wd(d,s){return d[s]===255&&(224&d[s+1])==224&&(6&d[s+1])!=0}function Ih(d,s){return s+1<d.length&&Wd(d,s)}function Pv(d,s){if(s+1<d.length&&Wd(d,s)){var e=Lh(d,s),t=4;e!=null&&e.frameLength&&(t=e.frameLength);var i=s+t;return i===d.length||Ih(d,i)}return!1}var Rh=function(){function d(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var s=d.prototype;return s.loadWord=function(){var e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),o=Math.min(4,t);if(o===0)throw new Error("no bytes available");r.set(e.subarray(i,i+o)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*o,this.bytesAvailable-=o},s.skipBits=function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},s.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;if(e>32&&H.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?i<<t|this.readBits(t):i},s.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!=0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},s.skipUEG=function(){this.skipBits(1+this.skipLZ())},s.skipEG=function(){this.skipBits(1+this.skipLZ())},s.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},s.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},s.readBoolean=function(){return this.readBits(1)===1},s.readUByte=function(){return this.readBits(8)},s.readUShort=function(){return this.readBits(16)},s.readUInt=function(){return this.readBits(32)},s.skipScalingList=function(e){for(var t=8,i=8,r=0;r<e;r++)i!==0&&(i=(t+this.readEG()+256)%256),t=i===0?t:i},s.readSPS=function(){var e,t,i,r=0,o=0,u=0,c=0,f=this.readUByte.bind(this),h=this.readBits.bind(this),p=this.readUEG.bind(this),y=this.readBoolean.bind(this),b=this.skipBits.bind(this),A=this.skipEG.bind(this),k=this.skipUEG.bind(this),D=this.skipScalingList.bind(this);f();var S=f();if(h(5),b(3),f(),k(),S===100||S===110||S===122||S===244||S===44||S===83||S===86||S===118||S===128){var L=p();if(L===3&&b(1),k(),k(),b(1),y())for(t=L!==3?8:12,i=0;i<t;i++)y()&&D(i<6?16:64)}k();var N=p();if(N===0)p();else if(N===1)for(b(1),A(),A(),e=p(),i=0;i<e;i++)A();k(),b(1);var P=p(),V=p(),q=h(1);q===0&&b(1),b(1),y()&&(r=p(),o=p(),u=p(),c=p());var j=[1,1];if(y()&&y())switch(f()){case 1:j=[1,1];break;case 2:j=[12,11];break;case 3:j=[10,11];break;case 4:j=[16,11];break;case 5:j=[40,33];break;case 6:j=[24,11];break;case 7:j=[20,11];break;case 8:j=[32,11];break;case 9:j=[80,33];break;case 10:j=[18,11];break;case 11:j=[15,11];break;case 12:j=[64,33];break;case 13:j=[160,99];break;case 14:j=[4,3];break;case 15:j=[3,2];break;case 16:j=[2,1];break;case 255:j=[f()<<8|f(),f()<<8|f()]}return{width:Math.ceil(16*(P+1)-2*r-2*o),height:(2-q)*(V+1)*16-(q?2:4)*(u+c),pixelRatio:j}},s.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},d}(),Ov=function(){function d(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Di(t,{removePKCS7Padding:!1})}var s=d.prototype;return s.decryptBuffer=function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)},s.decryptAacSample=function(e,t,i){var r=this,o=e[t].unit;if(!(o.length<=16)){var u=o.subarray(16,o.length-o.length%16),c=u.buffer.slice(u.byteOffset,u.byteOffset+u.length);this.decryptBuffer(c).then(function(f){var h=new Uint8Array(f);o.set(h,16),r.decrypter.isSync()||r.decryptAacSamples(e,t+1,i)})}},s.decryptAacSamples=function(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,i),this.decrypter.isSync())))return}},s.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),r=0,o=32;o<e.length-16;o+=160,r+=16)i.set(e.subarray(o,o+16),r);return i},s.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),r=0,o=32;o<e.length-16;o+=160,r+=16)e.set(i.subarray(r,r+16),o);return e},s.decryptAvcSample=function(e,t,i,r,o){var u=this,c=yo(o.data),f=this.getAvcEncryptedData(c);this.decryptBuffer(f.buffer).then(function(h){o.data=u.getAvcDecryptedUnit(c,h),u.decrypter.isSync()||u.decryptAvcSamples(e,t,i+1,r)})},s.decryptAvcSamples=function(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();for(var o=e[t].units;!(i>=o.length);i++){var u=o[i];if(!(u.data.length<=48||u.type!==1&&u.type!==5||(this.decryptAvcSample(e,t,i,r,u),this.decrypter.isSync())))return}}},d}(),Ti=188,Nv=function(){function d(e,t,i){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=e,this.config=t,this.typeSupported=i}d.probe=function(e){var t=d.syncOffset(e);return t>0&&H.warn("MPEG2-TS detected but first sync word found @ offset "+t),t!==-1},d.syncOffset=function(e){for(var t=e.length,i=Math.min(940,e.length-Ti)+1,r=0;r<i;){for(var o=!1,u=r;u<t&&e[u]===71;u+=Ti)if(o||qd(e,u)!==0||(o=!0),o&&u+Ti>i)return r;r++}return-1},d.createTrack=function(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:fo[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}};var s=d.prototype;return s.resetInitSegment=function(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video"),this._audioTrack=d.createTrack("audio",r),this._id3Track=d.createTrack("id3"),this._txtTrack=d.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r},s.resetTimeStamp=function(){},s.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,i=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},s.demux=function(e,t,i,r){var o;i===void 0&&(i=!1),r===void 0&&(r=!1),i||(this.sampleAes=null);var u=this._avcTrack,c=this._audioTrack,f=this._id3Track,h=this._txtTrack,p=u.pid,y=u.pesData,b=c.pid,A=f.pid,k=c.pesData,D=f.pesData,S=null,L=this.pmtParsed,N=this._pmtId,P=e.length;if(this.remainderData&&(P=(e=hr(this.remainderData,e)).length,this.remainderData=null),P<Ti&&!r)return this.remainderData=e,{audioTrack:c,videoTrack:u,id3Track:f,textTrack:h};var V=Math.max(0,d.syncOffset(e));(P-=(P-V)%Ti)<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,P,e.buffer.byteLength-P));for(var q=0,j=V;j<P;j+=Ti)if(e[j]===71){var ee=!!(64&e[j+1]),z=qd(e,j),X=void 0;if((48&e[j+3])>>4>1){if((X=j+5+e[j+4])===j+Ti)continue}else X=j+4;switch(z){case p:ee&&(y&&(o=rn(y))&&this.parseAVCPES(u,h,o,!1),y={data:[],size:0}),y&&(y.data.push(e.subarray(X,j+Ti)),y.size+=j+Ti-X);break;case b:if(ee){if(k&&(o=rn(k)))switch(c.segmentCodec){case"aac":this.parseAACPES(c,o);break;case"mp3":this.parseMPEGPES(c,o)}k={data:[],size:0}}k&&(k.data.push(e.subarray(X,j+Ti)),k.size+=j+Ti-X);break;case A:ee&&(D&&(o=rn(D))&&this.parseID3PES(f,o),D={data:[],size:0}),D&&(D.data.push(e.subarray(X,j+Ti)),D.size+=j+Ti-X);break;case 0:ee&&(X+=e[X]+1),N=this._pmtId=Fv(e,X);break;case N:ee&&(X+=e[X]+1);var ue=Uv(e,X,this.typeSupported,i);(p=ue.avc)>0&&(u.pid=p),(b=ue.audio)>0&&(c.pid=b,c.segmentCodec=ue.segmentCodec),(A=ue.id3)>0&&(f.pid=A),S===null||L||(H.warn("MPEG-TS PMT found at "+j+" after unknown PID '"+S+"'. Backtracking to sync byte @"+V+" to parse all TS packets."),S=null,j=V-188),L=this.pmtParsed=!0;break;case 17:case 8191:break;default:S=z}}else q++;if(q>0){var ne=new Error("Found "+q+" TS packet/s that do not start with 0x47");this.observer.emit(w.ERROR,w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:ne,reason:ne.message})}u.pesData=y,c.pesData=k,f.pesData=D;var Te={audioTrack:c,videoTrack:u,id3Track:f,textTrack:h};return r&&this.extractRemainingSamples(Te),Te},s.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},s.extractRemainingSamples=function(e){var t,i=e.audioTrack,r=e.videoTrack,o=e.id3Track,u=e.textTrack,c=r.pesData,f=i.pesData,h=o.pesData;if(c&&(t=rn(c))?(this.parseAVCPES(r,u,t,!0),r.pesData=null):r.pesData=c,f&&(t=rn(f))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,t);break;case"mp3":this.parseMPEGPES(i,t)}i.pesData=null}else f!=null&&f.size&&H.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=f;h&&(t=rn(h))?(this.parseID3PES(o,t),o.pesData=null):o.pesData=h},s.demuxSampleAes=function(e,t,i){var r=this.demux(e,i,!0,!this.config.progressive),o=this.sampleAes=new Ov(this.observer,this.config,t);return this.decrypt(r,o)},s.decrypt=function(e,t){return new Promise(function(i){var r=e.audioTrack,o=e.videoTrack;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,function(){o.samples?t.decryptAvcSamples(o.samples,0,0,function(){i(e)}):i(e)}):o.samples&&t.decryptAvcSamples(o.samples,0,0,function(){i(e)})})},s.destroy=function(){this._duration=0},s.parseAVCPES=function(e,t,i,r){var o,u=this,c=this.parseAVCNALu(e,i.data),f=this.avcSample,h=!1;i.data=null,f&&c.length&&!e.audFound&&(Yd(f,e),f=this.avcSample=Bo(!1,i.pts,i.dts,"")),c.forEach(function(p){switch(p.type){case 1:o=!0,f||(f=u.avcSample=Bo(!0,i.pts,i.dts,"")),f.frame=!0;var y=p.data;if(h&&y.length>4){var b=new Rh(y).readSliceType();b!==2&&b!==4&&b!==7&&b!==9||(f.key=!0)}break;case 5:o=!0,f||(f=u.avcSample=Bo(!0,i.pts,i.dts,"")),f.key=!0,f.frame=!0;break;case 6:o=!0,go(p.data,1,i.pts,t.samples);break;case 7:if(o=!0,h=!0,!e.sps){var A=p.data,k=new Rh(A).readSPS();e.width=k.width,e.height=k.height,e.pixelRatio=k.pixelRatio,e.sps=[A],e.duration=u._duration;for(var D=A.subarray(1,4),S="avc1.",L=0;L<3;L++){var N=D[L].toString(16);N.length<2&&(N="0"+N),S+=N}e.codec=S}break;case 8:o=!0,e.pps||(e.pps=[p.data]);break;case 9:o=!1,e.audFound=!0,f&&Yd(f,e),f=u.avcSample=Bo(!1,i.pts,i.dts,"");break;case 12:o=!0;break;default:o=!1,f&&(f.debug+="unknown NAL "+p.type+" ")}f&&o&&f.units.push(p)}),r&&f&&(Yd(f,e),this.avcSample=null)},s.getLastNalUnit=function(e){var t,i,r=this.avcSample;if(r&&r.units.length!==0||(r=e[e.length-1]),(t=r)!=null&&t.units){var o=r.units;i=o[o.length-1]}return i},s.parseAVCNALu=function(e,t){var i,r,o=t.byteLength,u=e.naluState||0,c=u,f=[],h=0,p=-1,y=0;for(u===-1&&(p=0,y=31&t[0],u=0,h=1);h<o;)if(i=t[h++],u)if(u!==1)if(i)if(i===1){if(p>=0){var b={data:t.subarray(p,h-u-1),type:y};f.push(b)}else{var A=this.getLastNalUnit(e.samples);if(A&&(c&&h<=4-c&&A.state&&(A.data=A.data.subarray(0,A.data.byteLength-c)),(r=h-u-1)>0)){var k=new Uint8Array(A.data.byteLength+r);k.set(A.data,0),k.set(t.subarray(0,r),A.data.byteLength),A.data=k,A.state=0}}h<o?(p=h,y=31&t[h],u=0):u=-1}else u=0;else u=3;else u=i?0:2;else u=i?0:1;if(p>=0&&u>=0){var D={data:t.subarray(p,o),type:y,state:u};f.push(D)}if(f.length===0){var S=this.getLastNalUnit(e.samples);if(S){var L=new Uint8Array(S.data.byteLength+t.byteLength);L.set(S.data,0),L.set(t,S.data.byteLength),S.data=L}}return e.naluState=u,f},s.parseAACPES=function(e,t){var i,r,o,u=0,c=this.aacOverFlow,f=t.data;if(c){this.aacOverFlow=null;var h=c.missing,p=c.sample.unit.byteLength;if(h===-1){var y=new Uint8Array(p+f.byteLength);y.set(c.sample.unit,0),y.set(f,p),f=y}else{var b=p-h;c.sample.unit.set(f.subarray(0,h),b),e.samples.push(c.sample),u=c.missing}}for(i=u,r=f.length;i<r-1&&!Fo(f,i);i++);if(i!==u){var A,k=i<r-1;A=k?"AAC PES did not start with ADTS header,offset:"+i:"No ADTS header found in AAC PES";var D=new Error(A);if(H.warn("parsing error: "+A),this.observer.emit(w.ERROR,w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:k,error:D,reason:A}),!k)return}if(Ah(e,this.observer,f,i,this.audioCodec),t.pts!==void 0)o=t.pts;else{if(!c)return void H.warn("[tsdemuxer]: AAC PES unknown PTS");var S=Sh(e.samplerate);o=c.sample.pts+S}for(var L,N=0;i<r;){if(i+=(L=kh(e,f,i,o,N)).length,L.missing){this.aacOverFlow=L;break}for(N++;i<r-1&&!Fo(f,i);i++);}},s.parseMPEGPES=function(e,t){var i=t.data,r=i.length,o=0,u=0,c=t.pts;if(c!==void 0)for(;u<r;)if(Ih(i,u)){var f=wh(e,i,u,c,o);if(!f)break;u+=f.length,o++}else u++;else H.warn("[tsdemuxer]: MPEG PES unknown PTS")},s.parseID3PES=function(e,t){if(t.pts!==void 0){var i=F({},t,{type:this._avcTrack?pr:ma,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}else H.warn("[tsdemuxer]: ID3 PES unknown PTS")},d}();function Bo(d,s,e,t){return{key:d,frame:!1,pts:s,dts:e,units:[],debug:t,length:0}}function qd(d,s){return((31&d[s+1])<<8)+d[s+2]}function Fv(d,s){return(31&d[s+10])<<8|d[s+11]}function Uv(d,s,e,t){var i={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},r=s+3+((15&d[s+1])<<8|d[s+2])-4;for(s+=12+((15&d[s+10])<<8|d[s+11]);s<r;){var o=qd(d,s);switch(d[s]){case 207:if(!t){H.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:i.audio===-1&&(i.audio=o);break;case 21:i.id3===-1&&(i.id3=o);break;case 219:if(!t){H.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:i.avc===-1&&(i.avc=o);break;case 3:case 4:e.mpeg!==!0&&e.mp3!==!0?H.log("MPEG audio found, not supported in this browser"):i.audio===-1&&(i.audio=o,i.segmentCodec="mp3");break;case 36:H.warn("Unsupported HEVC stream type found")}s+=5+((15&d[s+3])<<8|d[s+4])}return i}function rn(d){var s,e,t,i,r,o=0,u=d.data;if(!d||d.size===0)return null;for(;u[0].length<19&&u.length>1;){var c=new Uint8Array(u[0].length+u[1].length);c.set(u[0]),c.set(u[1],u[0].length),u[0]=c,u.splice(1,1)}if(((s=u[0])[0]<<16)+(s[1]<<8)+s[2]===1){if((e=(s[4]<<8)+s[5])&&e>d.size-6)return null;var f=s[7];192&f&&(i=536870912*(14&s[9])+4194304*(255&s[10])+16384*(254&s[11])+128*(255&s[12])+(254&s[13])/2,64&f?i-(r=536870912*(14&s[14])+4194304*(255&s[15])+16384*(254&s[16])+128*(255&s[17])+(254&s[18])/2)>54e5&&(H.warn(Math.round((i-r)/9e4)+"s delta between PTS and DTS, align them"),i=r):r=i);var h=(t=s[8])+9;if(d.size<=h)return null;d.size-=h;for(var p=new Uint8Array(d.size),y=0,b=u.length;y<b;y++){var A=(s=u[y]).byteLength;if(h){if(h>A){h-=A;continue}s=s.subarray(h),A-=h,h=0}p.set(s,o),o+=A}return e&&(e-=t+3),{data:p,pts:i,dts:r,len:e}}return null}function Yd(d,s){if(d.units.length&&d.frame){if(d.pts===void 0){var e=s.samples,t=e.length;if(!t)return void s.dropped++;var i=e[t-1];d.pts=i.pts,d.dts=i.dts}s.samples.push(d)}d.debug.length&&H.log(d.pts+"/"+d.dts+":"+d.debug)}var Bv=function(d){function s(){return d.apply(this,arguments)||this}Q(s,d);var e=s.prototype;return e.resetInitSegment=function(t,i,r,o){d.prototype.resetInitSegment.call(this,t,i,r,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:i,duration:o,inputTimeScale:9e4,dropped:0}},s.probe=function(t){if(!t)return!1;for(var i=(la(t,0)||[]).length,r=t.length;i<r;i++)if(Pv(t,i))return H.log("MPEG Audio sync word found !"),!0;return!1},e.canParse=function(t,i){return function(r,o){return Wd(r,o)&&4<=r.length-o}(t,i)},e.appendFrame=function(t,i,r){if(this.basePTS!==null)return wh(t,i,r,this.basePTS,this.frameIndex)},s}(bh),Dh=function(){function d(){}return d.getSilentFrame=function(s,e){if(s==="mp4a.40.2"){if(e===1)return new Uint8Array([0,200,0,128,35,128]);if(e===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(e===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(e===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(e===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(e===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(e===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(e===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(e===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])}},d}(),Vr=Math.pow(2,32)-1,Yt=function(){function d(){}return d.init=function(){var s;for(s in d.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:[]},d.types)d.types.hasOwnProperty(s)&&(d.types[s]=[s.charCodeAt(0),s.charCodeAt(1),s.charCodeAt(2),s.charCodeAt(3)]);var e=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]),t=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]);d.HDLR_TYPES={video:e,audio:t};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);d.STTS=d.STSC=d.STCO=r,d.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),d.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),d.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),d.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);d.FTYP=d.box(d.types.ftyp,o,c,o,u),d.DINF=d.box(d.types.dinf,d.box(d.types.dref,i))},d.box=function(s){for(var e=8,t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var o=i.length,u=o;o--;)e+=i[o].byteLength;var c=new Uint8Array(e);for(c[0]=e>>24&255,c[1]=e>>16&255,c[2]=e>>8&255,c[3]=255&e,c.set(s,4),o=0,e=8;o<u;o++)c.set(i[o],e),e+=i[o].byteLength;return c},d.hdlr=function(s){return d.box(d.types.hdlr,d.HDLR_TYPES[s])},d.mdat=function(s){return d.box(d.types.mdat,s)},d.mdhd=function(s,e){e*=s;var t=Math.floor(e/(Vr+1)),i=Math.floor(e%(Vr+1));return d.box(d.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,s>>24&255,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))},d.mdia=function(s){return d.box(d.types.mdia,d.mdhd(s.timescale,s.duration),d.hdlr(s.type),d.minf(s))},d.mfhd=function(s){return d.box(d.types.mfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s]))},d.minf=function(s){return s.type==="audio"?d.box(d.types.minf,d.box(d.types.smhd,d.SMHD),d.DINF,d.stbl(s)):d.box(d.types.minf,d.box(d.types.vmhd,d.VMHD),d.DINF,d.stbl(s))},d.moof=function(s,e,t){return d.box(d.types.moof,d.mfhd(s),d.traf(t,e))},d.moov=function(s){for(var e=s.length,t=[];e--;)t[e]=d.trak(s[e]);return d.box.apply(null,[d.types.moov,d.mvhd(s[0].timescale,s[0].duration)].concat(t).concat(d.mvex(s)))},d.mvex=function(s){for(var e=s.length,t=[];e--;)t[e]=d.trex(s[e]);return d.box.apply(null,[d.types.mvex].concat(t))},d.mvhd=function(s,e){e*=s;var t=Math.floor(e/(Vr+1)),i=Math.floor(e%(Vr+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,s>>24&255,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,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 d.box(d.types.mvhd,r)},d.sdtp=function(s){var e,t,i=s.samples||[],r=new Uint8Array(4+i.length);for(e=0;e<i.length;e++)t=i[e].flags,r[e+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return d.box(d.types.sdtp,r)},d.stbl=function(s){return d.box(d.types.stbl,d.stsd(s),d.box(d.types.stts,d.STTS),d.box(d.types.stsc,d.STSC),d.box(d.types.stsz,d.STSZ),d.box(d.types.stco,d.STCO))},d.avc1=function(s){var e,t,i,r=[],o=[];for(e=0;e<s.sps.length;e++)i=(t=s.sps[e]).byteLength,r.push(i>>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(t));for(e=0;e<s.pps.length;e++)i=(t=s.pps[e]).byteLength,o.push(i>>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(t));var u=d.box(d.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|s.sps.length].concat(r).concat([s.pps.length]).concat(o))),c=s.width,f=s.height,h=s.pixelRatio[0],p=s.pixelRatio[1];return d.box(d.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,c>>8&255,255&c,f>>8&255,255&f,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]),u,d.box(d.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),d.box(d.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,255&h,p>>24,p>>16&255,p>>8&255,255&p])))},d.esds=function(s){var e=s.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(s.config).concat([6,1,2]))},d.mp4a=function(s){var e=s.samplerate;return d.box(d.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,s.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]),d.box(d.types.esds,d.esds(s)))},d.mp3=function(s){var e=s.samplerate;return d.box(d.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,s.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]))},d.stsd=function(s){return s.type==="audio"?s.segmentCodec==="mp3"&&s.codec==="mp3"?d.box(d.types.stsd,d.STSD,d.mp3(s)):d.box(d.types.stsd,d.STSD,d.mp4a(s)):d.box(d.types.stsd,d.STSD,d.avc1(s))},d.tkhd=function(s){var e=s.id,t=s.duration*s.timescale,i=s.width,r=s.height,o=Math.floor(t/(Vr+1)),u=Math.floor(t%(Vr+1));return d.box(d.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,u>>24,u>>16&255,u>>8&255,255&u,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,i>>8&255,255&i,0,0,r>>8&255,255&r,0,0]))},d.traf=function(s,e){var t=d.sdtp(s),i=s.id,r=Math.floor(e/(Vr+1)),o=Math.floor(e%(Vr+1));return d.box(d.types.traf,d.box(d.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),d.box(d.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,o>>24,o>>16&255,o>>8&255,255&o])),d.trun(s,t.length+16+20+8+16+8+8),t)},d.trak=function(s){return s.duration=s.duration||4294967295,d.box(d.types.trak,d.tkhd(s),d.mdia(s))},d.trex=function(s){var e=s.id;return d.box(d.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},d.trun=function(s,e){var t,i,r,o,u,c,f=s.samples||[],h=f.length,p=12+16*h,y=new Uint8Array(p);for(e+=8+p,y.set([s.type==="video"?1:0,0,15,1,h>>>24&255,h>>>16&255,h>>>8&255,255&h,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),t=0;t<h;t++)r=(i=f[t]).duration,o=i.size,u=i.flags,c=i.cts,y.set([r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,61440&u.degradPrio,15&u.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*t);return d.box(d.types.trun,y)},d.initSegment=function(s){d.types||d.init();var e=d.moov(s),t=new Uint8Array(d.FTYP.byteLength+e.byteLength);return t.set(d.FTYP),t.set(e,d.FTYP.byteLength),t},d}();function $d(d,s,e,t){e===void 0&&(e=1),t===void 0&&(t=!1);var i=d*s*e;return t?Math.round(i):i}function ls(d,s){return s===void 0&&(s=!1),$d(d,1e3,1/9e4,s)}Yt.types=void 0,Yt.HDLR_TYPES=void 0,Yt.STTS=void 0,Yt.STSC=void 0,Yt.STCO=void 0,Yt.STSZ=void 0,Yt.VMHD=void 0,Yt.SMHD=void 0,Yt.STSD=void 0,Yt.FTYP=void 0,Yt.DINF=void 0;var Ho=null,jd=null,zd=function(){function d(e,t,i,r){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,Ho===null){var o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ho=o?parseInt(o[1]):0}if(jd===null){var u=navigator.userAgent.match(/Safari\/(\d+)/i);jd=u?parseInt(u[1]):0}}var s=d.prototype;return s.destroy=function(){},s.resetTimeStamp=function(e){H.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},s.resetNextTimestamp=function(){H.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},s.resetInitSegment=function(){H.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},s.getVideoStartPts=function(e){var t=!1,i=e.reduce(function(r,o){var u=o.pts-r;return u<-4294967296?(t=!0,Ci(r,o.pts)):u>0?r:o.pts},e[0].pts);return t&&H.debug("PTS rollover detected"),i},s.remux=function(e,t,i,r,o,u,c,f){var h,p,y,b,A,k,D=o,S=o,L=e.pid>-1,N=t.pid>-1,P=t.samples.length,V=e.samples.length>0,q=c&&P>0||P>1;if((!L||V)&&(!N||q)||this.ISGenerated||c){this.ISGenerated||(y=this.generateIS(e,t,o,u));var j,ee=this.isVideoContiguous,z=-1;if(q&&(z=function(Me){for(var _e=0;_e<Me.length;_e++)if(Me[_e].key)return _e;return-1}(t.samples),!ee&&this.config.forceKeyFrameOnDiscontinuity))if(k=!0,z>0){H.warn("[mp4-remuxer]: Dropped "+z+" out of "+P+" video samples due to a missing keyframe");var X=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(z),t.dropped+=z,j=S+=(t.samples[0].pts-X)/t.inputTimeScale}else z===-1&&(H.warn("[mp4-remuxer]: No keyframe found out of "+P+" video samples"),k=!1);if(this.ISGenerated){if(V&&q){var ue=this.getVideoStartPts(t.samples),ne=(Ci(e.samples[0].pts,ue)-ue)/t.inputTimeScale;D+=Math.max(0,ne),S+=Math.max(0,-ne)}if(V){if(e.samplerate||(H.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),y=this.generateIS(e,t,o,u)),p=this.remuxAudio(e,D,this.isAudioContiguous,u,N||q||f===_i?S:void 0),q){var Te=p?p.endPTS-p.startPTS:0;t.inputTimeScale||(H.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),y=this.generateIS(e,t,o,u)),h=this.remuxVideo(t,S,ee,Te)}}else q&&(h=this.remuxVideo(t,S,ee,0));h&&(h.firstKeyFrame=z,h.independent=z!==-1,h.firstKeyFramePTS=j)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(A=Ch(i,o,this._initPTS,this._initDTS)),r.samples.length&&(b=Mh(r,o,this._initPTS))),{audio:p,video:h,initSegment:y,independent:k,text:b,id3:A}},s.generateIS=function(e,t,i,r){var o,u,c,f=e.samples,h=t.samples,p=this.typeSupported,y={},b=this._initPTS,A=!b||r,k="audio/mp4";if(A&&(o=u=1/0),e.config&&f.length&&(e.timescale=e.samplerate,e.segmentCodec==="mp3"&&(p.mpeg?(k="audio/mpeg",e.codec=""):p.mp3&&(e.codec="mp3")),y.audio={id:"audio",container:k,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&p.mpeg?new Uint8Array(0):Yt.initSegment([e]),metadata:{channelCount:e.channelCount}},A&&(c=e.inputTimeScale,b&&c===b.timescale?A=!1:o=u=f[0].pts-Math.round(c*i))),t.sps&&t.pps&&h.length&&(t.timescale=t.inputTimeScale,y.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Yt.initSegment([t]),metadata:{width:t.width,height:t.height}},A))if(c=t.inputTimeScale,b&&c===b.timescale)A=!1;else{var D=this.getVideoStartPts(h),S=Math.round(c*i);u=Math.min(u,Ci(h[0].dts,D)-S),o=Math.min(o,D-S)}if(Object.keys(y).length)return this.ISGenerated=!0,A?(this._initPTS={baseTime:o,timescale:c},this._initDTS={baseTime:u,timescale:c}):o=c=void 0,{tracks:y,initPTS:o,timescale:c}},s.remuxVideo=function(e,t,i,r){var o,u,c=e.inputTimeScale,f=e.samples,h=[],p=f.length,y=this._initPTS,b=this.nextAvcDts,A=8,k=this.videoSampleDuration,D=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,L=!1;i&&b!==null||(b=t*c-(f[0].pts-Ci(f[0].dts,f[0].pts)));for(var N=y.baseTime*c/y.timescale,P=0;P<p;P++){var V=f[P];V.pts=Ci(V.pts-N,b),V.dts=Ci(V.dts-N,b),V.dts<f[P>0?P-1:P].dts&&(L=!0)}L&&f.sort(function($o,pf){var Fg=$o.dts-pf.dts,Ug=$o.pts-pf.pts;return Fg||Ug}),o=f[0].dts;var q=(u=f[f.length-1].dts)-o,j=q?Math.round(q/(p-1)):k||e.inputTimeScale/30;if(i){var ee=o-b,z=ee>j,X=ee<-1;if((z||X)&&(z?H.warn("AVC: "+ls(ee,!0)+" ms ("+ee+"dts) hole between fragments detected, filling it"):H.warn("AVC: "+ls(-ee,!0)+" ms ("+ee+"dts) overlapping between fragments detected"),!X||b>f[0].pts)){o=b;var ue=f[0].pts-ee;f[0].dts=o,f[0].pts=ue,H.log("Video: First PTS/DTS adjusted: "+ls(ue,!0)+"/"+ls(o,!0)+", delta: "+ls(ee,!0)+" ms")}}o=Math.max(0,o);for(var ne=0,Te=0,Me=0;Me<p;Me++){for(var _e=f[Me],De=_e.units,xe=De.length,Ce=0,He=0;He<xe;He++)Ce+=De[He].data.length;Te+=Ce,ne+=xe,_e.length=Ce,_e.dts=Math.max(_e.dts,o),D=Math.min(_e.pts,D),S=Math.max(_e.pts,S)}u=f[p-1].dts;var We,Qe=Te+4*ne+8;try{We=new Uint8Array(Qe)}catch($o){return void this.observer.emit(w.ERROR,w.ERROR,{type:le.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:$o,bytes:Qe,reason:"fail allocating video mdat "+Qe})}var ot=new DataView(We.buffer);ot.setUint32(0,Qe),We.set(Yt.types.mdat,4);for(var mi=!1,Ot=Number.POSITIVE_INFINITY,Wi=Number.POSITIVE_INFINITY,xi=Number.NEGATIVE_INFINITY,Pi=Number.NEGATIVE_INFINITY,Nt=0;Nt<p;Nt++){for(var $t=f[Nt],tr=$t.units,Kr=0,Ai=0,ds=tr.length;Ai<ds;Ai++){var us=tr[Ai],Yo=us.data,sn=us.data.byteLength;ot.setUint32(A,sn),A+=4,We.set(Yo,A),A+=sn,Kr+=4+sn}var wa=void 0;if(Nt<p-1)k=f[Nt+1].dts-$t.dts,wa=f[Nt+1].pts-$t.pts;else{var cs=this.config,_r=Nt>0?$t.dts-f[Nt-1].dts:j;if(wa=Nt>0?$t.pts-f[Nt-1].pts:j,cs.stretchShortVideoTrack&&this.nextAudioPts!==null){var Mg=Math.floor(cs.maxBufferHole*c),pu=(r?D+r*c:this.nextAudioPts)-$t.pts;pu>Mg?((k=pu-_r)<0?k=_r:mi=!0,H.log("[mp4-remuxer]: It is approximately "+pu/90+" ms to the next segment; using duration "+k/90+" ms for the last video frame.")):k=_r}else k=_r}var xg=Math.round($t.pts-$t.dts);Ot=Math.min(Ot,k),xi=Math.max(xi,k),Wi=Math.min(Wi,wa),Pi=Math.max(Pi,wa),h.push(new xh($t.key,k,Kr,xg))}if(h.length){if(Ho){if(Ho<70){var hf=h[0].flags;hf.dependsOn=2,hf.isNonSync=0}}else if(jd&&Pi-Wi<xi-Ot&&j/xi<.025&&h[0].cts===0){H.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var vu=o,qi=0,ff=h.length;qi<ff;qi++){var mf=vu+h[qi].duration,Pg=vu+h[qi].cts;if(qi<ff-1){var Og=mf+h[qi+1].cts;h[qi].duration=Og-Pg}else h[qi].duration=qi?h[qi-1].duration:j;h[qi].cts=0,vu=mf}}}k=mi||!k?j:k,this.nextAvcDts=b=u+k,this.videoSampleDuration=k,this.isVideoContiguous=!0;var Ng={data1:Yt.moof(e.sequenceNumber++,o,F({},e,{samples:h})),data2:We,startPTS:D/c,endPTS:(S+k)/c,startDTS:o/c,endDTS:b/c,type:"video",hasAudio:!1,hasVideo:!0,nb:h.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Ng},s.remuxAudio=function(e,t,i,r,o){var u=e.inputTimeScale,c=u/(e.samplerate?e.samplerate:u),f=e.segmentCodec==="aac"?1024:1152,h=f*c,p=this._initPTS,y=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,b=[],A=o!==void 0,k=e.samples,D=y?0:8,S=this.nextAudioPts||-1,L=t*u,N=p.baseTime*u/p.timescale;if(this.isAudioContiguous=i=i||k.length&&S>0&&(r&&Math.abs(L-S)<9e3||Math.abs(Ci(k[0].pts-N,L)-S)<20*h),k.forEach(function(Ai){Ai.pts=Ci(Ai.pts-N,L)}),!i||S<0){if(k=k.filter(function(Ai){return Ai.pts>=0}),!k.length)return;S=o===0?0:r&&!A?Math.max(0,L):k[0].pts}if(e.segmentCodec==="aac")for(var P=this.config.maxAudioFramesDrift,V=0,q=S;V<k.length;V++){var j=k[V],ee=j.pts,z=ee-q,X=Math.abs(1e3*z/u);if(z<=-P*h&&A)V===0&&(H.warn("Audio frame @ "+(ee/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*z/u)+" ms."),this.nextAudioPts=S=q=ee);else if(z>=P*h&&X<1e4&&A){var ue=Math.round(z/h);(q=ee-ue*h)<0&&(ue--,q+=h),V===0&&(this.nextAudioPts=S=q),H.warn("[mp4-remuxer]: Injecting "+ue+" audio frame @ "+(q/u).toFixed(3)+"s due to "+Math.round(1e3*z/u)+" ms gap.");for(var ne=0;ne<ue;ne++){var Te=Math.max(q,0),Me=Dh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);Me||(H.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Me=j.unit.subarray()),k.splice(V,0,{unit:Me,pts:Te}),q+=h,V++}}j.pts=q,q+=h}for(var _e,De=null,xe=null,Ce=0,He=k.length;He--;)Ce+=k[He].unit.byteLength;for(var We=0,Qe=k.length;We<Qe;We++){var ot=k[We],mi=ot.unit,Ot=ot.pts;if(xe!==null)b[We-1].duration=Math.round((Ot-xe)/c);else{if(i&&e.segmentCodec==="aac"&&(Ot=S),De=Ot,!(Ce>0))return;Ce+=D;try{_e=new Uint8Array(Ce)}catch(Ai){return void this.observer.emit(w.ERROR,w.ERROR,{type:le.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:Ai,bytes:Ce,reason:"fail allocating audio mdat "+Ce})}y||(new DataView(_e.buffer).setUint32(0,Ce),_e.set(Yt.types.mdat,4))}_e.set(mi,D);var Wi=mi.byteLength;D+=Wi,b.push(new xh(!0,f,Wi,0)),xe=Ot}var xi=b.length;if(xi){var Pi=b[b.length-1];this.nextAudioPts=S=xe+c*Pi.duration;var Nt=y?new Uint8Array(0):Yt.moof(e.sequenceNumber++,De/c,F({},e,{samples:b}));e.samples=[];var $t=De/u,tr=S/u,Kr={data1:Nt,data2:_e,startPTS:$t,endPTS:tr,startDTS:$t,endDTS:tr,type:"audio",hasAudio:!0,hasVideo:!1,nb:xi};return this.isAudioContiguous=!0,Kr}},s.remuxEmptyAudio=function(e,t,i,r){var o=e.inputTimeScale,u=o/(e.samplerate?e.samplerate:o),c=this.nextAudioPts,f=this._initDTS,h=9e4*f.baseTime/f.timescale,p=(c!==null?c:r.startDTS*o)+h,y=r.endDTS*o+h,b=1024*u,A=Math.ceil((y-p)/b),k=Dh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(H.warn("[mp4-remuxer]: remux empty Audio"),k){for(var D=[],S=0;S<A;S++){var L=p+S*b;D.push({unit:k,pts:L,dts:L})}return e.samples=D,this.remuxAudio(e,t,i,!1)}H.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},d}();function Ci(d,s){var e;if(s===null)return d;for(e=s<d?-8589934592:8589934592;Math.abs(d-s)>4294967296;)d+=e;return d}function Ch(d,s,e,t){var i=d.samples.length;if(i){for(var r=d.inputTimeScale,o=0;o<i;o++){var u=d.samples[o];u.pts=Ci(u.pts-9e4*e.baseTime/e.timescale,s*r)/r,u.dts=Ci(u.dts-9e4*t.baseTime/t.timescale,s*r)/r}var c=d.samples;return d.samples=[],{samples:c}}}function Mh(d,s,e){var t=d.samples.length;if(t){for(var i=d.inputTimeScale,r=0;r<t;r++){var o=d.samples[r];o.pts=Ci(o.pts-9e4*e.baseTime/e.timescale,s*i)/i}d.samples.sort(function(c,f){return c.pts-f.pts});var u=d.samples;return d.samples=[],{samples:u}}}var Er,xh=function(d,s,e,t){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=s,this.size=e,this.cts=t,this.flags=new Hv(d)},Hv=function(d){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=d?2:1,this.isNonSync=d?0:1},Gv=function(){function d(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}var s=d.prototype;return s.destroy=function(){},s.resetTimeStamp=function(e){this.initPTS=e,this.lastEndTime=null},s.resetNextTimestamp=function(){this.lastEndTime=null},s.resetInitSegment=function(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(o,u){if(!o||!u)return o;var c=u.keyId;return c&&u.isCommonEncryption&&ze(o,["moov","trak"]).forEach(function(f){var h=ze(f,["mdia","minf","stbl","stsd"])[0].subarray(8),p=ze(h,["enca"]),y=p.length>0;y||(p=ze(h,["encv"])),p.forEach(function(b){ze(y?b.subarray(28):b.subarray(78),["sinf"]).forEach(function(A){var k=qn(A);if(k){var D=k.subarray(8,24);D.some(function(S){return S!==0})||(H.log("[eme] Patching keyId in 'enc"+(y?"a":"v")+">sinf>>tenc' box: "+Ii(D)+" -> "+Ii(c)),k.set(c,8))}})})}),o}(e,r)),this.emitInitSegment=!0},s.generateInitSegment=function(e){var t=this.audioCodec,i=this.videoCodec;if(e==null||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var r=this.initData=Wn(e);t||(t=Ph(r.audio,ht)),i||(i=Ph(r.video,Tt));var o={};r.audio&&r.video?o.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?o.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?o.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:H.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},s.remux=function(e,t,i,r,o,u){var c,f,h=this.initPTS,p=this.lastEndTime,y={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};oe(p)||(p=this.lastEndTime=o||0);var b=t.samples;if(b==null||!b.length)return y;var A={initPTS:void 0,timescale:1},k=this.initData;if((c=k)!=null&&c.length||(this.generateInitSegment(b),k=this.initData),(f=k)==null||!f.length)return H.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),y;this.emitInitSegment&&(A.tracks=this.initTracks,this.emitInitSegment=!1);var D=function(z,X){return ze(X,["moof","traf"]).reduce(function(ue,ne){var Te=ze(ne,["tfdt"])[0],Me=Te[0],_e=ze(ne,["tfhd"]).reduce(function(De,xe){var Ce=Fe(xe,4),He=z[Ce];if(He){var We=Fe(Te,4);if(Me===1){if(We===da)return H.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),De;We*=da+1,We+=Fe(Te,8)}var Qe=We/(He.timescale||9e4);if(isFinite(Qe)&&(De===null||Qe<De))return Qe}return De},null);return _e!==null&&isFinite(_e)&&(ue===null||_e<ue)?_e:ue},null)}(k,b),S=D===null?o:D;(function(z,X,ue){if(z===null)return!0;var ne=X-z.baseTime/z.timescale;return ne<0&&Math.abs(ne-ue)>1}(h,S,o)||A.timescale!==h.timescale&&u)&&(A.initPTS=S-o,this.initPTS=h={baseTime:A.initPTS,timescale:1});var L=function(z,X){for(var ue=0,ne=0,Te=0,Me=ze(z,["moof","traf"]),_e=0;_e<Me.length;_e++){var De=Me[_e],xe=ze(De,["tfhd"])[0],Ce=X[Fe(xe,4)];if(Ce){var He=Ce.default,We=Fe(xe,0)|(He==null?void 0:He.flags),Qe=He==null?void 0:He.duration;8&We&&(Qe=Fe(xe,2&We?12:8));for(var ot=Ce.timescale||9e4,mi=ze(De,["trun"]),Ot=0;Ot<mi.length;Ot++)!(ue=xd(mi[Ot]))&&Qe&&(ue=Qe*Fe(mi[Ot],4)),Ce.type===Tt?ne+=ue/ot:Ce.type===ht&&(Te+=ue/ot)}}if(ne===0&&Te===0){for(var Wi=0,xi=ze(z,["sidx"]),Pi=0;Pi<xi.length;Pi++){var Nt=po(xi[Pi]);Nt!=null&&Nt.references&&(Wi+=Nt.references.reduce(function($t,tr){return $t+tr.info.duration||0},0))}return Wi}return ne||Te}(b,k),N=e?S-h.baseTime/h.timescale:p,P=N+L;(function(z,X,ue){ze(X,["moof","traf"]).forEach(function(ne){ze(ne,["tfhd"]).forEach(function(Te){var Me=Fe(Te,4),_e=z[Me];if(_e){var De=_e.timescale||9e4;ze(ne,["tfdt"]).forEach(function(xe){var Ce=xe[0],He=Fe(xe,4);if(Ce===0)He-=ue*De,Kn(xe,4,He=Math.max(He,0));else{He*=Math.pow(2,32),He+=Fe(xe,8),He-=ue*De,He=Math.max(He,0);var We=Math.floor(He/(da+1)),Qe=Math.floor(He%(da+1));Kn(xe,4,We),Kn(xe,8,Qe)}})}})})})(k,b,h.baseTime/h.timescale),L>0?this.lastEndTime=P:(H.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var V=!!k.audio,q=!!k.video,j="";V&&(j+="audio"),q&&(j+="video");var ee={data1:b,startPTS:N,startDTS:N,endPTS:P,endDTS:P,type:j,hasAudio:V,hasVideo:q,nb:1,dropped:0};return y.audio=ee.type==="audio"?ee:void 0,y.video=ee.type!=="audio"?ee:void 0,y.initSegment=A,y.id3=Ch(i,o,h,h),r.samples.length&&(y.text=Mh(r,o,h)),y},d}();function Ph(d,s){var e=d==null?void 0:d.codec;return e&&e.length>4?e:e==="hvc1"||e==="hev1"?"hvc1.1.6.L120.90":e==="av01"?"av01.0.04M.08":e==="avc1"||s===Tt?"avc1.42e01e":"mp4a.40.5"}try{Er=self.performance.now.bind(self.performance)}catch{H.debug("Unable to use Performance API on this environment"),Er=typeof self!="undefined"&&self.Date.now}var Qd=[{demux:Rv,remux:Gv},{demux:Nv,remux:zd},{demux:Lv,remux:zd},{demux:Bv,remux:zd}],Xd=function(){function d(e,t,i,r,o){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=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=o}var s=d.prototype;return s.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},s.push=function(e,t,i,r){var o=this,u=i.transmuxing;u.executeStart=Er();var c=new Uint8Array(e),f=this.currentTransmuxState,h=this.transmuxConfig;r&&(this.currentTransmuxState=r);var p=r||f,y=p.contiguous,b=p.discontinuity,A=p.trackSwitch,k=p.accurateTimeOffset,D=p.timeOffset,S=p.initSegmentChange,L=h.audioCodec,N=h.videoCodec,P=h.defaultInitPts,V=h.duration,q=h.initSegmentData,j=function(Me,_e){var De=null;return Me.byteLength>0&&_e!=null&&_e.key!=null&&_e.iv!==null&&_e.method!=null&&(De=_e),De}(c,t);if(j&&j.method==="AES-128"){var ee=this.getDecrypter();if(!ee.isSync())return this.decryptionPromise=ee.webCryptoDecrypt(c,j.key.buffer,j.iv.buffer).then(function(Me){var _e=o.push(Me,null,i);return o.decryptionPromise=null,_e}),this.decryptionPromise;var z=ee.softwareDecrypt(c,j.key.buffer,j.iv.buffer);if(i.part>-1&&(z=ee.flush()),!z)return u.executeEnd=Er(),Zd(i);c=new Uint8Array(z)}var X=this.needsProbing(b,A);if(X){var ue=this.configureTransmuxer(c);if(ue)return H.warn("[transmuxer] "+ue.message),this.observer.emit(w.ERROR,w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:ue,reason:ue.message}),u.executeEnd=Er(),Zd(i)}(b||A||S||X)&&this.resetInitSegment(q,L,N,V,t),(b||S||X)&&this.resetInitialTimestamp(P),y||this.resetContiguity();var ne=this.transmux(c,j,D,k,i),Te=this.currentTransmuxState;return Te.contiguous=!0,Te.discontinuity=!1,Te.trackSwitch=!1,u.executeEnd=Er(),ne},s.flush=function(e){var t=this,i=e.transmuxing;i.executeStart=Er();var r=this.decrypter,o=this.currentTransmuxState,u=this.decryptionPromise;if(u)return u.then(function(){return t.flush(e)});var c=[],f=o.timeOffset;if(r){var h=r.flush();h&&c.push(this.push(h,null,e))}var p=this.demuxer,y=this.remuxer;if(!p||!y)return i.executeEnd=Er(),[Zd(e)];var b=p.flush(f);return Aa(b)?b.then(function(A){return t.flushRemux(c,A,e),c}):(this.flushRemux(c,b,e),c)},s.flushRemux=function(e,t,i){var r=t.audioTrack,o=t.videoTrack,u=t.id3Track,c=t.textTrack,f=this.currentTransmuxState,h=f.accurateTimeOffset,p=f.timeOffset;H.log("[transmuxer.ts]: Flushed fragment "+i.sn+(i.part>-1?" p: "+i.part:"")+" of level "+i.level);var y=this.remuxer.remux(r,o,u,c,p,h,!0,this.id);e.push({remuxResult:y,chunkMeta:i}),i.transmuxing.executeEnd=Er()},s.resetInitialTimestamp=function(e){var t=this.demuxer,i=this.remuxer;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))},s.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},s.resetInitSegment=function(e,t,i,r,o){var u=this.demuxer,c=this.remuxer;u&&c&&(u.resetInitSegment(e,t,i,r),c.resetInitSegment(e,t,i,o))},s.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},s.transmux=function(e,t,i,r,o){return t&&t.method==="SAMPLE-AES"?this.transmuxSampleAes(e,t,i,r,o):this.transmuxUnencrypted(e,i,r,o)},s.transmuxUnencrypted=function(e,t,i,r){var o=this.demuxer.demux(e,t,!1,!this.config.progressive),u=o.audioTrack,c=o.videoTrack,f=o.id3Track,h=o.textTrack;return{remuxResult:this.remuxer.remux(u,c,f,h,t,i,!1,this.id),chunkMeta:r}},s.transmuxSampleAes=function(e,t,i,r,o){var u=this;return this.demuxer.demuxSampleAes(e,t,i).then(function(c){return{remuxResult:u.remuxer.remux(c.audioTrack,c.videoTrack,c.id3Track,c.textTrack,i,r,!1,u.id),chunkMeta:o}})},s.configureTransmuxer=function(e){for(var t,i=this.config,r=this.observer,o=this.typeSupported,u=this.vendor,c=0,f=Qd.length;c<f;c++)if(Qd[c].demux.probe(e)){t=Qd[c];break}if(!t)return new Error("Failed to find demuxer by probing fragment data");var h=this.demuxer,p=this.remuxer,y=t.remux,b=t.demux;p&&p instanceof y||(this.remuxer=new y(r,i,o,u)),h&&h instanceof b||(this.demuxer=new b(r,i,o),this.probe=b.probe)},s.needsProbing=function(e,t){return!this.demuxer||!this.remuxer||e||t},s.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new Di(this.config)),e},d}(),Zd=function(d){return{remuxResult:{},chunkMeta:d}};function Aa(d){return"then"in d&&d.then instanceof Function}var Vv=function(d,s,e,t,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=d,this.videoCodec=s,this.initSegmentData=e,this.duration=t,this.defaultInitPts=i||null},Kv=function(d,s,e,t,i,r){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=d,this.contiguous=s,this.accurateTimeOffset=e,this.trackSwitch=t,this.timeOffset=i,this.initSegmentChange=r},Oh={exports:{}};(function(d){var s=Object.prototype.hasOwnProperty,e="~";function t(){}function i(c,f,h){this.fn=c,this.context=f,this.once=h||!1}function r(c,f,h,p,y){if(typeof h!="function")throw new TypeError("The listener must be a function");var b=new i(h,p||c,y),A=e?e+f:f;return c._events[A]?c._events[A].fn?c._events[A]=[c._events[A],b]:c._events[A].push(b):(c._events[A]=b,c._eventsCount++),c}function o(c,f){--c._eventsCount==0?c._events=new t:delete c._events[f]}function u(){this._events=new t,this._eventsCount=0}Object.create&&(t.prototype=Object.create(null),new t().__proto__||(e=!1)),u.prototype.eventNames=function(){var c,f,h=[];if(this._eventsCount===0)return h;for(f in c=this._events)s.call(c,f)&&h.push(e?f.slice(1):f);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},u.prototype.listeners=function(c){var f=e?e+c:c,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,y=h.length,b=new Array(y);p<y;p++)b[p]=h[p].fn;return b},u.prototype.listenerCount=function(c){var f=e?e+c:c,h=this._events[f];return h?h.fn?1:h.length:0},u.prototype.emit=function(c,f,h,p,y,b){var A=e?e+c:c;if(!this._events[A])return!1;var k,D,S=this._events[A],L=arguments.length;if(S.fn){switch(S.once&&this.removeListener(c,S.fn,void 0,!0),L){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,f),!0;case 3:return S.fn.call(S.context,f,h),!0;case 4:return S.fn.call(S.context,f,h,p),!0;case 5:return S.fn.call(S.context,f,h,p,y),!0;case 6:return S.fn.call(S.context,f,h,p,y,b),!0}for(D=1,k=new Array(L-1);D<L;D++)k[D-1]=arguments[D];S.fn.apply(S.context,k)}else{var N,P=S.length;for(D=0;D<P;D++)switch(S[D].once&&this.removeListener(c,S[D].fn,void 0,!0),L){case 1:S[D].fn.call(S[D].context);break;case 2:S[D].fn.call(S[D].context,f);break;case 3:S[D].fn.call(S[D].context,f,h);break;case 4:S[D].fn.call(S[D].context,f,h,p);break;default:if(!k)for(N=1,k=new Array(L-1);N<L;N++)k[N-1]=arguments[N];S[D].fn.apply(S[D].context,k)}}return!0},u.prototype.on=function(c,f,h){return r(this,c,f,h,!1)},u.prototype.once=function(c,f,h){return r(this,c,f,h,!0)},u.prototype.removeListener=function(c,f,h,p){var y=e?e+c:c;if(!this._events[y])return this;if(!f)return o(this,y),this;var b=this._events[y];if(b.fn)b.fn!==f||p&&!b.once||h&&b.context!==h||o(this,y);else{for(var A=0,k=[],D=b.length;A<D;A++)(b[A].fn!==f||p&&!b[A].once||h&&b[A].context!==h)&&k.push(b[A]);k.length?this._events[y]=k.length===1?k[0]:k:o(this,y)}return this},u.prototype.removeAllListeners=function(c){var f;return c?(f=e?e+c:c,this._events[f]&&o(this,f)):(this._events=new t,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=e,u.EventEmitter=u,d.exports=u})(Oh);var Go=Ue(Oh.exports);function Jd(d,s){if(!((e=s.remuxResult).audio||e.video||e.text||e.id3||e.initSegment))return!1;var e,t=[],i=s.remuxResult,r=i.audio,o=i.video;return r&&Nh(t,r),o&&Nh(t,o),d.postMessage({event:"transmuxComplete",data:s},t),!0}function Nh(d,s){s.data1&&d.push(s.data1.buffer),s.data2&&d.push(s.data2.buffer)}function Fh(d,s,e){s.reduce(function(t,i){return Jd(d,i)||t},!1)||d.postMessage({event:"transmuxComplete",data:s[0]}),d.postMessage({event:"flush",data:e})}a!==void 0&&a&&function(d){var s=new Go,e=function(i,r){d.postMessage({event:i,data:r})};s.on(w.FRAG_DECRYPTED,e),s.on(w.ERROR,e);var t=function(){var i=function(o){var u=function(c){e("workerLog",{logType:o,message:c})};H[o]=u};for(var r in H)i(r)};d.addEventListener("message",function(i){var r=i.data;switch(r.cmd){case"init":var o=JSON.parse(r.config);d.transmuxer=new Xd(s,r.typeSupported,o,r.vendor,r.id),Je(o.debug,r.id),t(),e("init",null);break;case"configure":d.transmuxer.configure(r.config);break;case"demux":var u=d.transmuxer.push(r.data,r.decryptdata,r.chunkMeta,r.state);Aa(u)?(d.transmuxer.async=!0,u.then(function(h){Jd(d,h)}).catch(function(h){e(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:r.chunkMeta,fatal:!1,error:h,err:h,reason:"transmuxer-worker push error"})})):(d.transmuxer.async=!1,Jd(d,u));break;case"flush":var c=r.chunkMeta,f=d.transmuxer.flush(c);Aa(f)||d.transmuxer.async?(Aa(f)||(f=Promise.resolve(f)),f.then(function(h){Fh(d,h,c)}).catch(function(h){e(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:r.chunkMeta,fatal:!1,error:h,err:h,reason:"transmuxer-worker flush error"})})):Fh(d,f,c)}})}(self);var eu=$a()||{isTypeSupported:function(){return!1}},Uh=function(){function d(e,t,i,r){var o=this;this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var u=e.config;this.hls=e,this.id=t,this.useWorker=!!u.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;var c=function(D,S){(S=S||{}).frag=o.frag,S.id=o.id,D===w.ERROR&&(o.error=S.error),o.hls.trigger(D,S)};this.observer=new Go,this.observer.on(w.FRAG_DECRYPTED,c),this.observer.on(w.ERROR,c);var f,h,p,y,b={mp4:eu.isTypeSupported("video/mp4"),mpeg:eu.isTypeSupported("audio/mpeg"),mp3:eu.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(!this.useWorker||typeof Worker=="undefined"||(u.workerPath,0))this.transmuxer=new Xd(this.observer,b,u,A,t);else try{u.workerPath?(H.log("loading Web Worker "+u.workerPath+' for "'+t+'"'),this.workerContext=(p=u.workerPath,y=new self.URL(p,self.location.href).href,{worker:new self.Worker(y),scriptURL:y})):(H.log('injecting Web Worker for "'+t+'"'),this.workerContext=(f=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+n.toString()+")(true);"],{type:"text/javascript"}),h=self.URL.createObjectURL(f),{worker:new self.Worker(h),objectURL:h})),this.onwmsg=function(D){return o.onWorkerMessage(D)};var k=this.workerContext.worker;k.addEventListener("message",this.onwmsg),k.onerror=function(D){var S=new Error(D.message+" ("+D.filename+":"+D.lineno+")");u.enableWorker=!1,H.warn('Error in "'+t+'" Web Worker, fallback to inline'),o.hls.trigger(w.ERROR,{type:le.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:S})},k.postMessage({cmd:"init",typeSupported:b,vendor:A,id:t,config:JSON.stringify(u)})}catch(D){H.warn('Error setting up "'+t+'" Web Worker, fallback to inline',D),this.resetWorker(),this.error=null,this.transmuxer=new Xd(this.observer,b,u,A,t)}}var s=d.prototype;return s.resetWorker=function(){if(this.workerContext){var e=this.workerContext,t=e.worker,i=e.objectURL;i&&self.URL.revokeObjectURL(i),t.removeEventListener("message",this.onwmsg),t.onerror=null,t.terminate(),this.workerContext=null}},s.destroy=function(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},s.push=function(e,t,i,r,o,u,c,f,h,p){var y,b,A=this;h.transmuxing.start=self.performance.now();var k=this.transmuxer,D=u?u.start:o.start,S=o.decryptdata,L=this.frag,N=!(L&&o.cc===L.cc),P=!(L&&h.level===L.level),V=L?h.sn-L.sn:-1,q=this.part?h.part-this.part.index:-1,j=V===0&&h.id>1&&h.id===(L==null?void 0:L.stats.chunkCount),ee=!P&&(V===1||V===0&&(q===1||j&&q<=0)),z=self.performance.now();(P||V||o.stats.parsing.start===0)&&(o.stats.parsing.start=z),!u||!q&&ee||(u.stats.parsing.start=z);var X=!(L&&((y=o.initSegment)==null?void 0:y.url)===((b=L.initSegment)==null?void 0:b.url)),ue=new Kv(N,ee,f,P,D,X);if(!ee||N||X){H.log("[transmuxer-interface, "+o.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
21
|
+
discontinuity: `+N+`
|
|
22
|
+
trackSwitch: `+P+`
|
|
23
|
+
contiguous: `+ee+`
|
|
24
24
|
accurateTimeOffset: `+f+`
|
|
25
25
|
timeOffset: `+D+`
|
|
26
|
-
initSegmentChange: `+X);var ne=new Uv(i,r,t,c,p);this.configureTransmuxer(ne)}if(this.frag=l,this.part=u,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:S,chunkMeta:h,state:ue},e instanceof ArrayBuffer?[e]:[]);else if(k){var be=k.push(e,S,h,ue);fa(be)?(k.async=!0,be.then(function(Fe){A.handleTransmuxComplete(Fe)}).catch(function(Fe){A.transmuxerError(Fe,h,"transmuxer-interface push error")})):(k.async=!1,this.handleTransmuxComplete(be))}},s.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var i=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(i){var r=i.flush(e);fa(r)||i.async?(fa(r)||(r=Promise.resolve(r)),r.then(function(l){t.handleFlushResult(l,e)}).catch(function(l){t.transmuxerError(l,e,"transmuxer-interface flush error")})):this.handleFlushResult(r,e)}},s.transmuxerError=function(e,t,i){this.hls&&(this.error=e,this.hls.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))},s.handleFlushResult=function(e,t){var i=this;e.forEach(function(r){i.handleTransmuxComplete(r)}),this.onFlush(t)},s.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":var r,l=(r=this.workerContext)==null?void 0:r.objectURL;l&&self.URL.revokeObjectURL(l);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":H[t.data.logType]&&H[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}},s.configureTransmuxer=function(e){var t=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)},s.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},d}(),Hv=function(){function d(e,t,i,r){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=t,this.fragmentTracker=i,this.hls=r}var s=d.prototype;return s.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},s.poll=function(e,t){var i=this.config,r=this.media,l=this.stalled;if(r!==null){var u=r.currentTime,c=r.seeking,f=this.seeking&&!c,h=!this.seeking&&c;if(this.seeking=c,u===e){if(h||f)this.stalled=null;else if(!(r.paused&&!c||r.ended||r.playbackRate===0)&&ke.getBuffered(r).length){var p=ke.bufferInfo(r,u,0),E=p.len>0,b=p.nextStart||0;if(E||b){if(c){var A=p.len>2,k=!b||t&&t.start<=u||b-u>2&&!this.fragmentTracker.getPartialFragment(u);if(A||k)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var D,S=Math.max(b,p.start||0)-u,I=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,F=!(I==null||(D=I.details)==null)&&D.live?2*I.details.targetduration:2,N=this.fragmentTracker.getPartialFragment(u);if(S>0&&(S<=F||N))return void this._trySkipBufferHole(N)}var V=self.performance.now();if(l!==null){var Y=V-l;if(c||!(Y>=250)||(this._reportStall(p),this.media)){var j=ke.bufferInfo(r,u,i.maxBufferHole);this._tryFixBufferStall(j,Y)}}else this.stalled=V}}}else if(this.moved=!0,l!==null){if(this.stallReported){var J=self.performance.now()-l;H.warn("playback not stuck anymore @"+u+", after "+Math.round(J)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},s._tryFixBufferStall=function(e,t){var i=this.config,r=this.fragmentTracker,l=this.media;if(l!==null){var u=l.currentTime,c=r.getPartialFragment(u);if(c&&(this._trySkipBufferHole(c)||!this.media))return;(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-u<i.maxBufferHole)&&t>1e3*i.highBufferWatchdogPeriod&&(H.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},s._reportStall=function(e){var t=this.hls,i=this.media;if(!this.stallReported&&i){this.stallReported=!0;var r=new Error("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(e)+")");H.warn(r.message),t.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len})}},s._trySkipBufferHole=function(e){var t=this.config,i=this.hls,r=this.media;if(r===null)return 0;var l=r.currentTime,u=ke.bufferInfo(r,l,0),c=l<u.start?u.start:u.nextStart;if(c){var f=u.len<=t.maxBufferHole,h=u.len>0&&u.len<1&&r.readyState<3,p=c-l;if(p>0&&(f||h)){if(p>t.maxBufferHole){var E=this.fragmentTracker,b=!1;if(l===0){var A=E.getAppendedFrag(0,rt);A&&c<A.end&&(b=!0)}if(!b){var k=e||E.getAppendedFrag(l,rt);if(k){for(var D=!1,S=k.end;S<c;){var I=E.getPartialFragment(S);if(!I){D=!0;break}S+=I.duration}if(D)return 0}}}var F=Math.max(c+.05,l+.1);if(H.warn("skipping hole, adjusting currentTime from "+l+" to "+F),this.moved=!0,this.stalled=null,r.currentTime=F,e&&!e.gap){var N=new Error("fragment loaded with buffer holes, seeking from "+l+" to "+F);i.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:N,reason:N.message,frag:e})}return F}}return 0},s._tryNudgeBuffer=function(){var e=this.config,t=this.hls,i=this.media,r=this.nudgeRetry;if(i!==null){var l=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){var u=l+(r+1)*e.nudgeOffset,c=new Error("Nudging 'currentTime' from "+l+" to "+u);H.warn(c.message),i.currentTime=u,t.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1})}else{var f=new Error("Playhead still not moving while enough data buffered @"+l+" after "+e.nudgeMaxRetry+" nudges");H.error(f.message),t.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.BUFFER_STALLED_ERROR,error:f,fatal:!0})}}},d}(),Gv=function(d){function s(t,i,r){var l;return(l=d.call(this,t,i,r,"[stream-controller]",rt)||this).audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.couldBacktrack=!1,l.backtrackFragment=null,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}z(s,d);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(w.ERROR,this.onError,this),t.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(w.BUFFER_CREATED,this.onBufferCreated,this),t.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(w.ERROR,this.onError,this),t.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(w.BUFFER_CREATED,this.onBufferCreated,this),t.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this)},e.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},e.startLoad=function(t){if(this.levels){var i=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var l=r.startLevel;l===-1&&(r.config.testBandwidth&&this.levels.length>1?(l=0,this.bitrateTest=!0):l=r.nextAutoLevel),this.level=r.nextLoadLevel=l,this.loadedmetadata=!1}i>0&&t===-1&&(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),t=i),this.state=Le,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=nt},e.stopLoad=function(){this._forceStartLoad=!1,d.prototype.stopLoad.call(this)},e.doTick=function(){switch(this.state){case Ja:var t,i=this.levels,r=this.level,l=i==null||(t=i[r])==null?void 0:t.details;if(l&&(!l.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(l))break;this.state=Le;break}break;case di:var u,c=self.performance.now(),f=this.retryDate;(!f||c>=f||(u=this.media)!=null&&u.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=Le)}this.state===Le&&this.doTickIdle(),this.onTickEnd()},e.onTickEnd=function(){d.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},e.doTickIdle=function(){var t=this.hls,i=this.levelLastLoaded,r=this.levels,l=this.media,u=t.config,c=t.nextLoadLevel;if(i!==null&&(l||!this.startFragRequested&&u.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&r!=null&&r[c]){var f=r[c],h=this.getMainFwdBufferInfo();if(h!==null){var p=this.getLevelDetails();if(p&&this._streamEnded(h,p)){var E={};return this.altAudio&&(E.type="video"),this.hls.trigger(w.BUFFER_EOS,E),void(this.state=ha)}t.loadLevel!==c&&t.manualLevel===-1&&this.log("Adapting to level "+c+" from level "+this.level),this.level=t.nextLoadLevel=c;var b=f.details;if(!b||this.state===Ja||b.live&&this.levelLastLoaded!==c)return this.level=c,void(this.state=Ja);var A=h.len,k=this.getMaxBufferLength(f.maxBitrate);if(!(A>=k)){this.backtrackFragment&&this.backtrackFragment.start>h.end&&(this.backtrackFragment=null);var D=this.backtrackFragment?this.backtrackFragment.start:h.end,S=this.getNextFragment(D,b);if(this.couldBacktrack&&!this.fragPrevious&&S&&S.sn!=="initSegment"&&this.fragmentTracker.getState(S)!==K){var I,F=((I=this.backtrackFragment)!=null?I:S).sn-b.startSN,N=b.fragments[F-1];N&&S.cc===N.cc&&(S=N,this.fragmentTracker.removeFragment(N))}else this.backtrackFragment&&h.len&&(this.backtrackFragment=null);if(S&&this.isLoopLoading(S,D)){if(!S.gap){var V=this.audioOnly&&!this.altAudio?Ne:ct,Y=(V===ct?this.videoBuffer:this.mediaBuffer)||this.media;Y&&this.afterBufferFlushed(Y,V,rt)}S=this.getNextFragmentLoopLoading(S,b,h,rt,k)}S&&(!S.initSegment||S.initSegment.data||this.bitrateTest||(S=S.initSegment),this.loadFragment(S,f,D))}}}},e.loadFragment=function(t,i,r){var l=this.fragmentTracker.getState(t);this.fragCurrent=t,l===x?t.sn==="initSegment"?this._loadInitSegment(t,i):this.bitrateTest?(this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t,i)):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,r)):this.clearTrackerIfNeeded(t)},e.getAppendedFrag=function(t){var i=this.fragmentTracker.getAppendedFrag(t,rt);return i&&"fragment"in i?i.fragment:i},e.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,rt)},e.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.end+.5):null},e.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},e.nextLevelSwitch=function(){var t=this.levels,i=this.media;if(i!=null&&i.readyState){var r,l=this.getAppendedFrag(i.currentTime);if(l&&l.start>1&&this.flushMainBuffer(0,l.start-1),!i.paused&&t){var u=t[this.hls.nextLoadLevel],c=this.fragLastKbps;r=c&&this.fragCurrent?this.fragCurrent.duration*u.maxBitrate/(1e3*c)+1:0}else r=0;var f=this.getBufferedFrag(i.currentTime+r);if(f){var h=this.followingBufferedFrag(f);if(h){this.abortCurrentFrag();var p=h.maxStartPTS?h.maxStartPTS:h.start,E=h.duration,b=Math.max(f.end,p+Math.min(Math.max(E-this.config.maxFragLookUpTolerance,.5*E),.75*E));this.flushMainBuffer(b,Number.POSITIVE_INFINITY)}}}},e.abortCurrentFrag=function(){var t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case Ri:case Di:case di:case ai:case Za:this.state=Le}this.nextLoadPosition=this.getLoadPosition()},e.flushMainBuffer=function(t,i){d.prototype.flushMainBuffer.call(this,t,i,this.altAudio?"video":null)},e.onMediaAttached=function(t,i){d.prototype.onMediaAttached.call(this,t,i);var r=i.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new Hv(this.config,r,this.fragmentTracker,this.hls)},e.onMediaDetaching=function(){var t=this.media;t&&this.onvplaying&&this.onvseeked&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),d.prototype.onMediaDetaching.call(this)},e.onMediaPlaying=function(){this.tick()},e.onMediaSeeked=function(){var t=this.media,i=t?t.currentTime:null;le(i)&&this.log("Media seeked to "+i.toFixed(3));var r=this.getMainFwdBufferInfo();r!==null&&r.len!==0?this.tick():this.warn('Main forward buffer length on "seeked" event '+(r?r.len:"empty")+")")},e.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(w.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null,this.backtrackFragment=null},e.onManifestParsed=function(t,i){var r,l,u,c=!1,f=!1;i.levels.forEach(function(h){(r=h.audioCodec)&&(r.indexOf("mp4a.40.2")!==-1&&(c=!0),r.indexOf("mp4a.40.5")!==-1&&(f=!0))}),this.audioCodecSwitch=c&&f&&typeof((u=uh())==null||(l=u.prototype)==null?void 0:l.changeType)!="function",this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=i.levels,this.startFragRequested=!1},e.onLevelLoading=function(t,i){var r=this.levels;if(r&&this.state===Le){var l=r[i.level];(!l.details||l.details.live&&this.levelLastLoaded!==i.level||this.waitForCdnTuneIn(l.details))&&(this.state=Ja)}},e.onLevelLoaded=function(t,i){var r,l=this.levels,u=i.level,c=i.details,f=c.totalduration;if(l){this.log("Level "+u+" loaded ["+c.startSN+","+c.endSN+"], cc ["+c.startCC+", "+c.endCC+"] duration:"+f);var h=l[u],p=this.fragCurrent;!p||this.state!==Di&&this.state!==di||p.level===i.level&&p.urlId===h.urlId||!p.loader||this.abortCurrentFrag();var E=0;if(c.live||(r=h.details)!=null&&r.live){if(c.fragments[0]||(c.deltaUpdateFailed=!0),c.deltaUpdateFailed)return;E=this.alignPlaylists(c,h.details)}if(h.details=c,this.levelLastLoaded=u,this.hls.trigger(w.LEVEL_UPDATED,{details:c,level:u}),this.state===Ja){if(this.waitForCdnTuneIn(c))return;this.state=Le}this.startFragRequested?c.live&&this.synchronizeToLiveEdge(c):this.setStartPosition(c,E),this.tick()}else this.warn("Levels were reset while loading level "+u)},e._handleFragmentLoadProgress=function(t){var i,r=t.frag,l=t.part,u=t.payload,c=this.levels;if(c){var f=c[r.level],h=f.details;if(!h)return this.warn("Dropping fragment "+r.sn+" of level "+r.level+" after level details were reset"),void this.fragmentTracker.removeFragment(r);var p=f.videoCodec,E=h.PTSKnown||!h.live,b=(i=r.initSegment)==null?void 0:i.data,A=this._getAudioCodec(f),k=this.transmuxer=this.transmuxer||new Ih(this.hls,rt,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),D=l?l.index:-1,S=D!==-1,I=new ft(r.level,r.sn,r.stats.chunkCount,u.byteLength,D,S),F=this.initPTS[r.cc];k.push(u,b,A,p,r,l,h.totalduration,E,I,F)}else this.warn("Levels were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},e.onAudioTrackSwitching=function(t,i){var r=this.altAudio;if(!i.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var l=this.fragCurrent;l&&(this.log("Switching to main audio track, cancel main fragment load"),l.abortRequests(),this.fragmentTracker.removeFragment(l)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var u=this.hls;r&&(u.trigger(w.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),u.trigger(w.AUDIO_TRACK_SWITCHED,i)}},e.onAudioTrackSwitched=function(t,i){var r=i.id,l=!!this.hls.audioTracks[r].url;if(l){var u=this.videoBuffer;u&&this.mediaBuffer!==u&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=u)}this.altAudio=l,this.tick()},e.onBufferCreated=function(t,i){var r,l,u=i.tracks,c=!1;for(var f in u){var h=u[f];if(h.id==="main"){if(l=f,r=h,f==="video"){var p=u[f];p&&(this.videoBuffer=p.buffer)}}else c=!0}c&&r?(this.log("Alternate track found, use "+l+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},e.onFragBuffered=function(t,i){var r=i.frag,l=i.part;if(!r||r.type===rt){if(this.fragContextChanged(r))return this.warn("Fragment "+r.sn+(l?" p: "+l.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Za&&(this.state=Le));var u=l?l.stats:r.stats;this.fragLastKbps=Math.round(8*u.total/(u.buffering.end-u.loading.first)),r.sn!=="initSegment"&&(this.fragPrevious=r),this.fragBufferedComplete(r,l)}},e.onError=function(t,i){var r;if(i.fatal)this.state=Gr;else switch(i.details){case W.FRAG_GAP:case W.FRAG_PARSING_ERROR:case W.FRAG_DECRYPT_ERROR:case W.FRAG_LOAD_ERROR:case W.FRAG_LOAD_TIMEOUT:case W.KEY_LOAD_ERROR:case W.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(rt,i);break;case W.LEVEL_LOAD_ERROR:case W.LEVEL_LOAD_TIMEOUT:case W.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==Ja||((r=i.context)==null?void 0:r.type)!==yr||(this.state=Le);break;case W.BUFFER_FULL_ERROR:if(!i.parent||i.parent!=="main")return;this.reduceLengthAndFlushBuffer(i)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case W.INTERNAL_EXCEPTION:this.recoverWorkerError(i)}},e.checkBuffer=function(){var t=this.media,i=this.gapController;if(t&&i&&t.readyState){if(this.loadedmetadata||!ke.getBuffered(t).length){var r=this.state!==Le?this.fragCurrent:null;i.poll(this.lastCurrentTime,r)}this.lastCurrentTime=t.currentTime}},e.onFragLoadEmergencyAborted=function(){this.state=Le,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},e.onBufferFlushed=function(t,i){var r=i.type;if(r!==Ne||this.audioOnly&&!this.altAudio){var l=(r===ct?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(l,r,rt)}},e.onLevelsUpdated=function(t,i){this.levels=i.levels},e.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},e.seekToStartPos=function(){var t=this.media;if(t){var i=t.currentTime,r=this.startPosition;if(r>=0&&i<r){if(t.seeking)return void this.log("could not seek to "+r+", already seeking at "+i);var l=ke.getBuffered(t),u=(l.length?l.start(0):0)-r;u>0&&(u<this.config.maxBufferHole||u<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+u+" to match buffer start"),r+=u,this.startPosition=r),this.log("seek to target start position "+r+" from current time "+i),t.currentTime=r}}},e._getAudioCodec=function(t){var i=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&i&&(this.log("Swapping audio codec"),i=i.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),i},e._loadBitrateTestFrag=function(t,i){var r=this;t.bitrateTest=!0,this._doFragLoad(t,i).then(function(l){var u=r.hls;if(l&&!r.fragContextChanged(t)){i.fragmentError=0,r.state=Le,r.startFragRequested=!1,r.bitrateTest=!1;var c=t.stats;c.parsing.start=c.parsing.end=c.buffering.start=c.buffering.end=self.performance.now(),u.trigger(w.FRAG_LOADED,l),t.bitrateTest=!1}})},e._handleTransmuxComplete=function(t){var i,r="main",l=this.hls,u=t.remuxResult,c=t.chunkMeta,f=this.getCurrentContext(c);if(f){var h=f.frag,p=f.part,E=f.level,b=u.video,A=u.text,k=u.id3,D=u.initSegment,S=E.details,I=this.altAudio?void 0:u.audio;if(this.fragContextChanged(h))this.fragmentTracker.removeFragment(h);else{if(this.state=ai,D){D.tracks&&(this._bufferInitSegment(E,D.tracks,h,c),l.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:h,id:r,tracks:D.tracks}));var F=D.initPTS,N=D.timescale;le(F)&&(this.initPTS[h.cc]={baseTime:F,timescale:N},l.trigger(w.INIT_PTS_FOUND,{frag:h,id:r,initPTS:F,timescale:N}))}if(b&&u.independent!==!1){if(S){var V=b.startPTS,Y=b.endPTS,j=b.startDTS,J=b.endDTS;if(p)p.elementaryStreams[b.type]={startPTS:V,endPTS:Y,startDTS:j,endDTS:J};else if(b.firstKeyFrame&&b.independent&&c.id===1&&(this.couldBacktrack=!0),b.dropped&&b.independent){var Q=this.getMainFwdBufferInfo();if((Q?Q.end:this.getLoadPosition())+this.config.maxBufferHole<(b.firstKeyFramePTS?b.firstKeyFramePTS:V)-this.config.maxBufferHole)return void this.backtrack(h);h.setElementaryStreamInfo(b.type,h.start,Y,h.start,J,!0)}h.setElementaryStreamInfo(b.type,V,Y,j,J),this.backtrackFragment&&(this.backtrackFragment=h),this.bufferFragmentData(b,h,p,c)}}else if(u.independent===!1)return void this.backtrack(h);if(I){var X=I.startPTS,ue=I.endPTS,ne=I.startDTS,be=I.endDTS;p&&(p.elementaryStreams[Ne]={startPTS:X,endPTS:ue,startDTS:ne,endDTS:be}),h.setElementaryStreamInfo(Ne,X,ue,ne,be),this.bufferFragmentData(I,h,p,c)}if(S&&k!=null&&(i=k.samples)!=null&&i.length){var Fe={id:r,frag:h,details:S,samples:k.samples};l.trigger(w.FRAG_PARSING_METADATA,Fe)}if(S&&A){var ye={id:r,frag:h,details:S,samples:A.samples};l.trigger(w.FRAG_PARSING_USERDATA,ye)}}}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,r,l){var u=this;if(this.state===ai){this.audioOnly=!!i.audio&&!i.video,this.altAudio&&!this.audioOnly&&delete i.audio;var c=i.audio,f=i.video,h=i.audiovideo;if(c){var p=t.audioCodec,E=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(p&&(p=p.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),c.metadata.channelCount!==1&&E.indexOf("firefox")===-1&&(p="mp4a.40.5")),E.indexOf("android")!==-1&&c.container!=="audio/mpeg"&&(p="mp4a.40.2",this.log("Android: force audio codec to "+p)),t.audioCodec&&t.audioCodec!==p&&this.log('Swapping manifest audio codec "'+t.audioCodec+'" for "'+p+'"'),c.levelCodec=p,c.id="main",this.log("Init audio buffer, container:"+c.container+", codecs[selected/level/parsed]=["+(p||"")+"/"+(t.audioCodec||"")+"/"+c.codec+"]")}f&&(f.levelCodec=t.videoCodec,f.id="main",this.log("Init video buffer, container:"+f.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+f.codec+"]")),h&&this.log("Init audiovideo buffer, container:"+h.container+", codecs[level/parsed]=["+(t.attrs.CODECS||"")+"/"+h.codec+"]"),this.hls.trigger(w.BUFFER_CODECS,i),Object.keys(i).forEach(function(b){var A=i[b].initSegment;A!=null&&A.byteLength&&u.hls.trigger(w.BUFFER_APPENDING,{type:b,data:A,frag:r,part:null,chunkMeta:l,parent:r.type})}),this.tick()}},e.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,rt)},e.backtrack=function(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=Le},e.checkFragmentChanged=function(){var t=this.media,i=null;if(t&&t.readyState>1&&t.seeking===!1){var r=t.currentTime;if(ke.isBuffered(t,r)?i=this.getAppendedFrag(r):ke.isBuffered(t,r+.1)&&(i=this.getAppendedFrag(r+.1)),i){this.backtrackFragment=null;var l=this.fragPlaying,u=i.level;l&&i.sn===l.sn&&l.level===u&&i.urlId===l.urlId||(this.fragPlaying=i,this.hls.trigger(w.FRAG_CHANGED,{frag:i}),l&&l.level===u||this.hls.trigger(w.LEVEL_SWITCHED,{level:u}))}}},M(s,[{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"currentFrag",get:function(){var t=this.media;return t?this.fragPlaying||this.getAppendedFrag(t.currentTime):null}},{key:"currentProgramDateTime",get:function(){var t=this.media;if(t){var i=t.currentTime,r=this.currentFrag;if(r&&le(i)&&le(r.programDateTime)){var l=r.programDateTime+1e3*(i-r.start);return new Date(l)}}return null}},{key:"currentLevel",get:function(){var t=this.currentFrag;return t?t.level:-1}},{key:"nextBufferedFrag",get:function(){var t=this.currentFrag;return t?this.followingBufferedFrag(t):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),s}(Pd),tn=function(){function d(e,t,i){t===void 0&&(t=0),i===void 0&&(i=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_=t,this.totalWeight_=i}var s=d.prototype;return s.sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},s.getTotalWeight=function(){return this.totalWeight_},s.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},d}(),Vv=function(){function d(e,t,i,r){r===void 0&&(r=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new tn(e),this.fast_=new tn(t),this.defaultTTFB_=r,this.ttfb_=new tn(e)}var s=d.prototype;return s.update=function(e,t){var i=this.slow_,r=this.fast_,l=this.ttfb_;i.halfLife!==e&&(this.slow_=new tn(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new tn(t,r.getEstimate(),r.getTotalWeight())),l.halfLife!==e&&(this.ttfb_=new tn(e,l.getEstimate(),l.getTotalWeight()))},s.sample=function(e,t){var i=(e=Math.max(e,this.minDelayMs_))/1e3,r=8*t/i;this.fast_.sample(i,r),this.slow_.sample(i,r)},s.sampleTTFB=function(e){var t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))},s.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},s.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},s.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},s.destroy=function(){},d}(),Kv=function(){function d(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;var t=e.config;this.bwEstimator=new Vv(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.FRAG_LOADING,this.onFragLoading,this),e.on(w.FRAG_LOADED,this.onFragLoaded,this),e.on(w.FRAG_BUFFERED,this.onFragBuffered,this),e.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(w.LEVEL_LOADED,this.onLevelLoaded,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.FRAG_LOADING,this.onFragLoading,this),e.off(w.FRAG_LOADED,this.onFragLoaded,this),e.off(w.FRAG_BUFFERED,this.onFragBuffered,this),e.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(w.LEVEL_LOADED,this.onLevelLoaded,this)},s.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},s.onFragLoading=function(e,t){var i,r=t.frag;this.ignoreFragment(r)||(this.fragCurrent=r,this.partCurrent=(i=t.part)!=null?i:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))},s.onLevelSwitching=function(e,t){this.clearTimer()},s.getTimeToLoadFrag=function(e,t,i,r){return e+i/t+(r?this.lastLevelLoadSec:0)},s.onLevelLoaded=function(e,t){var i=this.hls.config,r=t.stats,l=r.total,u=r.bwEstimate;le(l)&&le(u)&&(this.lastLevelLoadSec=8*l/u),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},s._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,r=i.autoLevelEnabled,l=i.media;if(e&&l){var u=performance.now(),c=t?t.stats:e.stats,f=t?t.duration:e.duration,h=u-c.loading.start;if(c.aborted||c.loaded&&c.loaded===c.total||e.level===0)return this.clearTimer(),void(this._nextAutoLevel=-1);if(r&&!l.paused&&l.playbackRate&&l.readyState){var p=i.mainForwardBufferInfo;if(p!==null){var E=this.bwEstimator.getEstimateTTFB(),b=Math.abs(l.playbackRate);if(!(h<=Math.max(E,f/(2*b)*1e3))){var A=p.len/b;if(!(A>=2*f/b)){var k=c.loading.first?c.loading.first-c.loading.start:-1,D=c.loaded&&k>-1,S=this.bwEstimator.getEstimate(),I=i.levels,F=i.minAutoLevel,N=I[e.level],V=c.total||Math.max(c.loaded,Math.round(f*N.maxBitrate/8)),Y=h-k;Y<1&&D&&(Y=Math.min(h,8*c.loaded/S));var j=D?1e3*c.loaded/Y:0,J=j?(V-c.loaded)/j:8*V/S+E/1e3;if(!(J<=A)){var Q,X=j?8*j:S,ue=Number.POSITIVE_INFINITY;for(Q=e.level-1;Q>F;Q--){var ne=I[Q].maxBitrate;if((ue=this.getTimeToLoadFrag(E/1e3,X,f*ne,!I[Q].details))<A)break}ue>=J||ue>10*f||(i.nextLoadLevel=Q,D?this.bwEstimator.sample(h-Math.min(E,k),c.loaded):this.bwEstimator.sampleTTFB(h),this.clearTimer(),H.warn("[abr] Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+` is loading too slowly;
|
|
26
|
+
initSegmentChange: `+X);var ne=new Vv(i,r,t,c,p);this.configureTransmuxer(ne)}if(this.frag=o,this.part=u,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:S,chunkMeta:h,state:ue},e instanceof ArrayBuffer?[e]:[]);else if(k){var Te=k.push(e,S,h,ue);Aa(Te)?(k.async=!0,Te.then(function(Me){A.handleTransmuxComplete(Me)}).catch(function(Me){A.transmuxerError(Me,h,"transmuxer-interface push error")})):(k.async=!1,this.handleTransmuxComplete(Te))}},s.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var i=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(i){var r=i.flush(e);Aa(r)||i.async?(Aa(r)||(r=Promise.resolve(r)),r.then(function(o){t.handleFlushResult(o,e)}).catch(function(o){t.transmuxerError(o,e,"transmuxer-interface flush error")})):this.handleFlushResult(r,e)}},s.transmuxerError=function(e,t,i){this.hls&&(this.error=e,this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))},s.handleFlushResult=function(e,t){var i=this;e.forEach(function(r){i.handleTransmuxComplete(r)}),this.onFlush(t)},s.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":var r,o=(r=this.workerContext)==null?void 0:r.objectURL;o&&self.URL.revokeObjectURL(o);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":H[t.data.logType]&&H[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}},s.configureTransmuxer=function(e){var t=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)},s.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},d}(),Wv=function(){function d(e,t,i,r){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=t,this.fragmentTracker=i,this.hls=r}var s=d.prototype;return s.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},s.poll=function(e,t){var i=this.config,r=this.media,o=this.stalled;if(r!==null){var u=r.currentTime,c=r.seeking,f=this.seeking&&!c,h=!this.seeking&&c;if(this.seeking=c,u===e){if(h||f)this.stalled=null;else if(!(r.paused&&!c||r.ended||r.playbackRate===0)&&ce.getBuffered(r).length){var p=ce.bufferInfo(r,u,0),y=p.len>0,b=p.nextStart||0;if(y||b){if(c){var A=p.len>2,k=!b||t&&t.start<=u||b-u>2&&!this.fragmentTracker.getPartialFragment(u);if(A||k)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var D,S=Math.max(b,p.start||0)-u,L=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=!(L==null||(D=L.details)==null)&&D.live?2*L.details.targetduration:2,P=this.fragmentTracker.getPartialFragment(u);if(S>0&&(S<=N||P))return void this._trySkipBufferHole(P)}var V=self.performance.now();if(o!==null){var q=V-o;if(c||!(q>=250)||(this._reportStall(p),this.media)){var j=ce.bufferInfo(r,u,i.maxBufferHole);this._tryFixBufferStall(j,q)}}else this.stalled=V}}}else if(this.moved=!0,o!==null){if(this.stallReported){var ee=self.performance.now()-o;H.warn("playback not stuck anymore @"+u+", after "+Math.round(ee)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},s._tryFixBufferStall=function(e,t){var i=this.config,r=this.fragmentTracker,o=this.media;if(o!==null){var u=o.currentTime,c=r.getPartialFragment(u);if(c&&(this._trySkipBufferHole(c)||!this.media))return;(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-u<i.maxBufferHole)&&t>1e3*i.highBufferWatchdogPeriod&&(H.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},s._reportStall=function(e){var t=this.hls,i=this.media;if(!this.stallReported&&i){this.stallReported=!0;var r=new Error("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(e)+")");H.warn(r.message),t.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len})}},s._trySkipBufferHole=function(e){var t=this.config,i=this.hls,r=this.media;if(r===null)return 0;var o=r.currentTime,u=ce.bufferInfo(r,o,0),c=o<u.start?u.start:u.nextStart;if(c){var f=u.len<=t.maxBufferHole,h=u.len>0&&u.len<1&&r.readyState<3,p=c-o;if(p>0&&(f||h)){if(p>t.maxBufferHole){var y=this.fragmentTracker,b=!1;if(o===0){var A=y.getAppendedFrag(0,et);A&&c<A.end&&(b=!0)}if(!b){var k=e||y.getAppendedFrag(o,et);if(k){for(var D=!1,S=k.end;S<c;){var L=y.getPartialFragment(S);if(!L){D=!0;break}S+=L.duration}if(D)return 0}}}var N=Math.max(c+.05,o+.1);if(H.warn("skipping hole, adjusting currentTime from "+o+" to "+N),this.moved=!0,this.stalled=null,r.currentTime=N,e&&!e.gap){var P=new Error("fragment loaded with buffer holes, seeking from "+o+" to "+N);i.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:P,reason:P.message,frag:e})}return N}}return 0},s._tryNudgeBuffer=function(){var e=this.config,t=this.hls,i=this.media,r=this.nudgeRetry;if(i!==null){var o=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){var u=o+(r+1)*e.nudgeOffset,c=new Error("Nudging 'currentTime' from "+o+" to "+u);H.warn(c.message),i.currentTime=u,t.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1})}else{var f=new Error("Playhead still not moving while enough data buffered @"+o+" after "+e.nudgeMaxRetry+" nudges");H.error(f.message),t.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:f,fatal:!0})}}},d}(),qv=function(d){function s(t,i,r){var o;return(o=d.call(this,t,i,r,"[stream-controller]",et)||this).audioCodecSwap=!1,o.gapController=null,o.level=-1,o._forceStartLoad=!1,o.altAudio=!1,o.audioOnly=!1,o.fragPlaying=null,o.onvplaying=null,o.onvseeked=null,o.fragLastKbps=0,o.couldBacktrack=!1,o.backtrackFragment=null,o.audioCodecSwitch=!1,o.videoBuffer=null,o._registerListeners(),o}Q(s,d);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(w.ERROR,this.onError,this),t.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(w.BUFFER_CREATED,this.onBufferCreated,this),t.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(w.ERROR,this.onError,this),t.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(w.BUFFER_CREATED,this.onBufferCreated,this),t.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this)},e.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},e.startLoad=function(t){if(this.levels){var i=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var o=r.startLevel;o===-1&&(r.config.testBandwidth&&this.levels.length>1?(o=0,this.bitrateTest=!0):o=r.nextAutoLevel),this.level=r.nextLoadLevel=o,this.loadedmetadata=!1}i>0&&t===-1&&(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),t=i),this.state=Le,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=Rt},e.stopLoad=function(){this._forceStartLoad=!1,d.prototype.stopLoad.call(this)},e.doTick=function(){switch(this.state){case tn:var t,i=this.levels,r=this.level,o=i==null||(t=i[r])==null?void 0:t.details;if(o&&(!o.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(o))break;this.state=Le;break}break;case Gr:var u,c=self.performance.now(),f=this.retryDate;(!f||c>=f||(u=this.media)!=null&&u.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=Le)}this.state===Le&&this.doTickIdle(),this.onTickEnd()},e.onTickEnd=function(){d.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},e.doTickIdle=function(){var t=this.hls,i=this.levelLastLoaded,r=this.levels,o=this.media,u=t.config,c=t.nextLoadLevel;if(i!==null&&(o||!this.startFragRequested&&u.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&r!=null&&r[c]){var f=r[c],h=this.getMainFwdBufferInfo();if(h!==null){var p=this.getLevelDetails();if(p&&this._streamEnded(h,p)){var y={};return this.altAudio&&(y.type="video"),this.hls.trigger(w.BUFFER_EOS,y),void(this.state=ss)}t.loadLevel!==c&&t.manualLevel===-1&&this.log("Adapting to level "+c+" from level "+this.level),this.level=t.nextLoadLevel=c;var b=f.details;if(!b||this.state===tn||b.live&&this.levelLastLoaded!==c)return this.level=c,void(this.state=tn);var A=h.len,k=this.getMaxBufferLength(f.maxBitrate);if(!(A>=k)){this.backtrackFragment&&this.backtrackFragment.start>h.end&&(this.backtrackFragment=null);var D=this.backtrackFragment?this.backtrackFragment.start:h.end,S=this.getNextFragment(D,b);if(this.couldBacktrack&&!this.fragPrevious&&S&&S.sn!=="initSegment"&&this.fragmentTracker.getState(S)!==Se){var L,N=((L=this.backtrackFragment)!=null?L:S).sn-b.startSN,P=b.fragments[N-1];P&&S.cc===P.cc&&(S=P,this.fragmentTracker.removeFragment(P))}else this.backtrackFragment&&h.len&&(this.backtrackFragment=null);if(S&&this.isLoopLoading(S,D)){if(!S.gap){var V=this.audioOnly&&!this.altAudio?ht:Tt,q=(V===Tt?this.videoBuffer:this.mediaBuffer)||this.media;q&&this.afterBufferFlushed(q,V,et)}S=this.getNextFragmentLoopLoading(S,b,h,et,k)}S&&(!S.initSegment||S.initSegment.data||this.bitrateTest||(S=S.initSegment),this.loadFragment(S,f,D))}}}},e.loadFragment=function(t,i,r){var o=this.fragmentTracker.getState(t);this.fragCurrent=t,o===Z||o===ye?t.sn==="initSegment"?this._loadInitSegment(t,i):this.bitrateTest?(this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t,i)):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,r)):this.clearTrackerIfNeeded(t)},e.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,et)},e.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.end+.5):null},e.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},e.nextLevelSwitch=function(){var t=this.levels,i=this.media;if(i!=null&&i.readyState){var r,o=this.getAppendedFrag(i.currentTime);o&&o.start>1&&this.flushMainBuffer(0,o.start-1);var u=this.getLevelDetails();if(u!=null&&u.live){var c=this.getMainFwdBufferInfo();if(!c||c.len<2*u.targetduration)return}if(!i.paused&&t){var f=t[this.hls.nextLoadLevel],h=this.fragLastKbps;r=h&&this.fragCurrent?this.fragCurrent.duration*f.maxBitrate/(1e3*h)+1:0}else r=0;var p=this.getBufferedFrag(i.currentTime+r);if(p){var y=this.followingBufferedFrag(p);if(y){this.abortCurrentFrag();var b=y.maxStartPTS?y.maxStartPTS:y.start,A=y.duration,k=Math.max(p.end,b+Math.min(Math.max(A-this.config.maxFragLookUpTolerance,.5*A),.75*A));this.flushMainBuffer(k,Number.POSITIVE_INFINITY)}}}},e.abortCurrentFrag=function(){var t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case gr:case Hr:case Gr:case yr:case No:this.state=Le}this.nextLoadPosition=this.getLoadPosition()},e.flushMainBuffer=function(t,i){d.prototype.flushMainBuffer.call(this,t,i,this.altAudio?"video":null)},e.onMediaAttached=function(t,i){d.prototype.onMediaAttached.call(this,t,i);var r=i.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new Wv(this.config,r,this.fragmentTracker,this.hls)},e.onMediaDetaching=function(){var t=this.media;t&&this.onvplaying&&this.onvseeked&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),d.prototype.onMediaDetaching.call(this)},e.onMediaPlaying=function(){this.tick()},e.onMediaSeeked=function(){var t=this.media,i=t?t.currentTime:null;oe(i)&&this.log("Media seeked to "+i.toFixed(3));var r=this.getMainFwdBufferInfo();r!==null&&r.len!==0?this.tick():this.warn('Main forward buffer length on "seeked" event '+(r?r.len:"empty")+")")},e.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(w.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.levels=this.fragPlaying=this.backtrackFragment=null,this.altAudio=this.audioOnly=!1},e.onManifestParsed=function(t,i){var r,o,u,c=!1,f=!1;i.levels.forEach(function(h){(r=h.audioCodec)&&(r.indexOf("mp4a.40.2")!==-1&&(c=!0),r.indexOf("mp4a.40.5")!==-1&&(f=!0))}),this.audioCodecSwitch=c&&f&&typeof((u=Eh())==null||(o=u.prototype)==null?void 0:o.changeType)!="function",this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=i.levels,this.startFragRequested=!1},e.onLevelLoading=function(t,i){var r=this.levels;if(r&&this.state===Le){var o=r[i.level];(!o.details||o.details.live&&this.levelLastLoaded!==i.level||this.waitForCdnTuneIn(o.details))&&(this.state=tn)}},e.onLevelLoaded=function(t,i){var r,o=this.levels,u=i.level,c=i.details,f=c.totalduration;if(o){this.log("Level "+u+" loaded ["+c.startSN+","+c.endSN+"]"+(c.lastPartSn?"[part-"+c.lastPartSn+"-"+c.lastPartIndex+"]":"")+", cc ["+c.startCC+", "+c.endCC+"] duration:"+f);var h=o[u],p=this.fragCurrent;!p||this.state!==Hr&&this.state!==Gr||p.level===i.level&&p.urlId===h.urlId||!p.loader||this.abortCurrentFrag();var y=0;if(c.live||(r=h.details)!=null&&r.live){if(c.fragments[0]||(c.deltaUpdateFailed=!0),c.deltaUpdateFailed)return;y=this.alignPlaylists(c,h.details)}if(h.details=c,this.levelLastLoaded=u,this.hls.trigger(w.LEVEL_UPDATED,{details:c,level:u}),this.state===tn){if(this.waitForCdnTuneIn(c))return;this.state=Le}this.startFragRequested?c.live&&this.synchronizeToLiveEdge(c):this.setStartPosition(c,y),this.tick()}else this.warn("Levels were reset while loading level "+u)},e._handleFragmentLoadProgress=function(t){var i,r=t.frag,o=t.part,u=t.payload,c=this.levels;if(c){var f=c[r.level],h=f.details;if(!h)return this.warn("Dropping fragment "+r.sn+" of level "+r.level+" after level details were reset"),void this.fragmentTracker.removeFragment(r);var p=f.videoCodec,y=h.PTSKnown||!h.live,b=(i=r.initSegment)==null?void 0:i.data,A=this._getAudioCodec(f),k=this.transmuxer=this.transmuxer||new Uh(this.hls,et,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),D=o?o.index:-1,S=D!==-1,L=new he(r.level,r.sn,r.stats.chunkCount,u.byteLength,D,S),N=this.initPTS[r.cc];k.push(u,b,A,p,r,o,h.totalduration,y,L,N)}else this.warn("Levels were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},e.onAudioTrackSwitching=function(t,i){var r=this.altAudio;if(!i.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var u=this.hls;r&&(u.trigger(w.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),u.trigger(w.AUDIO_TRACK_SWITCHED,i)}},e.onAudioTrackSwitched=function(t,i){var r=i.id,o=!!this.hls.audioTracks[r].url;if(o){var u=this.videoBuffer;u&&this.mediaBuffer!==u&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=u)}this.altAudio=o,this.tick()},e.onBufferCreated=function(t,i){var r,o,u=i.tracks,c=!1;for(var f in u){var h=u[f];if(h.id==="main"){if(o=f,r=h,f==="video"){var p=u[f];p&&(this.videoBuffer=p.buffer)}}else c=!0}c&&r?(this.log("Alternate track found, use "+o+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},e.onFragBuffered=function(t,i){var r=i.frag,o=i.part;if(!r||r.type===et){if(this.fragContextChanged(r))return this.warn("Fragment "+r.sn+(o?" p: "+o.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===No&&(this.state=Le));var u=o?o.stats:r.stats;this.fragLastKbps=Math.round(8*u.total/(u.buffering.end-u.loading.first)),r.sn!=="initSegment"&&(this.fragPrevious=r),this.fragBufferedComplete(r,o)}},e.onError=function(t,i){var r;if(i.fatal)this.state=en;else switch(i.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(et,i);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==tn||((r=i.context)==null?void 0:r.type)!==mr||(this.state=Le);break;case $.BUFFER_FULL_ERROR:if(!i.parent||i.parent!=="main")return;this.reduceLengthAndFlushBuffer(i)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(i)}},e.checkBuffer=function(){var t=this.media,i=this.gapController;if(t&&i&&t.readyState){if(this.loadedmetadata||!ce.getBuffered(t).length){var r=this.state!==Le?this.fragCurrent:null;i.poll(this.lastCurrentTime,r)}this.lastCurrentTime=t.currentTime}},e.onFragLoadEmergencyAborted=function(){this.state=Le,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},e.onBufferFlushed=function(t,i){var r=i.type;if(r!==ht||this.audioOnly&&!this.altAudio){var o=(r===Tt?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(o,r,et)}},e.onLevelsUpdated=function(t,i){this.levels=i.levels},e.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},e.seekToStartPos=function(){var t=this.media;if(t){var i=t.currentTime,r=this.startPosition;if(r>=0&&i<r){if(t.seeking)return void this.log("could not seek to "+r+", already seeking at "+i);var o=ce.getBuffered(t),u=(o.length?o.start(0):0)-r;u>0&&(u<this.config.maxBufferHole||u<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+u+" to match buffer start"),r+=u,this.startPosition=r),this.log("seek to target start position "+r+" from current time "+i),t.currentTime=r}}},e._getAudioCodec=function(t){var i=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&i&&(this.log("Swapping audio codec"),i=i.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),i},e._loadBitrateTestFrag=function(t,i){var r=this;t.bitrateTest=!0,this._doFragLoad(t,i).then(function(o){var u=r.hls;if(o&&!r.fragContextChanged(t)){i.fragmentError=0,r.state=Le,r.startFragRequested=!1,r.bitrateTest=!1;var c=t.stats;c.parsing.start=c.parsing.end=c.buffering.start=c.buffering.end=self.performance.now(),u.trigger(w.FRAG_LOADED,o),t.bitrateTest=!1}})},e._handleTransmuxComplete=function(t){var i,r="main",o=this.hls,u=t.remuxResult,c=t.chunkMeta,f=this.getCurrentContext(c);if(f){var h=f.frag,p=f.part,y=f.level,b=u.video,A=u.text,k=u.id3,D=u.initSegment,S=y.details,L=this.altAudio?void 0:u.audio;if(this.fragContextChanged(h))this.fragmentTracker.removeFragment(h);else{if(this.state=yr,D){if(D!=null&&D.tracks){var N=h.initSegment||h;this._bufferInitSegment(y,D.tracks,N,c),o.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:r,tracks:D.tracks})}var P=D.initPTS,V=D.timescale;oe(P)&&(this.initPTS[h.cc]={baseTime:P,timescale:V},o.trigger(w.INIT_PTS_FOUND,{frag:h,id:r,initPTS:P,timescale:V}))}if(b&&u.independent!==!1){if(S){var q=b.startPTS,j=b.endPTS,ee=b.startDTS,z=b.endDTS;if(p)p.elementaryStreams[b.type]={startPTS:q,endPTS:j,startDTS:ee,endDTS:z};else if(b.firstKeyFrame&&b.independent&&c.id===1&&(this.couldBacktrack=!0),b.dropped&&b.independent){var X=this.getMainFwdBufferInfo();if((X?X.end:this.getLoadPosition())+this.config.maxBufferHole<(b.firstKeyFramePTS?b.firstKeyFramePTS:q)-this.config.maxBufferHole)return void this.backtrack(h);h.setElementaryStreamInfo(b.type,h.start,j,h.start,z,!0)}h.setElementaryStreamInfo(b.type,q,j,ee,z),this.backtrackFragment&&(this.backtrackFragment=h),this.bufferFragmentData(b,h,p,c)}}else if(u.independent===!1)return void this.backtrack(h);if(L){var ue=L.startPTS,ne=L.endPTS,Te=L.startDTS,Me=L.endDTS;p&&(p.elementaryStreams[ht]={startPTS:ue,endPTS:ne,startDTS:Te,endDTS:Me}),h.setElementaryStreamInfo(ht,ue,ne,Te,Me),this.bufferFragmentData(L,h,p,c)}if(S&&k!=null&&(i=k.samples)!=null&&i.length){var _e={id:r,frag:h,details:S,samples:k.samples};o.trigger(w.FRAG_PARSING_METADATA,_e)}if(S&&A){var De={id:r,frag:h,details:S,samples:A.samples};o.trigger(w.FRAG_PARSING_USERDATA,De)}}}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,r,o){var u=this;if(this.state===yr){this.audioOnly=!!i.audio&&!i.video,this.altAudio&&!this.audioOnly&&delete i.audio;var c=i.audio,f=i.video,h=i.audiovideo;if(c){var p=t.audioCodec,y=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(p&&(p=p.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),c.metadata.channelCount!==1&&y.indexOf("firefox")===-1&&(p="mp4a.40.5")),y.indexOf("android")!==-1&&c.container!=="audio/mpeg"&&(p="mp4a.40.2",this.log("Android: force audio codec to "+p)),t.audioCodec&&t.audioCodec!==p&&this.log('Swapping manifest audio codec "'+t.audioCodec+'" for "'+p+'"'),c.levelCodec=p,c.id="main",this.log("Init audio buffer, container:"+c.container+", codecs[selected/level/parsed]=["+(p||"")+"/"+(t.audioCodec||"")+"/"+c.codec+"]")}f&&(f.levelCodec=t.videoCodec,f.id="main",this.log("Init video buffer, container:"+f.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+f.codec+"]")),h&&this.log("Init audiovideo buffer, container:"+h.container+", codecs[level/parsed]=["+(t.attrs.CODECS||"")+"/"+h.codec+"]"),this.hls.trigger(w.BUFFER_CODECS,i),Object.keys(i).forEach(function(b){var A=i[b].initSegment;A!=null&&A.byteLength&&u.hls.trigger(w.BUFFER_APPENDING,{type:b,data:A,frag:r,part:null,chunkMeta:o,parent:r.type})}),this.tick()}},e.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,et)},e.backtrack=function(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=Le},e.checkFragmentChanged=function(){var t=this.media,i=null;if(t&&t.readyState>1&&t.seeking===!1){var r=t.currentTime;if(ce.isBuffered(t,r)?i=this.getAppendedFrag(r):ce.isBuffered(t,r+.1)&&(i=this.getAppendedFrag(r+.1)),i){this.backtrackFragment=null;var o=this.fragPlaying,u=i.level;o&&i.sn===o.sn&&o.level===u&&i.urlId===o.urlId||(this.fragPlaying=i,this.hls.trigger(w.FRAG_CHANGED,{frag:i}),o&&o.level===u||this.hls.trigger(w.LEVEL_SWITCHED,{level:u}))}}},M(s,[{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"currentFrag",get:function(){var t=this.media;return t?this.fragPlaying||this.getAppendedFrag(t.currentTime):null}},{key:"currentProgramDateTime",get:function(){var t=this.media;if(t){var i=t.currentTime,r=this.currentFrag;if(r&&oe(i)&&oe(r.programDateTime)){var o=r.programDateTime+1e3*(i-r.start);return new Date(o)}}return null}},{key:"currentLevel",get:function(){var t=this.currentFrag;return t?t.level:-1}},{key:"nextBufferedFrag",get:function(){var t=this.currentFrag;return t?this.followingBufferedFrag(t):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),s}(Vd),an=function(){function d(e,t,i){t===void 0&&(t=0),i===void 0&&(i=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_=t,this.totalWeight_=i}var s=d.prototype;return s.sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},s.getTotalWeight=function(){return this.totalWeight_},s.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},d}(),Yv=function(){function d(e,t,i,r){r===void 0&&(r=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new an(e),this.fast_=new an(t),this.defaultTTFB_=r,this.ttfb_=new an(e)}var s=d.prototype;return s.update=function(e,t){var i=this.slow_,r=this.fast_,o=this.ttfb_;i.halfLife!==e&&(this.slow_=new an(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new an(t,r.getEstimate(),r.getTotalWeight())),o.halfLife!==e&&(this.ttfb_=new an(e,o.getEstimate(),o.getTotalWeight()))},s.sample=function(e,t){var i=(e=Math.max(e,this.minDelayMs_))/1e3,r=8*t/i;this.fast_.sample(i,r),this.slow_.sample(i,r)},s.sampleTTFB=function(e){var t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))},s.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},s.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},s.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},s.destroy=function(){},d}(),$v=function(){function d(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;var t=e.config;this.bwEstimator=new Yv(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.FRAG_LOADING,this.onFragLoading,this),e.on(w.FRAG_LOADED,this.onFragLoaded,this),e.on(w.FRAG_BUFFERED,this.onFragBuffered,this),e.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(w.LEVEL_LOADED,this.onLevelLoaded,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.FRAG_LOADING,this.onFragLoading,this),e.off(w.FRAG_LOADED,this.onFragLoaded,this),e.off(w.FRAG_BUFFERED,this.onFragBuffered,this),e.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(w.LEVEL_LOADED,this.onLevelLoaded,this)},s.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},s.onFragLoading=function(e,t){var i,r=t.frag;this.ignoreFragment(r)||(this.fragCurrent=r,this.partCurrent=(i=t.part)!=null?i:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))},s.onLevelSwitching=function(e,t){this.clearTimer()},s.getTimeToLoadFrag=function(e,t,i,r){return e+i/t+(r?this.lastLevelLoadSec:0)},s.onLevelLoaded=function(e,t){var i=this.hls.config,r=t.stats,o=r.total,u=r.bwEstimate;oe(o)&&oe(u)&&(this.lastLevelLoadSec=8*o/u),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},s._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,r=i.autoLevelEnabled,o=i.media;if(e&&o){var u=performance.now(),c=t?t.stats:e.stats,f=t?t.duration:e.duration,h=u-c.loading.start;if(c.aborted||c.loaded&&c.loaded===c.total||e.level===0)return this.clearTimer(),void(this._nextAutoLevel=-1);if(r&&!o.paused&&o.playbackRate&&o.readyState){var p=i.mainForwardBufferInfo;if(p!==null){var y=this.bwEstimator.getEstimateTTFB(),b=Math.abs(o.playbackRate);if(!(h<=Math.max(y,f/(2*b)*1e3))){var A=p.len/b;if(!(A>=2*f/b)){var k=c.loading.first?c.loading.first-c.loading.start:-1,D=c.loaded&&k>-1,S=this.bwEstimator.getEstimate(),L=i.levels,N=i.minAutoLevel,P=L[e.level],V=c.total||Math.max(c.loaded,Math.round(f*P.maxBitrate/8)),q=h-k;q<1&&D&&(q=Math.min(h,8*c.loaded/S));var j=D?1e3*c.loaded/q:0,ee=j?(V-c.loaded)/j:8*V/S+y/1e3;if(!(ee<=A)){var z,X=j?8*j:S,ue=Number.POSITIVE_INFINITY;for(z=e.level-1;z>N;z--){var ne=L[z].maxBitrate;if((ue=this.getTimeToLoadFrag(y/1e3,X,f*ne,!L[z].details))<A)break}ue>=ee||ue>10*f||(i.nextLoadLevel=z,D?this.bwEstimator.sample(h-Math.min(y,k),c.loaded):this.bwEstimator.sampleTTFB(h),this.clearTimer(),H.warn("[abr] Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+` is loading too slowly;
|
|
27
27
|
Time to underbuffer: `+A.toFixed(3)+` s
|
|
28
|
-
Estimated load time for current fragment: `+
|
|
28
|
+
Estimated load time for current fragment: `+ee.toFixed(3)+` s
|
|
29
29
|
Estimated load time for down switch fragment: `+ue.toFixed(3)+` s
|
|
30
30
|
TTFB estimate: `+k+`
|
|
31
|
-
Current BW estimate: `+(
|
|
31
|
+
Current BW estimate: `+(oe(S)?(S/1024).toFixed(3):"Unknown")+` Kb/s
|
|
32
32
|
New BW estimate: `+(this.bwEstimator.getEstimate()/1024).toFixed(3)+` Kb/s
|
|
33
|
-
Aborting and switching to level `+Q),e.loader&&(this.fragCurrent=this.partCurrent=null,e.abortRequests()),i.trigger(w.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:c}))}}}}}}},s.onFragLoaded=function(e,t){var i=t.frag,r=t.part,l=r?r.stats:i.stats;if(i.type===rt&&this.bwEstimator.sampleTTFB(l.loading.first-l.loading.start),!this.ignoreFragment(i)){if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var u=r?r.duration:i.duration,c=this.hls.levels[i.level],f=(c.loaded?c.loaded.bytes:0)+l.loaded,h=(c.loaded?c.loaded.duration:0)+u;c.loaded={bytes:f,duration:h},c.realBitrate=Math.round(8*f/h)}if(i.bitrateTest){var p={stats:l,frag:i,part:r,id:i.type};this.onFragBuffered(w.FRAG_BUFFERED,p),i.bitrateTest=!1}}},s.onFragBuffered=function(e,t){var i=t.frag,r=t.part,l=r!=null&&r.stats.loaded?r.stats:i.stats;if(!l.aborted&&!this.ignoreFragment(i)){var u=l.parsing.end-l.loading.start-Math.min(l.loading.first-l.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(u,l.loaded),l.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=u/1e3:this.bitrateTestDelay=0}},s.ignoreFragment=function(e){return e.type!==rt||e.sn==="initSegment"},s.clearTimer=function(){self.clearInterval(this.timer)},s.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,r=i.maxAutoLevel,l=i.config,u=i.minAutoLevel,c=i.media,f=t?t.duration:e?e.duration:0,h=c&&c.playbackRate!==0?Math.abs(c.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():l.abrEwmaDefaultEstimate,E=i.mainForwardBufferInfo,b=(E?E.len:0)/h,A=this.findBestLevel(p,u,r,b,l.abrBandWidthFactor,l.abrBandWidthUpFactor);if(A>=0)return A;H.trace("[abr] "+(b?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var k=f?Math.min(f,l.maxStarvationDelay):l.maxStarvationDelay,D=l.abrBandWidthFactor,S=l.abrBandWidthUpFactor;if(!b){var I=this.bitrateTestDelay;I&&(k=(f?Math.min(f,l.maxLoadingDelay):l.maxLoadingDelay)-I,H.trace("[abr] bitrate test took "+Math.round(1e3*I)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*k)+" ms"),D=S=1)}return A=this.findBestLevel(p,u,r,b+k,D,S),Math.max(A,0)},s.findBestLevel=function(e,t,i,r,l,u){for(var c,f=this.fragCurrent,h=this.partCurrent,p=this.lastLoadedFragLevel,E=this.hls.levels,b=E[p],A=!(b==null||(c=b.details)==null||!c.live),k=b==null?void 0:b.codecSet,D=h?h.duration:f?f.duration:0,S=this.bwEstimator.getEstimateTTFB()/1e3,I=t,F=-1,N=i;N>=t;N--){var V=E[N];if(!V||k&&V.codecSet!==k)V&&(I=Math.min(N,I),F=Math.max(N,F));else{F!==-1&&H.trace("[abr] Skipped level(s) "+I+"-"+F+' with CODECS:"'+E[F].attrs.CODECS+'"; not compatible with "'+b.attrs.CODECS+'"');var Y=V.details,j=(h?Y==null?void 0:Y.partTarget:Y==null?void 0:Y.averagetargetduration)||D,J=void 0;J=N<=p?l*e:u*e;var Q=E[N].maxBitrate,X=this.getTimeToLoadFrag(S,J,Q*j,Y===void 0);if(H.trace("[abr] level:"+N+" adjustedbw-bitrate:"+Math.round(J-Q)+" avgDuration:"+j.toFixed(1)+" maxFetchDuration:"+r.toFixed(1)+" fetchDuration:"+X.toFixed(1)),J>Q&&(X===0||!le(X)||A&&!this.bitrateTestDelay||X<r))return N}}return-1},M(d,[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator;if(e!==-1&&!t.canEstimate())return e;var i=this.getNextABRAutoLevel();if(e!==-1){var r=this.hls.levels;if(r.length>Math.max(e,i)&&r[e].loadError<=r[i].loadError)return e}return e!==-1&&(i=Math.min(e,i)),i},set:function(e){this._nextAutoLevel=e}}]),d}(),Rh=function(){function d(){this.chunks=[],this.dataLength=0}var s=d.prototype;return s.push=function(e){this.chunks.push(e),this.dataLength+=e.length},s.flush=function(){var e,t=this.chunks,i=this.dataLength;return t.length?(e=t.length===1?t[0]:function(r,l){for(var u=new Uint8Array(l),c=0,f=0;f<r.length;f++){var h=r[f];u.set(h,c),c+=h.length}return u}(t,i),this.reset(),e):new Uint8Array(0)},s.reset=function(){this.chunks.length=0,this.dataLength=0},d}(),Wv=function(d){function s(t,i,r){var l;return(l=d.call(this,t,i,r,"[audio-stream-controller]",Li)||this).videoBuffer=null,l.videoTrackCC=-1,l.waitingVideoCC=-1,l.bufferedTrack=null,l.switchingTrack=null,l.trackId=-1,l.waitingData=null,l.mainDetails=null,l.bufferFlushed=!1,l.cachedTrackLoadedData=null,l._registerListeners(),l}z(s,d);var e=s.prototype;return e.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null},e._registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(w.ERROR,this.onError,this),t.on(w.BUFFER_RESET,this.onBufferReset,this),t.on(w.BUFFER_CREATED,this.onBufferCreated,this),t.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(w.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(w.ERROR,this.onError,this),t.off(w.BUFFER_RESET,this.onBufferReset,this),t.off(w.BUFFER_CREATED,this.onBufferCreated,this),t.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(w.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this)},e.onInitPtsFound=function(t,i){var r=i.frag,l=i.id,u=i.initPTS,c=i.timescale;if(l==="main"){var f=r.cc;this.initPTS[r.cc]={baseTime:u,timescale:c},this.log("InitPTS for cc: "+f+" found from main: "+u),this.videoTrackCC=f,this.state===ts&&this.tick()}},e.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=nt);var i=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),i>0&&t===-1?(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),t=i,this.state=Le):(this.loadedmetadata=!1,this.state=mt),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},e.doTick=function(){switch(this.state){case Le:this.doTickIdle();break;case mt:var t,i=this.levels,r=this.trackId,l=i==null||(t=i[r])==null?void 0:t.details;if(l){if(this.waitForCdnTuneIn(l))break;this.state=ts}break;case di:var u,c=performance.now(),f=this.retryDate;(!f||c>=f||(u=this.media)!=null&&u.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=Le);break;case ts:var h=this.waitingData;if(h){var p=h.frag,E=h.part,b=h.cache,A=h.complete;if(this.initPTS[p.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=Di;var k={frag:p,part:E,payload:b.flush(),networkDetails:null};this._handleFragmentLoadProgress(k),A&&d.prototype._handleFragmentLoadComplete.call(this,k)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+p.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var D=this.getLoadPosition(),S=ke.bufferInfo(this.mediaBuffer,D,this.config.maxBufferHole);Jn(S.end,this.config.maxFragLookUpTolerance,p)<0&&(this.log("Waiting fragment cc ("+p.cc+") @ "+p.start+" cancelled because another fragment at "+S.end+" is needed"),this.clearWaitingFragment())}}else this.state=Le}this.onTickEnd()},e.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Le)},e.resetLoadingState=function(){this.clearWaitingFragment(),d.prototype.resetLoadingState.call(this)},e.onTickEnd=function(){var t=this.media;t!=null&&t.readyState&&(this.lastCurrentTime=t.currentTime)},e.doTickIdle=function(){var t=this.hls,i=this.levels,r=this.media,l=this.trackId,u=t.config;if(i!=null&&i[l]&&(r||!this.startFragRequested&&u.startFragPrefetch)){var c=i[l],f=c.details;if(!f||f.live&&this.levelLastLoaded!==l||this.waitForCdnTuneIn(f))this.state=mt;else{var h=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&h&&(this.bufferFlushed=!1,this.afterBufferFlushed(h,Ne,Li));var p=this.getFwdBufferInfo(h,Li);if(p!==null){var E=this.bufferedTrack,b=this.switchingTrack;if(!b&&this._streamEnded(p,f))return t.trigger(w.BUFFER_EOS,{type:"audio"}),void(this.state=ha);var A=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,rt),k=p.len,D=this.getMaxBufferLength(A==null?void 0:A.len);if(!(k>=D)||b){var S=f.fragments[0].start,I=p.end;if(b&&r){var F=this.getLoadPosition();E&&b.attrs!==E.attrs&&(I=F),f.PTSKnown&&F<S&&(p.end>S||p.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=S+.05)}var N=this.getNextFragment(I,f),V=!1;if(N&&this.isLoopLoading(N,I)&&(V=!!N.gap,N=this.getNextFragmentLoopLoading(N,f,p,rt,D)),N){var Y=A&&N.start>A.end+f.targetduration;if(Y||(A==null||!A.len)&&p.len){var j=this.fragmentTracker.getBufferedFrag(N.start,rt);if(j===null||(V||(V=!!j.gap||!!Y&&A.len===0),Y&&!V||V&&p.nextStart&&p.nextStart<j.end))return}this.loadFragment(N,c,I)}else this.bufferFlushed=!0}}}}},e.getMaxBufferLength=function(t){var i=d.prototype.getMaxBufferLength.call(this);return t?Math.min(Math.max(i,t),this.config.maxMaxBufferLength):i},e.onMediaDetaching=function(){this.videoBuffer=null,d.prototype.onMediaDetaching.call(this)},e.onAudioTracksUpdated=function(t,i){var r=i.audioTracks;this.resetTransmuxer(),this.levels=r.map(function(l){return new la(l)})},e.onAudioTrackSwitching=function(t,i){var r=!!i.url;this.trackId=i.id;var l=this.fragCurrent;l&&(l.abortRequests(),this.removeUnbufferedFrags(l.start)),this.resetLoadingState(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.switchingTrack=i,this.state=Le):(this.switchingTrack=null,this.bufferedTrack=i,this.state=nt),this.tick()},e.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1,this.bufferedTrack=null,this.switchingTrack=null},e.onLevelLoaded=function(t,i){this.mainDetails=i.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(w.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},e.onAudioTrackLoaded=function(t,i){var r;if(this.mainDetails!=null){var l=this.levels,u=i.details,c=i.id;if(l){this.log("Track "+c+" loaded ["+u.startSN+","+u.endSN+"],duration:"+u.totalduration);var f=l[c],h=0;if(u.live||(r=f.details)!=null&&r.live){var p=this.mainDetails;if(u.fragments[0]||(u.deltaUpdateFailed=!0),u.deltaUpdateFailed||!p)return;!f.details&&u.hasProgramDateTime&&p.hasProgramDateTime?(He(u,p),h=u.fragments[0].start):h=this.alignPlaylists(u,f.details)}f.details=u,this.levelLastLoaded=c,this.startFragRequested||!this.mainDetails&&u.live||this.setStartPosition(f.details,h),this.state!==mt||this.waitForCdnTuneIn(u)||(this.state=Le),this.tick()}else this.warn("Audio tracks were reset while loading level "+c)}else this.cachedTrackLoadedData=i},e._handleFragmentLoadProgress=function(t){var i,r=t.frag,l=t.part,u=t.payload,c=this.config,f=this.trackId,h=this.levels;if(h){var p=h[f];if(p){var E=p.details;if(!E)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);var b=c.defaultAudioCodec||p.audioCodec||"mp4a.40.2",A=this.transmuxer;A||(A=this.transmuxer=new Ih(this.hls,Li,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var k=this.initPTS[r.cc],D=(i=r.initSegment)==null?void 0:i.data;if(k!==void 0){var S=l?l.index:-1,I=S!==-1,F=new ft(r.level,r.sn,r.stats.chunkCount,u.byteLength,S,I);A.push(u,D,b,"",r,l,E.totalduration,!1,F,k)}else this.log("Unknown video PTS for cc "+r.cc+", waiting for video PTS before demuxing audio frag "+r.sn+" of ["+E.startSN+" ,"+E.endSN+"],track "+f),(this.waitingData=this.waitingData||{frag:r,part:l,cache:new Rh,complete:!1}).cache.push(new Uint8Array(u)),this.waitingVideoCC=this.videoTrackCC,this.state=ts}else this.warn("Audio track is undefined on fragment load progress")}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},e._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:d.prototype._handleFragmentLoadComplete.call(this,t)},e.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},e.onBufferCreated=function(t,i){var r=i.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer||null)},e.onFragBuffered=function(t,i){var r,l=i.frag,u=i.part;if(l.type===Li)if(this.fragContextChanged(l))this.warn("Fragment "+l.sn+(u?" p: "+u.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+(this.switchingTrack?this.switchingTrack.name:"false"));else{if(l.sn!=="initSegment"){this.fragPrevious=l;var c=this.switchingTrack;c&&(this.bufferedTrack=c,this.switchingTrack=null,this.hls.trigger(w.AUDIO_TRACK_SWITCHED,g({},c)))}this.fragBufferedComplete(l,u)}else this.loadedmetadata||l.type!==rt||(r=this.videoBuffer||this.media)!=null&&r.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var r;if(i.fatal)this.state=Gr;else switch(i.details){case W.FRAG_GAP:case W.FRAG_PARSING_ERROR:case W.FRAG_DECRYPT_ERROR:case W.FRAG_LOAD_ERROR:case W.FRAG_LOAD_TIMEOUT:case W.KEY_LOAD_ERROR:case W.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Li,i);break;case W.AUDIO_TRACK_LOAD_ERROR:case W.AUDIO_TRACK_LOAD_TIMEOUT:case W.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==mt||((r=i.context)==null?void 0:r.type)!==ki||(this.state=Le);break;case W.BUFFER_FULL_ERROR:if(!i.parent||i.parent!=="audio")return;this.reduceLengthAndFlushBuffer(i)&&(this.bufferedTrack=null,d.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case W.INTERNAL_EXCEPTION:this.recoverWorkerError(i)}},e.onBufferFlushed=function(t,i){i.type===Ne&&(this.bufferFlushed=!0,this.state===ha&&(this.state=Le))},e._handleTransmuxComplete=function(t){var i,r="audio",l=this.hls,u=t.remuxResult,c=t.chunkMeta,f=this.getCurrentContext(c);if(f){var h=f.frag,p=f.part,E=f.level.details,b=u.audio,A=u.text,k=u.id3,D=u.initSegment;if(!this.fragContextChanged(h)&&E){if(this.state=ai,this.switchingTrack&&b&&this.completeAudioSwitch(this.switchingTrack),D!=null&&D.tracks&&(this._bufferInitSegment(D.tracks,h,c),l.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:h,id:r,tracks:D.tracks})),b){var S=b.startPTS,I=b.endPTS,F=b.startDTS,N=b.endDTS;p&&(p.elementaryStreams[Ne]={startPTS:S,endPTS:I,startDTS:F,endDTS:N}),h.setElementaryStreamInfo(Ne,S,I,F,N),this.bufferFragmentData(b,h,p,c)}if(k!=null&&(i=k.samples)!=null&&i.length){var V=U({id:r,frag:h,details:E},k);l.trigger(w.FRAG_PARSING_METADATA,V)}if(A){var Y=U({id:r,frag:h,details:E},A);l.trigger(w.FRAG_PARSING_USERDATA,Y)}}else this.fragmentTracker.removeFragment(h)}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,r){if(this.state===ai){t.video&&delete t.video;var l=t.audio;if(l){l.levelCodec=l.codec,l.id="audio",this.log("Init audio buffer, container:"+l.container+", codecs[parsed]=["+l.codec+"]"),this.hls.trigger(w.BUFFER_CODECS,t);var u=l.initSegment;if(u!=null&&u.byteLength){var c={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:u};this.hls.trigger(w.BUFFER_APPENDING,c)}this.tick()}}},e.loadFragment=function(t,i,r){var l,u=this.fragmentTracker.getState(t);this.fragCurrent=t,this.switchingTrack||u===x||u===$?t.sn==="initSegment"?this._loadInitSegment(t,i):(l=i.details)!=null&&l.live&&!this.initPTS[t.cc]?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=ts):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,r)):this.clearTrackerIfNeeded(t)},e.completeAudioSwitch=function(t){var i=this.hls,r=this.media,l=this.bufferedTrack,u=l==null?void 0:l.attrs,c=t.attrs;r&&u&&(u.CHANNELS!==c.CHANNELS||u.NAME!==c.NAME||u.LANGUAGE!==c.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),d.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=t,this.switchingTrack=null,i.trigger(w.AUDIO_TRACK_SWITCHED,g({},t))},s}(Pd),qv=function(d){function s(t){var i;return(i=d.call(this,t,"[audio-track-controller]")||this).tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.currentTrack=null,i.selectDefaultTrack=!0,i.registerListeners(),i}z(s,d);var e=s.prototype;return e.registerListeners=function(){var t=this.hls;t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(w.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADING,this.onLevelLoading,this),t.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(w.ERROR,this.onError,this)},e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,d.prototype.destroy.call(this)},e.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},e.onManifestParsed=function(t,i){this.tracks=i.audioTracks||[]},e.onAudioTrackLoaded=function(t,i){var r=i.id,l=i.groupId,u=i.details,c=this.tracksInGroup[r];if(c&&c.groupId===l){var f=c.details;c.details=i.details,this.log("audio-track "+r+' "'+c.name+'" lang:'+c.lang+" group:"+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,i,f)}else this.warn("Track with id:"+r+" and group:"+l+" not found in active group "+c.groupId)},e.onLevelLoading=function(t,i){this.switchLevel(i.level)},e.onLevelSwitching=function(t,i){this.switchLevel(i.level)},e.switchLevel=function(t){var i=this.hls.levels[t];if(i!=null&&i.audioGroupIds){var r=i.audioGroupIds[i.urlId];if(this.groupId!==r){this.groupId=r||null;var l=this.tracks.filter(function(c){return!r||c.groupId===r});this.selectDefaultTrack&&!l.some(function(c){return c.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var u={audioTracks:l};this.log("Updating audio tracks, "+l.length+" track(s) found in group:"+r),this.hls.trigger(w.AUDIO_TRACKS_UPDATED,u),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===ki&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&(this.requestScheduled=-1,this.checkRetry(i))},e.setAudioTrack=function(t){var i=this.tracksInGroup;if(t<0||t>=i.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var r=this.currentTrack;i[this.trackId];var l=i[t],u=l.groupId,c=l.name;if(this.log("Switching to audio-track "+t+' "'+c+'" lang:'+l.lang+" group:"+u),this.trackId=t,this.currentTrack=l,this.selectDefaultTrack=!1,this.hls.trigger(w.AUDIO_TRACK_SWITCHING,g({},l)),!l.details||l.details.live){var f=this.switchParams(l.url,r==null?void 0:r.details);this.loadPlaylist(f)}}},e.selectInitialTrack=function(){var t=this.tracksInGroup,i=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(i!==-1)this.setAudioTrack(i);else{var r=new Error("No track found for running audio group-ID: "+this.groupId+" track count: "+t.length);this.warn(r.message),this.hls.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:r})}},e.findTrackId=function(t){for(var i=this.tracksInGroup,r=0;r<i.length;r++){var l=i[r];if((!this.selectDefaultTrack||l.default)&&(!t||t.attrs["STABLE-RENDITION-ID"]===l.attrs["STABLE-RENDITION-ID"]||t.name===l.name&&t.lang===l.lang))return l.id}return-1},e.loadPlaylist=function(t){d.prototype.loadPlaylist.call(this);var i=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(i)){var r=i.id,l=i.groupId,u=i.url;if(t)try{u=t.addDirectives(u)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("loading audio-track playlist "+r+' "'+i.name+'" lang:'+i.lang+" group:"+l),this.clearTimer(),this.hls.trigger(w.AUDIO_TRACK_LOADING,{url:u,id:r,groupId:l,deliveryDirectives:t||null})}},M(s,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}}]),s}(_);function Dh(d,s){if(d.length!==s.length)return!1;for(var e=0;e<d.length;e++)if(!Yv(d[e].attrs,s[e].attrs))return!1;return!0}function Yv(d,s){var e=d["STABLE-RENDITION-ID"];return e?e===s["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some(function(t){return d[t]!==s[t]})}var $v=function(d){function s(t,i,r){var l;return(l=d.call(this,t,i,r,"[subtitle-stream-controller]",Ii)||this).levels=[],l.currentTrackId=-1,l.tracksBuffered=[],l.mainDetails=null,l._registerListeners(),l}z(s,d);var e=s.prototype;return e.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},e._registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.ERROR,this.onError,this),t.on(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(w.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(w.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.ERROR,this.onError,this),t.off(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(w.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(w.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this)},e.startLoad=function(t){this.stopLoad(),this.state=Le,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},e.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},e.onMediaDetaching=function(){this.tracksBuffered=[],d.prototype.onMediaDetaching.call(this)},e.onLevelLoaded=function(t,i){this.mainDetails=i.details},e.onSubtitleFragProcessed=function(t,i){var r=i.frag,l=i.success;if(this.fragPrevious=r,this.state=Le,l){var u=this.tracksBuffered[this.currentTrackId];if(u){for(var c,f=r.start,h=0;h<u.length;h++)if(f>=u[h].start&&f<=u[h].end){c=u[h];break}var p=r.start+r.duration;c?c.end=p:(c={start:f,end:p},u.push(c)),this.fragmentTracker.fragBuffered(r)}}},e.onBufferFlushing=function(t,i){var r=i.startOffset,l=i.endOffset;if(r===0&&l!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,c=this.levels;if(!c.length||!c[u]||!c[u].details)return;var f=l-c[u].details.targetduration;if(f<=0)return;i.endOffsetSubtitles=Math.max(0,f),this.tracksBuffered.forEach(function(h){for(var p=0;p<h.length;)if(h[p].end<=f)h.shift();else{if(!(h[p].start<f))break;h[p].start=f,p++}}),this.fragmentTracker.removeFragmentsInRange(r,f,Ii)}},e.onFragBuffered=function(t,i){var r;this.loadedmetadata||i.frag.type!==rt||(r=this.media)!=null&&r.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var r=i.frag;(r==null?void 0:r.type)===Ii&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==nt&&(this.state=Le))},e.onSubtitleTracksUpdated=function(t,i){var r=this,l=i.subtitleTracks;Dh(this.levels,l)?this.levels=l.map(function(u){return new la(u)}):(this.tracksBuffered=[],this.levels=l.map(function(u){var c=new la(u);return r.tracksBuffered[c.id]=[],c}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ii),this.fragPrevious=null,this.mediaBuffer=null)},e.onSubtitleTrackSwitch=function(t,i){if(this.currentTrackId=i.id,this.levels.length&&this.currentTrackId!==-1){var r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(500)}else this.clearInterval()},e.onSubtitleTrackLoaded=function(t,i){var r,l=i.details,u=i.id,c=this.currentTrackId,f=this.levels;if(f.length){var h=f[c];if(!(u>=f.length||u!==c)&&h){this.mediaBuffer=this.mediaBufferTimeRanges;var p=0;if(l.live||(r=h.details)!=null&&r.live){var E=this.mainDetails;if(l.deltaUpdateFailed||!E)return;var b=E.fragments[0];h.details?(p=this.alignPlaylists(l,h.details))===0&&b&&Xn(l,p=b.start):l.hasProgramDateTime&&E.hasProgramDateTime?(He(l,E),p=l.fragments[0].start):b&&Xn(l,p=b.start)}h.details=l,this.levelLastLoaded=u,this.startFragRequested||!this.mainDetails&&l.live||this.setStartPosition(h.details,p),this.tick(),l.live&&!this.fragCurrent&&this.media&&this.state===Le&&(ca(null,l.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),h.details=void 0))}}},e._handleFragmentLoadComplete=function(t){var i=this,r=t.frag,l=t.payload,u=r.decryptdata,c=this.hls;if(!this.fragContextChanged(r)&&l&&l.byteLength>0&&u&&u.key&&u.iv&&u.method==="AES-128"){var f=performance.now();this.decrypter.decrypt(new Uint8Array(l),u.key.buffer,u.iv.buffer).catch(function(h){throw c.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.FRAG_DECRYPT_ERROR,fatal:!1,error:h,reason:h.message,frag:r}),h}).then(function(h){var p=performance.now();c.trigger(w.FRAG_DECRYPTED,{frag:r,payload:h,stats:{tstart:f,tdecrypt:p}})}).catch(function(h){i.warn(h.name+": "+h.message),i.state=Le})}},e.doTick=function(){if(this.media){if(this.state===Le){var t=this.currentTrackId,i=this.levels,r=i[t];if(!i.length||!r||!r.details)return;var l=r.details,u=l.targetduration,c=this.config,f=this.getLoadPosition(),h=ke.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],f-u,c.maxBufferHole),p=h.end,E=h.len,b=this.getFwdBufferInfo(this.media,rt);if(E>this.getMaxBufferLength(b==null?void 0:b.len)+u)return;var A=l.fragments,k=A.length,D=l.edge,S=null,I=this.fragPrevious;if(p<D){var F=c.maxFragLookUpTolerance;!(S=ca(I,A,Math.max(A[0].start,p),F))&&I&&I.start<A[0].start&&(S=A[0])}else S=A[k-1];if(!S)return;S=this.mapToInitFragWhenRequired(S),this.fragmentTracker.getState(S)===x&&this.loadFragment(S,r,p)}}else this.state=Le},e.getMaxBufferLength=function(t){var i=d.prototype.getMaxBufferLength.call(this);return t?Math.max(i,t):i},e.loadFragment=function(t,i,r){this.fragCurrent=t,t.sn==="initSegment"?this._loadInitSegment(t,i):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,r))},M(s,[{key:"mediaBufferTimeRanges",get:function(){return new jv(this.tracksBuffered[this.currentTrackId]||[])}}]),s}(Pd),jv=function(d){this.buffered=void 0;var s=function(e,t,i){if((t>>>=0)>i-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is greater than the maximum bound ("+i+")");return d[t][e]};this.buffered={get length(){return d.length},end:function(e){return s("end",e,d.length)},start:function(e){return s("start",e,d.length)}}},zv=function(d){function s(t){var i;return(i=d.call(this,t,"[subtitle-track-controller]")||this).media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i._subtitleDisplay=!0,i.registerListeners(),i}z(s,d);var e=s.prototype;return e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,d.prototype.destroy.call(this)},e.registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(w.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADING,this.onLevelLoading,this),t.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(w.ERROR,this.onError,this)},e.onMediaAttached=function(t,i){this.media=i.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))},e.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},e.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),zd(this.media.textTracks).forEach(function(t){Br(t)}),this.subtitleTrack=-1,this.media=null)},e.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},e.onManifestParsed=function(t,i){this.tracks=i.subtitleTracks},e.onSubtitleTrackLoaded=function(t,i){var r=i.id,l=i.details,u=this.trackId,c=this.tracksInGroup[u];if(c){var f=c.details;c.details=i.details,this.log("subtitle track "+r+" loaded ["+l.startSN+"-"+l.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,i,f)}else this.warn("Invalid subtitle track id "+r)},e.onLevelLoading=function(t,i){this.switchLevel(i.level)},e.onLevelSwitching=function(t,i){this.switchLevel(i.level)},e.switchLevel=function(t){var i=this.hls.levels[t];if(i!=null&&i.textGroupIds){var r=i.textGroupIds[i.urlId],l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==r){var u=this.tracks.filter(function(h){return!r||h.groupId===r});this.tracksInGroup=u;var c=this.findTrackId(l==null?void 0:l.name)||this.findTrackId();this.groupId=r||null;var f={subtitleTracks:u};this.log("Updating subtitle tracks, "+u.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(w.SUBTITLE_TRACKS_UPDATED,f),c!==-1&&this.setSubtitleTrack(c,l)}else this.shouldReloadPlaylist(l)&&this.setSubtitleTrack(this.trackId,l)}},e.findTrackId=function(t){for(var i=this.tracksInGroup,r=0;r<i.length;r++){var l=i[r];if((!this.selectDefaultTrack||l.default)&&(!t||t===l.name))return l.id}return-1},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===wi&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.checkRetry(i)},e.loadPlaylist=function(t){d.prototype.loadPlaylist.call(this);var i=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(i)){var r=i.id,l=i.groupId,u=i.url;if(t)try{u=t.addDirectives(u)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Loading subtitle playlist for id "+r),this.hls.trigger(w.SUBTITLE_TRACK_LOADING,{url:u,id:r,groupId:l,deliveryDirectives:t||null})}},e.toggleTrackModes=function(t){var i=this,r=this.media,l=this.trackId;if(r){var u=zd(r.textTracks),c=u.filter(function(p){return p.groupId===i.groupId});if(t===-1)[].slice.call(u).forEach(function(p){p.mode="disabled"});else{var f=c[l];f&&(f.mode="disabled")}var h=c[t];h&&(h.mode=this.subtitleDisplay?"showing":"hidden")}},e.setSubtitleTrack=function(t,i){var r,l=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(t===-1||(r=l[t])!=null&&r.details)||t<-1||t>=l.length)){this.clearTimer();var u=l[t];if(this.log("Switching to subtitle-track "+t+(u?' "'+u.name+'" lang:'+u.lang+" group:"+u.groupId:"")),this.trackId=t,u){var c=u.id,f=u.groupId,h=f===void 0?"":f,p=u.name,E=u.type,b=u.url;this.hls.trigger(w.SUBTITLE_TRACK_SWITCH,{id:c,groupId:h,name:p,type:E,url:b});var A=this.switchParams(u.url,i==null?void 0:i.details);this.loadPlaylist(A)}else this.hls.trigger(w.SUBTITLE_TRACK_SWITCH,{id:t})}}else this.queuedDefaultTrack=t},e.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var t=-1,i=zd(this.media.textTracks),r=0;r<i.length;r++)if(i[r].mode==="hidden")t=r;else if(i[r].mode==="showing"){t=r;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)}},M(s,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,i)}}]),s}(_);function zd(d){for(var s=[],e=0;e<d.length;e++){var t=d[e];t.kind!=="subtitles"&&t.kind!=="captions"||!t.label||s.push(d[e])}return s}var Qv=function(){function d(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var s=d.prototype;return s.append=function(e,t){var i=this.queues[t];i.push(e),i.length===1&&this.buffers[t]&&this.executeNext(t)},s.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},s.appendBlocker=function(e){var t,i=new Promise(function(l){t=l}),r={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(r,e),i},s.executeNext=function(e){var t=this.buffers,i=this.queues,r=t[e],l=i[e];if(l.length){var u=l[0];try{u.execute()}catch(c){H.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),u.onError(c),r!=null&&r.updating||(l.shift(),this.executeNext(e))}}},s.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},s.current=function(e){return this.queues[e][0]},d}(),Ch=Od(),Mh=/([ha]vc.)(?:\.[^.,]+)+/,Xv=function(){function d(e){var t=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 i=t.media,r=t.mediaSource;H.log("[buffer-controller]: Media source opened"),i&&(i.removeEventListener("emptied",t._onMediaEmptied),t.updateMediaElementDuration(),t.hls.trigger(w.MEDIA_ATTACHED,{media:i})),r&&r.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){H.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){H.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=function(){var i=t.media,r=t._objectUrl;i&&i.src!==r&&H.error("Media element src was set while attaching MediaSource ("+r+" > "+i.src+")")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var s=d.prototype;return s.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},s.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null},s.registerListeners=function(){var e=this.hls;e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.BUFFER_RESET,this.onBufferReset,this),e.on(w.BUFFER_APPENDING,this.onBufferAppending,this),e.on(w.BUFFER_CODECS,this.onBufferCodecs,this),e.on(w.BUFFER_EOS,this.onBufferEos,this),e.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(w.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(w.FRAG_PARSED,this.onFragParsed,this),e.on(w.FRAG_CHANGED,this.onFragChanged,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.BUFFER_RESET,this.onBufferReset,this),e.off(w.BUFFER_APPENDING,this.onBufferAppending,this),e.off(w.BUFFER_CODECS,this.onBufferCodecs,this),e.off(w.BUFFER_EOS,this.onBufferEos,this),e.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(w.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(w.FRAG_PARSED,this.onFragParsed,this),e.off(w.FRAG_CHANGED,this.onFragChanged,this)},s._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new Qv(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null},s.onManifestParsed=function(e,t){var i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,H.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},s.onMediaAttaching=function(e,t){var i=this.media=t.media;if(i&&Ch){var r=this.mediaSource=new Ch;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(r),this._objectUrl=i.src,i.addEventListener("emptied",this._onMediaEmptied)}},s.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(H.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){H.warn("[buffer-controller]: onMediaDetaching: "+r.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):H.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(w.MEDIA_DETACHED,void 0)},s.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){var i=e.sourceBuffer[t];try{i&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(i),e.sourceBuffer[t]=void 0)}catch(r){H.warn("[buffer-controller]: Failed to reset the "+t+" buffer",r)}}),this._initSourceBuffer()},s.onBufferCodecs=function(e,t){var i=this,r=this.getSourceBufferTypes().length;Object.keys(t).forEach(function(l){if(r){var u=i.tracks[l];if(u&&typeof u.buffer.changeType=="function"){var c=t[l],f=c.id,h=c.codec,p=c.levelCodec,E=c.container,b=c.metadata,A=(u.levelCodec||u.codec).replace(Mh,"$1"),k=(p||h).replace(Mh,"$1");if(A!==k){var D=E+";codecs="+(p||h);i.appendChangeType(l,D),H.log("[buffer-controller]: switching codec "+A+" to "+k),i.tracks[l]={buffer:u.buffer,codec:h,container:E,levelCodec:p,metadata:b,id:f}}}}else i.pendingTracks[l]=t[l]}),r||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},s.appendChangeType=function(e,t){var i=this,r=this.operationQueue,l={execute:function(){var u=i.sourceBuffer[e];u&&(H.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),u.changeType(t)),r.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(u){H.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",u)}};r.append(l,e)},s.onBufferAppending=function(e,t){var i=this,r=this.hls,l=this.operationQueue,u=this.tracks,c=t.data,f=t.type,h=t.frag,p=t.part,E=t.chunkMeta,b=E.buffering[f],A=self.performance.now();b.start=A;var k=h.stats.buffering,D=p?p.stats.buffering:null;k.start===0&&(k.start=A),D&&D.start===0&&(D.start=A);var S=u.audio,I=!1;f==="audio"&&(S==null?void 0:S.container)==="audio/mpeg"&&(I=!this.lastMpegAudioChunk||E.id===1||this.lastMpegAudioChunk.sn!==E.sn,this.lastMpegAudioChunk=E);var F=h.start,N={execute:function(){if(b.executeStart=self.performance.now(),I){var V=i.sourceBuffer[f];if(V){var Y=F-V.timestampOffset;Math.abs(Y)>=.1&&(H.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+F+" (delta: "+Y+") sn: "+h.sn+")"),V.timestampOffset=F)}}i.appendExecutor(c,f)},onStart:function(){},onComplete:function(){var V=self.performance.now();b.executeEnd=b.end=V,k.first===0&&(k.first=V),D&&D.first===0&&(D.first=V);var Y=i.sourceBuffer,j={};for(var J in Y)j[J]=ke.getBuffered(Y[J]);i.appendError=0,i.hls.trigger(w.BUFFER_APPENDED,{type:f,frag:h,part:p,chunkMeta:E,parent:h.type,timeRanges:j})},onError:function(V){H.error("[buffer-controller]: Error encountered while trying to append to the "+f+" SourceBuffer",V);var Y={type:oe.MEDIA_ERROR,parent:h.type,details:W.BUFFER_APPEND_ERROR,frag:h,part:p,chunkMeta:E,error:V,err:V,fatal:!1};V.code===DOMException.QUOTA_EXCEEDED_ERR?Y.details=W.BUFFER_FULL_ERROR:(i.appendError++,Y.details=W.BUFFER_APPEND_ERROR,i.appendError>r.config.appendErrorMaxRetry&&(H.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),Y.fatal=!0)),r.trigger(w.ERROR,Y)}};l.append(N,f)},s.onBufferFlushing=function(e,t){var i=this,r=this.operationQueue,l=function(u){return{execute:i.removeExecutor.bind(i,u,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(w.BUFFER_FLUSHED,{type:u})},onError:function(c){H.warn("[buffer-controller]: Failed to remove from "+u+" SourceBuffer",c)}}};t.type?r.append(l(t.type),t.type):this.getSourceBufferTypes().forEach(function(u){r.append(l(u),u)})},s.onFragParsed=function(e,t){var i=this,r=t.frag,l=t.part,u=[],c=l?l.elementaryStreams:r.elementaryStreams;c[pi]?u.push("audiovideo"):(c[Ne]&&u.push("audio"),c[ct]&&u.push("video")),u.length===0&&H.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers(function(){var f=self.performance.now();r.stats.buffering.end=f,l&&(l.stats.buffering.end=f);var h=l?l.stats:r.stats;i.hls.trigger(w.FRAG_BUFFERED,{frag:r,part:l,stats:h,id:r.type})},u)},s.onFragChanged=function(e,t){this.flushBackBuffer()},s.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce(function(r,l){var u=i.sourceBuffer[l];return!u||t.type&&t.type!==l||(u.ending=!0,u.ended||(u.ended=!0,H.log("[buffer-controller]: "+l+" sourceBuffer now EOS"))),r&&!(u&&!u.ended)},!0)&&(H.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){i.getSourceBufferTypes().forEach(function(l){var u=i.sourceBuffer[l];u&&(u.ending=!1)});var r=i.mediaSource;r&&r.readyState==="open"?(H.log("[buffer-controller]: Calling mediaSource.endOfStream()"),r.endOfStream()):r&&H.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+r.readyState)}))},s.onLevelUpdated=function(e,t){var i=t.details;i.fragments.length&&(this.details=i,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},s.flushBackBuffer=function(){var e=this.hls,t=this.details,i=this.media,r=this.sourceBuffer;if(i&&t!==null){var l=this.getSourceBufferTypes();if(l.length){var u=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(le(u)&&!(u<0)){var c=i.currentTime,f=t.levelTargetDuration,h=Math.max(u,f),p=Math.floor(c/f)*f-h;l.forEach(function(E){var b=r[E];if(b){var A=ke.getBuffered(b);if(A.length>0&&p>A.start(0)){if(e.trigger(w.BACK_BUFFER_REACHED,{bufferEnd:p}),t.live)e.trigger(w.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p});else if(b.ended&&A.end(A.length-1)-c<2*f)return void H.info("[buffer-controller]: Cannot flush "+E+" back buffer while SourceBuffer is in ended state");e.trigger(w.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:E})}}})}}}},s.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&this.mediaSource.readyState==="open"){var e=this.details,t=this.hls,i=this.media,r=this.mediaSource,l=e.fragments[0].start+e.totalduration,u=i.duration,c=le(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(H.log("[buffer-controller]: Media Source duration is set to Infinity"),r.duration=1/0,this.updateSeekableRange(e)):(l>c&&l>u||!le(u))&&(H.log("[buffer-controller]: Updating Media Source duration to "+l.toFixed(3)),r.duration=l)}},s.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){var r=Math.max(0,i[0].start),l=Math.max(r,r+e.totalduration);t.setLiveSeekableRange(r,l)}},s.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,r=Object.keys(i).length;if(r&&!e||r===2){this.createSourceBuffers(i),this.pendingTracks={};var l=this.getSourceBufferTypes();if(l.length)this.hls.trigger(w.BUFFER_CREATED,{tracks:this.tracks}),l.forEach(function(c){t.executeNext(c)});else{var u=new Error("could not create source buffer for media codec(s)");this.hls.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:u,reason:u.message})}}},s.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(var r in e)if(!t[r]){var l=e[r];if(!l)throw Error("source buffer exists for track "+r+", however track does not");var u=l.levelCodec||l.codec,c=l.container+";codecs="+u;H.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var f=t[r]=i.addSourceBuffer(c),h=r;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[r]={buffer:f,codec:u,container:l.container,levelCodec:l.levelCodec,metadata:l.metadata,id:l.id}}catch(p){H.error("[buffer-controller]: error while trying to add sourceBuffer: "+p.message),this.hls.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:p,mimeType:c})}}},s._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},s._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},s._onSBUpdateError=function(e,t){var i=new Error(e+" SourceBuffer error");H.error("[buffer-controller]: "+i,t),this.hls.trigger(w.ERROR,{type:oe.MEDIA_ERROR,details:W.BUFFER_APPENDING_ERROR,error:i,fatal:!1});var r=this.operationQueue.current(e);r&&r.onError(t)},s.removeExecutor=function(e,t,i){var r=this.media,l=this.mediaSource,u=this.operationQueue,c=this.sourceBuffer[e];if(!r||!l||!c)return H.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void u.shiftAndExecuteNext(e);var f=le(r.duration)?r.duration:1/0,h=le(l.duration)?l.duration:1/0,p=Math.max(0,t),E=Math.min(i,f,h);E>p&&!c.ending?(c.ended=!1,H.log("[buffer-controller]: Removing ["+p+","+E+"] from the "+e+" SourceBuffer"),c.remove(p,E)):u.shiftAndExecuteNext(e)},s.appendExecutor=function(e,t){var i=this.operationQueue,r=this.sourceBuffer[t];if(!r)return H.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(t);r.ended=!1,r.appendBuffer(e)},s.blockBuffers=function(e,t){var i=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length)return H.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var r=this.operationQueue,l=t.map(function(u){return r.appendBlocker(u)});Promise.all(l).then(function(){e(),t.forEach(function(u){var c=i.sourceBuffer[u];c!=null&&c.updating||r.shiftAndExecuteNext(u)})})},s.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},s.addBufferListener=function(e,t,i){var r=this.sourceBuffer[e];if(r){var l=i.bind(this,e);this.listeners[e].push({event:t,listener:l}),r.addEventListener(t,l)}},s.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach(function(i){t.removeEventListener(i.event,i.listener)})},d}(),xh={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},Ph=function(d){var s=d;return xh.hasOwnProperty(d)&&(s=xh[d]),String.fromCharCode(s)},ma=15,_r=100,Zv={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Jv={17:2,18:4,21:6,22:8,23:10,19:13,20:15},eg={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},tg={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ig=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],rg=function(){function d(){this.time=null,this.verboseLevel=0}return d.prototype.log=function(s,e){if(this.verboseLevel>=s){var t=typeof e=="function"?e():e;H.log(this.time+" ["+s+"] "+t)}},d}(),pa=function(d){for(var s=[],e=0;e<d.length;e++)s.push(d[e].toString(16));return s},Oh=function(){function d(e,t,i,r,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=t||!1,this.italics=i||!1,this.background=r||"black",this.flash=l||!1}var s=d.prototype;return s.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},s.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;i<t.length;i++){var r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}},s.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},s.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},s.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},s.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},d}(),ag=function(){function d(e,t,i,r,l,u){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new Oh(t,i,r,l,u)}var s=d.prototype;return s.reset=function(){this.uchar=" ",this.penState.reset()},s.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},s.setPenState=function(e){this.penState.copy(e)},s.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},s.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},s.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},d}(),ng=function(){function d(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 t=0;t<_r;t++)this.chars.push(new ag);this.logger=e,this.pos=0,this.currPenState=new Oh}var s=d.prototype;return s.equals=function(e){for(var t=!0,i=0;i<_r;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<_r;t++)this.chars[t].copy(e.chars[t])},s.isEmpty=function(){for(var e=!0,t=0;t<_r;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},s.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>_r&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=_r)},s.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)},s.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},s.insertChar=function(e){var t=this;e>=144&&this.backSpace();var i=Ph(e);this.pos>=_r?this.logger.log(0,function(){return"Cannot insert "+e.toString(16)+" ("+i+") at position "+t.pos+". Skipping it!"}):(this.chars[this.pos].setChar(i,this.currPenState),this.moveCursor(1))},s.clearFromPos=function(e){var t;for(t=e;t<_r;t++)this.chars[t].reset()},s.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},s.clearToEndOfRow=function(){this.clearFromPos(this.pos)},s.getTextString=function(){for(var e=[],t=!0,i=0;i<_r;i++){var r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")},s.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},d}(),Qd=function(){function d(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 t=0;t<ma;t++)this.rows.push(new ng(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var s=d.prototype;return s.reset=function(){for(var e=0;e<ma;e++)this.rows[e].clear();this.currRow=14},s.equals=function(e){for(var t=!0,i=0;i<ma;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<ma;t++)this.rows[t].copy(e.rows[t])},s.isEmpty=function(){for(var e=!0,t=0;t<ma;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},s.backSpace=function(){this.rows[this.currRow].backSpace()},s.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},s.insertChar=function(e){this.rows[this.currRow].insertChar(e)},s.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},s.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},s.setCursor=function(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},s.setPAC=function(e){this.logger.log(2,function(){return"pacData = "+JSON.stringify(e)});var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var i=0;i<ma;i++)this.rows[i].clear();var r=this.currRow+1-this.nrRollUpRows,l=this.lastOutputScreen;if(l){var u=l.rows[r].cueStartTime,c=this.logger.time;if(u&&c!==null&&u<c)for(var f=0;f<this.nrRollUpRows;f++)this.rows[t-this.nrRollUpRows+f+1].copy(l.rows[r+f])}}this.currRow=t;var h=this.rows[this.currRow];if(e.indent!==null){var p=e.indent,E=Math.max(p-1,0);h.setCursor(e.indent),e.color=h.chars[E].penState.foreground}var b={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(b)},s.setBkgData=function(e){this.logger.log(2,function(){return"bkgData = "+JSON.stringify(e)}),this.backSpace(),this.setPen(e),this.insertChar(32)},s.setRollUpRows=function(e){this.nrRollUpRows=e},s.rollUp=function(){var e=this;if(this.nrRollUpRows!==null){this.logger.log(1,function(){return e.getDisplayText()});var t=this.currRow+1-this.nrRollUpRows,i=this.rows.splice(t,1)[0];i.clear(),this.rows.splice(this.currRow,0,i),this.logger.log(2,"Rolling up")}else this.logger.log(3,"roll_up but nrRollUpRows not set yet")},s.getDisplayText=function(e){e=e||!1;for(var t=[],i="",r=-1,l=0;l<ma;l++){var u=this.rows[l].getTextString();u&&(r=l+1,e?t.push("Row "+r+": '"+u+"'"):t.push(u.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join(`
|
|
34
|
-
`)),i},s.getTextAndFormat=function(){return this.rows},d}(),Nh=function(){function d(e,t,i){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=t,this.mode=null,this.verbose=0,this.displayedMemory=new Qd(i),this.nonDisplayedMemory=new Qd(i),this.lastOutputScreen=new Qd(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var s=d.prototype;return s.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},s.getHandler=function(){return this.outputFilter},s.setHandler=function(e){this.outputFilter=e},s.setPAC=function(e){this.writeScreen.setPAC(e)},s.setBkgData=function(e){this.writeScreen.setBkgData(e)},s.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,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)},s.insertChars=function(e){for(var t=this,i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,function(){return r+": "+t.writeScreen.getDisplayText(!0)}),this.mode!=="MODE_PAINT-ON"&&this.mode!=="MODE_ROLL-UP"||(this.logger.log(1,function(){return"DISPLAYED: "+t.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},s.ccRCL=function(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},s.ccBS=function(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},s.ccAOF=function(){},s.ccAON=function(){},s.ccDER=function(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},s.ccRU=function(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},s.ccFON=function(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},s.ccRDC=function(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},s.ccTR=function(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")},s.ccRTD=function(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")},s.ccEDM=function(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},s.ccCR=function(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},s.ccENM=function(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},s.ccEOC=function(){var e=this;if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,function(){return"DISP: "+e.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)},s.ccTO=function(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},s.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var i=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},s.outputDataUpdate=function(e){e===void 0&&(e=!1);var t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime!==null||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},s.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},d}(),Fh=function(){function d(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new rg;this.channels=[null,new Nh(e,t,r),new Nh(e+1,i,r)],this.cmdHistory={a:null,b:null},this.logger=r}var s=d.prototype;return s.getHandler=function(e){return this.channels[e].getHandler()},s.setHandler=function(e,t){this.channels[e].setHandler(t)},s.addData=function(e,t){var i,r,l,u=!1;this.logger.time=e;for(var c=0;c<t.length;c+=2)if(r=127&t[c],l=127&t[c+1],r!==0||l!==0){if(this.logger.log(3,"["+pa([t[c],t[c+1]])+"] -> ("+pa([r,l])+")"),(i=this.parseCmd(r,l))||(i=this.parseMidrow(r,l)),i||(i=this.parsePAC(r,l)),i||(i=this.parseBackgroundAttributes(r,l)),!i&&(u=this.parseChars(r,l))){var f=this.currentChannel;f&&f>0?this.channels[f].insertChars(u):this.logger.log(2,"No channel found yet. TEXT-MODE?")}i||u||this.logger.log(2,"Couldn't parse cleaned data "+pa([r,l])+" orig: "+pa([t[c],t[c+1]]))}},s.parseCmd=function(e,t){var i=this.cmdHistory;if(!((e===20||e===28||e===21||e===29)&&t>=32&&t<=47||(e===23||e===31)&&t>=33&&t<=35))return!1;if(Uh(e,t,i))return rn(null,null,i),this.logger.log(3,"Repeated command ("+pa([e,t])+") is dropped"),!0;var r=e===20||e===21||e===23?1:2,l=this.channels[r];return e===20||e===21||e===28||e===29?t===32?l.ccRCL():t===33?l.ccBS():t===34?l.ccAOF():t===35?l.ccAON():t===36?l.ccDER():t===37?l.ccRU(2):t===38?l.ccRU(3):t===39?l.ccRU(4):t===40?l.ccFON():t===41?l.ccRDC():t===42?l.ccTR():t===43?l.ccRTD():t===44?l.ccEDM():t===45?l.ccCR():t===46?l.ccENM():t===47&&l.ccEOC():l.ccTO(t-32),rn(e,t,i),this.currentChannel=r,!0},s.parseMidrow=function(e,t){var i=0;if((e===17||e===25)&&t>=32&&t<=47){if((i=e===17?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var r=this.channels[i];return!!r&&(r.ccMIDROW(t),this.logger.log(3,"MIDROW ("+pa([e,t])+")"),!0)}return!1},s.parsePAC=function(e,t){var i,r=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(e===16||e===24)&&t>=64&&t<=95))return!1;if(Uh(e,t,r))return rn(null,null,r),!0;var l=e<=23?1:2;i=t>=64&&t<=95?l===1?Zv[e]:eg[e]:l===1?Jv[e]:tg[e];var u=this.channels[l];return!!u&&(u.setPAC(this.interpretPAC(i,t)),rn(e,t,r),this.currentChannel=l,!0)},s.interpretPAC=function(e,t){var i,r={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,r.underline=(1&i)==1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((i-16)/2),r},s.parseChars=function(e,t){var i,r,l=null,u=null;if(e>=25?(i=2,u=e-8):(i=1,u=e),u>=17&&u<=19?(r=u===17?t+80:u===18?t+112:t+144,this.logger.log(2,"Special char '"+Ph(r)+"' in channel "+i),l=[r]):e>=32&&e<=127&&(l=t===0?[e]:[e,t]),l){var c=pa(l);this.logger.log(3,"Char codes = "+c.join(",")),rn(e,t,this.cmdHistory)}return l},s.parseBackgroundAttributes=function(e,t){var i;if(!((e===16||e===24)&&t>=32&&t<=47||(e===23||e===31)&&t>=45&&t<=47))return!1;var r={};e===16||e===24?(i=Math.floor((t-32)/2),r.background=ig[i],t%2==1&&(r.background=r.background+"_semi")):t===45?r.background="transparent":(r.foreground="black",t===47&&(r.underline=!0));var l=e<=23?1:2;return this.channels[l].setBkgData(r),rn(e,t,this.cmdHistory),!0},s.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}},s.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var i=this.channels[t];i&&i.cueSplitAtTime(e)}},d}();function rn(d,s,e){e.a=d,e.b=s}function Uh(d,s,e){return e.a===d&&e.b===s}var Fo=function(){function d(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}var s=d.prototype;return s.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},s.newCue=function(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},s.reset=function(){this.cueRanges=[],this.startTime=null},d}(),Xd=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var d=["","lr","rl"],s=["start","middle","end","left","right"];function e(l,u){if(typeof u!="string"||!Array.isArray(l))return!1;var c=u.toLowerCase();return!!~l.indexOf(c)&&c}function t(l){return e(s,l)}function i(l){for(var u=arguments.length,c=new Array(u>1?u-1:0),f=1;f<u;f++)c[f-1]=arguments[f];for(var h=1;h<arguments.length;h++){var p=arguments[h];for(var E in p)l[E]=p[E]}return l}function r(l,u,c){var f=this,h={enumerable:!0};f.hasBeenReset=!1;var p="",E=!1,b=l,A=u,k=c,D=null,S="",I=!0,F="auto",N="start",V=50,Y="middle",j=50,J="middle";Object.defineProperty(f,"id",i({},h,{get:function(){return p},set:function(Q){p=""+Q}})),Object.defineProperty(f,"pauseOnExit",i({},h,{get:function(){return E},set:function(Q){E=!!Q}})),Object.defineProperty(f,"startTime",i({},h,{get:function(){return b},set:function(Q){if(typeof Q!="number")throw new TypeError("Start time must be set to a number.");b=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",i({},h,{get:function(){return A},set:function(Q){if(typeof Q!="number")throw new TypeError("End time must be set to a number.");A=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",i({},h,{get:function(){return k},set:function(Q){k=""+Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",i({},h,{get:function(){return D},set:function(Q){D=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",i({},h,{get:function(){return S},set:function(Q){var X=function(ue){return e(d,ue)}(Q);if(X===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",i({},h,{get:function(){return I},set:function(Q){I=!!Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",i({},h,{get:function(){return F},set:function(Q){if(typeof Q!="number"&&Q!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");F=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",i({},h,{get:function(){return N},set:function(Q){var X=t(Q);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");N=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",i({},h,{get:function(){return V},set:function(Q){if(Q<0||Q>100)throw new Error("Position must be between 0 and 100.");V=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",i({},h,{get:function(){return Y},set:function(Q){var X=t(Q);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");Y=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",i({},h,{get:function(){return j},set:function(Q){if(Q<0||Q>100)throw new Error("Size must be between 0 and 100.");j=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",i({},h,{get:function(){return J},set:function(Q){var X=t(Q);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");J=X,this.hasBeenReset=!0}})),f.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}(),sg=function(){function d(){}return d.prototype.decode=function(s,e){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},d}();function Bh(d){function s(t,i,r,l){return 3600*(0|t)+60*(0|i)+(0|r)+parseFloat(l||0)}var e=d.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return e?parseFloat(e[2])>59?s(e[2],e[3],0,e[4]):s(e[1],e[2],e[3],e[4]):null}var og=function(){function d(){this.values=Object.create(null)}var s=d.prototype;return s.set=function(e,t){this.get(e)||t===""||(this.values[e]=t)},s.get=function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},s.has=function(e){return e in this.values},s.alt=function(e,t,i){for(var r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}},s.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},s.percent=function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1},d}();function Hh(d,s,e,t){var i=t?d.split(t):[d];for(var r in i)if(typeof i[r]=="string"){var l=i[r].split(e);l.length===2&&s(l[0],l[1])}}var Zd=new Xd(0,0,""),Uo=Zd.align==="middle"?"middle":"center";function lg(d,s,e){var t=d;function i(){var l=Bh(d);if(l===null)throw new Error("Malformed timestamp: "+t);return d=d.replace(/^[^\sa-zA-Z-]+/,""),l}function r(){d=d.replace(/^\s+/,"")}if(r(),s.startTime=i(),r(),d.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+t);d=d.slice(3),r(),s.endTime=i(),r(),function(l,u){var c=new og;Hh(l,function(p,E){var b;switch(p){case"region":for(var A=e.length-1;A>=0;A--)if(e[A].id===E){c.set(p,e[A].region);break}break;case"vertical":c.alt(p,E,["rl","lr"]);break;case"line":b=E.split(","),c.integer(p,b[0]),c.percent(p,b[0])&&c.set("snapToLines",!1),c.alt(p,b[0],["auto"]),b.length===2&&c.alt("lineAlign",b[1],["start",Uo,"end"]);break;case"position":b=E.split(","),c.percent(p,b[0]),b.length===2&&c.alt("positionAlign",b[1],["start",Uo,"end","line-left","line-right","auto"]);break;case"size":c.percent(p,E);break;case"align":c.alt(p,E,["start",Uo,"end","left","right"])}},/:/,/\s/),u.region=c.get("region",null),u.vertical=c.get("vertical","");var f=c.get("line","auto");f==="auto"&&Zd.line===-1&&(f=-1),u.line=f,u.lineAlign=c.get("lineAlign","start"),u.snapToLines=c.get("snapToLines",!0),u.size=c.get("size",100),u.align=c.get("align",Uo);var h=c.get("position","auto");h==="auto"&&Zd.position===50&&(h=u.align==="start"||u.align==="left"?0:u.align==="end"||u.align==="right"?100:50),u.position=h}(d,s)}function Gh(d){return d.replace(/<br(?: \/)?>/gi,`
|
|
35
|
-
`)}var
|
|
33
|
+
Aborting and switching to level `+z),e.loader&&(this.fragCurrent=this.partCurrent=null,e.abortRequests()),i.trigger(w.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:c}))}}}}}}},s.onFragLoaded=function(e,t){var i=t.frag,r=t.part,o=r?r.stats:i.stats;if(i.type===et&&this.bwEstimator.sampleTTFB(o.loading.first-o.loading.start),!this.ignoreFragment(i)){if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var u=r?r.duration:i.duration,c=this.hls.levels[i.level],f=(c.loaded?c.loaded.bytes:0)+o.loaded,h=(c.loaded?c.loaded.duration:0)+u;c.loaded={bytes:f,duration:h},c.realBitrate=Math.round(8*f/h)}if(i.bitrateTest){var p={stats:o,frag:i,part:r,id:i.type};this.onFragBuffered(w.FRAG_BUFFERED,p),i.bitrateTest=!1}}},s.onFragBuffered=function(e,t){var i=t.frag,r=t.part,o=r!=null&&r.stats.loaded?r.stats:i.stats;if(!o.aborted&&!this.ignoreFragment(i)){var u=o.parsing.end-o.loading.start-Math.min(o.loading.first-o.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(u,o.loaded),o.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=u/1e3:this.bitrateTestDelay=0}},s.ignoreFragment=function(e){return e.type!==et||e.sn==="initSegment"},s.clearTimer=function(){self.clearInterval(this.timer)},s.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,r=i.maxAutoLevel,o=i.config,u=i.minAutoLevel,c=i.media,f=t?t.duration:e?e.duration:0,h=c&&c.playbackRate!==0?Math.abs(c.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():o.abrEwmaDefaultEstimate,y=i.mainForwardBufferInfo,b=(y?y.len:0)/h,A=this.findBestLevel(p,u,r,b,o.abrBandWidthFactor,o.abrBandWidthUpFactor);if(A>=0)return A;H.trace("[abr] "+(b?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var k=f?Math.min(f,o.maxStarvationDelay):o.maxStarvationDelay,D=o.abrBandWidthFactor,S=o.abrBandWidthUpFactor;if(!b){var L=this.bitrateTestDelay;L&&(k=(f?Math.min(f,o.maxLoadingDelay):o.maxLoadingDelay)-L,H.trace("[abr] bitrate test took "+Math.round(1e3*L)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*k)+" ms"),D=S=1)}return A=this.findBestLevel(p,u,r,b+k,D,S),Math.max(A,0)},s.findBestLevel=function(e,t,i,r,o,u){for(var c,f=this.fragCurrent,h=this.partCurrent,p=this.lastLoadedFragLevel,y=this.hls.levels,b=y[p],A=!(b==null||(c=b.details)==null||!c.live),k=b==null?void 0:b.codecSet,D=h?h.duration:f?f.duration:0,S=this.bwEstimator.getEstimateTTFB()/1e3,L=t,N=-1,P=i;P>=t;P--){var V=y[P];if(!V||k&&V.codecSet!==k)V&&(L=Math.min(P,L),N=Math.max(P,N));else{N!==-1&&H.trace("[abr] Skipped level(s) "+L+"-"+N+' with CODECS:"'+y[N].attrs.CODECS+'"; not compatible with "'+b.attrs.CODECS+'"');var q=V.details,j=(h?q==null?void 0:q.partTarget:q==null?void 0:q.averagetargetduration)||D,ee=void 0;ee=P<=p?o*e:u*e;var z=y[P].maxBitrate,X=this.getTimeToLoadFrag(S,ee,z*j,q===void 0);if(H.trace("[abr] level:"+P+" adjustedbw-bitrate:"+Math.round(ee-z)+" avgDuration:"+j.toFixed(1)+" maxFetchDuration:"+r.toFixed(1)+" fetchDuration:"+X.toFixed(1)),ee>z&&(X===0||!oe(X)||A&&!this.bitrateTestDelay||X<r))return P}}return-1},M(d,[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator;if(e!==-1&&!t.canEstimate())return e;var i=this.getNextABRAutoLevel();if(e!==-1){var r=this.hls.levels;if(r.length>Math.max(e,i)&&r[e].loadError<=r[i].loadError)return e}return e!==-1&&(i=Math.min(e,i)),i},set:function(e){this._nextAutoLevel=e}}]),d}(),Bh=function(){function d(){this.chunks=[],this.dataLength=0}var s=d.prototype;return s.push=function(e){this.chunks.push(e),this.dataLength+=e.length},s.flush=function(){var e,t=this.chunks,i=this.dataLength;return t.length?(e=t.length===1?t[0]:function(r,o){for(var u=new Uint8Array(o),c=0,f=0;f<r.length;f++){var h=r[f];u.set(h,c),c+=h.length}return u}(t,i),this.reset(),e):new Uint8Array(0)},s.reset=function(){this.chunks.length=0,this.dataLength=0},d}(),jv=function(d){function s(t,i,r){var o;return(o=d.call(this,t,i,r,"[audio-stream-controller]",_i)||this).videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.bufferedTrack=null,o.switchingTrack=null,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o.cachedTrackLoadedData=null,o._registerListeners(),o}Q(s,d);var e=s.prototype;return e.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null},e._registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(w.ERROR,this.onError,this),t.on(w.BUFFER_RESET,this.onBufferReset,this),t.on(w.BUFFER_CREATED,this.onBufferCreated,this),t.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(w.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(w.ERROR,this.onError,this),t.off(w.BUFFER_RESET,this.onBufferReset,this),t.off(w.BUFFER_CREATED,this.onBufferCreated,this),t.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(w.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this)},e.onInitPtsFound=function(t,i){var r=i.frag,o=i.id,u=i.initPTS,c=i.timescale;if(o==="main"){var f=r.cc;this.initPTS[r.cc]={baseTime:u,timescale:c},this.log("InitPTS for cc: "+f+" found from main: "+u),this.videoTrackCC=f,this.state===os&&this.tick()}},e.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=Rt);var i=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),i>0&&t===-1?(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),t=i,this.state=Le):(this.loadedmetadata=!1,this.state=Ta),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},e.doTick=function(){switch(this.state){case Le:this.doTickIdle();break;case Ta:var t,i=this.levels,r=this.trackId,o=i==null||(t=i[r])==null?void 0:t.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=os}break;case Gr:var u,c=performance.now(),f=this.retryDate;(!f||c>=f||(u=this.media)!=null&&u.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=Le);break;case os:var h=this.waitingData;if(h){var p=h.frag,y=h.part,b=h.cache,A=h.complete;if(this.initPTS[p.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=Hr;var k={frag:p,part:y,payload:b.flush(),networkDetails:null};this._handleFragmentLoadProgress(k),A&&d.prototype._handleFragmentLoadComplete.call(this,k)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+p.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var D=this.getLoadPosition(),S=ce.bufferInfo(this.mediaBuffer,D,this.config.maxBufferHole);Ja(S.end,this.config.maxFragLookUpTolerance,p)<0&&(this.log("Waiting fragment cc ("+p.cc+") @ "+p.start+" cancelled because another fragment at "+S.end+" is needed"),this.clearWaitingFragment())}}else this.state=Le}this.onTickEnd()},e.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Le)},e.resetLoadingState=function(){this.clearWaitingFragment(),d.prototype.resetLoadingState.call(this)},e.onTickEnd=function(){var t=this.media;t!=null&&t.readyState&&(this.lastCurrentTime=t.currentTime)},e.doTickIdle=function(){var t=this.hls,i=this.levels,r=this.media,o=this.trackId,u=t.config;if(i!=null&&i[o]&&(r||!this.startFragRequested&&u.startFragPrefetch)){var c=i[o],f=c.details;if(!f||f.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(f))this.state=Ta;else{var h=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&h&&(this.bufferFlushed=!1,this.afterBufferFlushed(h,ht,_i));var p=this.getFwdBufferInfo(h,_i);if(p!==null){var y=this.bufferedTrack,b=this.switchingTrack;if(!b&&this._streamEnded(p,f))return t.trigger(w.BUFFER_EOS,{type:"audio"}),void(this.state=ss);var A=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,et),k=p.len,D=this.getMaxBufferLength(A==null?void 0:A.len);if(!(k>=D)||b){var S=f.fragments[0].start,L=p.end;if(b&&r){var N=this.getLoadPosition();y&&b.attrs!==y.attrs&&(L=N),f.PTSKnown&&N<S&&(p.end>S||p.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=S+.05)}var P=this.getNextFragment(L,f),V=!1;if(P&&this.isLoopLoading(P,L)&&(V=!!P.gap,P=this.getNextFragmentLoopLoading(P,f,p,et,D)),P){var q=A&&P.start>A.end+f.targetduration;if(q||(A==null||!A.len)&&p.len){var j=this.getAppendedFrag(P.start,et);if(j===null||(V||(V=!!j.gap||!!q&&A.len===0),q&&!V||V&&p.nextStart&&p.nextStart<j.end))return}this.loadFragment(P,c,L)}else this.bufferFlushed=!0}}}}},e.getMaxBufferLength=function(t){var i=d.prototype.getMaxBufferLength.call(this);return t?Math.min(Math.max(i,t),this.config.maxMaxBufferLength):i},e.onMediaDetaching=function(){this.videoBuffer=null,d.prototype.onMediaDetaching.call(this)},e.onAudioTracksUpdated=function(t,i){var r=i.audioTracks;this.resetTransmuxer(),this.levels=r.map(function(o){return new ga(o)})},e.onAudioTrackSwitching=function(t,i){var r=!!i.url;this.trackId=i.id;var o=this.fragCurrent;o&&(o.abortRequests(),this.removeUnbufferedFrags(o.start)),this.resetLoadingState(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.switchingTrack=i,this.state=Le):(this.switchingTrack=null,this.bufferedTrack=i,this.state=Rt),this.tick()},e.onManifestLoading=function(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1},e.onLevelLoaded=function(t,i){this.mainDetails=i.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(w.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},e.onAudioTrackLoaded=function(t,i){var r;if(this.mainDetails!=null){var o=this.levels,u=i.details,c=i.id;if(o){this.log("Track "+c+" loaded ["+u.startSN+","+u.endSN+"]"+(u.lastPartSn?"[part-"+u.lastPartSn+"-"+u.lastPartIndex+"]":"")+",duration:"+u.totalduration);var f=o[c],h=0;if(u.live||(r=f.details)!=null&&r.live){var p=this.mainDetails;if(u.fragments[0]||(u.deltaUpdateFailed=!0),u.deltaUpdateFailed||!p)return;!f.details&&u.hasProgramDateTime&&p.hasProgramDateTime?(wt(u,p),h=u.fragments[0].start):h=this.alignPlaylists(u,f.details)}f.details=u,this.levelLastLoaded=c,this.startFragRequested||!this.mainDetails&&u.live||this.setStartPosition(f.details,h),this.state!==Ta||this.waitForCdnTuneIn(u)||(this.state=Le),this.tick()}else this.warn("Audio tracks were reset while loading level "+c)}else this.cachedTrackLoadedData=i},e._handleFragmentLoadProgress=function(t){var i,r=t.frag,o=t.part,u=t.payload,c=this.config,f=this.trackId,h=this.levels;if(h){var p=h[f];if(p){var y=p.details;if(!y)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);var b=c.defaultAudioCodec||p.audioCodec||"mp4a.40.2",A=this.transmuxer;A||(A=this.transmuxer=new Uh(this.hls,_i,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var k=this.initPTS[r.cc],D=(i=r.initSegment)==null?void 0:i.data;if(k!==void 0){var S=o?o.index:-1,L=S!==-1,N=new he(r.level,r.sn,r.stats.chunkCount,u.byteLength,S,L);A.push(u,D,b,"",r,o,y.totalduration,!1,N,k)}else this.log("Unknown video PTS for cc "+r.cc+", waiting for video PTS before demuxing audio frag "+r.sn+" of ["+y.startSN+" ,"+y.endSN+"],track "+f),(this.waitingData=this.waitingData||{frag:r,part:o,cache:new Bh,complete:!1}).cache.push(new Uint8Array(u)),this.waitingVideoCC=this.videoTrackCC,this.state=os}else this.warn("Audio track is undefined on fragment load progress")}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},e._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:d.prototype._handleFragmentLoadComplete.call(this,t)},e.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},e.onBufferCreated=function(t,i){var r=i.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer||null)},e.onFragBuffered=function(t,i){var r,o=i.frag,u=i.part;if(o.type===_i)if(this.fragContextChanged(o))this.warn("Fragment "+o.sn+(u?" p: "+u.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+(this.switchingTrack?this.switchingTrack.name:"false"));else{if(o.sn!=="initSegment"){this.fragPrevious=o;var c=this.switchingTrack;c&&(this.bufferedTrack=c,this.switchingTrack=null,this.hls.trigger(w.AUDIO_TRACK_SWITCHED,E({},c)))}this.fragBufferedComplete(o,u)}else this.loadedmetadata||o.type!==et||(r=this.videoBuffer||this.media)!=null&&r.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var r;if(i.fatal)this.state=en;else switch(i.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_i,i);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==Ta||((r=i.context)==null?void 0:r.type)!==hi||(this.state=Le);break;case $.BUFFER_FULL_ERROR:if(!i.parent||i.parent!=="audio")return;this.reduceLengthAndFlushBuffer(i)&&(this.bufferedTrack=null,d.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(i)}},e.onBufferFlushed=function(t,i){i.type===ht&&(this.bufferFlushed=!0,this.state===ss&&(this.state=Le))},e._handleTransmuxComplete=function(t){var i,r="audio",o=this.hls,u=t.remuxResult,c=t.chunkMeta,f=this.getCurrentContext(c);if(f){var h=f.frag,p=f.part,y=f.level.details,b=u.audio,A=u.text,k=u.id3,D=u.initSegment;if(!this.fragContextChanged(h)&&y){if(this.state=yr,this.switchingTrack&&b&&this.completeAudioSwitch(this.switchingTrack),D!=null&&D.tracks){var S=h.initSegment||h;this._bufferInitSegment(D.tracks,S,c),o.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:r,tracks:D.tracks})}if(b){var L=b.startPTS,N=b.endPTS,P=b.startDTS,V=b.endDTS;p&&(p.elementaryStreams[ht]={startPTS:L,endPTS:N,startDTS:P,endDTS:V}),h.setElementaryStreamInfo(ht,L,N,P,V),this.bufferFragmentData(b,h,p,c)}if(k!=null&&(i=k.samples)!=null&&i.length){var q=F({id:r,frag:h,details:y},k);o.trigger(w.FRAG_PARSING_METADATA,q)}if(A){var j=F({id:r,frag:h,details:y},A);o.trigger(w.FRAG_PARSING_USERDATA,j)}}else this.fragmentTracker.removeFragment(h)}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,r){if(this.state===yr){t.video&&delete t.video;var o=t.audio;if(o){o.levelCodec=o.codec,o.id="audio",this.log("Init audio buffer, container:"+o.container+", codecs[parsed]=["+o.codec+"]"),this.hls.trigger(w.BUFFER_CODECS,t);var u=o.initSegment;if(u!=null&&u.byteLength){var c={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:u};this.hls.trigger(w.BUFFER_APPENDING,c)}this.tick()}}},e.loadFragment=function(t,i,r){var o,u=this.fragmentTracker.getState(t);this.fragCurrent=t,this.switchingTrack||u===Z||u===ye?t.sn==="initSegment"?this._loadInitSegment(t,i):(o=i.details)!=null&&o.live&&!this.initPTS[t.cc]?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=os):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,r)):this.clearTrackerIfNeeded(t)},e.completeAudioSwitch=function(t){var i=this.hls,r=this.media,o=this.bufferedTrack,u=o==null?void 0:o.attrs,c=t.attrs;r&&u&&(u.CHANNELS!==c.CHANNELS||u.NAME!==c.NAME||u.LANGUAGE!==c.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),d.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=t,this.switchingTrack=null,i.trigger(w.AUDIO_TRACK_SWITCHED,E({},t))},s}(Vd),zv=function(d){function s(t){var i;return(i=d.call(this,t,"[audio-track-controller]")||this).tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.currentTrack=null,i.selectDefaultTrack=!0,i.registerListeners(),i}Q(s,d);var e=s.prototype;return e.registerListeners=function(){var t=this.hls;t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(w.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADING,this.onLevelLoading,this),t.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(w.ERROR,this.onError,this)},e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,d.prototype.destroy.call(this)},e.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},e.onManifestParsed=function(t,i){this.tracks=i.audioTracks||[]},e.onAudioTrackLoaded=function(t,i){var r=i.id,o=i.groupId,u=i.details,c=this.tracksInGroup[r];if(c&&c.groupId===o){var f=c.details;c.details=i.details,this.log("audio-track "+r+' "'+c.name+'" lang:'+c.lang+" group:"+o+" loaded ["+u.startSN+"-"+u.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,i,f)}else this.warn("Track with id:"+r+" and group:"+o+" not found in active group "+c.groupId)},e.onLevelLoading=function(t,i){this.switchLevel(i.level)},e.onLevelSwitching=function(t,i){this.switchLevel(i.level)},e.switchLevel=function(t){var i=this.hls.levels[t];if(i!=null&&i.audioGroupIds){var r=i.audioGroupIds[i.urlId];if(this.groupId!==r){this.groupId=r||null;var o=this.tracks.filter(function(c){return!r||c.groupId===r});this.selectDefaultTrack&&!o.some(function(c){return c.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=o;var u={audioTracks:o};this.log("Updating audio tracks, "+o.length+" track(s) found in group:"+r),this.hls.trigger(w.AUDIO_TRACKS_UPDATED,u),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===hi&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&(this.requestScheduled=-1,this.checkRetry(i))},e.setAudioTrack=function(t){var i=this.tracksInGroup;if(t<0||t>=i.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var r=this.currentTrack;i[this.trackId];var o=i[t],u=o.groupId,c=o.name;if(this.log("Switching to audio-track "+t+' "'+c+'" lang:'+o.lang+" group:"+u),this.trackId=t,this.currentTrack=o,this.selectDefaultTrack=!1,this.hls.trigger(w.AUDIO_TRACK_SWITCHING,E({},o)),!o.details||o.details.live){var f=this.switchParams(o.url,r==null?void 0:r.details);this.loadPlaylist(f)}}},e.selectInitialTrack=function(){var t=this.tracksInGroup,i=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(i!==-1)this.setAudioTrack(i);else{var r=new Error("No track found for running audio group-ID: "+this.groupId+" track count: "+t.length);this.warn(r.message),this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:r})}},e.findTrackId=function(t){for(var i=this.tracksInGroup,r=0;r<i.length;r++){var o=i[r];if((!this.selectDefaultTrack||o.default)&&(!t||t.attrs["STABLE-RENDITION-ID"]!==void 0&&t.attrs["STABLE-RENDITION-ID"]===o.attrs["STABLE-RENDITION-ID"]||t.name===o.name&&t.lang===o.lang))return o.id}return-1},e.loadPlaylist=function(t){d.prototype.loadPlaylist.call(this);var i=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(i)){var r=i.id,o=i.groupId,u=i.url;if(t)try{u=t.addDirectives(u)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("loading audio-track playlist "+r+' "'+i.name+'" lang:'+i.lang+" group:"+o),this.clearTimer(),this.hls.trigger(w.AUDIO_TRACK_LOADING,{url:u,id:r,groupId:o,deliveryDirectives:t||null})}},M(s,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}}]),s}(x);function Hh(d,s){if(d.length!==s.length)return!1;for(var e=0;e<d.length;e++)if(!Qv(d[e].attrs,s[e].attrs))return!1;return!0}function Qv(d,s){var e=d["STABLE-RENDITION-ID"];return e?e===s["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some(function(t){return d[t]!==s[t]})}var Xv=function(d){function s(t,i,r){var o;return(o=d.call(this,t,i,r,"[subtitle-stream-controller]",Ri)||this).levels=[],o.currentTrackId=-1,o.tracksBuffered=[],o.mainDetails=null,o._registerListeners(),o}Q(s,d);var e=s.prototype;return e.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},e._registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.ERROR,this.onError,this),t.on(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(w.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(w.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.ERROR,this.onError,this),t.off(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(w.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(w.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this)},e.startLoad=function(t){this.stopLoad(),this.state=Le,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},e.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},e.onMediaDetaching=function(){this.tracksBuffered=[],d.prototype.onMediaDetaching.call(this)},e.onLevelLoaded=function(t,i){this.mainDetails=i.details},e.onSubtitleFragProcessed=function(t,i){var r=i.frag,o=i.success;if(this.fragPrevious=r,this.state=Le,o){var u=this.tracksBuffered[this.currentTrackId];if(u){for(var c,f=r.start,h=0;h<u.length;h++)if(f>=u[h].start&&f<=u[h].end){c=u[h];break}var p=r.start+r.duration;c?c.end=p:(c={start:f,end:p},u.push(c)),this.fragmentTracker.fragBuffered(r)}}},e.onBufferFlushing=function(t,i){var r=i.startOffset,o=i.endOffset;if(r===0&&o!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,c=this.levels;if(!c.length||!c[u]||!c[u].details)return;var f=o-c[u].details.targetduration;if(f<=0)return;i.endOffsetSubtitles=Math.max(0,f),this.tracksBuffered.forEach(function(h){for(var p=0;p<h.length;)if(h[p].end<=f)h.shift();else{if(!(h[p].start<f))break;h[p].start=f,p++}}),this.fragmentTracker.removeFragmentsInRange(r,f,Ri)}},e.onFragBuffered=function(t,i){var r;this.loadedmetadata||i.frag.type!==et||(r=this.media)!=null&&r.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var r=i.frag;(r==null?void 0:r.type)===Ri&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Rt&&(this.state=Le))},e.onSubtitleTracksUpdated=function(t,i){var r=this,o=i.subtitleTracks;Hh(this.levels,o)?this.levels=o.map(function(u){return new ga(u)}):(this.tracksBuffered=[],this.levels=o.map(function(u){var c=new ga(u);return r.tracksBuffered[c.id]=[],c}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ri),this.fragPrevious=null,this.mediaBuffer=null)},e.onSubtitleTrackSwitch=function(t,i){if(this.currentTrackId=i.id,this.levels.length&&this.currentTrackId!==-1){var r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(500)}else this.clearInterval()},e.onSubtitleTrackLoaded=function(t,i){var r,o=i.details,u=i.id,c=this.currentTrackId,f=this.levels;if(f.length){var h=f[c];if(!(u>=f.length||u!==c)&&h){this.mediaBuffer=this.mediaBufferTimeRanges;var p=0;if(o.live||(r=h.details)!=null&&r.live){var y=this.mainDetails;if(o.deltaUpdateFailed||!y)return;var b=y.fragments[0];h.details?(p=this.alignPlaylists(o,h.details))===0&&b&&Ea(o,p=b.start):o.hasProgramDateTime&&y.hasProgramDateTime?(wt(o,y),p=o.fragments[0].start):b&&Ea(o,p=b.start)}h.details=o,this.levelLastLoaded=u,this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(h.details,p),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===Le&&(ba(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),h.details=void 0))}}},e._handleFragmentLoadComplete=function(t){var i=this,r=t.frag,o=t.payload,u=r.decryptdata,c=this.hls;if(!this.fragContextChanged(r)&&o&&o.byteLength>0&&u&&u.key&&u.iv&&u.method==="AES-128"){var f=performance.now();this.decrypter.decrypt(new Uint8Array(o),u.key.buffer,u.iv.buffer).catch(function(h){throw c.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:h,reason:h.message,frag:r}),h}).then(function(h){var p=performance.now();c.trigger(w.FRAG_DECRYPTED,{frag:r,payload:h,stats:{tstart:f,tdecrypt:p}})}).catch(function(h){i.warn(h.name+": "+h.message),i.state=Le})}},e.doTick=function(){if(this.media){if(this.state===Le){var t=this.currentTrackId,i=this.levels,r=i[t];if(!i.length||!r||!r.details)return;var o=r.details,u=o.targetduration,c=this.config,f=this.getLoadPosition(),h=ce.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],f-u,c.maxBufferHole),p=h.end,y=h.len,b=this.getFwdBufferInfo(this.media,et);if(y>this.getMaxBufferLength(b==null?void 0:b.len)+u)return;var A=o.fragments,k=A.length,D=o.edge,S=null,L=this.fragPrevious;if(p<D){var N=c.maxFragLookUpTolerance;!(S=ba(L,A,Math.max(A[0].start,p),N))&&L&&L.start<A[0].start&&(S=A[0])}else S=A[k-1];if(!S)return;S=this.mapToInitFragWhenRequired(S),this.fragmentTracker.getState(S)===Z&&this.loadFragment(S,r,p)}}else this.state=Le},e.getMaxBufferLength=function(t){var i=d.prototype.getMaxBufferLength.call(this);return t?Math.max(i,t):i},e.loadFragment=function(t,i,r){this.fragCurrent=t,t.sn==="initSegment"?this._loadInitSegment(t,i):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,r))},M(s,[{key:"mediaBufferTimeRanges",get:function(){return new Zv(this.tracksBuffered[this.currentTrackId]||[])}}]),s}(Vd),Zv=function(d){this.buffered=void 0;var s=function(e,t,i){if((t>>>=0)>i-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is greater than the maximum bound ("+i+")");return d[t][e]};this.buffered={get length(){return d.length},end:function(e){return s("end",e,d.length)},start:function(e){return s("start",e,d.length)}}},Jv=function(d){function s(t){var i;return(i=d.call(this,t,"[subtitle-track-controller]")||this).media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i._subtitleDisplay=!0,i.registerListeners(),i}Q(s,d);var e=s.prototype;return e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,d.prototype.destroy.call(this)},e.registerListeners=function(){var t=this.hls;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(w.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADING,this.onLevelLoading,this),t.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(w.ERROR,this.onError,this)},e.onMediaAttached=function(t,i){this.media=i.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))},e.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},e.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),tu(this.media.textTracks).forEach(function(t){Br(t)}),this.subtitleTrack=-1,this.media=null)},e.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},e.onManifestParsed=function(t,i){this.tracks=i.subtitleTracks},e.onSubtitleTrackLoaded=function(t,i){var r=i.id,o=i.details,u=this.trackId,c=this.tracksInGroup[u];if(c){var f=c.details;c.details=i.details,this.log("subtitle track "+r+" loaded ["+o.startSN+"-"+o.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,i,f)}else this.warn("Invalid subtitle track id "+r)},e.onLevelLoading=function(t,i){this.switchLevel(i.level)},e.onLevelSwitching=function(t,i){this.switchLevel(i.level)},e.switchLevel=function(t){var i=this.hls.levels[t];if(i!=null&&i.textGroupIds){var r=i.textGroupIds[i.urlId],o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==r){var u=this.tracks.filter(function(h){return!r||h.groupId===r});this.tracksInGroup=u;var c=this.findTrackId(o==null?void 0:o.name)||this.findTrackId();this.groupId=r||null;var f={subtitleTracks:u};this.log("Updating subtitle tracks, "+u.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(w.SUBTITLE_TRACKS_UPDATED,f),c!==-1&&this.setSubtitleTrack(c,o)}else this.shouldReloadPlaylist(o)&&this.setSubtitleTrack(this.trackId,o)}},e.findTrackId=function(t){for(var i=this.tracksInGroup,r=0;r<i.length;r++){var o=i[r];if((!this.selectDefaultTrack||o.default)&&(!t||t===o.name))return o.id}return-1},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===Ki&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.checkRetry(i)},e.loadPlaylist=function(t){d.prototype.loadPlaylist.call(this);var i=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(i)){var r=i.id,o=i.groupId,u=i.url;if(t)try{u=t.addDirectives(u)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Loading subtitle playlist for id "+r),this.hls.trigger(w.SUBTITLE_TRACK_LOADING,{url:u,id:r,groupId:o,deliveryDirectives:t||null})}},e.toggleTrackModes=function(t){var i=this,r=this.media,o=this.trackId;if(r){var u=tu(r.textTracks),c=u.filter(function(p){return p.groupId===i.groupId});if(t===-1)[].slice.call(u).forEach(function(p){p.mode="disabled"});else{var f=c[o];f&&(f.mode="disabled")}var h=c[t];h&&(h.mode=this.subtitleDisplay?"showing":"hidden")}},e.setSubtitleTrack=function(t,i){var r,o=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(t===-1||(r=o[t])!=null&&r.details)||t<-1||t>=o.length)){this.clearTimer();var u=o[t];if(this.log("Switching to subtitle-track "+t+(u?' "'+u.name+'" lang:'+u.lang+" group:"+u.groupId:"")),this.trackId=t,u){var c=u.id,f=u.groupId,h=f===void 0?"":f,p=u.name,y=u.type,b=u.url;this.hls.trigger(w.SUBTITLE_TRACK_SWITCH,{id:c,groupId:h,name:p,type:y,url:b});var A=this.switchParams(u.url,i==null?void 0:i.details);this.loadPlaylist(A)}else this.hls.trigger(w.SUBTITLE_TRACK_SWITCH,{id:t})}}else this.queuedDefaultTrack=t},e.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var t=-1,i=tu(this.media.textTracks),r=0;r<i.length;r++)if(i[r].mode==="hidden")t=r;else if(i[r].mode==="showing"){t=r;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)}},M(s,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,i)}}]),s}(x);function tu(d){for(var s=[],e=0;e<d.length;e++){var t=d[e];t.kind!=="subtitles"&&t.kind!=="captions"||!t.label||s.push(d[e])}return s}var eg=function(){function d(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var s=d.prototype;return s.append=function(e,t){var i=this.queues[t];i.push(e),i.length===1&&this.buffers[t]&&this.executeNext(t)},s.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},s.appendBlocker=function(e){var t,i=new Promise(function(o){t=o}),r={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(r,e),i},s.executeNext=function(e){var t=this.buffers,i=this.queues,r=t[e],o=i[e];if(o.length){var u=o[0];try{u.execute()}catch(c){H.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),u.onError(c),r!=null&&r.updating||(o.shift(),this.executeNext(e))}}},s.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},s.current=function(e){return this.queues[e][0]},d}(),Gh=$a(),Vh=/([ha]vc.)(?:\.[^.,]+)+/,tg=function(){function d(e){var t=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 i=t.media,r=t.mediaSource;H.log("[buffer-controller]: Media source opened"),i&&(i.removeEventListener("emptied",t._onMediaEmptied),t.updateMediaElementDuration(),t.hls.trigger(w.MEDIA_ATTACHED,{media:i})),r&&r.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){H.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){H.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=function(){var i=t.media,r=t._objectUrl;i&&i.src!==r&&H.error("Media element src was set while attaching MediaSource ("+r+" > "+i.src+")")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var s=d.prototype;return s.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},s.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null},s.registerListeners=function(){var e=this.hls;e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.BUFFER_RESET,this.onBufferReset,this),e.on(w.BUFFER_APPENDING,this.onBufferAppending,this),e.on(w.BUFFER_CODECS,this.onBufferCodecs,this),e.on(w.BUFFER_EOS,this.onBufferEos,this),e.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(w.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(w.FRAG_PARSED,this.onFragParsed,this),e.on(w.FRAG_CHANGED,this.onFragChanged,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.BUFFER_RESET,this.onBufferReset,this),e.off(w.BUFFER_APPENDING,this.onBufferAppending,this),e.off(w.BUFFER_CODECS,this.onBufferCodecs,this),e.off(w.BUFFER_EOS,this.onBufferEos,this),e.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(w.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(w.FRAG_PARSED,this.onFragParsed,this),e.off(w.FRAG_CHANGED,this.onFragChanged,this)},s._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new eg(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null},s.onManifestLoading=function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null},s.onManifestParsed=function(e,t){var i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,H.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},s.onMediaAttaching=function(e,t){var i=this.media=t.media;if(i&&Gh){var r=this.mediaSource=new Gh;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(r),this._objectUrl=i.src,i.addEventListener("emptied",this._onMediaEmptied)}},s.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(H.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){H.warn("[buffer-controller]: onMediaDetaching: "+r.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):H.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(w.MEDIA_DETACHED,void 0)},s.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){var i=e.sourceBuffer[t];try{i&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(i),e.sourceBuffer[t]=void 0)}catch(r){H.warn("[buffer-controller]: Failed to reset the "+t+" buffer",r)}}),this._initSourceBuffer()},s.onBufferCodecs=function(e,t){var i=this,r=this.getSourceBufferTypes().length;Object.keys(t).forEach(function(o){if(r){var u=i.tracks[o];if(u&&typeof u.buffer.changeType=="function"){var c=t[o],f=c.id,h=c.codec,p=c.levelCodec,y=c.container,b=c.metadata,A=(u.levelCodec||u.codec).replace(Vh,"$1"),k=(p||h).replace(Vh,"$1");if(A!==k){var D=y+";codecs="+(p||h);i.appendChangeType(o,D),H.log("[buffer-controller]: switching codec "+A+" to "+k),i.tracks[o]={buffer:u.buffer,codec:h,container:y,levelCodec:p,metadata:b,id:f}}}}else i.pendingTracks[o]=t[o]}),r||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},s.appendChangeType=function(e,t){var i=this,r=this.operationQueue,o={execute:function(){var u=i.sourceBuffer[e];u&&(H.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),u.changeType(t)),r.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(u){H.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",u)}};r.append(o,e)},s.onBufferAppending=function(e,t){var i=this,r=this.hls,o=this.operationQueue,u=this.tracks,c=t.data,f=t.type,h=t.frag,p=t.part,y=t.chunkMeta,b=y.buffering[f],A=self.performance.now();b.start=A;var k=h.stats.buffering,D=p?p.stats.buffering:null;k.start===0&&(k.start=A),D&&D.start===0&&(D.start=A);var S=u.audio,L=!1;f==="audio"&&(S==null?void 0:S.container)==="audio/mpeg"&&(L=!this.lastMpegAudioChunk||y.id===1||this.lastMpegAudioChunk.sn!==y.sn,this.lastMpegAudioChunk=y);var N=h.start,P={execute:function(){if(b.executeStart=self.performance.now(),L){var V=i.sourceBuffer[f];if(V){var q=N-V.timestampOffset;Math.abs(q)>=.1&&(H.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+N+" (delta: "+q+") sn: "+h.sn+")"),V.timestampOffset=N)}}i.appendExecutor(c,f)},onStart:function(){},onComplete:function(){var V=self.performance.now();b.executeEnd=b.end=V,k.first===0&&(k.first=V),D&&D.first===0&&(D.first=V);var q=i.sourceBuffer,j={};for(var ee in q)j[ee]=ce.getBuffered(q[ee]);i.appendError=0,i.hls.trigger(w.BUFFER_APPENDED,{type:f,frag:h,part:p,chunkMeta:y,parent:h.type,timeRanges:j})},onError:function(V){H.error("[buffer-controller]: Error encountered while trying to append to the "+f+" SourceBuffer",V);var q={type:le.MEDIA_ERROR,parent:h.type,details:$.BUFFER_APPEND_ERROR,frag:h,part:p,chunkMeta:y,error:V,err:V,fatal:!1};V.code===DOMException.QUOTA_EXCEEDED_ERR?q.details=$.BUFFER_FULL_ERROR:(i.appendError++,q.details=$.BUFFER_APPEND_ERROR,i.appendError>r.config.appendErrorMaxRetry&&(H.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),q.fatal=!0)),r.trigger(w.ERROR,q)}};o.append(P,f)},s.onBufferFlushing=function(e,t){var i=this,r=this.operationQueue,o=function(u){return{execute:i.removeExecutor.bind(i,u,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(w.BUFFER_FLUSHED,{type:u})},onError:function(c){H.warn("[buffer-controller]: Failed to remove from "+u+" SourceBuffer",c)}}};t.type?r.append(o(t.type),t.type):this.getSourceBufferTypes().forEach(function(u){r.append(o(u),u)})},s.onFragParsed=function(e,t){var i=this,r=t.frag,o=t.part,u=[],c=o?o.elementaryStreams:r.elementaryStreams;c[Qi]?u.push("audiovideo"):(c[ht]&&u.push("audio"),c[Tt]&&u.push("video")),u.length===0&&H.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers(function(){var f=self.performance.now();r.stats.buffering.end=f,o&&(o.stats.buffering.end=f);var h=o?o.stats:r.stats;i.hls.trigger(w.FRAG_BUFFERED,{frag:r,part:o,stats:h,id:r.type})},u)},s.onFragChanged=function(e,t){this.flushBackBuffer()},s.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce(function(r,o){var u=i.sourceBuffer[o];return!u||t.type&&t.type!==o||(u.ending=!0,u.ended||(u.ended=!0,H.log("[buffer-controller]: "+o+" sourceBuffer now EOS"))),r&&!(u&&!u.ended)},!0)&&(H.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){i.getSourceBufferTypes().forEach(function(o){var u=i.sourceBuffer[o];u&&(u.ending=!1)});var r=i.mediaSource;r&&r.readyState==="open"?(H.log("[buffer-controller]: Calling mediaSource.endOfStream()"),r.endOfStream()):r&&H.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+r.readyState)}))},s.onLevelUpdated=function(e,t){var i=t.details;i.fragments.length&&(this.details=i,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},s.flushBackBuffer=function(){var e=this.hls,t=this.details,i=this.media,r=this.sourceBuffer;if(i&&t!==null){var o=this.getSourceBufferTypes();if(o.length){var u=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(oe(u)&&!(u<0)){var c=i.currentTime,f=t.levelTargetDuration,h=Math.max(u,f),p=Math.floor(c/f)*f-h;o.forEach(function(y){var b=r[y];if(b){var A=ce.getBuffered(b);if(A.length>0&&p>A.start(0)){if(e.trigger(w.BACK_BUFFER_REACHED,{bufferEnd:p}),t.live)e.trigger(w.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p});else if(b.ended&&A.end(A.length-1)-c<2*f)return void H.info("[buffer-controller]: Cannot flush "+y+" back buffer while SourceBuffer is in ended state");e.trigger(w.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:y})}}})}}}},s.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&this.mediaSource.readyState==="open"){var e=this.details,t=this.hls,i=this.media,r=this.mediaSource,o=e.fragments[0].start+e.totalduration,u=i.duration,c=oe(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(H.log("[buffer-controller]: Media Source duration is set to Infinity"),r.duration=1/0,this.updateSeekableRange(e)):(o>c&&o>u||!oe(u))&&(H.log("[buffer-controller]: Updating Media Source duration to "+o.toFixed(3)),r.duration=o)}},s.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){var r=Math.max(0,i[0].start),o=Math.max(r,r+e.totalduration);t.setLiveSeekableRange(r,o)}},s.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,r=Object.keys(i).length;if(r&&!e||r===2){this.createSourceBuffers(i),this.pendingTracks={};var o=this.getSourceBufferTypes();if(o.length)this.hls.trigger(w.BUFFER_CREATED,{tracks:this.tracks}),o.forEach(function(c){t.executeNext(c)});else{var u=new Error("could not create source buffer for media codec(s)");this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:u,reason:u.message})}}},s.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(var r in e)if(!t[r]){var o=e[r];if(!o)throw Error("source buffer exists for track "+r+", however track does not");var u=o.levelCodec||o.codec,c=o.container+";codecs="+u;H.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var f=t[r]=i.addSourceBuffer(c),h=r;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[r]={buffer:f,codec:u,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(p){H.error("[buffer-controller]: error while trying to add sourceBuffer: "+p.message),this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:p,mimeType:c})}}},s._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},s._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},s._onSBUpdateError=function(e,t){var i=new Error(e+" SourceBuffer error");H.error("[buffer-controller]: "+i,t),this.hls.trigger(w.ERROR,{type:le.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,error:i,fatal:!1});var r=this.operationQueue.current(e);r&&r.onError(t)},s.removeExecutor=function(e,t,i){var r=this.media,o=this.mediaSource,u=this.operationQueue,c=this.sourceBuffer[e];if(!r||!o||!c)return H.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void u.shiftAndExecuteNext(e);var f=oe(r.duration)?r.duration:1/0,h=oe(o.duration)?o.duration:1/0,p=Math.max(0,t),y=Math.min(i,f,h);y>p&&!c.ending?(c.ended=!1,H.log("[buffer-controller]: Removing ["+p+","+y+"] from the "+e+" SourceBuffer"),c.remove(p,y)):u.shiftAndExecuteNext(e)},s.appendExecutor=function(e,t){var i=this.operationQueue,r=this.sourceBuffer[t];if(!r)return H.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(t);r.ended=!1,r.appendBuffer(e)},s.blockBuffers=function(e,t){var i=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length)return H.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var r=this.operationQueue,o=t.map(function(u){return r.appendBlocker(u)});Promise.all(o).then(function(){e(),t.forEach(function(u){var c=i.sourceBuffer[u];c!=null&&c.updating||r.shiftAndExecuteNext(u)})})},s.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},s.addBufferListener=function(e,t,i){var r=this.sourceBuffer[e];if(r){var o=i.bind(this,e);this.listeners[e].push({event:t,listener:o}),r.addEventListener(t,o)}},s.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach(function(i){t.removeEventListener(i.event,i.listener)})},d}(),Kh={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},Wh=function(d){var s=d;return Kh.hasOwnProperty(d)&&(s=Kh[d]),String.fromCharCode(s)},Sa=15,br=100,ig={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},rg={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ag={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ng={25:2,26:4,29:6,30:8,31:10,27:13,28:15},sg=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],og=function(){function d(){this.time=null,this.verboseLevel=0}return d.prototype.log=function(s,e){if(this.verboseLevel>=s){var t=typeof e=="function"?e():e;H.log(this.time+" ["+s+"] "+t)}},d}(),ka=function(d){for(var s=[],e=0;e<d.length;e++)s.push(d[e].toString(16));return s},qh=function(){function d(e,t,i,r,o){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=t||!1,this.italics=i||!1,this.background=r||"black",this.flash=o||!1}var s=d.prototype;return s.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},s.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;i<t.length;i++){var r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}},s.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},s.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},s.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},s.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},d}(),lg=function(){function d(e,t,i,r,o,u){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new qh(t,i,r,o,u)}var s=d.prototype;return s.reset=function(){this.uchar=" ",this.penState.reset()},s.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},s.setPenState=function(e){this.penState.copy(e)},s.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},s.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},s.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},d}(),dg=function(){function d(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 t=0;t<br;t++)this.chars.push(new lg);this.logger=e,this.pos=0,this.currPenState=new qh}var s=d.prototype;return s.equals=function(e){for(var t=!0,i=0;i<br;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<br;t++)this.chars[t].copy(e.chars[t])},s.isEmpty=function(){for(var e=!0,t=0;t<br;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},s.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>br&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=br)},s.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)},s.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},s.insertChar=function(e){var t=this;e>=144&&this.backSpace();var i=Wh(e);this.pos>=br?this.logger.log(0,function(){return"Cannot insert "+e.toString(16)+" ("+i+") at position "+t.pos+". Skipping it!"}):(this.chars[this.pos].setChar(i,this.currPenState),this.moveCursor(1))},s.clearFromPos=function(e){var t;for(t=e;t<br;t++)this.chars[t].reset()},s.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},s.clearToEndOfRow=function(){this.clearFromPos(this.pos)},s.getTextString=function(){for(var e=[],t=!0,i=0;i<br;i++){var r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")},s.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},d}(),iu=function(){function d(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 t=0;t<Sa;t++)this.rows.push(new dg(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var s=d.prototype;return s.reset=function(){for(var e=0;e<Sa;e++)this.rows[e].clear();this.currRow=14},s.equals=function(e){for(var t=!0,i=0;i<Sa;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<Sa;t++)this.rows[t].copy(e.rows[t])},s.isEmpty=function(){for(var e=!0,t=0;t<Sa;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},s.backSpace=function(){this.rows[this.currRow].backSpace()},s.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},s.insertChar=function(e){this.rows[this.currRow].insertChar(e)},s.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},s.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},s.setCursor=function(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},s.setPAC=function(e){this.logger.log(2,function(){return"pacData = "+JSON.stringify(e)});var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var i=0;i<Sa;i++)this.rows[i].clear();var r=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){var u=o.rows[r].cueStartTime,c=this.logger.time;if(u&&c!==null&&u<c)for(var f=0;f<this.nrRollUpRows;f++)this.rows[t-this.nrRollUpRows+f+1].copy(o.rows[r+f])}}this.currRow=t;var h=this.rows[this.currRow];if(e.indent!==null){var p=e.indent,y=Math.max(p-1,0);h.setCursor(e.indent),e.color=h.chars[y].penState.foreground}var b={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(b)},s.setBkgData=function(e){this.logger.log(2,function(){return"bkgData = "+JSON.stringify(e)}),this.backSpace(),this.setPen(e),this.insertChar(32)},s.setRollUpRows=function(e){this.nrRollUpRows=e},s.rollUp=function(){var e=this;if(this.nrRollUpRows!==null){this.logger.log(1,function(){return e.getDisplayText()});var t=this.currRow+1-this.nrRollUpRows,i=this.rows.splice(t,1)[0];i.clear(),this.rows.splice(this.currRow,0,i),this.logger.log(2,"Rolling up")}else this.logger.log(3,"roll_up but nrRollUpRows not set yet")},s.getDisplayText=function(e){e=e||!1;for(var t=[],i="",r=-1,o=0;o<Sa;o++){var u=this.rows[o].getTextString();u&&(r=o+1,e?t.push("Row "+r+": '"+u+"'"):t.push(u.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join(`
|
|
34
|
+
`)),i},s.getTextAndFormat=function(){return this.rows},d}(),Yh=function(){function d(e,t,i){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=t,this.mode=null,this.verbose=0,this.displayedMemory=new iu(i),this.nonDisplayedMemory=new iu(i),this.lastOutputScreen=new iu(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var s=d.prototype;return s.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},s.getHandler=function(){return this.outputFilter},s.setHandler=function(e){this.outputFilter=e},s.setPAC=function(e){this.writeScreen.setPAC(e)},s.setBkgData=function(e){this.writeScreen.setBkgData(e)},s.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,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)},s.insertChars=function(e){for(var t=this,i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,function(){return r+": "+t.writeScreen.getDisplayText(!0)}),this.mode!=="MODE_PAINT-ON"&&this.mode!=="MODE_ROLL-UP"||(this.logger.log(1,function(){return"DISPLAYED: "+t.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},s.ccRCL=function(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},s.ccBS=function(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},s.ccAOF=function(){},s.ccAON=function(){},s.ccDER=function(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},s.ccRU=function(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},s.ccFON=function(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},s.ccRDC=function(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},s.ccTR=function(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")},s.ccRTD=function(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")},s.ccEDM=function(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},s.ccCR=function(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},s.ccENM=function(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},s.ccEOC=function(){var e=this;if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,function(){return"DISP: "+e.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)},s.ccTO=function(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},s.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var i=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},s.outputDataUpdate=function(e){e===void 0&&(e=!1);var t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime!==null||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},s.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},d}(),$h=function(){function d(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new og;this.channels=[null,new Yh(e,t,r),new Yh(e+1,i,r)],this.cmdHistory={a:null,b:null},this.logger=r}var s=d.prototype;return s.getHandler=function(e){return this.channels[e].getHandler()},s.setHandler=function(e,t){this.channels[e].setHandler(t)},s.addData=function(e,t){var i,r,o,u=!1;this.logger.time=e;for(var c=0;c<t.length;c+=2)if(r=127&t[c],o=127&t[c+1],r!==0||o!==0){if(this.logger.log(3,"["+ka([t[c],t[c+1]])+"] -> ("+ka([r,o])+")"),(i=this.parseCmd(r,o))||(i=this.parseMidrow(r,o)),i||(i=this.parsePAC(r,o)),i||(i=this.parseBackgroundAttributes(r,o)),!i&&(u=this.parseChars(r,o))){var f=this.currentChannel;f&&f>0?this.channels[f].insertChars(u):this.logger.log(2,"No channel found yet. TEXT-MODE?")}i||u||this.logger.log(2,"Couldn't parse cleaned data "+ka([r,o])+" orig: "+ka([t[c],t[c+1]]))}},s.parseCmd=function(e,t){var i=this.cmdHistory;if(!((e===20||e===28||e===21||e===29)&&t>=32&&t<=47||(e===23||e===31)&&t>=33&&t<=35))return!1;if(jh(e,t,i))return nn(null,null,i),this.logger.log(3,"Repeated command ("+ka([e,t])+") is dropped"),!0;var r=e===20||e===21||e===23?1:2,o=this.channels[r];return e===20||e===21||e===28||e===29?t===32?o.ccRCL():t===33?o.ccBS():t===34?o.ccAOF():t===35?o.ccAON():t===36?o.ccDER():t===37?o.ccRU(2):t===38?o.ccRU(3):t===39?o.ccRU(4):t===40?o.ccFON():t===41?o.ccRDC():t===42?o.ccTR():t===43?o.ccRTD():t===44?o.ccEDM():t===45?o.ccCR():t===46?o.ccENM():t===47&&o.ccEOC():o.ccTO(t-32),nn(e,t,i),this.currentChannel=r,!0},s.parseMidrow=function(e,t){var i=0;if((e===17||e===25)&&t>=32&&t<=47){if((i=e===17?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var r=this.channels[i];return!!r&&(r.ccMIDROW(t),this.logger.log(3,"MIDROW ("+ka([e,t])+")"),!0)}return!1},s.parsePAC=function(e,t){var i,r=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(e===16||e===24)&&t>=64&&t<=95))return!1;if(jh(e,t,r))return nn(null,null,r),!0;var o=e<=23?1:2;i=t>=64&&t<=95?o===1?ig[e]:ag[e]:o===1?rg[e]:ng[e];var u=this.channels[o];return!!u&&(u.setPAC(this.interpretPAC(i,t)),nn(e,t,r),this.currentChannel=o,!0)},s.interpretPAC=function(e,t){var i,r={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,r.underline=(1&i)==1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((i-16)/2),r},s.parseChars=function(e,t){var i,r,o=null,u=null;if(e>=25?(i=2,u=e-8):(i=1,u=e),u>=17&&u<=19?(r=u===17?t+80:u===18?t+112:t+144,this.logger.log(2,"Special char '"+Wh(r)+"' in channel "+i),o=[r]):e>=32&&e<=127&&(o=t===0?[e]:[e,t]),o){var c=ka(o);this.logger.log(3,"Char codes = "+c.join(",")),nn(e,t,this.cmdHistory)}return o},s.parseBackgroundAttributes=function(e,t){var i;if(!((e===16||e===24)&&t>=32&&t<=47||(e===23||e===31)&&t>=45&&t<=47))return!1;var r={};e===16||e===24?(i=Math.floor((t-32)/2),r.background=sg[i],t%2==1&&(r.background=r.background+"_semi")):t===45?r.background="transparent":(r.foreground="black",t===47&&(r.underline=!0));var o=e<=23?1:2;return this.channels[o].setBkgData(r),nn(e,t,this.cmdHistory),!0},s.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}},s.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var i=this.channels[t];i&&i.cueSplitAtTime(e)}},d}();function nn(d,s,e){e.a=d,e.b=s}function jh(d,s,e){return e.a===d&&e.b===s}var Vo=function(){function d(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}var s=d.prototype;return s.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},s.newCue=function(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},s.reset=function(){this.cueRanges=[],this.startTime=null},d}(),ru=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var d=["","lr","rl"],s=["start","middle","end","left","right"];function e(o,u){if(typeof u!="string"||!Array.isArray(o))return!1;var c=u.toLowerCase();return!!~o.indexOf(c)&&c}function t(o){return e(s,o)}function i(o){for(var u=arguments.length,c=new Array(u>1?u-1:0),f=1;f<u;f++)c[f-1]=arguments[f];for(var h=1;h<arguments.length;h++){var p=arguments[h];for(var y in p)o[y]=p[y]}return o}function r(o,u,c){var f=this,h={enumerable:!0};f.hasBeenReset=!1;var p="",y=!1,b=o,A=u,k=c,D=null,S="",L=!0,N="auto",P="start",V=50,q="middle",j=50,ee="middle";Object.defineProperty(f,"id",i({},h,{get:function(){return p},set:function(z){p=""+z}})),Object.defineProperty(f,"pauseOnExit",i({},h,{get:function(){return y},set:function(z){y=!!z}})),Object.defineProperty(f,"startTime",i({},h,{get:function(){return b},set:function(z){if(typeof z!="number")throw new TypeError("Start time must be set to a number.");b=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",i({},h,{get:function(){return A},set:function(z){if(typeof z!="number")throw new TypeError("End time must be set to a number.");A=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",i({},h,{get:function(){return k},set:function(z){k=""+z,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",i({},h,{get:function(){return D},set:function(z){D=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",i({},h,{get:function(){return S},set:function(z){var X=function(ue){return e(d,ue)}(z);if(X===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",i({},h,{get:function(){return L},set:function(z){L=!!z,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",i({},h,{get:function(){return N},set:function(z){if(typeof z!="number"&&z!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");N=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",i({},h,{get:function(){return P},set:function(z){var X=t(z);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");P=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",i({},h,{get:function(){return V},set:function(z){if(z<0||z>100)throw new Error("Position must be between 0 and 100.");V=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",i({},h,{get:function(){return q},set:function(z){var X=t(z);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");q=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",i({},h,{get:function(){return j},set:function(z){if(z<0||z>100)throw new Error("Size must be between 0 and 100.");j=z,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",i({},h,{get:function(){return ee},set:function(z){var X=t(z);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");ee=X,this.hasBeenReset=!0}})),f.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}(),ug=function(){function d(){}return d.prototype.decode=function(s,e){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},d}();function zh(d){function s(t,i,r,o){return 3600*(0|t)+60*(0|i)+(0|r)+parseFloat(o||0)}var e=d.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return e?parseFloat(e[2])>59?s(e[2],e[3],0,e[4]):s(e[1],e[2],e[3],e[4]):null}var cg=function(){function d(){this.values=Object.create(null)}var s=d.prototype;return s.set=function(e,t){this.get(e)||t===""||(this.values[e]=t)},s.get=function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},s.has=function(e){return e in this.values},s.alt=function(e,t,i){for(var r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}},s.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},s.percent=function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1},d}();function Qh(d,s,e,t){var i=t?d.split(t):[d];for(var r in i)if(typeof i[r]=="string"){var o=i[r].split(e);o.length===2&&s(o[0],o[1])}}var au=new ru(0,0,""),Ko=au.align==="middle"?"middle":"center";function hg(d,s,e){var t=d;function i(){var o=zh(d);if(o===null)throw new Error("Malformed timestamp: "+t);return d=d.replace(/^[^\sa-zA-Z-]+/,""),o}function r(){d=d.replace(/^\s+/,"")}if(r(),s.startTime=i(),r(),d.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+t);d=d.slice(3),r(),s.endTime=i(),r(),function(o,u){var c=new cg;Qh(o,function(p,y){var b;switch(p){case"region":for(var A=e.length-1;A>=0;A--)if(e[A].id===y){c.set(p,e[A].region);break}break;case"vertical":c.alt(p,y,["rl","lr"]);break;case"line":b=y.split(","),c.integer(p,b[0]),c.percent(p,b[0])&&c.set("snapToLines",!1),c.alt(p,b[0],["auto"]),b.length===2&&c.alt("lineAlign",b[1],["start",Ko,"end"]);break;case"position":b=y.split(","),c.percent(p,b[0]),b.length===2&&c.alt("positionAlign",b[1],["start",Ko,"end","line-left","line-right","auto"]);break;case"size":c.percent(p,y);break;case"align":c.alt(p,y,["start",Ko,"end","left","right"])}},/:/,/\s/),u.region=c.get("region",null),u.vertical=c.get("vertical","");var f=c.get("line","auto");f==="auto"&&au.line===-1&&(f=-1),u.line=f,u.lineAlign=c.get("lineAlign","start"),u.snapToLines=c.get("snapToLines",!0),u.size=c.get("size",100),u.align=c.get("align",Ko);var h=c.get("position","auto");h==="auto"&&au.position===50&&(h=u.align==="start"||u.align==="left"?0:u.align==="end"||u.align==="right"?100:50),u.position=h}(d,s)}function Xh(d){return d.replace(/<br(?: \/)?>/gi,`
|
|
35
|
+
`)}var fg=function(){function d(){this.state="INITIAL",this.buffer="",this.decoder=new ug,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var s=d.prototype;return s.parse=function(e){var t=this;function i(){var f=t.buffer,h=0;for(f=Xh(f);h<f.length&&f[h]!=="\r"&&f[h]!==`
|
|
36
36
|
`;)++h;var p=f.slice(0,h);return f[h]==="\r"&&++h,f[h]===`
|
|
37
|
-
`&&++h,t.buffer=f.slice(h),p}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;var
|
|
37
|
+
`&&++h,t.buffer=f.slice(h),p}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;var o=(r=i()).match(/^()?WEBVTT([ \t].*)?$/);if(o==null||!o[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var u=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(u?u=!1:r=i(),t.state){case"HEADER":/:/.test(r)?Qh(r,function(f,h){},/:/):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;if(t.cue=new ru(0,0,""),t.state="CUE",r.indexOf("-->")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{hg(r,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var c=r.indexOf("-->")!==-1;if(!r||c&&(u=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
|
|
38
38
|
`),t.cue.text+=r;continue;case"BADCUE":r||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},s.flush=function(){var e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
|
|
39
39
|
|
|
40
|
-
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this},d}(),
|
|
40
|
+
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this},d}(),mg=/\r\n|\n\r|\n|\r/g,nu=function(d,s,e){return e===void 0&&(e=0),d.slice(e,e+s.length)===s},su=function(d){for(var s=5381,e=d.length;e;)s=33*s^d.charCodeAt(--e);return(s>>>0).toString()};function ou(d,s,e){return su(d.toString())+su(s.toString())+su(e)}function pg(d,s,e,t,i,r,o){var u,c,f,h=new fg,p=Ei(new Uint8Array(d)).trim().replace(mg,`
|
|
41
41
|
`).split(`
|
|
42
|
-
`),
|
|
43
|
-
`)}),h.flush()}var
|
|
44
|
-
`:(r=t.childNodes)!=null&&r.length?Yh(t,s):s?e+t.textContent.trim().replace(/\s+/g," "):e+t.textContent},"")}function au(d,s,e){return d&&d.hasAttributeNS(s,e)?d.getAttributeNS(s,e):null}function $h(d){return new Error("Could not parse ttml timestamp "+d)}function nu(d,s){if(!d)return null;var e=Bh(d);return e===null&&(Vh.test(d)?e=function(t,i){var r=Vh.exec(t),l=(0|r[4])+(0|r[5])/i.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+l/i.frameRate}(d,s):Kh.test(d)&&(e=function(t,i){var r=Kh.exec(t),l=Number(r[1]);switch(r[2]){case"h":return 3600*l;case"m":return 60*l;case"ms":return 1e3*l;case"f":return l/i.frameRate;case"t":return l/i.tickRate}return l}(d,s))),e}var fg=function(){function d(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.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 t=new Fo(this,"textTrack1"),i=new Fo(this,"textTrack2"),r=new Fo(this,"textTrack3"),l=new Fo(this,"textTrack4");this.cea608Parser1=new Fh(1,t,i),this.cea608Parser2=new Fh(3,r,l)}e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(w.FRAG_LOADING,this.onFragLoading,this),e.on(w.FRAG_LOADED,this.onFragLoaded,this),e.on(w.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(w.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(w.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(w.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=d.prototype;return s.destroy=function(){var e=this.hls;e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(w.FRAG_LOADING,this.onFragLoading,this),e.off(w.FRAG_LOADED,this.onFragLoaded,this),e.off(w.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(w.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(w.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(w.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(e,t,i,r,l){for(var u,c,f,h,p=!1,E=l.length;E--;){var b=l[E],A=(u=b[0],c=b[1],f=t,h=i,Math.min(c,h)-Math.max(u,f));if(A>=0&&(b[0]=Math.min(b[0],t),b[1]=Math.max(b[1],i),p=!0,A/(i-t)>.5))return}if(p||l.push([t,i]),this.config.renderTextTracksNatively){var k=this.captionsTracks[e];this.Cues.newCue(k,t,i,r)}else{var D=this.Cues.newCue(null,t,i,r);this.hls.trigger(w.CUES_PARSED,{type:"captions",cues:D,track:e})}},s.onInitPtsFound=function(e,t){var i=this,r=t.frag,l=t.id,u=t.initPTS,c=t.timescale,f=this.unparsedVttFrags;l==="main"&&(this.initPTS[r.cc]={baseTime:u,timescale:c}),f.length&&(this.unparsedVttFrags=[],f.forEach(function(h){i.onFragLoaded(w.FRAG_LOADED,h)}))},s.getExistingTrack=function(e){var t=this.media;if(t)for(var i=0;i<t.textTracks.length;i++){var r=t.textTracks[i];if(r[e])return r}return null},s.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},s.createNativeTrack=function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,i=this.captionsTracks,r=this.media,l=t[e],u=l.label,c=l.languageCode,f=this.getExistingTrack(e);if(f)i[e]=f,Br(i[e]),Wa(i[e],r);else{var h=this.createTextTrack("captions",u,c);h&&(h[e]=!0,i[e]=h)}}},s.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var i={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(w.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}}},s.createTextTrack=function(e,t,i){var r=this.media;if(r)return r.addTextTrack(e,t,i)},s.onMediaAttaching=function(e,t){this.media=t.media,this._cleanTracks()},s.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach(function(t){Br(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}},s.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.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},s._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var i=0;i<t.length;i++)Br(t[i])}},s.onSubtitleTracksUpdated=function(e,t){var i=this,r=t.subtitleTracks||[],l=r.some(function(f){return f.textCodec===iu});if(this.config.enableWebVTT||l&&this.config.enableIMSC1){if(Dh(this.tracks,r))return void(this.tracks=r);if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){var u=this.media?this.media.textTracks:null;this.tracks.forEach(function(f,h){var p;if(u&&h<u.length){for(var E=null,b=0;b<u.length;b++)if(mg(u[b],f)){E=u[b];break}E&&(p=E)}if(p)Br(p);else{var A=i._captionsOrSubtitlesFromCharacteristics(f);(p=i.createTextTrack(A,f.name,f.lang))&&(p.mode="disabled")}p&&(p.groupId=f.groupId,i.textTracks.push(p))})}else if(this.tracks.length){var c=this.tracks.map(function(f){return{label:f.name,kind:f.type.toLowerCase(),default:f.default,subtitleTrack:f}});this.hls.trigger(w.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},s._captionsOrSubtitlesFromCharacteristics=function(e){if(e.attrs.CHARACTERISTICS){var t=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),i=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(t&&i)return"captions"}return"subtitles"},s.onManifestLoaded=function(e,t){var i=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(function(r){var l=/(?:CC|SERVICE)([1-4])/.exec(r.instreamId);if(l){var u="textTrack"+l[1],c=i.captionsProperties[u];c&&(c.label=r.name,r.lang&&(c.languageCode=r.lang),c.media=r)}})},s.closedCaptionsForLevel=function(e){var t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]},s.onFragLoading=function(e,t){var i=this.cea608Parser1,r=this.cea608Parser2,l=this.lastSn,u=this.lastPartIndex;if(this.enabled&&i&&r&&t.frag.type===rt){var c,f,h=t.frag.sn,p=(c=t==null||(f=t.part)==null?void 0:f.index)!=null?c:-1;h===l+1||h===l&&p===u+1||(i.reset(),r.reset()),this.lastSn=h,this.lastPartIndex=p}},s.onFragLoaded=function(e,t){var i=t.frag,r=t.payload,l=this.initPTS,u=this.unparsedVttFrags;if(i.type===Ii)if(r.byteLength){if(!l[i.cc])return u.push(t),void(l.length&&this.hls.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Missing initial subtitle PTS")}));var c=i.decryptdata,f="stats"in t;if(c==null||!c.encrypted||f){var h=this.tracks[i.level],p=this.vttCCs;p[i.cc]||(p[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),h&&h.textCodec===iu?this._parseIMSC1(i,r):this._parseVTTs(i,r,p)}}else this.hls.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(e,t){var i=this,r=this.hls;Wh(t,this.initPTS[e.cc],function(l){i._appendCues(l,e.level),r.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(l){H.log("Failed to parse IMSC1: "+l),r.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:l})})},s._parseVTTs=function(e,t,i){var r,l=this,u=this.hls;cg((r=e.initSegment)!=null&&r.data?er(e.initSegment.data,new Uint8Array(t)):t,this.initPTS[e.cc],i,e.cc,e.start,function(c){l._appendCues(c,e.level),u.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(c){l._fallbackToIMSC1(e,t),H.log("Failed to parse VTT cue: "+c),u.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:c})})},s._fallbackToIMSC1=function(e,t){var i=this,r=this.tracks[e.level];r.textCodec||Wh(t,this.initPTS[e.cc],function(){r.textCodec=iu,i._parseIMSC1(e,t)},function(){r.textCodec="wvtt"})},s._appendCues=function(e,t){var i=this.hls;if(this.config.renderTextTracksNatively){var r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(function(c){return ko(r,c)})}else{var l=this.tracks[t];if(!l)return;var u=l.default?"default":"subtitles"+t;i.trigger(w.CUES_PARSED,{type:"subtitles",cues:e,track:u})}},s.onFragDecrypted=function(e,t){var i=t.frag;if(i.type===Ii){if(!this.initPTS[i.cc])return void this.unparsedVttFrags.push(t);this.onFragLoaded(w.FRAG_LOADED,t)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,r=this.cea608Parser2;if(this.enabled&&i&&r){var l=t.frag,u=t.samples;if(l.type!==rt||this.closedCaptionsForLevel(l)!=="NONE")for(var c=0;c<u.length;c++){var f=u[c].bytes;if(f){var h=this.extractCea608Data(f);i.addData(u[c].pts,h[0]),r.addData(u[c].pts,h[1])}}}},s.onBufferFlushing=function(e,t){var i=t.startOffset,r=t.endOffset,l=t.endOffsetSubtitles,u=t.type,c=this.media;if(c&&!(c.currentTime<r)){if(!u||u==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(p){return Tt(f[p],i,r)})}if(this.config.renderTextTracksNatively&&i===0&&l!==void 0){var h=this.textTracks;Object.keys(h).forEach(function(p){return Tt(h[p],i,l)})}}},s.extractCea608Data=function(e){for(var t=[[],[]],i=31&e[0],r=2,l=0;l<i;l++){var u=e[r++],c=127&e[r++],f=127&e[r++];if((c!==0||f!==0)&&(4&u)!=0){var h=3&u;h!==0&&h!==1||(t[h].push(c),t[h].push(f))}}return t},d}();function mg(d,s){return!!d&&d.label===s.name&&!(d.textTrack1||d.textTrack2)}var pg=function(){function d(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var s=d.prototype;return s.setStreamController=function(e){this.streamController=e},s.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},s.registerListeners=function(){var e=this.hls;e.on(w.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.BUFFER_CODECS,this.onBufferCodecs,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this)},s.unregisterListener=function(){var e=this.hls;e.off(w.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.BUFFER_CODECS,this.onBufferCodecs,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this)},s.onFpsDropLevelCapping=function(e,t){var i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})},s.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null},s.onManifestParsed=function(e,t){var i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onBufferCodecs=function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onMediaDetaching=function(){this.stopCapping()},s.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var e=this.hls.levels;if(e.length){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},s.getMaxLevel=function(e){var t=this,i=this.hls.levels;if(!i.length)return-1;var r=i.filter(function(l,u){return t.isLevelAllowed(l)&&u<=e});return this.clientRect=null,d.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)},s.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())},s.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},s.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t},s.isLevelAllowed=function(e){return!this.restrictedLevels.some(function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height})},d.getMaxLevelByMediaSize=function(e,t,i){if(e==null||!e.length)return-1;for(var r,l,u=e.length-1,c=0;c<e.length;c+=1){var f=e[c];if((f.width>=t||f.height>=i)&&(r=f,!(l=e[c+1])||r.width!==l.width||r.height!==l.height)){u=c;break}}return u},M(d,[{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 e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}}]),d}(),vg=function(){function d(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 s=d.prototype;return s.setStreamController=function(e){this.streamController=e},s.registerListeners=function(){this.hls.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this)},s.unregisterListeners=function(){this.hls.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this)},s.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},s.onMediaAttaching=function(e,t){var i=this.hls.config;if(i.capLevelOnFPSDrop){var r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}},s.checkFPS=function(e,t,i){var r=performance.now();if(t){if(this.lastTime){var l=r-this.lastTime,u=i-this.lastDroppedFrames,c=t-this.lastDecodedFrames,f=1e3*u/l,h=this.hls;if(h.trigger(w.FPS_DROP,{currentDropped:u,currentDecoded:c,totalDroppedFrames:i}),f>0&&u>h.config.fpsDroppedMonitoringThreshold*c){var p=h.currentLevel;H.warn("drop FPS ratio greater than max allowed value for currentLevel: "+p),p>0&&(h.autoLevelCapping===-1||h.autoLevelCapping>=p)&&(p-=1,h.trigger(w.FPS_DROP_LEVEL_CAPPING,{level:p,droppedLevel:h.currentLevel}),h.autoLevelCapping=p,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}},s.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},d}(),Bo="[eme]",jh=function(){function d(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=d.CDMCleanupPromise?[d.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=H.debug.bind(H,Bo),this.log=H.log.bind(H,Bo),this.warn=H.warn.bind(H,Bo),this.error=H.error.bind(H,Bo),this.hls=e,this.config=e.config,this.registerListeners()}var s=d.prototype;return s.destroy=function(){this.unregisterListeners(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null},s.registerListeners=function(){this.hls.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(w.MANIFEST_LOADED,this.onManifestLoaded,this)},s.unregisterListeners=function(){this.hls.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(w.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(w.MANIFEST_LOADED,this.onManifestLoaded,this)},s.getLicenseServerUrl=function(e){var t=this.config,i=t.drmSystems,r=t.widevineLicenseUrl,l=i[e];if(l)return l.licenseUrl;if(e===$e.WIDEVINE&&r)return r;throw new Error('no license server URL configured for key-system "'+e+'"')},s.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},s.attemptKeySystemAccess=function(e){var t=this,i=this.hls.levels,r=function(c,f,h){return!!c&&h.indexOf(c)===f},l=i.map(function(c){return c.audioCodec}).filter(r),u=i.map(function(c){return c.videoCodec}).filter(r);return l.length+u.length===0&&u.push("avc1.42e01e"),new Promise(function(c,f){(function h(p){var E=p.shift();t.getMediaKeysPromise(E,l,u).then(function(b){return c({keySystem:E,mediaKeys:b})}).catch(function(b){p.length?h(p):f(b instanceof Mi?b:new Mi({type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_NO_ACCESS,error:b,fatal:!0},b.message))})})(e)})},s.requestMediaKeySystemAccess=function(e,t){var i=this.config.requestMediaKeySystemAccessFunc;if(typeof i!="function"){var r="Configured requestMediaKeySystemAccess is not a function "+i;return Ji===null&&self.location.protocol==="http:"&&(r="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(r))}return i(e,t)},s.getMediaKeysPromise=function(e,t,i){var r=this,l=function(h,p,E,b){var A;switch(h){case $e.FAIRPLAY:A=["cenc","sinf"];break;case $e.WIDEVINE:case $e.PLAYREADY:A=["cenc"];break;case $e.CLEARKEY:A=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+h)}return function(k,D,S,I){return[{initDataTypes:k,persistentState:I.persistentState||"not-allowed",distinctiveIdentifier:I.distinctiveIdentifier||"not-allowed",sessionTypes:I.sessionTypes||[I.sessionType||"temporary"],audioCapabilities:D.map(function(F){return{contentType:'audio/mp4; codecs="'+F+'"',robustness:I.audioRobustness||"",encryptionScheme:I.audioEncryptionScheme||null}}),videoCapabilities:S.map(function(F){return{contentType:'video/mp4; codecs="'+F+'"',robustness:I.videoRobustness||"",encryptionScheme:I.videoEncryptionScheme||null}})}]}(A,p,E,b)}(e,t,i,this.config.drmSystemOptions),u=this.keySystemAccessPromises[e],c=u==null?void 0:u.keySystemAccess;if(!c){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(l)),c=this.requestMediaKeySystemAccess(e,l);var f=this.keySystemAccessPromises[e]={keySystemAccess:c};return c.catch(function(h){r.log('Failed to obtain access to key-system "'+e+'": '+h)}),c.then(function(h){r.log('Access for key-system "'+h.keySystem+'" obtained');var p=r.fetchServerCertificate(e);return r.log('Create media-keys for "'+e+'"'),f.mediaKeys=h.createMediaKeys().then(function(E){return r.log('Media-keys created for "'+e+'"'),p.then(function(b){return b?r.setMediaKeysServerCertificate(E,e,b):E})}),f.mediaKeys.catch(function(E){r.error('Failed to create media-keys for "'+e+'"}: '+E)}),f.mediaKeys})}return c.then(function(){return u.mediaKeys})},s.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem,r=e.mediaKeys;this.log('Creating key-system session "'+i+'" keyId: '+yi(t.keyId||[]));var l=r.createSession(),u={decryptdata:t,keySystem:i,mediaKeys:r,mediaKeysSession:l,keyStatus:"status-pending"};return this.mediaKeySessions.push(u),u},s.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t);this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,"cenc",t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},s.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 yi(e.keyId)},s.updateKeySession=function(e,t){var i,r=e.mediaKeysSession;return this.log('Updating key-session "'+r.sessionId+'" for keyID '+yi(((i=e.decryptdata)==null?void 0:i.keyId)||[])+`
|
|
45
|
-
} (data length: `+(t&&t.byteLength)+")"),r.update(t)},s.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},s.getKeyFormatPromise=function(e){var t=this;return new Promise(function(i,r){var l=dt(t.config),u=e.map(pr).filter(function(c){return!!c&&l.indexOf(c)!==-1});return t.getKeySystemSelectionPromise(u).then(function(c){var f=c.keySystem,h=oi(f);h?i(h):r(new Error('Unable to find format for key-system "'+f+'"'))}).catch(r)})},s.loadKey=function(e){var t=this,i=e.keyInfo.decryptdata,r=this.getKeyIdString(i),l="(keyId: "+r+' format: "'+i.keyFormat+'" method: '+i.method+" uri: "+i.uri+")";this.log("Starting session for key "+l);var u=this.keyIdToKeySessionPromise[r];return u||(u=this.keyIdToKeySessionPromise[r]=this.getKeySystemForKeyPromise(i).then(function(c){var f=c.keySystem,h=c.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+l),t.attemptSetMediaKeys(f,h).then(function(){t.throwIfDestroyed();var p=t.createMediaKeySessionContext({keySystem:f,mediaKeys:h,decryptdata:i});return t.generateRequestWithPreferredKeySession(p,"cenc",i.pssh,"playlist-key")})})).catch(function(c){return t.handleError(c)}),u},s.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},s.handleError=function(e){this.hls&&(this.error(e.message),e instanceof Mi?this.hls.trigger(w.ERROR,e.data):this.hls.trigger(w.ERROR,{type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},s.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){var r=pr(e.keyFormat),l=r?[r]:dt(this.config);return this.attemptKeySystemAccess(l)}return i},s.getKeySystemSelectionPromise=function(e){if(e.length||(e=dt(this.config)),e.length===0)throw new Mi({type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},s._onMediaEncrypted=function(e){var t=this,i=e.initDataType,r=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+i+'"'),r!==null){var l,u;if(i==="sinf"&&this.config.drmSystems[$e.FAIRPLAY]){var c=xt(new Uint8Array(r));try{var f=tt(JSON.parse(c).sinf),h=Gn(new Uint8Array(f));if(!h)return;l=h.subarray(8,24),u=$e.FAIRPLAY}catch{return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var p=function(F){if(!(F instanceof ArrayBuffer)||F.byteLength<32)return null;var N={version:0,systemId:"",kids:null,data:null},V=new DataView(F),Y=V.getUint32(0);if(F.byteLength!==Y&&Y>44||V.getUint32(4)!==1886614376||(N.version=V.getUint32(8)>>>24,N.version>1))return null;N.systemId=yi(new Uint8Array(F,12,16));var j=V.getUint32(28);if(N.version===0){if(Y-32<j)return null;N.data=new Uint8Array(F,32,j)}else if(N.version===1){N.kids=[];for(var J=0;J<j;J++)N.kids.push(new Uint8Array(F,32+16*J,16))}return N}(r);if(p===null)return;p.version===0&&p.systemId===Or&&p.data&&(l=p.data.subarray(8,24)),u=function(F){if(F===Or)return $e.WIDEVINE}(p.systemId)}if(u&&l){for(var E=yi(l),b=this.keyIdToKeySessionPromise,A=this.mediaKeySessions,k=b[E],D=function(){var F=A[S],N=F.decryptdata;if(N.pssh||!N.keyId)return"continue";var V=yi(N.keyId);return E===V||N.uri.replace(/-/g,"").indexOf(E)!==-1?(k=b[V],delete b[V],N.pssh=new Uint8Array(r),N.keyId=l,k=b[E]=k.then(function(){return t.generateRequestWithPreferredKeySession(F,i,r,"encrypted-event-key-match")}),"break"):void 0},S=0;S<A.length;S++){var I=D();if(I!=="continue"&&I==="break")break}k||(k=b[E]=this.getKeySystemSelectionPromise([u]).then(function(F){var N,V=F.keySystem,Y=F.mediaKeys;t.throwIfDestroyed();var j=new Ba("ISO-23001-7",E,(N=oi(V))!=null?N:"");return j.pssh=new Uint8Array(r),j.keyId=l,t.attemptSetMediaKeys(V,Y).then(function(){t.throwIfDestroyed();var J=t.createMediaKeySessionContext({decryptdata:j,keySystem:V,mediaKeys:Y});return t.generateRequestWithPreferredKeySession(J,i,r,"encrypted-event-no-match")})})),k.catch(function(F){return t.handleError(F)})}}},s._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},s.attemptSetMediaKeys=function(e,t){var i=this,r=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var l=Promise.all(r).then(function(){if(!i.media)throw new Error("Attempted to set mediaKeys without media element attached");return i.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(l),l.then(function(){i.log('Media-keys set for "'+e+'"'),r.push(l),i.setMediaKeysQueue=i.setMediaKeysQueue.filter(function(u){return r.indexOf(u)===-1})})},s.generateRequestWithPreferredKeySession=function(e,t,i,r){var l,u,c=this,f=(l=this.config.drmSystems)==null||(u=l[e.keySystem])==null?void 0:u.generateRequest;if(f)try{var h=f.call(this.hls,t,i,e);if(!h)throw new Error("Invalid response from configured generateRequest filter");t=h.initDataType,i=e.decryptdata.pssh=h.initData?new Uint8Array(h.initData):null}catch(k){var p;if(this.warn(k.message),(p=this.hls)!=null&&p.config.debug)throw k}if(i===null)return this.log('Skipping key-session request for "'+r+'" (no initData)'),Promise.resolve(e);var E=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+r+'": '+E+" (init data type: "+t+" length: "+(i?i.byteLength:null)+")");var b=new No;e.mediaKeysSession.onmessage=function(k){var D=e.mediaKeysSession;if(D){var S=k.messageType,I=k.message;c.log('"'+S+'" message event for session "'+D.sessionId+'" message size: '+I.byteLength),S==="license-request"||S==="license-renewal"?c.renewLicense(e,I).catch(function(F){c.handleError(F),b.emit("error",F)}):S==="license-release"?e.keySystem===$e.FAIRPLAY&&(c.updateKeySession(e,Lt("acknowledged")),c.removeSession(e)):c.warn('unhandled media key message type "'+S+'"')}else b.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(k){if(e.mediaKeysSession){c.onKeyStatusChange(e);var D=e.keyStatus;b.emit("keyStatus",D),D==="expired"&&(c.warn(e.keySystem+" expired for key "+E),c.renewKeySession(e))}else b.emit("error",new Error("invalid state"))};var A=new Promise(function(k,D){b.on("error",D),b.on("keyStatus",function(S){S.startsWith("usable")?k():S==="output-restricted"?D(new Mi({type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):S==="internal-error"?D(new Mi({type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+S+'"')):S==="expired"?D(new Error("key expired while generating request")):c.warn('unhandled key status change "'+S+'"')})});return e.mediaKeysSession.generateRequest(t,i).then(function(){var k;c.log('Request generated for key-session "'+((k=e.mediaKeysSession)==null?void 0:k.sessionId)+'" keyId: '+E)}).catch(function(k){throw new Mi({type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_NO_SESSION,error:k,fatal:!1},"Error generating key-session request: "+k)}).then(function(){return A}).catch(function(k){throw b.removeAllListeners(),c.removeSession(e),k}).then(function(){return b.removeAllListeners(),e})},s.onKeyStatusChange=function(e){var t=this;e.mediaKeysSession.keyStatuses.forEach(function(i,r){t.log('key status change "'+i+'" for keyStatuses keyId: '+yi("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))+" session keyId: "+yi(new Uint8Array(e.decryptdata.keyId||[]))+" uri: "+e.decryptdata.uri),e.keyStatus=i})},s.fetchServerCertificate=function(e){var t=this.config,i=new t.loader(t),r=this.getServerCertificateUrl(e);return r?(this.log('Fetching serverCertificate for "'+e+'"'),new Promise(function(l,u){var c={responseType:"arraybuffer",url:r},f=t.certLoadPolicy.default,h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},p={onSuccess:function(E,b,A,k){l(E.data)},onError:function(E,b,A,k){u(new Mi({type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:A,response:g({url:c.url,data:void 0},E)},'"'+e+'" certificate request failed ('+r+"). Status: "+E.code+" ("+E.text+")"))},onTimeout:function(E,b,A){u(new Mi({type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:A,response:{url:c.url,data:void 0}},'"'+e+'" certificate request timed out ('+r+")"))},onAbort:function(E,b,A){u(new Error("aborted"))}};i.load(c,h,p)})):Promise.resolve()},s.setMediaKeysServerCertificate=function(e,t,i){var r=this;return new Promise(function(l,u){e.setServerCertificate(i).then(function(c){r.log("setServerCertificate "+(c?"success":"not supported by CDM")+" ("+(i==null?void 0:i.byteLength)+') on "'+t+'"'),l(e)}).catch(function(c){u(new Mi({type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:c,fatal:!0},c.message))})})},s.renewLicense=function(e,t){var i=this;return this.requestLicense(e,new Uint8Array(t)).then(function(r){return i.updateKeySession(e,new Uint8Array(r)).catch(function(l){throw new Mi({type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:l,fatal:!0},l.message)})})},s.setupLicenseXHR=function(e,t,i,r){var l=this,u=this.config.licenseXhrSetup;return u?Promise.resolve().then(function(){if(!i.decryptdata)throw new Error("Key removed");return u.call(l.hls,e,t,i,r)}).catch(function(c){if(!i.decryptdata)throw c;return e.open("POST",t,!0),u.call(l.hls,e,t,i,r)}).then(function(c){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:c||r}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))},s.requestLicense=function(e,t){var i=this,r=this.config.keyLoadPolicy.default;return new Promise(function(l,u){var c=i.getLicenseServerUrl(e.keySystem);i.log("Sending license request to URL: "+c);var f=new XMLHttpRequest;f.responseType="arraybuffer",f.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return u(new Error("invalid state"));if(f.readyState===4)if(f.status===200){i._requestLicenseFailureCount=0;var h=f.response;i.log("License received "+(h instanceof ArrayBuffer?h.byteLength:h));var p=i.config.licenseResponseCallback;if(p)try{h=p.call(i.hls,f,c,e)}catch(k){i.error(k)}l(h)}else{var E=r.errorRetry,b=E?E.maxNumRetry:0;if(i._requestLicenseFailureCount++,i._requestLicenseFailureCount>b||f.status>=400&&f.status<500)u(new Mi({type:oe.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:{url:c,data:void 0,code:f.status,text:f.statusText}},"License Request XHR failed ("+c+"). Status: "+f.status+" ("+f.statusText+")"));else{var A=b-i._requestLicenseFailureCount+1;i.warn("Retrying license request, "+A+" attempts left"),i.requestLicense(e,t).then(l,u)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=f,i.setupLicenseXHR(f,c,e,t).then(function(h){var p=h.xhr,E=h.licenseChallenge;p.send(E)})})},s.onMediaAttached=function(e,t){if(this.config.emeEnabled){var i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}},s.onMediaDetached=function(){var e=this,t=this.media,i=this.mediaKeySessions;t&&(t.removeEventListener("encrypted",this.onMediaEncrypted),t.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ba.clearKeyUriToKeyIdMap();var r=i.length;d.CDMCleanupPromise=Promise.all(i.map(function(l){return e.removeSession(l)}).concat(t==null?void 0:t.setMediaKeys(null).catch(function(l){e.log("Could not clear media keys: "+l+". media.src: "+(t==null?void 0:t.src))}))).then(function(){r&&(e.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(function(l){e.log("Could not close sessions and clear media keys: "+l+". media.src: "+(t==null?void 0:t.src))})},s.onManifestLoaded=function(e,t){var i=t.sessionKeys;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){var r=i.reduce(function(l,u){return l.indexOf(u.keyFormat)===-1&&l.push(u.keyFormat),l},[]);this.log("Selecting key-system from session-keys "+r.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(r)}},s.removeSession=function(e){var t=this,i=e.mediaKeysSession,r=e.licenseXhr;if(i){this.log("Remove licenses and keys and close session "+i.sessionId),i.onmessage=null,i.onkeystatuseschange=null,r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var l=this.mediaKeySessions.indexOf(e);return l>-1&&this.mediaKeySessions.splice(l,1),i.remove().catch(function(u){t.log("Could not remove session: "+u)}).then(function(){return i.close()}).catch(function(u){t.log("Could not close session: "+u)})}},d}();jh.CDMCleanupPromise=void 0;var Mi=function(d){function s(e,t){var i;return(i=d.call(this,t)||this).data=void 0,e.error||(e.error=new Error(t)),i.data=e,e.err=e.error,i}return z(s,d),s}(_e(Error)),gg="m",Ho="a",su="v",ou="av",zh="i",yg="tt",Eg=function(){function d(e){var t=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(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(l){try{t.apply(l,{ot:gg,su:!t.initialized})}catch(u){H.warn("Could not generate manifest CMCD data.",u)}},this.applyFragmentData=function(l){try{var u=l.frag,c=t.hls.levels[u.level],f=t.getObjectType(u),h={d:1e3*u.duration,ot:f};f!==su&&f!==Ho&&f!=ou||(h.br=c.bitrate/1e3,h.tb=t.getTopBandwidth(f)/1e3,h.bl=t.getBufferLength(f)),t.apply(l,h)}catch(p){H.warn("Could not generate segment CMCD data.",p)}},this.hls=e;var i=this.config=e.config,r=i.cmcd;r!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||d.uuid(),this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.registerListeners())}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(w.MEDIA_DETACHED,this.onMediaDetached,this),e.on(w.BUFFER_CREATED,this.onBufferCreated,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(w.MEDIA_DETACHED,this.onMediaDetached,this),e.off(w.BUFFER_CREATED,this.onBufferCreated,this)},s.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},s.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},s.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},s.onBufferCreated=function(e,t){var i,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer},s.createData=function(){var e;return{v:1,sf:"h",sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},s.apply=function(e,t){t===void 0&&(t={}),U(t,this.createData());var i=t.ot===zh||t.ot===su||t.ot===ou;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var r=d.toHeaders(t);if(!Object.keys(r).length)return;e.headers||(e.headers={}),U(e.headers,r)}else{var l=d.toQuery(t);if(!l)return;e.url=d.appendQueryToUri(e.url,l)}},s.getObjectType=function(e){var t=e.type;return t==="subtitle"?yg:e.sn==="initSegment"?zh:t==="audio"?Ho:t==="main"?this.hls.audioTracks.length?su:ou:void 0},s.getTopBandwidth=function(e){var t,i=0,r=this.hls;if(e===Ho)t=r.audioTracks;else{var l=r.maxAutoLevel,u=l>-1?l+1:r.levels.length;t=r.levels.slice(0,u)}for(var c,f=Se(t);!(c=f()).done;){var h=c.value;h.bitrate>i&&(i=h.bitrate)}return i>0?i:NaN},s.getBufferLength=function(e){var t=this.hls.media,i=e===Ho?this.audioBuffer:this.videoBuffer;return i&&t?1e3*ke.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN},s.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function r(u){this.loader=void 0,this.loader=new i(u)}var l=r.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(u,c,f){t(u),this.loader.load(u,c,f)},M(r,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),r}()},s.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function r(u){this.loader=void 0,this.loader=new i(u)}var l=r.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(u,c,f){t(u),this.loader.load(u,c,f)},M(r,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),r}()},d.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)},d.serialize=function(e){for(var t,i=[],r=function(k){return!Number.isNaN(k)&&k!=null&&k!==""&&k!==!1},l=function(k){return Math.round(k)},u=function(k){return 100*l(k/100)},c={br:l,d:l,bl:u,dl:u,mtp:u,nor:function(k){return encodeURIComponent(k)},rtp:u,tb:l},f=Se(Object.keys(e||{}).sort());!(t=f()).done;){var h=t.value,p=e[h];if(r(p)&&!(h==="v"&&p===1||h=="pr"&&p===1)){var E=c[h];E&&(p=E(p));var b=typeof p,A=void 0;A=h==="ot"||h==="sf"||h==="st"?h+"="+p:b==="boolean"?h:b==="number"?h+"="+p:h+"="+JSON.stringify(p),i.push(A)}}return i.join(",")},d.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],r=[{},{},{},{}],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},u=0,c=Object.keys(e);u<c.length;u++){var f=c[u];r[l[f]!=null?l[f]:1][f]=e[f]}for(var h=0;h<r.length;h++){var p=d.serialize(r[h]);p&&(t["CMCD-"+i[h]]=p)}return t},d.toQuery=function(e){return"CMCD="+encodeURIComponent(d.serialize(e))},d.appendQueryToUri=function(e,t){if(!t)return e;var i=e.includes("?")?"&":"?";return""+e+i+t},d}(),bg=function(){function d(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=H.log.bind(H,"[content-steering]:"),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.ERROR,this.onError,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.ERROR,this.onError,this))},s.startLoad=function(){if(this.started=!0,self.clearTimeout(this.reloadTimer),this.enabled&&this.uri)if(this.updated){var e=Math.max(1e3*this.timeToLoad-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,e)}else this.loadSteeringManifest(this.uri)},s.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),self.clearTimeout(this.reloadTimer)},s.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},s.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter(function(i){return i!==e}))},s.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},s.onManifestLoaded=function(e,t){var i=t.contentSteering;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())},s.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},s.onError=function(e,t){var i=t.errorAction;if((i==null?void 0:i.action)===It&&i.flags===Xa){var r=this.pathwayPriority,l=this.pathwayId;this.penalizedPathways[l]||(this.penalizedPathways[l]=performance.now()),!r&&this.levels&&(r=this.levels.reduce(function(u,c){return u.indexOf(c.pathwayId)===-1&&u.push(c.pathwayId),u},[])),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==l)}},s.filterParsedLevels=function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){var i=e[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+i+'"'),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log("Found "+t.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),t):e},s.getLevelsForPathway=function(e){return this.levels===null?[]:this.levels.filter(function(t){return e===t.pathwayId})},s.updatePathwayPriority=function(e){var t;this.pathwayPriority=e;var i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(function(p){r-i[p]>3e5&&delete i[p]});for(var l=0;l<e.length;l++){var u=e[l];if(!i[u]){if(u===this.pathwayId)return;var c=this.hls.nextLoadLevel,f=this.hls.levels[c];if((t=this.getLevelsForPathway(u)).length>0){this.log('Setting Pathway to "'+u+'"'),this.pathwayId=u,this.hls.trigger(w.LEVELS_UPDATED,{levels:t});var h=this.hls.levels[c];f&&h&&this.levels&&(h.attrs["STABLE-VARIANT-ID"]!==f.attrs["STABLE-VARIANT-ID"]&&h.bitrate!==f.bitrate&&this.log("Unstable Pathways change from bitrate "+f.bitrate+" to "+h.bitrate),this.hls.nextLoadLevel=c);break}}}},s.clonePathways=function(e){var t=this,i=this.levels;if(i){var r={},l={};e.forEach(function(u){var c=u.ID,f=u["BASE-ID"],h=u["URI-REPLACEMENT"];if(!i.some(function(E){return E.pathwayId===c})){var p=t.getLevelsForPathway(f).map(function(E){var b=U({},E);b.details=void 0,b.url=Xh(E.uri,E.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",h);var A=new Je(E.attrs);A["PATHWAY-ID"]=c;var k=A.AUDIO&&A.AUDIO+"_clone_"+c,D=A.SUBTITLES&&A.SUBTITLES+"_clone_"+c;k&&(r[A.AUDIO]=k,A.AUDIO=k),D&&(l[A.SUBTITLES]=D,A.SUBTITLES=D),b.attrs=A;var S=new la(b);return C(S,"audio",k),C(S,"text",D),S});i.push.apply(i,p),Qh(t.audioTracks,r,h,c),Qh(t.subtitleTracks,l,h,c)}})}},s.loadSteeringManifest=function(e){var t,i=this,r=this.hls.config,l=r.loader;this.loader&&this.loader.destroy(),this.loader=new l(r);try{t=new self.URL(e)}catch{return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: "+e)}if(t.protocol!=="data:"){var u=0|(this.hls.bandwidthEstimate||r.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+u)}var c={responseType:"json",url:t.href},f=r.steeringManifestLoadPolicy.default,h=f.errorRetry||f.timeoutRetry||{},p={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:h.maxNumRetry||0,retryDelay:h.retryDelayMs||0,maxRetryDelay:h.maxRetryDelayMs||0},E={onSuccess:function(b,A,k,D){i.log('Loaded steering manifest: "'+t+'"');var S=b.data;if(S.VERSION===1){i.updated=performance.now(),i.timeToLoad=S.TTL;var I=S["RELOAD-URI"],F=S["PATHWAY-CLONES"],N=S["PATHWAY-PRIORITY"];if(I)try{i.uri=new self.URL(I,t).href}catch{return i.enabled=!1,void i.log("Failed to parse Steering Manifest RELOAD-URI: "+I)}i.scheduleRefresh(i.uri||k.url),F&&i.clonePathways(F),N&&i.updatePathwayPriority(N)}else i.log("Steering VERSION "+S.VERSION+" not supported!")},onError:function(b,A,k,D){if(i.log("Error loading steering manifest: "+b.code+" "+b.text+" ("+A.url+")"),i.stopLoad(),b.code===410)return i.enabled=!1,void i.log("Steering manifest "+A.url+" no longer available");var S=1e3*i.timeToLoad;if(b.code!==429)i.scheduleRefresh(i.uri||A.url,S);else{var I=i.loader;if(typeof(I==null?void 0:I.getResponseHeader)=="function"){var F=I.getResponseHeader("Retry-After");F&&(S=1e3*parseFloat(F))}i.log("Steering manifest "+A.url+" rate limited")}},onTimeout:function(b,A,k){i.log("Timeout loading steering manifest ("+A.url+")"),i.scheduleRefresh(i.uri||A.url)}};this.log("Requesting steering manifest: "+t),this.loader.load(c,p,E)},s.scheduleRefresh=function(e,t){var i=this;t===void 0&&(t=1e3*this.timeToLoad),self.clearTimeout(this.reloadTimer),this.reloadTimer=self.setTimeout(function(){i.loadSteeringManifest(e)},t)},d}();function Qh(d,s,e,t){d&&Object.keys(s).forEach(function(i){var r=d.filter(function(l){return l.groupId===i}).map(function(l){var u=U({},l);return u.details=void 0,u.attrs=new Je(u.attrs),u.url=u.attrs.URI=Xh(l.url,l.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",e),u.groupId=u.attrs["GROUP-ID"]=s[i],u.attrs["PATHWAY-ID"]=t,u});d.push.apply(d,r)})}function Xh(d,s,e,t){var i,r=t.HOST,l=t.PARAMS,u=t[e];s&&(i=u==null?void 0:u[s])&&(d=i);var c=new self.URL(d);return r&&!i&&(c.host=r),l&&Object.keys(l).sort().forEach(function(f){f&&c.searchParams.set(f,l[f])}),c.href}var _g=/^age:\s*[\d.]+\s*$/im,Zh=function(){function d(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 Mt,this.retryDelay=0}var s=d.prototype;return s.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},s.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()))},s.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},s.load=function(e,t,i){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=t,this.callbacks=i,this.loadInternal()},s.loadInternal=function(){var e=this,t=this.config,i=this.context;if(t){var r=this.loader=new self.XMLHttpRequest,l=this.stats;l.loading.first=0,l.loaded=0;var u=this.xhrSetup;u?Promise.resolve().then(function(){if(!e.stats.aborted)return u(r,i.url)}).catch(function(c){return r.open("GET",i.url,!0),u(r,i.url)}).then(function(){e.stats.aborted||e.openAndSendXhr(r,i,t)}).catch(function(c){e.callbacks.onError({code:r.status,text:c.message},i,r,l)}):this.openAndSendXhr(r,i,t)}},s.openAndSendXhr=function(e,t,i){e.readyState||e.open("GET",t.url,!0);var r=this.context.headers,l=i.loadPolicy,u=l.maxTimeToFirstByteMs,c=l.maxLoadTimeMs;if(r)for(var f in r)e.setRequestHeader(f,r[f]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=u&&le(u)?u:c,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()},s.readystatechange=function(){var e=this.context,t=this.loader,i=this.stats;if(e&&t){var r=t.readyState,l=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),l.timeout!==l.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),l.timeout=l.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),l.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var u=t.status,c=t.responseType!=="text";if(u>=200&&u<300&&(c&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);var f=c?t.response:t.responseText,h=t.responseType==="arraybuffer"?f.byteLength:f.length;if(i.loaded=i.total=h,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;var p=this.callbacks.onProgress;if(p&&p(i,e,f,t),!this.callbacks)return;var E={url:t.responseURL,data:f,code:u};this.callbacks.onSuccess(E,i,e,t)}else{var b=l.loadPolicy.errorRetry;za(b,i.retry,!1,u)?this.retry(b):(H.error(u+" while loading "+e.url),this.callbacks.onError({code:u,text:t.statusText},e,t,i))}}}},s.loadtimeout=function(){var e,t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry;if(za(t,this.stats.retry,!0))this.retry(t);else{H.warn("timeout while loading "+this.context.url);var i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}},s.retry=function(e){var t=this.context,i=this.stats;this.retryDelay=Zn(e,i.retry),i.retry++,H.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+t.url+", retrying "+i.retry+"/"+e.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},s.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},s.getCacheAge=function(){var e=null;if(this.loader&&_g.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},s.getResponseHeader=function(e){return this.loader&&new RegExp("^"+e+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null},d}(),Tg=/(\d+)-(\d+)\/(\d+)/,Jh=function(){function d(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||Ag,this.controller=new self.AbortController,this.stats=new Mt}var s=d.prototype;return s.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},s.abortInternal=function(){var e=this.response;e!=null&&e.ok||(this.stats.aborted=!0,this.controller.abort())},s.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},s.load=function(e,t,i){var r=this,l=this.stats;if(l.loading.start)throw new Error("Loader can only be used once.");l.loading.start=self.performance.now();var u=function(A,k){var D={method:"GET",mode:"cors",credentials:"same-origin",signal:k,headers:new self.Headers(U({},A.headers))};return A.rangeEnd&&D.headers.set("Range","bytes="+A.rangeStart+"-"+String(A.rangeEnd-1)),D}(e,this.controller.signal),c=i.onProgress,f=e.responseType==="arraybuffer",h=f?"byteLength":"length",p=t.loadPolicy,E=p.maxTimeToFirstByteMs,b=p.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,u),self.clearTimeout(this.requestTimeout),t.timeout=E&&le(E)?E:b,this.requestTimeout=self.setTimeout(function(){r.abortInternal(),i.onTimeout(l,e,r.response)},t.timeout),self.fetch(this.request).then(function(A){r.response=r.loader=A;var k=Math.max(self.performance.now(),l.loading.start);if(self.clearTimeout(r.requestTimeout),t.timeout=b,r.requestTimeout=self.setTimeout(function(){r.abortInternal(),i.onTimeout(l,e,r.response)},b-(k-l.loading.start)),!A.ok){var D=A.status,S=A.statusText;throw new Sg(S||"fetch, bad network response",D,A)}return l.loading.first=k,l.total=function(I){var F=I.get("Content-Range");if(F){var N=function(Y){var j=Tg.exec(Y);if(j)return parseInt(j[2])-parseInt(j[1])+1}(F);if(le(N))return N}var V=I.get("Content-Length");if(V)return parseInt(V)}(A.headers)||l.total,c&&le(t.highWaterMark)?r.loadProgressively(A,l,e,t.highWaterMark,c):f?A.arrayBuffer():e.responseType==="json"?A.json():A.text()}).then(function(A){var k=r.response;self.clearTimeout(r.requestTimeout),l.loading.end=Math.max(self.performance.now(),l.loading.first);var D=A[h];D&&(l.loaded=l.total=D);var S={url:k.url,data:A,code:k.status};c&&!le(t.highWaterMark)&&c(l,e,A,k),i.onSuccess(S,l,e,k)}).catch(function(A){if(self.clearTimeout(r.requestTimeout),!l.aborted){var k=A&&A.code||0,D=A?A.message:null;i.onError({code:k,text:D},e,A?A.details:null,l)}})},s.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},s.getResponseHeader=function(e){return this.response?this.response.headers.get(e):null},s.loadProgressively=function(e,t,i,r,l){r===void 0&&(r=0);var u=new Rh,c=e.body.getReader();return function f(){return c.read().then(function(h){if(h.done)return u.dataLength&&l(t,i,u.flush(),e),Promise.resolve(new ArrayBuffer(0));var p=h.value,E=p.length;return t.loaded+=E,E<r||u.dataLength?(u.push(p),u.dataLength>=r&&l(t,i,u.flush(),e)):l(t,i,p,e),f()}).catch(function(){return Promise.reject()})}()},d}();function Ag(d,s){return new self.Request(d.url,s)}var Sg=function(d){function s(e,t,i){var r;return(r=d.call(this,e)||this).code=void 0,r.details=void 0,r.code=t,r.details=i,r}return z(s,d),s}(_e(Error)),kg=/\s/,wg=g(g({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,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Zh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Kv,bufferController:Xv,capLevelController:pg,errorController:y,fpsController:vg,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:Ji,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:{newCue:function(d,s,e,t){for(var i,r,l,u,c,f=[],h=self.VTTCue||self.TextTrackCue,p=0;p<t.rows.length;p++)if(l=!0,u=0,c="",!(i=t.rows[p]).isEmpty()){for(var E,b=0;b<i.chars.length;b++)kg.test(i.chars[b].uchar)&&l?u++:(c+=i.chars[b].uchar,l=!1);i.cueStartTime=s,s===e&&(e+=1e-4),u>=16?u--:u++;var A=Gh(c.trim()),k=tu(s,e,A);d!=null&&(E=d.cues)!=null&&E.getCueById(k)||((r=new h(s,e,A)).id=k,r.line=p+1,r.align="left",r.position=10+Math.min(80,10*Math.floor(8*u/32)),f.push(r))}return d&&f.length&&(f.sort(function(D,S){return D.line==="auto"||S.line==="auto"?0:D.line>8&&S.line>8?S.line-D.line:D.line-S.line}),f.forEach(function(D){return ko(d,D)})),f}},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:$v,subtitleTrackController:zv,timelineController:fg,audioStreamController:Wv,audioTrackController:qv,emeController:jh,cmcdController:Eg,contentSteeringController:bg});function lu(d){return d&&typeof d=="object"?Array.isArray(d)?d.map(lu):Object.keys(d).reduce(function(s,e){return s[e]=lu(d[e]),s},{}):d}function Lg(d){var s=d.loader;s!==Jh&&s!==Zh?(H.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(d.loader=Jh,d.progressive=!0,d.enableSoftwareAES=!0,H.log("[config]: Progressive streaming enabled, using FetchLoader"))}var ef=function(){function d(e){e===void 0&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new No,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,ot(e.debug||!1,"Hls instance");var t=this.config=function(ue,ne){if((ne.liveSyncDurationCount||ne.liveMaxLatencyDurationCount)&&(ne.liveSyncDuration||ne.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(ne.liveMaxLatencyDurationCount!==void 0&&(ne.liveSyncDurationCount===void 0||ne.liveMaxLatencyDurationCount<=ne.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(ne.liveMaxLatencyDuration!==void 0&&(ne.liveSyncDuration===void 0||ne.liveMaxLatencyDuration<=ne.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var be=lu(ue),Fe=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(function(ye){var Ce=(ye==="level"?"playlist":ye)+"LoadPolicy",Pe=ne[Ce]===void 0,Me=[];Fe.forEach(function(Ge){var Ke=ye+"Loading"+Ge,Xe=ne[Ke];if(Xe!==void 0&&Pe){Me.push(Ke);var lt=be[Ce].default;switch(ne[Ce]={default:lt},Ge){case"TimeOut":lt.maxLoadTimeMs=Xe,lt.maxTimeToFirstByteMs=Xe;break;case"MaxRetry":lt.errorRetry.maxNumRetry=Xe,lt.timeoutRetry.maxNumRetry=Xe;break;case"RetryDelay":lt.errorRetry.retryDelayMs=Xe,lt.timeoutRetry.retryDelayMs=Xe;break;case"MaxRetryTimeout":lt.errorRetry.maxRetryDelayMs=Xe,lt.timeoutRetry.maxRetryDelayMs=Xe}}}),Me.length&&H.warn('hls.js config: "'+Me.join('", "')+'" setting(s) are deprecated, use "'+Ce+'": '+JSON.stringify(ne[Ce]))}),g(g({},be),ne)}(d.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&Lg(t);var i=t.abrController,r=t.bufferController,l=t.capLevelController,u=t.errorController,c=t.fpsController,f=new u(this),h=this.abrController=new i(this),p=this.bufferController=new r(this),E=this.capLevelController=new l(this),b=new c(this),A=new So(this),k=new zn(this),D=t.contentSteeringController,S=D?new D(this):null,I=this.levelController=new R(this,S),F=new Z(this),N=new Pt(this.config),V=this.streamController=new Gv(this,F,N);E.setStreamController(V),b.setStreamController(V);var Y=[A,I,V];S&&Y.splice(1,0,S),this.networkControllers=Y;var j=[h,p,E,b,k,F];this.audioTrackController=this.createController(t.audioTrackController,Y);var J=t.audioStreamController;J&&Y.push(new J(this,F,N)),this.subtitleTrackController=this.createController(t.subtitleTrackController,Y);var Q=t.subtitleStreamController;Q&&Y.push(new Q(this,F,N)),this.createController(t.timelineController,j),N.emeController=this.emeController=this.createController(t.emeController,j),this.cmcdController=this.createController(t.cmcdController,j),this.latencyController=this.createController(wo,j),this.coreComponents=j,Y.push(f);var X=f.onErrorOut;typeof X=="function"&&this.on(w.ERROR,X,f)}d.isSupported=function(){return function(){var e=Od();if(!e)return!1;var t=uh(),i=e&&typeof e.isTypeSupported=="function"&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),r=!t||t.prototype&&typeof t.prototype.appendBuffer=="function"&&typeof t.prototype.remove=="function";return!!i&&!!r}()};var s=d.prototype;return s.createController=function(e,t){if(e){var i=new e(this);return t&&t.push(i),i}return null},s.on=function(e,t,i){i===void 0&&(i=this),this._emitter.on(e,t,i)},s.once=function(e,t,i){i===void 0&&(i=this),this._emitter.once(e,t,i)},s.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},s.off=function(e,t,i,r){i===void 0&&(i=this),this._emitter.off(e,t,i,r)},s.listeners=function(e){return this._emitter.listeners(e)},s.emit=function(e,t,i){return this._emitter.emit(e,t,i)},s.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){H.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(w.ERROR,{type:oe.OTHER_ERROR,details:W.INTERNAL_EXCEPTION,fatal:!1,event:e,error:i})}return!1},s.listenerCount=function(e){return this._emitter.listenerCount(e)},s.destroy=function(){H.log("destroy"),this.trigger(w.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(t){return t.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(t){return t.destroy()}),this.coreComponents.length=0;var e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null},s.attachMedia=function(e){H.log("attachMedia"),this._media=e,this.trigger(w.MEDIA_ATTACHING,{media:e})},s.detachMedia=function(){H.log("detachMedia"),this.trigger(w.MEDIA_DETACHING,void 0),this._media=null},s.loadSource=function(e){this.stopLoad();var t=this.media,i=this.url,r=this.url=Ue.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});H.log("loadSource:"+r),t&&i&&i!==r&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(t)),this.trigger(w.MANIFEST_LOADING,{url:e})},s.startLoad=function(e){e===void 0&&(e=-1),H.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},s.stopLoad=function(){H.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},s.swapAudioCodec=function(){H.log("swapAudioCodec"),this.streamController.swapAudioCodec()},s.recoverMediaError=function(){H.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},s.removeLevel=function(e,t){t===void 0&&(t=0),this.levelController.removeLevel(e,t)},M(d,[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){H.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){H.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){H.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){H.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){H.log("set startLevel:"+e),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(H.log("set autoLevelCapping:"+e),this._autoLevelCapping=e)}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){Ya.indexOf(e)>-1&&(this._maxHdcpLevel=e)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var i=e.length,r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,i=this.autoLevelCapping,r=this.maxHdcpLevel;if(e=i===-1&&t&&t.length?t.length-1:i,r)for(var l=e;l--;){var u=t[l].attrs["HDCP-LEVEL"];if(u&&u<=r)return l}return e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.4.0"}},{key:"Events",get:function(){return w}},{key:"ErrorTypes",get:function(){return oe}},{key:"ErrorDetails",get:function(){return W}},{key:"DefaultConfig",get:function(){return d.defaultConfig?d.defaultConfig:wg},set:function(e){d.defaultConfig=e}}]),d}();return ef.defaultConfig=void 0,ef},typeof zm=="object"&&typeof Lc!="undefined"?Lc.exports=m():typeof define=="function"&&define.amd?define(m):(o=typeof globalThis!="undefined"?globalThis:o||self).Hls=m()})(!1)});var nn=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class n extends nn{}globalThis.DocumentFragment=n}var ss=class extends nn{},hu=class extends nn{},Gg={get(n){},define(n,a,o){},upgrade(n){},whenDefined(n){return Promise.resolve(ss)}},os,fu=class{constructor(a,o={}){Rt(this,os,void 0);Oi(this,os,o==null?void 0:o.detail)}get detail(){return at(this,os)}initCustomEvent(){}};os=new WeakMap;function Vg(n,a){return new ss}var df={document:{createElement:Vg},DocumentFragment,customElements:Gg,CustomEvent:fu,EventTarget:nn,HTMLElement:ss,HTMLVideoElement:hu},uf=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Ft=uf?df:globalThis,_i=uf?df.document:globalThis.document;var ve={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"},ls={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"},Oe={MEDIA_CHROME_ATTRIBUTES:"media-chrome-attributes",MEDIA_CONTROLLER:"media-controller"},P={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_TARGET_LIVE_WINDOW:"media-target-live-window",MEDIA_TIME_IS_LIVE:"media-time-is-live"},W0=Object.entries(ls).reduce((n,[a,o])=>{let m=P[a];return m&&(n[o]=m),n},{userinactivechange:"user-inactive"}),cf=Object.entries(P).reduce((n,[a,o])=>{let m=ls[a];return m&&(n[o]=m),n},{"user-inactive":"userinactivechange"}),sn={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},ga={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var mu={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Yi={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},$i={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"};var Zt={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:n=1}={})=>`current playback rate ${n}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading"},St={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:n=30}={})=>`seek forward ${n} seconds`,SEEK_BACK_N_SECS:({seekOffset:n=30}={})=>`seek back ${n} seconds`},Wg={...Zt,...St};function Ko(n,a=!1){return n.split("_").map(function(o,m){return(m||a?o[0].toUpperCase():o[0].toLowerCase())+o.slice(1).toLowerCase()}).join("")}function hf(n){return n.replace(/[-_]([a-z])/g,(a,o)=>o.toUpperCase())}function ff(n){return typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n)}function Wo(n){return typeof n!="string"?!1:!isNaN(n)&&!isNaN(parseFloat(n))}var mf=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],qg=(n,a)=>{let o=n===1?mf[a].singular:mf[a].plural;return`${n} ${o}`},ya=n=>{if(!ff(n))return"";let a=Math.abs(n),o=a!==n,m=new Date(0,0,0,0,0,a,0);return`${[m.getHours(),m.getMinutes(),m.getSeconds()].map((M,B)=>M&&qg(M,B)).filter(M=>M).join(", ")}${o?" remaining":""}`};function Ti(n,a){let o=!1;n<0&&(o=!0,n=0-n),n=n<0?0:n;let m=Math.floor(n%60),v=Math.floor(n/60%60),g=Math.floor(n/3600),L=Math.floor(a/60%60),M=Math.floor(a/3600);return(isNaN(n)||n===1/0)&&(g=v=m="-"),g=g>0||M>0?g+":":"",v=((g||L>=10)&&v<10?"0"+v:v)+":",m=m<10?"0"+m:m,(o?"-":"")+g+v+m}var qo=(n,a,o=".value")=>{let m=n.querySelector(o);!m||(m.textContent=a)},$g=(n,a)=>{let o=`slot[name="${a}"]`,m=n.shadowRoot.querySelector(o);return m?m.children:[]},Yo=(n,a)=>$g(n,a)[0],ds=(n,a)=>!n||!a?!1:n.contains(a)?!0:ds(n,a.getRootNode().host),Ea=(n,a)=>{if(!n)return null;let o=n.closest(a);return o||Ea(n.getRootNode().host,a)};function Dt(n,a){var o;let m;for(m of n.querySelectorAll("style")){let v;try{v=(o=m.sheet)==null?void 0:o.cssRules}catch{continue}for(let g of v!=null?v:[])if(g.selectorText===a)return g}return m!=null&&m.sheet?(m.sheet.insertRule(`${a}{}`,m.sheet.cssRules.length),m.sheet.cssRules[m.sheet.cssRules.length-1]):{style:{setProperty:()=>{},removeProperty:()=>{}}}}var $o=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},pu=class{observe(){}},pf={ResizeObserver:pu,HTMLElement:class extends $o{},DocumentFragment:class extends $o{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){},getComputedStyle:function(){}},jg={createElement:function(){return new pf.HTMLElement},addEventListener(){},removeEventListener(){}},vf=typeof window=="undefined"||typeof window.customElements=="undefined",q=vf?pf:window,re=vf?jg:window.document;var zg=Object.defineProperty,Qg=(n,a,o)=>a in n?zg(n,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[a]=o,Xg=(n,a,o)=>(Qg(n,typeof a!="symbol"?a+"":a,o),o),gf=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},Ni=(n,a,o)=>(gf(n,a,"read from private field"),o?o.call(n):a.get(n)),jo=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},zo=(n,a,o,m)=>(gf(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),sr,Qo,on,Xo,yf=re.createElement("template");yf.innerHTML=`
|
|
42
|
+
`),y=[],b=(u=s.baseTime,(c=s.timescale)===void 0&&(c=1),$d(u,9e4,1/c)),A="00:00.000",k=0,D=0,S=!0;h.oncue=function(L){var N=e[t],P=e.ccOffset,V=(k-b)/9e4;N!=null&&N.new&&(D!==void 0?P=e.ccOffset=N.start:function(z,X,ue){var ne=z[X],Te=z[ne.prevCC];if(!Te||!Te.new&&ne.new)return z.ccOffset=z.presentationOffset=ne.start,void(ne.new=!1);for(;(Me=Te)!=null&&Me.new;){var Me;z.ccOffset+=ne.start-Te.start,ne.new=!1,Te=z[(ne=Te).prevCC]}z.presentationOffset=ue}(e,t,V)),V&&(P=V-e.presentationOffset);var q=L.endTime-L.startTime,j=Ci(9e4*(L.startTime+P-D),9e4*i)/9e4;L.startTime=Math.max(j,0),L.endTime=Math.max(j+q,0);var ee=L.text.trim();L.text=decodeURIComponent(encodeURIComponent(ee)),L.id||(L.id=ou(L.startTime,L.endTime,ee)),L.endTime>0&&y.push(L)},h.onparsingerror=function(L){f=L},h.onflush=function(){f?o(f):r(y)},p.forEach(function(L){if(S){if(nu(L,"X-TIMESTAMP-MAP=")){S=!1,L.slice(16).split(",").forEach(function(N){nu(N,"LOCAL:")?A=N.slice(6):nu(N,"MPEGTS:")&&(k=parseInt(N.slice(7)))});try{D=function(N){var P=parseInt(N.slice(-3)),V=parseInt(N.slice(-6,-4)),q=parseInt(N.slice(-9,-7)),j=N.length>9?parseInt(N.substring(0,N.indexOf(":"))):0;if(!(oe(P)&&oe(V)&&oe(q)&&oe(j)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+N);return P+=1e3*V,(P+=6e4*q)+36e5*j}(A)/1e3}catch(N){f=N}return}L===""&&(S=!1)}h.parse(L+`
|
|
43
|
+
`)}),h.flush()}var lu="stpp.ttml.im1t",Zh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Jh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,vg={left:"start",center:"center",right:"end",start:"start",end:"end"};function ef(d,s,e,t){var i=ze(new Uint8Array(d),["mdat"]);if(i.length!==0){var r,o,u,c,f=i.map(function(p){return Ei(p)}),h=(r=s.baseTime,o=1,(u=s.timescale)===void 0&&(u=1),c===void 0&&(c=!1),$d(r,o,1/u,c));try{f.forEach(function(p){return e(function(y,b){var A=new DOMParser().parseFromString(y,"text/xml").getElementsByTagName("tt")[0];if(!A)throw new Error("Invalid ttml");var k={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},D=Object.keys(k).reduce(function(V,q){return V[q]=A.getAttribute("ttp:"+q)||k[q],V},{}),S=A.getAttribute("xml:space")!=="preserve",L=tf(du(A,"styling","style")),N=tf(du(A,"layout","region")),P=du(A,"body","[begin]");return[].map.call(P,function(V){var q=rf(V,S);if(!q||!V.hasAttribute("begin"))return null;var j=cu(V.getAttribute("begin"),D),ee=cu(V.getAttribute("dur"),D),z=cu(V.getAttribute("end"),D);if(j===null)throw af(V);if(z===null){if(ee===null)throw af(V);z=j+ee}var X=new ru(j-b,z-b,q);X.id=ou(X.startTime,X.endTime,X.text);var ue=function(Me,_e,De){var xe="http://www.w3.org/ns/ttml#styling",Ce=null,He=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],We=Me!=null&&Me.hasAttribute("style")?Me.getAttribute("style"):null;return We&&De.hasOwnProperty(We)&&(Ce=De[We]),He.reduce(function(Qe,ot){var mi=uu(_e,xe,ot)||uu(Me,xe,ot)||uu(Ce,xe,ot);return mi&&(Qe[ot]=mi),Qe},{})}(N[V.getAttribute("region")],L[V.getAttribute("style")],L),ne=ue.textAlign;if(ne){var Te=vg[ne];Te&&(X.lineAlign=Te),X.align=ne}return F(X,ue),X}).filter(function(V){return V!==null})}(p,h))})}catch(p){t(p)}}else t(new Error("Could not parse IMSC1 mdat"))}function du(d,s,e){var t=d.getElementsByTagName(s)[0];return t?[].slice.call(t.querySelectorAll(e)):[]}function tf(d){return d.reduce(function(s,e){var t=e.getAttribute("xml:id");return t&&(s[t]=e),s},{})}function rf(d,s){return[].slice.call(d.childNodes).reduce(function(e,t,i){var r;return t.nodeName==="br"&&i?e+`
|
|
44
|
+
`:(r=t.childNodes)!=null&&r.length?rf(t,s):s?e+t.textContent.trim().replace(/\s+/g," "):e+t.textContent},"")}function uu(d,s,e){return d&&d.hasAttributeNS(s,e)?d.getAttributeNS(s,e):null}function af(d){return new Error("Could not parse ttml timestamp "+d)}function cu(d,s){if(!d)return null;var e=zh(d);return e===null&&(Zh.test(d)?e=function(t,i){var r=Zh.exec(t),o=(0|r[4])+(0|r[5])/i.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+o/i.frameRate}(d,s):Jh.test(d)&&(e=function(t,i){var r=Jh.exec(t),o=Number(r[1]);switch(r[2]){case"h":return 3600*o;case"m":return 60*o;case"ms":return 1e3*o;case"f":return o/i.frameRate;case"t":return o/i.tickRate}return o}(d,s))),e}var gg=function(){function d(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.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 t=new Vo(this,"textTrack1"),i=new Vo(this,"textTrack2"),r=new Vo(this,"textTrack3"),o=new Vo(this,"textTrack4");this.cea608Parser1=new $h(1,t,i),this.cea608Parser2=new $h(3,r,o)}e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(w.FRAG_LOADING,this.onFragLoading,this),e.on(w.FRAG_LOADED,this.onFragLoaded,this),e.on(w.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(w.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(w.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(w.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=d.prototype;return s.destroy=function(){var e=this.hls;e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(w.FRAG_LOADING,this.onFragLoading,this),e.off(w.FRAG_LOADED,this.onFragLoaded,this),e.off(w.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(w.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(w.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(w.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(e,t,i,r,o){for(var u,c,f,h,p=!1,y=o.length;y--;){var b=o[y],A=(u=b[0],c=b[1],f=t,h=i,Math.min(c,h)-Math.max(u,f));if(A>=0&&(b[0]=Math.min(b[0],t),b[1]=Math.max(b[1],i),p=!0,A/(i-t)>.5))return}if(p||o.push([t,i]),this.config.renderTextTracksNatively){var k=this.captionsTracks[e];this.Cues.newCue(k,t,i,r)}else{var D=this.Cues.newCue(null,t,i,r);this.hls.trigger(w.CUES_PARSED,{type:"captions",cues:D,track:e})}},s.onInitPtsFound=function(e,t){var i=this,r=t.frag,o=t.id,u=t.initPTS,c=t.timescale,f=this.unparsedVttFrags;o==="main"&&(this.initPTS[r.cc]={baseTime:u,timescale:c}),f.length&&(this.unparsedVttFrags=[],f.forEach(function(h){i.onFragLoaded(w.FRAG_LOADED,h)}))},s.getExistingTrack=function(e){var t=this.media;if(t)for(var i=0;i<t.textTracks.length;i++){var r=t.textTracks[i];if(r[e])return r}return null},s.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},s.createNativeTrack=function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,i=this.captionsTracks,r=this.media,o=t[e],u=o.label,c=o.languageCode,f=this.getExistingTrack(e);if(f)i[e]=f,Br(i[e]),fa(i[e],r);else{var h=this.createTextTrack("captions",u,c);h&&(h[e]=!0,i[e]=h)}}},s.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var i={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(w.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}}},s.createTextTrack=function(e,t,i){var r=this.media;if(r)return r.addTextTrack(e,t,i)},s.onMediaAttaching=function(e,t){this.media=t.media,this._cleanTracks()},s.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach(function(t){Br(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}},s.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.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},s._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var i=0;i<t.length;i++)Br(t[i])}},s.onSubtitleTracksUpdated=function(e,t){var i=this,r=t.subtitleTracks||[],o=r.some(function(f){return f.textCodec===lu});if(this.config.enableWebVTT||o&&this.config.enableIMSC1){if(Hh(this.tracks,r))return void(this.tracks=r);if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){var u=this.media?this.media.textTracks:null;this.tracks.forEach(function(f,h){var p;if(u&&h<u.length){for(var y=null,b=0;b<u.length;b++)if(yg(u[b],f)){y=u[b];break}y&&(p=y)}if(p)Br(p);else{var A=i._captionsOrSubtitlesFromCharacteristics(f);(p=i.createTextTrack(A,f.name,f.lang))&&(p.mode="disabled")}p&&(p.groupId=f.groupId,i.textTracks.push(p))})}else if(this.tracks.length){var c=this.tracks.map(function(f){return{label:f.name,kind:f.type.toLowerCase(),default:f.default,subtitleTrack:f}});this.hls.trigger(w.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},s._captionsOrSubtitlesFromCharacteristics=function(e){if(e.attrs.CHARACTERISTICS){var t=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),i=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(t&&i)return"captions"}return"subtitles"},s.onManifestLoaded=function(e,t){var i=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(function(r){var o=/(?:CC|SERVICE)([1-4])/.exec(r.instreamId);if(o){var u="textTrack"+o[1],c=i.captionsProperties[u];c&&(c.label=r.name,r.lang&&(c.languageCode=r.lang),c.media=r)}})},s.closedCaptionsForLevel=function(e){var t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]},s.onFragLoading=function(e,t){var i=this.cea608Parser1,r=this.cea608Parser2,o=this.lastSn,u=this.lastPartIndex;if(this.enabled&&i&&r&&t.frag.type===et){var c,f,h=t.frag.sn,p=(c=t==null||(f=t.part)==null?void 0:f.index)!=null?c:-1;h===o+1||h===o&&p===u+1||(i.reset(),r.reset()),this.lastSn=h,this.lastPartIndex=p}},s.onFragLoaded=function(e,t){var i=t.frag,r=t.payload,o=this.initPTS,u=this.unparsedVttFrags;if(i.type===Ri)if(r.byteLength){if(!o[i.cc])return u.push(t),void(o.length&&this.hls.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Missing initial subtitle PTS")}));var c=i.decryptdata,f="stats"in t;if(c==null||!c.encrypted||f){var h=this.tracks[i.level],p=this.vttCCs;p[i.cc]||(p[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),h&&h.textCodec===lu?this._parseIMSC1(i,r):this._parseVTTs(i,r,p)}}else this.hls.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(e,t){var i=this,r=this.hls;ef(t,this.initPTS[e.cc],function(o){i._appendCues(o,e.level),r.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(o){H.log("Failed to parse IMSC1: "+o),r.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:o})})},s._parseVTTs=function(e,t,i){var r,o=this,u=this.hls;pg((r=e.initSegment)!=null&&r.data?hr(e.initSegment.data,new Uint8Array(t)):t,this.initPTS[e.cc],i,e.cc,e.start,function(c){o._appendCues(c,e.level),u.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(c){o._fallbackToIMSC1(e,t),H.log("Failed to parse VTT cue: "+c),u.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:c})})},s._fallbackToIMSC1=function(e,t){var i=this,r=this.tracks[e.level];r.textCodec||ef(t,this.initPTS[e.cc],function(){r.textCodec=lu,i._parseIMSC1(e,t)},function(){r.textCodec="wvtt"})},s._appendCues=function(e,t){var i=this.hls;if(this.config.renderTextTracksNatively){var r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(function(c){return Ro(r,c)})}else{var o=this.tracks[t];if(!o)return;var u=o.default?"default":"subtitles"+t;i.trigger(w.CUES_PARSED,{type:"subtitles",cues:e,track:u})}},s.onFragDecrypted=function(e,t){var i=t.frag;if(i.type===Ri){if(!this.initPTS[i.cc])return void this.unparsedVttFrags.push(t);this.onFragLoaded(w.FRAG_LOADED,t)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,r=this.cea608Parser2;if(this.enabled&&i&&r){var o=t.frag,u=t.samples;if(o.type!==et||this.closedCaptionsForLevel(o)!=="NONE")for(var c=0;c<u.length;c++){var f=u[c].bytes;if(f){var h=this.extractCea608Data(f);i.addData(u[c].pts,h[0]),r.addData(u[c].pts,h[1])}}}},s.onBufferFlushing=function(e,t){var i=t.startOffset,r=t.endOffset,o=t.endOffsetSubtitles,u=t.type,c=this.media;if(c&&!(c.currentTime<r)){if(!u||u==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(p){return Zn(f[p],i,r)})}if(this.config.renderTextTracksNatively&&i===0&&o!==void 0){var h=this.textTracks;Object.keys(h).forEach(function(p){return Zn(h[p],i,o)})}}},s.extractCea608Data=function(e){for(var t=[[],[]],i=31&e[0],r=2,o=0;o<i;o++){var u=e[r++],c=127&e[r++],f=127&e[r++];if((c!==0||f!==0)&&(4&u)!=0){var h=3&u;h!==0&&h!==1||(t[h].push(c),t[h].push(f))}}return t},d}();function yg(d,s){return!!d&&d.label===s.name&&!(d.textTrack1||d.textTrack2)}var Eg=function(){function d(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var s=d.prototype;return s.setStreamController=function(e){this.streamController=e},s.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},s.registerListeners=function(){var e=this.hls;e.on(w.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.BUFFER_CODECS,this.onBufferCodecs,this),e.on(w.MEDIA_DETACHING,this.onMediaDetaching,this)},s.unregisterListener=function(){var e=this.hls;e.off(w.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.BUFFER_CODECS,this.onBufferCodecs,this),e.off(w.MEDIA_DETACHING,this.onMediaDetaching,this)},s.onFpsDropLevelCapping=function(e,t){var i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})},s.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null},s.onManifestParsed=function(e,t){var i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onBufferCodecs=function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onMediaDetaching=function(){this.stopCapping()},s.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var e=this.hls.levels;if(e.length){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},s.getMaxLevel=function(e){var t=this,i=this.hls.levels;if(!i.length)return-1;var r=i.filter(function(o,u){return t.isLevelAllowed(o)&&u<=e});return this.clientRect=null,d.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)},s.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())},s.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},s.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t},s.isLevelAllowed=function(e){return!this.restrictedLevels.some(function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height})},d.getMaxLevelByMediaSize=function(e,t,i){if(e==null||!e.length)return-1;for(var r,o,u=e.length-1,c=0;c<e.length;c+=1){var f=e[c];if((f.width>=t||f.height>=i)&&(r=f,!(o=e[c+1])||r.width!==o.width||r.height!==o.height)){u=c;break}}return u},M(d,[{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 e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}}]),d}(),bg=function(){function d(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 s=d.prototype;return s.setStreamController=function(e){this.streamController=e},s.registerListeners=function(){this.hls.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this)},s.unregisterListeners=function(){this.hls.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this)},s.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},s.onMediaAttaching=function(e,t){var i=this.hls.config;if(i.capLevelOnFPSDrop){var r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}},s.checkFPS=function(e,t,i){var r=performance.now();if(t){if(this.lastTime){var o=r-this.lastTime,u=i-this.lastDroppedFrames,c=t-this.lastDecodedFrames,f=1e3*u/o,h=this.hls;if(h.trigger(w.FPS_DROP,{currentDropped:u,currentDecoded:c,totalDroppedFrames:i}),f>0&&u>h.config.fpsDroppedMonitoringThreshold*c){var p=h.currentLevel;H.warn("drop FPS ratio greater than max allowed value for currentLevel: "+p),p>0&&(h.autoLevelCapping===-1||h.autoLevelCapping>=p)&&(p-=1,h.trigger(w.FPS_DROP_LEVEL_CAPPING,{level:p,droppedLevel:h.currentLevel}),h.autoLevelCapping=p,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}},s.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},d}(),Wo="[eme]",nf=function(){function d(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=d.CDMCleanupPromise?[d.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=H.debug.bind(H,Wo),this.log=H.log.bind(H,Wo),this.warn=H.warn.bind(H,Wo),this.error=H.error.bind(H,Wo),this.hls=e,this.config=e.config,this.registerListeners()}var s=d.prototype;return s.destroy=function(){this.unregisterListeners(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null},s.registerListeners=function(){this.hls.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(w.MANIFEST_LOADED,this.onManifestLoaded,this)},s.unregisterListeners=function(){this.hls.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(w.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(w.MANIFEST_LOADED,this.onManifestLoaded,this)},s.getLicenseServerUrl=function(e){var t=this.config,i=t.drmSystems,r=t.widevineLicenseUrl,o=i[e];if(o)return o.licenseUrl;if(e===je.WIDEVINE&&r)return r;throw new Error('no license server URL configured for key-system "'+e+'"')},s.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},s.attemptKeySystemAccess=function(e){var t=this,i=this.hls.levels,r=function(c,f,h){return!!c&&h.indexOf(c)===f},o=i.map(function(c){return c.audioCodec}).filter(r),u=i.map(function(c){return c.videoCodec}).filter(r);return o.length+u.length===0&&u.push("avc1.42e01e"),new Promise(function(c,f){(function h(p){var y=p.shift();t.getMediaKeysPromise(y,o,u).then(function(b){return c({keySystem:y,mediaKeys:b})}).catch(function(b){p.length?h(p):f(b instanceof Mi?b:new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:b,fatal:!0},b.message))})})(e)})},s.requestMediaKeySystemAccess=function(e,t){var i=this.config.requestMediaKeySystemAccessFunc;if(typeof i!="function"){var r="Configured requestMediaKeySystemAccess is not a function "+i;return Nr===null&&self.location.protocol==="http:"&&(r="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(r))}return i(e,t)},s.getMediaKeysPromise=function(e,t,i){var r=this,o=function(h,p,y,b){var A;switch(h){case je.FAIRPLAY:A=["cenc","sinf"];break;case je.WIDEVINE:case je.PLAYREADY:A=["cenc"];break;case je.CLEARKEY:A=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+h)}return function(k,D,S,L){return[{initDataTypes:k,persistentState:L.persistentState||"not-allowed",distinctiveIdentifier:L.distinctiveIdentifier||"not-allowed",sessionTypes:L.sessionTypes||[L.sessionType||"temporary"],audioCapabilities:D.map(function(N){return{contentType:'audio/mp4; codecs="'+N+'"',robustness:L.audioRobustness||"",encryptionScheme:L.audioEncryptionScheme||null}}),videoCapabilities:S.map(function(N){return{contentType:'video/mp4; codecs="'+N+'"',robustness:L.videoRobustness||"",encryptionScheme:L.videoEncryptionScheme||null}})}]}(A,p,y,b)}(e,t,i,this.config.drmSystemOptions),u=this.keySystemAccessPromises[e],c=u==null?void 0:u.keySystemAccess;if(!c){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(o)),c=this.requestMediaKeySystemAccess(e,o);var f=this.keySystemAccessPromises[e]={keySystemAccess:c};return c.catch(function(h){r.log('Failed to obtain access to key-system "'+e+'": '+h)}),c.then(function(h){r.log('Access for key-system "'+h.keySystem+'" obtained');var p=r.fetchServerCertificate(e);return r.log('Create media-keys for "'+e+'"'),f.mediaKeys=h.createMediaKeys().then(function(y){return r.log('Media-keys created for "'+e+'"'),p.then(function(b){return b?r.setMediaKeysServerCertificate(y,e,b):y})}),f.mediaKeys.catch(function(y){r.error('Failed to create media-keys for "'+e+'"}: '+y)}),f.mediaKeys})}return c.then(function(){return u.mediaKeys})},s.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem,r=e.mediaKeys;this.log('Creating key-system session "'+i+'" keyId: '+Ii(t.keyId||[]));var o=r.createSession(),u={decryptdata:t,keySystem:i,mediaKeys:r,mediaKeysSession:o,keyStatus:"status-pending"};return this.mediaKeySessions.push(u),u},s.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t);this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,"cenc",t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},s.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 Ii(e.keyId)},s.updateKeySession=function(e,t){var i,r=e.mediaKeysSession;return this.log('Updating key-session "'+r.sessionId+'" for keyID '+Ii(((i=e.decryptdata)==null?void 0:i.keyId)||[])+`
|
|
45
|
+
} (data length: `+(t&&t.byteLength)+")"),r.update(t)},s.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},s.getKeyFormatPromise=function(e){var t=this;return new Promise(function(i,r){var o=ur(t.config),u=e.map(ci).filter(function(c){return!!c&&o.indexOf(c)!==-1});return t.getKeySystemSelectionPromise(u).then(function(c){var f=c.keySystem,h=Zi(f);h?i(h):r(new Error('Unable to find format for key-system "'+f+'"'))}).catch(r)})},s.loadKey=function(e){var t=this,i=e.keyInfo.decryptdata,r=this.getKeyIdString(i),o="(keyId: "+r+' format: "'+i.keyFormat+'" method: '+i.method+" uri: "+i.uri+")";this.log("Starting session for key "+o);var u=this.keyIdToKeySessionPromise[r];return u||(u=this.keyIdToKeySessionPromise[r]=this.getKeySystemForKeyPromise(i).then(function(c){var f=c.keySystem,h=c.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+o),t.attemptSetMediaKeys(f,h).then(function(){t.throwIfDestroyed();var p=t.createMediaKeySessionContext({keySystem:f,mediaKeys:h,decryptdata:i});return t.generateRequestWithPreferredKeySession(p,"cenc",i.pssh,"playlist-key")})})).catch(function(c){return t.handleError(c)}),u},s.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},s.handleError=function(e){this.hls&&(this.error(e.message),e instanceof Mi?this.hls.trigger(w.ERROR,e.data):this.hls.trigger(w.ERROR,{type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},s.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){var r=ci(e.keyFormat),o=r?[r]:ur(this.config);return this.attemptKeySystemAccess(o)}return i},s.getKeySystemSelectionPromise=function(e){if(e.length||(e=ur(this.config)),e.length===0)throw new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},s._onMediaEncrypted=function(e){var t=this,i=e.initDataType,r=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+i+'"'),r!==null){var o,u;if(i==="sinf"&&this.config.drmSystems[je.FAIRPLAY]){var c=At(new Uint8Array(r));try{var f=_t(JSON.parse(c).sinf),h=qn(new Uint8Array(f));if(!h)return;o=h.subarray(8,24),u=je.FAIRPLAY}catch{return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var p=function(N){if(!(N instanceof ArrayBuffer)||N.byteLength<32)return null;var P={version:0,systemId:"",kids:null,data:null},V=new DataView(N),q=V.getUint32(0);if(N.byteLength!==q&&q>44||V.getUint32(4)!==1886614376||(P.version=V.getUint32(8)>>>24,P.version>1))return null;P.systemId=Ii(new Uint8Array(N,12,16));var j=V.getUint32(28);if(P.version===0){if(q-32<j)return null;P.data=new Uint8Array(N,32,j)}else if(P.version===1){P.kids=[];for(var ee=0;ee<j;ee++)P.kids.push(new Uint8Array(N,32+16*ee,16))}return P}(r);if(p===null)return;p.version===0&&p.systemId===ut&&p.data&&(o=p.data.subarray(8,24)),u=function(N){if(N===ut)return je.WIDEVINE}(p.systemId)}if(u&&o){for(var y=Ii(o),b=this.keyIdToKeySessionPromise,A=this.mediaKeySessions,k=b[y],D=function(){var N=A[S],P=N.decryptdata;if(P.pssh||!P.keyId)return"continue";var V=Ii(P.keyId);return y===V||P.uri.replace(/-/g,"").indexOf(y)!==-1?(k=b[V],delete b[V],P.pssh=new Uint8Array(r),P.keyId=o,k=b[y]=k.then(function(){return t.generateRequestWithPreferredKeySession(N,i,r,"encrypted-event-key-match")}),"break"):void 0},S=0;S<A.length;S++){var L=D();if(L!=="continue"&&L==="break")break}k||(k=b[y]=this.getKeySystemSelectionPromise([u]).then(function(N){var P,V=N.keySystem,q=N.mediaKeys;t.throwIfDestroyed();var j=new ca("ISO-23001-7",y,(P=Zi(V))!=null?P:"");return j.pssh=new Uint8Array(r),j.keyId=o,t.attemptSetMediaKeys(V,q).then(function(){t.throwIfDestroyed();var ee=t.createMediaKeySessionContext({decryptdata:j,keySystem:V,mediaKeys:q});return t.generateRequestWithPreferredKeySession(ee,i,r,"encrypted-event-no-match")})})),k.catch(function(N){return t.handleError(N)})}}},s._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},s.attemptSetMediaKeys=function(e,t){var i=this,r=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var o=Promise.all(r).then(function(){if(!i.media)throw new Error("Attempted to set mediaKeys without media element attached");return i.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(o),o.then(function(){i.log('Media-keys set for "'+e+'"'),r.push(o),i.setMediaKeysQueue=i.setMediaKeysQueue.filter(function(u){return r.indexOf(u)===-1})})},s.generateRequestWithPreferredKeySession=function(e,t,i,r){var o,u,c=this,f=(o=this.config.drmSystems)==null||(u=o[e.keySystem])==null?void 0:u.generateRequest;if(f)try{var h=f.call(this.hls,t,i,e);if(!h)throw new Error("Invalid response from configured generateRequest filter");t=h.initDataType,i=e.decryptdata.pssh=h.initData?new Uint8Array(h.initData):null}catch(k){var p;if(this.warn(k.message),(p=this.hls)!=null&&p.config.debug)throw k}if(i===null)return this.log('Skipping key-session request for "'+r+'" (no initData)'),Promise.resolve(e);var y=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+r+'": '+y+" (init data type: "+t+" length: "+(i?i.byteLength:null)+")");var b=new Go;e.mediaKeysSession.onmessage=function(k){var D=e.mediaKeysSession;if(D){var S=k.messageType,L=k.message;c.log('"'+S+'" message event for session "'+D.sessionId+'" message size: '+L.byteLength),S==="license-request"||S==="license-renewal"?c.renewLicense(e,L).catch(function(N){c.handleError(N),b.emit("error",N)}):S==="license-release"?e.keySystem===je.FAIRPLAY&&(c.updateKeySession(e,Gi("acknowledged")),c.removeSession(e)):c.warn('unhandled media key message type "'+S+'"')}else b.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(k){if(e.mediaKeysSession){c.onKeyStatusChange(e);var D=e.keyStatus;b.emit("keyStatus",D),D==="expired"&&(c.warn(e.keySystem+" expired for key "+y),c.renewKeySession(e))}else b.emit("error",new Error("invalid state"))};var A=new Promise(function(k,D){b.on("error",D),b.on("keyStatus",function(S){S.startsWith("usable")?k():S==="output-restricted"?D(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):S==="internal-error"?D(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+S+'"')):S==="expired"?D(new Error("key expired while generating request")):c.warn('unhandled key status change "'+S+'"')})});return e.mediaKeysSession.generateRequest(t,i).then(function(){var k;c.log('Request generated for key-session "'+((k=e.mediaKeysSession)==null?void 0:k.sessionId)+'" keyId: '+y)}).catch(function(k){throw new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:k,fatal:!1},"Error generating key-session request: "+k)}).then(function(){return A}).catch(function(k){throw b.removeAllListeners(),c.removeSession(e),k}).then(function(){return b.removeAllListeners(),e})},s.onKeyStatusChange=function(e){var t=this;e.mediaKeysSession.keyStatuses.forEach(function(i,r){t.log('key status change "'+i+'" for keyStatuses keyId: '+Ii("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))+" session keyId: "+Ii(new Uint8Array(e.decryptdata.keyId||[]))+" uri: "+e.decryptdata.uri),e.keyStatus=i})},s.fetchServerCertificate=function(e){var t=this.config,i=new t.loader(t),r=this.getServerCertificateUrl(e);return r?(this.log('Fetching serverCertificate for "'+e+'"'),new Promise(function(o,u){var c={responseType:"arraybuffer",url:r},f=t.certLoadPolicy.default,h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},p={onSuccess:function(y,b,A,k){o(y.data)},onError:function(y,b,A,k){u(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:A,response:E({url:c.url,data:void 0},y)},'"'+e+'" certificate request failed ('+r+"). Status: "+y.code+" ("+y.text+")"))},onTimeout:function(y,b,A){u(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:A,response:{url:c.url,data:void 0}},'"'+e+'" certificate request timed out ('+r+")"))},onAbort:function(y,b,A){u(new Error("aborted"))}};i.load(c,h,p)})):Promise.resolve()},s.setMediaKeysServerCertificate=function(e,t,i){var r=this;return new Promise(function(o,u){e.setServerCertificate(i).then(function(c){r.log("setServerCertificate "+(c?"success":"not supported by CDM")+" ("+(i==null?void 0:i.byteLength)+') on "'+t+'"'),o(e)}).catch(function(c){u(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:c,fatal:!0},c.message))})})},s.renewLicense=function(e,t){var i=this;return this.requestLicense(e,new Uint8Array(t)).then(function(r){return i.updateKeySession(e,new Uint8Array(r)).catch(function(o){throw new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:o,fatal:!0},o.message)})})},s.setupLicenseXHR=function(e,t,i,r){var o=this,u=this.config.licenseXhrSetup;return u?Promise.resolve().then(function(){if(!i.decryptdata)throw new Error("Key removed");return u.call(o.hls,e,t,i,r)}).catch(function(c){if(!i.decryptdata)throw c;return e.open("POST",t,!0),u.call(o.hls,e,t,i,r)}).then(function(c){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:c||r}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))},s.requestLicense=function(e,t){var i=this,r=this.config.keyLoadPolicy.default;return new Promise(function(o,u){var c=i.getLicenseServerUrl(e.keySystem);i.log("Sending license request to URL: "+c);var f=new XMLHttpRequest;f.responseType="arraybuffer",f.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return u(new Error("invalid state"));if(f.readyState===4)if(f.status===200){i._requestLicenseFailureCount=0;var h=f.response;i.log("License received "+(h instanceof ArrayBuffer?h.byteLength:h));var p=i.config.licenseResponseCallback;if(p)try{h=p.call(i.hls,f,c,e)}catch(k){i.error(k)}o(h)}else{var y=r.errorRetry,b=y?y.maxNumRetry:0;if(i._requestLicenseFailureCount++,i._requestLicenseFailureCount>b||f.status>=400&&f.status<500)u(new Mi({type:le.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:{url:c,data:void 0,code:f.status,text:f.statusText}},"License Request XHR failed ("+c+"). Status: "+f.status+" ("+f.statusText+")"));else{var A=b-i._requestLicenseFailureCount+1;i.warn("Retrying license request, "+A+" attempts left"),i.requestLicense(e,t).then(o,u)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=f,i.setupLicenseXHR(f,c,e,t).then(function(h){var p=h.xhr,y=h.licenseChallenge;p.send(y)})})},s.onMediaAttached=function(e,t){if(this.config.emeEnabled){var i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}},s.onMediaDetached=function(){var e=this,t=this.media,i=this.mediaKeySessions;t&&(t.removeEventListener("encrypted",this.onMediaEncrypted),t.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},ca.clearKeyUriToKeyIdMap();var r=i.length;d.CDMCleanupPromise=Promise.all(i.map(function(o){return e.removeSession(o)}).concat(t==null?void 0:t.setMediaKeys(null).catch(function(o){e.log("Could not clear media keys: "+o+". media.src: "+(t==null?void 0:t.src))}))).then(function(){r&&(e.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(function(o){e.log("Could not close sessions and clear media keys: "+o+". media.src: "+(t==null?void 0:t.src))})},s.onManifestLoading=function(){this.keyFormatPromise=null},s.onManifestLoaded=function(e,t){var i=t.sessionKeys;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){var r=i.reduce(function(o,u){return o.indexOf(u.keyFormat)===-1&&o.push(u.keyFormat),o},[]);this.log("Selecting key-system from session-keys "+r.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(r)}},s.removeSession=function(e){var t=this,i=e.mediaKeysSession,r=e.licenseXhr;if(i){this.log("Remove licenses and keys and close session "+i.sessionId),i.onmessage=null,i.onkeystatuseschange=null,r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var o=this.mediaKeySessions.indexOf(e);return o>-1&&this.mediaKeySessions.splice(o,1),i.remove().catch(function(u){t.log("Could not remove session: "+u)}).then(function(){return i.close()}).catch(function(u){t.log("Could not close session: "+u)})}},d}();nf.CDMCleanupPromise=void 0;var Mi=function(d){function s(e,t){var i;return(i=d.call(this,t)||this).data=void 0,e.error||(e.error=new Error(t)),i.data=e,e.err=e.error,i}return Q(s,d),s}(Ae(Error)),_g="m",qo="a",hu="v",fu="av",sf="i",Tg="tt",Ag=function(){function d(e){var t=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(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(o){try{t.apply(o,{ot:_g,su:!t.initialized})}catch(u){H.warn("Could not generate manifest CMCD data.",u)}},this.applyFragmentData=function(o){try{var u=o.frag,c=t.hls.levels[u.level],f=t.getObjectType(u),h={d:1e3*u.duration,ot:f};f!==hu&&f!==qo&&f!=fu||(h.br=c.bitrate/1e3,h.tb=t.getTopBandwidth(f)/1e3,h.bl=t.getBufferLength(f)),t.apply(o,h)}catch(p){H.warn("Could not generate segment CMCD data.",p)}},this.hls=e;var i=this.config=e.config,r=i.cmcd;r!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||d.uuid(),this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.registerListeners())}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(w.MEDIA_DETACHED,this.onMediaDetached,this),e.on(w.BUFFER_CREATED,this.onBufferCreated,this)},s.unregisterListeners=function(){var e=this.hls;e.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(w.MEDIA_DETACHED,this.onMediaDetached,this),e.off(w.BUFFER_CREATED,this.onBufferCreated,this)},s.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},s.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},s.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},s.onBufferCreated=function(e,t){var i,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer},s.createData=function(){var e;return{v:1,sf:"h",sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},s.apply=function(e,t){t===void 0&&(t={}),F(t,this.createData());var i=t.ot===sf||t.ot===hu||t.ot===fu;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var r=d.toHeaders(t);if(!Object.keys(r).length)return;e.headers||(e.headers={}),F(e.headers,r)}else{var o=d.toQuery(t);if(!o)return;e.url=d.appendQueryToUri(e.url,o)}},s.getObjectType=function(e){var t=e.type;return t==="subtitle"?Tg:e.sn==="initSegment"?sf:t==="audio"?qo:t==="main"?this.hls.audioTracks.length?hu:fu:void 0},s.getTopBandwidth=function(e){var t,i=0,r=this.hls;if(e===qo)t=r.audioTracks;else{var o=r.maxAutoLevel,u=o>-1?o+1:r.levels.length;t=r.levels.slice(0,u)}for(var c,f=we(t);!(c=f()).done;){var h=c.value;h.bitrate>i&&(i=h.bitrate)}return i>0?i:NaN},s.getBufferLength=function(e){var t=this.hls.media,i=e===qo?this.audioBuffer:this.videoBuffer;return i&&t?1e3*ce.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN},s.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function r(u){this.loader=void 0,this.loader=new i(u)}var o=r.prototype;return o.destroy=function(){this.loader.destroy()},o.abort=function(){this.loader.abort()},o.load=function(u,c,f){t(u),this.loader.load(u,c,f)},M(r,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),r}()},s.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function r(u){this.loader=void 0,this.loader=new i(u)}var o=r.prototype;return o.destroy=function(){this.loader.destroy()},o.abort=function(){this.loader.abort()},o.load=function(u,c,f){t(u),this.loader.load(u,c,f)},M(r,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),r}()},d.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)},d.serialize=function(e){for(var t,i=[],r=function(k){return!Number.isNaN(k)&&k!=null&&k!==""&&k!==!1},o=function(k){return Math.round(k)},u=function(k){return 100*o(k/100)},c={br:o,d:o,bl:u,dl:u,mtp:u,nor:function(k){return encodeURIComponent(k)},rtp:u,tb:o},f=we(Object.keys(e||{}).sort());!(t=f()).done;){var h=t.value,p=e[h];if(r(p)&&!(h==="v"&&p===1||h=="pr"&&p===1)){var y=c[h];y&&(p=y(p));var b=typeof p,A=void 0;A=h==="ot"||h==="sf"||h==="st"?h+"="+p:b==="boolean"?h:b==="number"?h+"="+p:h+"="+JSON.stringify(p),i.push(A)}}return i.join(",")},d.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],r=[{},{},{},{}],o={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},u=0,c=Object.keys(e);u<c.length;u++){var f=c[u];r[o[f]!=null?o[f]:1][f]=e[f]}for(var h=0;h<r.length;h++){var p=d.serialize(r[h]);p&&(t["CMCD-"+i[h]]=p)}return t},d.toQuery=function(e){return"CMCD="+encodeURIComponent(d.serialize(e))},d.appendQueryToUri=function(e,t){if(!t)return e;var i=e.includes("?")?"&":"?";return""+e+i+t},d}(),Sg=function(){function d(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=H.log.bind(H,"[content-steering]:"),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(w.MANIFEST_LOADING,this.onManifestLoading,this),e.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(w.MANIFEST_PARSED,this.onManifestParsed,this),e.on(w.ERROR,this.onError,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(w.MANIFEST_LOADING,this.onManifestLoading,this),e.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(w.MANIFEST_PARSED,this.onManifestParsed,this),e.off(w.ERROR,this.onError,this))},s.startLoad=function(){if(this.started=!0,self.clearTimeout(this.reloadTimer),this.enabled&&this.uri)if(this.updated){var e=Math.max(1e3*this.timeToLoad-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,e)}else this.loadSteeringManifest(this.uri)},s.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),self.clearTimeout(this.reloadTimer)},s.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},s.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter(function(i){return i!==e}))},s.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},s.onManifestLoaded=function(e,t){var i=t.contentSteering;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())},s.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},s.onError=function(e,t){var i=t.errorAction;if((i==null?void 0:i.action)===T&&i.flags===R){var r=this.pathwayPriority,o=this.pathwayId;this.penalizedPathways[o]||(this.penalizedPathways[o]=performance.now()),!r&&this.levels&&(r=this.levels.reduce(function(u,c){return u.indexOf(c.pathwayId)===-1&&u.push(c.pathwayId),u},[])),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==o)}},s.filterParsedLevels=function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){var i=e[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+i+'"'),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log("Found "+t.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),t):e},s.getLevelsForPathway=function(e){return this.levels===null?[]:this.levels.filter(function(t){return e===t.pathwayId})},s.updatePathwayPriority=function(e){var t;this.pathwayPriority=e;var i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(function(p){r-i[p]>3e5&&delete i[p]});for(var o=0;o<e.length;o++){var u=e[o];if(!i[u]){if(u===this.pathwayId)return;var c=this.hls.nextLoadLevel,f=this.hls.levels[c];if((t=this.getLevelsForPathway(u)).length>0){this.log('Setting Pathway to "'+u+'"'),this.pathwayId=u,this.hls.trigger(w.LEVELS_UPDATED,{levels:t});var h=this.hls.levels[c];f&&h&&this.levels&&(h.attrs["STABLE-VARIANT-ID"]!==f.attrs["STABLE-VARIANT-ID"]&&h.bitrate!==f.bitrate&&this.log("Unstable Pathways change from bitrate "+f.bitrate+" to "+h.bitrate),this.hls.nextLoadLevel=c);break}}}},s.clonePathways=function(e){var t=this,i=this.levels;if(i){var r={},o={};e.forEach(function(u){var c=u.ID,f=u["BASE-ID"],h=u["URI-REPLACEMENT"];if(!i.some(function(y){return y.pathwayId===c})){var p=t.getLevelsForPathway(f).map(function(y){var b=F({},y);b.details=void 0,b.url=lf(y.uri,y.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",h);var A=new it(y.attrs);A["PATHWAY-ID"]=c;var k=A.AUDIO&&A.AUDIO+"_clone_"+c,D=A.SUBTITLES&&A.SUBTITLES+"_clone_"+c;k&&(r[A.AUDIO]=k,A.AUDIO=k),D&&(o[A.SUBTITLES]=D,A.SUBTITLES=D),b.attrs=A;var S=new ga(b);return Y(S,"audio",k),Y(S,"text",D),S});i.push.apply(i,p),of(t.audioTracks,r,h,c),of(t.subtitleTracks,o,h,c)}})}},s.loadSteeringManifest=function(e){var t,i=this,r=this.hls.config,o=r.loader;this.loader&&this.loader.destroy(),this.loader=new o(r);try{t=new self.URL(e)}catch{return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: "+e)}if(t.protocol!=="data:"){var u=0|(this.hls.bandwidthEstimate||r.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+u)}var c={responseType:"json",url:t.href},f=r.steeringManifestLoadPolicy.default,h=f.errorRetry||f.timeoutRetry||{},p={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:h.maxNumRetry||0,retryDelay:h.retryDelayMs||0,maxRetryDelay:h.maxRetryDelayMs||0},y={onSuccess:function(b,A,k,D){i.log('Loaded steering manifest: "'+t+'"');var S=b.data;if(S.VERSION===1){i.updated=performance.now(),i.timeToLoad=S.TTL;var L=S["RELOAD-URI"],N=S["PATHWAY-CLONES"],P=S["PATHWAY-PRIORITY"];if(L)try{i.uri=new self.URL(L,t).href}catch{return i.enabled=!1,void i.log("Failed to parse Steering Manifest RELOAD-URI: "+L)}i.scheduleRefresh(i.uri||k.url),N&&i.clonePathways(N),P&&i.updatePathwayPriority(P)}else i.log("Steering VERSION "+S.VERSION+" not supported!")},onError:function(b,A,k,D){if(i.log("Error loading steering manifest: "+b.code+" "+b.text+" ("+A.url+")"),i.stopLoad(),b.code===410)return i.enabled=!1,void i.log("Steering manifest "+A.url+" no longer available");var S=1e3*i.timeToLoad;if(b.code!==429)i.scheduleRefresh(i.uri||A.url,S);else{var L=i.loader;if(typeof(L==null?void 0:L.getResponseHeader)=="function"){var N=L.getResponseHeader("Retry-After");N&&(S=1e3*parseFloat(N))}i.log("Steering manifest "+A.url+" rate limited")}},onTimeout:function(b,A,k){i.log("Timeout loading steering manifest ("+A.url+")"),i.scheduleRefresh(i.uri||A.url)}};this.log("Requesting steering manifest: "+t),this.loader.load(c,p,y)},s.scheduleRefresh=function(e,t){var i=this;t===void 0&&(t=1e3*this.timeToLoad),self.clearTimeout(this.reloadTimer),this.reloadTimer=self.setTimeout(function(){i.loadSteeringManifest(e)},t)},d}();function of(d,s,e,t){d&&Object.keys(s).forEach(function(i){var r=d.filter(function(o){return o.groupId===i}).map(function(o){var u=F({},o);return u.details=void 0,u.attrs=new it(u.attrs),u.url=u.attrs.URI=lf(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",e),u.groupId=u.attrs["GROUP-ID"]=s[i],u.attrs["PATHWAY-ID"]=t,u});d.push.apply(d,r)})}function lf(d,s,e,t){var i,r=t.HOST,o=t.PARAMS,u=t[e];s&&(i=u==null?void 0:u[s])&&(d=i);var c=new self.URL(d);return r&&!i&&(c.host=r),o&&Object.keys(o).sort().forEach(function(f){f&&c.searchParams.set(f,o[f])}),c.href}var kg=/^age:\s*[\d.]+\s*$/im,df=function(){function d(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 xt,this.retryDelay=0}var s=d.prototype;return s.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},s.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()))},s.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},s.load=function(e,t,i){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=t,this.callbacks=i,this.loadInternal()},s.loadInternal=function(){var e=this,t=this.config,i=this.context;if(t){var r=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0;var u=this.xhrSetup;u?Promise.resolve().then(function(){if(!e.stats.aborted)return u(r,i.url)}).catch(function(c){return r.open("GET",i.url,!0),u(r,i.url)}).then(function(){e.stats.aborted||e.openAndSendXhr(r,i,t)}).catch(function(c){e.callbacks.onError({code:r.status,text:c.message},i,r,o)}):this.openAndSendXhr(r,i,t)}},s.openAndSendXhr=function(e,t,i){e.readyState||e.open("GET",t.url,!0);var r=this.context.headers,o=i.loadPolicy,u=o.maxTimeToFirstByteMs,c=o.maxLoadTimeMs;if(r)for(var f in r)e.setRequestHeader(f,r[f]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=u&&oe(u)?u:c,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()},s.readystatechange=function(){var e=this.context,t=this.loader,i=this.stats;if(e&&t){var r=t.readyState,o=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),o.timeout!==o.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),o.timeout=o.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var u=t.status,c=t.responseType!=="text";if(u>=200&&u<300&&(c&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);var f=c?t.response:t.responseText,h=t.responseType==="arraybuffer"?f.byteLength:f.length;if(i.loaded=i.total=h,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;var p=this.callbacks.onProgress;if(p&&p(i,e,f,t),!this.callbacks)return;var y={url:t.responseURL,data:f,code:u};this.callbacks.onSuccess(y,i,e,t)}else{var b=o.loadPolicy.errorRetry;Za(b,i.retry,!1,u)?this.retry(b):(H.error(u+" while loading "+e.url),this.callbacks.onError({code:u,text:t.statusText},e,t,i))}}}},s.loadtimeout=function(){var e,t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry;if(Za(t,this.stats.retry,!0))this.retry(t);else{H.warn("timeout while loading "+this.context.url);var i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}},s.retry=function(e){var t=this.context,i=this.stats;this.retryDelay=as(e,i.retry),i.retry++,H.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+t.url+", retrying "+i.retry+"/"+e.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},s.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},s.getCacheAge=function(){var e=null;if(this.loader&&kg.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},s.getResponseHeader=function(e){return this.loader&&new RegExp("^"+e+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null},d}(),wg=/(\d+)-(\d+)\/(\d+)/,uf=function(){function d(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||Lg,this.controller=new self.AbortController,this.stats=new xt}var s=d.prototype;return s.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},s.abortInternal=function(){var e=this.response;e!=null&&e.ok||(this.stats.aborted=!0,this.controller.abort())},s.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},s.load=function(e,t,i){var r=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var u=function(A,k){var D={method:"GET",mode:"cors",credentials:"same-origin",signal:k,headers:new self.Headers(F({},A.headers))};return A.rangeEnd&&D.headers.set("Range","bytes="+A.rangeStart+"-"+String(A.rangeEnd-1)),D}(e,this.controller.signal),c=i.onProgress,f=e.responseType==="arraybuffer",h=f?"byteLength":"length",p=t.loadPolicy,y=p.maxTimeToFirstByteMs,b=p.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,u),self.clearTimeout(this.requestTimeout),t.timeout=y&&oe(y)?y:b,this.requestTimeout=self.setTimeout(function(){r.abortInternal(),i.onTimeout(o,e,r.response)},t.timeout),self.fetch(this.request).then(function(A){r.response=r.loader=A;var k=Math.max(self.performance.now(),o.loading.start);if(self.clearTimeout(r.requestTimeout),t.timeout=b,r.requestTimeout=self.setTimeout(function(){r.abortInternal(),i.onTimeout(o,e,r.response)},b-(k-o.loading.start)),!A.ok){var D=A.status,S=A.statusText;throw new Ig(S||"fetch, bad network response",D,A)}return o.loading.first=k,o.total=function(L){var N=L.get("Content-Range");if(N){var P=function(q){var j=wg.exec(q);if(j)return parseInt(j[2])-parseInt(j[1])+1}(N);if(oe(P))return P}var V=L.get("Content-Length");if(V)return parseInt(V)}(A.headers)||o.total,c&&oe(t.highWaterMark)?r.loadProgressively(A,o,e,t.highWaterMark,c):f?A.arrayBuffer():e.responseType==="json"?A.json():A.text()}).then(function(A){var k=r.response;self.clearTimeout(r.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);var D=A[h];D&&(o.loaded=o.total=D);var S={url:k.url,data:A,code:k.status};c&&!oe(t.highWaterMark)&&c(o,e,A,k),i.onSuccess(S,o,e,k)}).catch(function(A){if(self.clearTimeout(r.requestTimeout),!o.aborted){var k=A&&A.code||0,D=A?A.message:null;i.onError({code:k,text:D},e,A?A.details:null,o)}})},s.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},s.getResponseHeader=function(e){return this.response?this.response.headers.get(e):null},s.loadProgressively=function(e,t,i,r,o){r===void 0&&(r=0);var u=new Bh,c=e.body.getReader();return function f(){return c.read().then(function(h){if(h.done)return u.dataLength&&o(t,i,u.flush(),e),Promise.resolve(new ArrayBuffer(0));var p=h.value,y=p.length;return t.loaded+=y,y<r||u.dataLength?(u.push(p),u.dataLength>=r&&o(t,i,u.flush(),e)):o(t,i,p,e),f()}).catch(function(){return Promise.reject()})}()},d}();function Lg(d,s){return new self.Request(d.url,s)}var Ig=function(d){function s(e,t,i){var r;return(r=d.call(this,e)||this).code=void 0,r.details=void 0,r.code=t,r.details=i,r}return Q(s,d),s}(Ae(Error)),Rg=/\s/,Dg=E(E({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,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:df,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$v,bufferController:tg,capLevelController:Eg,errorController:O,fpsController:bg,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:Nr,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:{newCue:function(d,s,e,t){for(var i,r,o,u,c,f=[],h=self.VTTCue||self.TextTrackCue,p=0;p<t.rows.length;p++)if(o=!0,u=0,c="",!(i=t.rows[p]).isEmpty()){for(var y,b=0;b<i.chars.length;b++)Rg.test(i.chars[b].uchar)&&o?u++:(c+=i.chars[b].uchar,o=!1);i.cueStartTime=s,s===e&&(e+=1e-4),u>=16?u--:u++;var A=Xh(c.trim()),k=ou(s,e,A);d!=null&&(y=d.cues)!=null&&y.getCueById(k)||((r=new h(s,e,A)).id=k,r.line=p+1,r.align="left",r.position=10+Math.min(80,10*Math.floor(8*u/32)),f.push(r))}return d&&f.length&&(f.sort(function(D,S){return D.line==="auto"||S.line==="auto"?0:D.line>8&&S.line>8?S.line-D.line:D.line-S.line}),f.forEach(function(D){return Ro(d,D)})),f}},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:Xv,subtitleTrackController:Jv,timelineController:gg,audioStreamController:jv,audioTrackController:zv,emeController:nf,cmcdController:Ag,contentSteeringController:Sg});function mu(d){return d&&typeof d=="object"?Array.isArray(d)?d.map(mu):Object.keys(d).reduce(function(s,e){return s[e]=mu(d[e]),s},{}):d}function Cg(d){var s=d.loader;s!==uf&&s!==df?(H.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(d.loader=uf,d.progressive=!0,d.enableSoftwareAES=!0,H.log("[config]: Progressive streaming enabled, using FetchLoader"))}var cf=function(){function d(e){e===void 0&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Go,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,Je(e.debug||!1,"Hls instance");var t=this.config=function(ue,ne){if((ne.liveSyncDurationCount||ne.liveMaxLatencyDurationCount)&&(ne.liveSyncDuration||ne.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(ne.liveMaxLatencyDurationCount!==void 0&&(ne.liveSyncDurationCount===void 0||ne.liveMaxLatencyDurationCount<=ne.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(ne.liveMaxLatencyDuration!==void 0&&(ne.liveSyncDuration===void 0||ne.liveMaxLatencyDuration<=ne.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var Te=mu(ue),Me=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(function(_e){var De=(_e==="level"?"playlist":_e)+"LoadPolicy",xe=ne[De]===void 0,Ce=[];Me.forEach(function(He){var We=_e+"Loading"+He,Qe=ne[We];if(Qe!==void 0&&xe){Ce.push(We);var ot=Te[De].default;switch(ne[De]={default:ot},He){case"TimeOut":ot.maxLoadTimeMs=Qe,ot.maxTimeToFirstByteMs=Qe;break;case"MaxRetry":ot.errorRetry.maxNumRetry=Qe,ot.timeoutRetry.maxNumRetry=Qe;break;case"RetryDelay":ot.errorRetry.retryDelayMs=Qe,ot.timeoutRetry.retryDelayMs=Qe;break;case"MaxRetryTimeout":ot.errorRetry.maxRetryDelayMs=Qe,ot.timeoutRetry.maxRetryDelayMs=Qe}}}),Ce.length&&H.warn('hls.js config: "'+Ce.join('", "')+'" setting(s) are deprecated, use "'+De+'": '+JSON.stringify(ne[De]))}),E(E({},Te),ne)}(d.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&Cg(t);var i=t.abrController,r=t.bufferController,o=t.capLevelController,u=t.errorController,c=t.fpsController,f=new u(this),h=this.abrController=new i(this),p=this.bufferController=new r(this),y=this.capLevelController=new o(this),b=new c(this),A=new St(this),k=new Fd(this),D=t.contentSteeringController,S=D?new D(this):null,L=this.levelController=new G(this,S),N=new be(this),P=new yt(this.config),V=this.streamController=new qv(this,N,P);y.setStreamController(V),b.setStreamController(V);var q=[A,L,V];S&&q.splice(1,0,S),this.networkControllers=q;var j=[h,p,y,b,k,N];this.audioTrackController=this.createController(t.audioTrackController,q);var ee=t.audioStreamController;ee&&q.push(new ee(this,N,P)),this.subtitleTrackController=this.createController(t.subtitleTrackController,q);var z=t.subtitleStreamController;z&&q.push(new z(this,N,P)),this.createController(t.timelineController,j),P.emeController=this.emeController=this.createController(t.emeController,j),this.cmcdController=this.createController(t.cmcdController,j),this.latencyController=this.createController(Ud,j),this.coreComponents=j,q.push(f);var X=f.onErrorOut;typeof X=="function"&&this.on(w.ERROR,X,f)}d.isSupported=function(){return function(){var e=$a();if(!e)return!1;var t=Eh(),i=e&&typeof e.isTypeSupported=="function"&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),r=!t||t.prototype&&typeof t.prototype.appendBuffer=="function"&&typeof t.prototype.remove=="function";return!!i&&!!r}()};var s=d.prototype;return s.createController=function(e,t){if(e){var i=new e(this);return t&&t.push(i),i}return null},s.on=function(e,t,i){i===void 0&&(i=this),this._emitter.on(e,t,i)},s.once=function(e,t,i){i===void 0&&(i=this),this._emitter.once(e,t,i)},s.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},s.off=function(e,t,i,r){i===void 0&&(i=this),this._emitter.off(e,t,i,r)},s.listeners=function(e){return this._emitter.listeners(e)},s.emit=function(e,t,i){return this._emitter.emit(e,t,i)},s.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){H.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(w.ERROR,{type:le.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:e,error:i})}return!1},s.listenerCount=function(e){return this._emitter.listenerCount(e)},s.destroy=function(){H.log("destroy"),this.trigger(w.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(t){return t.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(t){return t.destroy()}),this.coreComponents.length=0;var e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null},s.attachMedia=function(e){H.log("attachMedia"),this._media=e,this.trigger(w.MEDIA_ATTACHING,{media:e})},s.detachMedia=function(){H.log("detachMedia"),this.trigger(w.MEDIA_DETACHING,void 0),this._media=null},s.loadSource=function(e){this.stopLoad();var t=this.media,i=this.url,r=this.url=dt.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});H.log("loadSource:"+r),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(w.MANIFEST_LOADING,{url:e})},s.startLoad=function(e){e===void 0&&(e=-1),H.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},s.stopLoad=function(){H.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},s.swapAudioCodec=function(){H.log("swapAudioCodec"),this.streamController.swapAudioCodec()},s.recoverMediaError=function(){H.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},s.removeLevel=function(e,t){t===void 0&&(t=0),this.levelController.removeLevel(e,t)},M(d,[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){H.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){H.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){H.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){H.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){H.log("set startLevel:"+e),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(H.log("set autoLevelCapping:"+e),this._autoLevelCapping=e)}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){Jn.indexOf(e)>-1&&(this._maxHdcpLevel=e)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var i=e.length,r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,i=this.autoLevelCapping,r=this.maxHdcpLevel;if(e=i===-1&&t&&t.length?t.length-1:i,r)for(var o=e;o--;){var u=t[o].attrs["HDCP-LEVEL"];if(u&&u<=r)return o}return e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.4.1"}},{key:"Events",get:function(){return w}},{key:"ErrorTypes",get:function(){return le}},{key:"ErrorDetails",get:function(){return $}},{key:"DefaultConfig",get:function(){return d.defaultConfig?d.defaultConfig:Dg},set:function(e){d.defaultConfig=e}}]),d}();return cf.defaultConfig=void 0,cf},typeof ep=="object"&&typeof Pc!="undefined"?Pc.exports=m():typeof define=="function"&&define.amd?define(m):(l=typeof globalThis!="undefined"?globalThis:l||self).Hls=m()})(!1)});var on=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class n extends on{}globalThis.DocumentFragment=n}var hs=class extends on{},yu=class extends on{},qg={get(n){},define(n,a,l){},upgrade(n){},whenDefined(n){return Promise.resolve(hs)}},fs,Eu=class{constructor(a,l={}){Dt(this,fs,void 0);Oi(this,fs,l==null?void 0:l.detail)}get detail(){return at(this,fs)}initCustomEvent(){}};fs=new WeakMap;function Yg(n,a){return new hs}var Ef={document:{createElement:Yg},DocumentFragment,customElements:qg,CustomEvent:Eu,EventTarget:on,HTMLElement:hs,HTMLVideoElement:yu},bf=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Ft=bf?Ef:globalThis,Si=bf?Ef.document:globalThis.document;var ve={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"},ms={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"},Pe={MEDIA_CHROME_ATTRIBUTES:"media-chrome-attributes",MEDIA_CONTROLLER:"media-controller"},U={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_TARGET_LIVE_WINDOW:"media-target-live-window",MEDIA_TIME_IS_LIVE:"media-time-is-live"},V0=Object.entries(ms).reduce((n,[a,l])=>{let m=U[a];return m&&(n[l]=m),n},{userinactivechange:"user-inactive"}),_f=Object.entries(U).reduce((n,[a,l])=>{let m=ms[a];return m&&(n[l]=m),n},{"user-inactive":"userinactivechange"}),ln={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},La={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var bu={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Tr={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Yi={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"};var Jt={AUDIO_PLAYER:()=>"audio player",VIDEO_PLAYER:()=>"video player",VOLUME:()=>"volume",SEEK:()=>"seek",CLOSED_CAPTIONS:()=>"closed captions",PLAYBACK_RATE:({playbackRate:n=1}={})=>`current playback rate ${n}`,PLAYBACK_TIME:()=>"playback time",MEDIA_LOADING:()=>"media loading"},ct={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:n=30}={})=>`seek forward ${n} seconds`,SEEK_BACK_N_SECS:({seekOffset:n=30}={})=>`seek back ${n} seconds`,SEEK_LIVE:()=>"seek to live",PLAYING_LIVE:()=>"playing live"},jg={...Jt,...ct};function jo(n,a=!1){return n.split("_").map(function(l,m){return(m||a?l[0].toUpperCase():l[0].toLowerCase())+l.slice(1).toLowerCase()}).join("")}function Tf(n){return n.replace(/[-_]([a-z])/g,(a,l)=>l.toUpperCase())}function Af(n){return typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n)}function zo(n){return typeof n!="string"?!1:!isNaN(n)&&!isNaN(parseFloat(n))}var Qo=n=>new Promise(a=>setTimeout(a,n));var Sf=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],zg=(n,a)=>{let l=n===1?Sf[a].singular:Sf[a].plural;return`${n} ${l}`},Ia=n=>{if(!Af(n))return"";let a=Math.abs(n),l=a!==n,m=new Date(0,0,0,0,0,a,0);return`${[m.getHours(),m.getMinutes(),m.getSeconds()].map((M,B)=>M&&zg(M,B)).filter(M=>M).join(", ")}${l?" remaining":""}`};function ki(n,a){let l=!1;n<0&&(l=!0,n=0-n),n=n<0?0:n;let m=Math.floor(n%60),v=Math.floor(n/60%60),E=Math.floor(n/3600),I=Math.floor(a/60%60),M=Math.floor(a/3600);return(isNaN(n)||n===1/0)&&(E=v=m="-"),E=E>0||M>0?E+":":"",v=((E||I>=10)&&v<10?"0"+v:v)+":",m=m<10?"0"+m:m,(l?"-":"")+E+v+m}var Qg=Object.freeze({length:0,start(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});function kf(n=Qg){return Array.from(n).map((a,l)=>[Number(n.start(l).toFixed(3)),Number(n.end(l).toFixed(3))].join(":")).join(" ")}var Xo=(n,a,l=".value")=>{let m=n.querySelector(l);!m||(m.textContent=a)},Zg=(n,a)=>{let l=`slot[name="${a}"]`,m=n.shadowRoot.querySelector(l);return m?m.children:[]},Zo=(n,a)=>Zg(n,a)[0],ps=(n,a)=>!n||!a?!1:n.contains(a)?!0:ps(n,a.getRootNode().host),Ra=(n,a)=>{if(!n)return null;let l=n.closest(a);return l||Ra(n.getRootNode().host,a)};function Ct(n,a){var l;let m;for(m of n.querySelectorAll("style")){let v;try{v=(l=m.sheet)==null?void 0:l.cssRules}catch{continue}for(let E of v!=null?v:[])if(E.selectorText===a)return E}return m!=null&&m.sheet?(m.sheet.insertRule(`${a}{}`,m.sheet.cssRules.length),m.sheet.cssRules[m.sheet.cssRules.length-1]):{style:{setProperty:()=>{},removeProperty:()=>{}}}}var Jo=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},_u=class{observe(){}},wf={ResizeObserver:_u,HTMLElement:class extends Jo{},DocumentFragment:class extends Jo{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){},getComputedStyle:function(){}},Jg={createElement:function(){return new wf.HTMLElement},addEventListener(){},removeEventListener(){}},Lf=typeof window=="undefined"||typeof window.customElements=="undefined",W=Lf?wf:window,ie=Lf?Jg:window.document;var ey=Object.defineProperty,ty=(n,a,l)=>a in n?ey(n,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[a]=l,iy=(n,a,l)=>(ty(n,typeof a!="symbol"?a+"":a,l),l),If=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Ni=(n,a,l)=>(If(n,a,"read from private field"),l?l.call(n):a.get(n)),el=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},tl=(n,a,l,m)=>(If(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),ir,il,dn,rl,Rf=ie.createElement("template");Rf.innerHTML=`
|
|
46
46
|
<style>
|
|
47
47
|
:host {
|
|
48
|
+
font: var(--media-font,
|
|
49
|
+
var(--media-font-weight, bold)
|
|
50
|
+
var(--media-font-size, 14px) /
|
|
51
|
+
var(--media-text-content-height, var(--media-control-height, 24px))
|
|
52
|
+
var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
|
|
53
|
+
color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
|
|
54
|
+
background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
|
|
55
|
+
padding: var(--media-control-padding, 10px);
|
|
48
56
|
display: inline-flex;
|
|
49
57
|
align-items: center;
|
|
50
58
|
justify-content: center;
|
|
51
59
|
vertical-align: middle;
|
|
52
60
|
box-sizing: border-box;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
padding: var(--media-control-padding, 10px);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
font-size: 14px;
|
|
59
|
-
line-height: var(--media-text-content-height, var(--media-control-height, 24px));
|
|
60
|
-
font-weight: bold;
|
|
61
|
-
color: #fff;
|
|
62
|
-
|
|
63
|
-
transition: background 0.15s linear;
|
|
64
|
-
|
|
61
|
+
transition: background .15s linear;
|
|
65
62
|
pointer-events: auto;
|
|
66
63
|
cursor: pointer;
|
|
67
|
-
font-family: Arial, sans-serif;
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
|
|
71
67
|
:host(:focus-visible) {
|
|
72
|
-
box-shadow: inset 0 0 0 2px
|
|
68
|
+
box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9);
|
|
73
69
|
outline: 0;
|
|
74
70
|
}
|
|
75
71
|
|
|
@@ -79,7 +75,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
79
75
|
}
|
|
80
76
|
|
|
81
77
|
:host(:hover) {
|
|
82
|
-
background: var(--media-control-hover-background, rgba(50
|
|
78
|
+
background: var(--media-control-hover-background, rgba(50 50 70 / .7));
|
|
83
79
|
}
|
|
84
80
|
|
|
85
81
|
svg, img, ::slotted(svg), ::slotted(img) {
|
|
@@ -87,42 +83,42 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
87
83
|
height: var(--media-button-icon-height, var(--media-control-height, 24px));
|
|
88
84
|
transform: var(--media-button-icon-transform);
|
|
89
85
|
transition: var(--media-button-icon-transition);
|
|
90
|
-
fill: var(--media-icon-color,
|
|
86
|
+
fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
|
|
91
87
|
vertical-align: middle;
|
|
92
88
|
max-width: 100%;
|
|
93
89
|
max-height: 100%;
|
|
94
90
|
min-width: 100%;
|
|
95
91
|
}
|
|
96
92
|
</style>
|
|
97
|
-
`;var
|
|
93
|
+
`;var al=class extends W.HTMLElement{constructor(a={}){if(super(),el(this,ir,void 0),iy(this,"preventClick",!1),el(this,il,m=>{this.preventClick||this.handleClick(m)}),el(this,dn,m=>{let{key:v}=m;if(!this.keysUsed.includes(v)){this.removeEventListener("keyup",Ni(this,dn));return}this.preventClick||this.handleClick(m)}),el(this,rl,m=>{let{metaKey:v,altKey:E,key:I}=m;if(v||E||!this.keysUsed.includes(I)){this.removeEventListener("keyup",Ni(this,dn));return}this.addEventListener("keyup",Ni(this,dn),{once:!0})}),!this.shadowRoot){this.attachShadow({mode:"open"});let m=Rf.content.cloneNode(!0);this.nativeEl=m;let v=a.slotTemplate;v||(v=ie.createElement("template"),v.innerHTML=`<slot>${a.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),this.shadowRoot.appendChild(m)}let{style:l}=Ct(this.shadowRoot,":host");l.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`)}static get observedAttributes(){return["disabled",Pe.MEDIA_CONTROLLER]}enable(){this.addEventListener("click",Ni(this,il)),this.addEventListener("keydown",Ni(this,rl)),this.setAttribute("tabindex","0")}disable(){this.removeEventListener("click",Ni(this,il)),this.removeEventListener("keydown",Ni(this,rl)),this.removeEventListener("keyup",Ni(this,dn)),this.removeAttribute("tabindex")}attributeChangedCallback(a,l,m){var v,E,I,M,B;a===Pe.MEDIA_CONTROLLER?(l&&((E=(v=Ni(this,ir))==null?void 0:v.unassociateElement)==null||E.call(v,this),tl(this,ir,null)),m&&(tl(this,ir,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Ni(this,ir))==null?void 0:M.associateElement)==null||B.call(M,this))):a==="disabled"&&m!==l&&(m==null?this.enable():this.disable())}connectedCallback(){var a,l,m;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","button");let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(tl(this,ir,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=Ni(this,ir))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var a,l;this.disable(),(l=(a=Ni(this,ir))==null?void 0:a.unassociateElement)==null||l.call(a,this),tl(this,ir,null)}get keysUsed(){return["Enter"," "]}handleClick(a){}};ir=new WeakMap;il=new WeakMap;dn=new WeakMap;rl=new WeakMap;W.customElements.get("media-chrome-button")||W.customElements.define("media-chrome-button",al);var Et=al;var ry=`<svg aria-hidden="true" viewBox="0 0 26 24">
|
|
98
94
|
<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"/>
|
|
99
95
|
</svg>
|
|
100
|
-
`,
|
|
101
|
-
<slot name="airplay">${
|
|
102
|
-
`;var
|
|
96
|
+
`,Df=ie.createElement("template");Df.innerHTML=`
|
|
97
|
+
<slot name="airplay">${ry}</slot>
|
|
98
|
+
`;var Tu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(a={}){super({slotTemplate:Df,...a})}connectedCallback(){this.setAttribute("aria-label",ct.AIRPLAY()),super.connectedCallback()}handleClick(){let a=new W.CustomEvent(ve.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(a)}};W.customElements.get("media-airplay-button")||W.customElements.define("media-airplay-button",Tu);var ay='<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>',ny='<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>',Mf=ie.createElement("template");Mf.innerHTML=`
|
|
103
99
|
<style>
|
|
104
|
-
:host([${
|
|
105
|
-
:host([${
|
|
100
|
+
:host([${U.MEDIA_IS_CASTING}]) slot:not([name=exit]) > *,
|
|
101
|
+
:host([${U.MEDIA_IS_CASTING}]) ::slotted(:not([slot=exit])) {
|
|
106
102
|
display: none !important;
|
|
107
103
|
}
|
|
108
104
|
|
|
109
105
|
|
|
110
|
-
:host(:not([${
|
|
111
|
-
:host(:not([${
|
|
106
|
+
:host(:not([${U.MEDIA_IS_CASTING}])) slot:not([name=enter]) > *,
|
|
107
|
+
:host(:not([${U.MEDIA_IS_CASTING}])) ::slotted(:not([slot=enter])) {
|
|
112
108
|
display: none !important;
|
|
113
109
|
}
|
|
114
110
|
</style>
|
|
115
111
|
|
|
116
|
-
<slot name="enter">${
|
|
117
|
-
<slot name="exit">${
|
|
118
|
-
`;var
|
|
112
|
+
<slot name="enter">${ay}</slot>
|
|
113
|
+
<slot name="exit">${ny}</slot>
|
|
114
|
+
`;var Cf=n=>{let l=n.getAttribute(U.MEDIA_IS_CASTING)!=null?ct.EXIT_CAST():ct.ENTER_CAST();n.setAttribute("aria-label",l)},Au=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_IS_CASTING,U.MEDIA_CAST_UNAVAILABLE]}constructor(a={}){super({slotTemplate:Mf,...a})}connectedCallback(){Cf(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a===U.MEDIA_IS_CASTING&&Cf(this),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_IS_CASTING)!=null?ve.MEDIA_EXIT_CAST_REQUEST:ve.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new W.CustomEvent(a,{composed:!0,bubbles:!0}))}};W.customElements.get("media-cast-button")||W.customElements.define("media-cast-button",Au);var xf=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Wr=(n,a,l)=>(xf(n,a,"read from private field"),l?l.call(n):a.get(n)),sy=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},nl=(n,a,l,m)=>(xf(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),pi,Pf=ie.createElement("template");Pf.innerHTML=`
|
|
119
115
|
<style>
|
|
120
116
|
:host {
|
|
121
117
|
display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block));
|
|
122
118
|
box-sizing: border-box;
|
|
123
119
|
}
|
|
124
120
|
</style>
|
|
125
|
-
`;var
|
|
121
|
+
`;var Su=class extends W.HTMLElement{constructor(a={}){if(super(),sy(this,pi,void 0),!this.shadowRoot){let l=this.attachShadow({mode:"open"}),m=Pf.content.cloneNode(!0);this.nativeEl=m;let v=a.slotTemplate;v||(v=ie.createElement("template"),v.innerHTML=`<slot>${a.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),l.appendChild(m)}}static get observedAttributes(){return[Pe.MEDIA_CONTROLLER,U.MEDIA_PAUSED]}attributeChangedCallback(a,l,m){var v,E,I,M,B;a===Pe.MEDIA_CONTROLLER&&(l&&((E=(v=Wr(this,pi))==null?void 0:v.unassociateElement)==null||E.call(v,this),nl(this,pi,null)),m&&(nl(this,pi,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Wr(this,pi))==null?void 0:M.associateElement)==null||B.call(M,this)))}connectedCallback(){var a,l,m,v;this.setAttribute("tabindex",-1),this.setAttribute("aria-hidden",!0),nl(this,pi,oy(this)),this.getAttribute(Pe.MEDIA_CONTROLLER)&&((l=(a=Wr(this,pi))==null?void 0:a.associateElement)==null||l.call(a,this)),(m=Wr(this,pi))==null||m.addEventListener("pointerdown",this),(v=Wr(this,pi))==null||v.addEventListener("click",this)}disconnectedCallback(){var a,l,m,v;this.getAttribute(Pe.MEDIA_CONTROLLER)&&((l=(a=Wr(this,pi))==null?void 0:a.unassociateElement)==null||l.call(a,this)),(m=Wr(this,pi))==null||m.removeEventListener("pointerdown",this),(v=Wr(this,pi))==null||v.removeEventListener("click",this),nl(this,pi,null)}handleEvent(a){var l;let m=(l=a.composedPath())==null?void 0:l[0];if(!!["video","media-controller"].includes(m==null?void 0:m.localName)){if(a.type==="pointerdown")this._pointerType=a.pointerType;else if(a.type==="click"){let{clientX:E,clientY:I}=a,{left:M,top:B,width:F,height:Q}=this.getBoundingClientRect(),re=E-M,te=I-B;if(re<0||te<0||re>F||te>Q||F===0&&Q===0)return;let{pointerType:se=this._pointerType}=a;if(this._pointerType=void 0,se===bu.TOUCH){this.handleTap(a);return}else if(se===bu.MOUSE){this.handleMouseClick(a);return}}}}handleTap(a){}handleMouseClick(a){let l=this.getAttribute(U.MEDIA_PAUSED)!=null?ve.MEDIA_PLAY_REQUEST:ve.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new W.CustomEvent(l,{composed:!0,bubbles:!0}))}};pi=new WeakMap;function oy(n){var a;let l=n.getAttribute(Pe.MEDIA_CONTROLLER);return l?(a=n.getRootNode())==null?void 0:a.getElementById(l):Ra(n,"media-controller")}W.customElements.get("media-gesture-receiver")||W.customElements.define("media-gesture-receiver",Su);var Of=ie.createElement("template");Of.innerHTML=`
|
|
126
122
|
<style>
|
|
127
123
|
|
|
128
124
|
:host([media-is-fullscreen]) ::slotted([slot=media]) {
|
|
@@ -211,7 +207,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
211
207
|
}
|
|
212
208
|
|
|
213
209
|
|
|
214
|
-
:host([user-inactive]:not([${
|
|
210
|
+
:host([user-inactive]:not([${U.MEDIA_PAUSED}]):not([${U.MEDIA_IS_CASTING}]):not([audio])) ::slotted(:not([slot=media]):not([no-auto-hide])) {
|
|
215
211
|
opacity: 0;
|
|
216
212
|
transition: opacity 1s;
|
|
217
213
|
}
|
|
@@ -220,7 +216,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
220
216
|
align-self: stretch;
|
|
221
217
|
}
|
|
222
218
|
|
|
223
|
-
:host([${
|
|
219
|
+
:host([${U.MEDIA_HAS_PLAYED}]) ::slotted([slot=poster]) {
|
|
224
220
|
display: none;
|
|
225
221
|
}
|
|
226
222
|
</style>
|
|
@@ -237,43 +233,43 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
237
233
|
|
|
238
234
|
<slot part="bottom chrome"></slot>
|
|
239
235
|
</span>
|
|
240
|
-
`;var ry=Object.values(P),ay="sm:384 md:576 lg:768 xl:960",ny=n=>{var a;for(let o of n){let m=o.target;if(!m.isConnected)continue;let v=(a=m.getAttribute("breakpoints"))!=null?a:ay,g=sy(v),L=oy(g,o.contentRect);Object.keys(g).forEach(M=>{if(L.includes(M)){m.hasAttribute(`breakpoint-${M}`)||m.setAttribute(`breakpoint-${M}`,"");return}m.removeAttribute(`breakpoint-${M}`)})}};function sy(n){let a=n.split(/\s+/);return Object.fromEntries(a.map(o=>o.split(":")))}function oy(n,a){return Object.keys(n).filter(o=>a.width>=n[o])}var el=class extends q.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Sf.content.cloneNode(!0));let a=L=>{let M=this.media;for(let B of L)B.type==="childList"&&(B.removedNodes.forEach(U=>{if(U.slot=="media"&&B.target==this){let z=B.previousSibling&&B.previousSibling.previousElementSibling;if(!z||!M)this.mediaUnsetCallback(U);else{let ie=z.slot!=="media";for(;(z=z.previousSibling)!==null;)z.slot=="media"&&(ie=!1);ie&&this.mediaUnsetCallback(U)}}}),M&&B.addedNodes.forEach(U=>{U==M&&this.handleMediaUpdated(M).then(z=>this.mediaSetCallback(z))}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0});let m=new ResizeObserver(ny);this.resizeObserver=m,m.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(M=>this.mediaSetCallback(M)))})}static get observedAttributes(){return["autohide","gestures-disabled"].concat(ry)}attributeChangedCallback(a,o,m){a.toLowerCase()=="autohide"&&(this.autohide=m)}get media(){let a=this.querySelector(":scope > [slot=media]");return(a==null?void 0:a.nodeName)=="SLOT"&&(a=a.assignedElements({flatten:!0})[0]),a}mediaSetCallback(a){this._mediaClickPlayToggle=()=>{let o=a.paused?ve.MEDIA_PLAY_REQUEST:ve.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new q.CustomEvent(o,{composed:!0,bubbles:!0}))}}handleMediaUpdated(a){let o=g=>Promise.resolve(g),m=g=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',g),Promise.reject(g));if(!a)return m(a);let v=a.nodeName.toLowerCase();return v.includes("-")?q.customElements.whenDefined(v).then(()=>o(a)):o(a)}mediaUnsetCallback(a){}connectedCallback(){let o=this.getAttribute("audio")!=null?Zt.AUDIO_PLAYER():Zt.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",o),this.media&&this.handleMediaUpdated(this.media).then(L=>this.mediaSetCallback(L)),this.setAttribute("user-inactive","user-inactive");let m=()=>{if(this.autohide<0||this.hasAttribute("user-inactive"))return;this.setAttribute("user-inactive","");let L=new q.CustomEvent(ls.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(L)},v=()=>{if(!this.hasAttribute("user-inactive"))return;this.removeAttribute("user-inactive");let L=new q.CustomEvent(ls.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(L)},g=()=>{v(),q.clearTimeout(this._inactiveTimeout),!(this.autohide<0)&&(this._inactiveTimeout=q.setTimeout(()=>{m()},this.autohide*1e3))};this.addEventListener("keyup",()=>{g()}),this.addEventListener("pointerup",L=>{L.pointerType==="touch"?[this,this.media].includes(L.target)&&!this.hasAttribute("user-inactive")?m():g():L.composedPath().some(M=>{var B;return["media-play-button","media-fullscreen-button"].includes((B=M==null?void 0:M.nodeName)==null?void 0:B.toLowerCase())})&&g()}),this.addEventListener("pointermove",L=>{L.pointerType==="mouse"&&L.target!==this&&(v(),q.clearTimeout(this._inactiveTimeout),[this,this.media].includes(L.target)&&g())}),this.addEventListener("mouseleave",()=>{m()}),this.addEventListener("keyup",()=>{this.setAttribute("media-keyboard-control","")}),q.addEventListener("mouseup",()=>{this.removeAttribute("media-keyboard-control")})}set autohide(a){a=Number(a),this._autohide=isNaN(a)?0:a}get autohide(){return this._autohide===void 0?2:this._autohide}};q.customElements.get("media-container-temp")||q.customElements.define("media-container-temp",el);var kf=el;var wf=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},Jt=(n,a,o)=>(wf(n,a,"read from private field"),o?o.call(n):a.get(n)),Eu=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},bu=(n,a,o,m)=>(wf(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),ln,dn,Ai,tl=class{constructor(a,o){Eu(this,ln,void 0),Eu(this,dn,void 0),Eu(this,Ai,new Set),bu(this,ln,a),bu(this,dn,o)}[Symbol.iterator](){return Jt(this,Ai).values()}get length(){return Jt(this,Ai).size}get value(){var a;return(a=[...Jt(this,Ai)].join(" "))!=null?a:""}set value(a){var o;a!==this.value&&(bu(this,Ai,new Set),this.add(...(o=a==null?void 0:a.split(" "))!=null?o:[]))}toString(){return this.value}item(a){return[...Jt(this,Ai)][a]}values(){return Jt(this,Ai).values()}keys(){return Jt(this,Ai).keys()}forEach(a){Jt(this,Ai).forEach(a)}add(...a){var o,m;a.forEach(v=>Jt(this,Ai).add(v)),!(this.value===""&&!((o=Jt(this,ln))!=null&&o.hasAttribute(`${Jt(this,dn)}`)))&&((m=Jt(this,ln))==null||m.setAttribute(`${Jt(this,dn)}`,`${this.value}`))}remove(...a){var o;a.forEach(m=>Jt(this,Ai).delete(m)),(o=Jt(this,ln))==null||o.setAttribute(`${Jt(this,dn)}`,`${this.value}`)}contains(a){return Jt(this,Ai).has(a)}toggle(a,o){return typeof o!="undefined"?o?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,o){this.remove(a),this.add(o)}};ln=new WeakMap;dn=new WeakMap;Ai=new WeakMap;var Ut={enter:"requestFullscreen",exit:"exitFullscreen",event:"fullscreenchange",element:"fullscreenElement",error:"fullscreenerror",enabled:"fullscreenEnabled"};re.fullscreenElement===void 0&&(Ut.enter="webkitRequestFullScreen",Ut.exit=re.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",Ut.event="webkitfullscreenchange",Ut.element="webkitFullscreenElement",Ut.error="webkitfullscreenerror",Ut.enabled="webkitFullscreenEnabled");var _u=(n="")=>n.split(/\s+/),Lf=(n="")=>{let[a,o]=n.split(":"),m=o?decodeURIComponent(o):void 0;return{language:a,label:m}},us=(n="",a={})=>_u(n).map(o=>{let m=Lf(o);return{...a,...m}}),ly=n=>Array.isArray(n)?n.map(a=>typeof a=="string"?Lf(a):a):typeof n=="string"?us(n):[n],Tu=({label:n,language:a}={})=>n?`${a}:${encodeURIComponent(n)}`:a,ji=(n=[])=>Array.prototype.map.call(n,Tu).join(" "),dy=(n,a)=>o=>o[n]===a,If=n=>{let a=Object.entries(n).map(([o,m])=>dy(o,m));return o=>a.every(m=>m(o))},cs=(n,a=[],o=[])=>{let m=ly(o).map(If),v=g=>m.some(L=>L(g));Array.from(a).filter(v).forEach(g=>{g.mode=n})},un=(n,a=()=>!0)=>{if(!(n!=null&&n.textTracks))return[];let o=typeof a=="function"?a:If(a);return Array.from(n.textTracks).filter(o)},Au=n=>{let a=!!n.getAttribute(P.MEDIA_CAPTIONS_SHOWING),o=!n.hasAttribute("no-subtitles-fallback")&&!!n.getAttribute(P.MEDIA_SUBTITLES_SHOWING);return a||o},ba=n=>{var a,o,m,v;if(Au(n)){let L=n.getAttribute(P.MEDIA_CAPTIONS_SHOWING);if(L){let B=new window.CustomEvent(ve.MEDIA_DISABLE_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:L});n.dispatchEvent(B)}let M=n.getAttribute(P.MEDIA_SUBTITLES_SHOWING);if(M&&!n.hasAttribute("no-subtitles-fallback")){let B=new window.CustomEvent(ve.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:M});n.dispatchEvent(B)}}else{let[L]=(o=_u((a=n.getAttribute(P.MEDIA_CAPTIONS_LIST))!=null?a:""))!=null?o:[];if(L){let M=new window.CustomEvent(ve.MEDIA_SHOW_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:L});n.dispatchEvent(M)}else if(n.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[M]=(v=_u((m=n.getAttribute(P.MEDIA_SUBTITLES_LIST))!=null?m:""))!=null?v:[];if(M){let B=new window.CustomEvent(ve.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:M});n.dispatchEvent(B)}}}};var Iu=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},Ta=(n,a,o)=>(Iu(n,a,"read from private field"),o?o.call(n):a.get(n)),il=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},Rf=(n,a,o,m)=>(Iu(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),cn=(n,a,o)=>(Iu(n,a,"access private method"),o),qr,fs,hn,gs,al,Su,uy=Object.values($i),xf=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],cy=10,Df=0,sl=class extends kf{constructor(){super(),il(this,hn),il(this,al),il(this,qr,new tl(this,"hotkeys")),il(this,fs,void 0),_y||(this._airplayUnavailable=Yi.UNSUPPORTED),Mf||(this._fullscreenUnavailable=Yi.UNAVAILABLE),Ty||(this._castUnavailable=Yi.UNSUPPORTED),Ey||(this._pipUnavailable=Yi.UNSUPPORTED),vs!==void 0?vs||(this._volumeUnavailable=Yi.UNSUPPORTED):by.then(()=>{vs||(this._volumeUnavailable=Yi.UNSUPPORTED,this.propagateMediaState(P.MEDIA_VOLUME_UNAVAILABLE,this._volumeUnavailable))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associateElement(this);let a={MEDIA_PLAY_REQUEST:(o,m)=>{let v=hs[P.MEDIA_STREAM_TYPE](this),g=this.getAttribute("noautoseektolive")===null;v==$i.LIVE&&g&&a.MEDIA_SEEK_TO_LIVE_REQUEST(o,m),this.media.play().catch(()=>{})},MEDIA_PAUSE_REQUEST:()=>this.media.pause(),MEDIA_MUTE_REQUEST:()=>this.media.muted=!0,MEDIA_UNMUTE_REQUEST:()=>{let o=this.media;o.muted=!1,o.volume===0&&(o.volume=.25)},MEDIA_VOLUME_REQUEST:o=>{let m=this.media,v=o.detail;m.volume=v,v>0&&m.muted&&(m.muted=!1);try{q.localStorage.setItem("media-chrome-pref-volume",v.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:()=>{if(!Mf){console.warn("Fullscreen support is unavailable; not entering fullscreen");return}let o=this.media;re.pictureInPictureElement&&re.exitPictureInPicture(),super[Ut.enter]?this.fullscreenElement[Ut.enter]():o.webkitEnterFullscreen?o.webkitEnterFullscreen():o.requestFullscreen?o.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{re[Ut.exit]()},MEDIA_ENTER_PIP_REQUEST:()=>{let o=this.media;if(!re.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!o.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}re[Ut.element]&&re[Ut.exit]();let m=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};o.requestPictureInPicture().catch(v=>{if(v.code===11)if(o.readyState===0&&o.preload==="none"){let g=()=>{o.removeEventListener("loadedmetadata",L),o.preload="none"},L=()=>{o.requestPictureInPicture().catch(m),g()};o.addEventListener("loadedmetadata",L),o.preload="metadata",setTimeout(()=>{o.readyState===0&&m(),g()},1e3)}else throw v;else throw v})},MEDIA_EXIT_PIP_REQUEST:()=>{re.pictureInPictureElement&&re.exitPictureInPicture()},MEDIA_ENTER_CAST_REQUEST:()=>{var o;let m=this.media;!((o=globalThis.CastableVideoElement)!=null&&o.castEnabled)||(re[Ut.element]&&re[Ut.exit](),m.requestCast())},MEDIA_EXIT_CAST_REQUEST:async()=>{var o;(o=globalThis.CastableVideoElement)!=null&&o.castElement&&globalThis.CastableVideoElement.exitCast()},MEDIA_SEEK_REQUEST:o=>{let m=this.media,v=o.detail;(m.readyState>0||m.readyState===void 0)&&(m.currentTime=v)},MEDIA_PLAYBACK_RATE_REQUEST:o=>{this.media.playbackRate=o.detail},MEDIA_PREVIEW_REQUEST:o=>{var m;let v=this.media;if(!v)return;let g=o.detail;g===null&&this.propagateMediaState(P.MEDIA_PREVIEW_TIME,void 0),this.propagateMediaState(P.MEDIA_PREVIEW_TIME,g);let[L]=un(v,{kind:sn.METADATA,label:"thumbnails"});if(!(L&&L.cues))return;if(g===null){this.propagateMediaState(P.MEDIA_PREVIEW_IMAGE,void 0),this.propagateMediaState(P.MEDIA_PREVIEW_COORDS,void 0);return}let M=Array.prototype.find.call(L.cues,ie=>ie.startTime>=g);if(!M)return;let B=/'^(?:[a-z]+:)?\/\//i.test(M.text)||(m=v.querySelector('track[label="thumbnails"]'))==null?void 0:m.src,U=new URL(M.text,B),z=new URLSearchParams(U.hash).get("#xywh");this.propagateMediaState(P.MEDIA_PREVIEW_IMAGE,U.href),this.propagateMediaState(P.MEDIA_PREVIEW_COORDS,z.split(",").join(" "))},MEDIA_SHOW_CAPTIONS_REQUEST:o=>{let m=nl(this),{detail:v=[]}=o;cs(ga.SHOWING,m,v)},MEDIA_DISABLE_CAPTIONS_REQUEST:o=>{let m=nl(this),{detail:v=[]}=o;cs(ga.DISABLED,m,v)},MEDIA_SHOW_SUBTITLES_REQUEST:o=>{let m=ps(this),{detail:v=[]}=o;cs(ga.SHOWING,m,v)},MEDIA_DISABLE_SUBTITLES_REQUEST:o=>{let m=ps(this),{detail:v=[]}=o;cs(ga.DISABLED,m,v)},MEDIA_AIRPLAY_REQUEST:()=>{let{media:o}=this;if(!!o){if(!(o.webkitShowPlaybackTargetPicker&&q.WebKitPlaybackTargetAvailabilityEvent)){console.warn("received a request to select AirPlay but AirPlay is not supported in this environment");return}o.webkitShowPlaybackTargetPicker()}},MEDIA_SEEK_TO_LIVE_REQUEST:(o,m)=>{let v=m.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}m.currentTime=v.end(v.length-1)}};if(Object.keys(a).forEach(o=>{let m=`_handle${Ko(o,!0)}`;this[m]=v=>{if(v.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}a[o](v,this.media)},this.addEventListener(ve[o],this[m])}),this._mediaStatePropagators={"play,pause,emptied":()=>{this.propagateMediaState(P.MEDIA_PAUSED,Pf(this))},"playing,emptied":()=>{var o;this.propagateMediaState(P.MEDIA_HAS_PLAYED,!((o=this.media)!=null&&o.paused))},volumechange:()=>{this.propagateMediaState(P.MEDIA_MUTED,Of(this)),this.propagateMediaState(P.MEDIA_VOLUME,Nf(this)),this.propagateMediaState(P.MEDIA_VOLUME_LEVEL,Ff(this))},[Ut.event]:o=>{let v=!!re[Ut.element]&&(o==null?void 0:o.target),g=ds(this.fullscreenElement,v);this.propagateMediaState(P.MEDIA_IS_FULLSCREEN,g)},"enterpictureinpicture,leavepictureinpicture":o=>{var m;let v;if(o)v=o.type=="enterpictureinpicture";else{let g=(m=this.getRootNode().pictureInPictureElement)!=null?m:re.pictureInPictureElement;v=this.media&&ds(this.media,g)}this.propagateMediaState(P.MEDIA_IS_PIP,v)},"entercast,leavecast,castchange":o=>{var m;let v=(m=globalThis.CastableVideoElement)==null?void 0:m.castElement,g=this.media&&ds(this.media,v);(o==null?void 0:o.type)==="castchange"&&(o==null?void 0:o.detail)==="CONNECTING"&&(g="connecting"),this.propagateMediaState(P.MEDIA_IS_CASTING,g)},"timeupdate,loadedmetadata":()=>{this.propagateMediaState(P.MEDIA_CURRENT_TIME,Uf(this))},"durationchange,loadedmetadata,emptied":()=>{this.propagateMediaState(P.MEDIA_DURATION,Bf(this))},"emptied,durationchange,loadedmetadata,streamtypechange":()=>{this.propagateMediaState(P.MEDIA_STREAM_TYPE)},"emptied,durationchange,loadedmetadata,streamtypechange,targetlivewindowchange":()=>{this.propagateMediaState(P.MEDIA_TARGET_LIVE_WINDOW)},"loadedmetadata,emptied,progress":()=>{var o;this.propagateMediaState(P.MEDIA_SEEKABLE,(o=Hf(this))==null?void 0:o.join(":"))},"progress,emptied":()=>{var o;this.propagateMediaState(P.MEDIA_BUFFERED,ky((o=this.media)==null?void 0:o.buffered))},"ratechange,loadstart":()=>{this.propagateMediaState(P.MEDIA_PLAYBACK_RATE,Gf(this))},"waiting,playing,emptied":()=>{var o;let m=((o=this.media)==null?void 0:o.readyState)<3;this.propagateMediaState(P.MEDIA_LOADING,m)},"playing,timeupdate,progress,waiting,emptied":()=>{this.propagateMediaState(P.MEDIA_TIME_IS_LIVE)}},this._airplayUnavailable!==Yi.UNSUPPORTED){let o=m=>{(m==null?void 0:m.availability)==="available"?this._airplayUnavailable=void 0:(m==null?void 0:m.availability)==="not-available"&&(this._airplayUnavailable=Yi.UNAVAILABLE),this.propagateMediaState(P.MEDIA_AIRPLAY_UNAVAILABLE,this._airplayUnavailable)};this._mediaStatePropagators.webkitplaybacktargetavailabilitychanged=o}if(this._castUnavailable!==Yi.UNSUPPORTED){let o=()=>{var m;let v=(m=globalThis.CastableVideoElement)==null?void 0:m.castState;v!=null&&v.includes("CONNECT")?this._castUnavailable=void 0:this._castUnavailable=Yi.UNAVAILABLE,this.propagateMediaState(P.MEDIA_CAST_UNAVAILABLE,this._castUnavailable)};this._mediaStatePropagators.castchange=o}this._textTrackMediaStatePropagators={"addtrack,removetrack,loadstart":()=>{this.propagateMediaState(P.MEDIA_CAPTIONS_LIST,ji(nl(this))||void 0),this.propagateMediaState(P.MEDIA_SUBTITLES_LIST,ji(ps(this))||void 0),this.propagateMediaState(P.MEDIA_CAPTIONS_SHOWING,ji(ku(this))||void 0),this.propagateMediaState(P.MEDIA_SUBTITLES_SHOWING,ji(Cf(this))||void 0)},change:()=>{this.propagateMediaState(P.MEDIA_CAPTIONS_SHOWING,ji(ku(this))||void 0),this.propagateMediaState(P.MEDIA_SUBTITLES_SHOWING,ji(Cf(this))||void 0)}},this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat("nohotkeys","hotkeys","default-stream-type")}get fullscreenElement(){var a;return(a=Ta(this,fs))!=null?a:this}set fullscreenElement(a){this.hasAttribute("fullscreen-element")&&this.removeAttribute("fullscreen-element"),Rf(this,fs,a)}attributeChangedCallback(a,o,m){var v;if(a==="nohotkeys")m!==o&&m===""?(this.hasAttribute("hotkeys")&&console.warn("Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):m!==o&&m===null&&this.enableHotkeys();else if(a==="hotkeys")Ta(this,qr).value=m;else if(a==="default-stream-type")this.propagateMediaState(P.MEDIA_STREAM_TYPE);else if(a==="fullscreen-element"){let g=m?(v=this.getRootNode())==null?void 0:v.getElementById(m):void 0;Rf(this,fs,g)}super.attributeChangedCallback(a,o,m)}mediaSetCallback(a){super.mediaSetCallback(a),a.hasAttribute("tabindex")||a.setAttribute("tabindex",-1),Object.keys(this._mediaStatePropagators).forEach(o=>{let m=o.split(","),v=this._mediaStatePropagators[o];m.forEach(g=>{(g==Ut.event?this.getRootNode():a).addEventListener(g,v)}),v()}),Object.entries(this._textTrackMediaStatePropagators).forEach(([o,m])=>{o.split(",").forEach(g=>{a.textTracks&&a.textTracks.addEventListener(g,m)}),m()});try{let o=q.localStorage.getItem("media-chrome-pref-volume");o!==null&&(a.volume=o)}catch(o){console.debug("Error getting volume pref",o)}}mediaUnsetCallback(a){super.mediaUnsetCallback(a),Object.keys(this._mediaStatePropagators).forEach(o=>{let m=o.split(","),v=this._mediaStatePropagators[o];m.forEach(g=>{(g==Ut.event?this.getRootNode():a).removeEventListener(g,v)})}),Object.entries(this._textTrackMediaStatePropagators).forEach(([o,m])=>{o.split(",").forEach(g=>{a.textTracks&&a.textTracks.removeEventListener(g,m)}),m()}),this.propagateMediaState(P.MEDIA_PAUSED,!0)}propagateMediaState(a,o){arguments.length===1&&(o=hs[a](this));let m=this.getAttribute(a);if(_a(this.mediaStateReceivers,a,o),m===this.getAttribute(a))return;let v=cf[a];if(!v)return;let g=new q.CustomEvent(v,{composed:!0,bubbles:!0,detail:o});this.dispatchEvent(g)}associateElement(a){if(!a)return;let{associatedElementSubscriptions:o}=this;if(o.has(a))return;let m=this.registerMediaStateReceiver.bind(this),v=this.unregisterMediaStateReceiver.bind(this),g=vy(a,m,v);Object.keys(ve).forEach(L=>{a.addEventListener(ve[L],this[`_handle${Ko(L,!0)}`])}),o.set(a,g)}unassociateElement(a){if(!a)return;let{associatedElementSubscriptions:o}=this;if(!o.has(a))return;o.get(a)(),o.delete(a),Object.keys(ve).forEach(v=>{a.removeEventListener(ve[v],this[`_handle${Ko(v,!0)}`])})}registerMediaStateReceiver(a){if(!a)return;let o=this.mediaStateReceivers;o.indexOf(a)>-1||(o.push(a),_a([a],P.MEDIA_VOLUME_UNAVAILABLE,this._volumeUnavailable),_a([a],P.MEDIA_AIRPLAY_UNAVAILABLE,this._airplayUnavailable),_a([a],P.MEDIA_FULLSCREEN_UNAVAILABLE,this._fullscreenUnavailable),_a([a],P.MEDIA_CAST_UNAVAILABLE,this._castUnavailable),_a([a],P.MEDIA_PIP_UNAVAILABLE,this._pipUnavailable),this.media&&Object.keys(P).forEach(v=>{v.includes("UNAVAILABLE")||_a([a],P[v],hs[P[v]]?hs[P[v]](this):hs.default(this,P[v]))}))}unregisterMediaStateReceiver(a){let o=this.mediaStateReceivers,m=o.indexOf(a);m<0||o.splice(m,1)}enableHotkeys(){this.addEventListener("keydown",cn(this,al,Su))}disableHotkeys(){this.removeEventListener("keydown",cn(this,al,Su)),this.removeEventListener("keyup",cn(this,hn,gs))}get hotkeys(){return Ta(this,qr)}keyboardShortcutHandler(a){var o,m,v,g;if(((g=(v=(o=a.target.getAttribute("keysused"))==null?void 0:o.split(" "))!=null?v:(m=a.target)==null?void 0:m.keysUsed)!=null?g:[]).map(se=>se==="Space"?" ":se).filter(Boolean).includes(a.key))return;let M,B,U,z,ie,ee=cy;if(!Ta(this,qr).contains(`no${a.key.toLowerCase()}`)&&!(a.key===" "&&Ta(this,qr).contains("nospace")))switch(a.key){case" ":case"k":M=this.getAttribute(P.MEDIA_PAUSED)!=null?ve.MEDIA_PLAY_REQUEST:ve.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"m":M=this.getAttribute(P.MEDIA_VOLUME_LEVEL)==="off"?ve.MEDIA_UNMUTE_REQUEST:ve.MEDIA_MUTE_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"f":M=this.getAttribute(P.MEDIA_IS_FULLSCREEN)!=null?ve.MEDIA_EXIT_FULLSCREEN_REQUEST:ve.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"c":ba(this);break;case"ArrowLeft":B=this.getAttribute(P.MEDIA_CURRENT_TIME),U=B&&!Number.isNaN(+B)?+B:Df,z=Math.max(U-ee,0),ie=new q.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:z}),this.dispatchEvent(ie);break;case"ArrowRight":B=this.getAttribute(P.MEDIA_CURRENT_TIME),U=B&&!Number.isNaN(+B)?+B:Df,z=Math.max(U+ee,0),ie=new q.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:z}),this.dispatchEvent(ie);break;default:break}}};qr=new WeakMap;fs=new WeakMap;hn=new WeakSet;gs=function(n){let{key:a}=n;if(!xf.includes(a)){this.removeEventListener("keyup",cn(this,hn,gs));return}this.keyboardShortcutHandler(n)};al=new WeakSet;Su=function(n){let{metaKey:a,altKey:o,key:m}=n;if(a||o||!xf.includes(m)){this.removeEventListener("keyup",cn(this,hn,gs));return}[" ","ArrowLeft","ArrowRight"].includes(m)&&!(Ta(this,qr).contains(`no${m.toLowerCase()}`)||m===" "&&Ta(this,qr).contains("nospace"))&&n.preventDefault(),this.addEventListener("keyup",cn(this,hn,gs),{once:!0})};var hs={default(n,a){return n.getAttribute(a)},[P.MEDIA_CAPTIONS_LIST](n){return ji(nl(n))||void 0},[P.MEDIA_SUBTITLES_LIST](n){return ji(ps(n))||void 0},[P.MEDIA_SUBTITLES_LIST](n){return ji(ps(n))||void 0},[P.MEDIA_CAPTIONS_SHOWING](n){return ji(ku(n))||void 0},[P.MEDIA_PAUSED](n){return Pf(n)},[P.MEDIA_MUTED](n){return Of(n)},[P.MEDIA_VOLUME](n){return Nf(n)},[P.MEDIA_VOLUME_LEVEL](n){return Ff(n)},[P.MEDIA_CURRENT_TIME](n){return Uf(n)},[P.MEDIA_DURATION](n){return Bf(n)},[P.MEDIA_SEEKABLE](n){var a;return(a=Hf(n))==null?void 0:a.join(":")},[P.MEDIA_PLAYBACK_RATE](n){return Gf(n)},[P.MEDIA_STREAM_TYPE](n){return wu(n)},[P.MEDIA_TARGET_LIVE_WINDOW](n){return hy(n)},[P.MEDIA_TIME_IS_LIVE](n){let a=n.media;if(!a)return!1;if(typeof a.liveEdgeStart=="number")return Number.isNaN(a.liveEdgeStart)?!1:a.currentTime>=a.liveEdgeStart;if(!(wu(n)==="live"))return!1;let m=a.seekable;if(!m)return!0;if(!m.length)return!1;let v=n.hasAttribute("liveedgeoffset")?Number(n.getAttribute("liveedgeoffset")):10,g=m.end(m.length-1)-v;return a.currentTime>=g}},Pf=n=>n.media?n.media.paused:!0,Of=n=>!!(n.media&&n.media.muted),Nf=n=>{let a=n.media;return a?a.volume:1},Ff=n=>{let a="high";if(!n.media)return a;let{muted:o,volume:m}=n.media;return m===0||o?a="off":m<.5?a="low":m<.75&&(a="medium"),a},Uf=n=>{let a=n.media;return a?a.currentTime:0},Bf=n=>{let a=n==null?void 0:n.media;return Number.isFinite(a==null?void 0:a.duration)?a.duration:NaN},Hf=n=>{var a;let o=n==null?void 0:n.media;if(!((a=o==null?void 0:o.seekable)!=null&&a.length))return;let m=o.seekable.start(0),v=o.seekable.end(o.seekable.length-1);if(!(!m&&!v))return[Number(m.toFixed(3)),Number(v.toFixed(3))]},Gf=n=>{let a=n.media;return a?a.playbackRate:1},ps=n=>un(n.media,{kind:sn.SUBTITLES}),nl=n=>un(n.media,{kind:sn.CAPTIONS}),Cf=n=>un(n.media,{kind:sn.SUBTITLES,mode:ga.SHOWING}),ku=n=>un(n.media,{kind:sn.CAPTIONS,mode:ga.SHOWING}),wu=n=>{let{media:a}=n;if(!a)return;let{streamType:o}=a;if(uy.includes(o)){if(o===$i.UNKNOWN){let v=n.getAttribute("default-stream-type");return[$i.LIVE,$i.ON_DEMAND].includes(v)?v:void 0}return o}let m=a.duration;if(m===1/0)return $i.LIVE;if(Number.isFinite(m))return $i.ON_DEMAND;{let v=n.getAttribute("default-stream-type");if([$i.LIVE,$i.ON_DEMAND].includes(v))return v}},hy=n=>{let{media:a}=n;if(!a)return Number.NaN;let{targetLiveWindow:o}=a;return(o==null||Number.isNaN(o))&&wu(n)===$i.LIVE?0:o},fy=Object.values(P),Vf=n=>{var a,o,m,v;let{observedAttributes:g}=n.constructor;!g&&((a=n.nodeName)==null?void 0:a.includes("-"))&&(q.customElements.upgrade(n),{observedAttributes:g}=n.constructor);let L=(v=(m=(o=n==null?void 0:n.getAttribute)==null?void 0:o.call(n,Oe.MEDIA_CHROME_ATTRIBUTES))==null?void 0:m.split)==null?void 0:v.call(m,/\s+/);return Array.isArray(g||L)?(g||L).filter(M=>fy.includes(M)):[]},Lu=n=>!!Vf(n).length,my=async(n,a,o)=>(n.isConnected||await Kf(0),o==null?n.removeAttribute(a):typeof o=="boolean"?o?n.setAttribute(a,""):n.removeAttribute(a):Number.isNaN(o)?n.removeAttribute(a):n.setAttribute(a,o)),py=n=>{var a;return!!((a=n.closest)!=null&&a.call(n,'*[slot="media"]'))},ms=(n,a)=>{if(py(n))return;let o=(v,g)=>{var L,M;Lu(v)&&g(v);let{children:B=[]}=v!=null?v:{},U=(M=(L=v==null?void 0:v.shadowRoot)==null?void 0:L.children)!=null?M:[];[...B,...U].forEach(ie=>ms(ie,g))},m=n==null?void 0:n.nodeName.toLowerCase();if(m.includes("-")&&!Lu(n)){q.customElements.whenDefined(m).then(()=>{o(n,a)});return}o(n,a)},_a=(n,a,o)=>{n.forEach(m=>{!Vf(m).includes(a)||my(m,a,o)})},vy=(n,a,o)=>{ms(n,a);let m=B=>{var U;let z=(U=B==null?void 0:B.composedPath()[0])!=null?U:B.target;a(z)},v=B=>{var U;let z=(U=B==null?void 0:B.composedPath()[0])!=null?U:B.target;o(z)};n.addEventListener(ve.REGISTER_MEDIA_STATE_RECEIVER,m),n.addEventListener(ve.UNREGISTER_MEDIA_STATE_RECEIVER,v);let g=B=>{B.forEach(U=>{let{addedNodes:z=[],removedNodes:ie=[],type:ee,target:se,attributeName:fe}=U;ee==="childList"?(Array.prototype.forEach.call(z,_e=>ms(_e,a)),Array.prototype.forEach.call(ie,_e=>ms(_e,o))):ee==="attributes"&&fe===Oe.MEDIA_CHROME_ATTRIBUTES&&(Lu(se)?a(se):o(se))})},L=new MutationObserver(g);return L.observe(n,{childList:!0,attributes:!0,subtree:!0}),()=>{ms(n,o),L.disconnect(),n.removeEventListener(ve.REGISTER_MEDIA_STATE_RECEIVER,m),n.removeEventListener(ve.UNREGISTER_MEDIA_STATE_RECEIVER,v)}},rl,Ru=()=>{var n,a;return rl||(rl=(a=(n=re)==null?void 0:n.createElement)==null?void 0:a.call(n,"video"),rl)},gy=async(n=Ru())=>{if(!n)return!1;let a=n.volume;return n.volume=a/2+.1,await Kf(0),n.volume!==a},Kf=n=>new Promise(a=>setTimeout(a,n)),yy=(n=Ru())=>typeof(n==null?void 0:n.requestPictureInPicture)=="function",Ey=yy(),vs,by=gy().then(n=>(vs=n,vs)),_y=!!q.WebKitPlaybackTargetAvailabilityEvent,Ty=!!q.chrome,Ay=(n=Ru())=>{let a=re[Ut.enabled];return!a&&n&&(a="webkitSupportsFullscreen"in n),a},Mf=Ay(),Sy=Object.freeze({length:0,start(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});function ky(n=Sy){return Array.from(n).map((a,o)=>[Number(n.start(o).toFixed(3)),Number(n.end(o).toFixed(3))].join(":")).join(" ")}q.customElements.get("media-controller")||q.customElements.define("media-controller",sl);var ys=sl;var qf=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},Ar=(n,a,o)=>(qf(n,a,"read from private field"),o?o.call(n):a.get(n)),ol=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},Es=(n,a,o,m)=>(qf(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),ll,or,dl,ul,Yf=re.createElement("template"),Wf=`
|
|
236
|
+
`;var ly=Object.values(U),dy="sm:384 md:576 lg:768 xl:960",uy=n=>{var a;for(let l of n){let m=l.target;if(!m.isConnected)continue;let v=(a=m.getAttribute("breakpoints"))!=null?a:dy,E=cy(v),I=hy(E,l.contentRect);Object.keys(E).forEach(M=>{if(I.includes(M)){m.hasAttribute(`breakpoint-${M}`)||m.setAttribute(`breakpoint-${M}`,"");return}m.removeAttribute(`breakpoint-${M}`)})}};function cy(n){let a=n.split(/\s+/);return Object.fromEntries(a.map(l=>l.split(":")))}function hy(n,a){return Object.keys(n).filter(l=>a.width>=n[l])}var sl=class extends W.HTMLElement{constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Of.content.cloneNode(!0)));let a=I=>{let M=this.media;for(let B of I)B.type==="childList"&&(B.removedNodes.forEach(F=>{if(F.slot=="media"&&B.target==this){let Q=B.previousSibling&&B.previousSibling.previousElementSibling;if(!Q||!M)this.mediaUnsetCallback(F);else{let re=Q.slot!=="media";for(;(Q=Q.previousSibling)!==null;)Q.slot=="media"&&(re=!1);re&&this.mediaUnsetCallback(F)}}}),M&&B.addedNodes.forEach(F=>{F==M&&this.handleMediaUpdated(M).then(Q=>this.mediaSetCallback(Q))}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0});let m=new ResizeObserver(uy);this.resizeObserver=m,m.observe(this);let v=this.media,E=this.querySelector(":scope > slot[slot=media]");E&&E.addEventListener("slotchange",()=>{if(!E.assignedElements({flatten:!0}).length){this.mediaUnsetCallback(v);return}this.media&&(v=this.media,this.handleMediaUpdated(this.media).then(M=>this.mediaSetCallback(M)))})}static get observedAttributes(){return["autohide","gestures-disabled"].concat(ly)}attributeChangedCallback(a,l,m){a.toLowerCase()=="autohide"&&(this.autohide=m)}get media(){let a=this.querySelector(":scope > [slot=media]");return(a==null?void 0:a.nodeName)=="SLOT"&&(a=a.assignedElements({flatten:!0})[0]),a}mediaSetCallback(a){this._mediaClickPlayToggle=()=>{let l=a.paused?ve.MEDIA_PLAY_REQUEST:ve.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new W.CustomEvent(l,{composed:!0,bubbles:!0}))}}handleMediaUpdated(a){let l=E=>Promise.resolve(E),m=E=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',E),Promise.reject(E));if(!a)return m(a);let v=a.nodeName.toLowerCase();return v.includes("-")?W.customElements.whenDefined(v).then(()=>l(a)):l(a)}mediaUnsetCallback(a){}connectedCallback(){let l=this.getAttribute("audio")!=null?Jt.AUDIO_PLAYER():Jt.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",l),this.media&&this.handleMediaUpdated(this.media).then(I=>this.mediaSetCallback(I)),this.setAttribute("user-inactive","user-inactive");let m=()=>{if(this.autohide<0||this.hasAttribute("user-inactive"))return;this.setAttribute("user-inactive","");let I=new W.CustomEvent(ms.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(I)},v=()=>{if(!this.hasAttribute("user-inactive"))return;this.removeAttribute("user-inactive");let I=new W.CustomEvent(ms.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(I)},E=()=>{v(),W.clearTimeout(this._inactiveTimeout),!(this.autohide<0)&&(this._inactiveTimeout=W.setTimeout(()=>{m()},this.autohide*1e3))};this.addEventListener("keyup",()=>{E()}),this.addEventListener("pointerup",I=>{I.pointerType==="touch"?[this,this.media].includes(I.target)&&!this.hasAttribute("user-inactive")?m():E():I.composedPath().some(M=>{var B;return["media-play-button","media-fullscreen-button"].includes((B=M==null?void 0:M.nodeName)==null?void 0:B.toLowerCase())})&&E()}),this.addEventListener("pointermove",I=>{I.pointerType==="mouse"&&I.target!==this&&(v(),W.clearTimeout(this._inactiveTimeout),[this,this.media].includes(I.target)&&E())}),this.addEventListener("mouseleave",()=>{m()}),this.addEventListener("keyup",()=>{this.setAttribute("media-keyboard-control","")}),W.addEventListener("mouseup",()=>{this.removeAttribute("media-keyboard-control")})}set autohide(a){a=Number(a),this._autohide=isNaN(a)?0:a}get autohide(){return this._autohide===void 0?2:this._autohide}};W.customElements.get("media-container-temp")||W.customElements.define("media-container-temp",sl);var Nf=sl;var Ff=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},ei=(n,a,l)=>(Ff(n,a,"read from private field"),l?l.call(n):a.get(n)),ku=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},wu=(n,a,l,m)=>(Ff(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),un,cn,wi,ol=class{constructor(a,l){ku(this,un,void 0),ku(this,cn,void 0),ku(this,wi,new Set),wu(this,un,a),wu(this,cn,l)}[Symbol.iterator](){return ei(this,wi).values()}get length(){return ei(this,wi).size}get value(){var a;return(a=[...ei(this,wi)].join(" "))!=null?a:""}set value(a){var l;a!==this.value&&(wu(this,wi,new Set),this.add(...(l=a==null?void 0:a.split(" "))!=null?l:[]))}toString(){return this.value}item(a){return[...ei(this,wi)][a]}values(){return ei(this,wi).values()}keys(){return ei(this,wi).keys()}forEach(a){ei(this,wi).forEach(a)}add(...a){var l,m;a.forEach(v=>ei(this,wi).add(v)),!(this.value===""&&!((l=ei(this,un))!=null&&l.hasAttribute(`${ei(this,cn)}`)))&&((m=ei(this,un))==null||m.setAttribute(`${ei(this,cn)}`,`${this.value}`))}remove(...a){var l;a.forEach(m=>ei(this,wi).delete(m)),(l=ei(this,un))==null||l.setAttribute(`${ei(this,cn)}`,`${this.value}`)}contains(a){return ei(this,wi).has(a)}toggle(a,l){return typeof l!="undefined"?l?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,l){this.remove(a),this.add(l)}};un=new WeakMap;cn=new WeakMap;wi=new WeakMap;var Lu=(n="")=>n.split(/\s+/),Uf=(n="")=>{let[a,l]=n.split(":"),m=l?decodeURIComponent(l):void 0;return{language:a,label:m}},vs=(n="",a={})=>Lu(n).map(l=>{let m=Uf(l);return{...a,...m}}),fy=n=>Array.isArray(n)?n.map(a=>typeof a=="string"?Uf(a):a):typeof n=="string"?vs(n):[n],Iu=({label:n,language:a}={})=>n?`${a}:${encodeURIComponent(n)}`:a,gs=(n=[])=>Array.prototype.map.call(n,Iu).join(" "),my=(n,a)=>l=>l[n]===a,Bf=n=>{let a=Object.entries(n).map(([l,m])=>my(l,m));return l=>a.every(m=>m(l))},ys=(n,a=[],l=[])=>{let m=fy(l).map(Bf),v=E=>m.some(I=>I(E));Array.from(a).filter(v).forEach(E=>{E.mode=n})},hn=(n,a=()=>!0)=>{if(!(n!=null&&n.textTracks))return[];let l=typeof a=="function"?a:Bf(a);return Array.from(n.textTracks).filter(l)},Ru=n=>{let a=!!n.getAttribute(U.MEDIA_CAPTIONS_SHOWING),l=!n.hasAttribute("no-subtitles-fallback")&&!!n.getAttribute(U.MEDIA_SUBTITLES_SHOWING);return a||l},Da=(n,a=!1)=>{var l,m,v,E;if(Ru(n)){let M=n.getAttribute(U.MEDIA_CAPTIONS_SHOWING);if(M){let F=new window.CustomEvent(ve.MEDIA_DISABLE_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:M});n.dispatchEvent(F)}let B=n.getAttribute(U.MEDIA_SUBTITLES_SHOWING);if(B&&!n.hasAttribute("no-subtitles-fallback")){let F=new window.CustomEvent(ve.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:B});n.dispatchEvent(F)}}else if(!a){let[M]=(m=Lu((l=n.getAttribute(U.MEDIA_CAPTIONS_LIST))!=null?l:""))!=null?m:[];if(M){let B=new window.CustomEvent(ve.MEDIA_SHOW_CAPTIONS_REQUEST,{composed:!0,bubbles:!0,detail:M});n.dispatchEvent(B)}else if(n.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[B]=(E=Lu((v=n.getAttribute(U.MEDIA_SUBTITLES_LIST))!=null?v:""))!=null?E:[];if(B){let F=new window.CustomEvent(ve.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:B});n.dispatchEvent(F)}}}};var Vt={enter:"requestFullscreen",exit:"exitFullscreen",event:"fullscreenchange",element:"fullscreenElement",error:"fullscreenerror",enabled:"fullscreenEnabled"};ie.fullscreenElement===void 0&&(Vt.enter="webkitRequestFullScreen",Vt.exit=ie.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",Vt.event="webkitfullscreenchange",Vt.element="webkitFullscreenElement",Vt.error="webkitfullscreenerror",Vt.enabled="webkitFullscreenEnabled");var ll,Du=()=>{var n,a;return ll||(ll=(a=(n=ie)==null?void 0:n.createElement)==null?void 0:a.call(n,"video"),ll)},Hf=async(n=Du())=>{if(!n)return!1;let a=n.volume;return n.volume=a/2+.1,await Qo(0),n.volume!==a},py=(n=Du())=>typeof(n==null?void 0:n.requestPictureInPicture)=="function",vy=(n=Du())=>{let a=ie[Vt.enabled];return!a&&n&&(a="webkitSupportsFullscreen"in n),a},Cu=vy(),Gf=py(),Vf=!!W.WebKitPlaybackTargetAvailabilityEvent,Kf=!!W.chrome;var dl,Wf=Hf().then(n=>(dl=n,dl)),gy=Object.values(Yi),Mu=n=>hn(n.media,{kind:ln.SUBTITLES}),xu=n=>hn(n.media,{kind:ln.CAPTIONS}),yy=n=>hn(n.media,{kind:ln.SUBTITLES,mode:La.SHOWING}),Ey=n=>hn(n.media,{kind:ln.CAPTIONS,mode:La.SHOWING}),vi={MEDIA_PAUSED:{get:function(n){let{media:a}=n;return a?a.paused:!0},mediaEvents:["play","pause","emptied"]},MEDIA_HAS_PLAYED:{get:function(n){let{media:a}=n;return a?!a.paused:!1},mediaEvents:["playing","emptied"]},MEDIA_PLAYBACK_RATE:{get:function(n){let{media:a}=n;return!a||typeof a.playbackRate=="undefined"?1:a.playbackRate},mediaEvents:["ratechange","loadstart"]},MEDIA_MUTED:{get:function(n){let{media:a}=n;return!a||typeof a.muted=="undefined"?!1:a.muted},mediaEvents:["volumechange"]},MEDIA_VOLUME:{get:function(n){let{media:a}=n;return!a||typeof a.volume=="undefined"?1:Number(a.volume)},mediaEvents:["volumechange"]},MEDIA_VOLUME_LEVEL:{get:function(n){let{media:a}=n,l="high";if(!a||typeof a.volume=="undefined")return l;let{muted:m,volume:v}=a;return v===0||m?l="off":v<.5?l="low":v<.75&&(l="medium"),l},mediaEvents:["volumechange"]},MEDIA_CURRENT_TIME:{get:function(n){let{media:a}=n;return!a||typeof a.currentTime=="undefined"?0:a.currentTime},mediaEvents:["timeupdate","loadedmetadata"]},MEDIA_DURATION:{get:function(n){let{media:a}=n;return!a||!Number.isFinite(a.duration)?NaN:a.duration},mediaEvents:["durationchange","loadedmetadata","emptied"]},MEDIA_SEEKABLE:{get:function(n){var a;let{media:l}=n;if(!((a=l==null?void 0:l.seekable)!=null&&a.length))return;let m=l.seekable.start(0),v=l.seekable.end(l.seekable.length-1);if(!(!m&&!v))return[Number(m.toFixed(3)),Number(v.toFixed(3))].join(":")},mediaEvents:["loadedmetadata","emptied","progress"]},MEDIA_LOADING:{get:function(n){var a;return((a=n.media)==null?void 0:a.readyState)<3},mediaEvents:["waiting","playing","emptied"]},MEDIA_BUFFERED:{get:function(n){var a;kf((a=n.media)==null?void 0:a.buffered)},mediaEvents:["progress","emptied"]},MEDIA_STREAM_TYPE:{get:function(n){let{media:a}=n;if(!a)return;let{streamType:l}=a;if(gy.includes(l)){if(l===Yi.UNKNOWN){let v=n.getAttribute("default-stream-type");return[Yi.LIVE,Yi.ON_DEMAND].includes(v)?v:void 0}return l}let m=a.duration;if(m===1/0)return Yi.LIVE;if(Number.isFinite(m))return Yi.ON_DEMAND;{let v=n.getAttribute("default-stream-type");if([Yi.LIVE,Yi.ON_DEMAND].includes(v))return v}},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},MEDIA_TARGET_LIVE_WINDOW:{get:function(n){let{media:a}=n;if(!a)return Number.NaN;let{targetLiveWindow:l}=a,m=vi.MEDIA_STREAM_TYPE.get(n);return(l==null||Number.isNaN(l))&&m===Yi.LIVE?0:l},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},MEDIA_TIME_IS_LIVE:{get:function(n){let{media:a}=n;if(!a)return!1;if(typeof a.liveEdgeStart=="number")return Number.isNaN(a.liveEdgeStart)?!1:a.currentTime>=a.liveEdgeStart;if(!(vi.MEDIA_STREAM_TYPE.get(n)==="live"))return!1;let m=a.seekable;if(!m)return!0;if(!m.length)return!1;let v=n.hasAttribute("liveedgeoffset")?Number(n.getAttribute("liveedgeoffset")):10,E=m.end(m.length-1)-v;return a.currentTime>=E},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},MEDIA_IS_FULLSCREEN:{get:function(n,a){let m=!!ie[Vt.element]&&(a==null?void 0:a.target);return ps(n.fullscreenElement,m)},rootEvents:[Vt.event]},MEDIA_IS_PIP:{get:function(n,a){var l;let m=n.media;if(!m)return!1;if(a)return a.type=="enterpictureinpicture";{let v=(l=n.getRootNode().pictureInPictureElement)!=null?l:ie.pictureInPictureElement;return ps(m,v)}},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},MEDIA_IS_CASTING:{get:function(n,a){var l;let{media:m}=n;if(!m)return!1;let v=(l=globalThis.CastableVideoElement)==null?void 0:l.castElement,E=ps(m,v);return(a==null?void 0:a.type)==="castchange"&&(a==null?void 0:a.detail)==="CONNECTING"&&(E="connecting"),E},mediaEvents:["entercast","leavecast","castchange"]},MEDIA_AIRPLAY_UNAVAILABLE:{get:function(n,a){if(!Vf)return Tr.UNSUPPORTED;if(!!a&&a.availability!=="available"&&a.availability==="not-available")return Tr.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"]},MEDIA_CAST_UNAVAILABLE:{get:function(){var n;let a=(n=globalThis.CastableVideoElement)==null?void 0:n.castState;if(!Kf||!a)return Tr.UNSUPPORTED;if(!a.includes("CONNECT"))return Tr.UNAVAILABLE},mediaEvents:["castchange"]},MEDIA_FULLSCREEN_UNAVAILABLE:{get:function(){return Cu?void 0:Tr.UNAVAILABLE}},MEDIA_PIP_UNAVAILABLE:{get:function(){return Gf?void 0:Tr.UNSUPPORTED}},MEDIA_VOLUME_UNAVAILABLE:{get:function(n){if(dl!==void 0&&!dl)return Tr.UNSUPPORTED;let{media:a}=n;if(a&&typeof a.volume=="undefined")return Tr.UNAVAILABLE},mediaEvents:["loadstart"]},MEDIA_CAPTIONS_LIST:{get:function(n){return gs(xu(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack"]},MEDIA_SUBTITLES_LIST:{get:function(n){return gs(Mu(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack"]},MEDIA_CAPTIONS_SHOWING:{get:function(n){return gs(Ey(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack","change"]},MEDIA_SUBTITLES_SHOWING:{get:function(n){return gs(yy(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack","change"]}},ul={MEDIA_PLAY_REQUEST:(n,a,l)=>{let m=vi.MEDIA_STREAM_TYPE.get(l),v=l.getAttribute("noautoseektolive")===null;m==Yi.LIVE&&v&&ul.MEDIA_SEEK_TO_LIVE_REQUEST(n),n.play().catch(()=>{})},MEDIA_PAUSE_REQUEST:n=>n.pause(),MEDIA_MUTE_REQUEST:n=>n.muted=!0,MEDIA_UNMUTE_REQUEST:n=>{n.muted=!1,n.volume===0&&(n.volume=.25)},MEDIA_VOLUME_REQUEST:(n,a,l)=>{let m=a.detail;if(n.volume=m,m>0&&n.muted&&(n.muted=!1),!l.hasAttribute("novolumepref"))try{W.localStorage.setItem("media-chrome-pref-volume",m.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:(n,a,l)=>{if(!Cu){console.warn("Fullscreen support is unavailable; not entering fullscreen");return}ie.pictureInPictureElement&&ie.exitPictureInPicture(),l[Vt.enter]?l.fullscreenElement[Vt.enter]():n.webkitEnterFullscreen?n.webkitEnterFullscreen():n.requestFullscreen?n.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{ie[Vt.exit]()},MEDIA_ENTER_PIP_REQUEST:n=>{if(!ie.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!n.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}ie[Vt.element]&&ie[Vt.exit]();let a=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};n.requestPictureInPicture().catch(l=>{if(l.code===11)if(n.readyState===0&&n.preload==="none"){let m=()=>{n.removeEventListener("loadedmetadata",v),n.preload="none"},v=()=>{n.requestPictureInPicture().catch(a),m()};n.addEventListener("loadedmetadata",v),n.preload="metadata",setTimeout(()=>{n.readyState===0&&a(),m()},1e3)}else throw l;else throw l})},MEDIA_EXIT_PIP_REQUEST:()=>{ie.pictureInPictureElement&&ie.exitPictureInPicture()},MEDIA_ENTER_CAST_REQUEST:n=>{var a;!((a=globalThis.CastableVideoElement)!=null&&a.castEnabled)||(ie[Vt.element]&&ie[Vt.exit](),n.requestCast())},MEDIA_EXIT_CAST_REQUEST:async()=>{var n;(n=globalThis.CastableVideoElement)!=null&&n.castElement&&globalThis.CastableVideoElement.exitCast()},MEDIA_SEEK_REQUEST:(n,a)=>{let l=a.detail;(n.readyState>0||n.readyState===void 0)&&(n.currentTime=l)},MEDIA_PLAYBACK_RATE_REQUEST:(n,a)=>{n.playbackRate=a.detail},MEDIA_PREVIEW_REQUEST:(n,a,l)=>{var m;if(!n)return;let v=a.detail;v===null&&l.propagateMediaState(U.MEDIA_PREVIEW_TIME,void 0),l.propagateMediaState(U.MEDIA_PREVIEW_TIME,v);let[E]=hn(n,{kind:ln.METADATA,label:"thumbnails"});if(!(E&&E.cues))return;if(v===null){l.propagateMediaState(U.MEDIA_PREVIEW_IMAGE,void 0),l.propagateMediaState(U.MEDIA_PREVIEW_COORDS,void 0);return}let I=Array.prototype.find.call(E.cues,Q=>Q.startTime>=v);if(!I)return;let M=/'^(?:[a-z]+:)?\/\//i.test(I.text)||(m=n.querySelector('track[label="thumbnails"]'))==null?void 0:m.src,B=new URL(I.text,M),F=new URLSearchParams(B.hash).get("#xywh");l.propagateMediaState(U.MEDIA_PREVIEW_IMAGE,B.href),l.propagateMediaState(U.MEDIA_PREVIEW_COORDS,F.split(",").join(" "))},MEDIA_SHOW_CAPTIONS_REQUEST:(n,a,l)=>{let m=xu(l),{detail:v=[]}=a;ys(La.SHOWING,m,v)},MEDIA_DISABLE_CAPTIONS_REQUEST:(n,a,l)=>{let m=xu(l),{detail:v=[]}=a;ys(La.DISABLED,m,v)},MEDIA_SHOW_SUBTITLES_REQUEST:(n,a,l)=>{let m=Mu(l),{detail:v=[]}=a;ys(La.SHOWING,m,v)},MEDIA_DISABLE_SUBTITLES_REQUEST:(n,a,l)=>{let m=Mu(l),{detail:v=[]}=a;ys(La.DISABLED,m,v)},MEDIA_AIRPLAY_REQUEST:n=>{if(!!n){if(!(n.webkitShowPlaybackTargetPicker&&W.WebKitPlaybackTargetAvailabilityEvent)){console.warn("received a request to select AirPlay but AirPlay is not supported in this environment");return}n.webkitShowPlaybackTargetPicker()}},MEDIA_SEEK_TO_LIVE_REQUEST:n=>{let a=n.seekable;if(!a){console.warn("MediaController: Media element does not support seeking to live.");return}if(!a.length){console.warn("MediaController: Media is unable to seek to live.");return}n.currentTime=a.end(a.length-1)}};var Nu=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Ca=(n,a,l)=>(Nu(n,a,"read from private field"),l?l.call(n):a.get(n)),cl=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},qf=(n,a,l,m)=>(Nu(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),fn=(n,a,l)=>(Nu(n,a,"access private method"),l),qr,Es,mn,_s,hl,Pu,jf=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],by=10,Yf=0,fl=class extends Nf{constructor(){super(),cl(this,mn),cl(this,hl),cl(this,qr,new ol(this,"hotkeys")),cl(this,Es,void 0),vi.MEDIA_VOLUME_UNAVAILABLE.get(this)===void 0&&Wf.then(()=>{this.propagateMediaState(U.MEDIA_VOLUME_UNAVAILABLE,vi.MEDIA_VOLUME_UNAVAILABLE.get(this))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associateElement(this),Object.keys(ul).forEach(a=>{let l=`_handle${jo(a,!0)}`;this[l]=m=>{if(m.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}ul[a](this.media,m,this)},this.addEventListener(ve[a],this[l])}),this._mediaStatePropagators={},Object.keys(vi).forEach(a=>{this._mediaStatePropagators[a]=l=>{this.propagateMediaState(U[a],vi[a].get(this,l))}}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat("nohotkeys","hotkeys","default-stream-type")}get fullscreenElement(){var a;return(a=Ca(this,Es))!=null?a:this}set fullscreenElement(a){this.hasAttribute("fullscreen-element")&&this.removeAttribute("fullscreen-element"),qf(this,Es,a)}attributeChangedCallback(a,l,m){var v;if(a==="nohotkeys")m!==l&&m===""?(this.hasAttribute("hotkeys")&&console.warn("Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):m!==l&&m===null&&this.enableHotkeys();else if(a==="hotkeys")Ca(this,qr).value=m;else if(a==="default-stream-type")this.propagateMediaState(U.MEDIA_STREAM_TYPE);else if(a==="fullscreen-element"){let E=m?(v=this.getRootNode())==null?void 0:v.getElementById(m):void 0;qf(this,Es,E)}super.attributeChangedCallback(a,l,m)}mediaSetCallback(a){if(super.mediaSetCallback(a),a.hasAttribute("tabindex")||a.setAttribute("tabindex",-1),Object.keys(vi).forEach(l=>{let{mediaEvents:m,rootEvents:v,trackListEvents:E}=vi[l],I=this._mediaStatePropagators[l];m==null||m.forEach(M=>{a.addEventListener(M,I)}),v==null||v.forEach(M=>{this.getRootNode().addEventListener(M,I)}),E==null||E.forEach(M=>{var B;(B=a.textTracks)==null||B.addEventListener(M,I)})}),!this.hasAttribute("novolumepref"))try{let l=W.localStorage.getItem("media-chrome-pref-volume");l!==null&&(a.volume=l)}catch(l){console.debug("Error getting volume pref",l)}}mediaUnsetCallback(a){super.mediaUnsetCallback(a),Object.keys(vi).forEach(l=>{let{mediaEvents:m,rootEvents:v,trackListEvents:E}=vi[l],I=this._mediaStatePropagators[l];m==null||m.forEach(M=>{a.removeEventListener(M,I)}),v==null||v.forEach(M=>{this.getRootNode().removeEventListener(M,I)}),E==null||E.forEach(M=>{var B;(B=a.textTracks)==null||B.removeEventListener(M,I)})}),this.propagateMediaState(U.MEDIA_PAUSED,!0)}propagateMediaState(a,l){let m=this.getAttribute(a);if($f(this.mediaStateReceivers,a,l),m===this.getAttribute(a))return;let v=new W.CustomEvent(_f[a],{composed:!0,bubbles:!0,detail:l});this.dispatchEvent(v)}associateElement(a){if(!a)return;let{associatedElementSubscriptions:l}=this;if(l.has(a))return;let m=this.registerMediaStateReceiver.bind(this),v=this.unregisterMediaStateReceiver.bind(this),E=Sy(a,m,v);Object.keys(ve).forEach(I=>{a.addEventListener(ve[I],this[`_handle${jo(I,!0)}`])}),l.set(a,E)}unassociateElement(a){if(!a)return;let{associatedElementSubscriptions:l}=this;if(!l.has(a))return;l.get(a)(),l.delete(a),Object.keys(ve).forEach(v=>{a.removeEventListener(ve[v],this[`_handle${jo(v,!0)}`])})}registerMediaStateReceiver(a){if(!a)return;let l=this.mediaStateReceivers;l.indexOf(a)>-1||(l.push(a),Object.keys(vi).forEach(v=>{let E=vi[v];$f([a],U[v],E.get(this))}))}unregisterMediaStateReceiver(a){let l=this.mediaStateReceivers,m=l.indexOf(a);m<0||l.splice(m,1)}enableHotkeys(){this.addEventListener("keydown",fn(this,hl,Pu))}disableHotkeys(){this.removeEventListener("keydown",fn(this,hl,Pu)),this.removeEventListener("keyup",fn(this,mn,_s))}get hotkeys(){return Ca(this,qr)}keyboardShortcutHandler(a){var l,m,v,E;if(((E=(v=(l=a.target.getAttribute("keysused"))==null?void 0:l.split(" "))!=null?v:(m=a.target)==null?void 0:m.keysUsed)!=null?E:[]).map(se=>se==="Space"?" ":se).filter(Boolean).includes(a.key))return;let M,B,F,Q,re,te=by;if(!Ca(this,qr).contains(`no${a.key.toLowerCase()}`)&&!(a.key===" "&&Ca(this,qr).contains("nospace")))switch(a.key){case" ":case"k":M=this.getAttribute(U.MEDIA_PAUSED)!=null?ve.MEDIA_PLAY_REQUEST:ve.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new W.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"m":M=this.getAttribute(U.MEDIA_VOLUME_LEVEL)==="off"?ve.MEDIA_UNMUTE_REQUEST:ve.MEDIA_MUTE_REQUEST,this.dispatchEvent(new W.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"f":M=this.getAttribute(U.MEDIA_IS_FULLSCREEN)!=null?ve.MEDIA_EXIT_FULLSCREEN_REQUEST:ve.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new W.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"c":Da(this);break;case"ArrowLeft":B=this.getAttribute(U.MEDIA_CURRENT_TIME),F=B&&!Number.isNaN(+B)?+B:Yf,Q=Math.max(F-te,0),re=new W.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:Q}),this.dispatchEvent(re);break;case"ArrowRight":B=this.getAttribute(U.MEDIA_CURRENT_TIME),F=B&&!Number.isNaN(+B)?+B:Yf,Q=Math.max(F+te,0),re=new W.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:Q}),this.dispatchEvent(re);break;default:break}}};qr=new WeakMap;Es=new WeakMap;mn=new WeakSet;_s=function(n){let{key:a}=n;if(!jf.includes(a)){this.removeEventListener("keyup",fn(this,mn,_s));return}this.keyboardShortcutHandler(n)};hl=new WeakSet;Pu=function(n){let{metaKey:a,altKey:l,key:m}=n;if(a||l||!jf.includes(m)){this.removeEventListener("keyup",fn(this,mn,_s));return}[" ","ArrowLeft","ArrowRight"].includes(m)&&!(Ca(this,qr).contains(`no${m.toLowerCase()}`)||m===" "&&Ca(this,qr).contains("nospace"))&&n.preventDefault(),this.addEventListener("keyup",fn(this,mn,_s),{once:!0})};var _y=Object.values(U),zf=n=>{var a,l,m,v;let{observedAttributes:E}=n.constructor;!E&&((a=n.nodeName)==null?void 0:a.includes("-"))&&(W.customElements.upgrade(n),{observedAttributes:E}=n.constructor);let I=(v=(m=(l=n==null?void 0:n.getAttribute)==null?void 0:l.call(n,Pe.MEDIA_CHROME_ATTRIBUTES))==null?void 0:m.split)==null?void 0:v.call(m,/\s+/);return Array.isArray(E||I)?(E||I).filter(M=>_y.includes(M)):[]},Ou=n=>!!zf(n).length,Ty=async(n,a,l)=>(n.isConnected||await Qo(0),l==null?n.removeAttribute(a):typeof l=="boolean"?l?n.setAttribute(a,""):n.removeAttribute(a):Number.isNaN(l)?n.removeAttribute(a):n.setAttribute(a,l)),Ay=n=>{var a;return!!((a=n.closest)!=null&&a.call(n,'*[slot="media"]'))},bs=(n,a)=>{if(Ay(n))return;let l=(v,E)=>{var I,M;Ou(v)&&E(v);let{children:B=[]}=v!=null?v:{},F=(M=(I=v==null?void 0:v.shadowRoot)==null?void 0:I.children)!=null?M:[];[...B,...F].forEach(re=>bs(re,E))},m=n==null?void 0:n.nodeName.toLowerCase();if(m.includes("-")&&!Ou(n)){W.customElements.whenDefined(m).then(()=>{l(n,a)});return}l(n,a)},$f=(n,a,l)=>{n.forEach(m=>{!zf(m).includes(a)||Ty(m,a,l)})},Sy=(n,a,l)=>{bs(n,a);let m=B=>{var F;let Q=(F=B==null?void 0:B.composedPath()[0])!=null?F:B.target;a(Q)},v=B=>{var F;let Q=(F=B==null?void 0:B.composedPath()[0])!=null?F:B.target;l(Q)};n.addEventListener(ve.REGISTER_MEDIA_STATE_RECEIVER,m),n.addEventListener(ve.UNREGISTER_MEDIA_STATE_RECEIVER,v);let E=B=>{B.forEach(F=>{let{addedNodes:Q=[],removedNodes:re=[],type:te,target:se,attributeName:pe}=F;te==="childList"?(Array.prototype.forEach.call(Q,Ae=>bs(Ae,a)),Array.prototype.forEach.call(re,Ae=>bs(Ae,l))):te==="attributes"&&pe===Pe.MEDIA_CHROME_ATTRIBUTES&&(Ou(se)?a(se):l(se))})},I=new MutationObserver(E);return I.observe(n,{childList:!0,attributes:!0,subtree:!0}),()=>{bs(n,l),I.disconnect(),n.removeEventListener(ve.REGISTER_MEDIA_STATE_RECEIVER,m),n.removeEventListener(ve.UNREGISTER_MEDIA_STATE_RECEIVER,v)}};W.customElements.get("media-controller")||W.customElements.define("media-controller",fl);var Ts=fl;var Xf=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Ar=(n,a,l)=>(Xf(n,a,"read from private field"),l?l.call(n):a.get(n)),ml=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},As=(n,a,l,m)=>(Xf(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),pl,rr,vl,gl,Zf=ie.createElement("template"),Qf=`
|
|
241
237
|
height: var(--thumb-height);
|
|
242
238
|
width: var(--media-range-thumb-width, 10px);
|
|
243
239
|
border: var(--media-range-thumb-border, none);
|
|
244
240
|
border-radius: var(--media-range-thumb-border-radius, 10px);
|
|
245
|
-
background: var(--media-range-thumb-background,
|
|
241
|
+
background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238)));
|
|
246
242
|
box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent);
|
|
247
243
|
cursor: pointer;
|
|
248
244
|
transition: var(--media-range-thumb-transition, none);
|
|
249
245
|
transform: var(--media-range-thumb-transform, none);
|
|
250
246
|
opacity: var(--media-range-thumb-opacity, 1);
|
|
251
|
-
`,
|
|
247
|
+
`,Fu=`
|
|
252
248
|
min-width: 40px;
|
|
253
249
|
height: var(--track-height);
|
|
254
250
|
border: var(--media-range-track-border, none);
|
|
255
251
|
outline: var(--media-range-track-outline);
|
|
256
252
|
outline-offset: var(--media-range-track-outline-offset);
|
|
257
|
-
border-radius: var(--media-range-track-border-radius,
|
|
258
|
-
background: var(--media-range-track-progress-internal, var(--media-range-track-background,
|
|
253
|
+
border-radius: var(--media-range-track-border-radius, 1px);
|
|
254
|
+
background: var(--media-range-track-progress-internal, var(--media-range-track-background, rgb(255 255 255 / .2)));
|
|
259
255
|
box-shadow: var(--media-range-track-box-shadow, none);
|
|
260
256
|
transition: var(--media-range-track-transition, none);
|
|
261
257
|
transform: translate(var(--media-range-track-translate-x, 0), var(--media-range-track-translate-y, 0));
|
|
262
258
|
cursor: pointer;
|
|
263
|
-
`;
|
|
259
|
+
`;Zf.innerHTML=`
|
|
264
260
|
<style>
|
|
265
261
|
:host {
|
|
266
262
|
--thumb-height: var(--media-range-thumb-height, 10px);
|
|
267
263
|
--track-height: var(--media-range-track-height, 4px);
|
|
268
|
-
--_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px
|
|
264
|
+
--_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
|
|
269
265
|
--_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px));
|
|
270
266
|
|
|
271
267
|
vertical-align: middle;
|
|
272
268
|
box-sizing: border-box;
|
|
273
269
|
display: inline-block;
|
|
274
270
|
position: relative;
|
|
275
|
-
background: var(--media-control-background,
|
|
276
|
-
transition: background
|
|
271
|
+
background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
|
|
272
|
+
transition: background .15s linear;
|
|
277
273
|
width: 100px;
|
|
278
274
|
height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding));
|
|
279
275
|
padding-left: var(--media-range-padding-left, var(--_media-range-padding));
|
|
@@ -293,7 +289,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
293
289
|
}
|
|
294
290
|
|
|
295
291
|
:host(:hover) {
|
|
296
|
-
background: var(--media-control-hover-background,
|
|
292
|
+
background: var(--media-control-hover-background, rgb(50 50 70 / .7));
|
|
297
293
|
}
|
|
298
294
|
|
|
299
295
|
#container {
|
|
@@ -318,19 +314,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
318
314
|
|
|
319
315
|
input[type=range]::-webkit-slider-thumb {
|
|
320
316
|
-webkit-appearance: none;
|
|
321
|
-
${
|
|
317
|
+
${Qf}
|
|
322
318
|
|
|
323
319
|
margin-top: calc(calc(0px - var(--thumb-height) + var(--track-height)) / 2);
|
|
324
320
|
}
|
|
325
321
|
|
|
326
322
|
|
|
327
323
|
input[type=range]::-moz-range-thumb {
|
|
328
|
-
${
|
|
324
|
+
${Qf}
|
|
329
325
|
translate: var(--media-range-track-translate-x, 0) var(--media-range-track-translate-y, 0);
|
|
330
326
|
}
|
|
331
327
|
|
|
332
|
-
input[type=range]::-webkit-slider-runnable-track { ${
|
|
333
|
-
input[type=range]::-moz-range-track { ${
|
|
328
|
+
input[type=range]::-webkit-slider-runnable-track { ${Fu} }
|
|
329
|
+
input[type=range]::-moz-range-track { ${Fu} }
|
|
334
330
|
input[type=range]::-ms-track {
|
|
335
331
|
|
|
336
332
|
width: 100%;
|
|
@@ -340,7 +336,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
340
336
|
border-color: transparent;
|
|
341
337
|
color: transparent;
|
|
342
338
|
|
|
343
|
-
${
|
|
339
|
+
${Fu}
|
|
344
340
|
}
|
|
345
341
|
|
|
346
342
|
#background,
|
|
@@ -348,11 +344,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
348
344
|
min-width: 40px;
|
|
349
345
|
width: var(--media-range-track-width, 100%);
|
|
350
346
|
height: var(--track-height);
|
|
351
|
-
border-radius: var(--media-range-track-border-radius,
|
|
347
|
+
border-radius: var(--media-range-track-border-radius, 1px);
|
|
352
348
|
position: absolute;
|
|
353
349
|
top: 50%;
|
|
354
350
|
transform: translate(var(--media-range-track-translate-x, 0px), calc(var(--media-range-track-translate-y, 0px) - 50%));
|
|
355
|
-
background: var(--media-range-track-background,
|
|
351
|
+
background: var(--media-range-track-background, rgb(255 255 255 / .2));
|
|
356
352
|
}
|
|
357
353
|
|
|
358
354
|
#pointer {
|
|
@@ -400,13 +396,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
400
396
|
<div id="hoverzone"></div>
|
|
401
397
|
<input id="range" type="range" min="0" max="1000" step="any" value="0">
|
|
402
398
|
</div>
|
|
403
|
-
`;var
|
|
399
|
+
`;var yl=class extends W.HTMLElement{constructor(){super(),ml(this,pl,void 0),ml(this,rr,void 0),ml(this,vl,()=>{if(this.range.matches(":focus-visible")){let{style:l}=Ct(this.shadowRoot,":host");l.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),ml(this,gl,()=>{let{style:l}=Ct(this.shadowRoot,":host");l.removeProperty("--_focus-visible-box-shadow")}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Zf.content.cloneNode(!0)));let{style:a}=Ct(this.shadowRoot,":host");a.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-block))`),this.container=this.shadowRoot.querySelector("#container"),this.range=this.shadowRoot.querySelector("#range"),this.range.addEventListener("input",this.updateBar.bind(this)),As(this,pl,parseInt(getComputedStyle(this).getPropertyValue("--media-range-thumb-width")||"10",10))}static get observedAttributes(){return["disabled","aria-disabled",Pe.MEDIA_CONTROLLER]}attributeChangedCallback(a,l,m){var v,E,I,M,B;a===Pe.MEDIA_CONTROLLER?(l&&((E=(v=Ar(this,rr))==null?void 0:v.unassociateElement)==null||E.call(v,this),As(this,rr,null)),m&&(As(this,rr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=Ar(this,rr))==null?void 0:M.associateElement)==null||B.call(M,this))):(a==="disabled"||a==="aria-disabled"&&l!==m)&&(m==null?this.range.removeAttribute(a):this.range.setAttribute(a,m))}connectedCallback(){var a,l,m;let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(As(this,rr,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=Ar(this,rr))==null?void 0:l.associateElement)==null||m.call(l,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",Ar(this,vl)),this.shadowRoot.addEventListener("focusout",Ar(this,gl))}disconnectedCallback(){var a,l;(l=(a=Ar(this,rr))==null?void 0:a.unassociateElement)==null||l.call(a,this),As(this,rr,null),this.shadowRoot.removeEventListener("focusin",Ar(this,vl)),this.shadowRoot.removeEventListener("focusout",Ar(this,gl))}updatePointerBar(a){let l=this.range.getBoundingClientRect(),m=(a.clientX-l.left)/l.width;m=Math.max(0,Math.min(1,m));let{style:v}=Ct(this.shadowRoot,"#pointer");v.setProperty("width",`${m*l.width}px`)}updateBar(){let a=this.getBarColors(),l="linear-gradient(to right, ",m=0;a.forEach(E=>{E[1]<m||(l=l+`${E[0]} ${m}%, ${E[0]} ${E[1]}%,`,m=E[1])}),l=l.slice(0,l.length-1)+")";let{style:v}=Ct(this.shadowRoot,"#range");v.setProperty("--media-range-track-progress-internal",l)}getBarColors(){let a=this.range,l=a.value-a.min,m=a.max-a.min,v=l/m*100,E=0;return a.value>a.min&&a.value<a.max&&(E=Ar(this,pl)*(.5-v/100)/a.offsetWidth*100),[["var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238)))",v+E],["var(--media-range-track-color, transparent)",100]]}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}};pl=new WeakMap;rr=new WeakMap;vl=new WeakMap;gl=new WeakMap;W.customElements.get("media-chrome-range")||W.customElements.define("media-chrome-range",yl);var Ss=yl;var Jf=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},El=(n,a,l)=>(Jf(n,a,"read from private field"),l?l.call(n):a.get(n)),ky=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},bl=(n,a,l,m)=>(Jf(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),ar,em=ie.createElement("template");em.innerHTML=`
|
|
404
400
|
<style>
|
|
405
401
|
:host {
|
|
406
402
|
|
|
407
403
|
box-sizing: border-box;
|
|
408
404
|
display: var(--media-control-display, var(--media-control-bar-display, inline-flex));
|
|
409
|
-
color: var(--media-
|
|
405
|
+
color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
|
|
410
406
|
--media-loading-icon-width: 44px;
|
|
411
407
|
}
|
|
412
408
|
|
|
@@ -419,29 +415,29 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
419
415
|
</style>
|
|
420
416
|
|
|
421
417
|
<slot></slot>
|
|
422
|
-
`;var
|
|
418
|
+
`;var Uu=class extends W.HTMLElement{constructor(){super(),ky(this,ar,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(em.content.cloneNode(!0)))}static get observedAttributes(){return[Pe.MEDIA_CONTROLLER]}attributeChangedCallback(a,l,m){var v,E,I,M,B;a===Pe.MEDIA_CONTROLLER&&(l&&((E=(v=El(this,ar))==null?void 0:v.unassociateElement)==null||E.call(v,this),bl(this,ar,null)),m&&(bl(this,ar,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=El(this,ar))==null?void 0:M.associateElement)==null||B.call(M,this)))}connectedCallback(){var a,l,m;let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(bl(this,ar,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=El(this,ar))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var a,l;(l=(a=El(this,ar))==null?void 0:a.unassociateElement)==null||l.call(a,this),bl(this,ar,null)}};ar=new WeakMap;W.customElements.get("media-control-bar")||W.customElements.define("media-control-bar",Uu);var tm=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},_l=(n,a,l)=>(tm(n,a,"read from private field"),l?l.call(n):a.get(n)),wy=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Tl=(n,a,l,m)=>(tm(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),nr,im=ie.createElement("template");im.innerHTML=`
|
|
423
419
|
<style>
|
|
424
420
|
:host {
|
|
421
|
+
font: var(--media-font,
|
|
422
|
+
var(--media-font-weight, normal)
|
|
423
|
+
var(--media-font-size, 14px) /
|
|
424
|
+
var(--media-text-content-height, var(--media-control-height, 24px))
|
|
425
|
+
var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
|
|
426
|
+
color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
|
|
427
|
+
background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
|
|
428
|
+
padding: var(--media-control-padding, 10px);
|
|
425
429
|
display: inline-flex;
|
|
426
430
|
justify-content: center;
|
|
427
431
|
align-items: center;
|
|
428
432
|
vertical-align: middle;
|
|
429
433
|
box-sizing: border-box;
|
|
430
|
-
background: var(--media-control-background, rgba(20,20,30, 0.7));
|
|
431
|
-
|
|
432
|
-
padding: var(--media-control-padding, 10px);
|
|
433
|
-
|
|
434
|
-
font-size: 14px;
|
|
435
|
-
line-height: var(--media-text-content-height, var(--media-control-height, 24px));
|
|
436
|
-
font-family: Arial, sans-serif;
|
|
437
434
|
text-align: center;
|
|
438
|
-
color: #ffffff;
|
|
439
435
|
pointer-events: auto;
|
|
440
436
|
}
|
|
441
437
|
|
|
442
438
|
|
|
443
439
|
:host(:focus-visible) {
|
|
444
|
-
box-shadow: inset 0 0 0 2px
|
|
440
|
+
box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9);
|
|
445
441
|
outline: 0;
|
|
446
442
|
}
|
|
447
443
|
|
|
@@ -452,11 +448,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
452
448
|
}
|
|
453
449
|
</style>
|
|
454
450
|
<slot></slot>
|
|
455
|
-
`;var
|
|
451
|
+
`;var Al=class extends W.HTMLElement{constructor(){super(),wy(this,nr,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(im.content.cloneNode(!0)));let{style:a}=Ct(this.shadowRoot,":host");a.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`)}static get observedAttributes(){return[Pe.MEDIA_CONTROLLER]}attributeChangedCallback(a,l,m){var v,E,I,M,B;a===Pe.MEDIA_CONTROLLER&&(l&&((E=(v=_l(this,nr))==null?void 0:v.unassociateElement)==null||E.call(v,this),Tl(this,nr,null)),m&&(Tl(this,nr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=_l(this,nr))==null?void 0:M.associateElement)==null||B.call(M,this)))}connectedCallback(){var a,l,m;let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(Tl(this,nr,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=_l(this,nr))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var a,l;(l=(a=_l(this,nr))==null?void 0:a.unassociateElement)==null||l.call(a,this),Tl(this,nr,null)}};nr=new WeakMap;W.customElements.get("media-text-display")||W.customElements.define("media-text-display",Al);var Yr=Al;var am=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},rm=(n,a,l)=>(am(n,a,"read from private field"),l?l.call(n):a.get(n)),Ly=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Iy=(n,a,l,m)=>(am(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),ks,Bu=class extends Yr{constructor(){super(),Ly(this,ks,void 0),Iy(this,ks,this.shadowRoot.querySelector("slot")),rm(this,ks).textContent=ki(0)}static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_CURRENT_TIME]}attributeChangedCallback(a,l,m){a===U.MEDIA_CURRENT_TIME&&(rm(this,ks).textContent=ki(m)),super.attributeChangedCallback(a,l,m)}};ks=new WeakMap;W.customElements.get("media-current-time-display")||W.customElements.define("media-current-time-display",Bu);var sm=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},nm=(n,a,l)=>(sm(n,a,"read from private field"),l?l.call(n):a.get(n)),Ry=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Dy=(n,a,l,m)=>(sm(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),ws,Hu=class extends Yr{constructor(){super(),Ry(this,ws,void 0),Dy(this,ws,this.shadowRoot.querySelector("slot")),nm(this,ws).textContent=ki(0)}static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_DURATION]}attributeChangedCallback(a,l,m){a===U.MEDIA_DURATION&&(nm(this,ws).textContent=ki(m)),super.attributeChangedCallback(a,l,m)}};ws=new WeakMap;W.customElements.get("media-duration-display")||W.customElements.define("media-duration-display",Hu);var dm=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Gu=(n,a,l)=>(dm(n,a,"read from private field"),l?l.call(n):a.get(n)),Cy=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},My=(n,a,l,m)=>(dm(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),pn,om=["Enter"," "],xy=" / ",lm=(n,{timesSep:a=xy}={})=>{var l,m,v;let E=n.getAttribute("remaining")!=null,I=n.getAttribute("show-duration")!=null,M=(l=n.mediaCurrentTime)!=null?l:0,B=(v=(m=n.mediaDuration)!=null?m:n.mediaSeekableEnd)!=null?v:0,F=E?ki(0-(B-M)):ki(M);return I?`${F}${a}${ki(B)}`:F},Py="video not loaded, unknown time.",Oy=n=>{let a=n.mediaCurrentTime,l=n.mediaDuration||n.mediaSeekableEnd;if(a==null||l==null){n.setAttribute("aria-valuetext",Py);return}let m=n.hasAttribute("remaining"),v=n.hasAttribute("show-duration"),E=m?Ia(0-(l-a)):Ia(a);if(!v){n.setAttribute("aria-valuetext",E);return}let I=Ia(l),M=`${E} of ${I}`;n.setAttribute("aria-valuetext",M)},Vu=class extends Yr{constructor(){super(),Cy(this,pn,void 0),My(this,pn,this.shadowRoot.querySelector("slot")),Gu(this,pn).innerHTML=`${lm(this)}`;let{style:a}=Ct(this.shadowRoot,":host");a.setProperty("cursor","pointer")}static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_CURRENT_TIME,U.MEDIA_DURATION,U.MEDIA_SEEKABLE,"remaining","show-duration","disabled"]}connectedCallback(){this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",Jt.PLAYBACK_TIME());let a=l=>{let{key:m}=l;if(!om.includes(m)){this.removeEventListener("keyup",a);return}this.toggleTimeDisplay()};this.addEventListener("keydown",l=>{let{metaKey:m,altKey:v,key:E}=l;if(m||v||!om.includes(E)){this.removeEventListener("keyup",a);return}this.addEventListener("keyup",a)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining","")}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(a,l,m){if([U.MEDIA_CURRENT_TIME,U.MEDIA_DURATION,U.MEDIA_SEEKABLE,"remaining","show-duration"].includes(a)){let v=lm(this);Oy(this),v!==Gu(this,pn).innerHTML&&(Gu(this,pn).innerHTML=v)}else a==="disabled"&&m!==l&&(m==null?this.enable():this.disable());super.attributeChangedCallback(a,l,m)}enable(){this.setAttribute("tabindex",0)}disable(){this.removeAttribute("tabindex")}get mediaDuration(){let a=this.getAttribute(U.MEDIA_DURATION);return a!=null?+a:void 0}get mediaCurrentTime(){let a=this.getAttribute(U.MEDIA_CURRENT_TIME);return a!=null?+a:void 0}get mediaSeekable(){let a=this.getAttribute(U.MEDIA_SEEKABLE);if(!!a)return a.split(":").map(l=>+l)}get mediaSeekableEnd(){var a;let[,l]=(a=this.mediaSeekable)!=null?a:[];return l}get mediaSeekableStart(){var a;let[l]=(a=this.mediaSeekable)!=null?a:[];return l}};pn=new WeakMap;W.customElements.get("media-time-display")||W.customElements.define("media-time-display",Vu);var Ny=`<svg aria-hidden="true" viewBox="0 0 26 24">
|
|
456
452
|
<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"/>
|
|
457
|
-
</svg>`,
|
|
453
|
+
</svg>`,Fy=`<svg aria-hidden="true" viewBox="0 0 26 24">
|
|
458
454
|
<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"/>
|
|
459
|
-
</svg>`,
|
|
455
|
+
</svg>`,cm=ie.createElement("template");cm.innerHTML=`
|
|
460
456
|
<style>
|
|
461
457
|
:host([aria-checked="true"]) slot:not([name=on]) > *,
|
|
462
458
|
:host([aria-checked="true"]) ::slotted(:not([slot=on])) {
|
|
@@ -470,31 +466,31 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
470
466
|
}
|
|
471
467
|
</style>
|
|
472
468
|
|
|
473
|
-
<slot name="on">${
|
|
474
|
-
<slot name="off">${
|
|
475
|
-
`;var
|
|
476
|
-
<slot name="forward">${
|
|
477
|
-
`;var
|
|
469
|
+
<slot name="on">${Ny}</slot>
|
|
470
|
+
<slot name="off">${Fy}</slot>
|
|
471
|
+
`;var um=n=>{n.setAttribute("aria-checked",Ru(n))},Ku=class extends Et{static get observedAttributes(){return[...super.observedAttributes,"no-subtitles-fallback","default-showing",U.MEDIA_CAPTIONS_LIST,U.MEDIA_CAPTIONS_SHOWING,U.MEDIA_SUBTITLES_LIST,U.MEDIA_SUBTITLES_SHOWING]}constructor(a={}){super({slotTemplate:cm,...a}),this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",Jt.CLOSED_CAPTIONS()),um(this)}attributeChangedCallback(a,l,m){if([U.MEDIA_CAPTIONS_SHOWING,U.MEDIA_SUBTITLES_SHOWING].includes(a)&&um(this),this.hasAttribute("default-showing")&&this.getAttribute("aria-checked")!=="true"){let v=!this.hasAttribute("no-subtitles-fallback");if((v?[U.MEDIA_CAPTIONS_LIST,U.MEDIA_SUBTITLES_LIST]:[U.MEDIA_CAPTIONS_LIST]).includes(a)){let I=!!this.getAttribute(U.MEDIA_CAPTIONS_LIST)||!!(v&&this.getAttribute(U.MEDIA_SUBTITLES_LIST));this._captionsReady!==I&&(this._captionsReady=I,this._captionsReady&&Da(this))}}super.attributeChangedCallback(a,l,m)}handleClick(){Da(this)}};W.customElements.get("media-captions-button")||W.customElements.define("media-captions-button",Ku);var Wu="30",Uy=`<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)">${Wu}</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>`,mm=ie.createElement("template");mm.innerHTML=`
|
|
472
|
+
<slot name="forward">${Uy}</slot>
|
|
473
|
+
`;var By=0,hm=n=>{let a=Math.abs(+n.getAttribute("seek-offset")),l=ct.SEEK_FORWARD_N_SECS({seekOffset:a});n.setAttribute("aria-label",l)},fm=n=>{let a=Zo(n,"forward"),l=n.getAttribute("seek-offset");Xo(a,l)},qu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_CURRENT_TIME,"seek-offset"]}constructor(a={}){super({slotTemplate:mm,...a})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",Wu),hm(this),fm(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a==="seek-offset"&&(m==null&&this.setAttribute("seek-offset",Wu),fm(this),hm(this)),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_CURRENT_TIME),l=+this.getAttribute("seek-offset"),v=(a&&!Number.isNaN(+a)?+a:By)+l,E=new W.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(E)}};W.customElements.get("media-seek-forward-button")||W.customElements.define("media-seek-forward-button",qu);var Hy=`<svg aria-hidden="true" viewBox="0 0 26 24">
|
|
478
474
|
<path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/>
|
|
479
|
-
</svg>`,
|
|
475
|
+
</svg>`,Gy=`<svg aria-hidden="true" viewBox="0 0 26 24">
|
|
480
476
|
<path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/>
|
|
481
|
-
</svg>`,
|
|
477
|
+
</svg>`,vm=ie.createElement("template");vm.innerHTML=`
|
|
482
478
|
<style>
|
|
483
|
-
:host([${
|
|
484
|
-
:host([${
|
|
479
|
+
:host([${U.MEDIA_IS_FULLSCREEN}]) slot:not([name=exit]) > *,
|
|
480
|
+
:host([${U.MEDIA_IS_FULLSCREEN}]) ::slotted(:not([slot=exit])) {
|
|
485
481
|
display: none !important;
|
|
486
482
|
}
|
|
487
483
|
|
|
488
484
|
|
|
489
|
-
:host(:not([${
|
|
490
|
-
:host(:not([${
|
|
485
|
+
:host(:not([${U.MEDIA_IS_FULLSCREEN}])) slot:not([name=enter]) > *,
|
|
486
|
+
:host(:not([${U.MEDIA_IS_FULLSCREEN}])) ::slotted(:not([slot=enter])) {
|
|
491
487
|
display: none !important;
|
|
492
488
|
}
|
|
493
489
|
</style>
|
|
494
490
|
|
|
495
|
-
<slot name="enter">${
|
|
496
|
-
<slot name="exit">${
|
|
497
|
-
`;var
|
|
491
|
+
<slot name="enter">${Hy}</slot>
|
|
492
|
+
<slot name="exit">${Gy}</slot>
|
|
493
|
+
`;var pm=n=>{let l=n.getAttribute(U.MEDIA_IS_FULLSCREEN)!=null?ct.EXIT_FULLSCREEN():ct.ENTER_FULLSCREEN();n.setAttribute("aria-label",l)},Yu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_IS_FULLSCREEN,U.MEDIA_FULLSCREEN_UNAVAILABLE]}constructor(a={}){super({slotTemplate:vm,...a})}connectedCallback(){pm(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a===U.MEDIA_IS_FULLSCREEN&&pm(this),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_IS_FULLSCREEN)!=null?ve.MEDIA_EXIT_FULLSCREEN_REQUEST:ve.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new W.CustomEvent(a,{composed:!0,bubbles:!0}))}};W.customElements.get("media-fullscreen-button")||W.customElements.define("media-fullscreen-button",Yu);var{MEDIA_TIME_IS_LIVE:vn,MEDIA_PAUSED:Ma}=U,{MEDIA_SEEK_TO_LIVE_REQUEST:Vy,MEDIA_PLAY_REQUEST:Ky}=ve,Wy='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>',gm=ie.createElement("template");gm.innerHTML=`
|
|
498
494
|
<style>
|
|
499
495
|
|
|
500
496
|
slot[name=indicator] > *,
|
|
@@ -505,97 +501,97 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
505
501
|
color: var(--media-live-button-icon-color, rgb(140, 140, 140));
|
|
506
502
|
}
|
|
507
503
|
|
|
508
|
-
:host([${
|
|
509
|
-
:host([${
|
|
504
|
+
:host([${vn}]:not([${Ma}])) slot[name=indicator] > *,
|
|
505
|
+
:host([${vn}]:not([${Ma}])) ::slotted([slot=indicator]) {
|
|
510
506
|
fill: var(--media-live-indicator-color, rgb(255, 0, 0));
|
|
511
507
|
color: var(--media-live-indicator-color, rgb(255, 0, 0));
|
|
512
508
|
}
|
|
513
509
|
|
|
514
|
-
:host([${
|
|
510
|
+
:host([${vn}]:not([${Ma}])) {
|
|
515
511
|
cursor: not-allowed;
|
|
516
512
|
}
|
|
517
513
|
|
|
518
514
|
</style>
|
|
519
515
|
|
|
520
|
-
<slot name="indicator">${
|
|
516
|
+
<slot name="indicator">${Wy}</slot>
|
|
521
517
|
|
|
522
518
|
<slot name="spacer"> </slot><slot name="text">LIVE</slot>
|
|
523
|
-
`;var
|
|
519
|
+
`;var $u=class extends Et{static get observedAttributes(){return[...super.observedAttributes,Ma,vn]}constructor(a={}){super({slotTemplate:gm,...a}),this.setAttribute("aria-label",ct.SEEK_LIVE())}attributeChangedCallback(a,l,m){super.attributeChangedCallback(a,l,m),this.hasAttribute(Ma)||!this.hasAttribute(vn)?(this.setAttribute("aria-label",ct.SEEK_LIVE()),this.removeAttribute("aria-disabled")):(this.setAttribute("aria-label",ct.PLAYING_LIVE()),this.setAttribute("aria-disabled","true"))}handleClick(){!this.hasAttribute(Ma)&&this.hasAttribute(vn)||(this.dispatchEvent(new W.CustomEvent(Vy,{composed:!0,bubbles:!0})),this.hasAttribute(Ma)&&this.dispatchEvent(new W.CustomEvent(Ky,{composed:!0,bubbles:!0})))}};W.customElements.get("media-live-button")||W.customElements.define("media-live-button",$u);var qy=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
524
520
|
<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"/>
|
|
525
|
-
</svg>`,
|
|
521
|
+
</svg>`,ym=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
526
522
|
<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"/>
|
|
527
|
-
</svg
|
|
523
|
+
</svg>`,Yy=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
528
524
|
<path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4ZM14 3.23v2.06a7 7 0 0 1 0 13.42v2.06a9 9 0 0 0 0-17.54Z"/>
|
|
529
|
-
</svg>`,
|
|
525
|
+
</svg>`,bm=ie.createElement("template");bm.innerHTML=`
|
|
530
526
|
<style>
|
|
531
527
|
|
|
532
|
-
:host(:not([${
|
|
533
|
-
:host(:not([${
|
|
534
|
-
:host([${
|
|
535
|
-
:host([${
|
|
528
|
+
:host(:not([${U.MEDIA_VOLUME_LEVEL}])) slot:not([name=high]) > *,
|
|
529
|
+
:host(:not([${U.MEDIA_VOLUME_LEVEL}])) ::slotted(:not([slot=high])),
|
|
530
|
+
:host([${U.MEDIA_VOLUME_LEVEL}=high]) slot:not([name=high]) > *,
|
|
531
|
+
:host([${U.MEDIA_VOLUME_LEVEL}=high]) ::slotted(:not([slot=high])) {
|
|
536
532
|
display: none !important;
|
|
537
533
|
}
|
|
538
534
|
|
|
539
|
-
:host([${
|
|
540
|
-
:host([${
|
|
535
|
+
:host([${U.MEDIA_VOLUME_LEVEL}=off]) slot:not([name=off]) > *,
|
|
536
|
+
:host([${U.MEDIA_VOLUME_LEVEL}=off]) ::slotted(:not([slot=off])) {
|
|
541
537
|
display: none !important;
|
|
542
538
|
}
|
|
543
539
|
|
|
544
|
-
:host([${
|
|
545
|
-
:host([${
|
|
540
|
+
:host([${U.MEDIA_VOLUME_LEVEL}=low]) slot:not([name=low]) > *,
|
|
541
|
+
:host([${U.MEDIA_VOLUME_LEVEL}=low]) ::slotted(:not([slot=low])) {
|
|
546
542
|
display: none !important;
|
|
547
543
|
}
|
|
548
544
|
|
|
549
|
-
:host([${
|
|
550
|
-
:host([${
|
|
545
|
+
:host([${U.MEDIA_VOLUME_LEVEL}=medium]) slot:not([name=medium]) > *,
|
|
546
|
+
:host([${U.MEDIA_VOLUME_LEVEL}=medium]) ::slotted(:not([slot=medium])) {
|
|
551
547
|
display: none !important;
|
|
552
548
|
}
|
|
553
549
|
</style>
|
|
554
550
|
|
|
555
|
-
<slot name="off">${
|
|
556
|
-
<slot name="low">${
|
|
557
|
-
<slot name="medium">${
|
|
558
|
-
<slot name="high">${
|
|
559
|
-
`;var
|
|
551
|
+
<slot name="off">${qy}</slot>
|
|
552
|
+
<slot name="low">${ym}</slot>
|
|
553
|
+
<slot name="medium">${ym}</slot>
|
|
554
|
+
<slot name="high">${Yy}</slot>
|
|
555
|
+
`;var Em=n=>{let l=n.getAttribute(U.MEDIA_VOLUME_LEVEL)==="off"?ct.UNMUTE():ct.MUTE();n.setAttribute("aria-label",l)},ju=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_VOLUME_LEVEL]}constructor(a={}){super({slotTemplate:bm,...a})}connectedCallback(){Em(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a===U.MEDIA_VOLUME_LEVEL&&Em(this),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_VOLUME_LEVEL)==="off"?ve.MEDIA_UNMUTE_REQUEST:ve.MEDIA_MUTE_REQUEST;this.dispatchEvent(new W.CustomEvent(a,{composed:!0,bubbles:!0}))}};W.customElements.get("media-mute-button")||W.customElements.define("media-mute-button",ju);var _m=`<svg aria-hidden="true" viewBox="0 0 28 24">
|
|
560
556
|
<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"/>
|
|
561
|
-
</svg>`,
|
|
557
|
+
</svg>`,Am=ie.createElement("template");Am.innerHTML=`
|
|
562
558
|
<style>
|
|
563
|
-
:host([${
|
|
564
|
-
:host([${
|
|
559
|
+
:host([${U.MEDIA_IS_PIP}]) slot:not([name=exit]) > *,
|
|
560
|
+
:host([${U.MEDIA_IS_PIP}]) ::slotted(:not([slot=exit])) {
|
|
565
561
|
display: none !important;
|
|
566
562
|
}
|
|
567
563
|
|
|
568
564
|
|
|
569
|
-
:host(:not([${
|
|
570
|
-
:host(:not([${
|
|
565
|
+
:host(:not([${U.MEDIA_IS_PIP}])) slot:not([name=enter]) > *,
|
|
566
|
+
:host(:not([${U.MEDIA_IS_PIP}])) ::slotted(:not([slot=enter])) {
|
|
571
567
|
display: none !important;
|
|
572
568
|
}
|
|
573
569
|
</style>
|
|
574
570
|
|
|
575
|
-
<slot name="enter">${
|
|
576
|
-
<slot name="exit">${
|
|
577
|
-
`;var
|
|
571
|
+
<slot name="enter">${_m}</slot>
|
|
572
|
+
<slot name="exit">${_m}</slot>
|
|
573
|
+
`;var Tm=n=>{let l=n.getAttribute(U.MEDIA_IS_PIP)!=null?ct.EXIT_PIP():ct.ENTER_PIP();n.setAttribute("aria-label",l)},zu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_IS_PIP,U.MEDIA_PIP_UNAVAILABLE]}constructor(a={}){super({slotTemplate:Am,...a})}connectedCallback(){Tm(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a===U.MEDIA_IS_PIP&&Tm(this),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_IS_PIP)!=null?ve.MEDIA_EXIT_PIP_REQUEST:ve.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new W.CustomEvent(a,{composed:!0,bubbles:!0}))}};W.customElements.get("media-pip-button")||W.customElements.define("media-pip-button",zu);var $y=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
578
574
|
<path d="m6 21 15-9L6 3v18Z"/>
|
|
579
|
-
</svg>`,
|
|
575
|
+
</svg>`,jy=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
580
576
|
<path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/>
|
|
581
|
-
</svg>`,
|
|
577
|
+
</svg>`,km=ie.createElement("template");km.innerHTML=`
|
|
582
578
|
<style>
|
|
583
|
-
:host([${
|
|
584
|
-
:host([${
|
|
579
|
+
:host([${U.MEDIA_PAUSED}]) slot[name=pause] > *,
|
|
580
|
+
:host([${U.MEDIA_PAUSED}]) ::slotted([slot=pause]) {
|
|
585
581
|
display: none !important;
|
|
586
582
|
}
|
|
587
583
|
|
|
588
|
-
:host(:not([${
|
|
589
|
-
:host(:not([${
|
|
584
|
+
:host(:not([${U.MEDIA_PAUSED}])) slot[name=play] > *,
|
|
585
|
+
:host(:not([${U.MEDIA_PAUSED}])) ::slotted([slot=play]) {
|
|
590
586
|
display: none !important;
|
|
591
587
|
}
|
|
592
588
|
</style>
|
|
593
589
|
|
|
594
|
-
<slot name="play">${
|
|
595
|
-
<slot name="pause">${
|
|
596
|
-
`;var
|
|
590
|
+
<slot name="play">${$y}</slot>
|
|
591
|
+
<slot name="pause">${jy}</slot>
|
|
592
|
+
`;var Sm=n=>{let l=n.getAttribute(U.MEDIA_PAUSED)!=null?ct.PLAY():ct.PAUSE();n.setAttribute("aria-label",l)},Qu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_PAUSED]}constructor(a={}){super({slotTemplate:km,...a})}connectedCallback(){Sm(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a===U.MEDIA_PAUSED&&Sm(this),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_PAUSED)!=null?ve.MEDIA_PLAY_REQUEST:ve.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new W.CustomEvent(a,{composed:!0,bubbles:!0}))}};W.customElements.get("media-play-button")||W.customElements.define("media-play-button",Qu);var wm=[1,1.25,1.5,1.75,2],Sl=1,Lm=ie.createElement("template");Lm.innerHTML=`
|
|
597
593
|
<span id="container"></span>
|
|
598
|
-
`;var
|
|
594
|
+
`;var Xu=class extends Et{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_PLAYBACK_RATE,"rates"]}constructor(a={}){super({slotTemplate:Lm,...a}),this._rates=wm,this.container=this.shadowRoot.querySelector("#container"),this.container.innerHTML=`${Sl}x`}attributeChangedCallback(a,l,m){if(a==="rates"){let v=(m!=null?m:"").trim().split(/\s*,?\s+/).map(E=>Number(E)).filter(E=>!Number.isNaN(E)).sort((E,I)=>E-I);this._rates=v.length?v:wm;return}if(a===U.MEDIA_PLAYBACK_RATE){let v=m?+m:Number.NaN,E=Number.isNaN(v)?Sl:v;this.container.innerHTML=`${E}x`,this.setAttribute("aria-label",Jt.PLAYBACK_RATE({playbackRate:E}));return}super.attributeChangedCallback(a,l,m)}handleClick(){var a,l;let m=+this.getAttribute(U.MEDIA_PLAYBACK_RATE)||Sl,v=(l=(a=this._rates.find(I=>I>m))!=null?a:this._rates[0])!=null?l:Sl,E=new W.CustomEvent(ve.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(E)}};W.customElements.get("media-playback-rate-button")||W.customElements.define("media-playback-rate-button",Xu);var Im=ie.createElement("template");Im.innerHTML=`
|
|
599
595
|
<style>
|
|
600
596
|
:host {
|
|
601
597
|
pointer-events: none;
|
|
@@ -617,16 +613,28 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
617
613
|
</style>
|
|
618
614
|
|
|
619
615
|
<img aria-hidden="true" id="image"/>
|
|
620
|
-
`;var
|
|
616
|
+
`;var zy=n=>{n.style.removeProperty("background-image")},Qy=(n,a)=>{n.style["background-image"]=`url('${a}')`},Zu=class extends W.HTMLElement{static get observedAttributes(){return["placeholder-src","src"]}constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Im.content.cloneNode(!0))),this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(a,l,m){a==="src"&&(m==null?this.image.removeAttribute("src"):this.image.setAttribute("src",m)),a==="placeholder-src"&&(m==null?zy(this.image):Qy(this.image,m))}};W.customElements.get("media-poster-image")||W.customElements.define("media-poster-image",Zu);var Ju="30",Xy=`<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)">${Ju}</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>`,Cm=ie.createElement("template");Cm.innerHTML=`
|
|
617
|
+
<slot name="backward">${Xy}</slot>
|
|
618
|
+
`;var Zy=0,Rm=n=>{let a=Math.abs(+n.getAttribute("seek-offset")),l=ct.SEEK_BACK_N_SECS({seekOffset:a});n.setAttribute("aria-label",l)},Dm=n=>{let a=Zo(n,"backward"),l=n.getAttribute("seek-offset");Xo(a,l)},ec=class extends Et{static get observedAttributes(){return[...super.observedAttributes,"seek-offset",U.MEDIA_CURRENT_TIME]}constructor(a={}){super({slotTemplate:Cm,...a})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",Ju),Rm(this),Dm(this),super.connectedCallback()}attributeChangedCallback(a,l,m){a==="seek-offset"&&(m==null&&this.setAttribute("seek-offset",Ju),Dm(this),Rm(this)),super.attributeChangedCallback(a,l,m)}handleClick(){let a=this.getAttribute(U.MEDIA_CURRENT_TIME),l=+this.getAttribute("seek-offset"),m=a&&!Number.isNaN(+a)?+a:Zy,v=Math.max(m-l,0),E=new W.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(E)}};W.customElements.get("media-seek-backward-button")||W.customElements.define("media-seek-backward-button",ec);var xm=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Mm=(n,a,l)=>(xm(n,a,"read from private field"),l?l.call(n):a.get(n)),Jy=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},eE=(n,a,l,m)=>(xm(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),Ls,tc=class extends Yr{constructor(){super(),Jy(this,Ls,void 0),eE(this,Ls,this.shadowRoot.querySelector("slot")),Mm(this,Ls).textContent=ki(0)}static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_PREVIEW_TIME]}attributeChangedCallback(a,l,m){a===U.MEDIA_PREVIEW_TIME&&m!=null&&(Mm(this,Ls).textContent=ki(m)),super.attributeChangedCallback(a,l,m)}};Ls=new WeakMap;W.customElements.get("media-preview-time-display")||W.customElements.define("media-preview-time-display",tc);var Pm=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},kl=(n,a,l)=>(Pm(n,a,"read from private field"),l?l.call(n):a.get(n)),tE=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},wl=(n,a,l,m)=>(Pm(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),sr,Om=ie.createElement("template");Om.innerHTML=`
|
|
619
|
+
<style>
|
|
620
|
+
:host {
|
|
621
|
+
box-sizing: border-box;
|
|
622
|
+
display: var(--media-control-display, var(--media-preview-thumbnail-display, inline-block));
|
|
623
|
+
overflow: hidden;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
img {
|
|
627
|
+
display: none;
|
|
628
|
+
position: relative;
|
|
629
|
+
}
|
|
630
|
+
</style>
|
|
631
|
+
<img crossorigin loading="eager" decoding="async" />
|
|
632
|
+
`;var ic=class extends W.HTMLElement{constructor(){super(),tE(this,sr,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Om.content.cloneNode(!0)))}static get observedAttributes(){return[Pe.MEDIA_CONTROLLER,"time",U.MEDIA_PREVIEW_IMAGE,U.MEDIA_PREVIEW_COORDS]}connectedCallback(){var a,l,m;let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(wl(this,sr,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=kl(this,sr))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var a,l;(l=(a=kl(this,sr))==null?void 0:a.unassociateElement)==null||l.call(a,this),wl(this,sr,null)}attributeChangedCallback(a,l,m){var v,E,I,M,B;["time",U.MEDIA_PREVIEW_IMAGE,U.MEDIA_PREVIEW_COORDS].includes(a)&&this.update(),a===Pe.MEDIA_CONTROLLER&&(l&&((E=(v=kl(this,sr))==null?void 0:v.unassociateElement)==null||E.call(v,this),wl(this,sr,null)),m&&(wl(this,sr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(B=(M=kl(this,sr))==null?void 0:M.associateElement)==null||B.call(M,this)))}update(){let a=this.getAttribute(U.MEDIA_PREVIEW_COORDS),l=this.getAttribute(U.MEDIA_PREVIEW_IMAGE);if(!(a&&l))return;let[m,v,E,I]=a.split(/\s+/).map(oe=>+oe),M=l.split("#")[0],B=getComputedStyle(this),{maxWidth:F,maxHeight:Q,minWidth:re,minHeight:te}=B,se=Math.min(parseInt(F)/E,parseInt(Q)/I),pe=Math.max(parseInt(re)/E,parseInt(te)/I),Ae=se<1,ke=Ae?se:pe>1?pe:1,{style:we}=Ct(this.shadowRoot,":host"),nt=Ct(this.shadowRoot,"img").style,Ue=this.shadowRoot.querySelector("img"),st=Ae?"min":"max";we.setProperty(`${st}-width`,"initial","important"),we.setProperty(`${st}-height`,"initial","important"),we.width=`${E*ke}px`,we.height=`${I*ke}px`;let dt=()=>{nt.width=`${this.imgWidth*ke}px`,nt.height=`${this.imgHeight*ke}px`,nt.display="block"};Ue.src!==M&&(Ue.onload=()=>{this.imgWidth=Ue.naturalWidth,this.imgHeight=Ue.naturalHeight,dt()},Ue.src=M,dt()),dt(),nt.transform=`translate(-${m*ke}px, -${v*ke}px)`}};sr=new WeakMap;W.customElements.get("media-preview-thumbnail")||W.customElements.define("media-preview-thumbnail",ic);var dc=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Kt=(n,a,l)=>(dc(n,a,"read from private field"),l?l.call(n):a.get(n)),gi=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},$r=(n,a,l,m)=>(dc(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),Is=(n,a,l)=>(dc(n,a,"access private method"),l),Rs,Ll,Ds,Cl,Ml,Il,ac,Rl,gn,Cs,nc,xl,Pl,Dl,sc,oc,Nm,iE="video not loaded, unknown time.",rc=n=>{let a=n.range,l=Ia(+a.value),m=Ia(+a.max),v=l&&m?`${l} of ${m}`:iE;a.setAttribute("aria-valuetext",v)},Fm=ie.createElement("template");Fm.innerHTML=`
|
|
621
633
|
<style>
|
|
622
634
|
:host {
|
|
623
|
-
--media-preview-background-color: rgba(20,20,30, .5);
|
|
624
|
-
--media-preview-background: var(--media-control-background,
|
|
625
|
-
var(--media-preview-background-color));
|
|
626
635
|
--media-preview-border-radius: 3px;
|
|
627
636
|
--media-box-padding-left: 10px;
|
|
628
637
|
--media-box-padding-right: 10px;
|
|
629
|
-
color: #fff;
|
|
630
638
|
}
|
|
631
639
|
|
|
632
640
|
#preview-rail,
|
|
@@ -657,8 +665,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
657
665
|
opacity: 0;
|
|
658
666
|
}
|
|
659
667
|
|
|
660
|
-
:host([${
|
|
661
|
-
:host([${
|
|
668
|
+
:host([${U.MEDIA_PREVIEW_IMAGE}]:hover) [part~="preview-box"],
|
|
669
|
+
:host([${U.MEDIA_PREVIEW_TIME}]:hover) [part~="preview-box"] {
|
|
662
670
|
transition-duration: var(--media-preview-transition-duration-in, .5s);
|
|
663
671
|
transition-delay: var(--media-preview-transition-delay-in, .25s);
|
|
664
672
|
visibility: visible;
|
|
@@ -671,8 +679,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
671
679
|
|
|
672
680
|
transition: visibility 0s .25s;
|
|
673
681
|
transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
|
|
674
|
-
background: var(--media-preview-time-background, var(--media-preview-background));
|
|
675
|
-
box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px
|
|
682
|
+
background: var(--media-preview-time-background, var(--media-preview-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)))));
|
|
683
|
+
box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2));
|
|
676
684
|
max-width: var(--media-preview-thumbnail-max-width, 180px);
|
|
677
685
|
max-height: var(--media-preview-thumbnail-max-height, 160px);
|
|
678
686
|
min-width: var(--media-preview-thumbnail-min-width, 120px);
|
|
@@ -682,37 +690,36 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
682
690
|
var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0);
|
|
683
691
|
}
|
|
684
692
|
|
|
685
|
-
:host([${
|
|
686
|
-
:host([${
|
|
693
|
+
:host([${U.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail,
|
|
694
|
+
:host([${U.MEDIA_PREVIEW_IMAGE}]:hover) ::slotted(media-preview-thumbnail) {
|
|
687
695
|
transition-delay: var(--media-preview-transition-delay-in, .25s);
|
|
688
696
|
visibility: visible;
|
|
689
697
|
}
|
|
690
698
|
|
|
691
699
|
media-preview-time-display,
|
|
692
700
|
::slotted(media-preview-time-display) {
|
|
693
|
-
color: unset;
|
|
694
701
|
min-width: 0;
|
|
695
702
|
|
|
696
703
|
transition: min-width 0s, border-radius 0s;
|
|
697
704
|
transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
|
|
698
|
-
background: var(--media-preview-time-background, var(--media-preview-background));
|
|
705
|
+
background: var(--media-preview-time-background, var(--media-preview-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)))));
|
|
699
706
|
border-radius: var(--media-preview-time-border-radius,
|
|
700
707
|
var(--media-preview-border-radius) var(--media-preview-border-radius)
|
|
701
708
|
var(--media-preview-border-radius) var(--media-preview-border-radius));
|
|
702
709
|
padding: var(--media-preview-time-padding, 1px 10px 0);
|
|
703
710
|
margin: var(--media-preview-time-margin, 0 0 10px);
|
|
704
|
-
text-shadow: var(--media-preview-time-text-shadow, 0 0 4px
|
|
711
|
+
text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75));
|
|
705
712
|
}
|
|
706
713
|
|
|
707
|
-
:host([${
|
|
708
|
-
:host([${
|
|
714
|
+
:host([${U.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display,
|
|
715
|
+
:host([${U.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) {
|
|
709
716
|
transition-delay: var(--media-preview-transition-delay-in, .25s);
|
|
710
717
|
min-width: 100%;
|
|
711
718
|
border-radius: var(--media-preview-time-border-radius,
|
|
712
719
|
0 0 var(--media-preview-border-radius) var(--media-preview-border-radius));
|
|
713
720
|
}
|
|
714
721
|
|
|
715
|
-
:host([${
|
|
722
|
+
:host([${U.MEDIA_PREVIEW_TIME}]:hover) {
|
|
716
723
|
--media-time-range-hover-display: block;
|
|
717
724
|
}
|
|
718
725
|
</style>
|
|
@@ -727,23 +734,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
727
734
|
|
|
728
735
|
</slot>
|
|
729
736
|
</div>
|
|
730
|
-
`;var
|
|
731
|
-
<slot name="backward">${Jy}</slot>
|
|
732
|
-
`;var eE=0,km=n=>{let a=Math.abs(+n.getAttribute("seek-offset")),o=St.SEEK_BACK_N_SECS({seekOffset:a});n.setAttribute("aria-label",o)},wm=n=>{let a=Yo(n,"backward"),o=n.getAttribute("seek-offset");qo(a,o)},tc=class extends bt{static get observedAttributes(){return[...super.observedAttributes,P.MEDIA_CURRENT_TIME]}constructor(a={}){super({slotTemplate:Lm,...a})}connectedCallback(){this.hasAttribute("seek-offset")||this.setAttribute("seek-offset",ec),km(this),wm(this),super.connectedCallback()}attributeChangedCallback(a,o,m){a==="seek-offset"&&(m==null&&this.setAttribute("seek-offset",ec),wm(this),km(this)),super.attributeChangedCallback(a,o,m)}handleClick(){let a=this.getAttribute(P.MEDIA_CURRENT_TIME),o=+this.getAttribute("seek-offset"),m=a&&!Number.isNaN(+a)?+a:eE,v=Math.max(m-o,0),g=new q.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(g)}};q.customElements.get("media-seek-backward-button")||q.customElements.define("media-seek-backward-button",tc);var Rm=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},Im=(n,a,o)=>(Rm(n,a,"read from private field"),o?o.call(n):a.get(n)),tE=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},iE=(n,a,o,m)=>(Rm(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),Is,ic=class extends Yr{constructor(){super(),tE(this,Is,void 0),iE(this,Is,this.shadowRoot.querySelector("slot")),Im(this,Is).textContent=Ti(0)}static get observedAttributes(){return[...super.observedAttributes,P.MEDIA_PREVIEW_TIME]}attributeChangedCallback(a,o,m){a===P.MEDIA_PREVIEW_TIME&&m!=null&&(Im(this,Is).textContent=Ti(m)),super.attributeChangedCallback(a,o,m)}};Is=new WeakMap;q.customElements.get("media-preview-time-display")||q.customElements.define("media-preview-time-display",ic);var Dm=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},Ll=(n,a,o)=>(Dm(n,a,"read from private field"),o?o.call(n):a.get(n)),rE=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},Il=(n,a,o,m)=>(Dm(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),ur,Cm=re.createElement("template");Cm.innerHTML=`
|
|
733
|
-
<style>
|
|
734
|
-
:host {
|
|
735
|
-
box-sizing: border-box;
|
|
736
|
-
display: var(--media-control-display, var(--media-preview-thumbnail-display, inline-block));
|
|
737
|
-
overflow: hidden;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
img {
|
|
741
|
-
display: none;
|
|
742
|
-
position: relative;
|
|
743
|
-
}
|
|
744
|
-
</style>
|
|
745
|
-
<img crossorigin loading="eager" decoding="async" />
|
|
746
|
-
`;var rc=class extends q.HTMLElement{constructor(){super(),rE(this,ur,void 0),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Cm.content.cloneNode(!0))}static get observedAttributes(){return[Oe.MEDIA_CONTROLLER,"time",P.MEDIA_PREVIEW_IMAGE,P.MEDIA_PREVIEW_COORDS]}connectedCallback(){var a,o,m;let v=this.getAttribute(Oe.MEDIA_CONTROLLER);v&&(Il(this,ur,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(o=Ll(this,ur))==null?void 0:o.associateElement)==null||m.call(o,this))}disconnectedCallback(){var a,o;(o=(a=Ll(this,ur))==null?void 0:a.unassociateElement)==null||o.call(a,this),Il(this,ur,null)}attributeChangedCallback(a,o,m){var v,g,L,M,B;["time",P.MEDIA_PREVIEW_IMAGE,P.MEDIA_PREVIEW_COORDS].includes(a)&&this.update(),a===Oe.MEDIA_CONTROLLER&&(o&&((g=(v=Ll(this,ur))==null?void 0:v.unassociateElement)==null||g.call(v,this),Il(this,ur,null)),m&&(Il(this,ur,(L=this.getRootNode())==null?void 0:L.getElementById(m)),(B=(M=Ll(this,ur))==null?void 0:M.associateElement)==null||B.call(M,this)))}update(){let a=this.getAttribute(P.MEDIA_PREVIEW_COORDS),o=this.getAttribute(P.MEDIA_PREVIEW_IMAGE);if(!(a&&o))return;let[m,v,g,L]=a.split(/\s+/).map(oe=>+oe),M=o.split("#")[0],B=getComputedStyle(this),{maxWidth:U,maxHeight:z,minWidth:ie,minHeight:ee}=B,se=Math.min(parseInt(U)/g,parseInt(z)/L),fe=Math.max(parseInt(ie)/g,parseInt(ee)/L),_e=se<1,Ae=_e?se:fe>1?fe:1,{style:Se}=Dt(this.shadowRoot,":host"),st=Dt(this.shadowRoot,"img").style,Ue=this.shadowRoot.querySelector("img"),le=_e?"min":"max";Se.setProperty(`${le}-width`,"initial","important"),Se.setProperty(`${le}-height`,"initial","important"),Se.width=`${g*Ae}px`,Se.height=`${L*Ae}px`;let w=()=>{st.width=`${this.imgWidth*Ae}px`,st.height=`${this.imgHeight*Ae}px`,st.display="block"};Ue.src!==M&&(Ue.onload=()=>{this.imgWidth=Ue.naturalWidth,this.imgHeight=Ue.naturalHeight,w()},Ue.src=M,w()),w(),st.transform=`translate(-${m*Ae}px, -${v*Ae}px)`}};ur=new WeakMap;q.customElements.get("media-preview-thumbnail")||q.customElements.define("media-preview-thumbnail",rc);var Mm=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},Rl=(n,a,o)=>(Mm(n,a,"read from private field"),o?o.call(n):a.get(n)),aE=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},Dl=(n,a,o,m)=>(Mm(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),cr,xm=re.createElement("template"),nE=`
|
|
737
|
+
`;var lc=class extends Ss{constructor(){super(),gi(this,Il),gi(this,Dl),gi(this,oc),gi(this,Rs,void 0),gi(this,Ll,void 0),gi(this,Ds,void 0),gi(this,Cl,void 0),gi(this,Ml,void 0),gi(this,Rl,l=>{if([...Kt(this,Rs)].some(Q=>l.composedPath().includes(Q)))return;this.updatePointerBar(l);let m=+this.getAttribute(U.MEDIA_DURATION);if(!m)return;let v=this.range.getBoundingClientRect(),E=(l.clientX-v.left)/v.width;E=Math.max(0,Math.min(1,E));let I=Is(this,Il,ac).call(this,Kt(this,Ll),E),{style:M}=Ct(this.shadowRoot,"#preview-rail");M.transform=`translateX(${I})`;let B=E*m,F=new W.CustomEvent(ve.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:B});this.dispatchEvent(F)}),gi(this,gn,!1),gi(this,Cs,l=>{(!l.composedPath().includes(this)||[...Kt(this,Rs)].some(m=>l.composedPath().includes(m)))&&(W.removeEventListener("pointermove",Kt(this,Cs)),$r(this,gn,!1),Kt(this,xl).call(this))}),gi(this,nc,()=>{W.addEventListener("pointermove",Kt(this,Rl),!1)}),gi(this,xl,()=>{W.removeEventListener("pointermove",Kt(this,Rl));let l=new W.CustomEvent(ve.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:null});this.dispatchEvent(l)}),gi(this,Pl,()=>{let l=this.getAttribute(U.MEDIA_DURATION);!Kt(this,gn)&&l&&($r(this,gn,!0),Kt(this,nc).call(this),W.addEventListener("pointermove",Kt(this,Cs),!1))}),this.container.appendChild(Fm.content.cloneNode(!0)),this.range.addEventListener("input",()=>{cancelAnimationFrame(this._refreshId);let m=this.range.value,v=new W.CustomEvent(ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:m});this.dispatchEvent(v)}),this._refreshBar=()=>{let l=(performance.now()-this._updateTimestamp)/1e3;this.range.value=this.mediaCurrentTime+l*this.mediaPlaybackRate,this.updateBar(),this.updateCurrentBox(),this._refreshId=requestAnimationFrame(this._refreshBar)},$r(this,Rs,this.shadowRoot.querySelectorAll('[part~="box"]')),$r(this,Ll,this.shadowRoot.querySelector('[part~="preview-box"]')),$r(this,Ds,this.shadowRoot.querySelector('[part~="current-box"]'));let a=getComputedStyle(this);$r(this,Cl,parseInt(a.getPropertyValue("--media-box-padding-left"))),$r(this,Ml,parseInt(a.getPropertyValue("--media-box-padding-right"))),Is(this,Dl,sc).call(this)}static get observedAttributes(){return[...super.observedAttributes,"thumbnails","disabled",U.MEDIA_PAUSED,U.MEDIA_DURATION,U.MEDIA_SEEKABLE,U.MEDIA_CURRENT_TIME,U.MEDIA_PREVIEW_IMAGE,U.MEDIA_PREVIEW_TIME,U.MEDIA_BUFFERED,U.MEDIA_PLAYBACK_RATE,U.MEDIA_LOADING]}connectedCallback(){this.range.setAttribute("aria-label",Jt.SEEK()),super.connectedCallback()}disconnectedCallback(){cancelAnimationFrame(this._refreshId),super.disconnectedCallback()}attributeChangedCallback(a,l,m){var v,E,I,M,B;(a===U.MEDIA_CURRENT_TIME||a===U.MEDIA_PAUSED||a===U.MEDIA_LOADING)&&(this._updateTimestamp=performance.now(),this.range.value=this.mediaCurrentTime,rc(this),this.updateBar(),this.updateCurrentBox(),cancelAnimationFrame(this._refreshId),!this.mediaPaused&&!this.mediaLoading&&(this._refreshId=requestAnimationFrame(this._refreshBar))),a===U.MEDIA_DURATION&&(this.range.max=(E=(v=this.mediaSeekableEnd)!=null?v:this.mediaDuration)!=null?E:1e3,rc(this),this.updateBar(),this.updateCurrentBox()),a===U.MEDIA_SEEKABLE&&(this.range.min=(I=this.mediaSeekableStart)!=null?I:0,this.range.max=(B=(M=this.mediaSeekableEnd)!=null?M:this.mediaDuration)!=null?B:1e3,rc(this),this.updateBar()),a===U.MEDIA_BUFFERED&&this.updateBar(),a==="disabled"&&(m==null?Is(this,Dl,sc).call(this):Is(this,oc,Nm).call(this)),super.attributeChangedCallback(a,l,m)}get mediaPaused(){return this.hasAttribute(U.MEDIA_PAUSED)}get mediaLoading(){return this.hasAttribute(U.MEDIA_LOADING)}get mediaDuration(){let a=this.getAttribute(U.MEDIA_DURATION);return a!=null?+a:void 0}get mediaCurrentTime(){let a=this.getAttribute(U.MEDIA_CURRENT_TIME);return a!=null?+a:void 0}get mediaPlaybackRate(){let a=this.getAttribute(U.MEDIA_PLAYBACK_RATE);return a!=null?+a:1}get mediaBuffered(){let a=this.getAttribute(U.MEDIA_BUFFERED);return a?a.split(" ").map(l=>l.split(":").map(m=>+m)):[]}get mediaSeekable(){let a=this.getAttribute(U.MEDIA_SEEKABLE);if(!!a)return a.split(":").map(l=>+l)}get mediaSeekableEnd(){var a;let[,l]=(a=this.mediaSeekable)!=null?a:[];return l}get mediaSeekableStart(){var a;let[l]=(a=this.mediaSeekable)!=null?a:[];return l}getBarColors(){var a;let l=super.getBarColors(),{range:m}=this,v=m.max-m.min,E=this.mediaBuffered;if(!E.length||!Number.isFinite(v)||v<=0)return l;let I=this.mediaCurrentTime,[,M=m.min]=(a=E.find(([Q,re])=>Q<=I&&I<=re))!=null?a:[],F=(M-m.min)/v*100;return l.splice(1,0,["var(--media-time-buffered-color, rgb(255 255 255 / .4))",F]),l}updateCurrentBox(){if(!Kt(this,Ds).assignedElements().length)return;let a=this.range.value/(this.range.max-this.range.min),l=Is(this,Il,ac).call(this,Kt(this,Ds),a),{style:m}=Ct(this.shadowRoot,"#current-rail");m.transform=`translateX(${l})`}};Rs=new WeakMap;Ll=new WeakMap;Ds=new WeakMap;Cl=new WeakMap;Ml=new WeakMap;Il=new WeakSet;ac=function(n,a){var l;let m=`${a*100*100}%`,v=n.offsetWidth;if(!v)return m;let E=(l=this.getAttribute("bounds")?Ra(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?l:this,I=this.range.getBoundingClientRect(),M=E.getBoundingClientRect(),B=(Kt(this,Cl)-(I.left-M.left-v/2))/I.width*100,F=(M.right-I.left-v/2-Kt(this,Ml))/I.width*100;return Number.isNaN(B)||(m=`max(${B*100}%, ${m})`),Number.isNaN(F)||(m=`min(${m}, ${F*100}%)`),m};Rl=new WeakMap;gn=new WeakMap;Cs=new WeakMap;nc=new WeakMap;xl=new WeakMap;Pl=new WeakMap;Dl=new WeakSet;sc=function(){this.addEventListener("pointermove",Kt(this,Pl),!1)};oc=new WeakSet;Nm=function(){W.removeEventListener("pointermove",Kt(this,Cs)),this.removeEventListener("pointermove",Kt(this,Pl)),$r(this,gn,!1),Kt(this,xl).call(this)};W.customElements.get("media-time-range")||W.customElements.define("media-time-range",lc);var Um=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},Ol=(n,a,l)=>(Um(n,a,"read from private field"),l?l.call(n):a.get(n)),rE=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Nl=(n,a,l,m)=>(Um(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),or,Bm=ie.createElement("template"),aE=`
|
|
747
738
|
<svg aria-hidden="true" viewBox="0 0 100 100">
|
|
748
739
|
<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">
|
|
749
740
|
<animateTransform
|
|
@@ -756,7 +747,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
756
747
|
repeatCount="indefinite" />
|
|
757
748
|
</path>
|
|
758
749
|
</svg>
|
|
759
|
-
`;
|
|
750
|
+
`;Bm.innerHTML=`
|
|
760
751
|
<style>
|
|
761
752
|
:host {
|
|
762
753
|
display: var(--media-control-display, var(--media-loading-indicator-display, inline-block));
|
|
@@ -788,54 +779,52 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
788
779
|
svg, img, ::slotted(svg), ::slotted(img) {
|
|
789
780
|
width: var(--media-loading-icon-width, 100px);
|
|
790
781
|
height: var(--media-loading-icon-height);
|
|
791
|
-
fill: var(--media-icon-color,
|
|
782
|
+
fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
|
|
792
783
|
vertical-align: middle;
|
|
793
784
|
}
|
|
794
785
|
</style>
|
|
795
786
|
|
|
796
|
-
<slot name="loading">${
|
|
797
|
-
<div id="status" role="status" aria-live="polite">${
|
|
798
|
-
`;var
|
|
799
|
-
<style>
|
|
800
|
-
:host {
|
|
801
|
-
}
|
|
802
|
-
</style>
|
|
803
|
-
<slot></slot>
|
|
804
|
-
`;var nc=class extends q.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Pm.content.cloneNode(!0))}};q.customElements.get("media-title-bar")||q.customElements.define("media-title-bar",nc);var oE=100,lE=n=>{var a;if(n.getAttribute(P.MEDIA_MUTED)!=null)return 0;let m=+((a=n.getAttribute(P.MEDIA_VOLUME))!=null?a:1);return Math.round(m*n.range.max)},dE=({value:n,max:a})=>`${Math.round(n/a*100)}%`,sc=class extends bs{static get observedAttributes(){return[...super.observedAttributes,P.MEDIA_VOLUME,P.MEDIA_MUTED,P.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=oE,this.range.addEventListener("input",()=>{let o=this.range.value/this.range.max,m=new q.CustomEvent(ve.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:o});this.dispatchEvent(m)})}connectedCallback(){this.range.setAttribute("aria-label",Zt.VOLUME()),super.connectedCallback()}attributeChangedCallback(a,o,m){if(a===P.MEDIA_VOLUME||a===P.MEDIA_MUTED){let v=lE(this);this.range.value=v,this.range.setAttribute("aria-valuetext",dE(this.range)),this.updateBar()}super.attributeChangedCallback(a,o,m)}};q.customElements.get("media-volume-range")||q.customElements.define("media-volume-range",sc);var oc=class extends ys{};q.customElements.get("media-chrome")||q.customElements.define("media-chrome",oc);var lc=class extends ys{constructor(){super(),console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}};q.customElements.get("media-container")||q.customElements.define("media-container",lc);var hc=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},ht=(n,a,o)=>(hc(n,a,"read from private field"),o?o.call(n):a.get(n)),Fi=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},hr=(n,a,o,m)=>(hc(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),Rs=(n,a,o)=>(hc(n,a,"access private method"),o),jr,gn,Ds,bn,Sr,yn,dc,Aa,En,Cl,vn,uc,Cs,Ml,cc,Om,fc,Nm,Fm=re.createElement("template");Fm.innerHTML=`
|
|
787
|
+
<slot name="loading">${aE}</slot>
|
|
788
|
+
<div id="status" role="status" aria-live="polite">${Jt.MEDIA_LOADING()}</div>
|
|
789
|
+
`;var nE=500,uc=class extends W.HTMLElement{constructor(){if(super(),rE(this,or,void 0),!this.shadowRoot){let a=this.attachShadow({mode:"open"}),l=Bm.content.cloneNode(!0);a.appendChild(l)}}static get observedAttributes(){return[Pe.MEDIA_CONTROLLER,U.MEDIA_PAUSED,U.MEDIA_LOADING,"loading-delay"]}attributeChangedCallback(a,l,m){var v,E,I,M,B,F;if(a===U.MEDIA_LOADING||a===U.MEDIA_PAUSED){let Q=this.getAttribute(U.MEDIA_PAUSED)!=null,re=this.getAttribute(U.MEDIA_LOADING)!=null,te=!Q&&re;if(!te)this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),this.removeAttribute("is-loading");else if(!this.loadingDelayHandle&&te){let se=+((v=this.getAttribute("loading-delay"))!=null?v:nE);this.loadingDelayHandle=setTimeout(()=>{this.setAttribute("is-loading",""),this.loadingDelayHandle=void 0},se)}}else a===Pe.MEDIA_CONTROLLER&&(l&&((I=(E=Ol(this,or))==null?void 0:E.unassociateElement)==null||I.call(E,this),Nl(this,or,null)),m&&(Nl(this,or,(M=this.getRootNode())==null?void 0:M.getElementById(m)),(F=(B=Ol(this,or))==null?void 0:B.associateElement)==null||F.call(B,this)))}connectedCallback(){var a,l,m;let v=this.getAttribute(Pe.MEDIA_CONTROLLER);v&&(Nl(this,or,(a=this.getRootNode())==null?void 0:a.getElementById(v)),(m=(l=Ol(this,or))==null?void 0:l.associateElement)==null||m.call(l,this))}disconnectedCallback(){var a,l;this.loadingDelayHandle&&(clearTimeout(this.loadingDelayHandle),this.loadingDelayHandle=void 0),(l=(a=Ol(this,or))==null?void 0:a.unassociateElement)==null||l.call(a,this),Nl(this,or,null)}};or=new WeakMap;W.customElements.get("media-loading-indicator")||W.customElements.define("media-loading-indicator",uc);var sE=100,oE=n=>{var a;if(n.getAttribute(U.MEDIA_MUTED)!=null)return 0;let m=+((a=n.getAttribute(U.MEDIA_VOLUME))!=null?a:1);return Math.round(m*n.range.max)},lE=({value:n,max:a})=>`${Math.round(n/a*100)}%`,cc=class extends Ss{static get observedAttributes(){return[...super.observedAttributes,U.MEDIA_VOLUME,U.MEDIA_MUTED,U.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=sE,this.range.addEventListener("input",()=>{let l=this.range.value/this.range.max,m=new W.CustomEvent(ve.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:l});this.dispatchEvent(m)})}connectedCallback(){this.range.setAttribute("aria-label",Jt.VOLUME()),super.connectedCallback()}attributeChangedCallback(a,l,m){if(a===U.MEDIA_VOLUME||a===U.MEDIA_MUTED){let v=oE(this);this.range.value=v,this.range.setAttribute("aria-valuetext",lE(this.range)),this.updateBar()}super.attributeChangedCallback(a,l,m)}};W.customElements.get("media-volume-range")||W.customElements.define("media-volume-range",cc);var hc=class extends Ts{};W.customElements.get("media-chrome")||W.customElements.define("media-chrome",hc);var fc=class extends Ts{constructor(){super(),console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}};W.customElements.get("media-container")||W.customElements.define("media-container",fc);var Ec=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},lt=(n,a,l)=>(Ec(n,a,"read from private field"),l?l.call(n):a.get(n)),si=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Fi=(n,a,l,m)=>(Ec(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),Sr=(n,a,l)=>(Ec(n,a,"access private method"),l),zr,En,Ms,bn,xs,kr,_n,mc,jr,xa,Fl,Ul,pc,yn,vc,Ps,Bl,Hl,gc,yc,Hm,bc,Gm,Vm=ie.createElement("template");Vm.innerHTML=`
|
|
805
790
|
<style>
|
|
806
791
|
:host ul {
|
|
792
|
+
font: var(--media-font,
|
|
793
|
+
var(--media-font-weight, normal)
|
|
794
|
+
var(--media-font-size, 1em) /
|
|
795
|
+
var(--media-text-content-height, var(--media-control-height, 24px))
|
|
796
|
+
var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
|
|
797
|
+
color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
|
|
798
|
+
background: var(--media-listbox-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .8))));
|
|
807
799
|
list-style: none;
|
|
808
800
|
display: inline-flex;
|
|
809
801
|
flex-direction: column;
|
|
810
802
|
gap: 0.5em;
|
|
811
803
|
margin: 0;
|
|
812
804
|
padding: 0.5em;
|
|
813
|
-
background-color: var(--media-listbox-background, var(--media-control-background, rgba(10,10,15, .8)));
|
|
814
|
-
color: var(--media-text-color, white);
|
|
815
|
-
font-family: Arial, sans-serif;
|
|
816
805
|
}
|
|
817
806
|
|
|
818
807
|
::slotted(media-chrome-listitem[tabindex="0"]:focus-visible),
|
|
819
808
|
media-chrome-listitem[tabindex="0"]:focus-visible {
|
|
820
|
-
box-shadow: inset 0 0 0 2px
|
|
809
|
+
box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9);
|
|
821
810
|
outline: 0;
|
|
822
811
|
}
|
|
823
812
|
|
|
824
813
|
::slotted(media-chrome-listitem[aria-selected="true"]),
|
|
825
814
|
media-chrome-listitem[aria-selected="true"] {
|
|
826
|
-
background-color: var(--media-listbox-selected-background,
|
|
815
|
+
background-color: var(--media-listbox-selected-background, rgb(122 122 184 / .8));
|
|
827
816
|
}
|
|
828
817
|
|
|
829
818
|
::slotted(media-chrome-listitem:hover),
|
|
830
819
|
media-chrome-listitem:hover {
|
|
831
|
-
background-color: var(--media-listbox-hover-background,
|
|
820
|
+
background-color: var(--media-listbox-hover-background, rgb(82 82 122 / .8));
|
|
832
821
|
outline: var(--media-listbox-hover-outline, none);
|
|
833
822
|
}
|
|
834
823
|
</style>
|
|
835
824
|
<ul tabindex="0">
|
|
836
825
|
<slot></slot>
|
|
837
826
|
</ul>
|
|
838
|
-
`;var
|
|
827
|
+
`;var Gl=class extends W.HTMLElement{constructor(a={}){if(super(),si(this,kr),si(this,jr),si(this,Ul),si(this,Ps),si(this,Hl),si(this,yc),si(this,bc),si(this,zr,""),si(this,En,null),si(this,Ms,void 0),si(this,bn,void 0),si(this,xs,!1),si(this,Fl,l=>{this.handleClick(l)}),si(this,yn,l=>{let{key:m}=l;if(m==="Escape"){this.removeEventListener("keyup",lt(this,yn));return}if(m==="Meta"){Fi(this,xs,!1);return}Sr(this,Ul,pc).call(this,l)}),si(this,vc,l=>{let{key:m,altKey:v}=l;if(v){this.removeEventListener("keyup",lt(this,yn));return}if(m==="Meta"){Fi(this,xs,!0);return}if(this.keysUsed.includes(m)&&l.preventDefault(),lt(this,xs)&&this.keysUsed.includes(m)){Sr(this,Ul,pc).call(this,l);return}this.addEventListener("keyup",lt(this,yn),{once:!0})}),!this.shadowRoot){let l=this.attachShadow({mode:"open"}),m=Vm.content.cloneNode(!0);this.nativeEl=m;let v=a.slotTemplate;v||(v=ie.createElement("template"),v.innerHTML=`<slot>${a.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),l.appendChild(m)}Fi(this,Ms,this.shadowRoot.querySelector("slot")),lt(this,Ms).addEventListener("slotchange",()=>{Fi(this,kr,lt(this,Ms).assignedElements({flatten:!0}),mc),lt(this,kr,_n).length===1&<(this,kr,_n)[0].nodeName.toLowerCase()==="slot"&&Fi(this,kr,lt(this,kr,_n)[0].assignedElements({flatten:!0}),mc);let l=lt(this,jr,xa);if(l.some(E=>E.getAttribute("tabindex")==="0"))return;let v=l.filter(E=>E.getAttribute("aria-selected")==="true")[0];v||(v=l[0]),v&&(v.setAttribute("tabindex",0),v.setAttribute("aria-selected","true"))})}static get observedAttributes(){return["disabled",Pe.MEDIA_CONTROLLER]}get selectedOptions(){return lt(this,jr,xa).filter(a=>a.getAttribute("aria-selected")==="true")}get value(){return this.selectedOptions[0].value||this.selectedOptions[0].textContent}set value(a){let l=lt(this,jr,xa).find(m=>m.value===a||m.textContent===a);!l||Sr(this,Hl,gc).call(this,l)}focus(){var a;(a=this.selectedOptions[0])==null||a.focus()}enable(){this.addEventListener("click",lt(this,Fl)),this.addEventListener("keydown",lt(this,vc))}disable(){this.removeEventListener("click",lt(this,Fl)),this.removeEventListener("keyup",lt(this,yn))}attributeChangedCallback(a,l,m){var v,E;if(a===Pe.MEDIA_CONTROLLER){if(l){let I=ie.getElementById(l);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this)}if(m){let I=ie.getElementById(m);(E=I==null?void 0:I.associateElement)==null||E.call(I,this)}}else a==="disabled"&&m!==l&&(m==null?this.enable():this.disable())}connectedCallback(){var a;this.hasAttribute("disabled")||this.enable(),this.hasAttribute("role")||this.setAttribute("role","listbox");let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.associateElement)==null||a.call(m,this)}}disconnectedCallback(){var a;this.disable();let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.unassociateElement)==null||a.call(m,this)}}get keysUsed(){return["Enter"," ","ArrowDown","ArrowUp","Home","End"]}handleSelection(a,l){let m=Sr(this,Ps,Bl).call(this,a);!m||Sr(this,Hl,gc).call(this,m,l)}handleMovement(a){let{key:l}=a,m=lt(this,jr,xa),v=Sr(this,Ps,Bl).call(this,a);v||(v=m.filter(I=>I.getAttribute("tabindex")==="0")[0]);let E;switch(l){case"ArrowDown":E=v.nextElementSibling,E!=null&&E.hasAttribute("disabled")&&(E=E.nextElementSibling);break;case"ArrowUp":E=v.previousElementSibling,E!=null&&E.hasAttribute("disabled")&&(E=E.previousElementSibling);break;case"Home":E=m[0];break;case"End":E=m[m.length-1];break;default:E=Sr(this,yc,Hm).call(this,l);break}E&&(m.forEach(I=>I.setAttribute("tabindex","-1")),E.setAttribute("tabindex","0"),E.focus())}handleClick(a){let l=Sr(this,Ps,Bl).call(this,a);!l||l.hasAttribute("disabled")||(lt(this,jr,xa).forEach(m=>m.setAttribute("tabindex","-1")),l.setAttribute("tabindex","0"),this.handleSelection(a,this.hasAttribute("aria-multiselectable")&&this.getAttribute("aria-multiselectable")==="true"))}};zr=new WeakMap;En=new WeakMap;Ms=new WeakMap;bn=new WeakMap;xs=new WeakMap;kr=new WeakSet;_n=function(){return lt(this,bn)||Fi(this,bn,Array.from(this.shadowRoot.querySelectorAll("media-chrome-listitem"))),lt(this,bn)};mc=function(n){Fi(this,bn,n)};jr=new WeakSet;xa=function(){return lt(this,kr,_n).filter(n=>!n.hasAttribute("disabled"))};Fl=new WeakMap;Ul=new WeakSet;pc=function(n){let{key:a}=n;a==="Enter"||a===" "?this.handleSelection(n,this.hasAttribute("aria-multiselectable")&&this.getAttribute("aria-multiselectable")==="true"):this.handleMovement(n)};yn=new WeakMap;vc=new WeakMap;Ps=new WeakSet;Bl=function(n){let a=n.composedPath(),l=a.findIndex(m=>m.nodeName==="MEDIA-CHROME-LISTITEM");return a[l]};Hl=new WeakSet;gc=function(n,a){(!this.hasAttribute("aria-multiselectable")||this.getAttribute("aria-multiselectable")!=="true")&<(this,kr,_n).forEach(l=>l.setAttribute("aria-selected","false")),a&&n.getAttribute("aria-selected")==="true"?n.setAttribute("aria-selected","false"):n.setAttribute("aria-selected","true"),this.dispatchEvent(new Event("change"))};yc=new WeakSet;Hm=function(n){Sr(this,bc,Gm).call(this);let a=lt(this,jr,xa),l=a.findIndex(F=>F.getAttribute("tabindex")==="0");Fi(this,zr,lt(this,zr)+n);let m=lt(this,zr).split("").every(F=>F===n),v=a.slice(l+(m?1:0)).filter(F=>F.textContent.toLowerCase().startsWith(lt(this,zr))),E=a.slice(0,l-(m?1:0)).filter(F=>F.textContent.toLowerCase().startsWith(lt(this,zr))),I=[],M=[];return m&&(I=a.slice(l+(m?1:0)).filter(F=>F.textContent.startsWith(n)),M=a.slice(0,l-(m?1:0)).filter(F=>F.textContent.startsWith(n))),[...v,...E,...I,...M][0]};bc=new WeakSet;Gm=function(){W.clearTimeout(lt(this,En)),Fi(this,En,null),Fi(this,En,W.setTimeout(()=>{Fi(this,zr,""),Fi(this,En,null)},500))};W.customElements.get("media-chrome-listbox")||W.customElements.define("media-chrome-listbox",Gl);var Km=Gl;var Ac=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},ge=(n,a,l)=>(Ac(n,a,"read from private field"),l?l.call(n):a.get(n)),ti=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Ui=(n,a,l,m)=>(Ac(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),wr=(n,a,l)=>(Ac(n,a,"access private method"),l),Tn,Os,An,Ut,Ns,mt,lr,Fs,Pa,Sn,Vl,_c,Wm,Tc,qm,kn,Us,Sc,Ym,Kl,kc,$m=ie.createElement("template");$m.innerHTML=`
|
|
839
828
|
<style>
|
|
840
829
|
:host {
|
|
841
830
|
display: inline-flex;
|
|
@@ -863,7 +852,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
863
852
|
<slot></slot>
|
|
864
853
|
</media-chrome-listbox>
|
|
865
854
|
</slot>
|
|
866
|
-
`;var
|
|
855
|
+
`;var Wl=class extends W.HTMLElement{constructor(){var a;if(super(),ti(this,_c),ti(this,Tc),ti(this,kn),ti(this,Sc),ti(this,Kl),ti(this,Tn,void 0),ti(this,Os,void 0),ti(this,An,!0),ti(this,Ut,void 0),ti(this,Ns,void 0),ti(this,mt,void 0),ti(this,lr,void 0),ti(this,Fs,!1),ti(this,Pa,m=>{let{key:v}=m;if(!this.keysUsed.includes(v)){this.removeEventListener("keyup",ge(this,Pa));return}m.composedPath().includes(ge(this,Ut))&&(v==="Enter"||v===" ")?ge(this,Tn).call(this):v==="Escape"&&!ge(this,lr).hidden&&wr(this,kn,Us).call(this)}),ti(this,Sn,m=>{let{metaKey:v,altKey:E,key:I}=m;if(v||E||!this.keysUsed.includes(I)){this.removeEventListener("keyup",ge(this,Pa));return}m.preventDefault(),this.addEventListener("keyup",ge(this,Pa),{once:!0})}),ti(this,Vl,m=>{m.composedPath().includes(this)||ge(this,lr).hidden||wr(this,kn,Us).call(this)}),!this.shadowRoot){let m=this.attachShadow({mode:"open"}),v=$m.content.cloneNode(!0);this.nativeEl=v,m.appendChild(v)}let{style:l}=Ct(this.shadowRoot,":host");l.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),Ui(this,Tn,wr(this,_c,Wm).bind(this)),Ui(this,Os,wr(this,Tc,qm).bind(this)),(a=this.init)==null||a.call(this),Ui(this,Ut,this.shadowRoot.querySelector("[part=button]")),Ui(this,mt,this.shadowRoot.querySelector("[part=listbox]")),Ui(this,Ns,this.shadowRoot.querySelector("slot[name=button]")),ge(this,Ns).addEventListener("slotchange",()=>{let m=ge(this,Ns).assignedElements()[0];!m||(this.disable(),Ui(this,Ut,m),ge(this,Ut).preventClick=!0,ge(this,Ut).hasAttribute("disabled")&&Ui(this,An,!1),ge(this,An)?(this.enable(),ge(this,Ut).setAttribute("aria-haspopup","listbox")):this.disable())}),Ui(this,lr,this.shadowRoot.querySelector("slot[name=listbox]")),ge(this,lr).addEventListener("slotchange",()=>{this.disable(),Ui(this,mt,ge(this,lr).assignedElements()[0]||ge(this,mt)),this.enable()})}static get observedAttributes(){return["disabled",Pe.MEDIA_CONTROLLER]}enable(){ge(this,Ut).removeAttribute("disabled"),ge(this,Ut).addEventListener("click",ge(this,Tn)),ge(this,Ut).addEventListener("keydown",ge(this,Sn)),ge(this,mt).addEventListener("keydown",ge(this,Sn)),wr(this,Kl,kc).call(this),ge(this,mt).addEventListener("change",ge(this,Os)),ie.addEventListener("click",ge(this,Vl))}disable(){ge(this,Ut).setAttribute("disabled",""),ge(this,Ut).removeEventListener("click",ge(this,Tn)),ge(this,Ut).removeEventListener("keydown",ge(this,Sn)),ge(this,Ut).removeEventListener("keyup",ge(this,Pa)),ge(this,mt).removeEventListener("keydown",ge(this,Sn)),ge(this,mt).removeEventListener("keyup",ge(this,Pa)),ge(this,mt).addEventListener("change",ge(this,Os)),ie.removeEventListener("click",ge(this,Vl))}attributeChangedCallback(a,l,m){var v,E;if(a===Pe.MEDIA_CONTROLLER){if(l){let I=ie.getElementById(l);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this),ge(this,mt).removeAttribute(Pe.MEDIA_CONTROLLER)}if(m){let I=ie.getElementById(m);(E=I==null?void 0:I.associateElement)==null||E.call(I,this),ge(this,mt).setAttribute(Pe.MEDIA_CONTROLLER,m)}}else a==="disabled"&&m!==l&&(m==null?(Ui(this,An,!0),this.enable()):(Ui(this,An,!1),this.disable()))}connectedCallback(){var a;this.hasAttribute("disabled")||this.enable();let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.associateElement)==null||a.call(m,this),ge(this,mt).setAttribute(Pe.MEDIA_CONTROLLER,l)}}disconnectedCallback(){var a;this.disable();let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.unassociateElement)==null||a.call(m,this),ge(this,mt).removeAttribute(Pe.MEDIA_CONTROLLER)}}get keysUsed(){return["Enter","Escape"," ","ArrowUp","ArrowDown","f","c","k","m"]}};Tn=new WeakMap;Os=new WeakMap;An=new WeakMap;Ut=new WeakMap;Ns=new WeakMap;mt=new WeakMap;lr=new WeakMap;Fs=new WeakMap;Pa=new WeakMap;Sn=new WeakMap;Vl=new WeakMap;_c=new WeakSet;Wm=function(){wr(this,kn,Us).call(this)};Tc=new WeakSet;qm=function(){wr(this,kn,Us).call(this,!0)};kn=new WeakSet;Us=function(n){ge(this,lr).hidden=!ge(this,lr).hidden||n,wr(this,Kl,kc).call(this,n),ge(this,lr).hidden?(this.shadowRoot.activeElement===ge(this,mt)||ge(this,mt).contains(this.shadowRoot.activeElement))&&ge(this,Ut).focus():(ge(this,mt).focus(),wr(this,Sc,Ym).call(this))};Sc=new WeakSet;Ym=function(){var n;if(ge(this,mt).offsetWidth===0)return;let a=ge(this,Ut).getBoundingClientRect();if(this.hasAttribute("media-controller")||ge(this,Ut).hasAttribute("media-controller")||ge(this,mt).hasAttribute("media-controller")){ge(this,mt).style.zIndex="1",ge(this,mt).style.bottom="unset",ge(this,mt).style.top=a.height+"px";return}let m=((n=this.getAttribute("bounds")?Ra(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?n:this).getBoundingClientRect(),v=ge(this,mt).getBoundingClientRect(),E=-Math.max(a.x+v.width-m.right,0);ge(this,mt).style.transform=`translateX(${E}px)`};Kl=new WeakSet;kc=function(n=!1){Ui(this,Fs,!ge(this,Fs)||n),ge(this,Ut).setAttribute("aria-expanded",ge(this,Fs))};W.customElements.get("media-chrome-selectmenu")||W.customElements.define("media-chrome-selectmenu",Wl);var jm=Wl;var zm=ie.createElement("template");zm.innerHTML=`
|
|
867
856
|
<style>
|
|
868
857
|
:host {
|
|
869
858
|
display: list-item;
|
|
@@ -880,25 +869,25 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
880
869
|
<li>
|
|
881
870
|
<slot></slot>
|
|
882
871
|
</li>
|
|
883
|
-
`;var
|
|
884
|
-
fill: var(--media-icon-color,
|
|
872
|
+
`;var wc=class extends W.HTMLElement{static get observedAttributes(){return["disabled","aria-selected","value",Pe.MEDIA_CONTROLLER]}constructor(){if(super(),!this.shadowRoot){let a=this.attachShadow({mode:"open"}),l=zm.content.cloneNode(!0);this.nativeEl=l,a.appendChild(l)}}set value(a){this.setAttribute("value",a)}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(a,l,m){var v,E;if(a===Pe.MEDIA_CONTROLLER){if(l){let I=ie.getElementById(l);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this)}if(m){let I=ie.getElementById(m);(E=I==null?void 0:I.associateElement)==null||E.call(I,this)}}else a==="disabled"&&m!==l&&(m==null?this.enable():this.disable())}connectedCallback(){var a;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","option");let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.associateElement)==null||a.call(m,this)}}disconnectedCallback(){var a;this.disable();let l=this.getAttribute(Pe.MEDIA_CONTROLLER);if(l){let m=ie.getElementById(l);(a=m==null?void 0:m.unassociateElement)==null||a.call(m,this)}}handleClick(){}};W.customElements.get("media-chrome-listitem")||W.customElements.define("media-chrome-listitem",wc);var Cc=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},jt=(n,a,l)=>(Cc(n,a,"read from private field"),l?l.call(n):a.get(n)),Qr=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Xr=(n,a,l,m)=>(Cc(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),$i=(n,a,l)=>(Cc(n,a,"access private method"),l),Ln,In,Lr,Bi,ql,Lc,$l,Ic,Oa,wn,Yl,Rc,Xm=`
|
|
873
|
+
fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
|
|
885
874
|
height: var(--media-captions-indicator-height, 1em);
|
|
886
875
|
vertical-align: var(--media-captions-indicator-vertical-align, bottom);
|
|
887
876
|
margin-inline-start: 1ch;
|
|
888
|
-
`,
|
|
889
|
-
<svg style="${
|
|
877
|
+
`,dE=`
|
|
878
|
+
<svg style="${Xm}" aria-hidden="true" viewBox="0 0 26 24">
|
|
890
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"/>
|
|
891
|
-
</svg
|
|
880
|
+
</svg>`,Zm=ie.createElement("template");Zm.innerHTML=`
|
|
892
881
|
<style>
|
|
893
882
|
media-chrome-listitem {
|
|
894
883
|
white-space: var(--media-captions-listbox-white-space, nowrap);
|
|
895
884
|
}
|
|
896
885
|
|
|
897
886
|
</style>
|
|
898
|
-
<slot hidden name="captions-indicator">${
|
|
899
|
-
`;var qm=(n,a)=>n.label===a.label&&n.language===a.language,Ac=class extends Um{constructor(){super({slotTemplate:$m}),zr(this,Fl),zr(this,Bl),zr(this,ka),zr(this,Ul),zr(this,wn,[]),zr(this,Ln,[]),zr(this,wr,void 0),zr(this,Bi,void 0);let a=re.createElement("media-chrome-listitem");a.part.add("listitem"),a.value="off",a.textContent="Off",Qr(this,wr,a);let o=this.shadowRoot.querySelector('[name="captions-indicator"]');Qr(this,Bi,o.firstElementChild),o.addEventListener("slotchange",()=>{let m=o.assignedElements();if(m.length===1&&m[0].nodeName.toLowerCase()==="slot"){let v=m[0].assignedElements();v.length===0?Qr(this,Bi,m[0].firstElementChild):v.length===1&&Qr(this,Bi,v[0])}Yt(this,Bi)||Qr(this,Bi,o.firstElementChild),Qr(this,Bi,Yt(this,Bi).cloneNode(!0)),Yt(this,Bi).removeAttribute("slot"),Yt(this,Bi).setAttribute("style",Ym)})}static get observedAttributes(){return[...super.observedAttributes,"aria-multiselectable",P.MEDIA_CAPTIONS_LIST,P.MEDIA_CAPTIONS_SHOWING,P.MEDIA_SUBTITLES_LIST,P.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(a,o,m){if(a===P.MEDIA_SUBTITLES_LIST&&o!==m)Qr(this,wn,zi(this,Fl,bc).call(this,m,Yt(this,wn))),zi(this,ka,kn).call(this);else if(a===P.MEDIA_CAPTIONS_LIST&&o!==m)Qr(this,Ln,zi(this,Fl,bc).call(this,m,Yt(this,Ln))),zi(this,ka,kn).call(this);else if(a===P.MEDIA_SUBTITLES_SHOWING&&o!==m){let v=us(m!=null?m:"")[0];Yt(this,wn).forEach(g=>{g.selected=g.language===v.language&&g.label===v.label}),zi(this,ka,kn).call(this)}else if(a===P.MEDIA_CAPTIONS_SHOWING&&o!==m){let v=us(m!=null?m:"")[0];Yt(this,Ln).forEach(g=>{g.selected=g.language===v.language&&g.label===v.label}),zi(this,ka,kn).call(this)}else a==="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(a,o,m)}connectedCallback(){zi(this,ka,kn).call(this),this.addEventListener("change",zi(this,Ul,Tc)),super.connectedCallback()}disconnectedCallback(){this.removeEventListener("change",zi(this,Ul,Tc)),super.disconnectedCallback()}};wn=new WeakMap;Ln=new WeakMap;wr=new WeakMap;Bi=new WeakMap;Fl=new WeakSet;bc=function(n,a){let o=n?us(n!=null?n:""):[],m=[],v=[];return a.forEach(g=>{o.some(L=>qm(L,g))||m.push(g)}),o.forEach(g=>{a.some(L=>qm(L,g))||v.push(g)}),m.forEach(g=>g.el.remove()),a.filter(g=>!m.includes(g)).concat(v)};Bl=new WeakSet;_c=function(n,a){let o=this.shadowRoot.querySelector("ul slot");n.forEach(m=>{let v=m.el,g=!0;if(!v){v=re.createElement("media-chrome-listitem"),g=!1,v.part.add("listitem"),v.value=a+"!"+Tu(m);let L=re.createElement("span");L.textContent=m.label,v.append(L),a==="cc"&&v.append(Yt(this,Bi).cloneNode(!0))}m.selected?v.setAttribute("aria-selected","true"):v.setAttribute("aria-selected","false"),g||(o.append(v),m.el=v)})};ka=new WeakSet;kn=function(){let n=this.shadowRoot.querySelector("ul slot");n.contains(Yt(this,wr))||n.append(Yt(this,wr)),!this.hasAttribute(P.MEDIA_CAPTIONS_SHOWING)&&!this.hasAttribute(P.MEDIA_SUBTITLES_SHOWING)?(Yt(this,wr).setAttribute("aria-selected","true"),Yt(this,wr).setAttribute("tabindex","0")):(Yt(this,wr).setAttribute("aria-selected","false"),Yt(this,wr).setAttribute("tabindex","-1")),zi(this,Bl,_c).call(this,Yt(this,Ln),"cc"),zi(this,Bl,_c).call(this,Yt(this,wn),"subs")};Ul=new WeakSet;Tc=function(){var n,a,o;let[m,v]=(o=(a=(n=this.selectedOptions[0])==null?void 0:n.value)==null?void 0:a.split("!"))!=null?o:[];if(ba(this),!v)return;let g=new q.CustomEvent(m==="cc"?ve.MEDIA_SHOW_CAPTIONS_REQUEST:ve.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(g)};q.customElements.get("media-captions-listbox")||q.customElements.define("media-captions-listbox",Ac);var kc=class extends Km{constructor(){super()}init(){let a=re.createElement("media-captions-button");a.part.add("button"),a.preventClick=!0,this.hasAttribute("default-showing")&&a.setAttribute("default-showing","");let o=re.createElement("media-captions-listbox");o.part.add("listbox"),o.setAttribute("exportparts","listitem");let m=this.shadowRoot.querySelector("slot[name=button]"),v=this.shadowRoot.querySelector("slot[name=listbox]");m.textContent="",v.textContent="",m.append(a),v.append(o)}};q.customElements.get("media-captions-selectmenu")||q.customElements.define("media-captions-selectmenu",kc);var Gl=lf(jm(),1),rp=lf(Qm(),1),cE=rp.default,fi=cE,Ns=class extends Error{constructor(n,a=Ns.MEDIA_ERR_CUSTOM,o,m){var v;super(n),this.name="MediaError",this.code=a,this.context=m,this.fatal=o!=null?o:a>=Ns.MEDIA_ERR_NETWORK&&a<=Ns.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(v=Ns.defaultMessages[this.code])!=null?v:"")}},vt=Ns;vt.MEDIA_ERR_ABORTED=1,vt.MEDIA_ERR_NETWORK=2,vt.MEDIA_ERR_DECODE=3,vt.MEDIA_ERR_SRC_NOT_SUPPORTED=4,vt.MEDIA_ERR_ENCRYPTED=5,vt.MEDIA_ERR_CUSTOM=100,vt.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 hE=n=>n==null,ap=(n,a)=>hE(a)?!1:n in a,Rc={ANY:"any",MUTED:"muted"},gt={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Hi={MSE:"mse",NATIVE:"native"},Dc={HEADER:"header",QUERY:"query",NONE:"none"},Rn=Object.values(Dc),In={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Cc={HLS:In.M3U8},aS=Object.keys(Cc),nS=[...Object.values(In),"hls","HLS"],Xr=(n,a,o,m,v=n)=>{v.addEventListener(a,o,m),n.addEventListener("teardown",()=>{v.removeEventListener(a,o)},{once:!0})};function fE(n,a,o){a&&o>a&&(o=a);for(let m=0;m<n.length;m++)if(n.start(m)<=o&&n.end(m)>=o)return!0;return!1}var mE=n=>{let a=n.indexOf("?");if(a<0)return[n];let o=n.slice(0,a),m=n.slice(a);return[o,m]},np=n=>{let a=n.type;if(a){let m=a.toUpperCase();return ap(m,Cc)?Cc[m]:a}let{src:o}=n;return o?pE(o):""},sp=n=>n==="VOD"?gt.ON_DEMAND:gt.LIVE,op=n=>n==="EVENT"?Number.POSITIVE_INFINITY:n==="VOD"?Number.NaN:0,pE=n=>{let a="";try{a=new URL(n).pathname}catch{console.error("invalid url")}let o=a.lastIndexOf(".");if(o<0)return"";let m=a.slice(o+1).toUpperCase();return ap(m,In)?In[m]:""},vE=Object.values(Rc),Xm=n=>typeof n=="boolean"||typeof n=="string"&&vE.includes(n),gE=({autoplay:n},a,o)=>{let m=!1,v=!1,g=Xm(n)?n:!!n,L=()=>{m||Xr(a,"playing",()=>{m=!0},{once:!0})};if(L(),Xr(a,"loadstart",()=>{m=!1,L(),Ic(a,g)},{once:!0}),Xr(a,"loadstart",()=>{o||(v=!Number.isFinite(a.duration)),Ic(a,g)},{once:!0}),o&&o.once(fi.Events.LEVEL_LOADED,(M,B)=>{var U;v=(U=B.details.live)!=null?U:!1}),!g){let M=()=>{!v||(o!=null&&o.liveSyncPosition?a.currentTime=o.liveSyncPosition:Number.isFinite(a.seekable.end(0))&&(a.currentTime=a.seekable.end(0)))};o&&Xr(a,"play",()=>{a.preload==="metadata"?o.once(fi.Events.LEVEL_UPDATED,M):M()},{once:!0})}return M=>{m||(g=Xm(M)?M:!!M,Ic(a,g))}},Ic=(n,a)=>{if(!a)return;let o=n.muted,m=()=>n.muted=o;switch(a){case Rc.ANY:n.play().catch(()=>{n.muted=!0,n.play().catch(m)});break;case Rc.MUTED:n.muted=!0,n.play().catch(m);break;default:n.play().catch(()=>{});break}},yE=({preload:n,src:a},o,m)=>{let v=ie=>{ie!=null&&["","none","metadata","auto"].includes(ie)?o.setAttribute("preload",ie):o.removeAttribute("preload")};if(!m)return v(n),v;let g=!1,L=!1,M=m.config.maxBufferLength,B=m.config.maxBufferSize,U=ie=>{v(ie);let ee=ie!=null?ie:o.preload;L||ee==="none"||(ee==="metadata"?(m.config.maxBufferLength=1,m.config.maxBufferSize=1):(m.config.maxBufferLength=M,m.config.maxBufferSize=B),z())},z=()=>{!g&&a&&(g=!0,m.loadSource(a))};return Xr(o,"play",()=>{L=!0,m.config.maxBufferLength=M,m.config.maxBufferSize=B,z()},{once:!0}),U(n),U};function EE(n,a){a.on(fi.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(v,{tracks:g})=>{g.forEach(L=>{var M;let B=(M=L.subtitleTrack)!=null?M:L.closedCaptions,U=a.subtitleTracks.findIndex(({lang:z,name:ie,type:ee})=>z==(B==null?void 0:B.lang)&&ie===L.label&&ee.toLowerCase()===L.kind);Vl(n,L.kind,L.label,B==null?void 0:B.lang,`${L.kind}${U}`)})});let o=()=>{var v;if(!a.subtitleTracks.length)return;let g=Array.from(n.textTracks).find(M=>M.id&&M.mode==="showing"&&["subtitles","captions"].includes(M.kind)),L=`${(v=a.subtitleTracks[a.subtitleTrack])==null?void 0:v.type.toLowerCase()}${a.subtitleTrack}`;if(g&&(a.subtitleTrack<0||(g==null?void 0:g.id)!==L)){let M=a.subtitleTracks.findIndex(({lang:B,name:U,type:z})=>B==g.language&&U===g.label&&z.toLowerCase()===g.kind);a.subtitleTrack=M}g&&(g==null?void 0:g.id)===L&&g.cues&&Array.from(g.cues).forEach(M=>{g.addCue(M)})};n.textTracks.addEventListener("change",o),a.on(fi.Events.CUES_PARSED,(v,{track:g,cues:L})=>{let M=n.textTracks.getTrackById(g);if(!M)return;let B=M.mode==="disabled";B&&(M.mode="hidden"),L.forEach(U=>{var z;(z=M.cues)!=null&&z.getCueById(U.id)||M.addCue(U)}),B&&(M.mode="disabled")}),a.once(fi.Events.DESTROYING,()=>{n.textTracks.removeEventListener("change",o),n.querySelectorAll("track[data-removeondestroy]").forEach(v=>{v.remove()})});let m=()=>{Array.from(n.textTracks).forEach(v=>{var g,L;if(!["subtitles","caption"].includes(v.kind)&&v.label==="thumbnails"){if(!((g=v.cues)!=null&&g.length)){let M=n.querySelector('track[label="thumbnails"]'),B=(L=M==null?void 0:M.getAttribute("src"))!=null?L:"";M==null||M.removeAttribute("src"),setTimeout(()=>{M==null||M.setAttribute("src",B)},0)}v.mode!=="hidden"&&(v.mode="hidden")}})};a.once(fi.Events.MANIFEST_LOADED,m),a.once(fi.Events.MEDIA_ATTACHED,m)}function Vl(n,a,o,m,v){let g=document.createElement("track");return g.kind=a,g.label=o,m&&(g.srclang=m),v&&(g.id=v),g.track.mode=["subtitles","captions"].includes(a)?"disabled":"hidden",g.setAttribute("data-removeondestroy",""),n.append(g),g.track}function lp(n,a){let o=Array.prototype.find.call(n.querySelectorAll("track"),m=>m.track===a);o==null||o.remove()}var Fs="cuepoints",xc=Object.freeze({label:Fs}),Pc=(n,{label:a=Fs}=xc)=>{var o;return(o=Array.from(n.querySelectorAll("track")).find(m=>m.track.label===a&&m.track.kind==="metadata"))==null?void 0:o.track};async function Oc(n,a,o=xc){let m=Pc(n,o);if(!m){let{label:v=Fs}=o;m=Vl(n,"metadata",v),m.mode="hidden",await new Promise(g=>setTimeout(()=>g(void 0),0))}return m.mode!=="hidden"&&(m.mode="hidden"),[...a].sort(({time:v},{time:g})=>g-v).forEach(({time:v,value:g})=>{var L,M;let B=Array.prototype.findIndex.call(m==null?void 0:m.cues,se=>se.startTime>=v),U=(L=m==null?void 0:m.cues)==null?void 0:L[B],z=U?U.startTime:Number.isFinite(n.duration)?n.duration:Number.MAX_SAFE_INTEGER,ie=(M=m==null?void 0:m.cues)==null?void 0:M[B-1];ie&&(ie.endTime=v);let ee=new VTTCue(v,z,JSON.stringify(g!=null?g:null));m.addCue(ee)}),m}var dp=n=>({time:n.startTime,value:JSON.parse(n.text)});function up(n,a={label:Fs}){let o=Pc(n,a);return o!=null&&o.cues?Array.from(o.cues,m=>dp(m)):[]}function Nc(n,a={label:Fs}){var o,m;let v=Pc(n,a);if(!((o=v==null?void 0:v.activeCues)!=null&&o.length))return;let{currentTime:g}=n,L=Array.prototype.find.call((m=v.activeCues)!=null?m:[],({startTime:M,endTime:B})=>M<=g&&B>g);return dp(L)}async function bE(n,a=xc){return new Promise(o=>{Xr(n,"loadstart",async()=>{let m=await Oc(n,[],a);Xr(n,"cuechange",()=>{let v=Nc(n);if(v){let g=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:v});n.dispatchEvent(g)}},{},m),o(m)})})}function cp(n,a){if(a){let o=a.playingDate;if(o!=null)return new Date(o.getTime()-n.currentTime*1e3)}return typeof n.getStartDate=="function"?n.getStartDate():new Date(NaN)}function hp(n,a){if(a&&a.playingDate)return a.playingDate;if(typeof n.getStartDate=="function"){let o=n.getStartDate();return new Date(o.getTime()+n.currentTime*1e3)}return new Date(NaN)}var _E=async n=>fetch(n).then(a=>a.text()).then(a=>{let o=a.split(`
|
|
900
|
-
`).find((m,v,
|
|
901
|
-
`))}),TE=n=>{var a,o;let m=(o=((a=n.find(M=>M.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?a:"").split(":")[1])==null?void 0:o.trim(),v=sp(m),g=op(m),L;if(v===gt.LIVE){let M=n.find(B=>B.startsWith("#EXT-X-PART-INF"));M?L=+M.split(":")[1].split("=")[1]*2:L=+n.find(B=>B.startsWith("#EXT-X-TARGETDURATION")).split(":")[1]*3}return{streamType:v,targetLiveWindow:g,liveEdgeStartOffset:L}},Zm=async(n,a)=>{var o,m,v;let g=await _E(n),{streamType:L,targetLiveWindow:M,liveEdgeStartOffset:B}=TE(g);((o=$t.get(a))!=null?o:{}).liveEdgeStartOffset=B,((m=$t.get(a))!=null?m:{}).targetLiveWindow=M,a.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((v=$t.get(a))!=null?v:{}).streamType=L,a.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},AE=n=>{var a;let o=n.type,m=sp(o),v=op(o),g,L=!!((a=n.partList)!=null&&a.length);return m===gt.LIVE&&(g=L?n.partTarget*2:n.targetduration*3),{streamType:m,targetLiveWindow:v,liveEdgeStartOffset:g,lowLatency:L}},SE=(n,a,o)=>{var m,v,g,L,M,B,U,z;let{streamType:ie,targetLiveWindow:ee,liveEdgeStartOffset:se,lowLatency:fe}=AE(n);if(ie===gt.LIVE){fe?(o.config.backBufferLength=(m=o.userConfig.backBufferLength)!=null?m:4,o.config.maxFragLookUpTolerance=(v=o.userConfig.maxFragLookUpTolerance)!=null?v:.001,o.config.abrBandWidthUpFactor=(g=o.userConfig.abrBandWidthUpFactor)!=null?g:o.config.abrBandWidthFactor):o.config.backBufferLength=(L=o.userConfig.backBufferLength)!=null?L:8;let _e=Object.freeze({get length(){return a.seekable.length},start(Ae){return a.seekable.start(Ae)},end(Ae){var Se;return Ae>this.length?a.seekable.end(Ae):(Se=o.liveSyncPosition)!=null?Se:a.seekable.end(Ae)}});((M=$t.get(a))!=null?M:{}).seekable=_e}((B=$t.get(a))!=null?B:{}).liveEdgeStartOffset=se,((U=$t.get(a))!=null?U:{}).targetLiveWindow=ee,a.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((z=$t.get(a))!=null?z:{}).streamType=ie,a.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},Jm,ep,kE=(ep=(Jm=globalThis==null?void 0:globalThis.navigator)==null?void 0:Jm.userAgent)!=null?ep:"",wE=kE.toLowerCase().indexOf("android")!==-1,$t=new WeakMap,fp="mux.com",tp,ip,mp=(ip=(tp=fi).isSupported)==null?void 0:ip.call(tp),LE=wE,pp=()=>Gl.default.utils.now(),IE=Gl.default.utils.generateUUID,vp=(n,{domain:a=fp,maxResolution:o=""}={})=>{if(!n)return;let[m,v=""]=mE(n),g=new URL(`https://stream.${a}/${m}.m3u8${v}`);return o&&g.searchParams.set("max_resolution",o),g.toString()},RE=n=>{if(!n)return;let[a]=n.split("?");return a||void 0},DE=n=>{if(!n||!n.startsWith("https://stream."))return;let[a]=new URL(n).pathname.slice(1).split(".m3u8");return a||void 0},CE=n=>{var a,o,m;return(a=n==null?void 0:n.metadata)!=null&&a.video_id?n.metadata.video_id:Ap(n)&&(m=(o=RE(n.playbackId))!=null?o:DE(n.src))!=null?m:n.src},gp=n=>{var a;return(a=$t.get(n))==null?void 0:a.error},yp=n=>{var a,o;return(o=(a=$t.get(n))==null?void 0:a.streamType)!=null?o:gt.UNKNOWN},Ep=n=>{var a,o;return(o=(a=$t.get(n))==null?void 0:a.targetLiveWindow)!=null?o:Number.NaN},Fc=n=>{var a,o;return(o=(a=$t.get(n))==null?void 0:a.seekable)!=null?o:n.seekable},bp=n=>{var a;let o=(a=$t.get(n))==null?void 0:a.liveEdgeStartOffset;if(typeof o!="number")return Number.NaN;let m=Fc(n);return m.length?m.end(m.length-1)-o:Number.NaN},_p=(n,a,o)=>{Uc(a,o);let{metadata:m={}}=n,{view_session_id:v=IE()}=m,g=CE(n);m.view_session_id=v,m.video_id=g,n.metadata=m,$t.set(a,{});let L=ME(n,a);PE(n,a,L),OE(n,a,L),bE(a);let M=gE(n,a,L),B=yE(n,a,L);return{engine:L,setAutoplay:M,setPreload:B}},Uc=(n,a)=>{let o=a==null?void 0:a.engine;o&&(o.detachMedia(),o.destroy()),(n==null?void 0:n.mux)&&!n.mux.deleted&&(n.mux.destroy(),delete n.mux),n&&(n.removeAttribute("src"),n.load(),n.removeEventListener("error",kp),n.removeEventListener("error",Mc),n.removeEventListener("durationchange",Sp),$t.delete(n),n.dispatchEvent(new Event("teardown")))};function Tp(n,a){var o;let m=np(n);if(m!==In.M3U8)return!0;let v=!m||((o=a.canPlayType(m))!=null?o:!0),{preferPlayback:g}=n,L=g===Hi.MSE,M=g===Hi.NATIVE;return v&&(M||!(mp&&(L||LE)))}var ME=(n,a)=>{let{debug:o,streamType:m,startTime:v=-1,metadata:g,preferCmcd:L}=n,M=np(n)===In.M3U8,B=Tp(n,a);if(M&&!B&&mp){let U={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},z=xE(m),ie=L!==Dc.NONE?{useHeaders:L===Dc.HEADER,sessionId:g==null?void 0:g.view_session_id,contentId:g==null?void 0:g.video_id}:void 0;return new fi({debug:o,startPosition:v,cmcd:ie,...U,...z})}},xE=n=>n===gt.LIVE?{backBufferLength:8}:{},Ap=({playbackId:n,src:a,customDomain:o})=>{if(n)return!0;if(typeof a!="string")return!1;let m=window==null?void 0:window.location.href,v=new URL(a,m).hostname.toLocaleLowerCase();return v.includes(fp)||!!o&&v.includes(o.toLocaleLowerCase())},PE=(n,a,o)=>{var m;let{envKey:v}=n,g=Ap(n);if(v||g){let{playerInitTime:L,playerSoftwareName:M,playerSoftwareVersion:B,beaconCollectionDomain:U,debug:z,disableCookies:ie}=n,ee={...n.metadata,video_title:((m=n==null?void 0:n.metadata)==null?void 0:m.video_title)||void 0},se=fe=>typeof fe.player_error_code=="string"?!1:typeof n.errorTranslator=="function"?n.errorTranslator(fe):fe;Gl.default.monitor(a,{debug:z,beaconCollectionDomain:U,hlsjs:o,Hls:o?fi:void 0,automaticErrorTracking:!1,errorTranslator:se,disableCookies:ie,data:{...v?{env_key:v}:{},player_software_name:M,player_software:M,player_software_version:B,player_init_time:L,...ee}})}},OE=(n,a,o)=>{var m;let v=Tp(n,a),{src:g}=n;a&&v?(typeof g=="string"?(a.preload==="none"?Xr(a,"loadstart",()=>Zm(g,a)):Zm(g,a),a.setAttribute("src",g),n.startTime&&(((m=$t.get(a))!=null?m:{}).startTime=n.startTime,a.addEventListener("durationchange",Sp,{once:!0}))):a.removeAttribute("src"),a.addEventListener("error",kp),a.addEventListener("error",Mc),a.addEventListener("emptied",()=>{a.querySelectorAll("track[data-removeondestroy]").forEach(L=>{L.remove()})},{once:!0})):o&&g?(o.once(fi.Events.LEVEL_LOADED,(L,M)=>{SE(M.details,a,o)}),o.on(fi.Events.ERROR,(L,M)=>{let B={[fi.ErrorTypes.NETWORK_ERROR]:vt.MEDIA_ERR_NETWORK,[fi.ErrorTypes.MEDIA_ERROR]:vt.MEDIA_ERR_DECODE},U=new vt("",B[M.type]);U.fatal=M.fatal,U.data=M,a.dispatchEvent(new CustomEvent("error",{detail:U}))}),a.addEventListener("error",Mc),EE(a,o),o.attachMedia(a)):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 Sp(n){var a;let o=n.target,m=(a=$t.get(o))==null?void 0:a.startTime;if(!!m&&fE(o.seekable,o.duration,m)){let v=o.preload==="auto";v&&(o.preload="none"),o.currentTime=m,v&&(o.preload="auto")}}async function kp(n){if(!n.isTrusted)return;n.stopImmediatePropagation();let a=n.target;if(!(a!=null&&a.error))return;let{message:o,code:m}=a.error,v=new vt(o,m);if(a.src&&(m!==vt.MEDIA_ERR_DECODE||m!==void 0))try{let{status:g}=await fetch(a.src);v.data={response:{code:g}}}catch{}a.dispatchEvent(new CustomEvent("error",{detail:v}))}function Mc(n){var a,o;if(!(n instanceof CustomEvent)||!(n.detail instanceof vt))return;let m=n.target,v=n.detail;!v||!v.fatal||(((a=$t.get(m))!=null?a:{}).error=v,(o=m.mux)==null||o.emit("error",{player_error_code:v.code,player_error_message:v.message,player_error_context:v.context}))}var NE=Object.defineProperty,FE=(n,a,o)=>a in n?NE(n,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[a]=o,Kl=(n,a,o)=>(FE(n,typeof a!="symbol"?a+"":a,o),o),Kc=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},he=(n,a,o)=>(Kc(n,a,"read from private field"),o?o.call(n):a.get(n)),Ze=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},yt=(n,a,o,m)=>(Kc(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),Ct=(n,a,o)=>(Kc(n,a,"access private method"),o),Jl=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class n extends Jl{}globalThis.DocumentFragment=n}var Wc=class extends Jl{},UE=class extends Jl{},BE={get(n){},define(n,a,o){},upgrade(n){},whenDefined(n){return Promise.resolve(Wc)}},Wl,HE=class{constructor(n,a={}){Ze(this,Wl,void 0),yt(this,Wl,a==null?void 0:a.detail)}get detail(){return he(this,Wl)}initCustomEvent(){}};Wl=new WeakMap;function GE(n,a){return new Wc}var Ip={document:{createElement:GE},DocumentFragment,customElements:BE,CustomEvent:HE,EventTarget:Jl,HTMLElement:Wc,HTMLVideoElement:UE},Rp=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Zr=Rp?Ip:globalThis,Dp=Rp?Ip.document:globalThis.document,VE=()=>{try{return"0.15.1"}catch{}return"UNKNOWN"},KE=VE(),WE=()=>KE,wp=n=>{var a,o,m,v,g,L,M,B,U,z,ie,ee,se,fe,_e,Ae,Se,st,Ue,le,w,oe,W,Ye,Et,Re,et,ot,H,it,pt,Je,Vt,mi,Mt,Ne,ct,pi,Gi,Zi;return a=class extends n{constructor(){super(),Ze(this,et),Ze(this,H),Ze(this,pt),Ze(this,Vt),Ze(this,Mt),Ze(this,ct),Ze(this,Gi),Kl(this,"castEnabled",!1),Ze(this,w,{paused:!1}),Ze(this,oe,void 0),Ze(this,W,{}),Ze(this,Ye,void 0),Ze(this,Et,void 0),Ze(this,Re,void 0),a.instances.add(this),Ct(this,Mt,Ne).call(this)}static get castElement(){return he(a,o)}static get castEnabled(){return he(a,m)}static get castState(){var te;return(te=he(a,U,z))==null?void 0:te.getCastState()}static async exitCast(){try{await he(a,U,z).endCurrentSession(!0)}catch(te){console.error(te);return}}get castPlayer(){if(a.castElement===this)return he(this,oe)}attributeChangedCallback(te){if(this.castPlayer)switch(te){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(te={}){var Te;Ct(Te=a,Ue,le).call(Te,te),yt(a,o,this),Object.entries(he(this,W)).forEach(([tt,_t])=>{he(this,oe).controller.addEventListener(tt,_t)});try{await he(a,U,z).requestSession()}catch{yt(a,o,void 0);return}he(this,w).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(tt){console.error(tt)}}async load(){var te,Te;if(!this.castPlayer)return super.load();let tt=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),_t=[...this.querySelectorAll("track")].filter(({kind:jt,src:ii})=>ii&&(jt==="subtitles"||jt==="captions")),Lt=[],$e=0;_t.length&&(tt.tracks=_t.map(jt=>{let ii=++$e;Lt.length===0&&jt.track.mode==="showing"&&Lt.push(ii);let ri=new chrome.cast.media.Track(ii,chrome.cast.media.TrackType.TEXT);return ri.trackContentId=jt.src,ri.trackContentType="text/vtt",ri.subtype=jt.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,ri.name=jt.label,ri.language=jt.srclang,ri})),this.castStreamType==="live"?tt.streamType=chrome.cast.media.StreamType.LIVE:tt.streamType=chrome.cast.media.StreamType.BUFFERED,tt.metadata=new chrome.cast.media.GenericMediaMetadata,tt.metadata.title=this.title,tt.metadata.images=[{url:this.poster}];let Si=new chrome.cast.media.LoadRequest(tt);Si.currentTime=(te=super.currentTime)!=null?te:0,Si.autoplay=!he(this,w).paused,Si.activeTrackIds=Lt,await((Te=he(a,ie,ee))==null?void 0:Te.loadMedia(Si)),this.dispatchEvent(new Event("volumechange"))}play(){var te;if(this.castPlayer){this.castPlayer.isPaused&&((te=this.castPlayer.controller)==null||te.playOrPause());return}return super.play()}pause(){var te;if(this.castPlayer){this.castPlayer.isPaused||(te=this.castPlayer.controller)==null||te.playOrPause();return}super.pause()}get castSrc(){var te,Te,tt;return(tt=(Te=this.getAttribute("cast-src"))!=null?Te:(te=this.querySelector("source"))==null?void 0:te.src)!=null?tt:this.currentSrc}set castSrc(te){this.castSrc!=te&&this.setAttribute("cast-src",`${te}`)}get castContentType(){var te;return(te=this.getAttribute("cast-content-type"))!=null?te:void 0}set castContentType(te){this.setAttribute("cast-content-type",`${te}`)}get castStreamType(){var te,Te;return(Te=(te=this.getAttribute("cast-stream-type"))!=null?te:this.streamType)!=null?Te:void 0}set castStreamType(te){this.setAttribute("cast-stream-type",`${te}`)}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 te;return this.castPlayer?(te=this.castPlayer)==null?void 0:te.isMuted:super.muted}set muted(te){var Te;if(this.castPlayer){(te&&!this.castPlayer.isMuted||!te&&this.castPlayer.isMuted)&&((Te=this.castPlayer.controller)==null||Te.muteOrUnmute());return}super.muted=te}get volume(){var te,Te;return this.castPlayer?(Te=(te=this.castPlayer)==null?void 0:te.volumeLevel)!=null?Te:1:super.volume}set volume(te){var Te;if(this.castPlayer){this.castPlayer.volumeLevel=te,(Te=this.castPlayer.controller)==null||Te.setVolumeLevel();return}super.volume=te}get duration(){var te,Te;return this.castPlayer&&he(this,et,ot)?(Te=(te=this.castPlayer)==null?void 0:te.duration)!=null?Te:NaN:super.duration}get currentTime(){var te,Te;return this.castPlayer&&he(this,et,ot)?(Te=(te=this.castPlayer)==null?void 0:te.currentTime)!=null?Te:0:super.currentTime}set currentTime(te){var Te;if(this.castPlayer){this.castPlayer.currentTime=te,(Te=this.castPlayer.controller)==null||Te.seek();return}super.currentTime=te}get onentercast(){return he(this,Ye)}set onentercast(te){he(this,Ye)&&(this.removeEventListener("entercast",he(this,Ye)),yt(this,Ye,null)),typeof te=="function"&&(yt(this,Ye,te),this.addEventListener("entercast",te))}get onleavecast(){return he(this,Et)}set onleavecast(te){he(this,Et)&&(this.removeEventListener("leavecast",he(this,Et)),yt(this,Et,null)),typeof te=="function"&&(yt(this,Et,te),this.addEventListener("leavecast",te))}get oncastchange(){return he(this,Re)}set oncastchange(te){he(this,Re)&&(this.removeEventListener("castchange",he(this,Re)),yt(this,Re,null)),typeof te=="function"&&(yt(this,Re,te),this.addEventListener("castchange",te))}},o=new WeakMap,m=new WeakMap,v=new WeakMap,g=new WeakSet,L=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},M=new WeakSet,B=function(){return typeof cast!="undefined"&&cast.framework},U=new WeakSet,z=function(){if(he(a,M,B))return cast.framework.CastContext.getInstance()},ie=new WeakSet,ee=function(){var te;return(te=he(a,U,z))==null?void 0:te.getCurrentSession()},se=new WeakSet,fe=function(){var te;return(te=he(a,ie,ee))==null?void 0:te.getSessionObj().media[0]},_e=new WeakSet,Ae=function(te){return new Promise((Te,tt)=>{he(a,se,fe).editTracksInfo(te,Te,tt)})},Se=new WeakSet,st=function(te){return new Promise((Te,tt)=>{he(a,se,fe).getStatus(te,Te,tt)})},Ue=new WeakSet,le=function(te){return he(a,U,z).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...te})},w=new WeakMap,oe=new WeakMap,W=new WeakMap,Ye=new WeakMap,Et=new WeakMap,Re=new WeakMap,et=new WeakSet,ot=function(){var te;return(te=this.castPlayer)==null?void 0:te.isMediaLoaded},H=new WeakSet,it=function(){he(a,o)===this&&(Object.entries(he(this,W)).forEach(([te,Te])=>{he(this,oe).controller.removeEventListener(te,Te)}),yt(a,o,void 0),this.muted=he(this,oe).isMuted,this.currentTime=he(this,oe).savedPlayerState.currentTime,he(this,oe).savedPlayerState.isPaused===!1&&this.play())},pt=new WeakSet,Je=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:he(a,U,z).getCastState()}))},Vt=new WeakSet,mi=async function(){var te,Te;let{SESSION_RESUMED:tt}=cast.framework.SessionState;if(he(a,U,z).getSessionState()===tt&&this.castSrc===((te=he(a,se,fe))==null?void 0:te.media.contentId)){yt(a,o,this),Object.entries(he(this,W)).forEach(([_t,Lt])=>{he(this,oe).controller.addEventListener(_t,Lt)});try{await Ct(Te=a,Se,st).call(Te,new chrome.cast.media.GetStatusRequest)}catch(_t){console.error(_t)}he(this,W)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),he(this,W)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Mt=new WeakSet,Ne=function(){var te;!he(a,M,B)||this.castEnabled||(this.castEnabled=!0,Ct(te=a,Ue,le).call(te),this.textTracks.addEventListener("change",Ct(this,Gi,Zi).bind(this)),Ct(this,pt,Je).call(this),yt(this,oe,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(he(this,oe)),yt(this,W,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:Te})=>{Te===!1&&Ct(this,H,it).call(this),this.dispatchEvent(new Event(Te?"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]:()=>{!he(this,et,ot)||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 Te,tt;((Te=this.castPlayer)==null?void 0:Te.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"}[(tt=this.castPlayer)==null?void 0:tt.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!he(this,et,ot)||(await Promise.resolve(),Ct(this,ct,pi).call(this))}}))},ct=new WeakSet,pi=function(){Ct(this,Gi,Zi).call(this)},Gi=new WeakSet,Zi=async function(){var te,Te,tt,_t,Lt,$e;if(!this.castPlayer)return;let Si=((Te=(te=he(this,oe).mediaInfo)==null?void 0:te.tracks)!=null?Te:[]).filter(({type:dt})=>dt===chrome.cast.media.TrackType.TEXT),jt=[...this.textTracks].filter(({kind:dt})=>dt==="subtitles"||dt==="captions"),ii=Si.map(({language:dt,name:Ji,trackId:vi})=>{var vr;let{mode:Nr}=(vr=jt.find(Fr=>Fr.language===dt&&Fr.label===Ji))!=null?vr:{};return Nr?{mode:Nr,trackId:vi}:!1}).filter(Boolean),ri=ii.filter(({mode:dt})=>dt!=="showing").map(({trackId:dt})=>dt),pr=ii.find(({mode:dt})=>dt==="showing"),Or=(Lt=(_t=(tt=he(a,ie,ee))==null?void 0:tt.getSessionObj().media[0])==null?void 0:_t.activeTrackIds)!=null?Lt:[],oi=Or;if(Or.length&&(oi=oi.filter(dt=>!ri.includes(dt))),pr!=null&&pr.trackId&&(oi=[...oi,pr.trackId]),oi=[...new Set(oi)],!((dt,Ji)=>dt.length===Ji.length&&dt.every(vi=>Ji.includes(vi)))(Or,oi))try{let dt=new chrome.cast.media.EditTracksInfoRequest(oi);await Ct($e=a,_e,Ae).call($e,dt)}catch(dt){console.error(dt)}},Ze(a,g),Ze(a,M),Ze(a,U),Ze(a,ie),Ze(a,se),Ze(a,_e),Ze(a,Se),Ze(a,Ue),Kl(a,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),Kl(a,"instances",new Set),Ze(a,o,void 0),Ze(a,m,!1),Kl(a,"initCast",()=>{var te;he(a,g,L)?he(a,M,B)?he(te=a,v).call(te,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var Te;return he(Te=a,v).call(Te,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var Te;return he(Te=a,v).call(Te,chrome.cast.isAvailable)})}}),Ze(a,v,te=>{if(te){yt(a,m,!0);let{CAST_STATE_CHANGED:Te}=cast.framework.CastContextEventType;he(a,U,z).addEventListener(Te,_t=>{a.instances.forEach(Lt=>{var $e;return Ct($e=Lt,pt,Je).call($e,_t)})});let{SESSION_STATE_CHANGED:tt}=cast.framework.CastContextEventType;he(a,U,z).addEventListener(tt,_t=>{a.instances.forEach(Lt=>{var $e;return Ct($e=Lt,Vt,mi).call($e,_t)})}),a.instances.forEach(_t=>{var Lt;return Ct(Lt=_t,Mt,Ne).call(Lt)})}}),a},Bc=globalThis.HTMLVideoElement?wp(HTMLVideoElement):wp(Object);globalThis.customElements&&!globalThis.customElements.get("castable-video")&&(customElements.define("castable-video",Bc,{extends:"video"}),globalThis.CastableVideoElement=Bc);Bc.initCast();var qc=["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"],Cp=Dp.createElement("template");Cp.innerHTML=`
|
|
887
|
+
<slot hidden name="captions-indicator">${dE}</slot>
|
|
888
|
+
`;var Qm=(n,a)=>n.label===a.label&&n.language===a.language,Dc=class extends Km{constructor(){super({slotTemplate:Zm}),Qr(this,ql),Qr(this,$l),Qr(this,Oa),Qr(this,Yl),Qr(this,Ln,[]),Qr(this,In,[]),Qr(this,Lr,void 0),Qr(this,Bi,void 0);let a=ie.createElement("media-chrome-listitem");a.part.add("listitem"),a.value="off",a.textContent="Off",Xr(this,Lr,a);let l=this.shadowRoot.querySelector('[name="captions-indicator"]');Xr(this,Bi,l.firstElementChild),l.addEventListener("slotchange",()=>{let m=l.assignedElements();if(m.length===1&&m[0].nodeName.toLowerCase()==="slot"){let v=m[0].assignedElements();v.length===0?Xr(this,Bi,m[0].firstElementChild):v.length===1&&Xr(this,Bi,v[0])}jt(this,Bi)||Xr(this,Bi,l.firstElementChild),Xr(this,Bi,jt(this,Bi).cloneNode(!0)),jt(this,Bi).removeAttribute("slot"),jt(this,Bi).setAttribute("style",Xm)})}static get observedAttributes(){return[...super.observedAttributes,"aria-multiselectable",U.MEDIA_CAPTIONS_LIST,U.MEDIA_CAPTIONS_SHOWING,U.MEDIA_SUBTITLES_LIST,U.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(a,l,m){if(a===U.MEDIA_SUBTITLES_LIST&&l!==m)Xr(this,Ln,$i(this,ql,Lc).call(this,m,jt(this,Ln))),$i(this,Oa,wn).call(this);else if(a===U.MEDIA_CAPTIONS_LIST&&l!==m)Xr(this,In,$i(this,ql,Lc).call(this,m,jt(this,In))),$i(this,Oa,wn).call(this);else if(a===U.MEDIA_SUBTITLES_SHOWING&&l!==m){let v=vs(m!=null?m:"")[0];jt(this,Ln).forEach(E=>{E.selected=E.language===v.language&&E.label===v.label}),$i(this,Oa,wn).call(this)}else if(a===U.MEDIA_CAPTIONS_SHOWING&&l!==m){let v=vs(m!=null?m:"")[0];jt(this,In).forEach(E=>{E.selected=E.language===v.language&&E.label===v.label}),$i(this,Oa,wn).call(this)}else a==="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(a,l,m)}connectedCallback(){$i(this,Oa,wn).call(this),this.addEventListener("change",$i(this,Yl,Rc)),super.connectedCallback()}disconnectedCallback(){this.removeEventListener("change",$i(this,Yl,Rc)),super.disconnectedCallback()}};Ln=new WeakMap;In=new WeakMap;Lr=new WeakMap;Bi=new WeakMap;ql=new WeakSet;Lc=function(n,a){let l=n?vs(n!=null?n:""):[],m=[],v=[];return a.forEach(E=>{l.some(I=>Qm(I,E))||m.push(E)}),l.forEach(E=>{a.some(I=>Qm(I,E))||v.push(E)}),m.forEach(E=>E.el.remove()),a.filter(E=>!m.includes(E)).concat(v)};$l=new WeakSet;Ic=function(n,a){let l=this.shadowRoot.querySelector("ul slot");n.forEach(m=>{let v=m.el,E=!0;if(!v){v=ie.createElement("media-chrome-listitem"),E=!1,v.part.add("listitem"),v.value=a+"!"+Iu(m);let I=ie.createElement("span");I.textContent=m.label,v.append(I),a==="cc"&&v.append(jt(this,Bi).cloneNode(!0))}m.selected?v.setAttribute("aria-selected","true"):v.setAttribute("aria-selected","false"),E||(l.append(v),m.el=v)})};Oa=new WeakSet;wn=function(){let n=this.shadowRoot.querySelector("ul slot");n.contains(jt(this,Lr))||n.append(jt(this,Lr)),!this.hasAttribute(U.MEDIA_CAPTIONS_SHOWING)&&!this.hasAttribute(U.MEDIA_SUBTITLES_SHOWING)?(jt(this,Lr).setAttribute("aria-selected","true"),jt(this,Lr).setAttribute("tabindex","0")):(jt(this,Lr).setAttribute("aria-selected","false"),jt(this,Lr).setAttribute("tabindex","-1")),$i(this,$l,Ic).call(this,jt(this,In),"cc"),$i(this,$l,Ic).call(this,jt(this,Ln),"subs")};Yl=new WeakSet;Rc=function(){var n,a,l;let[m,v]=(l=(a=(n=this.selectedOptions[0])==null?void 0:n.value)==null?void 0:a.split("!"))!=null?l:[];if(Da(this,!0),!v)return;let E=new W.CustomEvent(m==="cc"?ve.MEDIA_SHOW_CAPTIONS_REQUEST:ve.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(E)};W.customElements.get("media-captions-listbox")||W.customElements.define("media-captions-listbox",Dc);var Mc=class extends jm{constructor(){super()}init(){let a=ie.createElement("media-captions-button");a.part.add("button"),a.preventClick=!0,this.hasAttribute("default-showing")&&a.setAttribute("default-showing","");let l=ie.createElement("media-captions-listbox");l.part.add("listbox"),l.setAttribute("exportparts","listitem");let m=this.shadowRoot.querySelector("slot[name=button]"),v=this.shadowRoot.querySelector("slot[name=listbox]");m.textContent="",v.textContent="",m.append(a),v.append(l)}};W.customElements.get("media-captions-selectmenu")||W.customElements.define("media-captions-selectmenu",Mc);var zl=yf(Jm(),1),lp=yf(tp(),1),uE=lp.default,yi=uE,Bs=class extends Error{constructor(n,a=Bs.MEDIA_ERR_CUSTOM,l,m){var v;super(n),this.name="MediaError",this.code=a,this.context=m,this.fatal=l!=null?l:a>=Bs.MEDIA_ERR_NETWORK&&a<=Bs.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(v=Bs.defaultMessages[this.code])!=null?v:"")}},pt=Bs;pt.MEDIA_ERR_ABORTED=1,pt.MEDIA_ERR_NETWORK=2,pt.MEDIA_ERR_DECODE=3,pt.MEDIA_ERR_SRC_NOT_SUPPORTED=4,pt.MEDIA_ERR_ENCRYPTED=5,pt.MEDIA_ERR_CUSTOM=100,pt.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 cE=n=>n==null,dp=(n,a)=>cE(a)?!1:n in a,Nc={ANY:"any",MUTED:"muted"},vt={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Hi={MSE:"mse",NATIVE:"native"},Fc={HEADER:"header",QUERY:"query",NONE:"none"},Dn=Object.values(Fc),Rn={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Uc={HLS:Rn.M3U8},nS=Object.keys(Uc),sS=[...Object.values(Rn),"hls","HLS"],Zr=(n,a,l,m,v=n)=>{v.addEventListener(a,l,m),n.addEventListener("teardown",()=>{v.removeEventListener(a,l)},{once:!0})};function hE(n,a,l){a&&l>a&&(l=a);for(let m=0;m<n.length;m++)if(n.start(m)<=l&&n.end(m)>=l)return!0;return!1}var fE=n=>{let a=n.indexOf("?");if(a<0)return[n];let l=n.slice(0,a),m=n.slice(a);return[l,m]},up=n=>{let a=n.type;if(a){let m=a.toUpperCase();return dp(m,Uc)?Uc[m]:a}let{src:l}=n;return l?mE(l):""},cp=n=>n==="VOD"?vt.ON_DEMAND:vt.LIVE,hp=n=>n==="EVENT"?Number.POSITIVE_INFINITY:n==="VOD"?Number.NaN:0,mE=n=>{let a="";try{a=new URL(n).pathname}catch{console.error("invalid url")}let l=a.lastIndexOf(".");if(l<0)return"";let m=a.slice(l+1).toUpperCase();return dp(m,Rn)?Rn[m]:""},pE=Object.values(Nc),ip=n=>typeof n=="boolean"||typeof n=="string"&&pE.includes(n),vE=({autoplay:n},a,l)=>{let m=!1,v=!1,E=ip(n)?n:!!n,I=()=>{m||Zr(a,"playing",()=>{m=!0},{once:!0})};if(I(),Zr(a,"loadstart",()=>{m=!1,I(),Oc(a,E)},{once:!0}),Zr(a,"loadstart",()=>{l||(v=!Number.isFinite(a.duration)),Oc(a,E)},{once:!0}),l&&l.once(yi.Events.LEVEL_LOADED,(M,B)=>{var F;v=(F=B.details.live)!=null?F:!1}),!E){let M=()=>{!v||(l!=null&&l.liveSyncPosition?a.currentTime=l.liveSyncPosition:Number.isFinite(a.seekable.end(0))&&(a.currentTime=a.seekable.end(0)))};l&&Zr(a,"play",()=>{a.preload==="metadata"?l.once(yi.Events.LEVEL_UPDATED,M):M()},{once:!0})}return M=>{m||(E=ip(M)?M:!!M,Oc(a,E))}},Oc=(n,a)=>{if(!a)return;let l=n.muted,m=()=>n.muted=l;switch(a){case Nc.ANY:n.play().catch(()=>{n.muted=!0,n.play().catch(m)});break;case Nc.MUTED:n.muted=!0,n.play().catch(m);break;default:n.play().catch(()=>{});break}},gE=({preload:n,src:a},l,m)=>{let v=re=>{re!=null&&["","none","metadata","auto"].includes(re)?l.setAttribute("preload",re):l.removeAttribute("preload")};if(!m)return v(n),v;let E=!1,I=!1,M=m.config.maxBufferLength,B=m.config.maxBufferSize,F=re=>{v(re);let te=re!=null?re:l.preload;I||te==="none"||(te==="metadata"?(m.config.maxBufferLength=1,m.config.maxBufferSize=1):(m.config.maxBufferLength=M,m.config.maxBufferSize=B),Q())},Q=()=>{!E&&a&&(E=!0,m.loadSource(a))};return Zr(l,"play",()=>{I=!0,m.config.maxBufferLength=M,m.config.maxBufferSize=B,Q()},{once:!0}),F(n),F};function yE(n,a){a.on(yi.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(v,{tracks:E})=>{E.forEach(I=>{var M;let B=(M=I.subtitleTrack)!=null?M:I.closedCaptions,F=a.subtitleTracks.findIndex(({lang:Q,name:re,type:te})=>Q==(B==null?void 0:B.lang)&&re===I.label&&te.toLowerCase()===I.kind);Ql(n,I.kind,I.label,B==null?void 0:B.lang,`${I.kind}${F}`)})});let l=()=>{var v;if(!a.subtitleTracks.length)return;let E=Array.from(n.textTracks).find(M=>M.id&&M.mode==="showing"&&["subtitles","captions"].includes(M.kind)),I=`${(v=a.subtitleTracks[a.subtitleTrack])==null?void 0:v.type.toLowerCase()}${a.subtitleTrack}`;if(E&&(a.subtitleTrack<0||(E==null?void 0:E.id)!==I)){let M=a.subtitleTracks.findIndex(({lang:B,name:F,type:Q})=>B==E.language&&F===E.label&&Q.toLowerCase()===E.kind);a.subtitleTrack=M}E&&(E==null?void 0:E.id)===I&&E.cues&&Array.from(E.cues).forEach(M=>{E.addCue(M)})};n.textTracks.addEventListener("change",l),a.on(yi.Events.CUES_PARSED,(v,{track:E,cues:I})=>{let M=n.textTracks.getTrackById(E);if(!M)return;let B=M.mode==="disabled";B&&(M.mode="hidden"),I.forEach(F=>{var Q;(Q=M.cues)!=null&&Q.getCueById(F.id)||M.addCue(F)}),B&&(M.mode="disabled")}),a.once(yi.Events.DESTROYING,()=>{n.textTracks.removeEventListener("change",l),n.querySelectorAll("track[data-removeondestroy]").forEach(v=>{v.remove()})});let m=()=>{Array.from(n.textTracks).forEach(v=>{var E,I;if(!["subtitles","caption"].includes(v.kind)&&v.label==="thumbnails"){if(!((E=v.cues)!=null&&E.length)){let M=n.querySelector('track[label="thumbnails"]'),B=(I=M==null?void 0:M.getAttribute("src"))!=null?I:"";M==null||M.removeAttribute("src"),setTimeout(()=>{M==null||M.setAttribute("src",B)},0)}v.mode!=="hidden"&&(v.mode="hidden")}})};a.once(yi.Events.MANIFEST_LOADED,m),a.once(yi.Events.MEDIA_ATTACHED,m)}function Ql(n,a,l,m,v){let E=document.createElement("track");return E.kind=a,E.label=l,m&&(E.srclang=m),v&&(E.id=v),E.track.mode=["subtitles","captions"].includes(a)?"disabled":"hidden",E.setAttribute("data-removeondestroy",""),n.append(E),E.track}function fp(n,a){let l=Array.prototype.find.call(n.querySelectorAll("track"),m=>m.track===a);l==null||l.remove()}var Hs="cuepoints",Hc=Object.freeze({label:Hs}),Gc=(n,{label:a=Hs}=Hc)=>{var l;return(l=Array.from(n.querySelectorAll("track")).find(m=>m.track.label===a&&m.track.kind==="metadata"))==null?void 0:l.track};async function Vc(n,a,l=Hc){let m=Gc(n,l);if(!m){let{label:v=Hs}=l;m=Ql(n,"metadata",v),m.mode="hidden",await new Promise(E=>setTimeout(()=>E(void 0),0))}return m.mode!=="hidden"&&(m.mode="hidden"),[...a].sort(({time:v},{time:E})=>E-v).forEach(({time:v,value:E})=>{var I,M;let B=Array.prototype.findIndex.call(m==null?void 0:m.cues,se=>se.startTime>=v),F=(I=m==null?void 0:m.cues)==null?void 0:I[B],Q=F?F.startTime:Number.isFinite(n.duration)?n.duration:Number.MAX_SAFE_INTEGER,re=(M=m==null?void 0:m.cues)==null?void 0:M[B-1];re&&(re.endTime=v);let te=new VTTCue(v,Q,JSON.stringify(E!=null?E:null));m.addCue(te)}),m}var mp=n=>({time:n.startTime,value:JSON.parse(n.text)});function pp(n,a={label:Hs}){let l=Gc(n,a);return l!=null&&l.cues?Array.from(l.cues,m=>mp(m)):[]}function Kc(n,a={label:Hs}){var l,m;let v=Gc(n,a);if(!((l=v==null?void 0:v.activeCues)!=null&&l.length))return;let{currentTime:E}=n,I=Array.prototype.find.call((m=v.activeCues)!=null?m:[],({startTime:M,endTime:B})=>M<=E&&B>E);return mp(I)}async function EE(n,a=Hc){return new Promise(l=>{Zr(n,"loadstart",async()=>{let m=await Vc(n,[],a);Zr(n,"cuechange",()=>{let v=Kc(n);if(v){let E=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:v});n.dispatchEvent(E)}},{},m),l(m)})})}function vp(n,a){if(a){let l=a.playingDate;if(l!=null)return new Date(l.getTime()-n.currentTime*1e3)}return typeof n.getStartDate=="function"?n.getStartDate():new Date(NaN)}function gp(n,a){if(a&&a.playingDate)return a.playingDate;if(typeof n.getStartDate=="function"){let l=n.getStartDate();return new Date(l.getTime()+n.currentTime*1e3)}return new Date(NaN)}var bE=async n=>fetch(n).then(a=>a.text()).then(a=>{let l=a.split(`
|
|
889
|
+
`).find((m,v,E)=>v&&E[v-1].startsWith("#EXT-X-STREAM-INF"));return fetch(l).then(m=>m.text()).then(m=>m.split(`
|
|
890
|
+
`))}),_E=n=>{var a,l;let m=(l=((a=n.find(M=>M.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?a:"").split(":")[1])==null?void 0:l.trim(),v=cp(m),E=hp(m),I;if(v===vt.LIVE){let M=n.find(B=>B.startsWith("#EXT-X-PART-INF"));M?I=+M.split(":")[1].split("=")[1]*2:I=+n.find(B=>B.startsWith("#EXT-X-TARGETDURATION")).split(":")[1]*3}return{streamType:v,targetLiveWindow:E,liveEdgeStartOffset:I}},rp=async(n,a)=>{var l,m,v;let E=await bE(n),{streamType:I,targetLiveWindow:M,liveEdgeStartOffset:B}=_E(E);((l=zt.get(a))!=null?l:{}).liveEdgeStartOffset=B,((m=zt.get(a))!=null?m:{}).targetLiveWindow=M,a.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((v=zt.get(a))!=null?v:{}).streamType=I,a.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},TE=n=>{var a;let l=n.type,m=cp(l),v=hp(l),E,I=!!((a=n.partList)!=null&&a.length);return m===vt.LIVE&&(E=I?n.partTarget*2:n.targetduration*3),{streamType:m,targetLiveWindow:v,liveEdgeStartOffset:E,lowLatency:I}},AE=(n,a,l)=>{var m,v,E,I,M,B,F,Q;let{streamType:re,targetLiveWindow:te,liveEdgeStartOffset:se,lowLatency:pe}=TE(n);if(re===vt.LIVE){pe?(l.config.backBufferLength=(m=l.userConfig.backBufferLength)!=null?m:4,l.config.maxFragLookUpTolerance=(v=l.userConfig.maxFragLookUpTolerance)!=null?v:.001,l.config.abrBandWidthUpFactor=(E=l.userConfig.abrBandWidthUpFactor)!=null?E:l.config.abrBandWidthFactor):l.config.backBufferLength=(I=l.userConfig.backBufferLength)!=null?I:8;let Ae=Object.freeze({get length(){return a.seekable.length},start(ke){return a.seekable.start(ke)},end(ke){var we;return ke>this.length?a.seekable.end(ke):(we=l.liveSyncPosition)!=null?we:a.seekable.end(ke)}});((M=zt.get(a))!=null?M:{}).seekable=Ae}((B=zt.get(a))!=null?B:{}).liveEdgeStartOffset=se,((F=zt.get(a))!=null?F:{}).targetLiveWindow=te,a.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((Q=zt.get(a))!=null?Q:{}).streamType=re,a.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},ap,np,SE=(np=(ap=globalThis==null?void 0:globalThis.navigator)==null?void 0:ap.userAgent)!=null?np:"",kE=SE.toLowerCase().indexOf("android")!==-1,zt=new WeakMap,yp="mux.com",sp,op,Ep=(op=(sp=yi).isSupported)==null?void 0:op.call(sp),wE=kE,bp=()=>zl.default.utils.now(),LE=zl.default.utils.generateUUID,_p=(n,{domain:a=yp,maxResolution:l=""}={})=>{if(!n)return;let[m,v=""]=fE(n),E=new URL(`https://stream.${a}/${m}.m3u8${v}`);return l&&E.searchParams.set("max_resolution",l),E.toString()},IE=n=>{if(!n)return;let[a]=n.split("?");return a||void 0},RE=n=>{if(!n||!n.startsWith("https://stream."))return;let[a]=new URL(n).pathname.slice(1).split(".m3u8");return a||void 0},DE=n=>{var a,l,m;return(a=n==null?void 0:n.metadata)!=null&&a.video_id?n.metadata.video_id:Ip(n)&&(m=(l=IE(n.playbackId))!=null?l:RE(n.src))!=null?m:n.src},Tp=n=>{var a;return(a=zt.get(n))==null?void 0:a.error},Ap=n=>{var a,l;return(l=(a=zt.get(n))==null?void 0:a.streamType)!=null?l:vt.UNKNOWN},Sp=n=>{var a,l;return(l=(a=zt.get(n))==null?void 0:a.targetLiveWindow)!=null?l:Number.NaN},Wc=n=>{var a,l;return(l=(a=zt.get(n))==null?void 0:a.seekable)!=null?l:n.seekable},kp=n=>{var a;let l=(a=zt.get(n))==null?void 0:a.liveEdgeStartOffset;if(typeof l!="number")return Number.NaN;let m=Wc(n);return m.length?m.end(m.length-1)-l:Number.NaN},wp=(n,a,l)=>{qc(a,l);let{metadata:m={}}=n,{view_session_id:v=LE()}=m,E=DE(n);m.view_session_id=v,m.video_id=E,n.metadata=m,zt.set(a,{});let I=CE(n,a);xE(n,a,I),PE(n,a,I),EE(a);let M=vE(n,a,I),B=gE(n,a,I);return{engine:I,setAutoplay:M,setPreload:B}},qc=(n,a)=>{let l=a==null?void 0:a.engine;l&&(l.detachMedia(),l.destroy()),(n==null?void 0:n.mux)&&!n.mux.deleted&&(n.mux.destroy(),delete n.mux),n&&(n.removeAttribute("src"),n.load(),n.removeEventListener("error",Dp),n.removeEventListener("error",Bc),n.removeEventListener("durationchange",Rp),zt.delete(n),n.dispatchEvent(new Event("teardown")))};function Lp(n,a){var l;let m=up(n);if(m!==Rn.M3U8)return!0;let v=!m||((l=a.canPlayType(m))!=null?l:!0),{preferPlayback:E}=n,I=E===Hi.MSE,M=E===Hi.NATIVE;return v&&(M||!(Ep&&(I||wE)))}var CE=(n,a)=>{let{debug:l,streamType:m,startTime:v=-1,metadata:E,preferCmcd:I}=n,M=up(n)===Rn.M3U8,B=Lp(n,a);if(M&&!B&&Ep){let F={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},Q=ME(m),re=I!==Fc.NONE?{useHeaders:I===Fc.HEADER,sessionId:E==null?void 0:E.view_session_id,contentId:E==null?void 0:E.video_id}:void 0;return new yi({debug:l,startPosition:v,cmcd:re,...F,...Q})}},ME=n=>n===vt.LIVE?{backBufferLength:8}:{},Ip=({playbackId:n,src:a,customDomain:l})=>{if(n)return!0;if(typeof a!="string")return!1;let m=window==null?void 0:window.location.href,v=new URL(a,m).hostname.toLocaleLowerCase();return v.includes(yp)||!!l&&v.includes(l.toLocaleLowerCase())},xE=(n,a,l)=>{var m;let{envKey:v}=n,E=Ip(n);if(v||E){let{playerInitTime:I,playerSoftwareName:M,playerSoftwareVersion:B,beaconCollectionDomain:F,debug:Q,disableCookies:re}=n,te={...n.metadata,video_title:((m=n==null?void 0:n.metadata)==null?void 0:m.video_title)||void 0},se=pe=>typeof pe.player_error_code=="string"?!1:typeof n.errorTranslator=="function"?n.errorTranslator(pe):pe;zl.default.monitor(a,{debug:Q,beaconCollectionDomain:F,hlsjs:l,Hls:l?yi:void 0,automaticErrorTracking:!1,errorTranslator:se,disableCookies:re,data:{...v?{env_key:v}:{},player_software_name:M,player_software:M,player_software_version:B,player_init_time:I,...te}})}},PE=(n,a,l)=>{var m;let v=Lp(n,a),{src:E}=n;a&&v?(typeof E=="string"?(a.preload==="none"?Zr(a,"loadstart",()=>rp(E,a)):rp(E,a),a.setAttribute("src",E),n.startTime&&(((m=zt.get(a))!=null?m:{}).startTime=n.startTime,a.addEventListener("durationchange",Rp,{once:!0}))):a.removeAttribute("src"),a.addEventListener("error",Dp),a.addEventListener("error",Bc),a.addEventListener("emptied",()=>{a.querySelectorAll("track[data-removeondestroy]").forEach(I=>{I.remove()})},{once:!0})):l&&E?(l.once(yi.Events.LEVEL_LOADED,(I,M)=>{AE(M.details,a,l)}),l.on(yi.Events.ERROR,(I,M)=>{let B={[yi.ErrorTypes.NETWORK_ERROR]:pt.MEDIA_ERR_NETWORK,[yi.ErrorTypes.MEDIA_ERROR]:pt.MEDIA_ERR_DECODE},F=new pt("",B[M.type]);F.fatal=M.fatal,F.data=M,a.dispatchEvent(new CustomEvent("error",{detail:F}))}),a.addEventListener("error",Bc),yE(a,l),l.attachMedia(a)):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 Rp(n){var a;let l=n.target,m=(a=zt.get(l))==null?void 0:a.startTime;if(!!m&&hE(l.seekable,l.duration,m)){let v=l.preload==="auto";v&&(l.preload="none"),l.currentTime=m,v&&(l.preload="auto")}}async function Dp(n){if(!n.isTrusted)return;n.stopImmediatePropagation();let a=n.target;if(!(a!=null&&a.error))return;let{message:l,code:m}=a.error,v=new pt(l,m);if(a.src&&(m!==pt.MEDIA_ERR_DECODE||m!==void 0))try{let{status:E}=await fetch(a.src);v.data={response:{code:E}}}catch{}a.dispatchEvent(new CustomEvent("error",{detail:v}))}function Bc(n){var a,l;if(!(n instanceof CustomEvent)||!(n.detail instanceof pt))return;let m=n.target,v=n.detail;!v||!v.fatal||(((a=zt.get(m))!=null?a:{}).error=v,(l=m.mux)==null||l.emit("error",{player_error_code:v.code,player_error_message:v.message,player_error_context:v.context}))}var OE=Object.defineProperty,NE=(n,a,l)=>a in n?OE(n,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[a]=l,Xl=(n,a,l)=>(NE(n,typeof a!="symbol"?a+"":a,l),l),Qc=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},fe=(n,a,l)=>(Qc(n,a,"read from private field"),l?l.call(n):a.get(n)),Xe=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},gt=(n,a,l,m)=>(Qc(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),Mt=(n,a,l)=>(Qc(n,a,"access private method"),l),od=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class n extends od{}globalThis.DocumentFragment=n}var Xc=class extends od{},FE=class extends od{},UE={get(n){},define(n,a,l){},upgrade(n){},whenDefined(n){return Promise.resolve(Xc)}},Zl,BE=class{constructor(n,a={}){Xe(this,Zl,void 0),gt(this,Zl,a==null?void 0:a.detail)}get detail(){return fe(this,Zl)}initCustomEvent(){}};Zl=new WeakMap;function HE(n,a){return new Xc}var xp={document:{createElement:HE},DocumentFragment,customElements:UE,CustomEvent:BE,EventTarget:od,HTMLElement:Xc,HTMLVideoElement:FE},Pp=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Jr=Pp?xp:globalThis,Op=Pp?xp.document:globalThis.document,GE=()=>{try{return"0.15.2"}catch{}return"UNKNOWN"},VE=GE(),KE=()=>VE,Cp=n=>{var a,l,m,v,E,I,M,B,F,Q,re,te,se,pe,Ae,ke,we,nt,Ue,st,dt,oe,w,le,$,Ie,$e,tt,Bt,Je,H,ri,Ht,it,Qt,Ke,xt,ht,Tt,Qi;return a=class extends n{constructor(){super(),Xe(this,$e),Xe(this,Bt),Xe(this,H),Xe(this,Ht),Xe(this,Qt),Xe(this,xt),Xe(this,Tt),Xl(this,"castEnabled",!1),Xe(this,dt,{paused:!1}),Xe(this,oe,void 0),Xe(this,w,{}),Xe(this,le,void 0),Xe(this,$,void 0),Xe(this,Ie,void 0),a.instances.add(this),Mt(this,Qt,Ke).call(this)}static get castElement(){return fe(a,l)}static get castEnabled(){return fe(a,m)}static get castState(){var J;return(J=fe(a,F,Q))==null?void 0:J.getCastState()}static async exitCast(){try{await fe(a,F,Q).endCurrentSession(!0)}catch(J){console.error(J);return}}get castPlayer(){if(a.castElement===this)return fe(this,oe)}attributeChangedCallback(J){if(this.castPlayer)switch(J){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(J={}){var Ee;Mt(Ee=a,Ue,st).call(Ee,J),gt(a,l,this),Object.entries(fe(this,w)).forEach(([rt,bt])=>{fe(this,oe).controller.addEventListener(rt,bt)});try{await fe(a,F,Q).requestSession()}catch{gt(a,l,void 0);return}fe(this,dt).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(rt){console.error(rt)}}async load(){var J,Ee;if(!this.castPlayer)return super.load();let rt=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),bt=[...this.querySelectorAll("track")].filter(({kind:je,src:di})=>di&&(je==="subtitles"||je==="captions")),_t=[],ai=0;bt.length&&(rt.tracks=bt.map(je=>{let di=++ai;_t.length===0&&je.track.mode==="showing"&&_t.push(di);let ui=new chrome.cast.media.Track(di,chrome.cast.media.TrackType.TEXT);return ui.trackContentId=je.src,ui.trackContentType="text/vtt",ui.subtype=je.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,ui.name=je.label,ui.language=je.srclang,ui})),this.castStreamType==="live"?rt.streamType=chrome.cast.media.StreamType.LIVE:rt.streamType=chrome.cast.media.StreamType.BUFFERED,rt.metadata=new chrome.cast.media.GenericMediaMetadata,rt.metadata.title=this.title,rt.metadata.images=[{url:this.poster}];let Gi=new chrome.cast.media.LoadRequest(rt);Gi.currentTime=(J=super.currentTime)!=null?J:0,Gi.autoplay=!fe(this,dt).paused,Gi.activeTrackIds=_t,await((Ee=fe(a,re,te))==null?void 0:Ee.loadMedia(Gi)),this.dispatchEvent(new Event("volumechange"))}play(){var J;if(this.castPlayer){this.castPlayer.isPaused&&((J=this.castPlayer.controller)==null||J.playOrPause());return}return super.play()}pause(){var J;if(this.castPlayer){this.castPlayer.isPaused||(J=this.castPlayer.controller)==null||J.playOrPause();return}super.pause()}get castSrc(){var J,Ee,rt;return(rt=(Ee=this.getAttribute("cast-src"))!=null?Ee:(J=this.querySelector("source"))==null?void 0:J.src)!=null?rt:this.currentSrc}set castSrc(J){this.castSrc!=J&&this.setAttribute("cast-src",`${J}`)}get castContentType(){var J;return(J=this.getAttribute("cast-content-type"))!=null?J:void 0}set castContentType(J){this.setAttribute("cast-content-type",`${J}`)}get castStreamType(){var J,Ee;return(Ee=(J=this.getAttribute("cast-stream-type"))!=null?J:this.streamType)!=null?Ee:void 0}set castStreamType(J){this.setAttribute("cast-stream-type",`${J}`)}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 J;return this.castPlayer?(J=this.castPlayer)==null?void 0:J.isMuted:super.muted}set muted(J){var Ee;if(this.castPlayer){(J&&!this.castPlayer.isMuted||!J&&this.castPlayer.isMuted)&&((Ee=this.castPlayer.controller)==null||Ee.muteOrUnmute());return}super.muted=J}get volume(){var J,Ee;return this.castPlayer?(Ee=(J=this.castPlayer)==null?void 0:J.volumeLevel)!=null?Ee:1:super.volume}set volume(J){var Ee;if(this.castPlayer){this.castPlayer.volumeLevel=J,(Ee=this.castPlayer.controller)==null||Ee.setVolumeLevel();return}super.volume=J}get duration(){var J,Ee;return this.castPlayer&&fe(this,$e,tt)?(Ee=(J=this.castPlayer)==null?void 0:J.duration)!=null?Ee:NaN:super.duration}get currentTime(){var J,Ee;return this.castPlayer&&fe(this,$e,tt)?(Ee=(J=this.castPlayer)==null?void 0:J.currentTime)!=null?Ee:0:super.currentTime}set currentTime(J){var Ee;if(this.castPlayer){this.castPlayer.currentTime=J,(Ee=this.castPlayer.controller)==null||Ee.seek();return}super.currentTime=J}get onentercast(){return fe(this,le)}set onentercast(J){fe(this,le)&&(this.removeEventListener("entercast",fe(this,le)),gt(this,le,null)),typeof J=="function"&&(gt(this,le,J),this.addEventListener("entercast",J))}get onleavecast(){return fe(this,$)}set onleavecast(J){fe(this,$)&&(this.removeEventListener("leavecast",fe(this,$)),gt(this,$,null)),typeof J=="function"&&(gt(this,$,J),this.addEventListener("leavecast",J))}get oncastchange(){return fe(this,Ie)}set oncastchange(J){fe(this,Ie)&&(this.removeEventListener("castchange",fe(this,Ie)),gt(this,Ie,null)),typeof J=="function"&&(gt(this,Ie,J),this.addEventListener("castchange",J))}},l=new WeakMap,m=new WeakMap,v=new WeakMap,E=new WeakSet,I=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},M=new WeakSet,B=function(){return typeof cast!="undefined"&&cast.framework},F=new WeakSet,Q=function(){if(fe(a,M,B))return cast.framework.CastContext.getInstance()},re=new WeakSet,te=function(){var J;return(J=fe(a,F,Q))==null?void 0:J.getCurrentSession()},se=new WeakSet,pe=function(){var J;return(J=fe(a,re,te))==null?void 0:J.getSessionObj().media[0]},Ae=new WeakSet,ke=function(J){return new Promise((Ee,rt)=>{fe(a,se,pe).editTracksInfo(J,Ee,rt)})},we=new WeakSet,nt=function(J){return new Promise((Ee,rt)=>{fe(a,se,pe).getStatus(J,Ee,rt)})},Ue=new WeakSet,st=function(J){return fe(a,F,Q).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...J})},dt=new WeakMap,oe=new WeakMap,w=new WeakMap,le=new WeakMap,$=new WeakMap,Ie=new WeakMap,$e=new WeakSet,tt=function(){var J;return(J=this.castPlayer)==null?void 0:J.isMediaLoaded},Bt=new WeakSet,Je=function(){fe(a,l)===this&&(Object.entries(fe(this,w)).forEach(([J,Ee])=>{fe(this,oe).controller.removeEventListener(J,Ee)}),gt(a,l,void 0),this.muted=fe(this,oe).isMuted,this.currentTime=fe(this,oe).savedPlayerState.currentTime,fe(this,oe).savedPlayerState.isPaused===!1&&this.play())},H=new WeakSet,ri=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:fe(a,F,Q).getCastState()}))},Ht=new WeakSet,it=async function(){var J,Ee;let{SESSION_RESUMED:rt}=cast.framework.SessionState;if(fe(a,F,Q).getSessionState()===rt&&this.castSrc===((J=fe(a,se,pe))==null?void 0:J.media.contentId)){gt(a,l,this),Object.entries(fe(this,w)).forEach(([bt,_t])=>{fe(this,oe).controller.addEventListener(bt,_t)});try{await Mt(Ee=a,we,nt).call(Ee,new chrome.cast.media.GetStatusRequest)}catch(bt){console.error(bt)}fe(this,w)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),fe(this,w)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Qt=new WeakSet,Ke=function(){var J;!fe(a,M,B)||this.castEnabled||(this.castEnabled=!0,Mt(J=a,Ue,st).call(J),this.textTracks.addEventListener("change",Mt(this,Tt,Qi).bind(this)),Mt(this,H,ri).call(this),gt(this,oe,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(fe(this,oe)),gt(this,w,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:Ee})=>{Ee===!1&&Mt(this,Bt,Je).call(this),this.dispatchEvent(new Event(Ee?"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]:()=>{!fe(this,$e,tt)||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 Ee,rt;((Ee=this.castPlayer)==null?void 0:Ee.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"}[(rt=this.castPlayer)==null?void 0:rt.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!fe(this,$e,tt)||(await Promise.resolve(),Mt(this,xt,ht).call(this))}}))},xt=new WeakSet,ht=function(){Mt(this,Tt,Qi).call(this)},Tt=new WeakSet,Qi=async function(){var J,Ee,rt,bt,_t,ai;if(!this.castPlayer)return;let Gi=((Ee=(J=fe(this,oe).mediaInfo)==null?void 0:J.tracks)!=null?Ee:[]).filter(({type:ut})=>ut===chrome.cast.media.TrackType.TEXT),je=[...this.textTracks].filter(({kind:ut})=>ut==="subtitles"||ut==="captions"),di=Gi.map(({language:ut,name:Zi,trackId:ur})=>{var Nr;let{mode:Li}=(Nr=je.find(cr=>cr.language===ut&&cr.label===Zi))!=null?Nr:{};return Li?{mode:Li,trackId:ur}:!1}).filter(Boolean),ui=di.filter(({mode:ut})=>ut!=="showing").map(({trackId:ut})=>ut),Vi=di.find(({mode:ut})=>ut==="showing"),Xi=(_t=(bt=(rt=fe(a,re,te))==null?void 0:rt.getSessionObj().media[0])==null?void 0:bt.activeTrackIds)!=null?_t:[],ci=Xi;if(Xi.length&&(ci=ci.filter(ut=>!ui.includes(ut))),Vi!=null&&Vi.trackId&&(ci=[...ci,Vi.trackId]),ci=[...new Set(ci)],!((ut,Zi)=>ut.length===Zi.length&&ut.every(ur=>Zi.includes(ur)))(Xi,ci))try{let ut=new chrome.cast.media.EditTracksInfoRequest(ci);await Mt(ai=a,Ae,ke).call(ai,ut)}catch(ut){console.error(ut)}},Xe(a,E),Xe(a,M),Xe(a,F),Xe(a,re),Xe(a,se),Xe(a,Ae),Xe(a,we),Xe(a,Ue),Xl(a,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),Xl(a,"instances",new Set),Xe(a,l,void 0),Xe(a,m,!1),Xl(a,"initCast",()=>{var J;fe(a,E,I)?fe(a,M,B)?fe(J=a,v).call(J,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var Ee;return fe(Ee=a,v).call(Ee,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var Ee;return fe(Ee=a,v).call(Ee,chrome.cast.isAvailable)})}}),Xe(a,v,J=>{if(J){gt(a,m,!0);let{CAST_STATE_CHANGED:Ee}=cast.framework.CastContextEventType;fe(a,F,Q).addEventListener(Ee,bt=>{a.instances.forEach(_t=>{var ai;return Mt(ai=_t,H,ri).call(ai,bt)})});let{SESSION_STATE_CHANGED:rt}=cast.framework.CastContextEventType;fe(a,F,Q).addEventListener(rt,bt=>{a.instances.forEach(_t=>{var ai;return Mt(ai=_t,Ht,it).call(ai,bt)})}),a.instances.forEach(bt=>{var _t;return Mt(_t=bt,Qt,Ke).call(_t)})}}),a},Yc=globalThis.HTMLVideoElement?Cp(HTMLVideoElement):Cp(Object);globalThis.customElements&&!globalThis.customElements.get("castable-video")&&(customElements.define("castable-video",Yc,{extends:"video"}),globalThis.CastableVideoElement=Yc);Yc.initCast();var Zc=["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"],Np=Op.createElement("template");Np.innerHTML=`
|
|
902
891
|
<style>
|
|
903
892
|
:host {
|
|
904
893
|
display: inline-block;
|
|
@@ -923,8 +912,8 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
923
912
|
</style>
|
|
924
913
|
<video is="castable-video" part="video" crossorigin></video>
|
|
925
914
|
<slot></slot>
|
|
926
|
-
`;var ql,Us,Yl,Zl,Hc,Dn=class extends Zr.HTMLElement{constructor(){super(),Ze(this,Us),Ze(this,Zl),Ze(this,ql,void 0),this.attachShadow({mode:"open"}),this.isConnected&&Ct(this,Us,Yl).call(this)}static get observedAttributes(){let n=[],a=m=>m.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(m=>{let v=!1;try{typeof this.prototype[m]=="function"&&(v=!0)}catch{}!v&&m!==m.toUpperCase()&&n.push(m.toLowerCase(),a(m))});let o=Object.getPrototypeOf(this).observedAttributes;return o&&(n=n.concat(o)),n}attributeChangedCallback(n,a,o){Ct(this,Us,Yl).call(this),Ct(this,Zl,Hc).call(this,n,a,o)}connectedCallback(){Ct(this,Us,Yl).call(this)}};ql=new WeakMap,Us=new WeakSet,Yl=function(){if(he(this,ql))return;yt(this,ql,!0),this.shadowRoot.append(Cp.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),qc.forEach(a=>{this.nativeEl.addEventListener(a,o=>{this.dispatchEvent(new CustomEvent(o.type,{detail:o.detail}))})});let n=this.shadowRoot.querySelector("slot");n.addEventListener("slotchange",()=>{n.assignedElements().forEach(a=>{!["track","source"].includes(a.localName)||this.nativeEl.append(a)})}),Array.prototype.forEach.call(this.attributes,a=>{Ct(this,Zl,Hc).call(this,a.name,null,a.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},Zl=new WeakSet,Hc=function(n,a,o){let m=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),v=YE(m,n),g=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;v&&!g?typeof this[v]=="boolean"?o===null?this[v]=!1:this[v]=!0:this[v]=o:o===null?this.nativeEl.removeAttribute(n):["id","class"].indexOf(n)===-1&&this.nativeEl.setAttribute(n,o)};var Mp=[],xp=Dp.createElement("video",{is:"castable-video"}),qE=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let n=Object.getPrototypeOf(xp);n&&n!==Zr.HTMLElement.prototype;n=Object.getPrototypeOf(n))Object.getOwnPropertyNames(n).forEach(a=>{qE.indexOf(a)===-1&&Mp.push(a)});Mp.forEach(n=>{if(!(n in Dn.prototype))if(typeof xp[n]=="function")Dn.prototype[n]=function(){return this.nativeEl[n].apply(this.nativeEl,arguments)};else{let a={get(){return this.nativeEl[n]}};n!==n.toUpperCase()&&(a.set=function(o){this.nativeEl[n]=o}),Object.defineProperty(Dn.prototype,n,a)}});function YE(n,a){let o=null;return n.forEach(m=>{m.toLowerCase()==a.toLowerCase()&&(o=m)}),o}Zr.customElements.get("custom-video")||(Zr.customElements.define("custom-video",Dn),Zr.CustomVideoElement=Dn);var Lp=Dn,ae={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",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type"},$E=Object.values(ae),jE=WE(),zE="mux-video",Lr,Bs,$l,Hs,jl,zl,Ql,Xl,Gc,Vc=class extends Lp{constructor(){super(),Ze(this,Xl),Ze(this,Lr,void 0),Ze(this,Bs,void 0),Ze(this,$l,void 0),Ze(this,Hs,{}),Ze(this,jl,void 0),Ze(this,zl,void 0),Ze(this,Ql,void 0),yt(this,$l,pp())}static get observedAttributes(){var n;return[...$E,...(n=Lp.observedAttributes)!=null?n:[]]}get preferCmcd(){var n;return(n=this.getAttribute(ae.PREFER_CMCD))!=null?n:void 0}set preferCmcd(n){n!==this.preferCmcd&&(n?Rn.includes(n)?this.setAttribute(ae.PREFER_CMCD,n):console.warn(`Invalid value for preferCmcd. Must be one of ${Rn.join()}`):this.removeAttribute(ae.PREFER_CMCD))}get playerInitTime(){return he(this,$l)}get playerSoftwareName(){var n;return(n=he(this,zl))!=null?n:zE}set playerSoftwareName(n){yt(this,zl,n)}get playerSoftwareVersion(){var n;return(n=he(this,jl))!=null?n:jE}set playerSoftwareVersion(n){yt(this,jl,n)}get _hls(){var n;return(n=he(this,Lr))==null?void 0:n.engine}get mux(){return this.nativeEl.mux}get error(){var n;return(n=gp(this.nativeEl))!=null?n:null}get errorTranslator(){return he(this,Ql)}set errorTranslator(n){yt(this,Ql,n)}get src(){return this.getAttribute("src")}set src(n){n!==this.src&&(n==null?this.removeAttribute("src"):this.setAttribute("src",n))}get type(){var n;return(n=this.getAttribute(ae.TYPE))!=null?n:void 0}set type(n){n!==this.type&&(n?this.setAttribute(ae.TYPE,n):this.removeAttribute(ae.TYPE))}get autoplay(){let n=this.getAttribute("autoplay");return n===null?!1:n===""?!0:n}set autoplay(n){let a=this.autoplay;n!==a&&(n?this.setAttribute("autoplay",typeof n=="string"?n:""):this.removeAttribute("autoplay"))}get preload(){let n=this.getAttribute("preload");return n===""?"auto":["none","metadata","auto"].includes(n)?n:super.preload}set preload(n){n!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(n)?this.setAttribute("preload",n):this.removeAttribute("preload"))}get debug(){return this.getAttribute(ae.DEBUG)!=null}set debug(n){n!==this.debug&&(n?this.setAttribute(ae.DEBUG,""):this.removeAttribute(ae.DEBUG))}get disableCookies(){return this.hasAttribute(ae.DISABLE_COOKIES)}set disableCookies(n){n!==this.disableCookies&&(n?this.setAttribute(ae.DISABLE_COOKIES,""):this.removeAttribute(ae.DISABLE_COOKIES))}get startTime(){let n=this.getAttribute(ae.START_TIME);if(n==null)return;let a=+n;return Number.isNaN(a)?void 0:a}set startTime(n){n!==this.startTime&&(n==null?this.removeAttribute(ae.START_TIME):this.setAttribute(ae.START_TIME,`${n}`))}get playbackId(){var n;return(n=this.getAttribute(ae.PLAYBACK_ID))!=null?n:void 0}set playbackId(n){n!==this.playbackId&&(n?this.setAttribute(ae.PLAYBACK_ID,n):this.removeAttribute(ae.PLAYBACK_ID))}get maxResolution(){var n;return(n=this.getAttribute(ae.MAX_RESOLUTION))!=null?n:void 0}set maxResolution(n){n!==this.maxResolution&&(n?this.setAttribute(ae.MAX_RESOLUTION,n):this.removeAttribute(ae.MAX_RESOLUTION))}get customDomain(){var n;return(n=this.getAttribute(ae.CUSTOM_DOMAIN))!=null?n:void 0}set customDomain(n){n!==this.customDomain&&(n?this.setAttribute(ae.CUSTOM_DOMAIN,n):this.removeAttribute(ae.CUSTOM_DOMAIN))}get envKey(){var n;return(n=this.getAttribute(ae.ENV_KEY))!=null?n:void 0}set envKey(n){n!==this.envKey&&(n?this.setAttribute(ae.ENV_KEY,n):this.removeAttribute(ae.ENV_KEY))}get beaconCollectionDomain(){var n;return(n=this.getAttribute(ae.BEACON_COLLECTION_DOMAIN))!=null?n:void 0}set beaconCollectionDomain(n){n!==this.beaconCollectionDomain&&(n?this.setAttribute(ae.BEACON_COLLECTION_DOMAIN,n):this.removeAttribute(ae.BEACON_COLLECTION_DOMAIN))}get streamType(){var n;return(n=this.getAttribute(ae.STREAM_TYPE))!=null?n:yp(this.nativeEl)}set streamType(n){n!==this.streamType&&(n?this.setAttribute(ae.STREAM_TYPE,n):this.removeAttribute(ae.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(ae.TARGET_LIVE_WINDOW)?+this.getAttribute(ae.TARGET_LIVE_WINDOW):Ep(this.nativeEl)}set targetLiveWindow(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ae.TARGET_LIVE_WINDOW):this.setAttribute(ae.TARGET_LIVE_WINDOW,`${+n}`))}get liveEdgeStart(){var n,a;if(this.hasAttribute(ae.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:o}=this,m=(n=this.nativeEl.seekable.end(0))!=null?n:0,v=(a=this.nativeEl.seekable.start(0))!=null?a:0;return Math.max(v,m-o)}return bp(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(ae.LIVE_EDGE_OFFSET))return+this.getAttribute(ae.LIVE_EDGE_OFFSET)}set liveEdgeOffset(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ae.LIVE_EDGE_OFFSET):this.setAttribute(ae.LIVE_EDGE_OFFSET,`${+n}`))}get seekable(){return Fc(this.nativeEl)}async addCuePoints(n){return Oc(this.nativeEl,n)}get activeCuePoint(){return Nc(this.nativeEl)}get cuePoints(){return up(this.nativeEl)}getStartDate(){return cp(this.nativeEl,this._hls)}get currentPdt(){return hp(this.nativeEl,this._hls)}get preferPlayback(){let n=this.getAttribute(ae.PREFER_PLAYBACK);if(n===Hi.MSE||n===Hi.NATIVE)return n}set preferPlayback(n){n!==this.preferPlayback&&(n===Hi.MSE||n===Hi.NATIVE?this.setAttribute(ae.PREFER_PLAYBACK,n):this.removeAttribute(ae.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(n=>n.startsWith("metadata-")&&![ae.METADATA_URL].includes(n)).reduce((n,a)=>{let o=this.getAttribute(a);return o!=null&&(n[a.replace(/^metadata-/,"").replace(/-/g,"_")]=o),n},{}),...he(this,Hs)}}set metadata(n){yt(this,Hs,n!=null?n:{}),this.mux&&this.mux.emit("hb",he(this,Hs))}load(){yt(this,Lr,_p(this,this.nativeEl,he(this,Lr)))}unload(){Uc(this.nativeEl,he(this,Lr)),yt(this,Lr,void 0)}attributeChangedCallback(n,a,o){var m,v;switch(super.attributeChangedCallback(n,a,o),n){case ae.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=o!=null?o:void 0;break;case ae.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=o!=null?o:void 0;break;case"src":{let g=!!a,L=!!o;!g&&L?Ct(this,Xl,Gc).call(this):g&&!L?this.unload():g&&L&&(this.unload(),Ct(this,Xl,Gc).call(this));break}case"autoplay":if(o===a)break;(m=he(this,Lr))==null||m.setAutoplay(this.autoplay);break;case"preload":if(o===a)break;(v=he(this,Lr))==null||v.setPreload(o);break;case ae.PLAYBACK_ID:this.src=vp(o!=null?o:void 0,{maxResolution:this.maxResolution,domain:this.customDomain});break;case ae.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 ae.METADATA_URL:o&&fetch(o).then(g=>g.json()).then(g=>this.metadata=g).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${o}!`));break;case ae.STREAM_TYPE:(o==null||o!==a)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case ae.TARGET_LIVE_WINDOW:(o==null||o!==a)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}disconnectedCallback(){this.unload()}};Lr=new WeakMap,Bs=new WeakMap,$l=new WeakMap,Hs=new WeakMap,jl=new WeakMap,zl=new WeakMap,Ql=new WeakMap,Xl=new WeakSet,Gc=async function(){he(this,Bs)||(await yt(this,Bs,Promise.resolve()),yt(this,Bs,null),this.load())};Zr.customElements.get("mux-video")||(Zr.customElements.define("mux-video",Vc),Zr.MuxVideoElement=Vc);var Pp=Vc;var QE="en",wa={code:QE};var Op="en";function qe(n,a=!0){var v,g;let o=a&&(g=(v=wa)==null?void 0:v[n])!=null?g:n,m=a?wa.code:Op;return new Yc(o,m)}var Yc=class{constructor(a,o=(m=>(m=wa.code)!=null?m:Op)()){this.message=a,this.locale=o}format(a){return this.message.replace(/\{(\w+)\}/g,(o,m)=>{var v;return(v=a[m])!=null?v:""})}toString(){return this.message}};function Np(n){let a="";return Object.entries(n).forEach(([o,m])=>{m!=null&&(a+=`${ed(o)}: ${m}; `)}),a?a.trim():void 0}function ed(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function td(n){return n.replace(/[-_]([a-z])/g,(a,o)=>o.toUpperCase())}function Ir(n){if(n==null)return;let a=+n;return Number.isNaN(a)?void 0:a}function id(n){let a=XE(n).toString();return a?"?"+a:""}function XE(n){let a={};for(let o in n)n[o]!=null&&(a[o]=n[o]);return new URLSearchParams(a)}function Jr(n){let a=(n!=null?n:"").split(".")[1];if(!a)return{};let o=a.replace(/-/g,"+").replace(/_/g,"/"),m=decodeURIComponent(atob(o).split("").map(function(v){return"%"+("00"+v.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(m)}var $c=(n,a)=>!n||!a?!1:n.contains(a)?!0:$c(n,a.getRootNode().host);var jc="mux.com",ZE=()=>{try{return"1.10.1"}catch{}return"UNKNOWN"},JE=ZE(),ad=()=>JE,zc=(n,{maxResolution:a,token:o,domain:m=jc}={})=>{let L=!!o?{token:o}:{redundant_streams:!0,...a?{max_resolution:a}:{}};return`https://stream.${m}/${n}.m3u8${id(L)}`},Fp=(n,{token:a,thumbnailTime:o,domain:m=jc}={})=>{let v=a==null?o:void 0,{aud:g}=Jr(a);if(!(a&&g!=="t"))return`https://image.${m}/${n}/thumbnail.webp${id({token:a,time:v})}`},Up=(n,{token:a,domain:o=jc}={})=>{let{aud:m}=Jr(a);if(!(a&&m!=="s"))return`https://image.${o}/${n}/storyboard.vtt${id({token:a,format:"webp"})}`},Gs=n=>{if(!!n){if([gt.LIVE,gt.ON_DEMAND].includes(n))return n;if(n!=null&&n.includes("live"))return gt.LIVE}};var e0={crossorigin:"crossOrigin",playsinline:"playsInline"};function Bp(n){var a;return(a=e0[n])!=null?a:td(n)}var La,Ia,ni,rd=class{constructor(a,o){Rt(this,La,void 0);Rt(this,Ia,void 0);Rt(this,ni,[]);Oi(this,La,a),Oi(this,Ia,o)}[Symbol.iterator](){return at(this,ni).values()}get length(){return at(this,ni).length}get value(){var a;return(a=at(this,ni).join(" "))!=null?a:""}set value(a){var o;a!==this.value&&(Oi(this,ni,[]),this.add(...(o=a==null?void 0:a.split(" "))!=null?o:[]))}toString(){return this.value}item(a){return at(this,ni)[a]}values(){return at(this,ni).values()}keys(){return at(this,ni).keys()}forEach(a){at(this,ni).forEach(a)}add(...a){var o,m;a.forEach(v=>{this.contains(v)||at(this,ni).push(v)}),!(this.value===""&&!((o=at(this,La))!=null&&o.hasAttribute(`${at(this,Ia)}`)))&&((m=at(this,La))==null||m.setAttribute(`${at(this,Ia)}`,`${this.value}`))}remove(...a){var o;a.forEach(m=>{at(this,ni).splice(at(this,ni).indexOf(m),1)}),(o=at(this,La))==null||o.setAttribute(`${at(this,Ia)}`,`${this.value}`)}contains(a){return at(this,ni).includes(a)}toggle(a,o){return typeof o!="undefined"?o?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,o){this.remove(a),this.add(o)}};La=new WeakMap,Ia=new WeakMap,ni=new WeakMap;var Hp=`[mux-player ${ad()}]`;function ea(...n){console.warn(Hp,...n)}function Qi(...n){console.error(Hp,...n)}function Qc(n){var o;let a=(o=n.message)!=null?o:"";if(n.context&&(a+=` ${n.context}`),n.file){let m="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${qe("Read more: ")}
|
|
927
|
-
${m}${n.file}`}ea(a)}var ti={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Ra={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Vp=Object.freeze({length:0,start(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),t0=qc.filter(n=>n!=="error"),i0=Object.values(ti).filter(n=>![ti.PLAYSINLINE].includes(n)),r0=Object.values(Ra);function Kp(n){n.querySelectorAll(":scope > track").forEach(a=>{var o;(o=n.media)==null||o.append(a.cloneNode())}),t0.forEach(a=>{var o;(o=n.media)==null||o.addEventListener(a,m=>{n.dispatchEvent(new Event(m.type))})})}var Xc=class extends Ft.HTMLElement{static get observedAttributes(){return[...i0,...r0]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(m=>{var v;(v=this.media)==null||v.append(m.cloneNode())});let a=m=>{for(let v of m)v.type==="childList"&&(v.removedNodes.forEach(g=>{var M,B;let L=(M=this.media)==null?void 0:M.querySelector(`track[src="${g.src}"]`);L&&((B=this.media)==null||B.removeChild(L))}),v.addedNodes.forEach(g=>{var L;(L=this.media)==null||L.append(g.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,o,m){var v,g;switch(a){case Ra.MUTED:{this.media&&(this.media.muted=m!=null,this.media.defaultMuted=m!=null);return}case Ra.VOLUME:{let L=(v=Ir(m))!=null?v:1;this.media&&(this.media.volume=L);return}case Ra.PLAYBACKRATE:{let L=(g=Ir(m))!=null?g:1;this.media&&(this.media.playbackRate=L,this.media.defaultPlaybackRate=L);return}}}play(){var a,o;return(o=(a=this.media)==null?void 0:a.play())!=null?o:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}requestCast(a){var o;return(o=this.media)==null?void 0:o.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get paused(){var a,o;return(o=(a=this.media)==null?void 0:a.paused)!=null?o:!0}get duration(){var a,o;return(o=(a=this.media)==null?void 0:a.duration)!=null?o:NaN}get ended(){var a,o;return(o=(a=this.media)==null?void 0:a.ended)!=null?o:!1}get buffered(){var a,o;return(o=(a=this.media)==null?void 0:a.buffered)!=null?o:Vp}get seekable(){var a,o;return(o=(a=this.media)==null?void 0:a.seekable)!=null?o:Vp}get readyState(){var a,o;return(o=(a=this.media)==null?void 0:a.readyState)!=null?o:0}get videoWidth(){var a,o;return(o=(a=this.media)==null?void 0:a.videoWidth)!=null?o:0}get videoHeight(){var a,o;return(o=(a=this.media)==null?void 0:a.videoHeight)!=null?o:0}get currentTime(){var a,o;return(o=(a=this.media)==null?void 0:a.currentTime)!=null?o:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,o;return(o=(a=this.media)==null?void 0:a.volume)!=null?o:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,o;return(o=(a=this.media)==null?void 0:a.playbackRate)!=null?o:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=Ir(this.getAttribute(Ra.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(Ra.PLAYBACKRATE,`${a}`):this.removeAttribute(Ra.PLAYBACKRATE)}get crossOrigin(){return Vs(this,ti.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(ti.CROSSORIGIN,`${a}`)}get autoplay(){return Vs(this,ti.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(ti.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(ti.AUTOPLAY)}get loop(){return Vs(this,ti.LOOP)!=null}set loop(a){a?this.setAttribute(ti.LOOP,""):this.removeAttribute(ti.LOOP)}get muted(){var a,o;return(o=(a=this.media)==null?void 0:a.muted)!=null?o:!1}set muted(a){this.media&&(this.media.muted=Boolean(a))}get defaultMuted(){return Vs(this,ti.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(ti.MUTED,""):this.removeAttribute(ti.MUTED)}get playsInline(){return Vs(this,ti.PLAYSINLINE)!=null}set playsInline(a){Qi("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(a){["","none","metadata","auto"].includes(a)?this.setAttribute(ti.PRELOAD,a):this.removeAttribute(ti.PRELOAD)}};function Vs(n,a){return n.media?n.media.getAttribute(a):n.getAttribute(a)}var Zc=Xc;var a0=Object.defineProperty,n0=(n,a,o)=>a in n?a0(n,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[a]=o,s0=(n,a,o)=>(n0(n,typeof a!="symbol"?a+"":a,o),o),jp=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},We=(n,a,o)=>(jp(n,a,"read from private field"),o?o.call(n):a.get(n)),mr=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},Rr=(n,a,o,m)=>(jp(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),Cn,nd,Da,Ks,ta,ia,ra,Ca,Mn,sd,Xi,Wp=1,qp=0,o0=1,l0={processCallback(n,a,o){if(!!o){for(let[m,v]of a)if(m in o){let g=o[m];typeof g=="boolean"&&v instanceof si&&typeof v.element[v.attributeName]=="boolean"?v.booleanValue=g:typeof g=="function"&&v instanceof si?v.element[v.attributeName]=g:v.value=g}}}},Dr=class extends q.DocumentFragment{constructor(a,o,m=l0){var v;super(),mr(this,Cn,void 0),mr(this,nd,void 0),this.append(a.content.cloneNode(!0)),Rr(this,Cn,zp(this)),Rr(this,nd,m),(v=m.createCallback)==null||v.call(m,this,We(this,Cn),o),m.processCallback(this,We(this,Cn),o)}update(a){We(this,nd).processCallback(this,We(this,Cn),a)}};Cn=new WeakMap;nd=new WeakMap;var zp=(n,a=[])=>{let o,m;for(let v of n.attributes||[])if(v.value.includes("{{")){let g=new Jc;for([o,m]of $p(v.value))if(!o)g.append(m);else{let L=new si(n,v.name,v.namespaceURI);g.append(L),a.push([m,L])}v.value=g.toString()}for(let v of n.childNodes)if(v.nodeType===Wp&&!(v instanceof HTMLTemplateElement))zp(v,a);else if(v.nodeType===Wp||v.data.includes("{{")){let g=[];if(v.data)for([o,m]of $p(v.data))if(!o)g.push(new Text(m));else{let L=new Cr(n);g.push(L),a.push([m,L])}else if(v instanceof HTMLTemplateElement){let L=new Ws(n,v);g.push(L),a.push([L.expression,L])}v.replaceWith(...g.flatMap(L=>L.replacementNodes||[L]))}return a},Yp={},$p=n=>{let a="",o=0,m=Yp[n],v=0,g;if(m)return m;for(m=[];g=n[v];v++)g==="{"&&n[v+1]==="{"&&n[v-1]!=="\\"&&n[v+2]&&++o==1?(a&&m.push([qp,a]),a="",v++):g==="}"&&n[v+1]==="}"&&n[v-1]!=="\\"&&!--o?(m.push([o0,a.trim()]),a="",v++):a+=g||"";return a&&m.push([qp,(o>0?"{{":"")+a]),Yp[n]=m},d0=11,od=class{get value(){return""}set value(a){}toString(){return this.value}},Qp=new WeakMap,Jc=class{constructor(){mr(this,Da,[])}[Symbol.iterator](){return We(this,Da).values()}get length(){return We(this,Da).length}item(a){return We(this,Da)[a]}append(...a){for(let o of a)o instanceof si&&Qp.set(o,this),We(this,Da).push(o)}toString(){return We(this,Da).join("")}};Da=new WeakMap;var si=class extends od{constructor(a,o,m){super(),mr(this,Ca),mr(this,Ks,""),mr(this,ta,void 0),mr(this,ia,void 0),mr(this,ra,void 0),Rr(this,ta,a),Rr(this,ia,o),Rr(this,ra,m)}get attributeName(){return We(this,ia)}get attributeNamespace(){return We(this,ra)}get element(){return We(this,ta)}get value(){return We(this,Ks)}set value(a){We(this,Ks)!==a&&(Rr(this,Ks,a),!We(this,Ca,Mn)||We(this,Ca,Mn).length===1?a==null?We(this,ta).removeAttributeNS(We(this,ra),We(this,ia)):We(this,ta).setAttributeNS(We(this,ra),We(this,ia),a):We(this,ta).setAttributeNS(We(this,ra),We(this,ia),We(this,Ca,Mn)))}get booleanValue(){return We(this,ta).hasAttributeNS(We(this,ra),We(this,ia))}set booleanValue(a){if(!We(this,Ca,Mn)||We(this,Ca,Mn).length===1)this.value=a?"":null;else throw new DOMException("Value is not fully templatized")}};Ks=new WeakMap;ta=new WeakMap;ia=new WeakMap;ra=new WeakMap;Ca=new WeakSet;Mn=function(){return Qp.get(this)};var Cr=class extends od{constructor(a,o){super(),mr(this,sd,void 0),mr(this,Xi,void 0),Rr(this,sd,a),Rr(this,Xi,o?[...o]:[new Text])}get replacementNodes(){return We(this,Xi)}get parentNode(){return We(this,sd)}get nextSibling(){return We(this,Xi)[We(this,Xi).length-1].nextSibling}get previousSibling(){return We(this,Xi)[0].previousSibling}get value(){return We(this,Xi).map(a=>a.textContent).join("")}set value(a){this.replace(a)}replace(...a){let o=a.flat().flatMap(m=>m==null?[new Text]:m.forEach?[...m]:m.nodeType===d0?[...m.childNodes]:m.nodeType?[m]:[new Text(m)]);o.length||o.push(new Text),Rr(this,Xi,u0(We(this,Xi)[0].parentNode,We(this,Xi),o,this.nextSibling))}};sd=new WeakMap;Xi=new WeakMap;var Ws=class extends Cr{constructor(a,o){let m=o.getAttribute("directive")||o.getAttribute("type"),v=o.getAttribute("expression")||o.getAttribute(m)||"";v.startsWith("{{")&&(v=v.trim().slice(2,-2).trim()),super(a),s0(this,"directive"),this.expression=v,this.template=o,this.directive=m}};function u0(n,a,o,m=null){let v=0,g,L,M,B=o.length,U=a.length;for(;v<B&&v<U&&a[v]==o[v];)v++;for(;v<B&&v<U&&o[B-1]==a[U-1];)m=o[--U,--B];if(v==U)for(;v<B;)n.insertBefore(o[v++],m);if(v==B)for(;v<U;)n.removeChild(a[v++]);else{for(g=a[v];v<B;)M=o[v++],L=g?g.nextSibling:m,g==M?g=L:v<B&&o[v]==L?(n.replaceChild(M,g),g=L):n.insertBefore(M,g);for(;g!=m;)L=g.nextSibling,n.removeChild(g),g=L}return o}var Xp={string:n=>String(n)},dd=class{constructor(a){this.template=a,this.state=void 0}},Ma=new WeakMap,xa=new WeakMap,eh={partial:(n,a)=>{a[n.expression]=new dd(n.template)},if:(n,a)=>{var o;if(Jp(n.expression,a))if(Ma.get(n)!==n.template){Ma.set(n,n.template);let m=new Dr(n.template,a,ud);n.replace(m),xa.set(n,m)}else(o=xa.get(n))==null||o.update(a);else n.replace(""),Ma.delete(n),xa.delete(n)}},c0=Object.keys(eh),ud={processCallback(n,a,o){var m,v;if(!!o)for(let[g,L]of a){if(L instanceof Ws){if(!L.directive){let B=c0.find(U=>L.template.hasAttribute(U));B&&(L.directive=B,L.expression=L.template.getAttribute(B))}(m=eh[L.directive])==null||m.call(eh,L,o);continue}let M=Jp(g,o);if(M instanceof dd){Ma.get(L)!==M.template?(Ma.set(L,M.template),M=new Dr(M.template,M.state,ud),L.value=M,xa.set(L,M)):(v=xa.get(L))==null||v.update(M.state);continue}M?(L instanceof si&&L.attributeName.startsWith("aria-")&&(M=String(M)),L instanceof si?typeof M=="boolean"?L.booleanValue=M:typeof M=="function"?L.element[L.attributeName]=M:L.value=M:(L.value=M,Ma.delete(L),xa.delete(L))):L instanceof si?L.value=void 0:(L.value=void 0,Ma.delete(L),xa.delete(L))}}},Zp={"!":n=>!n,"!!":n=>!!n,"==":(n,a)=>n==a,"!=":(n,a)=>n!=a,">":(n,a)=>n>a,">=":(n,a)=>n>=a,"<":(n,a)=>n<a,"<=":(n,a)=>n<=a,"??":(n,a)=>n!=null?n:a,"|":(n,a)=>{var o;return(o=Xp[a])==null?void 0:o.call(Xp,n)}};function h0(n){return f0(n,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:a})=>a!=="ws")}function Jp(n,a={}){var o,m,v,g,L,M,B;let U=h0(n);if(U.length===0||U.some(({type:z})=>!z))return qs(n);if(((o=U[0])==null?void 0:o.token)===">"){let z=a[(m=U[1])==null?void 0:m.token];if(!z)return qs(n);let ie={...a};z.state=ie;let ee=U.slice(2);for(let se=0;se<ee.length;se+=3){let fe=(v=ee[se])==null?void 0:v.token,_e=(g=ee[se+1])==null?void 0:g.token,Ae=(L=ee[se+2])==null?void 0:L.token;fe&&_e==="="&&(ie[fe]=Ys(Ae,a))}return z}if(U.length===1)return ld(U[0])?Ys(U[0].token,a):qs(n);if(U.length===2){let z=(M=U[0])==null?void 0:M.token,ie=Zp[z];if(!ie||!ld(U[1]))return qs(n);let ee=Ys(U[1].token,a);return ie(ee)}if(U.length===3){let z=(B=U[1])==null?void 0:B.token,ie=Zp[z];if(!ie||!ld(U[0])||!ld(U[2]))return qs(n);let ee=Ys(U[0].token,a);if(z==="|")return ie(ee,U[2].token);let se=Ys(U[2].token,a);return ie(ee,se)}}function qs(n){return console.warn(`Warning: invalid expression \`${n}\``),!1}function ld({type:n}){return["number","boolean","string","param"].includes(n)}function Ys(n,a){let o=n[0],m=n.slice(-1);return n==="true"||n==="false"?n==="true":o===m&&["'",'"'].includes(o)?n.slice(1,-1):Wo(n)?parseFloat(n):a[n]}function f0(n,a){let o,m,v,g=[];for(;n;){v=null,o=n.length;for(let L in a)m=a[L].exec(n),m&&m.index<o&&(v={token:m[0],type:L,matches:m.slice(1)},o=m.index);o&&g.push({token:n.substr(0,o),type:void 0}),v&&g.push(v),n=n.substr(o+(v?v.token.length:0))}return g}var m0=Object.defineProperty,p0=(n,a,o)=>a in n?m0(n,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[a]=o,$s=(n,a,o)=>(p0(n,typeof a!="symbol"?a+"":a,o),o),ah=(n,a,o)=>{if(!a.has(n))throw TypeError("Cannot "+o)},ev=(n,a,o)=>(ah(n,a,"read from private field"),o?o.call(n):a.get(n)),th=(n,a,o)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,o)},cd=(n,a,o,m)=>(ah(n,a,"write to private field"),m?m.call(n,o):a.set(n,o),o),v0=(n,a,o)=>(ah(n,a,"access private method"),o),xn,hd,rh,tv,ih={"media-target-live-window":"targetLiveWindow","media-stream-type":"streamType"},iv=re.createElement("template");iv.innerHTML=`
|
|
915
|
+
`;var Jl,Gs,ed,sd,$c,Cn=class extends Jr.HTMLElement{constructor(){super(),Xe(this,Gs),Xe(this,sd),Xe(this,Jl,void 0),this.attachShadow({mode:"open"}),this.isConnected&&Mt(this,Gs,ed).call(this)}static get observedAttributes(){let n=[],a=m=>m.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(m=>{let v=!1;try{typeof this.prototype[m]=="function"&&(v=!0)}catch{}!v&&m!==m.toUpperCase()&&n.push(m.toLowerCase(),a(m))});let l=Object.getPrototypeOf(this).observedAttributes;return l&&(n=n.concat(l)),n}attributeChangedCallback(n,a,l){Mt(this,Gs,ed).call(this),Mt(this,sd,$c).call(this,n,a,l)}connectedCallback(){Mt(this,Gs,ed).call(this)}};Jl=new WeakMap,Gs=new WeakSet,ed=function(){if(fe(this,Jl))return;gt(this,Jl,!0),this.shadowRoot.append(Np.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),Zc.forEach(a=>{this.nativeEl.addEventListener(a,l=>{this.dispatchEvent(new CustomEvent(l.type,{detail:l.detail}))})});let n=this.shadowRoot.querySelector("slot");n.addEventListener("slotchange",()=>{n.assignedElements().forEach(a=>{!["track","source"].includes(a.localName)||this.nativeEl.append(a)})}),Array.prototype.forEach.call(this.attributes,a=>{Mt(this,sd,$c).call(this,a.name,null,a.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},sd=new WeakSet,$c=function(n,a,l){let m=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),v=qE(m,n),E=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;v&&!E?typeof this[v]=="boolean"?l===null?this[v]=!1:this[v]=!0:this[v]=l:l===null?this.nativeEl.removeAttribute(n):["id","class"].indexOf(n)===-1&&this.nativeEl.setAttribute(n,l)};var Fp=[],Up=Op.createElement("video",{is:"castable-video"}),WE=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let n=Object.getPrototypeOf(Up);n&&n!==Jr.HTMLElement.prototype;n=Object.getPrototypeOf(n))Object.getOwnPropertyNames(n).forEach(a=>{WE.indexOf(a)===-1&&Fp.push(a)});Fp.forEach(n=>{if(!(n in Cn.prototype))if(typeof Up[n]=="function")Cn.prototype[n]=function(){return this.nativeEl[n].apply(this.nativeEl,arguments)};else{let a={get(){return this.nativeEl[n]}};n!==n.toUpperCase()&&(a.set=function(l){this.nativeEl[n]=l}),Object.defineProperty(Cn.prototype,n,a)}});function qE(n,a){let l=null;return n.forEach(m=>{m.toLowerCase()==a.toLowerCase()&&(l=m)}),l}Jr.customElements.get("custom-video")||(Jr.customElements.define("custom-video",Cn),Jr.CustomVideoElement=Cn);var Mp=Cn,ae={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",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type"},YE=Object.values(ae),$E=KE(),jE="mux-video",Ir,Vs,td,Ks,id,rd,ad,nd,jc,zc=class extends Mp{constructor(){super(),Xe(this,nd),Xe(this,Ir,void 0),Xe(this,Vs,void 0),Xe(this,td,void 0),Xe(this,Ks,{}),Xe(this,id,void 0),Xe(this,rd,void 0),Xe(this,ad,void 0),gt(this,td,bp())}static get observedAttributes(){var n;return[...YE,...(n=Mp.observedAttributes)!=null?n:[]]}get preferCmcd(){var n;return(n=this.getAttribute(ae.PREFER_CMCD))!=null?n:void 0}set preferCmcd(n){n!==this.preferCmcd&&(n?Dn.includes(n)?this.setAttribute(ae.PREFER_CMCD,n):console.warn(`Invalid value for preferCmcd. Must be one of ${Dn.join()}`):this.removeAttribute(ae.PREFER_CMCD))}get playerInitTime(){return fe(this,td)}get playerSoftwareName(){var n;return(n=fe(this,rd))!=null?n:jE}set playerSoftwareName(n){gt(this,rd,n)}get playerSoftwareVersion(){var n;return(n=fe(this,id))!=null?n:$E}set playerSoftwareVersion(n){gt(this,id,n)}get _hls(){var n;return(n=fe(this,Ir))==null?void 0:n.engine}get mux(){return this.nativeEl.mux}get error(){var n;return(n=Tp(this.nativeEl))!=null?n:null}get errorTranslator(){return fe(this,ad)}set errorTranslator(n){gt(this,ad,n)}get src(){return this.getAttribute("src")}set src(n){n!==this.src&&(n==null?this.removeAttribute("src"):this.setAttribute("src",n))}get type(){var n;return(n=this.getAttribute(ae.TYPE))!=null?n:void 0}set type(n){n!==this.type&&(n?this.setAttribute(ae.TYPE,n):this.removeAttribute(ae.TYPE))}get autoplay(){let n=this.getAttribute("autoplay");return n===null?!1:n===""?!0:n}set autoplay(n){let a=this.autoplay;n!==a&&(n?this.setAttribute("autoplay",typeof n=="string"?n:""):this.removeAttribute("autoplay"))}get preload(){let n=this.getAttribute("preload");return n===""?"auto":["none","metadata","auto"].includes(n)?n:super.preload}set preload(n){n!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(n)?this.setAttribute("preload",n):this.removeAttribute("preload"))}get debug(){return this.getAttribute(ae.DEBUG)!=null}set debug(n){n!==this.debug&&(n?this.setAttribute(ae.DEBUG,""):this.removeAttribute(ae.DEBUG))}get disableCookies(){return this.hasAttribute(ae.DISABLE_COOKIES)}set disableCookies(n){n!==this.disableCookies&&(n?this.setAttribute(ae.DISABLE_COOKIES,""):this.removeAttribute(ae.DISABLE_COOKIES))}get startTime(){let n=this.getAttribute(ae.START_TIME);if(n==null)return;let a=+n;return Number.isNaN(a)?void 0:a}set startTime(n){n!==this.startTime&&(n==null?this.removeAttribute(ae.START_TIME):this.setAttribute(ae.START_TIME,`${n}`))}get playbackId(){var n;return(n=this.getAttribute(ae.PLAYBACK_ID))!=null?n:void 0}set playbackId(n){n!==this.playbackId&&(n?this.setAttribute(ae.PLAYBACK_ID,n):this.removeAttribute(ae.PLAYBACK_ID))}get maxResolution(){var n;return(n=this.getAttribute(ae.MAX_RESOLUTION))!=null?n:void 0}set maxResolution(n){n!==this.maxResolution&&(n?this.setAttribute(ae.MAX_RESOLUTION,n):this.removeAttribute(ae.MAX_RESOLUTION))}get customDomain(){var n;return(n=this.getAttribute(ae.CUSTOM_DOMAIN))!=null?n:void 0}set customDomain(n){n!==this.customDomain&&(n?this.setAttribute(ae.CUSTOM_DOMAIN,n):this.removeAttribute(ae.CUSTOM_DOMAIN))}get envKey(){var n;return(n=this.getAttribute(ae.ENV_KEY))!=null?n:void 0}set envKey(n){n!==this.envKey&&(n?this.setAttribute(ae.ENV_KEY,n):this.removeAttribute(ae.ENV_KEY))}get beaconCollectionDomain(){var n;return(n=this.getAttribute(ae.BEACON_COLLECTION_DOMAIN))!=null?n:void 0}set beaconCollectionDomain(n){n!==this.beaconCollectionDomain&&(n?this.setAttribute(ae.BEACON_COLLECTION_DOMAIN,n):this.removeAttribute(ae.BEACON_COLLECTION_DOMAIN))}get streamType(){var n;return(n=this.getAttribute(ae.STREAM_TYPE))!=null?n:Ap(this.nativeEl)}set streamType(n){n!==this.streamType&&(n?this.setAttribute(ae.STREAM_TYPE,n):this.removeAttribute(ae.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(ae.TARGET_LIVE_WINDOW)?+this.getAttribute(ae.TARGET_LIVE_WINDOW):Sp(this.nativeEl)}set targetLiveWindow(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ae.TARGET_LIVE_WINDOW):this.setAttribute(ae.TARGET_LIVE_WINDOW,`${+n}`))}get liveEdgeStart(){var n,a;if(this.hasAttribute(ae.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:l}=this,m=(n=this.nativeEl.seekable.end(0))!=null?n:0,v=(a=this.nativeEl.seekable.start(0))!=null?a:0;return Math.max(v,m-l)}return kp(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(ae.LIVE_EDGE_OFFSET))return+this.getAttribute(ae.LIVE_EDGE_OFFSET)}set liveEdgeOffset(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ae.LIVE_EDGE_OFFSET):this.setAttribute(ae.LIVE_EDGE_OFFSET,`${+n}`))}get seekable(){return Wc(this.nativeEl)}async addCuePoints(n){return Vc(this.nativeEl,n)}get activeCuePoint(){return Kc(this.nativeEl)}get cuePoints(){return pp(this.nativeEl)}getStartDate(){return vp(this.nativeEl,this._hls)}get currentPdt(){return gp(this.nativeEl,this._hls)}get preferPlayback(){let n=this.getAttribute(ae.PREFER_PLAYBACK);if(n===Hi.MSE||n===Hi.NATIVE)return n}set preferPlayback(n){n!==this.preferPlayback&&(n===Hi.MSE||n===Hi.NATIVE?this.setAttribute(ae.PREFER_PLAYBACK,n):this.removeAttribute(ae.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(n=>n.startsWith("metadata-")&&![ae.METADATA_URL].includes(n)).reduce((n,a)=>{let l=this.getAttribute(a);return l!=null&&(n[a.replace(/^metadata-/,"").replace(/-/g,"_")]=l),n},{}),...fe(this,Ks)}}set metadata(n){gt(this,Ks,n!=null?n:{}),this.mux&&this.mux.emit("hb",fe(this,Ks))}load(){gt(this,Ir,wp(this,this.nativeEl,fe(this,Ir)))}unload(){qc(this.nativeEl,fe(this,Ir)),gt(this,Ir,void 0)}attributeChangedCallback(n,a,l){var m,v;switch(super.attributeChangedCallback(n,a,l),n){case ae.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=l!=null?l:void 0;break;case ae.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=l!=null?l:void 0;break;case"src":{let E=!!a,I=!!l;!E&&I?Mt(this,nd,jc).call(this):E&&!I?this.unload():E&&I&&(this.unload(),Mt(this,nd,jc).call(this));break}case"autoplay":if(l===a)break;(m=fe(this,Ir))==null||m.setAutoplay(this.autoplay);break;case"preload":if(l===a)break;(v=fe(this,Ir))==null||v.setPreload(l);break;case ae.PLAYBACK_ID:this.src=_p(l!=null?l:void 0,{maxResolution:this.maxResolution,domain:this.customDomain});break;case ae.DEBUG:{let E=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=E);break}case ae.METADATA_URL:l&&fetch(l).then(E=>E.json()).then(E=>this.metadata=E).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${l}!`));break;case ae.STREAM_TYPE:(l==null||l!==a)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case ae.TARGET_LIVE_WINDOW:(l==null||l!==a)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}disconnectedCallback(){this.unload()}};Ir=new WeakMap,Vs=new WeakMap,td=new WeakMap,Ks=new WeakMap,id=new WeakMap,rd=new WeakMap,ad=new WeakMap,nd=new WeakSet,jc=async function(){fe(this,Vs)||(await gt(this,Vs,Promise.resolve()),gt(this,Vs,null),this.load())};Jr.customElements.get("mux-video")||(Jr.customElements.define("mux-video",zc),Jr.MuxVideoElement=zc);var Bp=zc;var zE="en",Na={code:zE};var Hp="en";function Ye(n,a=!0){var v,E;let l=a&&(E=(v=Na)==null?void 0:v[n])!=null?E:n,m=a?Na.code:Hp;return new Jc(l,m)}var Jc=class{constructor(a,l=(m=>(m=Na.code)!=null?m:Hp)()){this.message=a,this.locale=l}format(a){return this.message.replace(/\{(\w+)\}/g,(l,m)=>{var v;return(v=a[m])!=null?v:""})}toString(){return this.message}};function Gp(n){let a="";return Object.entries(n).forEach(([l,m])=>{m!=null&&(a+=`${ld(l)}: ${m}; `)}),a?a.trim():void 0}function ld(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function dd(n){return n.replace(/[-_]([a-z])/g,(a,l)=>l.toUpperCase())}function Rr(n){if(n==null)return;let a=+n;return Number.isNaN(a)?void 0:a}function ud(n){let a=QE(n).toString();return a?"?"+a:""}function QE(n){let a={};for(let l in n)n[l]!=null&&(a[l]=n[l]);return new URLSearchParams(a)}function ea(n){let a=(n!=null?n:"").split(".")[1];if(!a)return{};let l=a.replace(/-/g,"+").replace(/_/g,"/"),m=decodeURIComponent(atob(l).split("").map(function(v){return"%"+("00"+v.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(m)}var eh=(n,a)=>!n||!a?!1:n.contains(a)?!0:eh(n,a.getRootNode().host);var th="mux.com",XE=()=>{try{return"1.11.0"}catch{}return"UNKNOWN"},ZE=XE(),hd=()=>ZE,ih=(n,{maxResolution:a,token:l,domain:m=th}={})=>{let I=!!l?{token:l}:{redundant_streams:!0,...a?{max_resolution:a}:{}};return`https://stream.${m}/${n}.m3u8${ud(I)}`},Vp=(n,{token:a,thumbnailTime:l,domain:m=th}={})=>{let v=a==null?l:void 0,{aud:E}=ea(a);if(!(a&&E!=="t"))return`https://image.${m}/${n}/thumbnail.webp${ud({token:a,time:v})}`},Kp=(n,{token:a,domain:l=th}={})=>{let{aud:m}=ea(a);if(!(a&&m!=="s"))return`https://image.${l}/${n}/storyboard.vtt${ud({token:a,format:"webp"})}`},Ws=n=>{if(!!n){if([vt.LIVE,vt.ON_DEMAND].includes(n))return n;if(n!=null&&n.includes("live"))return vt.LIVE}};var JE={crossorigin:"crossOrigin",playsinline:"playsInline"};function Wp(n){var a;return(a=JE[n])!=null?a:dd(n)}var Fa,Ua,oi,cd=class{constructor(a,l){Dt(this,Fa,void 0);Dt(this,Ua,void 0);Dt(this,oi,[]);Oi(this,Fa,a),Oi(this,Ua,l)}[Symbol.iterator](){return at(this,oi).values()}get length(){return at(this,oi).length}get value(){var a;return(a=at(this,oi).join(" "))!=null?a:""}set value(a){var l;a!==this.value&&(Oi(this,oi,[]),this.add(...(l=a==null?void 0:a.split(" "))!=null?l:[]))}toString(){return this.value}item(a){return at(this,oi)[a]}values(){return at(this,oi).values()}keys(){return at(this,oi).keys()}forEach(a){at(this,oi).forEach(a)}add(...a){var l,m;a.forEach(v=>{this.contains(v)||at(this,oi).push(v)}),!(this.value===""&&!((l=at(this,Fa))!=null&&l.hasAttribute(`${at(this,Ua)}`)))&&((m=at(this,Fa))==null||m.setAttribute(`${at(this,Ua)}`,`${this.value}`))}remove(...a){var l;a.forEach(m=>{at(this,oi).splice(at(this,oi).indexOf(m),1)}),(l=at(this,Fa))==null||l.setAttribute(`${at(this,Ua)}`,`${this.value}`)}contains(a){return at(this,oi).includes(a)}toggle(a,l){return typeof l!="undefined"?l?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,l){this.remove(a),this.add(l)}};Fa=new WeakMap,Ua=new WeakMap,oi=new WeakMap;var qp=`[mux-player ${hd()}]`;function ta(...n){console.warn(qp,...n)}function ji(...n){console.error(qp,...n)}function rh(n){var l;let a=(l=n.message)!=null?l:"";if(n.context&&(a+=` ${n.context}`),n.file){let m="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${Ye("Read more: ")}
|
|
916
|
+
${m}${n.file}`}ta(a)}var ii={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Ba={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},$p=Object.freeze({length:0,start(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let a=n>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),e0=Zc.filter(n=>n!=="error"),t0=Object.values(ii).filter(n=>![ii.PLAYSINLINE].includes(n)),i0=Object.values(Ba);function jp(n){n.querySelectorAll(":scope > track").forEach(a=>{var l;(l=n.media)==null||l.append(a.cloneNode())}),e0.forEach(a=>{var l;(l=n.media)==null||l.addEventListener(a,m=>{n.dispatchEvent(new Event(m.type))})})}var ah=class extends Ft.HTMLElement{static get observedAttributes(){return[...t0,...i0]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(m=>{var v;(v=this.media)==null||v.append(m.cloneNode())});let a=m=>{for(let v of m)v.type==="childList"&&(v.removedNodes.forEach(E=>{var M,B;let I=(M=this.media)==null?void 0:M.querySelector(`track[src="${E.src}"]`);I&&((B=this.media)==null||B.removeChild(I))}),v.addedNodes.forEach(E=>{var I;(I=this.media)==null||I.append(E.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,l,m){var v,E;switch(a){case Ba.MUTED:{this.media&&(this.media.muted=m!=null,this.media.defaultMuted=m!=null);return}case Ba.VOLUME:{let I=(v=Rr(m))!=null?v:1;this.media&&(this.media.volume=I);return}case Ba.PLAYBACKRATE:{let I=(E=Rr(m))!=null?E:1;this.media&&(this.media.playbackRate=I,this.media.defaultPlaybackRate=I);return}}}play(){var a,l;return(l=(a=this.media)==null?void 0:a.play())!=null?l:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}requestCast(a){var l;return(l=this.media)==null?void 0:l.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get paused(){var a,l;return(l=(a=this.media)==null?void 0:a.paused)!=null?l:!0}get duration(){var a,l;return(l=(a=this.media)==null?void 0:a.duration)!=null?l:NaN}get ended(){var a,l;return(l=(a=this.media)==null?void 0:a.ended)!=null?l:!1}get buffered(){var a,l;return(l=(a=this.media)==null?void 0:a.buffered)!=null?l:$p}get seekable(){var a,l;return(l=(a=this.media)==null?void 0:a.seekable)!=null?l:$p}get readyState(){var a,l;return(l=(a=this.media)==null?void 0:a.readyState)!=null?l:0}get videoWidth(){var a,l;return(l=(a=this.media)==null?void 0:a.videoWidth)!=null?l:0}get videoHeight(){var a,l;return(l=(a=this.media)==null?void 0:a.videoHeight)!=null?l:0}get currentTime(){var a,l;return(l=(a=this.media)==null?void 0:a.currentTime)!=null?l:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,l;return(l=(a=this.media)==null?void 0:a.volume)!=null?l:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,l;return(l=(a=this.media)==null?void 0:a.playbackRate)!=null?l:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=Rr(this.getAttribute(Ba.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(Ba.PLAYBACKRATE,`${a}`):this.removeAttribute(Ba.PLAYBACKRATE)}get crossOrigin(){return qs(this,ii.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(ii.CROSSORIGIN,`${a}`)}get autoplay(){return qs(this,ii.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(ii.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(ii.AUTOPLAY)}get loop(){return qs(this,ii.LOOP)!=null}set loop(a){a?this.setAttribute(ii.LOOP,""):this.removeAttribute(ii.LOOP)}get muted(){var a,l;return(l=(a=this.media)==null?void 0:a.muted)!=null?l:!1}set muted(a){this.media&&(this.media.muted=Boolean(a))}get defaultMuted(){return qs(this,ii.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(ii.MUTED,""):this.removeAttribute(ii.MUTED)}get playsInline(){return qs(this,ii.PLAYSINLINE)!=null}set playsInline(a){ji("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(a){["","none","metadata","auto"].includes(a)?this.setAttribute(ii.PRELOAD,a):this.removeAttribute(ii.PRELOAD)}};function qs(n,a){return n.media?n.media.getAttribute(a):n.getAttribute(a)}var nh=ah;var r0=Object.defineProperty,a0=(n,a,l)=>a in n?r0(n,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[a]=l,n0=(n,a,l)=>(a0(n,typeof a!="symbol"?a+"":a,l),l),Jp=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},qe=(n,a,l)=>(Jp(n,a,"read from private field"),l?l.call(n):a.get(n)),dr=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Dr=(n,a,l,m)=>(Jp(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),Mn,fd,Ha,Ys,ia,ra,aa,Ga,xn,md,zi,zp=1,Qp=0,s0=1,o0={processCallback(n,a,l){if(!!l){for(let[m,v]of a)if(m in l){let E=l[m];typeof E=="boolean"&&v instanceof li&&typeof v.element[v.attributeName]=="boolean"?v.booleanValue=E:typeof E=="function"&&v instanceof li?v.element[v.attributeName]=E:v.value=E}}}},Cr=class extends W.DocumentFragment{constructor(a,l,m=o0){var v;super(),dr(this,Mn,void 0),dr(this,fd,void 0),this.append(a.content.cloneNode(!0)),Dr(this,Mn,ev(this)),Dr(this,fd,m),(v=m.createCallback)==null||v.call(m,this,qe(this,Mn),l),m.processCallback(this,qe(this,Mn),l)}update(a){qe(this,fd).processCallback(this,qe(this,Mn),a)}};Mn=new WeakMap;fd=new WeakMap;var ev=(n,a=[])=>{let l,m;for(let v of n.attributes||[])if(v.value.includes("{{")){let E=new sh;for([l,m]of Zp(v.value))if(!l)E.append(m);else{let I=new li(n,v.name,v.namespaceURI);E.append(I),a.push([m,I])}v.value=E.toString()}for(let v of n.childNodes)if(v.nodeType===zp&&!(v instanceof HTMLTemplateElement))ev(v,a);else if(v.nodeType===zp||v.data.includes("{{")){let E=[];if(v.data)for([l,m]of Zp(v.data))if(!l)E.push(new Text(m));else{let I=new Mr(n);E.push(I),a.push([m,I])}else if(v instanceof HTMLTemplateElement){let I=new $s(n,v);E.push(I),a.push([I.expression,I])}v.replaceWith(...E.flatMap(I=>I.replacementNodes||[I]))}return a},Xp={},Zp=n=>{let a="",l=0,m=Xp[n],v=0,E;if(m)return m;for(m=[];E=n[v];v++)E==="{"&&n[v+1]==="{"&&n[v-1]!=="\\"&&n[v+2]&&++l==1?(a&&m.push([Qp,a]),a="",v++):E==="}"&&n[v+1]==="}"&&n[v-1]!=="\\"&&!--l?(m.push([s0,a.trim()]),a="",v++):a+=E||"";return a&&m.push([Qp,(l>0?"{{":"")+a]),Xp[n]=m},l0=11,pd=class{get value(){return""}set value(a){}toString(){return this.value}},tv=new WeakMap,sh=class{constructor(){dr(this,Ha,[])}[Symbol.iterator](){return qe(this,Ha).values()}get length(){return qe(this,Ha).length}item(a){return qe(this,Ha)[a]}append(...a){for(let l of a)l instanceof li&&tv.set(l,this),qe(this,Ha).push(l)}toString(){return qe(this,Ha).join("")}};Ha=new WeakMap;var li=class extends pd{constructor(a,l,m){super(),dr(this,Ga),dr(this,Ys,""),dr(this,ia,void 0),dr(this,ra,void 0),dr(this,aa,void 0),Dr(this,ia,a),Dr(this,ra,l),Dr(this,aa,m)}get attributeName(){return qe(this,ra)}get attributeNamespace(){return qe(this,aa)}get element(){return qe(this,ia)}get value(){return qe(this,Ys)}set value(a){qe(this,Ys)!==a&&(Dr(this,Ys,a),!qe(this,Ga,xn)||qe(this,Ga,xn).length===1?a==null?qe(this,ia).removeAttributeNS(qe(this,aa),qe(this,ra)):qe(this,ia).setAttributeNS(qe(this,aa),qe(this,ra),a):qe(this,ia).setAttributeNS(qe(this,aa),qe(this,ra),qe(this,Ga,xn)))}get booleanValue(){return qe(this,ia).hasAttributeNS(qe(this,aa),qe(this,ra))}set booleanValue(a){if(!qe(this,Ga,xn)||qe(this,Ga,xn).length===1)this.value=a?"":null;else throw new DOMException("Value is not fully templatized")}};Ys=new WeakMap;ia=new WeakMap;ra=new WeakMap;aa=new WeakMap;Ga=new WeakSet;xn=function(){return tv.get(this)};var Mr=class extends pd{constructor(a,l){super(),dr(this,md,void 0),dr(this,zi,void 0),Dr(this,md,a),Dr(this,zi,l?[...l]:[new Text])}get replacementNodes(){return qe(this,zi)}get parentNode(){return qe(this,md)}get nextSibling(){return qe(this,zi)[qe(this,zi).length-1].nextSibling}get previousSibling(){return qe(this,zi)[0].previousSibling}get value(){return qe(this,zi).map(a=>a.textContent).join("")}set value(a){this.replace(a)}replace(...a){let l=a.flat().flatMap(m=>m==null?[new Text]:m.forEach?[...m]:m.nodeType===l0?[...m.childNodes]:m.nodeType?[m]:[new Text(m)]);l.length||l.push(new Text),Dr(this,zi,d0(qe(this,zi)[0].parentNode,qe(this,zi),l,this.nextSibling))}};md=new WeakMap;zi=new WeakMap;var $s=class extends Mr{constructor(a,l){let m=l.getAttribute("directive")||l.getAttribute("type"),v=l.getAttribute("expression")||l.getAttribute(m)||"";v.startsWith("{{")&&(v=v.trim().slice(2,-2).trim()),super(a),n0(this,"directive"),this.expression=v,this.template=l,this.directive=m}};function d0(n,a,l,m=null){let v=0,E,I,M,B=l.length,F=a.length;for(;v<B&&v<F&&a[v]==l[v];)v++;for(;v<B&&v<F&&l[B-1]==a[F-1];)m=l[--F,--B];if(v==F)for(;v<B;)n.insertBefore(l[v++],m);if(v==B)for(;v<F;)n.removeChild(a[v++]);else{for(E=a[v];v<B;)M=l[v++],I=E?E.nextSibling:m,E==M?E=I:v<B&&l[v]==I?(n.replaceChild(M,E),E=I):n.insertBefore(M,E);for(;E!=m;)I=E.nextSibling,n.removeChild(E),E=I}return l}var iv={string:n=>String(n)},gd=class{constructor(a){this.template=a,this.state=void 0}},Va=new WeakMap,Ka=new WeakMap,oh={partial:(n,a)=>{a[n.expression]=new gd(n.template)},if:(n,a)=>{var l;if(av(n.expression,a))if(Va.get(n)!==n.template){Va.set(n,n.template);let m=new Cr(n.template,a,yd);n.replace(m),Ka.set(n,m)}else(l=Ka.get(n))==null||l.update(a);else n.replace(""),Va.delete(n),Ka.delete(n)}},u0=Object.keys(oh),yd={processCallback(n,a,l){var m,v;if(!!l)for(let[E,I]of a){if(I instanceof $s){if(!I.directive){let B=u0.find(F=>I.template.hasAttribute(F));B&&(I.directive=B,I.expression=I.template.getAttribute(B))}(m=oh[I.directive])==null||m.call(oh,I,l);continue}let M=av(E,l);if(M instanceof gd){Va.get(I)!==M.template?(Va.set(I,M.template),M=new Cr(M.template,M.state,yd),I.value=M,Ka.set(I,M)):(v=Ka.get(I))==null||v.update(M.state);continue}M?(I instanceof li&&I.attributeName.startsWith("aria-")&&(M=String(M)),I instanceof li?typeof M=="boolean"?I.booleanValue=M:typeof M=="function"?I.element[I.attributeName]=M:I.value=M:(I.value=M,Va.delete(I),Ka.delete(I))):I instanceof li?I.value=void 0:(I.value=void 0,Va.delete(I),Ka.delete(I))}}},rv={"!":n=>!n,"!!":n=>!!n,"==":(n,a)=>n==a,"!=":(n,a)=>n!=a,">":(n,a)=>n>a,">=":(n,a)=>n>=a,"<":(n,a)=>n<a,"<=":(n,a)=>n<=a,"??":(n,a)=>n!=null?n:a,"|":(n,a)=>{var l;return(l=iv[a])==null?void 0:l.call(iv,n)}};function c0(n){return h0(n,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:a})=>a!=="ws")}function av(n,a={}){var l,m,v,E,I,M,B;let F=c0(n);if(F.length===0||F.some(({type:Q})=>!Q))return js(n);if(((l=F[0])==null?void 0:l.token)===">"){let Q=a[(m=F[1])==null?void 0:m.token];if(!Q)return js(n);let re={...a};Q.state=re;let te=F.slice(2);for(let se=0;se<te.length;se+=3){let pe=(v=te[se])==null?void 0:v.token,Ae=(E=te[se+1])==null?void 0:E.token,ke=(I=te[se+2])==null?void 0:I.token;pe&&Ae==="="&&(re[pe]=zs(ke,a))}return Q}if(F.length===1)return vd(F[0])?zs(F[0].token,a):js(n);if(F.length===2){let Q=(M=F[0])==null?void 0:M.token,re=rv[Q];if(!re||!vd(F[1]))return js(n);let te=zs(F[1].token,a);return re(te)}if(F.length===3){let Q=(B=F[1])==null?void 0:B.token,re=rv[Q];if(!re||!vd(F[0])||!vd(F[2]))return js(n);let te=zs(F[0].token,a);if(Q==="|")return re(te,F[2].token);let se=zs(F[2].token,a);return re(te,se)}}function js(n){return console.warn(`Warning: invalid expression \`${n}\``),!1}function vd({type:n}){return["number","boolean","string","param"].includes(n)}function zs(n,a){let l=n[0],m=n.slice(-1);return n==="true"||n==="false"?n==="true":l===m&&["'",'"'].includes(l)?n.slice(1,-1):zo(n)?parseFloat(n):a[n]}function h0(n,a){let l,m,v,E=[];for(;n;){v=null,l=n.length;for(let I in a)m=a[I].exec(n),m&&m.index<l&&(v={token:m[0],type:I,matches:m.slice(1)},l=m.index);l&&E.push({token:n.substr(0,l),type:void 0}),v&&E.push(v),n=n.substr(l+(v?v.token.length:0))}return E}var f0=Object.defineProperty,m0=(n,a,l)=>a in n?f0(n,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[a]=l,Xs=(n,a,l)=>(m0(n,typeof a!="symbol"?a+"":a,l),l),fh=(n,a,l)=>{if(!a.has(n))throw TypeError("Cannot "+l)},uh=(n,a,l)=>(fh(n,a,"read from private field"),l?l.call(n):a.get(n)),Qs=(n,a,l)=>{if(a.has(n))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(n):a.set(n,l)},Wa=(n,a,l,m)=>(fh(n,a,"write to private field"),m?m.call(n,l):a.set(n,l),l),lh=(n,a,l)=>(fh(n,a,"access private method"),l),Pn,Ed,On,ch,nv,bd,hh,dh={"media-target-live-window":"targetLiveWindow","media-stream-type":"streamType"},sv=ie.createElement("template");sv.innerHTML=`
|
|
928
917
|
<style>
|
|
929
918
|
:host {
|
|
930
919
|
display: inline-block;
|
|
@@ -936,7 +925,7 @@ ${m}${n.file}`}ea(a)}var ti={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:
|
|
|
936
925
|
height: 100%;
|
|
937
926
|
}
|
|
938
927
|
</style>
|
|
939
|
-
`;var
|
|
928
|
+
`;var Nn=class extends W.HTMLElement{constructor(){super(),Qs(this,ch),Qs(this,bd),Xs(this,"renderRoot"),Xs(this,"renderer"),Qs(this,Pn,void 0),Qs(this,Ed,void 0),Qs(this,On,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());let a=new MutationObserver(l=>{l.some(m=>{let v=m.target;return v===this?!0:v.localName!=="media-controller"?!1:!!(dh[m.attributeName]||m.attributeName.startsWith("breakpoint-"))})&&this.render()});a.observe(this,{attributes:!0}),a.observe(this.renderRoot,{attributes:!0,subtree:!0}),lh(this,ch,nv).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var a;return(a=uh(this,Pn))!=null?a:this.constructor.template}set template(a){Wa(this,On,null),Wa(this,Pn,a),this.createRenderer()}get props(){var a,l,m;let v=[...Array.from((l=(a=this.mediaController)==null?void 0:a.attributes)!=null?l:[]).filter(({name:I})=>dh[I]||I.startsWith("breakpoint-")),...Array.from(this.attributes)],E={};for(let I of v){let M=(m=dh[I.name])!=null?m:Tf(I.name),{value:B}=I;B!=null?(zo(B)&&(B=parseFloat(B)),E[M]=B===""?!0:B):E[M]=!1}return E}attributeChangedCallback(a,l,m){a==="template"&&l!=m&&lh(this,bd,hh).call(this)}connectedCallback(){lh(this,bd,hh).call(this)}createRenderer(){this.template&&this.template!==uh(this,Ed)&&(Wa(this,Ed,this.template),this.renderer=new Cr(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(sv.content.cloneNode(!0),this.renderer))}render(){var a;(a=this.renderer)==null||a.update(this.props)}};Pn=new WeakMap;Ed=new WeakMap;On=new WeakMap;ch=new WeakSet;nv=function(n){if(Object.prototype.hasOwnProperty.call(this,n)){let a=this[n];delete this[n],this[n]=a}};bd=new WeakSet;hh=function(){var n;let a=this.getAttribute("template");if(!a||a===uh(this,On))return;let l=this.getRootNode(),m=(n=l==null?void 0:l.getElementById)==null?void 0:n.call(l,a);if(m){Wa(this,On,a),Wa(this,Pn,m),this.createRenderer();return}p0(a)&&(Wa(this,On,a),v0(a).then(v=>{let E=ie.createElement("template");E.innerHTML=v,Wa(this,Pn,E),this.createRenderer()}).catch(console.error))};Xs(Nn,"template");Xs(Nn,"observedAttributes",["template"]);Xs(Nn,"processor",yd);function p0(n){if(!/^(\/|\.\/|https?:\/\/)/.test(n))return!1;let a=/^https?:\/\//.test(n)?void 0:location.origin;try{new URL(n,a)}catch{return!1}return!0}async function v0(n){let a=await fetch(n);if(a.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${a.status}`);return a.text()}W.customElements.get("media-theme")||W.customElements.define("media-theme",Nn);var ov=`:host {
|
|
940
929
|
--media-control-display: var(--controls);
|
|
941
930
|
--media-loading-indicator-display: var(--loading-indicator);
|
|
942
931
|
--media-dialog-display: var(--dialog);
|
|
@@ -1052,7 +1041,7 @@ media-theme {
|
|
|
1052
1041
|
--media-duration-display-display: var(--duration-display, var(--bottom-duration-display));
|
|
1053
1042
|
--media-title-display-display: var(--title-display, var(--bottom-title-display));
|
|
1054
1043
|
}
|
|
1055
|
-
`;var
|
|
1044
|
+
`;var lv=`<!-- prettier-ignore -->
|
|
1056
1045
|
<template id="media-theme-mux">
|
|
1057
1046
|
<style>
|
|
1058
1047
|
:host {
|
|
@@ -1541,6 +1530,7 @@ media-theme {
|
|
|
1541
1530
|
gestures-disabled="{{disabled}}"
|
|
1542
1531
|
hotkeys="{{hotkeys}}"
|
|
1543
1532
|
nohotkeys="{{nohotkeys}}"
|
|
1533
|
+
novolumepref="{{novolumepref}}"
|
|
1544
1534
|
audio="{{audio}}"
|
|
1545
1535
|
noautoseektolive="{{noautoseektolive}}"
|
|
1546
1536
|
exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer"
|
|
@@ -1815,7 +1805,7 @@ media-theme {
|
|
|
1815
1805
|
|
|
1816
1806
|
</media-controller>
|
|
1817
1807
|
</template>
|
|
1818
|
-
`;var
|
|
1808
|
+
`;var uv=`
|
|
1819
1809
|
:host {
|
|
1820
1810
|
z-index: 100;
|
|
1821
1811
|
display: var(--media-dialog-display, flex);
|
|
@@ -1867,17 +1857,17 @@ media-theme {
|
|
|
1867
1857
|
text-align: center;
|
|
1868
1858
|
line-height: 1.4;
|
|
1869
1859
|
}
|
|
1870
|
-
`,
|
|
1860
|
+
`,cv=Si.createElement("template");cv.innerHTML=`
|
|
1871
1861
|
<style>
|
|
1872
|
-
${
|
|
1862
|
+
${uv}
|
|
1873
1863
|
</style>
|
|
1874
1864
|
|
|
1875
1865
|
<div class="dialog">
|
|
1876
1866
|
<slot></slot>
|
|
1877
1867
|
</div>
|
|
1878
|
-
`;var
|
|
1868
|
+
`;var na=class extends Ft.HTMLElement{constructor(){var l;super();this.attachShadow({mode:"open"}),(l=this.shadowRoot)==null||l.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),dv(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),E0(this))}attributeChangedCallback(l,m,v){l==="open"&&m!==v&&(v!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&dv(this)}};na.styles=uv,na.template=cv,na.observedAttributes=["open"];function dv(n){let a=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(n.dispatchEvent(a),a.defaultPrevented)return;let l=n.querySelector("[autofocus]:not([disabled])");!l&&n.tabIndex>=0&&(l=n),l||(l=hv(n.shadowRoot)),n._previouslyFocusedElement=Si.activeElement,Si.activeElement instanceof HTMLElement&&Si.activeElement.blur(),n.addEventListener("transitionend",()=>{l instanceof HTMLElement&&l.focus({preventScroll:!0})},{once:!0})}function hv(n){let l=["button","input","keygen","select","textarea"].map(function(v){return v+":not([disabled])"});l.push('[tabindex]:not([disabled]):not([tabindex=""])');let m=n==null?void 0:n.querySelector(l.join(", "));if(!m&&"attachShadow"in Element.prototype){let v=(n==null?void 0:n.querySelectorAll("*"))||[];for(let E=0;E<v.length&&!(v[E].tagName&&v[E].shadowRoot&&(m=hv(v[E].shadowRoot),m));E++);}return m}function E0(n){n._previouslyFocusedElement instanceof HTMLElement&&n._previouslyFocusedElement.focus()}Ft.customElements.get("media-dialog")||(Ft.customElements.define("media-dialog",na),Ft.MediaDialog=na);var mh=na;var fv=Si.createElement("template");fv.innerHTML=`
|
|
1879
1869
|
<style>
|
|
1880
|
-
${
|
|
1870
|
+
${mh.styles}
|
|
1881
1871
|
|
|
1882
1872
|
.close {
|
|
1883
1873
|
background: none;
|
|
@@ -1906,83 +1896,84 @@ media-theme {
|
|
|
1906
1896
|
</svg>
|
|
1907
1897
|
</button>
|
|
1908
1898
|
</slot>
|
|
1909
|
-
`;var
|
|
1899
|
+
`;var Zs=class extends mh{constructor(){var a,l;super(),(l=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||l.addEventListener("click",()=>{this.close()})}};Zs.template=fv;Ft.customElements.get("mxp-dialog")||(Ft.customElements.define("mxp-dialog",Zs),Ft.MxpDialog=Zs);var Js=new WeakMap,eo=class{constructor(a,l){this.element=a;this.type=l;this.element.addEventListener(this.type,this);let m=Js.get(this.element);m&&m.set(this.type,this)}set(a){if(typeof a=="function")this.handleEvent=a.bind(this.element);else if(typeof a=="object"&&typeof a.handleEvent=="function")this.handleEvent=a.handleEvent.bind(a);else{this.element.removeEventListener(this.type,this);let l=Js.get(this.element);l&&l.delete(this.type)}}static for(a){Js.has(a.element)||Js.set(a.element,new Map);let l=a.attributeName.slice(2),m=Js.get(a.element);return m&&m.has(l)?m.get(l):new eo(a.element,l)}};function b0(n,a){return n instanceof li&&n.attributeName.startsWith("on")?(eo.for(n).set(a),n.element.removeAttributeNS(n.attributeNamespace,n.attributeName),!0):!1}function _0(n,a){return a instanceof _d&&n instanceof Mr?(a.renderInto(n),!0):!1}function T0(n,a){return a instanceof DocumentFragment&&n instanceof Mr?(a.childNodes.length&&n.replace(...a.childNodes),!0):!1}function A0(n,a){if(n instanceof li){let l=n.attributeNamespace,m=n.element.getAttributeNS(l,n.attributeName);return String(a)!==m&&(n.value=String(a)),!0}return n.value=String(a),!0}function S0(n,a){if(n instanceof li&&a instanceof Element){let l=n.element;return l[n.attributeName]!==a&&(n.element.removeAttributeNS(n.attributeNamespace,n.attributeName),l[n.attributeName]=a),!0}return!1}function k0(n,a){if(typeof a=="boolean"&&n instanceof li){let l=n.attributeNamespace,m=n.element.hasAttributeNS(l,n.attributeName);return a!==m&&(n.booleanValue=a),!0}return!1}function w0(n,a){return a===!1&&n instanceof Mr?(n.replace(""),!0):!1}function L0(n,a){S0(n,a)||k0(n,a)||b0(n,a)||w0(n,a)||_0(n,a)||T0(n,a)||A0(n,a)}var ph=new Map,mv=new WeakMap,pv=new WeakMap,_d=class{constructor(a,l,m){this.strings=a;this.values=l;this.processor=m;this.stringsKey=this.strings.join("")}get template(){if(ph.has(this.stringsKey))return ph.get(this.stringsKey);{let a=Si.createElement("template"),l=this.strings.length-1;return a.innerHTML=this.strings.reduce((m,v,E)=>m+v+(E<l?`{{ ${E} }}`:""),""),ph.set(this.stringsKey,a),a}}renderInto(a){var v;let l=this.template;if(mv.get(a)!==l){mv.set(a,l);let E=new Cr(l,this.values,this.processor);pv.set(a,E),a instanceof Mr?a.replace(...E.children):a.appendChild(E);return}let m=pv.get(a);(v=m==null?void 0:m.update)==null||v.call(m,this.values)}},I0={processCallback(n,a,l){var m;if(!!l){for(let[v,E]of a)if(v in l){let I=(m=l[v])!=null?m:"";L0(E,I)}}}};function xr(n,...a){return new _d(n,a,I0)}function vv(n,a){n.renderInto(a)}var vh=Si.createElement("template");"innerHTML"in vh&&(vh.innerHTML=lv);var gv=n=>xr`
|
|
1910
1900
|
<style>
|
|
1911
|
-
${
|
|
1901
|
+
${ov}
|
|
1912
1902
|
</style>
|
|
1913
|
-
${
|
|
1914
|
-
`,
|
|
1903
|
+
${D0(n)}
|
|
1904
|
+
`,R0=n=>{let a=n.hotKeys?`${n.hotKeys}`:"";return Ws(n.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},D0=n=>{var a,l,m,v,E,I,M,B,F,Q,re,te,se,pe,Ae,ke,we,nt,Ue,st,dt,oe,w,le,$,Ie,$e,tt,Bt,Je,H,ri,Ht,it,Qt;return xr`
|
|
1915
1905
|
<media-theme
|
|
1916
|
-
template="${(a=n.themeTemplate)!=null?a:
|
|
1917
|
-
default-stream-type="${(
|
|
1918
|
-
hotkeys="${
|
|
1906
|
+
template="${(a=n.themeTemplate)!=null?a:vh.content.children[0]}"
|
|
1907
|
+
default-stream-type="${(l=n.defaultStreamType)!=null?l:!1}"
|
|
1908
|
+
hotkeys="${R0(n)||!1}"
|
|
1919
1909
|
nohotkeys="${n.noHotKeys||!n.hasSrc||n.isDialogOpen||!1}"
|
|
1920
|
-
noautoseektolive="${!!((m=n.streamType)!=null&&m.includes(
|
|
1910
|
+
noautoseektolive="${!!((m=n.streamType)!=null&&m.includes(vt.LIVE))&&n.targetLiveWindow!==0}"
|
|
1911
|
+
novolumepref="${n.novolumepref||!1}"
|
|
1921
1912
|
disabled="${!n.hasSrc||n.isDialogOpen}"
|
|
1922
1913
|
audio="${(v=n.audio)!=null?v:!1}"
|
|
1923
|
-
style="${(
|
|
1914
|
+
style="${(E=Gp({"--media-primary-color":n.primaryColor,"--media-secondary-color":n.secondaryColor}))!=null?E:!1}"
|
|
1924
1915
|
default-showing-captions="${!n.defaultHiddenCaptions}"
|
|
1925
|
-
forward-seek-offset="${(
|
|
1916
|
+
forward-seek-offset="${(I=n.forwardSeekOffset)!=null?I:!1}"
|
|
1926
1917
|
backward-seek-offset="${(M=n.backwardSeekOffset)!=null?M:!1}"
|
|
1927
1918
|
playback-rates="${(B=n.playbackRates)!=null?B:!1}"
|
|
1928
|
-
default-show-remaining-time="${(
|
|
1929
|
-
hide-duration="${(
|
|
1930
|
-
title="${(
|
|
1919
|
+
default-show-remaining-time="${(F=n.defaultShowRemainingTime)!=null?F:!1}"
|
|
1920
|
+
hide-duration="${(Q=n.hideDuration)!=null?Q:!1}"
|
|
1921
|
+
title="${(re=n.title)!=null?re:!1}"
|
|
1931
1922
|
exportparts="top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, poster, live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display"
|
|
1932
1923
|
>
|
|
1933
1924
|
<mux-video
|
|
1934
1925
|
slot="media"
|
|
1935
|
-
target-live-window="${(
|
|
1936
|
-
stream-type="${(se=
|
|
1937
|
-
crossorigin="${(
|
|
1926
|
+
target-live-window="${(te=n.targetLiveWindow)!=null?te:!1}"
|
|
1927
|
+
stream-type="${(se=Ws(n.streamType))!=null?se:!1}"
|
|
1928
|
+
crossorigin="${(pe=n.crossOrigin)!=null?pe:""}"
|
|
1938
1929
|
playsinline
|
|
1939
|
-
autoplay="${(
|
|
1940
|
-
muted="${(
|
|
1941
|
-
loop="${(
|
|
1942
|
-
preload="${(
|
|
1930
|
+
autoplay="${(Ae=n.autoplay)!=null?Ae:!1}"
|
|
1931
|
+
muted="${(ke=n.muted)!=null?ke:!1}"
|
|
1932
|
+
loop="${(we=n.loop)!=null?we:!1}"
|
|
1933
|
+
preload="${(nt=n.preload)!=null?nt:!1}"
|
|
1943
1934
|
debug="${(Ue=n.debug)!=null?Ue:!1}"
|
|
1944
|
-
prefer-cmcd="${(
|
|
1945
|
-
disable-cookies="${(
|
|
1935
|
+
prefer-cmcd="${(st=n.preferCmcd)!=null?st:!1}"
|
|
1936
|
+
disable-cookies="${(dt=n.disableCookies)!=null?dt:!1}"
|
|
1946
1937
|
prefer-playback="${(oe=n.preferPlayback)!=null?oe:!1}"
|
|
1947
1938
|
start-time="${n.startTime!=null?n.startTime:!1}"
|
|
1948
|
-
beacon-collection-domain="${(
|
|
1949
|
-
player-software-name="${(
|
|
1950
|
-
player-software-version="${(
|
|
1951
|
-
env-key="${(
|
|
1952
|
-
custom-domain="${(
|
|
1953
|
-
src="${n.src?n.src:n.playbackId?
|
|
1954
|
-
cast-src="${n.src?n.src:n.playbackId?
|
|
1939
|
+
beacon-collection-domain="${(w=n.beaconCollectionDomain)!=null?w:!1}"
|
|
1940
|
+
player-software-name="${(le=n.playerSoftwareName)!=null?le:!1}"
|
|
1941
|
+
player-software-version="${($=n.playerSoftwareVersion)!=null?$:!1}"
|
|
1942
|
+
env-key="${(Ie=n.envKey)!=null?Ie:!1}"
|
|
1943
|
+
custom-domain="${($e=n.customDomain)!=null?$e:!1}"
|
|
1944
|
+
src="${n.src?n.src:n.playbackId?ih(n.playbackId,{maxResolution:n.maxResolution,domain:n.customDomain,token:n.tokens.playback}):!1}"
|
|
1945
|
+
cast-src="${n.src?n.src:n.playbackId?ih(n.playbackId,{maxResolution:n.maxResolution,domain:n.customDomain,token:n.tokens.playback}):!1}"
|
|
1955
1946
|
exportparts="video"
|
|
1956
1947
|
>
|
|
1957
|
-
${n.storyboard?
|
|
1948
|
+
${n.storyboard?xr`<track label="thumbnails" default kind="metadata" src="${n.storyboard}" />`:xr``}
|
|
1958
1949
|
</mux-video>
|
|
1959
1950
|
<media-poster-image
|
|
1960
1951
|
slot="poster"
|
|
1961
1952
|
part="poster"
|
|
1962
|
-
src="${n.poster===""?!1:(
|
|
1963
|
-
placeholder-src="${(
|
|
1953
|
+
src="${n.poster===""?!1:(tt=n.poster)!=null?tt:!1}"
|
|
1954
|
+
placeholder-src="${(Bt=n.placeholder)!=null?Bt:!1}"
|
|
1964
1955
|
></media-poster-image>
|
|
1965
1956
|
<mxp-dialog
|
|
1966
1957
|
no-auto-hide
|
|
1967
|
-
open="${(
|
|
1958
|
+
open="${(Je=n.isDialogOpen)!=null?Je:!1}"
|
|
1968
1959
|
onclose="${n.onCloseErrorDialog}"
|
|
1969
1960
|
oninitfocus="${n.onInitFocusDialog}"
|
|
1970
1961
|
>
|
|
1971
|
-
${(
|
|
1962
|
+
${(H=n.dialog)!=null&&H.title?xr`<h3>${n.dialog.title}</h3>`:xr``}
|
|
1972
1963
|
<p>
|
|
1973
|
-
${(
|
|
1974
|
-
${(
|
|
1964
|
+
${(ri=n.dialog)==null?void 0:ri.message}
|
|
1965
|
+
${(Ht=n.dialog)!=null&&Ht.linkUrl?xr`<a
|
|
1975
1966
|
href="${n.dialog.linkUrl}"
|
|
1976
1967
|
target="_blank"
|
|
1977
1968
|
rel="external noopener"
|
|
1978
|
-
aria-label="${(
|
|
1979
|
-
>${(
|
|
1980
|
-
>`:
|
|
1969
|
+
aria-label="${(it=n.dialog.linkText)!=null?it:""} ${Ye("(opens in a new window)")}"
|
|
1970
|
+
>${(Qt=n.dialog.linkText)!=null?Qt:n.dialog.linkUrl}</a
|
|
1971
|
+
>`:xr``}
|
|
1981
1972
|
</p>
|
|
1982
1973
|
</mxp-dialog>
|
|
1983
1974
|
</media-theme>
|
|
1984
|
-
`};function md(n,a,o,m,v){var M,B,U;let g={},L={};switch(n.code){case vt.MEDIA_ERR_NETWORK:{switch(g.title=qe("Network Error",v),g.message=n.message,(M=n.data)==null?void 0:M.response.code){case 412:{g.title=qe("Video is not currently available",v),g.message=qe("The live stream or video file are not yet ready.",v),L.message=qe("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",v),L.file="412-not-playable.md";break}case 404:{g.title=qe("Video does not exist",v),g.message="",L.message=qe("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",v),L.file="404-not-found.md";break}case 403:{if(g.title=qe("Invalid playback URL",v),g.message=qe("The video URL or playback-token are formatted with incorrect or incomplete information.",v),L.message=qe("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",v),L.file="missing-signed-tokens.md",!m)break;let{exp:z,aud:ie,sub:ee}=Jr(m),se=Date.now()>z*1e3,fe=ee!==o,_e=ie!=="v",Ae={timeStyle:"medium",dateStyle:"medium"};if(se){g.title=qe("Video URL has expired",v),g.message=qe("The video\u2019s secured playback-token has expired.",v),L.message=qe("The video\u2019s secured playback-token has expired.",v),L.context=qe("Expired at: {expiredDate}. Current time: {currentDate}.",v).format({expiredDate:new Intl.DateTimeFormat(wa.code,Ae).format(z*1e3),currentDate:new Intl.DateTimeFormat(wa.code,Ae).format(Date.now())}),L.file="403-expired-token.md";break}if(fe){g.title=qe("Video URL is formatted incorrectly",v),g.message=qe("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),L.message=qe("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),L.context=qe("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",v).format({playbackId:o,tokenPlaybackId:ee}),L.file="403-playback-id-mismatch.md";break}if(_e){g.title=qe("Video URL is formatted incorrectly",v),g.message=qe("The playback-token is formatted with incorrect information.",v),L.message=qe("The playback-token is formatted with incorrect information.",v),L.context=qe("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",v).format({tokenType:ie}),L.file="403-incorrect-aud-value.md";break}L.message=qe("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",v),L.file="403-malformatted-token.md";break}}break}case vt.MEDIA_ERR_DECODE:{let{message:z}=n;g={title:qe("Media Error",v),message:z},L.file="media-decode-error.md";break}case vt.MEDIA_ERR_SRC_NOT_SUPPORTED:{let z=(U=(B=n.data)==null?void 0:B.response)==null?void 0:U.code;if(z>=400&&z<500){n.code=vt.MEDIA_ERR_NETWORK,n.data={response:{code:z}},{dialog:g,devlog:L}=md(n,a,o,m);break}g={title:qe("Source Not Supported",v),message:n.message},L.file="media-src-not-supported.md";break}default:g={title:qe("Error",v),message:n.message};break}return a&&(g={title:qe("Your device appears to be offline",v),message:qe("Check your internet connection and try reloading this video.",v)}),{dialog:g,devlog:L}}var xr={SRC:"src",POSTER:"poster"},pe={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",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window"},lh=["audio","backward-seek-offset","default-show-remaining-time","default-showing-captions","noautoseektolive","disabled","exportparts","forward-seek-offset","hide-duration","hotkeys","nohotkeys","playbackrates","default-stream-type","stream-type","style","target-live-window","template","title"];function x0(n,a){var m;return{src:!n.playbackId&&n.src,playbackId:n.playbackId,hasSrc:!!n.playbackId||!!n.src,poster:n.poster,storyboard:n.storyboard,storyboardSrc:n.getAttribute(pe.STORYBOARD_SRC),placeholder:n.getAttribute("placeholder"),themeTemplate:P0(n),thumbnailTime:!n.tokens.thumbnail&&n.thumbnailTime,autoplay:n.autoplay,crossOrigin:n.crossOrigin,loop:n.loop,noHotKeys:n.hasAttribute(pe.NOHOTKEYS),hotKeys:n.getAttribute(pe.HOTKEYS),muted:n.muted,paused:n.paused,preload:n.preload,envKey:n.envKey,preferCmcd:n.preferCmcd,debug:n.debug,disableCookies:n.disableCookies,tokens:n.tokens,beaconCollectionDomain:n.beaconCollectionDomain,maxResolution:n.maxResolution,metadata:n.metadata,playerSoftwareName:n.playerSoftwareName,playerSoftwareVersion:n.playerSoftwareVersion,startTime:n.startTime,preferPlayback:n.preferPlayback,audio:n.audio,defaultStreamType:n.defaultStreamType,targetLiveWindow:n.getAttribute(ae.TARGET_LIVE_WINDOW),streamType:Gs(n.getAttribute(ae.STREAM_TYPE)),primaryColor:n.primaryColor,secondaryColor:n.secondaryColor,forwardSeekOffset:n.forwardSeekOffset,backwardSeekOffset:n.backwardSeekOffset,defaultHiddenCaptions:n.defaultHiddenCaptions,defaultShowRemainingTime:n.defaultShowRemainingTime,hideDuration:O0(n),playbackRates:n.getAttribute(pe.PLAYBACK_RATES),customDomain:(m=n.getAttribute(ae.CUSTOM_DOMAIN))!=null?m:void 0,title:n.getAttribute(pe.TITLE),...a}}function P0(n){var o,m;let a=n.getAttribute(pe.THEME);if(a){let v=(m=(o=n.getRootNode())==null?void 0:o.getElementById)==null?void 0:m.call(o,a);if(v)return v;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let g=Ft.customElements.get(a);if(g!=null&&g.template)return g.template}}function O0(n){var o;let a=(o=n.mediaController)==null?void 0:o.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function mv(n){return n.getAttributeNames().filter(a=>a.startsWith("metadata-")).reduce((a,o)=>{let m=n.getAttribute(o);return m!==null&&(a[o.replace(/^metadata-/,"").replace(/-/g,"_")]=m),a},{})}var N0=Object.values(ae),F0=Object.values(xr),U0=Object.values(pe),B0=ad(),H0="mux-player",pv={dialog:void 0,isDialogOpen:!1},Zs,Js,Pr,eo,Pa,na,Nn,pd,vv,to,dh,sa,Fn,vd,gv,gd,yv,yd,Ev,Ed,bv,Xs=class extends Zc{constructor(){super();Rt(this,na);Rt(this,pd);Rt(this,to);Rt(this,sa);Rt(this,vd);Rt(this,gd);Rt(this,yd);Rt(this,Ed);Rt(this,Zs,!1);Rt(this,Js,{});Rt(this,Pr,!0);Rt(this,eo,new rd(this,"hotkeys"));Rt(this,Pa,{...pv,onCloseErrorDialog:()=>Ht(this,to,dh).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:o=>{$c(this,_i.activeElement)||o.preventDefault()}});this.attachShadow({mode:"open"}),Ht(this,pd,vv).call(this),this.isConnected&&Ht(this,na,Nn).call(this)}static get observedAttributes(){var o;return[...(o=Zc.observedAttributes)!=null?o:[],...F0,...N0,...U0]}get mediaTheme(){var o;return(o=this.shadowRoot)==null?void 0:o.querySelector("media-theme")}get mediaController(){var o,m;return(m=(o=this.mediaTheme)==null?void 0:o.shadowRoot)==null?void 0:m.querySelector("media-controller")}connectedCallback(){var m;let o=(m=this.shadowRoot)==null?void 0:m.querySelector("mux-video");o&&(o.metadata=mv(this))}attributeChangedCallback(o,m,v){switch(Ht(this,na,Nn).call(this),super.attributeChangedCallback(o,m,v),o){case pe.HOTKEYS:at(this,eo).value=v;break;case pe.THUMBNAIL_TIME:{v!=null&&this.tokens.thumbnail&&ea(qe("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case pe.THUMBNAIL_TOKEN:{let{aud:L}=Jr(v);v&&L!=="t"&&ea(qe("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:L}));break}case pe.STORYBOARD_TOKEN:{let{aud:L}=Jr(v);v&&L!=="s"&&ea(qe("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:L}));break}case ae.PLAYBACK_ID:{v!=null&&v.includes("?token")&&Qi(qe("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:v}));break}case ae.STREAM_TYPE:v&&![gt.LIVE,gt.ON_DEMAND,gt.UNKNOWN].includes(v)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=v.includes("dvr")?Number.POSITIVE_INFINITY:0:Qc({file:"invalid-stream-type.md",message:qe("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):this.targetLiveWindow=v===gt.LIVE?0:Number.NaN}[ae.PLAYBACK_ID,xr.SRC,pe.PLAYBACK_TOKEN].includes(o)&&m!==v&&Oi(this,Pa,{...at(this,Pa),...pv}),Ht(this,sa,Fn).call(this,{[Bp(o)]:v})}get preferCmcd(){var o;return(o=this.getAttribute(ae.PREFER_CMCD))!=null?o:void 0}set preferCmcd(o){o!==this.preferCmcd&&(o?Rn.includes(o)?this.setAttribute(ae.PREFER_CMCD,o):ea(`Invalid value for preferCmcd. Must be one of ${Rn.join()}`):this.removeAttribute(ae.PREFER_CMCD))}get hasPlayed(){var o,m;return(m=(o=this.mediaController)==null?void 0:o.hasAttribute("media-has-played"))!=null?m:!1}get inLiveWindow(){var o;return(o=this.mediaController)==null?void 0:o.hasAttribute("media-time-is-live")}get _hls(){var o;return(o=this.media)==null?void 0:o._hls}get mux(){var o;return(o=this.media)==null?void 0:o.mux}get theme(){var o;return(o=this.getAttribute(pe.THEME))!=null?o:""}set theme(o){this.setAttribute(pe.THEME,`${o}`)}get themeProps(){let o=this.mediaTheme;if(!o)return;let m={};for(let v of o.getAttributeNames()){if(lh.includes(v))continue;let g=o.getAttribute(v);m[td(v)]=g===""?!0:g}return m}set themeProps(o){var v,g;Ht(this,na,Nn).call(this);let m={...this.themeProps,...o};for(let L in m){if(lh.includes(L))continue;let M=o==null?void 0:o[L];typeof M=="boolean"||M==null?(v=this.mediaTheme)==null||v.toggleAttribute(ed(L),Boolean(M)):(g=this.mediaTheme)==null||g.setAttribute(ed(L),M)}}get playbackId(){var o;return(o=this.getAttribute(ae.PLAYBACK_ID))!=null?o:void 0}set playbackId(o){o?this.setAttribute(ae.PLAYBACK_ID,o):this.removeAttribute(ae.PLAYBACK_ID)}get src(){var o,m;return this.playbackId?(o=On(this,xr.SRC))!=null?o:void 0:(m=this.getAttribute(xr.SRC))!=null?m:void 0}set src(o){o?this.setAttribute(xr.SRC,o):this.removeAttribute(xr.SRC)}get poster(){var m;let o=this.getAttribute(xr.POSTER);if(o!=null)return o;if(this.playbackId&&!this.audio)return Fp(this.playbackId,{domain:this.customDomain,thumbnailTime:(m=this.thumbnailTime)!=null?m:this.startTime,token:this.tokens.thumbnail})}set poster(o){o||o===""?this.setAttribute(xr.POSTER,o):this.removeAttribute(xr.POSTER)}get storyboardSrc(){var o;return(o=this.getAttribute(pe.STORYBOARD_SRC))!=null?o:void 0}set storyboardSrc(o){o?this.setAttribute(pe.STORYBOARD_SRC,o):this.removeAttribute(pe.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[gt.LIVE,gt.UNKNOWN].includes(this.streamType)))return Up(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(pe.AUDIO)}set audio(o){if(!o){this.removeAttribute(pe.AUDIO);return}this.setAttribute(pe.AUDIO,"")}get hotkeys(){return at(this,eo)}get nohotkeys(){return this.hasAttribute(pe.NOHOTKEYS)}set nohotkeys(o){if(!o){this.removeAttribute(pe.NOHOTKEYS);return}this.setAttribute(pe.NOHOTKEYS,"")}get thumbnailTime(){return Ir(this.getAttribute(pe.THUMBNAIL_TIME))}set thumbnailTime(o){this.setAttribute(pe.THUMBNAIL_TIME,`${o}`)}get title(){var o;return(o=this.getAttribute(pe.TITLE))!=null?o:""}set title(o){o!==this.title&&(o?this.setAttribute(pe.TITLE,o):this.removeAttribute("title"),super.title=o)}get placeholder(){var o;return(o=On(this,pe.PLACEHOLDER))!=null?o:""}set placeholder(o){this.setAttribute(pe.PLACEHOLDER,`${o}`)}get primaryColor(){var m,v;let o=this.getAttribute(pe.PRIMARY_COLOR);if(o!=null||this.mediaTheme&&(o=(v=(m=Ft.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_primary-color"))==null?void 0:v.trim(),o))return o}set primaryColor(o){this.setAttribute(pe.PRIMARY_COLOR,`${o}`)}get secondaryColor(){var m,v;let o=this.getAttribute(pe.SECONDARY_COLOR);if(o!=null||this.mediaTheme&&(o=(v=(m=Ft.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_secondary-color"))==null?void 0:v.trim(),o))return o}set secondaryColor(o){this.setAttribute(pe.SECONDARY_COLOR,`${o}`)}get defaultShowRemainingTime(){return this.hasAttribute(pe.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(o){o?this.setAttribute(pe.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(pe.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(pe.PLAYBACK_RATES))return this.getAttribute(pe.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(o=>Number(o)).filter(o=>!Number.isNaN(o)).sort((o,m)=>o-m)}set playbackRates(o){if(!o){this.removeAttribute(pe.PLAYBACK_RATES);return}this.setAttribute(pe.PLAYBACK_RATES,o.join(" "))}get forwardSeekOffset(){var o;return(o=Ir(this.getAttribute(pe.FORWARD_SEEK_OFFSET)))!=null?o:10}set forwardSeekOffset(o){this.setAttribute(pe.FORWARD_SEEK_OFFSET,`${o}`)}get backwardSeekOffset(){var o;return(o=Ir(this.getAttribute(pe.BACKWARD_SEEK_OFFSET)))!=null?o:10}set backwardSeekOffset(o){this.setAttribute(pe.BACKWARD_SEEK_OFFSET,`${o}`)}get defaultHiddenCaptions(){return this.hasAttribute(pe.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(o){o?this.setAttribute(pe.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(pe.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var o;return(o=this.getAttribute(ae.PLAYER_SOFTWARE_NAME))!=null?o:H0}get playerSoftwareVersion(){var o;return(o=this.getAttribute(ae.PLAYER_SOFTWARE_VERSION))!=null?o:B0}get beaconCollectionDomain(){var o;return(o=this.getAttribute(ae.BEACON_COLLECTION_DOMAIN))!=null?o:void 0}set beaconCollectionDomain(o){o!==this.beaconCollectionDomain&&(o?this.setAttribute(ae.BEACON_COLLECTION_DOMAIN,o):this.removeAttribute(ae.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var o;return(o=this.getAttribute(ae.MAX_RESOLUTION))!=null?o:void 0}set maxResolution(o){o!==this.maxResolution&&(o?this.setAttribute(ae.MAX_RESOLUTION,o):this.removeAttribute(ae.MAX_RESOLUTION))}get customDomain(){var o;return(o=this.getAttribute(ae.CUSTOM_DOMAIN))!=null?o:void 0}set customDomain(o){o!==this.customDomain&&(o?this.setAttribute(ae.CUSTOM_DOMAIN,o):this.removeAttribute(ae.CUSTOM_DOMAIN))}get envKey(){var o;return(o=On(this,ae.ENV_KEY))!=null?o:void 0}set envKey(o){this.setAttribute(ae.ENV_KEY,`${o}`)}get debug(){return On(this,ae.DEBUG)!=null}set debug(o){o?this.setAttribute(ae.DEBUG,""):this.removeAttribute(ae.DEBUG)}get disableCookies(){return On(this,ae.DISABLE_COOKIES)!=null}set disableCookies(o){o?this.setAttribute(ae.DISABLE_COOKIES,""):this.removeAttribute(ae.DISABLE_COOKIES)}get streamType(){var o,m,v;return(v=(m=this.getAttribute(ae.STREAM_TYPE))!=null?m:(o=this.media)==null?void 0:o.streamType)!=null?v:gt.UNKNOWN}set streamType(o){this.setAttribute(ae.STREAM_TYPE,`${o}`)}get defaultStreamType(){var o,m,v;return(v=(m=this.getAttribute(pe.DEFAULT_STREAM_TYPE))!=null?m:(o=this.mediaController)==null?void 0:o.getAttribute(pe.DEFAULT_STREAM_TYPE))!=null?v:gt.ON_DEMAND}set defaultStreamType(o){o?this.setAttribute(pe.DEFAULT_STREAM_TYPE,o):this.removeAttribute(pe.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var o,m;return this.hasAttribute(pe.TARGET_LIVE_WINDOW)?+this.getAttribute(pe.TARGET_LIVE_WINDOW):(m=(o=this.media)==null?void 0:o.targetLiveWindow)!=null?m:Number.NaN}set targetLiveWindow(o){o!=this.targetLiveWindow&&(o==null?this.removeAttribute(pe.TARGET_LIVE_WINDOW):this.setAttribute(pe.TARGET_LIVE_WINDOW,`${+o}`))}get liveEdgeStart(){var o;return(o=this.media)==null?void 0:o.liveEdgeStart}get startTime(){return Ir(On(this,ae.START_TIME))}set startTime(o){this.setAttribute(ae.START_TIME,`${o}`)}get preferPlayback(){let o=this.getAttribute(ae.PREFER_PLAYBACK);if(o===Hi.MSE||o===Hi.NATIVE)return o}set preferPlayback(o){o!==this.preferPlayback&&(o===Hi.MSE||o===Hi.NATIVE?this.setAttribute(ae.PREFER_PLAYBACK,o):this.removeAttribute(ae.PREFER_PLAYBACK))}get metadata(){var o;return(o=this.media)==null?void 0:o.metadata}set metadata(o){if(Ht(this,na,Nn).call(this),!this.media){Qi("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...mv(this),...o}}async addCuePoints(o){var m;if(Ht(this,na,Nn).call(this),!this.media){Qi("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(m=this.media)==null?void 0:m.addCuePoints(o)}get activeCuePoint(){var o;return(o=this.media)==null?void 0:o.activeCuePoint}get cuePoints(){var o,m;return(m=(o=this.media)==null?void 0:o.cuePoints)!=null?m:[]}getStartDate(){var o;return(o=this.media)==null?void 0:o.getStartDate()}get currentPdt(){var o;return(o=this.media)==null?void 0:o.currentPdt}get tokens(){let o=this.getAttribute(pe.PLAYBACK_TOKEN),m=this.getAttribute(pe.THUMBNAIL_TOKEN),v=this.getAttribute(pe.STORYBOARD_TOKEN);return{...at(this,Js),...o!=null?{playback:o}:{},...m!=null?{thumbnail:m}:{},...v!=null?{storyboard:v}:{}}}set tokens(o){Oi(this,Js,o!=null?o:{})}get playbackToken(){var o;return(o=this.getAttribute(pe.PLAYBACK_TOKEN))!=null?o:void 0}set playbackToken(o){this.setAttribute(pe.PLAYBACK_TOKEN,`${o}`)}get thumbnailToken(){var o;return(o=this.getAttribute(pe.THUMBNAIL_TOKEN))!=null?o:void 0}set thumbnailToken(o){this.setAttribute(pe.THUMBNAIL_TOKEN,`${o}`)}get storyboardToken(){var o;return(o=this.getAttribute(pe.STORYBOARD_TOKEN))!=null?o:void 0}set storyboardToken(o){this.setAttribute(pe.STORYBOARD_TOKEN,`${o}`)}addTextTrack(o,m,v,g){var M;let L=(M=this.media)==null?void 0:M.nativeEl;if(!!L)return Vl(L,o,m,v,g)}removeTextTrack(o){var v;let m=(v=this.media)==null?void 0:v.nativeEl;if(!!m)return lp(m,o)}get textTracks(){var o;return(o=this.media)==null?void 0:o.textTracks}};Zs=new WeakMap,Js=new WeakMap,Pr=new WeakMap,eo=new WeakMap,Pa=new WeakMap,na=new WeakSet,Nn=function(){var o,m,v;if(!at(this,Zs)){Oi(this,Zs,!0),Ht(this,sa,Fn).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof Ft.HTMLElement))throw""}catch{Qi("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Pp))throw""}catch{Qi("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof ys))throw""}catch{Qi("<media-controller> failed to upgrade!")}Kp(this),Ht(this,vd,gv).call(this),Ht(this,gd,yv).call(this),Ht(this,yd,Ev).call(this),Oi(this,Pr,(m=(o=this.mediaController)==null?void 0:o.hasAttribute("user-inactive"))!=null?m:!0),Ht(this,Ed,bv).call(this),(v=this.media)==null||v.addEventListener("streamtypechange",()=>{Ht(this,sa,Fn).call(this)})}},pd=new WeakSet,vv=function(){var o,m;try{(o=window==null?void 0:window.CSS)==null||o.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(m=window==null?void 0:window.CSS)==null||m.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},to=new WeakSet,dh=function(o){Object.assign(at(this,Pa),o),Ht(this,sa,Fn).call(this)},sa=new WeakSet,Fn=function(o={}){hv(fv(x0(this,{...at(this,Pa),...o})),this.shadowRoot)},vd=new WeakSet,gv=function(){let o=v=>{var M,B;if(!(v!=null&&v.startsWith("theme-")))return;let g=v.replace(/^theme-/,"");if(lh.includes(g))return;let L=this.getAttribute(v);L!=null?(M=this.mediaTheme)==null||M.setAttribute(g,L):(B=this.mediaTheme)==null||B.removeAttribute(g)};new MutationObserver(v=>{for(let{attributeName:g}of v)o(g)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(o)},gd=new WeakSet,yv=function(){var m;let o=v=>{let{detail:g}=v;if(g instanceof vt||(g=new vt(g.message,g.code,g.fatal)),!(g!=null&&g.fatal)){ea(g),g.data&&ea(`${g.name} data:`,g.data);return}let{dialog:L,devlog:M}=md(g,!window.navigator.onLine,this.playbackId,this.playbackToken);M.message&&Qc(M),Qi(g),g.data&&Qi(`${g.name} data:`,g.data),Ht(this,to,dh).call(this,{isDialogOpen:!0,dialog:L})};this.addEventListener("error",o),this.media&&(this.media.errorTranslator=(v={})=>{var L,M,B;if(!(((L=this.media)==null?void 0:L.error)instanceof vt))return v;let{devlog:g}=md((M=this.media)==null?void 0:M.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(B=this.media)==null?void 0:B.error.code,player_error_message:g.message?String(g.message):v.player_error_message,player_error_context:g.context?String(g.context):v.player_error_context}}),(m=this.media)==null||m.addEventListener("error",v=>{var L,M;let{detail:g}=v;if(!g){let{message:B,code:U}=(M=(L=this.media)==null?void 0:L.error)!=null?M:{};g=new vt(B,U)}!(g!=null&&g.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:g}))})},yd=new WeakSet,Ev=function(){var m,v,g,L;let o=()=>Ht(this,sa,Fn).call(this);(v=(m=this.media)==null?void 0:m.textTracks)==null||v.addEventListener("addtrack",o),(L=(g=this.media)==null?void 0:g.textTracks)==null||L.addEventListener("removetrack",o)},Ed=new WeakSet,bv=function(){var z,ie;let o=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(!/Firefox/i.test(navigator.userAgent))return;let v,g=new WeakMap,L=()=>this.streamType===gt.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,M=(ee,se,fe=!1)=>{if(L())return;Array.from(ee&&ee.activeCues||[]).forEach(Ae=>{if(!(!Ae.snapToLines||Ae.line<-5||Ae.line>=0&&Ae.line<10))if(!se||this.paused){let Se=Ae.text.split(`
|
|
1985
|
-
`).length,
|
|
1975
|
+
`};function Td(n,a,l,m,v){var M,B,F;let E={},I={};switch(n.code){case pt.MEDIA_ERR_NETWORK:{switch(E.title=Ye("Network Error",v),E.message=n.message,(M=n.data)==null?void 0:M.response.code){case 412:{E.title=Ye("Video is not currently available",v),E.message=Ye("The live stream or video file are not yet ready.",v),I.message=Ye("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",v),I.file="412-not-playable.md";break}case 404:{E.title=Ye("Video does not exist",v),E.message="",I.message=Ye("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",v),I.file="404-not-found.md";break}case 403:{if(E.title=Ye("Invalid playback URL",v),E.message=Ye("The video URL or playback-token are formatted with incorrect or incomplete information.",v),I.message=Ye("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",v),I.file="missing-signed-tokens.md",!m)break;let{exp:Q,aud:re,sub:te}=ea(m),se=Date.now()>Q*1e3,pe=te!==l,Ae=re!=="v",ke={timeStyle:"medium",dateStyle:"medium"};if(se){E.title=Ye("Video URL has expired",v),E.message=Ye("The video\u2019s secured playback-token has expired.",v),I.message=Ye("The video\u2019s secured playback-token has expired.",v),I.context=Ye("Expired at: {expiredDate}. Current time: {currentDate}.",v).format({expiredDate:new Intl.DateTimeFormat(Na.code,ke).format(Q*1e3),currentDate:new Intl.DateTimeFormat(Na.code,ke).format(Date.now())}),I.file="403-expired-token.md";break}if(pe){E.title=Ye("Video URL is formatted incorrectly",v),E.message=Ye("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),I.message=Ye("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),I.context=Ye("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",v).format({playbackId:l,tokenPlaybackId:te}),I.file="403-playback-id-mismatch.md";break}if(Ae){E.title=Ye("Video URL is formatted incorrectly",v),E.message=Ye("The playback-token is formatted with incorrect information.",v),I.message=Ye("The playback-token is formatted with incorrect information.",v),I.context=Ye("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",v).format({tokenType:re}),I.file="403-incorrect-aud-value.md";break}I.message=Ye("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",v),I.file="403-malformatted-token.md";break}}break}case pt.MEDIA_ERR_DECODE:{let{message:Q}=n;E={title:Ye("Media Error",v),message:Q},I.file="media-decode-error.md";break}case pt.MEDIA_ERR_SRC_NOT_SUPPORTED:{let Q=(F=(B=n.data)==null?void 0:B.response)==null?void 0:F.code;if(Q>=400&&Q<500){n.code=pt.MEDIA_ERR_NETWORK,n.data={response:{code:Q}},{dialog:E,devlog:I}=Td(n,a,l,m);break}E={title:Ye("Source Not Supported",v),message:n.message},I.file="media-src-not-supported.md";break}default:E={title:Ye("Error",v),message:n.message};break}return a&&(E={title:Ye("Your device appears to be offline",v),message:Ye("Check your internet connection and try reloading this video.",v)}),{dialog:E,devlog:I}}var Pr={SRC:"src",POSTER:"poster"},me={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",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",NO_VOLUME_PREF:"no-volume-pref"},gh=["audio","backward-seek-offset","default-show-remaining-time","default-showing-captions","noautoseektolive","disabled","exportparts","forward-seek-offset","hide-duration","hotkeys","nohotkeys","playbackrates","default-stream-type","stream-type","style","target-live-window","template","title","no-volume-pref"];function C0(n,a){var m;return{src:!n.playbackId&&n.src,playbackId:n.playbackId,hasSrc:!!n.playbackId||!!n.src,poster:n.poster,storyboard:n.storyboard,storyboardSrc:n.getAttribute(me.STORYBOARD_SRC),placeholder:n.getAttribute("placeholder"),themeTemplate:M0(n),thumbnailTime:!n.tokens.thumbnail&&n.thumbnailTime,autoplay:n.autoplay,crossOrigin:n.crossOrigin,loop:n.loop,noHotKeys:n.hasAttribute(me.NOHOTKEYS),hotKeys:n.getAttribute(me.HOTKEYS),muted:n.muted,paused:n.paused,preload:n.preload,envKey:n.envKey,preferCmcd:n.preferCmcd,debug:n.debug,disableCookies:n.disableCookies,tokens:n.tokens,beaconCollectionDomain:n.beaconCollectionDomain,maxResolution:n.maxResolution,metadata:n.metadata,playerSoftwareName:n.playerSoftwareName,playerSoftwareVersion:n.playerSoftwareVersion,startTime:n.startTime,preferPlayback:n.preferPlayback,audio:n.audio,defaultStreamType:n.defaultStreamType,targetLiveWindow:n.getAttribute(ae.TARGET_LIVE_WINDOW),streamType:Ws(n.getAttribute(ae.STREAM_TYPE)),primaryColor:n.primaryColor,secondaryColor:n.secondaryColor,forwardSeekOffset:n.forwardSeekOffset,backwardSeekOffset:n.backwardSeekOffset,defaultHiddenCaptions:n.defaultHiddenCaptions,defaultShowRemainingTime:n.defaultShowRemainingTime,hideDuration:x0(n),playbackRates:n.getAttribute(me.PLAYBACK_RATES),customDomain:(m=n.getAttribute(ae.CUSTOM_DOMAIN))!=null?m:void 0,title:n.getAttribute(me.TITLE),novolumepref:n.hasAttribute(me.NO_VOLUME_PREF),...a}}function M0(n){var l,m;let a=n.getAttribute(me.THEME);if(a){let v=(m=(l=n.getRootNode())==null?void 0:l.getElementById)==null?void 0:m.call(l,a);if(v)return v;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let E=Ft.customElements.get(a);if(E!=null&&E.template)return E.template}}function x0(n){var l;let a=(l=n.mediaController)==null?void 0:l.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function yv(n){return n.getAttributeNames().filter(a=>a.startsWith("metadata-")).reduce((a,l)=>{let m=n.getAttribute(l);return m!==null&&(a[l.replace(/^metadata-/,"").replace(/-/g,"_")]=m),a},{})}var P0=Object.values(ae),O0=Object.values(Pr),N0=Object.values(me),F0=hd(),U0="mux-player",Ev={dialog:void 0,isDialogOpen:!1},io,ro,Or,ao,qa,sa,Un,Ad,bv,no,yh,oa,Bn,Sd,_v,kd,Tv,wd,Av,Ld,Sv,to=class extends nh{constructor(){super();Dt(this,sa);Dt(this,Ad);Dt(this,no);Dt(this,oa);Dt(this,Sd);Dt(this,kd);Dt(this,wd);Dt(this,Ld);Dt(this,io,!1);Dt(this,ro,{});Dt(this,Or,!0);Dt(this,ao,new cd(this,"hotkeys"));Dt(this,qa,{...Ev,onCloseErrorDialog:()=>Gt(this,no,yh).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:l=>{eh(this,Si.activeElement)||l.preventDefault()}});this.attachShadow({mode:"open"}),Gt(this,Ad,bv).call(this),this.isConnected&&Gt(this,sa,Un).call(this)}static get observedAttributes(){var l;return[...(l=nh.observedAttributes)!=null?l:[],...O0,...P0,...N0]}get mediaTheme(){var l;return(l=this.shadowRoot)==null?void 0:l.querySelector("media-theme")}get mediaController(){var l,m;return(m=(l=this.mediaTheme)==null?void 0:l.shadowRoot)==null?void 0:m.querySelector("media-controller")}connectedCallback(){var m;let l=(m=this.shadowRoot)==null?void 0:m.querySelector("mux-video");l&&(l.metadata=yv(this))}attributeChangedCallback(l,m,v){switch(Gt(this,sa,Un).call(this),super.attributeChangedCallback(l,m,v),l){case me.HOTKEYS:at(this,ao).value=v;break;case me.THUMBNAIL_TIME:{v!=null&&this.tokens.thumbnail&&ta(Ye("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case me.THUMBNAIL_TOKEN:{let{aud:I}=ea(v);v&&I!=="t"&&ta(Ye("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:I}));break}case me.STORYBOARD_TOKEN:{let{aud:I}=ea(v);v&&I!=="s"&&ta(Ye("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:I}));break}case ae.PLAYBACK_ID:{v!=null&&v.includes("?token")&&ji(Ye("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:v}));break}case ae.STREAM_TYPE:v&&![vt.LIVE,vt.ON_DEMAND,vt.UNKNOWN].includes(v)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=v.includes("dvr")?Number.POSITIVE_INFINITY:0:rh({file:"invalid-stream-type.md",message:Ye("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):this.targetLiveWindow=v===vt.LIVE?0:Number.NaN}[ae.PLAYBACK_ID,Pr.SRC,me.PLAYBACK_TOKEN].includes(l)&&m!==v&&Oi(this,qa,{...at(this,qa),...Ev}),Gt(this,oa,Bn).call(this,{[Wp(l)]:v})}get preferCmcd(){var l;return(l=this.getAttribute(ae.PREFER_CMCD))!=null?l:void 0}set preferCmcd(l){l!==this.preferCmcd&&(l?Dn.includes(l)?this.setAttribute(ae.PREFER_CMCD,l):ta(`Invalid value for preferCmcd. Must be one of ${Dn.join()}`):this.removeAttribute(ae.PREFER_CMCD))}get hasPlayed(){var l,m;return(m=(l=this.mediaController)==null?void 0:l.hasAttribute("media-has-played"))!=null?m:!1}get inLiveWindow(){var l;return(l=this.mediaController)==null?void 0:l.hasAttribute("media-time-is-live")}get _hls(){var l;return(l=this.media)==null?void 0:l._hls}get mux(){var l;return(l=this.media)==null?void 0:l.mux}get theme(){var l;return(l=this.getAttribute(me.THEME))!=null?l:""}set theme(l){this.setAttribute(me.THEME,`${l}`)}get themeProps(){let l=this.mediaTheme;if(!l)return;let m={};for(let v of l.getAttributeNames()){if(gh.includes(v))continue;let E=l.getAttribute(v);m[dd(v)]=E===""?!0:E}return m}set themeProps(l){var v,E;Gt(this,sa,Un).call(this);let m={...this.themeProps,...l};for(let I in m){if(gh.includes(I))continue;let M=l==null?void 0:l[I];typeof M=="boolean"||M==null?(v=this.mediaTheme)==null||v.toggleAttribute(ld(I),Boolean(M)):(E=this.mediaTheme)==null||E.setAttribute(ld(I),M)}}get playbackId(){var l;return(l=this.getAttribute(ae.PLAYBACK_ID))!=null?l:void 0}set playbackId(l){l?this.setAttribute(ae.PLAYBACK_ID,l):this.removeAttribute(ae.PLAYBACK_ID)}get src(){var l,m;return this.playbackId?(l=Fn(this,Pr.SRC))!=null?l:void 0:(m=this.getAttribute(Pr.SRC))!=null?m:void 0}set src(l){l?this.setAttribute(Pr.SRC,l):this.removeAttribute(Pr.SRC)}get poster(){var m;let l=this.getAttribute(Pr.POSTER);if(l!=null)return l;if(this.playbackId&&!this.audio)return Vp(this.playbackId,{domain:this.customDomain,thumbnailTime:(m=this.thumbnailTime)!=null?m:this.startTime,token:this.tokens.thumbnail})}set poster(l){l||l===""?this.setAttribute(Pr.POSTER,l):this.removeAttribute(Pr.POSTER)}get storyboardSrc(){var l;return(l=this.getAttribute(me.STORYBOARD_SRC))!=null?l:void 0}set storyboardSrc(l){l?this.setAttribute(me.STORYBOARD_SRC,l):this.removeAttribute(me.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[vt.LIVE,vt.UNKNOWN].includes(this.streamType)))return Kp(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(me.AUDIO)}set audio(l){if(!l){this.removeAttribute(me.AUDIO);return}this.setAttribute(me.AUDIO,"")}get hotkeys(){return at(this,ao)}get nohotkeys(){return this.hasAttribute(me.NOHOTKEYS)}set nohotkeys(l){if(!l){this.removeAttribute(me.NOHOTKEYS);return}this.setAttribute(me.NOHOTKEYS,"")}get thumbnailTime(){return Rr(this.getAttribute(me.THUMBNAIL_TIME))}set thumbnailTime(l){this.setAttribute(me.THUMBNAIL_TIME,`${l}`)}get title(){var l;return(l=this.getAttribute(me.TITLE))!=null?l:""}set title(l){l!==this.title&&(l?this.setAttribute(me.TITLE,l):this.removeAttribute("title"),super.title=l)}get placeholder(){var l;return(l=Fn(this,me.PLACEHOLDER))!=null?l:""}set placeholder(l){this.setAttribute(me.PLACEHOLDER,`${l}`)}get primaryColor(){var m,v;let l=this.getAttribute(me.PRIMARY_COLOR);if(l!=null||this.mediaTheme&&(l=(v=(m=Ft.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_primary-color"))==null?void 0:v.trim(),l))return l}set primaryColor(l){this.setAttribute(me.PRIMARY_COLOR,`${l}`)}get secondaryColor(){var m,v;let l=this.getAttribute(me.SECONDARY_COLOR);if(l!=null||this.mediaTheme&&(l=(v=(m=Ft.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_secondary-color"))==null?void 0:v.trim(),l))return l}set secondaryColor(l){this.setAttribute(me.SECONDARY_COLOR,`${l}`)}get defaultShowRemainingTime(){return this.hasAttribute(me.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(l){l?this.setAttribute(me.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(me.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(me.PLAYBACK_RATES))return this.getAttribute(me.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(l=>Number(l)).filter(l=>!Number.isNaN(l)).sort((l,m)=>l-m)}set playbackRates(l){if(!l){this.removeAttribute(me.PLAYBACK_RATES);return}this.setAttribute(me.PLAYBACK_RATES,l.join(" "))}get forwardSeekOffset(){var l;return(l=Rr(this.getAttribute(me.FORWARD_SEEK_OFFSET)))!=null?l:10}set forwardSeekOffset(l){this.setAttribute(me.FORWARD_SEEK_OFFSET,`${l}`)}get backwardSeekOffset(){var l;return(l=Rr(this.getAttribute(me.BACKWARD_SEEK_OFFSET)))!=null?l:10}set backwardSeekOffset(l){this.setAttribute(me.BACKWARD_SEEK_OFFSET,`${l}`)}get defaultHiddenCaptions(){return this.hasAttribute(me.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(l){l?this.setAttribute(me.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(me.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var l;return(l=this.getAttribute(ae.PLAYER_SOFTWARE_NAME))!=null?l:U0}get playerSoftwareVersion(){var l;return(l=this.getAttribute(ae.PLAYER_SOFTWARE_VERSION))!=null?l:F0}get beaconCollectionDomain(){var l;return(l=this.getAttribute(ae.BEACON_COLLECTION_DOMAIN))!=null?l:void 0}set beaconCollectionDomain(l){l!==this.beaconCollectionDomain&&(l?this.setAttribute(ae.BEACON_COLLECTION_DOMAIN,l):this.removeAttribute(ae.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var l;return(l=this.getAttribute(ae.MAX_RESOLUTION))!=null?l:void 0}set maxResolution(l){l!==this.maxResolution&&(l?this.setAttribute(ae.MAX_RESOLUTION,l):this.removeAttribute(ae.MAX_RESOLUTION))}get customDomain(){var l;return(l=this.getAttribute(ae.CUSTOM_DOMAIN))!=null?l:void 0}set customDomain(l){l!==this.customDomain&&(l?this.setAttribute(ae.CUSTOM_DOMAIN,l):this.removeAttribute(ae.CUSTOM_DOMAIN))}get envKey(){var l;return(l=Fn(this,ae.ENV_KEY))!=null?l:void 0}set envKey(l){this.setAttribute(ae.ENV_KEY,`${l}`)}get noVolumePref(){return this.hasAttribute(me.NO_VOLUME_PREF)}set noVolumePref(l){l?this.setAttribute(me.NO_VOLUME_PREF,""):this.removeAttribute(me.NO_VOLUME_PREF)}get debug(){return Fn(this,ae.DEBUG)!=null}set debug(l){l?this.setAttribute(ae.DEBUG,""):this.removeAttribute(ae.DEBUG)}get disableCookies(){return Fn(this,ae.DISABLE_COOKIES)!=null}set disableCookies(l){l?this.setAttribute(ae.DISABLE_COOKIES,""):this.removeAttribute(ae.DISABLE_COOKIES)}get streamType(){var l,m,v;return(v=(m=this.getAttribute(ae.STREAM_TYPE))!=null?m:(l=this.media)==null?void 0:l.streamType)!=null?v:vt.UNKNOWN}set streamType(l){this.setAttribute(ae.STREAM_TYPE,`${l}`)}get defaultStreamType(){var l,m,v;return(v=(m=this.getAttribute(me.DEFAULT_STREAM_TYPE))!=null?m:(l=this.mediaController)==null?void 0:l.getAttribute(me.DEFAULT_STREAM_TYPE))!=null?v:vt.ON_DEMAND}set defaultStreamType(l){l?this.setAttribute(me.DEFAULT_STREAM_TYPE,l):this.removeAttribute(me.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var l,m;return this.hasAttribute(me.TARGET_LIVE_WINDOW)?+this.getAttribute(me.TARGET_LIVE_WINDOW):(m=(l=this.media)==null?void 0:l.targetLiveWindow)!=null?m:Number.NaN}set targetLiveWindow(l){l!=this.targetLiveWindow&&(l==null?this.removeAttribute(me.TARGET_LIVE_WINDOW):this.setAttribute(me.TARGET_LIVE_WINDOW,`${+l}`))}get liveEdgeStart(){var l;return(l=this.media)==null?void 0:l.liveEdgeStart}get startTime(){return Rr(Fn(this,ae.START_TIME))}set startTime(l){this.setAttribute(ae.START_TIME,`${l}`)}get preferPlayback(){let l=this.getAttribute(ae.PREFER_PLAYBACK);if(l===Hi.MSE||l===Hi.NATIVE)return l}set preferPlayback(l){l!==this.preferPlayback&&(l===Hi.MSE||l===Hi.NATIVE?this.setAttribute(ae.PREFER_PLAYBACK,l):this.removeAttribute(ae.PREFER_PLAYBACK))}get metadata(){var l;return(l=this.media)==null?void 0:l.metadata}set metadata(l){if(Gt(this,sa,Un).call(this),!this.media){ji("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...yv(this),...l}}async addCuePoints(l){var m;if(Gt(this,sa,Un).call(this),!this.media){ji("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(m=this.media)==null?void 0:m.addCuePoints(l)}get activeCuePoint(){var l;return(l=this.media)==null?void 0:l.activeCuePoint}get cuePoints(){var l,m;return(m=(l=this.media)==null?void 0:l.cuePoints)!=null?m:[]}getStartDate(){var l;return(l=this.media)==null?void 0:l.getStartDate()}get currentPdt(){var l;return(l=this.media)==null?void 0:l.currentPdt}get tokens(){let l=this.getAttribute(me.PLAYBACK_TOKEN),m=this.getAttribute(me.THUMBNAIL_TOKEN),v=this.getAttribute(me.STORYBOARD_TOKEN);return{...at(this,ro),...l!=null?{playback:l}:{},...m!=null?{thumbnail:m}:{},...v!=null?{storyboard:v}:{}}}set tokens(l){Oi(this,ro,l!=null?l:{})}get playbackToken(){var l;return(l=this.getAttribute(me.PLAYBACK_TOKEN))!=null?l:void 0}set playbackToken(l){this.setAttribute(me.PLAYBACK_TOKEN,`${l}`)}get thumbnailToken(){var l;return(l=this.getAttribute(me.THUMBNAIL_TOKEN))!=null?l:void 0}set thumbnailToken(l){this.setAttribute(me.THUMBNAIL_TOKEN,`${l}`)}get storyboardToken(){var l;return(l=this.getAttribute(me.STORYBOARD_TOKEN))!=null?l:void 0}set storyboardToken(l){this.setAttribute(me.STORYBOARD_TOKEN,`${l}`)}addTextTrack(l,m,v,E){var M;let I=(M=this.media)==null?void 0:M.nativeEl;if(!!I)return Ql(I,l,m,v,E)}removeTextTrack(l){var v;let m=(v=this.media)==null?void 0:v.nativeEl;if(!!m)return fp(m,l)}get textTracks(){var l;return(l=this.media)==null?void 0:l.textTracks}};io=new WeakMap,ro=new WeakMap,Or=new WeakMap,ao=new WeakMap,qa=new WeakMap,sa=new WeakSet,Un=function(){var l,m,v;if(!at(this,io)){Oi(this,io,!0),Gt(this,oa,Bn).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof Ft.HTMLElement))throw""}catch{ji("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Bp))throw""}catch{ji("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof Ts))throw""}catch{ji("<media-controller> failed to upgrade!")}jp(this),Gt(this,Sd,_v).call(this),Gt(this,kd,Tv).call(this),Gt(this,wd,Av).call(this),Oi(this,Or,(m=(l=this.mediaController)==null?void 0:l.hasAttribute("user-inactive"))!=null?m:!0),Gt(this,Ld,Sv).call(this),(v=this.media)==null||v.addEventListener("streamtypechange",()=>{Gt(this,oa,Bn).call(this)})}},Ad=new WeakSet,bv=function(){var l,m;try{(l=window==null?void 0:window.CSS)==null||l.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(m=window==null?void 0:window.CSS)==null||m.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},no=new WeakSet,yh=function(l){Object.assign(at(this,qa),l),Gt(this,oa,Bn).call(this)},oa=new WeakSet,Bn=function(l={}){vv(gv(C0(this,{...at(this,qa),...l})),this.shadowRoot)},Sd=new WeakSet,_v=function(){let l=v=>{var M,B;if(!(v!=null&&v.startsWith("theme-")))return;let E=v.replace(/^theme-/,"");if(gh.includes(E))return;let I=this.getAttribute(v);I!=null?(M=this.mediaTheme)==null||M.setAttribute(E,I):(B=this.mediaTheme)==null||B.removeAttribute(E)};new MutationObserver(v=>{for(let{attributeName:E}of v)l(E)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(l)},kd=new WeakSet,Tv=function(){var m;let l=v=>{let{detail:E}=v;if(E instanceof pt||(E=new pt(E.message,E.code,E.fatal)),!(E!=null&&E.fatal)){ta(E),E.data&&ta(`${E.name} data:`,E.data);return}let{dialog:I,devlog:M}=Td(E,!window.navigator.onLine,this.playbackId,this.playbackToken);M.message&&rh(M),ji(E),E.data&&ji(`${E.name} data:`,E.data),Gt(this,no,yh).call(this,{isDialogOpen:!0,dialog:I})};this.addEventListener("error",l),this.media&&(this.media.errorTranslator=(v={})=>{var I,M,B;if(!(((I=this.media)==null?void 0:I.error)instanceof pt))return v;let{devlog:E}=Td((M=this.media)==null?void 0:M.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(B=this.media)==null?void 0:B.error.code,player_error_message:E.message?String(E.message):v.player_error_message,player_error_context:E.context?String(E.context):v.player_error_context}}),(m=this.media)==null||m.addEventListener("error",v=>{var I,M;let{detail:E}=v;if(!E){let{message:B,code:F}=(M=(I=this.media)==null?void 0:I.error)!=null?M:{};E=new pt(B,F)}!(E!=null&&E.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:E}))})},wd=new WeakSet,Av=function(){var m,v,E,I;let l=()=>Gt(this,oa,Bn).call(this);(v=(m=this.media)==null?void 0:m.textTracks)==null||v.addEventListener("addtrack",l),(I=(E=this.media)==null?void 0:E.textTracks)==null||I.addEventListener("removetrack",l)},Ld=new WeakSet,Sv=function(){var Q,re;let l=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(!/Firefox/i.test(navigator.userAgent))return;let v,E=new WeakMap,I=()=>this.streamType===vt.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,M=(te,se,pe=!1)=>{if(I())return;Array.from(te&&te.activeCues||[]).forEach(ke=>{if(!(!ke.snapToLines||ke.line<-5||ke.line>=0&&ke.line<10))if(!se||this.paused){let we=ke.text.split(`
|
|
1976
|
+
`).length,nt=l?-2:-3;this.streamType===vt.LIVE&&(nt=l?-1:-2);let Ue=nt-we;if(ke.line===Ue&&!pe)return;E.has(ke)||E.set(ke,ke.line),ke.line=Ue-1,ke.line=Ue}else setTimeout(()=>{ke.line=E.get(ke)||"auto"},500)})},B=()=>{var te,se;M(v,(se=(te=this.mediaController)==null?void 0:te.hasAttribute("user-inactive"))!=null?se:!1)},F=()=>{var pe,Ae;let se=Array.from(((Ae=(pe=this.mediaController)==null?void 0:pe.media)==null?void 0:Ae.textTracks)||[]).filter(ke=>["subtitles","captions"].includes(ke.kind)&&ke.mode==="showing")[0];se!==v&&(v==null||v.removeEventListener("cuechange",B)),v=se,v==null||v.addEventListener("cuechange",B),M(v,at(this,Or))};if(F(),(Q=this.textTracks)==null||Q.addEventListener("change",F),(re=this.textTracks)==null||re.addEventListener("addtrack",F),navigator.userAgent.includes("Chrome/")){let te=()=>{M(v,at(this,Or),!0),this.paused||window.requestAnimationFrame(te)};this.addEventListener("playing",()=>{te()})}this.addEventListener("userinactivechange",()=>{var se,pe;let te=(pe=(se=this.mediaController)==null?void 0:se.hasAttribute("user-inactive"))!=null?pe:!0;at(this,Or)!==te&&(Oi(this,Or,te),M(v,at(this,Or)))})};function Fn(n,a){return n.media?n.media.getAttribute(a):n.getAttribute(a)}Ft.customElements.get("mux-player")||(Ft.customElements.define("mux-player",to),Ft.MuxPlayerElement=to);var I1=to;})();
|
|
1986
1977
|
/*!
|
|
1987
1978
|
* JavaScript Cookie v2.1.3
|
|
1988
1979
|
* https://github.com/js-cookie/js-cookie
|