return an object in beforesetup hooks")}))
var a=Bs.getComponent("Player")
n=new a(r,t,i)
xr("setup").forEach((function(e){return e(n)}))
return n}ql.hooks_=Pr
ql.hooks=xr
ql.hook=function(e,t){xr(e,t)}
ql.hookOnce=function(e,t){xr(e,[].concat(t).map((function(t){return function i(){Ar(e,i)
return t.apply(void 0,arguments)}})))}
ql.removeHook=Ar
if(!0!==x.VIDEOJS_NO_DYNAMIC_STYLE&&ga()){var Wl=Wa(".vjs-styles-defaults")
if(!Wl){Wl=Ja("vjs-styles-defaults")
var Gl=Wa("head")
Gl&&Gl.insertBefore(Wl,Gl.firstChild)
Za(Wl,"\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid {\n        padding-top: 56.25%\n      }\n    ")}}Ya(1,ql)
ql.VERSION=Ir
ql.options=Ol.prototype.options_
ql.getPlayers=function(){return Ol.players}
ql.getPlayer=function(e){var t,i=Ol.players
if("string"==typeof e){var n=Hl(e),r=i[n]
if(r)return r
t=Wa("#"+n)}else t=e
if(va(t)){var a=t,s=a.player,o=a.playerId
if(s||i[o])return s||i[o]}}
ql.getAllPlayers=function(){return Object.keys(Ol.players).map((function(e){return Ol.players[e]})).filter(Boolean)}
ql.players=Ol.players
ql.getComponent=Bs.getComponent
ql.registerComponent=function(e,t){Io.isTech(t)&&Ur.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)")
Bs.registerComponent.call(Bs,e,t)}
ql.getTech=Io.getTech
ql.registerTech=Io.registerTech
ql.use=function(e,t){Po[e]=Po[e]||[]
Po[e].push(t)}
Object.defineProperty(ql,"middleware",{value:{},writeable:!1,enumerable:!0})
Object.defineProperty(ql.middleware,"TERMINATOR",{value:Ao,writeable:!1,enumerable:!0})
ql.browser=pa
ql.TOUCH_ENABLED=ua
ql.extend=function(e,t){void 0===t&&(t={})
var i=function(){e.apply(this,arguments)},n={}
if("object"==typeof t){t.constructor!==Object.prototype.constructor&&(i=t.constructor)
n=t}else"function"==typeof t&&(i=t)
Pe(i,e)
e&&(i.super_=e)
for(var r in n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r])
return i}
ql.mergeOptions=Ds
ql.bind=gs
ql.registerPlugin=Vl.registerPlugin
ql.deregisterPlugin=Vl.deregisterPlugin
ql.plugin=function(e,t){Ur.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead")
return Vl.registerPlugin(e,t)}
ql.getPlugins=Vl.getPlugins
ql.getPlugin=Vl.getPlugin
ql.getPluginVersion=Vl.getPluginVersion
ql.addLanguage=function(e,t){var i
e=(""+e).toLowerCase()
ql.options.languages=Ds(ql.options.languages,((i={})[e]=t,i))
return ql.options.languages[e]}
ql.log=Ur
ql.createLogger=Br
ql.createTimeRange=ql.createTimeRanges=Vs
ql.formatTime=nu
ql.setFormatTime=function(e){iu=e}
ql.resetFormatTime=function(){iu=tu}
ql.parseUrl=po
ql.isCrossOrigin=go
ql.EventTarget=ys
ql.on=us
ql.one=ds
ql.off=ls
ql.trigger=cs
ql.xhr=W
ql.TextTrack=bo
ql.AudioTrack=To
ql.VideoTrack=ko;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((function(e){ql[e]=function(){Ur.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead")
return za[e].apply(null,arguments)}}))
ql.computedStyle=Gr
ql.dom=za
ql.url=vo
ql.defineLazyProperty=El
ql.addLanguage("en",{"Non-Fullscreen":"Exit Fullscreen"})

