i=t.mediaSequence-e.mediaSequence
if(i>86400)ql.log.warn("Not saving expired segment info. Media sequence gap "+i+" is too large.")
else for(var n=i-1;n>=0;n--){var r=e.segments[n]
if(r&&void 0!==r.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start}
this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]")
this.trigger("syncinfoupdate")
break}}}
i.setDateTimeMappingForStart=function(e){this.timelineToDatetimeMappings={}
if(e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],i=t.dateTimeObject.getTime()/1e3
this.timelineToDatetimeMappings[t.timeline]=-i}}
i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i),r=t.segment
if(n){this.saveDiscontinuitySyncInfo_(t)
t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start})}var a=r.dateTimeObject
r.discontinuity&&i&&a&&(this.timelineToDatetimeMappings[r.timeline]=-a.getTime()/1e3)}
i.timestampOffsetForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].time}
i.mappingForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}
i.calculateSegmentTimeMapping_=function(e,t,i){var n,r,a=e.segment,s=e.part,o=this.timelines[e.timeline]
if("number"==typeof e.timestampOffset){o={time:e.startOfSegment,mapping:e.startOfSegment-t.start}
if(i){this.timelines[e.timeline]=o
this.trigger("timestampoffset")
this.logger_("time mapping for timeline "+e.timeline+": [time: "+o.time+"] [mapping: "+o.mapping+"]")}n=e.startOfSegment
r=t.end+o.mapping}else{if(!o)return!1
n=t.start+o.mapping
r=t.end+o.mapping}if(s){s.start=n
s.end=r}(!a.start||n<a.start)&&(a.start=n)
a.end=r
return!0}
i.saveDiscontinuitySyncInfo_=function(e){var t=e.playlist,i=e.segment
if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0}
else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var n=0;n<t.discontinuityStarts.length;n++){var r=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,s=r-e.mediaIndex,o=Math.abs(s)
if(!this.discontinuities[a]||this.discontinuities[a].accuracy>o){var u=void 0
u=s<0?i.start-hc({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+hc({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r})
this.discontinuities[a]={time:u,accuracy:o}}}}
i.dispose=function(){this.trigger("dispose")
this.off()}
return t}(ql.EventTarget),xh=function(e){B(t,e)
function t(){var t;(t=e.call(this)||this).pendingTimelineChanges_={}
t.lastTimelineChanges_={}
return t}var i=t.prototype
i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null
this.trigger("pendingtimelinechange")}
i.pendingTimelineChange=function(e){var t=e.type,i=e.from,n=e.to
if("number"==typeof i&&"number"==typeof n){this.pendingTimelineChanges_[t]={type:t,from:i,to:n}
this.trigger("pendingtimelinechange")}return this.pendingTimelineChanges_[t]}
i.lastTimelineChange=function(e){var t=e.type,i=e.from,n=e.to
if("number"==typeof i&&"number"==typeof n){this.lastTimelineChanges_[t]={type:t,from:i,to:n}
delete this.pendingTimelineChanges_[t]
this.trigger("timelinechange")}return this.lastTimelineChanges_[t]}
i.dispose=function(){this.trigger("dispose")
this.pendingTimelineChanges_={}
this.lastTimelineChanges_={}
this.off()}
return t}(ql.EventTarget),Ah=ud(ld((function(){function e(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var t=e((function(e){function t(e,t){for(var i=0;i<t.length;i++){var n=t[i]
n.enumerable=n.enumerable||!1
n.configurable=!0
"value"in n&&(n.writable=!0)
Object.defineProperty(e,n.key,n)}}e.exports=function(e,i,n){i&&t(e.prototype,i)
n&&t(e,n)
return e}
e.exports.default=e.exports,e.exports.__esModule=!0})),i=e((function(e){function t(i,n){e.exports=t=Object.setPrototypeOf||function(e,t){e.__proto__=t
return e}
e.exports.default=e.exports,e.exports.__esModule=!0
return t(i,n)}e.exports=t
e.exports.default=e.exports,e.exports.__esModule=!0})),n=e((function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype)
e.prototype.constructor=e
i(e,t)}
e.exports.default=e.exports,e.exports.__esModule=!0})),r=function(){function e(){this.listeners={}}var t=e.prototype
t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[])
this.listeners[e].push(t)}
t.off=function(e,t){if(!this.listeners[e])return!1
var i=this.listeners[e].indexOf(t)
this.listeners[e]=this.listeners[e].slice(0)
this.listeners[e].splice(i,1)
return i>-1}
t.trigger=function(e){var t=this.listeners[e]
if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1])
else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)}
t.dispose=function(){this.listeners={}}
t.pipe=function(e){this.on("data",(function(t){e.push(t)}))}
return e}()

