@mux/mux-player 1.11.1 → 1.11.2
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 +67 -63
- package/dist/index.mjs +1 -1
- package/dist/mux-player.js +148 -144
- package/dist/mux-player.mjs +148 -144
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
package/dist/mux-player.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
"use strict";(()=>{var Xg=Object.create;var Lf=Object.defineProperty;var Zg=Object.getOwnPropertyDescriptor;var Jg=Object.getOwnPropertyNames;var eE=Object.getPrototypeOf,tE=Object.prototype.hasOwnProperty;var If=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports);var iE=(n,r,l,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let v of Jg(r))!tE.call(n,v)&&v!==l&&Lf(n,v,{get:()=>r[v],enumerable:!(m=Zg(r,v))||m.enumerable});return n};var Rf=(n,r,l)=>(l=n!=null?Xg(eE(n)):{},iE(r||!n||!n.__esModule?Lf(l,"default",{value:n,enumerable:!0}):l,n));var Id=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)};var ot=(n,r,l)=>(Id(n,r,"read from private field"),l?l.call(n):r.get(n)),Bt=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Gi=(n,r,l,m)=>(Id(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l);var Qt=(n,r,l)=>(Id(n,r,"access private method"),l);var pp=If((su,Vc)=>{(function(){var n,r;n=this,r=function(){return function(){var l={80:function(y,I,M){y.exports=M(728).default},728:function(y,I,M){"use strict";M.d(I,{default:function(){return qo}});var B=M(48),H=M.n(B),z=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)})},J=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||J()),T.muxId):T},le=function(T){var g;T&&T.nodeName!==void 0?T=ee(g=T):g=document.querySelector(T);var _=g&&g.nodeName?g.nodeName.toLowerCase():"";return[g,T,_]},me=M(640),_e=M.n(me),ge=_e().methodFactory;_e().methodFactory=function(T,g,_){var R=ge(T,g,_);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 ye=_e();function Ee(){return(H().doNotTrack||H().navigator&&H().navigator.doNotTrack)==="1"}var de={now:function(){var T=H().performance,g=T&&T.timing,_=g&&g.navigationStart,R=typeof _=="number"&&typeof T.now=="function"?_+T.now():Date.now();return Math.round(R)}},Be=function(T){return Ge(T)[0]},Ge=function(T){if(typeof T!="string"||T==="")return["localhost"];var g,_=(T.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return _&&(g=(_.match(/[^\.]+\.[^\.]+$/)||[])[0]),[_,g]},re={exists:function(){var T=H().performance;return(T&&T.timing)!==void 0},domContentLoadedEventEnd:function(){var T=H().performance,g=T&&T.timing;return g&&g.domContentLoadedEventEnd},navigationStart:function(){var T=H().performance,g=T&&T.timing;return g&&g.navigationStart}};function k(T,g,_){_=_===void 0?1:_,T[g]=T[g]||0,T[g]+=_}var se=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],W=["x-cdn","content-type"].concat(se);function Se(T){var g={};return(T=T||"").trim().split(/[\r\n]+/).forEach(function(_){if(_){var R=_.split(": "),C=R.shift();C&&(W.indexOf(C.toLowerCase())>=0||C.toLowerCase().indexOf("x-litix-")===0)&&(g[C]=R.join(": "))}}),g}function Xe(T){if(T){var g=se.find(function(_){return T[_]!==void 0});return g?T[g]:void 0}}var at=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 jt(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 it(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?jt(Object(_),!0).forEach(function(R){U(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):jt(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function U(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var di=function(T){if(!T)return{};var g=re.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)}},zt=function(T){if(T&&typeof T.getAllResponseHeaders=="function")return Se(T.getAllResponseHeaders())};function nt(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 ri(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?nt(Object(_),!0).forEach(function(R){$e(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):nt(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function $e(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var Gt=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=Be(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(),Fe=isNaN(C.duration)?0:C.duration,Te=typeof g.getMetricsFor=="function"?g.getMetricsFor(C.mediaType).HttpList:g.getDashMetrics().getHttpRequests(C.mediaType);return Te.length>0&&(R=Se(Te[Te.length-1]._responseHeaders||"")),{requestStart:$,requestResponseStart:K,requestResponseEnd:Z,requestBytesLoaded:G,requestResponseHeaders:R,requestMediaDuration:Fe,requestHostname:O,requestUrl:x,requestId:R?Xe(R):void 0}},gt=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}:{}},Ct=function(T){var g;return(g=T.match(/.*codecs\*?="(.*)"/))===null||g===void 0?void 0:g[1]};function tr(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 te=0,ke=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||++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(Fe,Te){(Fe=Fe.slice()).forEach(function(Re){Re.call(x,{type:C},Te)})};Z(G,O),Z($,O),Z(K,O)}}}],_&&tr(g.prototype,_),R&&tr(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}(),st=ke;function wt(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 Rt=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&&(H().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=H().setInterval(function(){C.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(H().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&wt(g.prototype,_),R&&wt(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)}}function $i(T,g,_){return g&&ci(T.prototype,g),_&&ci(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Ze=$i(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 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 gi=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),k(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}}])&&vi(g.prototype,_),R&&vi(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function ji(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 ir=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&&k(this.pm.data,"view_content_playback_time",O)}this._playbackTimeTrackerLastPlayheadPosition=C}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&ji(g.prototype,_),R&&ji(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function Ei(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 ct=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 $=this.pm.getPlayheadTime();$!==void 0&&(this.pm.data.player_playhead_time=$,G(),this._updateMaxPlayheadPosition())}}}])&&Ei(g.prototype,_),R&&Ei(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function rr(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 gr(T,g,_){return g&&rr(T.prototype,g),_&&rr(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var $r=3e5,xi=gr(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-_;k(g.data,"view_rebuffer_duration",x),_=O.viewer_time,g.data.view_rebuffer_duration>$r&&(g.emit("viewend"),g.send("viewend"),g.mux.log.warn("Ending view after rebuffering for longer than ".concat($r,"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){_||(k(g.data,"view_rebuffer_count",1),_=x.viewer_time,g.one("rebufferend",R))}),g.on("viewinit",function(){_=void 0,g.off("rebufferend",R)})}});function Er(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 es=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:de.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,$=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()}}],_&&Er(g.prototype,_),R&&Er(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}(),vo=es;function ga(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 an=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 Fe=Z.viewer_time;K.type==="playing"&&C.data.view_time_to_first_frame===void 0?O.calculateTimeToFirstFrame(Fe||de.now(),G):K.type!=="adplaying"||C.data.view_time_to_first_frame!==void 0&&!O._inPrerollPosition()||O.calculateTimeToFirstFrame(Fe||de.now(),G)};C.one("playing",$),C.one("adplaying",$),C.one("viewend",function(){C.off("playing",$),C.off("adplaying",$)})}})}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))}}])&&ga(g.prototype,_),R&&ga(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function go(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 Eo(T,g,_){return g&&go(T.prototype,g),_&&go(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Bu=Eo(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),k(g.data,"view_total_content_playback_time",C),k(g.data,"view_total_upscaling",x*C),k(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 ts(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 Hu(T,g,_){return g&&ts(T.prototype,g),_&&ts(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Gu=Hu(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=de.now(),_.isSeeking===!1&&(_.isSeeking=!0,g.send("seeking"))}),g.on("seeked",function(){_.isSeeking=!1;var R=_._lastSeekingTime||de.now(),C=de.now()-R;k(g.data,"view_seek_count",1),k(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 yo(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=[],$=!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,g)||function(_,R){if(_){if(typeof _=="string")return bo(_,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)?bo(_,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 bo(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function _o(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 Li=function(T,g){T.push(g),T.sort(function(_,R){return _.viewer_time-R.viewer_time})},Vu=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Pi=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}),Vu.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++},$),Li(O._adRequests,$),k(C.data,"view_ad_request_count"),O.inPrerollPosition()&&(C.data.view_preroll_requested=!0,O._adHasPlayed||k(C.data,"view_preroll_request_count"))}),C.on("adresponse",function(G,$){$=Object.assign({ad_request_id:"generatedAdRequestId"+O._currentAdResponseNumber++},$),Li(O._adResponses,$);var K=O.findAdRequest($.ad_request_id);K&&k(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,k(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 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=yo(Ge(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=yo(Ge(O.ad_asset_url),2),Z=K[0],Fe=K[1];this.pm.data.view_preroll_ad_asset_domain=Fe,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}}])&&_o(g.prototype,_),R&&_o(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function Ea(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 Ku(T,g,_){return g&&Ea(T.prototype,g),_&&Ea(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var To=Ku(function T(g){var _,R;(function(G,$){if(!(G instanceof $))throw new TypeError("Cannot call a class as a function")})(this,T);var C=function(){g.disableRebufferTracking||_&&(k(g.data,"view_waiting_rebuffer_duration",de.now()-_),_=!1,H().clearInterval(R))},O=!1,x=function(){O=!1,C()};g.on("waiting",function(){O&&(g.disableRebufferTracking||(k(g.data,"view_waiting_rebuffer_count",1),_=de.now(),R=H().setInterval(function(){if(_){var G=de.now();k(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 Mt(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 Ao(T,g,_){return g&&Mt(T.prototype,g),_&&Mt(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var He=Ao(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=de.now(),g.on("before*",C)},C=function(O){var x=de.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)})}),is=M(375),rs=M(655),Je=M.n(rs),So="muxData",as=function(){var T;try{T=is.parse(Je().get(So)||"")}catch{T={}}return T},ns=function(T){try{Je().set(So,is.stringify(T),{expires:7300})}catch{}},Wu=function(){var T=as();return T.mux_viewer_id=T.mux_viewer_id||z(),T.msn=T.msn||Math.random(),ns(T),{mux_viewer_id:T.mux_viewer_id,mux_sample_number:T.msn}};function yr(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 ss=function(){var T;switch(ko()){case"cellular":T="cellular";break;case"ethernet":T="wired";break;case"wifi":T="wifi";break;case void 0:break;default:T="other"}return T},ko=function(){var T=H().navigator,g=T&&(T.connection||T.mozConnection||T.webkitConnection);return g&&g.type};ss.getConnectionFromAPI=ko;var wo=ss,Lo=ya({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"}),Io=ya({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 ya(T){var g={};for(var _ in T)T.hasOwnProperty(_)&&(g[T[_]]=_);return g}function ba(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=Lo[x];G||(ye.info("Data key word `"+O[0]+"` not expected in "+R),G=x+"_"),O.splice(1).forEach(function($){$==="url"&&(C=!0),Io[$]?G+=Io[$]:Number($)&&Math.floor(Number($))===Number($)?G+=$:(ye.info("Data key word `"+$+"` not expected in "+R),G+="_"+$+"_")}),C?_[G]=T[R]:g[G]=T[R]}}),Object.assign(g,_)}var Ro={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},Do=["hb","requestcompleted","requestfailed","requestcanceled"],ai="https://img.litix.io",Ii=function(T){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=T||ai,this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},Ro,g)};Ii.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)},Ii.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())},Ii.prototype.destroy=function(){var T=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,T?this._clearBeaconQueue():this.flushEvents(),H().clearTimeout(this._sendTimeout)},Ii.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],ba({mux_view_message:"event queue truncated"}));var _=this._createPayload(g);Mo(this._beaconUrl,_,!0,function(){})},Ii.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=de.now();Mo(this._beaconUrl,_,!1,function(C,O){O?(T._eventQueue=g.concat(T._eventQueue),T._failureCount+=1,ye.info("Error sending beacon: "+O)):T._failureCount=0,T._roundTripTime=de.now()-R,T._postInFlight=!1})}},Ii.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},Ii.prototype._startBeaconSending=function(){var T=this;H().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=H().setTimeout(function(){T._eventQueue.length&&T._sendBeaconQueue(),T._startBeaconSending()},this._getNextBeaconTime()))},Ii.prototype._createPayload=function(T){var g,_,R,C=this,O={transmission_timestamp:Math.round(de.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()||(ye.info("Payload size is too big ("+R+" kb). Removing unnecessary events."),_=T.filter(function($){return Do.indexOf($.e)===-1}),x()),G()||(ye.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()),g};var Co=function(T){return T.length<=57344},Mo=function(T,g,_,R){if(_&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(T,g))R();else if(H().fetch)H().fetch(T,{method:"POST",body:g,headers:{"Content-Type":"text/plain"},keepalive:Co(g)}).then(function(O){return R(null,O.ok?null:"Error")}).catch(function(O){return R(null,O)});else{if(H().XMLHttpRequest){var C=new(H()).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()}},nn=Ii;function qu(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=[],$=!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,g)||function(_,R){if(_){if(typeof _=="string")return os(_,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)?os(_,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 os(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function sn(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
|
|
4
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function rt(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function Ri(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 Oi(T,g){return Oi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(_,R){return _.__proto__=R,_},Oi(T,g)}function Fo(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=Ta(T);if(g){var C=Ta(this).constructor;_=Reflect.construct(R,arguments,C)}else _=R.apply(this,arguments);return cs(this,_)}}function cs(T,g){if(g&&(yi(g)==="object"||typeof g=="function"))return g;if(g!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xt(T)}function xt(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}function Ta(T){return Ta=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(g){return g.__proto__||Object.getPrototypeOf(g)},Ta(T)}var Uo=["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"],Qr=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&&Oi(x,G)})(O,T);var g,_,R,C=Fo(O);function O(x,G,$){var K;(function(we,Ce){if(!(we instanceof Ce))throw new TypeError("Cannot call a class as a function")})(this,O),(K=C.call(this)).DOM_CONTENT_LOADED_EVENT_END=re.domContentLoadedEventEnd(),K.NAVIGATION_START=re.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(we){return we}},$)).data=$.data||{},$.data.property_key&&($.data.env_key=$.data.property_key,delete $.data.property_key),ye.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 $u(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(we,Ce){Ce=Object.assign({viewer_time:this.mux.utils.now()},Ce),this.oldEmit(we,Ce)};var Z=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(xt(K));K.on("viewinit",function(we,Ce){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,Ce),this._initializeViewData(),this.one("play",Z),this.one("adbreakstart",Z)});var Fe=function(we){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",we)}.bind(xt(K));if(K.on("videochange",function(we,Ce){Fe(Ce)}),K.on("programchange",function(we,Ce){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."),Fe(Object.assign(Ce,{view_program_changed:!0})),Z(),this.emit("play"),this.emit("playing")}),K.on("fragmentchange",function(we,Ce){this.currentFragmentPDT=Ce.currentFragmentPDT,this.currentFragmentStart=Ce.currentFragmentStart}),K.on("destroy",K.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var Te=function(){var we=K.data.view_start!==void 0;K.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",we&&K.mux.WINDOW_HIDDEN&&(K.data.player_is_paused||K.emit("hb"))};window.addEventListener("visibilitychange",Te,!1);var Re=function(we){we.persisted||K.destroy()};window.addEventListener("pagehide",Re,!1),K.on("destroy",function(){window.removeEventListener("visibilitychange",Te),window.removeEventListener("pagehide",Re)})}return K.on("playerready",function(we,Ce){Object.assign(this.data,Ce)}),Uo.forEach(function(we){K.on(we,function(Ce,We){we.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,We),this._sanitizeData()}),K.on("after"+we,function(){(we!=="error"||this.errorTracker.viewErrored)&&this.send(we)})}),K.on("viewend",function(we,Ce){Object.assign(K.data,Ce)}),K.one("playerready",function(we){var Ce=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=Ce-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 _r(xt(K)),K.errorTracker=new Ze(xt(K)),new He(xt(K)),K.seekingTracker=new Gu(xt(K)),K.playheadTime=new ct(xt(K)),K.playbackHeartbeat=new Rt(xt(K)),new Bu(xt(K)),K.watchTimeTracker=new gi(xt(K)),new ir(xt(K)),K.adTracker=new Pi(xt(K)),new vo(xt(K)),new xi(xt(K)),new an(xt(K)),new To(xt(K)),new No(xt(K)),$.hlsjs&&K.addHLSJS($),$.dashjs&&K.addDashJS($),K.emit("viewinit",$.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(Fe){G[Fe]=void 0}),G.video_source_url=G.video_source_url||G.player_source_url,G.video_source_url){var $=zi(Ge(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&&k(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,Fe=G.log,Te=G.utils.secondsToMs,Re=function(tt){var ue,he=parseInt(Z.version);return he===1&&tt.programDateTime!==null&&(ue=tt.programDateTime),he===0&&tt.pdt!==null&&(ue=tt.pdt),ue};if(re.exists()){var we=function(tt,ue){return G.emit($,tt,ue)},Ce=function(tt,ue){var he=ue.levels,fe=ue.audioTracks,Ue=ue.url,qe=ue.stats,Et=ue.networkDetails,ni=ue.sessionData,Ot={},Jt={};he.forEach(function(De,Sr){Ot[Sr]={width:De.width,height:De.height,bitrate:De.bitrate,attrs:De.attrs}}),fe.forEach(function(De,Sr){Jt[Sr]={name:De.name,language:De.lang,bitrate:De.bitrate}});var Nt=di(qe),Ft=Nt.bytesLoaded,Ni=Nt.requestStart,Da=Nt.responseStart,Ut=Nt.responseEnd;we("requestcompleted",it(it({},at(ni)),{},{request_event_type:tt,request_bytes_loaded:Ft,request_start:Ni,request_response_start:Da,request_response_end:Ut,request_type:"manifest",request_hostname:Be(Ue),request_response_headers:zt(Et),request_rendition_lists:{media:Ot,audio:Jt,video:{}}}))};K.on(Z.Events.MANIFEST_LOADED,Ce);var We=function(tt,ue){var he=ue.details,fe=ue.level,Ue=ue.networkDetails,qe=ue.stats,Et=di(qe),ni=Et.bytesLoaded,Ot=Et.requestStart,Jt=Et.responseStart,Nt=Et.responseEnd,Ft=he.fragments[he.fragments.length-1],Ni=Re(Ft)+Te(Ft.duration);we("requestcompleted",{request_event_type:tt,request_bytes_loaded:ni,request_start:Ot,request_response_start:Jt,request_response_end:Nt,request_current_level:fe,request_type:"manifest",request_hostname:Be(he.url),request_response_headers:zt(Ue),video_holdback:he.holdBack&&Te(he.holdBack),video_part_holdback:he.partHoldBack&&Te(he.partHoldBack),video_part_target_duration:he.partTarget&&Te(he.partTarget),video_target_duration:he.targetduration&&Te(he.targetduration),video_source_is_live:he.live,player_manifest_newest_program_time:isNaN(Ni)?void 0:Ni})};K.on(Z.Events.LEVEL_LOADED,We);var Pt=function(tt,ue){var he=ue.details,fe=ue.networkDetails,Ue=ue.stats,qe=di(Ue),Et=qe.bytesLoaded,ni=qe.requestStart,Ot=qe.responseStart,Jt=qe.responseEnd;we("requestcompleted",{request_event_type:tt,request_bytes_loaded:Et,request_start:ni,request_response_start:Ot,request_response_end:Jt,request_type:"manifest",request_hostname:Be(he.url),request_response_headers:zt(fe)})};K.on(Z.Events.AUDIO_TRACK_LOADED,Pt);var Vt=function(tt,ue){var he=ue.stats,fe=ue.networkDetails,Ue=ue.frag;he=he||Ue.stats;var qe=di(he),Et=qe.bytesLoaded,ni=qe.requestStart,Ot=qe.responseStart,Jt=qe.responseEnd,Nt=fe?zt(fe):void 0,Ft={request_event_type:tt,request_bytes_loaded:Et,request_start:ni,request_response_start:Ot,request_response_end:Jt,request_hostname:fe?Be(fe.responseURL):void 0,request_id:Nt?Xe(Nt):void 0,request_response_headers:Nt,request_media_duration:Ue.duration,request_url:fe==null?void 0:fe.responseURL};Ue.type==="main"?(Ft.request_type="media",Ft.request_current_level=Ue.level,Ft.request_video_width=(K.levels[Ue.level]||{}).width,Ft.request_video_height=(K.levels[Ue.level]||{}).height,Ft.request_labeled_bitrate=(K.levels[Ue.level]||{}).bitrate):Ft.request_type=Ue.type,we("requestcompleted",Ft)};K.on(Z.Events.FRAG_LOADED,Vt);var Zt=function(tt,ue){var he=ue.frag,fe=he.start,Ue={currentFragmentPDT:Re(he),currentFragmentStart:Te(fe)};we("fragmentchange",Ue)};K.on(Z.Events.FRAG_CHANGED,Zt);var hi=function(tt,ue){var he=ue.type,fe=ue.details,Ue=ue.response,qe=ue.fatal,Et=ue.frag,ni=ue.networkDetails,Ot=(Et==null?void 0:Et.url)||ue.url||"",Jt=ni?zt(ni):void 0;if(fe!==Z.ErrorDetails.MANIFEST_LOAD_ERROR&&fe!==Z.ErrorDetails.MANIFEST_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.FRAG_LOAD_ERROR&&fe!==Z.ErrorDetails.FRAG_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.LEVEL_LOAD_ERROR&&fe!==Z.ErrorDetails.LEVEL_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&fe!==Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.SUBTITLE_LOAD_ERROR&&fe!==Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.KEY_LOAD_ERROR&&fe!==Z.ErrorDetails.KEY_LOAD_TIMEOUT||we("requestfailed",{request_error:fe,request_url:Ot,request_hostname:Be(Ot),request_id:Jt?Xe(Jt):void 0,request_type:fe===Z.ErrorDetails.FRAG_LOAD_ERROR||fe===Z.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":fe===Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||fe===Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":fe===Z.ErrorDetails.SUBTITLE_LOAD_ERROR||fe===Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":fe===Z.ErrorDetails.KEY_LOAD_ERROR||fe===Z.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:Ue==null?void 0:Ue.code,request_error_text:Ue==null?void 0:Ue.text}),qe){var Nt,Ft="".concat(Ot?"url: ".concat(Ot,`
|
|
1
|
+
"use strict";(()=>{var Jg=Object.create;var If=Object.defineProperty;var eE=Object.getOwnPropertyDescriptor;var tE=Object.getOwnPropertyNames;var iE=Object.getPrototypeOf,rE=Object.prototype.hasOwnProperty;var Rf=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports);var aE=(n,r,o,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let v of tE(r))!rE.call(n,v)&&v!==o&&If(n,v,{get:()=>r[v],enumerable:!(m=eE(r,v))||m.enumerable});return n};var Df=(n,r,o)=>(o=n!=null?Jg(iE(n)):{},aE(r||!n||!n.__esModule?If(o,"default",{value:n,enumerable:!0}):o,n));var Iu=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)};var ot=(n,r,o)=>(Iu(n,r,"read from private field"),o?o.call(n):r.get(n)),Bt=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},Gi=(n,r,o,m)=>(Iu(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o);var Qt=(n,r,o)=>(Iu(n,r,"access private method"),o);var vp=Rf((sd,Vc)=>{(function(){var n,r;n=this,r=function(){return function(){var o={80:function(y,I,M){y.exports=M(728).default},728:function(y,I,M){"use strict";M.d(I,{default:function(){return qo}});var U=M(48),H=M.n(U),z=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)})},J=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||J()),T.muxId):T},le=function(T){var g;T&&T.nodeName!==void 0?T=ee(g=T):g=document.querySelector(T);var _=g&&g.nodeName?g.nodeName.toLowerCase():"";return[g,T,_]},me=M(640),_e=M.n(me),ge=_e().methodFactory;_e().methodFactory=function(T,g,_){var R=ge(T,g,_);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 ye=_e();function Ee(){return(H().doNotTrack||H().navigator&&H().navigator.doNotTrack)==="1"}var ue={now:function(){var T=H().performance,g=T&&T.timing,_=g&&g.navigationStart,R=typeof _=="number"&&typeof T.now=="function"?_+T.now():Date.now();return Math.round(R)}},Be=function(T){return Ge(T)[0]},Ge=function(T){if(typeof T!="string"||T==="")return["localhost"];var g,_=(T.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return _&&(g=(_.match(/[^\.]+\.[^\.]+$/)||[])[0]),[_,g]},re={exists:function(){var T=H().performance;return(T&&T.timing)!==void 0},domContentLoadedEventEnd:function(){var T=H().performance,g=T&&T.timing;return g&&g.domContentLoadedEventEnd},navigationStart:function(){var T=H().performance,g=T&&T.timing;return g&&g.navigationStart}};function k(T,g,_){_=_===void 0?1:_,T[g]=T[g]||0,T[g]+=_}var se=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],W=["x-cdn","content-type"].concat(se);function Se(T){var g={};return(T=T||"").trim().split(/[\r\n]+/).forEach(function(_){if(_){var R=_.split(": "),C=R.shift();C&&(W.indexOf(C.toLowerCase())>=0||C.toLowerCase().indexOf("x-litix-")===0)&&(g[C]=R.join(": "))}}),g}function Xe(T){if(T){var g=se.find(function(_){return T[_]!==void 0});return g?T[g]:void 0}}var at=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 jt(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 it(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?jt(Object(_),!0).forEach(function(R){B(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):jt(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function B(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var ui=function(T){if(!T)return{};var g=re.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)}},zt=function(T){if(T&&typeof T.getAllResponseHeaders=="function")return Se(T.getAllResponseHeaders())};function nt(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 ri(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?nt(Object(_),!0).forEach(function(R){$e(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):nt(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function $e(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var Gt=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=Be(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(),Fe=isNaN(C.duration)?0:C.duration,Te=typeof g.getMetricsFor=="function"?g.getMetricsFor(C.mediaType).HttpList:g.getDashMetrics().getHttpRequests(C.mediaType);return Te.length>0&&(R=Se(Te[Te.length-1]._responseHeaders||"")),{requestStart:$,requestResponseStart:K,requestResponseEnd:Z,requestBytesLoaded:G,requestResponseHeaders:R,requestMediaDuration:Fe,requestHostname:O,requestUrl:x,requestId:R?Xe(R):void 0}},Et=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}:{}},Ct=function(T){var g;return(g=T.match(/.*codecs\*?="(.*)"/))===null||g===void 0?void 0:g[1]};function tr(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 te=0,ke=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||++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(Fe,Te){(Fe=Fe.slice()).forEach(function(Re){Re.call(x,{type:C},Te)})};Z(G,O),Z($,O),Z(K,O)}}}],_&&tr(g.prototype,_),R&&tr(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}(),st=ke;function wt(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 Rt=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&&(H().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=H().setInterval(function(){C.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(H().clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}])&&wt(g.prototype,_),R&&wt(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)}}function $i(T,g,_){return g&&ci(T.prototype,g),_&&ci(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Ze=$i(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 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 gi=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),k(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}}])&&vi(g.prototype,_),R&&vi(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function ji(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 ir=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&&k(this.pm.data,"view_content_playback_time",O)}this._playbackTimeTrackerLastPlayheadPosition=C}},{key:"_clearPlaybackTimeState",value:function(){this._updatePlaybackTime(),this._playbackTimeTrackerLastPlayheadPosition=-1}}])&&ji(g.prototype,_),R&&ji(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function Ei(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 ct=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 $=this.pm.getPlayheadTime();$!==void 0&&(this.pm.data.player_playhead_time=$,G(),this._updateMaxPlayheadPosition())}}}])&&Ei(g.prototype,_),R&&Ei(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function rr(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 Er(T,g,_){return g&&rr(T.prototype,g),_&&rr(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var jr=3e5,xi=Er(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-_;k(g.data,"view_rebuffer_duration",x),_=O.viewer_time,g.data.view_rebuffer_duration>jr&&(g.emit("viewend"),g.send("viewend"),g.mux.log.warn("Ending view after rebuffering for longer than ".concat(jr,"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){_||(k(g.data,"view_rebuffer_count",1),_=x.viewer_time,g.one("rebufferend",R))}),g.on("viewinit",function(){_=void 0,g.off("rebufferend",R)})}});function yr(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 es=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,$=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()}}],_&&yr(g.prototype,_),R&&yr(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}(),vo=es;function ga(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 an=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 Fe=Z.viewer_time;K.type==="playing"&&C.data.view_time_to_first_frame===void 0?O.calculateTimeToFirstFrame(Fe||ue.now(),G):K.type!=="adplaying"||C.data.view_time_to_first_frame!==void 0&&!O._inPrerollPosition()||O.calculateTimeToFirstFrame(Fe||ue.now(),G)};C.one("playing",$),C.one("adplaying",$),C.one("viewend",function(){C.off("playing",$),C.off("adplaying",$)})}})}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))}}])&&ga(g.prototype,_),R&&ga(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function go(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 Eo(T,g,_){return g&&go(T.prototype,g),_&&go(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Bd=Eo(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),k(g.data,"view_total_content_playback_time",C),k(g.data,"view_total_upscaling",x*C),k(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 ts(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 Hd(T,g,_){return g&&ts(T.prototype,g),_&&ts(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Gd=Hd(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;k(g.data,"view_seek_count",1),k(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 yo(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=[],$=!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,g)||function(_,R){if(_){if(typeof _=="string")return bo(_,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)?bo(_,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 bo(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function _o(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 Ii=function(T,g){T.push(g),T.sort(function(_,R){return _.viewer_time-R.viewer_time})},Vd=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror"],Pi=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}),Vd.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++},$),Ii(O._adRequests,$),k(C.data,"view_ad_request_count"),O.inPrerollPosition()&&(C.data.view_preroll_requested=!0,O._adHasPlayed||k(C.data,"view_preroll_request_count"))}),C.on("adresponse",function(G,$){$=Object.assign({ad_request_id:"generatedAdRequestId"+O._currentAdResponseNumber++},$),Ii(O._adResponses,$);var K=O.findAdRequest($.ad_request_id);K&&k(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,k(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 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=yo(Ge(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=yo(Ge(O.ad_asset_url),2),Z=K[0],Fe=K[1];this.pm.data.view_preroll_ad_asset_domain=Fe,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}}])&&_o(g.prototype,_),R&&_o(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function Ea(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 Kd(T,g,_){return g&&Ea(T.prototype,g),_&&Ea(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var To=Kd(function T(g){var _,R;(function(G,$){if(!(G instanceof $))throw new TypeError("Cannot call a class as a function")})(this,T);var C=function(){g.disableRebufferTracking||_&&(k(g.data,"view_waiting_rebuffer_duration",ue.now()-_),_=!1,H().clearInterval(R))},O=!1,x=function(){O=!1,C()};g.on("waiting",function(){O&&(g.disableRebufferTracking||(k(g.data,"view_waiting_rebuffer_count",1),_=ue.now(),R=H().setInterval(function(){if(_){var G=ue.now();k(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 Mt(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 Ao(T,g,_){return g&&Mt(T.prototype,g),_&&Mt(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var He=Ao(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)})}),is=M(375),rs=M(655),Je=M.n(rs),So="muxData",as=function(){var T;try{T=is.parse(Je().get(So)||"")}catch{T={}}return T},ns=function(T){try{Je().set(So,is.stringify(T),{expires:7300})}catch{}},Wd=function(){var T=as();return T.mux_viewer_id=T.mux_viewer_id||z(),T.msn=T.msn||Math.random(),ns(T),{mux_viewer_id:T.mux_viewer_id,mux_sample_number:T.msn}};function br(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 ss=function(){var T;switch(ko()){case"cellular":T="cellular";break;case"ethernet":T="wired";break;case"wifi":T="wifi";break;case void 0:break;default:T="other"}return T},ko=function(){var T=H().navigator,g=T&&(T.connection||T.mozConnection||T.webkitConnection);return g&&g.type};ss.getConnectionFromAPI=ko;var wo=ss,Lo=ya({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"}),Io=ya({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 ya(T){var g={};for(var _ in T)T.hasOwnProperty(_)&&(g[T[_]]=_);return g}function ba(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=Lo[x];G||(ye.info("Data key word `"+O[0]+"` not expected in "+R),G=x+"_"),O.splice(1).forEach(function($){$==="url"&&(C=!0),Io[$]?G+=Io[$]:Number($)&&Math.floor(Number($))===Number($)?G+=$:(ye.info("Data key word `"+$+"` not expected in "+R),G+="_"+$+"_")}),C?_[G]=T[R]:g[G]=T[R]}}),Object.assign(g,_)}var Ro={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},Do=["hb","requestcompleted","requestfailed","requestcanceled"],ai="https://img.litix.io",Ri=function(T){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=T||ai,this._eventQueue=[],this._postInFlight=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},Ro,g)};Ri.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)},Ri.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())},Ri.prototype.destroy=function(){var T=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.destroyed=!0,T?this._clearBeaconQueue():this.flushEvents(),H().clearTimeout(this._sendTimeout)},Ri.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],ba({mux_view_message:"event queue truncated"}));var _=this._createPayload(g);Mo(this._beaconUrl,_,!0,function(){})},Ri.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();Mo(this._beaconUrl,_,!1,function(C,O){O?(T._eventQueue=g.concat(T._eventQueue),T._failureCount+=1,ye.info("Error sending beacon: "+O)):T._failureCount=0,T._roundTripTime=ue.now()-R,T._postInFlight=!1})}},Ri.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},Ri.prototype._startBeaconSending=function(){var T=this;H().clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=H().setTimeout(function(){T._eventQueue.length&&T._sendBeaconQueue(),T._startBeaconSending()},this._getNextBeaconTime()))},Ri.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()||(ye.info("Payload size is too big ("+R+" kb). Removing unnecessary events."),_=T.filter(function($){return Do.indexOf($.e)===-1}),x()),G()||(ye.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()),g};var Co=function(T){return T.length<=57344},Mo=function(T,g,_,R){if(_&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(T,g))R();else if(H().fetch)H().fetch(T,{method:"POST",body:g,headers:{"Content-Type":"text/plain"},keepalive:Co(g)}).then(function(O){return R(null,O.ok?null:"Error")}).catch(function(O){return R(null,O)});else{if(H().XMLHttpRequest){var C=new(H()).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()}},nn=Ri;function qd(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=[],$=!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,g)||function(_,R){if(_){if(typeof _=="string")return os(_,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)?os(_,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 os(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}function sn(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 _r(T){for(var g=1;g<arguments.length;g++){var _=arguments[g]!=null?arguments[g]:{};g%2?sn(Object(_),!0).forEach(function(R){on(T,R,_[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(T,Object.getOwnPropertyDescriptors(_)):sn(Object(_)).forEach(function(R){Object.defineProperty(T,R,Object.getOwnPropertyDescriptor(_,R))})}return T}function zr(T){return zr=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},zr(T)}function Yd(T,g){if(!(T instanceof g))throw new TypeError("Cannot call a class as a function")}function ls(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 on(T,g,_){return g in T?Object.defineProperty(T,g,{value:_,enumerable:!0,configurable:!0,writable:!0}):T[g]=_,T}var _a=["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"],xo=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse"],Po=["viewstart","error","ended","viewend"],$d=function(){function T(C,O){var x,G,$,K,Z,Fe,Te,Re,we,Ce,We,Pt,Vt,Zt,hi,Ve=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Yd(this,T),on(this,"previousBeaconData",null),on(this,"lastEventTime",0),on(this,"rateLimited",!1),this.mux=C,this.envKey=O,this.options=Ve,this.eventQueue=new nn(br(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=($=this.options.respectDoNotTrack)!==null&&$!==void 0&&$,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:(Fe=this.options.platform)===null||Fe===void 0?void 0:Fe.layout,viewer_device_name:(Te=this.options.platform)===null||Te===void 0?void 0:Te.product,viewer_device_category:"",viewer_device_manufacturer:(Re=this.options.platform)===null||Re===void 0?void 0:Re.manufacturer,viewer_os_family:(we=this.options.platform)===null||we===void 0||(Ce=we.os)===null||Ce===void 0?void 0:Ce.family,viewer_os_architecture:(We=this.options.platform)===null||We===void 0||(Pt=We.os)===null||Pt===void 0?void 0:Pt.architecture,viewer_os_version:(Vt=this.options.platform)===null||Vt===void 0||(Zt=Vt.os)===null||Zt===void 0?void 0:Zt.version,viewer_connection_type:wo(),page_url:H()===null||H()===void 0||(hi=H().location)===null||hi===void 0?void 0:hi.href},this.viewerData=this.disableCookies?{}:Wd()}var g,_,R;return g=T,(_=[{key:"send",value:function(C,O){var x;if(C&&O!=null&&O.view_id){if(this.respectDoNotTrack&&Ee())return ye.info("Not sending `"+C+"` because Do Not Track is enabled");if(!O||zr(O)!=="object")return ye.error("A data object was expected in send() but was not provided");var G,$,K=this.disableCookies?{}:(G=as(),$=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<$)&&(G.sid=z(),G.sst=$),G.sex=$+15e5,ns(G),{session_id:G.sid,session_start:G.sst,session_expires:G.sex}),Z=_r(_r(_r(_r(_r({},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 Fe=((x=Z.mux_sample_number)!==null&&x!==void 0?x:0)>=this.sampleRate,Te=ba(this._deduplicateBeaconData(C,Z));if(this.lastEventTime=this.mux.utils.now(),Fe)return ye.info("Not sending event due to sample rate restriction",C,Z,Te);if(this.envKey||ye.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",C,Z,Te),!this.rateLimited){if(ye.info("Sending event",C,Z,Te),this.rateLimited=!this.eventQueue.queueEvent(C,Te),this.mux.WINDOW_UNLOADING&&C==="viewend")this.eventQueue.destroy(!0);else if(this.mux.WINDOW_HIDDEN&&C==="hb"?this.eventQueue.flushEvents(!0):Po.indexOf(C)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return Z.event="eventrateexceeded",Te=ba(Z),this.eventQueue.queueEvent(Z.event,Te),ye.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={},$=O.view_id;if($==="-1"||C==="viewstart"||C==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)G=_r({},O),$&&(this.previousBeaconData=G),$&&C==="viewend"&&(this.previousBeaconData=null);else{var K=C.indexOf("request")===0;Object.entries(O).forEach(function(Z){var Fe=qd(Z,2),Te=Fe[0],Re=Fe[1];x.previousBeaconData&&(Re!==x.previousBeaconData[Te]||_a.indexOf(Te)>-1||x.objectHasChanged(K,Te,Re,x.previousBeaconData[Te])||x.eventRequiresKey(C,Te))&&(G[Te]=Re,x.previousBeaconData[Te]=Re)})}return G}},{key:"objectHasChanged",value:function(C,O,x,G){return!(!C||O.indexOf("request_")!==0||O!=="request_response_headers"&&zr(x)==="object"&&zr(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||!xo.includes(C))}}])&&ls(g.prototype,_),R&&ls(g,R),Object.defineProperty(g,"prototype",{writable:!1}),T}();function ds(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 Oo(T,g,_){return g&&ds(T.prototype,g),_&&ds(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var No=Oo(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,$=0;g.on("requestcompleted",function(K,Z){var Fe,Te,Re=Z.request_start,we=Z.request_response_start,Ce=Z.request_response_end,We=Z.request_bytes_loaded;if(O++,we?(Fe=we-(Re!=null?Re:0),Te=(Ce!=null?Ce:0)-we):Te=(Ce!=null?Ce:0)-(Re!=null?Re:0),Te>0&&We&&We>0){var Pt=We/Te*8e3;x++,R+=We,C+=Te,g.data.view_min_request_throughput=Math.min(g.data.view_min_request_throughput||1/0,Pt),g.data.view_average_request_throughput=R/C*8e3,g.data.view_request_count=O,Fe>0&&(_+=Fe,g.data.view_max_request_latency=Math.max(g.data.view_max_request_latency||0,Fe),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++,$++,g.data.view_request_count=O,g.data.view_request_canceled_count=$})});function us(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 Qr(T,g,_){return g&&us(T.prototype,g),_&&us(T,_),Object.defineProperty(T,"prototype",{writable:!1}),T}var Tr=Qr(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 $=Object.keys(g.data).reduce(function(K,Z){return Z.indexOf("video_")===0?Object.assign(K,function(Fe,Te,Re){return Te in Fe?Object.defineProperty(Fe,Te,{value:Re,enumerable:!0,configurable:!0,writable:!0}):Fe[Te]=Re,Fe}({},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},$)),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 yi(T){return yi=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},yi(T)}function zi(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=[],$=!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,g)||function(_,R){if(_){if(typeof _=="string")return rt(_,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)?rt(_,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 rt(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}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)}}function Oi(T,g){return Oi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(_,R){return _.__proto__=R,_},Oi(T,g)}function Fo(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=Ta(T);if(g){var C=Ta(this).constructor;_=Reflect.construct(R,arguments,C)}else _=R.apply(this,arguments);return cs(this,_)}}function cs(T,g){if(g&&(yi(g)==="object"||typeof g=="function"))return g;if(g!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xt(T)}function xt(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}function Ta(T){return Ta=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(g){return g.__proto__||Object.getPrototypeOf(g)},Ta(T)}var Uo=["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"],Xr=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&&Oi(x,G)})(O,T);var g,_,R,C=Fo(O);function O(x,G,$){var K;(function(we,Ce){if(!(we instanceof Ce))throw new TypeError("Cannot call a class as a function")})(this,O),(K=C.call(this)).DOM_CONTENT_LOADED_EVENT_END=re.domContentLoadedEventEnd(),K.NAVIGATION_START=re.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(we){return we}},$)).data=$.data||{},$.data.property_key&&($.data.env_key=$.data.property_key,delete $.data.property_key),ye.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 $d(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(we,Ce){Ce=Object.assign({viewer_time:this.mux.utils.now()},Ce),this.oldEmit(we,Ce)};var Z=function(){this.data.view_start===void 0&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}.bind(xt(K));K.on("viewinit",function(we,Ce){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,Ce),this._initializeViewData(),this.one("play",Z),this.one("adbreakstart",Z)});var Fe=function(we){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",we)}.bind(xt(K));if(K.on("videochange",function(we,Ce){Fe(Ce)}),K.on("programchange",function(we,Ce){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."),Fe(Object.assign(Ce,{view_program_changed:!0})),Z(),this.emit("play"),this.emit("playing")}),K.on("fragmentchange",function(we,Ce){this.currentFragmentPDT=Ce.currentFragmentPDT,this.currentFragmentStart=Ce.currentFragmentStart}),K.on("destroy",K.destroy),typeof window!="undefined"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var Te=function(){var we=K.data.view_start!==void 0;K.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",we&&K.mux.WINDOW_HIDDEN&&(K.data.player_is_paused||K.emit("hb"))};window.addEventListener("visibilitychange",Te,!1);var Re=function(we){we.persisted||K.destroy()};window.addEventListener("pagehide",Re,!1),K.on("destroy",function(){window.removeEventListener("visibilitychange",Te),window.removeEventListener("pagehide",Re)})}return K.on("playerready",function(we,Ce){Object.assign(this.data,Ce)}),Uo.forEach(function(we){K.on(we,function(Ce,We){we.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,We),this._sanitizeData()}),K.on("after"+we,function(){(we!=="error"||this.errorTracker.viewErrored)&&this.send(we)})}),K.on("viewend",function(we,Ce){Object.assign(K.data,Ce)}),K.one("playerready",function(we){var Ce=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=Ce-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 Tr(xt(K)),K.errorTracker=new Ze(xt(K)),new He(xt(K)),K.seekingTracker=new Gd(xt(K)),K.playheadTime=new ct(xt(K)),K.playbackHeartbeat=new Rt(xt(K)),new Bd(xt(K)),K.watchTimeTracker=new gi(xt(K)),new ir(xt(K)),K.adTracker=new Pi(xt(K)),new vo(xt(K)),new xi(xt(K)),new an(xt(K)),new To(xt(K)),new No(xt(K)),$.hlsjs&&K.addHLSJS($),$.dashjs&&K.addDashJS($),K.emit("viewinit",$.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(Fe){G[Fe]=void 0}),G.video_source_url=G.video_source_url||G.player_source_url,G.video_source_url){var $=zi(Ge(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&&k(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,Fe=G.log,Te=G.utils.secondsToMs,Re=function(tt){var de,he=parseInt(Z.version);return he===1&&tt.programDateTime!==null&&(de=tt.programDateTime),he===0&&tt.pdt!==null&&(de=tt.pdt),de};if(re.exists()){var we=function(tt,de){return G.emit($,tt,de)},Ce=function(tt,de){var he=de.levels,fe=de.audioTracks,Ue=de.url,qe=de.stats,yt=de.networkDetails,ni=de.sessionData,Ot={},Jt={};he.forEach(function(De,kr){Ot[kr]={width:De.width,height:De.height,bitrate:De.bitrate,attrs:De.attrs}}),fe.forEach(function(De,kr){Jt[kr]={name:De.name,language:De.lang,bitrate:De.bitrate}});var Nt=ui(qe),Ft=Nt.bytesLoaded,Ni=Nt.requestStart,Da=Nt.responseStart,Ut=Nt.responseEnd;we("requestcompleted",it(it({},at(ni)),{},{request_event_type:tt,request_bytes_loaded:Ft,request_start:Ni,request_response_start:Da,request_response_end:Ut,request_type:"manifest",request_hostname:Be(Ue),request_response_headers:zt(yt),request_rendition_lists:{media:Ot,audio:Jt,video:{}}}))};K.on(Z.Events.MANIFEST_LOADED,Ce);var We=function(tt,de){var he=de.details,fe=de.level,Ue=de.networkDetails,qe=de.stats,yt=ui(qe),ni=yt.bytesLoaded,Ot=yt.requestStart,Jt=yt.responseStart,Nt=yt.responseEnd,Ft=he.fragments[he.fragments.length-1],Ni=Re(Ft)+Te(Ft.duration);we("requestcompleted",{request_event_type:tt,request_bytes_loaded:ni,request_start:Ot,request_response_start:Jt,request_response_end:Nt,request_current_level:fe,request_type:"manifest",request_hostname:Be(he.url),request_response_headers:zt(Ue),video_holdback:he.holdBack&&Te(he.holdBack),video_part_holdback:he.partHoldBack&&Te(he.partHoldBack),video_part_target_duration:he.partTarget&&Te(he.partTarget),video_target_duration:he.targetduration&&Te(he.targetduration),video_source_is_live:he.live,player_manifest_newest_program_time:isNaN(Ni)?void 0:Ni})};K.on(Z.Events.LEVEL_LOADED,We);var Pt=function(tt,de){var he=de.details,fe=de.networkDetails,Ue=de.stats,qe=ui(Ue),yt=qe.bytesLoaded,ni=qe.requestStart,Ot=qe.responseStart,Jt=qe.responseEnd;we("requestcompleted",{request_event_type:tt,request_bytes_loaded:yt,request_start:ni,request_response_start:Ot,request_response_end:Jt,request_type:"manifest",request_hostname:Be(he.url),request_response_headers:zt(fe)})};K.on(Z.Events.AUDIO_TRACK_LOADED,Pt);var Vt=function(tt,de){var he=de.stats,fe=de.networkDetails,Ue=de.frag;he=he||Ue.stats;var qe=ui(he),yt=qe.bytesLoaded,ni=qe.requestStart,Ot=qe.responseStart,Jt=qe.responseEnd,Nt=fe?zt(fe):void 0,Ft={request_event_type:tt,request_bytes_loaded:yt,request_start:ni,request_response_start:Ot,request_response_end:Jt,request_hostname:fe?Be(fe.responseURL):void 0,request_id:Nt?Xe(Nt):void 0,request_response_headers:Nt,request_media_duration:Ue.duration,request_url:fe==null?void 0:fe.responseURL};Ue.type==="main"?(Ft.request_type="media",Ft.request_current_level=Ue.level,Ft.request_video_width=(K.levels[Ue.level]||{}).width,Ft.request_video_height=(K.levels[Ue.level]||{}).height,Ft.request_labeled_bitrate=(K.levels[Ue.level]||{}).bitrate):Ft.request_type=Ue.type,we("requestcompleted",Ft)};K.on(Z.Events.FRAG_LOADED,Vt);var Zt=function(tt,de){var he=de.frag,fe=he.start,Ue={currentFragmentPDT:Re(he),currentFragmentStart:Te(fe)};we("fragmentchange",Ue)};K.on(Z.Events.FRAG_CHANGED,Zt);var hi=function(tt,de){var he=de.type,fe=de.details,Ue=de.response,qe=de.fatal,yt=de.frag,ni=de.networkDetails,Ot=(yt==null?void 0:yt.url)||de.url||"",Jt=ni?zt(ni):void 0;if(fe!==Z.ErrorDetails.MANIFEST_LOAD_ERROR&&fe!==Z.ErrorDetails.MANIFEST_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.FRAG_LOAD_ERROR&&fe!==Z.ErrorDetails.FRAG_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.LEVEL_LOAD_ERROR&&fe!==Z.ErrorDetails.LEVEL_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&fe!==Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.SUBTITLE_LOAD_ERROR&&fe!==Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT&&fe!==Z.ErrorDetails.KEY_LOAD_ERROR&&fe!==Z.ErrorDetails.KEY_LOAD_TIMEOUT||we("requestfailed",{request_error:fe,request_url:Ot,request_hostname:Be(Ot),request_id:Jt?Xe(Jt):void 0,request_type:fe===Z.ErrorDetails.FRAG_LOAD_ERROR||fe===Z.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":fe===Z.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||fe===Z.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":fe===Z.ErrorDetails.SUBTITLE_LOAD_ERROR||fe===Z.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":fe===Z.ErrorDetails.KEY_LOAD_ERROR||fe===Z.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:Ue==null?void 0:Ue.code,request_error_text:Ue==null?void 0:Ue.text}),qe){var Nt,Ft="".concat(Ot?"url: ".concat(Ot,`
|
|
5
5
|
`):"")+"".concat(Ue&&(Ue.code||Ue.text)?"response: ".concat(Ue.code,", ").concat(Ue.text,`
|
|
6
|
-
`):"")+"".concat(
|
|
7
|
-
`):"")+"".concat(
|
|
8
|
-
`):"")+"".concat(
|
|
9
|
-
`):"")+"".concat(
|
|
10
|
-
`):"")+"".concat(
|
|
11
|
-
`):"")+"".concat(
|
|
12
|
-
`):"")+"".concat(
|
|
13
|
-
`):"");we("error",{player_error_code:he,player_error_message:fe,player_error_context:Ft})}};K.on(Z.Events.ERROR,hi);var Ve=function(tt,
|
|
6
|
+
`):"")+"".concat(de.reason?"failure reason: ".concat(de.reason,`
|
|
7
|
+
`):"")+"".concat(de.level?"level: ".concat(de.level,`
|
|
8
|
+
`):"")+"".concat(de.parent?"parent stream controller: ".concat(de.parent,`
|
|
9
|
+
`):"")+"".concat(de.buffer?"buffer length: ".concat(de.buffer,`
|
|
10
|
+
`):"")+"".concat(de.error?"error: ".concat(de.error,`
|
|
11
|
+
`):"")+"".concat(de.event?"event: ".concat(de.event,`
|
|
12
|
+
`):"")+"".concat(de.err?"error message: ".concat((Nt=de.err)===null||Nt===void 0?void 0:Nt.message,`
|
|
13
|
+
`):"");we("error",{player_error_code:he,player_error_message:fe,player_error_context:Ft})}};K.on(Z.Events.ERROR,hi);var Ve=function(tt,de){var he=de.frag,fe=he&&he._url||"";we("requestcanceled",{request_event_type:tt,request_url:fe,request_type:"media",request_hostname:Be(fe)})};K.on(Z.Events.FRAG_LOAD_EMERGENCY_ABORTED,Ve);var At=function(tt,de){var he=de.level,fe=K.levels[he];if(fe&&fe.attrs&&fe.attrs.BANDWIDTH){var Ue,qe=fe.attrs.BANDWIDTH,yt=parseFloat(fe.attrs["FRAME-RATE"]);isNaN(yt)||(Ue=yt),qe?we("renditionchange",{video_source_fps:Ue,video_source_bitrate:qe,video_source_width:fe.width,video_source_height:fe.height,video_source_rendition_name:fe.name,video_source_codec:fe==null?void 0:fe.videoCodec}):Fe.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};K.on(Z.Events.LEVEL_SWITCHED,At),K._stopMuxMonitor=function(){K.off(Z.Events.MANIFEST_LOADED,Ce),K.off(Z.Events.LEVEL_LOADED,We),K.off(Z.Events.AUDIO_TRACK_LOADED,Pt),K.off(Z.Events.FRAG_LOADED,Vt),K.off(Z.Events.FRAG_CHANGED,Zt),K.off(Z.Events.ERROR,hi),K.off(Z.Events.FRAG_LOAD_EMERGENCY_ABORTED,Ve),K.off(Z.Events.LEVEL_SWITCHED,At),K.off(Z.Events.DESTROYING,K._stopMuxMonitor),delete K._stopMuxMonitor},K.on(Z.Events.DESTROYING,K._stopMuxMonitor)}else Fe.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,$,K){var Z=G.log;if(K&&K.on){var Fe=function(Ve,At){return G.emit($,Ve,At)},Te=function(Ve){var At=Ve.type,tt=(Ve.data||{}).url;Fe("requestcompleted",{request_event_type:At,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:Be(tt),request_url:tt})};K.on("manifestLoaded",Te);var Re={},we=function(Ve){var At=Ve.type,tt=Ve.fragmentModel,de=(Ve.chunk||{}).mediaInfo||{},he=de.type,fe=de.bitrateList,Ue={};(fe=fe||[]).forEach(function(Ut,De){Ue[De]={},Ue[De].width=Ut.width,Ue[De].height=Ut.height,Ue[De].bitrate=Ut.bandwidth,Ue[De].attrs={}}),he==="video"?Re.video=Ue:he==="audio"?Re.audio=Ue:Re.media=Ue;var qe=Gt(tt,K),yt=qe.requestStart,ni=qe.requestResponseStart,Ot=qe.requestResponseEnd,Jt=qe.requestResponseHeaders,Nt=qe.requestMediaDuration,Ft=qe.requestHostname,Ni=qe.requestUrl,Da=qe.requestId;Fe("requestcompleted",{request_event_type:At,request_start:yt,request_response_start:ni,request_response_end:Ot,request_bytes_loaded:-1,request_type:he+"_init",request_response_headers:Jt,request_hostname:Ft,request_id:Da,request_url:Ni,request_media_duration:Nt,request_rendition_lists:Re})};K.on("initFragmentLoaded",we);var Ce=function(Ve){var At=Ve.type,tt=Ve.fragmentModel,de=Ve.chunk||{},he=de.mediaInfo,fe=de.start,Ue=(he||{}).type,qe=Gt(tt,K),yt=qe.requestStart,ni=qe.requestResponseStart,Ot=qe.requestResponseEnd,Jt=qe.requestBytesLoaded,Nt=qe.requestResponseHeaders,Ft=qe.requestMediaDuration,Ni=qe.requestHostname,Da=qe.requestUrl,Ut=qe.requestId,De=Et(Ue,K),kr=De.currentLevel,Zr=De.renditionWidth,Jr=De.renditionHeight,Ca=De.renditionBitrate;Fe("requestcompleted",{request_event_type:At,request_start:yt,request_response_start:ni,request_response_end:Ot,request_bytes_loaded:Jt,request_type:Ue,request_response_headers:Nt,request_hostname:Ni,request_id:Ut,request_url:Da,request_media_start_time:fe,request_media_duration:Ft,request_current_level:kr,request_labeled_bitrate:Ca,request_video_width:Zr,request_video_height:Jr})};K.on("mediaFragmentLoaded",Ce);var We={video:void 0,audio:void 0,totalBitrate:void 0},Pt=function(){if(We.video&&typeof We.video.bitrate=="number"){if(We.video.width&&We.video.height){var Ve=We.video.bitrate;return We.audio&&typeof We.audio.bitrate=="number"&&(Ve+=We.audio.bitrate),Ve!==We.totalBitrate?(We.totalBitrate=Ve,{video_source_bitrate:Ve,video_source_height:We.video.height,video_source_width:We.video.width,video_source_codec:Ct(We.video.codec)}):void 0}Z.warn("have bitrate info for video but missing width/height")}},Vt=function(Ve,At,tt){if(typeof Ve.newQuality=="number"){var de=Ve.mediaType;if(de==="audio"||de==="video"){var he=K.getBitrateInfoListFor(de).find(function(Ue){return Ue.qualityIndex===Ve.newQuality});if(he&&typeof he.bitrate=="number"){We[de]=ri(ri({},he),{},{codec:K.getCurrentTrackFor(de).codec});var fe=Pt();fe&&Fe("renditionchange",fe)}else Z.warn("missing bitrate info for ".concat(de))}}else Z.warn("missing evt.newQuality in qualityChangeRendered event",Ve)};K.on("qualityChangeRendered",Vt);var Zt=function(Ve){var At=Ve.request,tt=Ve.mediaType;Fe("requestcanceled",{request_event_type:(At=At||{}).type+"_"+At.action,request_url:At.url,request_type:tt,request_hostname:Be(At.url)})};K.on("fragmentLoadingAbandoned",Zt);var hi=function(Ve){var At,tt,de=Ve.error,he=(de==null||(At=de.data)===null||At===void 0?void 0:At.request)||{},fe=(de==null||(tt=de.data)===null||tt===void 0?void 0:tt.response)||{};(de==null?void 0:de.code)===27&&Fe("requestfailed",{request_error:he.type+"_"+he.action,request_url:he.url,request_hostname:Be(he.url),request_type:he.mediaType,request_error_code:fe.status,request_error_text:fe.statusText});var Ue="".concat(he!=null&&he.url?"url: ".concat(he.url,`
|
|
14
14
|
`):"")+"".concat(fe!=null&&fe.status||fe!=null&&fe.statusText?"response: ".concat(fe==null?void 0:fe.status,", ").concat(fe==null?void 0:fe.statusText,`
|
|
15
|
-
`):"");Fe("error",{player_error_code:
|
|
16
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ka(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}var ar,
|
|
15
|
+
`):"");Fe("error",{player_error_code:de==null?void 0:de.code,player_error_message:de==null?void 0:de.message,player_error_context:Ue})};K.on("error",hi),K._stopMuxMonitor=function(){K.off("manifestLoaded",Te),K.off("initFragmentLoaded",we),K.off("mediaFragmentLoaded",Ce),K.off("qualityChangeRendered",Vt),K.off("error",hi),K.off("fragmentLoadingAbandoned",Zt),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)}}],_&&Di(g.prototype,_),R&&Di(g,R),Object.defineProperty(g,"prototype",{writable:!1}),O}(st),hs=Xr,Aa=M(153),Sa=M.n(Aa);function Ar(T){return Ar=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},Ar(T)}function ln(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=[],$=!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,g)||function(_,R){if(_){if(typeof _=="string")return ka(_,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)?ka(_,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 ka(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}var ar,jd=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],zd={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};H()&&H().WeakMap&&(ar=new WeakMap);var fs="#EXT-X-TARGETDURATION",ms="#EXT-X-PART-INF",Qd="#EXT-X-SERVER-CONTROL",Xd="#EXTINF",Bo="#EXT-X-PROGRAM-DATE-TIME",wa="#EXT-X-VERSION",ps="#EXT-X-SESSION-DATA",La=function(T){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(T),this.manifest};La.prototype.process=function(T){var g;for(this.buffer+=T,g=this.buffer.indexOf(`
|
|
17
17
|
`);g>-1;g=this.buffer.indexOf(`
|
|
18
|
-
`))this.processLine(this.buffer.substring(0,g)),this.buffer=this.buffer.substring(g+1)},La.prototype.processLine=function(T){var g=T.indexOf(":"),_=Vo(T,g),R=_[0],C=_.length===2?Ia(_[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 fs:if(!isFinite(C)||C<0)return;this.manifest.targetDuration=C,this.setHoldBack();break;case ms:vs(this.manifest,_),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case
|
|
19
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function cn(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}var bi={},Ar=function T(g){var _=arguments;typeof g=="string"?T.hasOwnProperty(g)?H().setTimeout(function(){_=Array.prototype.splice.call(_,1),T[g].apply(null,_)},0):ye.warn("`"+g+"` is an unknown task"):typeof g=="function"?H().setTimeout(function(){g(T)},0):ye.warn("`"+g+"` is invalid.")},Zu={loaded:de.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=ln(le(R),3),x=O[0],G=O[1],$=O[2],K=_.log,Z=_.utils.getComputedStyle,Fe=_.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 Fe(x.currentTime)},C.getStateData=function(){var Re,we,Ce=this.hlsjs&&this.hlsjs.url,We=this.dashjs&&Tr(this.dashjs.getSource==="function")&&this.dashjs.getSource(),Pt={player_is_paused:x.paused,player_playhead_time:Fe(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:Sa()&&!!(Sa().fullscreenElement||Sa().webkitFullscreenElement||Sa().mozFullScreenElement||Sa().msFullscreenElement),video_poster_url:x.poster,video_source_url:Ce||We||x.currentSrc,video_source_duration:Fe(x.duration),video_source_height:x.videoHeight,video_source_width:x.videoWidth,view_dropped_frame_count:(Re=x)===null||Re===void 0||(we=Re.getVideoPlaybackQuality)===null||we===void 0?void 0:we.call(Re).droppedVideoFrames},Vt=C.getPlayheadTime();if(x.getStartDate&&Vt>0){var Zt=x.getStartDate();if(Zt&&typeof Zt.getTime=="function"&&Zt.getTime()){var hi=Zt.getTime();if(Pt.player_program_time=hi+Vt,x.seekable.length>0){var Ve=hi+x.seekable.end(x.seekable.length-1);Pt.player_live_edge_program_time=Ve}}}return Pt},x.mux=x.mux||{},x.mux.deleted=!1,x.mux.emit=function(Re,we){_.emit(G,Re,we)};var Te=function(){K.error("The monitor for this video element has already been destroyed.")};x.mux.destroy=function(){Object.keys(x.mux.listeners).forEach(function(Re){x.removeEventListener(Re,x.mux.listeners[Re],!1)}),delete x.mux.listeners,x.mux.destroy=Te,x.mux.swapElement=Te,x.mux.emit=Te,x.mux.addHLSJS=Te,x.mux.addDashJS=Te,x.mux.removeHLSJS=Te,x.mux.removeDashJS=Te,x.mux.deleted=!0,_.emit(G,"destroy")},x.mux.swapElement=function(Re){var we=ln(le(Re),3),Ce=we[0],We=we[1],Pt=we[2];return Ce?Pt!=="video"&&Pt!=="audio"?_.log.error("The element of `"+We+"` was not a media element."):(Ce.muxId=x.muxId,delete x.muxId,Ce.mux=Ce.mux||{},Ce.mux.listeners=Object.assign({},x.mux.listeners),delete x.mux.listeners,Object.keys(Ce.mux.listeners).forEach(function(Vt){x.removeEventListener(Vt,Ce.mux.listeners[Vt],!1),Ce.addEventListener(Vt,Ce.mux.listeners[Vt],!1)}),Ce.mux.swapElement=x.mux.swapElement,Ce.mux.destroy=x.mux.destroy,delete x.mux,void(x=Ce)):_.log.error("No element was found with the `"+We+"` query selector.")},x.mux.addHLSJS=function(Re){_.addHLSJS(G,Re)},x.mux.addDashJS=function(Re){_.addDashJS(G,Re)},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={},ju.forEach(function(Re){(Re!=="error"||C.automaticErrorTracking)&&(x.mux.listeners[Re]=function(){var we={};if(Re==="error"){if(!x.error||x.error.code===1)return;we.player_error_code=x.error.code,we.player_error_message=zu[x.error.code]||x.error.message}_.emit(G,Re,we)},x.addEventListener(Re,x.mux.listeners[Re],!1))})}(Ar,T,g)},destroyMonitor:function(T){var g=Ra(le(T),1)[0];g&&g.mux&&typeof g.mux.destroy=="function"?g.mux.destroy():ye.error("A video element monitor for `"+T+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(T,g){var _=ee(T);bi[_]?bi[_].addHLSJS(g):ye.error("A monitor for `"+_+"` has not been initialized.")},addDashJS:function(T,g){var _=ee(T);bi[_]?bi[_].addDashJS(g):ye.error("A monitor for `"+_+"` has not been initialized.")},removeHLSJS:function(T){var g=ee(T);bi[g]?bi[g].removeHLSJS():ye.error("A monitor for `"+g+"` has not been initialized.")},removeDashJS:function(T){var g=ee(T);bi[g]?bi[g].removeDashJS():ye.error("A monitor for `"+g+"` has not been initialized.")},init:function(T,g){Ee()&&g&&g.respectDoNotTrack&&ye.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var _=ee(T);bi[_]=new hs(Ar,_,g)},emit:function(T,g,_){var R=ee(T);bi[R]?(bi[R].emit(g,_),g==="destroy"&&delete bi[R]):ye.error("A monitor for `"+R+"` has not been initialized.")},checkDoNotTrack:Ee,log:ye,utils:dn,events:Wo,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Ar,Zu),H()!==void 0&&typeof H().addEventListener=="function"&&H().addEventListener("pagehide",function(T){T.persisted||(Ar.WINDOW_UNLOADING=!0)},!1);var qo=Ar},655:function(y,I,M){var B,H;function z(J){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(J);}(function(J){var ee=!1;if((H=typeof(B=J)=="function"?B.call(I,M,I,y):B)===void 0||(y.exports=H),ee=!0,z(I)==="object"&&(y.exports=J(),ee=!0),!ee){var le=window.Cookies,me=window.Cookies=J();me.noConflict=function(){return window.Cookies=le,me}}})(function(){var J=function(){for(var ee=0,le={};ee<arguments.length;ee++){var me=arguments[ee];for(var _e in me)le[_e]=me[_e]}return le};return function ee(le){function me(_e,ge,ye){var Ee;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(ye=J({path:"/"},me.defaults,ye)).expires=="number"){var de=new Date;de.setMilliseconds(de.getMilliseconds()+864e5*ye.expires),ye.expires=de}try{Ee=JSON.stringify(ge),/^[\{\[]/.test(Ee)&&(ge=Ee)}catch{}return ge=le.write?le.write(ge,_e):encodeURIComponent(String(ge)).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,"=",ge,ye.expires?"; expires="+ye.expires.toUTCString():"",ye.path?"; path="+ye.path:"",ye.domain?"; domain="+ye.domain:"",ye.secure?"; secure":""].join("")}_e||(Ee={});for(var Be=document.cookie?document.cookie.split("; "):[],Ge=/(%[0-9A-Z]{2})+/g,re=0;re<Be.length;re++){var k=Be[re].split("="),se=k.slice(1).join("=");se.charAt(0)==='"'&&(se=se.slice(1,-1));try{var W=k[0].replace(Ge,decodeURIComponent);if(se=le.read?le.read(se,W):le(se,W)||se.replace(Ge,decodeURIComponent),this.json)try{se=JSON.parse(se)}catch{}if(_e===W){Ee=se;break}_e||(Ee[W]=se)}catch{}}return Ee}}return me.set=me,me.get=function(_e){return me.call(me,_e)},me.getJSON=function(){return me.apply({json:!0},[].slice.call(arguments))},me.defaults={},me.remove=function(_e,ge){me(_e,"",J(ge,{expires:-1}))},me.withConverter=ee,me}(function(){})})},153:function(y,I,M){var B,H=M.g!==void 0?M.g:typeof window!="undefined"?window:{},z=M(558);typeof document!="undefined"?B=document:(B=H["__GLOBAL_DOCUMENT_CACHE@4"])||(B=H["__GLOBAL_DOCUMENT_CACHE@4"]=z),y.exports=B},48:function(y,I,M){var B;B=typeof window!="undefined"?window:M.g!==void 0?M.g:typeof self!="undefined"?self:{},y.exports=B},640:function(y,I,M){var B,H;(function(z,J){"use strict";B=function(){var ee=function(){},le="undefined",me=typeof window!==le&&typeof window.navigator!==le&&/Trident\/|MSIE /.test(window.navigator.userAgent),_e=["trace","debug","info","warn","error"];function ge(Se,Xe){var at=Se[Xe];if(typeof at.bind=="function")return at.bind(Se);try{return Function.prototype.bind.call(at,Se)}catch{return function(){return Function.prototype.apply.apply(at,[Se,arguments])}}}function ye(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function Ee(Se){return Se==="debug"&&(Se="log"),typeof console!==le&&(Se==="trace"&&me?ye:console[Se]!==void 0?ge(console,Se):console.log!==void 0?ge(console,"log"):ee)}function de(Se,Xe){for(var at=0;at<_e.length;at++){var jt=_e[at];this[jt]=at<Se?ee:this.methodFactory(jt,Se,Xe)}this.log=this.debug}function Be(Se,Xe,at){return function(){typeof console!==le&&(de.call(this,Xe,at),this[Se].apply(this,arguments))}}function Ge(Se,Xe,at){return Ee(Se)||Be.apply(this,arguments)}function re(Se,Xe,at){var jt,it=this;Xe=Xe==null?"WARN":Xe;var U="loglevel";function di($e){var Gt=(_e[$e]||"silent").toUpperCase();if(typeof window!==le&&U){try{return void(window.localStorage[U]=Gt)}catch{}try{window.document.cookie=encodeURIComponent(U)+"="+Gt+";"}catch{}}}function zt(){var $e;if(typeof window!==le&&U){try{$e=window.localStorage[U]}catch{}if(typeof $e===le)try{var Gt=window.document.cookie,gt=Gt.indexOf(encodeURIComponent(U)+"=");gt!==-1&&($e=/^([^;]+)/.exec(Gt.slice(gt))[1])}catch{}return it.levels[$e]===void 0&&($e=void 0),$e}}function nt(){if(typeof window!==le&&U){try{return void window.localStorage.removeItem(U)}catch{}try{window.document.cookie=encodeURIComponent(U)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof Se=="string"?U+=":"+Se:typeof Se=="symbol"&&(U=void 0),it.name=Se,it.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},it.methodFactory=at||Ge,it.getLevel=function(){return jt},it.setLevel=function($e,Gt){if(typeof $e=="string"&&it.levels[$e.toUpperCase()]!==void 0&&($e=it.levels[$e.toUpperCase()]),!(typeof $e=="number"&&$e>=0&&$e<=it.levels.SILENT))throw"log.setLevel() called with invalid level: "+$e;if(jt=$e,Gt!==!1&&di($e),de.call(it,$e,Se),typeof console===le&&$e<it.levels.SILENT)return"No console available for logging"},it.setDefaultLevel=function($e){Xe=$e,zt()||it.setLevel($e,!1)},it.resetLevel=function(){it.setLevel(Xe,!1),nt()},it.enableAll=function($e){it.setLevel(it.levels.TRACE,$e)},it.disableAll=function($e){it.setLevel(it.levels.SILENT,$e)};var ri=zt();ri==null&&(ri=Xe),it.setLevel(ri,!1)}var k=new re,se={};k.getLogger=function(Se){if(typeof Se!="symbol"&&typeof Se!="string"||Se==="")throw new TypeError("You must supply a name when creating a logger.");var Xe=se[Se];return Xe||(Xe=se[Se]=new re(Se,k.getLevel(),k.methodFactory)),Xe};var W=typeof window!==le?window.log:void 0;return k.noConflict=function(){return typeof window!==le&&window.log===k&&(window.log=W),k},k.getLoggers=function(){return se},k.default=k,k},(H=typeof B=="function"?B.call(I,M,I,y):B)===void 0||(y.exports=H)})()},375:function(y,I){"use strict";var M=Object.prototype.hasOwnProperty;function B(z){try{return decodeURIComponent(z.replace(/\+/g," "))}catch{return null}}function H(z){try{return encodeURIComponent(z)}catch{return null}}I.stringify=function(z,J){J=J||"";var ee,le,me=[];for(le in typeof J!="string"&&(J="?"),z)if(M.call(z,le)){if((ee=z[le])||ee!=null&&!isNaN(ee)||(ee=""),le=H(le),ee=H(ee),le===null||ee===null)continue;me.push(le+"="+ee)}return me.length?J+me.join("&"):""},I.parse=function(z){for(var J,ee=/([^=?#&]+)=?([^&]*)/g,le={};J=ee.exec(z);){var me=B(J[1]),_e=B(J[2]);me===null||_e===null||me in le||(le[me]=_e)}return le}},558:function(){}},m={};function v(y){var I=m[y];if(I!==void 0)return I.exports;var M=m[y]={exports:{}};return l[y].call(M.exports,M,M.exports,v),M.exports}return v.n=function(y){var I=y&&y.__esModule?function(){return y.default}:function(){return y};return v.d(I,{a:I}),I},v.d=function(y,I){for(var M in I)v.o(I,M)&&!v.o(y,M)&&Object.defineProperty(y,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(y,I){return Object.prototype.hasOwnProperty.call(y,I)},v(80)}()},typeof su=="object"&&typeof Vc=="object"?Vc.exports=r():typeof su=="object"?su.mux=r():n.mux=r()})()});var gp=If((vp,Kc)=>{(function n(r){var l,m;l=this,m=function(){"use strict";function v(u,s){var e=Object.keys(u);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(u);s&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(u,i).enumerable})),e.push.apply(e,t)}return e}function y(u){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(u,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(e)):v(Object(e)).forEach(function(t){Object.defineProperty(u,t,Object.getOwnPropertyDescriptor(e,t))})}return u}function I(u,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(u,Ee(t.key),t)}}function M(u,s,e){return s&&I(u.prototype,s),e&&I(u,e),Object.defineProperty(u,"prototype",{writable:!1}),u}function B(u,s,e){return(s=Ee(s))in u?Object.defineProperty(u,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):u[s]=e,u}function H(){return H=Object.assign?Object.assign.bind():function(u){for(var s=1;s<arguments.length;s++){var e=arguments[s];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(u[t]=e[t])}return u},H.apply(this,arguments)}function z(u,s){u.prototype=Object.create(s.prototype),u.prototype.constructor=u,ee(u,s)}function J(u){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},J(u)}function ee(u,s){return ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ee(u,s)}function le(){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 me(u,s,e){return me=le()?Reflect.construct.bind():function(t,i,a){var o=[null];o.push.apply(o,i);var d=new(Function.bind.apply(t,o));return a&&ee(d,a.prototype),d},me.apply(null,arguments)}function _e(u){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 me(e,arguments,J(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ee(i,e)},_e(u)}function ge(u,s){(s==null||s>u.length)&&(s=u.length);for(var e=0,t=new Array(s);e<s;e++)t[e]=u[e];return t}function ye(u,s){var e=typeof Symbol!="undefined"&&u[Symbol.iterator]||u["@@iterator"];if(e)return(e=e.call(u)).next.bind(e);if(Array.isArray(u)||(e=function(i,a){if(i){if(typeof i=="string")return ge(i,a);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)?ge(i,a):void 0}}(u))||s&&u&&typeof u.length=="number"){e&&(u=e);var t=0;return function(){return t>=u.length?{done:!0}:{done:!1,value:u[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 Ee(u){var s=function(e,t){if(typeof e!="object"||e===null)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var a=i.call(e,t||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}(u,"string");return typeof s=="symbol"?s:String(s)}function de(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var Be={exports:{}};(function(u,s){var e,t,i,a,o;e=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,t=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(d,c,f){if(f=f||{},d=d.trim(),!(c=c.trim())){if(!f.alwaysNormalize)return d;var h=o.parseURL(d);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 E=o.parseURL(d);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 w=E.path,D=w.substring(0,w.lastIndexOf("/")+1)+p.path;A.path=o.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?o.normalizePath(p.path):p.path),o.buildURLFromParts(A)},parseURL:function(d){var c=e.exec(d);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(d){for(d=d.split("").reverse().join("").replace(i,"");d.length!==(d=d.replace(a,"")).length;);return d.split("").reverse().join("")},buildURLFromParts:function(d){return d.scheme+d.netLoc+d.path+d.params+d.query+d.fragment}},u.exports=o})(Be);var Ge=Be.exports,re=Number.isFinite||function(u){return typeof u=="number"&&isFinite(u)},k=function(u){return u.MEDIA_ATTACHING="hlsMediaAttaching",u.MEDIA_ATTACHED="hlsMediaAttached",u.MEDIA_DETACHING="hlsMediaDetaching",u.MEDIA_DETACHED="hlsMediaDetached",u.BUFFER_RESET="hlsBufferReset",u.BUFFER_CODECS="hlsBufferCodecs",u.BUFFER_CREATED="hlsBufferCreated",u.BUFFER_APPENDING="hlsBufferAppending",u.BUFFER_APPENDED="hlsBufferAppended",u.BUFFER_EOS="hlsBufferEos",u.BUFFER_FLUSHING="hlsBufferFlushing",u.BUFFER_FLUSHED="hlsBufferFlushed",u.MANIFEST_LOADING="hlsManifestLoading",u.MANIFEST_LOADED="hlsManifestLoaded",u.MANIFEST_PARSED="hlsManifestParsed",u.LEVEL_SWITCHING="hlsLevelSwitching",u.LEVEL_SWITCHED="hlsLevelSwitched",u.LEVEL_LOADING="hlsLevelLoading",u.LEVEL_LOADED="hlsLevelLoaded",u.LEVEL_UPDATED="hlsLevelUpdated",u.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",u.LEVELS_UPDATED="hlsLevelsUpdated",u.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",u.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",u.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",u.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",u.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",u.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",u.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",u.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",u.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",u.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",u.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",u.CUES_PARSED="hlsCuesParsed",u.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",u.INIT_PTS_FOUND="hlsInitPtsFound",u.FRAG_LOADING="hlsFragLoading",u.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",u.FRAG_LOADED="hlsFragLoaded",u.FRAG_DECRYPTED="hlsFragDecrypted",u.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",u.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",u.FRAG_PARSING_METADATA="hlsFragParsingMetadata",u.FRAG_PARSED="hlsFragParsed",u.FRAG_BUFFERED="hlsFragBuffered",u.FRAG_CHANGED="hlsFragChanged",u.FPS_DROP="hlsFpsDrop",u.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",u.ERROR="hlsError",u.DESTROYING="hlsDestroying",u.KEY_LOADING="hlsKeyLoading",u.KEY_LOADED="hlsKeyLoaded",u.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",u.BACK_BUFFER_REACHED="hlsBackBufferReached",u}({}),se=function(u){return u.NETWORK_ERROR="networkError",u.MEDIA_ERROR="mediaError",u.KEY_SYSTEM_ERROR="keySystemError",u.MUX_ERROR="muxError",u.OTHER_ERROR="otherError",u}({}),W=function(u){return u.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",u.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",u.KEY_SYSTEM_NO_SESSION="keySystemNoSession",u.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",u.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",u.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",u.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",u.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",u.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",u.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",u.MANIFEST_LOAD_ERROR="manifestLoadError",u.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",u.MANIFEST_PARSING_ERROR="manifestParsingError",u.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",u.LEVEL_EMPTY_ERROR="levelEmptyError",u.LEVEL_LOAD_ERROR="levelLoadError",u.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",u.LEVEL_PARSING_ERROR="levelParsingError",u.LEVEL_SWITCH_ERROR="levelSwitchError",u.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",u.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",u.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",u.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",u.FRAG_LOAD_ERROR="fragLoadError",u.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",u.FRAG_DECRYPT_ERROR="fragDecryptError",u.FRAG_PARSING_ERROR="fragParsingError",u.FRAG_GAP="fragGap",u.REMUX_ALLOC_ERROR="remuxAllocError",u.KEY_LOAD_ERROR="keyLoadError",u.KEY_LOAD_TIMEOUT="keyLoadTimeOut",u.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",u.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",u.BUFFER_APPEND_ERROR="bufferAppendError",u.BUFFER_APPENDING_ERROR="bufferAppendingError",u.BUFFER_STALLED_ERROR="bufferStalledError",u.BUFFER_FULL_ERROR="bufferFullError",u.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",u.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",u.INTERNAL_EXCEPTION="internalException",u.INTERNAL_ABORTED="aborted",u.UNKNOWN="unknown",u}({}),Se=function(){},Xe={trace:Se,debug:Se,log:Se,warn:Se,info:Se,error:Se},at=Xe;function jt(u){var s=self.console[u];return s?s.bind(self.console,"["+u+"] >"):Se}function it(u,s){if(self.console&&u===!0||typeof u=="object"){(function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];i.forEach(function(o){at[o]=e[o]?e[o].bind(e):jt(o)})})(u,"debug","log","info","warn","error");try{at.log('Debug logs enabled for "'+s+'" in hls.js version 1.4.3')}catch{at=Xe}}else at=Xe}var U=at,di=/^(\d+)x(\d+)$/,zt=/(.+?)=(".*?"|.*?)(?:,|$)/g,nt=function(){function u(e){for(var t in typeof e=="string"&&(e=u.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=u.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),a=0;a<t.length/2;a++)i[a]=parseInt(t.slice(2*a,2*a+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=di.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},u.parseAttrList=function(e){var t,i={};for(zt.lastIndex=0;(t=zt.exec(e))!==null;){var a=t[2];a.indexOf('"')===0&&a.lastIndexOf('"')===a.length-1&&(a=a.slice(1,-1)),i[t[1].trim()]=a}return i},u}();function ri(u){return u==="SCTE35-OUT"||u==="SCTE35-IN"}var $e=function(){function u(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]){U.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+s.ID+'"'),this._badValueForSameId=i;break}s=H(new nt({}),t,s)}if(this.attr=s,this._startDate=new Date(s["START-DATE"]),"END-DATE"in this.attr){var a=new Date(this.attr["END-DATE"]);re(a.getTime())&&(this._endDate=a)}}return M(u,[{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(re(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&&re(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),u}(),Gt=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}},gt="audio",Ct="video",tr="audiovideo",te=function(){function u(s){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[gt]=null,e[Ct]=null,e[tr]=null,e),this.baseurl=s}return u.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(u,[{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=Ge.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(s){this._url=s}}]),u}(),ke=function(u){function s(t,i){var a;return(a=u.call(this,i)||this)._decryptdata=null,a.rawProgramDateTime=null,a.programDateTime=null,a.tagList=[],a.duration=0,a.sn=0,a.levelkeys=void 0,a.type=void 0,a.loader=null,a.keyLoader=null,a.level=-1,a.cc=0,a.startPTS=void 0,a.endPTS=void 0,a.startDTS=void 0,a.endDTS=void 0,a.start=0,a.deltaPTS=void 0,a.maxStartPTS=void 0,a.minEndPTS=void 0,a.stats=new Gt,a.urlId=0,a.data=void 0,a.bitrateTest=!1,a.title=null,a.initSegment=null,a.endList=void 0,a.gap=void 0,a.type=t,a}z(s,u);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,a,o,d,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,a),h.startDTS=Math.min(h.startDTS,o),h.endDTS=Math.max(h.endDTS,d)):f[t]={startPTS:i,endPTS:a,startDTS:o,endDTS:d,partial:c}},e.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[gt]=null,t[Ct]=null,t[tr]=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||!re(this.programDateTime))return null;var t=re(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),a=i.length;if(a>1||a===1&&this.levelkeys[i[0]].encrypted)return!0}return!1}}]),s}(te),st=function(u){function s(e,t,i,a,o){var d;(d=u.call(this,i)||this).fragOffset=0,d.duration=0,d.gap=!1,d.independent=!1,d.relurl=void 0,d.fragment=void 0,d.index=void 0,d.stats=new Gt,d.duration=e.decimalFloatingPoint("DURATION"),d.gap=e.bool("GAP"),d.independent=e.bool("INDEPENDENT"),d.relurl=e.enumeratedString("URI"),d.fragment=t,d.index=a;var c=e.enumeratedString("BYTERANGE");return c&&d.setByteRange(c,o),o&&(d.fragOffset=o.fragOffset+o.duration),d}return z(s,u),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}(te),wt=function(){function u(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 u.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(u,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&re(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}}]),u}();function Rt(u){return Uint8Array.from(atob(u),function(s){return s.charCodeAt(0)})}function ci(u){var s,e,t=u.split(":"),i=null;if(t[0]==="data"&&t.length===2){var a=t[1].split(";"),o=a[a.length-1].split(",");if(o.length===2){var d=o[0]==="base64",c=o[1];d?(a.splice(-1,1),i=Rt(c)):(s=$i(c).subarray(0,16),(e=new Uint8Array(16)).set(s,16-s.length),i=e)}}return i}function $i(u){return Uint8Array.from(unescape(encodeURIComponent(u)),function(s){return s.charCodeAt(0)})}var Ze={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},vi="org.w3.clearkey",gi="com.apple.streamingkeydelivery",ji="com.microsoft.playready",ir="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Ei(u){switch(u){case gi:return Ze.FAIRPLAY;case ji:return Ze.PLAYREADY;case ir:return Ze.WIDEVINE;case vi:return Ze.CLEARKEY}}var ct="edef8ba979d64acea3c827dcd51d21ed";function rr(u){switch(u){case Ze.FAIRPLAY:return gi;case Ze.PLAYREADY:return ji;case Ze.WIDEVINE:return ir;case Ze.CLEARKEY:return vi}}function gr(u){var s=u.drmSystems,e=u.widevineLicenseUrl,t=s?[Ze.FAIRPLAY,Ze.WIDEVINE,Ze.PLAYREADY,Ze.CLEARKEY].filter(function(i){return!!s[i]}):[];return!t[Ze.WIDEVINE]&&e&&t.push(Ze.WIDEVINE),t}var $r=typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function xi(u,s,e){return Uint8Array.prototype.slice?u.slice(s,e):new Uint8Array(Array.prototype.slice.call(u,s,e))}var Er,es=function(u,s){return s+10<=u.length&&u[s]===73&&u[s+1]===68&&u[s+2]===51&&u[s+3]<255&&u[s+4]<255&&u[s+6]<128&&u[s+7]<128&&u[s+8]<128&&u[s+9]<128},vo=function(u,s){return s+10<=u.length&&u[s]===51&&u[s+1]===68&&u[s+2]===73&&u[s+3]<255&&u[s+4]<255&&u[s+6]<128&&u[s+7]<128&&u[s+8]<128&&u[s+9]<128},ga=function(u,s){for(var e=s,t=0;es(u,s);)t+=10,t+=an(u,s+6),vo(u,s+10)&&(t+=10),s+=t;if(t>0)return u.subarray(e,e+t)},an=function(u,s){var e=0;return e=(127&u[s])<<21,e|=(127&u[s+1])<<14,e|=(127&u[s+2])<<7,e|=127&u[s+3]},go=function(u,s){return es(u,s)&&an(u,s+6)+10<=u.length-s},Eo=function(u){return u&&u.key==="PRIV"&&u.info==="com.apple.streaming.transportStreamTimestamp"},Bu=function(u){var s=String.fromCharCode(u[0],u[1],u[2],u[3]),e=an(u,4);return{type:s,size:e,data:u.subarray(10,10+e)}},ts=function(u){for(var s=0,e=[];es(u,s);){for(var t=an(u,s+6),i=(s+=10)+t;s+8<i;){var a=Bu(u.subarray(s)),o=Hu(a);o&&e.push(o),s+=a.size+10}vo(u,s)&&(s+=10)}return e},Hu=function(u){return u.type==="PRIV"?Gu(u):u.type[0]==="W"?bo(u):yo(u)},Gu=function(u){if(!(u.size<2)){var s=Li(u.data,!0),e=new Uint8Array(u.data.subarray(s.length+1));return{key:u.type,info:s,data:e.buffer}}},yo=function(u){if(!(u.size<2)){if(u.type==="TXXX"){var s=1,e=Li(u.data.subarray(s),!0);s+=e.length+1;var t=Li(u.data.subarray(s));return{key:u.type,info:e,data:t}}var i=Li(u.data.subarray(1));return{key:u.type,data:i}}},bo=function(u){if(u.type==="WXXX"){if(u.size<2)return;var s=1,e=Li(u.data.subarray(s),!0);s+=e.length+1;var t=Li(u.data.subarray(s));return{key:u.type,info:e,data:t}}var i=Li(u.data);return{key:u.type,data:i}},_o=function(u){if(u.data.byteLength===8){var s=new Uint8Array(u.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)}},Li=function(u,s){s===void 0&&(s=!1);var e=Vu();if(e){var t=e.decode(u);if(s){var i=t.indexOf("\0");return i!==-1?t.substring(0,i):t}return t.replace(/\0/g,"")}for(var a,o,d,c=u.length,f="",h=0;h<c;){if((a=u[h++])===0&&s)return f;if(a!==0&&a!==3)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:f+=String.fromCharCode(a);break;case 12:case 13:o=u[h++],f+=String.fromCharCode((31&a)<<6|63&o);break;case 14:o=u[h++],d=u[h++],f+=String.fromCharCode((15&a)<<12|(63&o)<<6|(63&d)<<0)}}return f};function Vu(){return Er||self.TextDecoder===void 0||(Er=new self.TextDecoder("utf-8")),Er}var Pi=function(u){for(var s="",e=0;e<u.length;e++){var t=u[e].toString(16);t.length<2&&(t="0"+t),s+=t}return s},Ea=Math.pow(2,32)-1,Ku=[].push,To={video:1,audio:2,id3:3,text:4};function Mt(u){return String.fromCharCode.apply(null,u)}function Ao(u,s){var e=u[s]<<8|u[s+1];return e<0?65536+e:e}function He(u,s){var e=is(u,s);return e<0?4294967296+e:e}function is(u,s){return u[s]<<24|u[s+1]<<16|u[s+2]<<8|u[s+3]}function rs(u,s,e){u[s]=e>>24,u[s+1]=e>>16&255,u[s+2]=e>>8&255,u[s+3]=255&e}function Je(u,s){var e=[];if(!s.length)return e;for(var t=u.byteLength,i=0;i<t;){var a=He(u,i),o=a>1?i+a:t;if(Mt(u.subarray(i+4,i+8))===s[0])if(s.length===1)e.push(u.subarray(i+8,o));else{var d=Je(u.subarray(i+8,o),s.slice(1));d.length&&Ku.apply(e,d)}i=o}return e}function So(u){var s=[],e=u[0],t=8,i=He(u,t);t+=4,t+=e===0?8:16,t+=2;var a=u.length+0,o=Ao(u,t);t+=2;for(var d=0;d<o;d++){var c=t,f=He(u,c);c+=4;var h=2147483647&f;if((2147483648&f)>>>31==1)return U.warn("SIDX has hierarchical references (not supported)"),null;var p=He(u,c);c+=4,s.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/i,start:a,end:a+h-1}}),a+=h,t=c+=4}return{earliestPresentationTime:0,timescale:i,version:e,referencesCount:o,references:s}}function as(u){for(var s=[],e=Je(u,["moov","trak"]),t=0;t<e.length;t++){var i=e[t],a=Je(i,["tkhd"])[0];if(a){var o=a[0],d=o===0?12:20,c=He(a,d),f=Je(i,["mdia","mdhd"])[0];if(f){var h=He(f,d=(o=f[0])===0?12:20),p=Je(i,["mdia","hdlr"])[0];if(p){var E=Mt(p.subarray(8,12)),b={soun:gt,vide:Ct}[E];if(b){var A=Je(i,["mdia","minf","stbl","stsd"])[0],w=void 0;A&&(w=Mt(A.subarray(12,16))),s[c]={timescale:h,type:b},s[b]={timescale:h,id:c,codec:w}}}}}}return Je(u,["moov","mvex","trex"]).forEach(function(D){var S=He(D,4),L=s[S];L&&(L.default={duration:He(D,12),flags:He(D,20)})}),s}function ns(u){var s=Je(u,["schm"])[0];if(s){var e=Mt(s.subarray(4,8));if(e==="cbcs"||e==="cenc")return Je(u,["schi","tenc"])[0]}return U.error("[eme] missing 'schm' box"),null}function Wu(u){var s=He(u,0),e=8;1&s&&(e+=4),4&s&&(e+=4);for(var t=0,i=He(u,4),a=0;a<i;a++)256&s&&(t+=He(u,e),e+=4),512&s&&(e+=4),1024&s&&(e+=4),2048&s&&(e+=4);return t}function yr(u,s){var e=new Uint8Array(u.length+s.length);return e.set(u),e.set(s,u.length),e}function ss(u,s){var e=[],t=s.samples,i=s.timescale,a=s.id,o=!1;return Je(t,["moof"]).map(function(d){var c=d.byteOffset-8;Je(d,["traf"]).map(function(f){var h=Je(f,["tfdt"]).map(function(p){var E=p[0],b=He(p,4);return E===1&&(b*=Math.pow(2,32),b+=He(p,8)),b/i})[0];return h!==void 0&&(u=h),Je(f,["tfhd"]).map(function(p){var E=He(p,4),b=16777215&He(p,0),A=0,w=(16&b)!=0,D=0,S=(32&b)!=0,L=8;E===a&&((1&b)!=0&&(L+=8),(2&b)!=0&&(L+=4),(8&b)!=0&&(A=He(p,L),L+=4),w&&(D=He(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)),Je(f,["trun"]).map(function(N){var P=N[0],V=16777215&He(N,0),Y=(1&V)!=0,j=0,ie=(4&V)!=0,Q=(256&V)!=0,X=0,ce=(512&V)!=0,oe=0,Ae=(1024&V)!=0,xe=(2048&V)!=0,Le=0,Me=He(N,4),Oe=8;Y&&(j=He(N,Oe),Oe+=4),ie&&(Oe+=4);for(var Pe=j+c,Ke=0;Ke<Me;Ke++){if(Q?(X=He(N,Oe),Oe+=4):X=A,ce?(oe=He(N,Oe),Oe+=4):oe=D,Ae&&(Oe+=4),xe&&(Le=P===0?He(N,Oe):is(N,Oe),Oe+=4),s.type===Ct)for(var je=0;je<oe;){var et=He(t,Pe);ko(o,t[Pe+=4])&&wo(t.subarray(Pe,Pe+et),o?2:1,u+Le/i,e),Pe+=et,je+=et+4}u+=X/i}}))})})}),e}function ko(u,s){if(u){var e=s>>1&63;return e===39||e===40}return(31&s)==6}function wo(u,s,e,t){var i=Lo(u),a=0;a+=s;for(var o=0,d=0,c=!1,f=0;a<i.length;){o=0;do{if(a>=i.length)break;o+=f=i[a++]}while(f===255);d=0;do{if(a>=i.length)break;d+=f=i[a++]}while(f===255);var h=i.length-a;if(!c&&o===4&&a<i.length){if(c=!0,i[a++]===181){var p=Ao(i,a);if(a+=2,p===49){var E=He(i,a);if(a+=4,E===1195456820){var b=i[a++];if(b===3){var A=i[a++],w=64&A,D=w?2+3*(31&A):0,S=new Uint8Array(D);if(w){S[0]=A;for(var L=1;L<D;L++)S[L]=i[a++]}t.push({type:b,payloadType:o,pts:e,bytes:S})}}}}}else if(o===5&&d<h){if(c=!0,d>16){for(var N=[],P=0;P<16;P++){var V=i[a++].toString(16);N.push(V.length==1?"0"+V:V),P!==3&&P!==5&&P!==7&&P!==9||N.push("-")}for(var Y=d-16,j=new Uint8Array(Y),ie=0;ie<Y;ie++)j[ie]=i[a++];t.push({payloadType:o,pts:e,uuid:N.join(""),userData:Li(j),userDataBytes:j})}}else if(d<h)a+=d;else if(d>h)break}}function Lo(u){for(var s=u.byteLength,e=[],t=1;t<s-2;)u[t]===0&&u[t+1]===0&&u[t+2]===3?(e.push(t+2),t+=2):t++;if(e.length===0)return u;var i=s-e.length,a=new Uint8Array(i),o=0;for(t=0;t<i;o++,t++)o===e[0]&&(o++,e.shift()),a[t]=u[o];return a}function Io(u,s,e){if(u.byteLength!==16)throw new RangeError("Invalid system id");var t,i,a;if(s){t=1,i=new Uint8Array(16*s.length);for(var o=0;o<s.length;o++){var d=s[o];if(d.byteLength!==16)throw new RangeError("Invalid key");i.set(d,16*o)}}else t=0,i=new Uint8Array;t>0?(a=new Uint8Array(4),s.length>0&&new DataView(a.buffer).setUint32(0,s.length,!1)):a=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,w=b;w--;)A+=p[w].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),w=0,A=8;w<b;w++)D.set(p[w],A),A+=p[w].byteLength;return D}([112,115,115,104],new Uint8Array([t,0,0,0]),u,a,i,c,e||new Uint8Array)}var ya={},ba=function(){function u(e,t,i,a,o){a===void 0&&(a=[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=a,this.iv=o,this.encrypted=!!e&&e!=="NONE",this.isCommonEncryption=this.encrypted&&e!=="AES-128"}u.clearKeyUriToKeyIdMap=function(){ya={}};var s=u.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 gi:case ir:case ji:case vi: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||U.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 u(this.method,this.uri,"identity",this.keyFormatVersions,t)}var i=ci(this.uri);if(i)switch(this.keyFormat){case ir:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case ji:var a=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Io(a,null,i);var o=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),d=String.fromCharCode.apply(null,Array.from(o)),c=d.substring(d.indexOf("<"),d.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=Rt(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 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=ya[this.uri];if(!A){var w=Object.keys(ya).length%Number.MAX_SAFE_INTEGER;A=new Uint8Array(16),new DataView(A.buffer,12,4).setUint32(0,w),ya[this.uri]=A}this.keyId=A}return this},u}(),Ro=/\{\$([a-zA-Z0-9-_]+)\}/g;function Do(u){return Ro.test(u)}function ai(u,s,e){if(u.variableList!==null||u.hasVariableRefs)for(var t=e.length;t--;){var i=e[t],a=s[i];a&&(s[i]=Ii(u,a))}}function Ii(u,s){if(u.variableList!==null||u.hasVariableRefs){var e=u.variableList;return s.replace(Ro,function(t){var i=t.substring(2,t.length-1),a=e==null?void 0:e[i];return a===void 0?(u.playlistParsingError||(u.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+i+'"')),t):a})}return s}function Co(u,s,e){var t,i,a=u.variableList;if(a||(u.variableList=a={}),"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(d){u.playlistParsingError||(u.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+d.message))}}else t=s.NAME,i=s.VALUE;t in a?u.playlistParsingError||(u.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+t+'"')):a[t]=i||""}function Mo(u,s,e){var t=s.IMPORT;if(e&&t in e){var i=u.variableList;i||(u.variableList=i={}),i[t]=e[t]}else u.playlistParsingError||(u.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+t+'"'))}function nn(){if(typeof self!="undefined")return self.MediaSource||self.WebKitMediaSource}var qu={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}},os=nn();function sn(u,s){var e;return(e=os==null?void 0:os.isTypeSupported((s||"video")+'/mp4;codecs="'+u+'"'))!=null&&e}var br=/#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,jr=/#EXT-X-MEDIA:(.*)/g,Yu=/^#EXT(?:INF|-X-TARGETDURATION):/m,ls=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),on=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("|")),_a=function(){function u(){}return u.findGroup=function(s,e){for(var t=0;t<s.length;t++){var i=s[t];if(i.id===e)return i}},u.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},u.resolve=function(s,e){return Ge.buildAbsoluteURL(e,s,{alwaysNormalize:!0})},u.isMediaPlaylist=function(s){return Yu.test(s)},u.parseMasterPlaylist=function(s,e){var t,i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Do(s)},a=[];for(br.lastIndex=0;(t=br.exec(s))!=null;)if(t[1]){var o,d=new nt(t[1]);ai(i,d,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);var c=Ii(i,t[2]),f={attrs:d,bitrate:d.decimalInteger("AVERAGE-BANDWIDTH")||d.decimalInteger("BANDWIDTH"),name:d.NAME,url:u.resolve(c,e)},h=d.decimalResolution("RESOLUTION");h&&(f.width=h.width,f.height=h.height),$u((d.CODECS||"").split(/[ ,]+/).filter(function(N){return N}),f),f.videoCodec&&f.videoCodec.indexOf("avc1")!==-1&&(f.videoCodec=u.convertAVC1ToAVCOTI(f.videoCodec)),(o=f.unknownCodecs)!=null&&o.length||a.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 nt(E);ai(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 w=xo(E,e,i);w.encrypted&&w.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(w)):U.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+E+'"');break;case"DEFINE":var D=new nt(E);ai(i,D,["NAME","VALUE","QUERYPARAM"]),Co(i,D,e);break;case"CONTENT-STEERING":var S=new nt(E);ai(i,S,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:u.resolve(S["SERVER-URI"],e),pathwayId:S["PATHWAY-ID"]||"."};break;case"START":i.startTimeOffset=Po(E)}}var L=a.length>0&&a.length<i.levels.length;return i.levels=L?a:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i},u.parseMasterPlaylistMedia=function(s,e,t){var i,a={},o=t.levels,d={AUDIO:o.map(function(w){return{id:w.attrs.AUDIO,audioCodec:w.audioCodec}}),SUBTITLES:o.map(function(w){return{id:w.attrs.SUBTITLES,textCodec:w.textCodec}}),"CLOSED-CAPTIONS":[]},c=0;for(jr.lastIndex=0;(i=jr.exec(s))!==null;){var f=new nt(i[1]),h=f.TYPE;if(h){var p=d[h],E=a[h]||[];a[h]=E,ai(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?u.resolve(f.URI,e):""};if(p!=null&&p.length){var A=u.findGroup(p,b.groupId)||p[0];us(b,A,"audioCodec"),us(b,A,"textCodec")}E.push(b)}}return a},u.parseLevelPlaylist=function(s,e,t,i,a,o){var d,c,f,h=new wt(e),p=h.fragments,E=null,b=0,A=0,w=0,D=0,S=null,L=new ke(i,e),N=-1,P=!1;for(ls.lastIndex=0,h.m3u8=s,h.hasVariableRefs=Do(s);(d=ls.exec(s))!==null;){P&&(P=!1,(L=new ke(i,e)).start=w,L.sn=b,L.cc=D,L.level=t,E&&(L.initSegment=E,L.rawProgramDateTime=E.rawProgramDateTime,E.rawProgramDateTime=null));var V=d[1];if(V){L.duration=parseFloat(V);var Y=(" "+d[2]).slice(1);L.title=Y||null,L.tagList.push(Y?["INF",V,Y]:["INF",V])}else if(d[3]){if(re(L.duration)){L.start=w,f&&ds(L,f,h),L.sn=b,L.level=t,L.cc=D,L.urlId=a,p.push(L);var j=(" "+d[3]).slice(1);L.relurl=Ii(h,j),Oo(L,S),S=L,w+=L.duration,b++,A=0,P=!0}}else if(d[4]){var ie=(" "+d[4]).slice(1);S?L.setByteRange(ie,S):L.setByteRange(ie)}else if(d[5])L.rawProgramDateTime=(" "+d[5]).slice(1),L.tagList.push(["PROGRAM-DATE-TIME",L.rawProgramDateTime]),N===-1&&(N=p.length);else{if(!(d=d[0].match(on))){U.warn("No matches on slow regex match for level playlist!");continue}for(c=1;c<d.length&&d[c]===void 0;c++);var Q=(" "+d[c]).slice(1),X=(" "+d[c+1]).slice(1),ce=d[c+2]?(" "+d[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 oe=new nt(X);ai(h,oe,["RECENTLY-REMOVED-DATERANGES"]);var Ae=oe.decimalInteger("SKIPPED-SEGMENTS");if(re(Ae)){h.skippedSegments=Ae;for(var xe=Ae;xe--;)p.unshift(null);b+=Ae}var Le=oe.enumeratedString("RECENTLY-REMOVED-DATERANGES");Le&&(h.recentlyRemovedDateranges=Le.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||ce)&&L.tagList.push(ce?[X,ce]:[X]);break;case"DISCONTINUITY":D++,L.tagList.push(["DIS"]);break;case"GAP":L.gap=!0,L.tagList.push([Q]);break;case"BITRATE":L.tagList.push([Q,X]);break;case"DATERANGE":var Me=new nt(X);ai(h,Me,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),ai(h,Me,Me.clientAttrs);var Oe=new $e(Me,h.dateRanges[Me.ID]);Oe.isValid||h.skippedSegments?h.dateRanges[Oe.id]=Oe:U.warn('Ignoring invalid DATERANGE tag: "'+X+'"'),L.tagList.push(["EXT-X-DATERANGE",X]);break;case"DEFINE":var Pe=new nt(X);ai(h,Pe,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in Pe?Mo(h,Pe,o):Co(h,Pe,e);break;case"DISCONTINUITY-SEQUENCE":D=parseInt(X);break;case"KEY":var Ke=xo(X,e,h);if(Ke.isSupported()){if(Ke.method==="NONE"){f=void 0;break}f||(f={}),f[Ke.keyFormat]&&(f=H({},f)),f[Ke.keyFormat]=Ke}else U.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+X+'"');break;case"START":h.startTimeOffset=Po(X);break;case"MAP":var je=new nt(X);if(ai(h,je,["BYTERANGE","URI"]),L.duration){var et=new ke(i,e);No(et,je,t,f),E=et,L.initSegment=E,E.rawProgramDateTime&&!L.rawProgramDateTime&&(L.rawProgramDateTime=E.rawProgramDateTime)}else No(L,je,t,f),E=L,P=!0;break;case"SERVER-CONTROL":var lt=new nt(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 _i=new nt(X);h.partTarget=_i.decimalFloatingPoint("PART-TARGET");break;case"PART":var Kt=h.partList;Kt||(Kt=h.partList=[]);var Qi=A>0?Kt[Kt.length-1]:void 0,Bi=A++,Hi=new nt(X);ai(h,Hi,["BYTERANGE","URI"]);var Wt=new st(Hi,L,e,Bi,Qi);Kt.push(Wt),L.duration+=Wt.duration;break;case"PRELOAD-HINT":var ti=new nt(X);ai(h,ti,["URI"]),h.preloadHint=ti;break;case"RENDITION-REPORT":var sr=new nt(X);ai(h,sr,["URI"]),h.renditionReports=h.renditionReports||[],h.renditionReports.push(sr);break;default:U.warn("line parsed but not handled: "+d)}}}S&&!S.relurl?(p.pop(),w-=S.duration,h.partList&&(h.fragmentHint=S)):h.partList&&(Oo(L,S),L.cc=D,h.fragmentHint=L,f&&ds(L,f,h));var ea=p.length,Ci=p[0],Ts=p[ea-1];if((w+=h.skippedSegments*h.targetduration)>0&&ea&&Ts){h.averagetargetduration=w/ea;var As=Ts.sn;h.endSN=As!=="initSegment"?As:0,h.live||(Ts.endList=!0),Ci&&(h.startCC=Ci.cc)}else h.endSN=0,h.startCC=0;return h.fragmentHint&&(w+=h.fragmentHint.duration),h.totalduration=w,h.endCC=D,N>0&&function(il,gn){for(var Oa=il[gn],Ss=gn;Ss--;){var Ir=il[Ss];if(!Ir)return;Ir.programDateTime=Oa.programDateTime-1e3*Ir.duration,Oa=Ir}}(p,N),h},u}();function xo(u,s,e){var t,i,a=new nt(u);ai(e,a,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var o=(t=a.METHOD)!=null?t:"",d=a.URI,c=a.hexadecimalInteger("IV"),f=a.KEYFORMATVERSIONS,h=(i=a.KEYFORMAT)!=null?i:"identity";d&&a.IV&&!c&&U.error("Invalid IV: "+a.IV);var p=d?_a.resolve(d,s):"",E=(f||"1").split("/").map(Number).filter(Number.isFinite);return new ba(o,p,h,E,c)}function Po(u){var s=new nt(u).decimalFloatingPoint("TIME-OFFSET");return re(s)?s:null}function $u(u,s){["video","audio","text"].forEach(function(e){var t=u.filter(function(a){return function(o,d){var c=qu[d];return!!c&&c[o.slice(0,4)]===!0}(a,e)});if(t.length){var i=t.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});s[e+"Codec"]=i.length>0?i[0]:t[0],u=u.filter(function(a){return t.indexOf(a)===-1})}}),s.unknownCodecs=u}function us(u,s,e){var t=s[e];t&&(u[e]=t)}function Oo(u,s){u.rawProgramDateTime?u.programDateTime=Date.parse(u.rawProgramDateTime):s!=null&&s.programDateTime&&(u.programDateTime=s.endProgramDateTime),re(u.programDateTime)||(u.programDateTime=null,u.rawProgramDateTime=null)}function No(u,s,e,t){u.relurl=s.URI,s.BYTERANGE&&u.setByteRange(s.BYTERANGE),u.level=e,u.sn="initSegment",t&&(u.levelkeys=t),u.initSegment=null}function ds(u,s,e){u.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(u)}var zr="manifest",_r="level",yi="audioTrack",zi="subtitleTrack",rt="main",Ri="audio",Oi="subtitle";function Fo(u){switch(u.type){case yi:return Ri;case zi:return Oi;default:return rt}}function cs(u,s){var e=u.url;return e!==void 0&&e.indexOf("data:")!==0||(e=s.url),e}var xt=function(){function u(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}var s=u.prototype;return s.startLoad=function(e){},s.stopLoad=function(){this.destroyInternalLoaders()},s.registerListeners=function(){var e=this.hls;e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.LEVEL_LOADING,this.onLevelLoading,this),e.on(k.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(k.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.LEVEL_LOADING,this.onLevelLoading,this),e.off(k.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(k.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,a=t.loader,o=new(i||a)(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:zr,url:i,deliveryDirectives:null})},s.onLevelLoading=function(e,t){var i=t.id,a=t.level,o=t.url,d=t.deliveryDirectives;this.load({id:i,level:a,responseType:"text",type:_r,url:o,deliveryDirectives:d})},s.onAudioTrackLoading=function(e,t){var i=t.id,a=t.groupId,o=t.url,d=t.deliveryDirectives;this.load({id:i,groupId:a,level:null,responseType:"text",type:yi,url:o,deliveryDirectives:d})},s.onSubtitleTrackLoading=function(e,t){var i=t.id,a=t.groupId,o=t.url,d=t.deliveryDirectives;this.load({id:i,groupId:a,level:null,responseType:"text",type:zi,url:o,deliveryDirectives:d})},s.load=function(e){var t,i,a,o=this,d=this.hls.config,c=this.getInternalLoader(e);if(c){var f=c.context;if(f&&f.url===e.url)return void U.trace("[playlist-loader]: playlist request ongoing");U.log("[playlist-loader]: aborting previous loader for type: "+e.type),c.abort()}if(i=e.type===zr?d.manifestLoadPolicy.default:H({},d.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),c=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part&&(e.type===_r&&e.level!==null?a=this.hls.levels[e.level].details:e.type===yi&&e.id!==null?a=this.hls.audioTracks[e.id].details:e.type===zi&&e.id!==null&&(a=this.hls.subtitleTracks[e.id].details),a)){var h=a.partTarget,p=a.targetduration;if(h&&p){var E=1e3*Math.max(3*h,.8*p);i=H({},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},w={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(),_a.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,w)},s.handleMasterPlaylist=function(e,t,i,a){var o=this.hls,d=e.data,c=cs(e,i),f=_a.parseMasterPlaylist(d,c);if(f.playlistParsingError)this.handleManifestParsingError(e,i,f.playlistParsingError,a,t);else{var h=f.contentSteering,p=f.levels,E=f.sessionData,b=f.sessionKeys,A=f.startTimeOffset,w=f.variableList;this.variableList=w;var D=_a.parseMasterPlaylistMedia(d,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||(U.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 nt({}),bitrate:0,url:""}))),o.trigger(k.MANIFEST_LOADED,{levels:p,audioTracks:L,subtitles:N,captions:P,contentSteering:h,url:c,stats:t,networkDetails:a,sessionData:E,sessionKeys:b,startTimeOffset:A,variableList:w})}},s.handleTrackOrLevelPlaylist=function(e,t,i,a,o){var d=this.hls,c=i.id,f=i.level,h=i.type,p=cs(e,i),E=re(c)?c:0,b=re(f)?f:E,A=Fo(i),w=_a.parseLevelPlaylist(e.data,p,b,A,E,this.variableList);if(h===zr){var D={attrs:new nt({}),bitrate:0,details:w,name:"",url:p};d.trigger(k.MANIFEST_LOADED,{levels:[D],audioTracks:[],url:p,stats:t,networkDetails:a,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=w,this.handlePlaylistLoaded(w,e,t,i,a,o)},s.handleManifestParsingError=function(e,t,i,a,o){this.hls.trigger(k.ERROR,{type:se.NETWORK_ERROR,details:W.MANIFEST_PARSING_ERROR,fatal:t.type===zr,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:a,stats:o})},s.handleNetworkError=function(e,t,i,a,o){i===void 0&&(i=!1);var d="A network "+(i?"timeout":"error"+(a?" (status "+a.code+")":""))+" occurred while loading "+e.type;e.type===_r?d+=": "+e.level+" id: "+e.id:e.type!==yi&&e.type!==zi||(d+=" id: "+e.id+' group-id: "'+e.groupId+'"');var c=new Error(d);U.warn("[playlist-loader]: "+d);var f=W.UNKNOWN,h=!1,p=this.getInternalLoader(e);switch(e.type){case zr:f=i?W.MANIFEST_LOAD_TIMEOUT:W.MANIFEST_LOAD_ERROR,h=!0;break;case _r:f=i?W.LEVEL_LOAD_TIMEOUT:W.LEVEL_LOAD_ERROR,h=!1;break;case yi:f=i?W.AUDIO_TRACK_LOAD_TIMEOUT:W.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case zi:f=i?W.SUBTITLE_TRACK_LOAD_TIMEOUT:W.SUBTITLE_LOAD_ERROR,h=!1}p&&this.resetInternalLoader(e.type);var E={type:se.NETWORK_ERROR,details:f,fatal:h,url:e.url,loader:p,context:e,error:c,networkDetails:t,stats:o};if(a){var b=(t==null?void 0:t.url)||e.url;E.response=y({url:b,data:void 0},a)}this.hls.trigger(k.ERROR,E)},s.handlePlaylistLoaded=function(e,t,i,a,o,d){var c=this.hls,f=a.type,h=a.level,p=a.id,E=a.groupId,b=a.deliveryDirectives,A=cs(t,a),w=Fo(a),D=typeof a.level=="number"&&w===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(k.ERROR,{type:se.NETWORK_ERROR,details:W.LEVEL_PARSING_ERROR,fatal:!1,url:A,error:S,reason:S.message,response:t,context:a,level:D,parent:w,networkDetails:o,stats:i});else switch(e.live&&d&&(d.getCacheAge&&(e.ageHeader=d.getCacheAge()||0),d.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),f){case zr:case _r:c.trigger(k.LEVEL_LOADED,{details:e,level:D||0,id:p||0,stats:i,networkDetails:o,deliveryDirectives:b});break;case yi:c.trigger(k.AUDIO_TRACK_LOADED,{details:e,id:p||0,groupId:E||"",stats:i,networkDetails:o,deliveryDirectives:b});break;case zi:c.trigger(k.SUBTITLE_TRACK_LOADED,{details:e,id:p||0,groupId:E||"",stats:i,networkDetails:o,deliveryDirectives:b})}}else{var L=new Error("No Segments found in Playlist");c.trigger(k.ERROR,{type:se.NETWORK_ERROR,details:W.LEVEL_EMPTY_ERROR,fatal:!1,url:A,error:L,reason:L.message,response:t,context:a,level:D,parent:w,networkDetails:o,stats:i})}},u}();function Ta(u,s){var e;try{e=new Event("addtrack")}catch{(e=document.createEvent("Event")).initEvent("addtrack",!1,!1)}e.track=u,s.dispatchEvent(e)}function Uo(u,s){var e=u.mode;if(e==="disabled"&&(u.mode="hidden"),u.cues&&!u.cues.getCueById(s.id))try{if(u.addCue(s),!u.cues.getCueById(s.id))throw new Error("addCue is failed for: "+s)}catch(i){U.debug("[texttrack-utils]: "+i);var t=new self.TextTrackCue(s.startTime,s.endTime,s.text);t.id=s.id,u.addCue(t)}e==="disabled"&&(u.mode=e)}function Qr(u){var s=u.mode;if(s==="disabled"&&(u.mode="hidden"),u.cues)for(var e=u.cues.length;e--;)u.removeCue(u.cues[e]);s==="disabled"&&(u.mode=s)}function hs(u,s,e,t){var i=u.mode;if(i==="disabled"&&(u.mode="hidden"),u.cues&&u.cues.length>0)for(var a=function(d,c,f){var h=[],p=function(w,D){if(D<w[0].startTime)return 0;var S=w.length-1;if(D>w[S].endTime)return-1;for(var L=0,N=S;L<=N;){var P=Math.floor((N+L)/2);if(D<w[P].startTime)N=P-1;else{if(!(D>w[P].startTime&&L<S))return P;L=P+1}}return w[L].startTime-D<D-w[N].startTime?L:N}(d,c);if(p>-1)for(var E=p,b=d.length;E<b;E++){var A=d[E];if(A.startTime>=c&&A.endTime<=f)h.push(A);else if(A.startTime>f)return h}return h}(u.cues,s,e),o=0;o<a.length;o++)t&&!t(a[o])||u.removeCue(a[o]);i==="disabled"&&(u.mode=i)}var Aa="org.id3",Sa="com.apple.quicktime.HLS",Tr="https://aomedia.org/emsg/ID3";function ln(){if(typeof self!="undefined")return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var ka=function(){var u=ln();try{new u(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function ar(u,s){return u.getTime()/1e3-s}var ju=function(){function u(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var s=u.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(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(k.LEVEL_UPDATED,this.onLevelUpdated,this)},s._unregisterListeners=function(){var e=this.hls;e.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(k.LEVEL_UPDATED,this.onLevelUpdated,this)},s.onMediaAttached=function(e,t){this.media=t.media},s.onMediaDetaching=function(){this.id3Track&&(Qr(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 Ta(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},s.onFragParsingMetadata=function(e,t){if(this.media){var i=this.hls.config,a=i.enableEmsgMetadataCues,o=i.enableID3MetadataCues;if(a||o){var d=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var c=ln(),f=0;f<d.length;f++){var h=d[f].type;if((h!==Tr||a)&&o){var p=ts(d[f].data);if(p){var E=d[f].pts,b=E+d[f].duration;b>ka&&(b=ka),b-E<=0&&(b=E+.25);for(var A=0;A<p.length;A++){var w=p[A];if(!Eo(w)){this.updateId3CueEnds(E);var D=new c(E,b,"");D.value=w,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 a=i.length;a--;){var o=i[a];o.startTime<e&&o.endTime===ka&&(o.endTime=e)}},s.onBufferFlushing=function(e,t){var i=t.startOffset,a=t.endOffset,o=t.type,d=this.id3Track,c=this.hls;if(c){var f=c.config,h=f.enableEmsgMetadataCues,p=f.enableID3MetadataCues;d&&(h||p)&&hs(d,i,a,o==="audio"?function(E){return E.type===Aa&&p}:o==="video"?function(E){return E.type===Tr&&h}:function(E){return E.type===Aa&&p||E.type===Tr&&h})}},s.onLevelUpdated=function(e,t){var i=this,a=t.details;if(this.media&&a.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var o=this.dateRangeCuesAppended,d=this.id3Track,c=a.dateRanges,f=Object.keys(c);if(d)for(var h=Object.keys(o).filter(function(L){return!f.includes(L)}),p=function(){var L=h[E];Object.keys(o[L].cues).forEach(function(N){d.removeCue(o[L].cues[N])}),delete o[L]},E=h.length;E--;)p();var b=a.fragments[a.fragments.length-1];if(f.length!==0&&re(b==null?void 0:b.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var A=b.programDateTime/1e3-b.start,w=ln(),D=function(){var L=f[S],N=c[L],P=o[L],V=(P==null?void 0:P.cues)||{},Y=(P==null?void 0:P.durationKnown)||!1,j=ar(N.startDate,A),ie=ka,Q=N.endDate;if(Q)ie=ar(Q,A),Y=!0;else if(N.endOnNext&&!Y){var X=f.reduce(function(Pe,Ke){var je=c[Ke];return je.class===N.class&&je.id!==Ke&&je.startDate>N.startDate&&Pe.push(je),Pe},[]).sort(function(Pe,Ke){return Pe.startDate.getTime()-Ke.startDate.getTime()})[0];X&&(ie=ar(X.startDate,A),Y=!0)}for(var ce,oe,Ae=Object.keys(N.attr),xe=0;xe<Ae.length;xe++){var Le=Ae[xe];if((oe=Le)!=="ID"&&oe!=="CLASS"&&oe!=="START-DATE"&&oe!=="DURATION"&&oe!=="END-DATE"&&oe!=="END-ON-NEXT"){var Me=V[Le];if(Me)Y&&!P.durationKnown&&(Me.endTime=ie);else{var Oe=N.attr[Le];Me=new w(j,ie,""),ri(Le)&&(ce=Oe,Oe=Uint8Array.from(ce.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),Me.value={key:Le,data:Oe},Me.type=Sa,Me.id=L,i.id3Track.addCue(Me),V[Le]=Me}}}o[L]={cues:V,dateRange:N,durationKnown:Y}},S=0;S<f.length;S++)D()}}},u}(),zu=function(){function u(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=u.prototype;return s.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},s.registerListeners=function(){this.hls.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(k.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(k.ERROR,this.onError,this)},s.unregisterListeners=function(){this.hls.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(k.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(k.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&&U.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 a=this.config,o=a.lowLatencyMode,d=a.maxLiveSyncPlaybackRate;if(o&&d!==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,d)),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(u,[{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,a=e.targetduration,o=this.config,d=o.liveSyncDuration,c=o.liveSyncDurationCount,f=o.lowLatencyMode,h=this.hls.userConfig,p=f&&i||t;(h.liveSyncDuration||h.liveSyncDurationCount||p===0)&&(p=d!==void 0?d:c*a);var E=a;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 a=i.edge,o=e-t-this.edgeStalled,d=a-i.totalduration,c=a-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(d,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}}]),u}(),fs=["NONE","TYPE-0","TYPE-1",null],ms="",Qu="YES",Xu="v2",Bo=function(){function u(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 u.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},u}(),wa=function(){function u(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 u.prototype.addFallback=function(s){this.url.push(s.url),this._attrs.push(s.attrs)},M(u,[{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]}}]),u}();function ps(u,s){var e=s.startPTS;if(re(e)){var t,i=0;s.sn>u.sn?(i=e-u.start,t=u):(i=u.start-e,t=s),t.duration!==i&&(t.duration=i)}else s.sn>u.sn?u.cc===s.cc&&u.minEndPTS?s.start=u.start+(u.minEndPTS-u.start):s.start=u.start+u.duration:s.start=Math.max(u.start-s.duration,0)}function La(u,s,e,t,i,a){t-e<=0&&(U.warn("Fragment should have a positive duration",s),t=e+s.duration,a=i+s.duration);var o=e,d=t,c=s.startPTS,f=s.endPTS;if(re(c)){var h=Math.abs(c-e);re(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),d=Math.min(t,f),t=Math.max(t,f),a=Math.max(a,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=d,s.endDTS=a;var E,b=s.sn;if(!u||b<u.startSN||b>u.endSN)return 0;var A=b-u.startSN,w=u.fragments;for(w[A]=s,E=A;E>0;E--)ps(w[E],w[E-1]);for(E=A;E<w.length-1;E++)ps(w[E],w[E+1]);return u.fragmentHint&&ps(w[w.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,p}function vs(u,s){for(var e=null,t=u.fragments,i=t.length-1;i>=0;i--){var a=t[i].initSegment;if(a){e=a;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var o,d,c,f,h,p=0;if(function(S,L,N){for(var P=L.skippedSegments,V=Math.max(S.startSN,L.startSN)-L.startSN,Y=(S.fragmentHint?1:0)+(P?L.endSN:Math.min(S.endSN,L.endSN))-L.startSN,j=L.startSN-S.startSN,ie=L.fragmentHint?L.fragments.concat(L.fragmentHint):L.fragments,Q=S.fragmentHint?S.fragments.concat(S.fragmentHint):S.fragments,X=V;X<=Y;X++){var ce=Q[j+X],oe=ie[X];P&&!oe&&X<P&&(oe=L.fragments[X]=ce),ce&&oe&&N(ce,oe)}}(u,s,function(S,L){S.relurl&&(p=S.cc-L.cc),re(S.startPTS)&&re(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){U.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=(d=u.dateRanges,c=s.dateRanges,f=s.recentlyRemovedDateranges,h=H({},d),f&&f.forEach(function(S){delete h[S]}),Object.keys(c).forEach(function(S){var L=new $e(c[S].attr,h[S]);L.isValid?h[S]=L:U.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(c[S].attr)+'"')}),h));var b=s.fragments;if(p){U.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,Y=S.length;V<=Y;V++){var j=S[V],ie=L[V+P];j&&ie&&j.index===ie.index&&j.fragment.sn===ie.fragment.sn?N(j,ie):P--}}(u.partList,s.partList,function(S,L){L.elementaryStreams=S.elementaryStreams,L.stats=S.stats}),o?La(s,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS):gs(u,s),b.length&&(s.totalduration=s.edge-b[0].start),s.driftStartTime=u.driftStartTime,s.driftStart=u.driftStart;var w=s.advancedDateTime;if(s.advanced&&w){var D=s.edge;s.driftStart||(s.driftStartTime=w,s.driftStart=D),s.driftEndTime=w,s.driftEnd=D}else s.driftEndTime=u.driftEndTime,s.driftEnd=u.driftEnd,s.advancedDateTime=u.advancedDateTime}function gs(u,s){var e=s.startSN+s.skippedSegments-u.startSN,t=u.fragments;e<0||e>=t.length||Ia(s,t[e].start)}function Ia(u,s){if(s){for(var e=u.fragments,t=u.skippedSegments;t<e.length;t++)e[t].start+=s;u.fragmentHint&&(u.fragmentHint.start+=s)}}function Ho(u,s,e){var t;return u!=null&&u.details?Go((t=u.details)==null?void 0:t.partList,s,e):null}function Go(u,s,e){if(u)for(var t=u.length;t--;){var i=u[t];if(i.index===e&&i.fragment.sn===s)return i}return null}function un(u){switch(u.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 Vo(u,s){var e=un(s);return u.default[(e?"timeout":"error")+"Retry"]}function Es(u,s){var e=u.backoff==="linear"?1:Math.pow(2,s);return Math.min(e*u.retryDelayMs,u.maxRetryDelayMs)}function Ko(u){return y(y({},u),{errorRetry:null,timeoutRetry:null})}function dn(u,s,e,t){return!!u&&s<u.maxNumRetry&&(function(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}(t)||!!e)}var Wo=function(u,s){for(var e=0,t=u.length-1,i=null,a=null;e<=t;){var o=s(a=u[i=(e+t)/2|0]);if(o>0)e=i+1;else{if(!(o<0))return a;t=i-1}}return null};function Ra(u,s,e,t){e===void 0&&(e=0),t===void 0&&(t=0);var i=null;if(u?i=s[u.sn-s[0].sn+1]||null:e===0&&s[0].start===0&&(i=s[0]),i&&cn(e,t,i)===0)return i;var a=Wo(s,cn.bind(null,e,t));return!a||a===u&&i?i:a}function cn(u,s,e){if(u===void 0&&(u=0),s===void 0&&(s=0),e.start<=u&&e.start+e.duration>u)return 0;var t=Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return e.start+e.duration-t<=u?1:e.start-t>u&&e.start?-1:0}function bi(u,s,e){var t=1e3*Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return(e.endProgramDateTime||0)-t>u}var Ar,Zu=3e5,qo=0,T=2,g=5,_=0,R=1,C=2,O=function(){function u(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=U.log.bind(U,"[info]:"),this.warn=U.warn.bind(U,"[warning]:"),this.error=U.error.bind(U,"[error]:"),this.registerListeners()}var s=u.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.ERROR,this.onError,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(k.ERROR,this.onError,this),e.off(k.ERROR,this.onErrorOut,this),e.off(k.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 a=this.hls,o=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=T);case W.LEVEL_EMPTY_ERROR:case W.LEVEL_PARSING_ERROR:var d,c,f=t.parent===rt?t.level:a.loadLevel;return void(t.details===W.LEVEL_EMPTY_ERROR&&(d=t.context)!=null&&(c=d.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(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.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(o){var h=a.levels[a.loadLevel];if(h&&(o.type===yi&&o.groupId===h.audioGroupId||o.type===zi&&o.groupId===h.textGroupId))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.loadLevel),t.errorAction.action=T,void(t.errorAction.flags=R)}return;case W.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var p=a.levels[a.loadLevel],E=p==null?void 0:p.attrs["HDCP-LEVEL"];return void(E&&(t.errorAction={action:T,flags:C,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:a.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:qo,flags:_})}if(t.type===se.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,a=Vo(this.hls.config.playlistLoadPolicy,e),o=this.playlistError++,d=(i=e.response)==null?void 0:i.code;if(dn(a,o,un(e),d))return{action:g,flags:_,retryConfig:a,retryCount:o};var c=this.getLevelSwitchAction(e,t);return a&&(c.retryConfig=a,c.retryCount=o),c},s.getFragRetryOrSwitchAction=function(e){var t=this.hls,i=this.getVariantLevelIndex(e.frag),a=t.levels[i],o=t.config,d=o.fragLoadPolicy,c=o.keyLoadPolicy,f=Vo(e.details.startsWith("key")?c:d,e),h=t.levels.reduce(function(A,w){return A+w.fragmentError},0);if(a){var p;e.details!==W.FRAG_GAP&&a.fragmentError++;var E=(p=e.response)==null?void 0:p.code;if(dn(f,h,un(e),E))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 a=this.hls.levels[t];if(a&&(a.loadError++,i.autoLevelEnabled)){for(var o,d,c=-1,f=i.levels,h=(o=e.frag)==null?void 0:o.type,p=(d=e.context)!=null?d:{},E=p.type,b=p.groupId,A=f.length;A--;){var w=(A+i.loadLevel)%f.length;if(w!==i.loadLevel&&f[w].loadError===0){var D=f[w];if(e.details===W.FRAG_GAP&&e.frag){var S=f[w].details;if(S){var L=Ra(e.frag,S.fragments,e.frag.start);if(L!=null&&L.gap)continue}}else if(E===yi&&b===D.audioGroupId||E===zi&&b===D.textGroupId||h===Ri&&a.audioGroupId===D.audioGroupId||h===Oi&&a.textGroupId===D.textGroupId)continue;c=w;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 qo:break;case T: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 a=i.flags,o=i.hdcpLevel,d=i.nextAutoLevel;switch(a){case _:this.switchLevel(e,d);break;case R:i.resolved||(i.resolved=this.redundantFailover(e));break;case C:o&&(t.maxHdcpLevel=fs[fs.indexOf(o)-1],i.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}i.resolved||this.switchLevel(e,d)}},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,a=this.penalizedRenditions,o=e.parent===rt?e.level:i.loadLevel,d=i.levels[o],c=d.url.length,f=e.frag?e.frag.urlId:d.urlId;d.urlId!==f||e.frag&&!d.details||this.penalizeRendition(d,e);for(var h=function(){var b=(f+p)%c,A=a[b];if(!A||function(w,D,S){if(performance.now()-w.lastErrorPerfMs>Zu)return!0;var L=w.details;if(D.details===W.FRAG_GAP&&L&&D.frag){var N=D.frag.start,P=Ra(null,L.fragments,N);if(P&&!P.gap)return!0}if(S&&w.errors.length<S.errors.length){var V=w.errors[w.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,a[f]))return t.warn("Switching to Redundant Stream "+(b+1)+"/"+c+': "'+d.url[b]+'" after '+e.details),t.playlistError=0,i.levels.forEach(function(w){w.urlId=b}),i.nextLoadLevel=o,{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,a=i[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};a.lastErrorPerfMs=performance.now(),a.errors.push(t),a.details=e.details,i[e.urlId]=a},u}(),x=function(){function u(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=U.log.bind(U,t+":"),this.warn=U.warn.bind(U,t+":"),this.hls=e}var s=u.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 a=-1,o=0;o<i.length;o++){var d=i[o],c=void 0;try{c=new self.URL(d.URI,t.url).href}catch(b){U.warn("Could not construct new URL for Rendition Report: "+b),c=d.URI||""}if(c===e){a=o;break}c===e.substring(0,c.length)&&(a=o)}if(a!==-1){var f=i[a],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 Bo(h,p>=0?p:void 0,ms)}}},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 a=this,o=t.details,d=t.stats,c=self.performance.now(),f=d.loading.first?Math.max(0,c-d.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&&vs(i,o),!this.canLoad||!o.live)return;var h,p=void 0,E=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var b=this.hls.config.lowLatencyMode,A=o.lastPartSn,w=o.endSN,D=o.lastPartIndex,S=A===w;D!==-1?(p=S?w+1:A,E=S?b?0:D:D+1):p=w+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,E!==void 0&&(E+=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 "+E)}o.tuneInGoal=P}if(h=this.getDeliveryDirectives(o,t.deliveryDirectives,p,E),b||!S)return void this.loadPlaylist(h)}else o.canBlockReload&&(h=this.getDeliveryDirectives(o,t.deliveryDirectives,p,E));var Y=this.hls.mainForwardBufferInfo,j=Y?Y.end-Y.len:0,ie=function(X,ce){ce===void 0&&(ce=1/0);var oe=1e3*X.targetduration;if(X.updated){var Ae=X.fragments;if(Ae.length&&4*oe>ce){var xe=1e3*Ae[Ae.length-1].duration;xe<oe&&(oe=xe)}}else oe/=2;return Math.round(oe)}(o,1e3*(o.edge-j));o.updated&&c>this.requestScheduled+ie&&(this.requestScheduled=d.loading.start),p!==void 0&&o.canBlockReload?this.requestScheduled=d.loading.first+ie-(1e3*o.partTarget||1e3):this.requestScheduled===-1||this.requestScheduled+ie<c?this.requestScheduled=c:this.requestScheduled-c<=0&&(this.requestScheduled+=ie);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 a.loadPlaylist(h)},Q)}else this.clearTimer()},s.getDeliveryDirectives=function(e,t,i,a){var o=function(d,c){var f=d.canSkipUntil,h=d.canSkipDateRanges,p=d.endSN;return f&&(c!==void 0?c-p:0)<f?h?Xu:Qu:ms}(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,a=t.part,o=ms),new Bo(i,a,o)},s.checkRetry=function(e){var t=this,i=e.details,a=un(e),o=e.errorAction,d=o||{},c=d.action,f=d.retryCount,h=f===void 0?0:f,p=d.retryConfig,E=!!o&&!!p&&(c===g||!o.resolved&&c===T);if(E){var b;if(this.requestScheduled=-1,a&&(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=Es(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 E},u}(),G=function(u){function s(t,i){var a;return(a=u.call(this,t,"[level-controller]")||this)._levels=[],a._firstLevel=-1,a._startLevel=void 0,a.currentLevel=null,a.currentLevelIndex=-1,a.manualLevelIndex=-1,a.steering=void 0,a.onParsedComplete=void 0,a.steering=i,a._registerListeners(),a}z(s,u);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(k.FRAG_LOADED,this.onFragLoaded,this),t.on(k.ERROR,this.onError,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(k.FRAG_LOADED,this.onFragLoaded,this),t.off(k.ERROR,this.onError,this)},e.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),u.prototype.destroy.call(this)},e.startLoad=function(){this._levels.forEach(function(t){t.loadError=0,t.fragmentError=0}),u.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 a,o=[],d={};i.levels.forEach(function(c){var f,h=c.attrs;((f=c.audioCodec)==null?void 0:f.indexOf("mp4a.40.34"))!==-1&&(Ar||(Ar=/chrome|firefox/i.test(navigator.userAgent)),Ar&&(c.audioCodec=void 0));var p=h.AUDIO,E=h.CODECS,b=h["FRAME-RATE"],A=h["PATHWAY-ID"],w=h.RESOLUTION,D=h.SUBTITLES,S=(A||".")+"-"+c.bitrate+"-"+w+"-"+b+"-"+E;(a=d[S])?a.addFallback(c):(a=new wa(c),d[S]=a,o.push(a)),$(a,"audio",p),$(a,"text",D)}),this.filterAndSortMediaOptions(o,i)},e.filterAndSortMediaOptions=function(t,i){var a=this,o=[],d=[],c=!1,f=!1,h=!1,p=t.filter(function(L){var N=L.audioCodec,P=L.videoCodec,V=L.width,Y=L.height,j=L.unknownCodecs;return c||(c=!(!V||!Y)),f||(f=!!P),h||(h=!!N),!(j!=null&&j.length)&&(!N||sn(N,"audio"))&&(!P||sn(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||sn(L.audioCodec,"audio")})),i.subtitles&&K(d=i.subtitles);var E=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=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 w=0;w<p.length;w++)if(p[w]===b){this._firstLevel=w,this.log("manifest loaded, "+p.length+" level(s) found, first bitrate: "+b.bitrate);break}var D=h&&!f,S={levels:p,audioTracks:o,subtitleTracks:d,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(k.MANIFEST_PARSED,S),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then(function(){if(a.hls){var L=new Error("no level with compatible codecs found in manifest");a.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.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===_r&&i.context.level===this.level&&this.checkRetry(i)},e.onFragLoaded=function(t,i){var a=i.frag;if(a!==void 0&&a.type===rt){var o=this._levels[a.level];o!==void 0&&(o.loadError=0)}},e.onLevelLoaded=function(t,i){var a,o,d=i.level,c=i.details,f=this._levels[d];if(!f)return this.warn("Invalid level index "+d),void((o=i.deliveryDirectives)!=null&&o.skip&&(c.deltaUpdateFailed=!0));d===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0),this.playlistLoaded(d,i,f.details)):(a=i.deliveryDirectives)!=null&&a.skip&&(c.deltaUpdateFailed=!0)},e.onAudioTrackSwitched=function(t,i){var a=this.currentLevel;if(a){var o=this.hls.audioTracks[i.id].groupId;if(a.audioGroupIds&&a.audioGroupId!==o){for(var d=-1,c=0;c<a.audioGroupIds.length;c++)if(a.audioGroupIds[c]===o){d=c;break}d!==-1&&d!==a.urlId&&(a.urlId=d,this.canLoad&&this.startLoad())}}},e.loadPlaylist=function(t){u.prototype.loadPlaylist.call(this);var i=this.currentLevelIndex,a=this.currentLevel;if(a&&this.shouldLoadPlaylist(a)){var o=a.urlId,d=a.uri;if(t)try{d=t.addDirectives(d)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}var c=a.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)+"/"+a.url.length+" "+d),this.clearTimer(),this.hls.trigger(k.LEVEL_LOADING,{url:d,level:i,id:o,deliveryDirectives:t||null})}},e.removeLevel=function(t,i){var a=this,o=function(c,f){return f!==i},d=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):(a.steering&&a.steering.removeLevel(c),!1))});this.hls.trigger(k.LEVELS_UPDATED,{levels:d})},e.onLevelsUpdated=function(t,i){var a=i.levels;a.forEach(function(o,d){var c=o.details;c!=null&&c.fragments&&c.fragments.forEach(function(f){f.level=d})}),this._levels=a},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 a=new Error("invalid level idx"),o=t<0;if(this.hls.trigger(k.ERROR,{type:se.OTHER_ERROR,details:W.LEVEL_SWITCH_ERROR,level:t,fatal:o,error:a,reason:a.message}),o)return;t=Math.min(t,i.length-1)}var d=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,d!==t||!h.details||!c||f!==p){this.log("Switching to level "+t+(p?" with Pathway "+p:"")+" from level "+d+(f?" with Pathway "+f:""));var E=H({},h,{level:t,maxBitrate:h.maxBitrate,attrs:h.attrs,uri:h.uri,urlId:h.urlId});delete E._attrs,delete E._urlId,this.hls.trigger(k.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}(x);function $(u,s,e){e&&(s==="audio"?(u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds[u.url.length-1]=e):s==="text"&&(u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds[u.url.length-1]=e))}function K(u){var s={};u.forEach(function(e){var t=e.groupId||"";e.id=s[t]=s[t]||0,s[t]++})}var Z="NOT_LOADED",Fe="APPENDING",Te="PARTIAL",Re="OK",we=function(){function u(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=u.prototype;return s._registerListeners=function(){var e=this.hls;e.on(k.BUFFER_APPENDED,this.onBufferAppended,this),e.on(k.FRAG_BUFFERED,this.onFragBuffered,this),e.on(k.FRAG_LOADED,this.onFragLoaded,this)},s._unregisterListeners=function(){var e=this.hls;e.off(k.BUFFER_APPENDED,this.onBufferAppended,this),e.off(k.FRAG_BUFFERED,this.onFragBuffered,this),e.off(k.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 a=i.length;a--;){var o=i[a];if(!o)break;var d=o.end;if(o.start<=e&&d!==null&&e<=d)return o}return this.getBufferedFrag(e,t)},s.getBufferedFrag=function(e,t){for(var i=this.fragments,a=Object.keys(i),o=a.length;o--;){var d=i[a[o]];if((d==null?void 0:d.body.type)===t&&d.buffered){var c=d.body;if(c.start<=e&&e<=c.end)return c}}return null},s.detectEvictedFragments=function(e,t,i,a){var o=this;this.timeRanges&&(this.timeRanges[e]=t);var d=(a==null?void 0:a.fragment.sn)||-1;Object.keys(this.fragments).forEach(function(c){var f=o.fragments[c];if(f&&!(d>=f.body.sn))if(f.buffered||f.loaded){var h=f.range[e];h&&h.time.some(function(p){var E=!o.isTimeBuffered(p.startPTS,p.endPTS,t);return E&&o.removeFragment(f.body),E})}else f.body.type===i&&o.removeFragment(f.body)})},s.detectPartialFragments=function(e){var t=this,i=this.timeRanges,a=e.frag,o=e.part;if(i&&a.sn!=="initSegment"){var d=We(a),c=this.fragments[d];if(c){var f=!a.relurl;Object.keys(i).forEach(function(h){var p=a.elementaryStreams[h];if(p){var E=i[h],b=f||p.partial===!0;c.range[h]=t.getBufferedTimes(a,o,b,E)}}),c.loaded=null,Object.keys(c.range).length?(c.buffered=!0,c.body.endList&&(this.endListFragments[c.body.type]=c),Ce(c)||this.removeParts(a.sn-1,a.type)):this.removeFragment(c.body)}}},s.removeParts=function(e,t){var i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(function(a){return a.fragment.sn>=e}))},s.fragBuffered=function(e,t){var i=We(e),a=this.fragments[i];!a&&t&&(a=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),a&&(a.loaded=null,a.buffered=!0)},s.getBufferedTimes=function(e,t,i,a){for(var o={time:[],partial:i},d=e.start,c=e.end,f=e.minEndPTS||c,h=e.maxStartPTS||d,p=0;p<a.length;p++){var E=a.start(p)-this.bufferPadding,b=a.end(p)+this.bufferPadding;if(h>=E&&f<=b){o.time.push({startPTS:Math.max(d,a.start(p)),endPTS:Math.min(c,a.end(p))});break}if(d<b&&c>E)o.partial=!0,o.time.push({startPTS:Math.max(d,a.start(p)),endPTS:Math.min(c,a.end(p))});else if(c<=E)break}return o},s.getPartialFragment=function(e){var t,i,a,o=null,d=0,c=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(h){var p=f[h];p&&Ce(p)&&(i=p.body.start-c,a=p.body.end+c,e>=i&&e<=a&&(t=Math.min(e-i,a-e),d<=t&&(o=p.body,d=t)))}),o},s.isEndListAppended=function(e){var t=this.endListFragments[e];return t!==void 0&&(t.buffered||Ce(t))},s.getState=function(e){var t=We(e),i=this.fragments[t];return i?i.buffered?Ce(i)?Te:Re:Fe:Z},s.isTimeBuffered=function(e,t,i){for(var a,o,d=0;d<i.length;d++){if(a=i.start(d)-this.bufferPadding,o=i.end(d)+this.bufferPadding,e>=a&&t<=o)return!0;if(t<=a)return!1}return!1},s.onFragLoaded=function(e,t){var i=t.frag,a=t.part;if(i.sn!=="initSegment"&&!i.bitrateTest){var o=a?null:t,d=We(i);this.fragments[d]={body:i,appendedPTS:null,loaded:o,buffered:!1,range:Object.create(null)}}},s.onBufferAppended=function(e,t){var i=this,a=t.frag,o=t.part,d=t.timeRanges;if(a.sn!=="initSegment"){var c=a.type;if(o){var f=this.activePartLists[c];f||(this.activePartLists[c]=f=[]),f.push(o)}this.timeRanges=d,Object.keys(d).forEach(function(h){var p=d[h];i.detectEvictedFragments(h,p,c,o)})}},s.onFragBuffered=function(e,t){this.detectPartialFragments(t)},s.hasFragment=function(e){var t=We(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,a,o){var d=this;a&&!this.hasGaps||Object.keys(this.fragments).forEach(function(c){var f=d.fragments[c];if(f){var h=f.body;h.type!==i||a&&!h.gap||h.start<t&&h.end>e&&(f.buffered||o)&&d.removeFragment(h)}})},s.removeFragment=function(e){var t=We(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var i=this.activePartLists[e.type];if(i){var a=e.sn;this.activePartLists[e.type]=i.filter(function(o){return o.fragment.sn!==a})}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},u}();function Ce(u){var s,e,t;return u.buffered&&(u.body.gap||((s=u.range.video)==null?void 0:s.partial)||((e=u.range.audio)==null?void 0:e.partial)||((t=u.range.audiovideo)==null?void 0:t.partial))}function We(u){return u.type+"_"+u.level+"_"+u.urlId+"_"+u.sn}var Pt=Math.pow(2,17),Vt=function(){function u(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var s=u.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,a=e.url;if(!a)return Promise.reject(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(a?"part list":"url")),networkDetails:null}));this.abort();var o=this.config,d=o.fLoader,c=o.loader;return new Promise(function(f,h){if(i.loader&&i.loader.destroy(),e.gap)h(hi(e));else{var p=i.loader=e.loader=d?new d(o):new c(o),E=Zt(e),b=Ko(o.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Pt};e.stats=p.stats,p.load(E,A,{onSuccess:function(w,D,S,L){i.resetLoader(e,p);var N=w.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(w,D,S,L){i.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:y({url:a,data:void 0},w),error:new Error("HTTP Error "+w.code+" "+w.text),networkDetails:S,stats:L}))},onAbort:function(w,D,S){i.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:S,stats:w}))},onTimeout:function(w,D,S){i.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:w}))},onProgress:function(w,D,S,L){t&&t({frag:e,part:null,payload:S,networkDetails:L})}})}})},s.loadPart=function(e,t,i){var a=this;this.abort();var o=this.config,d=o.fLoader,c=o.loader;return new Promise(function(f,h){if(a.loader&&a.loader.destroy(),e.gap||t.gap)h(hi(e,t));else{var p=a.loader=e.loader=d?new d(o):new c(o),E=Zt(e,t),b=Ko(o.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Pt};t.stats=p.stats,p.load(E,A,{onSuccess:function(w,D,S,L){a.resetLoader(e,p),a.updateStatsFromPart(e,t);var N={frag:e,part:t,payload:w.data,networkDetails:L};i(N),f(N)},onError:function(w,D,S,L){a.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:y({url:E.url,data:void 0},w),error:new Error("HTTP Error "+w.code+" "+w.text),networkDetails:S,stats:L}))},onAbort:function(w,D,S){e.stats.aborted=t.stats.aborted,a.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:S,stats:w}))},onTimeout:function(w,D,S){a.resetLoader(e,p),h(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:w}))}})}})},s.updateStatsFromPart=function(e,t){var i=e.stats,a=t.stats,o=a.total;if(i.loaded+=a.loaded,o){var d=Math.round(e.duration/t.duration),c=Math.min(Math.round(i.loaded/o),d),f=(d-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=a.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()},u}();function Zt(u,s){s===void 0&&(s=null);var e=s||u,t={frag:u,part:s,responseType:"arraybuffer",url:e.url,headers:{},rangeStart:0,rangeEnd:0},i=e.byteRangeStartOffset,a=e.byteRangeEndOffset;if(re(i)&&re(a)){var o,d=i,c=a;if(u.sn==="initSegment"&&((o=u.decryptdata)==null?void 0:o.method)==="AES-128"){var f=a-i;f%16&&(c=a+(16-f%16)),i!==0&&(t.resetIV=!0,d=i-16)}t.rangeStart=d,t.rangeEnd=c}return t}function hi(u,s){var e=new Error("GAP "+(u.gap?"tag":"attribute")+" found"),t={type:se.MEDIA_ERROR,details:W.FRAG_GAP,fatal:!1,frag:u,error:e,networkDetails:null};return s&&(t.part=s),(s||u).stats.aborted=!0,new Ve(t)}var Ve=function(u){function s(e){var t;return(t=u.call(this,e.error.message)||this).data=void 0,t.data=e,t}return z(s,u),s}(_e(Error)),At=function(){function u(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var s=u.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,a,o){return t===void 0&&(t=W.KEY_LOAD_ERROR),new Ve({type:se.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:o,error:i,networkDetails:a})},s.loadClear=function(e,t){var i=this;if(this.emeController&&this.config.emeEnabled)for(var a=e.sn,o=e.cc,d=function(){var f=t[c];if(o<=f.cc&&(a==="initSegment"||f.sn==="initSegment"||a<f.sn))return i.emeController.selectKeySystemFormat(f).then(function(h){f.setKeyFormat(h)}),"break"},c=0;c<t.length&&d()!=="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,a;t&&e.setKeyFormat(t);var o=e.decryptdata;if(!o){var d=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,d))}var c=o.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 o.key=h.decryptdata.key,Promise.resolve({frag:e,keyInfo:h});if((a=h)!=null&&a.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,W.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 a=this.emeController.loadKey(i);if(a)return(e.keyLoadPromise=a.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,a=this.config,o=new a.loader(a);return t.keyLoader=e.loader=o,e.keyLoadPromise=new Promise(function(d,c){var f={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},h=a.keyLoadPolicy.default,p={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},E={onSuccess:function(b,A,w,D){var S=w.frag,L=w.keyInfo,N=w.url;if(!S.decryptdata||L!==i.keyUriToKeyInfo[N])return c(i.createKeyLoadError(S,W.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,d({frag:S,keyInfo:L})},onError:function(b,A,w,D){i.resetLoader(A),c(i.createKeyLoadError(t,W.KEY_LOAD_ERROR,new Error("HTTP Error "+b.code+" loading key "+b.text),w,y({url:f.url,data:void 0},b)))},onTimeout:function(b,A,w){i.resetLoader(A),c(i.createKeyLoadError(t,W.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),w))},onAbort:function(b,A,w){i.resetLoader(A),c(i.createKeyLoadError(t,W.INTERNAL_ABORTED,new Error("key loading aborted"),w))}};o.load(f,p,E)})},s.resetLoader=function(e){var t=e.frag,i=e.keyInfo,a=e.url,o=i.loader;t.keyLoader===o&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[a],o&&o.destroy()},u}(),tt=function(){function u(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var s=u.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(){},u}(),ue={length:0,start:function(){return 0},end:function(){return 0}},he=function(){function u(){}return u.isBuffered=function(s,e){try{if(s){for(var t=u.getBuffered(s),i=0;i<t.length;i++)if(e>=t.start(i)&&e<=t.end(i))return!0}}catch{}return!1},u.bufferInfo=function(s,e,t){try{if(s){var i,a=u.getBuffered(s),o=[];for(i=0;i<a.length;i++)o.push({start:a.start(i),end:a.end(i)});return this.bufferedInfo(o,e,t)}}catch{}return{len:0,start:e,end:e,nextStart:void 0}},u.bufferedInfo=function(s,e,t){e=Math.max(0,e),s.sort(function(w,D){var S=w.start-D.start;return S||D.end-w.end});var i=[];if(t)for(var a=0;a<s.length;a++){var o=i.length;if(o){var d=i[o-1].end;s[a].start-d<t?s[a].end>d&&(i[o-1].end=s[a].end):i.push(s[a])}else i.push(s[a])}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}},u.getBuffered=function(s){try{return s.buffered}catch(e){return U.log("failed to get media.buffered",e),ue}},u}(),fe=function(u,s,e,t,i,a){t===void 0&&(t=0),i===void 0&&(i=-1),a===void 0&&(a=!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=u,this.sn=s,this.id=e,this.size=t,this.part=i,this.partial=a};function Ue(u,s){for(var e=null,t=0,i=u.length;t<i;t++){var a=u[t];if(a&&a.cc===s){e=a;break}}return e}function qe(u,s){if(u){var e=u.start+s;u.start=u.startPTS=e,u.endPTS=e+u.duration}}function Et(u,s){for(var e=s.fragments,t=0,i=e.length;t<i;t++)qe(e[t],u);s.fragmentHint&&qe(s.fragmentHint,u),s.alignedSliding=!0}function ni(u,s,e){s&&(function(t,i,a){if(function(d,c,f){return!(!c.details||!(f.endCC>f.startCC||d&&d.cc<f.startCC))}(t,a,i)){var o=function(d,c,f){var h=d.fragments,p=c.fragments;if(p.length&&h.length){var E=Ue(h,p[0].cc);if(E&&(!E||E.startPTS))return E;U.log("No frag in previous level to align on")}else U.log("No fragments to align")}(a.details,i);o&&re(o.start)&&(U.log("Adjusting PTS using last level due to CC increase within current level "+i.url),Et(o.start,i))}}(u,e,s),!e.alignedSliding&&s.details&&function(t,i){if(i.fragments.length&&t.hasProgramDateTime&&i.hasProgramDateTime){var a=i.fragments[0].programDateTime,o=t.fragments[0].programDateTime,d=(o-a)/1e3+i.fragments[0].start;d&&re(d)&&(U.log("Adjusting PTS using programDateTime delta "+(o-a)+"ms, sliding:"+d.toFixed(3)+" "+t.url+" "),Et(d,t))}}(e,s.details),e.alignedSliding||!s.details||e.skippedSegments||gs(s.details,e))}function Ot(u,s){if(u.hasProgramDateTime&&s.hasProgramDateTime){var e=u.fragments,t=s.fragments;if(e.length&&t.length){var i=t[Math.round(t.length/2)-1],a=Ue(e,i.cc)||e[Math.round(e.length/2)-1],o=i.programDateTime,d=a.programDateTime;o!==null&&d!==null&&Et((d-o)/1e3-(a.start-i.start),u)}}}var Jt=function(){function u(s,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=s,this.aesIV=e}return u.prototype.decrypt=function(s,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,s)},u}(),Nt=function(){function u(s,e){this.subtle=void 0,this.key=void 0,this.subtle=s,this.key=e}return u.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},u}(),Ft=function(){function u(){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=u.prototype;return s.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),i=new Uint32Array(4),a=0;a<4;a++)i[a]=t.getUint32(4*a);return i},s.initTable=function(){var e=this.sBox,t=this.invSBox,i=this.subMix,a=i[0],o=i[1],d=i[2],c=i[3],f=this.invSubMix,h=f[0],p=f[1],E=f[2],b=f[3],A=new Uint32Array(256),w=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[w]=L,t[L]=w;var N=A[w],P=A[N],V=A[P],Y=257*A[L]^16843008*L;a[w]=Y<<24|Y>>>8,o[w]=Y<<16|Y>>>16,d[w]=Y<<8|Y>>>24,c[w]=Y,Y=16843009*V^65537*P^257*N^16843008*w,h[L]=Y<<24|Y>>>8,p[L]=Y<<16|Y>>>16,E[L]=Y<<8|Y>>>24,b[L]=Y,w?(w=N^A[A[A[V^N]]],D^=A[A[D]]):w=D=1}},s.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,a=0;a<t.length&&i;)i=t[a]===this.key[a],a++;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 d,c,f,h,p=this.ksRows=4*(o+6+1),E=this.keySchedule=new Uint32Array(p),b=this.invKeySchedule=new Uint32Array(p),A=this.sBox,w=this.rcon,D=this.invSubMix,S=D[0],L=D[1],N=D[2],P=D[3];for(d=0;d<p;d++)d<o?f=E[d]=t[d]:(h=f,d%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^=w[d/o|0]<<24):o>6&&d%o==4&&(h=A[h>>>24]<<24|A[h>>>16&255]<<16|A[h>>>8&255]<<8|A[255&h]),E[d]=f=(E[d-o]^h)>>>0);for(c=0;c<p;c++)d=p-c,h=3&c?E[d]:E[d-4],b[c]=c<4||d<=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 a,o,d,c,f,h,p,E,b,A,w,D,S,L,N=this.keySize+6,P=this.invKeySchedule,V=this.invSBox,Y=this.invSubMix,j=Y[0],ie=Y[1],Q=Y[2],X=Y[3],ce=this.uint8ArrayToUint32Array_(i),oe=ce[0],Ae=ce[1],xe=ce[2],Le=ce[3],Me=new Int32Array(e),Oe=new Int32Array(Me.length),Pe=this.networkToHostOrderSwap;t<Me.length;){for(b=Pe(Me[t]),A=Pe(Me[t+1]),w=Pe(Me[t+2]),D=Pe(Me[t+3]),f=b^P[0],h=D^P[1],p=w^P[2],E=A^P[3],S=4,L=1;L<N;L++)a=j[f>>>24]^ie[h>>16&255]^Q[p>>8&255]^X[255&E]^P[S],o=j[h>>>24]^ie[p>>16&255]^Q[E>>8&255]^X[255&f]^P[S+1],d=j[p>>>24]^ie[E>>16&255]^Q[f>>8&255]^X[255&h]^P[S+2],c=j[E>>>24]^ie[f>>16&255]^Q[h>>8&255]^X[255&p]^P[S+3],f=a,h=o,p=d,E=c,S+=4;a=V[f>>>24]<<24^V[h>>16&255]<<16^V[p>>8&255]<<8^V[255&E]^P[S],o=V[h>>>24]<<24^V[p>>16&255]<<16^V[E>>8&255]<<8^V[255&f]^P[S+1],d=V[p>>>24]<<24^V[E>>16&255]<<16^V[f>>8&255]<<8^V[255&h]^P[S+2],c=V[E>>>24]<<24^V[f>>16&255]<<16^V[h>>8&255]<<8^V[255&p]^P[S+3],Oe[t]=Pe(a^oe),Oe[t+1]=Pe(c^Ae),Oe[t+2]=Pe(d^xe),Oe[t+3]=Pe(o^Le),oe=b,Ae=A,xe=w,Le=D,t+=4}return Oe.buffer},u}(),Ni=function(){function u(e,t){var i=(t===void 0?{}:t).removePKCS7Padding,a=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=a,a)try{var o=self.crypto;o&&(this.subtle=o.subtle||o.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}var s=u.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,a,o,d=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(a=(i=d).byteLength,(o=a&&new DataView(i.buffer).getUint8(a-1))?xi(i,0,a-o):i):d},s.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},s.decrypt=function(e,t,i){var a=this;return this.useSoftware?new Promise(function(o,d){a.softwareDecrypt(new Uint8Array(e),t,i);var c=a.flush();c?o(c.buffer):d(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)},s.softwareDecrypt=function(e,t,i){var a=this.currentIV,o=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(e=yr(d,e),this.remainderData=null);var c=this.getValidChunk(e);if(!c.length)return null;a&&(i=a);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new Ft),f.expandKey(t);var h=o;return this.currentResult=f.decrypt(c.buffer,0,i),this.currentIV=xi(c,-16).buffer,h||null},s.webCryptoDecrypt=function(e,t,i){var a=this,o=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new Nt(o,t)),this.fastAesKey.expandKey().then(function(d){return o?(a.logOnce("WebCrypto AES decrypt"),new Jt(o,new Uint8Array(i)).decrypt(e.buffer,d)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(d){return U.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+d.name+": "+d.message),a.onWebCryptoError(e,t,i)})},s.onWebCryptoError=function(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);var a=this.flush();if(a)return a.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=xi(e,0,i),this.remainderData=xi(e,i)),t},s.logOnce=function(e){this.logEnabled&&(U.log("[decrypter]: "+e),this.logEnabled=!1)},u}(),Da=function(u){for(var s="",e=u.length,t=0;t<e;t++)s+="["+u.start(t).toFixed(3)+"-"+u.end(t).toFixed(3)+"]";return s},Ut="STOPPED",De="IDLE",Sr="KEY_LOADING",Xr="FRAG_LOADING",Zr="FRAG_LOADING_WAITING_RETRY",Ca="WAITING_TRACK",kr="PARSING",Yo="PARSED",ys="ENDED",hn="ERROR",bs="WAITING_INIT_PTS",fn="WAITING_LEVEL",Ju=function(u){function s(t,i,a,o,d){var c;return(c=u.call(this)||this).hls=void 0,c.fragPrevious=null,c.fragCurrent=null,c.fragmentTracker=void 0,c.transmuxer=null,c._state=Ut,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=d,c.logPrefix=o,c.log=U.log.bind(U,o+":"),c.warn=U.warn.bind(U,o+":"),c.hls=t,c.fragmentLoader=new Vt(t.config),c.keyLoader=a,c.fragmentTracker=i,c.config=t.config,c.decrypter=new Ni(t.config),t.on(k.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,u);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=Ut},e._streamEnded=function(t,i){if(i.live||t.nextStart||!t.end||!this.media)return!1;var a=i.partList;if(a!=null&&a.length){var o=a[a.length-1];return he.isBuffered(this.media,o.start+o.duration/2)}var d=i.fragments[i.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(d)},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 a=this.media=this.mediaBuffer=i.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),a.addEventListener("seeking",this.onvseeking),a.addEventListener("ended",this.onvended);var o=this.config;this.levels&&o.autoStartLoad&&this.state===Ut&&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,a=this.media,o=this.mediaBuffer,d=this.state,c=a?a.currentTime:0,f=he.bufferInfo(o||a,c,t.maxBufferHole);if(this.log("media seeking to "+(re(c)?c.toFixed(3):c)+", state: "+d),this.state===ys)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()),this.fragPrevious=null)}}a&&(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(),u.prototype.onHandlerDestroying.call(this)},e.onHandlerDestroyed=function(){this.state=Ut,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,u.prototype.onHandlerDestroyed.call(this)},e.loadFragment=function(t,i,a){this._loadFragForPlayback(t,i,a)},e._loadFragForPlayback=function(t,i,a){var o=this;this._doFragLoad(t,i,a,function(d){if(o.fragContextChanged(t))return o.warn("Fragment "+t.sn+(d.part?" p: "+d.part.index:"")+" of level "+t.level+" was dropped during download."),void o.fragmentTracker.removeFragment(t);t.stats.chunkCount++,o._handleFragmentLoadProgress(d)}).then(function(d){if(d){var c=o.state;o.fragContextChanged(t)?(c===Xr||!o.fragCurrent&&c===kr)&&(o.fragmentTracker.removeFragment(t),o.state=De):("payload"in d&&(o.log("Loaded fragment "+t.sn+" of level "+t.level),o.hls.trigger(k.FRAG_LOADED,d)),o._handleFragmentLoadComplete(d))}}).catch(function(d){o.state!==Ut&&o.state!==hn&&(o.warn(d),o.resetFragmentLoading(t))})},e.clearTrackerIfNeeded=function(t){var i,a=this.fragmentTracker;if(a.getState(t)===Fe){var o=t.type,d=this.getFwdBufferInfo(this.mediaBuffer,o),c=Math.max(t.duration,d?d.len:this.config.maxBufferLength);this.reduceMaxBufferLength(c)&&a.removeFragment(t)}else((i=this.mediaBuffer)==null?void 0:i.buffered.length)===0?a.removeAllFragments():a.hasParts(t.type)&&(a.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),a.getState(t)===Te&&a.removeFragment(t))},e.flushMainBuffer=function(t,i,a){if(a===void 0&&(a=null),t-i){var o={startOffset:t,endOffset:i,type:a};this.hls.trigger(k.BUFFER_FLUSHING,o)}},e._loadInitSegment=function(t,i){var a=this;this._doFragLoad(t,i).then(function(o){if(!o||a.fragContextChanged(t)||!a.levels)throw new Error("init load aborted");return o}).then(function(o){var d=a.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 a.decrypter.decrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).catch(function(p){throw d.trigger(k.ERROR,{type:se.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 d.trigger(k.FRAG_DECRYPTED,{frag:t,payload:p,stats:{tstart:h,tdecrypt:E}}),o.payload=p,o})}return o}).then(function(o){var d=a.fragCurrent,c=a.hls;if(!a.levels)throw new Error("init load aborted, missing levels");var f=t.stats;a.state=De,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===d&&c.trigger(k.FRAG_BUFFERED,{stats:f,frag:d,part:null,id:t.type}),a.tick()}).catch(function(o){a.state!==Ut&&a.state!==hn&&(a.warn(o),a.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 a,o,d,c,f=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(i?" part: "+i.index:"")+" of "+(this.playlistType===rt?"level":"track")+" "+t.level+" (frag:["+((a=t.startPTS)!=null?a:NaN).toFixed(3)+"-"+((o=t.endPTS)!=null?o:NaN).toFixed(3)+"] > buffer:"+(f?Da(he.getBuffered(f)):"(detached)")+")"),this.state=De,f&&(!this.loadedmetadata&&t.type==rt&&f.buffered.length&&((d=this.fragCurrent)==null?void 0:d.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 a=t.frag,o=t.part,d=t.partsLoaded,c=!d||d.length===0||d.some(function(h){return!h}),f=new fe(a.level,a.sn,a.stats.chunkCount+1,0,o?o.index:-1,!c);i.flush(f)}},e._handleFragmentLoadProgress=function(t){},e._doFragLoad=function(t,i,a,o){var d,c=this;a===void 0&&(a=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||(d=t.decryptdata)!=null&&d.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=Sr,this.fragCurrent=t,h=this.keyLoader.load(t).then(function(S){if(!c.fragContextChanged(S.frag))return c.hls.trigger(k.KEY_LOADED,S),c.state===Sr&&(c.state=De),S}),this.hls.trigger(k.KEY_LOADING,{frag:t}),this.fragCurrent===null&&(h=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),a=Math.max(t.start,a||0),this.config.lowLatencyMode&&t.sn!=="initSegment"){var p=f.partList;if(p&&o){a>t.end&&f.fragmentHint&&(t=f.fragmentHint);var E=this.getNextPart(p,t,a);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(a.toFixed(3))),this.nextLoadPosition=A.start+A.duration,this.state=Xr,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(k.FRAG_LOADING,{frag:t,part:A,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):b}if(!t.url||this.loadedEndOfParts(p,a))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(a.toFixed(3))),re(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=Xr;var w,D=this.config.progressive;return w=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(k.FRAG_LOADING,{frag:t,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):w},e.doFragPartsLoad=function(t,i,a,o){var d=this;return new Promise(function(c,f){var h,p=[],E=(h=a.details)==null?void 0:h.partList;(function b(A){d.fragmentLoader.loadPart(t,A,o).then(function(w){p[A.index]=w;var D=w.part;d.hls.trigger(k.FRAG_LOADED,w);var S=Ho(a,t.sn,A.index+1)||Go(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(k.ERROR,i)}else this.hls.trigger(k.ERROR,{type:se.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===kr){var a=i.frag,o=i.part,d=i.level,c=self.performance.now();a.stats.parsing.end=c,o&&(o.stats.parsing.end=c),this.updateLevelTiming(a,o,d,t.partial)}else this.fragCurrent||this.state===Ut||this.state===hn||(this.state=De)},e.getCurrentContext=function(t){var i=this.levels,a=this.fragCurrent,o=t.level,d=t.sn,c=t.part;if(i==null||!i[o])return this.warn("Levels object was unset while buffering fragment "+d+" of level "+o+". The current chunk will not be buffered."),null;var f=i[o],h=c>-1?Ho(f,d,c):null,p=h?h.fragment:function(E,b,A){if(E==null||!E.details)return null;var w=E.details,D=w.fragments[b-w.startSN];return D||((D=w.fragmentHint)&&D.sn===b?D:b<w.startSN&&A&&A.sn===b?A:null)}(f,d,a);return p?(a&&a!==p&&(p.stats=a.stats),{frag:p,part:h,level:f}):null},e.bufferFragmentData=function(t,i,a,o){var d;if(t&&this.state===kr){var c=t.data1,f=t.data2,h=c;if(c&&f&&(h=yr(c,f)),(d=h)!=null&&d.length){var p={type:t.type,frag:i,part:a,chunkMeta:o,parent:i.type,data:h};this.hls.trigger(k.BUFFER_APPENDING,p),t.dropped&&t.independent&&!a&&this.flushBufferGap(i)}}},e.flushBufferGap=function(t){var i=this.media;if(i)if(he.isBuffered(i,i.currentTime)){var a=i.currentTime,o=he.bufferInfo(i,a,0),d=t.duration,c=Math.min(2*this.config.maxFragLookUpTolerance,.25*d),f=Math.max(Math.min(t.start-c,o.end-c),a+c);t.start-f>c&&this.flushMainBuffer(f,t.start)}else this.flushMainBuffer(0,t.start)},e.getFwdBufferInfo=function(t,i){var a=this.getLoadPosition();return re(a)?this.getFwdBufferInfoAtPos(t,a,i):null},e.getFwdBufferInfoAtPos=function(t,i,a){var o=this.config.maxBufferHole,d=he.bufferInfo(t,i,o);if(d.len===0&&d.nextStart!==void 0){var c=this.fragmentTracker.getBufferedFrag(i,a);if(c&&d.nextStart<c.end)return he.bufferInfo(t,i,Math.max(d.nextStart,o))}return d},e.getMaxBufferLength=function(t){var i,a=this.config;return i=t?Math.max(8*a.maxBufferSize/t,a.maxBufferLength):a.maxBufferLength,Math.min(i,a.maxMaxBufferLength)},e.reduceMaxBufferLength=function(t){var i=this.config,a=t||i.maxBufferLength;return i.maxMaxBufferLength>=a&&(i.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+i.maxMaxBufferLength+"s"),!0)},e.getAppendedFrag=function(t,i){var a=this.fragmentTracker.getAppendedFrag(t,rt);return a&&"fragment"in a?a.fragment:a},e.getNextFragment=function(t,i){var a=i.fragments,o=a.length;if(!o)return null;var d,c=this.config,f=a[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||(d=this.getInitialLiveFragment(i,a),this.startPosition=d?this.hls.liveSyncPosition||d.start:t)}else t<=f&&(d=a[0]);if(!d){var p=c.lowLatencyMode?i.partEnd:i.fragmentEnd;d=this.getFragmentAtPosition(t,p,i)}return this.mapToInitFragWhenRequired(d)},e.isLoopLoading=function(t,i){var a=this.fragmentTracker.getState(t);return(a===Re||a===Te&&!!t.gap)&&this.nextLoadPosition>i},e.getNextFragmentLoopLoading=function(t,i,a,o,d){var c=t.gap,f=this.getNextFragment(this.nextLoadPosition,i);if(f===null)return f;if(t=f,c&&t&&!t.gap&&a.nextStart){var h=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,a.nextStart,o);if(h!==null&&a.len+h.len>=d)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,a){for(var o=-1,d=!1,c=!0,f=0,h=t.length;f<h;f++){var p=t[f];if(c=c&&!p.independent,o>-1&&a<p.start)break;var E=p.loaded;E?o=-1:(d||p.independent||c)&&p.fragment===i&&(o=f),d=E}return o},e.loadedEndOfParts=function(t,i){var a=t[t.length-1];return a&&i>a.start&&a.loaded},e.getInitialLiveFragment=function(t,i){var a=this.fragPrevious,o=null;if(a){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+a.programDateTime),o=function(h,p,E){if(p===null||!Array.isArray(h)||!h.length||!re(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(bi(p,E,A))return A}return null}(i,a.endProgramDateTime,this.config.maxFragLookUpTolerance)),!o){var d=a.sn+1;if(d>=t.startSN&&d<=t.endSN){var c=i[d-t.startSN];a.cc===c.cc&&(o=c,this.log("Live playlist, switching playlist, load frag with next SN: "+o.sn))}o||(o=function(h,p){return Wo(h,function(E){return E.cc<p?1:E.cc>p?-1:0})}(i,a.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,a){var o,d=this.config,c=this.fragPrevious,f=a.fragments,h=a.endSN,p=a.fragmentHint,E=d.maxFragLookUpTolerance,b=a.partList,A=!!(d.lowLatencyMode&&b!=null&&b.length&&p);if(A&&p&&!this.bitrateTest&&(f=f.concat(p),h=p.sn),o=t<i?Ra(c,f,t,t>i-E?0:E):f[f.length-1]){var w=o.sn-a.startSN,D=this.fragmentTracker.getState(o);if((D===Re||D===Te&&o.gap)&&(c=o),c&&o.sn===c.sn&&(!A||b[0].fragment.sn>o.sn)&&c&&o.level===c.level){var S=f[w+1];o=o.sn<h&&this.fragmentTracker.getState(S)!==Re?S:null}}return o},e.synchronizeToLiveEdge=function(t){var i=this.config,a=this.media;if(a){var o=this.hls.liveSyncPosition,d=a.currentTime,c=t.fragments[0].start,f=t.edge,h=d>=c-i.maxFragLookUpTolerance&&d<=f;if(o!==null&&a.duration>o&&(d<o||!h)){var p=i.liveMaxLatencyDuration!==void 0?i.liveMaxLatencyDuration:i.liveMaxLatencyDurationCount*t.targetduration;(!h&&a.readyState<4||d<f-p)&&(this.loadedmetadata||(this.nextLoadPosition=o),a.readyState&&(this.warn("Playback: "+d.toFixed(3)+" is located too far from the end of live sliding playlist: "+f+", reset currentTime to : "+o.toFixed(3)),a.currentTime=o))}}},e.alignPlaylists=function(t,i){var a=this.levels,o=this.levelLastLoaded,d=this.fragPrevious,c=o!==null?a[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,E=t.alignedSliding&&re(h);if(p||!E&&!h){ni(d,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: "+(d?d.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 a=this.startPosition;if(a<i&&(a=-1),a===-1||this.lastCurrentTime===-1){var o=this.startTimeOffset!==null,d=o?this.startTimeOffset:t.startTimeOffset;d!==null&&re(d)?(a=i+d,d<0&&(a+=t.totalduration),a=Math.min(Math.max(i,a),i+t.totalduration),this.log("Start time offset "+d+" found in "+(o?"multivariant":"media")+" playlist, adjust startPosition to "+a),this.startPosition=a):t.live?a=this.hls.liveSyncPosition||i:this.startPosition=a=0,this.lastCurrentTime=a}this.nextLoadPosition=a},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===Zr)||(this.state=De)},e.onFragmentOrKeyLoadError=function(t,i){if(i.chunkMeta&&!i.frag){var a=this.getCurrentContext(i.chunkMeta);a&&(i.frag=a.frag)}var o=i.frag;if(o&&o.type===t&&this.levels)if(this.fragContextChanged(o)){var d;this.warn("Frag load error must match current frag to retry "+o.url+" > "+((d=this.fragCurrent)==null?void 0:d.url))}else{var c=i.details===W.FRAG_GAP;c&&this.fragmentTracker.fragBuffered(o,!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===g&&A){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var w=Es(A,b);this.warn("Fragment "+o.sn+" of "+t+" "+o.level+" errored with "+i.details+", retrying loading "+(b+1)+"/"+A.maxNumRetry+" in "+w+"ms"),f.resolved=!0,this.retryDate=self.performance.now()+w,this.state=Zr}else A&&f?(this.resetFragmentErrors(t),b<A.maxNumRetry?c||(f.resolved=!0):U.warn(i.details+" reached or exceeded max retry ("+b+")")):this.state=hn;this.tickImmediate()}},e.reduceLengthAndFlushBuffer=function(t){if(this.state===kr||this.state===Yo){var i=t.parent,a=this.getFwdBufferInfo(this.mediaBuffer,i),o=a&&a.len>.5;o&&this.reduceMaxBufferLength(a.len);var d=!o;return d&&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(),d}return!1},e.resetFragmentErrors=function(t){t===Ri&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Ut&&(this.state=De)},e.afterBufferFlushed=function(t,i,a){if(t){var o=he.getBuffered(t);this.fragmentTracker.detectEvictedFragments(i,o,a),this.state===ys&&this.resetLoadingState()}},e.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=De},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,a,o){var d,c=this,f=a.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 w=o?0:La(f,t,b.startPTS,b.endPTS,b.startDTS,b.endDTS);return c.hls.trigger(k.LEVEL_PTS_UPDATED,{details:f,level:a,drift:w,type:E,frag:t,start:b.startPTS,end:b.endPTS}),!0}return p},!1))a.fragmentError=0;else if(((d=this.transmuxer)==null?void 0:d.error)===null){var h=new Error("Found no media in fragment "+t.sn+" of level "+a.id+" resetting transmuxer to fallback to playlist timing");if(this.warn(h.message),this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:h,frag:t,reason:"Found no media in msn "+t.sn+' of level "'+a.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=Yo,this.hls.trigger(k.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}(tt);function Dh(){return self.SourceBuffer||self.WebKitSourceBuffer}function nr(u,s){return u===void 0&&(u=""),s===void 0&&(s=9e4),{type:u,id:-1,pid:-1,inputTimeScale:s,sequenceNumber:-1,samples:[],dropped:0}}var Ch=function(){function u(){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=u.prototype;return s.resetInitSegment=function(e,t,i,a){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=yr(this.cachedData,e),this.cachedData=null);var i,a=ga(e,0),o=a?a.length:0,d=this._audioTrack,c=this._id3Track,f=a?function(b){for(var A=ts(b),w=0;w<A.length;w++){var D=A[w];if(Eo(D))return _o(D)}}(a):void 0,h=e.length;for((this.basePTS===null||this.frameIndex===0&&re(f))&&(this.basePTS=Fv(f,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),a&&a.length>0&&c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Aa,duration:Number.POSITIVE_INFINITY});o<h;){if(this.canParse(e,o)){var p=this.appendFrame(d,e,o);p?(this.frameIndex++,this.lastPTS=p.sample.pts,i=o+=p.length):o=h}else go(e,o)?(a=ga(e,o),c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Aa,duration:Number.POSITIVE_INFINITY}),i=o+=a.length):o++;if(o===h&&i!==h){var E=xi(e,i);this.cachedData?this.cachedData=yr(this.cachedData,E):this.cachedData=E}}return{audioTrack:d,videoTrack:nr(),id3Track:c,textTrack:nr()}},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:nr(),id3Track:this._id3Track,textTrack:nr()}},s.destroy=function(){},u}(),Fv=function(u,s,e){return re(u)?90*u:9e4*s+(e?9e4*e.baseTime/e.timescale:0)};function Mh(u,s){return u[s]===255&&(246&u[s+1])==240}function xh(u,s){return 1&u[s+1]?7:9}function ed(u,s){return(3&u[s+3])<<11|u[s+4]<<3|(224&u[s+5])>>>5}function $o(u,s){return s+1<u.length&&Mh(u,s)}function Uv(u,s){if($o(u,s)){var e=xh(u,s);if(s+e>=u.length)return!1;var t=ed(u,s);if(t<=e)return!1;var i=s+t;return i===u.length||$o(u,i)}return!1}function Ph(u,s,e,t,i){if(!u.samplerate){var a=function(o,d,c,f){var h,p,E,b,A=navigator.userAgent.toLowerCase(),w=f,D=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=1+((192&d[c+2])>>>6);var S=(60&d[c+2])>>>2;if(!(S>D.length-1))return E=(1&d[c+2])<<2,E|=(192&d[c+3])>>>6,U.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:w};o.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+S})}(s,e,t,i);if(!a)return;u.config=a.config,u.samplerate=a.samplerate,u.channelCount=a.channelCount,u.codec=a.codec,u.manifestCodec=a.manifestCodec,U.log("parsed codec:"+u.codec+", rate:"+a.samplerate+", channels:"+a.channelCount)}}function Oh(u){return 9216e4/u}function Nh(u,s,e,t,i){var a,o=t+i*Oh(u.samplerate),d=function(A,w){var D=xh(A,w);if(w+D<=A.length){var S=ed(A,w)-D;if(S>0)return{headerLength:D,frameLength:S}}}(s,e);if(d){var c=d.frameLength,f=d.headerLength,h=f+c,p=Math.max(0,e+h-s.length);p?(a=new Uint8Array(h-f)).set(s.subarray(e+f,s.length),0):a=s.subarray(e+f,e+h);var E={unit:a,pts:o};return p||u.samples.push(E),{sample:E,length:h,missing:p}}var b=s.length-e;return(a=new Uint8Array(b)).set(s.subarray(e,s.length),0),{sample:{unit:a,pts:o},length:b,missing:-1}}var Bv=function(u){function s(t,i){var a;return(a=u.call(this)||this).observer=void 0,a.config=void 0,a.observer=t,a.config=i,a}z(s,u);var e=s.prototype;return e.resetInitSegment=function(t,i,a,o){u.prototype.resetInitSegment.call(this,t,i,a,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=(ga(t,0)||[]).length,a=t.length;i<a;i++)if(Uv(t,i))return U.log("ADTS sync word found !"),!0;return!1},e.canParse=function(t,i){return function(a,o){return function(d,c){return c+5<d.length}(a,o)&&Mh(a,o)&&ed(a,o)<=a.length-o}(t,i)},e.appendFrame=function(t,i,a){Ph(t,this.observer,i,a,t.manifestCodec);var o=Nh(t,i,a,this.basePTS,this.frameIndex);if(o&&o.missing===0)return o},s}(Ch),Hv=/\/emsg[-/]ID3/i,Gv=function(){function u(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=u.prototype;return s.resetTimeStamp=function(){},s.resetInitSegment=function(e,t,i,a){var o=this.videoTrack=nr("video",1),d=this.audioTrack=nr("audio",1),c=this.txtTrack=nr("text",1);if(this.id3Track=nr("id3",1),this.timeOffset=0,e!=null&&e.byteLength){var f=as(e);if(f.video){var h=f.video,p=h.id,E=h.timescale,b=h.codec;o.id=p,o.timescale=c.timescale=E,o.codec=b}if(f.audio){var A=f.audio,w=A.id,D=A.timescale,S=A.codec;d.id=w,d.timescale=D,d.codec=S}c.id=To.text,o.sampleDuration=0,o.duration=d.duration=a}},s.resetContiguity=function(){this.remainderData=null},u.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,a=this.videoTrack,o=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=yr(this.remainderData,e));var d=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=xi(f,0,E.byteOffset-8),h.remainder=xi(f,E.byteOffset-8),h}(i);this.remainderData=d.remainder,a.samples=d.valid||new Uint8Array}else a.samples=i;var c=this.extractID3Track(a,t);return o.samples=ss(t,a),{videoTrack:a,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 a=this.extractID3Track(t,this.timeOffset);return i.samples=ss(e,t),{videoTrack:t,audioTrack:nr(),id3Track:a,textTrack:nr()}},s.extractID3Track=function(e,t){var i=this.id3Track;if(e.samples.length){var a=Je(e.samples,["emsg"]);a&&a.forEach(function(o){var d=function(p){var E=p[0],b="",A="",w=0,D=0,S=0,L=0,N=0,P=0;if(E===0){for(;Mt(p.subarray(P,P+1))!=="\0";)b+=Mt(p.subarray(P,P+1)),P+=1;for(b+=Mt(p.subarray(P,P+1)),P+=1;Mt(p.subarray(P,P+1))!=="\0";)A+=Mt(p.subarray(P,P+1)),P+=1;A+=Mt(p.subarray(P,P+1)),P+=1,w=He(p,12),D=He(p,16),L=He(p,20),N=He(p,24),P=28}else if(E===1){w=He(p,P+=4);var V=He(p,P+=4),Y=He(p,P+=4);for(P+=4,S=Math.pow(2,32)*V+Y,Number.isSafeInteger(S)||(S=Number.MAX_SAFE_INTEGER,U.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),L=He(p,P),N=He(p,P+=4),P+=4;Mt(p.subarray(P,P+1))!=="\0";)b+=Mt(p.subarray(P,P+1)),P+=1;for(b+=Mt(p.subarray(P,P+1)),P+=1;Mt(p.subarray(P,P+1))!=="\0";)A+=Mt(p.subarray(P,P+1)),P+=1;A+=Mt(p.subarray(P,P+1)),P+=1}return{schemeIdUri:b,value:A,timeScale:w,presentationTime:S,presentationTimeDelta:D,eventDuration:L,id:N,payload:p.subarray(P,p.byteLength)}}(o);if(Hv.test(d.schemeIdUri)){var c=re(d.presentationTime)?d.presentationTime/d.timeScale:t+d.presentationTimeDelta/d.timeScale,f=d.eventDuration===4294967295?Number.POSITIVE_INFINITY:d.eventDuration/d.timeScale;f<=.001&&(f=Number.POSITIVE_INFINITY);var h=d.payload;i.samples.push({data:h,len:h.byteLength,dts:c,pts:c,type:Tr,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(){},u}(),jo=null,Vv=[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],Kv=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Wv=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],qv=[0,1,1,4];function Fh(u,s,e,t,i){if(!(e+24>s.length)){var a=Uh(s,e);if(a&&e+a.frameLength<=s.length){var o=t+i*(9e4*a.samplesPerFrame/a.sampleRate),d={unit:s.subarray(e,e+a.frameLength),pts:o,dts:o};return u.config=[],u.channelCount=a.channelCount,u.samplerate=a.sampleRate,u.samples.push(d),{sample:d,length:a.frameLength,missing:0}}}}function Uh(u,s){var e=u[s+1]>>3&3,t=u[s+1]>>1&3,i=u[s+2]>>4&15,a=u[s+2]>>2&3;if(e!==1&&i!==0&&i!==15&&a!==3){var o=u[s+2]>>1&1,d=u[s+3]>>6,c=1e3*Vv[14*(e===3?3-t:t===3?3:4)+i-1],f=Kv[3*(e===3?0:e===2?1:2)+a],h=d===3?1:2,p=Wv[e][t],E=qv[t],b=8*p*E,A=Math.floor(p*c/f+o)*E;if(jo===null){var w=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);jo=w?parseInt(w[1]):0}return!!jo&&jo<=87&&t===2&&c>=224e3&&d===0&&(u[s+3]=128|u[s+3]),{sampleRate:f,channelCount:h,frameLength:A,samplesPerFrame:b}}}function td(u,s){return u[s]===255&&(224&u[s+1])==224&&(6&u[s+1])!=0}function Bh(u,s){return s+1<u.length&&td(u,s)}function Yv(u,s){if(s+1<u.length&&td(u,s)){var e=Uh(u,s),t=4;e!=null&&e.frameLength&&(t=e.frameLength);var i=s+t;return i===u.length||Bh(u,i)}return!1}var Hh=function(){function u(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=u.prototype;return s.loadWord=function(){var e=this.data,t=this.bytesAvailable,i=e.byteLength-t,a=new Uint8Array(4),o=Math.min(4,t);if(o===0)throw new Error("no bytes available");a.set(e.subarray(i,i+o)),this.word=new DataView(a.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&&U.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,a=0;a<e;a++)i!==0&&(i=(t+this.readEG()+256)%256),t=i===0?t:i},s.readSPS=function(){var e,t,i,a=0,o=0,d=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),w=this.skipUEG.bind(this),D=this.skipScalingList.bind(this);f();var S=f();if(h(5),b(3),f(),w(),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),w(),w(),b(1),E())for(t=L!==3?8:12,i=0;i<t;i++)E()&&D(i<6?16:64)}w();var N=p();if(N===0)p();else if(N===1)for(b(1),A(),A(),e=p(),i=0;i<e;i++)A();w(),b(1);var P=p(),V=p(),Y=h(1);Y===0&&b(1),b(1),E()&&(a=p(),o=p(),d=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*(P+1)-2*a-2*o),height:(2-Y)*(V+1)*16-(Y?2:4)*(d+c),pixelRatio:j}},s.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},u}(),$v=function(){function u(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Ni(t,{removePKCS7Padding:!1})}var s=u.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 a=this,o=e[t].unit;if(!(o.length<=16)){var d=o.subarray(16,o.length-o.length%16),c=d.buffer.slice(d.byteOffset,d.byteOffset+d.length);this.decryptBuffer(c).then(function(f){var h=new Uint8Array(f);o.set(h,16),a.decrypter.isSync()||a.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),a=0,o=32;o<e.length-16;o+=160,a+=16)i.set(e.subarray(o,o+16),a);return i},s.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),a=0,o=32;o<e.length-16;o+=160,a+=16)e.set(i.subarray(a,a+16),o);return e},s.decryptAvcSample=function(e,t,i,a,o){var d=this,c=Lo(o.data),f=this.getAvcEncryptedData(c);this.decryptBuffer(f.buffer).then(function(h){o.data=d.getAvcDecryptedUnit(c,h),d.decrypter.isSync()||d.decryptAvcSamples(e,t,i+1,a)})},s.decryptAvcSamples=function(e,t,i,a){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void a();for(var o=e[t].units;!(i>=o.length);i++){var d=o[i];if(!(d.data.length<=48||d.type!==1&&d.type!==5||(this.decryptAvcSample(e,t,i,a,d),this.decrypter.isSync())))return}}},u}(),Di=188,jv=function(){function u(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}u.probe=function(e){var t=u.syncOffset(e);return t>0&&U.warn("MPEG2-TS detected but first sync word found @ offset "+t),t!==-1},u.syncOffset=function(e){for(var t=e.length,i=Math.min(940,e.length-Di)+1,a=0;a<i;){for(var o=!1,d=a;d<t&&e[d]===71;d+=Di)if(o||id(e,d)!==0||(o=!0),o&&d+Di>i)return a;a++}return-1},u.createTrack=function(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:To[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}};var s=u.prototype;return s.resetInitSegment=function(e,t,i,a){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=u.createTrack("video"),this._audioTrack=u.createTrack("audio",a),this._id3Track=u.createTrack("id3"),this._txtTrack=u.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=a},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,a){var o;i===void 0&&(i=!1),a===void 0&&(a=!1),i||(this.sampleAes=null);var d=this._avcTrack,c=this._audioTrack,f=this._id3Track,h=this._txtTrack,p=d.pid,E=d.pesData,b=c.pid,A=f.pid,w=c.pesData,D=f.pesData,S=null,L=this.pmtParsed,N=this._pmtId,P=e.length;if(this.remainderData&&(P=(e=yr(this.remainderData,e)).length,this.remainderData=null),P<Di&&!a)return this.remainderData=e,{audioTrack:c,videoTrack:d,id3Track:f,textTrack:h};var V=Math.max(0,u.syncOffset(e));(P-=(P-V)%Di)<e.byteLength&&!a&&(this.remainderData=new Uint8Array(e.buffer,P,e.buffer.byteLength-P));for(var Y=0,j=V;j<P;j+=Di)if(e[j]===71){var ie=!!(64&e[j+1]),Q=id(e,j),X=void 0;if((48&e[j+3])>>4>1){if((X=j+5+e[j+4])===j+Di)continue}else X=j+4;switch(Q){case p:ie&&(E&&(o=mn(E))&&this.parseAVCPES(d,h,o,!1),E={data:[],size:0}),E&&(E.data.push(e.subarray(X,j+Di)),E.size+=j+Di-X);break;case b:if(ie){if(w&&(o=mn(w)))switch(c.segmentCodec){case"aac":this.parseAACPES(c,o);break;case"mp3":this.parseMPEGPES(c,o)}w={data:[],size:0}}w&&(w.data.push(e.subarray(X,j+Di)),w.size+=j+Di-X);break;case A:ie&&(D&&(o=mn(D))&&this.parseID3PES(f,o),D={data:[],size:0}),D&&(D.data.push(e.subarray(X,j+Di)),D.size+=j+Di-X);break;case 0:ie&&(X+=e[X]+1),N=this._pmtId=zv(e,X);break;case N:ie&&(X+=e[X]+1);var ce=Qv(e,X,this.typeSupported,i);(p=ce.avc)>0&&(d.pid=p),(b=ce.audio)>0&&(c.pid=b,c.segmentCodec=ce.segmentCodec),(A=ce.id3)>0&&(f.pid=A),S===null||L||(U.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=Q}}else Y++;if(Y>0){var oe=new Error("Found "+Y+" TS packet/s that do not start with 0x47");this.observer.emit(k.ERROR,k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:oe,reason:oe.message})}d.pesData=E,c.pesData=w,f.pesData=D;var Ae={audioTrack:c,videoTrack:d,id3Track:f,textTrack:h};return a&&this.extractRemainingSamples(Ae),Ae},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,a=e.videoTrack,o=e.id3Track,d=e.textTrack,c=a.pesData,f=i.pesData,h=o.pesData;if(c&&(t=mn(c))?(this.parseAVCPES(a,d,t,!0),a.pesData=null):a.pesData=c,f&&(t=mn(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&&U.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=f;h&&(t=mn(h))?(this.parseID3PES(o,t),o.pesData=null):o.pesData=h},s.demuxSampleAes=function(e,t,i){var a=this.demux(e,i,!0,!this.config.progressive),o=this.sampleAes=new $v(this.observer,this.config,t);return this.decrypt(a,o)},s.decrypt=function(e,t){return new Promise(function(i){var a=e.audioTrack,o=e.videoTrack;a.samples&&a.segmentCodec==="aac"?t.decryptAacSamples(a.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,a){var o,d=this,c=this.parseAVCNALu(e,i.data),f=this.avcSample,h=!1;i.data=null,f&&c.length&&!e.audFound&&(rd(f,e),f=this.avcSample=zo(!1,i.pts,i.dts,"")),c.forEach(function(p){switch(p.type){case 1:o=!0,f||(f=d.avcSample=zo(!0,i.pts,i.dts,"")),f.frame=!0;var E=p.data;if(h&&E.length>4){var b=new Hh(E).readSliceType();b!==2&&b!==4&&b!==7&&b!==9||(f.key=!0)}break;case 5:o=!0,f||(f=d.avcSample=zo(!0,i.pts,i.dts,"")),f.key=!0,f.frame=!0;break;case 6:o=!0,wo(p.data,1,i.pts,t.samples);break;case 7:if(o=!0,h=!0,!e.sps){var A=p.data,w=new Hh(A).readSPS();e.width=w.width,e.height=w.height,e.pixelRatio=w.pixelRatio,e.sps=[A],e.duration=d._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&&rd(f,e),f=d.avcSample=zo(!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)}),a&&f&&(rd(f,e),this.avcSample=null)},s.getLastNalUnit=function(e){var t,i,a=this.avcSample;if(a&&a.units.length!==0||(a=e[e.length-1]),(t=a)!=null&&t.units){var o=a.units;i=o[o.length-1]}return i},s.parseAVCNALu=function(e,t){var i,a,o=t.byteLength,d=e.naluState||0,c=d,f=[],h=0,p=-1,E=0;for(d===-1&&(p=0,E=31&t[0],d=0,h=1);h<o;)if(i=t[h++],d)if(d!==1)if(i)if(i===1){if(p>=0){var b={data:t.subarray(p,h-d-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)),(a=h-d-1)>0)){var w=new Uint8Array(A.data.byteLength+a);w.set(A.data,0),w.set(t.subarray(0,a),A.data.byteLength),A.data=w,A.state=0}}h<o?(p=h,E=31&t[h],d=0):d=-1}else d=0;else d=3;else d=i?0:2;else d=i?0:1;if(p>=0&&d>=0){var D={data:t.subarray(p,o),type:E,state:d};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=d,f},s.parseAACPES=function(e,t){var i,a,o,d=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),d=c.missing}}for(i=d,a=f.length;i<a-1&&!$o(f,i);i++);if(i!==d){var A,w=i<a-1;A=w?"AAC PES did not start with ADTS header,offset:"+i:"No ADTS header found in AAC PES";var D=new Error(A);if(U.warn("parsing error: "+A),this.observer.emit(k.ERROR,k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,levelRetry:w,error:D,reason:A}),!w)return}if(Ph(e,this.observer,f,i,this.audioCodec),t.pts!==void 0)o=t.pts;else{if(!c)return void U.warn("[tsdemuxer]: AAC PES unknown PTS");var S=Oh(e.samplerate);o=c.sample.pts+S}for(var L,N=0;i<a;){if(i+=(L=Nh(e,f,i,o,N)).length,L.missing){this.aacOverFlow=L;break}for(N++;i<a-1&&!$o(f,i);i++);}},s.parseMPEGPES=function(e,t){var i=t.data,a=i.length,o=0,d=0,c=t.pts;if(c!==void 0)for(;d<a;)if(Bh(i,d)){var f=Fh(e,i,d,c,o);if(!f)break;d+=f.length,o++}else d++;else U.warn("[tsdemuxer]: MPEG PES unknown PTS")},s.parseID3PES=function(e,t){if(t.pts!==void 0){var i=H({},t,{type:this._avcTrack?Tr:Aa,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}else U.warn("[tsdemuxer]: ID3 PES unknown PTS")},u}();function zo(u,s,e,t){return{key:u,frame:!1,pts:s,dts:e,units:[],debug:t,length:0}}function id(u,s){return((31&u[s+1])<<8)+u[s+2]}function zv(u,s){return(31&u[s+10])<<8|u[s+11]}function Qv(u,s,e,t){var i={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},a=s+3+((15&u[s+1])<<8|u[s+2])-4;for(s+=12+((15&u[s+10])<<8|u[s+11]);s<a;){var o=id(u,s);switch(u[s]){case 207:if(!t){U.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){U.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?U.log("MPEG audio found, not supported in this browser"):i.audio===-1&&(i.audio=o,i.segmentCodec="mp3");break;case 36:U.warn("Unsupported HEVC stream type found")}s+=5+((15&u[s+3])<<8|u[s+4])}return i}function mn(u){var s,e,t,i,a,o=0,d=u.data;if(!u||u.size===0)return null;for(;d[0].length<19&&d.length>1;){var c=new Uint8Array(d[0].length+d[1].length);c.set(d[0]),c.set(d[1],d[0].length),d[0]=c,d.splice(1,1)}if(((s=d[0])[0]<<16)+(s[1]<<8)+s[2]===1){if((e=(s[4]<<8)+s[5])&&e>u.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-(a=536870912*(14&s[14])+4194304*(255&s[15])+16384*(254&s[16])+128*(255&s[17])+(254&s[18])/2)>54e5&&(U.warn(Math.round((i-a)/9e4)+"s delta between PTS and DTS, align them"),i=a):a=i);var h=(t=s[8])+9;if(u.size<=h)return null;u.size-=h;for(var p=new Uint8Array(u.size),E=0,b=d.length;E<b;E++){var A=(s=d[E]).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:a,len:e}}return null}function rd(u,s){if(u.units.length&&u.frame){if(u.pts===void 0){var e=s.samples,t=e.length;if(!t)return void s.dropped++;var i=e[t-1];u.pts=i.pts,u.dts=i.dts}s.samples.push(u)}u.debug.length&&U.log(u.pts+"/"+u.dts+":"+u.debug)}var Xv=function(u){function s(){return u.apply(this,arguments)||this}z(s,u);var e=s.prototype;return e.resetInitSegment=function(t,i,a,o){u.prototype.resetInitSegment.call(this,t,i,a,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=(ga(t,0)||[]).length,a=t.length;i<a;i++)if(Yv(t,i))return U.log("MPEG Audio sync word found !"),!0;return!1},e.canParse=function(t,i){return function(a,o){return td(a,o)&&4<=a.length-o}(t,i)},e.appendFrame=function(t,i,a){if(this.basePTS!==null)return Fh(t,i,a,this.basePTS,this.frameIndex)},s}(Ch),Gh=function(){function u(){}return u.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])}},u}(),Jr=Math.pow(2,32)-1,ei=function(){function u(){}return u.init=function(){var s;for(s in u.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:[]},u.types)u.types.hasOwnProperty(s)&&(u.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]);u.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]),a=new Uint8Array([0,0,0,0,0,0,0,0]);u.STTS=u.STSC=u.STCO=a,u.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),u.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),u.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),u.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),d=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);u.FTYP=u.box(u.types.ftyp,o,c,o,d),u.DINF=u.box(u.types.dinf,u.box(u.types.dref,i))},u.box=function(s){for(var e=8,t=arguments.length,i=new Array(t>1?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];for(var o=i.length,d=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<d;o++)c.set(i[o],e),e+=i[o].byteLength;return c},u.hdlr=function(s){return u.box(u.types.hdlr,u.HDLR_TYPES[s])},u.mdat=function(s){return u.box(u.types.mdat,s)},u.mdhd=function(s,e){e*=s;var t=Math.floor(e/(Jr+1)),i=Math.floor(e%(Jr+1));return u.box(u.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]))},u.mdia=function(s){return u.box(u.types.mdia,u.mdhd(s.timescale,s.duration),u.hdlr(s.type),u.minf(s))},u.mfhd=function(s){return u.box(u.types.mfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s]))},u.minf=function(s){return s.type==="audio"?u.box(u.types.minf,u.box(u.types.smhd,u.SMHD),u.DINF,u.stbl(s)):u.box(u.types.minf,u.box(u.types.vmhd,u.VMHD),u.DINF,u.stbl(s))},u.moof=function(s,e,t){return u.box(u.types.moof,u.mfhd(s),u.traf(t,e))},u.moov=function(s){for(var e=s.length,t=[];e--;)t[e]=u.trak(s[e]);return u.box.apply(null,[u.types.moov,u.mvhd(s[0].timescale,s[0].duration)].concat(t).concat(u.mvex(s)))},u.mvex=function(s){for(var e=s.length,t=[];e--;)t[e]=u.trex(s[e]);return u.box.apply(null,[u.types.mvex].concat(t))},u.mvhd=function(s,e){e*=s;var t=Math.floor(e/(Jr+1)),i=Math.floor(e%(Jr+1)),a=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 u.box(u.types.mvhd,a)},u.sdtp=function(s){var e,t,i=s.samples||[],a=new Uint8Array(4+i.length);for(e=0;e<i.length;e++)t=i[e].flags,a[e+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return u.box(u.types.sdtp,a)},u.stbl=function(s){return u.box(u.types.stbl,u.stsd(s),u.box(u.types.stts,u.STTS),u.box(u.types.stsc,u.STSC),u.box(u.types.stsz,u.STSZ),u.box(u.types.stco,u.STCO))},u.avc1=function(s){var e,t,i,a=[],o=[];for(e=0;e<s.sps.length;e++)i=(t=s.sps[e]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.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 d=u.box(u.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|s.sps.length].concat(a).concat([s.pps.length]).concat(o))),c=s.width,f=s.height,h=s.pixelRatio[0],p=s.pixelRatio[1];return u.box(u.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]),d,u.box(u.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),u.box(u.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,255&h,p>>24,p>>16&255,p>>8&255,255&p])))},u.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]))},u.mp4a=function(s){var e=s.samplerate;return u.box(u.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]),u.box(u.types.esds,u.esds(s)))},u.mp3=function(s){var e=s.samplerate;return u.box(u.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]))},u.stsd=function(s){return s.type==="audio"?s.segmentCodec==="mp3"&&s.codec==="mp3"?u.box(u.types.stsd,u.STSD,u.mp3(s)):u.box(u.types.stsd,u.STSD,u.mp4a(s)):u.box(u.types.stsd,u.STSD,u.avc1(s))},u.tkhd=function(s){var e=s.id,t=s.duration*s.timescale,i=s.width,a=s.height,o=Math.floor(t/(Jr+1)),d=Math.floor(t%(Jr+1));return u.box(u.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,d>>24,d>>16&255,d>>8&255,255&d,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,a>>8&255,255&a,0,0]))},u.traf=function(s,e){var t=u.sdtp(s),i=s.id,a=Math.floor(e/(Jr+1)),o=Math.floor(e%(Jr+1));return u.box(u.types.traf,u.box(u.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),u.box(u.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o])),u.trun(s,t.length+16+20+8+16+8+8),t)},u.trak=function(s){return s.duration=s.duration||4294967295,u.box(u.types.trak,u.tkhd(s),u.mdia(s))},u.trex=function(s){var e=s.id;return u.box(u.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]))},u.trun=function(s,e){var t,i,a,o,d,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++)a=(i=f[t]).duration,o=i.size,d=i.flags,c=i.cts,E.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,61440&d.degradPrio,15&d.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*t);return u.box(u.types.trun,E)},u.initSegment=function(s){u.types||u.init();var e=u.moov(s),t=new Uint8Array(u.FTYP.byteLength+e.byteLength);return t.set(u.FTYP),t.set(e,u.FTYP.byteLength),t},u}();function ad(u,s,e,t){e===void 0&&(e=1),t===void 0&&(t=!1);var i=u*s*e;return t?Math.round(i):i}function _s(u,s){return s===void 0&&(s=!1),ad(u,1e3,1/9e4,s)}ei.types=void 0,ei.HDLR_TYPES=void 0,ei.STTS=void 0,ei.STSC=void 0,ei.STCO=void 0,ei.STSZ=void 0,ei.VMHD=void 0,ei.SMHD=void 0,ei.STSD=void 0,ei.FTYP=void 0,ei.DINF=void 0;var Qo=null,nd=null,sd=function(){function u(e,t,i,a){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,Qo===null){var o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Qo=o?parseInt(o[1]):0}if(nd===null){var d=navigator.userAgent.match(/Safari\/(\d+)/i);nd=d?parseInt(d[1]):0}}var s=u.prototype;return s.destroy=function(){},s.resetTimeStamp=function(e){U.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},s.resetNextTimestamp=function(){U.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},s.resetInitSegment=function(){U.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},s.getVideoStartPts=function(e){var t=!1,i=e.reduce(function(a,o){var d=o.pts-a;return d<-4294967296?(t=!0,Fi(a,o.pts)):d>0?a:o.pts},e[0].pts);return t&&U.debug("PTS rollover detected"),i},s.remux=function(e,t,i,a,o,d,c,f){var h,p,E,b,A,w,D=o,S=o,L=e.pid>-1,N=t.pid>-1,P=t.samples.length,V=e.samples.length>0,Y=c&&P>0||P>1;if((!L||V)&&(!N||Y)||this.ISGenerated||c){this.ISGenerated||(E=this.generateIS(e,t,o,d));var j,ie=this.isVideoContiguous,Q=-1;if(Y&&(Q=function(xe){for(var Le=0;Le<xe.length;Le++)if(xe[Le].key)return Le;return-1}(t.samples),!ie&&this.config.forceKeyFrameOnDiscontinuity))if(w=!0,Q>0){U.warn("[mp4-remuxer]: Dropped "+Q+" out of "+P+" 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&&(U.warn("[mp4-remuxer]: No keyframe found out of "+P+" video samples"),w=!1);if(this.ISGenerated){if(V&&Y){var ce=this.getVideoStartPts(t.samples),oe=(Fi(e.samples[0].pts,ce)-ce)/t.inputTimeScale;D+=Math.max(0,oe),S+=Math.max(0,-oe)}if(V){if(e.samplerate||(U.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),E=this.generateIS(e,t,o,d)),p=this.remuxAudio(e,D,this.isAudioContiguous,d,N||Y||f===Ri?S:void 0),Y){var Ae=p?p.endPTS-p.startPTS:0;t.inputTimeScale||(U.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),E=this.generateIS(e,t,o,d)),h=this.remuxVideo(t,S,ie,Ae)}}else Y&&(h=this.remuxVideo(t,S,ie,0));h&&(h.firstKeyFrame=Q,h.independent=Q!==-1,h.firstKeyFramePTS=j)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(A=Vh(i,o,this._initPTS,this._initDTS)),a.samples.length&&(b=Kh(a,o,this._initPTS))),{audio:p,video:h,initSegment:E,independent:w,text:b,id3:A}},s.generateIS=function(e,t,i,a){var o,d,c,f=e.samples,h=t.samples,p=this.typeSupported,E={},b=this._initPTS,A=!b||a,w="audio/mp4";if(A&&(o=d=1/0),e.config&&f.length&&(e.timescale=e.samplerate,e.segmentCodec==="mp3"&&(p.mpeg?(w="audio/mpeg",e.codec=""):p.mp3&&(e.codec="mp3")),E.audio={id:"audio",container:w,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&p.mpeg?new Uint8Array(0):ei.initSegment([e]),metadata:{channelCount:e.channelCount}},A&&(c=e.inputTimeScale,b&&c===b.timescale?A=!1:o=d=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:ei.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);d=Math.min(d,Fi(h[0].dts,D)-S),o=Math.min(o,D-S)}if(Object.keys(E).length)return this.ISGenerated=!0,A?(this._initPTS={baseTime:o,timescale:c},this._initDTS={baseTime:d,timescale:c}):o=c=void 0,{tracks:E,initPTS:o,timescale:c}},s.remuxVideo=function(e,t,i,a){var o,d,c=e.inputTimeScale,f=e.samples,h=[],p=f.length,E=this._initPTS,b=this.nextAvcDts,A=8,w=this.videoSampleDuration,D=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,L=!1;i&&b!==null||(b=t*c-(f[0].pts-Fi(f[0].dts,f[0].pts)));for(var N=E.baseTime*c/E.timescale,P=0;P<p;P++){var V=f[P];V.pts=Fi(V.pts-N,b),V.dts=Fi(V.dts-N,b),V.dts<f[P>0?P-1:P].dts&&(L=!0)}L&&f.sort(function(rl,wf){var zg=rl.dts-wf.dts,Qg=rl.pts-wf.pts;return zg||Qg}),o=f[0].dts;var Y=(d=f[f.length-1].dts)-o,j=Y?Math.round(Y/(p-1)):w||e.inputTimeScale/30;if(i){var ie=o-b,Q=ie>j,X=ie<-1;if((Q||X)&&(Q?U.warn("AVC: "+_s(ie,!0)+" ms ("+ie+"dts) hole between fragments detected, filling it"):U.warn("AVC: "+_s(-ie,!0)+" ms ("+ie+"dts) overlapping between fragments detected"),!X||b>f[0].pts)){o=b;var ce=f[0].pts-ie;f[0].dts=o,f[0].pts=ce,U.log("Video: First PTS/DTS adjusted: "+_s(ce,!0)+"/"+_s(o,!0)+", delta: "+_s(ie,!0)+" ms")}}o=Math.max(0,o);for(var oe=0,Ae=0,xe=0;xe<p;xe++){for(var Le=f[xe],Me=Le.units,Oe=Me.length,Pe=0,Ke=0;Ke<Oe;Ke++)Pe+=Me[Ke].data.length;Ae+=Pe,oe+=Oe,Le.length=Pe,Le.dts=Math.max(Le.dts,o),D=Math.min(Le.pts,D),S=Math.max(Le.pts,S)}d=f[p-1].dts;var je,et=Ae+4*oe+8;try{je=new Uint8Array(et)}catch(rl){return void this.observer.emit(k.ERROR,k.ERROR,{type:se.MUX_ERROR,details:W.REMUX_ALLOC_ERROR,fatal:!1,error:rl,bytes:et,reason:"fail allocating video mdat "+et})}var lt=new DataView(je.buffer);lt.setUint32(0,et),je.set(ei.types.mdat,4);for(var _i=!1,Kt=Number.POSITIVE_INFINITY,Qi=Number.POSITIVE_INFINITY,Bi=Number.NEGATIVE_INFINITY,Hi=Number.NEGATIVE_INFINITY,Wt=0;Wt<p;Wt++){for(var ti=f[Wt],sr=ti.units,ea=0,Ci=0,Ts=sr.length;Ci<Ts;Ci++){var As=sr[Ci],il=As.data,gn=As.data.byteLength;lt.setUint32(A,gn),A+=4,je.set(il,A),A+=gn,ea+=4+gn}var Oa=void 0;if(Wt<p-1)w=f[Wt+1].dts-ti.dts,Oa=f[Wt+1].pts-ti.pts;else{var Ss=this.config,Ir=Wt>0?ti.dts-f[Wt-1].dts:j;if(Oa=Wt>0?ti.pts-f[Wt-1].pts:j,Ss.stretchShortVideoTrack&&this.nextAudioPts!==null){var Wg=Math.floor(Ss.maxBufferHole*c),wd=(a?D+a*c:this.nextAudioPts)-ti.pts;wd>Wg?((w=wd-Ir)<0?w=Ir:_i=!0,U.log("[mp4-remuxer]: It is approximately "+wd/90+" ms to the next segment; using duration "+w/90+" ms for the last video frame.")):w=Ir}else w=Ir}var qg=Math.round(ti.pts-ti.dts);Kt=Math.min(Kt,w),Bi=Math.max(Bi,w),Qi=Math.min(Qi,Oa),Hi=Math.max(Hi,Oa),h.push(new Wh(ti.key,w,ea,qg))}if(h.length){if(Qo){if(Qo<70){var Af=h[0].flags;Af.dependsOn=2,Af.isNonSync=0}}else if(nd&&Hi-Qi<Bi-Kt&&j/Bi<.025&&h[0].cts===0){U.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var Ld=o,Xi=0,Sf=h.length;Xi<Sf;Xi++){var kf=Ld+h[Xi].duration,Yg=Ld+h[Xi].cts;if(Xi<Sf-1){var $g=kf+h[Xi+1].cts;h[Xi].duration=$g-Yg}else h[Xi].duration=Xi?h[Xi-1].duration:j;h[Xi].cts=0,Ld=kf}}}w=_i||!w?j:w,this.nextAvcDts=b=d+w,this.videoSampleDuration=w,this.isVideoContiguous=!0;var jg={data1:ei.moof(e.sequenceNumber++,o,H({},e,{samples:h})),data2:je,startPTS:D/c,endPTS:(S+w)/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,jg},s.remuxAudio=function(e,t,i,a,o){var d=e.inputTimeScale,c=d/(e.samplerate?e.samplerate:d),f=e.segmentCodec==="aac"?1024:1152,h=f*c,p=this._initPTS,E=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,b=[],A=o!==void 0,w=e.samples,D=E?0:8,S=this.nextAudioPts||-1,L=t*d,N=p.baseTime*d/p.timescale;if(this.isAudioContiguous=i=i||w.length&&S>0&&(a&&Math.abs(L-S)<9e3||Math.abs(Fi(w[0].pts-N,L)-S)<20*h),w.forEach(function(Ci){Ci.pts=Fi(Ci.pts-N,L)}),!i||S<0){if(w=w.filter(function(Ci){return Ci.pts>=0}),!w.length)return;S=o===0?0:a&&!A?Math.max(0,L):w[0].pts}if(e.segmentCodec==="aac")for(var P=this.config.maxAudioFramesDrift,V=0,Y=S;V<w.length;V++){var j=w[V],ie=j.pts,Q=ie-Y,X=Math.abs(1e3*Q/d);if(Q<=-P*h&&A)V===0&&(U.warn("Audio frame @ "+(ie/d).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Q/d)+" ms."),this.nextAudioPts=S=Y=ie);else if(Q>=P*h&&X<1e4&&A){var ce=Math.round(Q/h);(Y=ie-ce*h)<0&&(ce--,Y+=h),V===0&&(this.nextAudioPts=S=Y),U.warn("[mp4-remuxer]: Injecting "+ce+" audio frame @ "+(Y/d).toFixed(3)+"s due to "+Math.round(1e3*Q/d)+" ms gap.");for(var oe=0;oe<ce;oe++){var Ae=Math.max(Y,0),xe=Gh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);xe||(U.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=j.unit.subarray()),w.splice(V,0,{unit:xe,pts:Ae}),Y+=h,V++}}j.pts=Y,Y+=h}for(var Le,Me=null,Oe=null,Pe=0,Ke=w.length;Ke--;)Pe+=w[Ke].unit.byteLength;for(var je=0,et=w.length;je<et;je++){var lt=w[je],_i=lt.unit,Kt=lt.pts;if(Oe!==null)b[je-1].duration=Math.round((Kt-Oe)/c);else{if(i&&e.segmentCodec==="aac"&&(Kt=S),Me=Kt,!(Pe>0))return;Pe+=D;try{Le=new Uint8Array(Pe)}catch(Ci){return void this.observer.emit(k.ERROR,k.ERROR,{type:se.MUX_ERROR,details:W.REMUX_ALLOC_ERROR,fatal:!1,error:Ci,bytes:Pe,reason:"fail allocating audio mdat "+Pe})}E||(new DataView(Le.buffer).setUint32(0,Pe),Le.set(ei.types.mdat,4))}Le.set(_i,D);var Qi=_i.byteLength;D+=Qi,b.push(new Wh(!0,f,Qi,0)),Oe=Kt}var Bi=b.length;if(Bi){var Hi=b[b.length-1];this.nextAudioPts=S=Oe+c*Hi.duration;var Wt=E?new Uint8Array(0):ei.moof(e.sequenceNumber++,Me/c,H({},e,{samples:b}));e.samples=[];var ti=Me/d,sr=S/d,ea={data1:Wt,data2:Le,startPTS:ti,endPTS:sr,startDTS:ti,endDTS:sr,type:"audio",hasAudio:!0,hasVideo:!1,nb:Bi};return this.isAudioContiguous=!0,ea}},s.remuxEmptyAudio=function(e,t,i,a){var o=e.inputTimeScale,d=o/(e.samplerate?e.samplerate:o),c=this.nextAudioPts,f=this._initDTS,h=9e4*f.baseTime/f.timescale,p=(c!==null?c:a.startDTS*o)+h,E=a.endDTS*o+h,b=1024*d,A=Math.ceil((E-p)/b),w=Gh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(U.warn("[mp4-remuxer]: remux empty Audio"),w){for(var D=[],S=0;S<A;S++){var L=p+S*b;D.push({unit:w,pts:L,dts:L})}return e.samples=D,this.remuxAudio(e,t,i,!1)}U.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},u}();function Fi(u,s){var e;if(s===null)return u;for(e=s<u?-8589934592:8589934592;Math.abs(u-s)>4294967296;)u+=e;return u}function Vh(u,s,e,t){var i=u.samples.length;if(i){for(var a=u.inputTimeScale,o=0;o<i;o++){var d=u.samples[o];d.pts=Fi(d.pts-9e4*e.baseTime/e.timescale,s*a)/a,d.dts=Fi(d.dts-9e4*t.baseTime/t.timescale,s*a)/a}var c=u.samples;return u.samples=[],{samples:c}}}function Kh(u,s,e){var t=u.samples.length;if(t){for(var i=u.inputTimeScale,a=0;a<t;a++){var o=u.samples[a];o.pts=Fi(o.pts-9e4*e.baseTime/e.timescale,s*i)/i}u.samples.sort(function(c,f){return c.pts-f.pts});var d=u.samples;return u.samples=[],{samples:d}}}var wr,Wh=function(u,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 Zv(u)},Zv=function(u){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=u?2:1,this.isNonSync=u?0:1},Jv=function(){function u(){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=u.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,a){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(o,d){if(!o||!d)return o;var c=d.keyId;return c&&d.isCommonEncryption&&Je(o,["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 w=ns(A);if(w){var D=w.subarray(8,24);D.some(function(S){return S!==0})||(U.log("[eme] Patching keyId in 'enc"+(E?"a":"v")+">sinf>>tenc' box: "+Pi(D)+" -> "+Pi(c)),w.set(c,8))}})})}),o}(e,a)),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 a=this.initData=as(e);t||(t=qh(a.audio,gt)),i||(i=qh(a.video,Ct));var o={};a.audio&&a.video?o.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:a.audio?o.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:a.video?o.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:U.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},s.remux=function(e,t,i,a,o,d){var c,f,h=this.initPTS,p=this.lastEndTime,E={audio:void 0,video:void 0,text:a,id3:i,initSegment:void 0};re(p)||(p=this.lastEndTime=o||0);var b=t.samples;if(b==null||!b.length)return E;var A={initPTS:void 0,timescale:1},w=this.initData;if((c=w)!=null&&c.length||(this.generateInitSegment(b),w=this.initData),(f=w)==null||!f.length)return U.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(A.tracks=this.initTracks,this.emitInitSegment=!1);var D=function(Q,X){for(var ce=0,oe=0,Ae=0,xe=Je(Q,["moof","traf"]),Le=0;Le<xe.length;Le++){var Me=xe[Le],Oe=Je(Me,["tfhd"])[0],Pe=X[He(Oe,4)];if(Pe){var Ke=Pe.default,je=He(Oe,0)|(Ke==null?void 0:Ke.flags),et=Ke==null?void 0:Ke.duration;8&je&&(et=He(Oe,2&je?12:8));for(var lt=Pe.timescale||9e4,_i=Je(Me,["trun"]),Kt=0;Kt<_i.length;Kt++)!(ce=Wu(_i[Kt]))&&et&&(ce=et*He(_i[Kt],4)),Pe.type===Ct?oe+=ce/lt:Pe.type===gt&&(Ae+=ce/lt)}}if(oe===0&&Ae===0){for(var Qi=0,Bi=Je(Q,["sidx"]),Hi=0;Hi<Bi.length;Hi++){var Wt=So(Bi[Hi]);Wt!=null&&Wt.references&&(Qi+=Wt.references.reduce(function(ti,sr){return ti+sr.info.duration||0},0))}return Qi}return oe||Ae}(b,w),S=function(Q,X){return Je(X,["moof","traf"]).reduce(function(ce,oe){var Ae=Je(oe,["tfdt"])[0],xe=Ae[0],Le=Je(oe,["tfhd"]).reduce(function(Me,Oe){var Pe=He(Oe,4),Ke=Q[Pe];if(Ke){var je=He(Ae,4);if(xe===1){if(je===Ea)return U.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),Me;je*=Ea+1,je+=He(Ae,8)}var et=je/(Ke.timescale||9e4);if(isFinite(et)&&(Me===null||et<Me))return et}return Me},null);return Le!==null&&isFinite(Le)&&(ce===null||Le<ce)?Le:ce},null)}(w,b),L=S===null?o:S;(function(Q,X,ce,oe){if(Q===null)return!0;var Ae=Math.max(oe,1),xe=X-Q.baseTime/Q.timescale;return Math.abs(xe-ce)>Ae}(h,L,o,D)||A.timescale!==h.timescale&&d)&&(A.initPTS=L-o,h&&h.timescale===1&&U.warn("Adjusting initPTS by "+(A.initPTS-h.baseTime)),this.initPTS=h={baseTime:A.initPTS,timescale:1});var N=e?L-h.baseTime/h.timescale:p,P=N+D;(function(Q,X,ce){Je(X,["moof","traf"]).forEach(function(oe){Je(oe,["tfhd"]).forEach(function(Ae){var xe=He(Ae,4),Le=Q[xe];if(Le){var Me=Le.timescale||9e4;Je(oe,["tfdt"]).forEach(function(Oe){var Pe=Oe[0],Ke=He(Oe,4);if(Pe===0)Ke-=ce*Me,rs(Oe,4,Ke=Math.max(Ke,0));else{Ke*=Math.pow(2,32),Ke+=He(Oe,8),Ke-=ce*Me,Ke=Math.max(Ke,0);var je=Math.floor(Ke/(Ea+1)),et=Math.floor(Ke%(Ea+1));rs(Oe,4,je),rs(Oe,8,et)}})}})})})(w,b,h.baseTime/h.timescale),D>0?this.lastEndTime=P:(U.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var V=!!w.audio,Y=!!w.video,j="";V&&(j+="audio"),Y&&(j+="video");var ie={data1:b,startPTS:N,startDTS:N,endPTS:P,endDTS:P,type:j,hasAudio:V,hasVideo:Y,nb:1,dropped:0};return E.audio=ie.type==="audio"?ie:void 0,E.video=ie.type!=="audio"?ie:void 0,E.initSegment=A,E.id3=Vh(i,o,h,h),a.samples.length&&(E.text=Kh(a,o,h)),E},u}();function qh(u,s){var e=u==null?void 0:u.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===Ct?"avc1.42e01e":"mp4a.40.5"}try{wr=self.performance.now.bind(self.performance)}catch{U.debug("Unable to use Performance API on this environment"),wr=typeof self!="undefined"&&self.Date.now}var od=[{demux:Gv,remux:Jv},{demux:jv,remux:sd},{demux:Bv,remux:sd},{demux:Xv,remux:sd}],ld=function(){function u(e,t,i,a,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=a,this.id=o}var s=u.prototype;return s.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},s.push=function(e,t,i,a){var o=this,d=i.transmuxing;d.executeStart=wr();var c=new Uint8Array(e),f=this.currentTransmuxState,h=this.transmuxConfig;a&&(this.currentTransmuxState=a);var p=a||f,E=p.contiguous,b=p.discontinuity,A=p.trackSwitch,w=p.accurateTimeOffset,D=p.timeOffset,S=p.initSegmentChange,L=h.audioCodec,N=h.videoCodec,P=h.defaultInitPts,V=h.duration,Y=h.initSegmentData,j=function(xe,Le){var Me=null;return xe.byteLength>0&&Le!=null&&Le.key!=null&&Le.iv!==null&&Le.method!=null&&(Me=Le),Me}(c,t);if(j&&j.method==="AES-128"){var ie=this.getDecrypter();if(!ie.isSync())return this.decryptionPromise=ie.webCryptoDecrypt(c,j.key.buffer,j.iv.buffer).then(function(xe){var Le=o.push(xe,null,i);return o.decryptionPromise=null,Le}),this.decryptionPromise;var Q=ie.softwareDecrypt(c,j.key.buffer,j.iv.buffer);if(i.part>-1&&(Q=ie.flush()),!Q)return d.executeEnd=wr(),ud(i);c=new Uint8Array(Q)}var X=this.needsProbing(b,A);if(X){var ce=this.configureTransmuxer(c);if(ce)return U.warn("[transmuxer] "+ce.message),this.observer.emit(k.ERROR,k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:ce,reason:ce.message}),d.executeEnd=wr(),ud(i)}(b||A||S||X)&&this.resetInitSegment(Y,L,N,V,t),(b||S||X)&&this.resetInitialTimestamp(P),E||this.resetContiguity();var oe=this.transmux(c,j,D,w,i),Ae=this.currentTransmuxState;return Ae.contiguous=!0,Ae.discontinuity=!1,Ae.trackSwitch=!1,d.executeEnd=wr(),oe},s.flush=function(e){var t=this,i=e.transmuxing;i.executeStart=wr();var a=this.decrypter,o=this.currentTransmuxState,d=this.decryptionPromise;if(d)return d.then(function(){return t.flush(e)});var c=[],f=o.timeOffset;if(a){var h=a.flush();h&&c.push(this.push(h,null,e))}var p=this.demuxer,E=this.remuxer;if(!p||!E)return i.executeEnd=wr(),[ud(e)];var b=p.flush(f);return Ma(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 a=t.audioTrack,o=t.videoTrack,d=t.id3Track,c=t.textTrack,f=this.currentTransmuxState,h=f.accurateTimeOffset,p=f.timeOffset;U.log("[transmuxer.ts]: Flushed fragment "+i.sn+(i.part>-1?" p: "+i.part:"")+" of level "+i.level);var E=this.remuxer.remux(a,o,d,c,p,h,!0,this.id);e.push({remuxResult:E,chunkMeta:i}),i.transmuxing.executeEnd=wr()},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,a,o){var d=this.demuxer,c=this.remuxer;d&&c&&(d.resetInitSegment(e,t,i,a),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,a,o){return t&&t.method==="SAMPLE-AES"?this.transmuxSampleAes(e,t,i,a,o):this.transmuxUnencrypted(e,i,a,o)},s.transmuxUnencrypted=function(e,t,i,a){var o=this.demuxer.demux(e,t,!1,!this.config.progressive),d=o.audioTrack,c=o.videoTrack,f=o.id3Track,h=o.textTrack;return{remuxResult:this.remuxer.remux(d,c,f,h,t,i,!1,this.id),chunkMeta:a}},s.transmuxSampleAes=function(e,t,i,a,o){var d=this;return this.demuxer.demuxSampleAes(e,t,i).then(function(c){return{remuxResult:d.remuxer.remux(c.audioTrack,c.videoTrack,c.id3Track,c.textTrack,i,a,!1,d.id),chunkMeta:o}})},s.configureTransmuxer=function(e){for(var t,i=this.config,a=this.observer,o=this.typeSupported,d=this.vendor,c=0,f=od.length;c<f;c++)if(od[c].demux.probe(e)){t=od[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(a,i,o,d)),h&&h instanceof b||(this.demuxer=new b(a,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 Ni(this.config)),e},u}(),ud=function(u){return{remuxResult:{},chunkMeta:u}};function Ma(u){return"then"in u&&u.then instanceof Function}var eg=function(u,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=u,this.videoCodec=s,this.initSegmentData=e,this.duration=t,this.defaultInitPts=i||null},tg=function(u,s,e,t,i,a){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=u,this.contiguous=s,this.accurateTimeOffset=e,this.trackSwitch=t,this.timeOffset=i,this.initSegmentChange=a},Yh={exports:{}};(function(u){var s=Object.prototype.hasOwnProperty,e="~";function t(){}function i(c,f,h){this.fn=c,this.context=f,this.once=h||!1}function a(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 o(c,f){--c._eventsCount==0?c._events=new t:delete c._events[f]}function d(){this._events=new t,this._eventsCount=0}Object.create&&(t.prototype=Object.create(null),new t().__proto__||(e=!1)),d.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},d.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},d.prototype.listenerCount=function(c){var f=e?e+c:c,h=this._events[f];return h?h.fn?1:h.length:0},d.prototype.emit=function(c,f,h,p,E,b){var A=e?e+c:c;if(!this._events[A])return!1;var w,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,E),!0;case 6:return S.fn.call(S.context,f,h,p,E,b),!0}for(D=1,w=new Array(L-1);D<L;D++)w[D-1]=arguments[D];S.fn.apply(S.context,w)}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(!w)for(N=1,w=new Array(L-1);N<L;N++)w[N-1]=arguments[N];S[D].fn.apply(S[D].context,w)}}return!0},d.prototype.on=function(c,f,h){return a(this,c,f,h,!1)},d.prototype.once=function(c,f,h){return a(this,c,f,h,!0)},d.prototype.removeListener=function(c,f,h,p){var E=e?e+c:c;if(!this._events[E])return this;if(!f)return o(this,E),this;var b=this._events[E];if(b.fn)b.fn!==f||p&&!b.once||h&&b.context!==h||o(this,E);else{for(var A=0,w=[],D=b.length;A<D;A++)(b[A].fn!==f||p&&!b[A].once||h&&b[A].context!==h)&&w.push(b[A]);w.length?this._events[E]=w.length===1?w[0]:w:o(this,E)}return this},d.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},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prefixed=e,d.EventEmitter=d,u.exports=d})(Yh);var Xo=de(Yh.exports);function dd(u,s){if(!((e=s.remuxResult).audio||e.video||e.text||e.id3||e.initSegment))return!1;var e,t=[],i=s.remuxResult,a=i.audio,o=i.video;return a&&$h(t,a),o&&$h(t,o),u.postMessage({event:"transmuxComplete",data:s},t),!0}function $h(u,s){s.data1&&u.push(s.data1.buffer),s.data2&&u.push(s.data2.buffer)}function jh(u,s,e){s.reduce(function(t,i){return dd(u,i)||t},!1)||u.postMessage({event:"transmuxComplete",data:s[0]}),u.postMessage({event:"flush",data:e})}r!==void 0&&r&&function(u){var s=new Xo,e=function(i,a){u.postMessage({event:i,data:a})};s.on(k.FRAG_DECRYPTED,e),s.on(k.ERROR,e);var t=function(){var i=function(o){var d=function(c){e("workerLog",{logType:o,message:c})};U[o]=d};for(var a in U)i(a)};u.addEventListener("message",function(i){var a=i.data;switch(a.cmd){case"init":var o=JSON.parse(a.config);u.transmuxer=new ld(s,a.typeSupported,o,a.vendor,a.id),it(o.debug,a.id),t(),e("init",null);break;case"configure":u.transmuxer.configure(a.config);break;case"demux":var d=u.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Ma(d)?(u.transmuxer.async=!0,d.then(function(h){dd(u,h)}).catch(function(h){e(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,chunkMeta:a.chunkMeta,fatal:!1,error:h,err:h,reason:"transmuxer-worker push error"})})):(u.transmuxer.async=!1,dd(u,d));break;case"flush":var c=a.chunkMeta,f=u.transmuxer.flush(c);Ma(f)||u.transmuxer.async?(Ma(f)||(f=Promise.resolve(f)),f.then(function(h){jh(u,h,c)}).catch(function(h){e(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,chunkMeta:a.chunkMeta,fatal:!1,error:h,err:h,reason:"transmuxer-worker flush error"})})):jh(u,f,c)}})}(self);var cd=nn()||{isTypeSupported:function(){return!1}},zh=function(){function u(e,t,i,a){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 d=e.config;this.hls=e,this.id=t,this.useWorker=!!d.enableWorker,this.onTransmuxComplete=i,this.onFlush=a;var c=function(D,S){(S=S||{}).frag=o.frag,S.id=o.id,D===k.ERROR&&(o.error=S.error),o.hls.trigger(D,S)};this.observer=new Xo,this.observer.on(k.FRAG_DECRYPTED,c),this.observer.on(k.ERROR,c);var f,h,p,E,b={mp4:cd.isTypeSupported("video/mp4"),mpeg:cd.isTypeSupported("audio/mpeg"),mp3:cd.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(!this.useWorker||typeof Worker=="undefined"||(d.workerPath,0))this.transmuxer=new ld(this.observer,b,d,A,t);else try{d.workerPath?(U.log("loading Web Worker "+d.workerPath+' for "'+t+'"'),this.workerContext=(p=d.workerPath,E=new self.URL(p,self.location.href).href,{worker:new self.Worker(E),scriptURL:E})):(U.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 w=this.workerContext.worker;w.addEventListener("message",this.onwmsg),w.onerror=function(D){var S=new Error(D.message+" ("+D.filename+":"+D.lineno+")");d.enableWorker=!1,U.warn('Error in "'+t+'" Web Worker, fallback to inline'),o.hls.trigger(k.ERROR,{type:se.OTHER_ERROR,details:W.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:S})},w.postMessage({cmd:"init",typeSupported:b,vendor:A,id:t,config:JSON.stringify(d)})}catch(D){U.warn('Error setting up "'+t+'" Web Worker, fallback to inline',D),this.resetWorker(),this.error=null,this.transmuxer=new ld(this.observer,b,d,A,t)}}var s=u.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,a,o,d,c,f,h,p){var E,b,A=this;h.transmuxing.start=self.performance.now();var w=this.transmuxer,D=d?d.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,Y=this.part?h.part-this.part.index:-1,j=V===0&&h.id>1&&h.id===(L==null?void 0:L.stats.chunkCount),ie=!P&&(V===1||V===0&&(Y===1||j&&Y<=0)),Q=self.performance.now();(P||V||o.stats.parsing.start===0)&&(o.stats.parsing.start=Q),!d||!Y&&ie||(d.stats.parsing.start=Q);var X=!(L&&((E=o.initSegment)==null?void 0:E.url)===((b=L.initSegment)==null?void 0:b.url)),ce=new tg(N,ie,f,P,D,X);if(!ie||N||X){U.log("[transmuxer-interface, "+o.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
18
|
+
`))this.processLine(this.buffer.substring(0,g)),this.buffer=this.buffer.substring(g+1)},La.prototype.processLine=function(T){var g=T.indexOf(":"),_=Vo(T,g),R=_[0],C=_.length===2?Ia(_[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 fs:if(!isFinite(C)||C<0)return;this.manifest.targetDuration=C,this.setHoldBack();break;case ms:vs(this.manifest,_),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case Qd:vs(this.manifest,_),this.setHoldBack();break;case Xd:C===0?this.currentUri.duration=.01:C>0&&(this.currentUri.duration=C);break;case Bo: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 wa:vs(this.manifest,_);break;case ps:var G=Es(_[1]),$=at(G);Object.assign(this.manifest.sessionData,$)}},La.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 vs=function(T,g){var _,R=gs(g[0].replace("#EXT-X-",""));dn(g[1])?(_={},_=Object.assign(Go(g[1]),_)):_=Ia(g[1]),T[R]=_},gs=function(T){return T.toLowerCase().replace(/-(\w)/g,function(g){return g[1].toUpperCase()})},Ia=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},Ho=function(T){var g={},_=T.split("=");return _.length>1&&(g[gs(_[0])]=Ia(_[1])),g},Go=function(T){for(var g=T.split(","),_={},R=0;g.length>R;R++){var C=g[R],O=Ho(C);_=Object.assign(O,_)}return _},dn=function(T){return T.indexOf("=")>-1},Vo=function(T,g){return g===-1?[T]:[T.substring(0,g),T.substring(g+1)]},Es=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}}},Ko=La,un={safeCall:function(T,g,_,R){var C=R;if(T&&typeof T[g]=="function")try{C=T[g].apply(T,_)}catch(O){ye.info("safeCall error",O)}return C},safeIncrement:k,getComputedStyle:function(T,g){var _;if(T&&g&&H()&&typeof H().getComputedStyle=="function")return ar&&ar.has(T)&&(_=ar.get(T)),_||(_=H().getComputedStyle(T,null),ar&&ar.set(T,_)),_.getPropertyValue(g)},secondsToMs:function(T){return Math.floor(1e3*T)},assign:Object.assign,headersStringToObject:Se,cdnHeadersToRequestId:Xe,extractHostnameAndDomain:Ge,extractHostname:Be,manifestParser:Ko,generateShortID:J,generateUUID:z,now:ue.now},Wo={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 Ra(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=[],$=!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,g)||function(_,R){if(_){if(typeof _=="string")return cn(_,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)?cn(_,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 cn(T,g){(g==null||g>T.length)&&(g=T.length);for(var _=0,R=new Array(g);_<g;_++)R[_]=T[_];return R}var bi={},Sr=function T(g){var _=arguments;typeof g=="string"?T.hasOwnProperty(g)?H().setTimeout(function(){_=Array.prototype.splice.call(_,1),T[g].apply(null,_)},0):ye.warn("`"+g+"` is an unknown task"):typeof g=="function"?H().setTimeout(function(){g(T)},0):ye.warn("`"+g+"` is invalid.")},Zd={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=ln(le(R),3),x=O[0],G=O[1],$=O[2],K=_.log,Z=_.utils.getComputedStyle,Fe=_.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 Fe(x.currentTime)},C.getStateData=function(){var Re,we,Ce=this.hlsjs&&this.hlsjs.url,We=this.dashjs&&Ar(this.dashjs.getSource==="function")&&this.dashjs.getSource(),Pt={player_is_paused:x.paused,player_playhead_time:Fe(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:Sa()&&!!(Sa().fullscreenElement||Sa().webkitFullscreenElement||Sa().mozFullScreenElement||Sa().msFullscreenElement),video_poster_url:x.poster,video_source_url:Ce||We||x.currentSrc,video_source_duration:Fe(x.duration),video_source_height:x.videoHeight,video_source_width:x.videoWidth,view_dropped_frame_count:(Re=x)===null||Re===void 0||(we=Re.getVideoPlaybackQuality)===null||we===void 0?void 0:we.call(Re).droppedVideoFrames},Vt=C.getPlayheadTime();if(x.getStartDate&&Vt>0){var Zt=x.getStartDate();if(Zt&&typeof Zt.getTime=="function"&&Zt.getTime()){var hi=Zt.getTime();if(Pt.player_program_time=hi+Vt,x.seekable.length>0){var Ve=hi+x.seekable.end(x.seekable.length-1);Pt.player_live_edge_program_time=Ve}}}return Pt},x.mux=x.mux||{},x.mux.deleted=!1,x.mux.emit=function(Re,we){_.emit(G,Re,we)};var Te=function(){K.error("The monitor for this video element has already been destroyed.")};x.mux.destroy=function(){Object.keys(x.mux.listeners).forEach(function(Re){x.removeEventListener(Re,x.mux.listeners[Re],!1)}),delete x.mux.listeners,x.mux.destroy=Te,x.mux.swapElement=Te,x.mux.emit=Te,x.mux.addHLSJS=Te,x.mux.addDashJS=Te,x.mux.removeHLSJS=Te,x.mux.removeDashJS=Te,x.mux.deleted=!0,_.emit(G,"destroy")},x.mux.swapElement=function(Re){var we=ln(le(Re),3),Ce=we[0],We=we[1],Pt=we[2];return Ce?Pt!=="video"&&Pt!=="audio"?_.log.error("The element of `"+We+"` was not a media element."):(Ce.muxId=x.muxId,delete x.muxId,Ce.mux=Ce.mux||{},Ce.mux.listeners=Object.assign({},x.mux.listeners),delete x.mux.listeners,Object.keys(Ce.mux.listeners).forEach(function(Vt){x.removeEventListener(Vt,Ce.mux.listeners[Vt],!1),Ce.addEventListener(Vt,Ce.mux.listeners[Vt],!1)}),Ce.mux.swapElement=x.mux.swapElement,Ce.mux.destroy=x.mux.destroy,delete x.mux,void(x=Ce)):_.log.error("No element was found with the `"+We+"` query selector.")},x.mux.addHLSJS=function(Re){_.addHLSJS(G,Re)},x.mux.addDashJS=function(Re){_.addDashJS(G,Re)},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={},jd.forEach(function(Re){(Re!=="error"||C.automaticErrorTracking)&&(x.mux.listeners[Re]=function(){var we={};if(Re==="error"){if(!x.error||x.error.code===1)return;we.player_error_code=x.error.code,we.player_error_message=zd[x.error.code]||x.error.message}_.emit(G,Re,we)},x.addEventListener(Re,x.mux.listeners[Re],!1))})}(Sr,T,g)},destroyMonitor:function(T){var g=Ra(le(T),1)[0];g&&g.mux&&typeof g.mux.destroy=="function"?g.mux.destroy():ye.error("A video element monitor for `"+T+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(T,g){var _=ee(T);bi[_]?bi[_].addHLSJS(g):ye.error("A monitor for `"+_+"` has not been initialized.")},addDashJS:function(T,g){var _=ee(T);bi[_]?bi[_].addDashJS(g):ye.error("A monitor for `"+_+"` has not been initialized.")},removeHLSJS:function(T){var g=ee(T);bi[g]?bi[g].removeHLSJS():ye.error("A monitor for `"+g+"` has not been initialized.")},removeDashJS:function(T){var g=ee(T);bi[g]?bi[g].removeDashJS():ye.error("A monitor for `"+g+"` has not been initialized.")},init:function(T,g){Ee()&&g&&g.respectDoNotTrack&&ye.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var _=ee(T);bi[_]=new hs(Sr,_,g)},emit:function(T,g,_){var R=ee(T);bi[R]?(bi[R].emit(g,_),g==="destroy"&&delete bi[R]):ye.error("A monitor for `"+R+"` has not been initialized.")},checkDoNotTrack:Ee,log:ye,utils:un,events:Wo,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Sr,Zd),H()!==void 0&&typeof H().addEventListener=="function"&&H().addEventListener("pagehide",function(T){T.persisted||(Sr.WINDOW_UNLOADING=!0)},!1);var qo=Sr},655:function(y,I,M){var U,H;function z(J){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(J);}(function(J){var ee=!1;if((H=typeof(U=J)=="function"?U.call(I,M,I,y):U)===void 0||(y.exports=H),ee=!0,z(I)==="object"&&(y.exports=J(),ee=!0),!ee){var le=window.Cookies,me=window.Cookies=J();me.noConflict=function(){return window.Cookies=le,me}}})(function(){var J=function(){for(var ee=0,le={};ee<arguments.length;ee++){var me=arguments[ee];for(var _e in me)le[_e]=me[_e]}return le};return function ee(le){function me(_e,ge,ye){var Ee;if(typeof document!="undefined"){if(arguments.length>1){if(typeof(ye=J({path:"/"},me.defaults,ye)).expires=="number"){var ue=new Date;ue.setMilliseconds(ue.getMilliseconds()+864e5*ye.expires),ye.expires=ue}try{Ee=JSON.stringify(ge),/^[\{\[]/.test(Ee)&&(ge=Ee)}catch{}return ge=le.write?le.write(ge,_e):encodeURIComponent(String(ge)).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,"=",ge,ye.expires?"; expires="+ye.expires.toUTCString():"",ye.path?"; path="+ye.path:"",ye.domain?"; domain="+ye.domain:"",ye.secure?"; secure":""].join("")}_e||(Ee={});for(var Be=document.cookie?document.cookie.split("; "):[],Ge=/(%[0-9A-Z]{2})+/g,re=0;re<Be.length;re++){var k=Be[re].split("="),se=k.slice(1).join("=");se.charAt(0)==='"'&&(se=se.slice(1,-1));try{var W=k[0].replace(Ge,decodeURIComponent);if(se=le.read?le.read(se,W):le(se,W)||se.replace(Ge,decodeURIComponent),this.json)try{se=JSON.parse(se)}catch{}if(_e===W){Ee=se;break}_e||(Ee[W]=se)}catch{}}return Ee}}return me.set=me,me.get=function(_e){return me.call(me,_e)},me.getJSON=function(){return me.apply({json:!0},[].slice.call(arguments))},me.defaults={},me.remove=function(_e,ge){me(_e,"",J(ge,{expires:-1}))},me.withConverter=ee,me}(function(){})})},153:function(y,I,M){var U,H=M.g!==void 0?M.g:typeof window!="undefined"?window:{},z=M(558);typeof document!="undefined"?U=document:(U=H["__GLOBAL_DOCUMENT_CACHE@4"])||(U=H["__GLOBAL_DOCUMENT_CACHE@4"]=z),y.exports=U},48:function(y,I,M){var U;U=typeof window!="undefined"?window:M.g!==void 0?M.g:typeof self!="undefined"?self:{},y.exports=U},640:function(y,I,M){var U,H;(function(z,J){"use strict";U=function(){var ee=function(){},le="undefined",me=typeof window!==le&&typeof window.navigator!==le&&/Trident\/|MSIE /.test(window.navigator.userAgent),_e=["trace","debug","info","warn","error"];function ge(Se,Xe){var at=Se[Xe];if(typeof at.bind=="function")return at.bind(Se);try{return Function.prototype.bind.call(at,Se)}catch{return function(){return Function.prototype.apply.apply(at,[Se,arguments])}}}function ye(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function Ee(Se){return Se==="debug"&&(Se="log"),typeof console!==le&&(Se==="trace"&&me?ye:console[Se]!==void 0?ge(console,Se):console.log!==void 0?ge(console,"log"):ee)}function ue(Se,Xe){for(var at=0;at<_e.length;at++){var jt=_e[at];this[jt]=at<Se?ee:this.methodFactory(jt,Se,Xe)}this.log=this.debug}function Be(Se,Xe,at){return function(){typeof console!==le&&(ue.call(this,Xe,at),this[Se].apply(this,arguments))}}function Ge(Se,Xe,at){return Ee(Se)||Be.apply(this,arguments)}function re(Se,Xe,at){var jt,it=this;Xe=Xe==null?"WARN":Xe;var B="loglevel";function ui($e){var Gt=(_e[$e]||"silent").toUpperCase();if(typeof window!==le&&B){try{return void(window.localStorage[B]=Gt)}catch{}try{window.document.cookie=encodeURIComponent(B)+"="+Gt+";"}catch{}}}function zt(){var $e;if(typeof window!==le&&B){try{$e=window.localStorage[B]}catch{}if(typeof $e===le)try{var Gt=window.document.cookie,Et=Gt.indexOf(encodeURIComponent(B)+"=");Et!==-1&&($e=/^([^;]+)/.exec(Gt.slice(Et))[1])}catch{}return it.levels[$e]===void 0&&($e=void 0),$e}}function nt(){if(typeof window!==le&&B){try{return void window.localStorage.removeItem(B)}catch{}try{window.document.cookie=encodeURIComponent(B)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}typeof Se=="string"?B+=":"+Se:typeof Se=="symbol"&&(B=void 0),it.name=Se,it.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},it.methodFactory=at||Ge,it.getLevel=function(){return jt},it.setLevel=function($e,Gt){if(typeof $e=="string"&&it.levels[$e.toUpperCase()]!==void 0&&($e=it.levels[$e.toUpperCase()]),!(typeof $e=="number"&&$e>=0&&$e<=it.levels.SILENT))throw"log.setLevel() called with invalid level: "+$e;if(jt=$e,Gt!==!1&&ui($e),ue.call(it,$e,Se),typeof console===le&&$e<it.levels.SILENT)return"No console available for logging"},it.setDefaultLevel=function($e){Xe=$e,zt()||it.setLevel($e,!1)},it.resetLevel=function(){it.setLevel(Xe,!1),nt()},it.enableAll=function($e){it.setLevel(it.levels.TRACE,$e)},it.disableAll=function($e){it.setLevel(it.levels.SILENT,$e)};var ri=zt();ri==null&&(ri=Xe),it.setLevel(ri,!1)}var k=new re,se={};k.getLogger=function(Se){if(typeof Se!="symbol"&&typeof Se!="string"||Se==="")throw new TypeError("You must supply a name when creating a logger.");var Xe=se[Se];return Xe||(Xe=se[Se]=new re(Se,k.getLevel(),k.methodFactory)),Xe};var W=typeof window!==le?window.log:void 0;return k.noConflict=function(){return typeof window!==le&&window.log===k&&(window.log=W),k},k.getLoggers=function(){return se},k.default=k,k},(H=typeof U=="function"?U.call(I,M,I,y):U)===void 0||(y.exports=H)})()},375:function(y,I){"use strict";var M=Object.prototype.hasOwnProperty;function U(z){try{return decodeURIComponent(z.replace(/\+/g," "))}catch{return null}}function H(z){try{return encodeURIComponent(z)}catch{return null}}I.stringify=function(z,J){J=J||"";var ee,le,me=[];for(le in typeof J!="string"&&(J="?"),z)if(M.call(z,le)){if((ee=z[le])||ee!=null&&!isNaN(ee)||(ee=""),le=H(le),ee=H(ee),le===null||ee===null)continue;me.push(le+"="+ee)}return me.length?J+me.join("&"):""},I.parse=function(z){for(var J,ee=/([^=?#&]+)=?([^&]*)/g,le={};J=ee.exec(z);){var me=U(J[1]),_e=U(J[2]);me===null||_e===null||me in le||(le[me]=_e)}return le}},558:function(){}},m={};function v(y){var I=m[y];if(I!==void 0)return I.exports;var M=m[y]={exports:{}};return o[y].call(M.exports,M,M.exports,v),M.exports}return v.n=function(y){var I=y&&y.__esModule?function(){return y.default}:function(){return y};return v.d(I,{a:I}),I},v.d=function(y,I){for(var M in I)v.o(I,M)&&!v.o(y,M)&&Object.defineProperty(y,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(y,I){return Object.prototype.hasOwnProperty.call(y,I)},v(80)}()},typeof sd=="object"&&typeof Vc=="object"?Vc.exports=r():typeof sd=="object"?sd.mux=r():n.mux=r()})()});var Ep=Rf((gp,Kc)=>{(function n(r){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 y(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){U(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,Ee(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 U(d,s,e){return(s=Ee(s))in d?Object.defineProperty(d,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[s]=e,d}function H(){return H=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},H.apply(this,arguments)}function z(d,s){d.prototype=Object.create(s.prototype),d.prototype.constructor=d,ee(d,s)}function J(d){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},J(d)}function ee(d,s){return ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ee(d,s)}function le(){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 me(d,s,e){return me=le()?Reflect.construct.bind():function(t,i,a){var l=[null];l.push.apply(l,i);var u=new(Function.bind.apply(t,l));return a&&ee(u,a.prototype),u},me.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 me(e,arguments,J(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ee(i,e)},_e(d)}function ge(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 ye(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,a){if(i){if(typeof i=="string")return ge(i,a);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)?ge(i,a):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 Ee(d){var s=function(e,t){if(typeof e!="object"||e===null)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var a=i.call(e,t||"default");if(typeof a!="object")return a;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 Be={exports:{}};(function(d,s){var e,t,i,a,l;e=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,t=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,l={buildAbsoluteURL:function(u,c,h){if(h=h||{},u=u.trim(),!(c=c.trim())){if(!h.alwaysNormalize)return u;var f=l.parseURL(u);if(!f)throw new Error("Error trying to parse base URL.");return f.path=l.normalizePath(f.path),l.buildURLFromParts(f)}var p=l.parseURL(c);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return h.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 w=E.path,D=w.substring(0,w.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=h.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(a,"")).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})(Be);var Ge=Be.exports,re=Number.isFinite||function(d){return typeof d=="number"&&isFinite(d)},k=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}({}),se=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}({}),Se=function(){},Xe={trace:Se,debug:Se,log:Se,warn:Se,info:Se,error:Se},at=Xe;function jt(d){var s=self.console[d];return s?s.bind(self.console,"["+d+"] >"):Se}function it(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),a=1;a<t;a++)i[a-1]=arguments[a];i.forEach(function(l){at[l]=e[l]?e[l].bind(e):jt(l)})})(d,"debug","log","info","warn","error");try{at.log('Debug logs enabled for "'+s+'" in hls.js version 1.4.5')}catch{at=Xe}}else at=Xe}var B=at,ui=/^(\d+)x(\d+)$/,zt=/(.+?)=(".*?"|.*?)(?:,|$)/g,nt=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),a=0;a<t.length/2;a++)i[a]=parseInt(t.slice(2*a,2*a+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=ui.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(zt.lastIndex=0;(t=zt.exec(e))!==null;){var a=t[2];a.indexOf('"')===0&&a.lastIndexOf('"')===a.length-1&&(a=a.slice(1,-1)),i[t[1].trim()]=a}return i},d}();function ri(d){return d==="SCTE35-OUT"||d==="SCTE35-IN"}var $e=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]){B.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+s.ID+'"'),this._badValueForSameId=i;break}s=H(new nt({}),t,s)}if(this.attr=s,this._startDate=new Date(s["START-DATE"]),"END-DATE"in this.attr){var a=new Date(this.attr["END-DATE"]);re(a.getTime())&&(this._endDate=a)}}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(re(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&&re(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),d}(),Gt=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}},Et="audio",Ct="video",tr="audiovideo",te=function(){function d(s){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[Et]=null,e[Ct]=null,e[tr]=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=Ge.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(s){this._url=s}}]),d}(),ke=function(d){function s(t,i){var a;return(a=d.call(this,i)||this)._decryptdata=null,a.rawProgramDateTime=null,a.programDateTime=null,a.tagList=[],a.duration=0,a.sn=0,a.levelkeys=void 0,a.type=void 0,a.loader=null,a.keyLoader=null,a.level=-1,a.cc=0,a.startPTS=void 0,a.endPTS=void 0,a.startDTS=void 0,a.endDTS=void 0,a.start=0,a.deltaPTS=void 0,a.maxStartPTS=void 0,a.minEndPTS=void 0,a.stats=new Gt,a.urlId=0,a.data=void 0,a.bitrateTest=!1,a.title=null,a.initSegment=null,a.endList=void 0,a.gap=void 0,a.type=t,a}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,a,l,u,c){c===void 0&&(c=!1);var h=this.elementaryStreams,f=h[t];f?(f.startPTS=Math.min(f.startPTS,i),f.endPTS=Math.max(f.endPTS,a),f.startDTS=Math.min(f.startDTS,l),f.endDTS=Math.max(f.endDTS,u)):h[t]={startPTS:i,endPTS:a,startDTS:l,endDTS:u,partial:c}},e.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[Et]=null,t[Ct]=null,t[tr]=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||!re(this.programDateTime))return null;var t=re(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),a=i.length;if(a>1||a===1&&this.levelkeys[i[0]].encrypted)return!0}return!1}}]),s}(te),st=function(d){function s(e,t,i,a,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 Gt,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=a;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}(te),wt=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&&re(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 Rt(d){return Uint8Array.from(atob(d),function(s){return s.charCodeAt(0)})}function ci(d){var s,e,t=d.split(":"),i=null;if(t[0]==="data"&&t.length===2){var a=t[1].split(";"),l=a[a.length-1].split(",");if(l.length===2){var u=l[0]==="base64",c=l[1];u?(a.splice(-1,1),i=Rt(c)):(s=$i(c).subarray(0,16),(e=new Uint8Array(16)).set(s,16-s.length),i=e)}}return i}function $i(d){return Uint8Array.from(unescape(encodeURIComponent(d)),function(s){return s.charCodeAt(0)})}var Ze={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},vi="org.w3.clearkey",gi="com.apple.streamingkeydelivery",ji="com.microsoft.playready",ir="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Ei(d){switch(d){case gi:return Ze.FAIRPLAY;case ji:return Ze.PLAYREADY;case ir:return Ze.WIDEVINE;case vi:return Ze.CLEARKEY}}var ct="edef8ba979d64acea3c827dcd51d21ed";function rr(d){switch(d){case Ze.FAIRPLAY:return gi;case Ze.PLAYREADY:return ji;case Ze.WIDEVINE:return ir;case Ze.CLEARKEY:return vi}}function Er(d){var s=d.drmSystems,e=d.widevineLicenseUrl,t=s?[Ze.FAIRPLAY,Ze.WIDEVINE,Ze.PLAYREADY,Ze.CLEARKEY].filter(function(i){return!!s[i]}):[];return!t[Ze.WIDEVINE]&&e&&t.push(Ze.WIDEVINE),t}var jr=typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function xi(d,s,e){return Uint8Array.prototype.slice?d.slice(s,e):new Uint8Array(Array.prototype.slice.call(d,s,e))}var yr,es=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},vo=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},ga=function(d,s){for(var e=s,t=0;es(d,s);)t+=10,t+=an(d,s+6),vo(d,s+10)&&(t+=10),s+=t;if(t>0)return d.subarray(e,e+t)},an=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]},go=function(d,s){return es(d,s)&&an(d,s+6)+10<=d.length-s},Eo=function(d){return d&&d.key==="PRIV"&&d.info==="com.apple.streaming.transportStreamTimestamp"},Bd=function(d){var s=String.fromCharCode(d[0],d[1],d[2],d[3]),e=an(d,4);return{type:s,size:e,data:d.subarray(10,10+e)}},ts=function(d){for(var s=0,e=[];es(d,s);){for(var t=an(d,s+6),i=(s+=10)+t;s+8<i;){var a=Bd(d.subarray(s)),l=Hd(a);l&&e.push(l),s+=a.size+10}vo(d,s)&&(s+=10)}return e},Hd=function(d){return d.type==="PRIV"?Gd(d):d.type[0]==="W"?bo(d):yo(d)},Gd=function(d){if(!(d.size<2)){var s=Ii(d.data,!0),e=new Uint8Array(d.data.subarray(s.length+1));return{key:d.type,info:s,data:e.buffer}}},yo=function(d){if(!(d.size<2)){if(d.type==="TXXX"){var s=1,e=Ii(d.data.subarray(s),!0);s+=e.length+1;var t=Ii(d.data.subarray(s));return{key:d.type,info:e,data:t}}var i=Ii(d.data.subarray(1));return{key:d.type,data:i}}},bo=function(d){if(d.type==="WXXX"){if(d.size<2)return;var s=1,e=Ii(d.data.subarray(s),!0);s+=e.length+1;var t=Ii(d.data.subarray(s));return{key:d.type,info:e,data:t}}var i=Ii(d.data);return{key:d.type,data:i}},_o=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)}},Ii=function(d,s){s===void 0&&(s=!1);var e=Vd();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 a,l,u,c=d.length,h="",f=0;f<c;){if((a=d[f++])===0&&s)return h;if(a!==0&&a!==3)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:h+=String.fromCharCode(a);break;case 12:case 13:l=d[f++],h+=String.fromCharCode((31&a)<<6|63&l);break;case 14:l=d[f++],u=d[f++],h+=String.fromCharCode((15&a)<<12|(63&l)<<6|(63&u)<<0)}}return h};function Vd(){return yr||self.TextDecoder===void 0||(yr=new self.TextDecoder("utf-8")),yr}var Pi=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},Ea=Math.pow(2,32)-1,Kd=[].push,To={video:1,audio:2,id3:3,text:4};function Mt(d){return String.fromCharCode.apply(null,d)}function Ao(d,s){var e=d[s]<<8|d[s+1];return e<0?65536+e:e}function He(d,s){var e=is(d,s);return e<0?4294967296+e:e}function is(d,s){return d[s]<<24|d[s+1]<<16|d[s+2]<<8|d[s+3]}function rs(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 a=He(d,i),l=a>1?i+a:t;if(Mt(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&&Kd.apply(e,u)}i=l}return e}function So(d){var s=[],e=d[0],t=8,i=He(d,t);t+=4,t+=e===0?8:16,t+=2;var a=d.length+0,l=Ao(d,t);t+=2;for(var u=0;u<l;u++){var c=t,h=He(d,c);c+=4;var f=2147483647&h;if((2147483648&h)>>>31==1)return B.warn("SIDX has hierarchical references (not supported)"),null;var p=He(d,c);c+=4,s.push({referenceSize:f,subsegmentDuration:p,info:{duration:p/i,start:a,end:a+f-1}}),a+=f,t=c+=4}return{earliestPresentationTime:0,timescale:i,version:e,referencesCount:l,references:s}}function as(d){for(var s=[],e=Je(d,["moov","trak"]),t=0;t<e.length;t++){var i=e[t],a=Je(i,["tkhd"])[0];if(a){var l=a[0],u=l===0?12:20,c=He(a,u),h=Je(i,["mdia","mdhd"])[0];if(h){var f=He(h,u=(l=h[0])===0?12:20),p=Je(i,["mdia","hdlr"])[0];if(p){var E=Mt(p.subarray(8,12)),b={soun:Et,vide:Ct}[E];if(b){var A=Je(i,["mdia","minf","stbl","stsd"])[0],w=void 0;A&&(w=Mt(A.subarray(12,16))),s[c]={timescale:f,type:b},s[b]={timescale:f,id:c,codec:w}}}}}}return Je(d,["moov","mvex","trex"]).forEach(function(D){var S=He(D,4),L=s[S];L&&(L.default={duration:He(D,12),flags:He(D,20)})}),s}function ns(d){var s=Je(d,["schm"])[0];if(s){var e=Mt(s.subarray(4,8));if(e==="cbcs"||e==="cenc")return Je(d,["schi","tenc"])[0]}return B.error("[eme] missing 'schm' box"),null}function Wd(d){var s=He(d,0),e=8;1&s&&(e+=4),4&s&&(e+=4);for(var t=0,i=He(d,4),a=0;a<i;a++)256&s&&(t+=He(d,e),e+=4),512&s&&(e+=4),1024&s&&(e+=4),2048&s&&(e+=4);return t}function br(d,s){var e=new Uint8Array(d.length+s.length);return e.set(d),e.set(s,d.length),e}function ss(d,s){var e=[],t=s.samples,i=s.timescale,a=s.id,l=!1;return Je(t,["moof"]).map(function(u){var c=u.byteOffset-8;Je(u,["traf"]).map(function(h){var f=Je(h,["tfdt"]).map(function(p){var E=p[0],b=He(p,4);return E===1&&(b*=Math.pow(2,32),b+=He(p,8)),b/i})[0];return f!==void 0&&(d=f),Je(h,["tfhd"]).map(function(p){var E=He(p,4),b=16777215&He(p,0),A=0,w=(16&b)!=0,D=0,S=(32&b)!=0,L=8;E===a&&((1&b)!=0&&(L+=8),(2&b)!=0&&(L+=4),(8&b)!=0&&(A=He(p,L),L+=4),w&&(D=He(p,L),L+=4),S&&(L+=4),s.type==="video"&&(l=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)),Je(h,["trun"]).map(function(N){var P=N[0],V=16777215&He(N,0),Y=(1&V)!=0,j=0,ie=(4&V)!=0,Q=(256&V)!=0,X=0,ce=(512&V)!=0,oe=0,Ae=(1024&V)!=0,xe=(2048&V)!=0,Le=0,Me=He(N,4),Oe=8;Y&&(j=He(N,Oe),Oe+=4),ie&&(Oe+=4);for(var Pe=j+c,Ke=0;Ke<Me;Ke++){if(Q?(X=He(N,Oe),Oe+=4):X=A,ce?(oe=He(N,Oe),Oe+=4):oe=D,Ae&&(Oe+=4),xe&&(Le=P===0?He(N,Oe):is(N,Oe),Oe+=4),s.type===Ct)for(var je=0;je<oe;){var et=He(t,Pe);ko(l,t[Pe+=4])&&wo(t.subarray(Pe,Pe+et),l?2:1,d+Le/i,e),Pe+=et,je+=et+4}d+=X/i}}))})})}),e}function ko(d,s){if(d){var e=s>>1&63;return e===39||e===40}return(31&s)==6}function wo(d,s,e,t){var i=Lo(d),a=0;a+=s;for(var l=0,u=0,c=!1,h=0;a<i.length;){l=0;do{if(a>=i.length)break;l+=h=i[a++]}while(h===255);u=0;do{if(a>=i.length)break;u+=h=i[a++]}while(h===255);var f=i.length-a;if(!c&&l===4&&a<i.length){if(c=!0,i[a++]===181){var p=Ao(i,a);if(a+=2,p===49){var E=He(i,a);if(a+=4,E===1195456820){var b=i[a++];if(b===3){var A=i[a++],w=64&A,D=w?2+3*(31&A):0,S=new Uint8Array(D);if(w){S[0]=A;for(var L=1;L<D;L++)S[L]=i[a++]}t.push({type:b,payloadType:l,pts:e,bytes:S})}}}}}else if(l===5&&u<f){if(c=!0,u>16){for(var N=[],P=0;P<16;P++){var V=i[a++].toString(16);N.push(V.length==1?"0"+V:V),P!==3&&P!==5&&P!==7&&P!==9||N.push("-")}for(var Y=u-16,j=new Uint8Array(Y),ie=0;ie<Y;ie++)j[ie]=i[a++];t.push({payloadType:l,pts:e,uuid:N.join(""),userData:Ii(j),userDataBytes:j})}}else if(u<f)a+=u;else if(u>f)break}}function Lo(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,a=new Uint8Array(i),l=0;for(t=0;t<i;l++,t++)l===e[0]&&(l++,e.shift()),a[t]=d[l];return a}function Io(d,s,e){if(d.byteLength!==16)throw new RangeError("Invalid system id");var t,i,a;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?(a=new Uint8Array(4),s.length>0&&new DataView(a.buffer).setUint32(0,s.length,!1)):a=new Uint8Array;var c=new Uint8Array(4);return e&&e.byteLength>0&&new DataView(c.buffer).setUint32(0,e.byteLength,!1),function(h){for(var f=arguments.length,p=new Array(f>1?f-1:0),E=1;E<f;E++)p[E-1]=arguments[E];for(var b=p.length,A=8,w=b;w--;)A+=p[w].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(h,4),w=0,A=8;w<b;w++)D.set(p[w],A),A+=p[w].byteLength;return D}([112,115,115,104],new Uint8Array([t,0,0,0]),d,a,i,c,e||new Uint8Array)}var ya={},ba=function(){function d(e,t,i,a,l){a===void 0&&(a=[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=a,this.iv=l,this.encrypted=!!e&&e!=="NONE",this.isCommonEncryption=this.encrypted&&e!=="AES-128"}d.clearKeyUriToKeyIdMap=function(){ya={}};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 gi:case ir:case ji:case vi: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||B.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=ci(this.uri);if(i)switch(this.keyFormat){case ir:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case ji:var a=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Io(a,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),h=new DOMParser().parseFromString(c,"text/xml").getElementsByTagName("KID")[0];if(h){var f=h.childNodes[0]?h.childNodes[0].nodeValue:h.getAttribute("VALUE");if(f){var p=Rt(f).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 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=ya[this.uri];if(!A){var w=Object.keys(ya).length%Number.MAX_SAFE_INTEGER;A=new Uint8Array(16),new DataView(A.buffer,12,4).setUint32(0,w),ya[this.uri]=A}this.keyId=A}return this},d}(),Ro=/\{\$([a-zA-Z0-9-_]+)\}/g;function Do(d){return Ro.test(d)}function ai(d,s,e){if(d.variableList!==null||d.hasVariableRefs)for(var t=e.length;t--;){var i=e[t],a=s[i];a&&(s[i]=Ri(d,a))}}function Ri(d,s){if(d.variableList!==null||d.hasVariableRefs){var e=d.variableList;return s.replace(Ro,function(t){var i=t.substring(2,t.length-1),a=e==null?void 0:e[i];return a===void 0?(d.playlistParsingError||(d.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+i+'"')),t):a})}return s}function Co(d,s,e){var t,i,a=d.variableList;if(a||(d.variableList=a={}),"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 a?d.playlistParsingError||(d.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+t+'"')):a[t]=i||""}function Mo(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 nn(){if(typeof self!="undefined")return self.MediaSource||self.WebKitMediaSource}var qd={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}},os=nn();function sn(d,s){var e;return(e=os==null?void 0:os.isTypeSupported((s||"video")+'/mp4;codecs="'+d+'"'))!=null&&e}var _r=/#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,zr=/#EXT-X-MEDIA:(.*)/g,Yd=/^#EXT(?:INF|-X-TARGETDURATION):/m,ls=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),on=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("|")),_a=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 Ge.buildAbsoluteURL(e,s,{alwaysNormalize:!0})},d.isMediaPlaylist=function(s){return Yd.test(s)},d.parseMasterPlaylist=function(s,e){var t,i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Do(s)},a=[];for(_r.lastIndex=0;(t=_r.exec(s))!=null;)if(t[1]){var l,u=new nt(t[1]);ai(i,u,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);var c=Ri(i,t[2]),h={attrs:u,bitrate:u.decimalInteger("AVERAGE-BANDWIDTH")||u.decimalInteger("BANDWIDTH"),name:u.NAME,url:d.resolve(c,e)},f=u.decimalResolution("RESOLUTION");f&&(h.width=f.width,h.height=f.height),$d((u.CODECS||"").split(/[ ,]+/).filter(function(N){return N}),h),h.videoCodec&&h.videoCodec.indexOf("avc1")!==-1&&(h.videoCodec=d.convertAVC1ToAVCOTI(h.videoCodec)),(l=h.unknownCodecs)!=null&&l.length||a.push(h),i.levels.push(h)}else if(t[3]){var p=t[3],E=t[4];switch(p){case"SESSION-DATA":var b=new nt(E);ai(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 w=xo(E,e,i);w.encrypted&&w.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(w)):B.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+E+'"');break;case"DEFINE":var D=new nt(E);ai(i,D,["NAME","VALUE","QUERYPARAM"]),Co(i,D,e);break;case"CONTENT-STEERING":var S=new nt(E);ai(i,S,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:d.resolve(S["SERVER-URI"],e),pathwayId:S["PATHWAY-ID"]||"."};break;case"START":i.startTimeOffset=Po(E)}}var L=a.length>0&&a.length<i.levels.length;return i.levels=L?a:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i},d.parseMasterPlaylistMedia=function(s,e,t){var i,a={},l=t.levels,u={AUDIO:l.map(function(w){return{id:w.attrs.AUDIO,audioCodec:w.audioCodec}}),SUBTITLES:l.map(function(w){return{id:w.attrs.SUBTITLES,textCodec:w.textCodec}}),"CLOSED-CAPTIONS":[]},c=0;for(zr.lastIndex=0;(i=zr.exec(s))!==null;){var h=new nt(i[1]),f=h.TYPE;if(f){var p=u[f],E=a[f]||[];a[f]=E,ai(t,h,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);var b={attrs:h,bitrate:0,id:c++,groupId:h["GROUP-ID"]||"",instreamId:h["INSTREAM-ID"],name:h.NAME||h.LANGUAGE||"",type:f,default:h.bool("DEFAULT"),autoselect:h.bool("AUTOSELECT"),forced:h.bool("FORCED"),lang:h.LANGUAGE,url:h.URI?d.resolve(h.URI,e):""};if(p!=null&&p.length){var A=d.findGroup(p,b.groupId)||p[0];ds(b,A,"audioCodec"),ds(b,A,"textCodec")}E.push(b)}}return a},d.parseLevelPlaylist=function(s,e,t,i,a,l){var u,c,h,f=new wt(e),p=f.fragments,E=null,b=0,A=0,w=0,D=0,S=null,L=new ke(i,e),N=-1,P=!1;for(ls.lastIndex=0,f.m3u8=s,f.hasVariableRefs=Do(s);(u=ls.exec(s))!==null;){P&&(P=!1,(L=new ke(i,e)).start=w,L.sn=b,L.cc=D,L.level=t,E&&(L.initSegment=E,L.rawProgramDateTime=E.rawProgramDateTime,E.rawProgramDateTime=null));var V=u[1];if(V){L.duration=parseFloat(V);var Y=(" "+u[2]).slice(1);L.title=Y||null,L.tagList.push(Y?["INF",V,Y]:["INF",V])}else if(u[3]){if(re(L.duration)){L.start=w,h&&us(L,h,f),L.sn=b,L.level=t,L.cc=D,L.urlId=a,p.push(L);var j=(" "+u[3]).slice(1);L.relurl=Ri(f,j),Oo(L,S),S=L,w+=L.duration,b++,A=0,P=!0}}else if(u[4]){var ie=(" "+u[4]).slice(1);S?L.setByteRange(ie,S):L.setByteRange(ie)}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(on))){B.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),ce=u[c+2]?(" "+u[c+2]).slice(1):"";switch(Q){case"PLAYLIST-TYPE":f.type=X.toUpperCase();break;case"MEDIA-SEQUENCE":b=f.startSN=parseInt(X);break;case"SKIP":var oe=new nt(X);ai(f,oe,["RECENTLY-REMOVED-DATERANGES"]);var Ae=oe.decimalInteger("SKIPPED-SEGMENTS");if(re(Ae)){f.skippedSegments=Ae;for(var xe=Ae;xe--;)p.unshift(null);b+=Ae}var Le=oe.enumeratedString("RECENTLY-REMOVED-DATERANGES");Le&&(f.recentlyRemovedDateranges=Le.split(" "));break;case"TARGETDURATION":f.targetduration=Math.max(parseInt(X),1);break;case"VERSION":f.version=parseInt(X);break;case"EXTM3U":break;case"ENDLIST":f.live=!1;break;case"#":(X||ce)&&L.tagList.push(ce?[X,ce]:[X]);break;case"DISCONTINUITY":D++,L.tagList.push(["DIS"]);break;case"GAP":L.gap=!0,L.tagList.push([Q]);break;case"BITRATE":L.tagList.push([Q,X]);break;case"DATERANGE":var Me=new nt(X);ai(f,Me,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),ai(f,Me,Me.clientAttrs);var Oe=new $e(Me,f.dateRanges[Me.ID]);Oe.isValid||f.skippedSegments?f.dateRanges[Oe.id]=Oe:B.warn('Ignoring invalid DATERANGE tag: "'+X+'"'),L.tagList.push(["EXT-X-DATERANGE",X]);break;case"DEFINE":var Pe=new nt(X);ai(f,Pe,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in Pe?Mo(f,Pe,l):Co(f,Pe,e);break;case"DISCONTINUITY-SEQUENCE":D=parseInt(X);break;case"KEY":var Ke=xo(X,e,f);if(Ke.isSupported()){if(Ke.method==="NONE"){h=void 0;break}h||(h={}),h[Ke.keyFormat]&&(h=H({},h)),h[Ke.keyFormat]=Ke}else B.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+X+'"');break;case"START":f.startTimeOffset=Po(X);break;case"MAP":var je=new nt(X);if(ai(f,je,["BYTERANGE","URI"]),L.duration){var et=new ke(i,e);No(et,je,t,h),E=et,L.initSegment=E,E.rawProgramDateTime&&!L.rawProgramDateTime&&(L.rawProgramDateTime=E.rawProgramDateTime)}else No(L,je,t,h),E=L,P=!0;break;case"SERVER-CONTROL":var lt=new nt(X);f.canBlockReload=lt.bool("CAN-BLOCK-RELOAD"),f.canSkipUntil=lt.optionalFloat("CAN-SKIP-UNTIL",0),f.canSkipDateRanges=f.canSkipUntil>0&<.bool("CAN-SKIP-DATERANGES"),f.partHoldBack=lt.optionalFloat("PART-HOLD-BACK",0),f.holdBack=lt.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Ti=new nt(X);f.partTarget=Ti.decimalFloatingPoint("PART-TARGET");break;case"PART":var Kt=f.partList;Kt||(Kt=f.partList=[]);var Qi=A>0?Kt[Kt.length-1]:void 0,Bi=A++,Hi=new nt(X);ai(f,Hi,["BYTERANGE","URI"]);var Wt=new st(Hi,L,e,Bi,Qi);Kt.push(Wt),L.duration+=Wt.duration;break;case"PRELOAD-HINT":var ti=new nt(X);ai(f,ti,["URI"]),f.preloadHint=ti;break;case"RENDITION-REPORT":var sr=new nt(X);ai(f,sr,["URI"]),f.renditionReports=f.renditionReports||[],f.renditionReports.push(sr);break;default:B.warn("line parsed but not handled: "+u)}}}S&&!S.relurl?(p.pop(),w-=S.duration,f.partList&&(f.fragmentHint=S)):f.partList&&(Oo(L,S),L.cc=D,f.fragmentHint=L,h&&us(L,h,f));var ta=p.length,Ci=p[0],Ts=p[ta-1];if((w+=f.skippedSegments*f.targetduration)>0&&ta&&Ts){f.averagetargetduration=w/ta;var As=Ts.sn;f.endSN=As!=="initSegment"?As:0,f.live||(Ts.endList=!0),Ci&&(f.startCC=Ci.cc)}else f.endSN=0,f.startCC=0;return f.fragmentHint&&(w+=f.fragmentHint.duration),f.totalduration=w,f.endCC=D,N>0&&function(il,gn){for(var Oa=il[gn],Ss=gn;Ss--;){var Rr=il[Ss];if(!Rr)return;Rr.programDateTime=Oa.programDateTime-1e3*Rr.duration,Oa=Rr}}(p,N),f},d}();function xo(d,s,e){var t,i,a=new nt(d);ai(e,a,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var l=(t=a.METHOD)!=null?t:"",u=a.URI,c=a.hexadecimalInteger("IV"),h=a.KEYFORMATVERSIONS,f=(i=a.KEYFORMAT)!=null?i:"identity";u&&a.IV&&!c&&B.error("Invalid IV: "+a.IV);var p=u?_a.resolve(u,s):"",E=(h||"1").split("/").map(Number).filter(Number.isFinite);return new ba(l,p,f,E,c)}function Po(d){var s=new nt(d).decimalFloatingPoint("TIME-OFFSET");return re(s)?s:null}function $d(d,s){["video","audio","text"].forEach(function(e){var t=d.filter(function(a){return function(l,u){var c=qd[u];return!!c&&c[l.slice(0,4)]===!0}(a,e)});if(t.length){var i=t.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});s[e+"Codec"]=i.length>0?i[0]:t[0],d=d.filter(function(a){return t.indexOf(a)===-1})}}),s.unknownCodecs=d}function ds(d,s,e){var t=s[e];t&&(d[e]=t)}function Oo(d,s){d.rawProgramDateTime?d.programDateTime=Date.parse(d.rawProgramDateTime):s!=null&&s.programDateTime&&(d.programDateTime=s.endProgramDateTime),re(d.programDateTime)||(d.programDateTime=null,d.rawProgramDateTime=null)}function No(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 us(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 Qr="manifest",Tr="level",yi="audioTrack",zi="subtitleTrack",rt="main",Di="audio",Oi="subtitle";function Fo(d){switch(d.type){case yi:return Di;case zi:return Oi;default:return rt}}function cs(d,s){var e=d.url;return e!==void 0&&e.indexOf("data:")!==0||(e=s.url),e}var xt=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(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.LEVEL_LOADING,this.onLevelLoading,this),e.on(k.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(k.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.LEVEL_LOADING,this.onLevelLoading,this),e.off(k.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(k.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,a=t.loader,l=new(i||a)(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:Qr,url:i,deliveryDirectives:null})},s.onLevelLoading=function(e,t){var i=t.id,a=t.level,l=t.url,u=t.deliveryDirectives;this.load({id:i,level:a,responseType:"text",type:Tr,url:l,deliveryDirectives:u})},s.onAudioTrackLoading=function(e,t){var i=t.id,a=t.groupId,l=t.url,u=t.deliveryDirectives;this.load({id:i,groupId:a,level:null,responseType:"text",type:yi,url:l,deliveryDirectives:u})},s.onSubtitleTrackLoading=function(e,t){var i=t.id,a=t.groupId,l=t.url,u=t.deliveryDirectives;this.load({id:i,groupId:a,level:null,responseType:"text",type:zi,url:l,deliveryDirectives:u})},s.load=function(e){var t,i,a,l=this,u=this.hls.config,c=this.getInternalLoader(e);if(c){var h=c.context;if(h&&h.url===e.url)return void B.trace("[playlist-loader]: playlist request ongoing");B.log("[playlist-loader]: aborting previous loader for type: "+e.type),c.abort()}if(i=e.type===Qr?u.manifestLoadPolicy.default:H({},u.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),c=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part&&(e.type===Tr&&e.level!==null?a=this.hls.levels[e.level].details:e.type===yi&&e.id!==null?a=this.hls.audioTracks[e.id].details:e.type===zi&&e.id!==null&&(a=this.hls.subtitleTracks[e.id].details),a)){var f=a.partTarget,p=a.targetduration;if(f&&p){var E=1e3*Math.max(3*f,.8*p);i=H({},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},w={onSuccess:function(D,S,L,N){var P=l.getInternalLoader(L);l.resetInternalLoader(L.type);var V=D.data;V.indexOf("#EXTM3U")===0?(S.parsing.start=performance.now(),_a.isMediaPlaylist(V)?l.handleTrackOrLevelPlaylist(D,S,L,N||null,P):l.handleMasterPlaylist(D,S,L,N)):l.handleManifestParsingError(D,L,new Error("no EXTM3U delimiter"),N||null,S)},onError:function(D,S,L,N){l.handleNetworkError(S,L,!1,D,N)},onTimeout:function(D,S,L){l.handleNetworkError(S,L,!0,void 0,D)}};c.load(e,A,w)},s.handleMasterPlaylist=function(e,t,i,a){var l=this.hls,u=e.data,c=cs(e,i),h=_a.parseMasterPlaylist(u,c);if(h.playlistParsingError)this.handleManifestParsingError(e,i,h.playlistParsingError,a,t);else{var f=h.contentSteering,p=h.levels,E=h.sessionData,b=h.sessionKeys,A=h.startTimeOffset,w=h.variableList;this.variableList=w;var D=_a.parseMasterPlaylistMedia(u,c,h),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||(B.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 nt({}),bitrate:0,url:""}))),l.trigger(k.MANIFEST_LOADED,{levels:p,audioTracks:L,subtitles:N,captions:P,contentSteering:f,url:c,stats:t,networkDetails:a,sessionData:E,sessionKeys:b,startTimeOffset:A,variableList:w})}},s.handleTrackOrLevelPlaylist=function(e,t,i,a,l){var u=this.hls,c=i.id,h=i.level,f=i.type,p=cs(e,i),E=re(c)?c:0,b=re(h)?h:E,A=Fo(i),w=_a.parseLevelPlaylist(e.data,p,b,A,E,this.variableList);if(f===Qr){var D={attrs:new nt({}),bitrate:0,details:w,name:"",url:p};u.trigger(k.MANIFEST_LOADED,{levels:[D],audioTracks:[],url:p,stats:t,networkDetails:a,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=w,this.handlePlaylistLoaded(w,e,t,i,a,l)},s.handleManifestParsingError=function(e,t,i,a,l){this.hls.trigger(k.ERROR,{type:se.NETWORK_ERROR,details:W.MANIFEST_PARSING_ERROR,fatal:t.type===Qr,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:a,stats:l})},s.handleNetworkError=function(e,t,i,a,l){i===void 0&&(i=!1);var u="A network "+(i?"timeout":"error"+(a?" (status "+a.code+")":""))+" occurred while loading "+e.type;e.type===Tr?u+=": "+e.level+" id: "+e.id:e.type!==yi&&e.type!==zi||(u+=" id: "+e.id+' group-id: "'+e.groupId+'"');var c=new Error(u);B.warn("[playlist-loader]: "+u);var h=W.UNKNOWN,f=!1,p=this.getInternalLoader(e);switch(e.type){case Qr:h=i?W.MANIFEST_LOAD_TIMEOUT:W.MANIFEST_LOAD_ERROR,f=!0;break;case Tr:h=i?W.LEVEL_LOAD_TIMEOUT:W.LEVEL_LOAD_ERROR,f=!1;break;case yi:h=i?W.AUDIO_TRACK_LOAD_TIMEOUT:W.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case zi:h=i?W.SUBTITLE_TRACK_LOAD_TIMEOUT:W.SUBTITLE_LOAD_ERROR,f=!1}p&&this.resetInternalLoader(e.type);var E={type:se.NETWORK_ERROR,details:h,fatal:f,url:e.url,loader:p,context:e,error:c,networkDetails:t,stats:l};if(a){var b=(t==null?void 0:t.url)||e.url;E.response=y({url:b,data:void 0},a)}this.hls.trigger(k.ERROR,E)},s.handlePlaylistLoaded=function(e,t,i,a,l,u){var c=this.hls,h=a.type,f=a.level,p=a.id,E=a.groupId,b=a.deliveryDirectives,A=cs(t,a),w=Fo(a),D=typeof a.level=="number"&&w===rt?f:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var S=e.playlistParsingError;if(S)c.trigger(k.ERROR,{type:se.NETWORK_ERROR,details:W.LEVEL_PARSING_ERROR,fatal:!1,url:A,error:S,reason:S.message,response:t,context:a,level:D,parent:w,networkDetails:l,stats:i});else switch(e.live&&u&&(u.getCacheAge&&(e.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),h){case Qr:case Tr:c.trigger(k.LEVEL_LOADED,{details:e,level:D||0,id:p||0,stats:i,networkDetails:l,deliveryDirectives:b});break;case yi:c.trigger(k.AUDIO_TRACK_LOADED,{details:e,id:p||0,groupId:E||"",stats:i,networkDetails:l,deliveryDirectives:b});break;case zi:c.trigger(k.SUBTITLE_TRACK_LOADED,{details:e,id:p||0,groupId:E||"",stats:i,networkDetails:l,deliveryDirectives:b})}}else{var L=new Error("No Segments found in Playlist");c.trigger(k.ERROR,{type:se.NETWORK_ERROR,details:W.LEVEL_EMPTY_ERROR,fatal:!1,url:A,error:L,reason:L.message,response:t,context:a,level:D,parent:w,networkDetails:l,stats:i})}},d}();function Ta(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 Uo(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){B.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 Xr(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 hs(d,s,e,t){var i=d.mode;if(i==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var a=function(u,c,h){var f=[],p=function(w,D){if(D<w[0].startTime)return 0;var S=w.length-1;if(D>w[S].endTime)return-1;for(var L=0,N=S;L<=N;){var P=Math.floor((N+L)/2);if(D<w[P].startTime)N=P-1;else{if(!(D>w[P].startTime&&L<S))return P;L=P+1}}return w[L].startTime-D<D-w[N].startTime?L:N}(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<=h)f.push(A);else if(A.startTime>h)return f}return f}(d.cues,s,e),l=0;l<a.length;l++)t&&!t(a[l])||d.removeCue(a[l]);i==="disabled"&&(d.mode=i)}var Aa="org.id3",Sa="com.apple.quicktime.HLS",Ar="https://aomedia.org/emsg/ID3";function ln(){if(typeof self!="undefined")return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var ka=function(){var d=ln();try{new d(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function ar(d,s){return d.getTime()/1e3-s}var jd=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(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(k.LEVEL_UPDATED,this.onLevelUpdated,this)},s._unregisterListeners=function(){var e=this.hls;e.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(k.LEVEL_UPDATED,this.onLevelUpdated,this)},s.onMediaAttached=function(e,t){this.media=t.media},s.onMediaDetaching=function(){this.id3Track&&(Xr(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 Ta(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},s.onFragParsingMetadata=function(e,t){if(this.media){var i=this.hls.config,a=i.enableEmsgMetadataCues,l=i.enableID3MetadataCues;if(a||l){var u=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var c=ln(),h=0;h<u.length;h++){var f=u[h].type;if((f!==Ar||a)&&l){var p=ts(u[h].data);if(p){var E=u[h].pts,b=E+u[h].duration;b>ka&&(b=ka),b-E<=0&&(b=E+.25);for(var A=0;A<p.length;A++){var w=p[A];if(!Eo(w)){this.updateId3CueEnds(E,f);var D=new c(E,b,"");D.value=w,f&&(D.type=f),this.id3Track.addCue(D)}}}}}}}},s.updateId3CueEnds=function(e,t){var i,a=(i=this.id3Track)==null?void 0:i.cues;if(a)for(var l=a.length;l--;){var u=a[l];u.type===t&&u.startTime<e&&u.endTime===ka&&(u.endTime=e)}},s.onBufferFlushing=function(e,t){var i=t.startOffset,a=t.endOffset,l=t.type,u=this.id3Track,c=this.hls;if(c){var h=c.config,f=h.enableEmsgMetadataCues,p=h.enableID3MetadataCues;u&&(f||p)&&hs(u,i,a,l==="audio"?function(E){return E.type===Aa&&p}:l==="video"?function(E){return E.type===Ar&&f}:function(E){return E.type===Aa&&p||E.type===Ar&&f})}},s.onLevelUpdated=function(e,t){var i=this,a=t.details;if(this.media&&a.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var l=this.dateRangeCuesAppended,u=this.id3Track,c=a.dateRanges,h=Object.keys(c);if(u)for(var f=Object.keys(l).filter(function(L){return!h.includes(L)}),p=function(){var L=f[E];Object.keys(l[L].cues).forEach(function(N){u.removeCue(l[L].cues[N])}),delete l[L]},E=f.length;E--;)p();var b=a.fragments[a.fragments.length-1];if(h.length!==0&&re(b==null?void 0:b.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var A=b.programDateTime/1e3-b.start,w=ln(),D=function(){var L=h[S],N=c[L],P=l[L],V=(P==null?void 0:P.cues)||{},Y=(P==null?void 0:P.durationKnown)||!1,j=ar(N.startDate,A),ie=ka,Q=N.endDate;if(Q)ie=ar(Q,A),Y=!0;else if(N.endOnNext&&!Y){var X=h.reduce(function(Pe,Ke){var je=c[Ke];return je.class===N.class&&je.id!==Ke&&je.startDate>N.startDate&&Pe.push(je),Pe},[]).sort(function(Pe,Ke){return Pe.startDate.getTime()-Ke.startDate.getTime()})[0];X&&(ie=ar(X.startDate,A),Y=!0)}for(var ce,oe,Ae=Object.keys(N.attr),xe=0;xe<Ae.length;xe++){var Le=Ae[xe];if((oe=Le)!=="ID"&&oe!=="CLASS"&&oe!=="START-DATE"&&oe!=="DURATION"&&oe!=="END-DATE"&&oe!=="END-ON-NEXT"){var Me=V[Le];if(Me)Y&&!P.durationKnown&&(Me.endTime=ie);else{var Oe=N.attr[Le];Me=new w(j,ie,""),ri(Le)&&(ce=Oe,Oe=Uint8Array.from(ce.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),Me.value={key:Le,data:Oe},Me.type=Sa,Me.id=L,i.id3Track.addCue(Me),V[Le]=Me}}}l[L]={cues:V,dateRange:N,durationKnown:Y}},S=0;S<h.length;S++)D()}}},d}(),zd=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(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(k.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(k.ERROR,this.onError,this)},s.unregisterListeners=function(){this.hls.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(k.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(k.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&&B.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 a=this.config,l=a.lowLatencyMode,u=a.maxLiveSyncPlaybackRate;if(l&&u!==1){var c=this.targetLatency;if(c!==null){var h=i-c,f=h<Math.min(this.maxLatency,c+t.targetduration);if(t.live&&f&&h>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,u)),E=Math.round(2/(1+Math.exp(-.75*h-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,a=e.targetduration,l=this.config,u=l.liveSyncDuration,c=l.liveSyncDurationCount,h=l.lowLatencyMode,f=this.hls.userConfig,p=h&&i||t;(f.liveSyncDuration||f.liveSyncDurationCount||p===0)&&(p=u!==void 0?u:c*a);var E=a;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 a=i.edge,l=e-t-this.edgeStalled,u=a-i.totalduration,c=a-(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}(),fs=["NONE","TYPE-0","TYPE-1",null],ms="",Qd="YES",Xd="v2",Bo=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}(),wa=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 ps(d,s){var e=s.startPTS;if(re(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 La(d,s,e,t,i,a){t-e<=0&&(B.warn("Fragment should have a positive duration",s),t=e+s.duration,a=i+s.duration);var l=e,u=t,c=s.startPTS,h=s.endPTS;if(re(c)){var f=Math.abs(c-e);re(s.deltaPTS)?s.deltaPTS=Math.max(f,s.deltaPTS):s.deltaPTS=f,l=Math.max(e,c),e=Math.min(e,c),i=Math.min(i,s.startDTS),u=Math.min(t,h),t=Math.max(t,h),a=Math.max(a,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=a;var E,b=s.sn;if(!d||b<d.startSN||b>d.endSN)return 0;var A=b-d.startSN,w=d.fragments;for(w[A]=s,E=A;E>0;E--)ps(w[E],w[E-1]);for(E=A;E<w.length-1;E++)ps(w[E],w[E+1]);return d.fragmentHint&&ps(w[w.length-1],d.fragmentHint),d.PTSKnown=d.alignedSliding=!0,p}function vs(d,s){for(var e=null,t=d.fragments,i=t.length-1;i>=0;i--){var a=t[i].initSegment;if(a){e=a;break}}d.fragmentHint&&delete d.fragmentHint.endPTS;var l,u,c,h,f,p=0;if(function(S,L,N){for(var P=L.skippedSegments,V=Math.max(S.startSN,L.startSN)-L.startSN,Y=(S.fragmentHint?1:0)+(P?L.endSN:Math.min(S.endSN,L.endSN))-L.startSN,j=L.startSN-S.startSN,ie=L.fragmentHint?L.fragments.concat(L.fragmentHint):L.fragments,Q=S.fragmentHint?S.fragments.concat(S.fragmentHint):S.fragments,X=V;X<=Y;X++){var ce=Q[j+X],oe=ie[X];P&&!oe&&X<P&&(oe=L.fragments[X]=ce),ce&&oe&&N(ce,oe)}}(d,s,function(S,L){S.relurl&&(p=S.cc-L.cc),re(S.startPTS)&&re(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&&(l=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){B.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,h=s.recentlyRemovedDateranges,f=H({},u),h&&h.forEach(function(S){delete f[S]}),Object.keys(c).forEach(function(S){var L=new $e(c[S].attr,f[S]);L.isValid?f[S]=L:B.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(c[S].attr)+'"')}),f));var b=s.fragments;if(p){B.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,Y=S.length;V<=Y;V++){var j=S[V],ie=L[V+P];j&&ie&&j.index===ie.index&&j.fragment.sn===ie.fragment.sn?N(j,ie):P--}}(d.partList,s.partList,function(S,L){L.elementaryStreams=S.elementaryStreams,L.stats=S.stats}),l?La(s,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS):gs(d,s),b.length&&(s.totalduration=s.edge-b[0].start),s.driftStartTime=d.driftStartTime,s.driftStart=d.driftStart;var w=s.advancedDateTime;if(s.advanced&&w){var D=s.edge;s.driftStart||(s.driftStartTime=w,s.driftStart=D),s.driftEndTime=w,s.driftEnd=D}else s.driftEndTime=d.driftEndTime,s.driftEnd=d.driftEnd,s.advancedDateTime=d.advancedDateTime}function gs(d,s){var e=s.startSN+s.skippedSegments-d.startSN,t=d.fragments;e<0||e>=t.length||Ia(s,t[e].start)}function Ia(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 Ho(d,s,e){var t;return d!=null&&d.details?Go((t=d.details)==null?void 0:t.partList,s,e):null}function Go(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 dn(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 Vo(d,s){var e=dn(s);return d.default[(e?"timeout":"error")+"Retry"]}function Es(d,s){var e=d.backoff==="linear"?1:Math.pow(2,s);return Math.min(e*d.retryDelayMs,d.maxRetryDelayMs)}function Ko(d){return y(y({},d),{errorRetry:null,timeoutRetry:null})}function un(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 Wo=function(d,s){for(var e=0,t=d.length-1,i=null,a=null;e<=t;){var l=s(a=d[i=(e+t)/2|0]);if(l>0)e=i+1;else{if(!(l<0))return a;t=i-1}}return null};function Ra(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&&cn(e,t,i)===0)return i;var a=Wo(s,cn.bind(null,e,t));return!a||a===d&&i?i:a}function cn(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 bi(d,s,e){var t=1e3*Math.min(s,e.duration+(e.deltaPTS?e.deltaPTS:0));return(e.endProgramDateTime||0)-t>d}var Sr,Zd=3e5,qo=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=B.log.bind(B,"[info]:"),this.warn=B.warn.bind(B,"[warning]:"),this.error=B.error.bind(B,"[error]:"),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.ERROR,this.onError,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.LEVEL_UPDATED,this.onLevelUpdated,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(k.ERROR,this.onError,this),e.off(k.ERROR,this.onErrorOut,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.LEVEL_UPDATED,this.onLevelUpdated,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.onLevelUpdated=function(){this.playlistError=0},s.onError=function(e,t){var i;if(!t.fatal){var a=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=T);case W.LEVEL_EMPTY_ERROR:case W.LEVEL_PARSING_ERROR:var u,c,h=t.parent===rt?t.level:a.loadLevel;return void(t.details===W.LEVEL_EMPTY_ERROR&&(u=t.context)!=null&&(c=u.levelDetails)!=null&&c.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,h):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,h)));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 f=a.levels[a.loadLevel];if(f&&(l.type===yi&&l.groupId===f.audioGroupId||l.type===zi&&l.groupId===f.textGroupId))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.loadLevel),t.errorAction.action=T,void(t.errorAction.flags=R)}return;case W.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var p=a.levels[a.loadLevel],E=p==null?void 0:p.attrs["HDCP-LEVEL"];return void(E&&(t.errorAction={action:T,flags:C,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:a.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:qo,flags:_})}if(t.type===se.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,a=Vo(this.hls.config.playlistLoadPolicy,e),l=this.playlistError++,u=(i=e.response)==null?void 0:i.code;if(un(a,l,dn(e),u))return{action:g,flags:_,retryConfig:a,retryCount:l};var c=this.getLevelSwitchAction(e,t);return a&&(c.retryConfig=a,c.retryCount=l),c},s.getFragRetryOrSwitchAction=function(e){var t=this.hls,i=this.getVariantLevelIndex(e.frag),a=t.levels[i],l=t.config,u=l.fragLoadPolicy,c=l.keyLoadPolicy,h=Vo(e.details.startsWith("key")?c:u,e),f=t.levels.reduce(function(A,w){return A+w.fragmentError},0);if(a){var p;e.details!==W.FRAG_GAP&&a.fragmentError++;var E=(p=e.response)==null?void 0:p.code;if(un(h,f,dn(e),E))return{action:g,flags:_,retryConfig:h,retryCount:f}}var b=this.getLevelSwitchAction(e,i);return h&&(b.retryConfig=h,b.retryCount=f),b},s.getLevelSwitchAction=function(e,t){var i=this.hls;t==null&&(t=i.loadLevel);var a=this.hls.levels[t];if(a&&(a.loadError++,i.autoLevelEnabled)){for(var l,u,c=-1,h=i.levels,f=(l=e.frag)==null?void 0:l.type,p=(u=e.context)!=null?u:{},E=p.type,b=p.groupId,A=h.length;A--;){var w=(A+i.loadLevel)%h.length;if(w!==i.loadLevel&&h[w].loadError===0){var D=h[w];if(e.details===W.FRAG_GAP&&e.frag){var S=h[w].details;if(S){var L=Ra(e.frag,S.fragments,e.frag.start);if(L!=null&&L.gap)continue}}else if(E===yi&&b===D.audioGroupId||E===zi&&b===D.textGroupId||f===Di&&a.audioGroupId===D.audioGroupId||f===Oi&&a.textGroupId===D.textGroupId)continue;c=w;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=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 qo:break;case T: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 a=i.flags,l=i.hdcpLevel,u=i.nextAutoLevel;switch(a){case _:this.switchLevel(e,u);break;case R:i.resolved||(i.resolved=this.redundantFailover(e));break;case C:l&&(t.maxHdcpLevel=fs[fs.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,a=this.penalizedRenditions,l=e.parent===rt?e.level:i.loadLevel,u=i.levels[l],c=u.url.length,h=e.frag?e.frag.urlId:u.urlId;u.urlId!==h||e.frag&&!u.details||this.penalizeRendition(u,e);for(var f=function(){var b=(h+p)%c,A=a[b];if(!A||function(w,D,S){if(performance.now()-w.lastErrorPerfMs>Zd)return!0;var L=w.details;if(D.details===W.FRAG_GAP&&L&&D.frag){var N=D.frag.start,P=Ra(null,L.fragments,N);if(P&&!P.gap)return!0}if(S&&w.errors.length<S.errors.length){var V=w.errors[w.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,a[h]))return t.warn("Switching to Redundant Stream "+(b+1)+"/"+c+': "'+u.url[b]+'" after '+e.details),t.playlistError=0,i.levels.forEach(function(w){w.urlId=b}),i.nextLoadLevel=l,{v:!0}},p=1;p<c;p++){var E=f();if(typeof E=="object")return E.v}return!1},s.penalizeRendition=function(e,t){var i=this.penalizedRenditions,a=i[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};a.lastErrorPerfMs=performance.now(),a.errors.push(t),a.details=e.details,i[e.urlId]=a},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=B.log.bind(B,t+":"),this.warn=B.warn.bind(B,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 a=-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){B.warn("Could not construct new URL for Rendition Report: "+b),c=u.URI||""}if(c===e){a=l;break}c===e.substring(0,c.length)&&(a=l)}if(a!==-1){var h=i[a],f=parseInt(h["LAST-MSN"])||(t==null?void 0:t.lastPartSn),p=parseInt(h["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 Bo(f,p>=0?p:void 0,ms)}}},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 a=this,l=t.details,u=t.stats,c=self.performance.now(),h=u.loading.first?Math.max(0,c-u.loading.first):0;if(l.advancedDateTime=Date.now()-h,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&&vs(i,l),!this.canLoad||!l.live)return;var f,p=void 0,E=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var b=this.hls.config.lowLatencyMode,A=l.lastPartSn,w=l.endSN,D=l.lastPartIndex,S=A===w;D!==-1?(p=S?w+1:A,E=S?b?0:D:D+1):p=w+1;var L=l.age,N=L+l.ageHeader,P=Math.min(N-l.partTarget,1.5*l.targetduration);if(P>0){if(i&&P>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+P+" with playlist age: "+l.age),P=0;else{var V=Math.floor(P/l.targetduration);p+=V,E!==void 0&&(E+=Math.round(P%l.targetduration/l.partTarget)),this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+L.toFixed(2)+"s goal: "+P+" skip sn "+V+" to part "+E)}l.tuneInGoal=P}if(f=this.getDeliveryDirectives(l,t.deliveryDirectives,p,E),b||!S)return void this.loadPlaylist(f)}else l.canBlockReload&&(f=this.getDeliveryDirectives(l,t.deliveryDirectives,p,E));var Y=this.hls.mainForwardBufferInfo,j=Y?Y.end-Y.len:0,ie=function(X,ce){ce===void 0&&(ce=1/0);var oe=1e3*X.targetduration;if(X.updated){var Ae=X.fragments;if(Ae.length&&4*oe>ce){var xe=1e3*Ae[Ae.length-1].duration;xe<oe&&(oe=xe)}}else oe/=2;return Math.round(oe)}(l,1e3*(l.edge-j));l.updated&&c>this.requestScheduled+ie&&(this.requestScheduled=u.loading.start),p!==void 0&&l.canBlockReload?this.requestScheduled=u.loading.first+ie-(1e3*l.partTarget||1e3):this.requestScheduled===-1||this.requestScheduled+ie<c?this.requestScheduled=c:this.requestScheduled-c<=0&&(this.requestScheduled+=ie);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 a.loadPlaylist(f)},Q)}else this.clearTimer()},s.getDeliveryDirectives=function(e,t,i,a){var l=function(u,c){var h=u.canSkipUntil,f=u.canSkipDateRanges,p=u.endSN;return h&&(c!==void 0?c-p:0)<h?f?Xd:Qd:ms}(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,a=t.part,l=ms),new Bo(i,a,l)},s.checkRetry=function(e){var t=this,i=e.details,a=dn(e),l=e.errorAction,u=l||{},c=u.action,h=u.retryCount,f=h===void 0?0:h,p=u.retryConfig,E=!!l&&!!p&&(c===g||!l.resolved&&c===T);if(E){var b;if(this.requestScheduled=-1,f>=p.maxNumRetry)return!1;if(a&&(b=e.context)!=null&&b.deliveryDirectives)this.warn("Retrying playlist loading "+(f+1)+"/"+p.maxNumRetry+' after "'+i+'" without delivery-directives'),this.loadPlaylist();else{var A=Es(p,f);this.timer=self.setTimeout(function(){return t.loadPlaylist()},A),this.warn("Retrying playlist loading "+(f+1)+"/"+p.maxNumRetry+' after "'+i+'" in '+A+"ms")}e.levelRetry=!0,l.resolved=!0}return E},d}(),G=function(d){function s(t,i){var a;return(a=d.call(this,t,"[level-controller]")||this)._levels=[],a._firstLevel=-1,a._startLevel=void 0,a.currentLevel=null,a.currentLevelIndex=-1,a.manualLevelIndex=-1,a.steering=void 0,a.onParsedComplete=void 0,a.steering=i,a._registerListeners(),a}z(s,d);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(k.FRAG_LOADED,this.onFragLoaded,this),t.on(k.ERROR,this.onError,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(k.FRAG_LOADED,this.onFragLoaded,this),t.off(k.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 a,l=[],u={};i.levels.forEach(function(c){var h,f=c.attrs;((h=c.audioCodec)==null?void 0:h.indexOf("mp4a.40.34"))!==-1&&(Sr||(Sr=/chrome|firefox/i.test(navigator.userAgent)),Sr&&(c.audioCodec=void 0));var p=f.AUDIO,E=f.CODECS,b=f["FRAME-RATE"],A=f["PATHWAY-ID"],w=f.RESOLUTION,D=f.SUBTITLES,S=(A||".")+"-"+c.bitrate+"-"+w+"-"+b+"-"+E;(a=u[S])?a.addFallback(c):(a=new wa(c),u[S]=a,l.push(a)),$(a,"audio",p),$(a,"text",D)}),this.filterAndSortMediaOptions(l,i)},e.filterAndSortMediaOptions=function(t,i){var a=this,l=[],u=[],c=!1,h=!1,f=!1,p=t.filter(function(L){var N=L.audioCodec,P=L.videoCodec,V=L.width,Y=L.height,j=L.unknownCodecs;return c||(c=!(!V||!Y)),h||(h=!!P),f||(f=!!N),!(j!=null&&j.length)&&(!N||sn(N,"audio"))&&(!P||sn(P,"video"))});if((c||h)&&f&&(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(l=i.audioTracks.filter(function(L){return!L.audioCodec||sn(L.audioCodec,"audio")})),i.subtitles&&K(u=i.subtitles);var E=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=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 w=0;w<p.length;w++)if(p[w]===b){this._firstLevel=w,this.log("manifest loaded, "+p.length+" level(s) found, first bitrate: "+b.bitrate);break}var D=f&&!h,S={levels:p,audioTracks:l,subtitleTracks:u,sessionData:i.sessionData,sessionKeys:i.sessionKeys,firstLevel:this._firstLevel,stats:i.stats,audio:f,video:h,altAudio:!D&&l.some(function(L){return!!L.url})};this.hls.trigger(k.MANIFEST_PARSED,S),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then(function(){if(a.hls){var L=new Error("no level with compatible codecs found in manifest");a.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.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===Tr&&i.context.level===this.level&&this.checkRetry(i)},e.onFragLoaded=function(t,i){var a=i.frag;if(a!==void 0&&a.type===rt){var l=this._levels[a.level];l!==void 0&&(l.loadError=0)}},e.onLevelLoaded=function(t,i){var a,l,u=i.level,c=i.details,h=this._levels[u];if(!h)return this.warn("Invalid level index "+u),void((l=i.deliveryDirectives)!=null&&l.skip&&(c.deltaUpdateFailed=!0));u===this.currentLevelIndex?(h.fragmentError===0&&(h.loadError=0),this.playlistLoaded(u,i,h.details)):(a=i.deliveryDirectives)!=null&&a.skip&&(c.deltaUpdateFailed=!0)},e.onAudioTrackSwitched=function(t,i){var a=this.currentLevel;if(a){var l=this.hls.audioTracks[i.id].groupId;if(a.audioGroupIds&&a.audioGroupId!==l){for(var u=-1,c=0;c<a.audioGroupIds.length;c++)if(a.audioGroupIds[c]===l){u=c;break}u!==-1&&u!==a.urlId&&(a.urlId=u,this.canLoad&&this.startLoad())}}},e.loadPlaylist=function(t){d.prototype.loadPlaylist.call(this);var i=this.currentLevelIndex,a=this.currentLevel;if(a&&this.shouldLoadPlaylist(a)){var l=a.urlId,u=a.uri;if(t)try{u=t.addDirectives(u)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}var c=a.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)+"/"+a.url.length+" "+u),this.clearTimer(),this.hls.trigger(k.LEVEL_LOADING,{url:u,level:i,id:l,deliveryDirectives:t||null})}},e.removeLevel=function(t,i){var a=this,l=function(c,h){return h!==i},u=this._levels.filter(function(c,h){return h!==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):(a.steering&&a.steering.removeLevel(c),!1))});this.hls.trigger(k.LEVELS_UPDATED,{levels:u})},e.onLevelsUpdated=function(t,i){var a=i.levels;a.forEach(function(l,u){var c=l.details;c!=null&&c.fragments&&c.fragments.forEach(function(h){h.level=u})}),this._levels=a},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 a=new Error("invalid level idx"),l=t<0;if(this.hls.trigger(k.ERROR,{type:se.OTHER_ERROR,details:W.LEVEL_SWITCH_ERROR,level:t,fatal:l,error:a,reason:a.message}),l)return;t=Math.min(t,i.length-1)}var u=this.currentLevelIndex,c=this.currentLevel,h=c?c.attrs["PATHWAY-ID"]:void 0,f=i[t],p=f.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=f,u!==t||!f.details||!c||h!==p){this.log("Switching to level "+t+(p?" with Pathway "+p:"")+" from level "+u+(h?" with Pathway "+h:""));var E=H({},f,{level:t,maxBitrate:f.maxBitrate,attrs:f.attrs,uri:f.uri,urlId:f.urlId});delete E._attrs,delete E._urlId,this.hls.trigger(k.LEVEL_SWITCHING,E);var b=f.details;if(!b||b.live){var A=this.switchParams(f.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 $(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",Fe="APPENDING",Te="PARTIAL",Re="OK",we=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(k.BUFFER_APPENDED,this.onBufferAppended,this),e.on(k.FRAG_BUFFERED,this.onFragBuffered,this),e.on(k.FRAG_LOADED,this.onFragLoaded,this)},s._unregisterListeners=function(){var e=this.hls;e.off(k.BUFFER_APPENDED,this.onBufferAppended,this),e.off(k.FRAG_BUFFERED,this.onFragBuffered,this),e.off(k.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 a=i.length;a--;){var l=i[a];if(!l)break;var u=l.end;if(l.start<=e&&u!==null&&e<=u)return l}return this.getBufferedFrag(e,t)},s.getBufferedFrag=function(e,t){for(var i=this.fragments,a=Object.keys(i),l=a.length;l--;){var u=i[a[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,a){var l=this;this.timeRanges&&(this.timeRanges[e]=t);var u=(a==null?void 0:a.fragment.sn)||-1;Object.keys(this.fragments).forEach(function(c){var h=l.fragments[c];if(h&&!(u>=h.body.sn))if(h.buffered||h.loaded){var f=h.range[e];f&&f.time.some(function(p){var E=!l.isTimeBuffered(p.startPTS,p.endPTS,t);return E&&l.removeFragment(h.body),E})}else h.body.type===i&&l.removeFragment(h.body)})},s.detectPartialFragments=function(e){var t=this,i=this.timeRanges,a=e.frag,l=e.part;if(i&&a.sn!=="initSegment"){var u=We(a),c=this.fragments[u];if(c){var h=!a.relurl;Object.keys(i).forEach(function(f){var p=a.elementaryStreams[f];if(p){var E=i[f],b=h||p.partial===!0;c.range[f]=t.getBufferedTimes(a,l,b,E)}}),c.loaded=null,Object.keys(c.range).length?(c.buffered=!0,c.body.endList&&(this.endListFragments[c.body.type]=c),Ce(c)||this.removeParts(a.sn-1,a.type)):this.removeFragment(c.body)}}},s.removeParts=function(e,t){var i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(function(a){return a.fragment.sn>=e}))},s.fragBuffered=function(e,t){var i=We(e),a=this.fragments[i];!a&&t&&(a=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),a&&(a.loaded=null,a.buffered=!0)},s.getBufferedTimes=function(e,t,i,a){for(var l={time:[],partial:i},u=e.start,c=e.end,h=e.minEndPTS||c,f=e.maxStartPTS||u,p=0;p<a.length;p++){var E=a.start(p)-this.bufferPadding,b=a.end(p)+this.bufferPadding;if(f>=E&&h<=b){l.time.push({startPTS:Math.max(u,a.start(p)),endPTS:Math.min(c,a.end(p))});break}if(u<b&&c>E)l.partial=!0,l.time.push({startPTS:Math.max(u,a.start(p)),endPTS:Math.min(c,a.end(p))});else if(c<=E)break}return l},s.getPartialFragment=function(e){var t,i,a,l=null,u=0,c=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(f){var p=h[f];p&&Ce(p)&&(i=p.body.start-c,a=p.body.end+c,e>=i&&e<=a&&(t=Math.min(e-i,a-e),u<=t&&(l=p.body,u=t)))}),l},s.isEndListAppended=function(e){var t=this.endListFragments[e];return t!==void 0&&(t.buffered||Ce(t))},s.getState=function(e){var t=We(e),i=this.fragments[t];return i?i.buffered?Ce(i)?Te:Re:Fe:Z},s.isTimeBuffered=function(e,t,i){for(var a,l,u=0;u<i.length;u++){if(a=i.start(u)-this.bufferPadding,l=i.end(u)+this.bufferPadding,e>=a&&t<=l)return!0;if(t<=a)return!1}return!1},s.onFragLoaded=function(e,t){var i=t.frag,a=t.part;if(i.sn!=="initSegment"&&!i.bitrateTest){var l=a?null:t,u=We(i);this.fragments[u]={body:i,appendedPTS:null,loaded:l,buffered:!1,range:Object.create(null)}}},s.onBufferAppended=function(e,t){var i=this,a=t.frag,l=t.part,u=t.timeRanges;if(a.sn!=="initSegment"){var c=a.type;if(l){var h=this.activePartLists[c];h||(this.activePartLists[c]=h=[]),h.push(l)}this.timeRanges=u,Object.keys(u).forEach(function(f){var p=u[f];i.detectEvictedFragments(f,p,c,l)})}},s.onFragBuffered=function(e,t){this.detectPartialFragments(t)},s.hasFragment=function(e){var t=We(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,a,l){var u=this;a&&!this.hasGaps||Object.keys(this.fragments).forEach(function(c){var h=u.fragments[c];if(h){var f=h.body;f.type!==i||a&&!f.gap||f.start<t&&f.end>e&&(h.buffered||l)&&u.removeFragment(f)}})},s.removeFragment=function(e){var t=We(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var i=this.activePartLists[e.type];if(i){var a=e.sn;this.activePartLists[e.type]=i.filter(function(l){return l.fragment.sn!==a})}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 Ce(d){var s,e,t;return d.buffered&&(d.body.gap||((s=d.range.video)==null?void 0:s.partial)||((e=d.range.audio)==null?void 0:e.partial)||((t=d.range.audiovideo)==null?void 0:t.partial))}function We(d){return d.type+"_"+d.level+"_"+d.urlId+"_"+d.sn}var Pt=Math.pow(2,17),Vt=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,a=e.url;if(!a)return Promise.reject(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(a?"part list":"url")),networkDetails:null}));this.abort();var l=this.config,u=l.fLoader,c=l.loader;return new Promise(function(h,f){if(i.loader&&i.loader.destroy(),e.gap)f(hi(e));else{var p=i.loader=e.loader=u?new u(l):new c(l),E=Zt(e),b=Ko(l.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Pt};e.stats=p.stats,p.load(E,A,{onSuccess:function(w,D,S,L){i.resetLoader(e,p);var N=w.data;S.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(N.slice(0,16)),N=N.slice(16)),h({frag:e,part:null,payload:N,networkDetails:L})},onError:function(w,D,S,L){i.resetLoader(e,p),f(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:y({url:a,data:void 0},w),error:new Error("HTTP Error "+w.code+" "+w.text),networkDetails:S,stats:L}))},onAbort:function(w,D,S){i.resetLoader(e,p),f(new Ve({type:se.NETWORK_ERROR,details:W.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:S,stats:w}))},onTimeout:function(w,D,S){i.resetLoader(e,p),f(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:w}))},onProgress:function(w,D,S,L){t&&t({frag:e,part:null,payload:S,networkDetails:L})}})}})},s.loadPart=function(e,t,i){var a=this;this.abort();var l=this.config,u=l.fLoader,c=l.loader;return new Promise(function(h,f){if(a.loader&&a.loader.destroy(),e.gap||t.gap)f(hi(e,t));else{var p=a.loader=e.loader=u?new u(l):new c(l),E=Zt(e,t),b=Ko(l.fragLoadPolicy.default),A={loadPolicy:b,timeout:b.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Pt};t.stats=p.stats,p.load(E,A,{onSuccess:function(w,D,S,L){a.resetLoader(e,p),a.updateStatsFromPart(e,t);var N={frag:e,part:t,payload:w.data,networkDetails:L};i(N),h(N)},onError:function(w,D,S,L){a.resetLoader(e,p),f(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:y({url:E.url,data:void 0},w),error:new Error("HTTP Error "+w.code+" "+w.text),networkDetails:S,stats:L}))},onAbort:function(w,D,S){e.stats.aborted=t.stats.aborted,a.resetLoader(e,p),f(new Ve({type:se.NETWORK_ERROR,details:W.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:S,stats:w}))},onTimeout:function(w,D,S){a.resetLoader(e,p),f(new Ve({type:se.NETWORK_ERROR,details:W.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after "+A.timeout+"ms"),networkDetails:S,stats:w}))}})}})},s.updateStatsFromPart=function(e,t){var i=e.stats,a=t.stats,l=a.total;if(i.loaded+=a.loaded,l){var u=Math.round(e.duration/t.duration),c=Math.min(Math.round(i.loaded/l),u),h=(u-c)*Math.round(i.loaded/c);i.total=i.loaded+h}else i.total=Math.max(i.loaded,i.total);var f=i.loading,p=a.loading;f.start?f.first+=p.first-p.start:(f.start=p.start,f.first=p.first),f.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 Zt(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,a=e.byteRangeEndOffset;if(re(i)&&re(a)){var l,u=i,c=a;if(d.sn==="initSegment"&&((l=d.decryptdata)==null?void 0:l.method)==="AES-128"){var h=a-i;h%16&&(c=a+(16-h%16)),i!==0&&(t.resetIV=!0,u=i-16)}t.rangeStart=u,t.rangeEnd=c}return t}function hi(d,s){var e=new Error("GAP "+(d.gap?"tag":"attribute")+" found"),t={type:se.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 Ve(t)}var Ve=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)),At=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,a,l){return t===void 0&&(t=W.KEY_LOAD_ERROR),new Ve({type:se.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:l,error:i,networkDetails:a})},s.loadClear=function(e,t){var i=this;if(this.emeController&&this.config.emeEnabled)for(var a=e.sn,l=e.cc,u=function(){var h=t[c];if(l<=h.cc&&(a==="initSegment"||h.sn==="initSegment"||a<h.sn))return i.emeController.selectKeySystemFormat(h).then(function(f){h.setKeyFormat(f)}),"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,a;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 h,f=this.keyUriToKeyInfo[c];if((i=f)!=null&&i.decryptdata.key)return l.key=f.decryptdata.key,Promise.resolve({frag:e,keyInfo:f});if((a=f)!=null&&a.keyLoadPromise)switch((h=f.mediaKeySessionContext)==null?void 0:h.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return f.keyLoadPromise.then(function(p){return l.key=p.keyInfo.decryptdata.key,{frag:e,keyInfo:f}})}switch(f=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(f,e):this.loadKeyEME(f,e);case"AES-128":return this.loadKeyHTTP(f,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 a=this.emeController.loadKey(i);if(a)return(e.keyLoadPromise=a.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,a=this.config,l=new a.loader(a);return t.keyLoader=e.loader=l,e.keyLoadPromise=new Promise(function(u,c){var h={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},f=a.keyLoadPolicy.default,p={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},E={onSuccess:function(b,A,w,D){var S=w.frag,L=w.keyInfo,N=w.url;if(!S.decryptdata||L!==i.keyUriToKeyInfo[N])return c(i.createKeyLoadError(S,W.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,w,D){i.resetLoader(A),c(i.createKeyLoadError(t,W.KEY_LOAD_ERROR,new Error("HTTP Error "+b.code+" loading key "+b.text),w,y({url:h.url,data:void 0},b)))},onTimeout:function(b,A,w){i.resetLoader(A),c(i.createKeyLoadError(t,W.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),w))},onAbort:function(b,A,w){i.resetLoader(A),c(i.createKeyLoadError(t,W.INTERNAL_ABORTED,new Error("key loading aborted"),w))}};l.load(h,p,E)})},s.resetLoader=function(e){var t=e.frag,i=e.keyInfo,a=e.url,l=i.loader;t.keyLoader===l&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[a],l&&l.destroy()},d}(),tt=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}},he=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,a=d.getBuffered(s),l=[];for(i=0;i<a.length;i++)l.push({start:a.start(i),end:a.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(w,D){var S=w.start-D.start;return S||D.end-w.end});var i=[];if(t)for(var a=0;a<s.length;a++){var l=i.length;if(l){var u=i[l-1].end;s[a].start-u<t?s[a].end>u&&(i[l-1].end=s[a].end):i.push(s[a])}else i.push(s[a])}else i=s;for(var c,h=0,f=e,p=e,E=0;E<i.length;E++){var b=i[E].start,A=i[E].end;if(e+t>=b&&e<A)f=b,h=(p=A)-e;else if(e+t<b){c=b;break}}return{len:h,start:f||0,end:p||0,nextStart:c}},d.getBuffered=function(s){try{return s.buffered}catch(e){return B.log("failed to get media.buffered",e),de}},d}(),fe=function(d,s,e,t,i,a){t===void 0&&(t=0),i===void 0&&(i=-1),a===void 0&&(a=!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=a};function Ue(d,s){for(var e=null,t=0,i=d.length;t<i;t++){var a=d[t];if(a&&a.cc===s){e=a;break}}return e}function qe(d,s){if(d){var e=d.start+s;d.start=d.startPTS=e,d.endPTS=e+d.duration}}function yt(d,s){for(var e=s.fragments,t=0,i=e.length;t<i;t++)qe(e[t],d);s.fragmentHint&&qe(s.fragmentHint,d),s.alignedSliding=!0}function ni(d,s,e){s&&(function(t,i,a){if(function(u,c,h){return!(!c.details||!(h.endCC>h.startCC||u&&u.cc<h.startCC))}(t,a,i)){var l=function(u,c,h){var f=u.fragments,p=c.fragments;if(p.length&&f.length){var E=Ue(f,p[0].cc);if(E&&(!E||E.startPTS))return E;B.log("No frag in previous level to align on")}else B.log("No fragments to align")}(a.details,i);l&&re(l.start)&&(B.log("Adjusting PTS using last level due to CC increase within current level "+i.url),yt(l.start,i))}}(d,e,s),!e.alignedSliding&&s.details&&function(t,i){if(i.fragments.length&&t.hasProgramDateTime&&i.hasProgramDateTime){var a=i.fragments[0].programDateTime,l=t.fragments[0].programDateTime,u=(l-a)/1e3+i.fragments[0].start;u&&re(u)&&(B.log("Adjusting PTS using programDateTime delta "+(l-a)+"ms, sliding:"+u.toFixed(3)+" "+t.url+" "),yt(u,t))}}(e,s.details),e.alignedSliding||!s.details||e.skippedSegments||gs(s.details,e))}function Ot(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],a=Ue(e,i.cc)||e[Math.round(e.length/2)-1],l=i.programDateTime,u=a.programDateTime;l!==null&&u!==null&&yt((u-l)/1e3-(a.start-i.start),d)}}}var Jt=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}(),Nt=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}(),Ft=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),a=0;a<4;a++)i[a]=t.getUint32(4*a);return i},s.initTable=function(){var e=this.sBox,t=this.invSBox,i=this.subMix,a=i[0],l=i[1],u=i[2],c=i[3],h=this.invSubMix,f=h[0],p=h[1],E=h[2],b=h[3],A=new Uint32Array(256),w=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[w]=L,t[L]=w;var N=A[w],P=A[N],V=A[P],Y=257*A[L]^16843008*L;a[w]=Y<<24|Y>>>8,l[w]=Y<<16|Y>>>16,u[w]=Y<<8|Y>>>24,c[w]=Y,Y=16843009*V^65537*P^257*N^16843008*w,f[L]=Y<<24|Y>>>8,p[L]=Y<<16|Y>>>16,E[L]=Y<<8|Y>>>24,b[L]=Y,w?(w=N^A[A[A[V^N]]],D^=A[A[D]]):w=D=1}},s.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,a=0;a<t.length&&i;)i=t[a]===this.key[a],a++;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,h,f,p=this.ksRows=4*(l+6+1),E=this.keySchedule=new Uint32Array(p),b=this.invKeySchedule=new Uint32Array(p),A=this.sBox,w=this.rcon,D=this.invSubMix,S=D[0],L=D[1],N=D[2],P=D[3];for(u=0;u<p;u++)u<l?h=E[u]=t[u]:(f=h,u%l==0?(f=A[(f=f<<8|f>>>24)>>>24]<<24|A[f>>>16&255]<<16|A[f>>>8&255]<<8|A[255&f],f^=w[u/l|0]<<24):l>6&&u%l==4&&(f=A[f>>>24]<<24|A[f>>>16&255]<<16|A[f>>>8&255]<<8|A[255&f]),E[u]=h=(E[u-l]^f)>>>0);for(c=0;c<p;c++)u=p-c,f=3&c?E[u]:E[u-4],b[c]=c<4||u<=4?f:S[A[f>>>24]]^L[A[f>>>16&255]]^N[A[f>>>8&255]]^P[A[255&f]],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 a,l,u,c,h,f,p,E,b,A,w,D,S,L,N=this.keySize+6,P=this.invKeySchedule,V=this.invSBox,Y=this.invSubMix,j=Y[0],ie=Y[1],Q=Y[2],X=Y[3],ce=this.uint8ArrayToUint32Array_(i),oe=ce[0],Ae=ce[1],xe=ce[2],Le=ce[3],Me=new Int32Array(e),Oe=new Int32Array(Me.length),Pe=this.networkToHostOrderSwap;t<Me.length;){for(b=Pe(Me[t]),A=Pe(Me[t+1]),w=Pe(Me[t+2]),D=Pe(Me[t+3]),h=b^P[0],f=D^P[1],p=w^P[2],E=A^P[3],S=4,L=1;L<N;L++)a=j[h>>>24]^ie[f>>16&255]^Q[p>>8&255]^X[255&E]^P[S],l=j[f>>>24]^ie[p>>16&255]^Q[E>>8&255]^X[255&h]^P[S+1],u=j[p>>>24]^ie[E>>16&255]^Q[h>>8&255]^X[255&f]^P[S+2],c=j[E>>>24]^ie[h>>16&255]^Q[f>>8&255]^X[255&p]^P[S+3],h=a,f=l,p=u,E=c,S+=4;a=V[h>>>24]<<24^V[f>>16&255]<<16^V[p>>8&255]<<8^V[255&E]^P[S],l=V[f>>>24]<<24^V[p>>16&255]<<16^V[E>>8&255]<<8^V[255&h]^P[S+1],u=V[p>>>24]<<24^V[E>>16&255]<<16^V[h>>8&255]<<8^V[255&f]^P[S+2],c=V[E>>>24]<<24^V[h>>16&255]<<16^V[f>>8&255]<<8^V[255&p]^P[S+3],Oe[t]=Pe(a^oe),Oe[t+1]=Pe(c^Ae),Oe[t+2]=Pe(u^xe),Oe[t+3]=Pe(l^Le),oe=b,Ae=A,xe=w,Le=D,t+=4}return Oe.buffer},d}(),Ni=function(){function d(e,t){var i=(t===void 0?{}:t).removePKCS7Padding,a=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=a,a)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,a,l,u=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(a=(i=u).byteLength,(l=a&&new DataView(i.buffer).getUint8(a-1))?xi(i,0,a-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 a=this;return this.useSoftware?new Promise(function(l,u){a.softwareDecrypt(new Uint8Array(e),t,i);var c=a.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 a=this.currentIV,l=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(e=br(u,e),this.remainderData=null);var c=this.getValidChunk(e);if(!c.length)return null;a&&(i=a);var h=this.softwareDecrypter;h||(h=this.softwareDecrypter=new Ft),h.expandKey(t);var f=l;return this.currentResult=h.decrypt(c.buffer,0,i),this.currentIV=xi(c,-16).buffer,f||null},s.webCryptoDecrypt=function(e,t,i){var a=this,l=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new Nt(l,t)),this.fastAesKey.expandKey().then(function(u){return l?(a.logOnce("WebCrypto AES decrypt"),new Jt(l,new Uint8Array(i)).decrypt(e.buffer,u)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(u){return B.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+u.name+": "+u.message),a.onWebCryptoError(e,t,i)})},s.onWebCryptoError=function(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);var a=this.flush();if(a)return a.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=xi(e,0,i),this.remainderData=xi(e,i)),t},s.logOnce=function(e){this.logEnabled&&(B.log("[decrypter]: "+e),this.logEnabled=!1)},d}(),Da=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},Ut="STOPPED",De="IDLE",kr="KEY_LOADING",Zr="FRAG_LOADING",Jr="FRAG_LOADING_WAITING_RETRY",Ca="WAITING_TRACK",wr="PARSING",Yo="PARSED",ys="ENDED",hn="ERROR",bs="WAITING_INIT_PTS",fn="WAITING_LEVEL",Jd=function(d){function s(t,i,a,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=Ut,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=B.log.bind(B,l+":"),c.warn=B.warn.bind(B,l+":"),c.hls=t,c.fragmentLoader=new Vt(t.config),c.keyLoader=a,c.fragmentTracker=i,c.config=t.config,c.decrypter=new Ni(t.config),t.on(k.MANIFEST_LOADED,c.onManifestLoaded,function(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}(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(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=Ut},e._streamEnded=function(t,i){if(i.live||t.nextStart||!t.end||!this.media)return!1;var a=i.partList;if(a!=null&&a.length){var l=a[a.length-1];return he.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 a=this.media=this.mediaBuffer=i.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),a.addEventListener("seeking",this.onvseeking),a.addEventListener("ended",this.onvended);var l=this.config;this.levels&&l.autoStartLoad&&this.state===Ut&&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,a=this.media,l=this.mediaBuffer,u=this.state,c=a?a.currentTime:0,h=he.bufferInfo(l||a,c,t.maxBufferHole);if(this.log("media seeking to "+(re(c)?c.toFixed(3):c)+", state: "+u),this.state===ys)this.resetLoadingState();else if(i){var f=t.maxFragLookUpTolerance,p=i.start-f,E=i.start+i.duration+f;if(!h.len||E<h.start||p>h.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()),this.fragPrevious=null)}}a&&(this.fragmentTracker.removeFragmentsInRange(c,1/0,this.playlistType,!0),this.lastCurrentTime=c),this.loadedmetadata||h.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=Ut,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,a){this._loadFragForPlayback(t,i,a)},e._loadFragForPlayback=function(t,i,a){var l=this;this._doFragLoad(t,i,a,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===Zr||!l.fragCurrent&&c===wr)&&(l.fragmentTracker.removeFragment(t),l.state=De):("payload"in u&&(l.log("Loaded fragment "+t.sn+" of level "+t.level),l.hls.trigger(k.FRAG_LOADED,u)),l._handleFragmentLoadComplete(u))}}).catch(function(u){l.state!==Ut&&l.state!==hn&&(l.warn(u),l.resetFragmentLoading(t))})},e.clearTrackerIfNeeded=function(t){var i,a=this.fragmentTracker;if(a.getState(t)===Fe){var l=t.type,u=this.getFwdBufferInfo(this.mediaBuffer,l),c=Math.max(t.duration,u?u.len:this.config.maxBufferLength);this.reduceMaxBufferLength(c)&&a.removeFragment(t)}else((i=this.mediaBuffer)==null?void 0:i.buffered.length)===0?a.removeAllFragments():a.hasParts(t.type)&&(a.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),a.getState(t)===Te&&a.removeFragment(t))},e.flushMainBuffer=function(t,i,a){if(a===void 0&&(a=null),t-i){var l={startOffset:t,endOffset:i,type:a};this.hls.trigger(k.BUFFER_FLUSHING,l)}},e._loadInitSegment=function(t,i){var a=this;this._doFragLoad(t,i).then(function(l){if(!l||a.fragContextChanged(t)||!a.levels)throw new Error("init load aborted");return l}).then(function(l){var u=a.hls,c=l.payload,h=t.decryptdata;if(c&&c.byteLength>0&&h&&h.key&&h.iv&&h.method==="AES-128"){var f=self.performance.now();return a.decrypter.decrypt(new Uint8Array(c),h.key.buffer,h.iv.buffer).catch(function(p){throw u.trigger(k.ERROR,{type:se.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(k.FRAG_DECRYPTED,{frag:t,payload:p,stats:{tstart:f,tdecrypt:E}}),l.payload=p,l})}return l}).then(function(l){var u=a.fragCurrent,c=a.hls;if(!a.levels)throw new Error("init load aborted, missing levels");var h=t.stats;a.state=De,i.fragmentError=0,t.data=new Uint8Array(l.payload),h.parsing.start=h.buffering.start=self.performance.now(),h.parsing.end=h.buffering.end=self.performance.now(),l.frag===u&&c.trigger(k.FRAG_BUFFERED,{stats:h,frag:u,part:null,id:t.type}),a.tick()}).catch(function(l){a.state!==Ut&&a.state!==hn&&(a.warn(l),a.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 a,l,u,c,h=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(i?" part: "+i.index:"")+" of "+(this.playlistType===rt?"level":"track")+" "+t.level+" (frag:["+((a=t.startPTS)!=null?a:NaN).toFixed(3)+"-"+((l=t.endPTS)!=null?l:NaN).toFixed(3)+"] > buffer:"+(h?Da(he.getBuffered(h)):"(detached)")+")"),this.state=De,h&&(!this.loadedmetadata&&t.type==rt&&h.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 a=t.frag,l=t.part,u=t.partsLoaded,c=!u||u.length===0||u.some(function(f){return!f}),h=new fe(a.level,a.sn,a.stats.chunkCount+1,0,l?l.index:-1,!c);i.flush(h)}},e._handleFragmentLoadProgress=function(t){},e._doFragLoad=function(t,i,a,l){var u,c=this;a===void 0&&(a=null);var h=i==null?void 0:i.details;if(!this.levels||!h)throw new Error("frag load aborted, missing level"+(h?"":" detail")+"s");var f=null;if(!t.encrypted||(u=t.decryptdata)!=null&&u.key?!t.encrypted&&h.encryptedFragments.length&&this.keyLoader.loadClear(t,h.encryptedFragments):(this.log("Loading key for "+t.sn+" of ["+h.startSN+"-"+h.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+t.level),this.state=kr,this.fragCurrent=t,f=this.keyLoader.load(t).then(function(S){if(!c.fragContextChanged(S.frag))return c.hls.trigger(k.KEY_LOADED,S),c.state===kr&&(c.state=De),S}),this.hls.trigger(k.KEY_LOADING,{frag:t}),this.fragCurrent===null&&(f=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),a=Math.max(t.start,a||0),this.config.lowLatencyMode&&t.sn!=="initSegment"){var p=h.partList;if(p&&l){a>t.end&&h.fragmentHint&&(t=h.fragmentHint);var E=this.getNextPart(p,t,a);if(E>-1){var b,A=p[E];return this.log("Loading part sn: "+t.sn+" p: "+A.index+" cc: "+t.cc+" of playlist ["+h.startSN+"-"+h.endSN+"] parts [0-"+E+"-"+(p.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+t.level+", target: "+parseFloat(a.toFixed(3))),this.nextLoadPosition=A.start+A.duration,this.state=Zr,b=f?f.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(k.FRAG_LOADING,{frag:t,part:A,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):b}if(!t.url||this.loadedEndOfParts(p,a))return Promise.resolve(null)}}this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(h?"of ["+h.startSN+"-"+h.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+t.level+", target: "+parseFloat(a.toFixed(3))),re(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=Zr;var w,D=this.config.progressive;return w=D&&f?f.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),f]).then(function(S){var L=S[0];return!D&&L&&l&&l(L),L}).catch(function(S){return c.handleFragLoadError(S)}),this.hls.trigger(k.FRAG_LOADING,{frag:t,targetBufferTime:a}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):w},e.doFragPartsLoad=function(t,i,a,l){var u=this;return new Promise(function(c,h){var f,p=[],E=(f=a.details)==null?void 0:f.partList;(function b(A){u.fragmentLoader.loadPart(t,A,l).then(function(w){p[A.index]=w;var D=w.part;u.hls.trigger(k.FRAG_LOADED,w);var S=Ho(a,t.sn,A.index+1)||Go(E,t.sn,A.index+1);if(!S)return c({frag:t,part:D,partsLoaded:p});b(S)}).catch(h)})(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(k.ERROR,i)}else this.hls.trigger(k.ERROR,{type:se.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===wr){var a=i.frag,l=i.part,u=i.level,c=self.performance.now();a.stats.parsing.end=c,l&&(l.stats.parsing.end=c),this.updateLevelTiming(a,l,u,t.partial)}else this.fragCurrent||this.state===Ut||this.state===hn||(this.state=De)},e.getCurrentContext=function(t){var i=this.levels,a=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 h=i[l],f=c>-1?Ho(h,u,c):null,p=f?f.fragment:function(E,b,A){if(E==null||!E.details)return null;var w=E.details,D=w.fragments[b-w.startSN];return D||((D=w.fragmentHint)&&D.sn===b?D:b<w.startSN&&A&&A.sn===b?A:null)}(h,u,a);return p?(a&&a!==p&&(p.stats=a.stats),{frag:p,part:f,level:h}):null},e.bufferFragmentData=function(t,i,a,l){var u;if(t&&this.state===wr){var c=t.data1,h=t.data2,f=c;if(c&&h&&(f=br(c,h)),(u=f)!=null&&u.length){var p={type:t.type,frag:i,part:a,chunkMeta:l,parent:i.type,data:f};this.hls.trigger(k.BUFFER_APPENDING,p),t.dropped&&t.independent&&!a&&this.flushBufferGap(i)}}},e.flushBufferGap=function(t){var i=this.media;if(i)if(he.isBuffered(i,i.currentTime)){var a=i.currentTime,l=he.bufferInfo(i,a,0),u=t.duration,c=Math.min(2*this.config.maxFragLookUpTolerance,.25*u),h=Math.max(Math.min(t.start-c,l.end-c),a+c);t.start-h>c&&this.flushMainBuffer(h,t.start)}else this.flushMainBuffer(0,t.start)},e.getFwdBufferInfo=function(t,i){var a=this.getLoadPosition();return re(a)?this.getFwdBufferInfoAtPos(t,a,i):null},e.getFwdBufferInfoAtPos=function(t,i,a){var l=this.config.maxBufferHole,u=he.bufferInfo(t,i,l);if(u.len===0&&u.nextStart!==void 0){var c=this.fragmentTracker.getBufferedFrag(i,a);if(c&&u.nextStart<c.end)return he.bufferInfo(t,i,Math.max(u.nextStart,l))}return u},e.getMaxBufferLength=function(t){var i,a=this.config;return i=t?Math.max(8*a.maxBufferSize/t,a.maxBufferLength):a.maxBufferLength,Math.min(i,a.maxMaxBufferLength)},e.reduceMaxBufferLength=function(t){var i=this.config,a=t||i.maxBufferLength;return i.maxMaxBufferLength>=a&&(i.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+i.maxMaxBufferLength+"s"),!0)},e.getAppendedFrag=function(t,i){var a=this.fragmentTracker.getAppendedFrag(t,rt);return a&&"fragment"in a?a.fragment:a},e.getNextFragment=function(t,i){var a=i.fragments,l=a.length;if(!l)return null;var u,c=this.config,h=a[0].start;if(i.live){var f=c.initialLiveManifestSize;if(l<f)return this.warn("Not enough fragments to start playback (have: "+l+", need: "+f+")"),null;i.PTSKnown||this.startFragRequested||this.startPosition!==-1||(u=this.getInitialLiveFragment(i,a),this.startPosition=u?this.hls.liveSyncPosition||u.start:t)}else t<=h&&(u=a[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 a=this.fragmentTracker.getState(t);return(a===Re||a===Te&&!!t.gap)&&this.nextLoadPosition>i},e.getNextFragmentLoopLoading=function(t,i,a,l,u){var c=t.gap,h=this.getNextFragment(this.nextLoadPosition,i);if(h===null)return h;if(t=h,c&&t&&!t.gap&&a.nextStart){var f=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,a.nextStart,l);if(f!==null&&a.len+f.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,a){for(var l=-1,u=!1,c=!0,h=0,f=t.length;h<f;h++){var p=t[h];if(c=c&&!p.independent,l>-1&&a<p.start)break;var E=p.loaded;E?l=-1:(u||p.independent||c)&&p.fragment===i&&(l=h),u=E}return l},e.loadedEndOfParts=function(t,i){var a=t[t.length-1];return a&&i>a.start&&a.loaded},e.getInitialLiveFragment=function(t,i){var a=this.fragPrevious,l=null;if(a){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+a.programDateTime),l=function(f,p,E){if(p===null||!Array.isArray(f)||!f.length||!re(p)||p<(f[0].programDateTime||0)||p>=(f[f.length-1].endProgramDateTime||0))return null;E=E||0;for(var b=0;b<f.length;++b){var A=f[b];if(bi(p,E,A))return A}return null}(i,a.endProgramDateTime,this.config.maxFragLookUpTolerance)),!l){var u=a.sn+1;if(u>=t.startSN&&u<=t.endSN){var c=i[u-t.startSN];a.cc===c.cc&&(l=c,this.log("Live playlist, switching playlist, load frag with next SN: "+l.sn))}l||(l=function(f,p){return Wo(f,function(E){return E.cc<p?1:E.cc>p?-1:0})}(i,a.cc),l&&this.log("Live playlist, switching playlist, load frag with same CC: "+l.sn))}}else{var h=this.hls.liveSyncPosition;h!==null&&(l=this.getFragmentAtPosition(h,this.bitrateTest?t.fragmentEnd:t.edge,t))}return l},e.getFragmentAtPosition=function(t,i,a){var l,u=this.config,c=this.fragPrevious,h=a.fragments,f=a.endSN,p=a.fragmentHint,E=u.maxFragLookUpTolerance,b=a.partList,A=!!(u.lowLatencyMode&&b!=null&&b.length&&p);if(A&&p&&!this.bitrateTest&&(h=h.concat(p),f=p.sn),l=t<i?Ra(c,h,t,t>i-E?0:E):h[h.length-1]){var w=l.sn-a.startSN,D=this.fragmentTracker.getState(l);if((D===Re||D===Te&&l.gap)&&(c=l),c&&l.sn===c.sn&&(!A||b[0].fragment.sn>l.sn)&&c&&l.level===c.level){var S=h[w+1];l=l.sn<f&&this.fragmentTracker.getState(S)!==Re?S:null}}return l},e.synchronizeToLiveEdge=function(t){var i=this.config,a=this.media;if(a){var l=this.hls.liveSyncPosition,u=a.currentTime,c=t.fragments[0].start,h=t.edge,f=u>=c-i.maxFragLookUpTolerance&&u<=h;if(l!==null&&a.duration>l&&(u<l||!f)){var p=i.liveMaxLatencyDuration!==void 0?i.liveMaxLatencyDuration:i.liveMaxLatencyDurationCount*t.targetduration;(!f&&a.readyState<4||u<h-p)&&(this.loadedmetadata||(this.nextLoadPosition=l),a.readyState&&(this.warn("Playback: "+u.toFixed(3)+" is located too far from the end of live sliding playlist: "+h+", reset currentTime to : "+l.toFixed(3)),a.currentTime=l))}}},e.alignPlaylists=function(t,i){var a=this.levels,l=this.levelLastLoaded,u=this.fragPrevious,c=l!==null?a[l]:null,h=t.fragments.length;if(!h)return this.warn("No fragments in live playlist"),0;var f=t.fragments[0].start,p=!i,E=t.alignedSliding&&re(f);if(p||!E&&!f){ni(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: "+h),b}return f},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 a=this.startPosition;if(a<i&&(a=-1),a===-1||this.lastCurrentTime===-1){var l=this.startTimeOffset!==null,u=l?this.startTimeOffset:t.startTimeOffset;u!==null&&re(u)?(a=i+u,u<0&&(a+=t.totalduration),a=Math.min(Math.max(i,a),i+t.totalduration),this.log("Start time offset "+u+" found in "+(l?"multivariant":"media")+" playlist, adjust startPosition to "+a),this.startPosition=a):t.live?a=this.hls.liveSyncPosition||i:this.startPosition=a=0,this.lastCurrentTime=a}this.nextLoadPosition=a},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===Jr)||(this.state=De)},e.onFragmentOrKeyLoadError=function(t,i){if(i.chunkMeta&&!i.frag){var a=this.getCurrentContext(i.chunkMeta);a&&(i.frag=a.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 h=i.errorAction,f=h||{},p=f.action,E=f.retryCount,b=E===void 0?0:E,A=f.retryConfig;if(h&&p===g&&A){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var w=Es(A,b);this.warn("Fragment "+l.sn+" of "+t+" "+l.level+" errored with "+i.details+", retrying loading "+(b+1)+"/"+A.maxNumRetry+" in "+w+"ms"),h.resolved=!0,this.retryDate=self.performance.now()+w,this.state=Jr}else A&&h?(this.resetFragmentErrors(t),b<A.maxNumRetry?c||(h.resolved=!0):B.warn(i.details+" reached or exceeded max retry ("+b+")")):this.state=hn;this.tickImmediate()}},e.reduceLengthAndFlushBuffer=function(t){if(this.state===wr||this.state===Yo){var i=t.parent,a=this.getFwdBufferInfo(this.mediaBuffer,i),l=a&&a.len>.5;l&&this.reduceMaxBufferLength(a.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===Di&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Ut&&(this.state=De)},e.afterBufferFlushed=function(t,i,a){if(t){var l=he.getBuffered(t);this.fragmentTracker.detectEvictedFragments(i,l,a),this.state===ys&&this.resetLoadingState()}},e.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=De},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,a,l){var u,c=this,h=a.details;if(h){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 w=l?0:La(h,t,b.startPTS,b.endPTS,b.startDTS,b.endDTS);return c.hls.trigger(k.LEVEL_PTS_UPDATED,{details:h,level:a,drift:w,type:E,frag:t,start:b.startPTS,end:b.endPTS}),!0}return p},!1))a.fragmentError=0;else if(((u=this.transmuxer)==null?void 0:u.error)===null){var f=new Error("Found no media in fragment "+t.sn+" of level "+a.id+" resetting transmuxer to fallback to playlist timing");if(this.warn(f.message),this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:f,frag:t,reason:"Found no media in msn "+t.sn+' of level "'+a.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=Yo,this.hls.trigger(k.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}(tt);function Ch(){return self.SourceBuffer||self.WebKitSourceBuffer}function nr(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 Mh=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,a){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=br(this.cachedData,e),this.cachedData=null);var i,a=ga(e,0),l=a?a.length:0,u=this._audioTrack,c=this._id3Track,h=a?function(b){for(var A=ts(b),w=0;w<A.length;w++){var D=A[w];if(Eo(D))return _o(D)}}(a):void 0,f=e.length;for((this.basePTS===null||this.frameIndex===0&&re(h))&&(this.basePTS=Bv(h,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),a&&a.length>0&&c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Aa,duration:Number.POSITIVE_INFINITY});l<f;){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=f}else go(e,l)?(a=ga(e,l),c.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Aa,duration:Number.POSITIVE_INFINITY}),i=l+=a.length):l++;if(l===f&&i!==f){var E=xi(e,i);this.cachedData?this.cachedData=br(this.cachedData,E):this.cachedData=E}}return{audioTrack:u,videoTrack:nr(),id3Track:c,textTrack:nr()}},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:nr(),id3Track:this._id3Track,textTrack:nr()}},s.destroy=function(){},d}(),Bv=function(d,s,e){return re(d)?90*d:9e4*s+(e?9e4*e.baseTime/e.timescale:0)};function xh(d,s){return d[s]===255&&(246&d[s+1])==240}function Ph(d,s){return 1&d[s+1]?7:9}function eu(d,s){return(3&d[s+3])<<11|d[s+4]<<3|(224&d[s+5])>>>5}function $o(d,s){return s+1<d.length&&xh(d,s)}function Hv(d,s){if($o(d,s)){var e=Ph(d,s);if(s+e>=d.length)return!1;var t=eu(d,s);if(t<=e)return!1;var i=s+t;return i===d.length||$o(d,i)}return!1}function Oh(d,s,e,t,i){if(!d.samplerate){var a=function(l,u,c,h){var f,p,E,b,A=navigator.userAgent.toLowerCase(),w=h,D=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=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,B.log("manifest codec:"+h+", ADTS type:"+f+", samplingIndex:"+S),/firefox/i.test(A)?S>=6?(f=5,b=new Array(4),p=S-3):(f=2,b=new Array(2),p=S):A.indexOf("android")!==-1?(f=2,b=new Array(2),p=S):(f=5,b=new Array(4),h&&(h.indexOf("mp4a.40.29")!==-1||h.indexOf("mp4a.40.5")!==-1)||!h&&S>=6?p=S-3:((h&&h.indexOf("mp4a.40.2")!==-1&&(S>=6&&E===1||/vivaldi/i.test(A))||!h&&E===1)&&(f=2,b=new Array(2)),p=S)),b[0]=f<<3,b[0]|=(14&S)>>1,b[1]|=(1&S)<<7,b[1]|=E<<3,f===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."+f,manifestCodec:w};l.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+S})}(s,e,t,i);if(!a)return;d.config=a.config,d.samplerate=a.samplerate,d.channelCount=a.channelCount,d.codec=a.codec,d.manifestCodec=a.manifestCodec,B.log("parsed codec:"+d.codec+", rate:"+a.samplerate+", channels:"+a.channelCount)}}function Nh(d){return 9216e4/d}function Fh(d,s,e,t,i){var a,l=t+i*Nh(d.samplerate),u=function(A,w){var D=Ph(A,w);if(w+D<=A.length){var S=eu(A,w)-D;if(S>0)return{headerLength:D,frameLength:S}}}(s,e);if(u){var c=u.frameLength,h=u.headerLength,f=h+c,p=Math.max(0,e+f-s.length);p?(a=new Uint8Array(f-h)).set(s.subarray(e+h,s.length),0):a=s.subarray(e+h,e+f);var E={unit:a,pts:l};return p||d.samples.push(E),{sample:E,length:f,missing:p}}var b=s.length-e;return(a=new Uint8Array(b)).set(s.subarray(e,s.length),0),{sample:{unit:a,pts:l},length:b,missing:-1}}var Gv=function(d){function s(t,i){var a;return(a=d.call(this)||this).observer=void 0,a.config=void 0,a.observer=t,a.config=i,a}z(s,d);var e=s.prototype;return e.resetInitSegment=function(t,i,a,l){d.prototype.resetInitSegment.call(this,t,i,a,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=(ga(t,0)||[]).length,a=t.length;i<a;i++)if(Hv(t,i))return B.log("ADTS sync word found !"),!0;return!1},e.canParse=function(t,i){return function(a,l){return function(u,c){return c+5<u.length}(a,l)&&xh(a,l)&&eu(a,l)<=a.length-l}(t,i)},e.appendFrame=function(t,i,a){Oh(t,this.observer,i,a,t.manifestCodec);var l=Fh(t,i,a,this.basePTS,this.frameIndex);if(l&&l.missing===0)return l},s}(Mh),Vv=/\/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,a){var l=this.videoTrack=nr("video",1),u=this.audioTrack=nr("audio",1),c=this.txtTrack=nr("text",1);if(this.id3Track=nr("id3",1),this.timeOffset=0,e!=null&&e.byteLength){var h=as(e);if(h.video){var f=h.video,p=f.id,E=f.timescale,b=f.codec;l.id=p,l.timescale=c.timescale=E,l.codec=b}if(h.audio){var A=h.audio,w=A.id,D=A.timescale,S=A.codec;u.id=w,u.timescale=D,u.codec=S}c.id=To.text,l.sampleDuration=0,l.duration=u.duration=a}},s.resetContiguity=function(){this.remainderData=null},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,a=this.videoTrack,l=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=br(this.remainderData,e));var u=function(h){var f={valid:null,remainder:null},p=Je(h,["moof"]);if(!p)return f;if(p.length<2)return f.remainder=h,f;var E=p[p.length-1];return f.valid=xi(h,0,E.byteOffset-8),f.remainder=xi(h,E.byteOffset-8),f}(i);this.remainderData=u.remainder,a.samples=u.valid||new Uint8Array}else a.samples=i;var c=this.extractID3Track(a,t);return l.samples=ss(t,a),{videoTrack:a,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 a=this.extractID3Track(t,this.timeOffset);return i.samples=ss(e,t),{videoTrack:t,audioTrack:nr(),id3Track:a,textTrack:nr()}},s.extractID3Track=function(e,t){var i=this.id3Track;if(e.samples.length){var a=Je(e.samples,["emsg"]);a&&a.forEach(function(l){var u=function(p){var E=p[0],b="",A="",w=0,D=0,S=0,L=0,N=0,P=0;if(E===0){for(;Mt(p.subarray(P,P+1))!=="\0";)b+=Mt(p.subarray(P,P+1)),P+=1;for(b+=Mt(p.subarray(P,P+1)),P+=1;Mt(p.subarray(P,P+1))!=="\0";)A+=Mt(p.subarray(P,P+1)),P+=1;A+=Mt(p.subarray(P,P+1)),P+=1,w=He(p,12),D=He(p,16),L=He(p,20),N=He(p,24),P=28}else if(E===1){w=He(p,P+=4);var V=He(p,P+=4),Y=He(p,P+=4);for(P+=4,S=Math.pow(2,32)*V+Y,Number.isSafeInteger(S)||(S=Number.MAX_SAFE_INTEGER,B.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),L=He(p,P),N=He(p,P+=4),P+=4;Mt(p.subarray(P,P+1))!=="\0";)b+=Mt(p.subarray(P,P+1)),P+=1;for(b+=Mt(p.subarray(P,P+1)),P+=1;Mt(p.subarray(P,P+1))!=="\0";)A+=Mt(p.subarray(P,P+1)),P+=1;A+=Mt(p.subarray(P,P+1)),P+=1}return{schemeIdUri:b,value:A,timeScale:w,presentationTime:S,presentationTimeDelta:D,eventDuration:L,id:N,payload:p.subarray(P,p.byteLength)}}(l);if(Vv.test(u.schemeIdUri)){var c=re(u.presentationTime)?u.presentationTime/u.timeScale:t+u.presentationTimeDelta/u.timeScale,h=u.eventDuration===4294967295?Number.POSITIVE_INFINITY:u.eventDuration/u.timeScale;h<=.001&&(h=Number.POSITIVE_INFINITY);var f=u.payload;i.samples.push({data:f,len:f.byteLength,dts:c,pts:c,type:Ar,duration:h})}})}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}(),jo=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],qv=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Yv=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],$v=[0,1,1,4];function Uh(d,s,e,t,i){if(!(e+24>s.length)){var a=Bh(s,e);if(a&&e+a.frameLength<=s.length){var l=t+i*(9e4*a.samplesPerFrame/a.sampleRate),u={unit:s.subarray(e,e+a.frameLength),pts:l,dts:l};return d.config=[],d.channelCount=a.channelCount,d.samplerate=a.sampleRate,d.samples.push(u),{sample:u,length:a.frameLength,missing:0}}}}function Bh(d,s){var e=d[s+1]>>3&3,t=d[s+1]>>1&3,i=d[s+2]>>4&15,a=d[s+2]>>2&3;if(e!==1&&i!==0&&i!==15&&a!==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],h=qv[3*(e===3?0:e===2?1:2)+a],f=u===3?1:2,p=Yv[e][t],E=$v[t],b=8*p*E,A=Math.floor(p*c/h+l)*E;if(jo===null){var w=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);jo=w?parseInt(w[1]):0}return!!jo&&jo<=87&&t===2&&c>=224e3&&u===0&&(d[s+3]=128|d[s+3]),{sampleRate:h,channelCount:f,frameLength:A,samplesPerFrame:b}}}function tu(d,s){return d[s]===255&&(224&d[s+1])==224&&(6&d[s+1])!=0}function Hh(d,s){return s+1<d.length&&tu(d,s)}function jv(d,s){if(s+1<d.length&&tu(d,s)){var e=Bh(d,s),t=4;e!=null&&e.frameLength&&(t=e.frameLength);var i=s+t;return i===d.length||Hh(d,i)}return!1}var Gh=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,a=new Uint8Array(4),l=Math.min(4,t);if(l===0)throw new Error("no bytes available");a.set(e.subarray(i,i+l)),this.word=new DataView(a.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&&B.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,a=0;a<e;a++)i!==0&&(i=(t+this.readEG()+256)%256),t=i===0?t:i},s.readSPS=function(){var e,t,i,a=0,l=0,u=0,c=0,h=this.readUByte.bind(this),f=this.readBits.bind(this),p=this.readUEG.bind(this),E=this.readBoolean.bind(this),b=this.skipBits.bind(this),A=this.skipEG.bind(this),w=this.skipUEG.bind(this),D=this.skipScalingList.bind(this);h();var S=h();if(f(5),b(3),h(),w(),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),w(),w(),b(1),E())for(t=L!==3?8:12,i=0;i<t;i++)E()&&D(i<6?16:64)}w();var N=p();if(N===0)p();else if(N===1)for(b(1),A(),A(),e=p(),i=0;i<e;i++)A();w(),b(1);var P=p(),V=p(),Y=f(1);Y===0&&b(1),b(1),E()&&(a=p(),l=p(),u=p(),c=p());var j=[1,1];if(E()&&E())switch(h()){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=[h()<<8|h(),h()<<8|h()]}return{width:Math.ceil(16*(P+1)-2*a-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}(),zv=function(){function d(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Ni(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 a=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(h){var f=new Uint8Array(h);l.set(f,16),a.decrypter.isSync()||a.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),a=0,l=32;l<e.length-16;l+=160,a+=16)i.set(e.subarray(l,l+16),a);return i},s.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),a=0,l=32;l<e.length-16;l+=160,a+=16)e.set(i.subarray(a,a+16),l);return e},s.decryptAvcSample=function(e,t,i,a,l){var u=this,c=Lo(l.data),h=this.getAvcEncryptedData(c);this.decryptBuffer(h.buffer).then(function(f){l.data=u.getAvcDecryptedUnit(c,f),u.decrypter.isSync()||u.decryptAvcSamples(e,t,i+1,a)})},s.decryptAvcSamples=function(e,t,i,a){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void a();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,a,u),this.decrypter.isSync())))return}}},d}(),_i=188,Qv=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&&B.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-_i)+1,a=0;a<i;){for(var l=!1,u=-1,c=0,h=a;h<t;h+=_i){if(e[h]!==71){if(c)return-1;break}if(c++,u===-1&&(u=h)!==0&&(i=Math.min(u+18612,e.length-_i)+1),l||(l=iu(e,h)===0),l&&c>1&&(u===0&&c>2||h+_i>i))return u}a++}return-1},d.createTrack=function(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:To[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,a){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video"),this._audioTrack=d.createTrack("audio",a),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=a},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,a){var l;i===void 0&&(i=!1),a===void 0&&(a=!1),i||(this.sampleAes=null);var u=this._avcTrack,c=this._audioTrack,h=this._id3Track,f=this._txtTrack,p=u.pid,E=u.pesData,b=c.pid,A=h.pid,w=c.pesData,D=h.pesData,S=null,L=this.pmtParsed,N=this._pmtId,P=e.length;if(this.remainderData&&(P=(e=br(this.remainderData,e)).length,this.remainderData=null),P<_i&&!a)return this.remainderData=e,{audioTrack:c,videoTrack:u,id3Track:h,textTrack:f};var V=Math.max(0,d.syncOffset(e));(P-=(P-V)%_i)<e.byteLength&&!a&&(this.remainderData=new Uint8Array(e.buffer,P,e.buffer.byteLength-P));for(var Y=0,j=V;j<P;j+=_i)if(e[j]===71){var ie=!!(64&e[j+1]),Q=iu(e,j),X=void 0;if((48&e[j+3])>>4>1){if((X=j+5+e[j+4])===j+_i)continue}else X=j+4;switch(Q){case p:ie&&(E&&(l=mn(E))&&this.parseAVCPES(u,f,l,!1),E={data:[],size:0}),E&&(E.data.push(e.subarray(X,j+_i)),E.size+=j+_i-X);break;case b:if(ie){if(w&&(l=mn(w)))switch(c.segmentCodec){case"aac":this.parseAACPES(c,l);break;case"mp3":this.parseMPEGPES(c,l)}w={data:[],size:0}}w&&(w.data.push(e.subarray(X,j+_i)),w.size+=j+_i-X);break;case A:ie&&(D&&(l=mn(D))&&this.parseID3PES(h,l),D={data:[],size:0}),D&&(D.data.push(e.subarray(X,j+_i)),D.size+=j+_i-X);break;case 0:ie&&(X+=e[X]+1),N=this._pmtId=Xv(e,X);break;case N:ie&&(X+=e[X]+1);var ce=Zv(e,X,this.typeSupported,i);(p=ce.avc)>0&&(u.pid=p),(b=ce.audio)>0&&(c.pid=b,c.segmentCodec=ce.segmentCodec),(A=ce.id3)>0&&(h.pid=A),S===null||L||(B.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=Q}}else Y++;if(Y>0){var oe=new Error("Found "+Y+" TS packet/s that do not start with 0x47");this.observer.emit(k.ERROR,k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:oe,reason:oe.message})}u.pesData=E,c.pesData=w,h.pesData=D;var Ae={audioTrack:c,videoTrack:u,id3Track:h,textTrack:f};return a&&this.extractRemainingSamples(Ae),Ae},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,a=e.videoTrack,l=e.id3Track,u=e.textTrack,c=a.pesData,h=i.pesData,f=l.pesData;if(c&&(t=mn(c))?(this.parseAVCPES(a,u,t,!0),a.pesData=null):a.pesData=c,h&&(t=mn(h))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,t);break;case"mp3":this.parseMPEGPES(i,t)}i.pesData=null}else h!=null&&h.size&&B.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=h;f&&(t=mn(f))?(this.parseID3PES(l,t),l.pesData=null):l.pesData=f},s.demuxSampleAes=function(e,t,i){var a=this.demux(e,i,!0,!this.config.progressive),l=this.sampleAes=new zv(this.observer,this.config,t);return this.decrypt(a,l)},s.decrypt=function(e,t){return new Promise(function(i){var a=e.audioTrack,l=e.videoTrack;a.samples&&a.segmentCodec==="aac"?t.decryptAacSamples(a.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,a){var l,u=this,c=this.parseAVCNALu(e,i.data),h=this.avcSample,f=!1;i.data=null,h&&c.length&&!e.audFound&&(ru(h,e),h=this.avcSample=zo(!1,i.pts,i.dts,"")),c.forEach(function(p){switch(p.type){case 1:l=!0,h||(h=u.avcSample=zo(!0,i.pts,i.dts,"")),h.frame=!0;var E=p.data;if(f&&E.length>4){var b=new Gh(E).readSliceType();b!==2&&b!==4&&b!==7&&b!==9||(h.key=!0)}break;case 5:l=!0,h||(h=u.avcSample=zo(!0,i.pts,i.dts,"")),h.key=!0,h.frame=!0;break;case 6:l=!0,wo(p.data,1,i.pts,t.samples);break;case 7:if(l=!0,f=!0,!e.sps){var A=p.data,w=new Gh(A).readSPS();e.width=w.width,e.height=w.height,e.pixelRatio=w.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:l=!0,e.pps||(e.pps=[p.data]);break;case 9:l=!1,e.audFound=!0,h&&ru(h,e),h=u.avcSample=zo(!1,i.pts,i.dts,"");break;case 12:l=!0;break;default:l=!1,h&&(h.debug+="unknown NAL "+p.type+" ")}h&&l&&h.units.push(p)}),a&&h&&(ru(h,e),this.avcSample=null)},s.getLastNalUnit=function(e){var t,i,a=this.avcSample;if(a&&a.units.length!==0||(a=e[e.length-1]),(t=a)!=null&&t.units){var l=a.units;i=l[l.length-1]}return i},s.parseAVCNALu=function(e,t){var i,a,l=t.byteLength,u=e.naluState||0,c=u,h=[],f=0,p=-1,E=0;for(u===-1&&(p=0,E=31&t[0],u=0,f=1);f<l;)if(i=t[f++],u)if(u!==1)if(i)if(i===1){if(p>=0){var b={data:t.subarray(p,f-u-1),type:E};h.push(b)}else{var A=this.getLastNalUnit(e.samples);if(A&&(c&&f<=4-c&&A.state&&(A.data=A.data.subarray(0,A.data.byteLength-c)),(a=f-u-1)>0)){var w=new Uint8Array(A.data.byteLength+a);w.set(A.data,0),w.set(t.subarray(0,a),A.data.byteLength),A.data=w,A.state=0}}f<l?(p=f,E=31&t[f],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};h.push(D)}if(h.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,h},s.parseAACPES=function(e,t){var i,a,l,u=0,c=this.aacOverFlow,h=t.data;if(c){this.aacOverFlow=null;var f=c.missing,p=c.sample.unit.byteLength;if(f===-1){var E=new Uint8Array(p+h.byteLength);E.set(c.sample.unit,0),E.set(h,p),h=E}else{var b=p-f;c.sample.unit.set(h.subarray(0,f),b),e.samples.push(c.sample),u=c.missing}}for(i=u,a=h.length;i<a-1&&!$o(h,i);i++);if(i!==u){var A,w=i<a-1;A=w?"AAC PES did not start with ADTS header,offset:"+i:"No ADTS header found in AAC PES";var D=new Error(A);if(B.warn("parsing error: "+A),this.observer.emit(k.ERROR,k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,levelRetry:w,error:D,reason:A}),!w)return}if(Oh(e,this.observer,h,i,this.audioCodec),t.pts!==void 0)l=t.pts;else{if(!c)return void B.warn("[tsdemuxer]: AAC PES unknown PTS");var S=Nh(e.samplerate);l=c.sample.pts+S}for(var L,N=0;i<a;){if(i+=(L=Fh(e,h,i,l,N)).length,L.missing){this.aacOverFlow=L;break}for(N++;i<a-1&&!$o(h,i);i++);}},s.parseMPEGPES=function(e,t){var i=t.data,a=i.length,l=0,u=0,c=t.pts;if(c!==void 0)for(;u<a;)if(Hh(i,u)){var h=Uh(e,i,u,c,l);if(!h)break;u+=h.length,l++}else u++;else B.warn("[tsdemuxer]: MPEG PES unknown PTS")},s.parseID3PES=function(e,t){if(t.pts!==void 0){var i=H({},t,{type:this._avcTrack?Ar:Aa,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}else B.warn("[tsdemuxer]: ID3 PES unknown PTS")},d}();function zo(d,s,e,t){return{key:d,frame:!1,pts:s,dts:e,units:[],debug:t,length:0}}function iu(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 Zv(d,s,e,t){var i={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},a=s+3+((15&d[s+1])<<8|d[s+2])-4;for(s+=12+((15&d[s+10])<<8|d[s+11]);s<a;){var l=iu(d,s);switch(d[s]){case 207:if(!t){B.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){B.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?B.log("MPEG audio found, not supported in this browser"):i.audio===-1&&(i.audio=l,i.segmentCodec="mp3");break;case 36:B.warn("Unsupported HEVC stream type found")}s+=5+((15&d[s+3])<<8|d[s+4])}return i}function mn(d){var s,e,t,i,a,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 h=s[7];192&h&&(i=536870912*(14&s[9])+4194304*(255&s[10])+16384*(254&s[11])+128*(255&s[12])+(254&s[13])/2,64&h?i-(a=536870912*(14&s[14])+4194304*(255&s[15])+16384*(254&s[16])+128*(255&s[17])+(254&s[18])/2)>54e5&&(B.warn(Math.round((i-a)/9e4)+"s delta between PTS and DTS, align them"),i=a):a=i);var f=(t=s[8])+9;if(d.size<=f)return null;d.size-=f;for(var p=new Uint8Array(d.size),E=0,b=u.length;E<b;E++){var A=(s=u[E]).byteLength;if(f){if(f>A){f-=A;continue}s=s.subarray(f),A-=f,f=0}p.set(s,l),l+=A}return e&&(e-=t+3),{data:p,pts:i,dts:a,len:e}}return null}function ru(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&&B.log(d.pts+"/"+d.dts+":"+d.debug)}var Jv=function(d){function s(){return d.apply(this,arguments)||this}z(s,d);var e=s.prototype;return e.resetInitSegment=function(t,i,a,l){d.prototype.resetInitSegment.call(this,t,i,a,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=(ga(t,0)||[]).length,a=t.length;i<a;i++)if(jv(t,i))return B.log("MPEG Audio sync word found !"),!0;return!1},e.canParse=function(t,i){return function(a,l){return tu(a,l)&&4<=a.length-l}(t,i)},e.appendFrame=function(t,i,a){if(this.basePTS!==null)return Uh(t,i,a,this.basePTS,this.frameIndex)},s}(Mh),Vh=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}(),ea=Math.pow(2,32)-1,ei=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]),a=new Uint8Array([0,0,0,0,0,0,0,0]);d.STTS=d.STSC=d.STCO=a,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),a=1;a<t;a++)i[a-1]=arguments[a];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/(ea+1)),i=Math.floor(e%(ea+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/(ea+1)),i=Math.floor(e%(ea+1)),a=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,a)},d.sdtp=function(s){var e,t,i=s.samples||[],a=new Uint8Array(4+i.length);for(e=0;e<i.length;e++)t=i[e].flags,a[e+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return d.box(d.types.sdtp,a)},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,a=[],l=[];for(e=0;e<s.sps.length;e++)i=(t=s.sps[e]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.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,a[3],a[4],a[5],255,224|s.sps.length].concat(a).concat([s.pps.length]).concat(l))),c=s.width,h=s.height,f=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,h>>8&255,255&h,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([f>>24,f>>16&255,f>>8&255,255&f,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,a=s.height,l=Math.floor(t/(ea+1)),u=Math.floor(t%(ea+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,a>>8&255,255&a,0,0]))},d.traf=function(s,e){var t=d.sdtp(s),i=s.id,a=Math.floor(e/(ea+1)),l=Math.floor(e%(ea+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,a>>24,a>>16&255,a>>8&255,255&a,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,a,l,u,c,h=s.samples||[],f=h.length,p=12+16*f,E=new Uint8Array(p);for(e+=8+p,E.set([s.type==="video"?1:0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,255&f,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),t=0;t<f;t++)a=(i=h[t]).duration,l=i.size,u=i.flags,c=i.cts,E.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,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 au(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 _s(d,s){return s===void 0&&(s=!1),au(d,1e3,1/9e4,s)}ei.types=void 0,ei.HDLR_TYPES=void 0,ei.STTS=void 0,ei.STSC=void 0,ei.STCO=void 0,ei.STSZ=void 0,ei.VMHD=void 0,ei.SMHD=void 0,ei.STSD=void 0,ei.FTYP=void 0,ei.DINF=void 0;var Qo=null,nu=null,su=function(){function d(e,t,i,a){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,Qo===null){var l=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Qo=l?parseInt(l[1]):0}if(nu===null){var u=navigator.userAgent.match(/Safari\/(\d+)/i);nu=u?parseInt(u[1]):0}}var s=d.prototype;return s.destroy=function(){},s.resetTimeStamp=function(e){B.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},s.resetNextTimestamp=function(){B.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},s.resetInitSegment=function(){B.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},s.getVideoStartPts=function(e){var t=!1,i=e.reduce(function(a,l){var u=l.pts-a;return u<-4294967296?(t=!0,Fi(a,l.pts)):u>0?a:l.pts},e[0].pts);return t&&B.debug("PTS rollover detected"),i},s.remux=function(e,t,i,a,l,u,c,h){var f,p,E,b,A,w,D=l,S=l,L=e.pid>-1,N=t.pid>-1,P=t.samples.length,V=e.samples.length>0,Y=c&&P>0||P>1;if((!L||V)&&(!N||Y)||this.ISGenerated||c){this.ISGenerated||(E=this.generateIS(e,t,l,u));var j,ie=this.isVideoContiguous,Q=-1;if(Y&&(Q=function(xe){for(var Le=0;Le<xe.length;Le++)if(xe[Le].key)return Le;return-1}(t.samples),!ie&&this.config.forceKeyFrameOnDiscontinuity))if(w=!0,Q>0){B.warn("[mp4-remuxer]: Dropped "+Q+" out of "+P+" 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&&(B.warn("[mp4-remuxer]: No keyframe found out of "+P+" video samples"),w=!1);if(this.ISGenerated){if(V&&Y){var ce=this.getVideoStartPts(t.samples),oe=(Fi(e.samples[0].pts,ce)-ce)/t.inputTimeScale;D+=Math.max(0,oe),S+=Math.max(0,-oe)}if(V){if(e.samplerate||(B.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),E=this.generateIS(e,t,l,u)),p=this.remuxAudio(e,D,this.isAudioContiguous,u,N||Y||h===Di?S:void 0),Y){var Ae=p?p.endPTS-p.startPTS:0;t.inputTimeScale||(B.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),E=this.generateIS(e,t,l,u)),f=this.remuxVideo(t,S,ie,Ae)}}else Y&&(f=this.remuxVideo(t,S,ie,0));f&&(f.firstKeyFrame=Q,f.independent=Q!==-1,f.firstKeyFramePTS=j)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(A=Kh(i,l,this._initPTS,this._initDTS)),a.samples.length&&(b=Wh(a,l,this._initPTS))),{audio:p,video:f,initSegment:E,independent:w,text:b,id3:A}},s.generateIS=function(e,t,i,a){var l,u,c,h=e.samples,f=t.samples,p=this.typeSupported,E={},b=this._initPTS,A=!b||a,w="audio/mp4";if(A&&(l=u=1/0),e.config&&h.length&&(e.timescale=e.samplerate,e.segmentCodec==="mp3"&&(p.mpeg?(w="audio/mpeg",e.codec=""):p.mp3&&(e.codec="mp3")),E.audio={id:"audio",container:w,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&p.mpeg?new Uint8Array(0):ei.initSegment([e]),metadata:{channelCount:e.channelCount}},A&&(c=e.inputTimeScale,b&&c===b.timescale?A=!1:l=u=h[0].pts-Math.round(c*i))),t.sps&&t.pps&&f.length&&(t.timescale=t.inputTimeScale,E.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:ei.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(f),S=Math.round(c*i);u=Math.min(u,Fi(f[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,a){var l,u,c=e.inputTimeScale,h=e.samples,f=[],p=h.length,E=this._initPTS,b=this.nextAvcDts,A=8,w=this.videoSampleDuration,D=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,L=!1;i&&b!==null||(b=t*c-(h[0].pts-Fi(h[0].dts,h[0].pts)));for(var N=E.baseTime*c/E.timescale,P=0;P<p;P++){var V=h[P];V.pts=Fi(V.pts-N,b),V.dts=Fi(V.dts-N,b),V.dts<h[P>0?P-1:P].dts&&(L=!0)}L&&h.sort(function(rl,Lf){var Xg=rl.dts-Lf.dts,Zg=rl.pts-Lf.pts;return Xg||Zg}),l=h[0].dts;var Y=(u=h[h.length-1].dts)-l,j=Y?Math.round(Y/(p-1)):w||e.inputTimeScale/30;if(i){var ie=l-b,Q=ie>j,X=ie<-1;if((Q||X)&&(Q?B.warn("AVC: "+_s(ie,!0)+" ms ("+ie+"dts) hole between fragments detected, filling it"):B.warn("AVC: "+_s(-ie,!0)+" ms ("+ie+"dts) overlapping between fragments detected"),!X||b>=h[0].pts)){l=b;var ce=h[0].pts-ie;h[0].dts=l,h[0].pts=ce,B.log("Video: First PTS/DTS adjusted: "+_s(ce,!0)+"/"+_s(l,!0)+", delta: "+_s(ie,!0)+" ms")}}l=Math.max(0,l);for(var oe=0,Ae=0,xe=0;xe<p;xe++){for(var Le=h[xe],Me=Le.units,Oe=Me.length,Pe=0,Ke=0;Ke<Oe;Ke++)Pe+=Me[Ke].data.length;Ae+=Pe,oe+=Oe,Le.length=Pe,Le.dts=Math.max(Le.dts,l),D=Math.min(Le.pts,D),S=Math.max(Le.pts,S)}u=h[p-1].dts;var je,et=Ae+4*oe+8;try{je=new Uint8Array(et)}catch(rl){return void this.observer.emit(k.ERROR,k.ERROR,{type:se.MUX_ERROR,details:W.REMUX_ALLOC_ERROR,fatal:!1,error:rl,bytes:et,reason:"fail allocating video mdat "+et})}var lt=new DataView(je.buffer);lt.setUint32(0,et),je.set(ei.types.mdat,4);for(var Ti=!1,Kt=Number.POSITIVE_INFINITY,Qi=Number.POSITIVE_INFINITY,Bi=Number.NEGATIVE_INFINITY,Hi=Number.NEGATIVE_INFINITY,Wt=0;Wt<p;Wt++){for(var ti=h[Wt],sr=ti.units,ta=0,Ci=0,Ts=sr.length;Ci<Ts;Ci++){var As=sr[Ci],il=As.data,gn=As.data.byteLength;lt.setUint32(A,gn),A+=4,je.set(il,A),A+=gn,ta+=4+gn}var Oa=void 0;if(Wt<p-1)w=h[Wt+1].dts-ti.dts,Oa=h[Wt+1].pts-ti.pts;else{var Ss=this.config,Rr=Wt>0?ti.dts-h[Wt-1].dts:j;if(Oa=Wt>0?ti.pts-h[Wt-1].pts:j,Ss.stretchShortVideoTrack&&this.nextAudioPts!==null){var Yg=Math.floor(Ss.maxBufferHole*c),wu=(a?D+a*c:this.nextAudioPts)-ti.pts;wu>Yg?((w=wu-Rr)<0?w=Rr:Ti=!0,B.log("[mp4-remuxer]: It is approximately "+wu/90+" ms to the next segment; using duration "+w/90+" ms for the last video frame.")):w=Rr}else w=Rr}var $g=Math.round(ti.pts-ti.dts);Kt=Math.min(Kt,w),Bi=Math.max(Bi,w),Qi=Math.min(Qi,Oa),Hi=Math.max(Hi,Oa),f.push(new qh(ti.key,w,ta,$g))}if(f.length){if(Qo){if(Qo<70){var Sf=f[0].flags;Sf.dependsOn=2,Sf.isNonSync=0}}else if(nu&&Hi-Qi<Bi-Kt&&j/Bi<.025&&f[0].cts===0){B.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var Lu=l,Xi=0,kf=f.length;Xi<kf;Xi++){var wf=Lu+f[Xi].duration,jg=Lu+f[Xi].cts;if(Xi<kf-1){var zg=wf+f[Xi+1].cts;f[Xi].duration=zg-jg}else f[Xi].duration=Xi?f[Xi-1].duration:j;f[Xi].cts=0,Lu=wf}}}w=Ti||!w?j:w,this.nextAvcDts=b=u+w,this.videoSampleDuration=w,this.isVideoContiguous=!0;var Qg={data1:ei.moof(e.sequenceNumber++,l,H({},e,{samples:f})),data2:je,startPTS:D/c,endPTS:(S+w)/c,startDTS:l/c,endDTS:b/c,type:"video",hasAudio:!1,hasVideo:!0,nb:f.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Qg},s.remuxAudio=function(e,t,i,a,l){var u=e.inputTimeScale,c=u/(e.samplerate?e.samplerate:u),h=e.segmentCodec==="aac"?1024:1152,f=h*c,p=this._initPTS,E=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,b=[],A=l!==void 0,w=e.samples,D=E?0:8,S=this.nextAudioPts||-1,L=t*u,N=p.baseTime*u/p.timescale;if(this.isAudioContiguous=i=i||w.length&&S>0&&(a&&Math.abs(L-S)<9e3||Math.abs(Fi(w[0].pts-N,L)-S)<20*f),w.forEach(function(Ci){Ci.pts=Fi(Ci.pts-N,L)}),!i||S<0){if(w=w.filter(function(Ci){return Ci.pts>=0}),!w.length)return;S=l===0?0:a&&!A?Math.max(0,L):w[0].pts}if(e.segmentCodec==="aac")for(var P=this.config.maxAudioFramesDrift,V=0,Y=S;V<w.length;V++){var j=w[V],ie=j.pts,Q=ie-Y,X=Math.abs(1e3*Q/u);if(Q<=-P*f&&A)V===0&&(B.warn("Audio frame @ "+(ie/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Q/u)+" ms."),this.nextAudioPts=S=Y=ie);else if(Q>=P*f&&X<1e4&&A){var ce=Math.round(Q/f);(Y=ie-ce*f)<0&&(ce--,Y+=f),V===0&&(this.nextAudioPts=S=Y),B.warn("[mp4-remuxer]: Injecting "+ce+" audio frame @ "+(Y/u).toFixed(3)+"s due to "+Math.round(1e3*Q/u)+" ms gap.");for(var oe=0;oe<ce;oe++){var Ae=Math.max(Y,0),xe=Vh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);xe||(B.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=j.unit.subarray()),w.splice(V,0,{unit:xe,pts:Ae}),Y+=f,V++}}j.pts=Y,Y+=f}for(var Le,Me=null,Oe=null,Pe=0,Ke=w.length;Ke--;)Pe+=w[Ke].unit.byteLength;for(var je=0,et=w.length;je<et;je++){var lt=w[je],Ti=lt.unit,Kt=lt.pts;if(Oe!==null)b[je-1].duration=Math.round((Kt-Oe)/c);else{if(i&&e.segmentCodec==="aac"&&(Kt=S),Me=Kt,!(Pe>0))return;Pe+=D;try{Le=new Uint8Array(Pe)}catch(Ci){return void this.observer.emit(k.ERROR,k.ERROR,{type:se.MUX_ERROR,details:W.REMUX_ALLOC_ERROR,fatal:!1,error:Ci,bytes:Pe,reason:"fail allocating audio mdat "+Pe})}E||(new DataView(Le.buffer).setUint32(0,Pe),Le.set(ei.types.mdat,4))}Le.set(Ti,D);var Qi=Ti.byteLength;D+=Qi,b.push(new qh(!0,h,Qi,0)),Oe=Kt}var Bi=b.length;if(Bi){var Hi=b[b.length-1];this.nextAudioPts=S=Oe+c*Hi.duration;var Wt=E?new Uint8Array(0):ei.moof(e.sequenceNumber++,Me/c,H({},e,{samples:b}));e.samples=[];var ti=Me/u,sr=S/u,ta={data1:Wt,data2:Le,startPTS:ti,endPTS:sr,startDTS:ti,endDTS:sr,type:"audio",hasAudio:!0,hasVideo:!1,nb:Bi};return this.isAudioContiguous=!0,ta}},s.remuxEmptyAudio=function(e,t,i,a){var l=e.inputTimeScale,u=l/(e.samplerate?e.samplerate:l),c=this.nextAudioPts,h=this._initDTS,f=9e4*h.baseTime/h.timescale,p=(c!==null?c:a.startDTS*l)+f,E=a.endDTS*l+f,b=1024*u,A=Math.ceil((E-p)/b),w=Vh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(B.warn("[mp4-remuxer]: remux empty Audio"),w){for(var D=[],S=0;S<A;S++){var L=p+S*b;D.push({unit:w,pts:L,dts:L})}return e.samples=D,this.remuxAudio(e,t,i,!1)}B.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},d}();function Fi(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 Kh(d,s,e,t){var i=d.samples.length;if(i){for(var a=d.inputTimeScale,l=0;l<i;l++){var u=d.samples[l];u.pts=Fi(u.pts-e.baseTime*a/e.timescale,s*a)/a,u.dts=Fi(u.dts-t.baseTime*a/t.timescale,s*a)/a}var c=d.samples;return d.samples=[],{samples:c}}}function Wh(d,s,e){var t=d.samples.length;if(t){for(var i=d.inputTimeScale,a=0;a<t;a++){var l=d.samples[a];l.pts=Fi(l.pts-9e4*e.baseTime/e.timescale,s*i)/i}d.samples.sort(function(c,h){return c.pts-h.pts});var u=d.samples;return d.samples=[],{samples:u}}}var Lr,qh=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 eg(d)},eg=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},tg=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,a){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(h){var f=Je(h,["mdia","minf","stbl","stsd"])[0].subarray(8),p=Je(f,["enca"]),E=p.length>0;E||(p=Je(f,["encv"])),p.forEach(function(b){Je(E?b.subarray(28):b.subarray(78),["sinf"]).forEach(function(A){var w=ns(A);if(w){var D=w.subarray(8,24);D.some(function(S){return S!==0})||(B.log("[eme] Patching keyId in 'enc"+(E?"a":"v")+">sinf>>tenc' box: "+Pi(D)+" -> "+Pi(c)),w.set(c,8))}})})}),l}(e,a)),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 a=this.initData=as(e);t||(t=Yh(a.audio,Et)),i||(i=Yh(a.video,Ct));var l={};a.audio&&a.video?l.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:a.audio?l.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:a.video?l.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:B.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=l},s.remux=function(e,t,i,a,l,u){var c,h,f=this.initPTS,p=this.lastEndTime,E={audio:void 0,video:void 0,text:a,id3:i,initSegment:void 0};re(p)||(p=this.lastEndTime=l||0);var b=t.samples;if(b==null||!b.length)return E;var A={initPTS:void 0,timescale:1},w=this.initData;if((c=w)!=null&&c.length||(this.generateInitSegment(b),w=this.initData),(h=w)==null||!h.length)return B.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(A.tracks=this.initTracks,this.emitInitSegment=!1);var D=function(Q,X){for(var ce=0,oe=0,Ae=0,xe=Je(Q,["moof","traf"]),Le=0;Le<xe.length;Le++){var Me=xe[Le],Oe=Je(Me,["tfhd"])[0],Pe=X[He(Oe,4)];if(Pe){var Ke=Pe.default,je=He(Oe,0)|(Ke==null?void 0:Ke.flags),et=Ke==null?void 0:Ke.duration;8&je&&(et=He(Oe,2&je?12:8));for(var lt=Pe.timescale||9e4,Ti=Je(Me,["trun"]),Kt=0;Kt<Ti.length;Kt++)!(ce=Wd(Ti[Kt]))&&et&&(ce=et*He(Ti[Kt],4)),Pe.type===Ct?oe+=ce/lt:Pe.type===Et&&(Ae+=ce/lt)}}if(oe===0&&Ae===0){for(var Qi=0,Bi=Je(Q,["sidx"]),Hi=0;Hi<Bi.length;Hi++){var Wt=So(Bi[Hi]);Wt!=null&&Wt.references&&(Qi+=Wt.references.reduce(function(ti,sr){return ti+sr.info.duration||0},0))}return Qi}return oe||Ae}(b,w),S=function(Q,X){return Je(X,["moof","traf"]).reduce(function(ce,oe){var Ae=Je(oe,["tfdt"])[0],xe=Ae[0],Le=Je(oe,["tfhd"]).reduce(function(Me,Oe){var Pe=He(Oe,4),Ke=Q[Pe];if(Ke){var je=He(Ae,4);if(xe===1){if(je===Ea)return B.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),Me;je*=Ea+1,je+=He(Ae,8)}var et=je/(Ke.timescale||9e4);if(isFinite(et)&&(Me===null||et<Me))return et}return Me},null);return Le!==null&&isFinite(Le)&&(ce===null||Le<ce)?Le:ce},null)}(w,b),L=S===null?l:S;(function(Q,X,ce,oe){if(Q===null)return!0;var Ae=Math.max(oe,1),xe=X-Q.baseTime/Q.timescale;return Math.abs(xe-ce)>Ae}(f,L,l,D)||A.timescale!==f.timescale&&u)&&(A.initPTS=L-l,f&&f.timescale===1&&B.warn("Adjusting initPTS by "+(A.initPTS-f.baseTime)),this.initPTS=f={baseTime:A.initPTS,timescale:1});var N=e?L-f.baseTime/f.timescale:p,P=N+D;(function(Q,X,ce){Je(X,["moof","traf"]).forEach(function(oe){Je(oe,["tfhd"]).forEach(function(Ae){var xe=He(Ae,4),Le=Q[xe];if(Le){var Me=Le.timescale||9e4;Je(oe,["tfdt"]).forEach(function(Oe){var Pe=Oe[0],Ke=He(Oe,4);if(Pe===0)Ke-=ce*Me,rs(Oe,4,Ke=Math.max(Ke,0));else{Ke*=Math.pow(2,32),Ke+=He(Oe,8),Ke-=ce*Me,Ke=Math.max(Ke,0);var je=Math.floor(Ke/(Ea+1)),et=Math.floor(Ke%(Ea+1));rs(Oe,4,je),rs(Oe,8,et)}})}})})})(w,b,f.baseTime/f.timescale),D>0?this.lastEndTime=P:(B.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var V=!!w.audio,Y=!!w.video,j="";V&&(j+="audio"),Y&&(j+="video");var ie={data1:b,startPTS:N,startDTS:N,endPTS:P,endDTS:P,type:j,hasAudio:V,hasVideo:Y,nb:1,dropped:0};return E.audio=ie.type==="audio"?ie:void 0,E.video=ie.type!=="audio"?ie:void 0,E.initSegment=A,E.id3=Kh(i,l,f,f),a.samples.length&&(E.text=Wh(a,l,f)),E},d}();function Yh(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===Ct?"avc1.42e01e":"mp4a.40.5"}try{Lr=self.performance.now.bind(self.performance)}catch{B.debug("Unable to use Performance API on this environment"),Lr=typeof self!="undefined"&&self.Date.now}var ou=[{demux:Kv,remux:tg},{demux:Qv,remux:su},{demux:Gv,remux:su},{demux:Jv,remux:su}],lu=function(){function d(e,t,i,a,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=a,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,a){var l=this,u=i.transmuxing;u.executeStart=Lr();var c=new Uint8Array(e),h=this.currentTransmuxState,f=this.transmuxConfig;a&&(this.currentTransmuxState=a);var p=a||h,E=p.contiguous,b=p.discontinuity,A=p.trackSwitch,w=p.accurateTimeOffset,D=p.timeOffset,S=p.initSegmentChange,L=f.audioCodec,N=f.videoCodec,P=f.defaultInitPts,V=f.duration,Y=f.initSegmentData,j=function(xe,Le){var Me=null;return xe.byteLength>0&&Le!=null&&Le.key!=null&&Le.iv!==null&&Le.method!=null&&(Me=Le),Me}(c,t);if(j&&j.method==="AES-128"){var ie=this.getDecrypter();if(!ie.isSync())return this.decryptionPromise=ie.webCryptoDecrypt(c,j.key.buffer,j.iv.buffer).then(function(xe){var Le=l.push(xe,null,i);return l.decryptionPromise=null,Le}),this.decryptionPromise;var Q=ie.softwareDecrypt(c,j.key.buffer,j.iv.buffer);if(i.part>-1&&(Q=ie.flush()),!Q)return u.executeEnd=Lr(),du(i);c=new Uint8Array(Q)}var X=this.needsProbing(b,A);if(X){var ce=this.configureTransmuxer(c);if(ce)return B.warn("[transmuxer] "+ce.message),this.observer.emit(k.ERROR,k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,fatal:!1,error:ce,reason:ce.message}),u.executeEnd=Lr(),du(i)}(b||A||S||X)&&this.resetInitSegment(Y,L,N,V,t),(b||S||X)&&this.resetInitialTimestamp(P),E||this.resetContiguity();var oe=this.transmux(c,j,D,w,i),Ae=this.currentTransmuxState;return Ae.contiguous=!0,Ae.discontinuity=!1,Ae.trackSwitch=!1,u.executeEnd=Lr(),oe},s.flush=function(e){var t=this,i=e.transmuxing;i.executeStart=Lr();var a=this.decrypter,l=this.currentTransmuxState,u=this.decryptionPromise;if(u)return u.then(function(){return t.flush(e)});var c=[],h=l.timeOffset;if(a){var f=a.flush();f&&c.push(this.push(f,null,e))}var p=this.demuxer,E=this.remuxer;if(!p||!E)return i.executeEnd=Lr(),[du(e)];var b=p.flush(h);return Ma(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 a=t.audioTrack,l=t.videoTrack,u=t.id3Track,c=t.textTrack,h=this.currentTransmuxState,f=h.accurateTimeOffset,p=h.timeOffset;B.log("[transmuxer.ts]: Flushed fragment "+i.sn+(i.part>-1?" p: "+i.part:"")+" of level "+i.level);var E=this.remuxer.remux(a,l,u,c,p,f,!0,this.id);e.push({remuxResult:E,chunkMeta:i}),i.transmuxing.executeEnd=Lr()},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,a,l){var u=this.demuxer,c=this.remuxer;u&&c&&(u.resetInitSegment(e,t,i,a),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,a,l){return t&&t.method==="SAMPLE-AES"?this.transmuxSampleAes(e,t,i,a,l):this.transmuxUnencrypted(e,i,a,l)},s.transmuxUnencrypted=function(e,t,i,a){var l=this.demuxer.demux(e,t,!1,!this.config.progressive),u=l.audioTrack,c=l.videoTrack,h=l.id3Track,f=l.textTrack;return{remuxResult:this.remuxer.remux(u,c,h,f,t,i,!1,this.id),chunkMeta:a}},s.transmuxSampleAes=function(e,t,i,a,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,a,!1,u.id),chunkMeta:l}})},s.configureTransmuxer=function(e){for(var t,i=this.config,a=this.observer,l=this.typeSupported,u=this.vendor,c=0,h=ou.length;c<h;c++)if(ou[c].demux.probe(e)){t=ou[c];break}if(!t)return new Error("Failed to find demuxer by probing fragment data");var f=this.demuxer,p=this.remuxer,E=t.remux,b=t.demux;p&&p instanceof E||(this.remuxer=new E(a,i,l,u)),f&&f instanceof b||(this.demuxer=new b(a,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 Ni(this.config)),e},d}(),du=function(d){return{remuxResult:{},chunkMeta:d}};function Ma(d){return"then"in d&&d.then instanceof Function}var ig=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},rg=function(d,s,e,t,i,a){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=a},$h={exports:{}};(function(d){var s=Object.prototype.hasOwnProperty,e="~";function t(){}function i(c,h,f){this.fn=c,this.context=h,this.once=f||!1}function a(c,h,f,p,E){if(typeof f!="function")throw new TypeError("The listener must be a function");var b=new i(f,p||c,E),A=e?e+h:h;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,h){--c._eventsCount==0?c._events=new t:delete c._events[h]}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,h,f=[];if(this._eventsCount===0)return f;for(h in c=this._events)s.call(c,h)&&f.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(c)):f},u.prototype.listeners=function(c){var h=e?e+c:c,f=this._events[h];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,E=f.length,b=new Array(E);p<E;p++)b[p]=f[p].fn;return b},u.prototype.listenerCount=function(c){var h=e?e+c:c,f=this._events[h];return f?f.fn?1:f.length:0},u.prototype.emit=function(c,h,f,p,E,b){var A=e?e+c:c;if(!this._events[A])return!1;var w,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,h),!0;case 3:return S.fn.call(S.context,h,f),!0;case 4:return S.fn.call(S.context,h,f,p),!0;case 5:return S.fn.call(S.context,h,f,p,E),!0;case 6:return S.fn.call(S.context,h,f,p,E,b),!0}for(D=1,w=new Array(L-1);D<L;D++)w[D-1]=arguments[D];S.fn.apply(S.context,w)}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,h);break;case 3:S[D].fn.call(S[D].context,h,f);break;case 4:S[D].fn.call(S[D].context,h,f,p);break;default:if(!w)for(N=1,w=new Array(L-1);N<L;N++)w[N-1]=arguments[N];S[D].fn.apply(S[D].context,w)}}return!0},u.prototype.on=function(c,h,f){return a(this,c,h,f,!1)},u.prototype.once=function(c,h,f){return a(this,c,h,f,!0)},u.prototype.removeListener=function(c,h,f,p){var E=e?e+c:c;if(!this._events[E])return this;if(!h)return l(this,E),this;var b=this._events[E];if(b.fn)b.fn!==h||p&&!b.once||f&&b.context!==f||l(this,E);else{for(var A=0,w=[],D=b.length;A<D;A++)(b[A].fn!==h||p&&!b[A].once||f&&b[A].context!==f)&&w.push(b[A]);w.length?this._events[E]=w.length===1?w[0]:w:l(this,E)}return this},u.prototype.removeAllListeners=function(c){var h;return c?(h=e?e+c:c,this._events[h]&&l(this,h)):(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})($h);var Xo=ue($h.exports);function uu(d,s){if(!((e=s.remuxResult).audio||e.video||e.text||e.id3||e.initSegment))return!1;var e,t=[],i=s.remuxResult,a=i.audio,l=i.video;return a&&jh(t,a),l&&jh(t,l),d.postMessage({event:"transmuxComplete",data:s},t),!0}function jh(d,s){s.data1&&d.push(s.data1.buffer),s.data2&&d.push(s.data2.buffer)}function zh(d,s,e){s.reduce(function(t,i){return uu(d,i)||t},!1)||d.postMessage({event:"transmuxComplete",data:s[0]}),d.postMessage({event:"flush",data:e})}r!==void 0&&r&&function(d){var s=new Xo,e=function(i,a){d.postMessage({event:i,data:a})};s.on(k.FRAG_DECRYPTED,e),s.on(k.ERROR,e);var t=function(){var i=function(l){var u=function(c){e("workerLog",{logType:l,message:c})};B[l]=u};for(var a in B)i(a)};d.addEventListener("message",function(i){var a=i.data;switch(a.cmd){case"init":var l=JSON.parse(a.config);d.transmuxer=new lu(s,a.typeSupported,l,a.vendor,a.id),it(l.debug,a.id),t(),e("init",null);break;case"configure":d.transmuxer.configure(a.config);break;case"demux":var u=d.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Ma(u)?(d.transmuxer.async=!0,u.then(function(f){uu(d,f)}).catch(function(f){e(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,chunkMeta:a.chunkMeta,fatal:!1,error:f,err:f,reason:"transmuxer-worker push error"})})):(d.transmuxer.async=!1,uu(d,u));break;case"flush":var c=a.chunkMeta,h=d.transmuxer.flush(c);Ma(h)||d.transmuxer.async?(Ma(h)||(h=Promise.resolve(h)),h.then(function(f){zh(d,f,c)}).catch(function(f){e(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_PARSING_ERROR,chunkMeta:a.chunkMeta,fatal:!1,error:f,err:f,reason:"transmuxer-worker flush error"})})):zh(d,h,c)}})}(self);var cu=nn()||{isTypeSupported:function(){return!1}},Qh=function(){function d(e,t,i,a){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=a;var c=function(D,S){(S=S||{}).frag=l.frag,S.id=l.id,D===k.ERROR&&(l.error=S.error),l.hls.trigger(D,S)};this.observer=new Xo,this.observer.on(k.FRAG_DECRYPTED,c),this.observer.on(k.ERROR,c);var h,f,p,E,b={mp4:cu.isTypeSupported("video/mp4"),mpeg:cu.isTypeSupported("audio/mpeg"),mp3:cu.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(!this.useWorker||typeof Worker=="undefined"||(u.workerPath,0))this.transmuxer=new lu(this.observer,b,u,A,t);else try{u.workerPath?(B.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})):(B.log('injecting Web Worker for "'+t+'"'),this.workerContext=(h=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+n.toString()+")(true);"],{type:"text/javascript"}),f=self.URL.createObjectURL(h),{worker:new self.Worker(f),objectURL:f})),this.onwmsg=function(D){return l.onWorkerMessage(D)};var w=this.workerContext.worker;w.addEventListener("message",this.onwmsg),w.onerror=function(D){var S=new Error(D.message+" ("+D.filename+":"+D.lineno+")");u.enableWorker=!1,B.warn('Error in "'+t+'" Web Worker, fallback to inline'),l.hls.trigger(k.ERROR,{type:se.OTHER_ERROR,details:W.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:S})},w.postMessage({cmd:"init",typeSupported:b,vendor:A,id:t,config:JSON.stringify(u)})}catch(D){B.warn('Error setting up "'+t+'" Web Worker, fallback to inline',D),this.resetWorker(),this.error=null,this.transmuxer=new lu(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,a,l,u,c,h,f,p){var E,b,A=this;f.transmuxing.start=self.performance.now();var w=this.transmuxer,D=u?u.start:l.start,S=l.decryptdata,L=this.frag,N=!(L&&l.cc===L.cc),P=!(L&&f.level===L.level),V=L?f.sn-L.sn:-1,Y=this.part?f.part-this.part.index:-1,j=V===0&&f.id>1&&f.id===(L==null?void 0:L.stats.chunkCount),ie=!P&&(V===1||V===0&&(Y===1||j&&Y<=0)),Q=self.performance.now();(P||V||l.stats.parsing.start===0)&&(l.stats.parsing.start=Q),!u||!Y&&ie||(u.stats.parsing.start=Q);var X=!(L&&((E=l.initSegment)==null?void 0:E.url)===((b=L.initSegment)==null?void 0:b.url)),ce=new rg(N,ie,h,P,D,X);if(!ie||N||X){B.log("[transmuxer-interface, "+l.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
|
|
21
21
|
discontinuity: `+N+`
|
|
22
22
|
trackSwitch: `+P+`
|
|
23
23
|
contiguous: `+ie+`
|
|
24
|
-
accurateTimeOffset: `+
|
|
24
|
+
accurateTimeOffset: `+h+`
|
|
25
25
|
timeOffset: `+D+`
|
|
26
|
-
initSegmentChange: `+X);var oe=new eg(i,a,t,c,p);this.configureTransmuxer(oe)}if(this.frag=o,this.part=d,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:S,chunkMeta:h,state:ce},e instanceof ArrayBuffer?[e]:[]);else if(w){var Ae=w.push(e,S,h,ce);Ma(Ae)?(w.async=!0,Ae.then(function(xe){A.handleTransmuxComplete(xe)}).catch(function(xe){A.transmuxerError(xe,h,"transmuxer-interface push error")})):(w.async=!1,this.handleTransmuxComplete(Ae))}},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 a=i.flush(e);Ma(a)||i.async?(Ma(a)||(a=Promise.resolve(a)),a.then(function(o){t.handleFlushResult(o,e)}).catch(function(o){t.transmuxerError(o,e,"transmuxer-interface flush error")})):this.handleFlushResult(a,e)}},s.transmuxerError=function(e,t,i){this.hls&&(this.error=e,this.hls.trigger(k.ERROR,{type:se.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(a){i.handleTransmuxComplete(a)}),this.onFlush(t)},s.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":var a,o=(a=this.workerContext)==null?void 0:a.objectURL;o&&self.URL.revokeObjectURL(o);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":U[t.data.logType]&&U[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)},u}(),ig=function(){function u(e,t,i,a){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=a}var s=u.prototype;return s.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},s.poll=function(e,t){var i=this.config,a=this.media,o=this.stalled;if(a!==null){var d=a.currentTime,c=a.seeking,f=this.seeking&&!c,h=!this.seeking&&c;if(this.seeking=c,d===e){if(h||f)this.stalled=null;else if(!(a.paused&&!c||a.ended||a.playbackRate===0)&&he.getBuffered(a).length){var p=he.bufferInfo(a,d,0),E=p.len>0,b=p.nextStart||0;if(E||b){if(c){var A=p.len>2,w=!b||t&&t.start<=d||b-d>2&&!this.fragmentTracker.getPartialFragment(d);if(A||w)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var D,S=Math.max(b,p.start||0)-d,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(d);if(S>0&&(S<=N||P))return void this._trySkipBufferHole(P)}var V=self.performance.now();if(o!==null){var Y=V-o;if(c||!(Y>=250)||(this._reportStall(p),this.media)){var j=he.bufferInfo(a,d,i.maxBufferHole);this._tryFixBufferStall(j,Y)}}else this.stalled=V}}}else if(this.moved=!0,o!==null){if(this.stallReported){var ie=self.performance.now()-o;U.warn("playback not stuck anymore @"+d+", after "+Math.round(ie)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},s._tryFixBufferStall=function(e,t){var i=this.config,a=this.fragmentTracker,o=this.media;if(o!==null){var d=o.currentTime,c=a.getPartialFragment(d);if(c&&(this._trySkipBufferHole(c)||!this.media))return;(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-d<i.maxBufferHole)&&t>1e3*i.highBufferWatchdogPeriod&&(U.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 a=new Error("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(e)+")");U.warn(a.message),t.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len})}},s._trySkipBufferHole=function(e){var t=this.config,i=this.hls,a=this.media;if(a===null)return 0;var o=a.currentTime,d=he.bufferInfo(a,o,0),c=o<d.start?d.start:d.nextStart;if(c){var f=d.len<=t.maxBufferHole,h=d.len>0&&d.len<1&&a.readyState<3,p=c-o;if(p>0&&(f||h)){if(p>t.maxBufferHole){var E=this.fragmentTracker,b=!1;if(o===0){var A=E.getAppendedFrag(0,rt);A&&c<A.end&&(b=!0)}if(!b){var w=e||E.getAppendedFrag(o,rt);if(w){for(var D=!1,S=w.end;S<c;){var L=E.getPartialFragment(S);if(!L){D=!0;break}S+=L.duration}if(D)return 0}}}var N=Math.max(c+.05,o+.1);if(U.warn("skipping hole, adjusting currentTime from "+o+" to "+N),this.moved=!0,this.stalled=null,a.currentTime=N,e&&!e.gap){var P=new Error("fragment loaded with buffer holes, seeking from "+o+" to "+N);i.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.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,a=this.nudgeRetry;if(i!==null){var o=i.currentTime;if(this.nudgeRetry++,a<e.nudgeMaxRetry){var d=o+(a+1)*e.nudgeOffset,c=new Error("Nudging 'currentTime' from "+o+" to "+d);U.warn(c.message),i.currentTime=d,t.trigger(k.ERROR,{type:se.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 @"+o+" after "+e.nudgeMaxRetry+" nudges");U.error(f.message),t.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_STALLED_ERROR,error:f,fatal:!0})}}},u}(),rg=function(u){function s(t,i,a){var o;return(o=u.call(this,t,i,a,"[stream-controller]",rt)||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}z(s,u);var e=s.prototype;return e._registerListeners=function(){var t=this.hls;t.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_PARSED,this.onManifestParsed,this),t.on(k.LEVEL_LOADING,this.onLevelLoading,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(k.ERROR,this.onError,this),t.on(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(k.BUFFER_CREATED,this.onBufferCreated,this),t.on(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(k.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_PARSED,this.onManifestParsed,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(k.ERROR,this.onError,this),t.off(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(k.BUFFER_CREATED,this.onBufferCreated,this),t.off(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(k.FRAG_BUFFERED,this.onFragBuffered,this)},e.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},e.startLoad=function(t){if(this.levels){var i=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var o=a.startLevel;o===-1&&(a.config.testBandwidth&&this.levels.length>1?(o=0,this.bitrateTest=!0):o=a.nextAutoLevel),this.level=a.nextLoadLevel=o,this.loadedmetadata=!1}i>0&&t===-1&&(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),t=i),this.state=De,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=Ut},e.stopLoad=function(){this._forceStartLoad=!1,u.prototype.stopLoad.call(this)},e.doTick=function(){switch(this.state){case fn:var t,i=this.levels,a=this.level,o=i==null||(t=i[a])==null?void 0:t.details;if(o&&(!o.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(o))break;this.state=De;break}break;case Zr:var d,c=self.performance.now(),f=this.retryDate;(!f||c>=f||(d=this.media)!=null&&d.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=De)}this.state===De&&this.doTickIdle(),this.onTickEnd()},e.onTickEnd=function(){u.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},e.doTickIdle=function(){var t=this.hls,i=this.levelLastLoaded,a=this.levels,o=this.media,d=t.config,c=t.nextLoadLevel;if(i!==null&&(o||!this.startFragRequested&&d.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&a!=null&&a[c]){var f=a[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(k.BUFFER_EOS,E),void(this.state=ys)}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===fn||b.live&&this.levelLastLoaded!==c)return this.level=c,void(this.state=fn);var A=h.len,w=this.getMaxBufferLength(f.maxBitrate);if(!(A>=w)){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)!==Re){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?gt:Ct,Y=(V===Ct?this.videoBuffer:this.mediaBuffer)||this.media;Y&&this.afterBufferFlushed(Y,V,rt)}S=this.getNextFragmentLoopLoading(S,b,h,rt,w)}S&&(!S.initSegment||S.initSegment.data||this.bitrateTest||(S=S.initSegment),this.loadFragment(S,f,D))}}}},e.loadFragment=function(t,i,a){var o=this.fragmentTracker.getState(t);this.fragCurrent=t,o===Z||o===Te?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,u.prototype.loadFragment.call(this,t,i,a)):this.clearTrackerIfNeeded(t)},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 a,o=this.getAppendedFrag(i.currentTime);o&&o.start>1&&this.flushMainBuffer(0,o.start-1);var d=this.getLevelDetails();if(d!=null&&d.live){var c=this.getMainFwdBufferInfo();if(!c||c.len<2*d.targetduration)return}if(!i.paused&&t){var f=t[this.hls.nextLoadLevel],h=this.fragLastKbps;a=h&&this.fragCurrent?this.fragCurrent.duration*f.maxBitrate/(1e3*h)+1:0}else a=0;var p=this.getBufferedFrag(i.currentTime+a);if(p){var E=this.followingBufferedFrag(p);if(E){this.abortCurrentFrag();var b=E.maxStartPTS?E.maxStartPTS:E.start,A=E.duration,w=Math.max(p.end,b+Math.min(Math.max(A-this.config.maxFragLookUpTolerance,.5*A),.75*A));this.flushMainBuffer(w,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 Sr:case Xr:case Zr:case kr:case Yo:this.state=De}this.nextLoadPosition=this.getLoadPosition()},e.flushMainBuffer=function(t,i){u.prototype.flushMainBuffer.call(this,t,i,this.altAudio?"video":null)},e.onMediaAttached=function(t,i){u.prototype.onMediaAttached.call(this,t,i);var a=i.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new ig(this.config,a,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),u.prototype.onMediaDetaching.call(this)},e.onMediaPlaying=function(){this.tick()},e.onMediaSeeked=function(){var t=this.media,i=t?t.currentTime:null;re(i)&&this.log("Media seeked to "+i.toFixed(3));var a=this.getMainFwdBufferInfo();a!==null&&a.len!==0?this.tick():this.warn('Main forward buffer length on "seeked" event '+(a?a.len:"empty")+")")},e.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(k.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 a,o,d,c=!1,f=!1;i.levels.forEach(function(h){(a=h.audioCodec)&&(a.indexOf("mp4a.40.2")!==-1&&(c=!0),a.indexOf("mp4a.40.5")!==-1&&(f=!0))}),this.audioCodecSwitch=c&&f&&typeof((d=Dh())==null||(o=d.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 a=this.levels;if(a&&this.state===De){var o=a[i.level];(!o.details||o.details.live&&this.levelLastLoaded!==i.level||this.waitForCdnTuneIn(o.details))&&(this.state=fn)}},e.onLevelLoaded=function(t,i){var a,o=this.levels,d=i.level,c=i.details,f=c.totalduration;if(o){this.log("Level "+d+" loaded ["+c.startSN+","+c.endSN+"]"+(c.lastPartSn?"[part-"+c.lastPartSn+"-"+c.lastPartIndex+"]":"")+", cc ["+c.startCC+", "+c.endCC+"] duration:"+f);var h=o[d],p=this.fragCurrent;!p||this.state!==Xr&&this.state!==Zr||p.level===i.level&&p.urlId===h.urlId||!p.loader||this.abortCurrentFrag();var E=0;if(c.live||(a=h.details)!=null&&a.live){if(c.fragments[0]||(c.deltaUpdateFailed=!0),c.deltaUpdateFailed)return;E=this.alignPlaylists(c,h.details)}if(h.details=c,this.levelLastLoaded=d,this.hls.trigger(k.LEVEL_UPDATED,{details:c,level:d}),this.state===fn){if(this.waitForCdnTuneIn(c))return;this.state=De}this.startFragRequested?c.live&&this.synchronizeToLiveEdge(c):this.setStartPosition(c,E),this.tick()}else this.warn("Levels were reset while loading level "+d)},e._handleFragmentLoadProgress=function(t){var i,a=t.frag,o=t.part,d=t.payload,c=this.levels;if(c){var f=c[a.level],h=f.details;if(!h)return this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset"),void this.fragmentTracker.removeFragment(a);var p=f.videoCodec,E=h.PTSKnown||!h.live,b=(i=a.initSegment)==null?void 0:i.data,A=this._getAudioCodec(f),w=this.transmuxer=this.transmuxer||new zh(this.hls,rt,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),D=o?o.index:-1,S=D!==-1,L=new fe(a.level,a.sn,a.stats.chunkCount,d.byteLength,D,S),N=this.initPTS[a.cc];w.push(d,b,A,p,a,o,h.totalduration,E,L,N)}else this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered")},e.onAudioTrackSwitching=function(t,i){var a=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 d=this.hls;a&&(d.trigger(k.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),d.trigger(k.AUDIO_TRACK_SWITCHED,i)}},e.onAudioTrackSwitched=function(t,i){var a=i.id,o=!!this.hls.audioTracks[a].url;if(o){var d=this.videoBuffer;d&&this.mediaBuffer!==d&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=d)}this.altAudio=o,this.tick()},e.onBufferCreated=function(t,i){var a,o,d=i.tracks,c=!1;for(var f in d){var h=d[f];if(h.id==="main"){if(o=f,a=h,f==="video"){var p=d[f];p&&(this.videoBuffer=p.buffer)}}else c=!0}c&&a?(this.log("Alternate track found, use "+o+".buffered to schedule main fragment loading"),this.mediaBuffer=a.buffer):this.mediaBuffer=this.media},e.onFragBuffered=function(t,i){var a=i.frag,o=i.part;if(!a||a.type===rt){if(this.fragContextChanged(a))return this.warn("Fragment "+a.sn+(o?" p: "+o.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Yo&&(this.state=De));var d=o?o.stats:a.stats;this.fragLastKbps=Math.round(8*d.total/(d.buffering.end-d.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,o)}},e.onError=function(t,i){var a;if(i.fatal)this.state=hn;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!==fn||((a=i.context)==null?void 0:a.type)!==_r||(this.state=De);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||!he.getBuffered(t).length){var a=this.state!==De?this.fragCurrent:null;i.poll(this.lastCurrentTime,a)}this.lastCurrentTime=t.currentTime}},e.onFragLoadEmergencyAborted=function(){this.state=De,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},e.onBufferFlushed=function(t,i){var a=i.type;if(a!==gt||this.audioOnly&&!this.altAudio){var o=(a===Ct?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(o,a,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,a=this.startPosition;if(a>=0&&i<a){if(t.seeking)return void this.log("could not seek to "+a+", already seeking at "+i);var o=he.getBuffered(t),d=(o.length?o.start(0):0)-a;d>0&&(d<this.config.maxBufferHole||d<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+d+" to match buffer start"),a+=d,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+i),t.currentTime=a}}},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 a=this;t.bitrateTest=!0,this._doFragLoad(t,i).then(function(o){var d=a.hls;if(o&&!a.fragContextChanged(t)){i.fragmentError=0,a.state=De,a.startFragRequested=!1,a.bitrateTest=!1;var c=t.stats;c.parsing.start=c.parsing.end=c.buffering.start=c.buffering.end=self.performance.now(),d.trigger(k.FRAG_LOADED,o),t.bitrateTest=!1}})},e._handleTransmuxComplete=function(t){var i,a="main",o=this.hls,d=t.remuxResult,c=t.chunkMeta,f=this.getCurrentContext(c);if(f){var h=f.frag,p=f.part,E=f.level,b=d.video,A=d.text,w=d.id3,D=d.initSegment,S=E.details,L=this.altAudio?void 0:d.audio;if(this.fragContextChanged(h))this.fragmentTracker.removeFragment(h);else{if(this.state=kr,D){if(D!=null&&D.tracks){var N=h.initSegment||h;this._bufferInitSegment(E,D.tracks,N,c),o.trigger(k.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:a,tracks:D.tracks})}var P=D.initPTS,V=D.timescale;re(P)&&(this.initPTS[h.cc]={baseTime:P,timescale:V},o.trigger(k.INIT_PTS_FOUND,{frag:h,id:a,initPTS:P,timescale:V}))}if(b&&d.independent!==!1){if(S){var Y=b.startPTS,j=b.endPTS,ie=b.startDTS,Q=b.endDTS;if(p)p.elementaryStreams[b.type]={startPTS:Y,endPTS:j,startDTS:ie,endDTS:Q};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:Y)-this.config.maxBufferHole)return void this.backtrack(h);h.setElementaryStreamInfo(b.type,h.start,j,h.start,Q,!0)}h.setElementaryStreamInfo(b.type,Y,j,ie,Q),this.backtrackFragment&&(this.backtrackFragment=h),this.bufferFragmentData(b,h,p,c)}}else if(d.independent===!1)return void this.backtrack(h);if(L){var ce=L.startPTS,oe=L.endPTS,Ae=L.startDTS,xe=L.endDTS;p&&(p.elementaryStreams[gt]={startPTS:ce,endPTS:oe,startDTS:Ae,endDTS:xe}),h.setElementaryStreamInfo(gt,ce,oe,Ae,xe),this.bufferFragmentData(L,h,p,c)}if(S&&w!=null&&(i=w.samples)!=null&&i.length){var Le={id:a,frag:h,details:S,samples:w.samples};o.trigger(k.FRAG_PARSING_METADATA,Le)}if(S&&A){var Me={id:a,frag:h,details:S,samples:A.samples};o.trigger(k.FRAG_PARSING_USERDATA,Me)}}}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,a,o){var d=this;if(this.state===kr){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(k.BUFFER_CODECS,i),Object.keys(i).forEach(function(b){var A=i[b].initSegment;A!=null&&A.byteLength&&d.hls.trigger(k.BUFFER_APPENDING,{type:b,data:A,frag:a,part:null,chunkMeta:o,parent:a.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=De},e.checkFragmentChanged=function(){var t=this.media,i=null;if(t&&t.readyState>1&&t.seeking===!1){var a=t.currentTime;if(he.isBuffered(t,a)?i=this.getAppendedFrag(a):he.isBuffered(t,a+.1)&&(i=this.getAppendedFrag(a+.1)),i){this.backtrackFragment=null;var o=this.fragPlaying,d=i.level;o&&i.sn===o.sn&&o.level===d&&i.urlId===o.urlId||(this.fragPlaying=i,this.hls.trigger(k.FRAG_CHANGED,{frag:i}),o&&o.level===d||this.hls.trigger(k.LEVEL_SWITCHED,{level:d}))}}},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,a=this.currentFrag;if(a&&re(i)&&re(a.programDateTime)){var o=a.programDateTime+1e3*(i-a.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}(Ju),pn=function(){function u(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=u.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_},u}(),ag=function(){function u(e,t,i,a){a===void 0&&(a=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 pn(e),this.fast_=new pn(t),this.defaultTTFB_=a,this.ttfb_=new pn(e)}var s=u.prototype;return s.update=function(e,t){var i=this.slow_,a=this.fast_,o=this.ttfb_;i.halfLife!==e&&(this.slow_=new pn(e,i.getEstimate(),i.getTotalWeight())),a.halfLife!==t&&(this.fast_=new pn(t,a.getEstimate(),a.getTotalWeight())),o.halfLife!==e&&(this.ttfb_=new pn(e,o.getEstimate(),o.getTotalWeight()))},s.sample=function(e,t){var i=(e=Math.max(e,this.minDelayMs_))/1e3,a=8*t/i;this.fast_.sample(i,a),this.slow_.sample(i,a)},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(){},u}(),ng=function(){function u(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 ag(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}var s=u.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.FRAG_LOADING,this.onFragLoading,this),e.on(k.FRAG_LOADED,this.onFragLoaded,this),e.on(k.FRAG_BUFFERED,this.onFragBuffered,this),e.on(k.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(k.LEVEL_LOADED,this.onLevelLoaded,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.FRAG_LOADING,this.onFragLoading,this),e.off(k.FRAG_LOADED,this.onFragLoaded,this),e.off(k.FRAG_BUFFERED,this.onFragBuffered,this),e.off(k.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(k.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,a=t.frag;this.ignoreFragment(a)||(this.fragCurrent=a,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,a){return e+i/t+(a?this.lastLevelLoadSec:0)},s.onLevelLoaded=function(e,t){var i=this.hls.config,a=t.stats,o=a.total,d=a.bwEstimate;re(o)&&re(d)&&(this.lastLevelLoadSec=8*o/d),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,a=i.autoLevelEnabled,o=i.media;if(e&&o){var d=performance.now(),c=t?t.stats:e.stats,f=t?t.duration:e.duration,h=d-c.loading.start;if(c.aborted||c.loaded&&c.loaded===c.total||e.level===0)return this.clearTimer(),void(this._nextAutoLevel=-1);if(a&&!o.paused&&o.playbackRate&&o.readyState){var p=i.mainForwardBufferInfo;if(p!==null){var E=this.bwEstimator.getEstimateTTFB(),b=Math.abs(o.playbackRate);if(!(h<=Math.max(E,f/(2*b)*1e3))){var A=p.len/b;if(!(A>=2*f/b)){var w=c.loading.first?c.loading.first-c.loading.start:-1,D=c.loaded&&w>-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)),Y=h-w;Y<1&&D&&(Y=Math.min(h,8*c.loaded/S));var j=D?1e3*c.loaded/Y:0,ie=j?(V-c.loaded)/j:8*V/S+E/1e3;if(!(ie<=A)){var Q,X=j?8*j:S,ce=Number.POSITIVE_INFINITY;for(Q=e.level-1;Q>N;Q--){var oe=L[Q].maxBitrate;if((ce=this.getTimeToLoadFrag(E/1e3,X,f*oe,!L[Q].details))<A)break}ce>=ie||ce>10*f||(i.nextLoadLevel=Q,D?this.bwEstimator.sample(h-Math.min(E,w),c.loaded):this.bwEstimator.sampleTTFB(h),this.clearTimer(),U.warn("[abr] Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+` is loading too slowly;
|
|
26
|
+
initSegmentChange: `+X);var oe=new ig(i,a,t,c,p);this.configureTransmuxer(oe)}if(this.frag=l,this.part=u,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:S,chunkMeta:f,state:ce},e instanceof ArrayBuffer?[e]:[]);else if(w){var Ae=w.push(e,S,f,ce);Ma(Ae)?(w.async=!0,Ae.then(function(xe){A.handleTransmuxComplete(xe)}).catch(function(xe){A.transmuxerError(xe,f,"transmuxer-interface push error")})):(w.async=!1,this.handleTransmuxComplete(Ae))}},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 a=i.flush(e);Ma(a)||i.async?(Ma(a)||(a=Promise.resolve(a)),a.then(function(l){t.handleFlushResult(l,e)}).catch(function(l){t.transmuxerError(l,e,"transmuxer-interface flush error")})):this.handleFlushResult(a,e)}},s.transmuxerError=function(e,t,i){this.hls&&(this.error=e,this.hls.trigger(k.ERROR,{type:se.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(a){i.handleTransmuxComplete(a)}),this.onFlush(t)},s.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":var a,l=(a=this.workerContext)==null?void 0:a.objectURL;l&&self.URL.revokeObjectURL(l);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":B[t.data.logType]&&B[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}(),ag=function(){function d(e,t,i,a){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=a}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,a=this.media,l=this.stalled;if(a!==null){var u=a.currentTime,c=a.seeking,h=this.seeking&&!c,f=!this.seeking&&c;if(this.seeking=c,u===e){if(f||h)this.stalled=null;else if(!(a.paused&&!c||a.ended||a.playbackRate===0)&&he.getBuffered(a).length){var p=he.bufferInfo(a,u,0),E=p.len>0,b=p.nextStart||0;if(E||b){if(c){var A=p.len>2,w=!b||t&&t.start<=u||b-u>2&&!this.fragmentTracker.getPartialFragment(u);if(A||w)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(l!==null){var Y=V-l;if(c||!(Y>=250)||(this._reportStall(p),this.media)){var j=he.bufferInfo(a,u,i.maxBufferHole);this._tryFixBufferStall(j,Y)}}else this.stalled=V}}}else if(this.moved=!0,l!==null){if(this.stallReported){var ie=self.performance.now()-l;B.warn("playback not stuck anymore @"+u+", after "+Math.round(ie)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},s._tryFixBufferStall=function(e,t){var i=this.config,a=this.fragmentTracker,l=this.media;if(l!==null){var u=l.currentTime,c=a.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&&(B.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 a=new Error("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(e)+")");B.warn(a.message),t.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len})}},s._trySkipBufferHole=function(e){var t=this.config,i=this.hls,a=this.media;if(a===null)return 0;var l=a.currentTime,u=he.bufferInfo(a,l,0),c=l<u.start?u.start:u.nextStart;if(c){var h=u.len<=t.maxBufferHole,f=u.len>0&&u.len<1&&a.readyState<3,p=c-l;if(p>0&&(h||f)){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 w=e||E.getAppendedFrag(l,rt);if(w){for(var D=!1,S=w.end;S<c;){var L=E.getPartialFragment(S);if(!L){D=!0;break}S+=L.duration}if(D)return 0}}}var N=Math.max(c+.05,l+.1);if(B.warn("skipping hole, adjusting currentTime from "+l+" to "+N),this.moved=!0,this.stalled=null,a.currentTime=N,e&&!e.gap){var P=new Error("fragment loaded with buffer holes, seeking from "+l+" to "+N);i.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.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,a=this.nudgeRetry;if(i!==null){var l=i.currentTime;if(this.nudgeRetry++,a<e.nudgeMaxRetry){var u=l+(a+1)*e.nudgeOffset,c=new Error("Nudging 'currentTime' from "+l+" to "+u);B.warn(c.message),i.currentTime=u,t.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1})}else{var h=new Error("Playhead still not moving while enough data buffered @"+l+" after "+e.nudgeMaxRetry+" nudges");B.error(h.message),t.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_STALLED_ERROR,error:h,fatal:!0})}}},d}(),ng=function(d){function s(t,i,a){var l;return(l=d.call(this,t,i,a,"[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(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_PARSED,this.onManifestParsed,this),t.on(k.LEVEL_LOADING,this.onLevelLoading,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(k.ERROR,this.onError,this),t.on(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(k.BUFFER_CREATED,this.onBufferCreated,this),t.on(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(k.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_PARSED,this.onManifestParsed,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(k.ERROR,this.onError,this),t.off(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(k.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(k.BUFFER_CREATED,this.onBufferCreated,this),t.off(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(k.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(k.FRAG_BUFFERED,this.onFragBuffered,this)},e.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},e.startLoad=function(t){if(this.levels){var i=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var l=a.startLevel;l===-1&&(a.config.testBandwidth&&this.levels.length>1?(l=0,this.bitrateTest=!0):l=a.nextAutoLevel),this.level=a.nextLoadLevel=l,this.loadedmetadata=!1}i>0&&t===-1&&(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),t=i),this.state=De,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=Ut},e.stopLoad=function(){this._forceStartLoad=!1,d.prototype.stopLoad.call(this)},e.doTick=function(){switch(this.state){case fn:var t,i=this.levels,a=this.level,l=i==null||(t=i[a])==null?void 0:t.details;if(l&&(!l.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(l))break;this.state=De;break}if(this.hls.nextLoadLevel!==this.level){this.state=De;break}break;case Jr:var u,c=self.performance.now(),h=this.retryDate;(!h||c>=h||(u=this.media)!=null&&u.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=De)}this.state===De&&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,a=this.levels,l=this.media,u=t.config,c=t.nextLoadLevel;if(i!==null&&(l||!this.startFragRequested&&u.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&a!=null&&a[c]){var h=a[c],f=this.getMainFwdBufferInfo();if(f!==null){var p=this.getLevelDetails();if(p&&this._streamEnded(f,p)){var E={};return this.altAudio&&(E.type="video"),this.hls.trigger(k.BUFFER_EOS,E),void(this.state=ys)}t.loadLevel!==c&&t.manualLevel===-1&&this.log("Adapting to level "+c+" from level "+this.level),this.level=t.nextLoadLevel=c;var b=h.details;if(!b||this.state===fn||b.live&&this.levelLastLoaded!==c)return this.level=c,void(this.state=fn);var A=f.len,w=this.getMaxBufferLength(h.maxBitrate);if(!(A>=w)){this.backtrackFragment&&this.backtrackFragment.start>f.end&&(this.backtrackFragment=null);var D=this.backtrackFragment?this.backtrackFragment.start:f.end,S=this.getNextFragment(D,b);if(this.couldBacktrack&&!this.fragPrevious&&S&&S.sn!=="initSegment"&&this.fragmentTracker.getState(S)!==Re){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&&f.len&&(this.backtrackFragment=null);if(S&&this.isLoopLoading(S,D)){if(!S.gap){var V=this.audioOnly&&!this.altAudio?Et:Ct,Y=(V===Ct?this.videoBuffer:this.mediaBuffer)||this.media;Y&&this.afterBufferFlushed(Y,V,rt)}S=this.getNextFragmentLoopLoading(S,b,f,rt,w)}S&&(!S.initSegment||S.initSegment.data||this.bitrateTest||(S=S.initSegment),this.loadFragment(S,h,D))}}}},e.loadFragment=function(t,i,a){var l=this.fragmentTracker.getState(t);this.fragCurrent=t,l===Z||l===Te?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,a)):this.clearTrackerIfNeeded(t)},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 a,l=this.getAppendedFrag(i.currentTime);l&&l.start>1&&this.flushMainBuffer(0,l.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 h=t[this.hls.nextLoadLevel],f=this.fragLastKbps;a=f&&this.fragCurrent?this.fragCurrent.duration*h.maxBitrate/(1e3*f)+1:0}else a=0;var p=this.getBufferedFrag(i.currentTime+a);if(p){var E=this.followingBufferedFrag(p);if(E){this.abortCurrentFrag();var b=E.maxStartPTS?E.maxStartPTS:E.start,A=E.duration,w=Math.max(p.end,b+Math.min(Math.max(A-this.config.maxFragLookUpTolerance,.5*A),.75*A));this.flushMainBuffer(w,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 kr:case Zr:case Jr:case wr:case Yo:this.state=De}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 a=i.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new ag(this.config,a,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;re(i)&&this.log("Media seeked to "+i.toFixed(3));var a=this.getMainFwdBufferInfo();a!==null&&a.len!==0?this.tick():this.warn('Main forward buffer length on "seeked" event '+(a?a.len:"empty")+")")},e.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(k.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 a,l,u,c=!1,h=!1;i.levels.forEach(function(f){(a=f.audioCodec)&&(a.indexOf("mp4a.40.2")!==-1&&(c=!0),a.indexOf("mp4a.40.5")!==-1&&(h=!0))}),this.audioCodecSwitch=c&&h&&typeof((u=Ch())==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 a=this.levels;if(a&&this.state===De){var l=a[i.level];(!l.details||l.details.live&&this.levelLastLoaded!==i.level||this.waitForCdnTuneIn(l.details))&&(this.state=fn)}},e.onLevelLoaded=function(t,i){var a,l=this.levels,u=i.level,c=i.details,h=c.totalduration;if(l){this.log("Level "+u+" loaded ["+c.startSN+","+c.endSN+"]"+(c.lastPartSn?"[part-"+c.lastPartSn+"-"+c.lastPartIndex+"]":"")+", cc ["+c.startCC+", "+c.endCC+"] duration:"+h);var f=l[u],p=this.fragCurrent;!p||this.state!==Zr&&this.state!==Jr||p.level===i.level&&p.urlId===f.urlId||!p.loader||this.abortCurrentFrag();var E=0;if(c.live||(a=f.details)!=null&&a.live){if(c.fragments[0]||(c.deltaUpdateFailed=!0),c.deltaUpdateFailed)return;E=this.alignPlaylists(c,f.details)}if(f.details=c,this.levelLastLoaded=u,this.hls.trigger(k.LEVEL_UPDATED,{details:c,level:u}),this.state===fn){if(this.waitForCdnTuneIn(c))return;this.state=De}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,a=t.frag,l=t.part,u=t.payload,c=this.levels;if(c){var h=c[a.level],f=h.details;if(!f)return this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset"),void this.fragmentTracker.removeFragment(a);var p=h.videoCodec,E=f.PTSKnown||!f.live,b=(i=a.initSegment)==null?void 0:i.data,A=this._getAudioCodec(h),w=this.transmuxer=this.transmuxer||new Qh(this.hls,rt,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),D=l?l.index:-1,S=D!==-1,L=new fe(a.level,a.sn,a.stats.chunkCount,u.byteLength,D,S),N=this.initPTS[a.cc];w.push(u,b,A,p,a,l,f.totalduration,E,L,N)}else this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered")},e.onAudioTrackSwitching=function(t,i){var a=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;a&&(u.trigger(k.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),u.trigger(k.AUDIO_TRACK_SWITCHED,i)}},e.onAudioTrackSwitched=function(t,i){var a=i.id,l=!!this.hls.audioTracks[a].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 a,l,u=i.tracks,c=!1;for(var h in u){var f=u[h];if(f.id==="main"){if(l=h,a=f,h==="video"){var p=u[h];p&&(this.videoBuffer=p.buffer)}}else c=!0}c&&a?(this.log("Alternate track found, use "+l+".buffered to schedule main fragment loading"),this.mediaBuffer=a.buffer):this.mediaBuffer=this.media},e.onFragBuffered=function(t,i){var a=i.frag,l=i.part;if(!a||a.type===rt){if(this.fragContextChanged(a))return this.warn("Fragment "+a.sn+(l?" p: "+l.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Yo&&(this.state=De));var u=l?l.stats:a.stats;this.fragLastKbps=Math.round(8*u.total/(u.buffering.end-u.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,l)}},e.onError=function(t,i){var a;if(i.fatal)this.state=hn;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!==fn||((a=i.context)==null?void 0:a.type)!==Tr||(this.state=De);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||!he.getBuffered(t).length){var a=this.state!==De?this.fragCurrent:null;i.poll(this.lastCurrentTime,a)}this.lastCurrentTime=t.currentTime}},e.onFragLoadEmergencyAborted=function(){this.state=De,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},e.onBufferFlushed=function(t,i){var a=i.type;if(a!==Et||this.audioOnly&&!this.altAudio){var l=(a===Ct?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(l,a,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,a=this.startPosition;if(a>=0&&i<a){if(t.seeking)return void this.log("could not seek to "+a+", already seeking at "+i);var l=he.getBuffered(t),u=(l.length?l.start(0):0)-a;u>0&&(u<this.config.maxBufferHole||u<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+u+" to match buffer start"),a+=u,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+i),t.currentTime=a}}},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 a=this;t.bitrateTest=!0,this._doFragLoad(t,i).then(function(l){var u=a.hls;if(l&&!a.fragContextChanged(t)){i.fragmentError=0,a.state=De,a.startFragRequested=!1,a.bitrateTest=!1;var c=t.stats;c.parsing.start=c.parsing.end=c.buffering.start=c.buffering.end=self.performance.now(),u.trigger(k.FRAG_LOADED,l),t.bitrateTest=!1}})},e._handleTransmuxComplete=function(t){var i,a="main",l=this.hls,u=t.remuxResult,c=t.chunkMeta,h=this.getCurrentContext(c);if(h){var f=h.frag,p=h.part,E=h.level,b=u.video,A=u.text,w=u.id3,D=u.initSegment,S=E.details,L=this.altAudio?void 0:u.audio;if(this.fragContextChanged(f))this.fragmentTracker.removeFragment(f);else{if(this.state=wr,D){if(D!=null&&D.tracks){var N=f.initSegment||f;this._bufferInitSegment(E,D.tracks,N,c),l.trigger(k.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:a,tracks:D.tracks})}var P=D.initPTS,V=D.timescale;re(P)&&(this.initPTS[f.cc]={baseTime:P,timescale:V},l.trigger(k.INIT_PTS_FOUND,{frag:f,id:a,initPTS:P,timescale:V}))}if(b&&u.independent!==!1){if(S){var Y=b.startPTS,j=b.endPTS,ie=b.startDTS,Q=b.endDTS;if(p)p.elementaryStreams[b.type]={startPTS:Y,endPTS:j,startDTS:ie,endDTS:Q};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:Y)-this.config.maxBufferHole)return void this.backtrack(f);f.setElementaryStreamInfo(b.type,f.start,j,f.start,Q,!0)}f.setElementaryStreamInfo(b.type,Y,j,ie,Q),this.backtrackFragment&&(this.backtrackFragment=f),this.bufferFragmentData(b,f,p,c)}}else if(u.independent===!1)return void this.backtrack(f);if(L){var ce=L.startPTS,oe=L.endPTS,Ae=L.startDTS,xe=L.endDTS;p&&(p.elementaryStreams[Et]={startPTS:ce,endPTS:oe,startDTS:Ae,endDTS:xe}),f.setElementaryStreamInfo(Et,ce,oe,Ae,xe),this.bufferFragmentData(L,f,p,c)}if(S&&w!=null&&(i=w.samples)!=null&&i.length){var Le={id:a,frag:f,details:S,samples:w.samples};l.trigger(k.FRAG_PARSING_METADATA,Le)}if(S&&A){var Me={id:a,frag:f,details:S,samples:A.samples};l.trigger(k.FRAG_PARSING_USERDATA,Me)}}}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,a,l){var u=this;if(this.state===wr){this.audioOnly=!!i.audio&&!i.video,this.altAudio&&!this.audioOnly&&delete i.audio;var c=i.audio,h=i.video,f=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+"]")}h&&(h.levelCodec=t.videoCodec,h.id="main",this.log("Init video buffer, container:"+h.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+h.codec+"]")),f&&this.log("Init audiovideo buffer, container:"+f.container+", codecs[level/parsed]=["+(t.attrs.CODECS||"")+"/"+f.codec+"]"),this.hls.trigger(k.BUFFER_CODECS,i),Object.keys(i).forEach(function(b){var A=i[b].initSegment;A!=null&&A.byteLength&&u.hls.trigger(k.BUFFER_APPENDING,{type:b,data:A,frag:a,part:null,chunkMeta:l,parent:a.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=De},e.checkFragmentChanged=function(){var t=this.media,i=null;if(t&&t.readyState>1&&t.seeking===!1){var a=t.currentTime;if(he.isBuffered(t,a)?i=this.getAppendedFrag(a):he.isBuffered(t,a+.1)&&(i=this.getAppendedFrag(a+.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(k.FRAG_CHANGED,{frag:i}),l&&l.level===u||this.hls.trigger(k.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,a=this.currentFrag;if(a&&re(i)&&re(a.programDateTime)){var l=a.programDateTime+1e3*(i-a.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}(Jd),pn=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}(),sg=function(){function d(e,t,i,a){a===void 0&&(a=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 pn(e),this.fast_=new pn(t),this.defaultTTFB_=a,this.ttfb_=new pn(e)}var s=d.prototype;return s.update=function(e,t){var i=this.slow_,a=this.fast_,l=this.ttfb_;i.halfLife!==e&&(this.slow_=new pn(e,i.getEstimate(),i.getTotalWeight())),a.halfLife!==t&&(this.fast_=new pn(t,a.getEstimate(),a.getTotalWeight())),l.halfLife!==e&&(this.ttfb_=new pn(e,l.getEstimate(),l.getTotalWeight()))},s.sample=function(e,t){var i=(e=Math.max(e,this.minDelayMs_))/1e3,a=8*t/i;this.fast_.sample(i,a),this.slow_.sample(i,a)},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}(),og=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 sg(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.FRAG_LOADING,this.onFragLoading,this),e.on(k.FRAG_LOADED,this.onFragLoaded,this),e.on(k.FRAG_BUFFERED,this.onFragBuffered,this),e.on(k.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(k.LEVEL_LOADED,this.onLevelLoaded,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.FRAG_LOADING,this.onFragLoading,this),e.off(k.FRAG_LOADED,this.onFragLoaded,this),e.off(k.FRAG_BUFFERED,this.onFragBuffered,this),e.off(k.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(k.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,a=t.frag;this.ignoreFragment(a)||(this.fragCurrent=a,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,a){return e+i/t+(a?this.lastLevelLoadSec:0)},s.onLevelLoaded=function(e,t){var i=this.hls.config,a=t.stats,l=a.total,u=a.bwEstimate;re(l)&&re(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,a=i.autoLevelEnabled,l=i.media;if(e&&l){var u=performance.now(),c=t?t.stats:e.stats,h=t?t.duration:e.duration,f=u-c.loading.start;if(c.aborted||c.loaded&&c.loaded===c.total||e.level===0)return this.clearTimer(),void(this._nextAutoLevel=-1);if(a&&!l.paused&&l.playbackRate&&l.readyState){var p=i.mainForwardBufferInfo;if(p!==null){var E=this.bwEstimator.getEstimateTTFB(),b=Math.abs(l.playbackRate);if(!(f<=Math.max(E,h/(2*b)*1e3))){var A=p.len/b;if(!(A>=2*h/b)){var w=c.loading.first?c.loading.first-c.loading.start:-1,D=c.loaded&&w>-1,S=this.bwEstimator.getEstimate(),L=i.levels,N=i.minAutoLevel,P=L[e.level],V=c.total||Math.max(c.loaded,Math.round(h*P.maxBitrate/8)),Y=f-w;Y<1&&D&&(Y=Math.min(f,8*c.loaded/S));var j=D?1e3*c.loaded/Y:0,ie=j?(V-c.loaded)/j:8*V/S+E/1e3;if(!(ie<=A)){var Q,X=j?8*j:S,ce=Number.POSITIVE_INFINITY;for(Q=e.level-1;Q>N;Q--){var oe=L[Q].maxBitrate;if((ce=this.getTimeToLoadFrag(E/1e3,X,h*oe,!L[Q].details))<A)break}ce>=ie||ce>10*h||(i.nextLoadLevel=Q,D?this.bwEstimator.sample(f-Math.min(E,w),c.loaded):this.bwEstimator.sampleTTFB(f),this.clearTimer(),B.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
28
|
Estimated load time for current fragment: `+ie.toFixed(3)+` s
|
|
29
29
|
Estimated load time for down switch fragment: `+ce.toFixed(3)+` s
|
|
30
30
|
TTFB estimate: `+w+`
|
|
31
31
|
Current BW estimate: `+(re(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(k.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:c}))}}}}}}},s.onFragLoaded=function(e,t){var i=t.frag,a=t.part,o=a?a.stats:i.stats;if(i.type===rt&&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 d=a?a.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)+d;c.loaded={bytes:f,duration:h},c.realBitrate=Math.round(8*f/h)}if(i.bitrateTest){var p={stats:o,frag:i,part:a,id:i.type};this.onFragBuffered(k.FRAG_BUFFERED,p),i.bitrateTest=!1}}},s.onFragBuffered=function(e,t){var i=t.frag,a=t.part,o=a!=null&&a.stats.loaded?a.stats:i.stats;if(!o.aborted&&!this.ignoreFragment(i)){var d=o.parsing.end-o.loading.start-Math.min(o.loading.first-o.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(d,o.loaded),o.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=d/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,a=i.maxAutoLevel,o=i.config,d=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,E=i.mainForwardBufferInfo,b=(E?E.len:0)/h,A=this.findBestLevel(p,d,a,b,o.abrBandWidthFactor,o.abrBandWidthUpFactor);if(A>=0)return A;U.trace("[abr] "+(b?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var w=f?Math.min(f,o.maxStarvationDelay):o.maxStarvationDelay,D=o.abrBandWidthFactor,S=o.abrBandWidthUpFactor;if(!b){var L=this.bitrateTestDelay;L&&(w=(f?Math.min(f,o.maxLoadingDelay):o.maxLoadingDelay)-L,U.trace("[abr] bitrate test took "+Math.round(1e3*L)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*w)+" ms"),D=S=1)}return A=this.findBestLevel(p,d,a,b+w,D,S),Math.max(A,0)},s.findBestLevel=function(e,t,i,a,o,d){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),w=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=E[P];if(!V||w&&V.codecSet!==w)V&&(L=Math.min(P,L),N=Math.max(P,N));else{N!==-1&&U.trace("[abr] Skipped level(s) "+L+"-"+N+' with CODECS:"'+E[N].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,ie=void 0;ie=P<=p?o*e:d*e;var Q=E[P].maxBitrate,X=this.getTimeToLoadFrag(S,ie,Q*j,Y===void 0);if(U.trace("[abr] level:"+P+" adjustedbw-bitrate:"+Math.round(ie-Q)+" avgDuration:"+j.toFixed(1)+" maxFetchDuration:"+a.toFixed(1)+" fetchDuration:"+X.toFixed(1)),ie>Q&&(X===0||!re(X)||A&&!this.bitrateTestDelay||X<a))return P}}return-1},M(u,[{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 a=this.hls.levels;if(a.length>Math.max(e,i)&&a[e].loadError<=a[i].loadError)return e}return e!==-1&&(i=Math.min(e,i)),i},set:function(e){this._nextAutoLevel=e}}]),u}(),Qh=function(){function u(){this.chunks=[],this.dataLength=0}var s=u.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(a,o){for(var d=new Uint8Array(o),c=0,f=0;f<a.length;f++){var h=a[f];d.set(h,c),c+=h.length}return d}(t,i),this.reset(),e):new Uint8Array(0)},s.reset=function(){this.chunks.length=0,this.dataLength=0},u}(),sg=function(u){function s(t,i,a){var o;return(o=u.call(this,t,i,a,"[audio-stream-controller]",Ri)||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}z(s,u);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(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(k.ERROR,this.onError,this),t.on(k.BUFFER_RESET,this.onBufferReset,this),t.on(k.BUFFER_CREATED,this.onBufferCreated,this),t.on(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(k.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(k.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(k.ERROR,this.onError,this),t.off(k.BUFFER_RESET,this.onBufferReset,this),t.off(k.BUFFER_CREATED,this.onBufferCreated,this),t.off(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(k.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(k.FRAG_BUFFERED,this.onFragBuffered,this)},e.onInitPtsFound=function(t,i){var a=i.frag,o=i.id,d=i.initPTS,c=i.timescale;if(o==="main"){var f=a.cc;this.initPTS[a.cc]={baseTime:d,timescale:c},this.log("InitPTS for cc: "+f+" found from main: "+d),this.videoTrackCC=f,this.state===bs&&this.tick()}},e.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=Ut);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=De):(this.loadedmetadata=!1,this.state=Ca),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},e.doTick=function(){switch(this.state){case De:this.doTickIdle();break;case Ca:var t,i=this.levels,a=this.trackId,o=i==null||(t=i[a])==null?void 0:t.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=bs}break;case Zr:var d,c=performance.now(),f=this.retryDate;(!f||c>=f||(d=this.media)!=null&&d.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=De);break;case bs: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=Xr;var w={frag:p,part:E,payload:b.flush(),networkDetails:null};this._handleFragmentLoadProgress(w),A&&u.prototype._handleFragmentLoadComplete.call(this,w)}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=he.bufferInfo(this.mediaBuffer,D,this.config.maxBufferHole);cn(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=De}this.onTickEnd()},e.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=De)},e.resetLoadingState=function(){this.clearWaitingFragment(),u.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,a=this.media,o=this.trackId,d=t.config;if(i!=null&&i[o]&&(a||!this.startFragRequested&&d.startFragPrefetch)){var c=i[o],f=c.details;if(!f||f.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(f))this.state=Ca;else{var h=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&h&&(this.bufferFlushed=!1,this.afterBufferFlushed(h,gt,Ri));var p=this.getFwdBufferInfo(h,Ri);if(p!==null){var E=this.bufferedTrack,b=this.switchingTrack;if(!b&&this._streamEnded(p,f))return t.trigger(k.BUFFER_EOS,{type:"audio"}),void(this.state=ys);var A=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,rt),w=p.len,D=this.getMaxBufferLength(A==null?void 0:A.len);if(!(w>=D)||b){var S=f.fragments[0].start,L=p.end;if(b&&a){var N=this.getLoadPosition();E&&b.attrs!==E.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"),a.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,rt,D)),P){var Y=A&&P.start>A.end+f.targetduration;if(Y||(A==null||!A.len)&&p.len){var j=this.getAppendedFrag(P.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(P,c,L)}else this.bufferFlushed=!0}}}}},e.getMaxBufferLength=function(t){var i=u.prototype.getMaxBufferLength.call(this);return t?Math.min(Math.max(i,t),this.config.maxMaxBufferLength):i},e.onMediaDetaching=function(){this.videoBuffer=null,u.prototype.onMediaDetaching.call(this)},e.onAudioTracksUpdated=function(t,i){var a=i.audioTracks;this.resetTransmuxer(),this.levels=a.map(function(o){return new wa(o)})},e.onAudioTrackSwitching=function(t,i){var a=!!i.url;this.trackId=i.id;var o=this.fragCurrent;o&&(o.abortRequests(),this.removeUnbufferedFrags(o.start)),this.resetLoadingState(),a?this.setInterval(100):this.resetTransmuxer(),a?(this.switchingTrack=i,this.state=De):(this.switchingTrack=null,this.bufferedTrack=i,this.state=Ut),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(k.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},e.onAudioTrackLoaded=function(t,i){var a;if(this.mainDetails!=null){var o=this.levels,d=i.details,c=i.id;if(o){this.log("Track "+c+" loaded ["+d.startSN+","+d.endSN+"]"+(d.lastPartSn?"[part-"+d.lastPartSn+"-"+d.lastPartIndex+"]":"")+",duration:"+d.totalduration);var f=o[c],h=0;if(d.live||(a=f.details)!=null&&a.live){var p=this.mainDetails;if(d.fragments[0]||(d.deltaUpdateFailed=!0),d.deltaUpdateFailed||!p)return;!f.details&&d.hasProgramDateTime&&p.hasProgramDateTime?(Ot(d,p),h=d.fragments[0].start):h=this.alignPlaylists(d,f.details)}f.details=d,this.levelLastLoaded=c,this.startFragRequested||!this.mainDetails&&d.live||this.setStartPosition(f.details,h),this.state!==Ca||this.waitForCdnTuneIn(d)||(this.state=De),this.tick()}else this.warn("Audio tracks were reset while loading level "+c)}else this.cachedTrackLoadedData=i},e._handleFragmentLoadProgress=function(t){var i,a=t.frag,o=t.part,d=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(a.start);var b=c.defaultAudioCodec||p.audioCodec||"mp4a.40.2",A=this.transmuxer;A||(A=this.transmuxer=new zh(this.hls,Ri,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var w=this.initPTS[a.cc],D=(i=a.initSegment)==null?void 0:i.data;if(w!==void 0){var S=o?o.index:-1,L=S!==-1,N=new fe(a.level,a.sn,a.stats.chunkCount,d.byteLength,S,L);A.push(d,D,b,"",a,o,E.totalduration,!1,N,w)}else this.log("Unknown video PTS for cc "+a.cc+", waiting for video PTS before demuxing audio frag "+a.sn+" of ["+E.startSN+" ,"+E.endSN+"],track "+f),(this.waitingData=this.waitingData||{frag:a,part:o,cache:new Qh,complete:!1}).cache.push(new Uint8Array(d)),this.waitingVideoCC=this.videoTrackCC,this.state=bs}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 "+a.sn+" of level "+a.level+" will not be buffered")},e._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:u.prototype._handleFragmentLoadComplete.call(this,t)},e.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},e.onBufferCreated=function(t,i){var a=i.tracks.audio;a&&(this.mediaBuffer=a.buffer||null),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer||null)},e.onFragBuffered=function(t,i){var a,o=i.frag,d=i.part;if(o.type===Ri)if(this.fragContextChanged(o))this.warn("Fragment "+o.sn+(d?" p: "+d.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(k.AUDIO_TRACK_SWITCHED,y({},c)))}this.fragBufferedComplete(o,d)}else this.loadedmetadata||o.type!==rt||(a=this.videoBuffer||this.media)!=null&&a.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var a;if(i.fatal)this.state=hn;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(Ri,i);break;case W.AUDIO_TRACK_LOAD_ERROR:case W.AUDIO_TRACK_LOAD_TIMEOUT:case W.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==Ca||((a=i.context)==null?void 0:a.type)!==yi||(this.state=De);break;case W.BUFFER_FULL_ERROR:if(!i.parent||i.parent!=="audio")return;this.reduceLengthAndFlushBuffer(i)&&(this.bufferedTrack=null,u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case W.INTERNAL_EXCEPTION:this.recoverWorkerError(i)}},e.onBufferFlushed=function(t,i){i.type===gt&&(this.bufferFlushed=!0,this.state===ys&&(this.state=De))},e._handleTransmuxComplete=function(t){var i,a="audio",o=this.hls,d=t.remuxResult,c=t.chunkMeta,f=this.getCurrentContext(c);if(f){var h=f.frag,p=f.part,E=f.level.details,b=d.audio,A=d.text,w=d.id3,D=d.initSegment;if(!this.fragContextChanged(h)&&E){if(this.state=kr,this.switchingTrack&&b&&this.completeAudioSwitch(this.switchingTrack),D!=null&&D.tracks){var S=h.initSegment||h;this._bufferInitSegment(D.tracks,S,c),o.trigger(k.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:a,tracks:D.tracks})}if(b){var L=b.startPTS,N=b.endPTS,P=b.startDTS,V=b.endDTS;p&&(p.elementaryStreams[gt]={startPTS:L,endPTS:N,startDTS:P,endDTS:V}),h.setElementaryStreamInfo(gt,L,N,P,V),this.bufferFragmentData(b,h,p,c)}if(w!=null&&(i=w.samples)!=null&&i.length){var Y=H({id:a,frag:h,details:E},w);o.trigger(k.FRAG_PARSING_METADATA,Y)}if(A){var j=H({id:a,frag:h,details:E},A);o.trigger(k.FRAG_PARSING_USERDATA,j)}}else this.fragmentTracker.removeFragment(h)}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,a){if(this.state===kr){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(k.BUFFER_CODECS,t);var d=o.initSegment;if(d!=null&&d.byteLength){var c={type:"audio",frag:i,part:null,chunkMeta:a,parent:i.type,data:d};this.hls.trigger(k.BUFFER_APPENDING,c)}this.tick()}}},e.loadFragment=function(t,i,a){var o,d=this.fragmentTracker.getState(t);this.fragCurrent=t,this.switchingTrack||d===Z||d===Te?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=bs):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,t,i,a)):this.clearTrackerIfNeeded(t)},e.completeAudioSwitch=function(t){var i=this.hls,a=this.media,o=this.bufferedTrack,d=o==null?void 0:o.attrs,c=t.attrs;a&&d&&(d.CHANNELS!==c.CHANNELS||d.NAME!==c.NAME||d.LANGUAGE!==c.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=t,this.switchingTrack=null,i.trigger(k.AUDIO_TRACK_SWITCHED,y({},t))},s}(Ju),og=function(u){function s(t){var i;return(i=u.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,u);var e=s.prototype;return e.registerListeners=function(){var t=this.hls;t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_PARSED,this.onManifestParsed,this),t.on(k.LEVEL_LOADING,this.onLevelLoading,this),t.on(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(k.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_PARSED,this.onManifestParsed,this),t.off(k.LEVEL_LOADING,this.onLevelLoading,this),t.off(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(k.ERROR,this.onError,this)},e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,u.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 a=i.id,o=i.groupId,d=i.details,c=this.tracksInGroup[a];if(c&&c.groupId===o){var f=c.details;c.details=i.details,this.log("audio-track "+a+' "'+c.name+'" lang:'+c.lang+" group:"+o+" loaded ["+d.startSN+"-"+d.endSN+"]"),a===this.trackId&&this.playlistLoaded(a,i,f)}else this.warn("Track with id:"+a+" 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 a=i.audioGroupIds[i.urlId];if(this.groupId!==a){this.groupId=a||null;var o=this.tracks.filter(function(c){return!a||c.groupId===a});this.selectDefaultTrack&&!o.some(function(c){return c.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=o;var d={audioTracks:o};this.log("Updating audio tracks, "+o.length+" track(s) found in group:"+a),this.hls.trigger(k.AUDIO_TRACKS_UPDATED,d),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}},e.onError=function(t,i){!i.fatal&&i.context&&i.context.type===yi&&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 a=this.currentTrack;i[this.trackId];var o=i[t],d=o.groupId,c=o.name;if(this.log("Switching to audio-track "+t+' "'+c+'" lang:'+o.lang+" group:"+d),this.trackId=t,this.currentTrack=o,this.selectDefaultTrack=!1,this.hls.trigger(k.AUDIO_TRACK_SWITCHING,y({},o)),!o.details||o.details.live){var f=this.switchParams(o.url,a==null?void 0:a.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 a=new Error("No track found for running audio group-ID: "+this.groupId+" track count: "+t.length);this.warn(a.message),this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:a})}},e.findTrackId=function(t){for(var i=this.tracksInGroup,a=0;a<i.length;a++){var o=i[a];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){u.prototype.loadPlaylist.call(this);var i=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(i)){var a=i.id,o=i.groupId,d=i.url;if(t)try{d=t.addDirectives(d)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("loading audio-track playlist "+a+' "'+i.name+'" lang:'+i.lang+" group:"+o),this.clearTimer(),this.hls.trigger(k.AUDIO_TRACK_LOADING,{url:d,id:a,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 Xh(u,s){if(u.length!==s.length)return!1;for(var e=0;e<u.length;e++)if(!lg(u[e].attrs,s[e].attrs))return!1;return!0}function lg(u,s){var e=u["STABLE-RENDITION-ID"];return e?e===s["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some(function(t){return u[t]!==s[t]})}var ug=function(u){function s(t,i,a){var o;return(o=u.call(this,t,i,a,"[subtitle-stream-controller]",Oi)||this).levels=[],o.currentTrackId=-1,o.tracksBuffered=[],o.mainDetails=null,o._registerListeners(),o}z(s,u);var e=s.prototype;return e.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},e._registerListeners=function(){var t=this.hls;t.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.ERROR,this.onError,this),t.on(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(k.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(k.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(k.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.ERROR,this.onError,this),t.off(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(k.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(k.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(k.FRAG_BUFFERED,this.onFragBuffered,this)},e.startLoad=function(t){this.stopLoad(),this.state=De,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=[],u.prototype.onMediaDetaching.call(this)},e.onLevelLoaded=function(t,i){this.mainDetails=i.details},e.onSubtitleFragProcessed=function(t,i){var a=i.frag,o=i.success;if(this.fragPrevious=a,this.state=De,o){var d=this.tracksBuffered[this.currentTrackId];if(d){for(var c,f=a.start,h=0;h<d.length;h++)if(f>=d[h].start&&f<=d[h].end){c=d[h];break}var p=a.start+a.duration;c?c.end=p:(c={start:f,end:p},d.push(c)),this.fragmentTracker.fragBuffered(a)}}},e.onBufferFlushing=function(t,i){var a=i.startOffset,o=i.endOffset;if(a===0&&o!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,c=this.levels;if(!c.length||!c[d]||!c[d].details)return;var f=o-c[d].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(a,f,Oi)}},e.onFragBuffered=function(t,i){var a;this.loadedmetadata||i.frag.type!==rt||(a=this.media)!=null&&a.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var a=i.frag;(a==null?void 0:a.type)===Oi&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Ut&&(this.state=De))},e.onSubtitleTracksUpdated=function(t,i){var a=this,o=i.subtitleTracks;Xh(this.levels,o)?this.levels=o.map(function(d){return new wa(d)}):(this.tracksBuffered=[],this.levels=o.map(function(d){var c=new wa(d);return a.tracksBuffered[c.id]=[],c}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Oi),this.fragPrevious=null,this.mediaBuffer=null)},e.onSubtitleTrackSwitch=function(t,i){if(this.currentTrackId=i.id,this.levels.length&&this.currentTrackId!==-1){var a=this.levels[this.currentTrackId];a!=null&&a.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,a&&this.setInterval(500)}else this.clearInterval()},e.onSubtitleTrackLoaded=function(t,i){var a,o=i.details,d=i.id,c=this.currentTrackId,f=this.levels;if(f.length){var h=f[c];if(!(d>=f.length||d!==c)&&h){this.mediaBuffer=this.mediaBufferTimeRanges;var p=0;if(o.live||(a=h.details)!=null&&a.live){var E=this.mainDetails;if(o.deltaUpdateFailed||!E)return;var b=E.fragments[0];h.details?(p=this.alignPlaylists(o,h.details))===0&&b&&Ia(o,p=b.start):o.hasProgramDateTime&&E.hasProgramDateTime?(Ot(o,E),p=o.fragments[0].start):b&&Ia(o,p=b.start)}h.details=o,this.levelLastLoaded=d,this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(h.details,p),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===De&&(Ra(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,a=t.frag,o=t.payload,d=a.decryptdata,c=this.hls;if(!this.fragContextChanged(a)&&o&&o.byteLength>0&&d&&d.key&&d.iv&&d.method==="AES-128"){var f=performance.now();this.decrypter.decrypt(new Uint8Array(o),d.key.buffer,d.iv.buffer).catch(function(h){throw c.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_DECRYPT_ERROR,fatal:!1,error:h,reason:h.message,frag:a}),h}).then(function(h){var p=performance.now();c.trigger(k.FRAG_DECRYPTED,{frag:a,payload:h,stats:{tstart:f,tdecrypt:p}})}).catch(function(h){i.warn(h.name+": "+h.message),i.state=De})}},e.doTick=function(){if(this.media){if(this.state===De){var t=this.currentTrackId,i=this.levels,a=i[t];if(!i.length||!a||!a.details)return;var o=a.details,d=o.targetduration,c=this.config,f=this.getLoadPosition(),h=he.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],f-d,c.maxBufferHole),p=h.end,E=h.len,b=this.getFwdBufferInfo(this.media,rt);if(E>this.getMaxBufferLength(b==null?void 0:b.len)+d)return;var A=o.fragments,w=A.length,D=o.edge,S=null,L=this.fragPrevious;if(p<D){var N=c.maxFragLookUpTolerance;!(S=Ra(L,A,Math.max(A[0].start,p),N))&&L&&L.start<A[0].start&&(S=A[0])}else S=A[w-1];if(!S)return;S=this.mapToInitFragWhenRequired(S),this.fragmentTracker.getState(S)===Z&&this.loadFragment(S,a,p)}}else this.state=De},e.getMaxBufferLength=function(t){var i=u.prototype.getMaxBufferLength.call(this);return t?Math.max(i,t):i},e.loadFragment=function(t,i,a){this.fragCurrent=t,t.sn==="initSegment"?this._loadInitSegment(t,i):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,t,i,a))},M(s,[{key:"mediaBufferTimeRanges",get:function(){return new dg(this.tracksBuffered[this.currentTrackId]||[])}}]),s}(Ju),dg=function(u){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 u[t][e]};this.buffered={get length(){return u.length},end:function(e){return s("end",e,u.length)},start:function(e){return s("start",e,u.length)}}},cg=function(u){function s(t){var i;return(i=u.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,u);var e=s.prototype;return e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,u.prototype.destroy.call(this)},e.registerListeners=function(){var t=this.hls;t.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_PARSED,this.onManifestParsed,this),t.on(k.LEVEL_LOADING,this.onLevelLoading,this),t.on(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(k.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_PARSED,this.onManifestParsed,this),t.off(k.LEVEL_LOADING,this.onLevelLoading,this),t.off(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(k.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),hd(this.media.textTracks).forEach(function(t){Qr(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 a=i.id,o=i.details,d=this.trackId,c=this.tracksInGroup[d];if(c){var f=c.details;c.details=i.details,this.log("subtitle track "+a+" loaded ["+o.startSN+"-"+o.endSN+"]"),a===this.trackId&&this.playlistLoaded(a,i,f)}else this.warn("Invalid subtitle track id "+a)},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 a=i.textGroupIds[i.urlId],o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==a){var d=this.tracks.filter(function(h){return!a||h.groupId===a});this.tracksInGroup=d;var c=this.findTrackId(o==null?void 0:o.name)||this.findTrackId();this.groupId=a||null;var f={subtitleTracks:d};this.log("Updating subtitle tracks, "+d.length+' track(s) found in "'+a+'" group-id'),this.hls.trigger(k.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,a=0;a<i.length;a++){var o=i[a];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===zi&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.checkRetry(i)},e.loadPlaylist=function(t){u.prototype.loadPlaylist.call(this);var i=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(i)){var a=i.id,o=i.groupId,d=i.url;if(t)try{d=t.addDirectives(d)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Loading subtitle playlist for id "+a),this.hls.trigger(k.SUBTITLE_TRACK_LOADING,{url:d,id:a,groupId:o,deliveryDirectives:t||null})}},e.toggleTrackModes=function(t){var i=this,a=this.media,o=this.trackId;if(a){var d=hd(a.textTracks),c=d.filter(function(p){return p.groupId===i.groupId});if(t===-1)[].slice.call(d).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 a,o=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(t===-1||(a=o[t])!=null&&a.details)||t<-1||t>=o.length)){this.clearTimer();var d=o[t];if(this.log("Switching to subtitle-track "+t+(d?' "'+d.name+'" lang:'+d.lang+" group:"+d.groupId:"")),this.trackId=t,d){var c=d.id,f=d.groupId,h=f===void 0?"":f,p=d.name,E=d.type,b=d.url;this.hls.trigger(k.SUBTITLE_TRACK_SWITCH,{id:c,groupId:h,name:p,type:E,url:b});var A=this.switchParams(d.url,i==null?void 0:i.details);this.loadPlaylist(A)}else this.hls.trigger(k.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=hd(this.media.textTracks),a=0;a<i.length;a++)if(i[a].mode==="hidden")t=a;else if(i[a].mode==="showing"){t=a;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 hd(u){for(var s=[],e=0;e<u.length;e++){var t=u[e];t.kind!=="subtitles"&&t.kind!=="captions"||!t.label||s.push(u[e])}return s}var hg=function(){function u(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var s=u.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}),a={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(a,e),i},s.executeNext=function(e){var t=this.buffers,i=this.queues,a=t[e],o=i[e];if(o.length){var d=o[0];try{d.execute()}catch(c){U.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),d.onError(c),a!=null&&a.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]},u}(),Zh=nn(),Jh=/([ha]vc.)(?:\.[^.,]+)+/,fg=function(){function u(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,a=t.mediaSource;U.log("[buffer-controller]: Media source opened"),i&&(i.removeEventListener("emptied",t._onMediaEmptied),t.updateMediaElementDuration(),t.hls.trigger(k.MEDIA_ATTACHED,{media:i})),a&&a.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){U.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){U.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=function(){var i=t.media,a=t._objectUrl;i&&i.src!==a&&U.error("Media element src was set while attaching MediaSource ("+a+" > "+i.src+")")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var s=u.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(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.BUFFER_RESET,this.onBufferReset,this),e.on(k.BUFFER_APPENDING,this.onBufferAppending,this),e.on(k.BUFFER_CODECS,this.onBufferCodecs,this),e.on(k.BUFFER_EOS,this.onBufferEos,this),e.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(k.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(k.FRAG_PARSED,this.onFragParsed,this),e.on(k.FRAG_CHANGED,this.onFragChanged,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.BUFFER_RESET,this.onBufferReset,this),e.off(k.BUFFER_APPENDING,this.onBufferAppending,this),e.off(k.BUFFER_CODECS,this.onBufferCodecs,this),e.off(k.BUFFER_EOS,this.onBufferEos,this),e.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(k.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(k.FRAG_PARSED,this.onFragParsed,this),e.off(k.FRAG_CHANGED,this.onFragChanged,this)},s._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new hg(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,U.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},s.onMediaAttaching=function(e,t){var i=this.media=t.media;if(i&&Zh){var a=this.mediaSource=new Zh;a.addEventListener("sourceopen",this._onMediaSourceOpen),a.addEventListener("sourceended",this._onMediaSourceEnded),a.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(a),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(U.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(a){U.warn("[buffer-controller]: onMediaDetaching: "+a.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()):U.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(k.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(a){U.warn("[buffer-controller]: Failed to reset the "+t+" buffer",a)}}),this._initSourceBuffer()},s.onBufferCodecs=function(e,t){var i=this,a=this.getSourceBufferTypes().length;Object.keys(t).forEach(function(o){if(a){var d=i.tracks[o];if(d&&typeof d.buffer.changeType=="function"){var c=t[o],f=c.id,h=c.codec,p=c.levelCodec,E=c.container,b=c.metadata,A=(d.levelCodec||d.codec).replace(Jh,"$1"),w=(p||h).replace(Jh,"$1");if(A!==w){var D=E+";codecs="+(p||h);i.appendChangeType(o,D),U.log("[buffer-controller]: switching codec "+A+" to "+w),i.tracks[o]={buffer:d.buffer,codec:h,container:E,levelCodec:p,metadata:b,id:f}}}}else i.pendingTracks[o]=t[o]}),a||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},s.appendChangeType=function(e,t){var i=this,a=this.operationQueue,o={execute:function(){var d=i.sourceBuffer[e];d&&(U.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),d.changeType(t)),a.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(d){U.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",d)}};a.append(o,e)},s.onBufferAppending=function(e,t){var i=this,a=this.hls,o=this.operationQueue,d=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 w=h.stats.buffering,D=p?p.stats.buffering:null;w.start===0&&(w.start=A),D&&D.start===0&&(D.start=A);var S=d.audio,L=!1;f==="audio"&&(S==null?void 0:S.container)==="audio/mpeg"&&(L=!this.lastMpegAudioChunk||E.id===1||this.lastMpegAudioChunk.sn!==E.sn,this.lastMpegAudioChunk=E);var N=h.start,P={execute:function(){if(b.executeStart=self.performance.now(),L){var V=i.sourceBuffer[f];if(V){var Y=N-V.timestampOffset;Math.abs(Y)>=.1&&(U.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+N+" (delta: "+Y+") sn: "+h.sn+")"),V.timestampOffset=N)}}i.appendExecutor(c,f)},onStart:function(){},onComplete:function(){var V=self.performance.now();b.executeEnd=b.end=V,w.first===0&&(w.first=V),D&&D.first===0&&(D.first=V);var Y=i.sourceBuffer,j={};for(var ie in Y)j[ie]=he.getBuffered(Y[ie]);i.appendError=0,i.hls.trigger(k.BUFFER_APPENDED,{type:f,frag:h,part:p,chunkMeta:E,parent:h.type,timeRanges:j})},onError:function(V){U.error("[buffer-controller]: Error encountered while trying to append to the "+f+" SourceBuffer",V);var Y={type:se.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>a.config.appendErrorMaxRetry&&(U.error("[buffer-controller]: Failed "+a.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),Y.fatal=!0)),a.trigger(k.ERROR,Y)}};o.append(P,f)},s.onBufferFlushing=function(e,t){var i=this,a=this.operationQueue,o=function(d){return{execute:i.removeExecutor.bind(i,d,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(k.BUFFER_FLUSHED,{type:d})},onError:function(c){U.warn("[buffer-controller]: Failed to remove from "+d+" SourceBuffer",c)}}};t.type?a.append(o(t.type),t.type):this.getSourceBufferTypes().forEach(function(d){a.append(o(d),d)})},s.onFragParsed=function(e,t){var i=this,a=t.frag,o=t.part,d=[],c=o?o.elementaryStreams:a.elementaryStreams;c[tr]?d.push("audiovideo"):(c[gt]&&d.push("audio"),c[Ct]&&d.push("video")),d.length===0&&U.warn("Fragments must have at least one ElementaryStreamType set. type: "+a.type+" level: "+a.level+" sn: "+a.sn),this.blockBuffers(function(){var f=self.performance.now();a.stats.buffering.end=f,o&&(o.stats.buffering.end=f);var h=o?o.stats:a.stats;i.hls.trigger(k.FRAG_BUFFERED,{frag:a,part:o,stats:h,id:a.type})},d)},s.onFragChanged=function(e,t){this.flushBackBuffer()},s.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce(function(a,o){var d=i.sourceBuffer[o];return!d||t.type&&t.type!==o||(d.ending=!0,d.ended||(d.ended=!0,U.log("[buffer-controller]: "+o+" sourceBuffer now EOS"))),a&&!(d&&!d.ended)},!0)&&(U.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){i.getSourceBufferTypes().forEach(function(o){var d=i.sourceBuffer[o];d&&(d.ending=!1)});var a=i.mediaSource;a&&a.readyState==="open"?(U.log("[buffer-controller]: Calling mediaSource.endOfStream()"),a.endOfStream()):a&&U.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+a.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,a=this.sourceBuffer;if(i&&t!==null){var o=this.getSourceBufferTypes();if(o.length){var d=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(re(d)&&!(d<0)){var c=i.currentTime,f=t.levelTargetDuration,h=Math.max(d,f),p=Math.floor(c/f)*f-h;o.forEach(function(E){var b=a[E];if(b){var A=he.getBuffered(b);if(A.length>0&&p>A.start(0)){if(e.trigger(k.BACK_BUFFER_REACHED,{bufferEnd:p}),t.live)e.trigger(k.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p});else if(b.ended&&A.end(A.length-1)-c<2*f)return void U.info("[buffer-controller]: Cannot flush "+E+" back buffer while SourceBuffer is in ended state");e.trigger(k.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,a=this.mediaSource,o=e.fragments[0].start+e.totalduration,d=i.duration,c=re(a.duration)?a.duration:0;e.live&&t.config.liveDurationInfinity?(U.log("[buffer-controller]: Media Source duration is set to Infinity"),a.duration=1/0,this.updateSeekableRange(e)):(o>c&&o>d||!re(d))&&(U.log("[buffer-controller]: Updating Media Source duration to "+o.toFixed(3)),a.duration=o)}},s.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){var a=Math.max(0,i[0].start),o=Math.max(a,a+e.totalduration);t.setLiveSeekableRange(a,o)}},s.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,a=Object.keys(i).length;if(a&&!e||a===2){this.createSourceBuffers(i),this.pendingTracks={};var o=this.getSourceBufferTypes();if(o.length)this.hls.trigger(k.BUFFER_CREATED,{tracks:this.tracks}),o.forEach(function(c){t.executeNext(c)});else{var d=new Error("could not create source buffer for media codec(s)");this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:d,reason:d.message})}}},s.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(var a in e)if(!t[a]){var o=e[a];if(!o)throw Error("source buffer exists for track "+a+", however track does not");var d=o.levelCodec||o.codec,c=o.container+";codecs="+d;U.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var f=t[a]=i.addSourceBuffer(c),h=a;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[a]={buffer:f,codec:d,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(p){U.error("[buffer-controller]: error while trying to add sourceBuffer: "+p.message),this.hls.trigger(k.ERROR,{type:se.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");U.error("[buffer-controller]: "+i,t),this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_APPENDING_ERROR,error:i,fatal:!1});var a=this.operationQueue.current(e);a&&a.onError(t)},s.removeExecutor=function(e,t,i){var a=this.media,o=this.mediaSource,d=this.operationQueue,c=this.sourceBuffer[e];if(!a||!o||!c)return U.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void d.shiftAndExecuteNext(e);var f=re(a.duration)?a.duration:1/0,h=re(o.duration)?o.duration:1/0,p=Math.max(0,t),E=Math.min(i,f,h);E>p&&!c.ending?(c.ended=!1,U.log("[buffer-controller]: Removing ["+p+","+E+"] from the "+e+" SourceBuffer"),c.remove(p,E)):d.shiftAndExecuteNext(e)},s.appendExecutor=function(e,t){var i=this.operationQueue,a=this.sourceBuffer[t];if(!a)return U.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(t);a.ended=!1,a.appendBuffer(e)},s.blockBuffers=function(e,t){var i=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length)return U.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var a=this.operationQueue,o=t.map(function(d){return a.appendBlocker(d)});Promise.all(o).then(function(){e(),t.forEach(function(d){var c=i.sourceBuffer[d];c!=null&&c.updating||a.shiftAndExecuteNext(d)})})},s.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},s.addBufferListener=function(e,t,i){var a=this.sourceBuffer[e];if(a){var o=i.bind(this,e);this.listeners[e].push({event:t,listener:o}),a.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)})},u}(),ef={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},tf=function(u){var s=u;return ef.hasOwnProperty(u)&&(s=ef[u]),String.fromCharCode(s)},xa=15,Lr=100,mg={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},pg={17:2,18:4,21:6,22:8,23:10,19:13,20:15},vg={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},gg={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Eg=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],yg=function(){function u(){this.time=null,this.verboseLevel=0}return u.prototype.log=function(s,e){if(this.verboseLevel>=s){var t=typeof e=="function"?e():e;U.log(this.time+" ["+s+"] "+t)}},u}(),Pa=function(u){for(var s=[],e=0;e<u.length;e++)s.push(u[e].toString(16));return s},rf=function(){function u(e,t,i,a,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=a||"black",this.flash=o||!1}var s=u.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 a=t[i];e.hasOwnProperty(a)&&(this[a]=e[a])}},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},u}(),bg=function(){function u(e,t,i,a,o,d){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new rf(t,i,a,o,d)}var s=u.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()},u}(),_g=function(){function u(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<Lr;t++)this.chars.push(new bg);this.logger=e,this.pos=0,this.currPenState=new rf}var s=u.prototype;return s.equals=function(e){for(var t=!0,i=0;i<Lr;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<Lr;t++)this.chars[t].copy(e.chars[t])},s.isEmpty=function(){for(var e=!0,t=0;t<Lr;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>Lr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Lr)},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=tf(e);this.pos>=Lr?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<Lr;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<Lr;i++){var a=this.chars[i].uchar;a!==" "&&(t=!1),e.push(a)}return t?"":e.join("")},s.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},u}(),fd=function(){function u(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<xa;t++)this.rows.push(new _g(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var s=u.prototype;return s.reset=function(){for(var e=0;e<xa;e++)this.rows[e].clear();this.currRow=14},s.equals=function(e){for(var t=!0,i=0;i<xa;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<xa;t++)this.rows[t].copy(e.rows[t])},s.isEmpty=function(){for(var e=!0,t=0;t<xa;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<xa;i++)this.rows[i].clear();var a=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){var d=o.rows[a].cueStartTime,c=this.logger.time;if(d&&c!==null&&d<c)for(var f=0;f<this.nrRollUpRows;f++)this.rows[t-this.nrRollUpRows+f+1].copy(o.rows[a+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="",a=-1,o=0;o<xa;o++){var d=this.rows[o].getTextString();d&&(a=o+1,e?t.push("Row "+a+": '"+d+"'"):t.push(d.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join(`
|
|
34
|
-
`)),i},s.getTextAndFormat=function(){return this.rows},u}(),af=function(){function u(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 fd(i),this.nonDisplayedMemory=new fd(i),this.lastOutputScreen=new fd(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var s=u.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 a=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,function(){return a+": "+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))},u}(),nf=function(){function u(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var a=new yg;this.channels=[null,new af(e,t,a),new af(e+1,i,a)],this.cmdHistory={a:null,b:null},this.logger=a}var s=u.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,a,o,d=!1;this.logger.time=e;for(var c=0;c<t.length;c+=2)if(a=127&t[c],o=127&t[c+1],a!==0||o!==0){if(this.logger.log(3,"["+Pa([t[c],t[c+1]])+"] -> ("+Pa([a,o])+")"),(i=this.parseCmd(a,o))||(i=this.parseMidrow(a,o)),i||(i=this.parsePAC(a,o)),i||(i=this.parseBackgroundAttributes(a,o)),!i&&(d=this.parseChars(a,o))){var f=this.currentChannel;f&&f>0?this.channels[f].insertChars(d):this.logger.log(2,"No channel found yet. TEXT-MODE?")}i||d||this.logger.log(2,"Couldn't parse cleaned data "+Pa([a,o])+" 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(sf(e,t,i))return vn(null,null,i),this.logger.log(3,"Repeated command ("+Pa([e,t])+") is dropped"),!0;var a=e===20||e===21||e===23?1:2,o=this.channels[a];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),vn(e,t,i),this.currentChannel=a,!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 a=this.channels[i];return!!a&&(a.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Pa([e,t])+")"),!0)}return!1},s.parsePAC=function(e,t){var i,a=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(sf(e,t,a))return vn(null,null,a),!0;var o=e<=23?1:2;i=t>=64&&t<=95?o===1?mg[e]:vg[e]:o===1?pg[e]:gg[e];var d=this.channels[o];return!!d&&(d.setPAC(this.interpretPAC(i,t)),vn(e,t,a),this.currentChannel=o,!0)},s.interpretPAC=function(e,t){var i,a={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,a.underline=(1&i)==1,i<=13?a.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(a.italics=!0,a.color="white"):a.indent=4*Math.floor((i-16)/2),a},s.parseChars=function(e,t){var i,a,o=null,d=null;if(e>=25?(i=2,d=e-8):(i=1,d=e),d>=17&&d<=19?(a=d===17?t+80:d===18?t+112:t+144,this.logger.log(2,"Special char '"+tf(a)+"' in channel "+i),o=[a]):e>=32&&e<=127&&(o=t===0?[e]:[e,t]),o){var c=Pa(o);this.logger.log(3,"Char codes = "+c.join(",")),vn(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 a={};e===16||e===24?(i=Math.floor((t-32)/2),a.background=Eg[i],t%2==1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));var o=e<=23?1:2;return this.channels[o].setBkgData(a),vn(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)}},u}();function vn(u,s,e){e.a=u,e.b=s}function sf(u,s,e){return e.a===u&&e.b===s}var Zo=function(){function u(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=u.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},u}(),md=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var u=["","lr","rl"],s=["start","middle","end","left","right"];function e(o,d){if(typeof d!="string"||!Array.isArray(o))return!1;var c=d.toLowerCase();return!!~o.indexOf(c)&&c}function t(o){return e(s,o)}function i(o){for(var d=arguments.length,c=new Array(d>1?d-1:0),f=1;f<d;f++)c[f-1]=arguments[f];for(var h=1;h<arguments.length;h++){var p=arguments[h];for(var E in p)o[E]=p[E]}return o}function a(o,d,c){var f=this,h={enumerable:!0};f.hasBeenReset=!1;var p="",E=!1,b=o,A=d,w=c,D=null,S="",L=!0,N="auto",P="start",V=50,Y="middle",j=50,ie="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 w},set:function(Q){w=""+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(ce){return e(u,ce)}(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 L},set:function(Q){L=!!Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",i({},h,{get:function(){return N},set:function(Q){if(typeof Q!="number"&&Q!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");N=Q,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",i({},h,{get:function(){return P},set:function(Q){var X=t(Q);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(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 ie},set:function(Q){var X=t(Q);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");ie=X,this.hasBeenReset=!0}})),f.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}(),Tg=function(){function u(){}return u.prototype.decode=function(s,e){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},u}();function of(u){function s(t,i,a,o){return 3600*(0|t)+60*(0|i)+(0|a)+parseFloat(o||0)}var e=u.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 Ag=function(){function u(){this.values=Object.create(null)}var s=u.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 a=0;a<i.length;++a)if(t===i[a]){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},u}();function lf(u,s,e,t){var i=t?u.split(t):[u];for(var a in i)if(typeof i[a]=="string"){var o=i[a].split(e);o.length===2&&s(o[0],o[1])}}var pd=new md(0,0,""),Jo=pd.align==="middle"?"middle":"center";function Sg(u,s,e){var t=u;function i(){var o=of(u);if(o===null)throw new Error("Malformed timestamp: "+t);return u=u.replace(/^[^\sa-zA-Z-]+/,""),o}function a(){u=u.replace(/^\s+/,"")}if(a(),s.startTime=i(),a(),u.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+t);u=u.slice(3),a(),s.endTime=i(),a(),function(o,d){var c=new Ag;lf(o,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",Jo,"end"]);break;case"position":b=E.split(","),c.percent(p,b[0]),b.length===2&&c.alt("positionAlign",b[1],["start",Jo,"end","line-left","line-right","auto"]);break;case"size":c.percent(p,E);break;case"align":c.alt(p,E,["start",Jo,"end","left","right"])}},/:/,/\s/),d.region=c.get("region",null),d.vertical=c.get("vertical","");var f=c.get("line","auto");f==="auto"&&pd.line===-1&&(f=-1),d.line=f,d.lineAlign=c.get("lineAlign","start"),d.snapToLines=c.get("snapToLines",!0),d.size=c.get("size",100),d.align=c.get("align",Jo);var h=c.get("position","auto");h==="auto"&&pd.position===50&&(h=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=h}(u,s)}function uf(u){return u.replace(/<br(?: \/)?>/gi,`
|
|
35
|
-
`)}var
|
|
36
|
-
`;)++
|
|
37
|
-
`&&++
|
|
33
|
+
Aborting and switching to level `+Q),e.loader&&(this.fragCurrent=this.partCurrent=null,e.abortRequests()),i.trigger(k.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:c}))}}}}}}},s.onFragLoaded=function(e,t){var i=t.frag,a=t.part,l=a?a.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=a?a.duration:i.duration,c=this.hls.levels[i.level],h=(c.loaded?c.loaded.bytes:0)+l.loaded,f=(c.loaded?c.loaded.duration:0)+u;c.loaded={bytes:h,duration:f},c.realBitrate=Math.round(8*h/f)}if(i.bitrateTest){var p={stats:l,frag:i,part:a,id:i.type};this.onFragBuffered(k.FRAG_BUFFERED,p),i.bitrateTest=!1}}},s.onFragBuffered=function(e,t){var i=t.frag,a=t.part,l=a!=null&&a.stats.loaded?a.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,a=i.maxAutoLevel,l=i.config,u=i.minAutoLevel,c=i.media,h=t?t.duration:e?e.duration:0,f=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)/f,A=this.findBestLevel(p,u,a,b,l.abrBandWidthFactor,l.abrBandWidthUpFactor);if(A>=0)return A;B.trace("[abr] "+(b?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var w=h?Math.min(h,l.maxStarvationDelay):l.maxStarvationDelay,D=l.abrBandWidthFactor,S=l.abrBandWidthUpFactor;if(!b){var L=this.bitrateTestDelay;L&&(w=(h?Math.min(h,l.maxLoadingDelay):l.maxLoadingDelay)-L,B.trace("[abr] bitrate test took "+Math.round(1e3*L)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*w)+" ms"),D=S=1)}return A=this.findBestLevel(p,u,a,b+w,D,S),Math.max(A,0)},s.findBestLevel=function(e,t,i,a,l,u){for(var c,h=this.fragCurrent,f=this.partCurrent,p=this.lastLoadedFragLevel,E=this.hls.levels,b=E[p],A=!(b==null||(c=b.details)==null||!c.live),w=b==null?void 0:b.codecSet,D=f?f.duration:h?h.duration:0,S=this.bwEstimator.getEstimateTTFB()/1e3,L=t,N=-1,P=i;P>=t;P--){var V=E[P];if(!V||w&&V.codecSet!==w)V&&(L=Math.min(P,L),N=Math.max(P,N));else{N!==-1&&B.trace("[abr] Skipped level(s) "+L+"-"+N+' with CODECS:"'+E[N].attrs.CODECS+'"; not compatible with "'+b.attrs.CODECS+'"');var Y=V.details,j=(f?Y==null?void 0:Y.partTarget:Y==null?void 0:Y.averagetargetduration)||D,ie=void 0;ie=P<=p?l*e:u*e;var Q=E[P].maxBitrate,X=this.getTimeToLoadFrag(S,ie,Q*j,Y===void 0);if(B.trace("[abr] level:"+P+" adjustedbw-bitrate:"+Math.round(ie-Q)+" avgDuration:"+j.toFixed(1)+" maxFetchDuration:"+a.toFixed(1)+" fetchDuration:"+X.toFixed(1)),ie>Q&&(X===0||!re(X)||A&&!this.bitrateTestDelay||X<a))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 a=this.hls.levels;if(a.length>Math.max(e,i)&&a[e].loadError<=a[i].loadError)return e}return e!==-1&&(i=Math.min(e,i)),i},set:function(e){this._nextAutoLevel=e}}]),d}(),Xh=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(a,l){for(var u=new Uint8Array(l),c=0,h=0;h<a.length;h++){var f=a[h];u.set(f,c),c+=f.length}return u}(t,i),this.reset(),e):new Uint8Array(0)},s.reset=function(){this.chunks.length=0,this.dataLength=0},d}(),lg=function(d){function s(t,i,a){var l;return(l=d.call(this,t,i,a,"[audio-stream-controller]",Di)||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(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(k.ERROR,this.onError,this),t.on(k.BUFFER_RESET,this.onBufferReset,this),t.on(k.BUFFER_CREATED,this.onBufferCreated,this),t.on(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(k.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(k.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(k.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(k.ERROR,this.onError,this),t.off(k.BUFFER_RESET,this.onBufferReset,this),t.off(k.BUFFER_CREATED,this.onBufferCreated,this),t.off(k.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(k.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(k.FRAG_BUFFERED,this.onFragBuffered,this)},e.onInitPtsFound=function(t,i){var a=i.frag,l=i.id,u=i.initPTS,c=i.timescale;if(l==="main"){var h=a.cc;this.initPTS[a.cc]={baseTime:u,timescale:c},this.log("InitPTS for cc: "+h+" found from main: "+u),this.videoTrackCC=h,this.state===bs&&this.tick()}},e.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=Ut);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=De):(this.loadedmetadata=!1,this.state=Ca),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},e.doTick=function(){switch(this.state){case De:this.doTickIdle();break;case Ca:var t,i=this.levels,a=this.trackId,l=i==null||(t=i[a])==null?void 0:t.details;if(l){if(this.waitForCdnTuneIn(l))break;this.state=bs}break;case Jr:var u,c=performance.now(),h=this.retryDate;(!h||c>=h||(u=this.media)!=null&&u.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=De);break;case bs:var f=this.waitingData;if(f){var p=f.frag,E=f.part,b=f.cache,A=f.complete;if(this.initPTS[p.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=Zr;var w={frag:p,part:E,payload:b.flush(),networkDetails:null};this._handleFragmentLoadProgress(w),A&&d.prototype._handleFragmentLoadComplete.call(this,w)}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=he.bufferInfo(this.mediaBuffer,D,this.config.maxBufferHole);cn(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=De}this.onTickEnd()},e.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=De)},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,a=this.media,l=this.trackId,u=t.config;if(i!=null&&i[l]&&(a||!this.startFragRequested&&u.startFragPrefetch)){var c=i[l],h=c.details;if(!h||h.live&&this.levelLastLoaded!==l||this.waitForCdnTuneIn(h))this.state=Ca;else{var f=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&f&&(this.bufferFlushed=!1,this.afterBufferFlushed(f,Et,Di));var p=this.getFwdBufferInfo(f,Di);if(p!==null){var E=this.bufferedTrack,b=this.switchingTrack;if(!b&&this._streamEnded(p,h))return t.trigger(k.BUFFER_EOS,{type:"audio"}),void(this.state=ys);var A=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,rt),w=p.len,D=this.getMaxBufferLength(A==null?void 0:A.len);if(!(w>=D)||b){var S=h.fragments[0].start,L=p.end;if(b&&a){var N=this.getLoadPosition();E&&b.attrs!==E.attrs&&(L=N),h.PTSKnown&&N<S&&(p.end>S||p.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),a.currentTime=S+.05)}var P=this.getNextFragment(L,h),V=!1;if(P&&this.isLoopLoading(P,L)&&(V=!!P.gap,P=this.getNextFragmentLoopLoading(P,h,p,rt,D)),P){var Y=A&&P.start>A.end+h.targetduration;if(Y||(A==null||!A.len)&&p.len){var j=this.getAppendedFrag(P.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(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 a=i.audioTracks;this.resetTransmuxer(),this.levels=a.map(function(l){return new wa(l)})},e.onAudioTrackSwitching=function(t,i){var a=!!i.url;this.trackId=i.id;var l=this.fragCurrent;l&&(l.abortRequests(),this.removeUnbufferedFrags(l.start)),this.resetLoadingState(),a?this.setInterval(100):this.resetTransmuxer(),a?(this.switchingTrack=i,this.state=De):(this.switchingTrack=null,this.bufferedTrack=i,this.state=Ut),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(k.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},e.onAudioTrackLoaded=function(t,i){var a;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+"]"+(u.lastPartSn?"[part-"+u.lastPartSn+"-"+u.lastPartIndex+"]":"")+",duration:"+u.totalduration);var h=l[c],f=0;if(u.live||(a=h.details)!=null&&a.live){var p=this.mainDetails;if(u.fragments[0]||(u.deltaUpdateFailed=!0),u.deltaUpdateFailed||!p)return;!h.details&&u.hasProgramDateTime&&p.hasProgramDateTime?(Ot(u,p),f=u.fragments[0].start):f=this.alignPlaylists(u,h.details)}h.details=u,this.levelLastLoaded=c,this.startFragRequested||!this.mainDetails&&u.live||this.setStartPosition(h.details,f),this.state!==Ca||this.waitForCdnTuneIn(u)||(this.state=De),this.tick()}else this.warn("Audio tracks were reset while loading level "+c)}else this.cachedTrackLoadedData=i},e._handleFragmentLoadProgress=function(t){var i,a=t.frag,l=t.part,u=t.payload,c=this.config,h=this.trackId,f=this.levels;if(f){var p=f[h];if(p){var E=p.details;if(!E)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(a.start);var b=c.defaultAudioCodec||p.audioCodec||"mp4a.40.2",A=this.transmuxer;A||(A=this.transmuxer=new Qh(this.hls,Di,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var w=this.initPTS[a.cc],D=(i=a.initSegment)==null?void 0:i.data;if(w!==void 0){var S=l?l.index:-1,L=S!==-1,N=new fe(a.level,a.sn,a.stats.chunkCount,u.byteLength,S,L);A.push(u,D,b,"",a,l,E.totalduration,!1,N,w)}else this.log("Unknown video PTS for cc "+a.cc+", waiting for video PTS before demuxing audio frag "+a.sn+" of ["+E.startSN+" ,"+E.endSN+"],track "+h),(this.waitingData=this.waitingData||{frag:a,part:l,cache:new Xh,complete:!1}).cache.push(new Uint8Array(u)),this.waitingVideoCC=this.videoTrackCC,this.state=bs}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 "+a.sn+" of level "+a.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 a=i.tracks.audio;a&&(this.mediaBuffer=a.buffer||null),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer||null)},e.onFragBuffered=function(t,i){var a=i.frag,l=i.part;if(a.type===Di)if(this.fragContextChanged(a))this.warn("Fragment "+a.sn+(l?" p: "+l.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+(this.switchingTrack?this.switchingTrack.name:"false"));else{if(a.sn!=="initSegment"){this.fragPrevious=a;var u=this.switchingTrack;u&&(this.bufferedTrack=u,this.switchingTrack=null,this.hls.trigger(k.AUDIO_TRACK_SWITCHED,y({},u)))}this.fragBufferedComplete(a,l)}else if(!this.loadedmetadata&&a.type===rt){var c=this.videoBuffer||this.media;c&&he.getBuffered(c).length&&(this.loadedmetadata=!0)}},e.onError=function(t,i){var a;if(i.fatal)this.state=hn;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(Di,i);break;case W.AUDIO_TRACK_LOAD_ERROR:case W.AUDIO_TRACK_LOAD_TIMEOUT:case W.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==Ca||((a=i.context)==null?void 0:a.type)!==yi||(this.state=De);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===Et&&(this.bufferFlushed=!0,this.state===ys&&(this.state=De))},e._handleTransmuxComplete=function(t){var i,a="audio",l=this.hls,u=t.remuxResult,c=t.chunkMeta,h=this.getCurrentContext(c);if(h){var f=h.frag,p=h.part,E=h.level.details,b=u.audio,A=u.text,w=u.id3,D=u.initSegment;if(!this.fragContextChanged(f)&&E){if(this.state=wr,this.switchingTrack&&b&&this.completeAudioSwitch(this.switchingTrack),D!=null&&D.tracks){var S=f.initSegment||f;this._bufferInitSegment(D.tracks,S,c),l.trigger(k.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:a,tracks:D.tracks})}if(b){var L=b.startPTS,N=b.endPTS,P=b.startDTS,V=b.endDTS;p&&(p.elementaryStreams[Et]={startPTS:L,endPTS:N,startDTS:P,endDTS:V}),f.setElementaryStreamInfo(Et,L,N,P,V),this.bufferFragmentData(b,f,p,c)}if(w!=null&&(i=w.samples)!=null&&i.length){var Y=H({id:a,frag:f,details:E},w);l.trigger(k.FRAG_PARSING_METADATA,Y)}if(A){var j=H({id:a,frag:f,details:E},A);l.trigger(k.FRAG_PARSING_USERDATA,j)}}else this.fragmentTracker.removeFragment(f)}else this.resetWhenMissingContext(c)},e._bufferInitSegment=function(t,i,a){if(this.state===wr){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(k.BUFFER_CODECS,t);var u=l.initSegment;if(u!=null&&u.byteLength){var c={type:"audio",frag:i,part:null,chunkMeta:a,parent:i.type,data:u};this.hls.trigger(k.BUFFER_APPENDING,c)}this.tick()}}},e.loadFragment=function(t,i,a){var l,u=this.fragmentTracker.getState(t);this.fragCurrent=t,this.switchingTrack||u===Z||u===Te?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=bs):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,a)):this.clearTrackerIfNeeded(t)},e.completeAudioSwitch=function(t){var i=this.hls,a=this.media,l=this.bufferedTrack,u=l==null?void 0:l.attrs,c=t.attrs;a&&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(k.AUDIO_TRACK_SWITCHED,y({},t))},s}(Jd),dg=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(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_PARSED,this.onManifestParsed,this),t.on(k.LEVEL_LOADING,this.onLevelLoading,this),t.on(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(k.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_PARSED,this.onManifestParsed,this),t.off(k.LEVEL_LOADING,this.onLevelLoading,this),t.off(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(k.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(k.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 a=i.id,l=i.groupId,u=i.details,c=this.tracksInGroup[a];if(c&&c.groupId===l){var h=c.details;c.details=i.details,this.log("audio-track "+a+' "'+c.name+'" lang:'+c.lang+" group:"+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),a===this.trackId&&this.playlistLoaded(a,i,h)}else this.warn("Track with id:"+a+" 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 a=i.audioGroupIds[i.urlId];if(this.groupId!==a){this.groupId=a||null;var l=this.tracks.filter(function(c){return!a||c.groupId===a});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:"+a),this.hls.trigger(k.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===yi&&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 a=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(k.AUDIO_TRACK_SWITCHING,y({},l)),!l.details||l.details.live){var h=this.switchParams(l.url,a==null?void 0:a.details);this.loadPlaylist(h)}}},e.selectInitialTrack=function(){var t=this.tracksInGroup,i=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(i!==-1)this.setAudioTrack(i);else{var a=new Error("No track found for running audio group-ID: "+this.groupId+" track count: "+t.length);this.warn(a.message),this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:a})}},e.findTrackId=function(t){for(var i=this.tracksInGroup,a=0;a<i.length;a++){var l=i[a];if((!this.selectDefaultTrack||l.default)&&(!t||t.attrs["STABLE-RENDITION-ID"]!==void 0&&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 a=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 "+a+' "'+i.name+'" lang:'+i.lang+" group:"+l),this.clearTimer(),this.hls.trigger(k.AUDIO_TRACK_LOADING,{url:u,id:a,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}(x);function Zh(d,s){if(d.length!==s.length)return!1;for(var e=0;e<d.length;e++)if(!ug(d[e].attrs,s[e].attrs))return!1;return!0}function ug(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 cg=function(d){function s(t,i,a){var l;return(l=d.call(this,t,i,a,"[subtitle-stream-controller]",Oi)||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(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.LEVEL_LOADED,this.onLevelLoaded,this),t.on(k.ERROR,this.onError,this),t.on(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(k.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(k.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(k.FRAG_BUFFERED,this.onFragBuffered,this)},e._unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.LEVEL_LOADED,this.onLevelLoaded,this),t.off(k.ERROR,this.onError,this),t.off(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(k.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(k.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(k.FRAG_BUFFERED,this.onFragBuffered,this)},e.startLoad=function(t){this.stopLoad(),this.state=De,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 a=i.frag,l=i.success;if(this.fragPrevious=a,this.state=De,l){var u=this.tracksBuffered[this.currentTrackId];if(u){for(var c,h=a.start,f=0;f<u.length;f++)if(h>=u[f].start&&h<=u[f].end){c=u[f];break}var p=a.start+a.duration;c?c.end=p:(c={start:h,end:p},u.push(c)),this.fragmentTracker.fragBuffered(a)}}},e.onBufferFlushing=function(t,i){var a=i.startOffset,l=i.endOffset;if(a===0&&l!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,c=this.levels;if(!c.length||!c[u]||!c[u].details)return;var h=l-c[u].details.targetduration;if(h<=0)return;i.endOffsetSubtitles=Math.max(0,h),this.tracksBuffered.forEach(function(f){for(var p=0;p<f.length;)if(f[p].end<=h)f.shift();else{if(!(f[p].start<h))break;f[p].start=h,p++}}),this.fragmentTracker.removeFragmentsInRange(a,h,Oi)}},e.onFragBuffered=function(t,i){var a;this.loadedmetadata||i.frag.type!==rt||(a=this.media)!=null&&a.buffered.length&&(this.loadedmetadata=!0)},e.onError=function(t,i){var a=i.frag;(a==null?void 0:a.type)===Oi&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Ut&&(this.state=De))},e.onSubtitleTracksUpdated=function(t,i){var a=this,l=i.subtitleTracks;Zh(this.levels,l)?this.levels=l.map(function(u){return new wa(u)}):(this.tracksBuffered=[],this.levels=l.map(function(u){var c=new wa(u);return a.tracksBuffered[c.id]=[],c}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Oi),this.fragPrevious=null,this.mediaBuffer=null)},e.onSubtitleTrackSwitch=function(t,i){if(this.currentTrackId=i.id,this.levels.length&&this.currentTrackId!==-1){var a=this.levels[this.currentTrackId];a!=null&&a.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,a&&this.setInterval(500)}else this.clearInterval()},e.onSubtitleTrackLoaded=function(t,i){var a,l=i.details,u=i.id,c=this.currentTrackId,h=this.levels;if(h.length){var f=h[c];if(!(u>=h.length||u!==c)&&f){this.mediaBuffer=this.mediaBufferTimeRanges;var p=0;if(l.live||(a=f.details)!=null&&a.live){var E=this.mainDetails;if(l.deltaUpdateFailed||!E)return;var b=E.fragments[0];f.details?(p=this.alignPlaylists(l,f.details))===0&&b&&Ia(l,p=b.start):l.hasProgramDateTime&&E.hasProgramDateTime?(Ot(l,E),p=l.fragments[0].start):b&&Ia(l,p=b.start)}f.details=l,this.levelLastLoaded=u,this.startFragRequested||!this.mainDetails&&l.live||this.setStartPosition(f.details,p),this.tick(),l.live&&!this.fragCurrent&&this.media&&this.state===De&&(Ra(null,l.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),f.details=void 0))}}},e._handleFragmentLoadComplete=function(t){var i=this,a=t.frag,l=t.payload,u=a.decryptdata,c=this.hls;if(!this.fragContextChanged(a)&&l&&l.byteLength>0&&u&&u.key&&u.iv&&u.method==="AES-128"){var h=performance.now();this.decrypter.decrypt(new Uint8Array(l),u.key.buffer,u.iv.buffer).catch(function(f){throw c.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.FRAG_DECRYPT_ERROR,fatal:!1,error:f,reason:f.message,frag:a}),f}).then(function(f){var p=performance.now();c.trigger(k.FRAG_DECRYPTED,{frag:a,payload:f,stats:{tstart:h,tdecrypt:p}})}).catch(function(f){i.warn(f.name+": "+f.message),i.state=De})}},e.doTick=function(){if(this.media){if(this.state===De){var t=this.currentTrackId,i=this.levels,a=i[t];if(!i.length||!a||!a.details)return;var l=a.details,u=l.targetduration,c=this.config,h=this.getLoadPosition(),f=he.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],h-u,c.maxBufferHole),p=f.end,E=f.len,b=this.getFwdBufferInfo(this.media,rt);if(E>this.getMaxBufferLength(b==null?void 0:b.len)+u)return;var A=l.fragments,w=A.length,D=l.edge,S=null,L=this.fragPrevious;if(p<D){var N=c.maxFragLookUpTolerance;!(S=Ra(L,A,Math.max(A[0].start,p),N))&&L&&L.start<A[0].start&&(S=A[0])}else S=A[w-1];if(!S)return;S=this.mapToInitFragWhenRequired(S),this.fragmentTracker.getState(S)===Z&&this.loadFragment(S,a,p)}}else this.state=De},e.getMaxBufferLength=function(t){var i=d.prototype.getMaxBufferLength.call(this);return t?Math.max(i,t):i},e.loadFragment=function(t,i,a){this.fragCurrent=t,t.sn==="initSegment"?this._loadInitSegment(t,i):(this.startFragRequested=!0,d.prototype.loadFragment.call(this,t,i,a))},M(s,[{key:"mediaBufferTimeRanges",get:function(){return new hg(this.tracksBuffered[this.currentTrackId]||[])}}]),s}(Jd),hg=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)}}},fg=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(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(k.MANIFEST_LOADING,this.onManifestLoading,this),t.on(k.MANIFEST_PARSED,this.onManifestParsed,this),t.on(k.LEVEL_LOADING,this.onLevelLoading,this),t.on(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(k.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(k.MANIFEST_LOADING,this.onManifestLoading,this),t.off(k.MANIFEST_PARSED,this.onManifestParsed,this),t.off(k.LEVEL_LOADING,this.onLevelLoading,this),t.off(k.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(k.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(k.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),hu(this.media.textTracks).forEach(function(t){Xr(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 a=i.id,l=i.details,u=this.trackId,c=this.tracksInGroup[u];if(c){var h=c.details;c.details=i.details,this.log("subtitle track "+a+" loaded ["+l.startSN+"-"+l.endSN+"]"),a===this.trackId&&this.playlistLoaded(a,i,h)}else this.warn("Invalid subtitle track id "+a)},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 a=i.textGroupIds[i.urlId],l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==a){var u=this.tracks.filter(function(f){return!a||f.groupId===a});this.tracksInGroup=u;var c=this.findTrackId(l==null?void 0:l.name)||this.findTrackId();this.groupId=a||null;var h={subtitleTracks:u};this.log("Updating subtitle tracks, "+u.length+' track(s) found in "'+a+'" group-id'),this.hls.trigger(k.SUBTITLE_TRACKS_UPDATED,h),c!==-1&&this.setSubtitleTrack(c,l)}else this.shouldReloadPlaylist(l)&&this.setSubtitleTrack(this.trackId,l)}},e.findTrackId=function(t){for(var i=this.tracksInGroup,a=0;a<i.length;a++){var l=i[a];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===zi&&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 a=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 "+a),this.hls.trigger(k.SUBTITLE_TRACK_LOADING,{url:u,id:a,groupId:l,deliveryDirectives:t||null})}},e.toggleTrackModes=function(t){var i=this,a=this.media,l=this.trackId;if(a){var u=hu(a.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 h=c[l];h&&(h.mode="disabled")}var f=c[t];f&&(f.mode=this.subtitleDisplay?"showing":"hidden")}},e.setSubtitleTrack=function(t,i){var a,l=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(t===-1||(a=l[t])!=null&&a.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,h=u.groupId,f=h===void 0?"":h,p=u.name,E=u.type,b=u.url;this.hls.trigger(k.SUBTITLE_TRACK_SWITCH,{id:c,groupId:f,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(k.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=hu(this.media.textTracks),a=0;a<i.length;a++)if(i[a].mode==="hidden")t=a;else if(i[a].mode==="showing"){t=a;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 hu(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 mg=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}),a={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(a,e),i},s.executeNext=function(e){var t=this.buffers,i=this.queues,a=t[e],l=i[e];if(l.length){var u=l[0];try{u.execute()}catch(c){B.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),u.onError(c),a!=null&&a.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}(),Jh=nn(),ef=/([ha]vc.)(?:\.[^.,]+)+/,pg=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,a=t.mediaSource;B.log("[buffer-controller]: Media source opened"),i&&(i.removeEventListener("emptied",t._onMediaEmptied),t.updateMediaElementDuration(),t.hls.trigger(k.MEDIA_ATTACHED,{media:i})),a&&a.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){B.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){B.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=function(){var i=t.media,a=t._objectUrl;i&&i.src!==a&&B.error("Media element src was set while attaching MediaSource ("+a+" > "+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(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.BUFFER_RESET,this.onBufferReset,this),e.on(k.BUFFER_APPENDING,this.onBufferAppending,this),e.on(k.BUFFER_CODECS,this.onBufferCodecs,this),e.on(k.BUFFER_EOS,this.onBufferEos,this),e.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(k.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(k.FRAG_PARSED,this.onFragParsed,this),e.on(k.FRAG_CHANGED,this.onFragChanged,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.BUFFER_RESET,this.onBufferReset,this),e.off(k.BUFFER_APPENDING,this.onBufferAppending,this),e.off(k.BUFFER_CODECS,this.onBufferCodecs,this),e.off(k.BUFFER_EOS,this.onBufferEos,this),e.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(k.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(k.FRAG_PARSED,this.onFragParsed,this),e.off(k.FRAG_CHANGED,this.onFragChanged,this)},s._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new mg(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,B.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},s.onMediaAttaching=function(e,t){var i=this.media=t.media;if(i&&Jh){var a=this.mediaSource=new Jh;a.addEventListener("sourceopen",this._onMediaSourceOpen),a.addEventListener("sourceended",this._onMediaSourceEnded),a.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(a),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(B.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(a){B.warn("[buffer-controller]: onMediaDetaching: "+a.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()):B.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(k.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(a){B.warn("[buffer-controller]: Failed to reset the "+t+" buffer",a)}}),this._initSourceBuffer()},s.onBufferCodecs=function(e,t){var i=this,a=this.getSourceBufferTypes().length;Object.keys(t).forEach(function(l){if(a){var u=i.tracks[l];if(u&&typeof u.buffer.changeType=="function"){var c=t[l],h=c.id,f=c.codec,p=c.levelCodec,E=c.container,b=c.metadata,A=(u.levelCodec||u.codec).replace(ef,"$1"),w=(p||f).replace(ef,"$1");if(A!==w){var D=E+";codecs="+(p||f);i.appendChangeType(l,D),B.log("[buffer-controller]: switching codec "+A+" to "+w),i.tracks[l]={buffer:u.buffer,codec:f,container:E,levelCodec:p,metadata:b,id:h}}}}else i.pendingTracks[l]=t[l]}),a||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},s.appendChangeType=function(e,t){var i=this,a=this.operationQueue,l={execute:function(){var u=i.sourceBuffer[e];u&&(B.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),u.changeType(t)),a.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(u){B.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",u)}};a.append(l,e)},s.onBufferAppending=function(e,t){var i=this,a=this.hls,l=this.operationQueue,u=this.tracks,c=t.data,h=t.type,f=t.frag,p=t.part,E=t.chunkMeta,b=E.buffering[h],A=self.performance.now();b.start=A;var w=f.stats.buffering,D=p?p.stats.buffering:null;w.start===0&&(w.start=A),D&&D.start===0&&(D.start=A);var S=u.audio,L=!1;h==="audio"&&(S==null?void 0:S.container)==="audio/mpeg"&&(L=!this.lastMpegAudioChunk||E.id===1||this.lastMpegAudioChunk.sn!==E.sn,this.lastMpegAudioChunk=E);var N=f.start,P={execute:function(){if(b.executeStart=self.performance.now(),L){var V=i.sourceBuffer[h];if(V){var Y=N-V.timestampOffset;Math.abs(Y)>=.1&&(B.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+N+" (delta: "+Y+") sn: "+f.sn+")"),V.timestampOffset=N)}}i.appendExecutor(c,h)},onStart:function(){},onComplete:function(){var V=self.performance.now();b.executeEnd=b.end=V,w.first===0&&(w.first=V),D&&D.first===0&&(D.first=V);var Y=i.sourceBuffer,j={};for(var ie in Y)j[ie]=he.getBuffered(Y[ie]);i.appendError=0,i.hls.trigger(k.BUFFER_APPENDED,{type:h,frag:f,part:p,chunkMeta:E,parent:f.type,timeRanges:j})},onError:function(V){B.error("[buffer-controller]: Error encountered while trying to append to the "+h+" SourceBuffer",V);var Y={type:se.MEDIA_ERROR,parent:f.type,details:W.BUFFER_APPEND_ERROR,frag:f,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>a.config.appendErrorMaxRetry&&(B.error("[buffer-controller]: Failed "+a.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),Y.fatal=!0)),a.trigger(k.ERROR,Y)}};l.append(P,h)},s.onBufferFlushing=function(e,t){var i=this,a=this.operationQueue,l=function(u){return{execute:i.removeExecutor.bind(i,u,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(k.BUFFER_FLUSHED,{type:u})},onError:function(c){B.warn("[buffer-controller]: Failed to remove from "+u+" SourceBuffer",c)}}};t.type?a.append(l(t.type),t.type):this.getSourceBufferTypes().forEach(function(u){a.append(l(u),u)})},s.onFragParsed=function(e,t){var i=this,a=t.frag,l=t.part,u=[],c=l?l.elementaryStreams:a.elementaryStreams;c[tr]?u.push("audiovideo"):(c[Et]&&u.push("audio"),c[Ct]&&u.push("video")),u.length===0&&B.warn("Fragments must have at least one ElementaryStreamType set. type: "+a.type+" level: "+a.level+" sn: "+a.sn),this.blockBuffers(function(){var h=self.performance.now();a.stats.buffering.end=h,l&&(l.stats.buffering.end=h);var f=l?l.stats:a.stats;i.hls.trigger(k.FRAG_BUFFERED,{frag:a,part:l,stats:f,id:a.type})},u)},s.onFragChanged=function(e,t){this.flushBackBuffer()},s.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce(function(a,l){var u=i.sourceBuffer[l];return!u||t.type&&t.type!==l||(u.ending=!0,u.ended||(u.ended=!0,B.log("[buffer-controller]: "+l+" sourceBuffer now EOS"))),a&&!(u&&!u.ended)},!0)&&(B.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){i.getSourceBufferTypes().forEach(function(l){var u=i.sourceBuffer[l];u&&(u.ending=!1)});var a=i.mediaSource;a&&a.readyState==="open"?(B.log("[buffer-controller]: Calling mediaSource.endOfStream()"),a.endOfStream()):a&&B.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+a.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,a=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(re(u)&&!(u<0)){var c=i.currentTime,h=t.levelTargetDuration,f=Math.max(u,h),p=Math.floor(c/h)*h-f;l.forEach(function(E){var b=a[E];if(b){var A=he.getBuffered(b);if(A.length>0&&p>A.start(0)){if(e.trigger(k.BACK_BUFFER_REACHED,{bufferEnd:p}),t.live)e.trigger(k.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p});else if(b.ended&&A.end(A.length-1)-c<2*h)return void B.info("[buffer-controller]: Cannot flush "+E+" back buffer while SourceBuffer is in ended state");e.trigger(k.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,a=this.mediaSource,l=e.fragments[0].start+e.totalduration,u=i.duration,c=re(a.duration)?a.duration:0;e.live&&t.config.liveDurationInfinity?(B.log("[buffer-controller]: Media Source duration is set to Infinity"),a.duration=1/0,this.updateSeekableRange(e)):(l>c&&l>u||!re(u))&&(B.log("[buffer-controller]: Updating Media Source duration to "+l.toFixed(3)),a.duration=l)}},s.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){var a=Math.max(0,i[0].start),l=Math.max(a,a+e.totalduration);t.setLiveSeekableRange(a,l)}},s.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,a=Object.keys(i).length;if(a&&!e||a===2){this.createSourceBuffers(i),this.pendingTracks={};var l=this.getSourceBufferTypes();if(l.length)this.hls.trigger(k.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(k.ERROR,{type:se.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 a in e)if(!t[a]){var l=e[a];if(!l)throw Error("source buffer exists for track "+a+", however track does not");var u=l.levelCodec||l.codec,c=l.container+";codecs="+u;B.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var h=t[a]=i.addSourceBuffer(c),f=a;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[a]={buffer:h,codec:u,container:l.container,levelCodec:l.levelCodec,metadata:l.metadata,id:l.id}}catch(p){B.error("[buffer-controller]: error while trying to add sourceBuffer: "+p.message),this.hls.trigger(k.ERROR,{type:se.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");B.error("[buffer-controller]: "+i,t),this.hls.trigger(k.ERROR,{type:se.MEDIA_ERROR,details:W.BUFFER_APPENDING_ERROR,error:i,fatal:!1});var a=this.operationQueue.current(e);a&&a.onError(t)},s.removeExecutor=function(e,t,i){var a=this.media,l=this.mediaSource,u=this.operationQueue,c=this.sourceBuffer[e];if(!a||!l||!c)return B.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void u.shiftAndExecuteNext(e);var h=re(a.duration)?a.duration:1/0,f=re(l.duration)?l.duration:1/0,p=Math.max(0,t),E=Math.min(i,h,f);E>p&&!c.ending?(c.ended=!1,B.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,a=this.sourceBuffer[t];if(!a)return B.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(t);a.ended=!1,a.appendBuffer(e)},s.blockBuffers=function(e,t){var i=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length)return B.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var a=this.operationQueue,l=t.map(function(u){return a.appendBlocker(u)});Promise.all(l).then(function(){e(),t.forEach(function(u){var c=i.sourceBuffer[u];c!=null&&c.updating||a.shiftAndExecuteNext(u)})})},s.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},s.addBufferListener=function(e,t,i){var a=this.sourceBuffer[e];if(a){var l=i.bind(this,e);this.listeners[e].push({event:t,listener:l}),a.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}(),tf={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},rf=function(d){var s=d;return tf.hasOwnProperty(d)&&(s=tf[d]),String.fromCharCode(s)},xa=15,Ir=100,vg={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},gg={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},yg={25:2,26:4,29:6,30:8,31:10,27:13,28:15},bg=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],_g=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;B.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},af=function(){function d(e,t,i,a,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=a||"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 a=t[i];e.hasOwnProperty(a)&&(this[a]=e[a])}},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}(),Tg=function(){function d(e,t,i,a,l,u){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new af(t,i,a,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}(),Ag=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<Ir;t++)this.chars.push(new Tg);this.logger=e,this.pos=0,this.currPenState=new af}var s=d.prototype;return s.equals=function(e){for(var t=!0,i=0;i<Ir;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<Ir;t++)this.chars[t].copy(e.chars[t])},s.isEmpty=function(){for(var e=!0,t=0;t<Ir;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>Ir&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Ir)},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=rf(e);this.pos>=Ir?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<Ir;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<Ir;i++){var a=this.chars[i].uchar;a!==" "&&(t=!1),e.push(a)}return t?"":e.join("")},s.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},d}(),fu=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<xa;t++)this.rows.push(new Ag(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<xa;e++)this.rows[e].clear();this.currRow=14},s.equals=function(e){for(var t=!0,i=0;i<xa;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},s.copy=function(e){for(var t=0;t<xa;t++)this.rows[t].copy(e.rows[t])},s.isEmpty=function(){for(var e=!0,t=0;t<xa;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<xa;i++)this.rows[i].clear();var a=this.currRow+1-this.nrRollUpRows,l=this.lastOutputScreen;if(l){var u=l.rows[a].cueStartTime,c=this.logger.time;if(u&&c!==null&&u<c)for(var h=0;h<this.nrRollUpRows;h++)this.rows[t-this.nrRollUpRows+h+1].copy(l.rows[a+h])}}this.currRow=t;var f=this.rows[this.currRow];if(e.indent!==null){var p=e.indent,E=Math.max(p-1,0);f.setCursor(e.indent),e.color=f.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="",a=-1,l=0;l<xa;l++){var u=this.rows[l].getTextString();u&&(a=l+1,e?t.push("Row "+a+": '"+u+"'"):t.push(u.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join(`
|
|
34
|
+
`)),i},s.getTextAndFormat=function(){return this.rows},d}(),nf=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 fu(i),this.nonDisplayedMemory=new fu(i),this.lastOutputScreen=new fu(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 a=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,function(){return a+": "+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}(),sf=function(){function d(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var a=new _g;this.channels=[null,new nf(e,t,a),new nf(e+1,i,a)],this.cmdHistory={a:null,b:null},this.logger=a}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,a,l,u=!1;this.logger.time=e;for(var c=0;c<t.length;c+=2)if(a=127&t[c],l=127&t[c+1],a!==0||l!==0){if(this.logger.log(3,"["+Pa([t[c],t[c+1]])+"] -> ("+Pa([a,l])+")"),(i=this.parseCmd(a,l))||(i=this.parseMidrow(a,l)),i||(i=this.parsePAC(a,l)),i||(i=this.parseBackgroundAttributes(a,l)),!i&&(u=this.parseChars(a,l))){var h=this.currentChannel;h&&h>0?this.channels[h].insertChars(u):this.logger.log(2,"No channel found yet. TEXT-MODE?")}i||u||this.logger.log(2,"Couldn't parse cleaned data "+Pa([a,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(of(e,t,i))return vn(null,null,i),this.logger.log(3,"Repeated command ("+Pa([e,t])+") is dropped"),!0;var a=e===20||e===21||e===23?1:2,l=this.channels[a];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),vn(e,t,i),this.currentChannel=a,!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 a=this.channels[i];return!!a&&(a.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Pa([e,t])+")"),!0)}return!1},s.parsePAC=function(e,t){var i,a=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(of(e,t,a))return vn(null,null,a),!0;var l=e<=23?1:2;i=t>=64&&t<=95?l===1?vg[e]:Eg[e]:l===1?gg[e]:yg[e];var u=this.channels[l];return!!u&&(u.setPAC(this.interpretPAC(i,t)),vn(e,t,a),this.currentChannel=l,!0)},s.interpretPAC=function(e,t){var i,a={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,a.underline=(1&i)==1,i<=13?a.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(a.italics=!0,a.color="white"):a.indent=4*Math.floor((i-16)/2),a},s.parseChars=function(e,t){var i,a,l=null,u=null;if(e>=25?(i=2,u=e-8):(i=1,u=e),u>=17&&u<=19?(a=u===17?t+80:u===18?t+112:t+144,this.logger.log(2,"Special char '"+rf(a)+"' in channel "+i),l=[a]):e>=32&&e<=127&&(l=t===0?[e]:[e,t]),l){var c=Pa(l);this.logger.log(3,"Char codes = "+c.join(",")),vn(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 a={};e===16||e===24?(i=Math.floor((t-32)/2),a.background=bg[i],t%2==1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));var l=e<=23?1:2;return this.channels[l].setBkgData(a),vn(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 vn(d,s,e){e.a=d,e.b=s}function of(d,s,e){return e.a===d&&e.b===s}var Zo=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}(),mu=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),h=1;h<u;h++)c[h-1]=arguments[h];for(var f=1;f<arguments.length;f++){var p=arguments[f];for(var E in p)l[E]=p[E]}return l}function a(l,u,c){var h=this,f={enumerable:!0};h.hasBeenReset=!1;var p="",E=!1,b=l,A=u,w=c,D=null,S="",L=!0,N="auto",P="start",V=50,Y="middle",j=50,ie="middle";Object.defineProperty(h,"id",i({},f,{get:function(){return p},set:function(Q){p=""+Q}})),Object.defineProperty(h,"pauseOnExit",i({},f,{get:function(){return E},set:function(Q){E=!!Q}})),Object.defineProperty(h,"startTime",i({},f,{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(h,"endTime",i({},f,{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(h,"text",i({},f,{get:function(){return w},set:function(Q){w=""+Q,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",i({},f,{get:function(){return D},set:function(Q){D=Q,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",i({},f,{get:function(){return S},set:function(Q){var X=function(ce){return e(d,ce)}(Q);if(X===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=X,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",i({},f,{get:function(){return L},set:function(Q){L=!!Q,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",i({},f,{get:function(){return N},set:function(Q){if(typeof Q!="number"&&Q!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");N=Q,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",i({},f,{get:function(){return P},set:function(Q){var X=t(Q);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");P=X,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",i({},f,{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(h,"positionAlign",i({},f,{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(h,"size",i({},f,{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(h,"align",i({},f,{get:function(){return ie},set:function(Q){var X=t(Q);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");ie=X,this.hasBeenReset=!0}})),h.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}(),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 lf(d){function s(t,i,a,l){return 3600*(0|t)+60*(0|i)+(0|a)+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 kg=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 a=0;a<i.length;++a)if(t===i[a]){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 df(d,s,e,t){var i=t?d.split(t):[d];for(var a in i)if(typeof i[a]=="string"){var l=i[a].split(e);l.length===2&&s(l[0],l[1])}}var pu=new mu(0,0,""),Jo=pu.align==="middle"?"middle":"center";function wg(d,s,e){var t=d;function i(){var l=lf(d);if(l===null)throw new Error("Malformed timestamp: "+t);return d=d.replace(/^[^\sa-zA-Z-]+/,""),l}function a(){d=d.replace(/^\s+/,"")}if(a(),s.startTime=i(),a(),d.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+t);d=d.slice(3),a(),s.endTime=i(),a(),function(l,u){var c=new kg;df(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",Jo,"end"]);break;case"position":b=E.split(","),c.percent(p,b[0]),b.length===2&&c.alt("positionAlign",b[1],["start",Jo,"end","line-left","line-right","auto"]);break;case"size":c.percent(p,E);break;case"align":c.alt(p,E,["start",Jo,"end","left","right"])}},/:/,/\s/),u.region=c.get("region",null),u.vertical=c.get("vertical","");var h=c.get("line","auto");h==="auto"&&pu.line===-1&&(h=-1),u.line=h,u.lineAlign=c.get("lineAlign","start"),u.snapToLines=c.get("snapToLines",!0),u.size=c.get("size",100),u.align=c.get("align",Jo);var f=c.get("position","auto");f==="auto"&&pu.position===50&&(f=u.align==="start"||u.align==="left"?0:u.align==="end"||u.align==="right"?100:50),u.position=f}(d,s)}function uf(d){return d.replace(/<br(?: \/)?>/gi,`
|
|
35
|
+
`)}var Lg=function(){function d(){this.state="INITIAL",this.buffer="",this.decoder=new Sg,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 h=t.buffer,f=0;for(h=uf(h);f<h.length&&h[f]!=="\r"&&h[f]!==`
|
|
36
|
+
`;)++f;var p=h.slice(0,f);return h[f]==="\r"&&++f,h[f]===`
|
|
37
|
+
`&&++f,t.buffer=h.slice(f),p}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var a="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;var l=(a=i()).match(/^()?WEBVTT([ \t].*)?$/);if(l==null||!l[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:a=i(),t.state){case"HEADER":/:/.test(a)?df(a,function(h,f){},/:/):a||(t.state="ID");continue;case"NOTE":a||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(a)){t.state="NOTE";break}if(!a)continue;if(t.cue=new mu(0,0,""),t.state="CUE",a.indexOf("-->")===-1){t.cue.id=a;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{wg(a,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var c=a.indexOf("-->")!==-1;if(!a||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+=a;continue;case"BADCUE":a||(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},
|
|
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}(),Ig=/\r\n|\n\r|\n|\r/g,vu=function(d,s,e){return e===void 0&&(e=0),d.slice(e,e+s.length)===s},gu=function(d){for(var s=5381,e=d.length;e;)s=33*s^d.charCodeAt(--e);return(s>>>0).toString()};function Eu(d,s,e){return gu(d.toString())+gu(s.toString())+gu(e)}function Rg(d,s,e,t,i,a,l){var u,c,h,f=new Lg,p=Ii(new Uint8Array(d)).trim().replace(Ig,`
|
|
41
41
|
`).split(`
|
|
42
|
-
`),E=[],b=(
|
|
43
|
-
`)}),
|
|
44
|
-
`:(a=t.childNodes)!=null&&a.length?mf(t,s):s?e+t.textContent.trim().replace(/\s+/g," "):e+t.textContent},"")}function _d(u,s,e){return u&&u.hasAttributeNS(s,e)?u.getAttributeNS(s,e):null}function pf(u){return new Error("Could not parse ttml timestamp "+u)}function Td(u,s){if(!u)return null;var e=of(u);return e===null&&(df.test(u)?e=function(t,i){var a=df.exec(t),o=(0|a[4])+(0|a[5])/i.subFrameRate;return 3600*(0|a[1])+60*(0|a[2])+(0|a[3])+o/i.frameRate}(u,s):cf.test(u)&&(e=function(t,i){var a=cf.exec(t),o=Number(a[1]);switch(a[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}(u,s))),e}var Rg=function(){function u(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 Zo(this,"textTrack1"),i=new Zo(this,"textTrack2"),a=new Zo(this,"textTrack3"),o=new Zo(this,"textTrack4");this.cea608Parser1=new nf(1,t,i),this.cea608Parser2=new nf(3,a,o)}e.on(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(k.FRAG_LOADING,this.onFragLoading,this),e.on(k.FRAG_LOADED,this.onFragLoaded,this),e.on(k.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(k.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(k.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(k.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=u.prototype;return s.destroy=function(){var e=this.hls;e.off(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(k.FRAG_LOADING,this.onFragLoading,this),e.off(k.FRAG_LOADED,this.onFragLoaded,this),e.off(k.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(k.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(k.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(k.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(e,t,i,a,o){for(var d,c,f,h,p=!1,E=o.length;E--;){var b=o[E],A=(d=b[0],c=b[1],f=t,h=i,Math.min(c,h)-Math.max(d,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 w=this.captionsTracks[e];this.Cues.newCue(w,t,i,a)}else{var D=this.Cues.newCue(null,t,i,a);this.hls.trigger(k.CUES_PARSED,{type:"captions",cues:D,track:e})}},s.onInitPtsFound=function(e,t){var i=this,a=t.frag,o=t.id,d=t.initPTS,c=t.timescale,f=this.unparsedVttFrags;o==="main"&&(this.initPTS[a.cc]={baseTime:d,timescale:c}),f.length&&(this.unparsedVttFrags=[],f.forEach(function(h){i.onFragLoaded(k.FRAG_LOADED,h)}))},s.getExistingTrack=function(e){var t=this.media;if(t)for(var i=0;i<t.textTracks.length;i++){var a=t.textTracks[i];if(a[e])return a}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,a=this.media,o=t[e],d=o.label,c=o.languageCode,f=this.getExistingTrack(e);if(f)i[e]=f,Qr(i[e]),Ta(i[e],a);else{var h=this.createTextTrack("captions",d,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(k.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}}},s.createTextTrack=function(e,t,i){var a=this.media;if(a)return a.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){Qr(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++)Qr(t[i])}},s.onSubtitleTracksUpdated=function(e,t){var i=this,a=t.subtitleTracks||[],o=a.some(function(f){return f.textCodec===yd});if(this.config.enableWebVTT||o&&this.config.enableIMSC1){if(Xh(this.tracks,a))return void(this.tracks=a);if(this.textTracks=[],this.tracks=a,this.config.renderTextTracksNatively){var d=this.media?this.media.textTracks:null;this.tracks.forEach(function(f,h){var p;if(d&&h<d.length){for(var E=null,b=0;b<d.length;b++)if(Dg(d[b],f)){E=d[b];break}E&&(p=E)}if(p)Qr(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(k.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(a){var o=/(?:CC|SERVICE)([1-4])/.exec(a.instreamId);if(o){var d="textTrack"+o[1],c=i.captionsProperties[d];c&&(c.label=a.name,a.lang&&(c.languageCode=a.lang),c.media=a)}})},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,a=this.cea608Parser2,o=this.lastSn,d=this.lastPartIndex;if(this.enabled&&i&&a&&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===o+1||h===o&&p===d+1||(i.reset(),a.reset()),this.lastSn=h,this.lastPartIndex=p}},s.onFragLoaded=function(e,t){var i=t.frag,a=t.payload,o=this.initPTS,d=this.unparsedVttFrags;if(i.type===Oi)if(a.byteLength){if(!o[i.cc])return d.push(t),void(o.length&&this.hls.trigger(k.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===yd?this._parseIMSC1(i,a):this._parseVTTs(i,a,p)}}else this.hls.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(e,t){var i=this,a=this.hls;hf(t,this.initPTS[e.cc],function(o){i._appendCues(o,e.level),a.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(o){U.log("Failed to parse IMSC1: "+o),a.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:o})})},s._parseVTTs=function(e,t,i){var a,o=this,d=this.hls;Lg((a=e.initSegment)!=null&&a.data?yr(e.initSegment.data,new Uint8Array(t)):t,this.initPTS[e.cc],i,e.cc,e.start,function(c){o._appendCues(c,e.level),d.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(c){o._fallbackToIMSC1(e,t),U.log("Failed to parse VTT cue: "+c),d.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:c})})},s._fallbackToIMSC1=function(e,t){var i=this,a=this.tracks[e.level];a.textCodec||hf(t,this.initPTS[e.cc],function(){a.textCodec=yd,i._parseIMSC1(e,t)},function(){a.textCodec="wvtt"})},s._appendCues=function(e,t){var i=this.hls;if(this.config.renderTextTracksNatively){var a=this.textTracks[t];if(!a||a.mode==="disabled")return;e.forEach(function(c){return Uo(a,c)})}else{var o=this.tracks[t];if(!o)return;var d=o.default?"default":"subtitles"+t;i.trigger(k.CUES_PARSED,{type:"subtitles",cues:e,track:d})}},s.onFragDecrypted=function(e,t){var i=t.frag;if(i.type===Oi){if(!this.initPTS[i.cc])return void this.unparsedVttFrags.push(t);this.onFragLoaded(k.FRAG_LOADED,t)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,a=this.cea608Parser2;if(this.enabled&&i&&a){var o=t.frag,d=t.samples;if(o.type!==rt||this.closedCaptionsForLevel(o)!=="NONE")for(var c=0;c<d.length;c++){var f=d[c].bytes;if(f){var h=this.extractCea608Data(f);i.addData(d[c].pts,h[0]),a.addData(d[c].pts,h[1])}}}},s.onBufferFlushing=function(e,t){var i=t.startOffset,a=t.endOffset,o=t.endOffsetSubtitles,d=t.type,c=this.media;if(c&&!(c.currentTime<a)){if(!d||d==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(p){return hs(f[p],i,a)})}if(this.config.renderTextTracksNatively&&i===0&&o!==void 0){var h=this.textTracks;Object.keys(h).forEach(function(p){return hs(h[p],i,o)})}}},s.extractCea608Data=function(e){for(var t=[[],[]],i=31&e[0],a=2,o=0;o<i;o++){var d=e[a++],c=127&e[a++],f=127&e[a++];if((c!==0||f!==0)&&(4&d)!=0){var h=3&d;h!==0&&h!==1||(t[h].push(c),t[h].push(f))}}return t},u}();function Dg(u,s){return!!u&&u.label===s.name&&!(u.textTrack1||u.textTrack2)}var Cg=function(){function u(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=u.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(k.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(k.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.BUFFER_CODECS,this.onBufferCodecs,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this)},s.unregisterListener=function(){var e=this.hls;e.off(k.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(k.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.BUFFER_CODECS,this.onBufferCodecs,this),e.off(k.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 a=i.filter(function(o,d){return t.isLevelAllowed(o)&&d<=e});return this.clientRect=null,u.getMaxLevelByMediaSize(a,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})},u.getMaxLevelByMediaSize=function(e,t,i){if(e==null||!e.length)return-1;for(var a,o,d=e.length-1,c=0;c<e.length;c+=1){var f=e[c];if((f.width>=t||f.height>=i)&&(a=f,!(o=e[c+1])||a.width!==o.width||a.height!==o.height)){d=c;break}}return d},M(u,[{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}}]),u}(),Mg=function(){function u(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=u.prototype;return s.setStreamController=function(e){this.streamController=e},s.registerListeners=function(){this.hls.on(k.MEDIA_ATTACHING,this.onMediaAttaching,this)},s.unregisterListeners=function(){this.hls.off(k.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 a=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=a,a&&typeof a.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 a=performance.now();if(t){if(this.lastTime){var o=a-this.lastTime,d=i-this.lastDroppedFrames,c=t-this.lastDecodedFrames,f=1e3*d/o,h=this.hls;if(h.trigger(k.FPS_DROP,{currentDropped:d,currentDecoded:c,totalDroppedFrames:i}),f>0&&d>h.config.fpsDroppedMonitoringThreshold*c){var p=h.currentLevel;U.warn("drop FPS ratio greater than max allowed value for currentLevel: "+p),p>0&&(h.autoLevelCapping===-1||h.autoLevelCapping>=p)&&(p-=1,h.trigger(k.FPS_DROP_LEVEL_CAPPING,{level:p,droppedLevel:h.currentLevel}),h.autoLevelCapping=p,this.streamController.nextLevelSwitch())}}this.lastTime=a,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)},u}(),el="[eme]",vf=function(){function u(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=u.CDMCleanupPromise?[u.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=U.debug.bind(U,el),this.log=U.log.bind(U,el),this.warn=U.warn.bind(U,el),this.error=U.error.bind(U,el),this.hls=e,this.config=e.config,this.registerListeners()}var s=u.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(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(k.MANIFEST_LOADED,this.onManifestLoaded,this)},s.unregisterListeners=function(){this.hls.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(k.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(k.MANIFEST_LOADED,this.onManifestLoaded,this)},s.getLicenseServerUrl=function(e){var t=this.config,i=t.drmSystems,a=t.widevineLicenseUrl,o=i[e];if(o)return o.licenseUrl;if(e===Ze.WIDEVINE&&a)return a;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,a=function(c,f,h){return!!c&&h.indexOf(c)===f},o=i.map(function(c){return c.audioCodec}).filter(a),d=i.map(function(c){return c.videoCodec}).filter(a);return o.length+d.length===0&&d.push("avc1.42e01e"),new Promise(function(c,f){(function h(p){var E=p.shift();t.getMediaKeysPromise(E,o,d).then(function(b){return c({keySystem:E,mediaKeys:b})}).catch(function(b){p.length?h(p):f(b instanceof Ui?b:new Ui({type:se.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 a="Configured requestMediaKeySystemAccess is not a function "+i;return $r===null&&self.location.protocol==="http:"&&(a="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(a))}return i(e,t)},s.getMediaKeysPromise=function(e,t,i){var a=this,o=function(h,p,E,b){var A;switch(h){case Ze.FAIRPLAY:A=["cenc","sinf"];break;case Ze.WIDEVINE:case Ze.PLAYREADY:A=["cenc"];break;case Ze.CLEARKEY:A=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+h)}return function(w,D,S,L){return[{initDataTypes:w,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,E,b)}(e,t,i,this.config.drmSystemOptions),d=this.keySystemAccessPromises[e],c=d==null?void 0:d.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){a.log('Failed to obtain access to key-system "'+e+'": '+h)}),c.then(function(h){a.log('Access for key-system "'+h.keySystem+'" obtained');var p=a.fetchServerCertificate(e);return a.log('Create media-keys for "'+e+'"'),f.mediaKeys=h.createMediaKeys().then(function(E){return a.log('Media-keys created for "'+e+'"'),p.then(function(b){return b?a.setMediaKeysServerCertificate(E,e,b):E})}),f.mediaKeys.catch(function(E){a.error('Failed to create media-keys for "'+e+'"}: '+E)}),f.mediaKeys})}return c.then(function(){return d.mediaKeys})},s.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem,a=e.mediaKeys;this.log('Creating key-system session "'+i+'" keyId: '+Pi(t.keyId||[]));var o=a.createSession(),d={decryptdata:t,keySystem:i,mediaKeys:a,mediaKeysSession:o,keyStatus:"status-pending"};return this.mediaKeySessions.push(d),d},s.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var i=this.createMediaKeySessionContext(e),a=this.getKeyIdString(t);this.keyIdToKeySessionPromise[a]=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 Pi(e.keyId)},s.updateKeySession=function(e,t){var i,a=e.mediaKeysSession;return this.log('Updating key-session "'+a.sessionId+'" for keyID '+Pi(((i=e.decryptdata)==null?void 0:i.keyId)||[])+`
|
|
45
|
-
} (data length: `+(t&&t.byteLength)+")"),a.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,a){var o=gr(t.config),d=e.map(Ei).filter(function(c){return!!c&&o.indexOf(c)!==-1});return t.getKeySystemSelectionPromise(d).then(function(c){var f=c.keySystem,h=rr(f);h?i(h):a(new Error('Unable to find format for key-system "'+f+'"'))}).catch(a)})},s.loadKey=function(e){var t=this,i=e.keyInfo.decryptdata,a=this.getKeyIdString(i),o="(keyId: "+a+' format: "'+i.keyFormat+'" method: '+i.method+" uri: "+i.uri+")";this.log("Starting session for key "+o);var d=this.keyIdToKeySessionPromise[a];return d||(d=this.keyIdToKeySessionPromise[a]=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)}),d},s.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},s.handleError=function(e){this.hls&&(this.error(e.message),e instanceof Ui?this.hls.trigger(k.ERROR,e.data):this.hls.trigger(k.ERROR,{type:se.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 a=Ei(e.keyFormat),o=a?[a]:gr(this.config);return this.attemptKeySystemAccess(o)}return i},s.getKeySystemSelectionPromise=function(e){if(e.length||(e=gr(this.config)),e.length===0)throw new Ui({type:se.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,a=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+i+'"'),a!==null){var o,d;if(i==="sinf"&&this.config.drmSystems[Ze.FAIRPLAY]){var c=Mt(new Uint8Array(a));try{var f=Rt(JSON.parse(c).sinf),h=ns(new Uint8Array(f));if(!h)return;o=h.subarray(8,24),d=Ze.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),Y=V.getUint32(0);if(N.byteLength!==Y&&Y>44||V.getUint32(4)!==1886614376||(P.version=V.getUint32(8)>>>24,P.version>1))return null;P.systemId=Pi(new Uint8Array(N,12,16));var j=V.getUint32(28);if(P.version===0){if(Y-32<j)return null;P.data=new Uint8Array(N,32,j)}else if(P.version===1){P.kids=[];for(var ie=0;ie<j;ie++)P.kids.push(new Uint8Array(N,32+16*ie,16))}return P}(a);if(p===null)return;p.version===0&&p.systemId===ct&&p.data&&(o=p.data.subarray(8,24)),d=function(N){if(N===ct)return Ze.WIDEVINE}(p.systemId)}if(d&&o){for(var E=Pi(o),b=this.keyIdToKeySessionPromise,A=this.mediaKeySessions,w=b[E],D=function(){var N=A[S],P=N.decryptdata;if(P.pssh||!P.keyId)return"continue";var V=Pi(P.keyId);return E===V||P.uri.replace(/-/g,"").indexOf(E)!==-1?(w=b[V],delete b[V],P.pssh=new Uint8Array(a),P.keyId=o,w=b[E]=w.then(function(){return t.generateRequestWithPreferredKeySession(N,i,a,"encrypted-event-key-match")}),"break"):void 0},S=0;S<A.length;S++){var L=D();if(L!=="continue"&&L==="break")break}w||(w=b[E]=this.getKeySystemSelectionPromise([d]).then(function(N){var P,V=N.keySystem,Y=N.mediaKeys;t.throwIfDestroyed();var j=new ba("ISO-23001-7",E,(P=rr(V))!=null?P:"");return j.pssh=new Uint8Array(a),j.keyId=o,t.attemptSetMediaKeys(V,Y).then(function(){t.throwIfDestroyed();var ie=t.createMediaKeySessionContext({decryptdata:j,keySystem:V,mediaKeys:Y});return t.generateRequestWithPreferredKeySession(ie,i,a,"encrypted-event-no-match")})})),w.catch(function(N){return t.handleError(N)})}}},s._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},s.attemptSetMediaKeys=function(e,t){var i=this,a=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var o=Promise.all(a).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+'"'),a.push(o),i.setMediaKeysQueue=i.setMediaKeysQueue.filter(function(d){return a.indexOf(d)===-1})})},s.generateRequestWithPreferredKeySession=function(e,t,i,a){var o,d,c=this,f=(o=this.config.drmSystems)==null||(d=o[e.keySystem])==null?void 0:d.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(w){var p;if(this.warn(w.message),(p=this.hls)!=null&&p.config.debug)throw w}if(i===null)return this.log('Skipping key-session request for "'+a+'" (no initData)'),Promise.resolve(e);var E=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+a+'": '+E+" (init data type: "+t+" length: "+(i?i.byteLength:null)+")");var b=new Xo;e.mediaKeysSession.onmessage=function(w){var D=e.mediaKeysSession;if(D){var S=w.messageType,L=w.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===Ze.FAIRPLAY&&(c.updateKeySession(e,$i("acknowledged")),c.removeSession(e)):c.warn('unhandled media key message type "'+S+'"')}else b.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(w){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(w,D){b.on("error",D),b.on("keyStatus",function(S){S.startsWith("usable")?w():S==="output-restricted"?D(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):S==="internal-error"?D(new Ui({type:se.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 w;c.log('Request generated for key-session "'+((w=e.mediaKeysSession)==null?void 0:w.sessionId)+'" keyId: '+E)}).catch(function(w){throw new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_NO_SESSION,error:w,fatal:!1},"Error generating key-session request: "+w)}).then(function(){return A}).catch(function(w){throw b.removeAllListeners(),c.removeSession(e),w}).then(function(){return b.removeAllListeners(),e})},s.onKeyStatusChange=function(e){var t=this;e.mediaKeysSession.keyStatuses.forEach(function(i,a){t.log('key status change "'+i+'" for keyStatuses keyId: '+Pi("buffer"in a?new Uint8Array(a.buffer,a.byteOffset,a.byteLength):new Uint8Array(a))+" session keyId: "+Pi(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),a=this.getServerCertificateUrl(e);return a?(this.log('Fetching serverCertificate for "'+e+'"'),new Promise(function(o,d){var c={responseType:"arraybuffer",url:a},f=t.certLoadPolicy.default,h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},p={onSuccess:function(E,b,A,w){o(E.data)},onError:function(E,b,A,w){d(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:A,response:y({url:c.url,data:void 0},E)},'"'+e+'" certificate request failed ('+a+"). Status: "+E.code+" ("+E.text+")"))},onTimeout:function(E,b,A){d(new Ui({type:se.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 ('+a+")"))},onAbort:function(E,b,A){d(new Error("aborted"))}};i.load(c,h,p)})):Promise.resolve()},s.setMediaKeysServerCertificate=function(e,t,i){var a=this;return new Promise(function(o,d){e.setServerCertificate(i).then(function(c){a.log("setServerCertificate "+(c?"success":"not supported by CDM")+" ("+(i==null?void 0:i.byteLength)+') on "'+t+'"'),o(e)}).catch(function(c){d(new Ui({type:se.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(a){return i.updateKeySession(e,new Uint8Array(a)).catch(function(o){throw new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:o,fatal:!0},o.message)})})},s.setupLicenseXHR=function(e,t,i,a){var o=this,d=this.config.licenseXhrSetup;return d?Promise.resolve().then(function(){if(!i.decryptdata)throw new Error("Key removed");return d.call(o.hls,e,t,i,a)}).catch(function(c){if(!i.decryptdata)throw c;return e.open("POST",t,!0),d.call(o.hls,e,t,i,a)}).then(function(c){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:c||a}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:a}))},s.requestLicense=function(e,t){var i=this,a=this.config.keyLoadPolicy.default;return new Promise(function(o,d){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 d(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(w){i.error(w)}o(h)}else{var E=a.errorRetry,b=E?E.maxNumRetry:0;if(i._requestLicenseFailureCount++,i._requestLicenseFailureCount>b||f.status>=400&&f.status<500)d(new Ui({type:se.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(o,d)}}},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 a=i.length;u.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(){a&&(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 a=i.reduce(function(o,d){return o.indexOf(d.keyFormat)===-1&&o.push(d.keyFormat),o},[]);this.log("Selecting key-system from session-keys "+a.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(a)}},s.removeSession=function(e){var t=this,i=e.mediaKeysSession,a=e.licenseXhr;if(i){this.log("Remove licenses and keys and close session "+i.sessionId),i.onmessage=null,i.onkeystatuseschange=null,a&&a.readyState!==XMLHttpRequest.DONE&&a.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(d){t.log("Could not remove session: "+d)}).then(function(){return i.close()}).catch(function(d){t.log("Could not close session: "+d)})}},u}();vf.CDMCleanupPromise=void 0;var Ui=function(u){function s(e,t){var i;return(i=u.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,u),s}(_e(Error)),xg="m",tl="a",Ad="v",Sd="av",gf="i",Pg="tt",Og=function(){function u(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:xg,su:!t.initialized})}catch(d){U.warn("Could not generate manifest CMCD data.",d)}},this.applyFragmentData=function(o){try{var d=o.frag,c=t.hls.levels[d.level],f=t.getObjectType(d),h={d:1e3*d.duration,ot:f};f!==Ad&&f!==tl&&f!=Sd||(h.br=c.bitrate/1e3,h.tb=t.getTopBandwidth(f)/1e3,h.bl=t.getBufferLength(f)),t.apply(o,h)}catch(p){U.warn("Could not generate segment CMCD data.",p)}},this.hls=e;var i=this.config=e.config,a=i.cmcd;a!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||u.uuid(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.registerListeners())}var s=u.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(k.MEDIA_DETACHED,this.onMediaDetached,this),e.on(k.BUFFER_CREATED,this.onBufferCreated,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(k.MEDIA_DETACHED,this.onMediaDetached,this),e.off(k.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,a;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(a=t.tracks.video)==null?void 0:a.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={}),H(t,this.createData());var i=t.ot===gf||t.ot===Ad||t.ot===Sd;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var a=u.toHeaders(t);if(!Object.keys(a).length)return;e.headers||(e.headers={}),H(e.headers,a)}else{var o=u.toQuery(t);if(!o)return;e.url=u.appendQueryToUri(e.url,o)}},s.getObjectType=function(e){var t=e.type;return t==="subtitle"?Pg:e.sn==="initSegment"?gf:t==="audio"?tl:t==="main"?this.hls.audioTracks.length?Ad:Sd:void 0},s.getTopBandwidth=function(e){var t,i=0,a=this.hls;if(e===tl)t=a.audioTracks;else{var o=a.maxAutoLevel,d=o>-1?o+1:a.levels.length;t=a.levels.slice(0,d)}for(var c,f=ye(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===tl?this.audioBuffer:this.videoBuffer;return i&&t?1e3*he.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 a(d){this.loader=void 0,this.loader=new i(d)}var o=a.prototype;return o.destroy=function(){this.loader.destroy()},o.abort=function(){this.loader.abort()},o.load=function(d,c,f){t(d),this.loader.load(d,c,f)},M(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),a}()},s.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function a(d){this.loader=void 0,this.loader=new i(d)}var o=a.prototype;return o.destroy=function(){this.loader.destroy()},o.abort=function(){this.loader.abort()},o.load=function(d,c,f){t(d),this.loader.load(d,c,f)},M(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),a}()},u.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)},u.serialize=function(e){for(var t,i=[],a=function(w){return!Number.isNaN(w)&&w!=null&&w!==""&&w!==!1},o=function(w){return Math.round(w)},d=function(w){return 100*o(w/100)},c={br:o,d:o,bl:d,dl:d,mtp:d,nor:function(w){return encodeURIComponent(w)},rtp:d,tb:o},f=ye(Object.keys(e||{}).sort());!(t=f()).done;){var h=t.value,p=e[h];if(a(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(",")},u.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],a=[{},{},{},{}],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},d=0,c=Object.keys(e);d<c.length;d++){var f=c[d];a[o[f]!=null?o[f]:1][f]=e[f]}for(var h=0;h<a.length;h++){var p=u.serialize(a[h]);p&&(t["CMCD-"+i[h]]=p)}return t},u.toQuery=function(e){return"CMCD="+encodeURIComponent(u.serialize(e))},u.appendQueryToUri=function(e,t){if(!t)return e;var i=e.includes("?")?"&":"?";return""+e+i+t},u}(),Ng=function(){function u(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=U.log.bind(U,"[content-steering]:"),this.registerListeners()}var s=u.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(k.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.ERROR,this.onError,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(k.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.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 a=this.pathwayPriority,o=this.pathwayId;this.penalizedPathways[o]||(this.penalizedPathways[o]=performance.now()),!a&&this.levels&&(a=this.levels.reduce(function(d,c){return d.indexOf(c.pathwayId)===-1&&d.push(c.pathwayId),d},[])),a&&a.length>1&&(this.updatePathwayPriority(a),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,a=performance.now();Object.keys(i).forEach(function(p){a-i[p]>3e5&&delete i[p]});for(var o=0;o<e.length;o++){var d=e[o];if(!i[d]){if(d===this.pathwayId)return;var c=this.hls.nextLoadLevel,f=this.hls.levels[c];if((t=this.getLevelsForPathway(d)).length>0){this.log('Setting Pathway to "'+d+'"'),this.pathwayId=d,this.hls.trigger(k.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 a={},o={};e.forEach(function(d){var c=d.ID,f=d["BASE-ID"],h=d["URI-REPLACEMENT"];if(!i.some(function(E){return E.pathwayId===c})){var p=t.getLevelsForPathway(f).map(function(E){var b=H({},E);b.details=void 0,b.url=yf(E.uri,E.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",h);var A=new nt(E.attrs);A["PATHWAY-ID"]=c;var w=A.AUDIO&&A.AUDIO+"_clone_"+c,D=A.SUBTITLES&&A.SUBTITLES+"_clone_"+c;w&&(a[A.AUDIO]=w,A.AUDIO=w),D&&(o[A.SUBTITLES]=D,A.SUBTITLES=D),b.attrs=A;var S=new wa(b);return $(S,"audio",w),$(S,"text",D),S});i.push.apply(i,p),Ef(t.audioTracks,a,h,c),Ef(t.subtitleTracks,o,h,c)}})}},s.loadSteeringManifest=function(e){var t,i=this,a=this.hls.config,o=a.loader;this.loader&&this.loader.destroy(),this.loader=new o(a);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 d=0|(this.hls.bandwidthEstimate||a.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+d)}var c={responseType:"json",url:t.href},f=a.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,w,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||w.url),N&&i.clonePathways(N),P&&i.updatePathwayPriority(P)}else i.log("Steering VERSION "+S.VERSION+" not supported!")},onError:function(b,A,w,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,w){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)},u}();function Ef(u,s,e,t){u&&Object.keys(s).forEach(function(i){var a=u.filter(function(o){return o.groupId===i}).map(function(o){var d=H({},o);return d.details=void 0,d.attrs=new nt(d.attrs),d.url=d.attrs.URI=yf(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",e),d.groupId=d.attrs["GROUP-ID"]=s[i],d.attrs["PATHWAY-ID"]=t,d});u.push.apply(u,a)})}function yf(u,s,e,t){var i,a=t.HOST,o=t.PARAMS,d=t[e];s&&(i=d==null?void 0:d[s])&&(u=i);var c=new self.URL(u);return a&&!i&&(c.host=a),o&&Object.keys(o).sort().forEach(function(f){f&&c.searchParams.set(f,o[f])}),c.href}var Fg=/^age:\s*[\d.]+\s*$/im,bf=function(){function u(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 Gt,this.retryDelay=0}var s=u.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 a=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0;var d=this.xhrSetup;d?Promise.resolve().then(function(){if(!e.stats.aborted)return d(a,i.url)}).catch(function(c){return a.open("GET",i.url,!0),d(a,i.url)}).then(function(){e.stats.aborted||e.openAndSendXhr(a,i,t)}).catch(function(c){e.callbacks.onError({code:a.status,text:c.message},i,a,o)}):this.openAndSendXhr(a,i,t)}},s.openAndSendXhr=function(e,t,i){e.readyState||e.open("GET",t.url,!0);var a=this.context.headers,o=i.loadPolicy,d=o.maxTimeToFirstByteMs,c=o.maxLoadTimeMs;if(a)for(var f in a)e.setRequestHeader(f,a[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=d&&re(d)?d: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 a=t.readyState,o=this.config;if(!i.aborted&&a>=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)))),a===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var d=t.status,c=t.responseType!=="text";if(d>=200&&d<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:d};this.callbacks.onSuccess(E,i,e,t)}else{var b=o.loadPolicy.errorRetry;dn(b,i.retry,!1,d)?this.retry(b):(U.error(d+" while loading "+e.url),this.callbacks.onError({code:d,text:t.statusText},e,t,i))}}}},s.loadtimeout=function(){var e,t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry;if(dn(t,this.stats.retry,!0))this.retry(t);else{U.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=Es(e,i.retry),i.retry++,U.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&&Fg.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},u}(),Ug=/(\d+)-(\d+)\/(\d+)/,_f=function(){function u(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||Bg,this.controller=new self.AbortController,this.stats=new Gt}var s=u.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 a=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var d=function(A,w){var D={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(H({},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,d),self.clearTimeout(this.requestTimeout),t.timeout=E&&re(E)?E:b,this.requestTimeout=self.setTimeout(function(){a.abortInternal(),i.onTimeout(o,e,a.response)},t.timeout),self.fetch(this.request).then(function(A){a.response=a.loader=A;var w=Math.max(self.performance.now(),o.loading.start);if(self.clearTimeout(a.requestTimeout),t.timeout=b,a.requestTimeout=self.setTimeout(function(){a.abortInternal(),i.onTimeout(o,e,a.response)},b-(w-o.loading.start)),!A.ok){var D=A.status,S=A.statusText;throw new Hg(S||"fetch, bad network response",D,A)}return o.loading.first=w,o.total=function(L){var N=L.get("Content-Range");if(N){var P=function(Y){var j=Ug.exec(Y);if(j)return parseInt(j[2])-parseInt(j[1])+1}(N);if(re(P))return P}var V=L.get("Content-Length");if(V)return parseInt(V)}(A.headers)||o.total,c&&re(t.highWaterMark)?a.loadProgressively(A,o,e,t.highWaterMark,c):f?A.arrayBuffer():e.responseType==="json"?A.json():A.text()}).then(function(A){var w=a.response;self.clearTimeout(a.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:w.url,data:A,code:w.status};c&&!re(t.highWaterMark)&&c(o,e,A,w),i.onSuccess(S,o,e,w)}).catch(function(A){if(self.clearTimeout(a.requestTimeout),!o.aborted){var w=A&&A.code||0,D=A?A.message:null;i.onError({code:w,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,a,o){a===void 0&&(a=0);var d=new Qh,c=e.body.getReader();return function f(){return c.read().then(function(h){if(h.done)return d.dataLength&&o(t,i,d.flush(),e),Promise.resolve(new ArrayBuffer(0));var p=h.value,E=p.length;return t.loaded+=E,E<a||d.dataLength?(d.push(p),d.dataLength>=a&&o(t,i,d.flush(),e)):o(t,i,p,e),f()}).catch(function(){return Promise.reject()})}()},u}();function Bg(u,s){return new self.Request(u.url,s)}var Hg=function(u){function s(e,t,i){var a;return(a=u.call(this,e)||this).code=void 0,a.details=void 0,a.code=t,a.details=i,a}return z(s,u),s}(_e(Error)),Gg=/\s/,Vg=y(y({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:bf,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:ng,bufferController:fg,capLevelController:Cg,errorController:O,fpsController:Mg,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:$r,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(u,s,e,t){for(var i,a,o,d,c,f=[],h=self.VTTCue||self.TextTrackCue,p=0;p<t.rows.length;p++)if(o=!0,d=0,c="",!(i=t.rows[p]).isEmpty()){for(var E,b=0;b<i.chars.length;b++)Gg.test(i.chars[b].uchar)&&o?d++:(c+=i.chars[b].uchar,o=!1);i.cueStartTime=s,s===e&&(e+=1e-4),d>=16?d--:d++;var A=uf(c.trim()),w=Ed(s,e,A);u!=null&&(E=u.cues)!=null&&E.getCueById(w)||((a=new h(s,e,A)).id=w,a.line=p+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*d/32)),f.push(a))}return u&&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 Uo(u,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:ug,subtitleTrackController:cg,timelineController:Rg,audioStreamController:sg,audioTrackController:og,emeController:vf,cmcdController:Og,contentSteeringController:Ng});function kd(u){return u&&typeof u=="object"?Array.isArray(u)?u.map(kd):Object.keys(u).reduce(function(s,e){return s[e]=kd(u[e]),s},{}):u}function Kg(u){var s=u.loader;s!==_f&&s!==bf?(U.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(u.loader=_f,u.progressive=!0,u.enableSoftwareAES=!0,U.log("[config]: Progressive streaming enabled, using FetchLoader"))}var Tf=function(){function u(e){e===void 0&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Xo,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,it(e.debug||!1,"Hls instance");var t=this.config=function(ce,oe){if((oe.liveSyncDurationCount||oe.liveMaxLatencyDurationCount)&&(oe.liveSyncDuration||oe.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(oe.liveMaxLatencyDurationCount!==void 0&&(oe.liveSyncDurationCount===void 0||oe.liveMaxLatencyDurationCount<=oe.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(oe.liveMaxLatencyDuration!==void 0&&(oe.liveSyncDuration===void 0||oe.liveMaxLatencyDuration<=oe.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var Ae=kd(ce),xe=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(function(Le){var Me=(Le==="level"?"playlist":Le)+"LoadPolicy",Oe=oe[Me]===void 0,Pe=[];xe.forEach(function(Ke){var je=Le+"Loading"+Ke,et=oe[je];if(et!==void 0&&Oe){Pe.push(je);var lt=Ae[Me].default;switch(oe[Me]={default:lt},Ke){case"TimeOut":lt.maxLoadTimeMs=et,lt.maxTimeToFirstByteMs=et;break;case"MaxRetry":lt.errorRetry.maxNumRetry=et,lt.timeoutRetry.maxNumRetry=et;break;case"RetryDelay":lt.errorRetry.retryDelayMs=et,lt.timeoutRetry.retryDelayMs=et;break;case"MaxRetryTimeout":lt.errorRetry.maxRetryDelayMs=et,lt.timeoutRetry.maxRetryDelayMs=et}}}),Pe.length&&U.warn('hls.js config: "'+Pe.join('", "')+'" setting(s) are deprecated, use "'+Me+'": '+JSON.stringify(oe[Me]))}),y(y({},Ae),oe)}(u.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&Kg(t);var i=t.abrController,a=t.bufferController,o=t.capLevelController,d=t.errorController,c=t.fpsController,f=new d(this),h=this.abrController=new i(this),p=this.bufferController=new a(this),E=this.capLevelController=new o(this),b=new c(this),A=new xt(this),w=new ju(this),D=t.contentSteeringController,S=D?new D(this):null,L=this.levelController=new G(this,S),N=new we(this),P=new At(this.config),V=this.streamController=new rg(this,N,P);E.setStreamController(V),b.setStreamController(V);var Y=[A,L,V];S&&Y.splice(1,0,S),this.networkControllers=Y;var j=[h,p,E,b,w,N];this.audioTrackController=this.createController(t.audioTrackController,Y);var ie=t.audioStreamController;ie&&Y.push(new ie(this,N,P)),this.subtitleTrackController=this.createController(t.subtitleTrackController,Y);var Q=t.subtitleStreamController;Q&&Y.push(new Q(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(zu,j),this.coreComponents=j,Y.push(f);var X=f.onErrorOut;typeof X=="function"&&this.on(k.ERROR,X,f)}u.isSupported=function(){return function(){var e=nn();if(!e)return!1;var t=Dh(),i=e&&typeof e.isTypeSupported=="function"&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),a=!t||t.prototype&&typeof t.prototype.appendBuffer=="function"&&typeof t.prototype.remove=="function";return!!i&&!!a}()};var s=u.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,a){i===void 0&&(i=this),this._emitter.off(e,t,i,a)},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){U.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(k.ERROR,{type:se.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(){U.log("destroy"),this.trigger(k.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){U.log("attachMedia"),this._media=e,this.trigger(k.MEDIA_ATTACHING,{media:e})},s.detachMedia=function(){U.log("detachMedia"),this.trigger(k.MEDIA_DETACHING,void 0),this._media=null},s.loadSource=function(e){this.stopLoad();var t=this.media,i=this.url,a=this.url=Ge.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});U.log("loadSource:"+a),t&&i&&(i!==a||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(k.MANIFEST_LOADING,{url:e})},s.startLoad=function(e){e===void 0&&(e=-1),U.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},s.stopLoad=function(){U.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},s.swapAudioCodec=function(){U.log("swapAudioCodec"),this.streamController.swapAudioCodec()},s.recoverMediaError=function(){U.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(u,[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){U.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){U.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){U.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){U.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){U.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&&(U.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){fs.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,a=0;a<i;a++)if(e[a].maxBitrate>=t)return a;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,i=this.autoLevelCapping,a=this.maxHdcpLevel;if(e=i===-1&&t&&t.length?t.length-1:i,a)for(var o=e;o--;){var d=t[o].attrs["HDCP-LEVEL"];if(d&&d<=a)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.3"}},{key:"Events",get:function(){return k}},{key:"ErrorTypes",get:function(){return se}},{key:"ErrorDetails",get:function(){return W}},{key:"DefaultConfig",get:function(){return u.defaultConfig?u.defaultConfig:Vg},set:function(e){u.defaultConfig=e}}]),u}();return Tf.defaultConfig=void 0,Tf},typeof vp=="object"&&typeof Kc!="undefined"?Kc.exports=m():typeof define=="function"&&define.amd?define(m):(l=typeof globalThis!="undefined"?globalThis:l||self).Hls=m()})(!1)});var En=class{addEventListener(){}removeEventListener(){}dispatchEvent(r){return!0}};if(typeof DocumentFragment=="undefined"){class n extends En{}globalThis.DocumentFragment=n}var ks=class extends En{},Rd=class extends En{},rE={get(n){},define(n,r,l){},upgrade(n){},whenDefined(n){return Promise.resolve(ks)}},ws,Dd=class{constructor(r,l={}){Bt(this,ws,void 0);Gi(this,ws,l==null?void 0:l.detail)}get detail(){return ot(this,ws)}initCustomEvent(){}};ws=new WeakMap;function aE(n,r){return new ks}var Df={document:{createElement:aE},DocumentFragment,customElements:rE,CustomEvent:Dd,EventTarget:En,HTMLElement:ks,HTMLVideoElement:Rd},Cf=typeof window=="undefined"||typeof globalThis.customElements=="undefined",qt=Cf?Df:globalThis,Mi=Cf?Df.document:globalThis.document;var Ie={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_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",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"},yn={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_SUBTITLES_LIST:"mediasubtitleslistchange",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",BREAKPOINTS_CHANGE:"breakpointchange"},Ne={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},F={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailable",MEDIA_FULLSCREEN_UNAVAILABLE:"mediafullscreenunavailable",MEDIA_PIP_UNAVAILABLE:"mediapipunavailable",MEDIA_CAST_UNAVAILABLE:"mediacastunavailable",MEDIA_PAUSED:"mediapaused",MEDIA_HAS_PLAYED:"mediahasplayed",MEDIA_ENDED:"mediaended",MEDIA_MUTED:"mediamuted",MEDIA_VOLUME_LEVEL:"mediavolumelevel",MEDIA_VOLUME:"mediavolume",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailable",MEDIA_IS_PIP:"mediaispip",MEDIA_IS_CASTING:"mediaiscasting",MEDIA_SUBTITLES_LIST:"mediasubtitleslist",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowing",MEDIA_IS_FULLSCREEN:"mediaisfullscreen",MEDIA_PLAYBACK_RATE:"mediaplaybackrate",MEDIA_CURRENT_TIME:"mediacurrenttime",MEDIA_DURATION:"mediaduration",MEDIA_SEEKABLE:"mediaseekable",MEDIA_PREVIEW_TIME:"mediapreviewtime",MEDIA_PREVIEW_IMAGE:"mediapreviewimage",MEDIA_PREVIEW_COORDS:"mediapreviewcoords",MEDIA_LOADING:"medialoading",MEDIA_BUFFERED:"mediabuffered",MEDIA_STREAM_TYPE:"mediastreamtype",MEDIA_TARGET_LIVE_WINDOW:"mediatargetlivewindow",MEDIA_TIME_IS_LIVE:"mediatimeislive"},J0=Object.entries(yn).reduce((n,[r,l])=>{let m=F[r];return m&&(n[l]=m),n},{userinactivechange:"userinactive"}),Mf=Object.entries(F).reduce((n,[r,l])=>{let m=yn[r];return m&&(n[l]=m),n},{userinactive:"userinactivechange"}),bn={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},al={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var Cd={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Rr={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Zi={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"};var si={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"},yt={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"},sE={...si,...yt};function nl(n,r=!1){return n.split("_").map(function(l,m){return(m||r?l[0].toUpperCase():l[0].toLowerCase())+l.slice(1).toLowerCase()}).join("")}function xf(n){return n.replace(/[-_]([a-z])/g,(r,l)=>l.toUpperCase())}function Pf(n){return typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n)}function sl(n){return typeof n!="string"?!1:!isNaN(n)&&!isNaN(parseFloat(n))}var ol=n=>new Promise(r=>setTimeout(r,n));var Of=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],oE=(n,r)=>{let l=n===1?Of[r].singular:Of[r].plural;return`${n} ${l}`},Na=n=>{if(!Pf(n))return"";let r=Math.abs(n),l=r!==n,m=new Date(0,0,0,0,0,r,0);return`${[m.getHours(),m.getMinutes(),m.getSeconds()].map((M,B)=>M&&oE(M,B)).filter(M=>M).join(", ")}${l?" remaining":""}`};function or(n,r){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),y=Math.floor(n/3600),I=Math.floor(r/60%60),M=Math.floor(r/3600);return(isNaN(n)||n===1/0)&&(y=v=m="-"),y=y>0||M>0?y+":":"",v=((y||I>=10)&&v<10?"0"+v:v)+":",m=m<10?"0"+m:m,(l?"-":"")+y+v+m}var lE=Object.freeze({length:0,start(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});function Nf(n=lE){return Array.from(n).map((r,l)=>[Number(n.start(l).toFixed(3)),Number(n.end(l).toFixed(3))].join(":")).join(" ")}var Ff=(n,r,l=".value")=>{let m=n.querySelector(l);!m||(m.textContent=r)},dE=(n,r)=>{let l=`slot[name="${r}"]`,m=n.shadowRoot.querySelector(l);return m?m.children:[]},Uf=(n,r)=>dE(n,r)[0],Ls=(n,r)=>!n||!r?!1:n.contains(r)?!0:Ls(n,r.getRootNode().host),Fa=(n,r)=>{if(!n)return null;let l=n.closest(r);return l||Fa(n.getRootNode().host,r)};function ft(n,r){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 y of v!=null?v:[])if(y.selectorText===r)return y}return m!=null&&m.sheet?(m.sheet.insertRule(`${r}{}`,m.sheet.cssRules.length),m.sheet.cssRules[m.sheet.cssRules.length-1]):{style:{setProperty:()=>{},removeProperty:()=>{}}}}function St(n,r){let l=n.getAttribute(r);return l!=null?+l:void 0}function Lt(n,r,l){if(St(n,r)!=l){if(l==null){n.removeAttribute(r);return}n.setAttribute(r,`${+l}`)}}function mt(n,r){return n.hasAttribute(r)}function bt(n,r,l){if(mt(n,r)!=l){if(l==null){n.removeAttribute(r);return}n.toggleAttribute(r,l)}}function Ht(n,r){var l;return(l=n.getAttribute(r))!=null?l:void 0}function Yt(n,r,l){if(Ht(n,r)!=l){if(l==null){n.removeAttribute(r);return}n.setAttribute(r,`${l}`)}}var ll=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},Md=class{observe(){}},Bf={ResizeObserver:Md,HTMLElement:class extends ll{},DocumentFragment:class extends ll{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){},getComputedStyle:function(){}},cE={createElement:function(){return new Bf.HTMLElement},addEventListener(){},removeEventListener(){}},Hf=typeof window=="undefined"||typeof window.customElements=="undefined",q=Hf?Bf:window,ae=Hf?cE:window.document;var hE=Object.defineProperty,fE=(n,r,l)=>r in n?hE(n,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[r]=l,mE=(n,r,l)=>(fE(n,typeof r!="symbol"?r+"":r,l),l),Gf=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Vi=(n,r,l)=>(Gf(n,r,"read from private field"),l?l.call(n):r.get(n)),ul=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},dl=(n,r,l,m)=>(Gf(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),lr,cl,_n,hl,Vf=ae.createElement("template");Vf.innerHTML=`
|
|
42
|
+
`),E=[],b=(u=s.baseTime,(c=s.timescale)===void 0&&(c=1),au(u,9e4,1/c)),A="00:00.000",w=0,D=0,S=!0;f.oncue=function(L){var N=e[t],P=e.ccOffset,V=(w-b)/9e4;N!=null&&N.new&&(D!==void 0?P=e.ccOffset=N.start:function(Q,X,ce){var oe=Q[X],Ae=Q[oe.prevCC];if(!Ae||!Ae.new&&oe.new)return Q.ccOffset=Q.presentationOffset=oe.start,void(oe.new=!1);for(;(xe=Ae)!=null&&xe.new;){var xe;Q.ccOffset+=oe.start-Ae.start,oe.new=!1,Ae=Q[(oe=Ae).prevCC]}Q.presentationOffset=ce}(e,t,V)),V&&(P=V-e.presentationOffset);var Y=L.endTime-L.startTime,j=Fi(9e4*(L.startTime+P-D),9e4*i)/9e4;L.startTime=Math.max(j,0),L.endTime=Math.max(j+Y,0);var ie=L.text.trim();L.text=decodeURIComponent(encodeURIComponent(ie)),L.id||(L.id=Eu(L.startTime,L.endTime,ie)),L.endTime>0&&E.push(L)},f.onparsingerror=function(L){h=L},f.onflush=function(){h?l(h):a(E)},p.forEach(function(L){if(S){if(vu(L,"X-TIMESTAMP-MAP=")){S=!1,L.slice(16).split(",").forEach(function(N){vu(N,"LOCAL:")?A=N.slice(6):vu(N,"MPEGTS:")&&(w=parseInt(N.slice(7)))});try{D=function(N){var P=parseInt(N.slice(-3)),V=parseInt(N.slice(-6,-4)),Y=parseInt(N.slice(-9,-7)),j=N.length>9?parseInt(N.substring(0,N.indexOf(":"))):0;if(!(re(P)&&re(V)&&re(Y)&&re(j)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+N);return P+=1e3*V,(P+=6e4*Y)+36e5*j}(A)/1e3}catch(N){h=N}return}L===""&&(S=!1)}f.parse(L+`
|
|
43
|
+
`)}),f.flush()}var yu="stpp.ttml.im1t",cf=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,hf=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Dg={left:"start",center:"center",right:"end",start:"start",end:"end"};function ff(d,s,e,t){var i=Je(new Uint8Array(d),["mdat"]);if(i.length!==0){var a,l,u,c,h=i.map(function(p){return Ii(p)}),f=(a=s.baseTime,l=1,(u=s.timescale)===void 0&&(u=1),c===void 0&&(c=!1),au(a,l,1/u,c));try{h.forEach(function(p){return e(function(E,b){var A=new DOMParser().parseFromString(E,"text/xml").getElementsByTagName("tt")[0];if(!A)throw new Error("Invalid ttml");var w={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},D=Object.keys(w).reduce(function(V,Y){return V[Y]=A.getAttribute("ttp:"+Y)||w[Y],V},{}),S=A.getAttribute("xml:space")!=="preserve",L=mf(bu(A,"styling","style")),N=mf(bu(A,"layout","region")),P=bu(A,"body","[begin]");return[].map.call(P,function(V){var Y=pf(V,S);if(!Y||!V.hasAttribute("begin"))return null;var j=Tu(V.getAttribute("begin"),D),ie=Tu(V.getAttribute("dur"),D),Q=Tu(V.getAttribute("end"),D);if(j===null)throw vf(V);if(Q===null){if(ie===null)throw vf(V);Q=j+ie}var X=new mu(j-b,Q-b,Y);X.id=Eu(X.startTime,X.endTime,X.text);var ce=function(xe,Le,Me){var Oe="http://www.w3.org/ns/ttml#styling",Pe=null,Ke=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],je=xe!=null&&xe.hasAttribute("style")?xe.getAttribute("style"):null;return je&&Me.hasOwnProperty(je)&&(Pe=Me[je]),Ke.reduce(function(et,lt){var Ti=_u(Le,Oe,lt)||_u(xe,Oe,lt)||_u(Pe,Oe,lt);return Ti&&(et[lt]=Ti),et},{})}(N[V.getAttribute("region")],L[V.getAttribute("style")],L),oe=ce.textAlign;if(oe){var Ae=Dg[oe];Ae&&(X.lineAlign=Ae),X.align=oe}return H(X,ce),X}).filter(function(V){return V!==null})}(p,f))})}catch(p){t(p)}}else t(new Error("Could not parse IMSC1 mdat"))}function bu(d,s,e){var t=d.getElementsByTagName(s)[0];return t?[].slice.call(t.querySelectorAll(e)):[]}function mf(d){return d.reduce(function(s,e){var t=e.getAttribute("xml:id");return t&&(s[t]=e),s},{})}function pf(d,s){return[].slice.call(d.childNodes).reduce(function(e,t,i){var a;return t.nodeName==="br"&&i?e+`
|
|
44
|
+
`:(a=t.childNodes)!=null&&a.length?pf(t,s):s?e+t.textContent.trim().replace(/\s+/g," "):e+t.textContent},"")}function _u(d,s,e){return d&&d.hasAttributeNS(s,e)?d.getAttributeNS(s,e):null}function vf(d){return new Error("Could not parse ttml timestamp "+d)}function Tu(d,s){if(!d)return null;var e=lf(d);return e===null&&(cf.test(d)?e=function(t,i){var a=cf.exec(t),l=(0|a[4])+(0|a[5])/i.subFrameRate;return 3600*(0|a[1])+60*(0|a[2])+(0|a[3])+l/i.frameRate}(d,s):hf.test(d)&&(e=function(t,i){var a=hf.exec(t),l=Number(a[1]);switch(a[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 Cg=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 Zo(this,"textTrack1"),i=new Zo(this,"textTrack2"),a=new Zo(this,"textTrack3"),l=new Zo(this,"textTrack4");this.cea608Parser1=new sf(1,t,i),this.cea608Parser2=new sf(3,a,l)}e.on(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(k.FRAG_LOADING,this.onFragLoading,this),e.on(k.FRAG_LOADED,this.onFragLoaded,this),e.on(k.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(k.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(k.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(k.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(k.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=d.prototype;return s.destroy=function(){var e=this.hls;e.off(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(k.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(k.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(k.FRAG_LOADING,this.onFragLoading,this),e.off(k.FRAG_LOADED,this.onFragLoaded,this),e.off(k.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(k.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(k.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(k.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(k.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(e,t,i,a,l){for(var u,c,h,f,p=!1,E=l.length;E--;){var b=l[E],A=(u=b[0],c=b[1],h=t,f=i,Math.min(c,f)-Math.max(u,h));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 w=this.captionsTracks[e];this.Cues.newCue(w,t,i,a)}else{var D=this.Cues.newCue(null,t,i,a);this.hls.trigger(k.CUES_PARSED,{type:"captions",cues:D,track:e})}},s.onInitPtsFound=function(e,t){var i=this,a=t.frag,l=t.id,u=t.initPTS,c=t.timescale,h=this.unparsedVttFrags;l==="main"&&(this.initPTS[a.cc]={baseTime:u,timescale:c}),h.length&&(this.unparsedVttFrags=[],h.forEach(function(f){i.onFragLoaded(k.FRAG_LOADED,f)}))},s.getExistingTrack=function(e){var t=this.media;if(t)for(var i=0;i<t.textTracks.length;i++){var a=t.textTracks[i];if(a[e])return a}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,a=this.media,l=t[e],u=l.label,c=l.languageCode,h=this.getExistingTrack(e);if(h)i[e]=h,Xr(i[e]),Ta(i[e],a);else{var f=this.createTextTrack("captions",u,c);f&&(f[e]=!0,i[e]=f)}}},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(k.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}}},s.createTextTrack=function(e,t,i){var a=this.media;if(a)return a.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){Xr(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++)Xr(t[i])}},s.onSubtitleTracksUpdated=function(e,t){var i=this,a=t.subtitleTracks||[],l=a.some(function(h){return h.textCodec===yu});if(this.config.enableWebVTT||l&&this.config.enableIMSC1){if(Zh(this.tracks,a))return void(this.tracks=a);if(this.textTracks=[],this.tracks=a,this.config.renderTextTracksNatively){var u=this.media?this.media.textTracks:null;this.tracks.forEach(function(h,f){var p;if(u&&f<u.length){for(var E=null,b=0;b<u.length;b++)if(Mg(u[b],h)){E=u[b];break}E&&(p=E)}if(p)Xr(p);else{var A=i._captionsOrSubtitlesFromCharacteristics(h);(p=i.createTextTrack(A,h.name,h.lang))&&(p.mode="disabled")}p&&(p.groupId=h.groupId,i.textTracks.push(p))})}else if(this.tracks.length){var c=this.tracks.map(function(h){return{label:h.name,kind:h.type.toLowerCase(),default:h.default,subtitleTrack:h}});this.hls.trigger(k.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(a){var l=/(?:CC|SERVICE)([1-4])/.exec(a.instreamId);if(l){var u="textTrack"+l[1],c=i.captionsProperties[u];c&&(c.label=a.name,a.lang&&(c.languageCode=a.lang),c.media=a)}})},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,a=this.cea608Parser2,l=this.lastSn,u=this.lastPartIndex;if(this.enabled&&i&&a&&t.frag.type===rt){var c,h,f=t.frag.sn,p=(c=t==null||(h=t.part)==null?void 0:h.index)!=null?c:-1;f===l+1||f===l&&p===u+1||(i.reset(),a.reset()),this.lastSn=f,this.lastPartIndex=p}},s.onFragLoaded=function(e,t){var i=t.frag,a=t.payload,l=this.initPTS,u=this.unparsedVttFrags;if(i.type===Oi)if(a.byteLength){if(!l[i.cc])return u.push(t),void(l.length&&this.hls.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Missing initial subtitle PTS")}));var c=i.decryptdata,h="stats"in t;if(c==null||!c.encrypted||h){var f=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),f&&f.textCodec===yu?this._parseIMSC1(i,a):this._parseVTTs(i,a,p)}}else this.hls.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(e,t){var i=this,a=this.hls;ff(t,this.initPTS[e.cc],function(l){i._appendCues(l,e.level),a.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(l){B.log("Failed to parse IMSC1: "+l),a.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:l})})},s._parseVTTs=function(e,t,i){var a,l=this,u=this.hls;Rg((a=e.initSegment)!=null&&a.data?br(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(k.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(c){l._fallbackToIMSC1(e,t),B.log("Failed to parse VTT cue: "+c),u.trigger(k.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:c})})},s._fallbackToIMSC1=function(e,t){var i=this,a=this.tracks[e.level];a.textCodec||ff(t,this.initPTS[e.cc],function(){a.textCodec=yu,i._parseIMSC1(e,t)},function(){a.textCodec="wvtt"})},s._appendCues=function(e,t){var i=this.hls;if(this.config.renderTextTracksNatively){var a=this.textTracks[t];if(!a||a.mode==="disabled")return;e.forEach(function(c){return Uo(a,c)})}else{var l=this.tracks[t];if(!l)return;var u=l.default?"default":"subtitles"+t;i.trigger(k.CUES_PARSED,{type:"subtitles",cues:e,track:u})}},s.onFragDecrypted=function(e,t){var i=t.frag;if(i.type===Oi){if(!this.initPTS[i.cc])return void this.unparsedVttFrags.push(t);this.onFragLoaded(k.FRAG_LOADED,t)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,a=this.cea608Parser2;if(this.enabled&&i&&a){var l=t.frag,u=t.samples;if(l.type!==rt||this.closedCaptionsForLevel(l)!=="NONE")for(var c=0;c<u.length;c++){var h=u[c].bytes;if(h){var f=this.extractCea608Data(h);i.addData(u[c].pts,f[0]),a.addData(u[c].pts,f[1])}}}},s.onBufferFlushing=function(e,t){var i=t.startOffset,a=t.endOffset,l=t.endOffsetSubtitles,u=t.type,c=this.media;if(c&&!(c.currentTime<a)){if(!u||u==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(p){return hs(h[p],i,a)})}if(this.config.renderTextTracksNatively&&i===0&&l!==void 0){var f=this.textTracks;Object.keys(f).forEach(function(p){return hs(f[p],i,l)})}}},s.extractCea608Data=function(e){for(var t=[[],[]],i=31&e[0],a=2,l=0;l<i;l++){var u=e[a++],c=127&e[a++],h=127&e[a++];if((c!==0||h!==0)&&(4&u)!=0){var f=3&u;f!==0&&f!==1||(t[f].push(c),t[f].push(h))}}return t},d}();function Mg(d,s){return!!d&&d.label===s.name&&!(d.textTrack1||d.textTrack2)}var xg=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(k.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(k.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.BUFFER_CODECS,this.onBufferCodecs,this),e.on(k.MEDIA_DETACHING,this.onMediaDetaching,this)},s.unregisterListener=function(){var e=this.hls;e.off(k.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(k.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(k.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.BUFFER_CODECS,this.onBufferCodecs,this),e.off(k.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 a=i.filter(function(l,u){return t.isLevelAllowed(l)&&u<=e});return this.clientRect=null,d.getMaxLevelByMediaSize(a,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 a,l,u=e.length-1,c=0;c<e.length;c+=1){var h=e[c];if((h.width>=t||h.height>=i)&&(a=h,!(l=e[c+1])||a.width!==l.width||a.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}(),Pg=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(k.MEDIA_ATTACHING,this.onMediaAttaching,this)},s.unregisterListeners=function(){this.hls.off(k.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 a=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=a,a&&typeof a.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 a=performance.now();if(t){if(this.lastTime){var l=a-this.lastTime,u=i-this.lastDroppedFrames,c=t-this.lastDecodedFrames,h=1e3*u/l,f=this.hls;if(f.trigger(k.FPS_DROP,{currentDropped:u,currentDecoded:c,totalDroppedFrames:i}),h>0&&u>f.config.fpsDroppedMonitoringThreshold*c){var p=f.currentLevel;B.warn("drop FPS ratio greater than max allowed value for currentLevel: "+p),p>0&&(f.autoLevelCapping===-1||f.autoLevelCapping>=p)&&(p-=1,f.trigger(k.FPS_DROP_LEVEL_CAPPING,{level:p,droppedLevel:f.currentLevel}),f.autoLevelCapping=p,this.streamController.nextLevelSwitch())}}this.lastTime=a,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}(),el="[eme]",gf=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=B.debug.bind(B,el),this.log=B.log.bind(B,el),this.warn=B.warn.bind(B,el),this.error=B.error.bind(B,el),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(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(k.MANIFEST_LOADED,this.onManifestLoaded,this)},s.unregisterListeners=function(){this.hls.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(k.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(k.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(k.MANIFEST_LOADED,this.onManifestLoaded,this)},s.getLicenseServerUrl=function(e){var t=this.config,i=t.drmSystems,a=t.widevineLicenseUrl,l=i[e];if(l)return l.licenseUrl;if(e===Ze.WIDEVINE&&a)return a;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,a=function(c,h,f){return!!c&&f.indexOf(c)===h},l=i.map(function(c){return c.audioCodec}).filter(a),u=i.map(function(c){return c.videoCodec}).filter(a);return l.length+u.length===0&&u.push("avc1.42e01e"),new Promise(function(c,h){(function f(p){var E=p.shift();t.getMediaKeysPromise(E,l,u).then(function(b){return c({keySystem:E,mediaKeys:b})}).catch(function(b){p.length?f(p):h(b instanceof Ui?b:new Ui({type:se.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 a="Configured requestMediaKeySystemAccess is not a function "+i;return jr===null&&self.location.protocol==="http:"&&(a="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(a))}return i(e,t)},s.getMediaKeysPromise=function(e,t,i){var a=this,l=function(f,p,E,b){var A;switch(f){case Ze.FAIRPLAY:A=["cenc","sinf"];break;case Ze.WIDEVINE:case Ze.PLAYREADY:A=["cenc"];break;case Ze.CLEARKEY:A=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+f)}return function(w,D,S,L){return[{initDataTypes:w,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,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 h=this.keySystemAccessPromises[e]={keySystemAccess:c};return c.catch(function(f){a.log('Failed to obtain access to key-system "'+e+'": '+f)}),c.then(function(f){a.log('Access for key-system "'+f.keySystem+'" obtained');var p=a.fetchServerCertificate(e);return a.log('Create media-keys for "'+e+'"'),h.mediaKeys=f.createMediaKeys().then(function(E){return a.log('Media-keys created for "'+e+'"'),p.then(function(b){return b?a.setMediaKeysServerCertificate(E,e,b):E})}),h.mediaKeys.catch(function(E){a.error('Failed to create media-keys for "'+e+'"}: '+E)}),h.mediaKeys})}return c.then(function(){return u.mediaKeys})},s.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem,a=e.mediaKeys;this.log('Creating key-system session "'+i+'" keyId: '+Pi(t.keyId||[]));var l=a.createSession(),u={decryptdata:t,keySystem:i,mediaKeys:a,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),a=this.getKeyIdString(t);this.keyIdToKeySessionPromise[a]=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 Pi(e.keyId)},s.updateKeySession=function(e,t){var i,a=e.mediaKeysSession;return this.log('Updating key-session "'+a.sessionId+'" for keyID '+Pi(((i=e.decryptdata)==null?void 0:i.keyId)||[])+`
|
|
45
|
+
} (data length: `+(t&&t.byteLength)+")"),a.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,a){var l=Er(t.config),u=e.map(Ei).filter(function(c){return!!c&&l.indexOf(c)!==-1});return t.getKeySystemSelectionPromise(u).then(function(c){var h=c.keySystem,f=rr(h);f?i(f):a(new Error('Unable to find format for key-system "'+h+'"'))}).catch(a)})},s.loadKey=function(e){var t=this,i=e.keyInfo.decryptdata,a=this.getKeyIdString(i),l="(keyId: "+a+' format: "'+i.keyFormat+'" method: '+i.method+" uri: "+i.uri+")";this.log("Starting session for key "+l);var u=this.keyIdToKeySessionPromise[a];return u||(u=this.keyIdToKeySessionPromise[a]=this.getKeySystemForKeyPromise(i).then(function(c){var h=c.keySystem,f=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(h,f).then(function(){t.throwIfDestroyed();var p=t.createMediaKeySessionContext({keySystem:h,mediaKeys:f,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 Ui?this.hls.trigger(k.ERROR,e.data):this.hls.trigger(k.ERROR,{type:se.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 a=Ei(e.keyFormat),l=a?[a]:Er(this.config);return this.attemptKeySystemAccess(l)}return i},s.getKeySystemSelectionPromise=function(e){if(e.length||(e=Er(this.config)),e.length===0)throw new Ui({type:se.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,a=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+i+'"'),a!==null){var l,u;if(i==="sinf"&&this.config.drmSystems[Ze.FAIRPLAY]){var c=Mt(new Uint8Array(a));try{var h=Rt(JSON.parse(c).sinf),f=ns(new Uint8Array(h));if(!f)return;l=f.subarray(8,24),u=Ze.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),Y=V.getUint32(0);if(N.byteLength!==Y&&Y>44||V.getUint32(4)!==1886614376||(P.version=V.getUint32(8)>>>24,P.version>1))return null;P.systemId=Pi(new Uint8Array(N,12,16));var j=V.getUint32(28);if(P.version===0){if(Y-32<j)return null;P.data=new Uint8Array(N,32,j)}else if(P.version===1){P.kids=[];for(var ie=0;ie<j;ie++)P.kids.push(new Uint8Array(N,32+16*ie,16))}return P}(a);if(p===null)return;p.version===0&&p.systemId===ct&&p.data&&(l=p.data.subarray(8,24)),u=function(N){if(N===ct)return Ze.WIDEVINE}(p.systemId)}if(u&&l){for(var E=Pi(l),b=this.keyIdToKeySessionPromise,A=this.mediaKeySessions,w=b[E],D=function(){var N=A[S],P=N.decryptdata;if(P.pssh||!P.keyId)return"continue";var V=Pi(P.keyId);return E===V||P.uri.replace(/-/g,"").indexOf(E)!==-1?(w=b[V],delete b[V],P.pssh=new Uint8Array(a),P.keyId=l,w=b[E]=w.then(function(){return t.generateRequestWithPreferredKeySession(N,i,a,"encrypted-event-key-match")}),"break"):void 0},S=0;S<A.length;S++){var L=D();if(L!=="continue"&&L==="break")break}w||(w=b[E]=this.getKeySystemSelectionPromise([u]).then(function(N){var P,V=N.keySystem,Y=N.mediaKeys;t.throwIfDestroyed();var j=new ba("ISO-23001-7",E,(P=rr(V))!=null?P:"");return j.pssh=new Uint8Array(a),j.keyId=l,t.attemptSetMediaKeys(V,Y).then(function(){t.throwIfDestroyed();var ie=t.createMediaKeySessionContext({decryptdata:j,keySystem:V,mediaKeys:Y});return t.generateRequestWithPreferredKeySession(ie,i,a,"encrypted-event-no-match")})})),w.catch(function(N){return t.handleError(N)})}}},s._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},s.attemptSetMediaKeys=function(e,t){var i=this,a=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var l=Promise.all(a).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+'"'),a.push(l),i.setMediaKeysQueue=i.setMediaKeysQueue.filter(function(u){return a.indexOf(u)===-1})})},s.generateRequestWithPreferredKeySession=function(e,t,i,a){var l,u,c=this,h=(l=this.config.drmSystems)==null||(u=l[e.keySystem])==null?void 0:u.generateRequest;if(h)try{var f=h.call(this.hls,t,i,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");t=f.initDataType,i=e.decryptdata.pssh=f.initData?new Uint8Array(f.initData):null}catch(w){var p;if(this.warn(w.message),(p=this.hls)!=null&&p.config.debug)throw w}if(i===null)return this.log('Skipping key-session request for "'+a+'" (no initData)'),Promise.resolve(e);var E=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+a+'": '+E+" (init data type: "+t+" length: "+(i?i.byteLength:null)+")");var b=new Xo;e.mediaKeysSession.onmessage=function(w){var D=e.mediaKeysSession;if(D){var S=w.messageType,L=w.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===Ze.FAIRPLAY&&(c.updateKeySession(e,$i("acknowledged")),c.removeSession(e)):c.warn('unhandled media key message type "'+S+'"')}else b.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(w){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(w,D){b.on("error",D),b.on("keyStatus",function(S){S.startsWith("usable")?w():S==="output-restricted"?D(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):S==="internal-error"?D(new Ui({type:se.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 w;c.log('Request generated for key-session "'+((w=e.mediaKeysSession)==null?void 0:w.sessionId)+'" keyId: '+E)}).catch(function(w){throw new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_NO_SESSION,error:w,fatal:!1},"Error generating key-session request: "+w)}).then(function(){return A}).catch(function(w){throw b.removeAllListeners(),c.removeSession(e),w}).then(function(){return b.removeAllListeners(),e})},s.onKeyStatusChange=function(e){var t=this;e.mediaKeysSession.keyStatuses.forEach(function(i,a){t.log('key status change "'+i+'" for keyStatuses keyId: '+Pi("buffer"in a?new Uint8Array(a.buffer,a.byteOffset,a.byteLength):new Uint8Array(a))+" session keyId: "+Pi(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),a=this.getServerCertificateUrl(e);return a?(this.log('Fetching serverCertificate for "'+e+'"'),new Promise(function(l,u){var c={responseType:"arraybuffer",url:a},h=t.certLoadPolicy.default,f={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},p={onSuccess:function(E,b,A,w){l(E.data)},onError:function(E,b,A,w){u(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:A,response:y({url:c.url,data:void 0},E)},'"'+e+'" certificate request failed ('+a+"). Status: "+E.code+" ("+E.text+")"))},onTimeout:function(E,b,A){u(new Ui({type:se.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 ('+a+")"))},onAbort:function(E,b,A){u(new Error("aborted"))}};i.load(c,f,p)})):Promise.resolve()},s.setMediaKeysServerCertificate=function(e,t,i){var a=this;return new Promise(function(l,u){e.setServerCertificate(i).then(function(c){a.log("setServerCertificate "+(c?"success":"not supported by CDM")+" ("+(i==null?void 0:i.byteLength)+') on "'+t+'"'),l(e)}).catch(function(c){u(new Ui({type:se.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(a){return i.updateKeySession(e,new Uint8Array(a)).catch(function(l){throw new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:l,fatal:!0},l.message)})})},s.setupLicenseXHR=function(e,t,i,a){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,a)}).catch(function(c){if(!i.decryptdata)throw c;return e.open("POST",t,!0),u.call(l.hls,e,t,i,a)}).then(function(c){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:c||a}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:a}))},s.requestLicense=function(e,t){var i=this,a=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 h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return u(new Error("invalid state"));if(h.readyState===4)if(h.status===200){i._requestLicenseFailureCount=0;var f=h.response;i.log("License received "+(f instanceof ArrayBuffer?f.byteLength:f));var p=i.config.licenseResponseCallback;if(p)try{f=p.call(i.hls,h,c,e)}catch(w){i.error(w)}l(f)}else{var E=a.errorRetry,b=E?E.maxNumRetry:0;if(i._requestLicenseFailureCount++,i._requestLicenseFailureCount>b||h.status>=400&&h.status<500)u(new Ui({type:se.KEY_SYSTEM_ERROR,details:W.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:h,response:{url:c,data:void 0,code:h.status,text:h.statusText}},"License Request XHR failed ("+c+"). Status: "+h.status+" ("+h.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=h,i.setupLicenseXHR(h,c,e,t).then(function(f){var p=f.xhr,E=f.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 a=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(){a&&(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.onManifestLoading=function(){this.keyFormatPromise=null},s.onManifestLoaded=function(e,t){var i=t.sessionKeys;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){var a=i.reduce(function(l,u){return l.indexOf(u.keyFormat)===-1&&l.push(u.keyFormat),l},[]);this.log("Selecting key-system from session-keys "+a.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(a)}},s.removeSession=function(e){var t=this,i=e.mediaKeysSession,a=e.licenseXhr;if(i){this.log("Remove licenses and keys and close session "+i.sessionId),i.onmessage=null,i.onkeystatuseschange=null,a&&a.readyState!==XMLHttpRequest.DONE&&a.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}();gf.CDMCleanupPromise=void 0;var Ui=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)),Og="m",tl="a",Au="v",Su="av",Ef="i",Ng="tt",Fg=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:Og,su:!t.initialized})}catch(u){B.warn("Could not generate manifest CMCD data.",u)}},this.applyFragmentData=function(l){try{var u=l.frag,c=t.hls.levels[u.level],h=t.getObjectType(u),f={d:1e3*u.duration,ot:h};h!==Au&&h!==tl&&h!=Su||(f.br=c.bitrate/1e3,f.tb=t.getTopBandwidth(h)/1e3,f.bl=t.getBufferLength(h)),t.apply(l,f)}catch(p){B.warn("Could not generate segment CMCD data.",p)}},this.hls=e;var i=this.config=e.config,a=i.cmcd;a!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||d.uuid(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.registerListeners())}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(k.MEDIA_DETACHED,this.onMediaDetached,this),e.on(k.BUFFER_CREATED,this.onBufferCreated,this)},s.unregisterListeners=function(){var e=this.hls;e.off(k.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(k.MEDIA_DETACHED,this.onMediaDetached,this),e.off(k.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,a;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(a=t.tracks.video)==null?void 0:a.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={}),H(t,this.createData());var i=t.ot===Ef||t.ot===Au||t.ot===Su;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var a=d.toHeaders(t);if(!Object.keys(a).length)return;e.headers||(e.headers={}),H(e.headers,a)}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"?Ng:e.sn==="initSegment"?Ef:t==="audio"?tl:t==="main"?this.hls.audioTracks.length?Au:Su:void 0},s.getTopBandwidth=function(e){var t,i=0,a=this.hls;if(e===tl)t=a.audioTracks;else{var l=a.maxAutoLevel,u=l>-1?l+1:a.levels.length;t=a.levels.slice(0,u)}for(var c,h=ye(t);!(c=h()).done;){var f=c.value;f.bitrate>i&&(i=f.bitrate)}return i>0?i:NaN},s.getBufferLength=function(e){var t=this.hls.media,i=e===tl?this.audioBuffer:this.videoBuffer;return i&&t?1e3*he.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 a(u){this.loader=void 0,this.loader=new i(u)}var l=a.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(u,c,h){t(u),this.loader.load(u,c,h)},M(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),a}()},s.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function a(u){this.loader=void 0,this.loader=new i(u)}var l=a.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(u,c,h){t(u),this.loader.load(u,c,h)},M(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),a}()},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=[],a=function(w){return!Number.isNaN(w)&&w!=null&&w!==""&&w!==!1},l=function(w){return Math.round(w)},u=function(w){return 100*l(w/100)},c={br:l,d:l,bl:u,dl:u,mtp:u,nor:function(w){return encodeURIComponent(w)},rtp:u,tb:l},h=ye(Object.keys(e||{}).sort());!(t=h()).done;){var f=t.value,p=e[f];if(a(p)&&!(f==="v"&&p===1||f=="pr"&&p===1)){var E=c[f];E&&(p=E(p));var b=typeof p,A=void 0;A=f==="ot"||f==="sf"||f==="st"?f+"="+p:b==="boolean"?f:b==="number"?f+"="+p:f+"="+JSON.stringify(p),i.push(A)}}return i.join(",")},d.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],a=[{},{},{},{}],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 h=c[u];a[l[h]!=null?l[h]:1][h]=e[h]}for(var f=0;f<a.length;f++){var p=d.serialize(a[f]);p&&(t["CMCD-"+i[f]]=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}(),Ug=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=B.log.bind(B,"[content-steering]:"),this.registerListeners()}var s=d.prototype;return s.registerListeners=function(){var e=this.hls;e.on(k.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(k.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.ERROR,this.onError,this)},s.unregisterListeners=function(){var e=this.hls;e&&(e.off(k.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(k.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.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 a=this.pathwayPriority,l=this.pathwayId;this.penalizedPathways[l]||(this.penalizedPathways[l]=performance.now()),!a&&this.levels&&(a=this.levels.reduce(function(u,c){return u.indexOf(c.pathwayId)===-1&&u.push(c.pathwayId),u},[])),a&&a.length>1&&(this.updatePathwayPriority(a),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,a=performance.now();Object.keys(i).forEach(function(p){a-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,h=this.hls.levels[c];if((t=this.getLevelsForPathway(u)).length>0){this.log('Setting Pathway to "'+u+'"'),this.pathwayId=u,this.hls.trigger(k.LEVELS_UPDATED,{levels:t});var f=this.hls.levels[c];h&&f&&this.levels&&(f.attrs["STABLE-VARIANT-ID"]!==h.attrs["STABLE-VARIANT-ID"]&&f.bitrate!==h.bitrate&&this.log("Unstable Pathways change from bitrate "+h.bitrate+" to "+f.bitrate),this.hls.nextLoadLevel=c);break}}}},s.clonePathways=function(e){var t=this,i=this.levels;if(i){var a={},l={};e.forEach(function(u){var c=u.ID,h=u["BASE-ID"],f=u["URI-REPLACEMENT"];if(!i.some(function(E){return E.pathwayId===c})){var p=t.getLevelsForPathway(h).map(function(E){var b=H({},E);b.details=void 0,b.url=bf(E.uri,E.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",f);var A=new nt(E.attrs);A["PATHWAY-ID"]=c;var w=A.AUDIO&&A.AUDIO+"_clone_"+c,D=A.SUBTITLES&&A.SUBTITLES+"_clone_"+c;w&&(a[A.AUDIO]=w,A.AUDIO=w),D&&(l[A.SUBTITLES]=D,A.SUBTITLES=D),b.attrs=A;var S=new wa(b);return $(S,"audio",w),$(S,"text",D),S});i.push.apply(i,p),yf(t.audioTracks,a,f,c),yf(t.subtitleTracks,l,f,c)}})}},s.loadSteeringManifest=function(e){var t,i=this,a=this.hls.config,l=a.loader;this.loader&&this.loader.destroy(),this.loader=new l(a);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||a.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+u)}var c={responseType:"json",url:t.href},h=a.steeringManifestLoadPolicy.default,f=h.errorRetry||h.timeoutRetry||{},p={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:f.maxNumRetry||0,retryDelay:f.retryDelayMs||0,maxRetryDelay:f.maxRetryDelayMs||0},E={onSuccess:function(b,A,w,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||w.url),N&&i.clonePathways(N),P&&i.updatePathwayPriority(P)}else i.log("Steering VERSION "+S.VERSION+" not supported!")},onError:function(b,A,w,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,w){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 yf(d,s,e,t){d&&Object.keys(s).forEach(function(i){var a=d.filter(function(l){return l.groupId===i}).map(function(l){var u=H({},l);return u.details=void 0,u.attrs=new nt(u.attrs),u.url=u.attrs.URI=bf(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,a)})}function bf(d,s,e,t){var i,a=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 a&&!i&&(c.host=a),l&&Object.keys(l).sort().forEach(function(h){h&&c.searchParams.set(h,l[h])}),c.href}var Bg=/^age:\s*[\d.]+\s*$/im,_f=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 Gt,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 a=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(a,i.url)}).catch(function(c){return a.open("GET",i.url,!0),u(a,i.url)}).then(function(){e.stats.aborted||e.openAndSendXhr(a,i,t)}).catch(function(c){e.callbacks.onError({code:a.status,text:c.message},i,a,l)}):this.openAndSendXhr(a,i,t)}},s.openAndSendXhr=function(e,t,i){e.readyState||e.open("GET",t.url,!0);var a=this.context.headers,l=i.loadPolicy,u=l.maxTimeToFirstByteMs,c=l.maxLoadTimeMs;if(a)for(var h in a)e.setRequestHeader(h,a[h]);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&&re(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 a=t.readyState,l=this.config;if(!i.aborted&&a>=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)))),a===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 h=c?t.response:t.responseText,f=t.responseType==="arraybuffer"?h.byteLength:h.length;if(i.loaded=i.total=f,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;var p=this.callbacks.onProgress;if(p&&p(i,e,h,t),!this.callbacks)return;var E={url:t.responseURL,data:h,code:u};this.callbacks.onSuccess(E,i,e,t)}else{var b=l.loadPolicy.errorRetry;un(b,i.retry,!1,u)?this.retry(b):(B.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(un(t,this.stats.retry,!0))this.retry(t);else{B.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=Es(e,i.retry),i.retry++,B.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&&Bg.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}(),Hg=/(\d+)-(\d+)\/(\d+)/,Tf=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||Gg,this.controller=new self.AbortController,this.stats=new Gt}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 a=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,w){var D={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(H({},A.headers))};return A.rangeEnd&&D.headers.set("Range","bytes="+A.rangeStart+"-"+String(A.rangeEnd-1)),D}(e,this.controller.signal),c=i.onProgress,h=e.responseType==="arraybuffer",f=h?"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&&re(E)?E:b,this.requestTimeout=self.setTimeout(function(){a.abortInternal(),i.onTimeout(l,e,a.response)},t.timeout),self.fetch(this.request).then(function(A){a.response=a.loader=A;var w=Math.max(self.performance.now(),l.loading.start);if(self.clearTimeout(a.requestTimeout),t.timeout=b,a.requestTimeout=self.setTimeout(function(){a.abortInternal(),i.onTimeout(l,e,a.response)},b-(w-l.loading.start)),!A.ok){var D=A.status,S=A.statusText;throw new Vg(S||"fetch, bad network response",D,A)}return l.loading.first=w,l.total=function(L){var N=L.get("Content-Range");if(N){var P=function(Y){var j=Hg.exec(Y);if(j)return parseInt(j[2])-parseInt(j[1])+1}(N);if(re(P))return P}var V=L.get("Content-Length");if(V)return parseInt(V)}(A.headers)||l.total,c&&re(t.highWaterMark)?a.loadProgressively(A,l,e,t.highWaterMark,c):h?A.arrayBuffer():e.responseType==="json"?A.json():A.text()}).then(function(A){var w=a.response;self.clearTimeout(a.requestTimeout),l.loading.end=Math.max(self.performance.now(),l.loading.first);var D=A[f];D&&(l.loaded=l.total=D);var S={url:w.url,data:A,code:w.status};c&&!re(t.highWaterMark)&&c(l,e,A,w),i.onSuccess(S,l,e,w)}).catch(function(A){if(self.clearTimeout(a.requestTimeout),!l.aborted){var w=A&&A.code||0,D=A?A.message:null;i.onError({code:w,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,a,l){a===void 0&&(a=0);var u=new Xh,c=e.body.getReader();return function h(){return c.read().then(function(f){if(f.done)return u.dataLength&&l(t,i,u.flush(),e),Promise.resolve(new ArrayBuffer(0));var p=f.value,E=p.length;return t.loaded+=E,E<a||u.dataLength?(u.push(p),u.dataLength>=a&&l(t,i,u.flush(),e)):l(t,i,p,e),h()}).catch(function(){return Promise.reject()})}()},d}();function Gg(d,s){return new self.Request(d.url,s)}var Vg=function(d){function s(e,t,i){var a;return(a=d.call(this,e)||this).code=void 0,a.details=void 0,a.code=t,a.details=i,a}return z(s,d),s}(_e(Error)),Kg=/\s/,Wg=y(y({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:_f,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:og,bufferController:pg,capLevelController:xg,errorController:O,fpsController:Pg,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:jr,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,a,l,u,c,h=[],f=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=uf(c.trim()),w=Eu(s,e,A);d!=null&&(E=d.cues)!=null&&E.getCueById(w)||((a=new f(s,e,A)).id=w,a.line=p+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*u/32)),h.push(a))}return d&&h.length&&(h.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}),h.forEach(function(D){return Uo(d,D)})),h}},enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:cg,subtitleTrackController:fg,timelineController:Cg,audioStreamController:lg,audioTrackController:dg,emeController:gf,cmcdController:Fg,contentSteeringController:Ug});function ku(d){return d&&typeof d=="object"?Array.isArray(d)?d.map(ku):Object.keys(d).reduce(function(s,e){return s[e]=ku(d[e]),s},{}):d}function qg(d){var s=d.loader;s!==Tf&&s!==_f?(B.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=Tf,d.progressive=!0,d.enableSoftwareAES=!0,B.log("[config]: Progressive streaming enabled, using FetchLoader"))}var Af=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 Xo,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,it(e.debug||!1,"Hls instance");var t=this.config=function(ce,oe){if((oe.liveSyncDurationCount||oe.liveMaxLatencyDurationCount)&&(oe.liveSyncDuration||oe.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(oe.liveMaxLatencyDurationCount!==void 0&&(oe.liveSyncDurationCount===void 0||oe.liveMaxLatencyDurationCount<=oe.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(oe.liveMaxLatencyDuration!==void 0&&(oe.liveSyncDuration===void 0||oe.liveMaxLatencyDuration<=oe.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var Ae=ku(ce),xe=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(function(Le){var Me=(Le==="level"?"playlist":Le)+"LoadPolicy",Oe=oe[Me]===void 0,Pe=[];xe.forEach(function(Ke){var je=Le+"Loading"+Ke,et=oe[je];if(et!==void 0&&Oe){Pe.push(je);var lt=Ae[Me].default;switch(oe[Me]={default:lt},Ke){case"TimeOut":lt.maxLoadTimeMs=et,lt.maxTimeToFirstByteMs=et;break;case"MaxRetry":lt.errorRetry.maxNumRetry=et,lt.timeoutRetry.maxNumRetry=et;break;case"RetryDelay":lt.errorRetry.retryDelayMs=et,lt.timeoutRetry.retryDelayMs=et;break;case"MaxRetryTimeout":lt.errorRetry.maxRetryDelayMs=et,lt.timeoutRetry.maxRetryDelayMs=et}}}),Pe.length&&B.warn('hls.js config: "'+Pe.join('", "')+'" setting(s) are deprecated, use "'+Me+'": '+JSON.stringify(oe[Me]))}),y(y({},Ae),oe)}(d.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&qg(t);var i=t.abrController,a=t.bufferController,l=t.capLevelController,u=t.errorController,c=t.fpsController,h=new u(this),f=this.abrController=new i(this),p=this.bufferController=new a(this),E=this.capLevelController=new l(this),b=new c(this),A=new xt(this),w=new jd(this),D=t.contentSteeringController,S=D?new D(this):null,L=this.levelController=new G(this,S),N=new we(this),P=new At(this.config),V=this.streamController=new ng(this,N,P);E.setStreamController(V),b.setStreamController(V);var Y=[A,L,V];S&&Y.splice(1,0,S),this.networkControllers=Y;var j=[f,p,E,b,w,N];this.audioTrackController=this.createController(t.audioTrackController,Y);var ie=t.audioStreamController;ie&&Y.push(new ie(this,N,P)),this.subtitleTrackController=this.createController(t.subtitleTrackController,Y);var Q=t.subtitleStreamController;Q&&Y.push(new Q(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(zd,j),this.coreComponents=j,Y.push(h);var X=h.onErrorOut;typeof X=="function"&&this.on(k.ERROR,X,h)}d.isSupported=function(){return function(){var e=nn();if(!e)return!1;var t=Ch(),i=e&&typeof e.isTypeSupported=="function"&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),a=!t||t.prototype&&typeof t.prototype.appendBuffer=="function"&&typeof t.prototype.remove=="function";return!!i&&!!a}()};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,a){i===void 0&&(i=this),this._emitter.off(e,t,i,a)},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){B.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(k.ERROR,{type:se.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(){B.log("destroy"),this.trigger(k.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){B.log("attachMedia"),this._media=e,this.trigger(k.MEDIA_ATTACHING,{media:e})},s.detachMedia=function(){B.log("detachMedia"),this.trigger(k.MEDIA_DETACHING,void 0),this._media=null},s.loadSource=function(e){this.stopLoad();var t=this.media,i=this.url,a=this.url=Ge.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});B.log("loadSource:"+a),t&&i&&(i!==a||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(k.MANIFEST_LOADING,{url:e})},s.startLoad=function(e){e===void 0&&(e=-1),B.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},s.stopLoad=function(){B.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},s.swapAudioCodec=function(){B.log("swapAudioCodec"),this.streamController.swapAudioCodec()},s.recoverMediaError=function(){B.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){B.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){B.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){B.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){B.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){B.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&&(B.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){fs.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,a=0;a<i;a++)if(e[a].maxBitrate>=t)return a;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,i=this.autoLevelCapping,a=this.maxHdcpLevel;if(e=i===-1&&t&&t.length?t.length-1:i,a)for(var l=e;l--;){var u=t[l].attrs["HDCP-LEVEL"];if(u&&u<=a)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.5"}},{key:"Events",get:function(){return k}},{key:"ErrorTypes",get:function(){return se}},{key:"ErrorDetails",get:function(){return W}},{key:"DefaultConfig",get:function(){return d.defaultConfig?d.defaultConfig:Wg},set:function(e){d.defaultConfig=e}}]),d}();return Af.defaultConfig=void 0,Af},typeof gp=="object"&&typeof Kc!="undefined"?Kc.exports=m():typeof define=="function"&&define.amd?define(m):(o=typeof globalThis!="undefined"?globalThis:o||self).Hls=m()})(!1)});var En=class{addEventListener(){}removeEventListener(){}dispatchEvent(r){return!0}};if(typeof DocumentFragment=="undefined"){class n extends En{}globalThis.DocumentFragment=n}var ks=class extends En{},Ru=class extends En{},nE={get(n){},define(n,r,o){},upgrade(n){},whenDefined(n){return Promise.resolve(ks)}},ws,Du=class{constructor(r,o={}){Bt(this,ws,void 0);Gi(this,ws,o==null?void 0:o.detail)}get detail(){return ot(this,ws)}initCustomEvent(){}};ws=new WeakMap;function sE(n,r){return new ks}var Cf={document:{createElement:sE},DocumentFragment,customElements:nE,CustomEvent:Du,EventTarget:En,HTMLElement:ks,HTMLVideoElement:Ru},Mf=typeof window=="undefined"||typeof globalThis.customElements=="undefined",qt=Mf?Cf:globalThis,Mi=Mf?Cf.document:globalThis.document;var Ie={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_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",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"},yn={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailablechange",MEDIA_FULLSCREEN_UNAVAILABLE:"mediafullscreenunavailablechange",MEDIA_PIP_UNAVAILABLE:"mediapipunavailablechange",MEDIA_CAST_UNAVAILABLE:"mediacastunavailablechange",MEDIA_PAUSED:"mediapausedchange",MEDIA_HAS_PLAYED:"mediahasplayedchange",MEDIA_ENDED:"mediaendedchange",MEDIA_MUTED:"mediamutedchange",MEDIA_VOLUME_LEVEL:"mediavolumelevelchange",MEDIA_VOLUME:"mediavolumechange",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailablechange",MEDIA_IS_PIP:"mediaispipchange",MEDIA_IS_CASTING:"mediaiscastingchange",MEDIA_SUBTITLES_LIST:"mediasubtitleslistchange",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowingchange",MEDIA_IS_FULLSCREEN:"mediaisfullscreenchange",MEDIA_PLAYBACK_RATE:"mediaplaybackratechange",MEDIA_CURRENT_TIME:"mediacurrenttimechange",MEDIA_DURATION:"mediadurationchange",MEDIA_SEEKABLE:"mediaseekablechange",MEDIA_PREVIEW_TIME:"mediapreviewtimechange",MEDIA_PREVIEW_IMAGE:"mediapreviewimagechange",MEDIA_PREVIEW_COORDS:"mediapreviewcoordschange",MEDIA_LOADING:"medialoadingchange",MEDIA_BUFFERED:"mediabufferedchange",MEDIA_STREAM_TYPE:"mediastreamtypechange",MEDIA_TARGET_LIVE_WINDOW:"mediatargetlivewindowchange",MEDIA_TIME_IS_LIVE:"mediatimeislivechange",USER_INACTIVE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange"},Ne={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},F={MEDIA_AIRPLAY_UNAVAILABLE:"mediaairplayunavailable",MEDIA_FULLSCREEN_UNAVAILABLE:"mediafullscreenunavailable",MEDIA_PIP_UNAVAILABLE:"mediapipunavailable",MEDIA_CAST_UNAVAILABLE:"mediacastunavailable",MEDIA_PAUSED:"mediapaused",MEDIA_HAS_PLAYED:"mediahasplayed",MEDIA_ENDED:"mediaended",MEDIA_MUTED:"mediamuted",MEDIA_VOLUME_LEVEL:"mediavolumelevel",MEDIA_VOLUME:"mediavolume",MEDIA_VOLUME_UNAVAILABLE:"mediavolumeunavailable",MEDIA_IS_PIP:"mediaispip",MEDIA_IS_CASTING:"mediaiscasting",MEDIA_SUBTITLES_LIST:"mediasubtitleslist",MEDIA_SUBTITLES_SHOWING:"mediasubtitlesshowing",MEDIA_IS_FULLSCREEN:"mediaisfullscreen",MEDIA_PLAYBACK_RATE:"mediaplaybackrate",MEDIA_CURRENT_TIME:"mediacurrenttime",MEDIA_DURATION:"mediaduration",MEDIA_SEEKABLE:"mediaseekable",MEDIA_PREVIEW_TIME:"mediapreviewtime",MEDIA_PREVIEW_IMAGE:"mediapreviewimage",MEDIA_PREVIEW_COORDS:"mediapreviewcoords",MEDIA_LOADING:"medialoading",MEDIA_BUFFERED:"mediabuffered",MEDIA_STREAM_TYPE:"mediastreamtype",MEDIA_TARGET_LIVE_WINDOW:"mediatargetlivewindow",MEDIA_TIME_IS_LIVE:"mediatimeislive"},rb=Object.entries(yn).reduce((n,[r,o])=>{let m=F[r];return m&&(n[o]=m),n},{userinactivechange:"userinactive"}),xf=Object.entries(F).reduce((n,[r,o])=>{let m=yn[r];return m&&(n[o]=m),n},{userinactive:"userinactivechange"}),bn={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},al={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"};var Cu={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Dr={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Zi={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"};var si={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"},bt={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"},lE={...si,...bt};function nl(n,r=!1){return n.split("_").map(function(o,m){return(m||r?o[0].toUpperCase():o[0].toLowerCase())+o.slice(1).toLowerCase()}).join("")}function Pf(n){return n.replace(/[-_]([a-z])/g,(r,o)=>o.toUpperCase())}function Of(n){return typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n)}function sl(n){return typeof n!="string"?!1:!isNaN(n)&&!isNaN(parseFloat(n))}var ol=n=>new Promise(r=>setTimeout(r,n));var Nf=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],dE=(n,r)=>{let o=n===1?Nf[r].singular:Nf[r].plural;return`${n} ${o}`},Na=n=>{if(!Of(n))return"";let r=Math.abs(n),o=r!==n,m=new Date(0,0,0,0,0,r,0);return`${[m.getHours(),m.getMinutes(),m.getSeconds()].map((M,U)=>M&&dE(M,U)).filter(M=>M).join(", ")}${o?" remaining":""}`};function or(n,r){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),y=Math.floor(n/3600),I=Math.floor(r/60%60),M=Math.floor(r/3600);return(isNaN(n)||n===1/0)&&(y=v=m="-"),y=y>0||M>0?y+":":"",v=((y||I>=10)&&v<10?"0"+v:v)+":",m=m<10?"0"+m:m,(o?"-":"")+y+v+m}var uE=Object.freeze({length:0,start(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0}});function Ff(n=uE){return Array.from(n).map((r,o)=>[Number(n.start(o).toFixed(3)),Number(n.end(o).toFixed(3))].join(":")).join(" ")}var Uf=(n,r,o=".value")=>{let m=n.querySelector(o);!m||(m.textContent=r)},hE=(n,r)=>{let o=`slot[name="${r}"]`,m=n.shadowRoot.querySelector(o);return m?m.children:[]},Bf=(n,r)=>hE(n,r)[0],Ls=(n,r)=>!n||!r?!1:n.contains(r)?!0:Ls(n,r.getRootNode().host),Fa=(n,r)=>{if(!n)return null;let o=n.closest(r);return o||Fa(n.getRootNode().host,r)};function mt(n,r){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 y of v!=null?v:[])if(y.selectorText===r)return y}return m!=null&&m.sheet?(m.sheet.insertRule(`${r}{}`,m.sheet.cssRules.length),m.sheet.cssRules[m.sheet.cssRules.length-1]):{style:{setProperty:()=>{},removeProperty:()=>{}}}}function St(n,r){let o=n.getAttribute(r);return o!=null?+o:void 0}function Lt(n,r,o){if(St(n,r)!=o){if(o==null){n.removeAttribute(r);return}n.setAttribute(r,`${+o}`)}}function ht(n,r){return n.hasAttribute(r)}function pt(n,r,o){if(ht(n,r)!=o){if(o==null){n.removeAttribute(r);return}n.toggleAttribute(r,o)}}function Ht(n,r){var o;return(o=n.getAttribute(r))!=null?o:void 0}function Yt(n,r,o){if(Ht(n,r)!=o){if(o==null){n.removeAttribute(r);return}n.setAttribute(r,`${o}`)}}var ll=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},Mu=class{observe(){}},Hf={ResizeObserver:Mu,HTMLElement:class extends ll{},DocumentFragment:class extends ll{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},CustomEvent:function(){},getComputedStyle:function(){}},fE={createElement:function(){return new Hf.HTMLElement},addEventListener(){},removeEventListener(){}},Gf=typeof window=="undefined"||typeof window.customElements=="undefined",q=Gf?Hf:window,ae=Gf?fE:window.document;var mE=Object.defineProperty,pE=(n,r,o)=>r in n?mE(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o,vE=(n,r,o)=>(pE(n,typeof r!="symbol"?r+"":r,o),o),Vf=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},Vi=(n,r,o)=>(Vf(n,r,"read from private field"),o?o.call(n):r.get(n)),dl=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},ul=(n,r,o,m)=>(Vf(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),lr,cl,_n,hl,Kf=ae.createElement("template");Kf.innerHTML=`
|
|
46
46
|
<style>
|
|
47
47
|
:host {
|
|
48
48
|
font: var(--media-font,
|
|
@@ -90,12 +90,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
90
90
|
min-width: 100%;
|
|
91
91
|
}
|
|
92
92
|
</style>
|
|
93
|
-
`;var
|
|
93
|
+
`;var vt=class extends q.HTMLElement{constructor(r={}){if(super(),dl(this,lr,void 0),vE(this,"preventClick",!1),dl(this,cl,m=>{this.preventClick||this.handleClick(m)}),dl(this,_n,m=>{let{key:v}=m;if(!this.keysUsed.includes(v)){this.removeEventListener("keyup",Vi(this,_n));return}this.preventClick||this.handleClick(m)}),dl(this,hl,m=>{let{metaKey:v,altKey:y,key:I}=m;if(v||y||!this.keysUsed.includes(I)){this.removeEventListener("keyup",Vi(this,_n));return}this.addEventListener("keyup",Vi(this,_n),{once:!0})}),!this.shadowRoot){this.attachShadow({mode:"open"});let m=Kf.content.cloneNode(!0);this.nativeEl=m;let v=r.slotTemplate;v||(v=ae.createElement("template"),v.innerHTML=`<slot>${r.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),this.shadowRoot.appendChild(m)}let{style:o}=mt(this.shadowRoot,":host");o.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`)}static get observedAttributes(){return["disabled",Ne.MEDIA_CONTROLLER]}enable(){this.addEventListener("click",Vi(this,cl)),this.addEventListener("keydown",Vi(this,hl)),this.tabIndex=0}disable(){this.removeEventListener("click",Vi(this,cl)),this.removeEventListener("keydown",Vi(this,hl)),this.removeEventListener("keyup",Vi(this,_n)),this.tabIndex=-1}attributeChangedCallback(r,o,m){var v,y,I,M,U;r===Ne.MEDIA_CONTROLLER?(o&&((y=(v=Vi(this,lr))==null?void 0:v.unassociateElement)==null||y.call(v,this),ul(this,lr,null)),m&&(ul(this,lr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(U=(M=Vi(this,lr))==null?void 0:M.associateElement)==null||U.call(M,this))):r==="disabled"&&m!==o&&(m==null?this.enable():this.disable())}connectedCallback(){var r,o,m;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","button");let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(ul(this,lr,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(o=Vi(this,lr))==null?void 0:o.associateElement)==null||m.call(o,this))}disconnectedCallback(){var r,o;this.disable(),(o=(r=Vi(this,lr))==null?void 0:r.unassociateElement)==null||o.call(r,this),ul(this,lr,null)}get keysUsed(){return["Enter"," "]}handleClick(r){}};lr=new WeakMap;cl=new WeakMap;_n=new WeakMap;hl=new WeakMap;q.customElements.get("media-chrome-button")||q.customElements.define("media-chrome-button",vt);var gE=`<svg aria-hidden="true" viewBox="0 0 26 24">
|
|
94
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"/>
|
|
95
95
|
</svg>
|
|
96
|
-
`,
|
|
97
|
-
<slot name="
|
|
98
|
-
`;var
|
|
96
|
+
`,Wf=ae.createElement("template");Wf.innerHTML=`
|
|
97
|
+
<slot name="icon">${gE}</slot>
|
|
98
|
+
`;var xu=class extends vt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_AIRPLAY_UNAVAILABLE]}constructor(r={}){super({slotTemplate:Wf,...r})}connectedCallback(){this.setAttribute("aria-label",bt.AIRPLAY()),super.connectedCallback()}get mediaAirplayUnavailable(){return Ht(this,F.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(r){Yt(this,F.MEDIA_AIRPLAY_UNAVAILABLE,r)}handleClick(){let r=new q.CustomEvent(Ie.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(r)}};q.customElements.get("media-airplay-button")||q.customElements.define("media-airplay-button",xu);var EE='<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>',yE='<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>',Yf=ae.createElement("template");Yf.innerHTML=`
|
|
99
99
|
<style>
|
|
100
100
|
:host([${F.MEDIA_IS_CASTING}]) slot:not([name=exit]):not([name=icon]) {
|
|
101
101
|
display: none !important;
|
|
@@ -108,17 +108,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
108
108
|
</style>
|
|
109
109
|
|
|
110
110
|
<slot name="icon">
|
|
111
|
-
<slot name="enter">${
|
|
112
|
-
<slot name="exit">${
|
|
111
|
+
<slot name="enter">${EE}</slot>
|
|
112
|
+
<slot name="exit">${yE}</slot>
|
|
113
113
|
</slot>
|
|
114
|
-
`;var
|
|
114
|
+
`;var qf=n=>{let o=n.getAttribute(F.MEDIA_IS_CASTING)!=null?bt.EXIT_CAST():bt.ENTER_CAST();n.setAttribute("aria-label",o)},Pu=class extends vt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_CASTING,F.MEDIA_CAST_UNAVAILABLE]}constructor(r={}){super({slotTemplate:Yf,...r})}connectedCallback(){qf(this),super.connectedCallback()}attributeChangedCallback(r,o,m){r===F.MEDIA_IS_CASTING&&qf(this),super.attributeChangedCallback(r,o,m)}get mediaIsCasting(){return ht(this,F.MEDIA_IS_CASTING)}set mediaIsCasting(r){pt(this,F.MEDIA_IS_CASTING,r)}get mediaCastUnavailable(){return Ht(this,F.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(r){Yt(this,F.MEDIA_CAST_UNAVAILABLE,r)}handleClick(){let r=this.mediaIsCasting?Ie.MEDIA_EXIT_CAST_REQUEST:Ie.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new q.CustomEvent(r,{composed:!0,bubbles:!0}))}};q.customElements.get("media-cast-button")||q.customElements.define("media-cast-button",Pu);var $f=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},ia=(n,r,o)=>($f(n,r,"read from private field"),o?o.call(n):r.get(n)),bE=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},fl=(n,r,o,m)=>($f(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),Ai,jf=ae.createElement("template");jf.innerHTML=`
|
|
115
115
|
<style>
|
|
116
116
|
:host {
|
|
117
117
|
display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block));
|
|
118
118
|
box-sizing: border-box;
|
|
119
119
|
}
|
|
120
120
|
</style>
|
|
121
|
-
`;var
|
|
121
|
+
`;var Ou=class extends q.HTMLElement{constructor(r={}){if(super(),bE(this,Ai,void 0),!this.shadowRoot){let o=this.attachShadow({mode:"open"}),m=jf.content.cloneNode(!0);this.nativeEl=m;let v=r.slotTemplate;v||(v=ae.createElement("template"),v.innerHTML=`<slot>${r.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),o.appendChild(m)}}static get observedAttributes(){return[Ne.MEDIA_CONTROLLER,F.MEDIA_PAUSED]}attributeChangedCallback(r,o,m){var v,y,I,M,U;r===Ne.MEDIA_CONTROLLER&&(o&&((y=(v=ia(this,Ai))==null?void 0:v.unassociateElement)==null||y.call(v,this),fl(this,Ai,null)),m&&(fl(this,Ai,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(U=(M=ia(this,Ai))==null?void 0:M.associateElement)==null||U.call(M,this)))}connectedCallback(){var r,o,m,v;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),fl(this,Ai,_E(this)),this.getAttribute(Ne.MEDIA_CONTROLLER)&&((o=(r=ia(this,Ai))==null?void 0:r.associateElement)==null||o.call(r,this)),(m=ia(this,Ai))==null||m.addEventListener("pointerdown",this),(v=ia(this,Ai))==null||v.addEventListener("click",this)}disconnectedCallback(){var r,o,m,v;this.getAttribute(Ne.MEDIA_CONTROLLER)&&((o=(r=ia(this,Ai))==null?void 0:r.unassociateElement)==null||o.call(r,this)),(m=ia(this,Ai))==null||m.removeEventListener("pointerdown",this),(v=ia(this,Ai))==null||v.removeEventListener("click",this),fl(this,Ai,null)}handleEvent(r){var o;let m=(o=r.composedPath())==null?void 0:o[0];if(!!["video","media-controller"].includes(m==null?void 0:m.localName)){if(r.type==="pointerdown")this._pointerType=r.pointerType;else if(r.type==="click"){let{clientX:y,clientY:I}=r,{left:M,top:U,width:H,height:z}=this.getBoundingClientRect(),J=y-M,ee=I-U;if(J<0||ee<0||J>H||ee>z||H===0&&z===0)return;let{pointerType:le=this._pointerType}=r;if(this._pointerType=void 0,le===Cu.TOUCH){this.handleTap(r);return}else if(le===Cu.MOUSE){this.handleMouseClick(r);return}}}}get mediaPaused(){return ht(this,F.MEDIA_PAUSED)}set mediaPaused(r){pt(this,F.MEDIA_PAUSED,r)}handleTap(r){}handleMouseClick(r){let o=this.mediaPaused?Ie.MEDIA_PLAY_REQUEST:Ie.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new q.CustomEvent(o,{composed:!0,bubbles:!0}))}};Ai=new WeakMap;function _E(n){var r;let o=n.getAttribute(Ne.MEDIA_CONTROLLER);return o?(r=n.getRootNode())==null?void 0:r.getElementById(o):Fa(n,"media-controller")}q.customElements.get("media-gesture-receiver")||q.customElements.define("media-gesture-receiver",Ou);var dt={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive"},zf=ae.createElement("template");zf.innerHTML=`
|
|
122
122
|
<style>
|
|
123
123
|
|
|
124
124
|
:host([${F.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) {
|
|
@@ -133,7 +133,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
133
133
|
background-color: var(--media-background-color, #000);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
:host(:not([${
|
|
136
|
+
:host(:not([${dt.AUDIO}])) [part~=layer]:not([part~=media-layer]) {
|
|
137
137
|
position: absolute;
|
|
138
138
|
top: 0;
|
|
139
139
|
left: 0;
|
|
@@ -151,19 +151,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
|
|
154
|
-
:host([${
|
|
154
|
+
:host([${dt.AUDIO}]) slot[name=media] {
|
|
155
155
|
display: var(--media-slot-display, none);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
|
|
159
|
-
:host([${
|
|
159
|
+
:host([${dt.AUDIO}]) [part~=layer][part~=gesture-layer] {
|
|
160
160
|
height: 0;
|
|
161
161
|
display: block;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
|
|
165
|
-
:host(:not([${
|
|
166
|
-
:host(:not([${
|
|
165
|
+
:host(:not([${dt.AUDIO}])[${dt.GESTURES_DISABLED}]) ::slotted([slot=gestures-chrome]),
|
|
166
|
+
:host(:not([${dt.AUDIO}])[${dt.GESTURES_DISABLED}]) media-gesture-receiver[slot=gestures-chrome] {
|
|
167
167
|
display: none;
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -172,13 +172,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
172
172
|
pointer-events: auto;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
:host(:not([${
|
|
175
|
+
:host(:not([${dt.AUDIO}])) *[part~=layer][part~=centered-layer] {
|
|
176
176
|
align-items: center;
|
|
177
177
|
justify-content: center;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
:host(:not([${
|
|
181
|
-
:host(:not([${
|
|
180
|
+
:host(:not([${dt.AUDIO}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]),
|
|
181
|
+
:host(:not([${dt.AUDIO}])) media-gesture-receiver[slot=gestures-chrome] {
|
|
182
182
|
align-self: stretch;
|
|
183
183
|
flex-grow: 1;
|
|
184
184
|
}
|
|
@@ -198,7 +198,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
|
|
201
|
-
:host(:not([${
|
|
201
|
+
:host(:not([${dt.AUDIO}])) .spacer {
|
|
202
202
|
flex-grow: 1;
|
|
203
203
|
}
|
|
204
204
|
|
|
@@ -210,13 +210,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
|
|
213
|
-
::slotted(:not([slot=media]):not([${
|
|
213
|
+
::slotted(:not([slot=media]):not([${dt.NO_AUTOHIDE}])) {
|
|
214
214
|
opacity: 1;
|
|
215
215
|
transition: opacity 0.25s;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
|
|
219
|
-
:host([${
|
|
219
|
+
:host([${dt.USER_INACTIVE}]:not([${F.MEDIA_PAUSED}]):not([${F.MEDIA_IS_CASTING}]):not([${dt.AUDIO}])) ::slotted(:not([slot=media]):not([${dt.NO_AUTOHIDE}])) {
|
|
220
220
|
opacity: 0;
|
|
221
221
|
transition: opacity 1s;
|
|
222
222
|
}
|
|
@@ -242,7 +242,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
242
242
|
|
|
243
243
|
<slot part="bottom chrome"></slot>
|
|
244
244
|
</span>
|
|
245
|
-
`;var bE=Object.values(F),_E="sm:384 md:576 lg:768 xl:960",TE=n=>{var r;for(let l of n){let m=l.target;if(!m.isConnected)continue;let v=(r=m.getAttribute(ut.BREAKPOINTS))!=null?r:_E,y=AE(v),I=SE(y,l.contentRect),M=!1;if(Object.keys(y).forEach(B=>{if(I.includes(B)){m.hasAttribute(`breakpoint${B}`)||(m.setAttribute(`breakpoint${B}`,""),M=!0);return}m.hasAttribute(`breakpoint${B}`)&&(m.removeAttribute(`breakpoint${B}`),M=!0)}),M){let B=new CustomEvent(yn.BREAKPOINTS_CHANGE,{detail:I});m.dispatchEvent(B)}}};function AE(n){let r=n.split(/\s+/);return Object.fromEntries(r.map(l=>l.split(":")))}function SE(n,r){return Object.keys(n).filter(l=>r.width>=n[l])}var ml=class extends q.HTMLElement{constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(jf.content.cloneNode(!0)));let r=I=>{let M=this.media;for(let B of I)B.type==="childList"&&(B.removedNodes.forEach(H=>{if(H.slot=="media"&&B.target==this){let z=B.previousSibling&&B.previousSibling.previousElementSibling;if(!z||!M)this.mediaUnsetCallback(H);else{let J=z.slot!=="media";for(;(z=z.previousSibling)!==null;)z.slot=="media"&&(J=!1);J&&this.mediaUnsetCallback(H)}}}),M&&B.addedNodes.forEach(H=>{H==M&&this.handleMediaUpdated(M).then(z=>this.mediaSetCallback(z))}))};new MutationObserver(r).observe(this,{childList:!0,subtree:!0});let m=new ResizeObserver(TE);this.resizeObserver=m,m.observe(this);let v=this.media,y=this.querySelector(":scope > slot[slot=media]");y&&y.addEventListener("slotchange",()=>{if(!y.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[ut.AUTOHIDE,ut.GESTURES_DISABLED].concat(bE)}attributeChangedCallback(r,l,m){r.toLowerCase()==ut.AUTOHIDE&&(this.autohide=m)}get media(){let r=this.querySelector(":scope > [slot=media]");return(r==null?void 0:r.nodeName)=="SLOT"&&(r=r.assignedElements({flatten:!0})[0]),r}mediaSetCallback(r){this._mediaClickPlayToggle=()=>{let l=r.paused?Ie.MEDIA_PLAY_REQUEST:Ie.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new q.CustomEvent(l,{composed:!0,bubbles:!0}))}}handleMediaUpdated(r){let l=y=>Promise.resolve(y),m=y=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',y),Promise.reject(y));if(!r)return m(r);let v=r.nodeName.toLowerCase();return v.includes("-")?q.customElements.whenDefined(v).then(()=>l(r)):l(r)}mediaUnsetCallback(r){}connectedCallback(){let l=this.getAttribute(ut.AUDIO)!=null?si.AUDIO_PLAYER():si.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",l),this.media&&this.handleMediaUpdated(this.media).then(I=>this.mediaSetCallback(I)),this.setAttribute(ut.USER_INACTIVE,"");let m=()=>{if(this.autohide<0||this.hasAttribute(ut.USER_INACTIVE))return;this.setAttribute(ut.USER_INACTIVE,"");let I=new q.CustomEvent(yn.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(I)},v=()=>{if(!this.hasAttribute(ut.USER_INACTIVE))return;this.removeAttribute(ut.USER_INACTIVE);let I=new q.CustomEvent(yn.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(I)},y=()=>{v(),q.clearTimeout(this._inactiveTimeout),!(this.autohide<0)&&(this._inactiveTimeout=q.setTimeout(()=>{m()},this.autohide*1e3))};this.addEventListener("keyup",()=>{y()}),this.addEventListener("pointerup",I=>{I.pointerType==="touch"?[this,this.media].includes(I.target)&&!this.hasAttribute(ut.USER_INACTIVE)?m():y():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())})&&y()}),this.addEventListener("pointermove",I=>{I.pointerType==="mouse"&&(v(),q.clearTimeout(this._inactiveTimeout),[this,this.media].includes(I.target)&&y())}),this.addEventListener("mouseleave",()=>{m()}),this.addEventListener("keyup",()=>{this.setAttribute(ut.KEYBOARD_CONTROL,"")}),q.addEventListener("mouseup",()=>{this.removeAttribute(ut.KEYBOARD_CONTROL)})}set autohide(r){r=Number(r),this._autohide=isNaN(r)?0:r}get autohide(){return this._autohide===void 0?2:this._autohide}};var zf=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Xt=(n,r,l)=>(zf(n,r,"read from private field"),l?l.call(n):r.get(n)),Is=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},pl=(n,r,l,m)=>(zf(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),Tn,An,vl,Ua,Dr,ia,Sn=class{constructor(r,l,{defaultValue:m}={defaultValue:void 0}){Is(this,Dr),Is(this,Tn,void 0),Is(this,An,void 0),Is(this,vl,void 0),Is(this,Ua,new Set),pl(this,Tn,r),pl(this,An,l),pl(this,vl,new Set(m))}[Symbol.iterator](){return Xt(this,Dr,ia).values()}get length(){return Xt(this,Dr,ia).size}get value(){var r;return(r=[...Xt(this,Dr,ia)].join(" "))!=null?r:""}set value(r){var l;r!==this.value&&(pl(this,Ua,new Set),this.add(...(l=r==null?void 0:r.split(" "))!=null?l:[]))}toString(){return this.value}item(r){return[...Xt(this,Dr,ia)][r]}values(){return Xt(this,Dr,ia).values()}forEach(r){Xt(this,Dr,ia).forEach(r)}add(...r){var l,m;r.forEach(v=>Xt(this,Ua).add(v)),!(this.value===""&&!((l=Xt(this,Tn))!=null&&l.hasAttribute(`${Xt(this,An)}`)))&&((m=Xt(this,Tn))==null||m.setAttribute(`${Xt(this,An)}`,`${this.value}`))}remove(...r){var l;r.forEach(m=>Xt(this,Ua).delete(m)),(l=Xt(this,Tn))==null||l.setAttribute(`${Xt(this,An)}`,`${this.value}`)}contains(r){return Xt(this,Dr,ia).has(r)}toggle(r,l){return typeof l!="undefined"?l?(this.add(r),!0):(this.remove(r),!1):this.contains(r)?(this.remove(r),!1):(this.add(r),!0)}replace(r,l){return this.remove(r),this.add(l),r===l}};Tn=new WeakMap;An=new WeakMap;vl=new WeakMap;Ua=new WeakMap;Dr=new WeakSet;ia=function(){return Xt(this,Ua).size?Xt(this,Ua):Xt(this,vl)};var Qf=(n="")=>n.split(/\s+/),Xf=(n="")=>{let[r,l,m]=n.split(":"),v=m?decodeURIComponent(m):void 0;return r=r==="cc"?"captions":"subtitles",{kind:r,language:l,label:v}},kn=(n="",r={})=>Qf(n).map(l=>{let m=Xf(l);return{...r,...m}}),kE=n=>Array.isArray(n)?n.map(r=>typeof r=="string"?Xf(r):r):typeof n=="string"?kn(n):[n],Nd=({kind:n,label:r,language:l}={kind:"subtitles"})=>r?`${n==="captions"?"cc":"sb"}:${l}:${encodeURIComponent(r)}`:l,Rs=(n=[])=>Array.prototype.map.call(n,Nd).join(" "),wE=(n,r)=>l=>l[n]===r,Zf=n=>{let r=Object.entries(n).map(([l,m])=>wE(l,m));return l=>r.every(m=>m(l))},Fd=(n,r=[],l=[])=>{let m=kE(l).map(Zf),v=y=>m.some(I=>I(y));Array.from(r).filter(v).forEach(y=>{y.mode=n})},gl=(n,r=()=>!0)=>{if(!(n!=null&&n.textTracks))return[];let l=typeof r=="function"?r:Zf(r);return Array.from(n.textTracks).filter(l)},Ud=n=>!!n.getAttribute(F.MEDIA_SUBTITLES_SHOWING),Cr=(n,r)=>{var l,m;let v=Ud(n);if(v||r===!1){let y=n.getAttribute(F.MEDIA_SUBTITLES_SHOWING);if(y){let I=new window.CustomEvent(Ie.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:y});n.dispatchEvent(I)}}else if(!v||r===!0){let[y]=(m=Qf((l=n.getAttribute(F.MEDIA_SUBTITLES_LIST))!=null?l:""))!=null?m:[];if(y){let I=new window.CustomEvent(Ie.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:y});n.dispatchEvent(I)}}else console.error("Attempting to enable captions or subtitles but none are available! Please verify your media content if this is unexpected.")};var It={enter:"requestFullscreen",exit:"exitFullscreen",rootEvents:["fullscreenchange"],mediaEvents:[],element:"fullscreenElement",error:"fullscreenerror",enabled:"fullscreenEnabled"};ae.fullscreenElement===void 0&&(It.enter="webkitRequestFullScreen",It.exit=ae.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",It.rootEvents=["webkitfullscreenchange"],It.mediaEvents=["webkitbeginfullscreen","webkitendfullscreen"],It.element="webkitFullscreenElement",It.error="webkitfullscreenerror",It.enabled="webkitFullscreenEnabled");var El,Bd=()=>{var n,r;return El||(El=(r=(n=ae)==null?void 0:n.createElement)==null?void 0:r.call(n,"video"),El)},Jf=async(n=Bd())=>{if(!n)return!1;let r=n.volume;return n.volume=r/2+.1,await ol(0),n.volume!==r},LE=(n=Bd())=>typeof(n==null?void 0:n.requestPictureInPicture)=="function",IE=(n=Bd())=>{let r=ae[It.enabled];return!r&&n&&(r="webkitSupportsFullscreen"in n),r},Hd=IE(),em=LE(),tm=!!q.WebKitPlaybackTargetAvailabilityEvent,im=!!q.chrome;var yl,rm=Jf().then(n=>(yl=n,yl)),RE=Object.values(Zi),Gd=n=>gl(n.media,r=>[bn.SUBTITLES,bn.CAPTIONS].includes(r.kind)).sort((r,l)=>r.kind>=l.kind?1:-1),DE=n=>gl(n.media,r=>r.mode===al.SHOWING&&[bn.SUBTITLES,bn.CAPTIONS].includes(r.kind)),Ai={MEDIA_PAUSED:{get:function(n){let{media:r}=n;return r?r.paused:!0},mediaEvents:["play","playing","pause","emptied"]},MEDIA_HAS_PLAYED:{get:function(n){let{media:r}=n;return r?!r.paused:!1},mediaEvents:["playing","emptied"]},MEDIA_ENDED:{get:function(n){let{media:r}=n;return r?r.ended:!1},mediaEvents:["seeked","ended","emptied"]},MEDIA_PLAYBACK_RATE:{get:function(n){let{media:r}=n;return!r||typeof r.playbackRate=="undefined"?1:r.playbackRate},mediaEvents:["ratechange","loadstart"]},MEDIA_MUTED:{get:function(n){let{media:r}=n;return!r||typeof r.muted=="undefined"?!1:r.muted},mediaEvents:["volumechange"]},MEDIA_VOLUME:{get:function(n){let{media:r}=n;return!r||typeof r.volume=="undefined"?1:Number(r.volume)},mediaEvents:["volumechange"]},MEDIA_VOLUME_LEVEL:{get:function(n){let{media:r}=n,l="high";if(!r||typeof r.volume=="undefined")return l;let{muted:m,volume:v}=r;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:r}=n;return!r||typeof r.currentTime=="undefined"?0:r.currentTime},mediaEvents:["timeupdate","loadedmetadata"]},MEDIA_DURATION:{get:function(n){let{media:r}=n;return!r||!Number.isFinite(r.duration)?NaN:r.duration},mediaEvents:["durationchange","loadedmetadata","emptied"]},MEDIA_SEEKABLE:{get:function(n){var r;let{media:l}=n;if(!((r=l==null?void 0:l.seekable)!=null&&r.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 r;return((r=n.media)==null?void 0:r.readyState)<3},mediaEvents:["waiting","playing","emptied"]},MEDIA_BUFFERED:{get:function(n){var r;return Nf((r=n.media)==null?void 0:r.buffered)},mediaEvents:["progress","emptied"]},MEDIA_STREAM_TYPE:{get:function(n){let{media:r}=n;if(!r)return;let{streamType:l}=r;if(RE.includes(l)){if(l===Zi.UNKNOWN){let v=n.getAttribute("defaultstreamtype");return[Zi.LIVE,Zi.ON_DEMAND].includes(v)?v:void 0}return l}let m=r.duration;if(m===1/0)return Zi.LIVE;if(Number.isFinite(m))return Zi.ON_DEMAND;{let v=n.getAttribute("defaultstreamtype");if([Zi.LIVE,Zi.ON_DEMAND].includes(v))return v}},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},MEDIA_TARGET_LIVE_WINDOW:{get:function(n){let{media:r}=n;if(!r)return Number.NaN;let{targetLiveWindow:l}=r,m=Ai.MEDIA_STREAM_TYPE.get(n);return(l==null||Number.isNaN(l))&&m===Zi.LIVE?0:l},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},MEDIA_TIME_IS_LIVE:{get:function(n){let{media:r}=n;if(!r)return!1;if(typeof r.liveEdgeStart=="number")return Number.isNaN(r.liveEdgeStart)?!1:r.currentTime>=r.liveEdgeStart;if(!(Ai.MEDIA_STREAM_TYPE.get(n)==="live"))return!1;let m=r.seekable;if(!m)return!0;if(!m.length)return!1;let v=n.hasAttribute("liveedgeoffset")?Number(n.getAttribute("liveedgeoffset")):10,y=m.end(m.length-1)-v;return r.currentTime>=y},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},MEDIA_IS_FULLSCREEN:{get:function(n,r){var l;let m=n.media;if(m&&ae[It.element]===void 0&&"webkitDisplayingFullscreen"in m)return m.webkitDisplayingFullscreen&&m.webkitPresentationMode==="fullscreen";let v;return r?v=ae[It.element]?r.target:null:v=(l=n.getRootNode().fullscreenElement)!=null?l:ae[It.element],Ls(n.fullscreenElement,v)},rootEvents:It.rootEvents,mediaEvents:It.mediaEvents},MEDIA_IS_PIP:{get:function(n,r){var l;let m=n.media;if(!m)return!1;if(r)return r.type=="enterpictureinpicture";{let v=(l=n.getRootNode().pictureInPictureElement)!=null?l:ae.pictureInPictureElement;return Ls(m,v)}},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},MEDIA_IS_CASTING:{get:function(n,r){var l;let{media:m}=n;if(!m)return!1;let v=(l=globalThis.CastableVideoElement)==null?void 0:l.castElement,y=Ls(m,v);return(r==null?void 0:r.type)==="castchange"&&(r==null?void 0:r.detail)==="CONNECTING"&&(y="connecting"),y},mediaEvents:["entercast","leavecast","castchange"]},MEDIA_AIRPLAY_UNAVAILABLE:{get:function(n,r){if(!tm)return Rr.UNSUPPORTED;if(!!r&&r.availability!=="available"&&r.availability==="not-available")return Rr.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"]},MEDIA_CAST_UNAVAILABLE:{get:function(){var n;let r=(n=globalThis.CastableVideoElement)==null?void 0:n.castState;if(!im||!r)return Rr.UNSUPPORTED;if(!r.includes("CONNECT"))return Rr.UNAVAILABLE},mediaEvents:["castchange"]},MEDIA_FULLSCREEN_UNAVAILABLE:{get:function(){return Hd?void 0:Rr.UNAVAILABLE}},MEDIA_PIP_UNAVAILABLE:{get:function(){return em?void 0:Rr.UNSUPPORTED}},MEDIA_VOLUME_UNAVAILABLE:{get:function(n){if(yl!==void 0&&!yl)return Rr.UNSUPPORTED;let{media:r}=n;if(r&&typeof r.volume=="undefined")return Rr.UNAVAILABLE},mediaEvents:["loadstart"]},MEDIA_SUBTITLES_LIST:{get:function(n){return Rs(Gd(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack"]},MEDIA_SUBTITLES_SHOWING:{get:function(n){return n.hasAttribute("defaultsubtitles")&&!n.hasAttribute(F.MEDIA_HAS_PLAYED)&&!n.hasAttribute(F.MEDIA_SUBTITLES_SHOWING)&&Cr(n,!0),Rs(DE(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack","change"]}},bl={MEDIA_PLAY_REQUEST:(n,r,l)=>{var m;let v=Ai.MEDIA_STREAM_TYPE.get(l),y=l.getAttribute("noautoseektolive")===null;v==Zi.LIVE&&y&&bl.MEDIA_SEEK_TO_LIVE_REQUEST(n),(m=n.play())==null||m.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,r,l)=>{let m=r.detail;if(n.volume=m,m>0&&n.muted&&(n.muted=!1),!l.hasAttribute("novolumepref"))try{q.localStorage.setItem("media-chrome-pref-volume",m.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:(n,r,l)=>{if(!Hd){console.warn("Fullscreen support is unavailable; not entering fullscreen");return}ae.pictureInPictureElement&&ae.exitPictureInPicture(),l[It.enter]?l.fullscreenElement[It.enter]():n.webkitEnterFullscreen?n.webkitEnterFullscreen():n.requestFullscreen?n.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{ae[It.exit]()},MEDIA_ENTER_PIP_REQUEST:n=>{if(!ae.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}ae[It.element]&&ae[It.exit]();let r=()=>{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(r),m()};n.addEventListener("loadedmetadata",v),n.preload="metadata",setTimeout(()=>{n.readyState===0&&r(),m()},1e3)}else throw l;else throw l})},MEDIA_EXIT_PIP_REQUEST:()=>{ae.pictureInPictureElement&&ae.exitPictureInPicture()},MEDIA_ENTER_CAST_REQUEST:n=>{var r;!((r=globalThis.CastableVideoElement)!=null&&r.castEnabled)||(ae[It.element]&&ae[It.exit](),n.requestCast())},MEDIA_EXIT_CAST_REQUEST:async()=>{var n;(n=globalThis.CastableVideoElement)!=null&&n.castElement&&globalThis.CastableVideoElement.exitCast()},MEDIA_SEEK_REQUEST:(n,r)=>{let l=r.detail;(n.readyState>0||n.readyState===void 0)&&(n.currentTime=l)},MEDIA_PLAYBACK_RATE_REQUEST:(n,r)=>{n.playbackRate=r.detail},MEDIA_PREVIEW_REQUEST:(n,r,l)=>{var m;if(!n)return;let v=r.detail;v===null&&l.propagateMediaState(F.MEDIA_PREVIEW_TIME,void 0),l.propagateMediaState(F.MEDIA_PREVIEW_TIME,v);let[y]=gl(n,{kind:bn.METADATA,label:"thumbnails"});if(!(y&&y.cues))return;if(v===null){l.propagateMediaState(F.MEDIA_PREVIEW_IMAGE,void 0),l.propagateMediaState(F.MEDIA_PREVIEW_COORDS,void 0);return}let I=Array.prototype.find.call(y.cues,z=>z.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),H=new URLSearchParams(B.hash).get("#xywh");l.propagateMediaState(F.MEDIA_PREVIEW_IMAGE,B.href),l.propagateMediaState(F.MEDIA_PREVIEW_COORDS,H.split(",").join(" "))},MEDIA_SHOW_SUBTITLES_REQUEST:(n,r,l)=>{let m=Gd(l),{detail:v=[]}=r;Fd(al.SHOWING,m,v)},MEDIA_DISABLE_SUBTITLES_REQUEST:(n,r,l)=>{let m=Gd(l),{detail:v=[]}=r;Fd(al.DISABLED,m,v)},MEDIA_AIRPLAY_REQUEST:n=>{if(!!n){if(!(n.webkitShowPlaybackTargetPicker&&q.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 r=n.seekable;if(!r){console.warn("MediaController: Media element does not support seeking to live.");return}if(!r.length){console.warn("MediaController: Media is unable to seek to live.");return}n.currentTime=r.end(r.length-1)}};var Wd=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Ha=(n,r,l)=>(Wd(n,r,"read from private field"),l?l.call(n):r.get(n)),_l=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},am=(n,r,l,m)=>(Wd(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),wn=(n,r,l)=>(Wd(n,r,"access private method"),l),ra,Ds,Ln,Cs,Tl,Vd,om=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],CE=10,nm=0,Si={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYS_USED:"keysused",LIVE_EDGE_OFFSET:"liveedgeoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_HOTKEYS:"nohotkeys"},Al=class extends ml{constructor(){super(),_l(this,Ln),_l(this,Tl),_l(this,ra,new Sn(this,Si.HOTKEYS)),_l(this,Ds,void 0),Ai.MEDIA_VOLUME_UNAVAILABLE.get(this)===void 0&&rm.then(()=>{this.propagateMediaState(F.MEDIA_VOLUME_UNAVAILABLE,Ai.MEDIA_VOLUME_UNAVAILABLE.get(this))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associateElement(this),Object.keys(bl).forEach(r=>{let l=`_handle${nl(r,!0)}`;this[l]=m=>{if(m.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}bl[r](this.media,m,this)},this.addEventListener(Ie[r],this[l])}),this._mediaStatePropagators={},Object.keys(Ai).forEach(r=>{this._mediaStatePropagators[r]=l=>{this.propagateMediaState(F[r],Ai[r].get(this,l))}}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(Si.NO_HOTKEYS,Si.HOTKEYS,Si.DEFAULT_STREAM_TYPE,Si.DEFAULT_SUBTITLES)}get fullscreenElement(){var r;return(r=Ha(this,Ds))!=null?r:this}set fullscreenElement(r){this.hasAttribute(Si.FULLSCREEN_ELEMENT)&&this.removeAttribute(Si.FULLSCREEN_ELEMENT),am(this,Ds,r)}attributeChangedCallback(r,l,m){var v;if(r===Si.NO_HOTKEYS)m!==l&&m===""?(this.hasAttribute(Si.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(r===Si.HOTKEYS)Ha(this,ra).value=m;else if(r===Si.DEFAULT_SUBTITLES&&m!==l&&m==="")Cr(this,!0);else if(r===Si.DEFAULT_STREAM_TYPE)this.propagateMediaState(F.MEDIA_STREAM_TYPE);else if(r===Si.FULLSCREEN_ELEMENT){let y=m?(v=this.getRootNode())==null?void 0:v.getElementById(m):void 0;am(this,Ds,y)}super.attributeChangedCallback(r,l,m)}mediaSetCallback(r){if(super.mediaSetCallback(r),r.hasAttribute("tabindex")||(r.tabIndex=-1),Object.keys(Ai).forEach(l=>{let{mediaEvents:m,rootEvents:v,trackListEvents:y}=Ai[l],I=this._mediaStatePropagators[l];m==null||m.forEach(M=>{r.addEventListener(M,I),I()}),v==null||v.forEach(M=>{this.getRootNode().addEventListener(M,I),I()}),y==null||y.forEach(M=>{var B;(B=r.textTracks)==null||B.addEventListener(M,I),I()})}),!this.hasAttribute("novolumepref"))try{let l=q.localStorage.getItem("media-chrome-pref-volume");l!==null&&(r.volume=l)}catch(l){console.debug("Error getting volume pref",l)}}mediaUnsetCallback(r){super.mediaUnsetCallback(r),Object.keys(Ai).forEach(l=>{let{mediaEvents:m,rootEvents:v,trackListEvents:y}=Ai[l],I=this._mediaStatePropagators[l];m==null||m.forEach(M=>{r.removeEventListener(M,I)}),v==null||v.forEach(M=>{this.getRootNode().removeEventListener(M,I)}),y==null||y.forEach(M=>{var B;(B=r.textTracks)==null||B.removeEventListener(M,I)})}),this.propagateMediaState(F.MEDIA_PAUSED,!0)}propagateMediaState(r,l){let m=this.getAttribute(r);if(sm(this.mediaStateReceivers,r,l),m===this.getAttribute(r))return;let v=new q.CustomEvent(Mf[r],{composed:!0,bubbles:!0,detail:l});this.dispatchEvent(v)}associateElement(r){if(!r)return;let{associatedElementSubscriptions:l}=this;if(l.has(r))return;let m=this.registerMediaStateReceiver.bind(this),v=this.unregisterMediaStateReceiver.bind(this),y=OE(r,m,v);Object.keys(Ie).forEach(I=>{r.addEventListener(Ie[I],this[`_handle${nl(I,!0)}`])}),l.set(r,y)}unassociateElement(r){if(!r)return;let{associatedElementSubscriptions:l}=this;if(!l.has(r))return;l.get(r)(),l.delete(r),Object.keys(Ie).forEach(v=>{r.removeEventListener(Ie[v],this[`_handle${nl(v,!0)}`])})}registerMediaStateReceiver(r){if(!r)return;let l=this.mediaStateReceivers;l.indexOf(r)>-1||(l.push(r),Object.keys(Ai).forEach(v=>{let y=Ai[v];sm([r],F[v],y.get(this))}))}unregisterMediaStateReceiver(r){let l=this.mediaStateReceivers,m=l.indexOf(r);m<0||l.splice(m,1)}enableHotkeys(){this.addEventListener("keydown",wn(this,Tl,Vd))}disableHotkeys(){this.removeEventListener("keydown",wn(this,Tl,Vd)),this.removeEventListener("keyup",wn(this,Ln,Cs))}get hotkeys(){return Ha(this,ra)}keyboardShortcutHandler(r){var l,m,v,y;if(((y=(v=(l=r.target.getAttribute(Si.KEYS_USED))==null?void 0:l.split(" "))!=null?v:(m=r.target)==null?void 0:m.keysUsed)!=null?y:[]).map(le=>le==="Space"?" ":le).filter(Boolean).includes(r.key))return;let M,B,H,z,J,ee=CE;if(!Ha(this,ra).contains(`no${r.key.toLowerCase()}`)&&!(r.key===" "&&Ha(this,ra).contains("nospace")))switch(r.key){case" ":case"k":M=this.getAttribute(F.MEDIA_PAUSED)!=null?Ie.MEDIA_PLAY_REQUEST:Ie.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"m":M=this.getAttribute(F.MEDIA_VOLUME_LEVEL)==="off"?Ie.MEDIA_UNMUTE_REQUEST:Ie.MEDIA_MUTE_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"f":M=this.getAttribute(F.MEDIA_IS_FULLSCREEN)!=null?Ie.MEDIA_EXIT_FULLSCREEN_REQUEST:Ie.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"c":Cr(this);break;case"ArrowLeft":B=this.getAttribute(F.MEDIA_CURRENT_TIME),H=B&&!Number.isNaN(+B)?+B:nm,z=Math.max(H-ee,0),J=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:z}),this.dispatchEvent(J);break;case"ArrowRight":B=this.getAttribute(F.MEDIA_CURRENT_TIME),H=B&&!Number.isNaN(+B)?+B:nm,z=Math.max(H+ee,0),J=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:z}),this.dispatchEvent(J);break;default:break}}};ra=new WeakMap;Ds=new WeakMap;Ln=new WeakSet;Cs=function(n){let{key:r}=n;if(!om.includes(r)){this.removeEventListener("keyup",wn(this,Ln,Cs));return}this.keyboardShortcutHandler(n)};Tl=new WeakSet;Vd=function(n){let{metaKey:r,altKey:l,key:m}=n;if(r||l||!om.includes(m)){this.removeEventListener("keyup",wn(this,Ln,Cs));return}[" ","ArrowLeft","ArrowRight"].includes(m)&&!(Ha(this,ra).contains(`no${m.toLowerCase()}`)||m===" "&&Ha(this,ra).contains("nospace"))&&n.preventDefault(),this.addEventListener("keyup",wn(this,Ln,Cs),{once:!0})};var ME=Object.values(F),lm=n=>{var r,l,m,v;let{observedAttributes:y}=n.constructor;!y&&((r=n.nodeName)==null?void 0:r.includes("-"))&&(q.customElements.upgrade(n),{observedAttributes:y}=n.constructor);let I=(v=(m=(l=n==null?void 0:n.getAttribute)==null?void 0:l.call(n,Ne.MEDIA_CHROME_ATTRIBUTES))==null?void 0:m.split)==null?void 0:v.call(m,/\s+/);return Array.isArray(y||I)?(y||I).filter(M=>ME.includes(M)):[]},Kd=n=>!!lm(n).length,xE=async(n,r,l)=>(n.isConnected||await ol(0),l==null?n.removeAttribute(r):typeof l=="boolean"?l?n.setAttribute(r,""):n.removeAttribute(r):Number.isNaN(l)?n.removeAttribute(r):n.setAttribute(r,l)),PE=n=>{var r;return!!((r=n.closest)!=null&&r.call(n,'*[slot="media"]'))},Ba=(n,r)=>{if(PE(n))return;let l=(v,y)=>{var I,M;Kd(v)&&y(v);let{children:B=[]}=v!=null?v:{},H=(M=(I=v==null?void 0:v.shadowRoot)==null?void 0:I.children)!=null?M:[];[...B,...H].forEach(J=>Ba(J,y))},m=n==null?void 0:n.nodeName.toLowerCase();if(m.includes("-")&&!Kd(n)){q.customElements.whenDefined(m).then(()=>{l(n,r)});return}l(n,r)},sm=(n,r,l)=>{n.forEach(m=>{!lm(m).includes(r)||xE(m,r,l)})},OE=(n,r,l)=>{Ba(n,r);let m=z=>{var J;let ee=(J=z==null?void 0:z.composedPath()[0])!=null?J:z.target;r(ee)},v=z=>{var J;let ee=(J=z==null?void 0:z.composedPath()[0])!=null?J:z.target;l(ee)};n.addEventListener(Ie.REGISTER_MEDIA_STATE_RECEIVER,m),n.addEventListener(Ie.UNREGISTER_MEDIA_STATE_RECEIVER,v);let y=z=>{z.forEach(J=>{let{addedNodes:ee=[],removedNodes:le=[],type:me,target:_e,attributeName:ge}=J;me==="childList"?(Array.prototype.forEach.call(ee,ye=>Ba(ye,r)),Array.prototype.forEach.call(le,ye=>Ba(ye,l))):me==="attributes"&&ge===Ne.MEDIA_CHROME_ATTRIBUTES&&(Kd(_e)?r(_e):l(_e))})},I=[],M=z=>{let J=z.target;J.name!=="media"&&(I.forEach(ee=>Ba(ee,l)),I=[...J.assignedElements({flatten:!0})],I.forEach(ee=>Ba(ee,r)))};n.addEventListener("slotchange",M);let B=new MutationObserver(y);return B.observe(n,{childList:!0,attributes:!0,subtree:!0}),()=>{Ba(n,l),n.removeEventListener("slotchange",M),B.disconnect(),n.removeEventListener(Ie.REGISTER_MEDIA_STATE_RECEIVER,m),n.removeEventListener(Ie.UNREGISTER_MEDIA_STATE_RECEIVER,v)}};q.customElements.get("media-controller")||q.customElements.define("media-controller",Al);var qd=Al;var dm=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},Mr=(n,r,l)=>(dm(n,r,"read from private field"),l?l.call(n):r.get(n)),Sl=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Ms=(n,r,l,m)=>(dm(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),kl,ur,wl,Ll,cm=ae.createElement("template"),um=`
|
|
245
|
+
`;var TE=Object.values(F),AE="sm:384 md:576 lg:768 xl:960",SE=n=>{var r;for(let o of n){let m=o.target;if(!m.isConnected)continue;let v=(r=m.getAttribute(dt.BREAKPOINTS))!=null?r:AE,y=kE(v),I=wE(y,o.contentRect),M=!1;if(Object.keys(y).forEach(U=>{if(I.includes(U)){m.hasAttribute(`breakpoint${U}`)||(m.setAttribute(`breakpoint${U}`,""),M=!0);return}m.hasAttribute(`breakpoint${U}`)&&(m.removeAttribute(`breakpoint${U}`),M=!0)}),M){let U=new CustomEvent(yn.BREAKPOINTS_CHANGE,{detail:I});m.dispatchEvent(U)}}};function kE(n){let r=n.split(/\s+/);return Object.fromEntries(r.map(o=>o.split(":")))}function wE(n,r){return Object.keys(n).filter(o=>r.width>=n[o])}var ml=class extends q.HTMLElement{constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(zf.content.cloneNode(!0)));let r=I=>{let M=this.media;for(let U of I)U.type==="childList"&&(U.removedNodes.forEach(H=>{if(H.slot=="media"&&U.target==this){let z=U.previousSibling&&U.previousSibling.previousElementSibling;if(!z||!M)this.mediaUnsetCallback(H);else{let J=z.slot!=="media";for(;(z=z.previousSibling)!==null;)z.slot=="media"&&(J=!1);J&&this.mediaUnsetCallback(H)}}}),M&&U.addedNodes.forEach(H=>{H==M&&this.handleMediaUpdated(M).then(z=>this.mediaSetCallback(z))}))};new MutationObserver(r).observe(this,{childList:!0,subtree:!0});let m=new ResizeObserver(SE);this.resizeObserver=m,m.observe(this);let v=this.media,y=this.querySelector(":scope > slot[slot=media]");y&&y.addEventListener("slotchange",()=>{if(!y.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[dt.AUTOHIDE,dt.GESTURES_DISABLED].concat(TE)}attributeChangedCallback(r,o,m){r.toLowerCase()==dt.AUTOHIDE&&(this.autohide=m)}get media(){let r=this.querySelector(":scope > [slot=media]");return(r==null?void 0:r.nodeName)=="SLOT"&&(r=r.assignedElements({flatten:!0})[0]),r}mediaSetCallback(r){this._mediaClickPlayToggle=()=>{let o=r.paused?Ie.MEDIA_PLAY_REQUEST:Ie.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new q.CustomEvent(o,{composed:!0,bubbles:!0}))}}handleMediaUpdated(r){let o=y=>Promise.resolve(y),m=y=>(console.error('<media-chrome>: Media element set with slot="media" does not appear to be compatible.',y),Promise.reject(y));if(!r)return m(r);let v=r.nodeName.toLowerCase();return v.includes("-")?q.customElements.whenDefined(v).then(()=>o(r)):o(r)}mediaUnsetCallback(r){}connectedCallback(){let o=this.getAttribute(dt.AUDIO)!=null?si.AUDIO_PLAYER():si.VIDEO_PLAYER();this.setAttribute("role","region"),this.setAttribute("aria-label",o),this.media&&this.handleMediaUpdated(this.media).then(I=>this.mediaSetCallback(I)),this.setAttribute(dt.USER_INACTIVE,"");let m=()=>{if(this.autohide<0||this.hasAttribute(dt.USER_INACTIVE))return;this.setAttribute(dt.USER_INACTIVE,"");let I=new q.CustomEvent(yn.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(I)},v=()=>{if(!this.hasAttribute(dt.USER_INACTIVE))return;this.removeAttribute(dt.USER_INACTIVE);let I=new q.CustomEvent(yn.USER_INACTIVE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(I)},y=()=>{v(),q.clearTimeout(this._inactiveTimeout),!(this.autohide<0)&&(this._inactiveTimeout=q.setTimeout(()=>{m()},this.autohide*1e3))};this.addEventListener("keyup",()=>{y()}),this.addEventListener("pointerup",I=>{I.pointerType==="touch"?[this,this.media].includes(I.target)&&!this.hasAttribute(dt.USER_INACTIVE)?m():y():I.composedPath().some(M=>{var U;return["media-play-button","media-fullscreen-button"].includes((U=M==null?void 0:M.nodeName)==null?void 0:U.toLowerCase())})&&y()}),this.addEventListener("pointermove",I=>{I.pointerType==="mouse"&&(v(),q.clearTimeout(this._inactiveTimeout),[this,this.media].includes(I.target)&&y())}),this.addEventListener("mouseleave",()=>{m()}),this.addEventListener("keyup",()=>{this.setAttribute(dt.KEYBOARD_CONTROL,"")}),q.addEventListener("mouseup",()=>{this.removeAttribute(dt.KEYBOARD_CONTROL)})}set autohide(r){r=Number(r),this._autohide=isNaN(r)?0:r}get autohide(){return this._autohide===void 0?2:this._autohide}};var Qf=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},Xt=(n,r,o)=>(Qf(n,r,"read from private field"),o?o.call(n):r.get(n)),Is=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},pl=(n,r,o,m)=>(Qf(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),Tn,An,vl,Ua,Cr,ra,Sn=class{constructor(r,o,{defaultValue:m}={defaultValue:void 0}){Is(this,Cr),Is(this,Tn,void 0),Is(this,An,void 0),Is(this,vl,void 0),Is(this,Ua,new Set),pl(this,Tn,r),pl(this,An,o),pl(this,vl,new Set(m))}[Symbol.iterator](){return Xt(this,Cr,ra).values()}get length(){return Xt(this,Cr,ra).size}get value(){var r;return(r=[...Xt(this,Cr,ra)].join(" "))!=null?r:""}set value(r){var o;r!==this.value&&(pl(this,Ua,new Set),this.add(...(o=r==null?void 0:r.split(" "))!=null?o:[]))}toString(){return this.value}item(r){return[...Xt(this,Cr,ra)][r]}values(){return Xt(this,Cr,ra).values()}forEach(r){Xt(this,Cr,ra).forEach(r)}add(...r){var o,m;r.forEach(v=>Xt(this,Ua).add(v)),!(this.value===""&&!((o=Xt(this,Tn))!=null&&o.hasAttribute(`${Xt(this,An)}`)))&&((m=Xt(this,Tn))==null||m.setAttribute(`${Xt(this,An)}`,`${this.value}`))}remove(...r){var o;r.forEach(m=>Xt(this,Ua).delete(m)),(o=Xt(this,Tn))==null||o.setAttribute(`${Xt(this,An)}`,`${this.value}`)}contains(r){return Xt(this,Cr,ra).has(r)}toggle(r,o){return typeof o!="undefined"?o?(this.add(r),!0):(this.remove(r),!1):this.contains(r)?(this.remove(r),!1):(this.add(r),!0)}replace(r,o){return this.remove(r),this.add(o),r===o}};Tn=new WeakMap;An=new WeakMap;vl=new WeakMap;Ua=new WeakMap;Cr=new WeakSet;ra=function(){return Xt(this,Ua).size?Xt(this,Ua):Xt(this,vl)};var Xf=(n="")=>n.split(/\s+/),Zf=(n="")=>{let[r,o,m]=n.split(":"),v=m?decodeURIComponent(m):void 0;return r=r==="cc"?"captions":"subtitles",{kind:r,language:o,label:v}},kn=(n="",r={})=>Xf(n).map(o=>{let m=Zf(o);return{...r,...m}}),LE=n=>Array.isArray(n)?n.map(r=>typeof r=="string"?Zf(r):r):typeof n=="string"?kn(n):[n],Nu=({kind:n,label:r,language:o}={kind:"subtitles"})=>r?`${n==="captions"?"cc":"sb"}:${o}:${encodeURIComponent(r)}`:o,Rs=(n=[])=>Array.prototype.map.call(n,Nu).join(" "),IE=(n,r)=>o=>o[n]===r,Jf=n=>{let r=Object.entries(n).map(([o,m])=>IE(o,m));return o=>r.every(m=>m(o))},Fu=(n,r=[],o=[])=>{let m=LE(o).map(Jf),v=y=>m.some(I=>I(y));Array.from(r).filter(v).forEach(y=>{y.mode=n})},gl=(n,r=()=>!0)=>{if(!(n!=null&&n.textTracks))return[];let o=typeof r=="function"?r:Jf(r);return Array.from(n.textTracks).filter(o)},Uu=n=>!!n.getAttribute(F.MEDIA_SUBTITLES_SHOWING),Mr=(n,r)=>{var o,m;let v=Uu(n);if(v||r===!1){let y=n.getAttribute(F.MEDIA_SUBTITLES_SHOWING);if(y){let I=new window.CustomEvent(Ie.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:y});n.dispatchEvent(I)}}else if(!v||r===!0){let[y]=(m=Xf((o=n.getAttribute(F.MEDIA_SUBTITLES_LIST))!=null?o:""))!=null?m:[];if(y){let I=new window.CustomEvent(Ie.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:y});n.dispatchEvent(I)}}else console.error("Attempting to enable captions or subtitles but none are available! Please verify your media content if this is unexpected.")};var It={enter:"requestFullscreen",exit:"exitFullscreen",rootEvents:["fullscreenchange"],mediaEvents:[],element:"fullscreenElement",error:"fullscreenerror",enabled:"fullscreenEnabled"};ae.fullscreenElement===void 0&&(It.enter="webkitRequestFullScreen",It.exit=ae.webkitExitFullscreen!=null?"webkitExitFullscreen":"webkitCancelFullScreen",It.rootEvents=["webkitfullscreenchange"],It.mediaEvents=["webkitbeginfullscreen","webkitendfullscreen"],It.element="webkitFullscreenElement",It.error="webkitfullscreenerror",It.enabled="webkitFullscreenEnabled");var El,Bu=()=>{var n,r;return El||(El=(r=(n=ae)==null?void 0:n.createElement)==null?void 0:r.call(n,"video"),El)},em=async(n=Bu())=>{if(!n)return!1;let r=n.volume;return n.volume=r/2+.1,await ol(0),n.volume!==r},RE=(n=Bu())=>typeof(n==null?void 0:n.requestPictureInPicture)=="function",DE=(n=Bu())=>{let r=ae[It.enabled];return!r&&n&&(r="webkitSupportsFullscreen"in n),r},Hu=DE(),tm=RE(),im=!!q.WebKitPlaybackTargetAvailabilityEvent,rm=!!q.chrome;var yl,am=em().then(n=>(yl=n,yl)),CE=Object.values(Zi),Gu=n=>gl(n.media,r=>[bn.SUBTITLES,bn.CAPTIONS].includes(r.kind)).sort((r,o)=>r.kind>=o.kind?1:-1),ME=n=>gl(n.media,r=>r.mode===al.SHOWING&&[bn.SUBTITLES,bn.CAPTIONS].includes(r.kind)),Si={MEDIA_PAUSED:{get:function(n){let{media:r}=n;return r?r.paused:!0},mediaEvents:["play","playing","pause","emptied"]},MEDIA_HAS_PLAYED:{get:function(n){let{media:r}=n;return r?!r.paused:!1},mediaEvents:["playing","emptied"]},MEDIA_ENDED:{get:function(n){let{media:r}=n;return r?r.ended:!1},mediaEvents:["seeked","ended","emptied"]},MEDIA_PLAYBACK_RATE:{get:function(n){let{media:r}=n;return!r||typeof r.playbackRate=="undefined"?1:r.playbackRate},mediaEvents:["ratechange","loadstart"]},MEDIA_MUTED:{get:function(n){let{media:r}=n;return!r||typeof r.muted=="undefined"?!1:r.muted},mediaEvents:["volumechange"]},MEDIA_VOLUME:{get:function(n){let{media:r}=n;return!r||typeof r.volume=="undefined"?1:Number(r.volume)},mediaEvents:["volumechange"]},MEDIA_VOLUME_LEVEL:{get:function(n){let{media:r}=n,o="high";if(!r||typeof r.volume=="undefined")return o;let{muted:m,volume:v}=r;return v===0||m?o="off":v<.5?o="low":v<.75&&(o="medium"),o},mediaEvents:["volumechange"]},MEDIA_CURRENT_TIME:{get:function(n){let{media:r}=n;return!r||typeof r.currentTime=="undefined"?0:r.currentTime},mediaEvents:["timeupdate","loadedmetadata"]},MEDIA_DURATION:{get:function(n){let{media:r}=n;return!r||!Number.isFinite(r.duration)?NaN:r.duration},mediaEvents:["durationchange","loadedmetadata","emptied"]},MEDIA_SEEKABLE:{get:function(n){var r;let{media:o}=n;if(!((r=o==null?void 0:o.seekable)!=null&&r.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))].join(":")},mediaEvents:["loadedmetadata","emptied","progress"]},MEDIA_LOADING:{get:function(n){var r;return((r=n.media)==null?void 0:r.readyState)<3},mediaEvents:["waiting","playing","emptied"]},MEDIA_BUFFERED:{get:function(n){var r;return Ff((r=n.media)==null?void 0:r.buffered)},mediaEvents:["progress","emptied"]},MEDIA_STREAM_TYPE:{get:function(n){let{media:r}=n;if(!r)return;let{streamType:o}=r;if(CE.includes(o)){if(o===Zi.UNKNOWN){let v=n.getAttribute("defaultstreamtype");return[Zi.LIVE,Zi.ON_DEMAND].includes(v)?v:void 0}return o}let m=r.duration;if(m===1/0)return Zi.LIVE;if(Number.isFinite(m))return Zi.ON_DEMAND;{let v=n.getAttribute("defaultstreamtype");if([Zi.LIVE,Zi.ON_DEMAND].includes(v))return v}},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},MEDIA_TARGET_LIVE_WINDOW:{get:function(n){let{media:r}=n;if(!r)return Number.NaN;let{targetLiveWindow:o}=r,m=Si.MEDIA_STREAM_TYPE.get(n);return(o==null||Number.isNaN(o))&&m===Zi.LIVE?0:o},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},MEDIA_TIME_IS_LIVE:{get:function(n){let{media:r}=n;if(!r)return!1;if(typeof r.liveEdgeStart=="number")return Number.isNaN(r.liveEdgeStart)?!1:r.currentTime>=r.liveEdgeStart;if(!(Si.MEDIA_STREAM_TYPE.get(n)==="live"))return!1;let m=r.seekable;if(!m)return!0;if(!m.length)return!1;let v=n.hasAttribute("liveedgeoffset")?Number(n.getAttribute("liveedgeoffset")):10,y=m.end(m.length-1)-v;return r.currentTime>=y},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},MEDIA_IS_FULLSCREEN:{get:function(n,r){var o;let m=n.media;if(m&&ae[It.element]===void 0&&"webkitDisplayingFullscreen"in m)return m.webkitDisplayingFullscreen&&m.webkitPresentationMode==="fullscreen";let v;return r?v=ae[It.element]?r.target:null:v=(o=n.getRootNode().fullscreenElement)!=null?o:ae[It.element],Ls(n.fullscreenElement,v)},rootEvents:It.rootEvents,mediaEvents:It.mediaEvents},MEDIA_IS_PIP:{get:function(n,r){var o;let m=n.media;if(!m)return!1;if(r)return r.type=="enterpictureinpicture";{let v=(o=n.getRootNode().pictureInPictureElement)!=null?o:ae.pictureInPictureElement;return Ls(m,v)}},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},MEDIA_IS_CASTING:{get:function(n,r){var o;let{media:m}=n;if(!m)return!1;let v=(o=globalThis.CastableVideoElement)==null?void 0:o.castElement,y=Ls(m,v);return(r==null?void 0:r.type)==="castchange"&&(r==null?void 0:r.detail)==="CONNECTING"&&(y="connecting"),y},mediaEvents:["entercast","leavecast","castchange"]},MEDIA_AIRPLAY_UNAVAILABLE:{get:function(n,r){if(!im)return Dr.UNSUPPORTED;if(!!r&&r.availability!=="available"&&r.availability==="not-available")return Dr.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"]},MEDIA_CAST_UNAVAILABLE:{get:function(){var n;let r=(n=globalThis.CastableVideoElement)==null?void 0:n.castState;if(!rm||!r)return Dr.UNSUPPORTED;if(!r.includes("CONNECT"))return Dr.UNAVAILABLE},mediaEvents:["castchange"]},MEDIA_FULLSCREEN_UNAVAILABLE:{get:function(){return Hu?void 0:Dr.UNAVAILABLE}},MEDIA_PIP_UNAVAILABLE:{get:function(){return tm?void 0:Dr.UNSUPPORTED}},MEDIA_VOLUME_UNAVAILABLE:{get:function(n){if(yl!==void 0&&!yl)return Dr.UNSUPPORTED;let{media:r}=n;if(r&&typeof r.volume=="undefined")return Dr.UNAVAILABLE},mediaEvents:["loadstart"]},MEDIA_SUBTITLES_LIST:{get:function(n){return Rs(Gu(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack"]},MEDIA_SUBTITLES_SHOWING:{get:function(n){return n.hasAttribute("defaultsubtitles")&&!n.hasAttribute(F.MEDIA_HAS_PLAYED)&&!n.hasAttribute(F.MEDIA_SUBTITLES_SHOWING)&&Mr(n,!0),Rs(ME(n))||void 0},mediaEvents:["loadstart"],trackListEvents:["addtrack","removetrack","change"]}},bl={MEDIA_PLAY_REQUEST:(n,r,o)=>{var m;let v=Si.MEDIA_STREAM_TYPE.get(o),y=o.getAttribute("noautoseektolive")===null;v==Zi.LIVE&&y&&bl.MEDIA_SEEK_TO_LIVE_REQUEST(n),(m=n.play())==null||m.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,r,o)=>{let m=r.detail;if(n.volume=m,m>0&&n.muted&&(n.muted=!1),!o.hasAttribute("novolumepref"))try{q.localStorage.setItem("media-chrome-pref-volume",m.toString())}catch{}},MEDIA_ENTER_FULLSCREEN_REQUEST:(n,r,o)=>{if(!Hu){console.warn("Fullscreen support is unavailable; not entering fullscreen");return}ae.pictureInPictureElement&&ae.exitPictureInPicture(),o[It.enter]?o.fullscreenElement[It.enter]():n.webkitEnterFullscreen?n.webkitEnterFullscreen():n.requestFullscreen?n.requestFullscreen():console.warn("MediaChrome: Fullscreen not supported")},MEDIA_EXIT_FULLSCREEN_REQUEST:()=>{ae[It.exit]()},MEDIA_ENTER_PIP_REQUEST:n=>{if(!ae.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}ae[It.element]&&ae[It.exit]();let r=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};n.requestPictureInPicture().catch(o=>{if(o.code===11)if(n.readyState===0&&n.preload==="none"){let m=()=>{n.removeEventListener("loadedmetadata",v),n.preload="none"},v=()=>{n.requestPictureInPicture().catch(r),m()};n.addEventListener("loadedmetadata",v),n.preload="metadata",setTimeout(()=>{n.readyState===0&&r(),m()},1e3)}else throw o;else throw o})},MEDIA_EXIT_PIP_REQUEST:()=>{ae.pictureInPictureElement&&ae.exitPictureInPicture()},MEDIA_ENTER_CAST_REQUEST:n=>{var r;!((r=globalThis.CastableVideoElement)!=null&&r.castEnabled)||(ae[It.element]&&ae[It.exit](),n.requestCast())},MEDIA_EXIT_CAST_REQUEST:async()=>{var n;(n=globalThis.CastableVideoElement)!=null&&n.castElement&&globalThis.CastableVideoElement.exitCast()},MEDIA_SEEK_REQUEST:(n,r)=>{let o=r.detail;(n.readyState>0||n.readyState===void 0)&&(n.currentTime=o)},MEDIA_PLAYBACK_RATE_REQUEST:(n,r)=>{n.playbackRate=r.detail},MEDIA_PREVIEW_REQUEST:(n,r,o)=>{var m;if(!n)return;let v=r.detail;v===null&&o.propagateMediaState(F.MEDIA_PREVIEW_TIME,void 0),o.propagateMediaState(F.MEDIA_PREVIEW_TIME,v);let[y]=gl(n,{kind:bn.METADATA,label:"thumbnails"});if(!(y&&y.cues))return;if(v===null){o.propagateMediaState(F.MEDIA_PREVIEW_IMAGE,void 0),o.propagateMediaState(F.MEDIA_PREVIEW_COORDS,void 0);return}let I=Array.prototype.find.call(y.cues,z=>z.startTime>=v);if(!I)return;let M=/'^(?:[a-z]+:)?\/\//i.test(I.text)||(m=n.querySelector('track[label="thumbnails"]'))==null?void 0:m.src,U=new URL(I.text,M),H=new URLSearchParams(U.hash).get("#xywh");o.propagateMediaState(F.MEDIA_PREVIEW_IMAGE,U.href),o.propagateMediaState(F.MEDIA_PREVIEW_COORDS,H.split(",").join(" "))},MEDIA_SHOW_SUBTITLES_REQUEST:(n,r,o)=>{let m=Gu(o),{detail:v=[]}=r;Fu(al.SHOWING,m,v)},MEDIA_DISABLE_SUBTITLES_REQUEST:(n,r,o)=>{let m=Gu(o),{detail:v=[]}=r;Fu(al.DISABLED,m,v)},MEDIA_AIRPLAY_REQUEST:n=>{if(!!n){if(!(n.webkitShowPlaybackTargetPicker&&q.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 r=n.seekable;if(!r){console.warn("MediaController: Media element does not support seeking to live.");return}if(!r.length){console.warn("MediaController: Media is unable to seek to live.");return}n.currentTime=r.end(r.length-1)}};var Wu=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},Ha=(n,r,o)=>(Wu(n,r,"read from private field"),o?o.call(n):r.get(n)),_l=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},nm=(n,r,o,m)=>(Wu(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),wn=(n,r,o)=>(Wu(n,r,"access private method"),o),aa,Ds,Ln,Cs,Tl,Vu,lm=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],xE=10,sm=0,ki={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYS_USED:"keysused",LIVE_EDGE_OFFSET:"liveedgeoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_HOTKEYS:"nohotkeys"},Al=class extends ml{constructor(){super(),_l(this,Ln),_l(this,Tl),_l(this,aa,new Sn(this,ki.HOTKEYS)),_l(this,Ds,void 0),Si.MEDIA_VOLUME_UNAVAILABLE.get(this)===void 0&&am.then(()=>{this.propagateMediaState(F.MEDIA_VOLUME_UNAVAILABLE,Si.MEDIA_VOLUME_UNAVAILABLE.get(this))}),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,this.associateElement(this),Object.keys(bl).forEach(r=>{let o=`_handle${nl(r,!0)}`;this[o]=m=>{if(m.stopPropagation(),!this.media){console.warn("MediaController: No media available.");return}bl[r](this.media,m,this)},this.addEventListener(Ie[r],this[o])}),this._mediaStatePropagators={},Object.keys(Si).forEach(r=>{this._mediaStatePropagators[r]=o=>{this.propagateMediaState(F[r],Si[r].get(this,o))}}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(ki.NO_HOTKEYS,ki.HOTKEYS,ki.DEFAULT_STREAM_TYPE,ki.DEFAULT_SUBTITLES)}get fullscreenElement(){var r;return(r=Ha(this,Ds))!=null?r:this}set fullscreenElement(r){this.hasAttribute(ki.FULLSCREEN_ELEMENT)&&this.removeAttribute(ki.FULLSCREEN_ELEMENT),nm(this,Ds,r)}attributeChangedCallback(r,o,m){var v;if(r===ki.NO_HOTKEYS)m!==o&&m===""?(this.hasAttribute(ki.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(r===ki.HOTKEYS)Ha(this,aa).value=m;else if(r===ki.DEFAULT_SUBTITLES&&m!==o&&m==="")Mr(this,!0);else if(r===ki.DEFAULT_STREAM_TYPE)this.propagateMediaState(F.MEDIA_STREAM_TYPE);else if(r===ki.FULLSCREEN_ELEMENT){let y=m?(v=this.getRootNode())==null?void 0:v.getElementById(m):void 0;nm(this,Ds,y)}super.attributeChangedCallback(r,o,m)}mediaSetCallback(r){if(super.mediaSetCallback(r),r.hasAttribute("tabindex")||(r.tabIndex=-1),Object.keys(Si).forEach(o=>{let{mediaEvents:m,rootEvents:v,trackListEvents:y}=Si[o],I=this._mediaStatePropagators[o];m==null||m.forEach(M=>{r.addEventListener(M,I),I()}),v==null||v.forEach(M=>{this.getRootNode().addEventListener(M,I),I()}),y==null||y.forEach(M=>{var U;(U=r.textTracks)==null||U.addEventListener(M,I),I()})}),!this.hasAttribute("novolumepref"))try{let o=q.localStorage.getItem("media-chrome-pref-volume");o!==null&&(r.volume=o)}catch(o){console.debug("Error getting volume pref",o)}}mediaUnsetCallback(r){super.mediaUnsetCallback(r),Object.keys(Si).forEach(o=>{let{mediaEvents:m,rootEvents:v,trackListEvents:y}=Si[o],I=this._mediaStatePropagators[o];m==null||m.forEach(M=>{r.removeEventListener(M,I)}),v==null||v.forEach(M=>{this.getRootNode().removeEventListener(M,I)}),y==null||y.forEach(M=>{var U;(U=r.textTracks)==null||U.removeEventListener(M,I)})}),this.propagateMediaState(F.MEDIA_PAUSED,!0)}propagateMediaState(r,o){let m=this.getAttribute(r);if(om(this.mediaStateReceivers,r,o),m===this.getAttribute(r))return;let v=new q.CustomEvent(xf[r],{composed:!0,bubbles:!0,detail:o});this.dispatchEvent(v)}associateElement(r){if(!r)return;let{associatedElementSubscriptions:o}=this;if(o.has(r))return;let m=this.registerMediaStateReceiver.bind(this),v=this.unregisterMediaStateReceiver.bind(this),y=FE(r,m,v);Object.keys(Ie).forEach(I=>{r.addEventListener(Ie[I],this[`_handle${nl(I,!0)}`])}),o.set(r,y)}unassociateElement(r){if(!r)return;let{associatedElementSubscriptions:o}=this;if(!o.has(r))return;o.get(r)(),o.delete(r),Object.keys(Ie).forEach(v=>{r.removeEventListener(Ie[v],this[`_handle${nl(v,!0)}`])})}registerMediaStateReceiver(r){if(!r)return;let o=this.mediaStateReceivers;o.indexOf(r)>-1||(o.push(r),Object.keys(Si).forEach(v=>{let y=Si[v];om([r],F[v],y.get(this))}))}unregisterMediaStateReceiver(r){let o=this.mediaStateReceivers,m=o.indexOf(r);m<0||o.splice(m,1)}enableHotkeys(){this.addEventListener("keydown",wn(this,Tl,Vu))}disableHotkeys(){this.removeEventListener("keydown",wn(this,Tl,Vu)),this.removeEventListener("keyup",wn(this,Ln,Cs))}get hotkeys(){return Ha(this,aa)}keyboardShortcutHandler(r){var o,m,v,y;if(((y=(v=(o=r.target.getAttribute(ki.KEYS_USED))==null?void 0:o.split(" "))!=null?v:(m=r.target)==null?void 0:m.keysUsed)!=null?y:[]).map(le=>le==="Space"?" ":le).filter(Boolean).includes(r.key))return;let M,U,H,z,J,ee=xE;if(!Ha(this,aa).contains(`no${r.key.toLowerCase()}`)&&!(r.key===" "&&Ha(this,aa).contains("nospace")))switch(r.key){case" ":case"k":M=this.getAttribute(F.MEDIA_PAUSED)!=null?Ie.MEDIA_PLAY_REQUEST:Ie.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"m":M=this.getAttribute(F.MEDIA_VOLUME_LEVEL)==="off"?Ie.MEDIA_UNMUTE_REQUEST:Ie.MEDIA_MUTE_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"f":M=this.getAttribute(F.MEDIA_IS_FULLSCREEN)!=null?Ie.MEDIA_EXIT_FULLSCREEN_REQUEST:Ie.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new q.CustomEvent(M,{composed:!0,bubbles:!0}));break;case"c":Mr(this);break;case"ArrowLeft":U=this.getAttribute(F.MEDIA_CURRENT_TIME),H=U&&!Number.isNaN(+U)?+U:sm,z=Math.max(H-ee,0),J=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:z}),this.dispatchEvent(J);break;case"ArrowRight":U=this.getAttribute(F.MEDIA_CURRENT_TIME),H=U&&!Number.isNaN(+U)?+U:sm,z=Math.max(H+ee,0),J=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:z}),this.dispatchEvent(J);break;default:break}}};aa=new WeakMap;Ds=new WeakMap;Ln=new WeakSet;Cs=function(n){let{key:r}=n;if(!lm.includes(r)){this.removeEventListener("keyup",wn(this,Ln,Cs));return}this.keyboardShortcutHandler(n)};Tl=new WeakSet;Vu=function(n){let{metaKey:r,altKey:o,key:m}=n;if(r||o||!lm.includes(m)){this.removeEventListener("keyup",wn(this,Ln,Cs));return}[" ","ArrowLeft","ArrowRight"].includes(m)&&!(Ha(this,aa).contains(`no${m.toLowerCase()}`)||m===" "&&Ha(this,aa).contains("nospace"))&&n.preventDefault(),this.addEventListener("keyup",wn(this,Ln,Cs),{once:!0})};var PE=Object.values(F),dm=n=>{var r,o,m,v;let{observedAttributes:y}=n.constructor;!y&&((r=n.nodeName)==null?void 0:r.includes("-"))&&(q.customElements.upgrade(n),{observedAttributes:y}=n.constructor);let I=(v=(m=(o=n==null?void 0:n.getAttribute)==null?void 0:o.call(n,Ne.MEDIA_CHROME_ATTRIBUTES))==null?void 0:m.split)==null?void 0:v.call(m,/\s+/);return Array.isArray(y||I)?(y||I).filter(M=>PE.includes(M)):[]},Ku=n=>!!dm(n).length,OE=async(n,r,o)=>(n.isConnected||await ol(0),o==null?n.removeAttribute(r):typeof o=="boolean"?o?n.setAttribute(r,""):n.removeAttribute(r):Number.isNaN(o)?n.removeAttribute(r):n.setAttribute(r,o)),NE=n=>{var r;return!!((r=n.closest)!=null&&r.call(n,'*[slot="media"]'))},Ba=(n,r)=>{if(NE(n))return;let o=(v,y)=>{var I,M;Ku(v)&&y(v);let{children:U=[]}=v!=null?v:{},H=(M=(I=v==null?void 0:v.shadowRoot)==null?void 0:I.children)!=null?M:[];[...U,...H].forEach(J=>Ba(J,y))},m=n==null?void 0:n.nodeName.toLowerCase();if(m.includes("-")&&!Ku(n)){q.customElements.whenDefined(m).then(()=>{o(n,r)});return}o(n,r)},om=(n,r,o)=>{n.forEach(m=>{!dm(m).includes(r)||OE(m,r,o)})},FE=(n,r,o)=>{Ba(n,r);let m=z=>{var J;let ee=(J=z==null?void 0:z.composedPath()[0])!=null?J:z.target;r(ee)},v=z=>{var J;let ee=(J=z==null?void 0:z.composedPath()[0])!=null?J:z.target;o(ee)};n.addEventListener(Ie.REGISTER_MEDIA_STATE_RECEIVER,m),n.addEventListener(Ie.UNREGISTER_MEDIA_STATE_RECEIVER,v);let y=z=>{z.forEach(J=>{let{addedNodes:ee=[],removedNodes:le=[],type:me,target:_e,attributeName:ge}=J;me==="childList"?(Array.prototype.forEach.call(ee,ye=>Ba(ye,r)),Array.prototype.forEach.call(le,ye=>Ba(ye,o))):me==="attributes"&&ge===Ne.MEDIA_CHROME_ATTRIBUTES&&(Ku(_e)?r(_e):o(_e))})},I=[],M=z=>{let J=z.target;J.name!=="media"&&(I.forEach(ee=>Ba(ee,o)),I=[...J.assignedElements({flatten:!0})],I.forEach(ee=>Ba(ee,r)))};n.addEventListener("slotchange",M);let U=new MutationObserver(y);return U.observe(n,{childList:!0,attributes:!0,subtree:!0}),()=>{Ba(n,o),n.removeEventListener("slotchange",M),U.disconnect(),n.removeEventListener(Ie.REGISTER_MEDIA_STATE_RECEIVER,m),n.removeEventListener(Ie.UNREGISTER_MEDIA_STATE_RECEIVER,v)}};q.customElements.get("media-controller")||q.customElements.define("media-controller",Al);var qu=Al;var cm=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},xr=(n,r,o)=>(cm(n,r,"read from private field"),o?o.call(n):r.get(n)),Sl=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},Ms=(n,r,o,m)=>(cm(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),kl,dr,wl,Ll,hm=ae.createElement("template"),um=`
|
|
246
246
|
height: var(--thumb-height);
|
|
247
247
|
width: var(--media-range-thumb-width, 10px);
|
|
248
248
|
border: var(--media-range-thumb-border, none);
|
|
@@ -253,7 +253,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
253
253
|
transition: var(--media-range-thumb-transition, none);
|
|
254
254
|
transform: var(--media-range-thumb-transform, none);
|
|
255
255
|
opacity: var(--media-range-thumb-opacity, 1);
|
|
256
|
-
`,
|
|
256
|
+
`,Yu=`
|
|
257
257
|
min-width: 40px;
|
|
258
258
|
height: var(--track-height);
|
|
259
259
|
border: var(--media-range-track-border, none);
|
|
@@ -261,11 +261,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
261
261
|
outline-offset: var(--media-range-track-outline-offset);
|
|
262
262
|
border-radius: var(--media-range-track-border-radius, 1px);
|
|
263
263
|
background: var(--media-range-track-progress-internal, var(--media-range-track-background, rgb(255 255 255 / .2)));
|
|
264
|
+
backdrop-filter: var(--media-range-track-backdrop-filter);
|
|
264
265
|
box-shadow: var(--media-range-track-box-shadow, none);
|
|
265
266
|
transition: var(--media-range-track-transition, none);
|
|
266
267
|
transform: translate(var(--media-range-track-translate-x, 0), var(--media-range-track-translate-y, 0));
|
|
267
268
|
cursor: pointer;
|
|
268
|
-
`;
|
|
269
|
+
`;hm.innerHTML=`
|
|
269
270
|
<style>
|
|
270
271
|
:host {
|
|
271
272
|
--thumb-height: var(--media-range-thumb-height, 10px);
|
|
@@ -334,8 +335,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
334
335
|
translate: var(--media-range-track-translate-x, 0) var(--media-range-track-translate-y, 0);
|
|
335
336
|
}
|
|
336
337
|
|
|
337
|
-
input[type=range]::-webkit-slider-runnable-track { ${
|
|
338
|
-
input[type=range]::-moz-range-track { ${
|
|
338
|
+
input[type=range]::-webkit-slider-runnable-track { ${Yu} }
|
|
339
|
+
input[type=range]::-moz-range-track { ${Yu} }
|
|
339
340
|
input[type=range]::-ms-track {
|
|
340
341
|
|
|
341
342
|
width: 100%;
|
|
@@ -345,23 +346,26 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
345
346
|
border-color: transparent;
|
|
346
347
|
color: transparent;
|
|
347
348
|
|
|
348
|
-
${
|
|
349
|
+
${Yu}
|
|
349
350
|
}
|
|
350
351
|
|
|
351
352
|
#background,
|
|
352
353
|
#pointer {
|
|
353
|
-
min-width: 40px;
|
|
354
354
|
width: var(--media-range-track-width, 100%);
|
|
355
355
|
height: var(--track-height);
|
|
356
356
|
border-radius: var(--media-range-track-border-radius, 1px);
|
|
357
357
|
position: absolute;
|
|
358
358
|
top: 50%;
|
|
359
359
|
transform: translate(var(--media-range-track-translate-x, 0px), calc(var(--media-range-track-translate-y, 0px) - 50%));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
#background {
|
|
363
|
+
min-width: 40px;
|
|
360
364
|
background: var(--media-range-track-background, rgb(255 255 255 / .2));
|
|
365
|
+
backdrop-filter: var(--media-range-track-background-backdrop-filter);
|
|
361
366
|
}
|
|
362
367
|
|
|
363
368
|
#pointer {
|
|
364
|
-
min-width: auto;
|
|
365
369
|
background: var(--media-range-track-pointer-background);
|
|
366
370
|
border-right: var(--media-range-track-pointer-border-right);
|
|
367
371
|
transition: visibility .25s, opacity .25s;
|
|
@@ -405,7 +409,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
405
409
|
<div id="hoverzone"></div>
|
|
406
410
|
<input id="range" type="range" min="0" max="1000" step="any" value="0">
|
|
407
411
|
</div>
|
|
408
|
-
`;var Ga=class extends q.HTMLElement{constructor(){super(),Sl(this,kl,void 0),Sl(this,
|
|
412
|
+
`;var Ga=class extends q.HTMLElement{constructor(){super(),Sl(this,kl,void 0),Sl(this,dr,void 0),Sl(this,wl,()=>{if(this.range.matches(":focus-visible")){let{style:o}=mt(this.shadowRoot,":host");o.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),Sl(this,Ll,()=>{let{style:o}=mt(this.shadowRoot,":host");o.removeProperty("--_focus-visible-box-shadow")}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(hm.content.cloneNode(!0)));let{style:r}=mt(this.shadowRoot,":host");r.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)),Ms(this,kl,parseInt(getComputedStyle(this).getPropertyValue("--media-range-thumb-width")||"10",10))}static get observedAttributes(){return["disabled","aria-disabled",Ne.MEDIA_CONTROLLER]}attributeChangedCallback(r,o,m){var v,y,I,M,U;r===Ne.MEDIA_CONTROLLER?(o&&((y=(v=xr(this,dr))==null?void 0:v.unassociateElement)==null||y.call(v,this),Ms(this,dr,null)),m&&(Ms(this,dr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(U=(M=xr(this,dr))==null?void 0:M.associateElement)==null||U.call(M,this))):(r==="disabled"||r==="aria-disabled"&&o!==m)&&(m==null?this.range.removeAttribute(r):this.range.setAttribute(r,m))}connectedCallback(){var r,o,m;let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(Ms(this,dr,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(o=xr(this,dr))==null?void 0:o.associateElement)==null||m.call(o,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",xr(this,wl)),this.shadowRoot.addEventListener("focusout",xr(this,Ll))}disconnectedCallback(){var r,o;(o=(r=xr(this,dr))==null?void 0:r.unassociateElement)==null||o.call(r,this),Ms(this,dr,null),this.shadowRoot.removeEventListener("focusin",xr(this,wl)),this.shadowRoot.removeEventListener("focusout",xr(this,Ll))}updatePointerBar(r){let o=this.range.getBoundingClientRect(),m=(r.clientX-o.left)/o.width;m=Math.max(0,Math.min(1,m));let{style:v}=mt(this.shadowRoot,"#pointer");v.setProperty("width",`${m*o.width}px`)}updateBar(){let r=this.getBarColors(),o="linear-gradient(to right, ",m=0;r.forEach(y=>{y[1]<m||(o=o+`${y[0]} ${m}%, ${y[0]} ${y[1]}%,`,m=y[1])}),o=o.slice(0,o.length-1)+")";let{style:v}=mt(this.shadowRoot,"#range");v.setProperty("--media-range-track-progress-internal",o)}getRelativeValues(){let{range:r}=this;return{relativeValue:r.value-r.min,relativeMax:r.max-r.min}}getBarColors(){let r=this.range,{relativeValue:o,relativeMax:m}=this.getRelativeValues(),v=o/m*100,y=0;return!!o&&o<m&&(y=xr(this,kl)*(.5-v/100)/r.offsetWidth*100),[["var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238)))",v+y],["var(--media-range-track-color, transparent)",100]]}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}};kl=new WeakMap;dr=new WeakMap;wl=new WeakMap;Ll=new WeakMap;q.customElements.get("media-chrome-range")||q.customElements.define("media-chrome-range",Ga);var fm=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},Il=(n,r,o)=>(fm(n,r,"read from private field"),o?o.call(n):r.get(n)),UE=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},Rl=(n,r,o,m)=>(fm(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),ur,mm=ae.createElement("template");mm.innerHTML=`
|
|
409
413
|
<style>
|
|
410
414
|
:host {
|
|
411
415
|
|
|
@@ -431,7 +435,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
431
435
|
</style>
|
|
432
436
|
|
|
433
437
|
<slot></slot>
|
|
434
|
-
`;var $
|
|
438
|
+
`;var $u=class extends q.HTMLElement{constructor(){super(),UE(this,ur,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(mm.content.cloneNode(!0))),this.shadowRoot.querySelector("slot").addEventListener("slotchange",({target:r})=>{let o=r.assignedElements({flatten:!0}).every(y=>["media-time-range","media-volume-range"].includes(y.nodeName.toLowerCase())),{style:m}=mt(this.shadowRoot,":host"),v=o?"unset":"initial";m.setProperty("--_range-auto-size",v)})}static get observedAttributes(){return[Ne.MEDIA_CONTROLLER]}attributeChangedCallback(r,o,m){var v,y,I,M,U;r===Ne.MEDIA_CONTROLLER&&(o&&((y=(v=Il(this,ur))==null?void 0:v.unassociateElement)==null||y.call(v,this),Rl(this,ur,null)),m&&(Rl(this,ur,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(U=(M=Il(this,ur))==null?void 0:M.associateElement)==null||U.call(M,this)))}connectedCallback(){var r,o,m;let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(Rl(this,ur,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(o=Il(this,ur))==null?void 0:o.associateElement)==null||m.call(o,this))}disconnectedCallback(){var r,o;(o=(r=Il(this,ur))==null?void 0:r.unassociateElement)==null||o.call(r,this),Rl(this,ur,null)}};ur=new WeakMap;q.customElements.get("media-control-bar")||q.customElements.define("media-control-bar",$u);var pm=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},Dl=(n,r,o)=>(pm(n,r,"read from private field"),o?o.call(n):r.get(n)),BE=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},Cl=(n,r,o,m)=>(pm(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),cr,vm=ae.createElement("template");vm.innerHTML=`
|
|
435
439
|
<style>
|
|
436
440
|
:host {
|
|
437
441
|
font: var(--media-font,
|
|
@@ -464,11 +468,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
464
468
|
}
|
|
465
469
|
</style>
|
|
466
470
|
<slot></slot>
|
|
467
|
-
`;var
|
|
471
|
+
`;var Pr=class extends q.HTMLElement{constructor(){super(),BE(this,cr,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(vm.content.cloneNode(!0)));let{style:r}=mt(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`)}static get observedAttributes(){return[Ne.MEDIA_CONTROLLER]}attributeChangedCallback(r,o,m){var v,y,I,M,U;r===Ne.MEDIA_CONTROLLER&&(o&&((y=(v=Dl(this,cr))==null?void 0:v.unassociateElement)==null||y.call(v,this),Cl(this,cr,null)),m&&(Cl(this,cr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(U=(M=Dl(this,cr))==null?void 0:M.associateElement)==null||U.call(M,this)))}connectedCallback(){var r,o,m;let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(Cl(this,cr,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(o=Dl(this,cr))==null?void 0:o.associateElement)==null||m.call(o,this))}disconnectedCallback(){var r,o;(o=(r=Dl(this,cr))==null?void 0:r.unassociateElement)==null||o.call(r,this),Cl(this,cr,null)}};cr=new WeakMap;q.customElements.get("media-text-display")||q.customElements.define("media-text-display",Pr);var Em=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},gm=(n,r,o)=>(Em(n,r,"read from private field"),o?o.call(n):r.get(n)),HE=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},GE=(n,r,o,m)=>(Em(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),xs,ju=class extends Pr{constructor(){super(),HE(this,xs,void 0),GE(this,xs,this.shadowRoot.querySelector("slot")),gm(this,xs).textContent=or(0)}static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_DURATION]}attributeChangedCallback(r,o,m){r===F.MEDIA_DURATION&&(gm(this,xs).textContent=or(m)),super.attributeChangedCallback(r,o,m)}get mediaDuration(){return St(this,F.MEDIA_DURATION)}set mediaDuration(r){Lt(this,F.MEDIA_DURATION,r)}};xs=new WeakMap;q.customElements.get("media-duration-display")||q.customElements.define("media-duration-display",ju);var Tm=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},zu=(n,r,o)=>(Tm(n,r,"read from private field"),o?o.call(n):r.get(n)),VE=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},KE=(n,r,o,m)=>(Tm(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),In,Or={REMAINING:"remaining",SHOW_DURATION:"showduration"},ym=[...Object.values(Or),F.MEDIA_CURRENT_TIME,F.MEDIA_DURATION,F.MEDIA_SEEKABLE],bm=["Enter"," "],WE=" / ",_m=(n,{timesSep:r=WE}={})=>{var o,m,v,y;let I=n.hasAttribute(Or.REMAINING),M=n.hasAttribute(Or.SHOW_DURATION),U=(o=n.mediaCurrentTime)!=null?o:0,[,H]=(m=n.mediaSeekable)!=null?m:[],z=(y=(v=n.mediaDuration)!=null?v:H)!=null?y:0,J=I?or(0-(z-U)):or(U);return M?`${J}${r}${or(z)}`:J},qE="video not loaded, unknown time.",YE=n=>{var r;let o=n.mediaCurrentTime,[,m]=(r=n.mediaSeekable)!=null?r:[],v=n.mediaDuration||m;if(o==null||v==null){n.setAttribute("aria-valuetext",qE);return}let y=n.hasAttribute(Or.REMAINING),I=n.hasAttribute(Or.SHOW_DURATION),M=y?Na(0-(v-o)):Na(o);if(!I){n.setAttribute("aria-valuetext",M);return}let U=Na(v),H=`${M} of ${U}`;n.setAttribute("aria-valuetext",H)},Qu=class extends Pr{constructor(){super(),VE(this,In,void 0),KE(this,In,this.shadowRoot.querySelector("slot")),zu(this,In).innerHTML=`${_m(this)}`;let{style:r}=mt(this.shadowRoot,":host");r.setProperty("cursor","pointer");let{style:o}=mt(this.shadowRoot,":host(:hover)");o.setProperty("background","var(--media-control-hover-background, rgba(50 50 70 / .7))")}static get observedAttributes(){return[...super.observedAttributes,...ym,"disabled"]}connectedCallback(){this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",si.PLAYBACK_TIME());let r=o=>{let{key:m}=o;if(!bm.includes(m)){this.removeEventListener("keyup",r);return}this.toggleTimeDisplay()};this.addEventListener("keydown",o=>{let{metaKey:m,altKey:v,key:y}=o;if(m||v||!bm.includes(y)){this.removeEventListener("keyup",r);return}this.addEventListener("keyup",r)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining","")}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(r,o,m){ym.includes(r)?this.update():r==="disabled"&&m!==o&&(m==null?this.enable():this.disable()),super.attributeChangedCallback(r,o,m)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return ht(this,Or.REMAINING)}set remaining(r){pt(this,Or.REMAINING,r)}get showDuration(){return ht(this,Or.SHOW_DURATION)}set showDuration(r){pt(this,Or.SHOW_DURATION,r)}get mediaDuration(){return St(this,F.MEDIA_DURATION)}set mediaDuration(r){Lt(this,F.MEDIA_DURATION,r)}get mediaCurrentTime(){return St(this,F.MEDIA_CURRENT_TIME)}set mediaCurrentTime(r){Lt(this,F.MEDIA_CURRENT_TIME,r)}get mediaSeekable(){let r=this.getAttribute(F.MEDIA_SEEKABLE);if(!!r)return r.split(":").map(o=>+o)}set mediaSeekable(r){if(r==null){this.removeAttribute(F.MEDIA_SEEKABLE);return}this.setAttribute(F.MEDIA_SEEKABLE,r.join(":"))}update(){let r=_m(this);YE(this),r!==zu(this,In).innerHTML&&(zu(this,In).innerHTML=r)}};In=new WeakMap;q.customElements.get("media-time-display")||q.customElements.define("media-time-display",Qu);var $E=`<svg aria-hidden="true" viewBox="0 0 26 24">
|
|
468
472
|
<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"/>
|
|
469
|
-
</svg>`,
|
|
473
|
+
</svg>`,jE=`<svg aria-hidden="true" viewBox="0 0 26 24">
|
|
470
474
|
<path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/>
|
|
471
|
-
</svg>`,
|
|
475
|
+
</svg>`,wm=ae.createElement("template");wm.innerHTML=`
|
|
472
476
|
<style>
|
|
473
477
|
:host([aria-checked="true"]) slot[name=off] {
|
|
474
478
|
display: none !important;
|
|
@@ -481,16 +485,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
481
485
|
</style>
|
|
482
486
|
|
|
483
487
|
<slot name="icon">
|
|
484
|
-
<slot name="on">${
|
|
485
|
-
<slot name="off">${
|
|
488
|
+
<slot name="on">${$E}</slot>
|
|
489
|
+
<slot name="off">${jE}</slot>
|
|
486
490
|
</slot>
|
|
487
|
-
`;var
|
|
488
|
-
<slot name="
|
|
489
|
-
`;var
|
|
491
|
+
`;var Am=n=>{n.setAttribute("aria-checked",Uu(n))},Sm=(n,r)=>{let o=n.getAttribute(r);return o?kn(o):[]},km=(n,r,o)=>{if(!o){n.removeAttribute(r);return}let m=Rs(o);n.getAttribute(r)!==m&&n.setAttribute(r,m)},Xu=class extends vt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}constructor(r={}){super({slotTemplate:wm,...r}),this._captionsReady=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",si.CLOSED_CAPTIONS()),Am(this)}attributeChangedCallback(r,o,m){r===F.MEDIA_SUBTITLES_SHOWING&&Am(this),super.attributeChangedCallback(r,o,m)}get mediaSubtitlesList(){return Sm(this,F.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(r){km(this,F.MEDIA_SUBTITLES_LIST,r)}get mediaSubtitlesShowing(){return Sm(this,F.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(r){km(this,F.MEDIA_SUBTITLES_SHOWING,r)}handleClick(){Mr(this)}};q.customElements.get("media-captions-button")||q.customElements.define("media-captions-button",Xu);function Rn(n){let r=Math.abs(n.seekOffset),o=bt.SEEK_BACK_N_SECS({seekOffset:r});n.setAttribute("aria-label",o)}function Dn(n){let r=Bf(n,"icon"),o=n.seekOffset;Uf(r,o)}var Ml={SEEK_OFFSET:"seekoffset"},Lm=30,zE=`<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)">${Lm}</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>`,Im=ae.createElement("template");Im.innerHTML=`
|
|
492
|
+
<slot name="icon">${zE}</slot>
|
|
493
|
+
`;var QE=0,Zu=class extends vt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME,Ml.SEEK_OFFSET]}constructor(r={}){super({slotTemplate:Im,...r})}connectedCallback(){Rn(this),Dn(this),super.connectedCallback()}attributeChangedCallback(r,o,m){r===Ml.SEEK_OFFSET&&(Dn(this),Rn(this)),super.attributeChangedCallback(r,o,m)}get seekOffset(){var r;return(r=St(this,Ml.SEEK_OFFSET))!=null?r:Lm}set seekOffset(r){Lt(this,Ml.SEEK_OFFSET,r)}get mediaCurrentTime(){var r;return(r=St(this,F.MEDIA_CURRENT_TIME))!=null?r:QE}set mediaCurrentTime(r){Lt(this,F.MEDIA_CURRENT_TIME,r)}handleClick(){let r=this.mediaCurrentTime+this.seekOffset,o=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(o)}};q.customElements.get("media-seek-forward-button")||q.customElements.define("media-seek-forward-button",Zu);var XE=`<svg aria-hidden="true" viewBox="0 0 26 24">
|
|
490
494
|
<path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/>
|
|
491
|
-
</svg>`,
|
|
495
|
+
</svg>`,ZE=`<svg aria-hidden="true" viewBox="0 0 26 24">
|
|
492
496
|
<path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/>
|
|
493
|
-
</svg>`,
|
|
497
|
+
</svg>`,Dm=ae.createElement("template");Dm.innerHTML=`
|
|
494
498
|
<style>
|
|
495
499
|
:host([${F.MEDIA_IS_FULLSCREEN}]) slot:not([name=exit]):not([name=icon]) {
|
|
496
500
|
display: none !important;
|
|
@@ -503,10 +507,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
503
507
|
</style>
|
|
504
508
|
|
|
505
509
|
<slot name="icon">
|
|
506
|
-
<slot name="enter">${
|
|
507
|
-
<slot name="exit">${
|
|
510
|
+
<slot name="enter">${XE}</slot>
|
|
511
|
+
<slot name="exit">${ZE}</slot>
|
|
508
512
|
</slot>
|
|
509
|
-
`;var
|
|
513
|
+
`;var Rm=n=>{let r=n.mediaIsFullscreen?bt.EXIT_FULLSCREEN():bt.ENTER_FULLSCREEN();n.setAttribute("aria-label",r)},Ju=class extends vt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_FULLSCREEN,F.MEDIA_FULLSCREEN_UNAVAILABLE]}constructor(r={}){super({slotTemplate:Dm,...r})}connectedCallback(){Rm(this),super.connectedCallback()}attributeChangedCallback(r,o,m){r===F.MEDIA_IS_FULLSCREEN&&Rm(this),super.attributeChangedCallback(r,o,m)}get mediaFullscreenUnavailable(){return Ht(this,F.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(r){Yt(this,F.MEDIA_FULLSCREEN_UNAVAILABLE,r)}get mediaIsFullscreen(){return ht(this,F.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(r){pt(this,F.MEDIA_IS_FULLSCREEN,r)}handleClick(){let r=this.mediaIsFullscreen?Ie.MEDIA_EXIT_FULLSCREEN_REQUEST:Ie.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new q.CustomEvent(r,{composed:!0,bubbles:!0}))}};q.customElements.get("media-fullscreen-button")||q.customElements.define("media-fullscreen-button",Ju);var{MEDIA_TIME_IS_LIVE:xl,MEDIA_PAUSED:Ps}=F,{MEDIA_SEEK_TO_LIVE_REQUEST:JE,MEDIA_PLAY_REQUEST:ey}=Ie,ty='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>',Cm=ae.createElement("template");Cm.innerHTML=`
|
|
510
514
|
<style>
|
|
511
515
|
|
|
512
516
|
slot[name=indicator] > *,
|
|
@@ -529,16 +533,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
529
533
|
|
|
530
534
|
</style>
|
|
531
535
|
|
|
532
|
-
<slot name="indicator">${
|
|
536
|
+
<slot name="indicator">${ty}</slot>
|
|
533
537
|
|
|
534
538
|
<slot name="spacer"> </slot><slot name="text">LIVE</slot>
|
|
535
|
-
`;var ec=class extends
|
|
539
|
+
`;var ec=class extends vt{static get observedAttributes(){return[...super.observedAttributes,Ps,xl]}constructor(r={}){super({slotTemplate:Cm,...r}),this.setAttribute("aria-label",bt.SEEK_LIVE())}attributeChangedCallback(r,o,m){super.attributeChangedCallback(r,o,m),this.mediaPaused||!this.mediaTimeIsLive?(this.setAttribute("aria-label",bt.SEEK_LIVE()),this.removeAttribute("aria-disabled")):(this.setAttribute("aria-label",bt.PLAYING_LIVE()),this.setAttribute("aria-disabled","true"))}get mediaPaused(){return ht(this,F.MEDIA_PAUSED)}set mediaPaused(r){pt(this,F.MEDIA_PAUSED,r)}get mediaTimeIsLive(){return ht(this,F.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(r){pt(this,F.MEDIA_TIME_IS_LIVE,r)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new q.CustomEvent(JE,{composed:!0,bubbles:!0})),this.hasAttribute(Ps)&&this.dispatchEvent(new q.CustomEvent(ey,{composed:!0,bubbles:!0})))}};q.customElements.get("media-live-button")||q.customElements.define("media-live-button",ec);var{MEDIA_VOLUME_LEVEL:Os}=F,iy=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
536
540
|
<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"/>
|
|
537
|
-
</svg>`,
|
|
541
|
+
</svg>`,Mm=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
538
542
|
<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"/>
|
|
539
|
-
</svg>`,
|
|
543
|
+
</svg>`,ry=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
540
544
|
<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"/>
|
|
541
|
-
</svg>`,
|
|
545
|
+
</svg>`,Pm=ae.createElement("template");Pm.innerHTML=`
|
|
542
546
|
<style>
|
|
543
547
|
|
|
544
548
|
:host(:not([${Os}])) slot:not([name=high]):not([name=icon]),
|
|
@@ -560,14 +564,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
560
564
|
</style>
|
|
561
565
|
|
|
562
566
|
<slot name="icon">
|
|
563
|
-
<slot name="off">${
|
|
564
|
-
<slot name="low">${
|
|
565
|
-
<slot name="medium">${
|
|
566
|
-
<slot name="high">${
|
|
567
|
+
<slot name="off">${iy}</slot>
|
|
568
|
+
<slot name="low">${Mm}</slot>
|
|
569
|
+
<slot name="medium">${Mm}</slot>
|
|
570
|
+
<slot name="high">${ry}</slot>
|
|
567
571
|
</slot>
|
|
568
|
-
`;var
|
|
572
|
+
`;var xm=n=>{let o=n.mediaVolumeLevel==="off"?bt.UNMUTE():bt.MUTE();n.setAttribute("aria-label",o)},tc=class extends vt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_VOLUME_LEVEL]}constructor(r={}){super({slotTemplate:Pm,...r})}connectedCallback(){xm(this),super.connectedCallback()}attributeChangedCallback(r,o,m){r===F.MEDIA_VOLUME_LEVEL&&xm(this),super.attributeChangedCallback(r,o,m)}get mediaVolumeLevel(){return Ht(this,F.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(r){Yt(this,F.MEDIA_VOLUME_LEVEL,r)}handleClick(){let r=this.mediaVolumeLevel==="off"?Ie.MEDIA_UNMUTE_REQUEST:Ie.MEDIA_MUTE_REQUEST;this.dispatchEvent(new q.CustomEvent(r,{composed:!0,bubbles:!0}))}};q.customElements.get("media-mute-button")||q.customElements.define("media-mute-button",tc);var Om=`<svg aria-hidden="true" viewBox="0 0 28 24">
|
|
569
573
|
<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"/>
|
|
570
|
-
</svg>`,
|
|
574
|
+
</svg>`,Fm=ae.createElement("template");Fm.innerHTML=`
|
|
571
575
|
<style>
|
|
572
576
|
:host([${F.MEDIA_IS_PIP}]) slot:not([name=exit]):not([name=icon]) {
|
|
573
577
|
display: none !important;
|
|
@@ -580,14 +584,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
580
584
|
</style>
|
|
581
585
|
|
|
582
586
|
<slot name="icon">
|
|
583
|
-
<slot name="enter">${
|
|
584
|
-
<slot name="exit">${
|
|
587
|
+
<slot name="enter">${Om}</slot>
|
|
588
|
+
<slot name="exit">${Om}</slot>
|
|
585
589
|
</slot>
|
|
586
|
-
`;var
|
|
590
|
+
`;var Nm=n=>{let r=n.mediaIsPip?bt.EXIT_PIP():bt.ENTER_PIP();n.setAttribute("aria-label",r)},ic=class extends vt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_IS_PIP,F.MEDIA_PIP_UNAVAILABLE]}constructor(r={}){super({slotTemplate:Fm,...r})}connectedCallback(){Nm(this),super.connectedCallback()}attributeChangedCallback(r,o,m){r===F.MEDIA_IS_PIP&&Nm(this),super.attributeChangedCallback(r,o,m)}get mediaPipUnavailable(){return Ht(this,F.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(r){Yt(this,F.MEDIA_PIP_UNAVAILABLE,r)}get mediaIsPip(){return ht(this,F.MEDIA_IS_PIP)}set mediaIsPip(r){pt(this,F.MEDIA_IS_PIP,r)}handleClick(){let r=this.mediaIsPip?Ie.MEDIA_EXIT_PIP_REQUEST:Ie.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new q.CustomEvent(r,{composed:!0,bubbles:!0}))}};q.customElements.get("media-pip-button")||q.customElements.define("media-pip-button",ic);var ay=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
587
591
|
<path d="m6 21 15-9L6 3v18Z"/>
|
|
588
|
-
</svg>`,
|
|
592
|
+
</svg>`,ny=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
589
593
|
<path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/>
|
|
590
|
-
</svg>`,
|
|
594
|
+
</svg>`,Bm=ae.createElement("template");Bm.innerHTML=`
|
|
591
595
|
<style>
|
|
592
596
|
:host([${F.MEDIA_PAUSED}]) slot[name=pause] {
|
|
593
597
|
display: none !important;
|
|
@@ -599,12 +603,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
599
603
|
</style>
|
|
600
604
|
|
|
601
605
|
<slot name="icon">
|
|
602
|
-
<slot name="play">${
|
|
603
|
-
<slot name="pause">${
|
|
606
|
+
<slot name="play">${ay}</slot>
|
|
607
|
+
<slot name="pause">${ny}</slot>
|
|
604
608
|
</slot>
|
|
605
|
-
`;var
|
|
609
|
+
`;var Um=n=>{let r=n.mediaPaused?bt.PLAY():bt.PAUSE();n.setAttribute("aria-label",r)},rc=class extends vt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PAUSED,F.MEDIA_ENDED]}constructor(r={}){super({slotTemplate:Bm,...r})}connectedCallback(){Um(this),super.connectedCallback()}attributeChangedCallback(r,o,m){r===F.MEDIA_PAUSED&&Um(this),super.attributeChangedCallback(r,o,m)}get mediaPaused(){return ht(this,F.MEDIA_PAUSED)}set mediaPaused(r){pt(this,F.MEDIA_PAUSED,r)}handleClick(){let r=this.mediaPaused?Ie.MEDIA_PLAY_REQUEST:Ie.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new q.CustomEvent(r,{composed:!0,bubbles:!0}))}};q.customElements.get("media-play-button")||q.customElements.define("media-play-button",rc);var sy=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},Pl=(n,r,o)=>(sy(n,r,"read from private field"),o?o.call(n):r.get(n)),oy=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},Cn,ac={RATES:"rates"},ly=[1,1.25,1.5,1.75,2],Ol=1,Hm=ae.createElement("template");Hm.innerHTML=`
|
|
606
610
|
<span id="container"></span>
|
|
607
|
-
`;var nc=class extends
|
|
611
|
+
`;var nc=class extends vt{constructor(r={}){super({slotTemplate:Hm,...r}),oy(this,Cn,new Sn(this,ac.RATES,{defaultValue:ly})),this.container=this.shadowRoot.querySelector("#container"),this.container.innerHTML=`${Ol}x`}static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PLAYBACK_RATE,ac.RATES]}attributeChangedCallback(r,o,m){if(r===ac.RATES&&(Pl(this,Cn).value=m),r===F.MEDIA_PLAYBACK_RATE){let v=m?+m:Number.NaN,y=Number.isNaN(v)?Ol:v;this.container.innerHTML=`${y}x`,this.setAttribute("aria-label",si.PLAYBACK_RATE({playbackRate:y}));return}super.attributeChangedCallback(r,o,m)}get rates(){return Pl(this,Cn)}set rates(r){r?Array.isArray(r)&&(Pl(this,Cn).value=r.join(" ")):Pl(this,Cn).value=""}get mediaPlaybackRate(){var r;return(r=St(this,F.MEDIA_PLAYBACK_RATE))!=null?r:Ol}set mediaPlaybackRate(r){Lt(this,F.MEDIA_PLAYBACK_RATE,r)}handleClick(){var r,o;let m=Array.from(this.rates.values(),I=>+I).sort(),v=(o=(r=m.find(I=>I>this.mediaPlaybackRate))!=null?r:m[0])!=null?o:Ol,y=new q.CustomEvent(Ie.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:v});this.dispatchEvent(y)}};Cn=new WeakMap;q.customElements.get("media-playback-rate-button")||q.customElements.define("media-playback-rate-button",nc);var hr={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"},Gm=ae.createElement("template");Gm.innerHTML=`
|
|
608
612
|
<style>
|
|
609
613
|
:host {
|
|
610
614
|
pointer-events: none;
|
|
@@ -626,9 +630,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
626
630
|
</style>
|
|
627
631
|
|
|
628
632
|
<img aria-hidden="true" id="image"/>
|
|
629
|
-
`;var
|
|
630
|
-
<slot name="
|
|
631
|
-
`;var
|
|
633
|
+
`;var dy=n=>{n.style.removeProperty("background-image")},uy=(n,r)=>{n.style["background-image"]=`url('${r}')`},sc=class extends q.HTMLElement{static get observedAttributes(){return[hr.PLACEHOLDER_SRC,hr.SRC]}constructor(){super(),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Gm.content.cloneNode(!0))),this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(r,o,m){r===hr.SRC&&(m==null?this.image.removeAttribute(hr.SRC):this.image.setAttribute(hr.SRC,m)),r===hr.PLACEHOLDER_SRC&&(m==null?dy(this.image):uy(this.image,m))}get placeholderSrc(){return Ht(this,hr.PLACEHOLDER_SRC)}set placeholderSrc(r){Yt(this,hr.SRC,r)}get src(){return Ht(this,hr.SRC)}set src(r){Yt(this,hr.SRC,r)}};q.customElements.get("media-poster-image")||q.customElements.define("media-poster-image",sc);var Nl={SEEK_OFFSET:"seekoffset"},Vm=30,cy=`<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)">${Vm}</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>`,Km=ae.createElement("template");Km.innerHTML=`
|
|
634
|
+
<slot name="icon">${cy}</slot>
|
|
635
|
+
`;var hy=0,oc=class extends vt{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_CURRENT_TIME,Nl.SEEK_OFFSET]}constructor(r={}){super({slotTemplate:Km,...r})}connectedCallback(){Rn(this),Dn(this),super.connectedCallback()}attributeChangedCallback(r,o,m){r===Nl.SEEK_OFFSET&&(Dn(this),Rn(this)),super.attributeChangedCallback(r,o,m)}get seekOffset(){var r;return(r=St(this,Nl.SEEK_OFFSET))!=null?r:Vm}set seekOffset(r){Lt(this,Nl.SEEK_OFFSET,r)}get mediaCurrentTime(){var r;return(r=St(this,F.MEDIA_CURRENT_TIME))!=null?r:hy}set mediaCurrentTime(r){Lt(this,F.MEDIA_CURRENT_TIME,r)}handleClick(){let r=Math.max(this.mediaCurrentTime-this.seekOffset,0),o=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(o)}};q.customElements.get("media-seek-backward-button")||q.customElements.define("media-seek-backward-button",oc);var qm=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},Wm=(n,r,o)=>(qm(n,r,"read from private field"),o?o.call(n):r.get(n)),fy=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},my=(n,r,o,m)=>(qm(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),Ns,lc=class extends Pr{constructor(){super(),fy(this,Ns,void 0),my(this,Ns,this.shadowRoot.querySelector("slot")),Wm(this,Ns).textContent=or(0)}static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PREVIEW_TIME]}attributeChangedCallback(r,o,m){r===F.MEDIA_PREVIEW_TIME&&m!=null&&(Wm(this,Ns).textContent=or(m)),super.attributeChangedCallback(r,o,m)}get mediaPreviewTime(){return St(this,F.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(r){Lt(this,F.MEDIA_PREVIEW_TIME,r)}};Ns=new WeakMap;q.customElements.get("media-preview-time-display")||q.customElements.define("media-preview-time-display",lc);var Ym=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},Fl=(n,r,o)=>(Ym(n,r,"read from private field"),o?o.call(n):r.get(n)),py=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},Ul=(n,r,o,m)=>(Ym(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),fr,$m=ae.createElement("template");$m.innerHTML=`
|
|
632
636
|
<style>
|
|
633
637
|
:host {
|
|
634
638
|
box-sizing: border-box;
|
|
@@ -642,7 +646,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
642
646
|
}
|
|
643
647
|
</style>
|
|
644
648
|
<img crossorigin loading="eager" decoding="async">
|
|
645
|
-
`;var
|
|
649
|
+
`;var dc=class extends q.HTMLElement{constructor(){super(),py(this,fr,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild($m.content.cloneNode(!0)))}static get observedAttributes(){return[Ne.MEDIA_CONTROLLER,F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_COORDS]}connectedCallback(){var r,o,m;let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(Ul(this,fr,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(o=Fl(this,fr))==null?void 0:o.associateElement)==null||m.call(o,this))}disconnectedCallback(){var r,o;(o=(r=Fl(this,fr))==null?void 0:r.unassociateElement)==null||o.call(r,this),Ul(this,fr,null)}attributeChangedCallback(r,o,m){var v,y,I,M,U;[F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_COORDS].includes(r)&&this.update(),r===Ne.MEDIA_CONTROLLER&&(o&&((y=(v=Fl(this,fr))==null?void 0:v.unassociateElement)==null||y.call(v,this),Ul(this,fr,null)),m&&(Ul(this,fr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(U=(M=Fl(this,fr))==null?void 0:M.associateElement)==null||U.call(M,this)))}get mediaPreviewImage(){return Ht(this,F.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(r){Yt(this,F.MEDIA_PREVIEW_IMAGE,r)}get mediaPreviewCoords(){let r=this.getAttribute(F.MEDIA_PREVIEW_COORDS);if(!!r)return r.split(/\s+/).map(o=>+o)}set mediaPreviewCoords(r){if(!r){this.removeAttribute(F.MEDIA_PREVIEW_COORDS);return}this.setAttribute(F.MEDIA_PREVIEW_COORDS,r.join(" "))}update(){let r=this.mediaPreviewCoords,o=this.mediaPreviewImage;if(!(r&&o))return;let[m,v,y,I]=r,M=o.split("#")[0],U=getComputedStyle(this),{maxWidth:H,maxHeight:z,minWidth:J,minHeight:ee}=U,le=Math.min(parseInt(H)/y,parseInt(z)/I),me=Math.max(parseInt(J)/y,parseInt(ee)/I),_e=le<1,ge=_e?le:me>1?me:1,{style:ye}=mt(this.shadowRoot,":host"),Ee=mt(this.shadowRoot,"img").style,ue=this.shadowRoot.querySelector("img"),Be=_e?"min":"max";ye.setProperty(`${Be}-width`,"initial","important"),ye.setProperty(`${Be}-height`,"initial","important"),ye.width=`${y*ge}px`,ye.height=`${I*ge}px`;let Ge=()=>{Ee.width=`${this.imgWidth*ge}px`,Ee.height=`${this.imgHeight*ge}px`,Ee.display="block"};ue.src!==M&&(ue.onload=()=>{this.imgWidth=ue.naturalWidth,this.imgHeight=ue.naturalHeight,Ge()},ue.src=M,Ge()),Ge(),Ee.transform=`translate(-${m*ge}px, -${v*ge}px)`}};fr=new WeakMap;q.customElements.get("media-preview-thumbnail")||q.customElements.define("media-preview-thumbnail",dc);var Ec=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},Dt=(n,r,o)=>(Ec(n,r,"read from private field"),o?o.call(n):r.get(n)),oi=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},na=(n,r,o,m)=>(Ec(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),Fs=(n,r,o)=>(Ec(n,r,"access private method"),o),Us,Bl,Bs,Wl,ql,Hl,cc,hc,jm,Gl,fc,Vl,Mn,Hs,mc,Yl,$l,Kl,pc,vc,zm,vy="video not loaded, unknown time.",uc=n=>{let r=n.range,o=Na(+r.value),m=Na(+r.max),v=o&&m?`${o} of ${m}`:vy;r.setAttribute("aria-valuetext",v)},Qm=ae.createElement("template");Qm.innerHTML=`
|
|
646
650
|
<style>
|
|
647
651
|
:host {
|
|
648
652
|
--media-preview-border-radius: 3px;
|
|
@@ -747,7 +751,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
747
751
|
|
|
748
752
|
</slot>
|
|
749
753
|
</div>
|
|
750
|
-
`;var gc=class extends Ga{constructor(){super(),oi(this,Hl),oi(this,hc),oi(this,Gl),oi(this,Kl),oi(this,vc),oi(this,Us,void 0),oi(this,Bl,void 0),oi(this,Bs,void 0),oi(this,Wl,void 0),oi(this,ql,void 0),oi(this,Vl,
|
|
754
|
+
`;var gc=class extends Ga{constructor(){super(),oi(this,Hl),oi(this,hc),oi(this,Gl),oi(this,Kl),oi(this,vc),oi(this,Us,void 0),oi(this,Bl,void 0),oi(this,Bs,void 0),oi(this,Wl,void 0),oi(this,ql,void 0),oi(this,Vl,o=>{if([...Dt(this,Us)].some(z=>o.composedPath().includes(z)))return;this.updatePointerBar(o);let m=this.mediaDuration;if(!m)return;let v=this.range.getBoundingClientRect(),y=(o.clientX-v.left)/v.width;y=Math.max(0,Math.min(1,y));let I=Fs(this,Gl,fc).call(this,Dt(this,Bl),y),{style:M}=mt(this.shadowRoot,"#preview-rail");M.transform=`translateX(${I})`;let U=y*m,H=new q.CustomEvent(Ie.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:U});this.dispatchEvent(H)}),oi(this,Mn,!1),oi(this,Hs,o=>{(!o.composedPath().includes(this)||[...Dt(this,Us)].some(m=>o.composedPath().includes(m)))&&(q.removeEventListener("pointermove",Dt(this,Hs)),na(this,Mn,!1),Dt(this,Yl).call(this))}),oi(this,mc,()=>{q.addEventListener("pointermove",Dt(this,Vl),!1)}),oi(this,Yl,()=>{q.removeEventListener("pointermove",Dt(this,Vl));let o=new q.CustomEvent(Ie.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:null});this.dispatchEvent(o)}),oi(this,$l,()=>{let o=this.getAttribute(F.MEDIA_DURATION);!Dt(this,Mn)&&o&&(na(this,Mn,!0),Dt(this,mc).call(this),q.addEventListener("pointermove",Dt(this,Hs),!1))}),this.container.appendChild(Qm.content.cloneNode(!0)),this.range.addEventListener("input",()=>{cancelAnimationFrame(this._refreshId);let m=this.range.value,v=new q.CustomEvent(Ie.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:m});this.dispatchEvent(v)}),this._refreshBar=()=>{let o=(performance.now()-this._updateTimestamp)/1e3;this.range.value=this.mediaCurrentTime+o*this.mediaPlaybackRate,this.updateBar(),this.updateCurrentBox(),this._refreshId=requestAnimationFrame(this._refreshBar)},na(this,Us,this.shadowRoot.querySelectorAll('[part~="box"]')),na(this,Bl,this.shadowRoot.querySelector('[part~="preview-box"]')),na(this,Bs,this.shadowRoot.querySelector('[part~="current-box"]'));let r=getComputedStyle(this);na(this,Wl,parseInt(r.getPropertyValue("--media-box-padding-left"))),na(this,ql,parseInt(r.getPropertyValue("--media-box-padding-right"))),Fs(this,Kl,pc).call(this)}static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_PAUSED,F.MEDIA_DURATION,F.MEDIA_SEEKABLE,F.MEDIA_CURRENT_TIME,F.MEDIA_PREVIEW_IMAGE,F.MEDIA_PREVIEW_TIME,F.MEDIA_BUFFERED,F.MEDIA_PLAYBACK_RATE,F.MEDIA_LOADING,F.MEDIA_ENDED]}connectedCallback(){this.range.setAttribute("aria-label",si.SEEK()),super.connectedCallback()}disconnectedCallback(){cancelAnimationFrame(this._refreshId),super.disconnectedCallback()}attributeChangedCallback(r,o,m){var v,y,I,M,U;(r===F.MEDIA_CURRENT_TIME||r===F.MEDIA_PAUSED||r===F.MEDIA_ENDED||r===F.MEDIA_LOADING)&&(this._updateTimestamp=performance.now(),this.range.value=this.mediaCurrentTime,uc(this),this.updateBar(),this.updateCurrentBox(),cancelAnimationFrame(this._refreshId),!this.mediaPaused&&!this.mediaLoading&&(this._refreshId=requestAnimationFrame(this._refreshBar))),r===F.MEDIA_DURATION&&(this.range.max=(y=(v=Dt(this,Hl,cc))!=null?v:this.mediaDuration)!=null?y:1e3,uc(this),this.updateBar(),this.updateCurrentBox()),r===F.MEDIA_SEEKABLE&&(this.range.min=(I=Dt(this,hc,jm))!=null?I:0,this.range.max=(U=(M=Dt(this,Hl,cc))!=null?M:this.mediaDuration)!=null?U:1e3,uc(this),this.updateBar()),r===F.MEDIA_BUFFERED&&this.updateBar(),r==="disabled"&&(m==null?Fs(this,Kl,pc).call(this):Fs(this,vc,zm).call(this)),super.attributeChangedCallback(r,o,m)}get mediaPaused(){return ht(this,F.MEDIA_PAUSED)}set mediaPaused(r){pt(this,F.MEDIA_PAUSED,r)}get mediaLoading(){return ht(this,F.MEDIA_LOADING)}set mediaLoading(r){pt(this,F.MEDIA_LOADING,r)}get mediaDuration(){return St(this,F.MEDIA_DURATION)}set mediaDuration(r){Lt(this,F.MEDIA_DURATION,r)}get mediaCurrentTime(){return St(this,F.MEDIA_CURRENT_TIME)}set mediaCurrentTime(r){Lt(this,F.MEDIA_CURRENT_TIME,r)}get mediaPlaybackRate(){var r;return(r=St(this,F.MEDIA_PLAYBACK_RATE))!=null?r:1}set mediaPlaybackrate(r){Lt(this,F.MEDIA_PLAYBACK_RATE,r)}get mediaBuffered(){let r=this.getAttribute(F.MEDIA_BUFFERED);return r?r.split(" ").map(o=>o.split(":").map(m=>+m)):[]}set mediaBuffered(r){if(!r){this.removeAttribute(F.MEDIA_BUFFERED);return}let o=r.map((m,v)=>`${m}:${v}`).join(" ");this.setAttribute(F.MEDIA_BUFFERED,o)}get mediaSeekable(){let r=this.getAttribute(F.MEDIA_SEEKABLE);if(!!r)return r.split(":").map(o=>+o)}set mediaSeekable(r){if(r==null){this.removeAttribute(F.MEDIA_SEEKABLE);return}this.setAttribute(F.MEDIA_SEEKABLE,r.join(":"))}get mediaPreviewImage(){return Ht(this,F.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(r){Yt(this,F.MEDIA_PREVIEW_IMAGE,r)}get mediaPreviewTime(){return St(this,F.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(r){Lt(this,F.MEDIA_PREVIEW_TIME,r)}get mediaEnded(){return ht(this,F.MEDIA_ENDED)}set mediaEnded(r){pt(this,F.MEDIA_ENDED,r)}getRelativeValues(){let r=super.getRelativeValues();return this.mediaEnded?{...r,relativeValue:r.relativeMax}:r}getBarColors(){var r;let o=super.getBarColors(),{range:m}=this,v=m.max-m.min,y=this.mediaBuffered;if(!y.length||!Number.isFinite(v)||v<=0)return o;let I;if(this.mediaEnded)I=v;else{let U=this.mediaCurrentTime,[,H=m.min]=(r=y.find(([z,J])=>z<=U&&U<=J))!=null?r:[];I=H-m.min}let M=I/v*100;return o.splice(1,0,["var(--media-time-range-buffered-color, rgb(255 255 255 / .4))",M]),o}updateCurrentBox(){if(!Dt(this,Bs).assignedElements().length)return;let r=this.range.value/(this.range.max-this.range.min),o=Fs(this,Gl,fc).call(this,Dt(this,Bs),r),{style:m}=mt(this.shadowRoot,"#current-rail");m.transform=`translateX(${o})`}};Us=new WeakMap;Bl=new WeakMap;Bs=new WeakMap;Wl=new WeakMap;ql=new WeakMap;Hl=new WeakSet;cc=function(){var n;let[,r]=(n=this.mediaSeekable)!=null?n:[];return r};hc=new WeakSet;jm=function(){var n;let[r]=(n=this.mediaSeekable)!=null?n:[];return r};Gl=new WeakSet;fc=function(n,r){var o;let m=`${r*100*100}%`,v=n.offsetWidth;if(!v)return m;let y=(o=this.getAttribute("bounds")?Fa(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?o:this,I=this.range.getBoundingClientRect(),M=y.getBoundingClientRect(),U=(Dt(this,Wl)-(I.left-M.left-v/2))/I.width*100,H=(M.right-I.left-v/2-Dt(this,ql))/I.width*100;return Number.isNaN(U)||(m=`max(${U*100}%, ${m})`),Number.isNaN(H)||(m=`min(${m}, ${H*100}%)`),m};Vl=new WeakMap;Mn=new WeakMap;Hs=new WeakMap;mc=new WeakMap;Yl=new WeakMap;$l=new WeakMap;Kl=new WeakSet;pc=function(){this.addEventListener("pointermove",Dt(this,$l),!1)};vc=new WeakSet;zm=function(){q.removeEventListener("pointermove",Dt(this,Hs)),this.removeEventListener("pointermove",Dt(this,$l)),na(this,Mn,!1),Dt(this,Yl).call(this)};q.customElements.get("media-time-range")||q.customElements.define("media-time-range",gc);var Zm=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},xn=(n,r,o)=>(Zm(n,r,"read from private field"),o?o.call(n):r.get(n)),yc=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},Pn=(n,r,o,m)=>(Zm(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),mr,jl,zl,Xm={LOADING_DELAY:"loadingdelay"},Jm=500,ep=ae.createElement("template"),gy=`
|
|
751
755
|
<svg aria-hidden="true" viewBox="0 0 100 100">
|
|
752
756
|
<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">
|
|
753
757
|
<animateTransform
|
|
@@ -760,13 +764,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
760
764
|
repeatCount="indefinite" />
|
|
761
765
|
</path>
|
|
762
766
|
</svg>
|
|
763
|
-
`;
|
|
767
|
+
`;ep.innerHTML=`
|
|
764
768
|
<style>
|
|
765
769
|
:host {
|
|
766
770
|
display: var(--media-control-display, var(--media-loading-indicator-display, inline-block));
|
|
767
771
|
vertical-align: middle;
|
|
768
772
|
box-sizing: border-box;
|
|
769
|
-
--_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ${
|
|
773
|
+
--_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ${Jm}ms);
|
|
770
774
|
}
|
|
771
775
|
|
|
772
776
|
#status {
|
|
@@ -775,14 +779,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
775
779
|
height: 0px;
|
|
776
780
|
}
|
|
777
781
|
|
|
778
|
-
:host slot[name=
|
|
779
|
-
:host ::slotted([slot=
|
|
782
|
+
:host slot[name=icon] > *,
|
|
783
|
+
:host ::slotted([slot=icon]) {
|
|
780
784
|
opacity: var(--media-loading-indicator-opacity, 0);
|
|
781
785
|
transition: opacity 0.15s;
|
|
782
786
|
}
|
|
783
787
|
|
|
784
|
-
:host([${F.MEDIA_LOADING}]:not([${F.MEDIA_PAUSED}])) slot[name=
|
|
785
|
-
:host([${F.MEDIA_LOADING}]:not([${F.MEDIA_PAUSED}])) ::slotted([slot=
|
|
788
|
+
:host([${F.MEDIA_LOADING}]:not([${F.MEDIA_PAUSED}])) slot[name=icon] > *,
|
|
789
|
+
:host([${F.MEDIA_LOADING}]:not([${F.MEDIA_PAUSED}])) ::slotted([slot=icon]) {
|
|
786
790
|
opacity: var(--media-loading-indicator-opacity, 1);
|
|
787
791
|
transition: opacity 0.15s var(--_loading-indicator-delay);
|
|
788
792
|
}
|
|
@@ -805,9 +809,9 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
805
809
|
}
|
|
806
810
|
</style>
|
|
807
811
|
|
|
808
|
-
<slot name="
|
|
812
|
+
<slot name="icon">${gy}</slot>
|
|
809
813
|
<div id="status" role="status" aria-live="polite">${si.MEDIA_LOADING()}</div>
|
|
810
|
-
`;var bc=class extends q.HTMLElement{constructor(){if(super(),yc(this,mr,void 0),yc(this,jl,
|
|
814
|
+
`;var bc=class extends q.HTMLElement{constructor(){if(super(),yc(this,mr,void 0),yc(this,jl,Jm),yc(this,zl,void 0),!this.shadowRoot){let o=this.attachShadow({mode:"open"}),m=ep.content.cloneNode(!0);o.appendChild(m)}let{style:r}=mt(this.shadowRoot,":host");Pn(this,zl,r)}static get observedAttributes(){return[Ne.MEDIA_CONTROLLER,F.MEDIA_PAUSED,F.MEDIA_LOADING,Xm.LOADING_DELAY]}attributeChangedCallback(r,o,m){var v,y,I,M,U;r===Xm.LOADING_DELAY&&o!==m?this.loadingDelay=Number(m):r===Ne.MEDIA_CONTROLLER&&(o&&((y=(v=xn(this,mr))==null?void 0:v.unassociateElement)==null||y.call(v,this),Pn(this,mr,null)),m&&(Pn(this,mr,(I=this.getRootNode())==null?void 0:I.getElementById(m)),(U=(M=xn(this,mr))==null?void 0:M.associateElement)==null||U.call(M,this)))}connectedCallback(){var r,o,m;let v=this.getAttribute(Ne.MEDIA_CONTROLLER);v&&(Pn(this,mr,(r=this.getRootNode())==null?void 0:r.getElementById(v)),(m=(o=xn(this,mr))==null?void 0:o.associateElement)==null||m.call(o,this))}disconnectedCallback(){var r,o;(o=(r=xn(this,mr))==null?void 0:r.unassociateElement)==null||o.call(r,this),Pn(this,mr,null)}get loadingDelay(){return xn(this,jl)}set loadingDelay(r){Pn(this,jl,r),xn(this,zl).setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${r}ms)`)}get mediaPaused(){return ht(this,F.MEDIA_PAUSED)}set mediaPaused(r){pt(this,F.MEDIA_PAUSED,r)}get mediaLoading(){return ht(this,F.MEDIA_LOADING)}set mediaLoading(r){pt(this,F.MEDIA_LOADING,r)}};mr=new WeakMap;jl=new WeakMap;zl=new WeakMap;q.customElements.get("media-loading-indicator")||q.customElements.define("media-loading-indicator",bc);var Ey=100,yy=1,by=n=>n.mediaMuted?0:Math.round(n.mediaVolume*n.range.max),_y=({value:n,max:r})=>`${Math.round(n/r*100)}%`,_c=class extends Ga{static get observedAttributes(){return[...super.observedAttributes,F.MEDIA_VOLUME,F.MEDIA_MUTED,F.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=Ey,this.range.addEventListener("input",()=>{let o=this.range.value/this.range.max,m=new q.CustomEvent(Ie.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:o});this.dispatchEvent(m)})}connectedCallback(){this.range.setAttribute("aria-label",si.VOLUME()),super.connectedCallback()}attributeChangedCallback(r,o,m){if(r===F.MEDIA_VOLUME||r===F.MEDIA_MUTED){let v=by(this);this.range.value=v,this.range.setAttribute("aria-valuetext",_y(this.range)),this.updateBar()}super.attributeChangedCallback(r,o,m)}get mediaVolume(){var r;return(r=St(this,F.MEDIA_VOLUME))!=null?r:yy}set mediaVolume(r){Lt(this,F.MEDIA_VOLUME,r)}get mediaMuted(){return ht(this,F.MEDIA_MUTED)}set mediaMuted(r){pt(this,F.MEDIA_MUTED,r)}get mediaVolumeUnavailable(){return Ht(this,F.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(r){Yt(this,F.MEDIA_VOLUME_UNAVAILABLE,r)}};q.customElements.get("media-volume-range")||q.customElements.define("media-volume-range",_c);var Lc=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},ut=(n,r,o)=>(Lc(n,r,"read from private field"),o?o.call(n):r.get(n)),fi=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},Ki=(n,r,o,m)=>(Lc(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),Nr=(n,r,o)=>(Lc(n,r,"access private method"),o),oa,Nn,Gs,Fn,Vs,Fr,Un,Tc,sa,Va,Ql,Xl,Ac,On,Sc,Ks,Zl,Jl,kc,wc,tp,Ic,ip,rp=ae.createElement("template");rp.innerHTML=`
|
|
811
815
|
<style>
|
|
812
816
|
:host ul {
|
|
813
817
|
font: var(--media-font,
|
|
@@ -845,7 +849,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
845
849
|
<ul tabindex="0">
|
|
846
850
|
<slot></slot>
|
|
847
851
|
</ul>
|
|
848
|
-
`;var
|
|
852
|
+
`;var ed=class extends q.HTMLElement{constructor(r={}){if(super(),fi(this,Fr),fi(this,sa),fi(this,Xl),fi(this,Ks),fi(this,Jl),fi(this,wc),fi(this,Ic),fi(this,oa,""),fi(this,Nn,null),fi(this,Gs,void 0),fi(this,Fn,void 0),fi(this,Vs,!1),fi(this,Ql,o=>{this.handleClick(o)}),fi(this,On,o=>{let{key:m}=o;if(m==="Escape"){this.removeEventListener("keyup",ut(this,On));return}if(m==="Meta"){Ki(this,Vs,!1);return}Nr(this,Xl,Ac).call(this,o)}),fi(this,Sc,o=>{let{key:m,altKey:v}=o;if(v){this.removeEventListener("keyup",ut(this,On));return}if(m==="Meta"){Ki(this,Vs,!0);return}if(this.keysUsed.includes(m)&&o.preventDefault(),ut(this,Vs)&&this.keysUsed.includes(m)){Nr(this,Xl,Ac).call(this,o);return}this.addEventListener("keyup",ut(this,On),{once:!0})}),!this.shadowRoot){let o=this.attachShadow({mode:"open"}),m=rp.content.cloneNode(!0);this.nativeEl=m;let v=r.slotTemplate;v||(v=ae.createElement("template"),v.innerHTML=`<slot>${r.defaultContent||""}</slot>`),this.nativeEl.appendChild(v.content.cloneNode(!0)),o.appendChild(m)}Ki(this,Gs,this.shadowRoot.querySelector("slot")),ut(this,Gs).addEventListener("slotchange",()=>{Ki(this,Fr,ut(this,Gs).assignedElements({flatten:!0}),Tc),ut(this,Fr,Un).length===1&&ut(this,Fr,Un)[0].nodeName.toLowerCase()==="slot"&&Ki(this,Fr,ut(this,Fr,Un)[0].assignedElements({flatten:!0}),Tc);let o=ut(this,sa,Va);if(o.some(y=>y.getAttribute("tabindex")==="0"))return;let v=o.filter(y=>y.getAttribute("aria-selected")==="true")[0];v||(v=o[0]),v&&(v.setAttribute("tabindex",0),v.setAttribute("aria-selected","true"))})}static get observedAttributes(){return["disabled",Ne.MEDIA_CONTROLLER]}get selectedOptions(){return ut(this,sa,Va).filter(r=>r.getAttribute("aria-selected")==="true")}get value(){return this.selectedOptions[0].value||this.selectedOptions[0].textContent}set value(r){let o=ut(this,sa,Va).find(m=>m.value===r||m.textContent===r);!o||Nr(this,Jl,kc).call(this,o)}focus(){var r;(r=this.selectedOptions[0])==null||r.focus()}enable(){this.addEventListener("click",ut(this,Ql)),this.addEventListener("keydown",ut(this,Sc))}disable(){this.removeEventListener("click",ut(this,Ql)),this.removeEventListener("keyup",ut(this,On))}attributeChangedCallback(r,o,m){var v,y;if(r===Ne.MEDIA_CONTROLLER){if(o){let I=ae.getElementById(o);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this)}if(m){let I=ae.getElementById(m);(y=I==null?void 0:I.associateElement)==null||y.call(I,this)}}else r==="disabled"&&m!==o&&(m==null?this.enable():this.disable())}connectedCallback(){var r;this.hasAttribute("disabled")||this.enable(),this.hasAttribute("role")||this.setAttribute("role","listbox");let o=this.getAttribute(Ne.MEDIA_CONTROLLER);if(o){let m=ae.getElementById(o);(r=m==null?void 0:m.associateElement)==null||r.call(m,this)}}disconnectedCallback(){var r;this.disable();let o=this.getAttribute(Ne.MEDIA_CONTROLLER);if(o){let m=ae.getElementById(o);(r=m==null?void 0:m.unassociateElement)==null||r.call(m,this)}}get keysUsed(){return["Enter"," ","ArrowDown","ArrowUp","Home","End"]}handleSelection(r,o){let m=Nr(this,Ks,Zl).call(this,r);!m||Nr(this,Jl,kc).call(this,m,o)}handleMovement(r){let{key:o}=r,m=ut(this,sa,Va),v=Nr(this,Ks,Zl).call(this,r);v||(v=m.filter(I=>I.getAttribute("tabindex")==="0")[0]);let y;switch(o){case"ArrowDown":y=v.nextElementSibling,y!=null&&y.hasAttribute("disabled")&&(y=y.nextElementSibling);break;case"ArrowUp":y=v.previousElementSibling,y!=null&&y.hasAttribute("disabled")&&(y=y.previousElementSibling);break;case"Home":y=m[0];break;case"End":y=m[m.length-1];break;default:y=Nr(this,wc,tp).call(this,o);break}y&&(m.forEach(I=>I.setAttribute("tabindex","-1")),y.setAttribute("tabindex","0"),y.focus())}handleClick(r){let o=Nr(this,Ks,Zl).call(this,r);!o||o.hasAttribute("disabled")||(ut(this,sa,Va).forEach(m=>m.setAttribute("tabindex","-1")),o.setAttribute("tabindex","0"),this.handleSelection(r,this.hasAttribute("aria-multiselectable")&&this.getAttribute("aria-multiselectable")==="true"))}};oa=new WeakMap;Nn=new WeakMap;Gs=new WeakMap;Fn=new WeakMap;Vs=new WeakMap;Fr=new WeakSet;Un=function(){return ut(this,Fn)||Ki(this,Fn,Array.from(this.shadowRoot.querySelectorAll("media-chrome-listitem"))),ut(this,Fn)};Tc=function(n){Ki(this,Fn,n)};sa=new WeakSet;Va=function(){return ut(this,Fr,Un).filter(n=>!n.hasAttribute("disabled"))};Ql=new WeakMap;Xl=new WeakSet;Ac=function(n){let{key:r}=n;r==="Enter"||r===" "?this.handleSelection(n,this.hasAttribute("aria-multiselectable")&&this.getAttribute("aria-multiselectable")==="true"):this.handleMovement(n)};On=new WeakMap;Sc=new WeakMap;Ks=new WeakSet;Zl=function(n){let r=n.composedPath(),o=r.findIndex(m=>m.nodeName==="MEDIA-CHROME-LISTITEM");return r[o]};Jl=new WeakSet;kc=function(n,r){(!this.hasAttribute("aria-multiselectable")||this.getAttribute("aria-multiselectable")!=="true")&&ut(this,Fr,Un).forEach(o=>o.setAttribute("aria-selected","false")),r&&n.getAttribute("aria-selected")==="true"?n.setAttribute("aria-selected","false"):n.setAttribute("aria-selected","true"),this.dispatchEvent(new Event("change"))};wc=new WeakSet;tp=function(n){Nr(this,Ic,ip).call(this);let r=ut(this,sa,Va),o=r.findIndex(H=>H.getAttribute("tabindex")==="0");Ki(this,oa,ut(this,oa)+n);let m=ut(this,oa).split("").every(H=>H===n),v=r.slice(o+(m?1:0)).filter(H=>H.textContent.toLowerCase().startsWith(ut(this,oa))),y=r.slice(0,o-(m?1:0)).filter(H=>H.textContent.toLowerCase().startsWith(ut(this,oa))),I=[],M=[];return m&&(I=r.slice(o+(m?1:0)).filter(H=>H.textContent.startsWith(n)),M=r.slice(0,o-(m?1:0)).filter(H=>H.textContent.startsWith(n))),[...v,...y,...I,...M][0]};Ic=new WeakSet;ip=function(){q.clearTimeout(ut(this,Nn)),Ki(this,Nn,null),Ki(this,Nn,q.setTimeout(()=>{Ki(this,oa,""),Ki(this,Nn,null)},500))};q.customElements.get("media-chrome-listbox")||q.customElements.define("media-chrome-listbox",ed);var ap=ed;var Cc=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},be=(n,r,o)=>(Cc(n,r,"read from private field"),o?o.call(n):r.get(n)),li=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},Wi=(n,r,o,m)=>(Cc(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),Ur=(n,r,o)=>(Cc(n,r,"access private method"),o),Bn,Ws,Hn,$t,qs,_t,pr,Ys,Ka,Gn,td,Rc,np,Dc,sp,Vn,$s,Mc,op,id,xc,lp=ae.createElement("template");lp.innerHTML=`
|
|
849
853
|
<style>
|
|
850
854
|
:host {
|
|
851
855
|
display: inline-flex;
|
|
@@ -873,7 +877,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
873
877
|
<slot></slot>
|
|
874
878
|
</media-chrome-listbox>
|
|
875
879
|
</slot>
|
|
876
|
-
`;var
|
|
880
|
+
`;var rd=class extends q.HTMLElement{constructor(){var r;if(super(),li(this,Rc),li(this,Dc),li(this,Vn),li(this,Mc),li(this,id),li(this,Bn,void 0),li(this,Ws,void 0),li(this,Hn,!0),li(this,$t,void 0),li(this,qs,void 0),li(this,_t,void 0),li(this,pr,void 0),li(this,Ys,!1),li(this,Ka,m=>{let{key:v}=m;if(!this.keysUsed.includes(v)){this.removeEventListener("keyup",be(this,Ka));return}m.composedPath().includes(be(this,$t))&&(v==="Enter"||v===" ")?be(this,Bn).call(this):v==="Escape"&&!be(this,pr).hidden&&Ur(this,Vn,$s).call(this)}),li(this,Gn,m=>{let{metaKey:v,altKey:y,key:I}=m;if(v||y||!this.keysUsed.includes(I)){this.removeEventListener("keyup",be(this,Ka));return}m.preventDefault(),this.addEventListener("keyup",be(this,Ka),{once:!0})}),li(this,td,m=>{m.composedPath().includes(this)||be(this,pr).hidden||Ur(this,Vn,$s).call(this)}),!this.shadowRoot){let m=this.attachShadow({mode:"open"}),v=lp.content.cloneNode(!0);this.nativeEl=v,m.appendChild(v)}let{style:o}=mt(this.shadowRoot,":host");o.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),Wi(this,Bn,Ur(this,Rc,np).bind(this)),Wi(this,Ws,Ur(this,Dc,sp).bind(this)),(r=this.init)==null||r.call(this),Wi(this,$t,this.shadowRoot.querySelector("[part=button]")),Wi(this,_t,this.shadowRoot.querySelector("[part=listbox]")),Wi(this,qs,this.shadowRoot.querySelector("slot[name=button]")),be(this,qs).addEventListener("slotchange",()=>{let m=be(this,qs).assignedElements()[0];!m||(this.disable(),Wi(this,$t,m),be(this,$t).preventClick=!0,be(this,$t).hasAttribute("disabled")&&Wi(this,Hn,!1),be(this,Hn)?(this.enable(),be(this,$t).setAttribute("aria-haspopup","listbox")):this.disable())}),Wi(this,pr,this.shadowRoot.querySelector("slot[name=listbox]")),be(this,pr).addEventListener("slotchange",()=>{this.disable(),Wi(this,_t,be(this,pr).assignedElements()[0]||be(this,_t)),this.enable()})}static get observedAttributes(){return["disabled",Ne.MEDIA_CONTROLLER]}enable(){be(this,$t).removeAttribute("disabled"),be(this,$t).addEventListener("click",be(this,Bn)),be(this,$t).addEventListener("keydown",be(this,Gn)),be(this,_t).addEventListener("keydown",be(this,Gn)),Ur(this,id,xc).call(this),be(this,_t).addEventListener("change",be(this,Ws)),ae.addEventListener("click",be(this,td))}disable(){be(this,$t).setAttribute("disabled",""),be(this,$t).removeEventListener("click",be(this,Bn)),be(this,$t).removeEventListener("keydown",be(this,Gn)),be(this,$t).removeEventListener("keyup",be(this,Ka)),be(this,_t).removeEventListener("keydown",be(this,Gn)),be(this,_t).removeEventListener("keyup",be(this,Ka)),be(this,_t).addEventListener("change",be(this,Ws)),ae.removeEventListener("click",be(this,td))}attributeChangedCallback(r,o,m){var v,y;if(r===Ne.MEDIA_CONTROLLER){if(o){let I=ae.getElementById(o);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this),be(this,_t).removeAttribute(Ne.MEDIA_CONTROLLER)}if(m){let I=ae.getElementById(m);(y=I==null?void 0:I.associateElement)==null||y.call(I,this),be(this,_t).setAttribute(Ne.MEDIA_CONTROLLER,m)}}else r==="disabled"&&m!==o&&(m==null?(Wi(this,Hn,!0),this.enable()):(Wi(this,Hn,!1),this.disable()))}connectedCallback(){var r;this.hasAttribute("disabled")||this.enable();let o=this.getAttribute(Ne.MEDIA_CONTROLLER);if(o){let m=ae.getElementById(o);(r=m==null?void 0:m.associateElement)==null||r.call(m,this),be(this,_t).setAttribute(Ne.MEDIA_CONTROLLER,o)}}disconnectedCallback(){var r;this.disable();let o=this.getAttribute(Ne.MEDIA_CONTROLLER);if(o){let m=ae.getElementById(o);(r=m==null?void 0:m.unassociateElement)==null||r.call(m,this),be(this,_t).removeAttribute(Ne.MEDIA_CONTROLLER)}}get keysUsed(){return["Enter","Escape"," ","ArrowUp","ArrowDown","f","c","k","m"]}};Bn=new WeakMap;Ws=new WeakMap;Hn=new WeakMap;$t=new WeakMap;qs=new WeakMap;_t=new WeakMap;pr=new WeakMap;Ys=new WeakMap;Ka=new WeakMap;Gn=new WeakMap;td=new WeakMap;Rc=new WeakSet;np=function(){Ur(this,Vn,$s).call(this)};Dc=new WeakSet;sp=function(){Ur(this,Vn,$s).call(this,!0)};Vn=new WeakSet;$s=function(n){be(this,pr).hidden=!be(this,pr).hidden||n,Ur(this,id,xc).call(this,n),be(this,pr).hidden?(this.shadowRoot.activeElement===be(this,_t)||be(this,_t).contains(this.shadowRoot.activeElement))&&be(this,$t).focus():(be(this,_t).focus(),Ur(this,Mc,op).call(this))};Mc=new WeakSet;op=function(){var n;if(be(this,_t).offsetWidth===0)return;let r=be(this,$t).getBoundingClientRect();if(this.hasAttribute("mediacontroller")||be(this,$t).hasAttribute("mediacontroller")||be(this,_t).hasAttribute("mediacontroller")){be(this,_t).style.zIndex="1",be(this,_t).style.bottom="unset",be(this,_t).style.top=r.height+"px";return}let m=((n=this.getAttribute("bounds")?Fa(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?n:this).getBoundingClientRect(),v=be(this,_t).getBoundingClientRect(),y=-Math.max(r.x+v.width-m.right,0);be(this,_t).style.transform=`translateX(${y}px)`};id=new WeakSet;xc=function(n=!1){Wi(this,Ys,!be(this,Ys)||n),be(this,$t).setAttribute("aria-expanded",be(this,Ys))};q.customElements.get("media-chrome-selectmenu")||q.customElements.define("media-chrome-selectmenu",rd);var dp=rd;var up=ae.createElement("template");up.innerHTML=`
|
|
877
881
|
<style>
|
|
878
882
|
:host {
|
|
879
883
|
display: list-item;
|
|
@@ -890,24 +894,24 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
890
894
|
<li>
|
|
891
895
|
<slot></slot>
|
|
892
896
|
</li>
|
|
893
|
-
`;var Pc={VALUE:"value"},Oc=class extends q.HTMLElement{static get observedAttributes(){return["disabled","aria-selected",Pc.VALUE,Ne.MEDIA_CONTROLLER]}constructor(){if(super(),!this.shadowRoot){let r=this.attachShadow({mode:"open"}),
|
|
897
|
+
`;var Pc={VALUE:"value"},Oc=class extends q.HTMLElement{static get observedAttributes(){return["disabled","aria-selected",Pc.VALUE,Ne.MEDIA_CONTROLLER]}constructor(){if(super(),!this.shadowRoot){let r=this.attachShadow({mode:"open"}),o=up.content.cloneNode(!0);this.nativeEl=o,r.appendChild(o)}}set value(r){this.setAttribute(Pc.VALUE,r)}get value(){return this.getAttribute(Pc.VALUE)}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex",-1),this.hasAttribute("aria-selected")||this.setAttribute("aria-selected","false")}disable(){this.removeAttribute("tabindex")}attributeChangedCallback(r,o,m){var v,y;if(r===Ne.MEDIA_CONTROLLER){if(o){let I=ae.getElementById(o);(v=I==null?void 0:I.unassociateElement)==null||v.call(I,this)}if(m){let I=ae.getElementById(m);(y=I==null?void 0:I.associateElement)==null||y.call(I,this)}}else r==="disabled"&&m!==o&&(m==null?this.enable():this.disable())}connectedCallback(){var r;this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","option");let o=this.getAttribute(Ne.MEDIA_CONTROLLER);if(o){let m=ae.getElementById(o);(r=m==null?void 0:m.associateElement)==null||r.call(m,this)}}disconnectedCallback(){var r;this.disable();let o=this.getAttribute(Ne.MEDIA_CONTROLLER);if(o){let m=ae.getElementById(o);(r=m==null?void 0:m.unassociateElement)==null||r.call(m,this)}}handleClick(){}};q.customElements.get("media-chrome-listitem")||q.customElements.define("media-chrome-listitem",Oc);var Bc=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},wi=(n,r,o)=>(Bc(n,r,"read from private field"),o?o.call(n):r.get(n)),Wa=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},qa=(n,r,o,m)=>(Bc(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),Ya=(n,r,o)=>(Bc(n,r,"access private method"),o),Kn,Br,qi,Nc,hp,Hc,fp,js,ad,nd,Fc,mp=`
|
|
894
898
|
fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
|
|
895
899
|
height: var(--media-captions-indicator-height, 1em);
|
|
896
900
|
vertical-align: var(--media-captions-indicator-vertical-align, bottom);
|
|
897
901
|
margin-inline-start: 1ch;
|
|
898
|
-
`,
|
|
899
|
-
<svg style="${
|
|
902
|
+
`,Ty=`
|
|
903
|
+
<svg style="${mp}" aria-hidden="true" viewBox="0 0 26 24">
|
|
900
904
|
<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"/>
|
|
901
|
-
</svg>`,
|
|
905
|
+
</svg>`,pp=ae.createElement("template");pp.innerHTML=`
|
|
902
906
|
<style>
|
|
903
907
|
media-chrome-listitem {
|
|
904
908
|
white-space: var(--media-captions-listbox-white-space, nowrap);
|
|
905
909
|
}
|
|
906
910
|
</style>
|
|
907
|
-
<slot hidden name="captions-indicator">${
|
|
908
|
-
`;var dp=(n,r)=>n.label===r.label&&n.language===r.language,Uc=class extends rp{constructor(){super({slotTemplate:mp}),Wa(this,Nc),Wa(this,Hc),Wa(this,js),Wa(this,nu),Wa(this,Kn,[]),Wa(this,Ur,void 0),Wa(this,qi,void 0);let r=ae.createElement("media-chrome-listitem");r.part.add("listitem"),r.value="off",r.textContent="Off",qa(this,Ur,r);let l=this.shadowRoot.querySelector('[name="captions-indicator"]');qa(this,qi,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?qa(this,qi,m[0].firstElementChild):v.length===1&&qa(this,qi,v[0])}ki(this,qi)||qa(this,qi,l.firstElementChild),qa(this,qi,ki(this,qi).cloneNode(!0)),ki(this,qi).removeAttribute("slot"),ki(this,qi).setAttribute("style",fp)})}static get observedAttributes(){return[...super.observedAttributes,"aria-multiselectable",F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(r,l,m){if(r===F.MEDIA_SUBTITLES_LIST&&l!==m)qa(this,Kn,Ya(this,Nc,cp).call(this,m,ki(this,Kn))),Ya(this,js,au).call(this);else if(r===F.MEDIA_SUBTITLES_SHOWING&&l!==m){let v=kn(m!=null?m:"")[0];ki(this,Kn).forEach(y=>{y.selected=y.language===v.language&&y.label===v.label}),Ya(this,js,au).call(this)}else r==="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(r,l,m)}connectedCallback(){Ya(this,js,au).call(this),this.addEventListener("change",Ya(this,nu,Fc)),super.connectedCallback()}disconnectedCallback(){this.removeEventListener("change",Ya(this,nu,Fc)),super.disconnectedCallback()}};Kn=new WeakMap;Ur=new WeakMap;qi=new WeakMap;Nc=new WeakSet;cp=function(n,r){let l=n?kn(n!=null?n:""):[],m=[],v=[];return r.forEach(y=>{l.some(I=>dp(I,y))||m.push(y)}),l.forEach(y=>{r.some(I=>dp(I,y))||v.push(y)}),m.forEach(y=>y.el.remove()),r.filter(y=>!m.includes(y)).concat(v)};Hc=new WeakSet;hp=function(n){let r=this.shadowRoot.querySelector("ul slot");n.forEach(l=>{var m;let v=l.el,y=!0,I=(m=l.kind)!=null?m:"subs";if(!v){v=ae.createElement("media-chrome-listitem"),y=!1,v.part.add("listitem"),v.value=Nd(l);let M=ae.createElement("span");M.textContent=l.label,v.append(M),I==="captions"&&v.append(ki(this,qi).cloneNode(!0))}l.selected?v.setAttribute("aria-selected","true"):v.setAttribute("aria-selected","false"),y||(r.append(v),l.el=v)})};js=new WeakSet;au=function(){let n=this.shadowRoot.querySelector("ul slot");n.contains(ki(this,Ur))||n.append(ki(this,Ur)),this.hasAttribute(F.MEDIA_SUBTITLES_SHOWING)?(ki(this,Ur).setAttribute("aria-selected","false"),ki(this,Ur).setAttribute("tabindex","-1")):(ki(this,Ur).setAttribute("aria-selected","true"),ki(this,Ur).setAttribute("tabindex","0")),Ya(this,Hc,hp).call(this,ki(this,Kn))};nu=new WeakSet;Fc=function(){var n;let r=(n=this.selectedOptions[0])==null?void 0:n.value;if(Cr(this,!1),!r)return;let l=new q.CustomEvent(Ie.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(l)};q.customElements.get("media-captions-listbox")||q.customElements.define("media-captions-listbox",Uc);var Gc=class extends lp{constructor(){super()}init(){let r=ae.createElement("media-captions-button");r.part.add("button"),r.preventClick=!0;let l=ae.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(r),v.append(l)}};q.customElements.get("media-captions-selectmenu")||q.customElements.define("media-captions-selectmenu",Gc);var ou=Rf(pp(),1),Sp=Rf(gp(),1),_y=Sp.default,wi=_y,zs=class extends Error{constructor(n,r=zs.MEDIA_ERR_CUSTOM,l,m){var v;super(n),this.name="MediaError",this.code=r,this.context=m,this.fatal=l!=null?l:r>=zs.MEDIA_ERR_NETWORK&&r<=zs.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(v=zs.defaultMessages[this.code])!=null?v:"")}},Tt=zs;Tt.MEDIA_ERR_ABORTED=1,Tt.MEDIA_ERR_NETWORK=2,Tt.MEDIA_ERR_DECODE=3,Tt.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Tt.MEDIA_ERR_ENCRYPTED=5,Tt.MEDIA_ERR_CUSTOM=100,Tt.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 Ty=n=>n==null,kp=(n,r)=>Ty(r)?!1:n in r,qc={ANY:"any",MUTED:"muted"},vt={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Yi={MSE:"mse",NATIVE:"native"},Yc={HEADER:"header",QUERY:"query",NONE:"none"},Wn=Object.values(Yc),la={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},$c={HLS:la.M3U8},IS=Object.keys($c),RS=[...Object.values(la),"hls","HLS"],oa=(n,r,l,m,v=n)=>{v.addEventListener(r,l,m),n.addEventListener("teardown",()=>{v.removeEventListener(r,l)},{once:!0})};function Ay(n,r,l){r&&l>r&&(l=r);for(let m=0;m<n.length;m++)if(n.start(m)<=l&&n.end(m)>=l)return!0;return!1}var Sy=n=>{let r=n.indexOf("?");if(r<0)return[n];let l=n.slice(0,r),m=n.slice(r);return[l,m]},lu=n=>{let r=n.type;if(r){let m=r.toUpperCase();return kp(m,$c)?$c[m]:r}let{src:l}=n;return l?ky(l):""},wp=n=>n==="VOD"?vt.ON_DEMAND:vt.LIVE,Lp=n=>n==="EVENT"?Number.POSITIVE_INFINITY:n==="VOD"?Number.NaN:0,ky=n=>{let r="";try{r=new URL(n).pathname}catch{console.error("invalid url")}let l=r.lastIndexOf(".");if(l<0)return"";let m=r.slice(l+1).toUpperCase();return kp(m,la)?la[m]:""},wy=Object.values(qc),Ep=n=>typeof n=="boolean"||typeof n=="string"&&wy.includes(n),Ly=({autoplay:n},r,l)=>{let m=!1,v=!1,y=Ep(n)?n:!!n,I=()=>{m||oa(r,"playing",()=>{m=!0},{once:!0})};if(I(),oa(r,"loadstart",()=>{m=!1,I(),Wc(r,y)},{once:!0}),oa(r,"loadstart",()=>{l||(v=!Number.isFinite(r.duration)),Wc(r,y)},{once:!0}),l&&l.once(wi.Events.LEVEL_LOADED,(M,B)=>{var H;v=(H=B.details.live)!=null?H:!1}),!y){let M=()=>{!v||(l!=null&&l.liveSyncPosition?r.currentTime=l.liveSyncPosition:Number.isFinite(r.seekable.end(0))&&(r.currentTime=r.seekable.end(0)))};l&&oa(r,"play",()=>{r.preload==="metadata"?l.once(wi.Events.LEVEL_UPDATED,M):M()},{once:!0})}return M=>{m||(y=Ep(M)?M:!!M,Wc(r,y))}},Wc=(n,r)=>{if(!r)return;let l=n.muted,m=()=>n.muted=l;switch(r){case qc.ANY:n.play().catch(()=>{n.muted=!0,n.play().catch(m)});break;case qc.MUTED:n.muted=!0,n.play().catch(m);break;default:n.play().catch(()=>{});break}},Iy=({preload:n,src:r},l,m)=>{let v=J=>{J!=null&&["","none","metadata","auto"].includes(J)?l.setAttribute("preload",J):l.removeAttribute("preload")};if(!m)return v(n),v;let y=!1,I=!1,M=m.config.maxBufferLength,B=m.config.maxBufferSize,H=J=>{v(J);let ee=J!=null?J:l.preload;I||ee==="none"||(ee==="metadata"?(m.config.maxBufferLength=1,m.config.maxBufferSize=1):(m.config.maxBufferLength=M,m.config.maxBufferSize=B),z())},z=()=>{!y&&r&&(y=!0,m.loadSource(r))};return oa(l,"play",()=>{I=!0,m.config.maxBufferLength=M,m.config.maxBufferSize=B,z()},{once:!0}),H(n),H};function Ry(n,r){r.on(wi.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(v,{tracks:y})=>{y.forEach(I=>{var M;let B=(M=I.subtitleTrack)!=null?M:I.closedCaptions,H=r.subtitleTracks.findIndex(({lang:z,name:J,type:ee})=>z==(B==null?void 0:B.lang)&&J===I.label&&ee.toLowerCase()===I.kind);uu(n,I.kind,I.label,B==null?void 0:B.lang,`${I.kind}${H}`)})});let l=()=>{var v;if(!r.subtitleTracks.length)return;let y=Array.from(n.textTracks).find(M=>M.id&&M.mode==="showing"&&["subtitles","captions"].includes(M.kind)),I=`${(v=r.subtitleTracks[r.subtitleTrack])==null?void 0:v.type.toLowerCase()}${r.subtitleTrack}`;if(y&&(r.subtitleTrack<0||(y==null?void 0:y.id)!==I)){let M=r.subtitleTracks.findIndex(({lang:B,name:H,type:z})=>B==y.language&&H===y.label&&z.toLowerCase()===y.kind);r.subtitleTrack=M}y&&(y==null?void 0:y.id)===I&&y.cues&&Array.from(y.cues).forEach(M=>{y.addCue(M)})};n.textTracks.addEventListener("change",l),r.on(wi.Events.CUES_PARSED,(v,{track:y,cues:I})=>{let M=n.textTracks.getTrackById(y);if(!M)return;let B=M.mode==="disabled";B&&(M.mode="hidden"),I.forEach(H=>{var z;(z=M.cues)!=null&&z.getCueById(H.id)||M.addCue(H)}),B&&(M.mode="disabled")}),r.once(wi.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 y,I;if(!["subtitles","caption"].includes(v.kind)&&v.label==="thumbnails"){if(!((y=v.cues)!=null&&y.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")}})};r.once(wi.Events.MANIFEST_LOADED,m),r.once(wi.Events.MEDIA_ATTACHED,m)}function uu(n,r,l,m,v){let y=document.createElement("track");return y.kind=r,y.label=l,m&&(y.srclang=m),v&&(y.id=v),y.track.mode=["subtitles","captions"].includes(r)?"disabled":"hidden",y.setAttribute("data-removeondestroy",""),n.append(y),y.track}function Ip(n,r){let l=Array.prototype.find.call(n.querySelectorAll("track"),m=>m.track===r);l==null||l.remove()}var Qs="cuepoints",zc=Object.freeze({label:Qs}),Qc=(n,{label:r=Qs}=zc)=>{var l;return(l=Array.from(n.querySelectorAll("track")).find(m=>m.track.label===r&&m.track.kind==="metadata"))==null?void 0:l.track};async function Xc(n,r,l=zc){let m=Qc(n,l);if(!m){let{label:v=Qs}=l;m=uu(n,"metadata",v),m.mode="hidden",await new Promise(y=>setTimeout(()=>y(void 0),0))}return m.mode!=="hidden"&&(m.mode="hidden"),[...r].sort(({time:v},{time:y})=>y-v).forEach(({time:v,value:y})=>{var I,M;let B=Array.prototype.findIndex.call(m==null?void 0:m.cues,le=>le.startTime>=v),H=(I=m==null?void 0:m.cues)==null?void 0:I[B],z=H?H.startTime:Number.isFinite(n.duration)?n.duration:Number.MAX_SAFE_INTEGER,J=(M=m==null?void 0:m.cues)==null?void 0:M[B-1];J&&(J.endTime=v);let ee=new VTTCue(v,z,JSON.stringify(y!=null?y:null));m.addCue(ee)}),m}var Rp=n=>({time:n.startTime,value:JSON.parse(n.text)});function Dp(n,r={label:Qs}){let l=Qc(n,r);return l!=null&&l.cues?Array.from(l.cues,m=>Rp(m)):[]}function Zc(n,r={label:Qs}){var l,m;let v=Qc(n,r);if(!((l=v==null?void 0:v.activeCues)!=null&&l.length))return;let{currentTime:y}=n,I=Array.prototype.find.call((m=v.activeCues)!=null?m:[],({startTime:M,endTime:B})=>M<=y&&B>y);return Rp(I)}async function Dy(n,r=zc){return new Promise(l=>{oa(n,"loadstart",async()=>{let m=await Xc(n,[],r);oa(n,"cuechange",()=>{let v=Zc(n);if(v){let y=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:v});n.dispatchEvent(y)}},{},m),l(m)})})}function Cp(n,r){if(r){let l=r.playingDate;if(l!=null)return new Date(l.getTime()-n.currentTime*1e3)}return typeof n.getStartDate=="function"?n.getStartDate():new Date(NaN)}function Mp(n,r){if(r&&r.playingDate)return r.playingDate;if(typeof n.getStartDate=="function"){let l=n.getStartDate();return new Date(l.getTime()+n.currentTime*1e3)}return new Date(NaN)}var Cy=async n=>fetch(n).then(r=>r.text()).then(r=>{let l=r.split(`
|
|
909
|
-
`).find((m,v,y)=>v&&y[v-1].startsWith("#EXT-X-STREAM-INF"));return fetch(
|
|
910
|
-
`))}),My=n=>{var r,l;let m=(l=((r=n.find(M=>M.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?r:"").split(":")[1])==null?void 0:l.trim(),v=wp(m),y=Lp(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:y,liveEdgeStartOffset:I}},xy=async(n,r)=>{if(r===la.MP4)return{streamType:vt.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0};if(r===la.M3U8){let l=await Cy(n);return My(l)}return console.error(`Media type ${r} is an unrecognized or unsupported type for src ${n}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0}},yp=async(n,r,l=lu({src:n}))=>{var m,v,y;let{streamType:I,targetLiveWindow:M,liveEdgeStartOffset:B}=await xy(n,l);((m=ii.get(r))!=null?m:{}).liveEdgeStartOffset=B,((v=ii.get(r))!=null?v:{}).targetLiveWindow=M,r.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((y=ii.get(r))!=null?y:{}).streamType=I,r.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},Py=n=>{var r;let l=n.type,m=wp(l),v=Lp(l),y,I=!!((r=n.partList)!=null&&r.length);return m===vt.LIVE&&(y=I?n.partTarget*2:n.targetduration*3),{streamType:m,targetLiveWindow:v,liveEdgeStartOffset:y,lowLatency:I}},Oy=(n,r,l)=>{var m,v,y,I,M,B,H,z;let{streamType:J,targetLiveWindow:ee,liveEdgeStartOffset:le,lowLatency:me}=Py(n);if(J===vt.LIVE){me?(l.config.backBufferLength=(m=l.userConfig.backBufferLength)!=null?m:4,l.config.maxFragLookUpTolerance=(v=l.userConfig.maxFragLookUpTolerance)!=null?v:.001,l.config.abrBandWidthUpFactor=(y=l.userConfig.abrBandWidthUpFactor)!=null?y:l.config.abrBandWidthFactor):l.config.backBufferLength=(I=l.userConfig.backBufferLength)!=null?I:8;let _e=Object.freeze({get length(){return r.seekable.length},start(ge){return r.seekable.start(ge)},end(ge){var ye;return ge>this.length?r.seekable.end(ge):(ye=l.liveSyncPosition)!=null?ye:r.seekable.end(ge)}});((M=ii.get(r))!=null?M:{}).seekable=_e}((B=ii.get(r))!=null?B:{}).liveEdgeStartOffset=le,((H=ii.get(r))!=null?H:{}).targetLiveWindow=ee,r.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((z=ii.get(r))!=null?z:{}).streamType=J,r.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},bp,_p,Ny=(_p=(bp=globalThis==null?void 0:globalThis.navigator)==null?void 0:bp.userAgent)!=null?_p:"",Fy=Ny.toLowerCase().indexOf("android")!==-1,ii=new WeakMap,xp="mux.com",Tp,Ap,Pp=(Ap=(Tp=wi).isSupported)==null?void 0:Ap.call(Tp),Uy=Fy,Op=()=>ou.default.utils.now(),By=ou.default.utils.generateUUID,Np=(n,{domain:r=xp,maxResolution:l=""}={})=>{if(!n)return;let[m,v=""]=Sy(n),y=new URL(`https://stream.${r}/${m}.m3u8${v}`);return l&&y.searchParams.set("max_resolution",l),y.toString()},Hy=n=>{if(!n)return;let[r]=n.split("?");return r||void 0},Gy=n=>{if(!n||!n.startsWith("https://stream."))return;let[r]=new URL(n).pathname.slice(1).split(".m3u8");return r||void 0},Vy=n=>{var r,l,m;return(r=n==null?void 0:n.metadata)!=null&&r.video_id?n.metadata.video_id:Kp(n)&&(m=(l=Hy(n.playbackId))!=null?l:Gy(n.src))!=null?m:n.src},Fp=n=>{var r;return(r=ii.get(n))==null?void 0:r.error},Up=n=>{var r,l;return(l=(r=ii.get(n))==null?void 0:r.streamType)!=null?l:vt.UNKNOWN},Bp=n=>{var r,l;return(l=(r=ii.get(n))==null?void 0:r.targetLiveWindow)!=null?l:Number.NaN},Jc=n=>{var r,l;return(l=(r=ii.get(n))==null?void 0:r.seekable)!=null?l:n.seekable},Hp=n=>{var r;let l=(r=ii.get(n))==null?void 0:r.liveEdgeStartOffset;if(typeof l!="number")return Number.NaN;let m=Jc(n);return m.length?m.end(m.length-1)-l:Number.NaN},Gp=(n,r,l)=>{eh(r,l);let{metadata:m={}}=n,{view_session_id:v=By()}=m,y=Vy(n);m.view_session_id=v,m.video_id=y,n.metadata=m,ii.set(r,{});let I=Ky(n,r);qy(n,r,I),Yy(n,r,I),Dy(r);let M=Ly(n,r,I),B=Iy(n,r,I);return{engine:I,setAutoplay:M,setPreload:B}},eh=(n,r)=>{let l=r==null?void 0:r.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",qp),n.removeEventListener("error",jc),n.removeEventListener("durationchange",Wp),ii.delete(n),n.dispatchEvent(new Event("teardown")))};function Vp(n,r){var l;let m=lu(n);if(m!==la.M3U8)return!0;let v=!m||((l=r.canPlayType(m))!=null?l:!0),{preferPlayback:y}=n,I=y===Yi.MSE,M=y===Yi.NATIVE;return v&&(M||!(Pp&&(I||Uy)))}var Ky=(n,r)=>{let{debug:l,streamType:m,startTime:v=-1,metadata:y,preferCmcd:I}=n,M=lu(n)===la.M3U8,B=Vp(n,r);if(M&&!B&&Pp){let H={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},z=Wy(m),J=I!==Yc.NONE?{useHeaders:I===Yc.HEADER,sessionId:y==null?void 0:y.view_session_id,contentId:y==null?void 0:y.video_id}:void 0;return new wi({debug:l,startPosition:v,cmcd:J,...H,...z})}},Wy=n=>n===vt.LIVE?{backBufferLength:8}:{},Kp=({playbackId:n,src:r,customDomain:l})=>{if(n)return!0;if(typeof r!="string")return!1;let m=window==null?void 0:window.location.href,v=new URL(r,m).hostname.toLocaleLowerCase();return v.includes(xp)||!!l&&v.includes(l.toLocaleLowerCase())},qy=(n,r,l)=>{var m;let{envKey:v}=n,y=Kp(n);if(v||y){let{playerInitTime:I,playerSoftwareName:M,playerSoftwareVersion:B,beaconCollectionDomain:H,debug:z,disableCookies:J}=n,ee={...n.metadata,video_title:((m=n==null?void 0:n.metadata)==null?void 0:m.video_title)||void 0},le=me=>typeof me.player_error_code=="string"?!1:typeof n.errorTranslator=="function"?n.errorTranslator(me):me;ou.default.monitor(r,{debug:z,beaconCollectionDomain:H,hlsjs:l,Hls:l?wi:void 0,automaticErrorTracking:!1,errorTranslator:le,disableCookies:J,data:{...v?{env_key:v}:{},player_software_name:M,player_software:M,player_software_version:B,player_init_time:I,...ee}})}},Yy=(n,r,l)=>{var m;let v=Vp(n,r),{src:y}=n;if(r&&v){let I=lu(n);typeof y=="string"?(r.preload==="none"?oa(r,"loadstart",()=>yp(y,r,I)):yp(y,r,I),r.setAttribute("src",y),n.startTime&&(((m=ii.get(r))!=null?m:{}).startTime=n.startTime,r.addEventListener("durationchange",Wp,{once:!0}))):r.removeAttribute("src"),r.addEventListener("error",qp),r.addEventListener("error",jc),r.addEventListener("emptied",()=>{r.querySelectorAll("track[data-removeondestroy]").forEach(M=>{M.remove()})},{once:!0})}else l&&y?(l.once(wi.Events.LEVEL_LOADED,(I,M)=>{Oy(M.details,r,l)}),l.on(wi.Events.ERROR,(I,M)=>{let B={[wi.ErrorTypes.NETWORK_ERROR]:Tt.MEDIA_ERR_NETWORK,[wi.ErrorTypes.MEDIA_ERROR]:Tt.MEDIA_ERR_DECODE},H=new Tt("",B[M.type]);H.fatal=M.fatal,H.data=M,r.dispatchEvent(new CustomEvent("error",{detail:H}))}),r.addEventListener("error",jc),Ry(r,l),l.attachMedia(r)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function Wp(n){var r;let l=n.target,m=(r=ii.get(l))==null?void 0:r.startTime;if(!!m&&Ay(l.seekable,l.duration,m)){let v=l.preload==="auto";v&&(l.preload="none"),l.currentTime=m,v&&(l.preload="auto")}}async function qp(n){if(!n.isTrusted)return;n.stopImmediatePropagation();let r=n.target;if(!(r!=null&&r.error))return;let{message:l,code:m}=r.error,v=new Tt(l,m);if(r.src&&(m!==Tt.MEDIA_ERR_DECODE||m!==void 0))try{let{status:y}=await fetch(r.src);v.data={response:{code:y}}}catch{}r.dispatchEvent(new CustomEvent("error",{detail:v}))}function jc(n){var r,l;if(!(n instanceof CustomEvent)||!(n.detail instanceof Tt))return;let m=n.target,v=n.detail;!v||!v.fatal||(((r=ii.get(m))!=null?r:{}).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 $y=Object.defineProperty,jy=(n,r,l)=>r in n?$y(n,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[r]=l,qn=(n,r,l)=>(jy(n,typeof r!="symbol"?r+"":r,l),l),oh=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},pe=(n,r,l)=>(oh(n,r,"read from private field"),l?l.call(n):r.get(n)),Ye=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},ht=(n,r,l,m)=>(oh(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),kt=(n,r,l)=>(oh(n,r,"access private method"),l),gu=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class n extends gu{}globalThis.DocumentFragment=n}var lh=class extends gu{},zy=class extends gu{},Qy={get(n){},define(n,r,l){},upgrade(n){},whenDefined(n){return Promise.resolve(lh)}},du,Xy=class{constructor(n,r={}){Ye(this,du,void 0),ht(this,du,r==null?void 0:r.detail)}get detail(){return pe(this,du)}initCustomEvent(){}};du=new WeakMap;function Zy(n,r){return new lh}var zp={document:{createElement:Zy},DocumentFragment,customElements:Qy,CustomEvent:Xy,EventTarget:gu,HTMLElement:lh,HTMLVideoElement:zy},Qp=typeof window=="undefined"||typeof globalThis.customElements=="undefined",cu=Qp?zp:globalThis,MS=Qp?zp.document:globalThis.document,Jy=()=>{try{return"0.15.3"}catch{}return"UNKNOWN"},e0=Jy(),t0=()=>e0,Yp=n=>{var r,l,m,v,y,I,M,B,H,z,J,ee,le,me,_e,ge,ye,Ee,de,Be,Ge,re,k,se,W,Se,Xe,at,jt,it,U,di,zt,nt,ri,$e,Gt,gt,Ct,tr;return r=class extends n{constructor(){super(),Ye(this,Xe),Ye(this,jt),Ye(this,U),Ye(this,zt),Ye(this,ri),Ye(this,Gt),Ye(this,Ct),qn(this,"castEnabled",!1),Ye(this,Ge,{paused:!1}),Ye(this,re,void 0),Ye(this,k,{}),Ye(this,se,void 0),Ye(this,W,void 0),Ye(this,Se,void 0),r.instances.add(this),kt(this,ri,$e).call(this)}static get castElement(){return pe(r,l)}static get castEnabled(){return pe(r,m)}static get castState(){var te;return(te=pe(r,H,z))==null?void 0:te.getCastState()}static async exitCast(){try{await pe(r,H,z).endCurrentSession(!0)}catch(te){console.error(te);return}}get castPlayer(){if(r.castElement===this)return pe(this,re)}attributeChangedCallback(te){if(this.castPlayer)switch(te){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(te={}){var ke;kt(ke=r,de,Be).call(ke,te),ht(r,l,this),Object.entries(pe(this,k)).forEach(([st,wt])=>{pe(this,re).controller.addEventListener(st,wt)});try{await pe(r,H,z).requestSession()}catch{ht(r,l,void 0);return}pe(this,Ge).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(st){console.error(st)}}async load(){var te,ke;if(!this.castPlayer)return super.load();let st=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),wt=[...this.querySelectorAll("track")].filter(({kind:Ze,src:vi})=>vi&&(Ze==="subtitles"||Ze==="captions")),Rt=[],ci=0;wt.length&&(st.tracks=wt.map(Ze=>{let vi=++ci;Rt.length===0&&Ze.track.mode==="showing"&&Rt.push(vi);let gi=new chrome.cast.media.Track(vi,chrome.cast.media.TrackType.TEXT);return gi.trackContentId=Ze.src,gi.trackContentType="text/vtt",gi.subtype=Ze.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,gi.name=Ze.label,gi.language=Ze.srclang,gi})),this.castStreamType==="live"?st.streamType=chrome.cast.media.StreamType.LIVE:st.streamType=chrome.cast.media.StreamType.BUFFERED,st.metadata=new chrome.cast.media.GenericMediaMetadata,st.metadata.title=this.title,st.metadata.images=[{url:this.poster}];let $i=new chrome.cast.media.LoadRequest(st);$i.currentTime=(te=super.currentTime)!=null?te:0,$i.autoplay=!pe(this,Ge).paused,$i.activeTrackIds=Rt,await((ke=pe(r,J,ee))==null?void 0:ke.loadMedia($i)),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,ke,st;return(st=(ke=this.getAttribute("cast-src"))!=null?ke:(te=this.querySelector("source"))==null?void 0:te.src)!=null?st: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,ke;return(ke=(te=this.getAttribute("cast-stream-type"))!=null?te:this.streamType)!=null?ke: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 ke;if(this.castPlayer){(te&&!this.castPlayer.isMuted||!te&&this.castPlayer.isMuted)&&((ke=this.castPlayer.controller)==null||ke.muteOrUnmute());return}super.muted=te}get volume(){var te,ke;return this.castPlayer?(ke=(te=this.castPlayer)==null?void 0:te.volumeLevel)!=null?ke:1:super.volume}set volume(te){var ke;if(this.castPlayer){this.castPlayer.volumeLevel=te,(ke=this.castPlayer.controller)==null||ke.setVolumeLevel();return}super.volume=te}get duration(){var te,ke;return this.castPlayer&&pe(this,Xe,at)?(ke=(te=this.castPlayer)==null?void 0:te.duration)!=null?ke:NaN:super.duration}get currentTime(){var te,ke;return this.castPlayer&&pe(this,Xe,at)?(ke=(te=this.castPlayer)==null?void 0:te.currentTime)!=null?ke:0:super.currentTime}set currentTime(te){var ke;if(this.castPlayer){this.castPlayer.currentTime=te,(ke=this.castPlayer.controller)==null||ke.seek();return}super.currentTime=te}get onentercast(){return pe(this,se)}set onentercast(te){pe(this,se)&&(this.removeEventListener("entercast",pe(this,se)),ht(this,se,null)),typeof te=="function"&&(ht(this,se,te),this.addEventListener("entercast",te))}get onleavecast(){return pe(this,W)}set onleavecast(te){pe(this,W)&&(this.removeEventListener("leavecast",pe(this,W)),ht(this,W,null)),typeof te=="function"&&(ht(this,W,te),this.addEventListener("leavecast",te))}get oncastchange(){return pe(this,Se)}set oncastchange(te){pe(this,Se)&&(this.removeEventListener("castchange",pe(this,Se)),ht(this,Se,null)),typeof te=="function"&&(ht(this,Se,te),this.addEventListener("castchange",te))}},l=new WeakMap,m=new WeakMap,v=new WeakMap,y=new WeakSet,I=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},M=new WeakSet,B=function(){return typeof cast!="undefined"&&cast.framework},H=new WeakSet,z=function(){if(pe(r,M,B))return cast.framework.CastContext.getInstance()},J=new WeakSet,ee=function(){var te;return(te=pe(r,H,z))==null?void 0:te.getCurrentSession()},le=new WeakSet,me=function(){var te;return(te=pe(r,J,ee))==null?void 0:te.getSessionObj().media[0]},_e=new WeakSet,ge=function(te){return new Promise((ke,st)=>{pe(r,le,me).editTracksInfo(te,ke,st)})},ye=new WeakSet,Ee=function(te){return new Promise((ke,st)=>{pe(r,le,me).getStatus(te,ke,st)})},de=new WeakSet,Be=function(te){return pe(r,H,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})},Ge=new WeakMap,re=new WeakMap,k=new WeakMap,se=new WeakMap,W=new WeakMap,Se=new WeakMap,Xe=new WeakSet,at=function(){var te;return(te=this.castPlayer)==null?void 0:te.isMediaLoaded},jt=new WeakSet,it=function(){pe(r,l)===this&&(Object.entries(pe(this,k)).forEach(([te,ke])=>{pe(this,re).controller.removeEventListener(te,ke)}),ht(r,l,void 0),this.muted=pe(this,re).isMuted,this.currentTime=pe(this,re).savedPlayerState.currentTime,pe(this,re).savedPlayerState.isPaused===!1&&this.play())},U=new WeakSet,di=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:pe(r,H,z).getCastState()}))},zt=new WeakSet,nt=async function(){var te,ke;let{SESSION_RESUMED:st}=cast.framework.SessionState;if(pe(r,H,z).getSessionState()===st&&this.castSrc===((te=pe(r,le,me))==null?void 0:te.media.contentId)){ht(r,l,this),Object.entries(pe(this,k)).forEach(([wt,Rt])=>{pe(this,re).controller.addEventListener(wt,Rt)});try{await kt(ke=r,ye,Ee).call(ke,new chrome.cast.media.GetStatusRequest)}catch(wt){console.error(wt)}pe(this,k)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),pe(this,k)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},ri=new WeakSet,$e=function(){var te;!pe(r,M,B)||this.castEnabled||(this.castEnabled=!0,kt(te=r,de,Be).call(te),this.textTracks.addEventListener("change",kt(this,Ct,tr).bind(this)),kt(this,U,di).call(this),ht(this,re,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(pe(this,re)),ht(this,k,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:ke})=>{ke===!1&&kt(this,jt,it).call(this),this.dispatchEvent(new Event(ke?"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]:()=>{!pe(this,Xe,at)||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 ke,st;((ke=this.castPlayer)==null?void 0:ke.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"}[(st=this.castPlayer)==null?void 0:st.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!pe(this,Xe,at)||(await Promise.resolve(),kt(this,Gt,gt).call(this))}}))},Gt=new WeakSet,gt=function(){kt(this,Ct,tr).call(this)},Ct=new WeakSet,tr=async function(){var te,ke,st,wt,Rt,ci;if(!this.castPlayer)return;let $i=((ke=(te=pe(this,re).mediaInfo)==null?void 0:te.tracks)!=null?ke:[]).filter(({type:ct})=>ct===chrome.cast.media.TrackType.TEXT),Ze=[...this.textTracks].filter(({kind:ct})=>ct==="subtitles"||ct==="captions"),vi=$i.map(({language:ct,name:rr,trackId:gr})=>{var $r;let{mode:xi}=($r=Ze.find(Er=>Er.language===ct&&Er.label===rr))!=null?$r:{};return xi?{mode:xi,trackId:gr}:!1}).filter(Boolean),gi=vi.filter(({mode:ct})=>ct!=="showing").map(({trackId:ct})=>ct),ji=vi.find(({mode:ct})=>ct==="showing"),ir=(Rt=(wt=(st=pe(r,J,ee))==null?void 0:st.getSessionObj().media[0])==null?void 0:wt.activeTrackIds)!=null?Rt:[],Ei=ir;if(ir.length&&(Ei=Ei.filter(ct=>!gi.includes(ct))),ji!=null&&ji.trackId&&(Ei=[...Ei,ji.trackId]),Ei=[...new Set(Ei)],!((ct,rr)=>ct.length===rr.length&&ct.every(gr=>rr.includes(gr)))(ir,Ei))try{let ct=new chrome.cast.media.EditTracksInfoRequest(Ei);await kt(ci=r,_e,ge).call(ci,ct)}catch(ct){console.error(ct)}},Ye(r,y),Ye(r,M),Ye(r,H),Ye(r,J),Ye(r,le),Ye(r,_e),Ye(r,ye),Ye(r,de),qn(r,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),qn(r,"instances",new Set),Ye(r,l,void 0),Ye(r,m,!1),qn(r,"initCast",()=>{var te;pe(r,y,I)?pe(r,M,B)?pe(te=r,v).call(te,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var ke;return pe(ke=r,v).call(ke,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var ke;return pe(ke=r,v).call(ke,chrome.cast.isAvailable)})}}),Ye(r,v,te=>{if(te){ht(r,m,!0);let{CAST_STATE_CHANGED:ke}=cast.framework.CastContextEventType;pe(r,H,z).addEventListener(ke,wt=>{r.instances.forEach(Rt=>{var ci;return kt(ci=Rt,U,di).call(ci,wt)})});let{SESSION_STATE_CHANGED:st}=cast.framework.CastContextEventType;pe(r,H,z).addEventListener(st,wt=>{r.instances.forEach(Rt=>{var ci;return kt(ci=Rt,zt,nt).call(ci,wt)})}),r.instances.forEach(wt=>{var Rt;return kt(Rt=wt,ri,$e).call(Rt)})}}),r},ih=globalThis.HTMLVideoElement?Yp(HTMLVideoElement):Yp(Object);globalThis.customElements&&!globalThis.customElements.get("castable-video")&&(customElements.define("castable-video",ih,{extends:"video"}),globalThis.CastableVideoElement=ih);ih.initCast();var Eu=["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","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],$p,rh=($p=globalThis.document)==null?void 0:$p.createElement("template");rh&&(rh.innerHTML=`
|
|
911
|
+
<slot hidden name="captions-indicator">${Ty}</slot>
|
|
912
|
+
`;var cp=(n,r)=>n.label===r.label&&n.language===r.language,Uc=class extends ap{constructor(){super({slotTemplate:pp}),Wa(this,Nc),Wa(this,Hc),Wa(this,js),Wa(this,nd),Wa(this,Kn,[]),Wa(this,Br,void 0),Wa(this,qi,void 0);let r=ae.createElement("media-chrome-listitem");r.part.add("listitem"),r.value="off",r.textContent="Off",qa(this,Br,r);let o=this.shadowRoot.querySelector('[name="captions-indicator"]');qa(this,qi,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?qa(this,qi,m[0].firstElementChild):v.length===1&&qa(this,qi,v[0])}wi(this,qi)||qa(this,qi,o.firstElementChild),qa(this,qi,wi(this,qi).cloneNode(!0)),wi(this,qi).removeAttribute("slot"),wi(this,qi).setAttribute("style",mp)})}static get observedAttributes(){return[...super.observedAttributes,"aria-multiselectable",F.MEDIA_SUBTITLES_LIST,F.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(r,o,m){if(r===F.MEDIA_SUBTITLES_LIST&&o!==m)qa(this,Kn,Ya(this,Nc,hp).call(this,m,wi(this,Kn))),Ya(this,js,ad).call(this);else if(r===F.MEDIA_SUBTITLES_SHOWING&&o!==m){let v=kn(m!=null?m:"")[0];wi(this,Kn).forEach(y=>{y.selected=y.language===v.language&&y.label===v.label}),Ya(this,js,ad).call(this)}else r==="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(r,o,m)}connectedCallback(){Ya(this,js,ad).call(this),this.addEventListener("change",Ya(this,nd,Fc)),super.connectedCallback()}disconnectedCallback(){this.removeEventListener("change",Ya(this,nd,Fc)),super.disconnectedCallback()}};Kn=new WeakMap;Br=new WeakMap;qi=new WeakMap;Nc=new WeakSet;hp=function(n,r){let o=n?kn(n!=null?n:""):[],m=[],v=[];return r.forEach(y=>{o.some(I=>cp(I,y))||m.push(y)}),o.forEach(y=>{r.some(I=>cp(I,y))||v.push(y)}),m.forEach(y=>y.el.remove()),r.filter(y=>!m.includes(y)).concat(v)};Hc=new WeakSet;fp=function(n){let r=this.shadowRoot.querySelector("ul slot");n.forEach(o=>{var m;let v=o.el,y=!0,I=(m=o.kind)!=null?m:"subs";if(!v){v=ae.createElement("media-chrome-listitem"),y=!1,v.part.add("listitem"),v.value=Nu(o);let M=ae.createElement("span");M.textContent=o.label,v.append(M),I==="captions"&&v.append(wi(this,qi).cloneNode(!0))}o.selected?v.setAttribute("aria-selected","true"):v.setAttribute("aria-selected","false"),y||(r.append(v),o.el=v)})};js=new WeakSet;ad=function(){let n=this.shadowRoot.querySelector("ul slot");n.contains(wi(this,Br))||n.append(wi(this,Br)),this.hasAttribute(F.MEDIA_SUBTITLES_SHOWING)?(wi(this,Br).setAttribute("aria-selected","false"),wi(this,Br).setAttribute("tabindex","-1")):(wi(this,Br).setAttribute("aria-selected","true"),wi(this,Br).setAttribute("tabindex","0")),Ya(this,Hc,fp).call(this,wi(this,Kn))};nd=new WeakSet;Fc=function(){var n;let r=(n=this.selectedOptions[0])==null?void 0:n.value;if(Mr(this,!1),!r)return;let o=new q.CustomEvent(Ie.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(o)};q.customElements.get("media-captions-listbox")||q.customElements.define("media-captions-listbox",Uc);var Gc=class extends dp{constructor(){super()}init(){let r=ae.createElement("media-captions-button");r.part.add("button"),r.preventClick=!0;let o=ae.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(r),v.append(o)}};q.customElements.get("media-captions-selectmenu")||q.customElements.define("media-captions-selectmenu",Gc);var od=Df(vp(),1),kp=Df(Ep(),1),Ay=kp.default,Li=Ay,zs=class extends Error{constructor(n,r=zs.MEDIA_ERR_CUSTOM,o,m){var v;super(n),this.name="MediaError",this.code=r,this.context=m,this.fatal=o!=null?o:r>=zs.MEDIA_ERR_NETWORK&&r<=zs.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(v=zs.defaultMessages[this.code])!=null?v:"")}},Tt=zs;Tt.MEDIA_ERR_ABORTED=1,Tt.MEDIA_ERR_NETWORK=2,Tt.MEDIA_ERR_DECODE=3,Tt.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Tt.MEDIA_ERR_ENCRYPTED=5,Tt.MEDIA_ERR_CUSTOM=100,Tt.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 Sy=n=>n==null,wp=(n,r)=>Sy(r)?!1:n in r,qc={ANY:"any",MUTED:"muted"},gt={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Yi={MSE:"mse",NATIVE:"native"},Yc={HEADER:"header",QUERY:"query",NONE:"none"},Wn=Object.values(Yc),la={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},$c={HLS:la.M3U8},MS=Object.keys($c),xS=[...Object.values(la),"hls","HLS"],vr=(n,r,o,m,v=n)=>{v.addEventListener(r,o,m),n.addEventListener("teardown",()=>{v.removeEventListener(r,o)},{once:!0})};function ky(n,r,o){r&&o>r&&(o=r);for(let m=0;m<n.length;m++)if(n.start(m)<=o&&n.end(m)>=o)return!0;return!1}var wy=n=>{let r=n.indexOf("?");if(r<0)return[n];let o=n.slice(0,r),m=n.slice(r);return[o,m]},ld=n=>{let r=n.type;if(r){let m=r.toUpperCase();return wp(m,$c)?$c[m]:r}let{src:o}=n;return o?Ly(o):""},Lp=n=>n==="VOD"?gt.ON_DEMAND:gt.LIVE,Ip=n=>n==="EVENT"?Number.POSITIVE_INFINITY:n==="VOD"?Number.NaN:0,Ly=n=>{let r="";try{r=new URL(n).pathname}catch{console.error("invalid url")}let o=r.lastIndexOf(".");if(o<0)return"";let m=r.slice(o+1).toUpperCase();return wp(m,la)?la[m]:""},Iy=Object.values(qc),yp=n=>typeof n=="boolean"||typeof n=="string"&&Iy.includes(n),Ry=({autoplay:n},r,o)=>{let m=!1,v=!1,y=yp(n)?n:!!n,I=()=>{m||vr(r,"playing",()=>{m=!0},{once:!0})};if(I(),vr(r,"loadstart",()=>{m=!1,I(),Wc(r,y)},{once:!0}),vr(r,"loadstart",()=>{o||(v=!Number.isFinite(r.duration)),Wc(r,y)},{once:!0}),o&&o.once(Li.Events.LEVEL_LOADED,(M,U)=>{var H;v=(H=U.details.live)!=null?H:!1}),!y){let M=()=>{!v||(o!=null&&o.liveSyncPosition?r.currentTime=o.liveSyncPosition:Number.isFinite(r.seekable.end(0))&&(r.currentTime=r.seekable.end(0)))};o&&vr(r,"play",()=>{r.preload==="metadata"?o.once(Li.Events.LEVEL_UPDATED,M):M()},{once:!0})}return M=>{m||(y=yp(M)?M:!!M,Wc(r,y))}},Wc=(n,r)=>{if(!r)return;let o=n.muted,m=()=>n.muted=o;switch(r){case qc.ANY:n.play().catch(()=>{n.muted=!0,n.play().catch(m)});break;case qc.MUTED:n.muted=!0,n.play().catch(m);break;default:n.play().catch(()=>{});break}},Dy=({preload:n,src:r},o,m)=>{let v=J=>{J!=null&&["","none","metadata","auto"].includes(J)?o.setAttribute("preload",J):o.removeAttribute("preload")};if(!m)return v(n),v;let y=!1,I=!1,M=m.config.maxBufferLength,U=m.config.maxBufferSize,H=J=>{v(J);let ee=J!=null?J:o.preload;I||ee==="none"||(ee==="metadata"?(m.config.maxBufferLength=1,m.config.maxBufferSize=1):(m.config.maxBufferLength=M,m.config.maxBufferSize=U),z())},z=()=>{!y&&r&&(y=!0,m.loadSource(r))};return vr(o,"play",()=>{I=!0,m.config.maxBufferLength=M,m.config.maxBufferSize=U,z()},{once:!0}),H(n),H};function Cy(n,r){r.on(Li.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(v,{tracks:y})=>{y.forEach(I=>{var M;let U=(M=I.subtitleTrack)!=null?M:I.closedCaptions,H=r.subtitleTracks.findIndex(({lang:z,name:J,type:ee})=>z==(U==null?void 0:U.lang)&&J===I.label&&ee.toLowerCase()===I.kind);dd(n,I.kind,I.label,U==null?void 0:U.lang,`${I.kind}${H}`)})});let o=()=>{var v;if(!r.subtitleTracks.length)return;let y=Array.from(n.textTracks).find(M=>M.id&&M.mode==="showing"&&["subtitles","captions"].includes(M.kind)),I=`${(v=r.subtitleTracks[r.subtitleTrack])==null?void 0:v.type.toLowerCase()}${r.subtitleTrack}`;if(y&&(r.subtitleTrack<0||(y==null?void 0:y.id)!==I)){let M=r.subtitleTracks.findIndex(({lang:U,name:H,type:z})=>U==y.language&&H===y.label&&z.toLowerCase()===y.kind);r.subtitleTrack=M}y&&(y==null?void 0:y.id)===I&&y.cues&&Array.from(y.cues).forEach(M=>{y.addCue(M)})};n.textTracks.addEventListener("change",o),r.on(Li.Events.CUES_PARSED,(v,{track:y,cues:I})=>{let M=n.textTracks.getTrackById(y);if(!M)return;let U=M.mode==="disabled";U&&(M.mode="hidden"),I.forEach(H=>{var z;(z=M.cues)!=null&&z.getCueById(H.id)||M.addCue(H)}),U&&(M.mode="disabled")}),r.once(Li.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 y,I;if(!["subtitles","caption"].includes(v.kind)&&v.label==="thumbnails"){if(!((y=v.cues)!=null&&y.length)){let M=n.querySelector('track[label="thumbnails"]'),U=(I=M==null?void 0:M.getAttribute("src"))!=null?I:"";M==null||M.removeAttribute("src"),setTimeout(()=>{M==null||M.setAttribute("src",U)},0)}v.mode!=="hidden"&&(v.mode="hidden")}})};r.once(Li.Events.MANIFEST_LOADED,m),r.once(Li.Events.MEDIA_ATTACHED,m)}function dd(n,r,o,m,v){let y=document.createElement("track");return y.kind=r,y.label=o,m&&(y.srclang=m),v&&(y.id=v),y.track.mode=["subtitles","captions"].includes(r)?"disabled":"hidden",y.setAttribute("data-removeondestroy",""),n.append(y),y.track}function Rp(n,r){let o=Array.prototype.find.call(n.querySelectorAll("track"),m=>m.track===r);o==null||o.remove()}var Qs="cuepoints",zc=Object.freeze({label:Qs}),Qc=(n,{label:r=Qs}=zc)=>{var o;return(o=Array.from(n.querySelectorAll("track")).find(m=>m.track.label===r&&m.track.kind==="metadata"))==null?void 0:o.track};async function Xc(n,r,o=zc){let m=Qc(n,o);if(!m){let{label:v=Qs}=o;m=dd(n,"metadata",v),m.mode="hidden",await new Promise(y=>setTimeout(()=>y(void 0),0))}return m.mode!=="hidden"&&(m.mode="hidden"),[...r].sort(({time:v},{time:y})=>y-v).forEach(({time:v,value:y})=>{var I,M;let U=Array.prototype.findIndex.call(m==null?void 0:m.cues,le=>le.startTime>=v),H=(I=m==null?void 0:m.cues)==null?void 0:I[U],z=H?H.startTime:Number.isFinite(n.duration)?n.duration:Number.MAX_SAFE_INTEGER,J=(M=m==null?void 0:m.cues)==null?void 0:M[U-1];J&&(J.endTime=v);let ee=new VTTCue(v,z,JSON.stringify(y!=null?y:null));m.addCue(ee)}),m}var Dp=n=>({time:n.startTime,value:JSON.parse(n.text)});function Cp(n,r={label:Qs}){let o=Qc(n,r);return o!=null&&o.cues?Array.from(o.cues,m=>Dp(m)):[]}function Zc(n,r={label:Qs}){var o,m;let v=Qc(n,r);if(!((o=v==null?void 0:v.activeCues)!=null&&o.length))return;let{currentTime:y}=n,I=Array.prototype.find.call((m=v.activeCues)!=null?m:[],({startTime:M,endTime:U})=>M<=y&&U>y);return Dp(I)}async function My(n,r=zc){return new Promise(o=>{vr(n,"loadstart",async()=>{let m=await Xc(n,[],r);vr(n,"cuechange",()=>{let v=Zc(n);if(v){let y=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:v});n.dispatchEvent(y)}},{},m),o(m)})})}function Mp(n,r){if(r){let o=r.playingDate;if(o!=null)return new Date(o.getTime()-n.currentTime*1e3)}return typeof n.getStartDate=="function"?n.getStartDate():new Date(NaN)}function xp(n,r){if(r&&r.playingDate)return r.playingDate;if(typeof n.getStartDate=="function"){let o=n.getStartDate();return new Date(o.getTime()+n.currentTime*1e3)}return new Date(NaN)}var xy=async n=>fetch(n).then(r=>r.text()).then(r=>{let o=r.split(`
|
|
913
|
+
`).find((m,v,y)=>v&&y[v-1].startsWith("#EXT-X-STREAM-INF"));return fetch(o).then(m=>m.text()).then(m=>m.split(`
|
|
914
|
+
`))}),Py=n=>{var r,o;let m=(o=((r=n.find(M=>M.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?r:"").split(":")[1])==null?void 0:o.trim(),v=Lp(m),y=Ip(m),I;if(v===gt.LIVE){let M=n.find(U=>U.startsWith("#EXT-X-PART-INF"));M?I=+M.split(":")[1].split("=")[1]*2:I=+n.find(U=>U.startsWith("#EXT-X-TARGETDURATION")).split(":")[1]*3}return{streamType:v,targetLiveWindow:y,liveEdgeStartOffset:I}},Oy=async(n,r)=>{if(r===la.MP4)return{streamType:gt.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0};if(r===la.M3U8){let o=await xy(n);return Py(o)}return console.error(`Media type ${r} is an unrecognized or unsupported type for src ${n}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0}},bp=async(n,r,o=ld({src:n}))=>{var m,v,y;let{streamType:I,targetLiveWindow:M,liveEdgeStartOffset:U}=await Oy(n,o);((m=ii.get(r))!=null?m:{}).liveEdgeStartOffset=U,((v=ii.get(r))!=null?v:{}).targetLiveWindow=M,r.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((y=ii.get(r))!=null?y:{}).streamType=I,r.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},Ny=n=>{var r;let o=n.type,m=Lp(o),v=Ip(o),y,I=!!((r=n.partList)!=null&&r.length);return m===gt.LIVE&&(y=I?n.partTarget*2:n.targetduration*3),{streamType:m,targetLiveWindow:v,liveEdgeStartOffset:y,lowLatency:I}},Fy=(n,r,o)=>{var m,v,y,I,M,U,H,z;let{streamType:J,targetLiveWindow:ee,liveEdgeStartOffset:le,lowLatency:me}=Ny(n);if(J===gt.LIVE){me?(o.config.backBufferLength=(m=o.userConfig.backBufferLength)!=null?m:4,o.config.maxFragLookUpTolerance=(v=o.userConfig.maxFragLookUpTolerance)!=null?v:.001,o.config.abrBandWidthUpFactor=(y=o.userConfig.abrBandWidthUpFactor)!=null?y:o.config.abrBandWidthFactor):o.config.backBufferLength=(I=o.userConfig.backBufferLength)!=null?I:8;let _e=Object.freeze({get length(){return r.seekable.length},start(ge){return r.seekable.start(ge)},end(ge){var ye;return ge>this.length?r.seekable.end(ge):(ye=o.liveSyncPosition)!=null?ye:r.seekable.end(ge)}});((M=ii.get(r))!=null?M:{}).seekable=_e}((U=ii.get(r))!=null?U:{}).liveEdgeStartOffset=le,((H=ii.get(r))!=null?H:{}).targetLiveWindow=ee,r.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((z=ii.get(r))!=null?z:{}).streamType=J,r.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},_p,Tp,Uy=(Tp=(_p=globalThis==null?void 0:globalThis.navigator)==null?void 0:_p.userAgent)!=null?Tp:"",By=Uy.toLowerCase().indexOf("android")!==-1,ii=new WeakMap,Pp="mux.com",Ap,Sp,Op=(Sp=(Ap=Li).isSupported)==null?void 0:Sp.call(Ap),Hy=By,Np=()=>od.default.utils.now(),Gy=od.default.utils.generateUUID,Fp=(n,{domain:r=Pp,maxResolution:o=""}={})=>{if(!n)return;let[m,v=""]=wy(n),y=new URL(`https://stream.${r}/${m}.m3u8${v}`);return o&&y.searchParams.set("max_resolution",o),y.toString()},Vy=n=>{if(!n)return;let[r]=n.split("?");return r||void 0},Ky=n=>{if(!n||!n.startsWith("https://stream."))return;let[r]=new URL(n).pathname.slice(1).split(".m3u8");return r||void 0},Wy=n=>{var r,o,m;return(r=n==null?void 0:n.metadata)!=null&&r.video_id?n.metadata.video_id:qp(n)&&(m=(o=Vy(n.playbackId))!=null?o:Ky(n.src))!=null?m:n.src},Up=n=>{var r;return(r=ii.get(n))==null?void 0:r.error},Bp=n=>{var r,o;return(o=(r=ii.get(n))==null?void 0:r.streamType)!=null?o:gt.UNKNOWN},Hp=n=>{var r,o;return(o=(r=ii.get(n))==null?void 0:r.targetLiveWindow)!=null?o:Number.NaN},Jc=n=>{var r,o;return(o=(r=ii.get(n))==null?void 0:r.seekable)!=null?o:n.seekable},Gp=n=>{var r;let o=(r=ii.get(n))==null?void 0:r.liveEdgeStartOffset;if(typeof o!="number")return Number.NaN;let m=Jc(n);return m.length?m.end(m.length-1)-o:Number.NaN},qy=(n,r,o=.001)=>Math.abs(n-r)<=o,Vp=(n,r,o=.001)=>n>r||qy(n,r,o),Yy=n=>n.paused&&Vp(n.currentTime,n.duration),eh=(n,r)=>r?n.ended:n.ended||Yy(n),Kp=(n,r,o)=>{th(r,o);let{metadata:m={}}=n,{view_session_id:v=Gy()}=m,y=Wy(n);m.view_session_id=v,m.video_id=y,n.metadata=m,ii.set(r,{});let I=$y(n,r);zy(n,r,I),Qy(n,r,I),My(r);let M=Ry(n,r,I),U=Dy(n,r,I);return{engine:I,setAutoplay:M,setPreload:U}},th=(n,r)=>{let o=r==null?void 0:r.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",$p),n.removeEventListener("error",jc),n.removeEventListener("durationchange",Yp),ii.delete(n),n.dispatchEvent(new Event("teardown")))};function Wp(n,r){var o;let m=ld(n);if(m!==la.M3U8)return!0;let v=!m||((o=r.canPlayType(m))!=null?o:!0),{preferPlayback:y}=n,I=y===Yi.MSE,M=y===Yi.NATIVE;return v&&(M||!(Op&&(I||Hy)))}var $y=(n,r)=>{let{debug:o,streamType:m,startTime:v=-1,metadata:y,preferCmcd:I}=n,M=ld(n)===la.M3U8,U=Wp(n,r);if(M&&!U&&Op){let H={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},z=jy(m),J=I!==Yc.NONE?{useHeaders:I===Yc.HEADER,sessionId:y==null?void 0:y.view_session_id,contentId:y==null?void 0:y.video_id}:void 0;return new Li({debug:o,startPosition:v,cmcd:J,...H,...z})}},jy=n=>n===gt.LIVE?{backBufferLength:8}:{},qp=({playbackId:n,src:r,customDomain:o})=>{if(n)return!0;if(typeof r!="string")return!1;let m=window==null?void 0:window.location.href,v=new URL(r,m).hostname.toLocaleLowerCase();return v.includes(Pp)||!!o&&v.includes(o.toLocaleLowerCase())},zy=(n,r,o)=>{var m;let{envKey:v}=n,y=qp(n);if(v||y){let{playerInitTime:I,playerSoftwareName:M,playerSoftwareVersion:U,beaconCollectionDomain:H,debug:z,disableCookies:J}=n,ee={...n.metadata,video_title:((m=n==null?void 0:n.metadata)==null?void 0:m.video_title)||void 0},le=me=>typeof me.player_error_code=="string"?!1:typeof n.errorTranslator=="function"?n.errorTranslator(me):me;od.default.monitor(r,{debug:z,beaconCollectionDomain:H,hlsjs:o,Hls:o?Li:void 0,automaticErrorTracking:!1,errorTranslator:le,disableCookies:J,data:{...v?{env_key:v}:{},player_software_name:M,player_software:M,player_software_version:U,player_init_time:I,...ee}})}},Qy=(n,r,o)=>{var m;let v=Wp(n,r),{src:y}=n;if(r&&v){let I=ld(n);typeof y=="string"?(r.preload==="none"?vr(r,"loadstart",()=>bp(y,r,I)):bp(y,r,I),r.setAttribute("src",y),n.startTime&&(((m=ii.get(r))!=null?m:{}).startTime=n.startTime,r.addEventListener("durationchange",Yp,{once:!0}))):r.removeAttribute("src"),r.addEventListener("error",$p),r.addEventListener("error",jc),r.addEventListener("emptied",()=>{r.querySelectorAll("track[data-removeondestroy]").forEach(M=>{M.remove()})},{once:!0}),vr(r,"pause",()=>{!eh(r)||r.ended||r.dispatchEvent(new Event("ended"))}),vr(r,"play",()=>{r.ended||!Vp(r.currentTime,r.duration)||(r.currentTime=r.seekable.start(0))})}else o&&y?(o.once(Li.Events.LEVEL_LOADED,(I,M)=>{Fy(M.details,r,o)}),o.on(Li.Events.ERROR,(I,M)=>{let U={[Li.ErrorTypes.NETWORK_ERROR]:Tt.MEDIA_ERR_NETWORK,[Li.ErrorTypes.MEDIA_ERROR]:Tt.MEDIA_ERR_DECODE},H=new Tt("",U[M.type]);H.fatal=M.fatal,H.data=M,r.dispatchEvent(new CustomEvent("error",{detail:H}))}),r.addEventListener("error",jc),Cy(r,o),o.attachMedia(r)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function Yp(n){var r;let o=n.target,m=(r=ii.get(o))==null?void 0:r.startTime;if(!!m&&ky(o.seekable,o.duration,m)){let v=o.preload==="auto";v&&(o.preload="none"),o.currentTime=m,v&&(o.preload="auto")}}async function $p(n){if(!n.isTrusted)return;n.stopImmediatePropagation();let r=n.target;if(!(r!=null&&r.error))return;let{message:o,code:m}=r.error,v=new Tt(o,m);if(r.src&&(m!==Tt.MEDIA_ERR_DECODE||m!==void 0))try{let{status:y}=await fetch(r.src);v.data={response:{code:y}}}catch{}r.dispatchEvent(new CustomEvent("error",{detail:v}))}function jc(n){var r,o;if(!(n instanceof CustomEvent)||!(n.detail instanceof Tt))return;let m=n.target,v=n.detail;!v||!v.fatal||(((r=ii.get(m))!=null?r:{}).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 Xy=Object.defineProperty,Zy=(n,r,o)=>r in n?Xy(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o,qn=(n,r,o)=>(Zy(n,typeof r!="symbol"?r+"":r,o),o),lh=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},pe=(n,r,o)=>(lh(n,r,"read from private field"),o?o.call(n):r.get(n)),Ye=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},ft=(n,r,o,m)=>(lh(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),kt=(n,r,o)=>(lh(n,r,"access private method"),o),gd=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class n extends gd{}globalThis.DocumentFragment=n}var dh=class extends gd{},Jy=class extends gd{},e0={get(n){},define(n,r,o){},upgrade(n){},whenDefined(n){return Promise.resolve(dh)}},ud,t0=class{constructor(n,r={}){Ye(this,ud,void 0),ft(this,ud,r==null?void 0:r.detail)}get detail(){return pe(this,ud)}initCustomEvent(){}};ud=new WeakMap;function i0(n,r){return new dh}var Xp={document:{createElement:i0},DocumentFragment,customElements:e0,CustomEvent:t0,EventTarget:gd,HTMLElement:dh,HTMLVideoElement:Jy},Zp=typeof window=="undefined"||typeof globalThis.customElements=="undefined",cd=Zp?Xp:globalThis,NS=Zp?Xp.document:globalThis.document,r0=()=>{try{return"0.15.4"}catch{}return"UNKNOWN"},a0=r0(),n0=()=>a0,jp=n=>{var r,o,m,v,y,I,M,U,H,z,J,ee,le,me,_e,ge,ye,Ee,ue,Be,Ge,re,k,se,W,Se,Xe,at,jt,it,B,ui,zt,nt,ri,$e,Gt,Et,Ct,tr;return r=class extends n{constructor(){super(),Ye(this,Xe),Ye(this,jt),Ye(this,B),Ye(this,zt),Ye(this,ri),Ye(this,Gt),Ye(this,Ct),qn(this,"castEnabled",!1),Ye(this,Ge,{paused:!1}),Ye(this,re,void 0),Ye(this,k,{}),Ye(this,se,void 0),Ye(this,W,void 0),Ye(this,Se,void 0),r.instances.add(this),kt(this,ri,$e).call(this)}static get castElement(){return pe(r,o)}static get castEnabled(){return pe(r,m)}static get castState(){var te;return(te=pe(r,H,z))==null?void 0:te.getCastState()}static async exitCast(){try{await pe(r,H,z).endCurrentSession(!0)}catch(te){console.error(te);return}}get castPlayer(){if(r.castElement===this)return pe(this,re)}attributeChangedCallback(te){if(this.castPlayer)switch(te){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(te={}){var ke;kt(ke=r,ue,Be).call(ke,te),ft(r,o,this),Object.entries(pe(this,k)).forEach(([st,wt])=>{pe(this,re).controller.addEventListener(st,wt)});try{await pe(r,H,z).requestSession()}catch{ft(r,o,void 0);return}pe(this,Ge).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(st){console.error(st)}}async load(){var te,ke;if(!this.castPlayer)return super.load();let st=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),wt=[...this.querySelectorAll("track")].filter(({kind:Ze,src:vi})=>vi&&(Ze==="subtitles"||Ze==="captions")),Rt=[],ci=0;wt.length&&(st.tracks=wt.map(Ze=>{let vi=++ci;Rt.length===0&&Ze.track.mode==="showing"&&Rt.push(vi);let gi=new chrome.cast.media.Track(vi,chrome.cast.media.TrackType.TEXT);return gi.trackContentId=Ze.src,gi.trackContentType="text/vtt",gi.subtype=Ze.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,gi.name=Ze.label,gi.language=Ze.srclang,gi})),this.castStreamType==="live"?st.streamType=chrome.cast.media.StreamType.LIVE:st.streamType=chrome.cast.media.StreamType.BUFFERED,st.metadata=new chrome.cast.media.GenericMediaMetadata,st.metadata.title=this.title,st.metadata.images=[{url:this.poster}];let $i=new chrome.cast.media.LoadRequest(st);$i.currentTime=(te=super.currentTime)!=null?te:0,$i.autoplay=!pe(this,Ge).paused,$i.activeTrackIds=Rt,await((ke=pe(r,J,ee))==null?void 0:ke.loadMedia($i)),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,ke,st;return(st=(ke=this.getAttribute("cast-src"))!=null?ke:(te=this.querySelector("source"))==null?void 0:te.src)!=null?st: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,ke;return(ke=(te=this.getAttribute("cast-stream-type"))!=null?te:this.streamType)!=null?ke: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 ke;if(this.castPlayer){(te&&!this.castPlayer.isMuted||!te&&this.castPlayer.isMuted)&&((ke=this.castPlayer.controller)==null||ke.muteOrUnmute());return}super.muted=te}get volume(){var te,ke;return this.castPlayer?(ke=(te=this.castPlayer)==null?void 0:te.volumeLevel)!=null?ke:1:super.volume}set volume(te){var ke;if(this.castPlayer){this.castPlayer.volumeLevel=te,(ke=this.castPlayer.controller)==null||ke.setVolumeLevel();return}super.volume=te}get duration(){var te,ke;return this.castPlayer&&pe(this,Xe,at)?(ke=(te=this.castPlayer)==null?void 0:te.duration)!=null?ke:NaN:super.duration}get currentTime(){var te,ke;return this.castPlayer&&pe(this,Xe,at)?(ke=(te=this.castPlayer)==null?void 0:te.currentTime)!=null?ke:0:super.currentTime}set currentTime(te){var ke;if(this.castPlayer){this.castPlayer.currentTime=te,(ke=this.castPlayer.controller)==null||ke.seek();return}super.currentTime=te}get onentercast(){return pe(this,se)}set onentercast(te){pe(this,se)&&(this.removeEventListener("entercast",pe(this,se)),ft(this,se,null)),typeof te=="function"&&(ft(this,se,te),this.addEventListener("entercast",te))}get onleavecast(){return pe(this,W)}set onleavecast(te){pe(this,W)&&(this.removeEventListener("leavecast",pe(this,W)),ft(this,W,null)),typeof te=="function"&&(ft(this,W,te),this.addEventListener("leavecast",te))}get oncastchange(){return pe(this,Se)}set oncastchange(te){pe(this,Se)&&(this.removeEventListener("castchange",pe(this,Se)),ft(this,Se,null)),typeof te=="function"&&(ft(this,Se,te),this.addEventListener("castchange",te))}},o=new WeakMap,m=new WeakMap,v=new WeakMap,y=new WeakSet,I=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},M=new WeakSet,U=function(){return typeof cast!="undefined"&&cast.framework},H=new WeakSet,z=function(){if(pe(r,M,U))return cast.framework.CastContext.getInstance()},J=new WeakSet,ee=function(){var te;return(te=pe(r,H,z))==null?void 0:te.getCurrentSession()},le=new WeakSet,me=function(){var te;return(te=pe(r,J,ee))==null?void 0:te.getSessionObj().media[0]},_e=new WeakSet,ge=function(te){return new Promise((ke,st)=>{pe(r,le,me).editTracksInfo(te,ke,st)})},ye=new WeakSet,Ee=function(te){return new Promise((ke,st)=>{pe(r,le,me).getStatus(te,ke,st)})},ue=new WeakSet,Be=function(te){return pe(r,H,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})},Ge=new WeakMap,re=new WeakMap,k=new WeakMap,se=new WeakMap,W=new WeakMap,Se=new WeakMap,Xe=new WeakSet,at=function(){var te;return(te=this.castPlayer)==null?void 0:te.isMediaLoaded},jt=new WeakSet,it=function(){pe(r,o)===this&&(Object.entries(pe(this,k)).forEach(([te,ke])=>{pe(this,re).controller.removeEventListener(te,ke)}),ft(r,o,void 0),this.muted=pe(this,re).isMuted,this.currentTime=pe(this,re).savedPlayerState.currentTime,pe(this,re).savedPlayerState.isPaused===!1&&this.play())},B=new WeakSet,ui=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:pe(r,H,z).getCastState()}))},zt=new WeakSet,nt=async function(){var te,ke;let{SESSION_RESUMED:st}=cast.framework.SessionState;if(pe(r,H,z).getSessionState()===st&&this.castSrc===((te=pe(r,le,me))==null?void 0:te.media.contentId)){ft(r,o,this),Object.entries(pe(this,k)).forEach(([wt,Rt])=>{pe(this,re).controller.addEventListener(wt,Rt)});try{await kt(ke=r,ye,Ee).call(ke,new chrome.cast.media.GetStatusRequest)}catch(wt){console.error(wt)}pe(this,k)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),pe(this,k)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},ri=new WeakSet,$e=function(){var te;!pe(r,M,U)||this.castEnabled||(this.castEnabled=!0,kt(te=r,ue,Be).call(te),this.textTracks.addEventListener("change",kt(this,Ct,tr).bind(this)),kt(this,B,ui).call(this),ft(this,re,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(pe(this,re)),ft(this,k,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:ke})=>{ke===!1&&kt(this,jt,it).call(this),this.dispatchEvent(new Event(ke?"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]:()=>{!pe(this,Xe,at)||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 ke,st;((ke=this.castPlayer)==null?void 0:ke.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"}[(st=this.castPlayer)==null?void 0:st.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!pe(this,Xe,at)||(await Promise.resolve(),kt(this,Gt,Et).call(this))}}))},Gt=new WeakSet,Et=function(){kt(this,Ct,tr).call(this)},Ct=new WeakSet,tr=async function(){var te,ke,st,wt,Rt,ci;if(!this.castPlayer)return;let $i=((ke=(te=pe(this,re).mediaInfo)==null?void 0:te.tracks)!=null?ke:[]).filter(({type:ct})=>ct===chrome.cast.media.TrackType.TEXT),Ze=[...this.textTracks].filter(({kind:ct})=>ct==="subtitles"||ct==="captions"),vi=$i.map(({language:ct,name:rr,trackId:Er})=>{var jr;let{mode:xi}=(jr=Ze.find(yr=>yr.language===ct&&yr.label===rr))!=null?jr:{};return xi?{mode:xi,trackId:Er}:!1}).filter(Boolean),gi=vi.filter(({mode:ct})=>ct!=="showing").map(({trackId:ct})=>ct),ji=vi.find(({mode:ct})=>ct==="showing"),ir=(Rt=(wt=(st=pe(r,J,ee))==null?void 0:st.getSessionObj().media[0])==null?void 0:wt.activeTrackIds)!=null?Rt:[],Ei=ir;if(ir.length&&(Ei=Ei.filter(ct=>!gi.includes(ct))),ji!=null&&ji.trackId&&(Ei=[...Ei,ji.trackId]),Ei=[...new Set(Ei)],!((ct,rr)=>ct.length===rr.length&&ct.every(Er=>rr.includes(Er)))(ir,Ei))try{let ct=new chrome.cast.media.EditTracksInfoRequest(Ei);await kt(ci=r,_e,ge).call(ci,ct)}catch(ct){console.error(ct)}},Ye(r,y),Ye(r,M),Ye(r,H),Ye(r,J),Ye(r,le),Ye(r,_e),Ye(r,ye),Ye(r,ue),qn(r,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),qn(r,"instances",new Set),Ye(r,o,void 0),Ye(r,m,!1),qn(r,"initCast",()=>{var te;pe(r,y,I)?pe(r,M,U)?pe(te=r,v).call(te,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var ke;return pe(ke=r,v).call(ke,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var ke;return pe(ke=r,v).call(ke,chrome.cast.isAvailable)})}}),Ye(r,v,te=>{if(te){ft(r,m,!0);let{CAST_STATE_CHANGED:ke}=cast.framework.CastContextEventType;pe(r,H,z).addEventListener(ke,wt=>{r.instances.forEach(Rt=>{var ci;return kt(ci=Rt,B,ui).call(ci,wt)})});let{SESSION_STATE_CHANGED:st}=cast.framework.CastContextEventType;pe(r,H,z).addEventListener(st,wt=>{r.instances.forEach(Rt=>{var ci;return kt(ci=Rt,zt,nt).call(ci,wt)})}),r.instances.forEach(wt=>{var Rt;return kt(Rt=wt,ri,$e).call(Rt)})}}),r},rh=globalThis.HTMLVideoElement?jp(HTMLVideoElement):jp(Object);globalThis.customElements&&!globalThis.customElements.get("castable-video")&&(customElements.define("castable-video",rh,{extends:"video"}),globalThis.CastableVideoElement=rh);rh.initCast();var Ed=["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","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],zp,ah=(zp=globalThis.document)==null?void 0:zp.createElement("template");ah&&(ah.innerHTML=`
|
|
911
915
|
<style>
|
|
912
916
|
:host {
|
|
913
917
|
display: inline-block;
|
|
@@ -922,7 +926,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
922
926
|
}
|
|
923
927
|
</style>
|
|
924
928
|
<slot></slot>
|
|
925
|
-
`);var
|
|
929
|
+
`);var Qp,nh=(Qp=globalThis.document)==null?void 0:Qp.createElement("template");nh&&(nh.innerHTML=`
|
|
926
930
|
<style>
|
|
927
931
|
:host {
|
|
928
932
|
display: inline-block;
|
|
@@ -944,8 +948,8 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
944
948
|
}
|
|
945
949
|
</style>
|
|
946
950
|
<slot></slot>
|
|
947
|
-
`);var uh=(n,{tag:r,is:l})=>{var m,v,y,I,M,B,H,z,J,ee,le,me,_e;let ge=(m=globalThis.document)==null?void 0:m.createElement(r,{is:l}),ye=ge?i0(ge):[];return v=class extends n{constructor(){super(),Ye(this,z),Ye(this,ee),Ye(this,me),Ye(this,B,void 0),Ye(this,H,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0)))}static get observedAttributes(){var Ee,de,Be;return kt(Ee=v,I,M).call(Ee),[...(Be=(de=ge==null?void 0:ge.constructor)==null?void 0:de.observedAttributes)!=null?Be:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var Ee,de;return(de=(Ee=pe(this,H))!=null?Ee:this.shadowRoot.querySelector(r))!=null?de:this.querySelector(r)}set nativeEl(Ee){ht(this,H,Ee)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(Ee){this.toggleAttribute("muted",Boolean(Ee))}get src(){return this.getAttribute("src")}set src(Ee){this.setAttribute("src",`${Ee}`)}get preload(){var Ee,de;return(de=this.getAttribute("preload"))!=null?de:(Ee=this.nativeEl)==null?void 0:Ee.preload}set preload(Ee){this.setAttribute("preload",`${Ee}`)}attributeChangedCallback(Ee,de,Be){kt(this,z,J).call(this),kt(this,me,_e).call(this,Ee,de,Be)}connectedCallback(){kt(this,z,J).call(this)}},y=new WeakMap,I=new WeakSet,M=function(){if(pe(this,y))return;ht(this,y,!0);let Ee=new Set(this.observedAttributes);Ee.delete("muted");for(let de of ye)if(!(de in this.prototype))if(typeof ge[de]=="function")this.prototype[de]=function(...Be){return kt(this,z,J).call(this),(()=>this.call?this.call(de,...Be):this.nativeEl[de].apply(this.nativeEl,Be))()};else{let Be={get(){var Ge,re,k;kt(this,z,J).call(this);let se=de.toLowerCase();if(Ee.has(se)){let W=this.getAttribute(se);return W===null?!1:W===""?!0:W}return(k=(Ge=this.get)==null?void 0:Ge.call(this,de))!=null?k:(re=this.nativeEl)==null?void 0:re[de]}};de!==de.toUpperCase()&&(Be.set=function(Ge){kt(this,z,J).call(this);let re=de.toLowerCase();if(Ee.has(re)){Ge===!0||Ge===!1||Ge==null?this.toggleAttribute(re,Boolean(Ge)):this.setAttribute(re,Ge);return}if(this.set){this.set(de,Ge);return}this.nativeEl[de]=Ge}),Object.defineProperty(this.prototype,de,Be)}},B=new WeakMap,H=new WeakMap,z=new WeakSet,J=function(){var Ee,de;if(pe(this,B))return;if(ht(this,B,!0),!this.nativeEl){let re=document.createElement(r,{is:l});re.part=r,this.shadowRoot.append(re)}this.nativeEl.muted=this.hasAttribute("muted");for(let re of ye)kt(this,ee,le).call(this,re);let Be=new Map,Ge=this.shadowRoot.querySelector("slot:not([name])");Ge==null||Ge.addEventListener("slotchange",()=>{let re=new Map(Be);Ge.assignedElements().filter(k=>["track","source"].includes(k.localName)).forEach(k=>{var se,W;re.delete(k);let Se=Be.get(k);Se||(Se=k.cloneNode(),Be.set(k,Se)),(W=(se=this.nativeEl).append)==null||W.call(se,Se)}),re.forEach(k=>k.remove())});for(let re of this.constructor.Events)(de=(Ee=this.shadowRoot).addEventListener)==null||de.call(Ee,re,k=>{k.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(k.type,{detail:k.detail}))},!0)},ee=new WeakSet,le=function(Ee){if(Object.prototype.hasOwnProperty.call(this,Ee)){let de=this[Ee];delete this[Ee],this[Ee]=de}},me=new WeakSet,_e=function(Ee,de,Be){var Ge,re,k,se;["id","class"].includes(Ee)||(Be===null?(re=(Ge=this.nativeEl).removeAttribute)==null||re.call(Ge,Ee):(se=(k=this.nativeEl).setAttribute)==null||se.call(k,Ee,Be))},Ye(v,I),qn(v,"Events",Eu),qn(v,"template",r.endsWith("audio")?rh:ah),Ye(v,y,void 0),v};function i0(n){let r=[];for(let l=Object.getPrototypeOf(n);l&&l!==HTMLElement.prototype;l=Object.getPrototypeOf(l))r.push(...Object.getOwnPropertyNames(l));return r}var PS=globalThis.document?uh(HTMLElement,{tag:"video"}):class{},OS=globalThis.document?uh(HTMLElement,{tag:"audio"}):class{};Eu.push("castchange","entercast","leavecast");var th=uh(cu.HTMLElement,{tag:"video",is:"castable-video"}),ne={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"},r0=Object.values(ne),a0=t0(),n0="mux-video",Br,Xs,hu,Zs,fu,mu,pu,vu,nh,sh=class extends th{constructor(){super(),Ye(this,vu),Ye(this,Br,void 0),Ye(this,Xs,void 0),Ye(this,hu,void 0),Ye(this,Zs,{}),Ye(this,fu,void 0),Ye(this,mu,void 0),Ye(this,pu,void 0),ht(this,hu,Op())}static get observedAttributes(){var n;return[...r0,...(n=th.observedAttributes)!=null?n:[]]}get preferCmcd(){var n;return(n=this.getAttribute(ne.PREFER_CMCD))!=null?n:void 0}set preferCmcd(n){n!==this.preferCmcd&&(n?Wn.includes(n)?this.setAttribute(ne.PREFER_CMCD,n):console.warn(`Invalid value for preferCmcd. Must be one of ${Wn.join()}`):this.removeAttribute(ne.PREFER_CMCD))}get playerInitTime(){return pe(this,hu)}get playerSoftwareName(){var n;return(n=pe(this,mu))!=null?n:n0}set playerSoftwareName(n){ht(this,mu,n)}get playerSoftwareVersion(){var n;return(n=pe(this,fu))!=null?n:a0}set playerSoftwareVersion(n){ht(this,fu,n)}get _hls(){var n;return(n=pe(this,Br))==null?void 0:n.engine}get mux(){return this.nativeEl.mux}get error(){var n;return(n=Fp(this.nativeEl))!=null?n:null}get errorTranslator(){return pe(this,pu)}set errorTranslator(n){ht(this,pu,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(ne.TYPE))!=null?n:void 0}set type(n){n!==this.type&&(n?this.setAttribute(ne.TYPE,n):this.removeAttribute(ne.TYPE))}get autoplay(){let n=this.getAttribute("autoplay");return n===null?!1:n===""?!0:n}set autoplay(n){let r=this.autoplay;n!==r&&(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(ne.DEBUG)!=null}set debug(n){n!==this.debug&&(n?this.setAttribute(ne.DEBUG,""):this.removeAttribute(ne.DEBUG))}get disableCookies(){return this.hasAttribute(ne.DISABLE_COOKIES)}set disableCookies(n){n!==this.disableCookies&&(n?this.setAttribute(ne.DISABLE_COOKIES,""):this.removeAttribute(ne.DISABLE_COOKIES))}get startTime(){let n=this.getAttribute(ne.START_TIME);if(n==null)return;let r=+n;return Number.isNaN(r)?void 0:r}set startTime(n){n!==this.startTime&&(n==null?this.removeAttribute(ne.START_TIME):this.setAttribute(ne.START_TIME,`${n}`))}get playbackId(){var n;return(n=this.getAttribute(ne.PLAYBACK_ID))!=null?n:void 0}set playbackId(n){n!==this.playbackId&&(n?this.setAttribute(ne.PLAYBACK_ID,n):this.removeAttribute(ne.PLAYBACK_ID))}get maxResolution(){var n;return(n=this.getAttribute(ne.MAX_RESOLUTION))!=null?n:void 0}set maxResolution(n){n!==this.maxResolution&&(n?this.setAttribute(ne.MAX_RESOLUTION,n):this.removeAttribute(ne.MAX_RESOLUTION))}get customDomain(){var n;return(n=this.getAttribute(ne.CUSTOM_DOMAIN))!=null?n:void 0}set customDomain(n){n!==this.customDomain&&(n?this.setAttribute(ne.CUSTOM_DOMAIN,n):this.removeAttribute(ne.CUSTOM_DOMAIN))}get envKey(){var n;return(n=this.getAttribute(ne.ENV_KEY))!=null?n:void 0}set envKey(n){n!==this.envKey&&(n?this.setAttribute(ne.ENV_KEY,n):this.removeAttribute(ne.ENV_KEY))}get beaconCollectionDomain(){var n;return(n=this.getAttribute(ne.BEACON_COLLECTION_DOMAIN))!=null?n:void 0}set beaconCollectionDomain(n){n!==this.beaconCollectionDomain&&(n?this.setAttribute(ne.BEACON_COLLECTION_DOMAIN,n):this.removeAttribute(ne.BEACON_COLLECTION_DOMAIN))}get streamType(){var n;return(n=this.getAttribute(ne.STREAM_TYPE))!=null?n:Up(this.nativeEl)}set streamType(n){n!==this.streamType&&(n?this.setAttribute(ne.STREAM_TYPE,n):this.removeAttribute(ne.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(ne.TARGET_LIVE_WINDOW)?+this.getAttribute(ne.TARGET_LIVE_WINDOW):Bp(this.nativeEl)}set targetLiveWindow(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ne.TARGET_LIVE_WINDOW):this.setAttribute(ne.TARGET_LIVE_WINDOW,`${+n}`))}get liveEdgeStart(){var n,r;if(this.hasAttribute(ne.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:l}=this,m=(n=this.nativeEl.seekable.end(0))!=null?n:0,v=(r=this.nativeEl.seekable.start(0))!=null?r:0;return Math.max(v,m-l)}return Hp(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(ne.LIVE_EDGE_OFFSET))return+this.getAttribute(ne.LIVE_EDGE_OFFSET)}set liveEdgeOffset(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ne.LIVE_EDGE_OFFSET):this.setAttribute(ne.LIVE_EDGE_OFFSET,`${+n}`))}get seekable(){return Jc(this.nativeEl)}async addCuePoints(n){return Xc(this.nativeEl,n)}get activeCuePoint(){return Zc(this.nativeEl)}get cuePoints(){return Dp(this.nativeEl)}getStartDate(){return Cp(this.nativeEl,this._hls)}get currentPdt(){return Mp(this.nativeEl,this._hls)}get preferPlayback(){let n=this.getAttribute(ne.PREFER_PLAYBACK);if(n===Yi.MSE||n===Yi.NATIVE)return n}set preferPlayback(n){n!==this.preferPlayback&&(n===Yi.MSE||n===Yi.NATIVE?this.setAttribute(ne.PREFER_PLAYBACK,n):this.removeAttribute(ne.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(n=>n.startsWith("metadata-")&&![ne.METADATA_URL].includes(n)).reduce((n,r)=>{let l=this.getAttribute(r);return l!=null&&(n[r.replace(/^metadata-/,"").replace(/-/g,"_")]=l),n},{}),...pe(this,Zs)}}set metadata(n){ht(this,Zs,n!=null?n:{}),this.mux&&this.mux.emit("hb",pe(this,Zs))}load(){ht(this,Br,Gp(this,this.nativeEl,pe(this,Br)))}unload(){eh(this.nativeEl,pe(this,Br)),ht(this,Br,void 0)}attributeChangedCallback(n,r,l){var m,v;switch(th.observedAttributes.includes(n)&&!["src","autoplay","preload"].includes(n)&&super.attributeChangedCallback(n,r,l),n){case ne.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=l!=null?l:void 0;break;case ne.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=l!=null?l:void 0;break;case"src":{let y=!!r,I=!!l;!y&&I?kt(this,vu,nh).call(this):y&&!I?this.unload():y&&I&&(this.unload(),kt(this,vu,nh).call(this));break}case"autoplay":if(l===r)break;(m=pe(this,Br))==null||m.setAutoplay(this.autoplay);break;case"preload":if(l===r)break;(v=pe(this,Br))==null||v.setPreload(l);break;case ne.PLAYBACK_ID:this.src=Np(l!=null?l:void 0,{maxResolution:this.maxResolution,domain:this.customDomain});break;case ne.DEBUG:{let y=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=y);break}case ne.METADATA_URL:l&&fetch(l).then(y=>y.json()).then(y=>this.metadata=y).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${l}!`));break;case ne.STREAM_TYPE:(l==null||l!==r)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case ne.TARGET_LIVE_WINDOW:(l==null||l!==r)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}disconnectedCallback(){this.unload()}};Br=new WeakMap,Xs=new WeakMap,hu=new WeakMap,Zs=new WeakMap,fu=new WeakMap,mu=new WeakMap,pu=new WeakMap,vu=new WeakSet,nh=async function(){pe(this,Xs)||(await ht(this,Xs,Promise.resolve()),ht(this,Xs,null),this.load())};cu.customElements.get("mux-video")||(cu.customElements.define("mux-video",sh),cu.MuxVideoElement=sh);var Xp=sh;var s0="en",$a={code:s0};var Zp="en";function Qe(n,r=!0){var v,y;let l=r&&(y=(v=$a)==null?void 0:v[n])!=null?y:n,m=r?$a.code:Zp;return new dh(l,m)}var dh=class{constructor(r,l=(m=>(m=$a.code)!=null?m:Zp)()){this.message=r,this.locale=l}format(r){return this.message.replace(/\{(\w+)\}/g,(l,m)=>{var v;return(v=r[m])!=null?v:""})}toString(){return this.message}};function Jp(n){let r="";return Object.entries(n).forEach(([l,m])=>{m!=null&&(r+=`${yu(l)}: ${m}; `)}),r?r.trim():void 0}function yu(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function bu(n){return n.replace(/[-_]([a-z])/g,(r,l)=>l.toUpperCase())}function Hr(n){if(n==null)return;let r=+n;return Number.isNaN(r)?void 0:r}function _u(n){let r=o0(n).toString();return r?"?"+r:""}function o0(n){let r={};for(let l in n)n[l]!=null&&(r[l]=n[l]);return new URLSearchParams(r)}function ua(n){let r=(n!=null?n:"").split(".")[1];if(!r)return{};let l=r.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 ch=(n,r)=>!n||!r?!1:n.contains(r)?!0:ch(n,r.getRootNode().host);var hh="mux.com",l0=()=>{try{return"1.11.1"}catch{}return"UNKNOWN"},u0=l0(),Au=()=>u0,fh=(n,{maxResolution:r,token:l,domain:m=hh}={})=>{let I=!!l?{token:l}:{redundant_streams:!0,...r?{max_resolution:r}:{}};return`https://stream.${m}/${n}.m3u8${_u(I)}`},ev=(n,{token:r,thumbnailTime:l,domain:m=hh}={})=>{let v=r==null?l:void 0,{aud:y}=ua(r);if(!(r&&y!=="t"))return`https://image.${m}/${n}/thumbnail.webp${_u({token:r,time:v})}`},tv=(n,{token:r,domain:l=hh}={})=>{let{aud:m}=ua(r);if(!(r&&m!=="s"))return`https://image.${l}/${n}/storyboard.vtt${_u({token:r,format:"webp"})}`},Js=n=>{if(!!n){if([vt.LIVE,vt.ON_DEMAND].includes(n))return n;if(n!=null&&n.includes("live"))return vt.LIVE}};var d0={crossorigin:"crossOrigin",playsinline:"playsInline"};function iv(n){var r;return(r=d0[n])!=null?r:bu(n)}var ja,za,mi,Tu=class{constructor(r,l){Bt(this,ja,void 0);Bt(this,za,void 0);Bt(this,mi,[]);Gi(this,ja,r),Gi(this,za,l)}[Symbol.iterator](){return ot(this,mi).values()}get length(){return ot(this,mi).length}get value(){var r;return(r=ot(this,mi).join(" "))!=null?r:""}set value(r){var l;r!==this.value&&(Gi(this,mi,[]),this.add(...(l=r==null?void 0:r.split(" "))!=null?l:[]))}toString(){return this.value}item(r){return ot(this,mi)[r]}values(){return ot(this,mi).values()}keys(){return ot(this,mi).keys()}forEach(r){ot(this,mi).forEach(r)}add(...r){var l,m;r.forEach(v=>{this.contains(v)||ot(this,mi).push(v)}),!(this.value===""&&!((l=ot(this,ja))!=null&&l.hasAttribute(`${ot(this,za)}`)))&&((m=ot(this,ja))==null||m.setAttribute(`${ot(this,za)}`,`${this.value}`))}remove(...r){var l;r.forEach(m=>{ot(this,mi).splice(ot(this,mi).indexOf(m),1)}),(l=ot(this,ja))==null||l.setAttribute(`${ot(this,za)}`,`${this.value}`)}contains(r){return ot(this,mi).includes(r)}toggle(r,l){return typeof l!="undefined"?l?(this.add(r),!0):(this.remove(r),!1):this.contains(r)?(this.remove(r),!1):(this.add(r),!0)}replace(r,l){this.remove(r),this.add(l)}};ja=new WeakMap,za=new WeakMap,mi=new WeakMap;var rv=`[mux-player ${Au()}]`;function da(...n){console.warn(rv,...n)}function Ji(...n){console.error(rv,...n)}function mh(n){var l;let r=(l=n.message)!=null?l:"";if(n.context&&(r+=` ${n.context}`),n.file){let m="https://github.com/muxinc/elements/blob/main/errors/";r+=` ${Qe("Read more: ")}
|
|
948
|
-
${m}${n.file}`}da(r)}var ui={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Qa={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},nv=Object.freeze({length:0,start(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),c0=Eu.filter(n=>n!=="error"),h0=Object.values(ui).filter(n=>![ui.PLAYSINLINE].includes(n)),f0=Object.values(Qa);function sv(n){n.querySelectorAll(":scope > track").forEach(r=>{var l;(l=n.media)==null||l.append(r.cloneNode())}),c0.forEach(r=>{var l;(l=n.media)==null||l.addEventListener(r,m=>{n.dispatchEvent(new Event(m.type))})})}var ph=class extends qt.HTMLElement{static get observedAttributes(){return[...h0,...f0]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(m=>{var v;(v=this.media)==null||v.append(m.cloneNode())});let r=m=>{for(let v of m)v.type==="childList"&&(v.removedNodes.forEach(y=>{var M,B;let I=(M=this.media)==null?void 0:M.querySelector(`track[src="${y.src}"]`);I&&((B=this.media)==null||B.removeChild(I))}),v.addedNodes.forEach(y=>{var I;(I=this.media)==null||I.append(y.cloneNode())}))};new MutationObserver(r).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(r,l,m){var v,y;switch(r){case Qa.MUTED:{this.media&&(this.media.muted=m!=null,this.media.defaultMuted=m!=null);return}case Qa.VOLUME:{let I=(v=Hr(m))!=null?v:1;this.media&&(this.media.volume=I);return}case Qa.PLAYBACKRATE:{let I=(y=Hr(m))!=null?y:1;this.media&&(this.media.playbackRate=I,this.media.defaultPlaybackRate=I);return}}}play(){var r,l;return(l=(r=this.media)==null?void 0:r.play())!=null?l:Promise.reject()}pause(){var r;(r=this.media)==null||r.pause()}requestCast(r){var l;return(l=this.media)==null?void 0:l.requestCast(r)}get media(){var r;return(r=this.shadowRoot)==null?void 0:r.querySelector("mux-video")}get paused(){var r,l;return(l=(r=this.media)==null?void 0:r.paused)!=null?l:!0}get duration(){var r,l;return(l=(r=this.media)==null?void 0:r.duration)!=null?l:NaN}get ended(){var r,l;return(l=(r=this.media)==null?void 0:r.ended)!=null?l:!1}get buffered(){var r,l;return(l=(r=this.media)==null?void 0:r.buffered)!=null?l:nv}get seekable(){var r,l;return(l=(r=this.media)==null?void 0:r.seekable)!=null?l:nv}get readyState(){var r,l;return(l=(r=this.media)==null?void 0:r.readyState)!=null?l:0}get videoWidth(){var r,l;return(l=(r=this.media)==null?void 0:r.videoWidth)!=null?l:0}get videoHeight(){var r,l;return(l=(r=this.media)==null?void 0:r.videoHeight)!=null?l:0}get currentTime(){var r,l;return(l=(r=this.media)==null?void 0:r.currentTime)!=null?l:0}set currentTime(r){this.media&&(this.media.currentTime=Number(r))}get volume(){var r,l;return(l=(r=this.media)==null?void 0:r.volume)!=null?l:1}set volume(r){this.media&&(this.media.volume=Number(r))}get playbackRate(){var r,l;return(l=(r=this.media)==null?void 0:r.playbackRate)!=null?l:1}set playbackRate(r){this.media&&(this.media.playbackRate=Number(r))}get defaultPlaybackRate(){var r;return(r=Hr(this.getAttribute(Qa.PLAYBACKRATE)))!=null?r:1}set defaultPlaybackRate(r){r!=null?this.setAttribute(Qa.PLAYBACKRATE,`${r}`):this.removeAttribute(Qa.PLAYBACKRATE)}get crossOrigin(){return eo(this,ui.CROSSORIGIN)}set crossOrigin(r){this.setAttribute(ui.CROSSORIGIN,`${r}`)}get autoplay(){return eo(this,ui.AUTOPLAY)!=null}set autoplay(r){r?this.setAttribute(ui.AUTOPLAY,typeof r=="string"?r:""):this.removeAttribute(ui.AUTOPLAY)}get loop(){return eo(this,ui.LOOP)!=null}set loop(r){r?this.setAttribute(ui.LOOP,""):this.removeAttribute(ui.LOOP)}get muted(){var r,l;return(l=(r=this.media)==null?void 0:r.muted)!=null?l:!1}set muted(r){this.media&&(this.media.muted=Boolean(r))}get defaultMuted(){return eo(this,ui.MUTED)!=null}set defaultMuted(r){r?this.setAttribute(ui.MUTED,""):this.removeAttribute(ui.MUTED)}get playsInline(){return eo(this,ui.PLAYSINLINE)!=null}set playsInline(r){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(r){["","none","metadata","auto"].includes(r)?this.setAttribute(ui.PRELOAD,r):this.removeAttribute(ui.PRELOAD)}};function eo(n,r){return n.media?n.media.getAttribute(r):n.getAttribute(r)}var vh=ph;var m0=Object.defineProperty,p0=(n,r,l)=>r in n?m0(n,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[r]=l,v0=(n,r,l)=>(p0(n,typeof r!="symbol"?r+"":r,l),l),cv=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},ze=(n,r,l)=>(cv(n,r,"read from private field"),l?l.call(n):r.get(n)),vr=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},Gr=(n,r,l,m)=>(cv(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),Yn,Su,Xa,to,ca,ha,fa,Za,$n,ku,er,ov=1,lv=0,g0=1,E0={processCallback(n,r,l){if(!!l){for(let[m,v]of r)if(m in l){let y=l[m];typeof y=="boolean"&&v instanceof pi&&typeof v.element[v.attributeName]=="boolean"?v.booleanValue=y:typeof y=="function"&&v instanceof pi?v.element[v.attributeName]=y:v.value=y}}}},Vr=class extends q.DocumentFragment{constructor(r,l,m=E0){var v;super(),vr(this,Yn,void 0),vr(this,Su,void 0),this.append(r.content.cloneNode(!0)),Gr(this,Yn,hv(this)),Gr(this,Su,m),(v=m.createCallback)==null||v.call(m,this,ze(this,Yn),l),m.processCallback(this,ze(this,Yn),l)}update(r){ze(this,Su).processCallback(this,ze(this,Yn),r)}};Yn=new WeakMap;Su=new WeakMap;var hv=(n,r=[])=>{let l,m;for(let v of n.attributes||[])if(v.value.includes("{{")){let y=new gh;for([l,m]of dv(v.value))if(!l)y.append(m);else{let I=new pi(n,v.name,v.namespaceURI);y.append(I),r.push([m,I])}v.value=y.toString()}for(let v of n.childNodes)if(v.nodeType===ov&&!(v instanceof HTMLTemplateElement))hv(v,r);else if(v.nodeType===ov||v.data.includes("{{")){let y=[];if(v.data)for([l,m]of dv(v.data))if(!l)y.push(new Text(m));else{let I=new Kr(n);y.push(I),r.push([m,I])}else if(v instanceof HTMLTemplateElement){let I=new io(n,v);y.push(I),r.push([I.expression,I])}v.replaceWith(...y.flatMap(I=>I.replacementNodes||[I]))}return r},uv={},dv=n=>{let r="",l=0,m=uv[n],v=0,y;if(m)return m;for(m=[];y=n[v];v++)y==="{"&&n[v+1]==="{"&&n[v-1]!=="\\"&&n[v+2]&&++l==1?(r&&m.push([lv,r]),r="",v++):y==="}"&&n[v+1]==="}"&&n[v-1]!=="\\"&&!--l?(m.push([g0,r.trim()]),r="",v++):r+=y||"";return r&&m.push([lv,(l>0?"{{":"")+r]),uv[n]=m},y0=11,wu=class{get value(){return""}set value(r){}toString(){return this.value}},fv=new WeakMap,gh=class{constructor(){vr(this,Xa,[])}[Symbol.iterator](){return ze(this,Xa).values()}get length(){return ze(this,Xa).length}item(r){return ze(this,Xa)[r]}append(...r){for(let l of r)l instanceof pi&&fv.set(l,this),ze(this,Xa).push(l)}toString(){return ze(this,Xa).join("")}};Xa=new WeakMap;var pi=class extends wu{constructor(r,l,m){super(),vr(this,Za),vr(this,to,""),vr(this,ca,void 0),vr(this,ha,void 0),vr(this,fa,void 0),Gr(this,ca,r),Gr(this,ha,l),Gr(this,fa,m)}get attributeName(){return ze(this,ha)}get attributeNamespace(){return ze(this,fa)}get element(){return ze(this,ca)}get value(){return ze(this,to)}set value(r){ze(this,to)!==r&&(Gr(this,to,r),!ze(this,Za,$n)||ze(this,Za,$n).length===1?r==null?ze(this,ca).removeAttributeNS(ze(this,fa),ze(this,ha)):ze(this,ca).setAttributeNS(ze(this,fa),ze(this,ha),r):ze(this,ca).setAttributeNS(ze(this,fa),ze(this,ha),ze(this,Za,$n)))}get booleanValue(){return ze(this,ca).hasAttributeNS(ze(this,fa),ze(this,ha))}set booleanValue(r){if(!ze(this,Za,$n)||ze(this,Za,$n).length===1)this.value=r?"":null;else throw new DOMException("Value is not fully templatized")}};to=new WeakMap;ca=new WeakMap;ha=new WeakMap;fa=new WeakMap;Za=new WeakSet;$n=function(){return fv.get(this)};var Kr=class extends wu{constructor(r,l){super(),vr(this,ku,void 0),vr(this,er,void 0),Gr(this,ku,r),Gr(this,er,l?[...l]:[new Text])}get replacementNodes(){return ze(this,er)}get parentNode(){return ze(this,ku)}get nextSibling(){return ze(this,er)[ze(this,er).length-1].nextSibling}get previousSibling(){return ze(this,er)[0].previousSibling}get value(){return ze(this,er).map(r=>r.textContent).join("")}set value(r){this.replace(r)}replace(...r){let l=r.flat().flatMap(m=>m==null?[new Text]:m.forEach?[...m]:m.nodeType===y0?[...m.childNodes]:m.nodeType?[m]:[new Text(m)]);l.length||l.push(new Text),Gr(this,er,b0(ze(this,er)[0].parentNode,ze(this,er),l,this.nextSibling))}};ku=new WeakMap;er=new WeakMap;var io=class extends Kr{constructor(r,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(r),v0(this,"directive"),this.expression=v,this.template=l,this.directive=m}};function b0(n,r,l,m=null){let v=0,y,I,M,B=l.length,H=r.length;for(;v<B&&v<H&&r[v]==l[v];)v++;for(;v<B&&v<H&&l[B-1]==r[H-1];)m=l[--H,--B];if(v==H)for(;v<B;)n.insertBefore(l[v++],m);if(v==B)for(;v<H;)n.removeChild(r[v++]);else{for(y=r[v];v<B;)M=l[v++],I=y?y.nextSibling:m,y==M?y=I:v<B&&l[v]==I?(n.replaceChild(M,y),y=I):n.insertBefore(M,y);for(;y!=m;)I=y.nextSibling,n.removeChild(y),y=I}return l}var mv={string:n=>String(n)},Iu=class{constructor(r){this.template=r,this.state=void 0}},Ja=new WeakMap,en=new WeakMap,Eh={partial:(n,r)=>{r[n.expression]=new Iu(n.template)},if:(n,r)=>{var l;if(vv(n.expression,r))if(Ja.get(n)!==n.template){Ja.set(n,n.template);let m=new Vr(n.template,r,Ru);n.replace(m),en.set(n,m)}else(l=en.get(n))==null||l.update(r);else n.replace(""),Ja.delete(n),en.delete(n)}},_0=Object.keys(Eh),Ru={processCallback(n,r,l){var m,v;if(!!l)for(let[y,I]of r){if(I instanceof io){if(!I.directive){let B=_0.find(H=>I.template.hasAttribute(H));B&&(I.directive=B,I.expression=I.template.getAttribute(B))}(m=Eh[I.directive])==null||m.call(Eh,I,l);continue}let M=vv(y,l);if(M instanceof Iu){Ja.get(I)!==M.template?(Ja.set(I,M.template),M=new Vr(M.template,M.state,Ru),I.value=M,en.set(I,M)):(v=en.get(I))==null||v.update(M.state);continue}M?(I instanceof pi&&I.attributeName.startsWith("aria-")&&(M=String(M)),I instanceof pi?typeof M=="boolean"?I.booleanValue=M:typeof M=="function"?I.element[I.attributeName]=M:I.value=M:(I.value=M,Ja.delete(I),en.delete(I))):I instanceof pi?I.value=void 0:(I.value=void 0,Ja.delete(I),en.delete(I))}}},pv={"!":n=>!n,"!!":n=>!!n,"==":(n,r)=>n==r,"!=":(n,r)=>n!=r,">":(n,r)=>n>r,">=":(n,r)=>n>=r,"<":(n,r)=>n<r,"<=":(n,r)=>n<=r,"??":(n,r)=>n!=null?n:r,"|":(n,r)=>{var l;return(l=mv[r])==null?void 0:l.call(mv,n)}};function T0(n){return A0(n,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:r})=>r!=="ws")}function vv(n,r={}){var l,m,v,y,I,M,B;let H=T0(n);if(H.length===0||H.some(({type:z})=>!z))return ro(n);if(((l=H[0])==null?void 0:l.token)===">"){let z=r[(m=H[1])==null?void 0:m.token];if(!z)return ro(n);let J={...r};z.state=J;let ee=H.slice(2);for(let le=0;le<ee.length;le+=3){let me=(v=ee[le])==null?void 0:v.token,_e=(y=ee[le+1])==null?void 0:y.token,ge=(I=ee[le+2])==null?void 0:I.token;me&&_e==="="&&(J[me]=ao(ge,r))}return z}if(H.length===1)return Lu(H[0])?ao(H[0].token,r):ro(n);if(H.length===2){let z=(M=H[0])==null?void 0:M.token,J=pv[z];if(!J||!Lu(H[1]))return ro(n);let ee=ao(H[1].token,r);return J(ee)}if(H.length===3){let z=(B=H[1])==null?void 0:B.token,J=pv[z];if(!J||!Lu(H[0])||!Lu(H[2]))return ro(n);let ee=ao(H[0].token,r);if(z==="|")return J(ee,H[2].token);let le=ao(H[2].token,r);return J(ee,le)}}function ro(n){return console.warn(`Warning: invalid expression \`${n}\``),!1}function Lu({type:n}){return["number","boolean","string","param"].includes(n)}function ao(n,r){let l=n[0],m=n.slice(-1);return n==="true"||n==="false"?n==="true":l===m&&["'",'"'].includes(l)?n.slice(1,-1):sl(n)?parseFloat(n):r[n]}function A0(n,r){let l,m,v,y=[];for(;n;){v=null,l=n.length;for(let I in r)m=r[I].exec(n),m&&m.index<l&&(v={token:m[0],type:I,matches:m.slice(1)},l=m.index);l&&y.push({token:n.substr(0,l),type:void 0}),v&&y.push(v),n=n.substr(l+(v?v.token.length:0))}return y}var S0=Object.defineProperty,k0=(n,r,l)=>r in n?S0(n,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[r]=l,so=(n,r,l)=>(k0(n,typeof r!="symbol"?r+"":r,l),l),Sh=(n,r,l)=>{if(!r.has(n))throw TypeError("Cannot "+l)},_h=(n,r,l)=>(Sh(n,r,"read from private field"),l?l.call(n):r.get(n)),no=(n,r,l)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,l)},tn=(n,r,l,m)=>(Sh(n,r,"write to private field"),m?m.call(n,l):r.set(n,l),l),yh=(n,r,l)=>(Sh(n,r,"access private method"),l),jn,Du,zn,Th,gv,Cu,Ah,bh={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},Ev=ae.createElement("template");Ev.innerHTML=`
|
|
951
|
+
`);var uh=(n,{tag:r,is:o})=>{var m,v,y,I,M,U,H,z,J,ee,le,me,_e;let ge=(m=globalThis.document)==null?void 0:m.createElement(r,{is:o}),ye=ge?s0(ge):[];return v=class extends n{constructor(){super(),Ye(this,z),Ye(this,ee),Ye(this,me),Ye(this,U,void 0),Ye(this,H,void 0),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0)))}static get observedAttributes(){var Ee,ue,Be;return kt(Ee=v,I,M).call(Ee),[...(Be=(ue=ge==null?void 0:ge.constructor)==null?void 0:ue.observedAttributes)!=null?Be:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var Ee,ue;return(ue=(Ee=pe(this,H))!=null?Ee:this.shadowRoot.querySelector(r))!=null?ue:this.querySelector(r)}set nativeEl(Ee){ft(this,H,Ee)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(Ee){this.toggleAttribute("muted",Boolean(Ee))}get src(){return this.getAttribute("src")}set src(Ee){this.setAttribute("src",`${Ee}`)}get preload(){var Ee,ue;return(ue=this.getAttribute("preload"))!=null?ue:(Ee=this.nativeEl)==null?void 0:Ee.preload}set preload(Ee){this.setAttribute("preload",`${Ee}`)}attributeChangedCallback(Ee,ue,Be){kt(this,z,J).call(this),kt(this,me,_e).call(this,Ee,ue,Be)}connectedCallback(){kt(this,z,J).call(this)}},y=new WeakMap,I=new WeakSet,M=function(){if(pe(this,y))return;ft(this,y,!0);let Ee=new Set(this.observedAttributes);Ee.delete("muted");for(let ue of ye)if(!(ue in this.prototype))if(typeof ge[ue]=="function")this.prototype[ue]=function(...Be){return kt(this,z,J).call(this),(()=>this.call?this.call(ue,...Be):this.nativeEl[ue].apply(this.nativeEl,Be))()};else{let Be={get(){var Ge,re,k;kt(this,z,J).call(this);let se=ue.toLowerCase();if(Ee.has(se)){let W=this.getAttribute(se);return W===null?!1:W===""?!0:W}return(k=(Ge=this.get)==null?void 0:Ge.call(this,ue))!=null?k:(re=this.nativeEl)==null?void 0:re[ue]}};ue!==ue.toUpperCase()&&(Be.set=function(Ge){kt(this,z,J).call(this);let re=ue.toLowerCase();if(Ee.has(re)){Ge===!0||Ge===!1||Ge==null?this.toggleAttribute(re,Boolean(Ge)):this.setAttribute(re,Ge);return}if(this.set){this.set(ue,Ge);return}this.nativeEl[ue]=Ge}),Object.defineProperty(this.prototype,ue,Be)}},U=new WeakMap,H=new WeakMap,z=new WeakSet,J=function(){var Ee,ue;if(pe(this,U))return;if(ft(this,U,!0),!this.nativeEl){let re=document.createElement(r,{is:o});re.part=r,this.shadowRoot.append(re)}this.nativeEl.muted=this.hasAttribute("muted");for(let re of ye)kt(this,ee,le).call(this,re);let Be=new Map,Ge=this.shadowRoot.querySelector("slot:not([name])");Ge==null||Ge.addEventListener("slotchange",()=>{let re=new Map(Be);Ge.assignedElements().filter(k=>["track","source"].includes(k.localName)).forEach(k=>{var se,W;re.delete(k);let Se=Be.get(k);Se||(Se=k.cloneNode(),Be.set(k,Se)),(W=(se=this.nativeEl).append)==null||W.call(se,Se)}),re.forEach(k=>k.remove())});for(let re of this.constructor.Events)(ue=(Ee=this.shadowRoot).addEventListener)==null||ue.call(Ee,re,k=>{k.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(k.type,{detail:k.detail}))},!0)},ee=new WeakSet,le=function(Ee){if(Object.prototype.hasOwnProperty.call(this,Ee)){let ue=this[Ee];delete this[Ee],this[Ee]=ue}},me=new WeakSet,_e=function(Ee,ue,Be){var Ge,re,k,se;["id","class"].includes(Ee)||(Be===null?(re=(Ge=this.nativeEl).removeAttribute)==null||re.call(Ge,Ee):(se=(k=this.nativeEl).setAttribute)==null||se.call(k,Ee,Be))},Ye(v,I),qn(v,"Events",Ed),qn(v,"template",r.endsWith("audio")?ah:nh),Ye(v,y,void 0),v};function s0(n){let r=[];for(let o=Object.getPrototypeOf(n);o&&o!==HTMLElement.prototype;o=Object.getPrototypeOf(o))r.push(...Object.getOwnPropertyNames(o));return r}var US=globalThis.document?uh(HTMLElement,{tag:"video"}):class{},BS=globalThis.document?uh(HTMLElement,{tag:"audio"}):class{};Ed.push("castchange","entercast","leavecast");var ih=uh(cd.HTMLElement,{tag:"video",is:"castable-video"}),ne={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"},o0=Object.values(ne),l0=n0(),d0="mux-video",Hr,Xs,hd,Zs,fd,md,pd,vd,sh,oh=class extends ih{constructor(){super(),Ye(this,vd),Ye(this,Hr,void 0),Ye(this,Xs,void 0),Ye(this,hd,void 0),Ye(this,Zs,{}),Ye(this,fd,void 0),Ye(this,md,void 0),Ye(this,pd,void 0),ft(this,hd,Np())}static get observedAttributes(){var n;return[...o0,...(n=ih.observedAttributes)!=null?n:[]]}get preferCmcd(){var n;return(n=this.getAttribute(ne.PREFER_CMCD))!=null?n:void 0}set preferCmcd(n){n!==this.preferCmcd&&(n?Wn.includes(n)?this.setAttribute(ne.PREFER_CMCD,n):console.warn(`Invalid value for preferCmcd. Must be one of ${Wn.join()}`):this.removeAttribute(ne.PREFER_CMCD))}get playerInitTime(){return pe(this,hd)}get playerSoftwareName(){var n;return(n=pe(this,md))!=null?n:d0}set playerSoftwareName(n){ft(this,md,n)}get playerSoftwareVersion(){var n;return(n=pe(this,fd))!=null?n:l0}set playerSoftwareVersion(n){ft(this,fd,n)}get _hls(){var n;return(n=pe(this,Hr))==null?void 0:n.engine}get mux(){return this.nativeEl.mux}get error(){var n;return(n=Up(this.nativeEl))!=null?n:null}get errorTranslator(){return pe(this,pd)}set errorTranslator(n){ft(this,pd,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(ne.TYPE))!=null?n:void 0}set type(n){n!==this.type&&(n?this.setAttribute(ne.TYPE,n):this.removeAttribute(ne.TYPE))}get autoplay(){let n=this.getAttribute("autoplay");return n===null?!1:n===""?!0:n}set autoplay(n){let r=this.autoplay;n!==r&&(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(ne.DEBUG)!=null}set debug(n){n!==this.debug&&(n?this.setAttribute(ne.DEBUG,""):this.removeAttribute(ne.DEBUG))}get disableCookies(){return this.hasAttribute(ne.DISABLE_COOKIES)}set disableCookies(n){n!==this.disableCookies&&(n?this.setAttribute(ne.DISABLE_COOKIES,""):this.removeAttribute(ne.DISABLE_COOKIES))}get startTime(){let n=this.getAttribute(ne.START_TIME);if(n==null)return;let r=+n;return Number.isNaN(r)?void 0:r}set startTime(n){n!==this.startTime&&(n==null?this.removeAttribute(ne.START_TIME):this.setAttribute(ne.START_TIME,`${n}`))}get playbackId(){var n;return(n=this.getAttribute(ne.PLAYBACK_ID))!=null?n:void 0}set playbackId(n){n!==this.playbackId&&(n?this.setAttribute(ne.PLAYBACK_ID,n):this.removeAttribute(ne.PLAYBACK_ID))}get maxResolution(){var n;return(n=this.getAttribute(ne.MAX_RESOLUTION))!=null?n:void 0}set maxResolution(n){n!==this.maxResolution&&(n?this.setAttribute(ne.MAX_RESOLUTION,n):this.removeAttribute(ne.MAX_RESOLUTION))}get customDomain(){var n;return(n=this.getAttribute(ne.CUSTOM_DOMAIN))!=null?n:void 0}set customDomain(n){n!==this.customDomain&&(n?this.setAttribute(ne.CUSTOM_DOMAIN,n):this.removeAttribute(ne.CUSTOM_DOMAIN))}get ended(){return eh(this.nativeEl,this._hls)}get envKey(){var n;return(n=this.getAttribute(ne.ENV_KEY))!=null?n:void 0}set envKey(n){n!==this.envKey&&(n?this.setAttribute(ne.ENV_KEY,n):this.removeAttribute(ne.ENV_KEY))}get beaconCollectionDomain(){var n;return(n=this.getAttribute(ne.BEACON_COLLECTION_DOMAIN))!=null?n:void 0}set beaconCollectionDomain(n){n!==this.beaconCollectionDomain&&(n?this.setAttribute(ne.BEACON_COLLECTION_DOMAIN,n):this.removeAttribute(ne.BEACON_COLLECTION_DOMAIN))}get streamType(){var n;return(n=this.getAttribute(ne.STREAM_TYPE))!=null?n:Bp(this.nativeEl)}set streamType(n){n!==this.streamType&&(n?this.setAttribute(ne.STREAM_TYPE,n):this.removeAttribute(ne.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(ne.TARGET_LIVE_WINDOW)?+this.getAttribute(ne.TARGET_LIVE_WINDOW):Hp(this.nativeEl)}set targetLiveWindow(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ne.TARGET_LIVE_WINDOW):this.setAttribute(ne.TARGET_LIVE_WINDOW,`${+n}`))}get liveEdgeStart(){var n,r;if(this.hasAttribute(ne.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:o}=this,m=(n=this.nativeEl.seekable.end(0))!=null?n:0,v=(r=this.nativeEl.seekable.start(0))!=null?r:0;return Math.max(v,m-o)}return Gp(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(ne.LIVE_EDGE_OFFSET))return+this.getAttribute(ne.LIVE_EDGE_OFFSET)}set liveEdgeOffset(n){n!=this.targetLiveWindow&&(n==null?this.removeAttribute(ne.LIVE_EDGE_OFFSET):this.setAttribute(ne.LIVE_EDGE_OFFSET,`${+n}`))}get seekable(){return Jc(this.nativeEl)}async addCuePoints(n){return Xc(this.nativeEl,n)}get activeCuePoint(){return Zc(this.nativeEl)}get cuePoints(){return Cp(this.nativeEl)}getStartDate(){return Mp(this.nativeEl,this._hls)}get currentPdt(){return xp(this.nativeEl,this._hls)}get preferPlayback(){let n=this.getAttribute(ne.PREFER_PLAYBACK);if(n===Yi.MSE||n===Yi.NATIVE)return n}set preferPlayback(n){n!==this.preferPlayback&&(n===Yi.MSE||n===Yi.NATIVE?this.setAttribute(ne.PREFER_PLAYBACK,n):this.removeAttribute(ne.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(n=>n.startsWith("metadata-")&&![ne.METADATA_URL].includes(n)).reduce((n,r)=>{let o=this.getAttribute(r);return o!=null&&(n[r.replace(/^metadata-/,"").replace(/-/g,"_")]=o),n},{}),...pe(this,Zs)}}set metadata(n){ft(this,Zs,n!=null?n:{}),this.mux&&this.mux.emit("hb",pe(this,Zs))}load(){ft(this,Hr,Kp(this,this.nativeEl,pe(this,Hr)))}unload(){th(this.nativeEl,pe(this,Hr)),ft(this,Hr,void 0)}attributeChangedCallback(n,r,o){var m,v;switch(ih.observedAttributes.includes(n)&&!["src","autoplay","preload"].includes(n)&&super.attributeChangedCallback(n,r,o),n){case ne.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=o!=null?o:void 0;break;case ne.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=o!=null?o:void 0;break;case"src":{let y=!!r,I=!!o;!y&&I?kt(this,vd,sh).call(this):y&&!I?this.unload():y&&I&&(this.unload(),kt(this,vd,sh).call(this));break}case"autoplay":if(o===r)break;(m=pe(this,Hr))==null||m.setAutoplay(this.autoplay);break;case"preload":if(o===r)break;(v=pe(this,Hr))==null||v.setPreload(o);break;case ne.PLAYBACK_ID:this.src=Fp(o!=null?o:void 0,{maxResolution:this.maxResolution,domain:this.customDomain});break;case ne.DEBUG:{let y=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=y);break}case ne.METADATA_URL:o&&fetch(o).then(y=>y.json()).then(y=>this.metadata=y).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${o}!`));break;case ne.STREAM_TYPE:(o==null||o!==r)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case ne.TARGET_LIVE_WINDOW:(o==null||o!==r)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;default:break}}disconnectedCallback(){this.unload()}};Hr=new WeakMap,Xs=new WeakMap,hd=new WeakMap,Zs=new WeakMap,fd=new WeakMap,md=new WeakMap,pd=new WeakMap,vd=new WeakSet,sh=async function(){pe(this,Xs)||(await ft(this,Xs,Promise.resolve()),ft(this,Xs,null),this.load())};cd.customElements.get("mux-video")||(cd.customElements.define("mux-video",oh),cd.MuxVideoElement=oh);var Jp=oh;var u0="en",$a={code:u0};var ev="en";function Qe(n,r=!0){var v,y;let o=r&&(y=(v=$a)==null?void 0:v[n])!=null?y:n,m=r?$a.code:ev;return new ch(o,m)}var ch=class{constructor(r,o=(m=>(m=$a.code)!=null?m:ev)()){this.message=r,this.locale=o}format(r){return this.message.replace(/\{(\w+)\}/g,(o,m)=>{var v;return(v=r[m])!=null?v:""})}toString(){return this.message}};function tv(n){let r="";return Object.entries(n).forEach(([o,m])=>{m!=null&&(r+=`${yd(o)}: ${m}; `)}),r?r.trim():void 0}function yd(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function bd(n){return n.replace(/[-_]([a-z])/g,(r,o)=>o.toUpperCase())}function Gr(n){if(n==null)return;let r=+n;return Number.isNaN(r)?void 0:r}function _d(n){let r=c0(n).toString();return r?"?"+r:""}function c0(n){let r={};for(let o in n)n[o]!=null&&(r[o]=n[o]);return new URLSearchParams(r)}function da(n){let r=(n!=null?n:"").split(".")[1];if(!r)return{};let o=r.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 hh=(n,r)=>!n||!r?!1:n.contains(r)?!0:hh(n,r.getRootNode().host);var fh="mux.com",h0=()=>{try{return"1.11.2"}catch{}return"UNKNOWN"},f0=h0(),Ad=()=>f0,mh=(n,{maxResolution:r,token:o,domain:m=fh}={})=>{let I=!!o?{token:o}:{redundant_streams:!0,...r?{max_resolution:r}:{}};return`https://stream.${m}/${n}.m3u8${_d(I)}`},iv=(n,{token:r,thumbnailTime:o,domain:m=fh}={})=>{let v=r==null?o:void 0,{aud:y}=da(r);if(!(r&&y!=="t"))return`https://image.${m}/${n}/thumbnail.webp${_d({token:r,time:v})}`},rv=(n,{token:r,domain:o=fh}={})=>{let{aud:m}=da(r);if(!(r&&m!=="s"))return`https://image.${o}/${n}/storyboard.vtt${_d({token:r,format:"webp"})}`},Js=n=>{if(!!n){if([gt.LIVE,gt.ON_DEMAND].includes(n))return n;if(n!=null&&n.includes("live"))return gt.LIVE}};var m0={crossorigin:"crossOrigin",playsinline:"playsInline"};function av(n){var r;return(r=m0[n])!=null?r:bd(n)}var ja,za,mi,Td=class{constructor(r,o){Bt(this,ja,void 0);Bt(this,za,void 0);Bt(this,mi,[]);Gi(this,ja,r),Gi(this,za,o)}[Symbol.iterator](){return ot(this,mi).values()}get length(){return ot(this,mi).length}get value(){var r;return(r=ot(this,mi).join(" "))!=null?r:""}set value(r){var o;r!==this.value&&(Gi(this,mi,[]),this.add(...(o=r==null?void 0:r.split(" "))!=null?o:[]))}toString(){return this.value}item(r){return ot(this,mi)[r]}values(){return ot(this,mi).values()}keys(){return ot(this,mi).keys()}forEach(r){ot(this,mi).forEach(r)}add(...r){var o,m;r.forEach(v=>{this.contains(v)||ot(this,mi).push(v)}),!(this.value===""&&!((o=ot(this,ja))!=null&&o.hasAttribute(`${ot(this,za)}`)))&&((m=ot(this,ja))==null||m.setAttribute(`${ot(this,za)}`,`${this.value}`))}remove(...r){var o;r.forEach(m=>{ot(this,mi).splice(ot(this,mi).indexOf(m),1)}),(o=ot(this,ja))==null||o.setAttribute(`${ot(this,za)}`,`${this.value}`)}contains(r){return ot(this,mi).includes(r)}toggle(r,o){return typeof o!="undefined"?o?(this.add(r),!0):(this.remove(r),!1):this.contains(r)?(this.remove(r),!1):(this.add(r),!0)}replace(r,o){this.remove(r),this.add(o)}};ja=new WeakMap,za=new WeakMap,mi=new WeakMap;var nv=`[mux-player ${Ad()}]`;function ua(...n){console.warn(nv,...n)}function Ji(...n){console.error(nv,...n)}function ph(n){var o;let r=(o=n.message)!=null?o:"";if(n.context&&(r+=` ${n.context}`),n.file){let m="https://github.com/muxinc/elements/blob/main/errors/";r+=` ${Qe("Read more: ")}
|
|
952
|
+
${m}${n.file}`}ua(r)}var di={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Qa={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ov=Object.freeze({length:0,start(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(n){let r=n>>>0;if(r>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${r}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),p0=Ed.filter(n=>n!=="error"),v0=Object.values(di).filter(n=>![di.PLAYSINLINE].includes(n)),g0=Object.values(Qa);function lv(n){n.querySelectorAll(":scope > track").forEach(r=>{var o;(o=n.media)==null||o.append(r.cloneNode())}),p0.forEach(r=>{var o;(o=n.media)==null||o.addEventListener(r,m=>{n.dispatchEvent(new Event(m.type))})})}var vh=class extends qt.HTMLElement{static get observedAttributes(){return[...v0,...g0]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(m=>{var v;(v=this.media)==null||v.append(m.cloneNode())});let r=m=>{for(let v of m)v.type==="childList"&&(v.removedNodes.forEach(y=>{var M,U;let I=(M=this.media)==null?void 0:M.querySelector(`track[src="${y.src}"]`);I&&((U=this.media)==null||U.removeChild(I))}),v.addedNodes.forEach(y=>{var I;(I=this.media)==null||I.append(y.cloneNode())}))};new MutationObserver(r).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(r,o,m){var v,y;switch(r){case Qa.MUTED:{this.media&&(this.media.muted=m!=null,this.media.defaultMuted=m!=null);return}case Qa.VOLUME:{let I=(v=Gr(m))!=null?v:1;this.media&&(this.media.volume=I);return}case Qa.PLAYBACKRATE:{let I=(y=Gr(m))!=null?y:1;this.media&&(this.media.playbackRate=I,this.media.defaultPlaybackRate=I);return}}}play(){var r,o;return(o=(r=this.media)==null?void 0:r.play())!=null?o:Promise.reject()}pause(){var r;(r=this.media)==null||r.pause()}requestCast(r){var o;return(o=this.media)==null?void 0:o.requestCast(r)}get media(){var r;return(r=this.shadowRoot)==null?void 0:r.querySelector("mux-video")}get paused(){var r,o;return(o=(r=this.media)==null?void 0:r.paused)!=null?o:!0}get duration(){var r,o;return(o=(r=this.media)==null?void 0:r.duration)!=null?o:NaN}get ended(){var r,o;return(o=(r=this.media)==null?void 0:r.ended)!=null?o:!1}get buffered(){var r,o;return(o=(r=this.media)==null?void 0:r.buffered)!=null?o:ov}get seekable(){var r,o;return(o=(r=this.media)==null?void 0:r.seekable)!=null?o:ov}get readyState(){var r,o;return(o=(r=this.media)==null?void 0:r.readyState)!=null?o:0}get videoWidth(){var r,o;return(o=(r=this.media)==null?void 0:r.videoWidth)!=null?o:0}get videoHeight(){var r,o;return(o=(r=this.media)==null?void 0:r.videoHeight)!=null?o:0}get currentTime(){var r,o;return(o=(r=this.media)==null?void 0:r.currentTime)!=null?o:0}set currentTime(r){this.media&&(this.media.currentTime=Number(r))}get volume(){var r,o;return(o=(r=this.media)==null?void 0:r.volume)!=null?o:1}set volume(r){this.media&&(this.media.volume=Number(r))}get playbackRate(){var r,o;return(o=(r=this.media)==null?void 0:r.playbackRate)!=null?o:1}set playbackRate(r){this.media&&(this.media.playbackRate=Number(r))}get defaultPlaybackRate(){var r;return(r=Gr(this.getAttribute(Qa.PLAYBACKRATE)))!=null?r:1}set defaultPlaybackRate(r){r!=null?this.setAttribute(Qa.PLAYBACKRATE,`${r}`):this.removeAttribute(Qa.PLAYBACKRATE)}get crossOrigin(){return eo(this,di.CROSSORIGIN)}set crossOrigin(r){this.setAttribute(di.CROSSORIGIN,`${r}`)}get autoplay(){return eo(this,di.AUTOPLAY)!=null}set autoplay(r){r?this.setAttribute(di.AUTOPLAY,typeof r=="string"?r:""):this.removeAttribute(di.AUTOPLAY)}get loop(){return eo(this,di.LOOP)!=null}set loop(r){r?this.setAttribute(di.LOOP,""):this.removeAttribute(di.LOOP)}get muted(){var r,o;return(o=(r=this.media)==null?void 0:r.muted)!=null?o:!1}set muted(r){this.media&&(this.media.muted=Boolean(r))}get defaultMuted(){return eo(this,di.MUTED)!=null}set defaultMuted(r){r?this.setAttribute(di.MUTED,""):this.removeAttribute(di.MUTED)}get playsInline(){return eo(this,di.PLAYSINLINE)!=null}set playsInline(r){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(r){["","none","metadata","auto"].includes(r)?this.setAttribute(di.PRELOAD,r):this.removeAttribute(di.PRELOAD)}};function eo(n,r){return n.media?n.media.getAttribute(r):n.getAttribute(r)}var gh=vh;var E0=Object.defineProperty,y0=(n,r,o)=>r in n?E0(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o,b0=(n,r,o)=>(y0(n,typeof r!="symbol"?r+"":r,o),o),fv=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},ze=(n,r,o)=>(fv(n,r,"read from private field"),o?o.call(n):r.get(n)),gr=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},Vr=(n,r,o,m)=>(fv(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),Yn,Sd,Xa,to,ca,ha,fa,Za,$n,kd,er,dv=1,uv=0,_0=1,T0={processCallback(n,r,o){if(!!o){for(let[m,v]of r)if(m in o){let y=o[m];typeof y=="boolean"&&v instanceof pi&&typeof v.element[v.attributeName]=="boolean"?v.booleanValue=y:typeof y=="function"&&v instanceof pi?v.element[v.attributeName]=y:v.value=y}}}},Kr=class extends q.DocumentFragment{constructor(r,o,m=T0){var v;super(),gr(this,Yn,void 0),gr(this,Sd,void 0),this.append(r.content.cloneNode(!0)),Vr(this,Yn,mv(this)),Vr(this,Sd,m),(v=m.createCallback)==null||v.call(m,this,ze(this,Yn),o),m.processCallback(this,ze(this,Yn),o)}update(r){ze(this,Sd).processCallback(this,ze(this,Yn),r)}};Yn=new WeakMap;Sd=new WeakMap;var mv=(n,r=[])=>{let o,m;for(let v of n.attributes||[])if(v.value.includes("{{")){let y=new Eh;for([o,m]of hv(v.value))if(!o)y.append(m);else{let I=new pi(n,v.name,v.namespaceURI);y.append(I),r.push([m,I])}v.value=y.toString()}for(let v of n.childNodes)if(v.nodeType===dv&&!(v instanceof HTMLTemplateElement))mv(v,r);else if(v.nodeType===dv||v.data.includes("{{")){let y=[];if(v.data)for([o,m]of hv(v.data))if(!o)y.push(new Text(m));else{let I=new Wr(n);y.push(I),r.push([m,I])}else if(v instanceof HTMLTemplateElement){let I=new io(n,v);y.push(I),r.push([I.expression,I])}v.replaceWith(...y.flatMap(I=>I.replacementNodes||[I]))}return r},cv={},hv=n=>{let r="",o=0,m=cv[n],v=0,y;if(m)return m;for(m=[];y=n[v];v++)y==="{"&&n[v+1]==="{"&&n[v-1]!=="\\"&&n[v+2]&&++o==1?(r&&m.push([uv,r]),r="",v++):y==="}"&&n[v+1]==="}"&&n[v-1]!=="\\"&&!--o?(m.push([_0,r.trim()]),r="",v++):r+=y||"";return r&&m.push([uv,(o>0?"{{":"")+r]),cv[n]=m},A0=11,wd=class{get value(){return""}set value(r){}toString(){return this.value}},pv=new WeakMap,Eh=class{constructor(){gr(this,Xa,[])}[Symbol.iterator](){return ze(this,Xa).values()}get length(){return ze(this,Xa).length}item(r){return ze(this,Xa)[r]}append(...r){for(let o of r)o instanceof pi&&pv.set(o,this),ze(this,Xa).push(o)}toString(){return ze(this,Xa).join("")}};Xa=new WeakMap;var pi=class extends wd{constructor(r,o,m){super(),gr(this,Za),gr(this,to,""),gr(this,ca,void 0),gr(this,ha,void 0),gr(this,fa,void 0),Vr(this,ca,r),Vr(this,ha,o),Vr(this,fa,m)}get attributeName(){return ze(this,ha)}get attributeNamespace(){return ze(this,fa)}get element(){return ze(this,ca)}get value(){return ze(this,to)}set value(r){ze(this,to)!==r&&(Vr(this,to,r),!ze(this,Za,$n)||ze(this,Za,$n).length===1?r==null?ze(this,ca).removeAttributeNS(ze(this,fa),ze(this,ha)):ze(this,ca).setAttributeNS(ze(this,fa),ze(this,ha),r):ze(this,ca).setAttributeNS(ze(this,fa),ze(this,ha),ze(this,Za,$n)))}get booleanValue(){return ze(this,ca).hasAttributeNS(ze(this,fa),ze(this,ha))}set booleanValue(r){if(!ze(this,Za,$n)||ze(this,Za,$n).length===1)this.value=r?"":null;else throw new DOMException("Value is not fully templatized")}};to=new WeakMap;ca=new WeakMap;ha=new WeakMap;fa=new WeakMap;Za=new WeakSet;$n=function(){return pv.get(this)};var Wr=class extends wd{constructor(r,o){super(),gr(this,kd,void 0),gr(this,er,void 0),Vr(this,kd,r),Vr(this,er,o?[...o]:[new Text])}get replacementNodes(){return ze(this,er)}get parentNode(){return ze(this,kd)}get nextSibling(){return ze(this,er)[ze(this,er).length-1].nextSibling}get previousSibling(){return ze(this,er)[0].previousSibling}get value(){return ze(this,er).map(r=>r.textContent).join("")}set value(r){this.replace(r)}replace(...r){let o=r.flat().flatMap(m=>m==null?[new Text]:m.forEach?[...m]:m.nodeType===A0?[...m.childNodes]:m.nodeType?[m]:[new Text(m)]);o.length||o.push(new Text),Vr(this,er,S0(ze(this,er)[0].parentNode,ze(this,er),o,this.nextSibling))}};kd=new WeakMap;er=new WeakMap;var io=class extends Wr{constructor(r,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(r),b0(this,"directive"),this.expression=v,this.template=o,this.directive=m}};function S0(n,r,o,m=null){let v=0,y,I,M,U=o.length,H=r.length;for(;v<U&&v<H&&r[v]==o[v];)v++;for(;v<U&&v<H&&o[U-1]==r[H-1];)m=o[--H,--U];if(v==H)for(;v<U;)n.insertBefore(o[v++],m);if(v==U)for(;v<H;)n.removeChild(r[v++]);else{for(y=r[v];v<U;)M=o[v++],I=y?y.nextSibling:m,y==M?y=I:v<U&&o[v]==I?(n.replaceChild(M,y),y=I):n.insertBefore(M,y);for(;y!=m;)I=y.nextSibling,n.removeChild(y),y=I}return o}var vv={string:n=>String(n)},Id=class{constructor(r){this.template=r,this.state=void 0}},Ja=new WeakMap,en=new WeakMap,yh={partial:(n,r)=>{r[n.expression]=new Id(n.template)},if:(n,r)=>{var o;if(Ev(n.expression,r))if(Ja.get(n)!==n.template){Ja.set(n,n.template);let m=new Kr(n.template,r,Rd);n.replace(m),en.set(n,m)}else(o=en.get(n))==null||o.update(r);else n.replace(""),Ja.delete(n),en.delete(n)}},k0=Object.keys(yh),Rd={processCallback(n,r,o){var m,v;if(!!o)for(let[y,I]of r){if(I instanceof io){if(!I.directive){let U=k0.find(H=>I.template.hasAttribute(H));U&&(I.directive=U,I.expression=I.template.getAttribute(U))}(m=yh[I.directive])==null||m.call(yh,I,o);continue}let M=Ev(y,o);if(M instanceof Id){Ja.get(I)!==M.template?(Ja.set(I,M.template),M=new Kr(M.template,M.state,Rd),I.value=M,en.set(I,M)):(v=en.get(I))==null||v.update(M.state);continue}M?(I instanceof pi&&I.attributeName.startsWith("aria-")&&(M=String(M)),I instanceof pi?typeof M=="boolean"?I.booleanValue=M:typeof M=="function"?I.element[I.attributeName]=M:I.value=M:(I.value=M,Ja.delete(I),en.delete(I))):I instanceof pi?I.value=void 0:(I.value=void 0,Ja.delete(I),en.delete(I))}}},gv={"!":n=>!n,"!!":n=>!!n,"==":(n,r)=>n==r,"!=":(n,r)=>n!=r,">":(n,r)=>n>r,">=":(n,r)=>n>=r,"<":(n,r)=>n<r,"<=":(n,r)=>n<=r,"??":(n,r)=>n!=null?n:r,"|":(n,r)=>{var o;return(o=vv[r])==null?void 0:o.call(vv,n)}};function w0(n){return L0(n,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:r})=>r!=="ws")}function Ev(n,r={}){var o,m,v,y,I,M,U;let H=w0(n);if(H.length===0||H.some(({type:z})=>!z))return ro(n);if(((o=H[0])==null?void 0:o.token)===">"){let z=r[(m=H[1])==null?void 0:m.token];if(!z)return ro(n);let J={...r};z.state=J;let ee=H.slice(2);for(let le=0;le<ee.length;le+=3){let me=(v=ee[le])==null?void 0:v.token,_e=(y=ee[le+1])==null?void 0:y.token,ge=(I=ee[le+2])==null?void 0:I.token;me&&_e==="="&&(J[me]=ao(ge,r))}return z}if(H.length===1)return Ld(H[0])?ao(H[0].token,r):ro(n);if(H.length===2){let z=(M=H[0])==null?void 0:M.token,J=gv[z];if(!J||!Ld(H[1]))return ro(n);let ee=ao(H[1].token,r);return J(ee)}if(H.length===3){let z=(U=H[1])==null?void 0:U.token,J=gv[z];if(!J||!Ld(H[0])||!Ld(H[2]))return ro(n);let ee=ao(H[0].token,r);if(z==="|")return J(ee,H[2].token);let le=ao(H[2].token,r);return J(ee,le)}}function ro(n){return console.warn(`Warning: invalid expression \`${n}\``),!1}function Ld({type:n}){return["number","boolean","string","param"].includes(n)}function ao(n,r){let o=n[0],m=n.slice(-1);return n==="true"||n==="false"?n==="true":o===m&&["'",'"'].includes(o)?n.slice(1,-1):sl(n)?parseFloat(n):r[n]}function L0(n,r){let o,m,v,y=[];for(;n;){v=null,o=n.length;for(let I in r)m=r[I].exec(n),m&&m.index<o&&(v={token:m[0],type:I,matches:m.slice(1)},o=m.index);o&&y.push({token:n.substr(0,o),type:void 0}),v&&y.push(v),n=n.substr(o+(v?v.token.length:0))}return y}var I0=Object.defineProperty,R0=(n,r,o)=>r in n?I0(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o,so=(n,r,o)=>(R0(n,typeof r!="symbol"?r+"":r,o),o),kh=(n,r,o)=>{if(!r.has(n))throw TypeError("Cannot "+o)},Th=(n,r,o)=>(kh(n,r,"read from private field"),o?o.call(n):r.get(n)),no=(n,r,o)=>{if(r.has(n))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(n):r.set(n,o)},tn=(n,r,o,m)=>(kh(n,r,"write to private field"),m?m.call(n,o):r.set(n,o),o),bh=(n,r,o)=>(kh(n,r,"access private method"),o),jn,Dd,zn,Ah,yv,Cd,Sh,_h={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},bv=ae.createElement("template");bv.innerHTML=`
|
|
949
953
|
<style>
|
|
950
954
|
:host {
|
|
951
955
|
display: inline-block;
|
|
@@ -967,7 +971,7 @@ ${m}${n.file}`}da(r)}var ui={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:
|
|
|
967
971
|
display: none;
|
|
968
972
|
}
|
|
969
973
|
</style>
|
|
970
|
-
`;var Qn=class extends q.HTMLElement{constructor(){super(),no(this,
|
|
974
|
+
`;var Qn=class extends q.HTMLElement{constructor(){super(),no(this,Ah),no(this,Cd),so(this,"renderRoot"),so(this,"renderer"),no(this,jn,void 0),no(this,Dd,void 0),no(this,zn,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());let r=new MutationObserver(o=>{o.some(m=>{let v=m.target;return v===this?!0:v.localName!=="media-controller"?!1:!!(_h[m.attributeName]||m.attributeName.startsWith("breakpoint"))})&&this.render()});r.observe(this,{attributes:!0}),r.observe(this.renderRoot,{attributes:!0,subtree:!0}),bh(this,Ah,yv).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var r;return(r=Th(this,jn))!=null?r:this.constructor.template}set template(r){tn(this,zn,null),tn(this,jn,r),this.createRenderer()}get props(){var r,o,m;let v=[...Array.from((o=(r=this.mediaController)==null?void 0:r.attributes)!=null?o:[]).filter(({name:I})=>_h[I]||I.startsWith("breakpoint")),...Array.from(this.attributes)],y={};for(let I of v){let M=(m=_h[I.name])!=null?m:Pf(I.name),{value:U}=I;U!=null?(sl(U)&&(U=parseFloat(U)),y[M]=U===""?!0:U):y[M]=!1}return y}attributeChangedCallback(r,o,m){r==="template"&&o!=m&&bh(this,Cd,Sh).call(this)}connectedCallback(){bh(this,Cd,Sh).call(this)}createRenderer(){this.template&&this.template!==Th(this,Dd)&&(tn(this,Dd,this.template),this.renderer=new Kr(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(bv.content.cloneNode(!0),this.renderer))}render(){var r;(r=this.renderer)==null||r.update(this.props)}};jn=new WeakMap;Dd=new WeakMap;zn=new WeakMap;Ah=new WeakSet;yv=function(n){if(Object.prototype.hasOwnProperty.call(this,n)){let r=this[n];delete this[n],this[n]=r}};Cd=new WeakSet;Sh=function(){var n;let r=this.getAttribute("template");if(!r||r===Th(this,zn))return;let o=this.getRootNode(),m=(n=o==null?void 0:o.getElementById)==null?void 0:n.call(o,r);if(m){tn(this,zn,r),tn(this,jn,m),this.createRenderer();return}D0(r)&&(tn(this,zn,r),C0(r).then(v=>{let y=ae.createElement("template");y.innerHTML=v,tn(this,jn,y),this.createRenderer()}).catch(console.error))};so(Qn,"template");so(Qn,"observedAttributes",["template"]);so(Qn,"processor",Rd);function D0(n){if(!/^(\/|\.\/|https?:\/\/)/.test(n))return!1;let r=/^https?:\/\//.test(n)?void 0:location.origin;try{new URL(n,r)}catch{return!1}return!0}async function C0(n){let r=await fetch(n);if(r.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${r.status}`);return r.text()}q.customElements.get("media-theme")||q.customElements.define("media-theme",Qn);var _v=`:host {
|
|
971
975
|
--media-control-display: var(--controls);
|
|
972
976
|
--media-loading-indicator-display: var(--loading-indicator);
|
|
973
977
|
--media-dialog-display: var(--dialog);
|
|
@@ -1083,7 +1087,7 @@ media-theme {
|
|
|
1083
1087
|
--media-duration-display-display: var(--duration-display, var(--bottom-duration-display));
|
|
1084
1088
|
--media-title-display-display: var(--title-display, var(--bottom-title-display));
|
|
1085
1089
|
}
|
|
1086
|
-
`;var
|
|
1090
|
+
`;var Tv=`<!-- prettier-ignore -->
|
|
1087
1091
|
<template id="media-theme-mux">
|
|
1088
1092
|
<style>
|
|
1089
1093
|
:host {
|
|
@@ -1847,7 +1851,7 @@ media-theme {
|
|
|
1847
1851
|
|
|
1848
1852
|
</media-controller>
|
|
1849
1853
|
</template>
|
|
1850
|
-
`;var
|
|
1854
|
+
`;var Sv=`
|
|
1851
1855
|
:host {
|
|
1852
1856
|
z-index: 100;
|
|
1853
1857
|
display: var(--media-dialog-display, flex);
|
|
@@ -1899,17 +1903,17 @@ media-theme {
|
|
|
1899
1903
|
text-align: center;
|
|
1900
1904
|
line-height: 1.4;
|
|
1901
1905
|
}
|
|
1902
|
-
`,
|
|
1906
|
+
`,kv=Mi.createElement("template");kv.innerHTML=`
|
|
1903
1907
|
<style>
|
|
1904
|
-
${
|
|
1908
|
+
${Sv}
|
|
1905
1909
|
</style>
|
|
1906
1910
|
|
|
1907
1911
|
<div class="dialog">
|
|
1908
1912
|
<slot></slot>
|
|
1909
1913
|
</div>
|
|
1910
|
-
`;var ma=class extends qt.HTMLElement{constructor(){var
|
|
1914
|
+
`;var ma=class extends qt.HTMLElement{constructor(){var o;super();this.attachShadow({mode:"open"}),(o=this.shadowRoot)==null||o.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),Av(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),P0(this))}attributeChangedCallback(o,m,v){o==="open"&&m!==v&&(v!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&Av(this)}};ma.styles=Sv,ma.template=kv,ma.observedAttributes=["open"];function Av(n){let r=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(n.dispatchEvent(r),r.defaultPrevented)return;let o=n.querySelector("[autofocus]:not([disabled])");!o&&n.tabIndex>=0&&(o=n),o||(o=wv(n.shadowRoot)),n._previouslyFocusedElement=Mi.activeElement,Mi.activeElement instanceof HTMLElement&&Mi.activeElement.blur(),n.addEventListener("transitionend",()=>{o instanceof HTMLElement&&o.focus({preventScroll:!0})},{once:!0})}function wv(n){let o=["button","input","keygen","select","textarea"].map(function(v){return v+":not([disabled])"});o.push('[tabindex]:not([disabled]):not([tabindex=""])');let m=n==null?void 0:n.querySelector(o.join(", "));if(!m&&"attachShadow"in Element.prototype){let v=(n==null?void 0:n.querySelectorAll("*"))||[];for(let y=0;y<v.length&&!(v[y].tagName&&v[y].shadowRoot&&(m=wv(v[y].shadowRoot),m));y++);}return m}function P0(n){n._previouslyFocusedElement instanceof HTMLElement&&n._previouslyFocusedElement.focus()}qt.customElements.get("media-dialog")||(qt.customElements.define("media-dialog",ma),qt.MediaDialog=ma);var wh=ma;var Lv=Mi.createElement("template");Lv.innerHTML=`
|
|
1911
1915
|
<style>
|
|
1912
|
-
${
|
|
1916
|
+
${wh.styles}
|
|
1913
1917
|
|
|
1914
1918
|
.close {
|
|
1915
1919
|
background: none;
|
|
@@ -1938,26 +1942,26 @@ media-theme {
|
|
|
1938
1942
|
</svg>
|
|
1939
1943
|
</button>
|
|
1940
1944
|
</slot>
|
|
1941
|
-
`;var oo=class extends
|
|
1945
|
+
`;var oo=class extends wh{constructor(){var r,o;super(),(o=(r=this.shadowRoot)==null?void 0:r.querySelector(".close"))==null||o.addEventListener("click",()=>{this.close()})}};oo.template=Lv;qt.customElements.get("mxp-dialog")||(qt.customElements.define("mxp-dialog",oo),qt.MxpDialog=oo);var lo=new WeakMap,uo=class{constructor(r,o){this.element=r;this.type=o;this.element.addEventListener(this.type,this);let m=lo.get(this.element);m&&m.set(this.type,this)}set(r){if(typeof r=="function")this.handleEvent=r.bind(this.element);else if(typeof r=="object"&&typeof r.handleEvent=="function")this.handleEvent=r.handleEvent.bind(r);else{this.element.removeEventListener(this.type,this);let o=lo.get(this.element);o&&o.delete(this.type)}}static for(r){lo.has(r.element)||lo.set(r.element,new Map);let o=r.attributeName.slice(2),m=lo.get(r.element);return m&&m.has(o)?m.get(o):new uo(r.element,o)}};function O0(n,r){return n instanceof pi&&n.attributeName.startsWith("on")?(uo.for(n).set(r),n.element.removeAttributeNS(n.attributeNamespace,n.attributeName),!0):!1}function N0(n,r){return r instanceof Md&&n instanceof Wr?(r.renderInto(n),!0):!1}function F0(n,r){return r instanceof DocumentFragment&&n instanceof Wr?(r.childNodes.length&&n.replace(...r.childNodes),!0):!1}function U0(n,r){if(n instanceof pi){let o=n.attributeNamespace,m=n.element.getAttributeNS(o,n.attributeName);return String(r)!==m&&(n.value=String(r)),!0}return n.value=String(r),!0}function B0(n,r){if(n instanceof pi&&r instanceof Element){let o=n.element;return o[n.attributeName]!==r&&(n.element.removeAttributeNS(n.attributeNamespace,n.attributeName),o[n.attributeName]=r),!0}return!1}function H0(n,r){if(typeof r=="boolean"&&n instanceof pi){let o=n.attributeNamespace,m=n.element.hasAttributeNS(o,n.attributeName);return r!==m&&(n.booleanValue=r),!0}return!1}function G0(n,r){return r===!1&&n instanceof Wr?(n.replace(""),!0):!1}function V0(n,r){B0(n,r)||H0(n,r)||O0(n,r)||G0(n,r)||N0(n,r)||F0(n,r)||U0(n,r)}var Lh=new Map,Iv=new WeakMap,Rv=new WeakMap,Md=class{constructor(r,o,m){this.strings=r;this.values=o;this.processor=m;this.stringsKey=this.strings.join("")}get template(){if(Lh.has(this.stringsKey))return Lh.get(this.stringsKey);{let r=Mi.createElement("template"),o=this.strings.length-1;return r.innerHTML=this.strings.reduce((m,v,y)=>m+v+(y<o?`{{ ${y} }}`:""),""),Lh.set(this.stringsKey,r),r}}renderInto(r){var v;let o=this.template;if(Iv.get(r)!==o){Iv.set(r,o);let y=new Kr(o,this.values,this.processor);Rv.set(r,y),r instanceof Wr?r.replace(...y.children):r.appendChild(y);return}let m=Rv.get(r);(v=m==null?void 0:m.update)==null||v.call(m,this.values)}},K0={processCallback(n,r,o){var m;if(!!o){for(let[v,y]of r)if(v in o){let I=(m=o[v])!=null?m:"";V0(y,I)}}}};function qr(n,...r){return new Md(n,r,K0)}function Dv(n,r){n.renderInto(r)}var Ih=Mi.createElement("template");"innerHTML"in Ih&&(Ih.innerHTML=Tv);var Cv=n=>qr`
|
|
1942
1946
|
<style>
|
|
1943
|
-
${
|
|
1947
|
+
${_v}
|
|
1944
1948
|
</style>
|
|
1945
|
-
${
|
|
1946
|
-
`,
|
|
1949
|
+
${q0(n)}
|
|
1950
|
+
`,W0=n=>{let r=n.hotKeys?`${n.hotKeys}`:"";return Js(n.streamType)==="live"&&(r+=" noarrowleft noarrowright"),r},q0=n=>{var r,o,m,v,y,I,M,U,H,z,J,ee,le,me,_e,ge,ye,Ee,ue,Be,Ge,re,k,se,W,Se,Xe,at,jt,it,B,ui,zt,nt,ri;return qr`
|
|
1947
1951
|
<media-theme
|
|
1948
|
-
template="${(r=n.themeTemplate)!=null?r:
|
|
1949
|
-
defaultstreamtype="${(
|
|
1950
|
-
hotkeys="${
|
|
1952
|
+
template="${(r=n.themeTemplate)!=null?r:Ih.content.children[0]}"
|
|
1953
|
+
defaultstreamtype="${(o=n.defaultStreamType)!=null?o:!1}"
|
|
1954
|
+
hotkeys="${W0(n)||!1}"
|
|
1951
1955
|
nohotkeys="${n.noHotKeys||!n.hasSrc||n.isDialogOpen||!1}"
|
|
1952
|
-
noautoseektolive="${!!((m=n.streamType)!=null&&m.includes(
|
|
1956
|
+
noautoseektolive="${!!((m=n.streamType)!=null&&m.includes(gt.LIVE))&&n.targetLiveWindow!==0}"
|
|
1953
1957
|
novolumepref="${n.novolumepref||!1}"
|
|
1954
1958
|
disabled="${!n.hasSrc||n.isDialogOpen}"
|
|
1955
1959
|
audio="${(v=n.audio)!=null?v:!1}"
|
|
1956
|
-
style="${(y=
|
|
1960
|
+
style="${(y=tv({"--media-primary-color":n.primaryColor,"--media-secondary-color":n.secondaryColor}))!=null?y:!1}"
|
|
1957
1961
|
defaultsubtitles="${!n.defaultHiddenCaptions}"
|
|
1958
1962
|
forwardseekoffset="${(I=n.forwardSeekOffset)!=null?I:!1}"
|
|
1959
1963
|
backwardseekoffset="${(M=n.backwardSeekOffset)!=null?M:!1}"
|
|
1960
|
-
playbackrates="${(
|
|
1964
|
+
playbackrates="${(U=n.playbackRates)!=null?U:!1}"
|
|
1961
1965
|
defaultshowremainingtime="${(H=n.defaultShowRemainingTime)!=null?H:!1}"
|
|
1962
1966
|
hideduration="${(z=n.hideDuration)!=null?z:!1}"
|
|
1963
1967
|
title="${(J=n.title)!=null?J:!1}"
|
|
@@ -1973,7 +1977,7 @@ media-theme {
|
|
|
1973
1977
|
muted="${(ge=n.muted)!=null?ge:!1}"
|
|
1974
1978
|
loop="${(ye=n.loop)!=null?ye:!1}"
|
|
1975
1979
|
preload="${(Ee=n.preload)!=null?Ee:!1}"
|
|
1976
|
-
debug="${(
|
|
1980
|
+
debug="${(ue=n.debug)!=null?ue:!1}"
|
|
1977
1981
|
prefer-cmcd="${(Be=n.preferCmcd)!=null?Be:!1}"
|
|
1978
1982
|
disable-cookies="${(Ge=n.disableCookies)!=null?Ge:!1}"
|
|
1979
1983
|
prefer-playback="${(re=n.preferPlayback)!=null?re:!1}"
|
|
@@ -1983,11 +1987,11 @@ media-theme {
|
|
|
1983
1987
|
player-software-version="${(W=n.playerSoftwareVersion)!=null?W:!1}"
|
|
1984
1988
|
env-key="${(Se=n.envKey)!=null?Se:!1}"
|
|
1985
1989
|
custom-domain="${(Xe=n.customDomain)!=null?Xe:!1}"
|
|
1986
|
-
src="${n.src?n.src:n.playbackId?
|
|
1987
|
-
cast-src="${n.src?n.src:n.playbackId?
|
|
1990
|
+
src="${n.src?n.src:n.playbackId?mh(n.playbackId,{maxResolution:n.maxResolution,domain:n.customDomain,token:n.tokens.playback}):!1}"
|
|
1991
|
+
cast-src="${n.src?n.src:n.playbackId?mh(n.playbackId,{maxResolution:n.maxResolution,domain:n.customDomain,token:n.tokens.playback}):!1}"
|
|
1988
1992
|
exportparts="video"
|
|
1989
1993
|
>
|
|
1990
|
-
${n.storyboard?
|
|
1994
|
+
${n.storyboard?qr`<track label="thumbnails" default kind="metadata" src="${n.storyboard}" />`:qr``}
|
|
1991
1995
|
</mux-video>
|
|
1992
1996
|
<media-poster-image
|
|
1993
1997
|
slot="poster"
|
|
@@ -2001,21 +2005,21 @@ media-theme {
|
|
|
2001
2005
|
onclose="${n.onCloseErrorDialog}"
|
|
2002
2006
|
oninitfocus="${n.onInitFocusDialog}"
|
|
2003
2007
|
>
|
|
2004
|
-
${(
|
|
2008
|
+
${(B=n.dialog)!=null&&B.title?qr`<h3>${n.dialog.title}</h3>`:qr``}
|
|
2005
2009
|
<p>
|
|
2006
|
-
${(
|
|
2007
|
-
${(zt=n.dialog)!=null&&zt.linkUrl?
|
|
2010
|
+
${(ui=n.dialog)==null?void 0:ui.message}
|
|
2011
|
+
${(zt=n.dialog)!=null&&zt.linkUrl?qr`<a
|
|
2008
2012
|
href="${n.dialog.linkUrl}"
|
|
2009
2013
|
target="_blank"
|
|
2010
2014
|
rel="external noopener"
|
|
2011
2015
|
aria-label="${(nt=n.dialog.linkText)!=null?nt:""} ${Qe("(opens in a new window)")}"
|
|
2012
2016
|
>${(ri=n.dialog.linkText)!=null?ri:n.dialog.linkUrl}</a
|
|
2013
|
-
>`:
|
|
2017
|
+
>`:qr``}
|
|
2014
2018
|
</p>
|
|
2015
2019
|
</mxp-dialog>
|
|
2016
2020
|
</media-theme>
|
|
2017
|
-
`};function xu(n,r,l,m,v){var M,B,H;let y={},I={};switch(n.code){case Tt.MEDIA_ERR_NETWORK:{switch(y.title=Qe("Network Error",v),y.message=n.message,(M=n.data)==null?void 0:M.response.code){case 412:{y.title=Qe("Video is not currently available",v),y.message=Qe("The live stream or video file are not yet ready.",v),I.message=Qe("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:{y.title=Qe("Video does not exist",v),y.message="",I.message=Qe("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(y.title=Qe("Invalid playback URL",v),y.message=Qe("The video URL or playback-token are formatted with incorrect or incomplete information.",v),I.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),I.file="missing-signed-tokens.md",!m)break;let{exp:z,aud:J,sub:ee}=ua(m),le=Date.now()>z*1e3,me=ee!==l,_e=J!=="v",ge={timeStyle:"medium",dateStyle:"medium"};if(le){y.title=Qe("Video URL has expired",v),y.message=Qe("The video\u2019s secured playback-token has expired.",v),I.message=Qe("The video\u2019s secured playback-token has expired.",v),I.context=Qe("Expired at: {expiredDate}. Current time: {currentDate}.",v).format({expiredDate:new Intl.DateTimeFormat($a.code,ge).format(z*1e3),currentDate:new Intl.DateTimeFormat($a.code,ge).format(Date.now())}),I.file="403-expired-token.md";break}if(me){y.title=Qe("Video URL is formatted incorrectly",v),y.message=Qe("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),I.message=Qe("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),I.context=Qe("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",v).format({playbackId:l,tokenPlaybackId:ee}),I.file="403-playback-id-mismatch.md";break}if(_e){y.title=Qe("Video URL is formatted incorrectly",v),y.message=Qe("The playback-token is formatted with incorrect information.",v),I.message=Qe("The playback-token is formatted with incorrect information.",v),I.context=Qe("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",v).format({tokenType:J}),I.file="403-incorrect-aud-value.md";break}I.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),I.file="403-malformatted-token.md";break}}break}case Tt.MEDIA_ERR_DECODE:{let{message:z}=n;y={title:Qe("Media Error",v),message:z},I.file="media-decode-error.md";break}case Tt.MEDIA_ERR_SRC_NOT_SUPPORTED:{let z=(H=(B=n.data)==null?void 0:B.response)==null?void 0:H.code;if(z>=400&&z<500){n.code=Tt.MEDIA_ERR_NETWORK,n.data={response:{code:z}},{dialog:y,devlog:I}=xu(n,r,l,m);break}y={title:Qe("Source Not Supported",v),message:n.message},I.file="media-src-not-supported.md";break}default:y={title:Qe("Error",v),message:n.message};break}return r&&(y={title:Qe("Your device appears to be offline",v),message:Qe("Check your internet connection and try reloading this video.",v)}),{dialog:y,devlog:I}}var qr={SRC:"src",POSTER:"poster"},ve={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"},Ih=["audio","backwardseekoffset","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function V0(n,r){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(ve.STORYBOARD_SRC),placeholder:n.getAttribute("placeholder"),themeTemplate:K0(n),thumbnailTime:!n.tokens.thumbnail&&n.thumbnailTime,autoplay:n.autoplay,crossOrigin:n.crossOrigin,loop:n.loop,noHotKeys:n.hasAttribute(ve.NOHOTKEYS),hotKeys:n.getAttribute(ve.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(ne.TARGET_LIVE_WINDOW),streamType:Js(n.getAttribute(ne.STREAM_TYPE)),primaryColor:n.primaryColor,secondaryColor:n.secondaryColor,forwardSeekOffset:n.forwardSeekOffset,backwardSeekOffset:n.backwardSeekOffset,defaultHiddenCaptions:n.defaultHiddenCaptions,defaultShowRemainingTime:n.defaultShowRemainingTime,hideDuration:W0(n),playbackRates:n.getAttribute(ve.PLAYBACK_RATES),customDomain:(m=n.getAttribute(ne.CUSTOM_DOMAIN))!=null?m:void 0,title:n.getAttribute(ve.TITLE),novolumepref:n.hasAttribute(ve.NO_VOLUME_PREF),...r}}function K0(n){var l,m;let r=n.getAttribute(ve.THEME);if(r){let v=(m=(l=n.getRootNode())==null?void 0:l.getElementById)==null?void 0:m.call(l,r);if(v)return v;r.startsWith("media-theme-")||(r=`media-theme-${r}`);let y=qt.customElements.get(r);if(y!=null&&y.template)return y.template}}function W0(n){var l;let r=(l=n.mediaController)==null?void 0:l.querySelector("media-time-display");return r&&getComputedStyle(r).getPropertyValue("--media-duration-display-display").trim()==="none"}function Dv(n){return n.getAttributeNames().filter(r=>r.startsWith("metadata-")).reduce((r,l)=>{let m=n.getAttribute(l);return m!==null&&(r[l.replace(/^metadata-/,"").replace(/-/g,"_")]=m),r},{})}var q0=Object.values(ne),Y0=Object.values(qr),$0=Object.values(ve),j0=Au(),z0="mux-player",Cv={dialog:void 0,isDialogOpen:!1},ho,fo,Yr,mo,rn,pa,Zn,Pu,Mv,po,Rh,va,Jn,Ou,xv,Nu,Pv,Fu,Ov,Uu,Nv,co=class extends vh{constructor(){super();Bt(this,pa);Bt(this,Pu);Bt(this,po);Bt(this,va);Bt(this,Ou);Bt(this,Nu);Bt(this,Fu);Bt(this,Uu);Bt(this,ho,!1);Bt(this,fo,{});Bt(this,Yr,!0);Bt(this,mo,new Tu(this,"hotkeys"));Bt(this,rn,{...Cv,onCloseErrorDialog:()=>Qt(this,po,Rh).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:l=>{ch(this,Mi.activeElement)||l.preventDefault()}});this.attachShadow({mode:"open"}),Qt(this,Pu,Mv).call(this),this.isConnected&&Qt(this,pa,Zn).call(this)}static get observedAttributes(){var l;return[...(l=vh.observedAttributes)!=null?l:[],...Y0,...q0,...$0]}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=Dv(this))}attributeChangedCallback(l,m,v){switch(Qt(this,pa,Zn).call(this),super.attributeChangedCallback(l,m,v),l){case ve.HOTKEYS:ot(this,mo).value=v;break;case ve.THUMBNAIL_TIME:{v!=null&&this.tokens.thumbnail&&da(Qe("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case ve.THUMBNAIL_TOKEN:{let{aud:I}=ua(v);v&&I!=="t"&&da(Qe("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:I}));break}case ve.STORYBOARD_TOKEN:{let{aud:I}=ua(v);v&&I!=="s"&&da(Qe("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:I}));break}case ne.PLAYBACK_ID:{v!=null&&v.includes("?token")&&Ji(Qe("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:v}));break}case ne.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:mh({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===vt.LIVE?0:Number.NaN}[ne.PLAYBACK_ID,qr.SRC,ve.PLAYBACK_TOKEN].includes(l)&&m!==v&&Gi(this,rn,{...ot(this,rn),...Cv}),Qt(this,va,Jn).call(this,{[iv(l)]:v})}get preferCmcd(){var l;return(l=this.getAttribute(ne.PREFER_CMCD))!=null?l:void 0}set preferCmcd(l){l!==this.preferCmcd&&(l?Wn.includes(l)?this.setAttribute(ne.PREFER_CMCD,l):da(`Invalid value for preferCmcd. Must be one of ${Wn.join()}`):this.removeAttribute(ne.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(ve.THEME))!=null?l:""}set theme(l){this.setAttribute(ve.THEME,`${l}`)}get themeProps(){let l=this.mediaTheme;if(!l)return;let m={};for(let v of l.getAttributeNames()){if(Ih.includes(v))continue;let y=l.getAttribute(v);m[bu(v)]=y===""?!0:y}return m}set themeProps(l){var v,y;Qt(this,pa,Zn).call(this);let m={...this.themeProps,...l};for(let I in m){if(Ih.includes(I))continue;let M=l==null?void 0:l[I];typeof M=="boolean"||M==null?(v=this.mediaTheme)==null||v.toggleAttribute(yu(I),Boolean(M)):(y=this.mediaTheme)==null||y.setAttribute(yu(I),M)}}get playbackId(){var l;return(l=this.getAttribute(ne.PLAYBACK_ID))!=null?l:void 0}set playbackId(l){l?this.setAttribute(ne.PLAYBACK_ID,l):this.removeAttribute(ne.PLAYBACK_ID)}get src(){var l,m;return this.playbackId?(l=Xn(this,qr.SRC))!=null?l:void 0:(m=this.getAttribute(qr.SRC))!=null?m:void 0}set src(l){l?this.setAttribute(qr.SRC,l):this.removeAttribute(qr.SRC)}get poster(){var m;let l=this.getAttribute(qr.POSTER);if(l!=null)return l;if(this.playbackId&&!this.audio)return ev(this.playbackId,{domain:this.customDomain,thumbnailTime:(m=this.thumbnailTime)!=null?m:this.startTime,token:this.tokens.thumbnail})}set poster(l){l||l===""?this.setAttribute(qr.POSTER,l):this.removeAttribute(qr.POSTER)}get storyboardSrc(){var l;return(l=this.getAttribute(ve.STORYBOARD_SRC))!=null?l:void 0}set storyboardSrc(l){l?this.setAttribute(ve.STORYBOARD_SRC,l):this.removeAttribute(ve.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 tv(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(ve.AUDIO)}set audio(l){if(!l){this.removeAttribute(ve.AUDIO);return}this.setAttribute(ve.AUDIO,"")}get hotkeys(){return ot(this,mo)}get nohotkeys(){return this.hasAttribute(ve.NOHOTKEYS)}set nohotkeys(l){if(!l){this.removeAttribute(ve.NOHOTKEYS);return}this.setAttribute(ve.NOHOTKEYS,"")}get thumbnailTime(){return Hr(this.getAttribute(ve.THUMBNAIL_TIME))}set thumbnailTime(l){this.setAttribute(ve.THUMBNAIL_TIME,`${l}`)}get title(){var l;return(l=this.getAttribute(ve.TITLE))!=null?l:""}set title(l){l!==this.title&&(l?this.setAttribute(ve.TITLE,l):this.removeAttribute("title"),super.title=l)}get placeholder(){var l;return(l=Xn(this,ve.PLACEHOLDER))!=null?l:""}set placeholder(l){this.setAttribute(ve.PLACEHOLDER,`${l}`)}get primaryColor(){var m,v;let l=this.getAttribute(ve.PRIMARY_COLOR);if(l!=null||this.mediaTheme&&(l=(v=(m=qt.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_primary-color"))==null?void 0:v.trim(),l))return l}set primaryColor(l){this.setAttribute(ve.PRIMARY_COLOR,`${l}`)}get secondaryColor(){var m,v;let l=this.getAttribute(ve.SECONDARY_COLOR);if(l!=null||this.mediaTheme&&(l=(v=(m=qt.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_secondary-color"))==null?void 0:v.trim(),l))return l}set secondaryColor(l){this.setAttribute(ve.SECONDARY_COLOR,`${l}`)}get defaultShowRemainingTime(){return this.hasAttribute(ve.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(l){l?this.setAttribute(ve.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(ve.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(ve.PLAYBACK_RATES))return this.getAttribute(ve.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(ve.PLAYBACK_RATES);return}this.setAttribute(ve.PLAYBACK_RATES,l.join(" "))}get forwardSeekOffset(){var l;return(l=Hr(this.getAttribute(ve.FORWARD_SEEK_OFFSET)))!=null?l:10}set forwardSeekOffset(l){this.setAttribute(ve.FORWARD_SEEK_OFFSET,`${l}`)}get backwardSeekOffset(){var l;return(l=Hr(this.getAttribute(ve.BACKWARD_SEEK_OFFSET)))!=null?l:10}set backwardSeekOffset(l){this.setAttribute(ve.BACKWARD_SEEK_OFFSET,`${l}`)}get defaultHiddenCaptions(){return this.hasAttribute(ve.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(l){l?this.setAttribute(ve.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(ve.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var l;return(l=this.getAttribute(ne.PLAYER_SOFTWARE_NAME))!=null?l:z0}get playerSoftwareVersion(){var l;return(l=this.getAttribute(ne.PLAYER_SOFTWARE_VERSION))!=null?l:j0}get beaconCollectionDomain(){var l;return(l=this.getAttribute(ne.BEACON_COLLECTION_DOMAIN))!=null?l:void 0}set beaconCollectionDomain(l){l!==this.beaconCollectionDomain&&(l?this.setAttribute(ne.BEACON_COLLECTION_DOMAIN,l):this.removeAttribute(ne.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var l;return(l=this.getAttribute(ne.MAX_RESOLUTION))!=null?l:void 0}set maxResolution(l){l!==this.maxResolution&&(l?this.setAttribute(ne.MAX_RESOLUTION,l):this.removeAttribute(ne.MAX_RESOLUTION))}get customDomain(){var l;return(l=this.getAttribute(ne.CUSTOM_DOMAIN))!=null?l:void 0}set customDomain(l){l!==this.customDomain&&(l?this.setAttribute(ne.CUSTOM_DOMAIN,l):this.removeAttribute(ne.CUSTOM_DOMAIN))}get envKey(){var l;return(l=Xn(this,ne.ENV_KEY))!=null?l:void 0}set envKey(l){this.setAttribute(ne.ENV_KEY,`${l}`)}get noVolumePref(){return this.hasAttribute(ve.NO_VOLUME_PREF)}set noVolumePref(l){l?this.setAttribute(ve.NO_VOLUME_PREF,""):this.removeAttribute(ve.NO_VOLUME_PREF)}get debug(){return Xn(this,ne.DEBUG)!=null}set debug(l){l?this.setAttribute(ne.DEBUG,""):this.removeAttribute(ne.DEBUG)}get disableCookies(){return Xn(this,ne.DISABLE_COOKIES)!=null}set disableCookies(l){l?this.setAttribute(ne.DISABLE_COOKIES,""):this.removeAttribute(ne.DISABLE_COOKIES)}get streamType(){var l,m,v;return(v=(m=this.getAttribute(ne.STREAM_TYPE))!=null?m:(l=this.media)==null?void 0:l.streamType)!=null?v:vt.UNKNOWN}set streamType(l){this.setAttribute(ne.STREAM_TYPE,`${l}`)}get defaultStreamType(){var l,m,v;return(v=(m=this.getAttribute(ve.DEFAULT_STREAM_TYPE))!=null?m:(l=this.mediaController)==null?void 0:l.getAttribute(ve.DEFAULT_STREAM_TYPE))!=null?v:vt.ON_DEMAND}set defaultStreamType(l){l?this.setAttribute(ve.DEFAULT_STREAM_TYPE,l):this.removeAttribute(ve.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var l,m;return this.hasAttribute(ve.TARGET_LIVE_WINDOW)?+this.getAttribute(ve.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(ve.TARGET_LIVE_WINDOW):this.setAttribute(ve.TARGET_LIVE_WINDOW,`${+l}`))}get liveEdgeStart(){var l;return(l=this.media)==null?void 0:l.liveEdgeStart}get startTime(){return Hr(Xn(this,ne.START_TIME))}set startTime(l){this.setAttribute(ne.START_TIME,`${l}`)}get preferPlayback(){let l=this.getAttribute(ne.PREFER_PLAYBACK);if(l===Yi.MSE||l===Yi.NATIVE)return l}set preferPlayback(l){l!==this.preferPlayback&&(l===Yi.MSE||l===Yi.NATIVE?this.setAttribute(ne.PREFER_PLAYBACK,l):this.removeAttribute(ne.PREFER_PLAYBACK))}get metadata(){var l;return(l=this.media)==null?void 0:l.metadata}set metadata(l){if(Qt(this,pa,Zn).call(this),!this.media){Ji("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Dv(this),...l}}async addCuePoints(l){var m;if(Qt(this,pa,Zn).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(ve.PLAYBACK_TOKEN),m=this.getAttribute(ve.THUMBNAIL_TOKEN),v=this.getAttribute(ve.STORYBOARD_TOKEN);return{...ot(this,fo),...l!=null?{playback:l}:{},...m!=null?{thumbnail:m}:{},...v!=null?{storyboard:v}:{}}}set tokens(l){Gi(this,fo,l!=null?l:{})}get playbackToken(){var l;return(l=this.getAttribute(ve.PLAYBACK_TOKEN))!=null?l:void 0}set playbackToken(l){this.setAttribute(ve.PLAYBACK_TOKEN,`${l}`)}get thumbnailToken(){var l;return(l=this.getAttribute(ve.THUMBNAIL_TOKEN))!=null?l:void 0}set thumbnailToken(l){this.setAttribute(ve.THUMBNAIL_TOKEN,`${l}`)}get storyboardToken(){var l;return(l=this.getAttribute(ve.STORYBOARD_TOKEN))!=null?l:void 0}set storyboardToken(l){this.setAttribute(ve.STORYBOARD_TOKEN,`${l}`)}addTextTrack(l,m,v,y){var M;let I=(M=this.media)==null?void 0:M.nativeEl;if(!!I)return uu(I,l,m,v,y)}removeTextTrack(l){var v;let m=(v=this.media)==null?void 0:v.nativeEl;if(!!m)return Ip(m,l)}get textTracks(){var l;return(l=this.media)==null?void 0:l.textTracks}};ho=new WeakMap,fo=new WeakMap,Yr=new WeakMap,mo=new WeakMap,rn=new WeakMap,pa=new WeakSet,Zn=function(){var l,m,v;if(!ot(this,ho)){Gi(this,ho,!0),Qt(this,va,Jn).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof qt.HTMLElement))throw""}catch{Ji("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Xp))throw""}catch{Ji("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof qd))throw""}catch{Ji("<media-controller> failed to upgrade!")}sv(this),Qt(this,Ou,xv).call(this),Qt(this,Nu,Pv).call(this),Qt(this,Fu,Ov).call(this),Gi(this,Yr,(m=(l=this.mediaController)==null?void 0:l.hasAttribute("userinactive"))!=null?m:!0),Qt(this,Uu,Nv).call(this),(v=this.media)==null||v.addEventListener("streamtypechange",()=>{Qt(this,va,Jn).call(this)})}},Pu=new WeakSet,Mv=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{}},po=new WeakSet,Rh=function(l){Object.assign(ot(this,rn),l),Qt(this,va,Jn).call(this)},va=new WeakSet,Jn=function(l={}){Iv(Rv(V0(this,{...ot(this,rn),...l})),this.shadowRoot)},Ou=new WeakSet,xv=function(){let l=v=>{var M,B;if(!(v!=null&&v.startsWith("theme-")))return;let y=v.replace(/^theme-/,"");if(Ih.includes(y))return;let I=this.getAttribute(v);I!=null?(M=this.mediaTheme)==null||M.setAttribute(y,I):(B=this.mediaTheme)==null||B.removeAttribute(y)};new MutationObserver(v=>{for(let{attributeName:y}of v)l(y)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(l)},Nu=new WeakSet,Pv=function(){var m;let l=v=>{let{detail:y}=v;if(y instanceof Tt||(y=new Tt(y.message,y.code,y.fatal)),!(y!=null&&y.fatal)){da(y),y.data&&da(`${y.name} data:`,y.data);return}let{dialog:I,devlog:M}=xu(y,!window.navigator.onLine,this.playbackId,this.playbackToken);M.message&&mh(M),Ji(y),y.data&&Ji(`${y.name} data:`,y.data),Qt(this,po,Rh).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 Tt))return v;let{devlog:y}=xu((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:y.message?String(y.message):v.player_error_message,player_error_context:y.context?String(y.context):v.player_error_context}}),(m=this.media)==null||m.addEventListener("error",v=>{var I,M;let{detail:y}=v;if(!y){let{message:B,code:H}=(M=(I=this.media)==null?void 0:I.error)!=null?M:{};y=new Tt(B,H)}!(y!=null&&y.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:y}))})},Fu=new WeakSet,Ov=function(){var m,v,y,I;let l=()=>Qt(this,va,Jn).call(this);(v=(m=this.media)==null?void 0:m.textTracks)==null||v.addEventListener("addtrack",l),(I=(y=this.media)==null?void 0:y.textTracks)==null||I.addEventListener("removetrack",l)},Uu=new WeakSet,Nv=function(){var z,J;let l=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(!/Firefox/i.test(navigator.userAgent))return;let v,y=new WeakMap,I=()=>this.streamType===vt.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,M=(ee,le,me=!1)=>{if(I())return;Array.from(ee&&ee.activeCues||[]).forEach(ge=>{if(!(!ge.snapToLines||ge.line<-5||ge.line>=0&&ge.line<10))if(!le||this.paused){let ye=ge.text.split(`
|
|
2018
|
-
`).length,Ee=
|
|
2021
|
+
`};function xd(n,r,o,m,v){var M,U,H;let y={},I={};switch(n.code){case Tt.MEDIA_ERR_NETWORK:{switch(y.title=Qe("Network Error",v),y.message=n.message,(M=n.data)==null?void 0:M.response.code){case 412:{y.title=Qe("Video is not currently available",v),y.message=Qe("The live stream or video file are not yet ready.",v),I.message=Qe("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:{y.title=Qe("Video does not exist",v),y.message="",I.message=Qe("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(y.title=Qe("Invalid playback URL",v),y.message=Qe("The video URL or playback-token are formatted with incorrect or incomplete information.",v),I.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),I.file="missing-signed-tokens.md",!m)break;let{exp:z,aud:J,sub:ee}=da(m),le=Date.now()>z*1e3,me=ee!==o,_e=J!=="v",ge={timeStyle:"medium",dateStyle:"medium"};if(le){y.title=Qe("Video URL has expired",v),y.message=Qe("The video\u2019s secured playback-token has expired.",v),I.message=Qe("The video\u2019s secured playback-token has expired.",v),I.context=Qe("Expired at: {expiredDate}. Current time: {currentDate}.",v).format({expiredDate:new Intl.DateTimeFormat($a.code,ge).format(z*1e3),currentDate:new Intl.DateTimeFormat($a.code,ge).format(Date.now())}),I.file="403-expired-token.md";break}if(me){y.title=Qe("Video URL is formatted incorrectly",v),y.message=Qe("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),I.message=Qe("The video\u2019s playback ID does not match the one encoded in the playback-token.",v),I.context=Qe("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",v).format({playbackId:o,tokenPlaybackId:ee}),I.file="403-playback-id-mismatch.md";break}if(_e){y.title=Qe("Video URL is formatted incorrectly",v),y.message=Qe("The playback-token is formatted with incorrect information.",v),I.message=Qe("The playback-token is formatted with incorrect information.",v),I.context=Qe("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",v).format({tokenType:J}),I.file="403-incorrect-aud-value.md";break}I.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),I.file="403-malformatted-token.md";break}}break}case Tt.MEDIA_ERR_DECODE:{let{message:z}=n;y={title:Qe("Media Error",v),message:z},I.file="media-decode-error.md";break}case Tt.MEDIA_ERR_SRC_NOT_SUPPORTED:{let z=(H=(U=n.data)==null?void 0:U.response)==null?void 0:H.code;if(z>=400&&z<500){n.code=Tt.MEDIA_ERR_NETWORK,n.data={response:{code:z}},{dialog:y,devlog:I}=xd(n,r,o,m);break}y={title:Qe("Source Not Supported",v),message:n.message},I.file="media-src-not-supported.md";break}default:y={title:Qe("Error",v),message:n.message};break}return r&&(y={title:Qe("Your device appears to be offline",v),message:Qe("Check your internet connection and try reloading this video.",v)}),{dialog:y,devlog:I}}var Yr={SRC:"src",POSTER:"poster"},ve={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"},Rh=["audio","backwardseekoffset","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function Y0(n,r){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(ve.STORYBOARD_SRC),placeholder:n.getAttribute("placeholder"),themeTemplate:$0(n),thumbnailTime:!n.tokens.thumbnail&&n.thumbnailTime,autoplay:n.autoplay,crossOrigin:n.crossOrigin,loop:n.loop,noHotKeys:n.hasAttribute(ve.NOHOTKEYS),hotKeys:n.getAttribute(ve.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(ne.TARGET_LIVE_WINDOW),streamType:Js(n.getAttribute(ne.STREAM_TYPE)),primaryColor:n.primaryColor,secondaryColor:n.secondaryColor,forwardSeekOffset:n.forwardSeekOffset,backwardSeekOffset:n.backwardSeekOffset,defaultHiddenCaptions:n.defaultHiddenCaptions,defaultShowRemainingTime:n.defaultShowRemainingTime,hideDuration:j0(n),playbackRates:n.getAttribute(ve.PLAYBACK_RATES),customDomain:(m=n.getAttribute(ne.CUSTOM_DOMAIN))!=null?m:void 0,title:n.getAttribute(ve.TITLE),novolumepref:n.hasAttribute(ve.NO_VOLUME_PREF),...r}}function $0(n){var o,m;let r=n.getAttribute(ve.THEME);if(r){let v=(m=(o=n.getRootNode())==null?void 0:o.getElementById)==null?void 0:m.call(o,r);if(v)return v;r.startsWith("media-theme-")||(r=`media-theme-${r}`);let y=qt.customElements.get(r);if(y!=null&&y.template)return y.template}}function j0(n){var o;let r=(o=n.mediaController)==null?void 0:o.querySelector("media-time-display");return r&&getComputedStyle(r).getPropertyValue("--media-duration-display-display").trim()==="none"}function Mv(n){return n.getAttributeNames().filter(r=>r.startsWith("metadata-")).reduce((r,o)=>{let m=n.getAttribute(o);return m!==null&&(r[o.replace(/^metadata-/,"").replace(/-/g,"_")]=m),r},{})}var z0=Object.values(ne),Q0=Object.values(Yr),X0=Object.values(ve),Z0=Ad(),J0="mux-player",xv={dialog:void 0,isDialogOpen:!1},ho,fo,$r,mo,rn,pa,Zn,Pd,Pv,po,Dh,va,Jn,Od,Ov,Nd,Nv,Fd,Fv,Ud,Uv,co=class extends gh{constructor(){super();Bt(this,pa);Bt(this,Pd);Bt(this,po);Bt(this,va);Bt(this,Od);Bt(this,Nd);Bt(this,Fd);Bt(this,Ud);Bt(this,ho,!1);Bt(this,fo,{});Bt(this,$r,!0);Bt(this,mo,new Td(this,"hotkeys"));Bt(this,rn,{...xv,onCloseErrorDialog:()=>Qt(this,po,Dh).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:o=>{hh(this,Mi.activeElement)||o.preventDefault()}});this.attachShadow({mode:"open"}),Qt(this,Pd,Pv).call(this),this.isConnected&&Qt(this,pa,Zn).call(this)}static get observedAttributes(){var o;return[...(o=gh.observedAttributes)!=null?o:[],...Q0,...z0,...X0]}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(Qt(this,pa,Zn).call(this),super.attributeChangedCallback(o,m,v),o){case ve.HOTKEYS:ot(this,mo).value=v;break;case ve.THUMBNAIL_TIME:{v!=null&&this.tokens.thumbnail&&ua(Qe("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case ve.THUMBNAIL_TOKEN:{let{aud:I}=da(v);v&&I!=="t"&&ua(Qe("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:I}));break}case ve.STORYBOARD_TOKEN:{let{aud:I}=da(v);v&&I!=="s"&&ua(Qe("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:I}));break}case ne.PLAYBACK_ID:{v!=null&&v.includes("?token")&&Ji(Qe("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:v}));break}case ne.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:ph({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}[ne.PLAYBACK_ID,Yr.SRC,ve.PLAYBACK_TOKEN].includes(o)&&m!==v&&Gi(this,rn,{...ot(this,rn),...xv}),Qt(this,va,Jn).call(this,{[av(o)]:v})}get preferCmcd(){var o;return(o=this.getAttribute(ne.PREFER_CMCD))!=null?o:void 0}set preferCmcd(o){o!==this.preferCmcd&&(o?Wn.includes(o)?this.setAttribute(ne.PREFER_CMCD,o):ua(`Invalid value for preferCmcd. Must be one of ${Wn.join()}`):this.removeAttribute(ne.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(ve.THEME))!=null?o:""}set theme(o){this.setAttribute(ve.THEME,`${o}`)}get themeProps(){let o=this.mediaTheme;if(!o)return;let m={};for(let v of o.getAttributeNames()){if(Rh.includes(v))continue;let y=o.getAttribute(v);m[bd(v)]=y===""?!0:y}return m}set themeProps(o){var v,y;Qt(this,pa,Zn).call(this);let m={...this.themeProps,...o};for(let I in m){if(Rh.includes(I))continue;let M=o==null?void 0:o[I];typeof M=="boolean"||M==null?(v=this.mediaTheme)==null||v.toggleAttribute(yd(I),Boolean(M)):(y=this.mediaTheme)==null||y.setAttribute(yd(I),M)}}get playbackId(){var o;return(o=this.getAttribute(ne.PLAYBACK_ID))!=null?o:void 0}set playbackId(o){o?this.setAttribute(ne.PLAYBACK_ID,o):this.removeAttribute(ne.PLAYBACK_ID)}get src(){var o,m;return this.playbackId?(o=Xn(this,Yr.SRC))!=null?o:void 0:(m=this.getAttribute(Yr.SRC))!=null?m:void 0}set src(o){o?this.setAttribute(Yr.SRC,o):this.removeAttribute(Yr.SRC)}get poster(){var m;let o=this.getAttribute(Yr.POSTER);if(o!=null)return o;if(this.playbackId&&!this.audio)return iv(this.playbackId,{domain:this.customDomain,thumbnailTime:(m=this.thumbnailTime)!=null?m:this.startTime,token:this.tokens.thumbnail})}set poster(o){o||o===""?this.setAttribute(Yr.POSTER,o):this.removeAttribute(Yr.POSTER)}get storyboardSrc(){var o;return(o=this.getAttribute(ve.STORYBOARD_SRC))!=null?o:void 0}set storyboardSrc(o){o?this.setAttribute(ve.STORYBOARD_SRC,o):this.removeAttribute(ve.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 rv(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(ve.AUDIO)}set audio(o){if(!o){this.removeAttribute(ve.AUDIO);return}this.setAttribute(ve.AUDIO,"")}get hotkeys(){return ot(this,mo)}get nohotkeys(){return this.hasAttribute(ve.NOHOTKEYS)}set nohotkeys(o){if(!o){this.removeAttribute(ve.NOHOTKEYS);return}this.setAttribute(ve.NOHOTKEYS,"")}get thumbnailTime(){return Gr(this.getAttribute(ve.THUMBNAIL_TIME))}set thumbnailTime(o){this.setAttribute(ve.THUMBNAIL_TIME,`${o}`)}get title(){var o;return(o=this.getAttribute(ve.TITLE))!=null?o:""}set title(o){o!==this.title&&(o?this.setAttribute(ve.TITLE,o):this.removeAttribute("title"),super.title=o)}get placeholder(){var o;return(o=Xn(this,ve.PLACEHOLDER))!=null?o:""}set placeholder(o){this.setAttribute(ve.PLACEHOLDER,`${o}`)}get primaryColor(){var m,v;let o=this.getAttribute(ve.PRIMARY_COLOR);if(o!=null||this.mediaTheme&&(o=(v=(m=qt.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_primary-color"))==null?void 0:v.trim(),o))return o}set primaryColor(o){this.setAttribute(ve.PRIMARY_COLOR,`${o}`)}get secondaryColor(){var m,v;let o=this.getAttribute(ve.SECONDARY_COLOR);if(o!=null||this.mediaTheme&&(o=(v=(m=qt.getComputedStyle(this.mediaTheme))==null?void 0:m.getPropertyValue("--_secondary-color"))==null?void 0:v.trim(),o))return o}set secondaryColor(o){this.setAttribute(ve.SECONDARY_COLOR,`${o}`)}get defaultShowRemainingTime(){return this.hasAttribute(ve.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(o){o?this.setAttribute(ve.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(ve.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(ve.PLAYBACK_RATES))return this.getAttribute(ve.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(ve.PLAYBACK_RATES);return}this.setAttribute(ve.PLAYBACK_RATES,o.join(" "))}get forwardSeekOffset(){var o;return(o=Gr(this.getAttribute(ve.FORWARD_SEEK_OFFSET)))!=null?o:10}set forwardSeekOffset(o){this.setAttribute(ve.FORWARD_SEEK_OFFSET,`${o}`)}get backwardSeekOffset(){var o;return(o=Gr(this.getAttribute(ve.BACKWARD_SEEK_OFFSET)))!=null?o:10}set backwardSeekOffset(o){this.setAttribute(ve.BACKWARD_SEEK_OFFSET,`${o}`)}get defaultHiddenCaptions(){return this.hasAttribute(ve.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(o){o?this.setAttribute(ve.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(ve.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var o;return(o=this.getAttribute(ne.PLAYER_SOFTWARE_NAME))!=null?o:J0}get playerSoftwareVersion(){var o;return(o=this.getAttribute(ne.PLAYER_SOFTWARE_VERSION))!=null?o:Z0}get beaconCollectionDomain(){var o;return(o=this.getAttribute(ne.BEACON_COLLECTION_DOMAIN))!=null?o:void 0}set beaconCollectionDomain(o){o!==this.beaconCollectionDomain&&(o?this.setAttribute(ne.BEACON_COLLECTION_DOMAIN,o):this.removeAttribute(ne.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var o;return(o=this.getAttribute(ne.MAX_RESOLUTION))!=null?o:void 0}set maxResolution(o){o!==this.maxResolution&&(o?this.setAttribute(ne.MAX_RESOLUTION,o):this.removeAttribute(ne.MAX_RESOLUTION))}get customDomain(){var o;return(o=this.getAttribute(ne.CUSTOM_DOMAIN))!=null?o:void 0}set customDomain(o){o!==this.customDomain&&(o?this.setAttribute(ne.CUSTOM_DOMAIN,o):this.removeAttribute(ne.CUSTOM_DOMAIN))}get envKey(){var o;return(o=Xn(this,ne.ENV_KEY))!=null?o:void 0}set envKey(o){this.setAttribute(ne.ENV_KEY,`${o}`)}get noVolumePref(){return this.hasAttribute(ve.NO_VOLUME_PREF)}set noVolumePref(o){o?this.setAttribute(ve.NO_VOLUME_PREF,""):this.removeAttribute(ve.NO_VOLUME_PREF)}get debug(){return Xn(this,ne.DEBUG)!=null}set debug(o){o?this.setAttribute(ne.DEBUG,""):this.removeAttribute(ne.DEBUG)}get disableCookies(){return Xn(this,ne.DISABLE_COOKIES)!=null}set disableCookies(o){o?this.setAttribute(ne.DISABLE_COOKIES,""):this.removeAttribute(ne.DISABLE_COOKIES)}get streamType(){var o,m,v;return(v=(m=this.getAttribute(ne.STREAM_TYPE))!=null?m:(o=this.media)==null?void 0:o.streamType)!=null?v:gt.UNKNOWN}set streamType(o){this.setAttribute(ne.STREAM_TYPE,`${o}`)}get defaultStreamType(){var o,m,v;return(v=(m=this.getAttribute(ve.DEFAULT_STREAM_TYPE))!=null?m:(o=this.mediaController)==null?void 0:o.getAttribute(ve.DEFAULT_STREAM_TYPE))!=null?v:gt.ON_DEMAND}set defaultStreamType(o){o?this.setAttribute(ve.DEFAULT_STREAM_TYPE,o):this.removeAttribute(ve.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var o,m;return this.hasAttribute(ve.TARGET_LIVE_WINDOW)?+this.getAttribute(ve.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(ve.TARGET_LIVE_WINDOW):this.setAttribute(ve.TARGET_LIVE_WINDOW,`${+o}`))}get liveEdgeStart(){var o;return(o=this.media)==null?void 0:o.liveEdgeStart}get startTime(){return Gr(Xn(this,ne.START_TIME))}set startTime(o){this.setAttribute(ne.START_TIME,`${o}`)}get preferPlayback(){let o=this.getAttribute(ne.PREFER_PLAYBACK);if(o===Yi.MSE||o===Yi.NATIVE)return o}set preferPlayback(o){o!==this.preferPlayback&&(o===Yi.MSE||o===Yi.NATIVE?this.setAttribute(ne.PREFER_PLAYBACK,o):this.removeAttribute(ne.PREFER_PLAYBACK))}get metadata(){var o;return(o=this.media)==null?void 0:o.metadata}set metadata(o){if(Qt(this,pa,Zn).call(this),!this.media){Ji("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(Qt(this,pa,Zn).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(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(ve.PLAYBACK_TOKEN),m=this.getAttribute(ve.THUMBNAIL_TOKEN),v=this.getAttribute(ve.STORYBOARD_TOKEN);return{...ot(this,fo),...o!=null?{playback:o}:{},...m!=null?{thumbnail:m}:{},...v!=null?{storyboard:v}:{}}}set tokens(o){Gi(this,fo,o!=null?o:{})}get playbackToken(){var o;return(o=this.getAttribute(ve.PLAYBACK_TOKEN))!=null?o:void 0}set playbackToken(o){this.setAttribute(ve.PLAYBACK_TOKEN,`${o}`)}get thumbnailToken(){var o;return(o=this.getAttribute(ve.THUMBNAIL_TOKEN))!=null?o:void 0}set thumbnailToken(o){this.setAttribute(ve.THUMBNAIL_TOKEN,`${o}`)}get storyboardToken(){var o;return(o=this.getAttribute(ve.STORYBOARD_TOKEN))!=null?o:void 0}set storyboardToken(o){this.setAttribute(ve.STORYBOARD_TOKEN,`${o}`)}addTextTrack(o,m,v,y){var M;let I=(M=this.media)==null?void 0:M.nativeEl;if(!!I)return dd(I,o,m,v,y)}removeTextTrack(o){var v;let m=(v=this.media)==null?void 0:v.nativeEl;if(!!m)return Rp(m,o)}get textTracks(){var o;return(o=this.media)==null?void 0:o.textTracks}};ho=new WeakMap,fo=new WeakMap,$r=new WeakMap,mo=new WeakMap,rn=new WeakMap,pa=new WeakSet,Zn=function(){var o,m,v;if(!ot(this,ho)){Gi(this,ho,!0),Qt(this,va,Jn).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof qt.HTMLElement))throw""}catch{Ji("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Jp))throw""}catch{Ji("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof qu))throw""}catch{Ji("<media-controller> failed to upgrade!")}lv(this),Qt(this,Od,Ov).call(this),Qt(this,Nd,Nv).call(this),Qt(this,Fd,Fv).call(this),Gi(this,$r,(m=(o=this.mediaController)==null?void 0:o.hasAttribute("userinactive"))!=null?m:!0),Qt(this,Ud,Uv).call(this),(v=this.media)==null||v.addEventListener("streamtypechange",()=>{Qt(this,va,Jn).call(this)})}},Pd=new WeakSet,Pv=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{}},po=new WeakSet,Dh=function(o){Object.assign(ot(this,rn),o),Qt(this,va,Jn).call(this)},va=new WeakSet,Jn=function(o={}){Dv(Cv(Y0(this,{...ot(this,rn),...o})),this.shadowRoot)},Od=new WeakSet,Ov=function(){let o=v=>{var M,U;if(!(v!=null&&v.startsWith("theme-")))return;let y=v.replace(/^theme-/,"");if(Rh.includes(y))return;let I=this.getAttribute(v);I!=null?(M=this.mediaTheme)==null||M.setAttribute(y,I):(U=this.mediaTheme)==null||U.removeAttribute(y)};new MutationObserver(v=>{for(let{attributeName:y}of v)o(y)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(o)},Nd=new WeakSet,Nv=function(){var m;let o=v=>{let{detail:y}=v;if(y instanceof Tt||(y=new Tt(y.message,y.code,y.fatal)),!(y!=null&&y.fatal)){ua(y),y.data&&ua(`${y.name} data:`,y.data);return}let{dialog:I,devlog:M}=xd(y,!window.navigator.onLine,this.playbackId,this.playbackToken);M.message&&ph(M),Ji(y),y.data&&Ji(`${y.name} data:`,y.data),Qt(this,po,Dh).call(this,{isDialogOpen:!0,dialog:I})};this.addEventListener("error",o),this.media&&(this.media.errorTranslator=(v={})=>{var I,M,U;if(!(((I=this.media)==null?void 0:I.error)instanceof Tt))return v;let{devlog:y}=xd((M=this.media)==null?void 0:M.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(U=this.media)==null?void 0:U.error.code,player_error_message:y.message?String(y.message):v.player_error_message,player_error_context:y.context?String(y.context):v.player_error_context}}),(m=this.media)==null||m.addEventListener("error",v=>{var I,M;let{detail:y}=v;if(!y){let{message:U,code:H}=(M=(I=this.media)==null?void 0:I.error)!=null?M:{};y=new Tt(U,H)}!(y!=null&&y.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:y}))})},Fd=new WeakSet,Fv=function(){var m,v,y,I;let o=()=>Qt(this,va,Jn).call(this);(v=(m=this.media)==null?void 0:m.textTracks)==null||v.addEventListener("addtrack",o),(I=(y=this.media)==null?void 0:y.textTracks)==null||I.addEventListener("removetrack",o)},Ud=new WeakSet,Uv=function(){var z,J;let o=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(!/Firefox/i.test(navigator.userAgent))return;let v,y=new WeakMap,I=()=>this.streamType===gt.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,M=(ee,le,me=!1)=>{if(I())return;Array.from(ee&&ee.activeCues||[]).forEach(ge=>{if(!(!ge.snapToLines||ge.line<-5||ge.line>=0&&ge.line<10))if(!le||this.paused){let ye=ge.text.split(`
|
|
2022
|
+
`).length,Ee=o?-2:-3;this.streamType===gt.LIVE&&(Ee=o?-1:-2);let ue=Ee-ye;if(ge.line===ue&&!me)return;y.has(ge)||y.set(ge,ge.line),ge.line=ue-1,ge.line=ue}else setTimeout(()=>{ge.line=y.get(ge)||"auto"},500)})},U=()=>{var ee,le;M(v,(le=(ee=this.mediaController)==null?void 0:ee.hasAttribute("userinactive"))!=null?le:!1)},H=()=>{var me,_e;let le=Array.from(((_e=(me=this.mediaController)==null?void 0:me.media)==null?void 0:_e.textTracks)||[]).filter(ge=>["subtitles","captions"].includes(ge.kind)&&ge.mode==="showing")[0];le!==v&&(v==null||v.removeEventListener("cuechange",U)),v=le,v==null||v.addEventListener("cuechange",U),M(v,ot(this,$r))};if(H(),(z=this.textTracks)==null||z.addEventListener("change",H),(J=this.textTracks)==null||J.addEventListener("addtrack",H),navigator.userAgent.includes("Chrome/")){let ee=()=>{M(v,ot(this,$r),!0),this.paused||window.requestAnimationFrame(ee)};this.addEventListener("playing",()=>{ee()})}this.addEventListener("userinactivechange",()=>{var le,me;let ee=(me=(le=this.mediaController)==null?void 0:le.hasAttribute("userinactive"))!=null?me:!0;ot(this,$r)!==ee&&(Gi(this,$r,ee),M(v,ot(this,$r)))})};function Xn(n,r){return n.media?n.media.getAttribute(r):n.getAttribute(r)}qt.customElements.get("mux-player")||(qt.customElements.define("mux-player",co),qt.MuxPlayerElement=co);var sk=co;})();
|
|
2019
2023
|
/*!
|
|
2020
2024
|
* JavaScript Cookie v2.1.3
|
|
2021
2025
|
* https://github.com/js-cookie/js-cookie
|