;/*! @name @videojs/http-streaming @version 2.14.0 @license Apache-2.0 */var zl=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=x.location&&x.location.href||"")
var i="function"==typeof x.URL,n=/^\/\//.test(e),r=!x.location&&!/\/\//i.test(e)
i?e=new x.URL(e,x.location||Ae):/\/\//i.test(e)||(e=xe.buildAbsoluteURL(x.location&&x.location.href||"",e))
if(i){var a=new URL(t,e)
return r?a.href.slice(18):n?a.href.slice(a.protocol.length):a.href}return xe.buildAbsoluteURL(e,t)},Kl=function(e,t,i){return e&&i&&i.responseURL&&t!==i.responseURL?i.responseURL:t},Xl=function(e){return ql.log.debug?ql.log.debug.bind(ql,"VHS:",e+" >"):function(){}},Yl=1/30,Ql=.1,$l=function(e,t){var i,n=[]
if(e&&e.length)for(i=0;i<e.length;i++)t(e.start(i),e.end(i))&&n.push([e.start(i),e.end(i)])
return ql.createTimeRanges(n)},Jl=function(e,t){return $l(e,(function(e,i){return e-Ql<=t&&i+Ql>=t}))},Zl=function(e,t){return $l(e,(function(e){return e-Yl>=t}))},ec=function(e){var t=[]
if(!e||!e.length)return""
for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i))
return t.join(", ")},tc=function(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)})
return t},ic=function(e){if(e&&e.length&&e.end)return e.end(e.length-1)},nc=function(e,t){var i=0
if(!e||!e.length)return i
for(var n=0;n<e.length;n++){var r=e.start(n),a=e.end(n)
t>a||(i+=t>r&&t<=a?a-t:a-r)}return i},rc=ql.createTimeRange,ac=function(e,t){if(!t.preload)return t.duration
var i=0;(t.parts||[]).forEach((function(e){i+=e.duration}));(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)}))
return i},sc=function(e){return(e.segments||[]).reduce((function(e,t,i){t.parts?t.parts.forEach((function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null})
return e}),[])},oc=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1]
return t&&t.parts||[]},uc=function(e){var t=e.preloadSegment
if(t){var i=t.parts,n=(t.preloadHints||[]).reduce((function(e,t){return e+("PART"===t.type?1:0)}),0)
return n+=i&&i.length?i.length:0}},lc=function(e,t){if(t.endList)return 0
if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay
var i=oc(t).length>0
return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},cc=function(e,t,i){void 0===t&&(t=e.mediaSequence+e.segments.length)
if(t<e.mediaSequence)return 0
var n=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n]
if(r){if(void 0!==r.start)return{result:r.start,precise:!0}
if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(void 0!==(r=e.segments[n]).end)return{result:i+r.end,precise:!0}
i+=ac(e,r)
if(void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t)
if(n.precise)return n.result
var r=function(e,t){for(var i,n=0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(i=e.segments[r]).start)return{result:i.start-n,precise:!0}
n+=ac(e,i)
if(void 0!==i.end)return{result:i.end-n,precise:!0}}return{result:-1,precise:!1}}(e,t)
return r.precise?r.result:n.result+i},dc=function(e,t,i){if(!e)return 0
"number"!=typeof i&&(i=0)
if(void 0===t){if(e.totalDuration)return e.totalDuration
if(!e.endList)return x.Infinity}return cc(e,t,i)},hc=function(e){var t=e.defaultDuration,i=e.durationList,n=e.startIndex,r=e.endIndex,a=0
if(n>r){var s=[r,n]
n=s[0]
r=s[1]}if(n<0){for(var o=n;o<Math.min(0,r);o++)a+=t
n=0}for(var u=n;u<r;u++)a+=i[u].duration
return a},pc=function(e,t,i,n){if(!e||!e.segments)return null
if(e.endList)return dc(e)
if(null===t)return null
t=t||0
var r=cc(e,e.mediaSequence+e.segments.length,t)
i&&(r-=n="number"==typeof n?n:lc(null,e))
return Math.max(0,r)},fc=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},mc=function(e){return e.excludeUntil&&e.excludeUntil===1/0},gc=function(e){var t=fc(e)
return!e.disabled&&!t},vc=function(e,t){return t.attributes&&t.attributes[e]},yc=function(e,t){if(1===e.playlists.length)return!0
var i=t.attributes.BANDWIDTH||Number.MAX_VALUE
return 0===e.playlists.filter((function(e){return!!gc(e)&&(e.attributes.BANDWIDTH||0)<i})).length},_c=function(e,t){return!(!e&&!t||!e&&t||e&&!t)&&(e===t||(!(!e.id||!t.id||e.id!==t.id)||(!(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)||!(!e.uri||!t.uri||e.uri!==t.uri))))},bc=function(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},n=!1
for(var r in i){for(var a in i[r])if(n=t(i[r][a]))break
if(n)break}return!!n},Tc=function(e){if(!e||!e.playlists||!e.playlists.length){return bc(e,(function(e){return e.playlists&&e.playlists.length||e.uri}))}for(var t=function(t){var i=e.playlists[t],n=i.attributes&&i.attributes.CODECS
return n&&n.split(",").every((function(e){return ze(e)}))||bc(e,(function(e){return _c(i,e)}))?"continue":{v:!1}},i=0;i<e.playlists.length;i++){var n=t(i)
if("continue"!==n&&"object"==typeof n)return n.v}return!0},kc={liveEdgeDelay:lc,duration:dc,seekable:function(e,t,i){var n=t||0,r=pc(e,t,!0,i)
return null===r?rc():rc(n,r)},getMediaInfoForTime:function(e){for(var t=e.playlist,i=e.currentTime,n=e.startingSegmentIndex,r=e.startingPartIndex,a=e.startTime,s=e.experimentalExactManifestTimings,o=i-a,u=sc(t),l=0,c=0;c<u.length;c++){var d=u[c]
if(n===d.segmentIndex&&("number"!=typeof r||"number"!=typeof d.partIndex||r===d.partIndex)){l=c
break}}if(o<0){if(l>0)for(var h=l-1;h>=0;h--){var p=u[h]
o+=p.duration
if(s){if(o<0)continue}else if(o+Yl<=0)continue
return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-hc({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:h})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i}}if(l<0){for(var f=l;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i}
l=0}for(var m=l;m<u.length;m++){var g=u[m]
o-=g.duration
if(s){if(o>0)continue}else if(o-Yl>=0)continue
return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+hc({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:m})}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:i}},isEnabled:gc,isDisabled:function(e){return e.disabled},isBlacklisted:fc,isIncompatible:mc,playlistEnd:pc,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0
return!1},hasAttribute:vc,estimateSegmentRequestTime:function(e,t,i,n){void 0===n&&(n=0)
return vc("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*n)/t:NaN},isLowestEnabledRendition:yc,isAudioOnly:Tc,playlistMatch:_c,segmentDurationWithParts:ac},Sc=ql.log,Ec=function(e,t){return e+"-"+t},Cc=function(e,t){e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((function(i){if(e.mediaGroups[i])for(var n in e.mediaGroups[i])for(var r in e.mediaGroups[i][n]){var a=e.mediaGroups[i][n][r]
t(a,i,n,r)}}))},wc=function(e){var t=e.playlist,i=e.uri,n=e.id
t.id=n
t.playlistErrors_=0
i&&(t.uri=i)
t.attributes=t.attributes||{}},Ic=function(e,t){e.uri=t
for(var i=0;i<e.playlists.length;i++)if(!e.playlists[i].uri){var n="placeholder-uri-"+i
e.playlists[i].uri=n}var r=Tc(e)
Cc(e,(function(t,i,n,a){var s="placeholder-uri-"+i+"-"+n+"-"+a
if(!t.playlists||!t.playlists.length){if(r&&"AUDIO"===i&&!t.uri)for(var o=0;o<e.playlists.length;o++){var u=e.playlists[o]
if(u.attributes&&u.attributes.AUDIO&&u.attributes.AUDIO===n)return}t.playlists=[R({},t)]}t.playlists.forEach((function(t,i){var n=Ec(i,s)
if(t.uri)t.resolvedUri=t.resolvedUri||zl(e.uri,t.uri)
else{t.uri=0===i?s:n
t.resolvedUri=t.uri}t.id=t.id||n
t.attributes=t.attributes||{}
e.playlists[t.id]=t
e.playlists[t.uri]=t}))}))
!function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t]
wc({playlist:i,id:Ec(t,i.uri)})
i.resolvedUri=zl(e.uri,i.uri)
e.playlists[i.id]=i
e.playlists[i.uri]=i
i.attributes.BANDWIDTH||Sc.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}(e)
!function(e){Cc(e,(function(t){t.uri&&(t.resolvedUri=zl(e.uri,t.uri))}))}(e)},Pc=ql.mergeOptions,xc=ql.EventTarget,Ac=function(e,t){if(!e)return t
var i=Pc(e,t)
e.preloadHints&&!t.preloadHints&&delete i.preloadHints
if(e.parts&&!t.parts)delete i.parts
else if(e.parts&&t.parts)for(var n=0;n<t.parts.length;n++)e.parts&&e.parts[n]&&(i.parts[n]=Pc(e.parts[n],t.parts[n]))
!e.skipped&&t.skipped&&(i.skipped=!1)
e.preload&&!t.preload&&(i.preload=!1)
return i},Oc=function(e,t){!e.resolvedUri&&e.uri&&(e.resolvedUri=zl(t,e.uri))
e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=zl(t,e.key.uri))
e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=zl(t,e.map.uri))
e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=zl(t,e.map.key.uri))
e.parts&&e.parts.length&&e.parts.forEach((function(e){e.resolvedUri||(e.resolvedUri=zl(t,e.uri))}))
e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((function(e){e.resolvedUri||(e.resolvedUri=zl(t,e.uri))}))},Lc=function(e){var t=e.segments||[],i=e.preloadSegment
if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(var n=0;n<i.preloadHints.length;n++)if("MAP"===i.preloadHints[n].type)return t
i.duration=e.targetDuration
i.preload=!0
t.push(i)}return t},Dc=function(e,t){return e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment},Rc=function(e,t,i){void 0===i&&(i=Dc)
var n=Pc(e,{}),r=n.playlists[t.id]
if(!r)return null
if(i(r,t))return null
t.segments=Lc(t)
var a=Pc(r,t)
a.preloadSegment&&!t.preloadSegment&&delete a.preloadSegment
if(r.segments){if(t.skip){t.segments=t.segments||[]
for(var s=0;s<t.skip.skippedSegments;s++)t.segments.unshift({skipped:!0})}a.segments=function(e,t,i){var n=e.slice(),r=t.slice()
i=i||0
for(var a,s=[],o=0;o<r.length;o++){var u=n[o+i],l=r[o]
if(u){a=u.map||a
s.push(Ac(u,l))}else{a&&!l.map&&(l.map=a)
s.push(l)}}return s}(r.segments,t.segments,t.mediaSequence-r.mediaSequence)}a.segments.forEach((function(e){Oc(e,a.resolvedUri)}))
for(var o=0;o<n.playlists.length;o++)n.playlists[o].id===t.id&&(n.playlists[o]=a)
n.playlists[t.id]=a
n.playlists[t.uri]=a
Cc(e,(function(e,i,n,r){if(e.playlists)for(var a=0;a<e.playlists.length;a++)t.id===e.playlists[a].id&&(e.playlists[a]=t)}))
return n},Mc=function(e,t){var i=e.segments||[],n=i[i.length-1],r=n&&n.parts&&n.parts[n.parts.length-1],a=r&&r.duration||n&&n.duration
return t&&a?1e3*a:500*(e.partTargetDuration||e.targetDuration||10)},Nc=function(e){B(t,e)
function t(t,i,n){var r
void 0===n&&(n={})
r=e.call(this)||this
if(!t)throw new Error("A non-empty playlist URL or object is required")
r.logger_=Xl("PlaylistLoader")
var a=n,s=a.withCredentials,o=void 0!==s&&s,u=a.handleManifestRedirects,l=void 0!==u&&u
r.src=t
r.vhs_=i
r.withCredentials=o
r.handleManifestRedirects=l
var c=i.options_
r.customTagParsers=c&&c.customTagParsers||[]
r.customTagMappers=c&&c.customTagMappers||[]
r.experimentalLLHLS=c&&c.experimentalLLHLS||!1
ql.browser.IE_VERSION&&(r.experimentalLLHLS=!1)
r.state="HAVE_NOTHING"
r.handleMediaupdatetimeout_=r.handleMediaupdatetimeout_.bind(N(r))
r.on("mediaupdatetimeout",r.handleMediaupdatetimeout_)
return r}var i=t.prototype
i.handleMediaupdatetimeout_=function(){var e=this
if("HAVE_METADATA"===this.state){var t=this.media(),i=zl(this.master.uri,t.uri)
this.experimentalLLHLS&&(i=function(e,t){if(t.endList||!t.serverControl)return e
var i={}
if(t.serverControl.canBlockReload){var n=t.preloadSegment,r=t.mediaSequence+t.segments.length
if(n){var a=n.parts||[],s=uc(t)-1
s>-1&&s!==a.length-1&&(i._HLS_part=s);(s>-1||a.length)&&r--}i._HLS_msn=r}t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES")
if(Object.keys(i).length){var o=new x.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&o.searchParams.set(e,i[e])}))
e=o.toString()}return e}(i,t))
this.state="HAVE_CURRENT_METADATA"
this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(t)return e.playlistRequestError(e.request,e.media(),"HAVE_METADATA")
e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})}}))}}
i.playlistRequestError=function(e,t,i){var n=t.uri,r=t.id
this.request=null
i&&(this.state=i)
this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:e.status>=500?4:2}
this.trigger("error")}
i.parseManifest_=function(e){var t=this,i=e.url
return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,s=e.customTagMappers,o=void 0===s?[]:s,u=e.experimentalLLHLS,l=new je
t&&l.on("warn",t)
i&&l.on("info",i)
a.forEach((function(e){return l.addParser(e)}))
o.forEach((function(e){return l.addTagMapper(e)}))
l.push(n)
l.end()
var c=l.manifest
if(!u){["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){c.hasOwnProperty(e)&&delete c[e]}))
c.segments&&c.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))}if(!c.targetDuration){var d=10
c.segments&&c.segments.length&&(d=c.segments.reduce((function(e,t){return Math.max(e,t.duration)}),0))
t&&t("manifest has no targetDuration defaulting to "+d)
c.targetDuration=d}var h=oc(c)
if(h.length&&!c.partTargetDuration){var p=h.reduce((function(e,t){return Math.max(e,t.duration)}),0)
if(t){t("manifest has no partTargetDuration defaulting to "+p)
Sc.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")}c.partTargetDuration=p}return c}({onwarn:function(e){var n=e.message
return t.logger_("m3u8-parser warn for "+i+": "+n)},oninfo:function(e){var n=e.message
return t.logger_("m3u8-parser info for "+i+": "+n)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})}
i.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url,r=e.id
this.request=null
this.state="HAVE_METADATA"
var a=i||this.parseManifest_({url:n,manifestString:t})
a.lastRequest=Date.now()
wc({playlist:a,uri:n,id:r})
var s=Rc(this.master,a)
this.targetDuration=a.partTargetDuration||a.targetDuration
this.pendingMedia_=null
if(s){this.master=s
this.media_=this.master.playlists[r]}else this.trigger("playlistunchanged")
this.updateMediaUpdateTimeout_(Mc(this.media(),!!s))
this.trigger("loadedplaylist")}
i.dispose=function(){this.trigger("dispose")
this.stopRequest()
x.clearTimeout(this.mediaUpdateTimeout)
x.clearTimeout(this.finalRenditionTimeout)
this.off()}
i.stopRequest=function(){if(this.request){var e=this.request
this.request=null
e.onreadystatechange=null
e.abort()}}
i.media=function(e,t){var i=this
if(!e)return this.media_
if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state)
if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e)
e=this.master.playlists[e]}x.clearTimeout(this.finalRenditionTimeout)
if(t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3
this.finalRenditionTimeout=x.setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state,a=!this.media_||e.id!==this.media_.id,s=this.master.playlists[e.id]
if(s&&s.endList||e.endList&&e.segments.length){if(this.request){this.request.onreadystatechange=null
this.request.abort()
this.request=null}this.state="HAVE_METADATA"
this.media_=e
if(a){this.trigger("mediachanging")
"HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")}}else{this.updateMediaUpdateTimeout_(Mc(e,!0))
if(a){this.state="SWITCHING_MEDIA"
if(this.request){if(e.resolvedUri===this.request.url)return
this.request.onreadystatechange=null
this.request.abort()
this.request=null}this.media_&&this.trigger("mediachanging")
this.pendingMedia_=e
this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){e.lastRequest=Date.now()
e.resolvedUri=Kl(i.handleManifestRedirects,e.resolvedUri,n)
if(t)return i.playlistRequestError(i.request,e,r)
i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id})
"HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}}}
i.pause=function(){if(this.mediaUpdateTimeout){x.clearTimeout(this.mediaUpdateTimeout)
this.mediaUpdateTimeout=null}this.stopRequest()
"HAVE_NOTHING"===this.state&&(this.started=!1)
"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}
i.load=function(e){var t=this
if(this.mediaUpdateTimeout){x.clearTimeout(this.mediaUpdateTimeout)
this.mediaUpdateTimeout=null}var i=this.media()
if(e){var n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3
this.mediaUpdateTimeout=x.setTimeout((function(){t.mediaUpdateTimeout=null
t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}
i.updateMediaUpdateTimeout_=function(e){var t=this
if(this.mediaUpdateTimeout){x.clearTimeout(this.mediaUpdateTimeout)
this.mediaUpdateTimeout=null}this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=x.setTimeout((function(){t.mediaUpdateTimeout=null
t.trigger("mediaupdatetimeout")
t.updateMediaUpdateTimeout_(e)}),e))}
i.start=function(){var e=this
this.started=!0
if("object"!=typeof this.src)this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){e.request=null
if(t){e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2}
"HAVE_NOTHING"===e.state&&(e.started=!1)
return e.trigger("error")}e.src=Kl(e.handleManifestRedirects,e.src,i)
var n=e.parseManifest_({manifestString:i.responseText,url:e.src})
e.setupInitialPlaylist(n)}}))
else{this.src.uri||(this.src.uri=x.location.href)
this.src.resolvedUri=this.src.uri
setTimeout((function(){e.setupInitialPlaylist(e.src)}),0)}}
i.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri}
i.setupInitialPlaylist=function(e){this.state="HAVE_MASTER"
if(e.playlists){this.master=e
Ic(this.master,this.srcUri())
e.playlists.forEach((function(e){e.segments=Lc(e)
e.segments.forEach((function(t){Oc(t,e.resolvedUri)}))}))
this.trigger("loadedplaylist")
this.request||this.media(this.master.playlists[0])}else{var t=this.srcUri()||x.location.href
this.master=function(e,t){var i=Ec(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:x.location.href,resolvedUri:x.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]}
n.playlists[i]=n.playlists[0]
n.playlists[t]=n.playlists[0]
return n}(0,t)
this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id})
this.trigger("loadedmetadata")}}
return t}(xc),Uc=ql.xhr,Bc=ql.mergeOptions,Fc=function(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText
if(!t&&r){e.responseTime=Date.now()
e.roundTripTime=e.responseTime-e.requestTime
e.bytesReceived=r.byteLength||r.length
e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))}i.headers&&(e.responseHeaders=i.headers)
t&&"ETIMEDOUT"===t.code&&(e.timedout=!0)
t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText))))
n(t,e)},jc=function(){var e=function e(t,i){t=Bc({timeout:45e3},t)
var n=e.beforeRequest||ql.Vhs.xhr.beforeRequest
if(n&&"function"==typeof n){var r=n(t)
r&&(t=r)}var a=(!0===ql.Vhs.xhr.original?Uc:ql.Vhs.xhr)(t,(function(e,t){return Fc(a,e,t,i)})),s=a.abort
a.abort=function(){a.aborted=!0
return s.apply(a,arguments)}
a.uri=t.uri
a.requestTime=Date.now()
return a}
e.original=!0
return e},Vc=function(e){var t,i={}
e.byterange&&(i.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"==typeof t.offset||"bigint"==typeof t.length?x.BigInt(t.offset)+x.BigInt(t.length)-x.BigInt(1):t.offset+t.length-1))
return i},Hc=function(e,t){return e.start(t)+"-"+e.end(t)},qc=function(e,t){var i=e.toString(16)
return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Wc=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Gc=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},zc=function(e){var t=e.byterange||{length:1/0,offset:0}
return[t.length,t.offset,e.resolvedUri].join(",")},Kc=function(e){return e.resolvedUri},Xc=function(e){for(var t=Array.prototype.slice.call(e),i=16,n="",r=0;r<t.length/i;r++)n+=t.slice(r*i,r*i+i).map(qc).join("")+" "+t.slice(r*i,r*i+i).map(Wc).join("")+"\n"
return n},Yc=Object.freeze({__proto__:null,createTransferableMessage:Gc,initSegmentId:zc,segmentKeyId:Kc,hexDump:Xc,tagDump:function(e){var t=e.bytes
return Xc(t)},textRanges:function(e){var t,i=""
for(t=0;t<e.length;t++)i+=Hc(e,t)+" "
return i}}),Qc=function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i,r=e.callback
if(!r)throw new Error("getProgramTime: callback must be provided")
if(!t||void 0===n)return r({message:"getProgramTime: playlist and time must be provided"})
var a=function(e,t){if(!t||!t.segments||0===t.segments.length)return null
for(var i,n=0,r=0;r<t.segments.length&&!(e<=(n=(i=t.segments[r]).videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:n+i.duration));r++);var a=t.segments[t.segments.length-1]
if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null
if(e>n){if(e>n+.25*a.duration)return null
i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t)
if(!a)return r({message:"valid programTime was not found"})
if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart})
var s={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null
var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i)
return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,a.segment)
o&&(s.programDateTime=o.toISOString())
return r(null,s)},$c=function e(t){var i=t.programTime,n=t.playlist,r=t.retryCount,a=void 0===r?2:r,s=t.seekTo,o=t.pauseAfterSeek,u=void 0===o||o,l=t.tech,c=t.callback
if(!c)throw new Error("seekToProgramTime: callback must be provided")
if(void 0===i||!n||!s)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"})
if(!n.endList&&!l.hasStarted_)return c({message:"player must be playing a live stream to start buffering"})
if(!function(e){if(!e.segments||0===e.segments.length)return!1
for(var t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1
return!0}(n))return c({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri})
var d=function(e,t){var i
try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null
var n=t.segments[0]
if(i<n.dateTimeObject)return null
for(var r=0;r<t.segments.length-1;r++){n=t.segments[r]
if(i<t.segments[r+1].dateTimeObject)break}var a,s=t.segments[t.segments.length-1],o=s.dateTimeObject,u=s.videoTimingInfo?(a=s.videoTimingInfo).transmuxedPresentationEnd-a.transmuxedPresentationStart-a.transmuxerPrependedSeconds:s.duration+.25*s.duration
if(i>new Date(o.getTime()+1e3*u))return null
i>o&&(n=s)
return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:kc.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"}}(i,n)
if(!d)return c({message:i+" was not found in the stream"})
var h=d.segment,p=function(e,t){var i,n
try{i=new Date(e)
n=new Date(t)}catch(e){}var r=i.getTime()
return(n.getTime()-r)/1e3}(h.dateTimeObject,i)
if("estimate"!==d.type){var f=h.start+p
l.one("seeked",(function(){return c(null,l.currentTime())}))
u&&l.pause()
s(f)}else{if(0===a)return c({message:i+" is not buffered yet. Try again"})
s(d.estimatedStart+p)
l.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:a-1,seekTo:s,pauseAfterSeek:u,tech:l,callback:c})}))}},Jc=function(e,t){if(4===e.readyState)return t()},Zc=function(e,t,i){var n,r=[],a=!1,s=function(e,t,n,r){t.abort()
a=!0
return i(e,t,n,r)},o=function(e,t){if(!a){if(e)return s(e,t,"",r)
var i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length)
r=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i]
if((t=t.filter((function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e}))).length<=1)return Kn(t[0])
var n=t.reduce((function(e,t,i){return e+(t.byteLength||t.length)}),0),r=new Uint8Array(n),a=0
t.forEach((function(e){e=Kn(e)
r.set(e,a)
a+=e.byteLength}))
return r}(r,Jn(i,!0))
n=n||tr(r)
if(r.length<10||n&&r.length<n+2)return Jc(t,(function(){return s(e,t,"",r)}))
var o=Sr(r)
return"ts"===o&&r.length<188||!o&&r.length<376?Jc(t,(function(){return s(e,t,"",r)})):s(null,t,o,r)}},u={uri:e,beforeSend:function(e){e.overrideMimeType("text/plain; charset=x-user-defined")
e.addEventListener("progress",(function(t){t.total
t.loaded
return Fc(e,null,{statusCode:e.status},o)}))}},l=t(u,(function(e,t){return Fc(l,e,t,o)}))
return l},ed=ql.EventTarget,td=ql.mergeOptions,id=function(e,t){if(!Dc(e,t))return!1
if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1
if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1
if(e.segments&&!t.segments||!e.segments&&t.segments)return!1
if(!e.segments&&!t.segments)return!0
for(var i=0;i<e.segments.length;i++){var n=e.segments[i],r=t.segments[i]
if(n.uri!==r.uri)return!1
if(n.byterange||r.byterange){var a=n.byterange,s=r.byterange
if(a&&!s||!a&&s)return!1
if(a.offset!==s.offset||a.length!==s.length)return!1}}return!0},nd=function(e,t){var i,n,r={}
for(var a in e){var s=e[a].sidx
if(s){var o=pn(s)
if(!t[o])break
var u=t[o].sidxInfo;(i=u,n=s,(Boolean(!i.map&&!n.map)||Boolean(i.map&&n.map&&i.map.byterange.offset===n.map.byterange.offset&&i.map.byterange.length===n.map.byterange.length))&&i.uri===n.uri&&i.byterange.offset===n.byterange.offset&&i.byterange.length===n.byterange.length)&&(r[o]=t[o])}}return r},rd=function(e){B(t,e)
function t(t,i,n,r){var a
void 0===n&&(n={});(a=e.call(this)||this).masterPlaylistLoader_=r||N(a)
r||(a.isMaster_=!0)
var s=n,o=s.withCredentials,u=void 0!==o&&o,l=s.handleManifestRedirects,c=void 0!==l&&l
a.vhs_=i
a.withCredentials=u
a.handleManifestRedirects=c
if(!t)throw new Error("A non-empty playlist URL or object is required")
a.on("minimumUpdatePeriod",(function(){a.refreshXml_()}))
a.on("mediaupdatetimeout",(function(){a.refreshMedia_(a.media().id)}))
a.state="HAVE_NOTHING"
a.loadedPlaylists_={}
a.logger_=Xl("DashPlaylistLoader")
if(a.isMaster_){a.masterPlaylistLoader_.srcUrl=t
a.masterPlaylistLoader_.sidxMapping_={}}else a.childPlaylist_=t
return a}var i=t.prototype
i.requestErrored_=function(e,t,i){if(!this.request)return!0
this.request=null
if(e){this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e
i&&(this.state=i)
this.trigger("error")
return!0}}
i.addSidxSegments_=function(e,t,i){var n=this,r=e.sidx&&pn(e.sidx)
if(e.sidx&&r&&!this.masterPlaylistLoader_.sidxMapping_[r]){var a=Kl(this.handleManifestRedirects,e.sidx.resolvedUri),s=function(a,s){if(!n.requestErrored_(a,s,t)){var o,u=n.masterPlaylistLoader_.sidxMapping_
try{o=Gn(Kn(s.response).subarray(8))}catch(e){n.requestErrored_(e,s,t)
return}u[r]={sidxInfo:e.sidx,sidx:o}
sn(e,o,e.sidx.resolvedUri)
return i(!0)}}
this.request=Zc(a,this.vhs_.xhr,(function(t,i,r,o){if(t)return s(t,i)
if(!r||"mp4"!==r)return s({status:i.status,message:"Unsupported "+(r||"unknown")+" container type for sidx segment at URL: "+a,response:"",playlist:e,internal:!0,blacklistDuration:1/0,code:2},i)
var u=e.sidx.byterange,l=u.offset,c=u.length
if(o.length>=c+l)return s(t,{response:o.subarray(l,l+c),status:i.status,uri:i.uri})
n.request=n.vhs_.xhr({uri:a,responseType:"arraybuffer",headers:Vc({byterange:e.sidx.byterange})},s)}))}else this.mediaRequest_=x.setTimeout((function(){return i(!1)}),0)}
i.dispose=function(){this.trigger("dispose")
this.stopRequest()
this.loadedPlaylists_={}
x.clearTimeout(this.minimumUpdatePeriodTimeout_)
x.clearTimeout(this.mediaRequest_)
x.clearTimeout(this.mediaUpdateTimeout)
this.mediaUpdateTimeout=null
this.mediaRequest_=null
this.minimumUpdatePeriodTimeout_=null
if(this.masterPlaylistLoader_.createMupOnMedia_){this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_)
this.masterPlaylistLoader_.createMupOnMedia_=null}this.off()}
i.hasPendingRequest=function(){return this.request||this.mediaRequest_}
i.stopRequest=function(){if(this.request){var e=this.request
this.request=null
e.onreadystatechange=null
e.abort()}}
i.media=function(e){var t=this
if(!e)return this.media_
if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state)
var i=this.state
if("string"==typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e)
e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id
if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA"
this.media_=e
if(n){this.trigger("mediachanging")
this.trigger("mediachange")}}else if(n){this.media_&&this.trigger("mediachanging")
this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})}))}}
i.haveMetadata=function(e){var t=e.startingState,i=e.playlist
this.state="HAVE_METADATA"
this.loadedPlaylists_[i.id]=i
this.mediaRequest_=null
this.refreshMedia_(i.id)
"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")}
i.pause=function(){if(this.masterPlaylistLoader_.createMupOnMedia_){this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_)
this.masterPlaylistLoader_.createMupOnMedia_=null}this.stopRequest()
x.clearTimeout(this.mediaUpdateTimeout)
this.mediaUpdateTimeout=null
if(this.isMaster_){x.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_)
this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null}"HAVE_NOTHING"===this.state&&(this.started=!1)}
i.load=function(e){var t=this
x.clearTimeout(this.mediaUpdateTimeout)
this.mediaUpdateTimeout=null
var i=this.media()
if(e){var n=i?i.targetDuration/2*1e3:5e3
this.mediaUpdateTimeout=x.setTimeout((function(){return t.load()}),n)}else if(this.started)if(i&&!i.endList){if(this.isMaster_&&!this.minimumUpdatePeriodTimeout_){this.trigger("minimumUpdatePeriod")
this.updateMinimumUpdatePeriodTimeout_()}this.trigger("mediaupdatetimeout")}else this.trigger("loadedplaylist")
else this.start()}
i.start=function(){var e=this
this.started=!0
this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_()
e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=x.setTimeout((function(){return e.haveMaster_()}),0)}
i.requestMaster_=function(e){var t=this
this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(t.requestErrored_(i,n))"HAVE_NOTHING"===t.state&&(t.started=!1)
else{var r=n.responseText!==t.masterPlaylistLoader_.masterXml_
t.masterPlaylistLoader_.masterXml_=n.responseText
n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now()
t.masterPlaylistLoader_.srcUrl=Kl(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n)
if(!r)return e(n,r)
t.handleMaster_()
t.syncClientServerClock_((function(){return e(n,r)}))}}))}
i.syncClientServerClock_=function(e){var t=this,i=Hn(this.masterPlaylistLoader_.masterXml_)
if(null===i){this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now()
return e()}if("DIRECT"===i.method){this.masterPlaylistLoader_.clientOffset_=i.value-Date.now()
return e()}this.request=this.vhs_.xhr({uri:zl(this.masterPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n){t.masterPlaylistLoader_.clientOffset_=t.masterLoaded_-Date.now()
return e()}var a
a="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText)
t.masterPlaylistLoader_.clientOffset_=a-Date.now()
e()}}))}
i.haveMaster_=function(){this.state="HAVE_MASTER"
this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}
i.handleMaster_=function(){this.mediaRequest_=null
var e=this.masterPlaylistLoader_.master,t=function(e){var t=e.masterXml,i=e.srcUrl,n=e.clientOffset,r=e.sidxMapping,a=e.previousManifest,s=Vn(t,{manifestUri:i,clientOffset:n,sidxMapping:r,previousManifest:a})
Ic(s,i)
return s}({masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:e})
e&&(t=function(e,t,i){for(var n=!0,r=td(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts}),a=0;a<t.playlists.length;a++){var s=t.playlists[a]
if(s.sidx){var o=pn(s.sidx)
i&&i[o]&&i[o].sidx&&sn(s,i[o].sidx,s.sidx.resolvedUri)}var u=Rc(r,s,id)
if(u){r=u
n=!1}}Cc(t,(function(e,t,i,a){if(e.playlists&&e.playlists.length){var s=e.playlists[0].id,o=Rc(r,e.playlists[0],id)
if(o){(r=o).mediaGroups[t][i][a].playlists[0]=r.playlists[s]
n=!1}}}))
t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(n=!1)
return n?null:r}(e,t,this.masterPlaylistLoader_.sidxMapping_))
this.masterPlaylistLoader_.master=t||e
var i=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0]
i&&i!==this.masterPlaylistLoader_.srcUrl&&(this.masterPlaylistLoader_.srcUrl=i);(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_()
return Boolean(t)}
i.updateMinimumUpdatePeriodTimeout_=function(){var e=this.masterPlaylistLoader_
if(e.createMupOnMedia_){e.off("loadedmetadata",e.createMupOnMedia_)
e.createMupOnMedia_=null}if(e.minimumUpdatePeriodTimeout_){x.clearTimeout(e.minimumUpdatePeriodTimeout_)
e.minimumUpdatePeriodTimeout_=null}var t=e.master&&e.master.minimumUpdatePeriod
if(0===t)if(e.media())t=1e3*e.media().targetDuration
else{e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_
e.one("loadedmetadata",e.createMupOnMedia_)}"number"!=typeof t||t<=0?t<0&&this.logger_("found invalid minimumUpdatePeriod of "+t+", not setting a timeout"):this.createMUPTimeout_(t)}
i.createMUPTimeout_=function(e){var t=this.masterPlaylistLoader_
t.minimumUpdatePeriodTimeout_=x.setTimeout((function(){t.minimumUpdatePeriodTimeout_=null
t.trigger("minimumUpdatePeriod")
t.createMUPTimeout_(e)}),e)}
i.refreshXml_=function(){var e=this
this.requestMaster_((function(t,i){if(i){e.media_&&(e.media_=e.masterPlaylistLoader_.master.playlists[e.media_.id])
e.masterPlaylistLoader_.sidxMapping_=function(e,t){var i=nd(e.playlists,t)
Cc(e,(function(e,n,r,a){if(e.playlists&&e.playlists.length){var s=e.playlists
i=td(i,nd(s,t))}}))
return i}(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.sidxMapping_)
e.addSidxSegments_(e.media(),e.state,(function(t){e.refreshMedia_(e.media().id)}))}}))}
i.refreshMedia_=function(e){var t=this
if(!e)throw new Error("refreshMedia_ must take a media id")
this.media_&&this.isMaster_&&this.handleMaster_()
var i=this.masterPlaylistLoader_.master.playlists,n=!this.media_||this.media_!==i[e]
n?this.media_=i[e]:this.trigger("playlistunchanged")
if(!this.mediaUpdateTimeout){!function e(){t.media().endList||(t.mediaUpdateTimeout=x.setTimeout((function(){t.trigger("mediaupdatetimeout")
e()}),Mc(t.media(),Boolean(n))))}()}this.trigger("loadedplaylist")}
return t}(ed),ad={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},sd=function(e){e.on=e.addEventListener
e.off=e.removeEventListener
return e},od=function(e){return function(){var t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(i){var t=new BlobBuilder
t.append(e)
return URL.createObjectURL(t.getBlob())}}(e),i=sd(new Worker(t))
i.objURL=t
var n=i.terminate
i.on=i.addEventListener
i.off=i.removeEventListener
i.terminate=function(){URL.revokeObjectURL(t)
return n.call(this)}
return i}},ud=function(e){return"var browserWorkerPolyFill = "+sd.toString()+";\nbrowserWorkerPolyFill(self);\n"+e},ld=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},cd=ud(ld((function(){var e=function(){this.init=function(){var e={}
this.on=function(t,i){e[t]||(e[t]=[])
e[t]=e[t].concat(i)}
this.off=function(t,i){var n
if(!e[t])return!1
n=e[t].indexOf(i)
e[t]=e[t].slice()
e[t].splice(n,1)
return n>-1}
this.trigger=function(t){var i,n,r,a
if(i=e[t])if(2===arguments.length){r=i.length
for(n=0;n<r;++n)i[n].call(this,arguments[1])}else{a=[]
n=arguments.length
for(n=1;n<arguments.length;++n)a.push(arguments[n])
r=i.length
for(n=0;n<r;++n)i[n].apply(this,a)}}
this.dispose=function(){e={}}}}
e.prototype.pipe=function(e){this.on("data",(function(t){e.push(t)}))
this.on("done",(function(t){e.flush(t)}))
this.on("partialdone",(function(t){e.partialFlush(t)}))
this.on("endedtimeline",(function(t){e.endTimeline(t)}))
this.on("reset",(function(t){e.reset(t)}))
return e}
e.prototype.push=function(e){this.trigger("data",e)}
e.prototype.flush=function(e){this.trigger("done",e)}
e.prototype.partialFlush=function(e){this.trigger("partialdone",e)}
e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)}
e.prototype.reset=function(e){this.trigger("reset",e)}
var t,i,n,r,a,s,o,u,l,c,d,h,p,f,m,g,v,y,_,b,T,k,S,E,C,w,I,P,x,A,O,L,D,R,M,N,U=e,B=Math.pow(2,32),F={getUint64:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength)
return i.getBigUint64?(t=i.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:i.getUint32(0)*B+i.getUint32(4)},MAX_UINT32:B},j=F.MAX_UINT32
!function(){var e
S={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]}
if("undefined"!=typeof Uint8Array){for(e in S)S.hasOwnProperty(e)&&(S[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)])
E=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)])
w=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)])
C=new Uint8Array([0,0,0,1])
I=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])
P=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])
x={video:I,audio:P}
L=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])
O=new Uint8Array([0,0,0,0,0,0,0,0])
D=new Uint8Array([0,0,0,0,0,0,0,0])
R=D
M=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0])
N=D
A=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}()
t=function(e){var t,i,n=[],r=0
for(t=1;t<arguments.length;t++)n.push(arguments[t])
t=n.length
for(;t--;)r+=n[t].byteLength
i=new Uint8Array(r+8)
new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength)
i.set(e,4)
for(t=0,r=8;t<n.length;t++){i.set(n[t],r)
r+=n[t].byteLength}return i}
i=function(){return t(S.dinf,t(S.dref,L))}
n=function(e){return t(S.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))}
r=function(){return t(S.ftyp,E,C,E,w)}
g=function(e){return t(S.hdlr,x[e])}
a=function(e){return t(S.mdat,e)}
m=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0])
if(e.samplerate){i[12]=e.samplerate>>>24&255
i[13]=e.samplerate>>>16&255
i[14]=e.samplerate>>>8&255
i[15]=255&e.samplerate}return t(S.mdhd,i)}
f=function(e){return t(S.mdia,m(e),g(e.type),o(e))}
s=function(e){return t(S.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))}
o=function(e){return t(S.minf,"video"===e.type?t(S.vmhd,A):t(S.smhd,O),i(),y(e))}
u=function(e,i){for(var n=[],r=i.length;r--;)n[r]=b(i[r])
return t.apply(null,[S.moof,s(e)].concat(n))}
l=function(e){for(var i=e.length,n=[];i--;)n[i]=h(e[i])
return t.apply(null,[S.moov,d(4294967295)].concat(n).concat(c(e)))}
c=function(e){for(var i=e.length,n=[];i--;)n[i]=T(e[i])
return t.apply(null,[S.mvex].concat(n))}
d=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255])
return t(S.mvhd,i)}
v=function(e){var i,n,r=e.samples||[],a=new Uint8Array(4+r.length)
for(n=0;n<r.length;n++){i=r[n].flags
a[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy}return t(S.sdtp,a)}
y=function(e){return t(S.stbl,_(e),t(S.stts,N),t(S.stsc,R),t(S.stsz,M),t(S.stco,D))}
!function(){var e,i
_=function(n){return t(S.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===n.type?e(n):i(n))}
e=function(e){var i,n,r=e.sps||[],a=e.pps||[],s=[],o=[]
for(i=0;i<r.length;i++){s.push((65280&r[i].byteLength)>>>8)
s.push(255&r[i].byteLength)
s=s.concat(Array.prototype.slice.call(r[i]))}for(i=0;i<a.length;i++){o.push((65280&a[i].byteLength)>>>8)
o.push(255&a[i].byteLength)
o=o.concat(Array.prototype.slice.call(a[i]))}n=[S.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,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(S.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),t(S.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))]
if(e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1]
n.push(t(S.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return t.apply(null,n)}
i=function(e){return t(S.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),n(e))}}()
p=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0])
return t(S.tkhd,i)}
b=function(e){var i,n,r,a,s,o
i=t(S.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0]))
s=Math.floor(e.baseMediaDecodeTime/j)
o=Math.floor(e.baseMediaDecodeTime%j)
n=t(S.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o]))
0
if("audio"===e.type){r=k(e,92)
return t(S.traf,i,n,r)}a=v(e)
r=k(e,a.length+92)
return t(S.traf,i,n,r,a)}
h=function(e){e.duration=e.duration||4294967295
return t(S.trak,p(e),f(e))}
T=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1])
"video"!==e.type&&(i[i.length-1]=0)
return t(S.trex,i)}
!function(){var e,i,n
n=function(e,t){var i=0,n=0,r=0,a=0
if(e.length){void 0!==e[0].duration&&(i=1)
void 0!==e[0].size&&(n=2)
void 0!==e[0].flags&&(r=4)
void 0!==e[0].compositionTimeOffset&&(a=8)}return[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]}
i=function(e,i){var r,a,s,o,u,l
i+=20+16*(o=e.samples||[]).length
s=n(o,i);(a=new Uint8Array(s.length+16*o.length)).set(s)
r=s.length
for(l=0;l<o.length;l++){u=o[l]
a[r++]=(4278190080&u.duration)>>>24
a[r++]=(16711680&u.duration)>>>16
a[r++]=(65280&u.duration)>>>8
a[r++]=255&u.duration
a[r++]=(4278190080&u.size)>>>24
a[r++]=(16711680&u.size)>>>16
a[r++]=(65280&u.size)>>>8
a[r++]=255&u.size
a[r++]=u.flags.isLeading<<2|u.flags.dependsOn
a[r++]=u.flags.isDependedOn<<6|u.flags.hasRedundancy<<4|u.flags.paddingValue<<1|u.flags.isNonSyncSample
a[r++]=61440&u.flags.degradationPriority
a[r++]=15&u.flags.degradationPriority
a[r++]=(4278190080&u.compositionTimeOffset)>>>24
a[r++]=(16711680&u.compositionTimeOffset)>>>16
a[r++]=(65280&u.compositionTimeOffset)>>>8
a[r++]=255&u.compositionTimeOffset}return t(S.trun,a)}
e=function(e,i){var r,a,s,o,u,l
i+=20+8*(o=e.samples||[]).length
s=n(o,i);(r=new Uint8Array(s.length+8*o.length)).set(s)
a=s.length
for(l=0;l<o.length;l++){u=o[l]
r[a++]=(4278190080&u.duration)>>>24
r[a++]=(16711680&u.duration)>>>16
r[a++]=(65280&u.duration)>>>8
r[a++]=255&u.duration
r[a++]=(4278190080&u.size)>>>24
r[a++]=(16711680&u.size)>>>16
r[a++]=(65280&u.size)>>>8
r[a++]=255&u.size}return t(S.trun,r)}
k=function(t,n){return"audio"===t.type?e(t,n):i(t,n)}}()
var V,H,q,W,G,z,K,X,Y=a,Q=u,$=function(e){var t,i=r(),n=l(e);(t=new Uint8Array(i.byteLength+n.byteLength)).set(i)
t.set(n,i.byteLength)
return t},J=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}
i.dataOffset=t
i.compositionTimeOffset=e.pts-e.dts
i.duration=e.duration
i.size=4*e.length
i.size+=e.byteLength
if(e.keyFrame){i.flags.dependsOn=2
i.flags.isNonSyncSample=0}return i},Z=function(e){var t,i,n=[],r=[]
r.byteLength=0
r.nalCount=0
r.duration=0
n.byteLength=0
for(t=0;t<e.length;t++)if("access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType){if(n.length){n.duration=i.dts-n.dts
r.byteLength+=n.byteLength
r.nalCount+=n.length
r.duration+=n.duration
r.push(n)}(n=[i]).byteLength=i.data.byteLength
n.pts=i.pts
n.dts=i.dts}else{"slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0)
n.duration=i.dts-n.dts
n.byteLength+=i.data.byteLength
n.push(i)}r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration)
r.byteLength+=n.byteLength
r.nalCount+=n.length
r.duration+=n.duration
r.push(n)
return r},ee=function(e){var t,i,n=[],r=[]
n.byteLength=0
n.nalCount=0
n.duration=0
n.pts=e[0].pts
n.dts=e[0].dts
r.byteLength=0
r.nalCount=0
r.duration=0
r.pts=e[0].pts
r.dts=e[0].dts
for(t=0;t<e.length;t++)if((i=e[t]).keyFrame){if(n.length){r.push(n)
r.byteLength+=n.byteLength
r.nalCount+=n.nalCount
r.duration+=n.duration}(n=[i]).nalCount=i.length
n.byteLength=i.byteLength
n.pts=i.pts
n.dts=i.dts
n.duration=i.duration}else{n.duration+=i.duration
n.nalCount+=i.length
n.byteLength+=i.byteLength
n.push(i)}r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration)
r.byteLength+=n.byteLength
r.nalCount+=n.nalCount
r.duration+=n.duration
r.push(n)
return r},te=function(e){var t
if(!e[0][0].keyFrame&&e.length>1){t=e.shift()
e.byteLength-=t.byteLength
e.nalCount-=t.nalCount
e[0][0].dts=t.dts
e[0][0].pts=t.pts
e[0][0].duration+=t.duration}return e},ie=function(e,t){var i,n,r,a,s,o=t||0,u=[]
for(i=0;i<e.length;i++){a=e[i]
for(n=0;n<a.length;n++){s=a[n]
o+=(r=J(s,o)).size
u.push(r)}}return u},ne=function(e){var t,i,n,r,a,s,o=0,u=e.byteLength,l=e.nalCount,c=new Uint8Array(u+4*l),d=new DataView(c.buffer)
for(t=0;t<e.length;t++){r=e[t]
for(i=0;i<r.length;i++){a=r[i]
for(n=0;n<a.length;n++){s=a[n]
d.setUint32(o,s.data.byteLength)
o+=4
c.set(s.data,o)
o+=s.data.byteLength}}}return c},re=[33,16,5,32,164,27],ae=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],se=function(e){for(var t=[];e--;)t.push(0)
return t},oe=function(){if(!V){var e={96e3:[re,[227,64],se(154),[56]],88200:[re,[231],se(170),[56]],64e3:[re,[248,192],se(240),[56]],48e3:[re,[255,192],se(268),[55,148,128],se(54),[112]],44100:[re,[255,192],se(268),[55,163,128],se(84),[112]],32e3:[re,[255,192],se(268),[55,234],se(226),[112]],24e3:[re,[255,192],se(268),[55,255,128],se(268),[111,112],se(126),[224]],16e3:[re,[255,192],se(268),[55,255,128],se(268),[111,255],se(269),[223,108],se(195),[1,192]],12e3:[ae,se(268),[3,127,248],se(268),[6,255,240],se(268),[13,255,224],se(268),[27,253,128],se(259),[56]],11025:[ae,se(268),[3,127,248],se(268),[6,255,240],se(268),[13,255,224],se(268),[27,255,192],se(268),[55,175,128],se(108),[112]],8e3:[ae,se(268),[3,121,16],se(47),[7]]}
V=(t=e,Object.keys(t).reduce((function(e,i){e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[]))
return e}),{}))}var t
return V},ue=9e4
z=function(e,t){return H(G(e,t))}
K=function(e,t){return q(W(e),t)}
X=function(e,t,i){return W(i?e:e-t)}
var le=ue,ce=H=function(e){return e*ue},de=(q=function(e,t){return e*t},W=function(e){return e/ue}),he=(G=function(e,t){return e/t},z),pe=K,fe=X,me=function(e,t,i,n){var r,a,s,o,u,l=0,c=0,d=0
if(t.length){r=he(e.baseMediaDecodeTime,e.samplerate)
a=Math.ceil(le/(e.samplerate/1024))
if(i&&n){l=r-Math.max(i,n)
d=(c=Math.floor(l/a))*a}if(!(c<1||d>le/2)){(s=oe()[e.samplerate])||(s=t[0].data)
for(o=0;o<c;o++){u=t[0]
t.splice(0,0,{data:s,dts:u.dts-a,pts:u.pts-a})}e.baseMediaDecodeTime-=Math.floor(pe(d,e.samplerate))
return d}}},ge=function(e,t,i){if(t.minSegmentDts>=i)return e
t.minSegmentDts=1/0
return e.filter((function(e){if(e.dts>=i){t.minSegmentDts=Math.min(t.minSegmentDts,e.dts)
t.minSegmentPts=t.minSegmentDts
return!0}return!1}))},ve=function(e){var t,i,n=[]
for(t=0;t<e.length;t++){i=e[t]
n.push({size:i.data.byteLength,duration:1024})}return n},ye=function(e){var t,i,n=0,r=new Uint8Array(function(e){var t,i=0
for(t=0;t<e.length;t++)i+=e[t].data.byteLength
return i}(e))
for(t=0;t<e.length;t++){i=e[t]
r.set(i.data,n)
n+=i.data.byteLength}return r},_e=le,be=function(e){delete e.minSegmentDts
delete e.maxSegmentDts
delete e.minSegmentPts
delete e.maxSegmentPts},Te=function(e,t){var i,n=e.minSegmentDts
t||(n-=e.timelineStartInfo.dts)
i=e.timelineStartInfo.baseMediaDecodeTime
i+=n
i=Math.max(0,i)
if("audio"===e.type){i*=e.samplerate/_e
i=Math.floor(i)}return i},ke=function(e,t){if("number"==typeof t.pts){void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts)
void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts)
void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)}if("number"==typeof t.dts){void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts)
void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts)
void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts)}},Se=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];){n+=255
t++}n+=e[t++]
for(;255===e[t];){r+=255
t++}r+=e[t++]
if(!i.payload&&4===n){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){i.payloadType=n
i.payloadSize=r
i.payload=e.subarray(t,t+r)
break}i.payload=void 0}t+=r
n=0
r=0}return i},Ee=function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},Ce=function(e,t){var i,n,r,a,s=[]
if(!(64&t[0]))return s
n=31&t[0]
for(i=0;i<n;i++){a={type:3&t[(r=3*i)+2],pts:e}
if(4&t[r+2]){a.ccData=t[r+3]<<8|t[r+4]
s.push(a)}}return s},we=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)if(0===e[a]&&0===e[a+1]&&3===e[a+2]){r.push(a+2)
a+=2}else a++
if(0===r.length)return e
t=n-r.length
i=new Uint8Array(t)
var s=0
for(a=0;a<t;s++,a++){if(s===r[0]){s++
r.shift()}i[a]=e[s]}return i},Ie=4,Pe=function e(t){t=t||{}
e.prototype.init.call(this)
this.parse708captions_="boolean"!=typeof t.parse708captions||t.parse708captions
this.captionPackets_=[]
this.ccStreams_=[new Be(0,0),new Be(0,1),new Be(1,0),new Be(1,1)]
this.parse708captions_&&(this.cc708Stream_=new De({captionServices:t.captionServices}))
this.reset()
this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data"))
e.on("partialdone",this.trigger.bind(this,"partialdone"))
e.on("done",this.trigger.bind(this,"done"))}),this)
if(this.parse708captions_){this.cc708Stream_.on("data",this.trigger.bind(this,"data"))
this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone"))
this.cc708Stream_.on("done",this.trigger.bind(this,"done"))}};(Pe.prototype=new U).push=function(e){var t,i,n
if("sei_rbsp"===e.nalUnitType&&(t=Se(e.escapedRBSP)).payload&&t.payloadType===Ie&&(i=Ee(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0
else if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--
this.numSameDts_||(this.ignoreNextEqualDts_=!1)}else{n=Ce(e.pts,i)
this.captionPackets_=this.captionPackets_.concat(n)
this.latestDts_!==e.dts&&(this.numSameDts_=0)
this.numSameDts_++
this.latestDts_=e.dts}}
Pe.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)}
Pe.prototype.flushStream=function(e){if(this.captionPackets_.length){this.captionPackets_.forEach((function(e,t){e.presortIndex=t}))
this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts}))
this.captionPackets_.forEach((function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)}),this)
this.captionPackets_.length=0
this.flushCCStreams(e)}else this.flushCCStreams(e)}
Pe.prototype.flush=function(){return this.flushStream("flush")}
Pe.prototype.partialFlush=function(){return this.flushStream("partialFlush")}
Pe.prototype.reset=function(){this.latestDts_=null
this.ignoreNextEqualDts_=!1
this.numSameDts_=0
this.activeCea608Channel_=[null,null]
this.ccStreams_.forEach((function(e){e.reset()}))}
Pe.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1)
null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)}
Pe.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)}
Pe.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)}
Pe.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)}
Pe.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)}
var xe={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},Ae=function(e){return 32<=e&&e<=127||160<=e&&e<=255},Oe=function(e){this.windowNum=e
this.reset()}
Oe.prototype.reset=function(){this.clearText()
this.pendingNewLine=!1
this.winAttr={}
this.penAttr={}
this.penLoc={}
this.penColor={}
this.visible=0
this.rowLock=0
this.columnLock=0
this.priority=0
this.relativePositioning=0
this.anchorVertical=0
this.anchorHorizontal=0
this.anchorPoint=0
this.rowCount=1
this.virtualRowCount=this.rowCount+1
this.columnCount=41
this.windowStyle=0
this.penStyle=0}
Oe.prototype.getText=function(){return this.rows.join("\n")}
Oe.prototype.clearText=function(){this.rows=[""]
this.rowIdx=0}
Oe.prototype.newLine=function(e){this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e)
if(this.rows.length>0){this.rows.push("")
this.rowIdx++}for(;this.rows.length>this.virtualRowCount;){this.rows.shift()
this.rowIdx--}}
Oe.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]}
Oe.prototype.addText=function(e){this.rows[this.rowIdx]+=e}
Oe.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx]
this.rows[this.rowIdx]=e.substr(0,e.length-1)}}
var Le=function(e,t,i){this.serviceNum=e
this.text=""
this.currentWindow=new Oe(-1)
this.windows=[]
this.stream=i
"string"==typeof t&&this.createTextDecoder(t)}
Le.prototype.init=function(e,t){this.startPts=e
for(var i=0;i<8;i++){this.windows[i]=new Oe(i)
"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)}}
Le.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]}
Le.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"})
else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}}
var De=function e(t){t=t||{}
e.prototype.init.call(this)
var i,n=this,r=t.captionServices||{},a={}
Object.keys(r).forEach((function(e){i=r[e];/^SERVICE/.test(e)&&(a[e]=i.encoding)}))
this.serviceEncodings=a
this.current708Packet=null
this.services={}
this.push=function(e){if(3===e.type){n.new708Packet()
n.add708Bytes(e)}else{null===n.current708Packet&&n.new708Packet()
n.add708Bytes(e)}}}
De.prototype=new U
De.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet()
this.current708Packet={data:[],ptsVals:[]}}
De.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t
this.current708Packet.ptsVals.push(e.pts)
this.current708Packet.data.push(i)
this.current708Packet.data.push(n)}
De.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,r=0,a=t[r++]
e.seq=a>>6
e.sizeCode=63&a
for(;r<t.length;r++){n=31&(a=t[r++])
7===(i=a>>5)&&n>0&&(i=a=t[r++])
this.pushServiceBlock(i,r,n)
n>0&&(r+=n-1)}}
De.prototype.pushServiceBlock=function(e,t,i){var n,r=t,a=this.current708Packet.data,s=this.services[e]
s||(s=this.initService(e,r))
for(;r<t+i&&r<a.length;r++){n=a[r]
Ae(n)?r=this.handleText(r,s):24===n?r=this.multiByteCharacter(r,s):16===n?r=this.extendedCommands(r,s):128<=n&&n<=135?r=this.setCurrentWindow(r,s):152<=n&&n<=159?r=this.defineWindow(r,s):136===n?r=this.clearWindows(r,s):140===n?r=this.deleteWindows(r,s):137===n?r=this.displayWindows(r,s):138===n?r=this.hideWindows(r,s):139===n?r=this.toggleWindows(r,s):151===n?r=this.setWindowAttributes(r,s):144===n?r=this.setPenAttributes(r,s):145===n?r=this.setPenColor(r,s):146===n?r=this.setPenLocation(r,s):143===n?s=this.reset(r,s):8===n?s.currentWindow.backspace():12===n?s.currentWindow.clearText():13===n?s.currentWindow.pendingNewLine=!0:14===n?s.currentWindow.clearText():141===n&&r++}}
De.prototype.extendedCommands=function(e,t){var i=this.current708Packet.data[++e]
Ae(i)&&(e=this.handleText(e,t,{isExtended:!0}))
return e}
De.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]}
De.prototype.initService=function(e,t){var i,n,r=this;(