;/*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */
var a=null,s=function(){function e(e){a||(a=function(){var e,t,i,n,r,a,s,o,u=[[[],[],[],[],[]],[[],[],[],[],[]]],l=u[0],c=u[1],d=l[4],h=c[4],p=[],f=[]
for(e=0;e<256;e++)f[(p[e]=e<<1^283*(e>>7))^e]=e
for(t=i=0;!d[t];t^=n||1,i=f[i]||1){a=(a=i^i<<1^i<<2^i<<3^i<<4)>>8^255&a^99
d[t]=a
h[a]=t
o=16843009*p[r=p[n=p[t]]]^65537*r^257*n^16843008*t
s=257*p[a]^16843008*a
for(e=0;e<4;e++){l[e][t]=s=s<<24^s>>>8
c[e][a]=o=o<<24^o>>>8}}for(e=0;e<5;e++){l[e]=l[e].slice(0)
c[e]=c[e].slice(0)}return u}())
this._tables=[[a[0][0].slice(),a[0][1].slice(),a[0][2].slice(),a[0][3].slice(),a[0][4].slice()],[a[1][0].slice(),a[1][1].slice(),a[1][2].slice(),a[1][3].slice(),a[1][4].slice()]]
var t,i,n,r=this._tables[0][4],s=this._tables[1],o=e.length,u=1
if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size")
var l=e.slice(0),c=[]
this._key=[l,c]
for(t=o;t<4*o+28;t++){n=l[t-1]
if(t%o==0||8===o&&t%o==4){n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n]
if(t%o==0){n=n<<8^n>>>24^u<<24
u=u<<1^283*(u>>7)}}l[t]=l[t-o]^n}for(i=0;t;i++,t--){n=l[3&i?t:t-4]
c[i]=t<=4||i<4?n:s[0][r[n>>>24]]^s[1][r[n>>16&255]]^s[2][r[n>>8&255]]^s[3][r[255&n]]}}e.prototype.decrypt=function(e,t,i,n,r,a){var s,o,u,l,c=this._key[1],d=e^c[0],h=n^c[1],p=i^c[2],f=t^c[3],m=c.length/4-2,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],k=v[4]
for(l=0;l<m;l++){s=y[d>>>24]^_[h>>16&255]^b[p>>8&255]^T[255&f]^c[g]
o=y[h>>>24]^_[p>>16&255]^b[f>>8&255]^T[255&d]^c[g+1]
u=y[p>>>24]^_[f>>16&255]^b[d>>8&255]^T[255&h]^c[g+2]
f=y[f>>>24]^_[d>>16&255]^b[h>>8&255]^T[255&p]^c[g+3]
g+=4
d=s
h=o
p=u}for(l=0;l<4;l++){r[(3&-l)+a]=k[d>>>24]<<24^k[h>>16&255]<<16^k[p>>8&255]<<8^k[255&f]^c[g++]
s=d
d=h
h=p
p=f
f=s}}
return e}(),o=function(e){n(t,e)
function t(){var t;(t=e.call(this,r)||this).jobs=[]
t.delay=1
t.timeout_=null
return t}var i=t.prototype
i.processJob_=function(){this.jobs.shift()()
this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}
i.push=function(e){this.jobs.push(e)
this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}
return t}(r),u=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},l=function(){function e(t,i,n,r){var a=e.STEP,s=new Int32Array(t.buffer),l=new Uint8Array(t.byteLength),c=0
this.asyncStream_=new o
this.asyncStream_.push(this.decryptChunk_(s.subarray(c,c+a),i,n,l))
for(c=a;c<s.length;c+=a){n=new Uint32Array([u(s[c-4]),u(s[c-3]),u(s[c-2]),u(s[c-1])])
this.asyncStream_.push(this.decryptChunk_(s.subarray(c,c+a),i,n,l))}this.asyncStream_.push((function(){r(null,(e=l).subarray(0,e.byteLength-e[e.byteLength-1]))

;/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
var e}))}e.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=function(e,t,i){var n,r,a,o,l,c,d,h,p,f=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),m=new s(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),v=new Int32Array(g.buffer)
n=i[0]
r=i[1]
a=i[2]
o=i[3]
for(p=0;p<f.length;p+=4){l=u(f[p])
c=u(f[p+1])
d=u(f[p+2])
h=u(f[p+3])
m.decrypt(l,c,d,h,v,p)
v[p]=u(v[p]^n)
v[p+1]=u(v[p+1]^r)
v[p+2]=u(v[p+2]^a)
v[p+3]=u(v[p+3]^o)
n=l
r=c
a=d
o=h}return g}(e,t,i)
n.set(r,e.byteOffset)}}
t(e,null,[{key:"STEP",get:function(){return 32e3}}])
return e}()
self.onmessage=function(e){var t=e.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),n=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),r=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4)
new l(i,n,r,(function(e,i){self.postMessage(function(e){var t={}
Object.keys(e).forEach((function(i){var n=e[i]
ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n}))
return t}({source:t.source,decrypted:i}),[i.buffer])}))}}))),Oh=od(Ah),Lh=function(e){var t=e.default?"main":"alternative"
e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc")
return t},Dh=function(e,t){e.abort()
e.pause()
if(t&&t.activePlaylistLoader){t.activePlaylistLoader.pause()
t.activePlaylistLoader=null}},Rh=function(e,t){t.activePlaylistLoader=e
e.load()},Mh={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist
Dh(i,n)
var a=n.activeTrack(),s=n.activeGroup(),o=(s.filter((function(e){return e.default}))[0]||s[0]).id,u=n.tracks[o]
if(a!==u){ql.log.warn("Problem encountered loading the alternate audio track.Switching back to default.")
for(var l in n.tracks)n.tracks[l].enabled=n.tracks[l]===u
n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e]
ql.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.")
Dh(i,n)
var r=n.activeTrack()
r&&(r.mode="disabled")
n.onTrackChanged()}}},Nh={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e]
t.on("loadedmetadata",(function(){var e=t.media()
a.playlist(e,r);(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()}))
t.on("loadedplaylist",(function(){a.playlist(t.media(),r)
n.paused()||a.load()}))
t.on("error",Mh[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e]
t.on("loadedmetadata",(function(){var e=t.media()
a.playlist(e,r)
a.track(s.activeTrack());(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()}))
t.on("loadedplaylist",(function(){a.playlist(t.media(),r)
n.paused()||a.load()}))
t.on("error",Mh[e](e,i))}},Uh={AUDIO:function(e,t){var i=t.vhs,n=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],u=o.groups,l=o.tracks,c=o.logger_,d=t.masterPlaylistLoader,h=Tc(d.master)
if(!s[e]||0===Object.keys(s[e]).length){s[e]={main:{default:{default:!0}}}
h&&(s[e].main.default.playlists=d.master.playlists)}for(var p in s[e]){u[p]||(u[p]=[])
for(var f in s[e][p]){var m=s[e][p][f],g=void 0
if(h){c("AUDIO group '"+p+"' label '"+f+"' is a master playlist")
m.isMasterPlaylist=!0
g=null}else g="vhs-json"===n&&m.playlists?new Nc(m.playlists[0],i,a):m.resolvedUri?new Nc(m.resolvedUri,i,a):m.playlists&&"dash"===n?new rd(m.playlists[0],i,a,d):null
m=ql.mergeOptions({id:f,playlistLoader:g},m)
Nh[e](e,m.playlistLoader,t)
u[p].push(m)
if(void 0===l[f]){var v=new ql.AudioTrack({id:f,kind:Lh(m),enabled:!1,language:m.language,default:m.default,label:f})
l[f]=v}}}r.on("error",Mh[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,u=t.mediaTypes[e],l=u.groups,c=u.tracks,d=t.masterPlaylistLoader
for(var h in o[e]){l[h]||(l[h]=[])
for(var p in o[e][h])if(!o[e][h][p].forced){var f=o[e][h][p],m=void 0
if("hls"===r)m=new Nc(f.resolvedUri,n,s)
else if("dash"===r){if(!f.playlists.filter((function(e){return e.excludeUntil!==1/0})).length)return
m=new rd(f.playlists[0],n,s,d)}else"vhs-json"===r&&(m=new Nc(f.playlists?f.playlists[0]:f.resolvedUri,n,s))
f=ql.mergeOptions({id:p,playlistLoader:m},f)
Nh[e](e,f.playlistLoader,t)
l[h].push(f)
if(void 0===c[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track
c[p]=g}}}a.on("error",Mh[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks
for(var o in n[e]){a[o]||(a[o]=[])
for(var u in n[e][o]){var l=n[e][o][u]
if(/^(?:CC|SERVICE)/.test(l.instreamId)){var c=i.options_.vhs&&i.options_.vhs.captionServices||{},d={label:u,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect}
c[d.instreamId]&&(d=ql.mergeOptions(d,c[d.instreamId]))
void 0===d.default&&delete d.default
a[o].push(ql.mergeOptions({id:u},l))
if(void 0===s[u]){var h=i.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track
s[u]=h}}}}}},Bh=function e(t,i){for(var n=0;n<t.length;n++){if(_c(i,t[n]))return!0
if(t[n].playlists&&e(t[n].playlists,i))return!0}return!1},Fh={AUDIO:function(e,t){return function(){var i=t.mediaTypes[e].tracks
for(var n in i)if(i[n].enabled)return i[n]
return null}},SUBTITLES:function(e,t){return function(){var i=t.mediaTypes[e].tracks
for(var n in i)if("showing"===i[n].mode||"hidden"===i[n].mode)return i[n]
return null}}},jh=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){Uh[t](t,e)}))
var t=e.mediaTypes,i=e.masterPlaylistLoader,n=e.tech,r=e.vhs,a=e.segmentLoaders,s=a.AUDIO,o=a.main;["AUDIO","SUBTITLES"].forEach((function(i){t[i].activeGroup=function(e,t){return function(i){var n=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,a=n.media()
if(!a)return null
var s=null
a.attributes[e]&&(s=r[a.attributes[e]])
var o=Object.keys(r)
if(!s)if("AUDIO"===e&&o.length>1&&Tc(t.master))for(var u=0;u<o.length;u++){var l=r[o[u]]
if(Bh(l,a)){s=l
break}}else r.main?s=r.main:1===o.length&&(s=r[o[0]])
return void 0===i?s:null!==i&&s&&s.filter((function(e){return e.id===i.id}))[0]||null}}(i,e)
t[i].activeTrack=Fh[i](i,e)
t[i].onGroupChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.getActiveGroup(),u=a.activePlaylistLoader,l=a.lastGroup_
if(!o||!l||o.id!==l.id){a.lastGroup_=o
a.lastTrack_=s
Dh(n,a)
if(o&&!o.isMasterPlaylist)if(o.playlistLoader){n.resyncLoader()
Rh(o.playlistLoader,a)}else u&&r.resetEverything()}}}(i,e)
t[i].onGroupChanging=function(e,t){return function(){var i=t.segmentLoaders[e]
t.mediaTypes[e].lastGroup_=null
i.abort()
i.pause()}}(i,e)
t[i].onTrackChanged=function(e,t){return function(){var i=t.masterPlaylistLoader,n=t.segmentLoaders,r=n[e],a=n.main,s=t.mediaTypes[e],o=s.activeTrack(),u=s.getActiveGroup(),l=s.activePlaylistLoader,c=s.lastTrack_
if(!c||!o||c.id!==o.id){s.lastGroup_=u
s.lastTrack_=o
Dh(r,s)
if(u)if(u.isMasterPlaylist){if(!o||!c||o.id===c.id)return
var d=t.vhs.masterPlaylistController_,h=d.selectPlaylist()
if(d.media()===h)return
s.logger_("track change. Switching master audio from "+c.id+" to "+o.id)
i.pause()
a.resetEverything()
d.fastQualityChange_(h)}else{if("AUDIO"===e){if(!u.playlistLoader){a.setAudio(!0)
a.resetEverything()
return}r.setAudio(!0)
a.setAudio(!1)}if(l!==u.playlistLoader){r.track&&r.track(o)
r.resetEverything()
Rh(u.playlistLoader,s)}else Rh(u.playlistLoader,s)}}}}(i,e)
t[i].getActiveGroup=function(e,t){var i=t.mediaTypes
return function(){var t=i[e].activeTrack()
return t?i[e].activeGroup(t):null}}(i,e)}))
var u=t.AUDIO.activeGroup()
if(u){var l=(u.filter((function(e){return e.default}))[0]||u[0]).id
t.AUDIO.tracks[l].enabled=!0
t.AUDIO.onGroupChanged()
t.AUDIO.onTrackChanged()
if(t.AUDIO.getActiveGroup().playlistLoader){o.setAudio(!1)
s.setAudio(!0)}else o.setAudio(!0)}i.on("mediachange",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanged()}))}))
i.on("mediachanging",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanging()}))}))
var c=function(){t.AUDIO.onTrackChanged()
n.trigger({type:"usage",name:"vhs-audio-change"})
n.trigger({type:"usage",name:"hls-audio-change"})}
n.audioTracks().addEventListener("change",c)
n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged)
r.on("dispose",(function(){n.audioTracks().removeEventListener("change",c)
n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}))
n.clearTracks("audio")
for(var d in t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[d])},Vh=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Hh=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},qh=function(e){B(t,e)
function t(t){var i
i=e.call(this)||this
var n=t.src,r=t.handleManifestRedirects,a=t.withCredentials,s=t.tech,o=t.bandwidth,u=t.externVhs,l=t.useCueTags,c=t.blacklistDuration,d=t.enableLowInitialPlaylist,h=t.sourceType,p=t.cacheEncryptionKeys,f=t.experimentalBufferBasedABR,m=t.experimentalLeastPixelDiffSelector,g=t.captionServices
if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required")
var v=t.maxPlaylistRetries
null==v&&(v=1/0)
nh=u
i.experimentalBufferBasedABR=Boolean(f)
i.experimentalLeastPixelDiffSelector=Boolean(m)
i.withCredentials=a
i.tech_=s
i.vhs_=s.vhs
i.sourceType_=h
i.useCueTags_=l
i.blacklistDuration=c
i.maxPlaylistRetries=v
i.enableLowInitialPlaylist=d
if(i.useCueTags_){i.cueTagsTrack_=i.tech_.addTextTrack("metadata","ad-cues")
i.cueTagsTrack_.inBandMetadataTrackDispatchType=""}i.requestOptions_={withCredentials:a,handleManifestRedirects:r,maxPlaylistRetries:v,timeout:null}
i.on("error",i.pauseLoading)
i.mediaTypes_=function(){var e={};["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:ih,activeTrack:ih,getActiveGroup:ih,onGroupChanged:ih,onTrackChanged:ih,lastTrack_:null,logger_:Xl("MediaGroups["+t+"]")}}))
return e}()
i.mediaSource=new x.MediaSource
i.handleDurationChange_=i.handleDurationChange_.bind(N(i))
i.handleSourceOpen_=i.handleSourceOpen_.bind(N(i))
i.handleSourceEnded_=i.handleSourceEnded_.bind(N(i))
i.mediaSource.addEventListener("durationchange",i.handleDurationChange_)
i.mediaSource.addEventListener("sourceopen",i.handleSourceOpen_)
i.mediaSource.addEventListener("sourceended",i.handleSourceEnded_)
i.seekable_=ql.createTimeRanges()
i.hasPlayed_=!1
i.syncController_=new Ph(t)
i.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track
i.decrypter_=new Oh
i.sourceUpdater_=new kh(i.mediaSource)
i.inbandTextTracks_={}
i.timelineChangeController_=new xh
var y={vhs:i.vhs_,parse708captions:t.parse708captions,useDtsForTimestampOffset:t.useDtsForTimestampOffset,captionServices:g,mediaSource:i.mediaSource,currentTime:i.tech_.currentTime.bind(i.tech_),seekable:function(){return i.seekable()},seeking:function(){return i.tech_.seeking()},duration:function(){return i.duration()},hasPlayed:function(){return i.hasPlayed_},goalBufferLength:function(){return i.goalBufferLength()},bandwidth:o,syncController:i.syncController_,decrypter:i.decrypter_,sourceType:i.sourceType_,inbandTextTracks:i.inbandTextTracks_,cacheEncryptionKeys:p,sourceUpdater:i.sourceUpdater_,timelineChangeController:i.timelineChangeController_,experimentalExactManifestTimings:t.experimentalExactManifestTimings}
i.masterPlaylistLoader_="dash"===i.sourceType_?new rd(n,i.vhs_,i.requestOptions_):new Nc(n,i.vhs_,i.requestOptions_)
i.setupMasterPlaylistLoaderListeners_()
i.mainSegmentLoader_=new th(ql.mergeOptions(y,{segmentMetadataTrack:i.segmentMetadataTrack_,loaderType:"main"}),t)
i.audioSegmentLoader_=new th(ql.mergeOptions(y,{loaderType:"audio"}),t)
i.subtitleSegmentLoader_=new Ch(ql.mergeOptions(y,{loaderType:"vtt",featuresNativeTextTracks:i.tech_.featuresNativeTextTracks}),t)
i.setupSegmentLoaderListeners_()
if(i.experimentalBufferBasedABR){i.masterPlaylistLoader_.one("loadedplaylist",(function(){return i.startABRTimer_()}))
i.tech_.on("pause",(function(){return i.stopABRTimer_()}))
i.tech_.on("play",(function(){return i.startABRTimer_()}))}Vh.forEach((function(e){i[e+"_"]=Hh.bind(N(i),e)}))
i.logger_=Xl("MPC")
i.triggeredFmp4Usage=!1
if("none"===i.tech_.preload()){i.loadOnPlay_=function(){i.loadOnPlay_=null
i.masterPlaylistLoader_.load()}
i.tech_.one("play",i.loadOnPlay_)}else i.masterPlaylistLoader_.load()
i.timeToLoadedData__=-1
i.mainAppendsToLoadedData__=-1
i.audioAppendsToLoadedData__=-1
var _="none"===i.tech_.preload()?"play":"loadstart"
i.tech_.one(_,(function(){var e=Date.now()
i.tech_.one("loadeddata",(function(){i.timeToLoadedData__=Date.now()-e
i.mainAppendsToLoadedData__=i.mainSegmentLoader_.mediaAppends
i.audioAppendsToLoadedData__=i.audioSegmentLoader_.mediaAppends}))}))
return i}var i=t.prototype
i.mainAppendsToLoadedData_=function(){return this.mainAppendsToLoadedData__}
i.audioAppendsToLoadedData_=function(){return this.audioAppendsToLoadedData__}
i.appendsToLoadedData_=function(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_()
return-1===e||-1===t?-1:e+t}
i.timeToLoadedData_=function(){return this.timeToLoadedData__}
i.checkABR_=function(){var e=this.selectPlaylist()
e&&this.shouldSwitchToMedia_(e)&&this.switchMedia_(e,"abr")}
i.switchMedia_=function(e,t,i){var n=this.media(),r=n&&(n.id||n.uri),a=e.id||e.uri
if(r&&r!==a){this.logger_("switch media "+r+" -> "+a+" from "+t)
this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})}this.masterPlaylistLoader_.media(e,i)}
i.startABRTimer_=function(){var e=this
this.stopABRTimer_()
this.abrTimer_=x.setInterval((function(){return e.checkABR_()}),250)}
i.stopABRTimer_=function(){if(!this.tech_.scrubbing||!this.tech_.scrubbing()){x.clearInterval(this.abrTimer_)
this.abrTimer_=null}}
i.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[]
if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t
var i,n=e.mediaGroups.AUDIO,r=Object.keys(n)
if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack()
else{var a=n.main||r.length&&n[r[0]]
for(var s in a)if(a[s].default){i={label:s}
break}}if(!i)return t
var o=[]
for(var u in n)if(n[u][i.label]){var l=n[u][i.label]
if(l.playlists&&l.playlists.length)o.push.apply(o,l.playlists)
else if(l.uri)o.push(l)
else if(e.playlists.length)for(var c=0;c<e.playlists.length;c++){var d=e.playlists[c]
d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===u&&o.push(d)}}return o.length?o:t}
i.setupMasterPlaylistLoaderListeners_=function(){var e=this
this.masterPlaylistLoader_.on("loadedmetadata",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3
yc(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i
if(t.endList&&"none"!==e.tech_.preload()){e.mainSegmentLoader_.playlist(t,e.requestOptions_)
e.mainSegmentLoader_.load()}jh({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,masterPlaylistLoader:e.masterPlaylistLoader_,vhs:e.vhs_,master:e.master(),mediaTypes:e.mediaTypes_,blacklistCurrentPlaylist:e.blacklistCurrentPlaylist.bind(e)})
e.triggerPresenceUsage_(e.master(),t)
e.setupFirstPlay()
!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(function(){e.trigger("selectedinitialmedia")}))}))
this.masterPlaylistLoader_.on("loadedplaylist",(function(){e.loadOnPlay_&&e.tech_.off("play",e.loadOnPlay_)
var t=e.masterPlaylistLoader_.media()
if(!t){e.excludeUnsupportedVariants_()
var i
e.enableLowInitialPlaylist&&(i=e.selectInitialPlaylist())
i||(i=e.selectPlaylist())
if(!i||!e.shouldSwitchToMedia_(i))return
e.initialMedia_=i
e.switchMedia_(e.initialMedia_,"initial")
if(!("vhs-json"===e.sourceType_&&e.initialMedia_.segments))return
t=e.initialMedia_}e.handleUpdatedMediaPlaylist(t)}))
this.masterPlaylistLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)}))
this.masterPlaylistLoader_.on("mediachanging",(function(){e.mainSegmentLoader_.abort()
e.mainSegmentLoader_.pause()}))
this.masterPlaylistLoader_.on("mediachange",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3
yc(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i
e.mainSegmentLoader_.playlist(t,e.requestOptions_)
e.mainSegmentLoader_.load()
e.tech_.trigger({type:"mediachange",bubbles:!0})}))
this.masterPlaylistLoader_.on("playlistunchanged",(function(){var t=e.masterPlaylistLoader_.media()
if("playlist-unchanged"!==t.lastExcludeReason_){if(e.stuckAtPlaylistEnd_(t)){e.blacklistCurrentPlaylist({message:"Playlist no longer updating.",reason:"playlist-unchanged"})
e.tech_.trigger("playliststuck")}}}))
this.masterPlaylistLoader_.on("renditiondisabled",(function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})
e.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})}))
this.masterPlaylistLoader_.on("renditionenabled",(function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})
e.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})}))}
i.handleUpdatedMediaPlaylist=function(e){this.useCueTags_&&this.updateAdCues_(e)
this.mainSegmentLoader_.playlist(e,this.requestOptions_)
this.updateDuration(!e.endList)
if(!this.tech_.paused()){this.mainSegmentLoader_.load()
this.audioSegmentLoader_&&this.audioSegmentLoader_.load()}}
i.triggerPresenceUsage_=function(e,t){var i=e.mediaGroups||{},n=!0,r=Object.keys(i.AUDIO)
for(var a in i.AUDIO)for(var s in i.AUDIO[a]){i.AUDIO[a][s].uri||(n=!1)}if(n){this.tech_.trigger({type:"usage",name:"vhs-demuxed"})
this.tech_.trigger({type:"usage",name:"hls-demuxed"})}if(Object.keys(i.SUBTITLES).length){this.tech_.trigger({type:"usage",name:"vhs-webvtt"})
this.tech_.trigger({type:"usage",name:"hls-webvtt"})}if(nh.Playlist.isAes(t)){this.tech_.trigger({type:"usage",name:"vhs-aes"})
this.tech_.trigger({type:"usage",name:"hls-aes"})}if(r.length&&Object.keys(i.AUDIO[r[0]]).length>1){this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"})
this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})}if(this.useCueTags_){this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})
this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}}
i.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine()
return function(e){var t=e.currentPlaylist,i=e.buffered,n=e.currentTime,r=e.nextPlaylist,a=e.bufferLowWaterLine,s=e.bufferHighWaterLine,o=e.duration,u=e.experimentalBufferBasedABR,l=e.log
if(!r){ql.log.warn("We received no playlist to switch to. Please check your stream.")
return!1}var c="allowing switch "+(t&&t.id||"null")+" -> "+r.id
if(!t){l(c+" as current playlist is not set")
return!0}if(r.id===t.id)return!1
var d=Boolean(Jl(i,n).length)
if(!t.endList){if(!d&&"number"==typeof t.partTargetDuration){l("not "+c+" as current playlist is live llhls, but currentTime isn't in buffered.")
return!1}l(c+" as current playlist is live")
return!0}var h=nc(i,n),p=u?ad.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:ad.MAX_BUFFER_LOW_WATER_LINE
if(o<p){l(c+" as duration < max low water line ("+o+" < "+p+")")
return!0}var f=r.attributes.BANDWIDTH,m=t.attributes.BANDWIDTH
if(f<m&&(!u||h<s)){var g=c+" as next bandwidth < current bandwidth ("+f+" < "+m+")"
u&&(g+=" and forwardBuffer < bufferHighWaterLine ("+h+" < "+s+")")
l(g)
return!0}if((!u||f>m)&&h>=a){var v=c+" as forwardBuffer >= bufferLowWaterLine ("+h+" >= "+a+")"
u&&(v+=" and next bandwidth > current bandwidth ("+f+" > "+m+")")
l(v)
return!0}l("not "+c+" as no switching criteria met")
return!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})}
i.setupSegmentLoaderListeners_=function(){var e=this
if(!this.experimentalBufferBasedABR){this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist()
e.shouldSwitchToMedia_(t)&&e.switchMedia_(t,"bandwidthupdate")
e.tech_.trigger("bandwidthupdate")}))
this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")}))}this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())}))
this.mainSegmentLoader_.on("appenderror",(function(){e.error=e.mainSegmentLoader_.error_
e.trigger("error")}))
this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()}))
this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})
e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})}))
this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()}))
this.audioSegmentLoader_.on("appenderror",(function(){e.error=e.audioSegmentLoader_.error_
e.trigger("error")}))
this.mainSegmentLoader_.on("ended",(function(){e.logger_("main segment loader ended")
e.onEndOfStream()}))
this.mainSegmentLoader_.on("earlyabort",(function(t){if(!e.experimentalBufferBasedABR){e.delegateLoaders_("all",["abort"])
e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)}}))
var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_()
var t=e.getCodecsOrExclude_()
t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)}
this.mainSegmentLoader_.on("trackinfo",t)
this.audioSegmentLoader_.on("trackinfo",t)
this.mainSegmentLoader_.on("fmp4",(function(){if(!e.triggeredFmp4Usage){e.tech_.trigger({type:"usage",name:"vhs-fmp4"})
e.tech_.trigger({type:"usage",name:"hls-fmp4"})
e.triggeredFmp4Usage=!0}}))
this.audioSegmentLoader_.on("fmp4",(function(){if(!e.triggeredFmp4Usage){e.tech_.trigger({type:"usage",name:"vhs-fmp4"})
e.tech_.trigger({type:"usage",name:"hls-fmp4"})
e.triggeredFmp4Usage=!0}}))
this.audioSegmentLoader_.on("ended",(function(){e.logger_("audioSegmentLoader ended")
e.onEndOfStream()}))}
i.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}
i.load=function(){this.mainSegmentLoader_.load()
this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load()
this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}
i.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist())
this.fastQualityChange_(e)}
i.fastQualityChange_=function(e){var t=this
void 0===e&&(e=this.selectPlaylist())
if(e!==this.masterPlaylistLoader_.media()){this.switchMedia_(e,"fast-quality")
this.mainSegmentLoader_.resetEverything((function(){ql.browser.IE_VERSION||ql.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))}else this.logger_("skipping fastQualityChange because new media is same as old")}
i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0)
this.hasPlayed_&&this.load()
var e=this.tech_.seekable()
return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}}
i.setupFirstPlay=function(){var e=this,t=this.masterPlaylistLoader_.media()
if(!t||this.tech_.paused()||this.hasPlayed_)return!1
if(!t.endList){var i=this.seekable()
if(!i.length)return!1
if(ql.browser.IE_VERSION&&0===this.tech_.readyState()){this.tech_.one("loadedmetadata",(function(){e.trigger("firstplay")
e.tech_.setCurrentTime(i.end(0))
e.hasPlayed_=!0}))
return!1}this.trigger("firstplay")
this.tech_.setCurrentTime(i.end(0))}this.hasPlayed_=!0
this.load()
return!0}
i.handleSourceOpen_=function(){this.tryToCreateSourceBuffers_()
if(this.tech_.autoplay()){var e=this.tech_.play()
void 0!==e&&"function"==typeof e.then&&e.then(null,(function(e){}))}this.trigger("sourceopen")}
i.handleSourceEnded_=function(){if(this.inbandTextTracks_.metadataTrack_){var e=this.inbandTextTracks_.metadataTrack_.cues
if(e&&e.length){var t=this.duration()
e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}}}
i.handleDurationChange_=function(){this.tech_.trigger("durationchange")}
i.onEndOfStream=function(){var e=this.mainSegmentLoader_.ended_
if(this.mediaTypes_.AUDIO.activePlaylistLoader){var t=this.mainSegmentLoader_.getCurrentMediaInfo_()
e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}if(e){this.stopABRTimer_()
this.sourceUpdater_.endOfStream()}}
i.stuckAtPlaylistEnd_=function(e){if(!this.seekable().length)return!1
var t=this.syncController_.getExpiredTime(e,this.duration())
if(null===t)return!1
var i=nh.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),r=this.tech_.buffered()
if(!r.length)return i-n<=Ql
var a=r.end(r.length-1)
return a-n<=Ql&&i-a<=Ql}
i.blacklistCurrentPlaylist=function(e,t){void 0===e&&(e={})
var i=e.playlist||this.masterPlaylistLoader_.media()
t=t||e.blacklistDuration||this.blacklistDuration
if(i){i.playlistErrors_++
var n,r=this.masterPlaylistLoader_.master.playlists,a=r.filter(gc),s=1===a.length&&a[0]===i
if(1===r.length&&t!==1/0){ql.log.warn("Problem encountered with playlist "+i.id+". Trying again since it is the only playlist.")
this.tech_.trigger("retryplaylist")
return this.masterPlaylistLoader_.load(s)}if(s){var o=!1
r.forEach((function(e){if(e!==i){var t=e.excludeUntil
if(void 0!==t&&t!==1/0){o=!0
delete e.excludeUntil}}}))
if(o){ql.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded.")
this.tech_.trigger("retryplaylist")}}n=i.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*t
i.excludeUntil=n
e.reason&&(i.lastExcludeReason_=e.reason)
this.tech_.trigger("blacklistplaylist")
this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"})
this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"})
var u=this.selectPlaylist()
if(u){var l=e.internal?this.logger_:ql.log.warn,c=e.message?" "+e.message:""
l((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+c+" Switching to playlist "+u.id+".")
u.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"])
u.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"])
this.delegateLoaders_("main",["abort","pause"])
var d=u.targetDuration/2*1e3||5e3,h="number"==typeof u.lastRequest&&Date.now()-u.lastRequest<=d
return this.switchMedia_(u,"exclude",s||h)}this.error="Playback cannot continue. No available working or supported playlists."
this.trigger("error")}else{this.error=e
"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network")}}
i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"])
this.stopABRTimer_()}
i.delegateLoaders_=function(e,t){var i=this,n=[],r="all"===e;(r||"main"===e)&&n.push(this.masterPlaylistLoader_)
var a=[];(r||"audio"===e)&&a.push("AUDIO")
if(r||"subtitle"===e){a.push("CLOSED-CAPTIONS")
a.push("SUBTITLES")}a.forEach((function(e){var t=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader
t&&n.push(t)}));["main","audio","subtitle"].forEach((function(t){var r=i[t+"SegmentLoader_"]
!r||e!==t&&"all"!==e||n.push(r)}))
n.forEach((function(e){return t.forEach((function(t){"function"==typeof e[t]&&e[t]()}))}))}
i.setCurrentTime=function(e){var t=Jl(this.tech_.buffered(),e)
if(!this.masterPlaylistLoader_||!this.masterPlaylistLoader_.media())return 0
if(!this.masterPlaylistLoader_.media().segments)return 0
if(t&&t.length)return e
this.mainSegmentLoader_.resetEverything()
this.mainSegmentLoader_.abort()
if(this.mediaTypes_.AUDIO.activePlaylistLoader){this.audioSegmentLoader_.resetEverything()
this.audioSegmentLoader_.abort()}if(this.mediaTypes_.SUBTITLES.activePlaylistLoader){this.subtitleSegmentLoader_.resetEverything()
this.subtitleSegmentLoader_.abort()}this.load()}
i.duration=function(){if(!this.masterPlaylistLoader_)return 0
var e=this.masterPlaylistLoader_.media()
return e?e.endList?this.mediaSource?this.mediaSource.duration:nh.Playlist.duration(e):1/0:0}
i.seekable=function(){return this.seekable_}
i.onSyncInfoUpdate_=function(){var e
if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media()
if(t){var i=this.syncController_.getExpiredTime(t,this.duration())
if(null!==i){var n=this.masterPlaylistLoader_.master,r=nh.Playlist.seekable(t,i,nh.Playlist.liveEdgeDelay(n,t))
if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){t=this.mediaTypes_.AUDIO.activePlaylistLoader.media()
if(null===(i=this.syncController_.getExpiredTime(t,this.duration())))return
if(0===(e=nh.Playlist.seekable(t,i,nh.Playlist.liveEdgeDelay(n,t))).length)return}var a,s
if(this.seekable_&&this.seekable_.length){a=this.seekable_.end(0)
s=this.seekable_.start(0)}e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=ql.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]]):this.seekable_=r
if(!this.seekable_||!this.seekable_.length||this.seekable_.end(0)!==a||this.seekable_.start(0)!==s){this.logger_("seekable updated ["+ec(this.seekable_)+"]")
this.tech_.trigger("seekablechanged")}}}}}}
i.updateDuration=function(e){if(this.updateDuration_){this.mediaSource.removeEventListener("sourceopen",this.updateDuration_)
this.updateDuration_=null}if("open"===this.mediaSource.readyState)if(e){var t=this.seekable()
if(!t.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1))}else{var i=this.tech_.buffered(),n=nh.Playlist.duration(this.masterPlaylistLoader_.media())
i.length>0&&(n=Math.max(n,i.end(i.length-1)))
this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}else{this.updateDuration_=this.updateDuration.bind(this,e)
this.mediaSource.addEventListener("sourceopen",this.updateDuration_)}}
i.dispose=function(){var e=this
this.trigger("dispose")
this.decrypter_.terminate()
this.masterPlaylistLoader_.dispose()
this.mainSegmentLoader_.dispose()
this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups
for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))}))
this.audioSegmentLoader_.dispose()
this.subtitleSegmentLoader_.dispose()
this.sourceUpdater_.dispose()
this.timelineChangeController_.dispose()
this.stopABRTimer_()
this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_)
this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_)
this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_)
this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_)
this.off()}
i.master=function(){return this.masterPlaylistLoader_.master}
i.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}
i.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_()
return!(!t||!i)}
i.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}}
t.video=t.main
var i=Bd(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader
t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||"avc1.4d400d")
t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||Qe))
if(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r){n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||Qe
t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4}if(n.audio||n.video){var a,s={};["video","audio"].forEach((function(e){if(n.hasOwnProperty(e)&&!(r=t[e].isFmp4,o=n[e],r?Xe(o):Ye(o))){var i=t[e].isFmp4?"browser":"muxer"
s[i]=s[i]||[]
s[i].push(n[e])
"audio"===e&&(a=i)}var r,o}))
if(r&&a&&this.media().attributes.AUDIO){var o=this.media().attributes.AUDIO
this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===o&&t!==e.media()&&(t.excludeUntil=1/0)}))
this.logger_("excluding audio group "+o+" as "+a+' does not support codec(s): "'+n.audio+'"')}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var u=[];["video","audio"].forEach((function(t){var i=(Ge(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(Ge(n[t]||"")[0]||{}).type
i&&r&&i.toLowerCase()!==r.toLowerCase()&&u.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+n[t]+'"')}))
if(u.length){this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+u.join(", ")+".",blacklistDuration:1/0,internal:!0})
return}}return n}var l=Object.keys(s).reduce((function(e,t){e&&(e+=", ")
return e+=t+' does not support codec(s): "'+s[t].join(",")+'"'}),"")+"."
this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:l,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})}
i.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_()
if(e){this.sourceUpdater_.createSourceBuffers(e)
var t=[e.video,e.audio].filter(Boolean).join(",")
this.excludeIncompatibleVariants_(t)}}}
i.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,i=[]
Object.keys(t).forEach((function(n){var r=t[n]
if(-1===i.indexOf(r.id)){i.push(r.id)
var a=Bd(e.master,r),s=[]
!a.audio||Ye(a.audio)||Xe(a.audio)||s.push("audio codec "+a.audio)
!a.video||Ye(a.video)||Xe(a.video)||s.push("video codec "+a.video)
a.text&&"stpp.ttml.im1t"===a.text&&s.push("text codec "+a.text)
if(s.length){r.excludeUntil=1/0
e.logger_("excluding "+r.id+" for unsupported: "+s.join(", "))}}}))}
i.excludeIncompatibleVariants_=function(e){var t=this,i=[],n=this.master().playlists,r=Nd(Ge(e)),a=Ud(r),s=r.video&&Ge(r.video)[0]||null,o=r.audio&&Ge(r.audio)[0]||null
Object.keys(n).forEach((function(e){var r=n[e]
if(-1===i.indexOf(r.id)&&r.excludeUntil!==1/0){i.push(r.id)
var u=[],l=Bd(t.masterPlaylistLoader_.master,r),c=Ud(l)
if(l.audio||l.video){c!==a&&u.push('codec count "'+c+'" !== "'+a+'"')
if(!t.sourceUpdater_.canChangeType()){var d=l.video&&Ge(l.video)[0]||null,h=l.audio&&Ge(l.audio)[0]||null
d&&s&&d.type.toLowerCase()!==s.type.toLowerCase()&&u.push('video codec "'+d.type+'" !== "'+s.type+'"')
h&&o&&h.type.toLowerCase()!==o.type.toLowerCase()&&u.push('audio codec "'+h.type+'" !== "'+o.type+'"')}if(u.length){r.excludeUntil=1/0
t.logger_("blacklisting "+r.id+": "+u.join(" && "))}}}}))}
i.updateAdCues_=function(e){var t=0,i=this.seekable()
i.length&&(t=i.start(0))
!function(e,t,i){void 0===i&&(i=0)
if(e.segments)for(var n,r=i,a=0;a<e.segments.length;a++){var s=e.segments[a]
n||(n=wh(t,r+s.duration/2))
if(n){if("cueIn"in s){n.endTime=r
n.adEndTime=r
r+=s.duration
n=null
continue}if(r<n.endTime){r+=s.duration
continue}n.endTime+=s.duration}else{if("cueOut"in s){(n=new x.VTTCue(r,r+s.duration,s.cueOut)).adStartTime=r
n.adEndTime=r+parseFloat(s.cueOut)
t.addCue(n)}if("cueOutCont"in s){var o=s.cueOutCont.split("/").map(parseFloat),u=o[0],l=o[1];(n=new x.VTTCue(r,r+s.duration,"")).adStartTime=r-u
n.adEndTime=n.adStartTime+l
t.addCue(n)}}r+=s.duration}}(e,this.cueTagsTrack_,t)}
i.goalBufferLength=function(){var e=this.tech_.currentTime(),t=ad.GOAL_BUFFER_LENGTH,i=ad.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,ad.MAX_GOAL_BUFFER_LENGTH)
return Math.min(t+e*i,n)}
i.bufferLowWaterLine=function(){var e=this.tech_.currentTime(),t=ad.BUFFER_LOW_WATER_LINE,i=ad.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,ad.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,ad.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE)
return Math.min(t+e*i,this.experimentalBufferBasedABR?r:n)}
i.bufferHighWaterLine=function(){return ad.BUFFER_HIGH_WATER_LINE}
return t}(ql.EventTarget),Wh=function(e,t,i){var n,r,a,s=e.masterPlaylistController_,o=s[(e.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(s)
if(t.attributes){var u=t.attributes.RESOLUTION
this.width=u&&u.width
this.height=u&&u.height
this.bandwidth=t.attributes.BANDWIDTH}this.codecs=Bd(s.master(),t)
this.playlist=t
this.id=i
this.enabled=(n=e.playlists,r=t.id,a=o,function(e){var t=n.master.playlists[r],i=mc(t),s=gc(t)
if(void 0===e)return s
e?delete t.disabled:t.disabled=!0
if(e!==s&&!i){a()
e?n.trigger("renditionenabled"):n.trigger("renditiondisabled")}return e})},Gh=["seeking","seeked","pause","playing","error"],zh=function(){function e(e){var t=this
this.masterPlaylistController_=e.masterPlaylistController
this.tech_=e.tech
this.seekable=e.seekable
this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow
this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta
this.media=e.media
this.consecutiveUpdates=0
this.lastRecordedTime=null
this.timer_=null
this.checkCurrentTimeTimeout_=null
this.logger_=Xl("PlaybackWatcher")
this.logger_("initialize")
var i=function(){return t.monitorCurrentTime_()},n=function(){return t.monitorCurrentTime_()},r=function(){return t.techWaiting_()},a=function(){return t.cancelTimer_()},s=this.masterPlaylistController_,o=["main","subtitle","audio"],u={}
o.forEach((function(e){u[e]={reset:function(){return t.resetSegmentDownloads_(e)},updateend:function(){return t.checkSegmentDownloads_(e)}}
s[e+"SegmentLoader_"].on("appendsdone",u[e].updateend)
s[e+"SegmentLoader_"].on("playlistupdate",u[e].reset)
t.tech_.on(["seeked","seeking"],u[e].reset)}))
var l=function(e){["main","audio"].forEach((function(i){s[i+"SegmentLoader_"][e]("appended",t.seekingAppendCheck_)}))}
this.seekingAppendCheck_=function(){if(t.fixesBadSeeks_()){t.consecutiveUpdates=0
t.lastRecordedTime=t.tech_.currentTime()
l("off")}}
this.clearSeekingAppendCheck_=function(){return l("off")}
this.watchForBadSeeking_=function(){t.clearSeekingAppendCheck_()
l("on")}
this.tech_.on("seeked",this.clearSeekingAppendCheck_)
this.tech_.on("seeking",this.watchForBadSeeking_)
this.tech_.on("waiting",r)
this.tech_.on(Gh,a)
this.tech_.on("canplay",n)
this.tech_.one("play",i)
this.dispose=function(){t.clearSeekingAppendCheck_()
t.logger_("dispose")
t.tech_.off("waiting",r)
t.tech_.off(Gh,a)
t.tech_.off("canplay",n)
t.tech_.off("play",i)
t.tech_.off("seeking",t.watchForBadSeeking_)
t.tech_.off("seeked",t.clearSeekingAppendCheck_)
o.forEach((function(e){s[e+"SegmentLoader_"].off("appendsdone",u[e].updateend)
s[e+"SegmentLoader_"].off("playlistupdate",u[e].reset)
t.tech_.off(["seeked","seeking"],u[e].reset)}))
t.checkCurrentTimeTimeout_&&x.clearTimeout(t.checkCurrentTimeTimeout_)
t.cancelTimer_()}}var t=e.prototype
t.monitorCurrentTime_=function(){this.checkCurrentTime_()
this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_)
this.checkCurrentTimeTimeout_=x.setTimeout(this.monitorCurrentTime_.bind(this),250)}
t.resetSegmentDownloads_=function(e){var t=this.masterPlaylistController_[e+"SegmentLoader_"]
this[e+"StalledDownloads_"]>0&&this.logger_("resetting possible stalled download count for "+e+" loader")
this[e+"StalledDownloads_"]=0
this[e+"Buffered_"]=t.buffered_()}
t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e===t)return!1
if(!e&&t||!t&&e)return!0
if(e.length!==t.length)return!0
for(var i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0
return!1}(this[e+"Buffered_"],n)
this[e+"Buffered_"]=n
if(r)this.resetSegmentDownloads_(e)
else{this[e+"StalledDownloads_"]++
this.logger_("found #"+this[e+"StalledDownloads_"]+" "+e+" appends that did not increase buffer (possible stalled download)",{playlistId:i.playlist_&&i.playlist_.id,buffered:tc(n)})
if(!(this[e+"StalledDownloads_"]<10)){this.logger_(e+" loader stalled download exclusion")
this.resetSegmentDownloads_(e)
this.tech_.trigger({type:"usage",name:"vhs-"+e+"-download-exclusion"})
"subtitle"!==e&&t.blacklistCurrentPlaylist({message:"Excessive "+e+" segment downloading detected."},1/0)}}}
t.checkCurrentTime_=function(){if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered()
if(this.lastRecordedTime===e&&(!t.length||e+Ql>=t.end(t.length-1)))return this.techWaiting_()
if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime){this.consecutiveUpdates++
this.waiting_()}else if(e===this.lastRecordedTime)this.consecutiveUpdates++
else{this.consecutiveUpdates=0
this.lastRecordedTime=e}}}
t.cancelTimer_=function(){this.consecutiveUpdates=0
if(this.timer_){this.logger_("cancelTimer_")
clearTimeout(this.timer_)}this.timer_=null}
t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1
var e,t=this.seekable(),i=this.tech_.currentTime()
if(this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)){e=t.end(t.length-1)}if(this.beforeSeekableWindow_(t,i)){var n=t.start(0)
e=n+(n===t.end(0)?0:Ql)}if(void 0!==e){this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+ec(t)+". Seeking to "+e+".")
this.tech_.setCurrentTime(e)
return!0}for(var r=this.masterPlaylistController_.sourceUpdater_,a=this.tech_.buffered(),s=r.audioBuffer?r.audioBuffered():null,o=r.videoBuffer?r.videoBuffered():null,u=this.media(),l=u.partTargetDuration?u.partTargetDuration:2*(u.targetDuration-Yl),c=[s,o],d=0;d<c.length;d++)if(c[d]){if(nc(c[d],i)<l)return!1}var h=Zl(a,i)
if(0===h.length)return!1
e=h.start(0)+Ql
this.logger_("Buffered region starts ("+h.start(0)+")  just beyond seek point ("+i+"). Seeking to "+e+".")
this.tech_.setCurrentTime(e)
return!0}
t.waiting_=function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),i=Jl(t,e)
if(i.length&&e+3<=i.end(0)){this.cancelTimer_()
this.tech_.setCurrentTime(e)
this.logger_("Stopped at "+e+" while inside a buffered region ["+i.start(0)+" -> "+i.end(0)+"]. Attempting to resume playback by seeking to the current time.")
this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})
this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})}else;}}
t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime()
if(this.tech_.seeking()||null!==this.timer_)return!0
if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1)
this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i)
this.cancelTimer_()
this.tech_.setCurrentTime(i)
this.tech_.trigger({type:"usage",name:"vhs-live-resync"})
this.tech_.trigger({type:"usage",name:"hls-live-resync"})
return!0}var n=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered()
if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t})){this.cancelTimer_()
this.tech_.setCurrentTime(t)
this.tech_.trigger({type:"usage",name:"vhs-video-underflow"})
this.tech_.trigger({type:"usage",name:"hls-video-underflow"})
return!0}var a=Zl(r,t)
if(a.length>0){var s=a.start(0)-t
this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+a.start(0))
this.cancelTimer_()
this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t)
return!0}return!1}
t.afterSeekableWindow_=function(e,t,i,n){void 0===n&&(n=!1)
if(!e.length)return!1
var r=e.end(e.length-1)+Ql
!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration)
return t>r}
t.beforeSeekableWindow_=function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}
t.videoUnderflow_=function(e){var t=e.videoBuffered,i=e.audioBuffered,n=e.currentTime
if(t){var r
if(t.length&&i.length){var a=Jl(t,n-3),s=Jl(t,n),o=Jl(i,n)
o.length&&!s.length&&a.length&&(r={start:a.end(0),end:o.end(0)})}else{Zl(t,n).length||(r=this.gapFromVideoUnderflow_(t,n))}if(r){this.logger_("Encountered a gap in video from "+r.start+" to "+r.end+". Seeking to current time "+n)
return!0}return!1}}
t.skipTheGap_=function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),n=Zl(t,i)
this.cancelTimer_()
if(0!==n.length&&i===e){this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0))
this.tech_.setCurrentTime(n.start(0)+Yl)
this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})
this.tech_.trigger({type:"usage",name:"hls-gap-skip"})}}
t.gapFromVideoUnderflow_=function(e,t){for(var i=function(e){if(e.length<2)return ql.createTimeRanges()
for(var t=[],i=1;i<e.length;i++){var n=e.end(i-1),r=e.start(i)
t.push([n,r])}return ql.createTimeRanges(t)}(e),n=0;n<i.length;n++){var r=i.start(n),a=i.end(n)
if(t-r<4&&t-r>2)return{start:r,end:a}}return null}
return e}(),Kh={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Xh=function e(t,i){var n=0,r=0,a=ql.mergeOptions(Kh,i)
t.ready((function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"})
t.trigger({type:"usage",name:"hls-error-reload-initialized"})}))
var s=function(){r&&t.currentTime(r)},o=function(e){if(null!=e){r=t.duration()!==1/0&&t.currentTime()||0
t.one("loadedmetadata",s)
t.src(e)
t.trigger({type:"usage",name:"vhs-error-reload"})
t.trigger({type:"usage",name:"hls-error-reload"})
t.play()}},u=function(){if(Date.now()-n<1e3*a.errorInterval){t.trigger({type:"usage",name:"vhs-error-reload-canceled"})
t.trigger({type:"usage",name:"hls-error-reload-canceled"})}else{if(a.getSource&&"function"==typeof a.getSource){n=Date.now()
return a.getSource.call(t,o)}ql.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},l=function e(){t.off("loadedmetadata",s)
t.off("error",u)
t.off("dispose",e)}
t.on("error",u)
t.on("dispose",l)
t.reloadSourceOnError=function(i){l()
e(t,i)}},Yh="2.14.0",Qh={PlaylistLoader:Nc,Playlist:kc,utils:Yc,STANDARD_PLAYLIST_SELECTOR:Gd,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(kc.isEnabled)
Hd(t,(function(e,t){return qd(e,t)}))
return t.filter((function(t){return!!Bd(e.playlists.master,t).video}))[0]||null},lastBandwidthSelector:Gd,movingAverageBandwidthSelector:function(e){var t=-1,i=-1
if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.")
return function(){var n=this.useDevicePixelRatio&&x.devicePixelRatio||1
if(t<0){t=this.systemBandwidth
i=this.systemBandwidth}if(this.systemBandwidth>0&&this.systemBandwidth!==i){t=e*this.systemBandwidth+(1-e)*t
i=this.systemBandwidth}return Wd(this.playlists.master,t,parseInt(Vd(this.tech_.el(),"width"),10)*n,parseInt(Vd(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:qd,comparePlaylistResolution:function(e,t){var i,n
e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width)
i=i||x.Number.MAX_VALUE
t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width)
return i===(n=n||x.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:jc()}
Object.keys(ad).forEach((function(e){Object.defineProperty(Qh,e,{get:function(){ql.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing")
return ad[e]},set:function(t){ql.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing")
"number"!=typeof t||t<0?ql.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):ad[e]=t}})}))
var $h="videojs-vhs",Jh=function(e,t){for(var i=t.media(),n=-1,r=0;r<e.length;r++)if(e[r].id===i.id){n=r
break}e.selectedIndex_=n
e.trigger({selectedIndex:n,type:"change"})}
Qh.canPlaySource=function(){return ql.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")}
var Zh=function(e){var t=e.player,i=e.sourceKeySystems,n=e.audioMedia,r=e.mainPlaylists
if(!t.eme.initializeMediaKeys)return Promise.resolve()
var a=function(e,t){return e.reduce((function(e,i){if(!i.contentProtection)return e
var n=t.reduce((function(e,t){var n=i.contentProtection[t]
n&&n.pssh&&(e[t]={pssh:n.pssh})
return e}),{})
Object.keys(n).length&&e.push(n)
return e}),[])}(n?r.concat([n]):r,Object.keys(i)),s=[],o=[]
a.forEach((function(e){o.push(new Promise((function(e,i){t.tech_.one("keysessioncreated",e)})))
s.push(new Promise((function(i,n){t.eme.initializeMediaKeys({keySystems:e},(function(e){e?n(e):i()}))})))}))
return Promise.race([Promise.all(s),Promise.race(o)])},ep=function(e){var t=e.player,i=function(e,t,i){if(!e)return e
var n={}
t&&t.attributes&&t.attributes.CODECS&&(n=Nd(Ge(t.attributes.CODECS)))
i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS)
var r=Ke(n.video),a=Ke(n.audio),s={}
for(var o in e){s[o]={}
a&&(s[o].audioContentType=a)
r&&(s[o].videoContentType=r)
t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(s[o].pssh=t.contentProtection[o].pssh)
"string"==typeof e[o]&&(s[o].url=e[o])}return ql.mergeOptions(e,s)}(e.sourceKeySystems,e.media,e.audioMedia)
if(!i)return!1
t.currentSource().keySystems=i
if(i&&!t.eme){ql.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin")
return!1}return!0},tp=function(){if(!x.localStorage)return null
var e=x.localStorage.getItem($h)
if(!e)return null
try{return JSON.parse(e)}catch(e){return null}}
Qh.supportsNativeHls=function(){if(!L||!L.createElement)return!1
var e=L.createElement("video")
if(!ql.getTech("Html5").isSupported())return!1
return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}()
Qh.supportsNativeDash=!!(L&&L.createElement&&ql.getTech("Html5").isSupported())&&/maybe|probably/i.test(L.createElement("video").canPlayType("application/dash+xml"))
Qh.supportsTypeNatively=function(e){return"hls"===e?Qh.supportsNativeHls:"dash"===e&&Qh.supportsNativeDash}
Qh.isSupported=function(){return ql.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")}
var ip=function(e){B(t,e)
function t(t,i,n){var r
r=e.call(this,i,ql.mergeOptions(n.hls,n.vhs))||this
n.hls&&Object.keys(n.hls).length&&ql.log.warn("Using hls options is deprecated. Please rename `hls` to `vhs` in your options object.")
"number"==typeof n.initialBandwidth&&(r.options_.bandwidth=n.initialBandwidth)
r.logger_=Xl("VhsHandler")
if(i.options_&&i.options_.playerId){var a=ql(i.options_.playerId)
a.hasOwnProperty("hls")||Object.defineProperty(a,"hls",{get:function(){ql.log.warn("player.hls is deprecated. Use player.tech().vhs instead.")
i.trigger({type:"usage",name:"hls-player-access"})
return N(r)},configurable:!0})
a.hasOwnProperty("vhs")||Object.defineProperty(a,"vhs",{get:function(){ql.log.warn("player.vhs is deprecated. Use player.tech().vhs instead.")
i.trigger({type:"usage",name:"vhs-player-access"})
return N(r)},configurable:!0})
a.hasOwnProperty("dash")||Object.defineProperty(a,"dash",{get:function(){ql.log.warn("player.dash is deprecated. Use player.tech().vhs instead.")
return N(r)},configurable:!0})
r.player_=a}r.tech_=i
r.source_=t
r.stats={}
r.ignoreNextSeekingEvent_=!1
r.setOptions_()
if(r.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks){i.overrideNativeAudioTracks(!0)
i.overrideNativeVideoTracks(!0)}else if(r.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB")
r.on(L,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(function(e){var t=L.fullscreenElement||L.webkitFullscreenElement||L.mozFullScreenElement||L.msFullscreenElement
t&&t.contains(r.tech_.el())?r.masterPlaylistController_.fastQualityChange_():r.masterPlaylistController_.checkABR_()}))
r.on(r.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}))
r.on(r.tech_,"error",(function(){this.tech_.error()&&this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()}))
r.on(r.tech_,"play",r.play)
return r}var i=t.prototype
i.setOptions_=function(){var e=this
this.options_.withCredentials=this.options_.withCredentials||!1
this.options_.handleManifestRedirects=!1!==this.options_.handleManifestRedirects
this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions
this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1
this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1
this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1
this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1
this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1
this.options_.customTagParsers=this.options_.customTagParsers||[]
this.options_.customTagMappers=this.options_.customTagMappers||[]
this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1
"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300)
if("number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var t=tp()
if(t&&t.bandwidth){this.options_.bandwidth=t.bandwidth
this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})
this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})}if(t&&t.throughput){this.options_.throughput=t.throughput
this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})
this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"})}}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=ad.INITIAL_BANDWIDTH)
this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===ad.INITIAL_BANDWIDTH;["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","experimentalBufferBasedABR","liveRangeSafeTimeDelta","experimentalLLHLS","useNetworkInformationApi","useDtsForTimestampOffset","experimentalExactManifestTimings","experim