import{aj as wn,aq as Qp,u as Jp,r as lt,ad as Zp,_ as em,P as tm,L as im,g as ki,ac as rm,Y as Vu,o as di,h as vr,i as Ot,w as Yt,m as yt,z as ju,B as Wu,j as qu,q as nm,t as Gu,Z as am,V as sm,W as om,X as um}from"./vendor.0bc3c1d4.js";import{a as lm,b as dm,c as cm}from"./index.14ca5e32.js";import{_ as fm}from"./index.fceaba64.js";var _r;typeof window!="undefined"?_r=window:typeof wn!="undefined"?_r=wn:typeof self!="undefined"?_r=self:_r={};var w=_r,hm={},pm=Object.freeze(Object.defineProperty({__proto__:null,default:hm},Symbol.toStringTag,{value:"Module"})),mm=Qp(pm),zu=typeof wn!="undefined"?wn:typeof window!="undefined"?window:{},gm=mm,yr;typeof document!="undefined"?yr=document:(yr=zu["__GLOBAL_DOCUMENT_CACHE@4"],yr||(yr=zu["__GLOBAL_DOCUMENT_CACHE@4"]=gm));var G=yr;function dt(){return dt=Object.assign?Object.assign.bind():function(a){for(var t=1;t=400&&e.statusCode<=599){var s=r;if(i)if(xm.TextDecoder){var o=Em(e.headers&&e.headers["content-type"]);try{s=new TextDecoder(o).decode(r)}catch{}}else s=String.fromCharCode.apply(null,new Uint8Array(r));t({cause:s});return}t(null,r)}};function Em(a){return a===void 0&&(a=""),a.toLowerCase().split(";").reduce(function(t,i){var n=i.split("="),e=n[0],r=n[1];return e.trim()==="charset"?r.trim():t},"utf-8")}var Cm=Sm,Ku=w,wm=$u.exports,Pm=ym;Tt.httpHandler=Cm;/** * @license * slighly modified parse-headers 2.0.2 * Copyright (c) 2014 David Björklund * Available under the MIT license * */var km=function(t){var i={};return t&&t.trim().split(` `).forEach(function(n){var e=n.indexOf(":"),r=n.slice(0,e).trim().toLowerCase(),s=n.slice(e+1).trim();typeof i[r]=="undefined"?i[r]=s:Array.isArray(i[r])?i[r].push(s):i[r]=[i[r],s]}),i};Qa.exports=Tt;Qa.exports.default=Tt;Tt.XMLHttpRequest=Ku.XMLHttpRequest||Om;Tt.XDomainRequest="withCredentials"in new Tt.XMLHttpRequest?Tt.XMLHttpRequest:Ku.XDomainRequest;Am(["get","put","post","patch","head","delete"],function(a){Tt[a==="delete"?"del":a]=function(t,i,n){return i=Xu(t,i,n),i.method=a.toUpperCase(),Yu(i)}});function Am(a,t){for(var i=0;i0&&(x=setTimeout(function(){if(!l){l=!0,o.abort("timeout");var O=new Error("XMLHttpRequest timeout");O.code="ETIMEDOUT",r(O)}},a.timeout)),o.setRequestHeader)for(u in y)y.hasOwnProperty(u)&&o.setRequestHeader(u,y[u]);else if(a.headers&&!Im(a.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in a&&(o.responseType=a.responseType),"beforeSend"in a&&typeof a.beforeSend=="function"&&a.beforeSend(o),o.send(p||null),o}function Dm(a){try{if(a.responseType==="document")return a.responseXML;var t=a.responseXML&&a.responseXML.documentElement.nodeName==="parsererror";if(a.responseType===""&&!t)return a.responseXML}catch{}return null}function Om(){}var Qu=Qa.exports,Ju={exports:{}},Zu=G,Ja=Object.create||function(){function a(){}return function(t){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return a.prototype=t,new a}}();function it(a,t){this.name="ParsingError",this.code=a.code,this.message=t||a.message}it.prototype=Ja(Error.prototype);it.prototype.constructor=it;it.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function Za(a){function t(n,e,r,s){return(n|0)*3600+(e|0)*60+(r|0)+(s|0)/1e3}var i=a.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function br(){this.values=Ja(null)}br.prototype={set:function(a,t){!this.get(a)&&t!==""&&(this.values[a]=t)},get:function(a,t,i){return i?this.has(a)?this.values[a]:t[i]:this.has(a)?this.values[a]:t},has:function(a){return a in this.values},alt:function(a,t,i){for(var n=0;n=0&&t<=100)?(this.set(a,t),!0):!1}};function xr(a,t,i,n){var e=n?a.split(n):[a];for(var r in e)if(typeof e[r]=="string"){var s=e[r].split(i);if(s.length===2){var o=s[0].trim(),u=s[1].trim();t(o,u)}}}function Lm(a,t,i){var n=a;function e(){var o=Za(a);if(o===null)throw new it(it.Errors.BadTimeStamp,"Malformed timestamp: "+n);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function r(o,u){var l=new br;xr(o,function(c,g){switch(c){case"region":for(var p=i.length-1;p>=0;p--)if(i[p].id===g){l.set(c,i[p].region);break}break;case"vertical":l.alt(c,g,["rl","lr"]);break;case"line":var y=g.split(","),b=y[0];l.integer(c,b),l.percent(c,b)&&l.set("snapToLines",!1),l.alt(c,b,["auto"]),y.length===2&&l.alt("lineAlign",y[1],["start","center","end"]);break;case"position":y=g.split(","),l.percent(c,y[0]),y.length===2&&l.alt("positionAlign",y[1],["start","center","end"]);break;case"size":l.percent(c,g);break;case"align":l.alt(c,g,["start","center","end","left","right"]);break}},/:/,/\s/),u.region=l.get("region",null),u.vertical=l.get("vertical","");try{u.line=l.get("line","auto")}catch{}u.lineAlign=l.get("lineAlign","start"),u.snapToLines=l.get("snapToLines",!0),u.size=l.get("size",100);try{u.align=l.get("align","center")}catch{u.align=l.get("align","middle")}try{u.position=l.get("position","auto")}catch{u.position=l.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},u.align)}u.positionAlign=l.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},u.align)}function s(){a=a.replace(/^\s+/,"")}if(s(),t.startTime=e(),s(),a.substr(0,3)!=="-->")throw new it(it.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+n);a=a.substr(3),s(),t.endTime=e(),s(),r(a,t)}var es=Zu.createElement&&Zu.createElement("textarea"),Mm={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},el={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},Rm={v:"title",lang:"lang"},tl={rt:"ruby"};function il(a,t){function i(){if(!t)return null;function b(x){return t=t.substr(x.length),x}var S=t.match(/^([^<]*)(<[^>]*>?)?/);return b(S[1]?S[1]:S[2])}function n(b){return es.innerHTML=b,b=es.textContent,es.textContent="",b}function e(b,S){return!tl[S.localName]||tl[S.localName]===b.localName}function r(b,S){var x=Mm[b];if(!x)return null;var A=a.document.createElement(x),O=Rm[b];return O&&S&&(A[O]=S.trim()),A}for(var s=a.document.createElement("div"),o=s,u,l=[];(u=i())!==null;){if(u[0]==="<"){if(u[1]==="/"){l.length&&l[l.length-1]===u.substr(2).replace(">","")&&(l.pop(),o=o.parentNode);continue}var c=Za(u.substr(1,u.length-2)),g;if(c){g=a.document.createProcessingInstruction("timestamp",c),o.appendChild(g);continue}var p=u.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!p||(g=r(p[1],p[3]),!g)||!e(o,g))continue;if(p[2]){var y=p[2].split(".");y.forEach(function(b){var S=/^bg_/.test(b),x=S?b.slice(3):b;if(el.hasOwnProperty(x)){var A=S?"background-color":"color",O=el[x];g.style[A]=O}}),g.className=y.join(" ")}l.push(p[1]),o.appendChild(g),o=g;continue}o.appendChild(a.document.createTextNode(n(u)))}return s}var rl=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Nm(a){for(var t=0;t=i[0]&&a<=i[1])return!0}return!1}function Fm(a){var t=[],i="",n;if(!a||!a.childNodes)return"ltr";function e(o,u){for(var l=u.childNodes.length-1;l>=0;l--)o.push(u.childNodes[l])}function r(o){if(!o||!o.length)return null;var u=o.pop(),l=u.textContent||u.innerText;if(l){var c=l.match(/^.*(\n|\r)/);return c?(o.length=0,c[0]):l}if(u.tagName==="ruby")return r(o);if(u.childNodes)return e(o,u),r(o)}for(e(t,a);i=r(t);)for(var s=0;s=0&&a.line<=100))return a.line;if(!a.track||!a.track.textTrackList||!a.track.textTrackList.mediaElement)return-1;for(var t=a.track,i=t.textTrackList,n=0,e=0;ea.left&&this.topa.top};We.prototype.overlapsAny=function(a){for(var t=0;t=a.top&&this.bottom<=a.bottom&&this.left>=a.left&&this.right<=a.right};We.prototype.overlapsOppositeAxis=function(a,t){switch(t){case"+x":return this.lefta.right;case"+y":return this.topa.bottom}};We.prototype.intersectPercentage=function(a){var t=Math.max(0,Math.min(this.right,a.right)-Math.max(this.left,a.left)),i=Math.max(0,Math.min(this.bottom,a.bottom)-Math.max(this.top,a.top)),n=t*i;return n/(this.height*this.width)};We.prototype.toCSSCompatValues=function(a){return{top:this.top-a.top,bottom:a.bottom-this.bottom,left:this.left-a.left,right:a.right-this.right,height:this.height,width:this.width}};We.getSimpleBoxPosition=function(a){var t=a.div?a.div.offsetHeight:a.tagName?a.offsetHeight:0,i=a.div?a.div.offsetWidth:a.tagName?a.offsetWidth:0,n=a.div?a.div.offsetTop:a.tagName?a.offsetTop:0;a=a.div?a.div.getBoundingClientRect():a.tagName?a.getBoundingClientRect():a;var e={left:a.left,right:a.right,top:a.top||n,height:a.height||t,bottom:a.bottom||n+(a.height||t),width:a.width||i};return e};function Bm(a,t,i,n){function e(x,A){for(var O,H=new We(x),L=1,M=0;Mj&&(O=new We(x),L=j),x=new We(H)}return O||H}var r=new We(t),s=t.cue,o=Um(s),u=[];if(s.snapToLines){var l;switch(s.vertical){case"":u=["+y","-y"],l="height";break;case"rl":u=["+x","-x"],l="width";break;case"lr":u=["-x","+x"],l="width";break}var c=r.lineHeight,g=c*Math.round(o),p=i[l]+c,y=u[0];Math.abs(g)>p&&(g=g<0?-1:1,g*=Math.ceil(p/c)*c),o<0&&(g+=s.vertical===""?i.height:i.width,u=u.reverse()),r.move(y,g)}else{var b=r.lineHeight/i.height*100;switch(s.lineAlign){case"center":o-=b/2;break;case"end":o-=b;break}switch(s.vertical){case"":t.applyStyles({top:t.formatStyle(o,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(o,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(o,"%")});break}u=["+y","-x","+x","-y"],r=new We(t)}var S=e(r,u);t.move(S.toCSSCompatValues(i))}function Ai(){}Ai.StringDecoder=function(){return{decode:function(a){if(!a)return"";if(typeof a!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))}}};Ai.convertCueToDOMTree=function(a,t){return!a||!t?null:il(a,t)};var Hm=.05,Vm="sans-serif",jm="1.5%";Ai.processCues=function(a,t,i){if(!a||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=a.document.createElement("div");n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin=jm,i.appendChild(n);function e(c){for(var g=0;g")===-1){t.cue.id=s;continue}case"CUE":try{Lm(s,t.cue,t.regionList)}catch(c){t.reportOrThrowError(c),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var l=s.indexOf("-->")!==-1;if(!s||l&&(u=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+=` `),t.cue.text+=s.replace(/\u2028/g,` `).replace(/u2029/g,` `);continue;case"BADCUE":s||(t.state="ID");continue}}}catch(c){t.reportOrThrowError(c),t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var a=this;try{if(a.buffer+=a.decoder.decode(),(a.cue||a.state==="HEADER")&&(a.buffer+=` `,a.parse()),a.state==="INITIAL")throw new it(it.Errors.BadSignature)}catch(t){a.reportOrThrowError(t)}return a.onflush&&a.onflush(),this}};var Wm=Ai,qm="auto",Gm={"":1,lr:1,rl:1},zm={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function $m(a){if(typeof a!="string")return!1;var t=Gm[a.toLowerCase()];return t?a.toLowerCase():!1}function ts(a){if(typeof a!="string")return!1;var t=zm[a.toLowerCase()];return t?a.toLowerCase():!1}function nl(a,t,i){this.hasBeenReset=!1;var n="",e=!1,r=a,s=t,o=i,u=null,l="",c=!0,g="auto",p="start",y="auto",b="auto",S=100,x="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(A){n=""+A}},pauseOnExit:{enumerable:!0,get:function(){return e},set:function(A){e=!!A}},startTime:{enumerable:!0,get:function(){return r},set:function(A){if(typeof A!="number")throw new TypeError("Start time must be set to a number.");r=A,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return s},set:function(A){if(typeof A!="number")throw new TypeError("End time must be set to a number.");s=A,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(A){o=""+A,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(A){u=A,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(A){var O=$m(A);if(O===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");l=O,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(A){c=!!A,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return g},set:function(A){if(typeof A!="number"&&A!==qm)throw new SyntaxError("Line: an invalid number or illegal string was specified.");g=A,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return p},set:function(A){var O=ts(A);O?(p=O,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return y},set:function(A){if(A<0||A>100)throw new Error("Position must be between 0 and 100.");y=A,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return b},set:function(A){var O=ts(A);O?(b=O,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return S},set:function(A){if(A<0||A>100)throw new Error("Size must be between 0 and 100.");S=A,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return x},set:function(A){var O=ts(A);if(!O)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");x=O,this.hasBeenReset=!0}}}),this.displayState=void 0}nl.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Km=nl,Xm={"":!0,up:!0};function Ym(a){if(typeof a!="string")return!1;var t=Xm[a.toLowerCase()];return t?a.toLowerCase():!1}function Sr(a){return typeof a=="number"&&a>=0&&a<=100}function Qm(){var a=100,t=3,i=0,n=100,e=0,r=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(o){if(!Sr(o))throw new Error("Width must be between 0 and 100.");a=o}},lines:{enumerable:!0,get:function(){return t},set:function(o){if(typeof o!="number")throw new TypeError("Lines must be set to a number.");t=o}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(o){if(!Sr(o))throw new Error("RegionAnchorX must be between 0 and 100.");n=o}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(o){if(!Sr(o))throw new Error("RegionAnchorY must be between 0 and 100.");i=o}},viewportAnchorY:{enumerable:!0,get:function(){return r},set:function(o){if(!Sr(o))throw new Error("ViewportAnchorY must be between 0 and 100.");r=o}},viewportAnchorX:{enumerable:!0,get:function(){return e},set:function(o){if(!Sr(o))throw new Error("ViewportAnchorX must be between 0 and 100.");e=o}},scroll:{enumerable:!0,get:function(){return s},set:function(o){var u=Ym(o);u===!1?console.warn("Scroll: an invalid or illegal string was specified."):s=u}}})}var Jm=Qm,Lt=w,ci=Ju.exports={WebVTT:Wm,VTTCue:Km,VTTRegion:Jm};Lt.vttjs=ci;Lt.WebVTT=ci.WebVTT;var Zm=ci.VTTCue,eg=ci.VTTRegion,tg=Lt.VTTCue,ig=Lt.VTTRegion;ci.shim=function(){Lt.VTTCue=Zm,Lt.VTTRegion=eg};ci.restore=function(){Lt.VTTCue=tg,Lt.VTTRegion=ig};Lt.VTTCue||ci.shim();var al=Ju.exports;function rg(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function An(a,t,i){return rg()?An=Reflect.construct.bind():An=function(e,r,s){var o=[null];o.push.apply(o,r);var u=Function.bind.apply(e,o),l=new u;return s&&Tr(l,s.prototype),l},An.apply(null,arguments)}function ng(a,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(t&&t.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),t&&Tr(a,t)}var sl={exports:{}};(function(a,t){(function(i){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,e=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(u,l,c){if(c=c||{},u=u.trim(),l=l.trim(),!l){if(!c.alwaysNormalize)return u;var g=o.parseURL(u);if(!g)throw new Error("Error trying to parse base URL.");return g.path=o.normalizePath(g.path),o.buildURLFromParts(g)}var p=o.parseURL(l);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return c.alwaysNormalize?(p.path=o.normalizePath(p.path),o.buildURLFromParts(p)):l;var y=o.parseURL(u);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var b=e.exec(y.path);y.netLoc=b[1],y.path=b[2]}y.netLoc&&!y.path&&(y.path="/");var S={scheme:y.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(S.netLoc=y.netLoc,p.path[0]!=="/"))if(!p.path)S.path=y.path,p.params||(S.params=y.params,p.query||(S.query=y.query));else{var x=y.path,A=x.substring(0,x.lastIndexOf("/")+1)+p.path;S.path=o.normalizePath(A)}return S.path===null&&(S.path=c.alwaysNormalize?o.normalizePath(p.path):p.path),o.buildURLFromParts(S)},parseURL:function(u){var l=n.exec(u);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[6]||""}:null},normalizePath:function(u){for(u=u.split("").reverse().join("").replace(r,"");u.length!==(u=u.replace(s,"")).length;);return u.split("").reverse().join("")},buildURLFromParts:function(u){return u.scheme+u.netLoc+u.path+u.params+u.query+u.fragment}};a.exports=o})()})(sl);var ol=sl.exports,ul="http://example.com",In=function(t,i){if(/^[a-z]+:/i.test(i))return i;/^data:/.test(t)&&(t=w.location&&w.location.href||"");var n=typeof w.URL=="function",e=/^\/\//.test(t),r=!w.location&&!/\/\//i.test(t);if(n?t=new w.URL(t,w.location||ul):/\/\//i.test(t)||(t=ol.buildAbsoluteURL(w.location&&w.location.href||"",t)),n){var s=new URL(i,t);return r?s.href.slice(ul.length):e?s.href.slice(s.protocol.length):s.href}return ol.buildAbsoluteURL(t,i)},is=function(){function a(){this.listeners={}}var t=a.prototype;return t.on=function(n,e){this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push(e)},t.off=function(n,e){if(!this.listeners[n])return!1;var r=this.listeners[n].indexOf(e);return this.listeners[n]=this.listeners[n].slice(0),this.listeners[n].splice(r,1),r>-1},t.trigger=function(n){var e=this.listeners[n];if(!!e)if(arguments.length===2)for(var r=e.length,s=0;s-1;r=this.buffer.indexOf(` `))this.trigger("data",this.buffer.substring(0,r)),this.buffer=this.buffer.substring(r+1)},t}(is),og=String.fromCharCode(9),rs=function(t){var i=/([0-9.]*)?@?([0-9.]*)?/.exec(t||""),n={};return i[1]&&(n.length=parseInt(i[1],10)),i[2]&&(n.offset=parseInt(i[2],10)),n},ug=function(){var t="[^=]*",i='"[^"]*"|[^,]*',n="(?:"+t+")=(?:"+i+")";return new RegExp("(?:^|,)("+n+")")},ct=function(t){for(var i=t.split(ug()),n={},e=i.length,r;e--;)i[e]!==""&&(r=/([^=]*)=(.*)/.exec(i[e]).slice(1),r[0]=r[0].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^['"](.*)['"]$/g,"$1"),n[r[0]]=r[1]);return n},lg=function(a){$(t,a);function t(){var n;return n=a.call(this)||this,n.customParsers=[],n.tagMappers=[],n}var i=t.prototype;return i.push=function(e){var r=this,s,o;if(e=e.trim(),e.length!==0){if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}var u=this.tagMappers.reduce(function(l,c){var g=c(e);return g===e?l:l.concat([g])},[e]);u.forEach(function(l){for(var c=0;c0&&(s.duration=x.duration),x.duration===0&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key:function(){if(!x.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(x.attributes.METHOD==="NONE"){u=null;return}if(!x.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(x.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:x.attributes};return}if(x.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:x.attributes.URI};return}if(x.attributes.KEYFORMAT===p){var M=["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"];if(M.indexOf(x.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(x.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),x.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(x.attributes.KEYID&&x.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:x.attributes.KEYFORMAT,keyId:x.attributes.KEYID.substring(2)},pssh:ll(x.attributes.URI.split(",")[1])};return}x.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),u={method:x.attributes.METHOD||"AES-128",uri:x.attributes.URI},typeof x.attributes.IV!="undefined"&&(u.iv=x.attributes.IV)},"media-sequence":function(){if(!isFinite(x.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+x.number});return}this.manifest.mediaSequence=x.number},"discontinuity-sequence":function(){if(!isFinite(x.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+x.number});return}this.manifest.discontinuitySequence=x.number,y=x.number},"playlist-type":function(){if(!/VOD|EVENT/.test(x.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+x.playlist});return}this.manifest.playlistType=x.playlistType},map:function(){o={},x.uri&&(o.uri=x.uri),x.byterange&&(o.byterange=x.byterange),u&&(o.key=u)},"stream-inf":function(){if(this.manifest.playlists=r,this.manifest.mediaGroups=this.manifest.mediaGroups||g,!x.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}s.attributes||(s.attributes={}),dt(s.attributes,x.attributes)},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||g,!(x.attributes&&x.attributes.TYPE&&x.attributes["GROUP-ID"]&&x.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}var M=this.manifest.mediaGroups[x.attributes.TYPE];M[x.attributes["GROUP-ID"]]=M[x.attributes["GROUP-ID"]]||{},A=M[x.attributes["GROUP-ID"]],O={default:/yes/i.test(x.attributes.DEFAULT)},O.default?O.autoselect=!0:O.autoselect=/yes/i.test(x.attributes.AUTOSELECT),x.attributes.LANGUAGE&&(O.language=x.attributes.LANGUAGE),x.attributes.URI&&(O.uri=x.attributes.URI),x.attributes["INSTREAM-ID"]&&(O.instreamId=x.attributes["INSTREAM-ID"]),x.attributes.CHARACTERISTICS&&(O.characteristics=x.attributes.CHARACTERISTICS),x.attributes.FORCED&&(O.forced=/yes/i.test(x.attributes.FORCED)),A[x.attributes.NAME]=O},discontinuity:function(){y+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(r.length)},"program-date-time":function(){typeof this.manifest.dateTimeString=="undefined"&&(this.manifest.dateTimeString=x.dateTimeString,this.manifest.dateTimeObject=x.dateTimeObject),s.dateTimeString=x.dateTimeString,s.dateTimeObject=x.dateTimeObject},targetduration:function(){if(!isFinite(x.duration)||x.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+x.duration});return}this.manifest.targetDuration=x.duration,ns.call(this,this.manifest)},start:function(){if(!x.attributes||isNaN(x.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:x.attributes["TIME-OFFSET"],precise:x.attributes.PRECISE}},"cue-out":function(){s.cueOut=x.data},"cue-out-cont":function(){s.cueOutCont=x.data},"cue-in":function(){s.cueIn=x.data},skip:function(){this.manifest.skip=Ii(x.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",x.attributes,["SKIPPED-SEGMENTS"])},part:function(){var M=this;l=!0;var j=this.manifest.segments.length,U=Ii(x.attributes);s.parts=s.parts||[],s.parts.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=S),S=U.byterange.offset+U.byterange.length);var F=s.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+F+" for segment #"+j,x.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(function(W,R){W.hasOwnProperty("lastPart")||M.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+R+" lacks required attribute(s): LAST-PART"})})},"server-control":function(){var M=this.manifest.serverControl=Ii(x.attributes);M.hasOwnProperty("canBlockReload")||(M.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),ns.call(this,this.manifest),M.canSkipDateranges&&!M.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var M=this.manifest.segments.length,j=Ii(x.attributes),U=j.type&&j.type==="PART";s.preloadHints=s.preloadHints||[],s.preloadHints.push(j),j.byterange&&(j.byterange.hasOwnProperty("offset")||(j.byterange.offset=U?S:0,U&&(S=j.byterange.offset+j.byterange.length)));var F=s.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+F+" for segment #"+M,x.attributes,["TYPE","URI"]),!!j.type)for(var W=0;Wg&&(c-=g,c-=g,c-=Me(2))}return Number(c)},xg=function(t,i){var n=i===void 0?{}:i,e=n.le,r=e===void 0?!1:e;(typeof t!="bigint"&&typeof t!="number"||typeof t=="number"&&t!==t)&&(t=0),t=Me(t);for(var s=yg(t),o=new Uint8Array(new ArrayBuffer(s)),u=0;u=i.length&&l.call(i,function(c,g){var p=u[g]?u[g]&t[s+g]:t[s+g];return c===p})},Eg=function(t,i,n){i.forEach(function(e){for(var r in t.mediaGroups[e])for(var s in t.mediaGroups[e][r]){var o=t.mediaGroups[e][r][s];n(o,e,r,s)}})},Qt={},Jt={};function Cg(a,t,i){if(i===void 0&&(i=Array.prototype),a&&typeof i.find=="function")return i.find.call(a,t);for(var n=0;n=0){for(var e=t.length-1;n0},lookupPrefix:function(a){for(var t=this;t;){var i=t._nsMap;if(i){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===a)return n}t=t.nodeType==Di?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(a){for(var t=this;t;){var i=t._nsMap;if(i&&a in i&&Object.prototype.hasOwnProperty.call(i,a))return i[a];t=t.nodeType==Di?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(a){var t=this.lookupPrefix(a);return t==null}};function Ll(a){return a=="<"&&"<"||a==">"&&">"||a=="&"&&"&"||a=='"'&&"""||"&#"+a.charCodeAt()+";"}wr(Qe,he);wr(Qe,he.prototype);function Pr(a,t){if(t(a))return!0;if(a=a.firstChild)do if(Pr(a,t))return!0;while(a=a.nextSibling)}function kr(){this.ownerDocument=this}function Og(a,t,i){a&&a._inc++;var n=i.namespaceURI;n===Cr.XMLNS&&(t._nsMap[i.prefix?i.localName:""]=i.value)}function Ml(a,t,i,n){a&&a._inc++;var e=i.namespaceURI;e===Cr.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function ls(a,t,i){if(a&&a._inc){a._inc++;var n=t.childNodes;if(i)n[n.length++]=i;else{for(var e=t.firstChild,r=0;e;)n[r++]=e,e=e.nextSibling;n.length=r,delete n[n.length]}}}function Rl(a,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:a.firstChild=n,n?n.previousSibling=i:a.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,ls(a.ownerDocument,a),t}function Lg(a){return a&&(a.nodeType===he.DOCUMENT_NODE||a.nodeType===he.DOCUMENT_FRAGMENT_NODE||a.nodeType===he.ELEMENT_NODE)}function Mg(a){return a&&(St(a)||ds(a)||Nt(a)||a.nodeType===he.DOCUMENT_FRAGMENT_NODE||a.nodeType===he.COMMENT_NODE||a.nodeType===he.PROCESSING_INSTRUCTION_NODE)}function Nt(a){return a&&a.nodeType===he.DOCUMENT_TYPE_NODE}function St(a){return a&&a.nodeType===he.ELEMENT_NODE}function ds(a){return a&&a.nodeType===he.TEXT_NODE}function Nl(a,t){var i=a.childNodes||[];if(xt(i,St)||Nt(t))return!1;var n=xt(i,Nt);return!(t&&n&&i.indexOf(n)>i.indexOf(t))}function Fl(a,t){var i=a.childNodes||[];function n(r){return St(r)&&r!==t}if(xt(i,n))return!1;var e=xt(i,Nt);return!(t&&e&&i.indexOf(e)>i.indexOf(t))}function Rg(a,t,i){if(!Lg(a))throw new Se(Je,"Unexpected parent node type "+a.nodeType);if(i&&i.parentNode!==a)throw new Se(Pl,"child not in parent");if(!Mg(t)||Nt(t)&&a.nodeType!==he.DOCUMENT_NODE)throw new Se(Je,"Unexpected node type "+t.nodeType+" for parent node type "+a.nodeType)}function Ng(a,t,i){var n=a.childNodes||[],e=t.childNodes||[];if(t.nodeType===he.DOCUMENT_FRAGMENT_NODE){var r=e.filter(St);if(r.length>1||xt(e,ds))throw new Se(Je,"More than one element or text in fragment");if(r.length===1&&!Nl(a,i))throw new Se(Je,"Element in fragment can not be inserted before doctype")}if(St(t)&&!Nl(a,i))throw new Se(Je,"Only one element can be added and only after doctype");if(Nt(t)){if(xt(n,Nt))throw new Se(Je,"Only one doctype is allowed");var s=xt(n,St);if(i&&n.indexOf(s)1||xt(e,ds))throw new Se(Je,"More than one element or text in fragment");if(r.length===1&&!Fl(a,i))throw new Se(Je,"Element in fragment can not be inserted before doctype")}if(St(t)&&!Fl(a,i))throw new Se(Je,"Only one element can be added and only after doctype");if(Nt(t)){if(xt(n,function(u){return Nt(u)&&u!==i}))throw new Se(Je,"Only one doctype is allowed");var s=xt(n,St);if(i&&n.indexOf(s)0&&Pr(i.documentElement,function(e){if(e!==i&&e.nodeType===ft){var r=e.getAttribute("class");if(r){var s=a===r;if(!s){var o=Tl(r);s=t.every(Ag(o))}s&&n.push(e)}}}),n})},createElement:function(a){var t=new hi;t.ownerDocument=this,t.nodeName=a,t.tagName=a,t.localName=a,t.childNodes=new Rt;var i=t.attributes=new Ln;return i._ownerElement=t,t},createDocumentFragment:function(){var a=new Fn;return a.ownerDocument=this,a.childNodes=new Rt,a},createTextNode:function(a){var t=new cs;return t.ownerDocument=this,t.appendData(a),t},createComment:function(a){var t=new fs;return t.ownerDocument=this,t.appendData(a),t},createCDATASection:function(a){var t=new hs;return t.ownerDocument=this,t.appendData(a),t},createProcessingInstruction:function(a,t){var i=new ms;return i.ownerDocument=this,i.tagName=i.target=a,i.nodeValue=i.data=t,i},createAttribute:function(a){var t=new Rn;return t.ownerDocument=this,t.name=a,t.nodeName=a,t.localName=a,t.specified=!0,t},createEntityReference:function(a){var t=new ps;return t.ownerDocument=this,t.nodeName=a,t},createElementNS:function(a,t){var i=new hi,n=t.split(":"),e=i.attributes=new Ln;return i.childNodes=new Rt,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=a,n.length==2?(i.prefix=n[0],i.localName=n[1]):i.localName=t,e._ownerElement=i,i},createAttributeNS:function(a,t){var i=new Rn,n=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=a,i.specified=!0,n.length==2?(i.prefix=n[0],i.localName=n[1]):i.localName=t,i}};Ye(kr,he);function hi(){this._nsMap={}}hi.prototype={nodeType:ft,hasAttribute:function(a){return this.getAttributeNode(a)!=null},getAttribute:function(a){var t=this.getAttributeNode(a);return t&&t.value||""},getAttributeNode:function(a){return this.attributes.getNamedItem(a)},setAttribute:function(a,t){var i=this.ownerDocument.createAttribute(a);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(a){var t=this.getAttributeNode(a);t&&this.removeAttributeNode(t)},appendChild:function(a){return a.nodeType===Mt?this.insertBefore(a,null):Fg(this,a)},setAttributeNode:function(a){return this.attributes.setNamedItem(a)},setAttributeNodeNS:function(a){return this.attributes.setNamedItemNS(a)},removeAttributeNode:function(a){return this.attributes.removeNamedItem(a.nodeName)},removeAttributeNS:function(a,t){var i=this.getAttributeNodeNS(a,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(a,t){return this.getAttributeNodeNS(a,t)!=null},getAttributeNS:function(a,t){var i=this.getAttributeNodeNS(a,t);return i&&i.value||""},setAttributeNS:function(a,t,i){var n=this.ownerDocument.createAttributeNS(a,t);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(a,t){return this.attributes.getNamedItemNS(a,t)},getElementsByTagName:function(a){return new Oi(this,function(t){var i=[];return Pr(t,function(n){n!==t&&n.nodeType==ft&&(a==="*"||n.tagName==a)&&i.push(n)}),i})},getElementsByTagNameNS:function(a,t){return new Oi(this,function(i){var n=[];return Pr(i,function(e){e!==i&&e.nodeType===ft&&(a==="*"||e.namespaceURI===a)&&(t==="*"||e.localName==t)&&n.push(e)}),n})}};kr.prototype.getElementsByTagName=hi.prototype.getElementsByTagName;kr.prototype.getElementsByTagNameNS=hi.prototype.getElementsByTagNameNS;Ye(hi,he);function Rn(){}Rn.prototype.nodeType=Di;Ye(Rn,he);function Ar(){}Ar.prototype={data:"",substringData:function(a,t){return this.data.substring(a,a+t)},appendData:function(a){a=this.data+a,this.nodeValue=this.data=a,this.length=a.length},insertData:function(a,t){this.replaceData(a,0,t)},appendChild:function(a){throw new Error(Ae[Je])},deleteData:function(a,t){this.replaceData(a,t,"")},replaceData:function(a,t,i){var n=this.data.substring(0,a),e=this.data.substring(a+t);i=n+i+e,this.nodeValue=this.data=i,this.length=i.length}};Ye(Ar,he);function cs(){}cs.prototype={nodeName:"#text",nodeType:On,splitText:function(a){var t=this.data,i=t.substring(a);t=t.substring(0,a),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};Ye(cs,Ar);function fs(){}fs.prototype={nodeName:"#comment",nodeType:El};Ye(fs,Ar);function hs(){}hs.prototype={nodeName:"#cdata-section",nodeType:bl};Ye(hs,Ar);function Nn(){}Nn.prototype.nodeType=wl;Ye(Nn,he);function Bl(){}Bl.prototype.nodeType=Dg;Ye(Bl,he);function Hl(){}Hl.prototype.nodeType=Ig;Ye(Hl,he);function ps(){}ps.prototype.nodeType=xl;Ye(ps,he);function Fn(){}Fn.prototype.nodeName="#document-fragment";Fn.prototype.nodeType=Mt;Ye(Fn,he);function ms(){}ms.prototype.nodeType=Sl;Ye(ms,he);function Vl(){}Vl.prototype.serializeToString=function(a,t,i){return jl.call(a,t,i)};he.prototype.toString=jl;function jl(a,t){var i=[],n=this.nodeType==9&&this.documentElement||this,e=n.prefix,r=n.namespaceURI;if(r&&e==null){var e=n.lookupPrefix(r);if(e==null)var s=[{namespace:r,prefix:null}]}return Li(this,i,a,t,s),i.join("")}function Wl(a,t,i){var n=a.prefix||"",e=a.namespaceURI;if(!e||n==="xml"&&e===Cr.XML||e===Cr.XMLNS)return!1;for(var r=i.length;r--;){var s=i[r];if(s.prefix===n)return s.namespace!==e}return!0}function gs(a,t,i){a.push(" ",t,'="',i.replace(/[<&"]/g,Ll),'"')}function Li(a,t,i,n,e){if(e||(e=[]),n)if(a=n(a),a){if(typeof a=="string"){t.push(a);return}}else return;switch(a.nodeType){case ft:var r=a.attributes,s=r.length,o=a.firstChild,u=a.tagName;i=Cr.isHTML(a.namespaceURI)||i;var l=u;if(!i&&!a.prefix&&a.namespaceURI){for(var c,g=0;g=0;p--){var y=e[p];if(y.prefix===""&&y.namespace===a.namespaceURI){c=y.namespace;break}}if(c!==a.namespaceURI)for(var p=e.length-1;p>=0;p--){var y=e[p];if(y.namespace===a.namespaceURI){y.prefix&&(l=y.prefix+":"+u);break}}}t.push("<",l);for(var b=0;b"),i&&/^script$/i.test(u))for(;o;)o.data?t.push(o.data):Li(o,t,i,n,e.slice()),o=o.nextSibling;else for(;o;)Li(o,t,i,n,e.slice()),o=o.nextSibling;t.push("")}else t.push("/>");return;case Cl:case Mt:for(var o=a.firstChild;o;)Li(o,t,i,n,e.slice()),o=o.nextSibling;return;case Di:return gs(t,a.name,a.value);case On:return t.push(a.data.replace(/[<&]/g,Ll).replace(/]]>/g,"]]>"));case bl:return t.push("");case El:return t.push("");case wl:var O=a.publicId,H=a.systemId;if(t.push("");else if(H&&H!=".")t.push(" SYSTEM ",H,">");else{var L=a.internalSubset;L&&t.push(" [",L,"]"),t.push(">")}return;case Sl:return t.push("");case xl:return t.push("&",a.nodeName,";");default:t.push("??",a.nodeName)}}function ql(a,t,i){var n;switch(t.nodeType){case ft:n=t.cloneNode(!1),n.ownerDocument=a;case Mt:break;case Di:i=!0;break}if(n||(n=t.cloneNode(!1)),n.ownerDocument=a,n.parentNode=null,i)for(var e=t.firstChild;e;)n.appendChild(ql(a,e,i)),e=e.nextSibling;return n}function vs(a,t,i){var n=new t.constructor;for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){var r=t[e];typeof r!="object"&&r!=n[e]&&(n[e]=r)}switch(t.childNodes&&(n.childNodes=new Rt),n.ownerDocument=a,n.nodeType){case ft:var s=t.attributes,o=n.attributes=new Ln,u=s.length;o._ownerElement=n;for(var l=0;l",lt:"<",quot:'"'}),a.HTML_ENTITIES=t({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",times:"\xD7",divide:"\xF7",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",euro:"\u20AC",trade:"\u2122",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"}),a.entityMap=a.HTML_ENTITIES})(zl);var _s={},Dr=Jt.NAMESPACE,ys=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,$l=new RegExp("[\\-\\.0-9"+ys.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Kl=new RegExp("^"+ys.source+$l.source+"*(?::"+ys.source+$l.source+"*)?$"),Or=0,Zt=1,Mi=2,Lr=3,Ri=4,Ni=5,Mr=6,Un=7;function Fi(a,t){this.message=a,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Fi)}Fi.prototype=new Error;Fi.prototype.name=Fi.name;function Xl(){}Xl.prototype={parse:function(a,t,i){var n=this.domBuilder;n.startDocument(),Jl(t,t={}),Ug(a,t,i,n,this.errorHandler),n.endDocument()}};function Ug(a,t,i,n,e){function r(ee){if(ee>65535){ee-=65536;var se=55296+(ee>>10),de=56320+(ee&1023);return String.fromCharCode(se,de)}else return String.fromCharCode(ee)}function s(ee){var se=ee.slice(1,-1);return se in i?i[se]:se.charAt(0)==="#"?r(parseInt(se.substr(1).replace("x","0x"))):(e.error("entity not found:"+ee),ee)}function o(ee){if(ee>S){var se=a.substring(S,ee).replace(/&#?\w+;/g,s);p&&u(S),n.characters(se,0,ee-S),S=ee}}function u(ee,se){for(;ee>=c&&(se=g.exec(a));)l=se.index,c=l+se[0].length,p.lineNumber++;p.columnNumber=ee-l+1}for(var l=0,c=0,g=/.*(?:\r\n?|\n)|.*$/g,p=n.locator,y=[{currentNSMap:t}],b={},S=0;;){try{var x=a.indexOf("<",S);if(x<0){if(!a.substr(S).match(/^\s*$/)){var A=n.doc,O=A.createTextNode(a.substr(S));A.appendChild(O),n.currentElement=O}return}switch(x>S&&o(x),a.charAt(x+1)){case"/":var H=a.indexOf(">",x+3),L=a.substring(x+2,H).replace(/[ \t\n\r]+$/g,""),M=y.pop();H<0?(L=a.substring(x+2).replace(/[\s<].*/,""),e.error("end tag name: "+L+" is not complete:"+M.tagName),H=x+1+L.length):L.match(/\sS?S=H:o(Math.max(x,S)+1)}}function Yl(a,t){return t.lineNumber=a.lineNumber,t.columnNumber=a.columnNumber,t}function Bg(a,t,i,n,e,r){function s(p,y,b){i.attributeNames.hasOwnProperty(p)&&r.fatalError("Attribute "+p+" redefined"),i.addValue(p,y,b)}for(var o,u,l=++t,c=Or;;){var g=a.charAt(l);switch(g){case"=":if(c===Zt)o=a.slice(t,l),c=Lr;else if(c===Mi)c=Lr;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===Lr||c===Zt)if(c===Zt&&(r.warning('attribute value must after "="'),o=a.slice(t,l)),t=l+1,l=a.indexOf(g,t),l>0)u=a.slice(t,l).replace(/&#?\w+;/g,e),s(o,u,t-1),c=Ni;else throw new Error("attribute value no end '"+g+"' match");else if(c==Ri)u=a.slice(t,l).replace(/&#?\w+;/g,e),s(o,u,t),r.warning('attribute "'+o+'" missed start quot('+g+")!!"),t=l+1,c=Ni;else throw new Error('attribute value must after "="');break;case"/":switch(c){case Or:i.setTagName(a.slice(t,l));case Ni:case Mr:case Un:c=Un,i.closed=!0;case Ri:case Zt:case Mi:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return r.error("unexpected end of input"),c==Or&&i.setTagName(a.slice(t,l)),l;case">":switch(c){case Or:i.setTagName(a.slice(t,l));case Ni:case Mr:case Un:break;case Ri:case Zt:u=a.slice(t,l),u.slice(-1)==="/"&&(i.closed=!0,u=u.slice(0,-1));case Mi:c===Mi&&(u=o),c==Ri?(r.warning('attribute "'+u+'" missed quot(")!'),s(o,u.replace(/&#?\w+;/g,e),t)):((!Dr.isHTML(n[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&r.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),s(u,u,t));break;case Lr:throw new Error("attribute value missed!!")}return l;case"\x80":g=" ";default:if(g<=" ")switch(c){case Or:i.setTagName(a.slice(t,l)),c=Mr;break;case Zt:o=a.slice(t,l),c=Mi;break;case Ri:var u=a.slice(t,l).replace(/&#?\w+;/g,e);r.warning('attribute "'+u+'" missed quot(")!!'),s(o,u,t);case Ni:c=Mr;break}else switch(c){case Mi:i.tagName,(!Dr.isHTML(n[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&r.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=l,c=Zt;break;case Ni:r.warning('attribute space is required"'+o+'"!!');case Mr:c=Zt,t=l;break;case Lr:c=Ri,t=l;break;case Un:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function Ql(a,t,i){for(var n=a.tagName,e=null,r=a.length;r--;){var s=a[r],o=s.qName,u=s.value,p=o.indexOf(":");if(p>0)var l=s.prefix=o.slice(0,p),c=o.slice(p+1),g=l==="xmlns"&&c;else c=o,l=null,g=o==="xmlns"&&"";s.localName=c,g!==!1&&(e==null&&(e={},Jl(i,i={})),i[g]=e[g]=u,s.uri=Dr.XMLNS,t.startPrefixMapping(g,u))}for(var r=a.length;r--;){s=a[r];var l=s.prefix;l&&(l==="xml"&&(s.uri=Dr.XML),l!=="xmlns"&&(s.uri=i[l||""]))}var p=n.indexOf(":");p>0?(l=a.prefix=n.slice(0,p),c=a.localName=n.slice(p+1)):(l=null,c=a.localName=n);var y=a.uri=i[l||""];if(t.startElement(y,c,n,a),a.closed){if(t.endElement(y,c,n),e)for(l in e)Object.prototype.hasOwnProperty.call(e,l)&&t.endPrefixMapping(l)}else return a.currentNSMap=i,a.localNSMap=e,!0}function Hg(a,t,i,n,e){if(/^(?:script|textarea)$/i.test(i)){var r=a.indexOf("",t),s=a.substring(t+1,r);if(/[&<]/.test(s))return/^script$/i.test(i)?(e.characters(s,0,s.length),r):(s=s.replace(/&#?\w+;/g,n),e.characters(s,0,s.length),r)}return t+1}function Vg(a,t,i,n){var e=n[i];return e==null&&(e=a.lastIndexOf(""),e",t+4);return r>t?(i.comment(a,t+4,r-t-4),r+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(a.substr(t+3,6)=="CDATA["){var r=a.indexOf("]]>",t+9);return i.startCDATA(),i.characters(a,t+9,r-t-9),i.endCDATA(),r+3}var s=qg(a,t),o=s.length;if(o>1&&/!doctype/i.test(s[0][0])){var u=s[1][0],l=!1,c=!1;o>3&&(/^public$/i.test(s[2][0])?(l=s[3][0],c=o>4&&s[4][0]):/^system$/i.test(s[2][0])&&(c=s[3][0]));var g=s[o-1];return i.startDTD(u,l,c),i.endDTD(),g.index+g[0].length}}return-1}function Wg(a,t,i){var n=a.indexOf("?>",t);if(n){var e=a.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return e?(e[0].length,i.processingInstruction(e[1],e[2]),n+2):-1}return-1}function Zl(){this.attributeNames={}}Zl.prototype={setTagName:function(a){if(!Kl.test(a))throw new Error("invalid tagName:"+a);this.tagName=a},addValue:function(a,t,i){if(!Kl.test(a))throw new Error("invalid attribute:"+a);this.attributeNames[a]=this.length,this[this.length++]={qName:a,value:t,offset:i}},length:0,getLocalName:function(a){return this[a].localName},getLocator:function(a){return this[a].locator},getQName:function(a){return this[a].qName},getURI:function(a){return this[a].uri},getValue:function(a){return this[a].value}};function qg(a,t){var i,n=[],e=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(e.lastIndex=t,e.exec(a);i=e.exec(a);)if(n.push(i),i[1])return n}_s.XMLReader=Xl;_s.ParseError=Fi;var Gg=Jt,Ts=Qt,ed=zl,td=_s,zg=Ts.DOMImplementation,id=Gg.NAMESPACE,$g=td.ParseError,Kg=td.XMLReader;function rd(a){this.options=a||{locator:{}}}rd.prototype.parseFromString=function(a,t){var i=this.options,n=new Kg,e=i.domBuilder||new Rr,r=i.errorHandler,s=i.locator,o=i.xmlns||{},u=/\/x?html?$/.test(t),l=u?ed.HTML_ENTITIES:ed.XML_ENTITIES;return s&&e.setDocumentLocator(s),n.errorHandler=Xg(r,e,s),n.domBuilder=i.domBuilder||e,u&&(o[""]=id.HTML),o.xml=o.xml||id.XML,a&&typeof a=="string"?n.parse(a,o,l):n.errorHandler.error("invalid doc source"),e.doc};function Xg(a,t,i){if(!a){if(t instanceof Rr)return t;a=t}var n={},e=a instanceof Function;i=i||{};function r(s){var o=a[s];!o&&e&&(o=a.length==2?function(u){a(s,u)}:a),n[s]=o&&function(u){o("[xmldom "+s+"] "+u+bs(i))}||function(){}}return r("warning"),r("error"),r("fatalError"),n}function Rr(){this.cdata=!1}function Ui(a,t){t.lineNumber=a.lineNumber,t.columnNumber=a.columnNumber}Rr.prototype={startDocument:function(){this.doc=new zg().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(a,t,i,n){var e=this.doc,r=e.createElementNS(a,i||t),s=n.length;Bn(this,r),this.currentElement=r,this.locator&&Ui(this.locator,r);for(var o=0;o=t+i||t?new java.lang.String(a,t,i)+"":a}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(a){Rr.prototype[a]=function(){return null}});function Bn(a,t){a.currentElement?a.currentElement.appendChild(t):a.doc.appendChild(t)}Ir.__DOMHandler=Rr;Ir.DOMParser=rd;Ir.DOMImplementation=Ts.DOMImplementation;Ir.XMLSerializer=Ts.XMLSerializer;var Yg=Ir.DOMParser;/*! @name mpd-parser @version 0.21.1 @license Apache-2.0 */var ad=function(t){return!!t&&typeof t=="object"},qe=function a(){for(var t=arguments.length,i=new Array(t),n=0;nn.timeline?1:-1})},av=function(t,i){for(var n=0;ns.timeline||s.segments.length&&r.timeline>s.segments[s.segments.length-1].timeline)&&r.discontinuitySequence--;return}var l=s.segments[u];l.discontinuity&&!o.discontinuity&&(o.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),fd({playlist:r,mediaSequence:s.segments[u].number})}})},ov=function(t){var i=t.oldManifest,n=t.newManifest,e=i.playlists.concat(cd(i)),r=n.playlists.concat(cd(n));return n.timelineStarts=dd([i.timelineStarts,n.timelineStarts]),sv({oldPlaylists:e,newPlaylists:r,timelineStarts:n.timelineStarts}),n},Vn=function(t){return t&&t.uri+"-"+ev(t.byterange)},Cs=function(t){var i=sd(t.reduce(function(n,e){var r=e.attributes.id+(e.attributes.lang||"");if(!n[r])n[r]=e,n[r].attributes.timelineStarts=[];else{if(e.segments){var s;e.segments[0]&&(e.segments[0].discontinuity=!0),(s=n[r].segments).push.apply(s,e.segments)}e.attributes.contentProtection&&(n[r].attributes.contentProtection=e.attributes.contentProtection)}return n[r].attributes.timelineStarts.push({start:e.attributes.periodStart,timeline:e.attributes.periodStart}),n},{}));return i.map(function(n){return n.discontinuityStarts=Jg(n.segments||[],"discontinuity"),n})},ws=function(t,i){var n=Vn(t.sidx),e=n&&i[n]&&i[n].sidx;return e&&Es(t,e,t.sidx.resolvedUri),t},uv=function(t,i){if(i===void 0&&(i={}),!Object.keys(i).length)return t;for(var n in t)t[n]=ws(t[n],i);return t},lv=function(t,i){var n,e=t.attributes,r=t.segments,s=t.sidx,o=t.mediaSequence,u=t.discontinuitySequence,l=t.discontinuityStarts,c={attributes:(n={NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs},n["PROGRAM-ID"]=1,n),uri:"",endList:e.type==="static",timeline:e.periodStart,resolvedUri:"",targetDuration:e.duration,discontinuitySequence:u,discontinuityStarts:l,timelineStarts:e.timelineStarts,mediaSequence:o,segments:r};return e.contentProtection&&(c.contentProtection=e.contentProtection),s&&(c.sidx=s),i&&(c.attributes.AUDIO="audio",c.attributes.SUBTITLES="subs"),c},dv=function(t){var i,n=t.attributes,e=t.segments,r=t.mediaSequence,s=t.discontinuityStarts,o=t.discontinuitySequence;typeof e=="undefined"&&(e=[{uri:n.baseUrl,timeline:n.periodStart,resolvedUri:n.baseUrl||"",duration:n.sourceDuration,number:0}],n.duration=n.sourceDuration);var u=(i={NAME:n.id,BANDWIDTH:n.bandwidth},i["PROGRAM-ID"]=1,i);return n.codecs&&(u.CODECS=n.codecs),{attributes:u,uri:"",endList:n.type==="static",timeline:n.periodStart,resolvedUri:n.baseUrl||"",targetDuration:n.duration,timelineStarts:n.timelineStarts,discontinuityStarts:s,discontinuitySequence:o,mediaSequence:r,segments:e}},cv=function(t,i,n){i===void 0&&(i={}),n===void 0&&(n=!1);var e,r=t.reduce(function(o,u){var l=u.attributes.role&&u.attributes.role.value||"",c=u.attributes.lang||"",g=u.attributes.label||"main";if(c&&!u.attributes.label){var p=l?" ("+l+")":"";g=""+u.attributes.lang+p}o[g]||(o[g]={language:c,autoselect:!0,default:l==="main",playlists:[],uri:""});var y=ws(lv(u,n),i);return o[g].playlists.push(y),typeof e=="undefined"&&l==="main"&&(e=u,e.default=!0),o},{});if(!e){var s=Object.keys(r)[0];r[s].default=!0}return r},fv=function(t,i){return i===void 0&&(i={}),t.reduce(function(n,e){var r=e.attributes.lang||"text";return n[r]||(n[r]={language:r,default:!1,autoselect:!1,playlists:[],uri:""}),n[r].playlists.push(ws(dv(e),i)),n},{})},hv=function(t){return t.reduce(function(i,n){return n&&n.forEach(function(e){var r=e.channel,s=e.language;i[s]={autoselect:!1,default:!1,instreamId:r,language:s},e.hasOwnProperty("aspectRatio")&&(i[s].aspectRatio=e.aspectRatio),e.hasOwnProperty("easyReader")&&(i[s].easyReader=e.easyReader),e.hasOwnProperty("3D")&&(i[s]["3D"]=e["3D"])}),i},{})},pv=function(t){var i,n=t.attributes,e=t.segments,r=t.sidx,s=t.discontinuityStarts,o={attributes:(i={NAME:n.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:n.width,height:n.height},CODECS:n.codecs,BANDWIDTH:n.bandwidth},i["PROGRAM-ID"]=1,i),uri:"",endList:n.type==="static",timeline:n.periodStart,resolvedUri:"",targetDuration:n.duration,discontinuityStarts:s,timelineStarts:n.timelineStarts,segments:e};return n.contentProtection&&(o.contentProtection=n.contentProtection),r&&(o.sidx=r),o},mv=function(t){var i=t.attributes;return i.mimeType==="video/mp4"||i.mimeType==="video/webm"||i.contentType==="video"},gv=function(t){var i=t.attributes;return i.mimeType==="audio/mp4"||i.mimeType==="audio/webm"||i.contentType==="audio"},vv=function(t){var i=t.attributes;return i.mimeType==="text/vtt"||i.contentType==="text"},_v=function(t,i){t.forEach(function(n){n.mediaSequence=0,n.discontinuitySequence=xs(i,function(e){var r=e.timeline;return r===n.timeline}),!!n.segments&&n.segments.forEach(function(e,r){e.number=r})})},hd=function(t){return t?Object.keys(t).reduce(function(i,n){var e=t[n];return i.concat(e.playlists)},[]):[]},yv=function(t){var i,n=t.dashPlaylists,e=t.locations,r=t.sidxMapping,s=r===void 0?{}:r,o=t.previousManifest;if(!n.length)return{};var u=n[0].attributes,l=u.sourceDuration,c=u.type,g=u.suggestedPresentationDelay,p=u.minimumUpdatePeriod,y=Cs(n.filter(mv)).map(pv),b=Cs(n.filter(gv)),S=Cs(n.filter(vv)),x=n.map(function(U){return U.attributes.captionServices}).filter(Boolean),A={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(i={AUDIO:{},VIDEO:{}},i["CLOSED-CAPTIONS"]={},i.SUBTITLES={},i),uri:"",duration:l,playlists:uv(y,s)};p>=0&&(A.minimumUpdatePeriod=p*1e3),e&&(A.locations=e),c==="dynamic"&&(A.suggestedPresentationDelay=g);var O=A.playlists.length===0,H=b.length?cv(b,s,O):null,L=S.length?fv(S,s):null,M=y.concat(hd(H),hd(L)),j=M.map(function(U){var F=U.timelineStarts;return F});return A.timelineStarts=dd(j),_v(M,A.timelineStarts),H&&(A.mediaGroups.AUDIO.audio=H),L&&(A.mediaGroups.SUBTITLES.subs=L),x.length&&(A.mediaGroups["CLOSED-CAPTIONS"].cc=hv(x)),o?ov({oldManifest:o,newManifest:A}):A},Tv=function(t,i,n){var e=t.NOW,r=t.clientOffset,s=t.availabilityStartTime,o=t.timescale,u=o===void 0?1:o,l=t.periodStart,c=l===void 0?0:l,g=t.minimumUpdatePeriod,p=g===void 0?0:g,y=(e+r)/1e3,b=s+c,S=y+p,x=S-b;return Math.ceil((x*u-i)/n)},pd=function(t,i){for(var n=t.type,e=t.minimumUpdatePeriod,r=e===void 0?0:e,s=t.media,o=s===void 0?"":s,u=t.sourceDuration,l=t.timescale,c=l===void 0?1:l,g=t.startNumber,p=g===void 0?1:g,y=t.periodStart,b=[],S=-1,x=0;xS&&(S=L);var M=void 0;if(H<0){var j=x+1;j===i.length?n==="dynamic"&&r>0&&o.indexOf("$Number$")>0?M=Tv(t,S,O):M=(u*c-S)/O:M=(i[j].t-S)/O}else M=H+1;for(var U=p+b.length+M,F=p+b.length;F=r)?s:""+new Array(r-s.length+1).join("0")+s}},md=function(t,i){return t.replace(bv,xv(i))},Sv=function(t,i){return!t.duration&&!i?[{number:t.startNumber||1,duration:t.sourceDuration,time:0,timeline:t.periodStart}]:t.duration?Ss(t):pd(t,i)},Ev=function(t,i){var n={RepresentationID:t.id,Bandwidth:t.bandwidth||0},e=t.initialization,r=e===void 0?{sourceURL:"",range:""}:e,s=Nr({baseUrl:t.baseUrl,source:md(r.sourceURL,n),range:r.range}),o=Sv(t,i);return o.map(function(u){n.Number=u.number,n.Time=u.time;var l=md(t.media||"",n),c=t.timescale||1,g=t.presentationTimeOffset||0,p=t.periodStart+(u.time-g)/c,y={uri:l,timeline:u.timeline,duration:u.duration,resolvedUri:In(t.baseUrl||"",l),map:s,number:u.number,presentationTime:p};return y})},Cv=function(t,i){var n=t.baseUrl,e=t.initialization,r=e===void 0?{}:e,s=Nr({baseUrl:n,source:r.sourceURL,range:r.range}),o=Nr({baseUrl:n,source:i.media,range:i.mediaRange});return o.map=s,o},wv=function(t,i){var n=t.duration,e=t.segmentUrls,r=e===void 0?[]:e,s=t.periodStart;if(!n&&!i||n&&i)throw new Error(Bi.SEGMENT_TIME_UNSPECIFIED);var o=r.map(function(c){return Cv(t,c)}),u;n&&(u=Ss(t)),i&&(u=pd(t,i));var l=u.map(function(c,g){if(o[g]){var p=o[g],y=t.timescale||1,b=t.presentationTimeOffset||0;return p.timeline=c.timeline,p.duration=c.duration,p.number=c.number,p.presentationTime=s+(c.time-b)/y,p}}).filter(function(c){return c});return l},Pv=function(t){var i=t.attributes,n=t.segmentInfo,e,r;n.template?(r=Ev,e=qe(i,n.template)):n.base?(r=ld,e=qe(i,n.base)):n.list&&(r=wv,e=qe(i,n.list));var s={attributes:i};if(!r)return s;var o=r(e,n.segmentTimeline);if(e.duration){var u=e,l=u.duration,c=u.timescale,g=c===void 0?1:c;e.duration=l/g}else o.length?e.duration=o.reduce(function(p,y){return Math.max(p,Math.ceil(y.duration))},0):e.duration=0;return s.attributes=e,s.segments=o,n.base&&e.indexRange&&(s.sidx=o[0],s.segments=[]),s},kv=function(t){return t.map(Pv)},Ee=function(t,i){return od(t.childNodes).filter(function(n){var e=n.tagName;return e===i})},Ps=function(t){return t.textContent.trim()},Hi=function(t){var i=365*24*60*60,n=30*24*60*60,e=24*60*60,r=60*60,s=60,o=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/,u=o.exec(t);if(!u)return 0;var l=u.slice(1),c=l[0],g=l[1],p=l[2],y=l[3],b=l[4],S=l[5];return parseFloat(c||0)*i+parseFloat(g||0)*n+parseFloat(p||0)*e+parseFloat(y||0)*r+parseFloat(b||0)*s+parseFloat(S||0)},Av=function(t){var i=/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;return i.test(t)&&(t+="Z"),Date.parse(t)},gd={mediaPresentationDuration:function(t){return Hi(t)},availabilityStartTime:function(t){return Av(t)/1e3},minimumUpdatePeriod:function(t){return Hi(t)},suggestedPresentationDelay:function(t){return Hi(t)},type:function(t){return t},timeShiftBufferDepth:function(t){return Hi(t)},start:function(t){return Hi(t)},width:function(t){return parseInt(t,10)},height:function(t){return parseInt(t,10)},bandwidth:function(t){return parseInt(t,10)},startNumber:function(t){return parseInt(t,10)},timescale:function(t){return parseInt(t,10)},presentationTimeOffset:function(t){return parseInt(t,10)},duration:function(t){var i=parseInt(t,10);return isNaN(i)?Hi(t):i},d:function(t){return parseInt(t,10)},t:function(t){return parseInt(t,10)},r:function(t){return parseInt(t,10)},DEFAULT:function(t){return t}},Ue=function(t){return t&&t.attributes?od(t.attributes).reduce(function(i,n){var e=gd[n.name]||gd.DEFAULT;return i[n.name]=e(n.value),i},{}):{}},Iv={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},jn=function(t,i){return i.length?Hn(t.map(function(n){return i.map(function(e){return In(n,Ps(e))})})):t},ks=function(t){var i=Ee(t,"SegmentTemplate")[0],n=Ee(t,"SegmentList")[0],e=n&&Ee(n,"SegmentURL").map(function(p){return qe({tag:"SegmentURL"},Ue(p))}),r=Ee(t,"SegmentBase")[0],s=n||i,o=s&&Ee(s,"SegmentTimeline")[0],u=n||r||i,l=u&&Ee(u,"Initialization")[0],c=i&&Ue(i);c&&l?c.initialization=l&&Ue(l):c&&c.initialization&&(c.initialization={sourceURL:c.initialization});var g={template:c,segmentTimeline:o&&Ee(o,"S").map(function(p){return Ue(p)}),list:n&&qe(Ue(n),{segmentUrls:e,initialization:Ue(l)}),base:r&&qe(Ue(r),{initialization:Ue(l)})};return Object.keys(g).forEach(function(p){g[p]||delete g[p]}),g},Dv=function(t,i,n){return function(e){var r=Ee(e,"BaseURL"),s=jn(i,r),o=qe(t,Ue(e)),u=ks(e);return s.map(function(l){return{segmentInfo:qe(n,u),attributes:qe(o,{baseUrl:l})}})}},Ov=function(t){return t.reduce(function(i,n){var e=Ue(n);e.schemeIdUri&&(e.schemeIdUri=e.schemeIdUri.toLowerCase());var r=Iv[e.schemeIdUri];if(r){i[r]={attributes:e};var s=Ee(n,"cenc:pssh")[0];if(s){var o=Ps(s);i[r].pssh=o&&ll(o)}}return i},{})},Lv=function(t){if(t.schemeIdUri==="urn:scte:dash:cc:cea-608:2015"){var i=typeof t.value!="string"?[]:t.value.split(";");return i.map(function(e){var r,s;if(s=e,/^CC\d=/.test(e)){var o=e.split("=");r=o[0],s=o[1]}else/^CC\d$/.test(e)&&(r=e);return{channel:r,language:s}})}else if(t.schemeIdUri==="urn:scte:dash:cc:cea-708:2015"){var n=typeof t.value!="string"?[]:t.value.split(";");return n.map(function(e){var r={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){var s=e.split("="),o=s[0],u=s[1],l=u===void 0?"":u;r.channel=o,r.language=e,l.split(",").forEach(function(c){var g=c.split(":"),p=g[0],y=g[1];p==="lang"?r.language=y:p==="er"?r.easyReader=Number(y):p==="war"?r.aspectRatio=Number(y):p==="3D"&&(r["3D"]=Number(y))})}else r.language=e;return r.channel&&(r.channel="SERVICE"+r.channel),r})}},Mv=function(t,i,n){return function(e){var r=Ue(e),s=jn(i,Ee(e,"BaseURL")),o=Ee(e,"Role")[0],u={role:Ue(o)},l=qe(t,r,u),c=Ee(e,"Accessibility")[0],g=Lv(Ue(c));g&&(l=qe(l,{captionServices:g}));var p=Ee(e,"Label")[0];if(p&&p.childNodes.length){var y=p.childNodes[0].nodeValue.trim();l=qe(l,{label:y})}var b=Ov(Ee(e,"ContentProtection"));Object.keys(b).length&&(l=qe(l,{contentProtection:b}));var S=ks(e),x=Ee(e,"Representation"),A=qe(n,S);return Hn(x.map(Dv(l,s,A)))}},Rv=function(t,i){return function(n,e){var r=jn(i,Ee(n.node,"BaseURL")),s=qe(t,{periodStart:n.attributes.start});typeof n.attributes.duration=="number"&&(s.periodDuration=n.attributes.duration);var o=Ee(n.node,"AdaptationSet"),u=ks(n.node);return Hn(o.map(Mv(s,r,u)))}},Nv=function(t){var i=t.attributes,n=t.priorPeriodAttributes,e=t.mpdType;return typeof i.start=="number"?i.start:n&&typeof n.start=="number"&&typeof n.duration=="number"?n.start+n.duration:!n&&e==="static"?0:null},Fv=function(t,i){i===void 0&&(i={});var n=i,e=n.manifestUri,r=e===void 0?"":e,s=n.NOW,o=s===void 0?Date.now():s,u=n.clientOffset,l=u===void 0?0:u,c=Ee(t,"Period");if(!c.length)throw new Error(Bi.INVALID_NUMBER_OF_PERIOD);var g=Ee(t,"Location"),p=Ue(t),y=jn([r],Ee(t,"BaseURL"));p.type=p.type||"static",p.sourceDuration=p.mediaPresentationDuration||0,p.NOW=o,p.clientOffset=l,g.length&&(p.locations=g.map(Ps));var b=[];return c.forEach(function(S,x){var A=Ue(S),O=b[x-1];A.start=Nv({attributes:A,priorPeriodAttributes:O?O.attributes:null,mpdType:p.type}),b.push({node:S,attributes:A})}),{locations:p.locations,representationInfo:Hn(b.map(Rv(p,y)))}},vd=function(t){if(t==="")throw new Error(Bi.DASH_EMPTY_MANIFEST);var i=new Yg,n,e;try{n=i.parseFromString(t,"application/xml"),e=n&&n.documentElement.tagName==="MPD"?n.documentElement:null}catch{}if(!e||e&&e.getElementsByTagName("parsererror").length>0)throw new Error(Bi.DASH_INVALID_XML);return e},Uv=function(t){var i=Ee(t,"UTCTiming")[0];if(!i)return null;var n=Ue(i);switch(n.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":n.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":n.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":n.method="DIRECT",n.value=Date.parse(n.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Bi.UNSUPPORTED_UTC_TIMING_SCHEME)}return n},Bv=function(t,i){i===void 0&&(i={});var n=Fv(vd(t),i),e=kv(n.representationInfo);return yv({dashPlaylists:e,locations:n.locations,sidxMapping:i.sidxMapping,previousManifest:i.previousManifest})},Hv=function(t){return Uv(vd(t))},_d=Math.pow(2,32),Vv=function(a){var t=new DataView(a.buffer,a.byteOffset,a.byteLength),i;return t.getBigUint64?(i=t.getBigUint64(0),i0;n+=12,e--)i.references.push({referenceType:(a[n]&128)>>>7,referencedSize:t.getUint32(n)&2147483647,subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(a[n+8]&128),sapType:(a[n+8]&112)>>>4,sapDeltaTime:t.getUint32(n+8)&268435455});return i},qv=Wv,Gv=J([73,68,51]),zv=function(t,i){i===void 0&&(i=0),t=J(t);var n=t[i+5],e=t[i+6]<<21|t[i+7]<<14|t[i+8]<<7|t[i+9],r=(n&16)>>4;return r?e+20:e+10},Fr=function a(t,i){return i===void 0&&(i=0),t=J(t),t.length-i<10||!ye(t,Gv,{offset:i})?i:(i+=zv(t,i),a(t,i))},Td=function(t){return typeof t=="string"?gl(t):t},$v=function(t){return Array.isArray(t)?t.map(function(i){return Td(i)}):[Td(t)]},Kv=function a(t,i,n){n===void 0&&(n=!1),i=$v(i),t=J(t);var e=[];if(!i.length)return e;for(var r=0;r>>0,o=t.subarray(r+4,r+8);if(s===0)break;var u=r+s;if(u>t.length){if(n)break;u=t.length}var l=t.subarray(r+8,u);ye(o,i[0])&&(i.length===1?e.push(l):e.push.apply(e,a(l,i.slice(1),n))),r=u}return e},Wn={EBML:J([26,69,223,163]),DocType:J([66,130]),Segment:J([24,83,128,103]),SegmentInfo:J([21,73,169,102]),Tracks:J([22,84,174,107]),Track:J([174]),TrackNumber:J([215]),DefaultDuration:J([35,227,131]),TrackEntry:J([174]),TrackType:J([131]),FlagDefault:J([136]),CodecID:J([134]),CodecPrivate:J([99,162]),VideoTrack:J([224]),AudioTrack:J([225]),Cluster:J([31,67,182,117]),Timestamp:J([231]),TimestampScale:J([42,215,177]),BlockGroup:J([160]),BlockDuration:J([155]),Block:J([161]),SimpleBlock:J([163])},As=[128,64,32,16,8,4,2,1],Xv=function(t){for(var i=1,n=0;n=i.length)return i.length;var e=qn(i,n,!1);if(ye(t.bytes,e.bytes))return n;var r=qn(i,n+e.length);return a(t,i,n+r.length+r.value+e.length)},xd=function a(t,i){i=Yv(i),t=J(t);var n=[];if(!i.length)return n;for(var e=0;et.length?t.length:o+s.value,l=t.subarray(o,u);ye(i[0],r.bytes)&&(i.length===1?n.push(l):n=n.concat(a(l,i.slice(1))));var c=r.length+s.length+l.length;e+=c}return n},Jv=J([0,0,0,1]),Zv=J([0,0,1]),e0=J([0,0,3]),t0=function(t){for(var i=[],n=1;n>1&63),n.indexOf(l)!==-1&&(s=r+u),r+=u+(i==="h264"?1:2)}return t.subarray(0,0)},i0=function(t,i,n){return Sd(t,"h264",i,n)},r0=function(t,i,n){return Sd(t,"h265",i,n)},Ge={webm:J([119,101,98,109]),matroska:J([109,97,116,114,111,115,107,97]),flac:J([102,76,97,67]),ogg:J([79,103,103,83]),ac3:J([11,119]),riff:J([82,73,70,70]),avi:J([65,86,73]),wav:J([87,65,86,69]),"3gp":J([102,116,121,112,51,103]),mp4:J([102,116,121,112]),fmp4:J([115,116,121,112]),mov:J([102,116,121,112,113,116]),moov:J([109,111,111,118]),moof:J([109,111,111,102])},Vi={aac:function(t){var i=Fr(t);return ye(t,[255,16],{offset:i,mask:[255,22]})},mp3:function(t){var i=Fr(t);return ye(t,[255,2],{offset:i,mask:[255,6]})},webm:function(t){var i=xd(t,[Wn.EBML,Wn.DocType])[0];return ye(i,Ge.webm)},mkv:function(t){var i=xd(t,[Wn.EBML,Wn.DocType])[0];return ye(i,Ge.matroska)},mp4:function(t){if(Vi["3gp"](t)||Vi.mov(t))return!1;if(ye(t,Ge.mp4,{offset:4})||ye(t,Ge.fmp4,{offset:4})||ye(t,Ge.moof,{offset:4})||ye(t,Ge.moov,{offset:4}))return!0},mov:function(t){return ye(t,Ge.mov,{offset:4})},"3gp":function(t){return ye(t,Ge["3gp"],{offset:4})},ac3:function(t){var i=Fr(t);return ye(t,Ge.ac3,{offset:i})},ts:function(t){if(t.length<189&&t.length>=1)return t[0]===71;for(var i=0;i+1880},Os=9e4,Ls,Ms,Gn,Rs,Ed,Cd,wd;Ls=function(a){return a*Os};Ms=function(a,t){return a*t};Gn=function(a){return a/Os};Rs=function(a,t){return a/t};Ed=function(a,t){return Ls(Rs(a,t))};Cd=function(a,t){return Ms(Gn(a),t)};wd=function(a,t,i){return Gn(i?a:a-t)};var zn={ONE_SECOND_IN_TS:Os,secondsToVideoTs:Ls,secondsToAudioTs:Ms,videoTsToSeconds:Gn,audioTsToSeconds:Rs,audioTsToVideoTs:Ed,videoTsToAudioTs:Cd,metadataTsToSeconds:wd};/** * @license * Video.js 7.20.3 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * * * Includes vtt.js * Available under Apache License Version 2.0 * */var Pd="7.20.3",Ft={},ei=function(t,i){return Ft[t]=Ft[t]||[],i&&(Ft[t]=Ft[t].concat(i)),Ft[t]},s0=function(t,i){ei(t,i)},kd=function(t,i){var n=ei(t).indexOf(i);return n<=-1?!1:(Ft[t]=Ft[t].slice(),Ft[t].splice(n,1),!0)},o0=function(t,i){ei(t,[].concat(i).map(function(n){var e=function r(){return kd(t,r),n.apply(void 0,arguments)};return e}))},$n={prefixed:!0},Kn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],Ad=Kn[0],Ur;for(var Xn=0;Xn0?u:0)}if(!!w.console){var l=w.console[n];!l&&n==="debug"&&(l=w.console.info||w.console.log),!(!l||!s||!o.test(n))&&l[Array.isArray(r)?"apply":"call"](w.console,r)}}};function Id(a){var t="info",i,n=function(){for(var r=arguments.length,s=new Array(r),o=0;o1?t-1:0),n=1;n=0)throw new Error("class has illegal whitespace characters")}function p0(a){return new RegExp("(^|\\s)"+a+"($|\\s)")}function qi(){return G===w.document}function Gi(a){return Ut(a)&&a.nodeType===1}function Vd(){try{return w.parent!==w.self}catch{return!0}}function jd(a){return function(t,i){if(!Bd(t))return G[a](null);Bd(i)&&(i=G.querySelector(i));var n=Gi(i)?i:G;return n[a]&&n[a](t)}}function oe(a,t,i,n){a===void 0&&(a="div"),t===void 0&&(t={}),i===void 0&&(i={});var e=G.createElement(a);return Object.getOwnPropertyNames(t).forEach(function(r){var s=t[r];r.indexOf("aria-")!==-1||r==="role"||r==="type"?(ne.warn(`Setting attributes in the second argument of createEl() has been deprecated. Use the third argument instead. `+("createEl(type, properties, attributes). Attempting to set "+r+" to "+s+".")),e.setAttribute(r,s)):r==="textContent"?pi(e,s):(e[r]!==s||r==="tabIndex")&&(e[r]=s)}),Object.getOwnPropertyNames(i).forEach(function(r){e.setAttribute(r,i[r])}),n&&js(e,n),e}function pi(a,t){return typeof a.textContent=="undefined"?a.innerText=t:a.textContent=t,a}function Hs(a,t){t.firstChild?t.insertBefore(a,t.firstChild):t.appendChild(a)}function mi(a,t){return Hd(t),a.classList?a.classList.contains(t):p0(t).test(a.className)}function Vt(a,t){return a.classList?a.classList.add(t):mi(a,t)||(a.className=(a.className+" "+t).trim()),a}function Wr(a,t){return a?(a.classList?a.classList.remove(t):(Hd(t),a.className=a.className.split(/\s+/).filter(function(i){return i!==t}).join(" ")),a):(ne.warn("removeClass was called with an element that doesn't exist"),null)}function Wd(a,t,i){var n=mi(a,t);if(typeof i=="function"&&(i=i(a,t)),typeof i!="boolean"&&(i=!n),i!==n)return i?Vt(a,t):Wr(a,t),a}function qd(a,t){Object.getOwnPropertyNames(t).forEach(function(i){var n=t[i];n===null||typeof n=="undefined"||n===!1?a.removeAttribute(i):a.setAttribute(i,n===!0?"":n)})}function jt(a){var t={},i=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(a&&a.attributes&&a.attributes.length>0)for(var n=a.attributes,e=n.length-1;e>=0;e--){var r=n[e].name,s=n[e].value;(typeof a[r]=="boolean"||i.indexOf(","+r+",")!==-1)&&(s=s!==null),t[r]=s}return t}function Gd(a,t){return a.getAttribute(t)}function zi(a,t,i){a.setAttribute(t,i)}function Jn(a,t){a.removeAttribute(t)}function zd(){G.body.focus(),G.onselectstart=function(){return!1}}function $d(){G.onselectstart=function(){return!0}}function $i(a){if(a&&a.getBoundingClientRect&&a.parentNode){var t=a.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(function(n){t[n]!==void 0&&(i[n]=t[n])}),i.height||(i.height=parseFloat(Hr(a,"height"))),i.width||(i.width=parseFloat(Hr(a,"width"))),i}}function qr(a){if(!a||a&&!a.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=a.offsetWidth,i=a.offsetHeight,n=0,e=0;a.offsetParent&&a!==G[$n.fullscreenElement];)n+=a.offsetLeft,e+=a.offsetTop,a=a.offsetParent;return{left:n,top:e,width:t,height:i}}function Zn(a,t){var i={x:0,y:0};if(ze)for(var n=a;n&&n.nodeName.toLowerCase()!=="html";){var e=Hr(n,"transform");if(/^matrix/.test(e)){var r=e.slice(7,-1).split(/,\s/).map(Number);i.x+=r[4],i.y+=r[5]}else if(/^matrix3d/.test(e)){var s=e.slice(9,-1).split(/,\s/).map(Number);i.x+=s[12],i.y+=s[13]}n=n.parentNode}var o={},u=qr(t.target),l=qr(a),c=l.width,g=l.height,p=t.offsetY-(l.top-u.top),y=t.offsetX-(l.left-u.left);return t.changedTouches&&(y=t.changedTouches[0].pageX-l.left,p=t.changedTouches[0].pageY+l.top,ze&&(y-=i.x,p-=i.y)),o.y=1-Math.max(0,Math.min(1,p/g)),o.x=Math.max(0,Math.min(1,y/c)),o}function Kd(a){return Ut(a)&&a.nodeType===3}function Vs(a){for(;a.firstChild;)a.removeChild(a.firstChild);return a}function Xd(a){return typeof a=="function"&&(a=a()),(Array.isArray(a)?a:[a]).map(function(t){if(typeof t=="function"&&(t=t()),Gi(t)||Kd(t))return t;if(typeof t=="string"&&/\S/.test(t))return G.createTextNode(t)}).filter(function(t){return t})}function js(a,t){return Xd(t).forEach(function(i){return a.appendChild(i)}),a}function Yd(a,t){return js(Vs(a),t)}function Gr(a){return a.button===void 0&&a.buttons===void 0||a.button===0&&a.buttons===void 0||a.type==="mouseup"&&a.button===0&&a.buttons===0?!0:!(a.button!==0||a.buttons!==1)}var ti=jd("querySelector"),Qd=jd("querySelectorAll"),Jd=Object.freeze({__proto__:null,isReal:qi,isEl:Gi,isInFrame:Vd,createEl:oe,textContent:pi,prependTo:Hs,hasClass:mi,addClass:Vt,removeClass:Wr,toggleClass:Wd,setAttributes:qd,getAttributes:jt,getAttribute:Gd,setAttribute:zi,removeAttribute:Jn,blockTextSelection:zd,unblockTextSelection:$d,getBoundingClientRect:$i,findPosition:qr,getPointerPosition:Zn,isTextNode:Kd,emptyEl:Vs,normalizeContent:Xd,appendContent:js,insertContent:Yd,isSingleLeftClick:Gr,$:ti,$$:Qd}),Zd=!1,Ws,m0=function(){if(Ws.options.autoSetup!==!1){var t=Array.prototype.slice.call(G.getElementsByTagName("video")),i=Array.prototype.slice.call(G.getElementsByTagName("audio")),n=Array.prototype.slice.call(G.getElementsByTagName("video-js")),e=t.concat(i,n);if(e&&e.length>0)for(var r=0,s=e.length;r-1&&(e={passive:!0}),a.addEventListener(t,n.dispatcher,e)}else a.attachEvent&&a.attachEvent("on"+t,n.dispatcher)}function Be(a,t,i){if(!!$e.has(a)){var n=$e.get(a);if(!!n.handlers){if(Array.isArray(t))return zs(Be,a,t,i);var e=function(l,c){n.handlers[c]=[],rc(l,c)};if(t===void 0){for(var r in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},r)&&e(a,r);return}var s=n.handlers[t];if(!!s){if(!i){e(a,t);return}if(i.guid)for(var o=0;o=i&&(t.apply(void 0,arguments),n=s)};return e},b0=function(t,i,n,e){e===void 0&&(e=w);var r,s=function(){e.clearTimeout(r),r=null},o=function(){var l=this,c=arguments,g=function(){r=null,g=null,n||t.apply(l,c)};!r&&n&&t.apply(l,c),e.clearTimeout(r),r=e.setTimeout(g,i)};return o.cancel=s,o},De=function(){};De.prototype.allowedEvents_={};De.prototype.on=function(a,t){var i=this.addEventListener;this.addEventListener=function(){},rt(this,a,t),this.addEventListener=i};De.prototype.addEventListener=De.prototype.on;De.prototype.off=function(a,t){Be(this,a,t)};De.prototype.removeEventListener=De.prototype.off;De.prototype.one=function(a,t){var i=this.addEventListener;this.addEventListener=function(){},ia(this,a,t),this.addEventListener=i};De.prototype.any=function(a,t){var i=this.addEventListener;this.addEventListener=function(){},nc(this,a,t),this.addEventListener=i};De.prototype.trigger=function(a){var t=a.type||a;typeof a=="string"&&(a={type:t}),a=ea(a),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](a),Ki(this,a)};De.prototype.dispatchEvent=De.prototype.trigger;var zr;De.prototype.queueTrigger=function(a){var t=this;zr||(zr=new Map);var i=a.type||a,n=zr.get(this);n||(n=new Map,zr.set(this,n));var e=n.get(i);n.delete(i),w.clearTimeout(e);var r=w.setTimeout(function(){n.size===0&&(n=null,zr.delete(t)),t.trigger(a)},0);n.set(i,r)};var ra=function(t){return typeof t.name=="function"?t.name():typeof t.name=="string"?t.name:t.name_?t.name_:t.constructor&&t.constructor.name?t.constructor.name:typeof t},Gt=function(t){return t instanceof De||!!t.eventBusEl_&&["on","one","off","trigger"].every(function(i){return typeof t[i]=="function"})},x0=function(t,i){Gt(t)?i():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(i))},$s=function(t){return typeof t=="string"&&/\S/.test(t)||Array.isArray(t)&&!!t.length},na=function(t,i,n){if(!t||!t.nodeName&&!Gt(t))throw new Error("Invalid target for "+ra(i)+"#"+n+"; must be a DOM node or evented object.")},ac=function(t,i,n){if(!$s(t))throw new Error("Invalid event type for "+ra(i)+"#"+n+"; must be a non-empty string or array.")},sc=function(t,i,n){if(typeof t!="function")throw new Error("Invalid listener for "+ra(i)+"#"+n+"; must be a function.")},Ks=function(t,i,n){var e=i.length<3||i[0]===t||i[0]===t.eventBusEl_,r,s,o;return e?(r=t.eventBusEl_,i.length>=3&&i.shift(),s=i[0],o=i[1]):(r=i[0],s=i[1],o=i[2]),na(r,t,n),ac(s,t,n),sc(o,t,n),o=ve(t,o),{isTargetingSelf:e,target:r,type:s,listener:o}},gi=function(t,i,n,e){na(t,t,i),t.nodeName?T0[i](t,n,e):t[i](n,e)},S0={on:function(){for(var t=this,i=arguments.length,n=new Array(i),e=0;e=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(n.restoreEl?this.el_.parentNode.replaceChild(n.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(n){return n?(this.options_=_e(this.options_,n),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(n,e,r){return oe(n,e,r)},t.localize=function(n,e,r){r===void 0&&(r=n);var s=this.player_.language&&this.player_.language(),o=this.player_.languages&&this.player_.languages(),u=o&&o[s],l=s&&s.split("-")[0],c=o&&o[l],g=r;return u&&u[n]?g=u[n]:c&&c[n]&&(g=c[n]),e&&(g=g.replace(/\{(\d+)\}/g,function(p,y){var b=e[y-1],S=b;return typeof b=="undefined"&&(S=p),S})),g},t.handleLanguagechange=function(){},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(n){return this.childIndex_[n]},t.getChild=function(n){if(!!n)return this.childNameIndex_[n]},t.getDescendant=function(){for(var n=arguments.length,e=new Array(n),r=0;r=0;r--)if(this.children_[r]===n){e=!0,this.children_.splice(r,1);break}if(!!e){n.parentComponent_=null,this.childIndex_[n.id()]=null,this.childNameIndex_[Ce(n.name())]=null,this.childNameIndex_[aa(n.name())]=null;var s=n.el();s&&s.parentNode===this.contentEl()&&this.contentEl().removeChild(n.el())}}},t.initChildren=function(){var n=this,e=this.options_.children;if(e){var r=this.options_,s=function(c){var g=c.name,p=c.opts;if(r[g]!==void 0&&(p=r[g]),p!==!1){p===!0&&(p={}),p.playerOptions=n.options_.playerOptions;var y=n.addChild(g,p);y&&(n[g]=y)}},o,u=a.getComponent("Tech");Array.isArray(e)?o=e:o=Object.keys(e),o.concat(Object.keys(this.options_).filter(function(l){return!o.some(function(c){return typeof c=="string"?l===c:l===c.name})})).map(function(l){var c,g;return typeof l=="string"?(c=l,g=e[c]||n.options_[c]||{}):(c=l.name,g=l),{name:c,opts:g}}).filter(function(l){var c=a.getComponent(l.opts.componentClass||Ce(l.name));return c&&!u.isTech(c)}).forEach(s)}},t.buildCSSClass=function(){return""},t.ready=function(n,e){if(e===void 0&&(e=!1),!!n){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(n);return}e?n.call(this):this.setTimeout(n,1)}},t.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var n=this.readyQueue_;this.readyQueue_=[],n&&n.length>0&&n.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)},t.$=function(n,e){return ti(n,e||this.contentEl())},t.$$=function(n,e){return Qd(n,e||this.contentEl())},t.hasClass=function(n){return mi(this.el_,n)},t.addClass=function(n){Vt(this.el_,n)},t.removeClass=function(n){Wr(this.el_,n)},t.toggleClass=function(n,e){Wd(this.el_,n,e)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(n){return Gd(this.el_,n)},t.setAttribute=function(n,e){zi(this.el_,n,e)},t.removeAttribute=function(n){Jn(this.el_,n)},t.width=function(n,e){return this.dimension("width",n,e)},t.height=function(n,e){return this.dimension("height",n,e)},t.dimensions=function(n,e){this.width(n,!0),this.height(e)},t.dimension=function(n,e,r){if(e!==void 0){(e===null||e!==e)&&(e=0),(""+e).indexOf("%")!==-1||(""+e).indexOf("px")!==-1?this.el_.style[n]=e:e==="auto"?this.el_.style[n]="":this.el_.style[n]=e+"px",r||this.trigger("componentresize");return}if(!this.el_)return 0;var s=this.el_.style[n],o=s.indexOf("px");return parseInt(o!==-1?s.slice(0,o):this.el_["offset"+Ce(n)],10)},t.currentDimension=function(n){var e=0;if(n!=="width"&&n!=="height")throw new Error("currentDimension only accepts width or height value");if(e=Hr(this.el_,n),e=parseFloat(e),e===0||isNaN(e)){var r="offset"+Ce(n);e=this.el_[r]}return e},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(n){this.player_&&(re.isEventKey(n,"Tab")||n.stopPropagation(),this.player_.handleKeyDown(n))},t.handleKeyPress=function(n){this.handleKeyDown(n)},t.emitTapEvents=function(){var n=0,e=null,r=10,s=200,o;this.on("touchstart",function(l){l.touches.length===1&&(e={pageX:l.touches[0].pageX,pageY:l.touches[0].pageY},n=w.performance.now(),o=!0)}),this.on("touchmove",function(l){if(l.touches.length>1)o=!1;else if(e){var c=l.touches[0].pageX-e.pageX,g=l.touches[0].pageY-e.pageY,p=Math.sqrt(c*c+g*g);p>r&&(o=!1)}});var u=function(){o=!1};this.on("touchleave",u),this.on("touchcancel",u),this.on("touchend",function(l){if(e=null,o===!0){var c=w.performance.now()-n;c0&&g.map(function(p){return c[p]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return a.components_[n]=e,a.components_[aa(n)]=e,e},a.getComponent=function(n){if(!(!n||!a.components_))return a.components_[n]},a}();V.prototype.supportsRaf_=typeof w.requestAnimationFrame=="function"&&typeof w.cancelAnimationFrame=="function";V.registerComponent("Component",V);function A0(a,t,i){if(typeof t!="number"||t<0||t>i)throw new Error("Failed to execute '"+a+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}function uc(a,t,i,n){return A0(a,n,i.length-1),i[n][t]}function Qs(a){var t;return a===void 0||a.length===0?t={length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:t={length:a.length,start:uc.bind(null,"start",0,a),end:uc.bind(null,"end",1,a)},w.Symbol&&w.Symbol.iterator&&(t[w.Symbol.iterator]=function(){return(a||[]).values()}),t}function vi(a,t){return Array.isArray(a)?Qs(a):a===void 0||t===void 0?Qs():Qs([[a,t]])}function lc(a,t){var i=0,n,e;if(!t)return 0;(!a||!a.length)&&(a=vi(0,0));for(var r=0;rt&&(e=t),i+=e-n;return i/t}function Ke(a){if(a instanceof Ke)return a;typeof a=="number"?this.code=a:typeof a=="string"?this.message=a:Ut(a)&&(typeof a.code=="number"&&(this.code=a.code),be(this,a)),this.message||(this.message=Ke.defaultMessages[this.code]||"")}Ke.prototype.code=0;Ke.prototype.message="";Ke.prototype.status=null;Ke.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Ke.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var Xi=0;Xi=0;r--)if(n[r].enabled){eo(n,n[r]);break}return e=a.call(this,n)||this,e.changing_=!1,e}var i=t.prototype;return i.addTrack=function(e){var r=this;e.enabled&&eo(this,e),a.prototype.addTrack.call(this,e),!!e.addEventListener&&(e.enabledChange_=function(){r.changing_||(r.changing_=!0,eo(r,e),r.changing_=!1,r.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))},i.removeTrack=function(e){a.prototype.removeTrack.call(this,e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)},t}(Qi),to=function(t,i){for(var n=0;n=0;r--)if(n[r].selected){to(n,n[r]);break}return e=a.call(this,n)||this,e.changing_=!1,Object.defineProperty(ie(e),"selectedIndex",{get:function(){for(var o=0;o0&&(w.console&&w.console.groupCollapsed&&w.console.groupCollapsed("Text Track parsing errors for "+i.src),e.forEach(function(r){return ne.error(r)}),w.console&&w.console.groupEnd&&w.console.groupEnd()),n.flush()},gc=function(t,i){var n={uri:t},e=sa(t);e&&(n.cors=e);var r=i.tech_.crossOrigin()==="use-credentials";r&&(n.withCredentials=r),Qu(n,ve(this,function(s,o,u){if(s)return ne.error(s,o);i.loaded_=!0,typeof w.WebVTT!="function"?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],function(l){if(l.type==="vttjserror"){ne.error("vttjs failed to load, stopping trying to process "+i.src);return}return mc(u,i)}):mc(u,i)}))},Kr=function(a){$(t,a);function t(n){var e;if(n===void 0&&(n={}),!n.tech)throw new Error("A tech was not provided.");var r=_e(n,{kind:U0[n.kind]||"subtitles",language:n.language||n.srclang||""}),s=hc[r.mode]||"disabled",o=r.default;(r.kind==="metadata"||r.kind==="chapters")&&(s="hidden"),e=a.call(this,r)||this,e.tech_=r.tech,e.cues_=[],e.activeCues_=[],e.preload_=e.tech_.preloadTextTracks!==!1;var u=new fc(e.cues_),l=new fc(e.activeCues_),c=!1;e.timeupdateHandler=ve(ie(e),function(p){if(p===void 0&&(p={}),!this.tech_.isDisposed()){if(!this.tech_.isReady_){p.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,c&&(this.trigger("cuechange"),c=!1),p.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});var g=function(){e.stopTracking()};return e.tech_.one("dispose",g),s!=="disabled"&&e.startTracking(),Object.defineProperties(ie(e),{default:{get:function(){return o},set:function(){}},mode:{get:function(){return s},set:function(y){!hc[y]||s!==y&&(s=y,!this.preload_&&s!=="disabled"&&this.cues.length===0&&gc(this.src,this),this.stopTracking(),s!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?u:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(this.cues.length===0)return l;for(var y=this.tech_.currentTime(),b=[],S=0,x=this.cues.length;S=y||A.startTime===A.endTime&&A.startTime<=y&&A.startTime+.5>=y)&&b.push(A)}if(c=!1,b.length!==this.activeCues_.length)c=!0;else for(var O=0;O0){this.trigger("vttjsloaded");return}var r=G.createElement("script");r.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",r.onload=function(){e.trigger("vttjsloaded")},r.onerror=function(){e.trigger("vttjserror")},this.on("dispose",function(){r.onload=null,r.onerror=null}),w.WebVTT=!0,this.el().parentNode.appendChild(r)}else this.ready(this.addWebVttScript_)},i.emulateTextTracks=function(){var e=this,r=this.textTracks(),s=this.remoteTextTracks(),o=function(p){return r.addTrack(p.track)},u=function(p){return r.removeTrack(p.track)};s.on("addtrack",o),s.on("removetrack",u),this.addWebVttScript_();var l=function(){return e.trigger("texttrackchange")},c=function(){l();for(var p=0;p=0;e--){var r=a[e];r[t]&&r[t](n,i)}}function Q0(a){ao[a.id()]=null}function J0(a,t){var i=ao[a.id()],n=null;if(i==null)return n=t(a),ao[a.id()]=[[t,n]],n;for(var e=0;e0;this.player_.tech(!0)&&!((jr||Vr)&&r)&&this.player_.tech(!0).focus(),this.player_.paused()?Et(this.player_.play()):this.player_.pause()}},t}(la);V.registerComponent("PosterImage",r_);var ot="#222",Ec="#ccc",n_={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function oo(a,t){var i;if(a.length===4)i=a[1]+a[1]+a[2]+a[2]+a[3]+a[3];else if(a.length===7)i=a.slice(1);else throw new Error("Invalid color code provided, "+a+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function uo(a,t,i){try{a.style[t]=i}catch{return}}var a_=function(a){$(t,a);function t(n,e,r){var s;s=a.call(this,n,e,r)||this;var o=function(l){return s.updateDisplay(l)};return n.on("loadstart",function(u){return s.toggleDisplay(u)}),n.on("texttrackchange",o),n.on("loadedmetadata",function(u){return s.preselectTrack(u)}),n.ready(ve(ie(s),function(){if(n.tech_&&n.tech_.featuresNativeTextTracks){this.hide();return}n.on("fullscreenchange",o),n.on("playerresize",o),w.addEventListener("orientationchange",o),n.on("dispose",function(){return w.removeEventListener("orientationchange",o)});for(var u=this.options_.playerOptions.tracks||[],l=0;l0;Et(r),this.player_.tech(!0)&&!((jr||Vr)&&s)&&this.player_.tech(!0).focus();return}var o=this.player_.getChild("controlBar"),u=o&&o.getChild("playToggle");if(!u){this.player_.tech(!0).focus();return}var l=function(){return u.focus()};$r(r)?r.then(l,function(){}):this.setTimeout(l,1)},i.handleKeyDown=function(e){this.mouseused_=!1,a.prototype.handleKeyDown.call(this,e)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(pt);Cc.prototype.controlText_="Play Video";V.registerComponent("BigPlayButton",Cc);var o_=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.controlText(e&&e.controlText||r.localize("Close")),r}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+a.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(e){re.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):a.prototype.handleKeyDown.call(this,e)},t}(pt);V.registerComponent("CloseButton",o_);var wc=function(a){$(t,a);function t(n,e){var r;return e===void 0&&(e={}),r=a.call(this,n,e)||this,e.replay=e.replay===void 0||e.replay,r.on(n,"play",function(s){return r.handlePlay(s)}),r.on(n,"pause",function(s){return r.handlePause(s)}),e.replay&&r.on(n,"ended",function(s){return r.handleEnded(s)}),r}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+a.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?Et(this.player_.play()):this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){var r=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",function(s){return r.handleSeeked(s)})},t}(pt);wc.prototype.controlText_="Play";V.registerComponent("PlayToggle",wc);var Pc=function(t,i){t=t<0?0:t;var n=Math.floor(t%60),e=Math.floor(t/60%60),r=Math.floor(t/3600),s=Math.floor(i/60%60),o=Math.floor(i/3600);return(isNaN(t)||t===1/0)&&(r=e=n="-"),r=r>0||o>0?r+":":"",e=((r||s>=10)&&e<10?"0"+e:e)+":",n=n<10?"0"+n:n,r+e+n},lo=Pc;function u_(a){lo=a}function l_(){lo=Pc}function er(a,t){return t===void 0&&(t=a),lo(a,t)}var tr=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.on(n,["timeupdate","ended"],function(s){return r.updateContent(s)}),r.updateTextNode_(),r}var i=t.prototype;return i.createEl=function(){var e=this.buildCSSClass(),r=a.prototype.createEl.call(this,"div",{className:e+" vjs-time-control vjs-control"}),s=oe("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+"\xA0"},{role:"presentation"});return r.appendChild(s),this.contentEl_=oe("span",{className:e+"-display"},{"aria-live":"off",role:"presentation"}),r.appendChild(this.contentEl_),r},i.dispose=function(){this.contentEl_=null,this.textNode_=null,a.prototype.dispose.call(this)},i.updateTextNode_=function(e){var r=this;e===void 0&&(e=0),e=er(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",function(){if(!!r.contentEl_){var s=r.textNode_;s&&r.contentEl_.firstChild!==s&&(s=null,ne.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),r.textNode_=G.createTextNode(r.formattedTime_),!!r.textNode_&&(s?r.contentEl_.replaceChild(r.textNode_,s):r.contentEl_.appendChild(r.textNode_))}}))},i.updateContent=function(e){},t}(V);tr.prototype.labelText_="Time";tr.prototype.controlText_="Time";V.registerComponent("TimeDisplay",tr);var co=function(a){$(t,a);function t(){return a.apply(this,arguments)||this}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var r;this.player_.ended()?r=this.player_.duration():r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(r)},t}(tr);co.prototype.labelText_="Current Time";co.prototype.controlText_="Current Time";V.registerComponent("CurrentTimeDisplay",co);var fo=function(a){$(t,a);function t(n,e){var r;r=a.call(this,n,e)||this;var s=function(u){return r.updateContent(u)};return r.on(n,"durationchange",s),r.on(n,"loadstart",s),r.on(n,"loadedmetadata",s),r}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var r=this.player_.duration();this.updateTextNode_(r)},t}(tr);fo.prototype.labelText_="Duration";fo.prototype.controlText_="Duration";V.registerComponent("DurationDisplay",fo);var d_=function(a){$(t,a);function t(){return a.apply(this,arguments)||this}var i=t.prototype;return i.createEl=function(){var e=a.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),r=a.prototype.createEl.call(this,"div"),s=a.prototype.createEl.call(this,"span",{textContent:"/"});return r.appendChild(s),e.appendChild(r),e},t}(V);V.registerComponent("TimeDivider",d_);var ho=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.on(n,"durationchange",function(s){return r.updateContent(s)}),r}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var e=a.prototype.createEl.call(this);return this.options_.displayNegative!==!1&&e.insertBefore(oe("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e},i.updateContent=function(e){if(typeof this.player_.duration()=="number"){var r;this.player_.ended()?r=0:this.player_.remainingTimeDisplay?r=this.player_.remainingTimeDisplay():r=this.player_.remainingTime(),this.updateTextNode_(r)}},t}(tr);ho.prototype.labelText_="Remaining Time";ho.prototype.controlText_="Remaining Time";V.registerComponent("RemainingTimeDisplay",ho);var c_=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.updateShowing(),r.on(r.player(),"durationchange",function(s){return r.updateShowing(s)}),r}var i=t.prototype;return i.createEl=function(){var e=a.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=oe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(oe("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+"\xA0"})),this.contentEl_.appendChild(G.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e},i.dispose=function(){this.contentEl_=null,a.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(V);V.registerComponent("LiveDisplay",c_);var kc=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.updateLiveEdgeStatus(),r.player_.liveTracker&&(r.updateLiveEdgeStatusHandler_=function(s){return r.updateLiveEdgeStatus(s)},r.on(r.player_.liveTracker,"liveedgechange",r.updateLiveEdgeStatusHandler_)),r}var i=t.prototype;return i.createEl=function(){var e=a.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=oe("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e},i.updateLiveEdgeStatus=function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,a.prototype.dispose.call(this)},t}(pt);kc.prototype.controlText_="Seek to live, currently playing live";V.registerComponent("SeekToLive",kc);var da=function(t,i,n){return t=Number(t),Math.min(n,Math.max(i,isNaN(t)?i:t))},po=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.handleMouseDown_=function(s){return r.handleMouseDown(s)},r.handleMouseUp_=function(s){return r.handleMouseUp(s)},r.handleKeyDown_=function(s){return r.handleKeyDown(s)},r.handleClick_=function(s){return r.handleClick(s)},r.handleMouseMove_=function(s){return r.handleMouseMove(s)},r.update_=function(s){return r.update(s)},r.bar=r.getChild(r.options_.barName),r.vertical(!!r.options_.vertical),r.enable(),r}var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(!!this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(e,r,s){return r===void 0&&(r={}),s===void 0&&(s={}),r.className=r.className+" vjs-slider",r=be({tabIndex:0},r),s=be({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},s),a.prototype.createEl.call(this,e,r,s)},i.handleMouseDown=function(e){var r=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!Ht&&e.preventDefault(),zd(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(r,"mousemove",this.handleMouseMove_),this.on(r,"mouseup",this.handleMouseUp_),this.on(r,"touchmove",this.handleMouseMove_),this.on(r,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;$d(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.update()},i.update=function(){var e=this;if(!(!this.el_||!this.bar)){var r=this.getProgress();return r===this.progress_||(this.progress_=r,this.requestNamedAnimationFrame("Slider#update",function(){var s=e.vertical()?"height":"width";e.bar.el().style[s]=(r*100).toFixed(2)+"%"})),r}},i.getProgress=function(){return Number(da(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var r=Zn(this.el_,e);return this.vertical()?r.y:r.x},i.handleKeyDown=function(e){re.isEventKey(e,"Left")||re.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):re.isEventKey(e,"Right")||re.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):a.prototype.handleKeyDown.call(this,e)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(V);V.registerComponent("Slider",po);var mo=function(t,i){return da(t/i*100,0,100).toFixed(2)+"%"},f_=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.partEls_=[],r.on(n,"progress",function(s){return r.update(s)}),r}var i=t.prototype;return i.createEl=function(){var e=a.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),r=oe("span",{className:"vjs-control-text"}),s=oe("span",{textContent:this.localize("Loaded")}),o=G.createTextNode(": ");return this.percentageEl_=oe("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(r),r.appendChild(s),r.appendChild(o),r.appendChild(this.percentageEl_),e},i.dispose=function(){this.partEls_=null,this.percentageEl_=null,a.prototype.dispose.call(this)},i.update=function(e){var r=this;this.requestNamedAnimationFrame("LoadProgressBar#update",function(){var s=r.player_.liveTracker,o=r.player_.buffered(),u=s&&s.isLive()?s.seekableEnd():r.player_.duration(),l=r.player_.bufferedEnd(),c=r.partEls_,g=mo(l,u);r.percent_!==g&&(r.el_.style.width=g,pi(r.percentageEl_,g),r.percent_=g);for(var p=0;po.length;x--)r.el_.removeChild(c[x-1]);c.length=o.length})},t}(V);V.registerComponent("LoadProgressBar",f_);var h_=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.update=qt(ve(ie(r),r.update),ht),r}var i=t.prototype;return i.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,r,s){var o=qr(this.el_),u=$i(this.player_.el()),l=e.width*r;if(!(!u||!o)){var c=e.left-u.left+l,g=e.width-l+(u.right-e.right),p=o.width/2;co.width&&(p=o.width),p=Math.round(p),this.el_.style.right="-"+p+"px",this.write(s)}},i.write=function(e){pi(this.el_,e)},i.updateTime=function(e,r,s,o){var u=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",function(){var l,c=u.player_.duration();if(u.player_.liveTracker&&u.player_.liveTracker.isLive()){var g=u.player_.liveTracker.liveWindow(),p=g-r*g;l=(p<1?"":"-")+er(p,g)}else l=er(s,c);u.update(e,r,l),o&&o()})},t}(V);V.registerComponent("TimeTooltip",h_);var go=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.update=qt(ve(ie(r),r.update),ht),r}var i=t.prototype;return i.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,r){var s=this.getChild("timeTooltip");if(!!s){var o=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();s.updateTime(e,r,o)}},t}(V);go.prototype.options_={children:[]};!ze&&!Bt&&go.prototype.options_.children.push("timeTooltip");V.registerComponent("PlayProgressBar",go);var Ac=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.update=qt(ve(ie(r),r.update),ht),r}var i=t.prototype;return i.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,r){var s=this,o=r*this.player_.duration();this.getChild("timeTooltip").updateTime(e,r,o,function(){s.el_.style.left=e.width*r+"px"})},t}(V);Ac.prototype.options_={children:["timeTooltip"]};V.registerComponent("MouseTimeDisplay",Ac);var ca=5,Ic=12,vo=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.setEventHandlers_(),r}var i=t.prototype;return i.setEventHandlers_=function(){var e=this;this.update_=ve(this,this.update),this.update=qt(this.update_,ht),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=function(r){return e.enableInterval_(r)},this.disableIntervalHandler_=function(r){return e.disableInterval_(r)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in G&&"visibilityState"in G&&this.on(G,"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(e){G.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,ht))},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||!this.updateInterval||(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(e){var r=this;if(G.visibilityState!=="hidden"){var s=a.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",function(){var o=r.player_.ended()?r.player_.duration():r.getCurrentTime_(),u=r.player_.liveTracker,l=r.player_.duration();u&&u.isLive()&&(l=r.player_.liveTracker.liveCurrentTime()),r.percent_!==s&&(r.el_.setAttribute("aria-valuenow",(s*100).toFixed(2)),r.percent_=s),(r.currentTime_!==o||r.duration_!==l)&&(r.el_.setAttribute("aria-valuetext",r.localize("progress bar timing: currentTime={1} duration={2}",[er(o,l),er(l,l)],"{1} of {2}")),r.currentTime_=o,r.duration_=l),r.bar&&r.bar.update($i(r.el()),r.getProgress())}),s}},i.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var e=this.getCurrentTime_(),r,s=this.player_.liveTracker;return s&&s.isLive()?(r=(e-s.seekableStart())/s.liveWindow(),s.atLiveEdge()&&(r=1)):r=e/this.player_.duration(),r},i.handleMouseDown=function(e){!Gr(e)||(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),a.prototype.handleMouseDown.call(this,e))},i.handleMouseMove=function(e,r){if(r===void 0&&(r=!1),!!Gr(e)){!r&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);var s,o=this.calculateDistance(e),u=this.player_.liveTracker;if(!u||!u.isLive())s=o*this.player_.duration(),s===this.player_.duration()&&(s=s-.1);else{if(o>=.99){u.seekToLiveEdge();return}var l=u.seekableStart(),c=u.liveCurrentTime();if(s=l+o*u.liveWindow(),s>=c&&(s=c),s<=l&&(s=l+.1),s===1/0)return}this.userSeek_(s)}},i.enable=function(){a.prototype.enable.call(this);var e=this.getChild("mouseTimeDisplay");!e||e.show()},i.disable=function(){a.prototype.disable.call(this);var e=this.getChild("mouseTimeDisplay");!e||e.hide()},i.handleMouseUp=function(e){a.prototype.handleMouseUp.call(this,e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Et(this.player_.play()):this.update_()},i.stepForward=function(){this.userSeek_(this.player_.currentTime()+ca)},i.stepBack=function(){this.userSeek_(this.player_.currentTime()-ca)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(e){var r=this.player_.liveTracker;if(re.isEventKey(e,"Space")||re.isEventKey(e,"Enter"))e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(re.isEventKey(e,"Home"))e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(re.isEventKey(e,"End"))e.preventDefault(),e.stopPropagation(),r&&r.isLive()?this.userSeek_(r.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(re(e))){e.preventDefault(),e.stopPropagation();var s=(re.codes[re(e)]-re.codes["0"])*10/100;r&&r.isLive()?this.userSeek_(r.seekableStart()+r.liveWindow()*s):this.userSeek_(this.player_.duration()*s)}else re.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-ca*Ic)):re.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+ca*Ic)):a.prototype.handleKeyDown.call(this,e)},i.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in G&&"visibilityState"in G&&this.off(G,"visibilitychange",this.toggleVisibility_),a.prototype.dispose.call(this)},t}(po);vo.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};!ze&&!Bt&&vo.prototype.options_.children.splice(1,0,"mouseTimeDisplay");V.registerComponent("SeekBar",vo);var Dc=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.handleMouseMove=qt(ve(ie(r),r.handleMouseMove),ht),r.throttledHandleMouseSeek=qt(ve(ie(r),r.handleMouseSeek),ht),r.handleMouseUpHandler_=function(s){return r.handleMouseUp(s)},r.handleMouseDownHandler_=function(s){return r.handleMouseDown(s)},r.enable(),r}var i=t.prototype;return i.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var r=this.getChild("seekBar");if(!!r){var s=r.getChild("playProgressBar"),o=r.getChild("mouseTimeDisplay");if(!(!s&&!o)){var u=r.el(),l=qr(u),c=Zn(u,e).x;c=da(c,0,1),o&&o.update(l,c),s&&s.update(l,r.getProgress())}}},i.handleMouseSeek=function(e){var r=this.getChild("seekBar");r&&r.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){if(this.children().forEach(function(r){return r.disable&&r.disable()}),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Et(this.player_.play())}},i.enable=function(){this.children().forEach(function(e){return e.enable&&e.enable()}),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.removeListenersAddedOnMousedownAndTouchstart=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)},i.handleMouseDown=function(e){var r=this.el_.ownerDocument,s=this.getChild("seekBar");s&&s.handleMouseDown(e),this.on(r,"mousemove",this.throttledHandleMouseSeek),this.on(r,"touchmove",this.throttledHandleMouseSeek),this.on(r,"mouseup",this.handleMouseUpHandler_),this.on(r,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var r=this.getChild("seekBar");r&&r.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},t}(V);Dc.prototype.options_={children:["seekBar"]};V.registerComponent("ProgressControl",Dc);var Oc=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.on(n,["enterpictureinpicture","leavepictureinpicture"],function(s){return r.handlePictureInPictureChange(s)}),r.on(n,["disablepictureinpicturechanged","loadedmetadata"],function(s){return r.handlePictureInPictureEnabledChange(s)}),r.on(n,["loadedmetadata","audioonlymodechange","audiopostermodechange"],function(){var s=n.currentType().substring(0,5)==="audio";s||n.audioPosterMode()||n.audioOnlyMode()?(n.isInPictureInPicture()&&n.exitPictureInPicture(),r.hide()):r.show()}),r.disable(),r}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+a.prototype.buildCSSClass.call(this)},i.handlePictureInPictureEnabledChange=function(){G.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1?this.enable():this.disable()},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}(pt);Oc.prototype.controlText_="Picture-in-Picture";V.registerComponent("PictureInPictureToggle",Oc);var Lc=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.on(n,"fullscreenchange",function(s){return r.handleFullscreenChange(s)}),G[n.fsApi_.fullscreenEnabled]===!1&&r.disable(),r}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+a.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(pt);Lc.prototype.controlText_="Fullscreen";V.registerComponent("FullscreenToggle",Lc);var p_=function(t,i){i.tech_&&!i.tech_.featuresVolumeControl&&t.addClass("vjs-hidden"),t.on(i,"loadstart",function(){i.tech_.featuresVolumeControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})},m_=function(a){$(t,a);function t(){return a.apply(this,arguments)||this}var i=t.prototype;return i.createEl=function(){var e=a.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return e.appendChild(a.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),e},t}(V);V.registerComponent("VolumeLevel",m_);var g_=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.update=qt(ve(ie(r),r.update),ht),r}var i=t.prototype;return i.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},i.update=function(e,r,s,o){if(!s){var u=$i(this.el_),l=$i(this.player_.el()),c=e.width*r;if(!l||!u)return;var g=e.left-l.left+c,p=e.width-c+(l.right-e.right),y=u.width/2;gu.width&&(y=u.width),this.el_.style.right="-"+y+"px"}this.write(o+"%")},i.write=function(e){pi(this.el_,e)},i.updateVolume=function(e,r,s,o,u){var l=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",function(){l.update(e,r,s,o.toFixed(0)),u&&u()})},t}(V);V.registerComponent("VolumeLevelTooltip",g_);var Mc=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.update=qt(ve(ie(r),r.update),ht),r}var i=t.prototype;return i.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,r,s){var o=this,u=100*r;this.getChild("volumeLevelTooltip").updateVolume(e,r,s,u,function(){s?o.el_.style.bottom=e.height*r+"px":o.el_.style.left=e.width*r+"px"})},t}(V);Mc.prototype.options_={children:["volumeLevelTooltip"]};V.registerComponent("MouseVolumeLevelDisplay",Mc);var fa=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.on("slideractive",function(s){return r.updateLastVolume_(s)}),r.on(n,"volumechange",function(s){return r.updateARIAAttributes(s)}),n.ready(function(){return r.updateARIAAttributes()}),r}var i=t.prototype;return i.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(e){!Gr(e)||a.prototype.handleMouseDown.call(this,e)},i.handleMouseMove=function(e){var r=this.getChild("mouseVolumeLevelDisplay");if(r){var s=this.el(),o=$i(s),u=this.vertical(),l=Zn(s,e);l=u?l.y:l.x,l=da(l,0,1),r.update(o,l,u)}!Gr(e)||(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var r=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",r),this.el_.setAttribute("aria-valuetext",r+"%")},i.volumeAsPercentage_=function(){return Math.round(this.player_.volume()*100)},i.updateLastVolume_=function(){var e=this,r=this.player_.volume();this.one("sliderinactive",function(){e.player_.volume()===0&&e.player_.lastVolume_(r)})},t}(po);fa.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!ze&&!Bt&&fa.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");fa.prototype.playerEvent="volumechange";V.registerComponent("VolumeBar",fa);var Rc=function(a){$(t,a);function t(n,e){var r;return e===void 0&&(e={}),e.vertical=e.vertical||!1,(typeof e.volumeBar=="undefined"||Br(e.volumeBar))&&(e.volumeBar=e.volumeBar||{},e.volumeBar.vertical=e.vertical),r=a.call(this,n,e)||this,p_(ie(r),n),r.throttledHandleMouseMove=qt(ve(ie(r),r.handleMouseMove),ht),r.handleMouseUpHandler_=function(s){return r.handleMouseUp(s)},r.on("mousedown",function(s){return r.handleMouseDown(s)}),r.on("touchstart",function(s){return r.handleMouseDown(s)}),r.on("mousemove",function(s){return r.handleMouseMove(s)}),r.on(r.volumeBar,["focus","slideractive"],function(){r.volumeBar.addClass("vjs-slider-active"),r.addClass("vjs-slider-active"),r.trigger("slideractive")}),r.on(r.volumeBar,["blur","sliderinactive"],function(){r.volumeBar.removeClass("vjs-slider-active"),r.removeClass("vjs-slider-active"),r.trigger("sliderinactive")}),r}var i=t.prototype;return i.createEl=function(){var e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),a.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+e})},i.handleMouseDown=function(e){var r=this.el_.ownerDocument;this.on(r,"mousemove",this.throttledHandleMouseMove),this.on(r,"touchmove",this.throttledHandleMouseMove),this.on(r,"mouseup",this.handleMouseUpHandler_),this.on(r,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var r=this.el_.ownerDocument;this.off(r,"mousemove",this.throttledHandleMouseMove),this.off(r,"touchmove",this.throttledHandleMouseMove),this.off(r,"mouseup",this.handleMouseUpHandler_),this.off(r,"touchend",this.handleMouseUpHandler_)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(V);Rc.prototype.options_={children:["volumeBar"]};V.registerComponent("VolumeControl",Rc);var v_=function(t,i){i.tech_&&!i.tech_.featuresMuteControl&&t.addClass("vjs-hidden"),t.on(i,"loadstart",function(){i.tech_.featuresMuteControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})},Nc=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,v_(ie(r),n),r.on(n,["loadstart","volumechange"],function(s){return r.update(s)}),r}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+a.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var r=this.player_.volume(),s=this.player_.lastVolume_();if(r===0){var o=s<.1?.1:s;this.player_.volume(o),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),r=3;ze&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?r=0:e<.33?r=1:e<.67&&(r=2);for(var s=0;s<4;s++)Wr(this.el_,"vjs-vol-"+s);Vt(this.el_,"vjs-vol-"+r)},i.updateControlText_=function(){var e=this.player_.muted()||this.player_.volume()===0,r=e?"Unmute":"Mute";this.controlText()!==r&&this.controlText(r)},t}(pt);Nc.prototype.controlText_="Mute";V.registerComponent("MuteToggle",Nc);var Fc=function(a){$(t,a);function t(n,e){var r;return e===void 0&&(e={}),typeof e.inline!="undefined"?e.inline=e.inline:e.inline=!0,(typeof e.volumeControl=="undefined"||Br(e.volumeControl))&&(e.volumeControl=e.volumeControl||{},e.volumeControl.vertical=!e.inline),r=a.call(this,n,e)||this,r.handleKeyPressHandler_=function(s){return r.handleKeyPress(s)},r.on(n,["loadstart"],function(s){return r.volumePanelState_(s)}),r.on(r.muteToggle,"keyup",function(s){return r.handleKeyPress(s)}),r.on(r.volumeControl,"keyup",function(s){return r.handleVolumeControlKeyUp(s)}),r.on("keydown",function(s){return r.handleKeyPress(s)}),r.on("mouseover",function(s){return r.handleMouseOver(s)}),r.on("mouseout",function(s){return r.handleMouseOut(s)}),r.on(r.volumeControl,["slideractive"],r.sliderActive_),r.on(r.volumeControl,["sliderinactive"],r.sliderInactive_),r}var i=t.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},i.createEl=function(){var e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),a.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+e})},i.dispose=function(){this.handleMouseOut(),a.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){re.isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),rt(G,"keyup",this.handleKeyPressHandler_)},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),Be(G,"keyup",this.handleKeyPressHandler_)},i.handleKeyPress=function(e){re.isEventKey(e,"Esc")&&this.handleMouseOut()},t}(V);Fc.prototype.options_={children:["muteToggle","volumeControl"]};V.registerComponent("VolumePanel",Fc);var Uc=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,e&&(r.menuButton_=e.menuButton),r.focusedChild_=-1,r.on("keydown",function(s){return r.handleKeyDown(s)}),r.boundHandleBlur_=function(s){return r.handleBlur(s)},r.boundHandleTapClick_=function(s){return r.handleTapClick(s)},r}var i=t.prototype;return i.addEventListenerForItem=function(e){e instanceof V&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof V&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),a.prototype.removeChild.call(this,e)},i.addItem=function(e){var r=this.addChild(e);r&&this.addEventListenerForItem(r)},i.createEl=function(){var e=this.options_.contentElType||"ul";this.contentEl_=oe(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var r=a.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return r.appendChild(this.contentEl_),rt(r,"click",function(s){s.preventDefault(),s.stopImmediatePropagation()}),r},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,a.prototype.dispose.call(this)},i.handleBlur=function(e){var r=e.relatedTarget||G.activeElement;if(!this.children().some(function(o){return o.el()===r})){var s=this.menuButton_;s&&s.buttonPressed_&&r!==s.el().firstChild&&s.unpressButton()}},i.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var r=this.children();if(!Array.isArray(r))return;var s=r.filter(function(o){return o.el()===e.target})[0];if(!s)return;s.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}},i.handleKeyDown=function(e){re.isEventKey(e,"Left")||re.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(re.isEventKey(e,"Right")||re.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},i.stepForward=function(){var e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)},i.focus=function(e){e===void 0&&(e=0);var r=this.children().slice(),s=r.length&&r[0].hasClass("vjs-menu-title");s&&r.shift(),r.length>0&&(e<0?e=0:e>=r.length&&(e=r.length-1),this.focusedChild_=e,r[e].el_.focus())},t}(V);V.registerComponent("Menu",Uc);var _o=function(a){$(t,a);function t(n,e){var r;e===void 0&&(e={}),r=a.call(this,n,e)||this,r.menuButton_=new pt(n,e),r.menuButton_.controlText(r.controlText_),r.menuButton_.el_.setAttribute("aria-haspopup","true");var s=pt.prototype.buildCSSClass();r.menuButton_.el_.className=r.buildCSSClass()+" "+s,r.menuButton_.removeClass("vjs-control"),r.addChild(r.menuButton_),r.update(),r.enabled_=!0;var o=function(l){return r.handleClick(l)};return r.handleMenuKeyUp_=function(u){return r.handleMenuKeyUp(u)},r.on(r.menuButton_,"tap",o),r.on(r.menuButton_,"click",o),r.on(r.menuButton_,"keydown",function(u){return r.handleKeyDown(u)}),r.on(r.menuButton_,"mouseenter",function(){r.addClass("vjs-hover"),r.menu.show(),rt(G,"keyup",r.handleMenuKeyUp_)}),r.on("mouseleave",function(u){return r.handleMouseLeave(u)}),r.on("keydown",function(u){return r.handleSubmenuKeyDown(u)}),r}var i=t.prototype;return i.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))},i.createMenu=function(){var e=new Uc(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var r=oe("li",{className:"vjs-menu-title",textContent:Ce(this.options_.title),tabIndex:-1}),s=new V(this.player_,{el:r});e.addItem(s)}if(this.items=this.createItems(),this.items)for(var o=0;o-1&&l.mode==="showing"){s=!1;break}}s!==this.isSelected_&&this.selected(s)},i.handleSelectedLanguageChange=function(e){for(var r=this.player().textTracks(),s=!0,o=0,u=r.length;o-1&&l.mode==="showing"){s=!1;break}}s&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(Yr);V.registerComponent("OffTextTrackMenuItem",Bc);var ir=function(a){$(t,a);function t(n,e){return e===void 0&&(e={}),e.tracks=n.textTracks(),a.call(this,n,e)||this}var i=t.prototype;return i.createItems=function(e,r){e===void 0&&(e=[]),r===void 0&&(r=Yr);var s;this.label_&&(s=this.label_+" off"),e.push(new Bc(this.player_,{kinds:this.kinds_,kind:this.kind_,label:s})),this.hideThreshold_+=1;var o=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var u=0;u-1){var c=new r(this.player_,{track:l,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});c.addClass("vjs-"+l.kind+"-menu-item"),e.push(c)}}return e},t}(yo);V.registerComponent("TextTrackButton",ir);var Hc=function(a){$(t,a);function t(n,e){var r,s=e.track,o=e.cue,u=n.currentTime();return e.selectable=!0,e.multiSelectable=!1,e.label=o.text,e.selected=o.startTime<=u&&u=0;r--){var s=e[r];if(s.kind===this.kind_)return s}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Ce(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),a.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var r=this.track_.cues;if(!r)return e;for(var s=0,o=r.length;s-1&&(r.label_="captions"),r.menuButton_.controlText(Ce(r.label_)),r}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+a.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+a.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new So(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=a.prototype.createItems.call(this,e,Vc),e},t}(ir);Co.prototype.kinds_=["captions","subtitles"];Co.prototype.controlText_="Subtitles";V.registerComponent("SubsCapsButton",Co);var jc=function(a){$(t,a);function t(n,e){var r,s=e.track,o=n.audioTracks();e.label=s.label||s.language||"Unknown",e.selected=s.enabled,r=a.call(this,n,e)||this,r.track=s,r.addClass("vjs-"+s.kind+"-menu-item");var u=function(){for(var c=arguments.length,g=new Array(c),p=0;p=0;s--)r.push(new wo(this.player(),{rate:e[s]+"x"}));return r},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){var r=this.player().playbackRate(),s=this.playbackRates(),o=s.indexOf(r),u=(o+1)%s.length;this.player().playbackRate(s[u])},i.handlePlaybackRateschange=function(e){this.update()},i.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},t}(_o);qc.prototype.controlText_="Playback Rate";V.registerComponent("PlaybackRateMenuButton",qc);var Gc=function(a){$(t,a);function t(){return a.apply(this,arguments)||this}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+a.prototype.buildCSSClass.call(this)},i.createEl=function(e,r,s){return e===void 0&&(e="div"),r===void 0&&(r={}),s===void 0&&(s={}),r.className||(r.className=this.buildCSSClass()),a.prototype.createEl.call(this,e,r,s)},t}(V);V.registerComponent("Spacer",Gc);var y_=function(a){$(t,a);function t(){return a.apply(this,arguments)||this}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+a.prototype.buildCSSClass.call(this)},i.createEl=function(){return a.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:"\xA0"})},t}(Gc);V.registerComponent("CustomControlSpacer",y_);var ha=function(a){$(t,a);function t(){return a.apply(this,arguments)||this}var i=t.prototype;return i.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(V);ha.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]};"exitPictureInPicture"in G&&ha.prototype.options_.children.splice(ha.prototype.options_.children.length-1,0,"pictureInPictureToggle");V.registerComponent("ControlBar",ha);var zc=function(a){$(t,a);function t(n,e){var r;return r=a.call(this,n,e)||this,r.on(n,"error",function(s){return r.open(s)}),r}var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+a.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(Yi);zc.prototype.options_=dt({},Yi.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});V.registerComponent("ErrorDisplay",zc);var Po="vjs-text-track-settings",$c=["#000","Black"],Kc=["#00F","Blue"],Xc=["#0FF","Cyan"],Yc=["#0F0","Green"],Qc=["#F0F","Magenta"],Jc=["#F00","Red"],Zc=["#FFF","White"],ef=["#FF0","Yellow"],ko=["1","Opaque"],Ao=["0.5","Semi-Transparent"],tf=["0","Transparent"],Ti={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[$c,Zc,Jc,Yc,Kc,ef,Qc,Xc]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[ko,Ao,tf]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Zc,$c,Jc,Yc,Kc,ef,Qc,Xc]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(t){return t==="1.00"?null:Number(t)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[ko,Ao]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[tf,Ao,ko]}};Ti.windowColor.options=Ti.backgroundColor.options;function rf(a,t){if(t&&(a=t(a)),a&&a!=="none")return a}function T_(a,t){var i=a.options[a.options.selectedIndex].value;return rf(i,t)}function b_(a,t,i){if(!!t){for(var n=0;n',this.localize(u.label),"",'").join("")},i.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['
','',this.localize("Text"),"",this.createElSelect_("color",e),'',this.createElSelect_("textOpacity",e),"","
"].join("")},i.createElBgColor_=function(){var e="captions-background-"+this.id_;return['
','',this.localize("Background"),"",this.createElSelect_("backgroundColor",e),'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")},i.createElWinColor_=function(){var e="captions-window-"+this.id_;return['
','',this.localize("Window"),"",this.createElSelect_("windowColor",e),'',this.createElSelect_("windowOpacity",e),"","
"].join("")},i.createElColors_=function(){return oe("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return oe("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})},i.createElControls_=function(){var e=this.localize("restore all settings to the default values");return oe("div",{className:"vjs-track-settings-controls",innerHTML:['",'"].join("")})},i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.label=function(){return this.localize("Caption Settings Dialog")},i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.buildCSSClass=function(){return a.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e=this;return d0(Ti,function(r,s,o){var u=T_(e.$(s.selector),s.parser);return u!==void 0&&(r[o]=u),r},{})},i.setValues=function(e){var r=this;ji(Ti,function(s,o){b_(r.$(s.selector),e[o],s.parser)})},i.setDefaults=function(){var e=this;ji(Ti,function(r){var s=r.hasOwnProperty("default")?r.default:0;e.$(r.selector).selectedIndex=s})},i.restoreSettings=function(){var e;try{e=JSON.parse(w.localStorage.getItem(Po))}catch(r){ne.warn(r)}e&&this.setValues(e)},i.saveSettings=function(){if(!!this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?w.localStorage.setItem(Po,JSON.stringify(e)):w.localStorage.removeItem(Po)}catch(r){ne.warn(r)}}},i.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},i.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,r=e&&e.subsCapsButton,s=e&&e.captionsButton;r?r.focus():s&&s.focus()},t}(Yi);V.registerComponent("TextTrackSettings",x_);var S_=function(a){$(t,a);function t(n,e){var r,s=e.ResizeObserver||w.ResizeObserver;e.ResizeObserver===null&&(s=!1);var o=_e({createEl:!s,reportTouchActivity:!1},e);return r=a.call(this,n,o)||this,r.ResizeObserver=e.ResizeObserver||w.ResizeObserver,r.loadListener_=null,r.resizeObserver_=null,r.debouncedHandler_=b0(function(){r.resizeHandler()},100,!1,ie(r)),s?(r.resizeObserver_=new r.ResizeObserver(r.debouncedHandler_),r.resizeObserver_.observe(n.el())):(r.loadListener_=function(){if(!(!r.el_||!r.el_.contentWindow)){var u=r.debouncedHandler_,l=r.unloadListener_=function(){Be(this,"resize",u),Be(this,"unload",l),l=null};rt(r.el_.contentWindow,"unload",l),rt(r.el_.contentWindow,"resize",u)}},r.one("load",r.loadListener_)),r}var i=t.prototype;return i.createEl=function(){return a.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})},i.resizeHandler=function(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")},i.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,a.prototype.dispose.call(this)},t}(V);V.registerComponent("ResizeManager",S_);var E_={trackingThreshold:20,liveTolerance:15},C_=function(a){$(t,a);function t(n,e){var r,s=_e(E_,e,{createEl:!1});return r=a.call(this,n,s)||this,r.handleVisibilityChange_=function(o){return r.handleVisibilityChange(o)},r.trackLiveHandler_=function(){return r.trackLive_()},r.handlePlay_=function(o){return r.handlePlay(o)},r.handleFirstTimeupdate_=function(o){return r.handleFirstTimeupdate(o)},r.handleSeeked_=function(o){return r.handleSeeked(o)},r.seekToLiveEdge_=function(o){return r.seekToLiveEdge(o)},r.reset_(),r.on(r.player_,"durationchange",function(o){return r.handleDurationchange(o)}),r.on(r.player_,"canplay",function(){return r.toggleTracking()}),jr&&"hidden"in G&&"visibilityState"in G&&r.on(G,"visibilitychange",r.handleVisibilityChange_),r}var i=t.prototype;return i.handleVisibilityChange=function(){this.player_.duration()===1/0&&(G.hidden?this.stopTracking():this.startTracking())},i.trackLive_=function(){var e=this.player_.seekable();if(!(!e||!e.length)){var r=Number(w.performance.now().toFixed(4)),s=this.lastTime_===-1?0:(r-this.lastTime_)/1e3;this.lastTime_=r,this.pastSeekEnd_=this.pastSeekEnd()+s;var o=this.liveCurrentTime(),u=this.player_.currentTime(),l=this.player_.paused()||this.seekedBehindLive_||Math.abs(o-u)>this.options_.liveTolerance;(!this.timeupdateSeen_||o===1/0)&&(l=!1),l!==this.behindLiveEdge_&&(this.behindLiveEdge_=l,this.trigger("liveedgechange"))}},i.handleDurationchange=function(){this.toggleTracking()},i.toggleTracking=function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},i.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,ht),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))},i.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},i.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},i.reset_=function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)},i.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},i.stopTracking=function(){!this.isTracking()||(this.reset_(),this.trigger("liveedgechange"))},i.seekableEnd=function(){for(var e=this.player_.seekable(),r=[],s=e?e.length:0;s--;)r.push(e.end(s));return r.length?r.sort()[r.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),r=[],s=e?e.length:0;s--;)r.push(e.start(s));return r.length?r.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){var e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return typeof this.trackingInterval_=="number"},i.seekToLiveEdge=function(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},i.dispose=function(){this.off(G,"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),a.prototype.dispose.call(this)},t}(V);V.registerComponent("LiveTracker",C_);var Io=function(t){var i=t.el();if(i.hasAttribute("src"))return t.triggerSourceset(i.src),!0;var n=t.$$("source"),e=[],r="";if(!n.length)return!1;for(var s=0;s=2&&u.push("loadeddata"),e.readyState>=3&&u.push("canplay"),e.readyState>=4&&u.push("canplaythrough"),this.ready(function(){u.forEach(function(l){this.trigger(l)},this)})}},i.setScrubbing=function(e){this.isScrubbing_=e},i.scrubbing=function(){return this.isScrubbing_},i.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&Qn?this.el_.fastSeek(e):this.el_.currentTime=e}catch(r){ne(r,"Video is not ready. (Video.js)")}},i.duration=function(){var e=this;if(this.el_.duration===1/0&&Bt&&Ht&&this.el_.currentTime===0){var r=function s(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",s))};return this.on("timeupdate",r),NaN}return this.el_.duration||NaN},i.width=function(){return this.el_.offsetWidth},i.height=function(){return this.el_.offsetHeight},i.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var r=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},s=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",r),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",s),this.on("dispose",function(){e.off("webkitbeginfullscreen",s),e.off("webkitendfullscreen",r)})}},i.supportsFullScreen=function(){if(typeof this.el_.webkitEnterFullScreen=="function"){var e=w.navigator&&w.navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},i.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Et(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(r){this.trigger("fullscreenerror",r)}},0);else try{e.webkitEnterFullScreen()}catch(r){this.trigger("fullscreenerror",r)}},i.exitFullScreen=function(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()},i.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},i.requestVideoFrameCallback=function(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):a.prototype.requestVideoFrameCallback.call(this,e)},i.cancelVideoFrameCallback=function(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):a.prototype.cancelVideoFrameCallback.call(this,e)},i.src=function(e){if(e===void 0)return this.el_.src;this.setSrc(e)},i.reset=function(){t.resetMediaElement(this.el_)},i.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.setControls=function(e){this.el_.controls=!!e},i.addTextTrack=function(e,r,s){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,r,s):a.prototype.addTextTrack.call(this,e,r,s)},i.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return a.prototype.createRemoteTextTrack.call(this,e);var r=G.createElement("track");return e.kind&&(r.kind=e.kind),e.label&&(r.label=e.label),(e.language||e.srclang)&&(r.srclang=e.language||e.srclang),e.default&&(r.default=e.default),e.id&&(r.id=e.id),e.src&&(r.src=e.src),r},i.addRemoteTextTrack=function(e,r){var s=a.prototype.addRemoteTextTrack.call(this,e,r);return this.featuresNativeTextTracks&&this.el().appendChild(s),s},i.removeRemoteTextTrack=function(e){if(a.prototype.removeRemoteTextTrack.call(this,e),this.featuresNativeTextTracks)for(var r=this.$$("track"),s=r.length;s--;)(e===r[s]||e===r[s].track)&&this.el().removeChild(r[s])},i.getVideoPlaybackQuality=function(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();var e={};return typeof this.el().webkitDroppedFrameCount!="undefined"&&typeof this.el().webkitDecodedFrameCount!="undefined"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),w.performance&&typeof w.performance.now=="function"?e.creationTime=w.performance.now():w.performance&&w.performance.timing&&typeof w.performance.timing.navigationStart=="number"&&(e.creationTime=w.Date.now()-w.performance.timing.navigationStart),e},t}(pe);Do(X,"TEST_VID",function(){if(!!qi()){var a=G.createElement("video"),t=G.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",a.appendChild(t),a}});X.isSupported=function(){try{X.TEST_VID.volume=.5}catch{return!1}return!!(X.TEST_VID&&X.TEST_VID.canPlayType)};X.canPlayType=function(a){return X.TEST_VID.canPlayType(a)};X.canPlaySource=function(a,t){return X.canPlayType(a.type)};X.canControlVolume=function(){try{var a=X.TEST_VID.volume;X.TEST_VID.volume=a/2+.1;var t=a!==X.TEST_VID.volume;return t&&ze?(w.setTimeout(function(){X&&X.prototype&&(X.prototype.featuresVolumeControl=a!==X.TEST_VID.volume)}),!1):t}catch{return!1}};X.canMuteVolume=function(){try{var a=X.TEST_VID.muted;return X.TEST_VID.muted=!a,X.TEST_VID.muted?zi(X.TEST_VID,"muted","muted"):Jn(X.TEST_VID,"muted","muted"),a!==X.TEST_VID.muted}catch{return!1}};X.canControlPlaybackRate=function(){if(Bt&&Ht&&Fd<58)return!1;try{var a=X.TEST_VID.playbackRate;return X.TEST_VID.playbackRate=a/2+.1,a!==X.TEST_VID.playbackRate}catch{return!1}};X.canOverrideAttributes=function(){try{var a=function(){};Object.defineProperty(G.createElement("video"),"src",{get:a,set:a}),Object.defineProperty(G.createElement("audio"),"src",{get:a,set:a}),Object.defineProperty(G.createElement("video"),"innerHTML",{get:a,set:a}),Object.defineProperty(G.createElement("audio"),"innerHTML",{get:a,set:a})}catch{return!1}return!0};X.supportsNativeTextTracks=function(){return Qn||ze&&Ht};X.supportsNativeVideoTracks=function(){return!!(X.TEST_VID&&X.TEST_VID.videoTracks)};X.supportsNativeAudioTracks=function(){return!!(X.TEST_VID&&X.TEST_VID.audioTracks)};X.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function(a){var t=a[0],i=a[1];Do(X.prototype,t,function(){return X[i]()},!0)});X.prototype.featuresVolumeControl=X.canControlVolume();X.prototype.movingMediaElementInDOM=!ze;X.prototype.featuresFullscreenResize=!0;X.prototype.featuresProgressEvents=!0;X.prototype.featuresTimeupdateEvents=!0;X.prototype.featuresVideoFrameCallback=!!(X.TEST_VID&&X.TEST_VID.requestVideoFrameCallback);var pa;X.patchCanPlayType=function(){Ns>=4&&!Nd&&!Ht&&(pa=X.TEST_VID&&X.TEST_VID.constructor.prototype.canPlayType,X.TEST_VID.constructor.prototype.canPlayType=function(a){var t=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;return a&&t.test(a)?"maybe":pa.call(this,a)})};X.unpatchCanPlayType=function(){var a=X.TEST_VID.constructor.prototype.canPlayType;return pa&&(X.TEST_VID.constructor.prototype.canPlayType=pa),a};X.patchCanPlayType();X.disposeMediaElement=function(a){if(!!a){for(a.parentNode&&a.parentNode.removeChild(a);a.hasChildNodes();)a.removeChild(a.firstChild);a.removeAttribute("src"),typeof a.load=="function"&&function(){try{a.load()}catch{}}()}};X.resetMediaElement=function(a){if(!!a){for(var t=a.querySelectorAll("source"),i=t.length;i--;)a.removeChild(t[i]);a.removeAttribute("src"),typeof a.load=="function"&&function(){try{a.load()}catch{}}()}};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(a){X.prototype[a]=function(){return this.el_[a]||this.el_.hasAttribute(a)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(a){X.prototype["set"+Ce(a)]=function(t){this.el_[a]=t,t?this.el_.setAttribute(a,a):this.el_.removeAttribute(a)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(a){X.prototype[a]=function(){return this.el_[a]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(a){X.prototype["set"+Ce(a)]=function(t){this.el_[a]=t}});["pause","load","play"].forEach(function(a){X.prototype[a]=function(){return this.el_[a]()}});pe.withSourceHandlers(X);X.nativeSourceHandler={};X.nativeSourceHandler.canPlayType=function(a){try{return X.TEST_VID.canPlayType(a)}catch{return""}};X.nativeSourceHandler.canHandleSource=function(a,t){if(a.type)return X.nativeSourceHandler.canPlayType(a.type);if(a.src){var i=no(a.src);return X.nativeSourceHandler.canPlayType("video/"+i)}return""};X.nativeSourceHandler.handleSource=function(a,t,i){t.setSrc(a.src)};X.nativeSourceHandler.dispose=function(){};X.registerSourceHandler(X.nativeSourceHandler);pe.registerTech("Html5",X);var sf=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Oo={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Lo=["tiny","xsmall","small","medium","large","xlarge","huge"],ma={};Lo.forEach(function(a){var t=a.charAt(0)==="x"?"x-"+a.substring(1):a;ma[a]="vjs-layout-"+t});var D_={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},we=function(a){$(t,a);function t(n,e,r){var s;if(n.id=n.id||e.id||"vjs_video_"+Wt(),e=be(t.getTagSettings(n),e),e.initChildren=!1,e.createEl=!1,e.evented=!1,e.reportTouchActivity=!1,!e.language)if(typeof n.closest=="function"){var o=n.closest("[lang]");o&&o.getAttribute&&(e.language=o.getAttribute("lang"))}else for(var u=n;u&&u.nodeType===1;){if(jt(u).hasOwnProperty("lang")){e.language=u.getAttribute("lang");break}u=u.parentNode}if(s=a.call(this,null,e,r)||this,s.boundDocumentFullscreenChange_=function(p){return s.documentFullscreenChange_(p)},s.boundFullWindowOnEscKey_=function(p){return s.fullWindowOnEscKey(p)},s.boundUpdateStyleEl_=function(p){return s.updateStyleEl_(p)},s.boundApplyInitTime_=function(p){return s.applyInitTime_(p)},s.boundUpdateCurrentBreakpoint_=function(p){return s.updateCurrentBreakpoint_(p)},s.boundHandleTechClick_=function(p){return s.handleTechClick_(p)},s.boundHandleTechDoubleClick_=function(p){return s.handleTechDoubleClick_(p)},s.boundHandleTechTouchStart_=function(p){return s.handleTechTouchStart_(p)},s.boundHandleTechTouchMove_=function(p){return s.handleTechTouchMove_(p)},s.boundHandleTechTouchEnd_=function(p){return s.handleTechTouchEnd_(p)},s.boundHandleTechTap_=function(p){return s.handleTechTap_(p)},s.isFullscreen_=!1,s.log=Dd(s.id_),s.fsApi_=$n,s.isPosterFromTech_=!1,s.queuedCallbacks_=[],s.isReady_=!1,s.hasStarted_=!1,s.userActive_=!1,s.debugEnabled_=!1,s.audioOnlyMode_=!1,s.audioPosterMode_=!1,s.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!s.options_||!s.options_.techOrder||!s.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(s.tag=n,s.tagAttributes=n&&jt(n),s.language(s.options_.language),e.languages){var l={};Object.getOwnPropertyNames(e.languages).forEach(function(p){l[p.toLowerCase()]=e.languages[p]}),s.languages_=l}else s.languages_=t.prototype.options_.languages;s.resetCache_(),s.poster_=e.poster||"",s.controls_=!!e.controls,n.controls=!1,n.removeAttribute("controls"),s.changingSrc_=!1,s.playCallbacks_=[],s.playTerminatedQueue_=[],n.hasAttribute("autoplay")?s.autoplay(!0):s.autoplay(s.options_.autoplay),e.plugins&&Object.keys(e.plugins).forEach(function(p){if(typeof s[p]!="function")throw new Error('plugin "'+p+'" does not exist')}),s.scrubbing_=!1,s.el_=s.createEl(),Xs(ie(s),{eventBusKey:"el_"}),s.fsApi_.requestFullscreen&&(rt(G,s.fsApi_.fullscreenchange,s.boundDocumentFullscreenChange_),s.on(s.fsApi_.fullscreenchange,s.boundDocumentFullscreenChange_)),s.fluid_&&s.on(["playerreset","resize"],s.boundUpdateStyleEl_);var c=_e(s.options_);e.plugins&&Object.keys(e.plugins).forEach(function(p){s[p](e.plugins[p])}),e.debug&&s.debug(!0),s.options_.playerOptions=c,s.middleware_=[],s.playbackRates(e.playbackRates),s.initChildren(),s.isAudio(n.nodeName.toLowerCase()==="audio"),s.controls()?s.addClass("vjs-controls-enabled"):s.addClass("vjs-controls-disabled"),s.el_.setAttribute("role","region"),s.isAudio()?s.el_.setAttribute("aria-label",s.localize("Audio Player")):s.el_.setAttribute("aria-label",s.localize("Video Player")),s.isAudio()&&s.addClass("vjs-audio"),s.flexNotSupported_()&&s.addClass("vjs-no-flex"),Wi&&s.addClass("vjs-touch-enabled"),ze||s.addClass("vjs-workinghover"),t.players[s.id_]=ie(s);var g=Pd.split(".")[0];return s.addClass("vjs-v"+g),s.userActive(!0),s.reportUserActivity(),s.one("play",function(p){return s.listenForUserActivity_(p)}),s.on("stageclick",function(p){return s.handleStageClick_(p)}),s.on("keydown",function(p){return s.handleKeyDown(p)}),s.on("languagechange",function(p){return s.handleLanguagechange(p)}),s.breakpoints(s.options_.breakpoints),s.responsive(s.options_.responsive),s.on("ready",function(){s.audioPosterMode(s.options_.audioPosterMode),s.audioOnlyMode(s.options_.audioOnlyMode)}),s}var i=t.prototype;return i.dispose=function(){var e=this;this.trigger("dispose"),this.off("dispose"),Be(G,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Be(G,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),t.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Q0(this),Xe.names.forEach(function(r){var s=Xe[r],o=e[s.getterName]();o&&o.off&&o.off()}),a.prototype.dispose.call(this,{restoreEl:this.options_.restoreEl})},i.createEl=function(){var e=this.tag,r,s=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player"),o=this.tag.tagName.toLowerCase()==="video-js";s?r=this.el_=e.parentNode:o||(r=this.el_=a.prototype.createEl.call(this,"div"));var u=jt(e);if(o){for(r=this.el_=e,e=this.tag=G.createElement("video");r.children.length;)e.appendChild(r.firstChild);mi(r,"video-js")||Vt(r,"video-js"),r.appendChild(e),s=this.playerElIngest_=r,Object.keys(r).forEach(function(b){try{e[b]=r[b]}catch{}})}if(e.setAttribute("tabindex","-1"),u.tabindex="-1",(jr||Ht&&Ud)&&(e.setAttribute("role","application"),u.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in u&&delete u.width,"height"in u&&delete u.height,Object.getOwnPropertyNames(u).forEach(function(b){o&&b==="class"||r.setAttribute(b,u[b]),o&&e.setAttribute(b,u[b])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=r.player=this,this.addClass("vjs-paused"),w.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=ec("vjs-styles-dimensions");var l=ti(".vjs-styles-defaults"),c=ti("head");c.insertBefore(this.styleEl_,l?l.nextSibling:c.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);for(var g=e.getElementsByTagName("a"),p=0;p=0&&(s.width=e),r>=0&&(s.height=r));return}var o,u,l,c;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?l=this.aspectRatio_:this.videoWidth()>0?l=this.videoWidth()+":"+this.videoHeight():l="16:9";var g=l.split(":"),p=g[1]/g[0];this.width_!==void 0?o=this.width_:this.height_!==void 0?o=this.height_/p:o=this.videoWidth()||300,this.height_!==void 0?u=this.height_:u=o*p,/^[^a-zA-Z]/.test(this.id())?c="dimensions-"+this.id():c=this.id()+"-dimensions",this.addClass(c),tc(this.styleEl_,` .`+c+` { width: `+o+`px; height: `+u+`px; } .`+c+`.vjs-fluid:not(.vjs-audio-only-mode) { padding-top: `+p*100+`%; } `)},i.loadTech_=function(e,r){var s=this;this.tech_&&this.unloadTech_();var o=Ce(e),u=e.charAt(0).toLowerCase()+e.slice(1);o!=="Html5"&&this.tag&&(pe.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=o,this.isReady_=!1;var l=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(l=!1);var c={source:r,autoplay:l,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+u+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset,Promise:this.options_.Promise};Xe.names.forEach(function(p){var y=Xe[p];c[y.getterName]=s[y.privateName]}),be(c,this.options_[o]),be(c,this.options_[u]),be(c,this.options_[e.toLowerCase()]),this.tag&&(c.tag=this.tag),r&&r.src===this.cache_.src&&this.cache_.currentTime>0&&(c.startTime=this.cache_.currentTime);var g=pe.getTech(e);if(!g)throw new Error("No Tech named '"+o+"' exists! '"+o+"' should be registered using videojs.registerTech()'");this.tech_=new g(c),this.tech_.ready(ve(this,this.handleTechReady_),!0),dc.jsonToTextTracks(this.textTracksJson_||[],this.tech_),sf.forEach(function(p){s.on(s.tech_,p,function(y){return s["handleTech"+Ce(p)+"_"](y)})}),Object.keys(Oo).forEach(function(p){s.on(s.tech_,p,function(y){if(s.tech_.playbackRate()===0&&s.tech_.seeking()){s.queuedCallbacks_.push({callback:s["handleTech"+Oo[p]+"_"].bind(s),event:y});return}s["handleTech"+Oo[p]+"_"](y)})}),this.on(this.tech_,"loadstart",function(p){return s.handleTechLoadStart_(p)}),this.on(this.tech_,"sourceset",function(p){return s.handleTechSourceset_(p)}),this.on(this.tech_,"waiting",function(p){return s.handleTechWaiting_(p)}),this.on(this.tech_,"ended",function(p){return s.handleTechEnded_(p)}),this.on(this.tech_,"seeking",function(p){return s.handleTechSeeking_(p)}),this.on(this.tech_,"play",function(p){return s.handleTechPlay_(p)}),this.on(this.tech_,"firstplay",function(p){return s.handleTechFirstPlay_(p)}),this.on(this.tech_,"pause",function(p){return s.handleTechPause_(p)}),this.on(this.tech_,"durationchange",function(p){return s.handleTechDurationChange_(p)}),this.on(this.tech_,"fullscreenchange",function(p,y){return s.handleTechFullscreenChange_(p,y)}),this.on(this.tech_,"fullscreenerror",function(p,y){return s.handleTechFullscreenError_(p,y)}),this.on(this.tech_,"enterpictureinpicture",function(p){return s.handleTechEnterPictureInPicture_(p)}),this.on(this.tech_,"leavepictureinpicture",function(p){return s.handleTechLeavePictureInPicture_(p)}),this.on(this.tech_,"error",function(p){return s.handleTechError_(p)}),this.on(this.tech_,"posterchange",function(p){return s.handleTechPosterChange_(p)}),this.on(this.tech_,"textdata",function(p){return s.handleTechTextData_(p)}),this.on(this.tech_,"ratechange",function(p){return s.handleTechRateChange_(p)}),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(o!=="Html5"||!this.tag)&&Hs(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},i.unloadTech_=function(){var e=this;Xe.names.forEach(function(r){var s=Xe[r];e[s.privateName]=e[s.getterName]()}),this.textTracksJson_=dc.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},i.tech=function(e){return e===void 0&&ne.warn(`Using the tech directly can be dangerous. I hope you know what you're doing. See https://github.com/videojs/video.js/issues/2617 for more info. `),this.tech_},i.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)},i.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)},i.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},i.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())},i.manualAutoplay_=function(e){var r=this;if(!(!this.tech_||typeof e!="string")){var s=function(){var l=r.muted();r.muted(!0);var c=function(){r.muted(l)};r.playTerminatedQueue_.push(c);var g=r.play();if(!!$r(g))return g.catch(function(p){throw c(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(p||""))})},o;if(e==="any"&&!this.muted()?(o=this.play(),$r(o)&&(o=o.catch(s))):e==="muted"&&!this.muted()?o=s():o=this.play(),!!$r(o))return o.then(function(){r.trigger({type:"autoplay-success",autoplay:e})}).catch(function(){r.trigger({type:"autoplay-failure",autoplay:e})})}},i.updateSourceCaches_=function(e){e===void 0&&(e="");var r=e,s="";typeof r!="string"&&(r=e.src,s=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],r&&!s&&(s=e_(this,r)),this.cache_.source=_e({},e,{src:r,type:s});for(var o=this.cache_.sources.filter(function(y){return y.src&&y.src===r}),u=[],l=this.$$("source"),c=[],g=0;g0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(function(e){return e.callback(e.event)}),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},i.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var r=this.currentTime(),s=function o(){r!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",o))};this.on("timeupdate",s)},i.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},i.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},i.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},i.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},i.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},i.handleTechFirstPlay_=function(){this.options_.starttime&&(ne.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},i.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},i.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},i.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},i.handleTechClick_=function(e){!this.controls_||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Et(this.play()):this.pause())},i.handleTechDoubleClick_=function(e){if(!!this.controls_){var r=Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(s){return s.contains(e.target)});r||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}},i.handleTechTap_=function(){this.userActive(!this.userActive())},i.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},i.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},i.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},i.handleStageClick_=function(){this.reportUserActivity()},i.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},i.documentFullscreenChange_=function(e){var r=e.target.player;if(!(r&&r!==this)){var s=this.el(),o=G[this.fsApi_.fullscreenElement]===s;!o&&s.matches?o=s.matches(":"+this.fsApi_.fullscreen):!o&&s.msMatchesSelector&&(o=s.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(o)}},i.handleTechFullscreenChange_=function(e,r){var s=this;r&&(r.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",function(){s.removeClass("vjs-ios-native-fs")})),this.isFullscreen(r.isFullscreen))},i.handleTechFullscreenError_=function(e,r){this.trigger("fullscreenerror",r)},i.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},i.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},i.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},i.handleTechError_=function(){var e=this.tech_.error();this.error(e)},i.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},i.getCache=function(){return this.cache_},i.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}},i.techCall_=function(e,r){this.ready(function(){if(e in X0)return $0(this.middleware_,this.tech_,e,r);if(e in xc)return bc(this.middleware_,this.tech_,e,r);try{this.tech_&&this.tech_[e](r)}catch(s){throw ne(s),s}},!0)},i.techGet_=function(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in K0)return z0(this.middleware_,this.tech_,e);if(e in xc)return bc(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(r){throw this.tech_[e]===void 0?(ne("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",r),r):r.name==="TypeError"?(ne("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",r),this.tech_.isReady_=!1,r):(ne(r),r)}}},i.play=function(){var e=this,r=this.options_.Promise||w.Promise;return r?new r(function(s){e.play_(s)}):this.play_()},i.play_=function(e){var r=this;e===void 0&&(e=Et),this.playCallbacks_.push(e);var s=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!s){this.waitToPlay_=function(u){r.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!s&&(Qn||ze)&&this.load();return}var o=this.techGet_("play");o===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(o)},i.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(r){r()})},i.runPlayCallbacks_=function(e){var r=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],r.forEach(function(s){s(e)})},i.pause=function(){this.techCall_("pause")},i.paused=function(){return this.techGet_("paused")!==!1},i.played=function(){return this.techGet_("played")||vi(0,0)},i.scrubbing=function(e){if(typeof e=="undefined")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},i.currentTime=function(e){if(typeof e!="undefined"){if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0;return}return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime},i.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},i.duration=function(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},i.remainingTime=function(){return this.duration()-this.currentTime()},i.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},i.buffered=function(){var e=this.techGet_("buffered");return(!e||!e.length)&&(e=vi(0,0)),e},i.bufferedPercent=function(){return lc(this.buffered(),this.duration())},i.bufferedEnd=function(){var e=this.buffered(),r=this.duration(),s=e.end(e.length-1);return s>r&&(s=r),s},i.volume=function(e){var r;if(e!==void 0){r=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=r,this.techCall_("setVolume",r),r>0&&this.lastVolume_(r);return}return r=parseFloat(this.techGet_("volume")),isNaN(r)?1:r},i.muted=function(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1},i.defaultMuted=function(e){return e!==void 0?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},i.lastVolume_=function(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume},i.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},i.isFullscreen=function(e){if(e!==void 0){var r=this.isFullscreen_;this.isFullscreen_=Boolean(e),this.isFullscreen_!==r&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_},i.requestFullscreen=function(e){var r=this.options_.Promise||w.Promise;if(r){var s=this;return new r(function(o,u){function l(){s.off("fullscreenerror",g),s.off("fullscreenchange",c)}function c(){l(),o()}function g(y,b){l(),u(b)}s.one("fullscreenchange",c),s.one("fullscreenerror",g);var p=s.requestFullscreenHelper_(e);p&&(p.then(l,l),p.then(o,u))})}return this.requestFullscreenHelper_()},i.requestFullscreenHelper_=function(e){var r=this,s;if(this.fsApi_.prefixed||(s=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(s=e)),this.fsApi_.requestFullscreen){var o=this.el_[this.fsApi_.requestFullscreen](s);return o&&o.then(function(){return r.isFullscreen(!0)},function(){return r.isFullscreen(!1)}),o}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},i.exitFullscreen=function(){var e=this.options_.Promise||w.Promise;if(e){var r=this;return new e(function(s,o){function u(){r.off("fullscreenerror",c),r.off("fullscreenchange",l)}function l(){u(),s()}function c(p,y){u(),o(y)}r.one("fullscreenchange",l),r.one("fullscreenerror",c);var g=r.exitFullscreenHelper_();g&&(g.then(u,u),g.then(s,o))})}return this.exitFullscreenHelper_()},i.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var r=G[this.fsApi_.exitFullscreen]();return r&&Et(r.then(function(){return e.isFullscreen(!1)})),r}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},i.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=G.documentElement.style.overflow,rt(G,"keydown",this.boundFullWindowOnEscKey_),G.documentElement.style.overflow="hidden",Vt(G.body,"vjs-full-window"),this.trigger("enterFullWindow")},i.fullWindowOnEscKey=function(e){re.isEventKey(e,"Esc")&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},i.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,Be(G,"keydown",this.boundFullWindowOnEscKey_),G.documentElement.style.overflow=this.docOrigOverflow,Wr(G.body,"vjs-full-window"),this.trigger("exitFullWindow")},i.disablePictureInPicture=function(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},i.isInPictureInPicture=function(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_},i.requestPictureInPicture=function(){if("pictureInPictureEnabled"in G&&this.disablePictureInPicture()===!1)return this.techGet_("requestPictureInPicture")},i.exitPictureInPicture=function(){if("pictureInPictureEnabled"in G)return G.exitPictureInPicture()},i.handleKeyDown=function(e){var r=this.options_.userActions;if(!(!r||!r.hotkeys)){var s=function(u){var l=u.tagName.toLowerCase();if(u.isContentEditable)return!0;var c=["button","checkbox","hidden","radio","reset","submit"];if(l==="input")return c.indexOf(u.type)===-1;var g=["textarea"];return g.indexOf(l)!==-1};s(this.el_.ownerDocument.activeElement)||(typeof r.hotkeys=="function"?r.hotkeys.call(this,e):this.handleHotkeys(e))}},i.handleHotkeys=function(e){var r=this.options_.userActions?this.options_.userActions.hotkeys:{},s=r.fullscreenKey,o=s===void 0?function(S){return re.isEventKey(S,"f")}:s,u=r.muteKey,l=u===void 0?function(S){return re.isEventKey(S,"m")}:u,c=r.playPauseKey,g=c===void 0?function(S){return re.isEventKey(S,"k")||re.isEventKey(S,"Space")}:c;if(o.call(this,e)){e.preventDefault(),e.stopPropagation();var p=V.getComponent("FullscreenToggle");G[this.fsApi_.fullscreenEnabled]!==!1&&p.prototype.handleClick.call(this,e)}else if(l.call(this,e)){e.preventDefault(),e.stopPropagation();var y=V.getComponent("MuteToggle");y.prototype.handleClick.call(this,e)}else if(g.call(this,e)){e.preventDefault(),e.stopPropagation();var b=V.getComponent("PlayToggle");b.prototype.handleClick.call(this,e)}},i.canPlayType=function(e){for(var r,s=0,o=this.options_.techOrder;s1)return s.handleSrc_(o.slice(1));s.changingSrc_=!1,s.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),s.triggerReady();return}G0(g,s.tech_)}),this.options_.retryOnError&&o.length>1){var u=function(){s.error(null),s.handleSrc_(o.slice(1),!0)},l=function(){s.off("error",u)};this.one("error",u),this.one("playing",l),this.resetRetryOnError_=function(){s.off("error",u),s.off("playing",l)}}},i.src=function(e){return this.handleSrc_(e,!1)},i.src_=function(e){var r=this,s=this.selectSource([e]);return s?C0(s.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(s.tech,s.source),this.tech_.ready(function(){r.changingSrc_=!1}),!1):!0},i.load=function(){this.techCall_("load")},i.reset=function(){var e=this,r=this.options_.Promise||w.Promise;if(this.paused()||!r)this.doReset_();else{var s=this.play();Et(s.then(function(){return e.doReset_()}))}},i.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),Gt(this)&&this.trigger("playerreset")},i.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},i.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar||{},r=e.durationDisplay,s=e.remainingTimeDisplay;r&&r.updateContent(),s&&s.updateContent()},i.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},i.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},i.currentSources=function(){var e=this.currentSource(),r=[];return Object.keys(e).length!==0&&r.push(e),this.cache_.sources||r},i.currentSource=function(){return this.cache_.source||{}},i.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},i.currentType=function(){return this.currentSource()&&this.currentSource().type||""},i.preload=function(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")},i.autoplay=function(e){if(e===void 0)return this.options_.autoplay||!1;var r;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),r=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,r=typeof r=="undefined"?this.options_.autoplay:r,this.tech_&&this.techCall_("setAutoplay",r)},i.playsinline=function(e){return e!==void 0?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},i.loop=function(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")},i.poster=function(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},i.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},i.controls=function(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},i.usingNativeControls=function(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},i.error=function(e){var r=this;if(e===void 0)return this.error_||null;if(ei("beforeerror").forEach(function(o){var u=o(r,e);if(!(Ut(u)&&!Array.isArray(u)||typeof u=="string"||typeof u=="number"||u===null)){r.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=u}),this.options_.suppressNotSupportedError&&e&&e.code===4){var s=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],s),this.one("loadstart",function(){this.off(["click","touchstart"],s)});return}if(e===null){this.error_=e,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Ke(e),this.addClass("vjs-error"),ne.error("(CODE:"+this.error_.code+" "+Ke.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),ei("error").forEach(function(o){return o(r,r.error_)})},i.reportUserActivity=function(e){this.userActivity_=!0},i.userActive=function(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(r){r.stopPropagation(),r.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},i.listenForUserActivity_=function(){var e,r,s,o=ve(this,this.reportUserActivity),u=function(b){(b.screenX!==r||b.screenY!==s)&&(r=b.screenX,s=b.screenY,o())},l=function(){o(),this.clearInterval(e),e=this.setInterval(o,250)},c=function(b){o(),this.clearInterval(e)};this.on("mousedown",l),this.on("mousemove",u),this.on("mouseup",c),this.on("mouseleave",c);var g=this.getChild("controlBar");g&&!ze&&!Bt&&(g.on("mouseenter",function(y){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),g.on("mouseleave",function(y){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",o),this.on("keyup",o);var p;this.setInterval(function(){if(!!this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(p);var y=this.options_.inactivityTimeout;y<=0||(p=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},y))}},250)},i.playbackRate=function(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1},i.defaultPlaybackRate=function(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},i.isAudio=function(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_},i.enableAudioOnlyUI_=function(){var e=this;this.addClass("vjs-audio-only-mode");var r=this.children(),s=this.getChild("ControlBar"),o=s&&s.currentHeight();r.forEach(function(u){u!==s&&u.el_&&!u.hasClass("vjs-hidden")&&(u.hide(),e.audioOnlyCache_.hiddenChildren.push(u))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(o),this.trigger("audioonlymodechange")},i.disableAudioOnlyUI_=function(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(function(e){return e.show()}),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")},i.audioOnlyMode=function(e){var r=this;if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;this.audioOnlyMode_=e;var s=this.options_.Promise||w.Promise;if(s){if(e){var o=[];return this.isInPictureInPicture()&&o.push(this.exitPictureInPicture()),this.isFullscreen()&&o.push(this.exitFullscreen()),this.audioPosterMode()&&o.push(this.audioPosterMode(!1)),s.all(o).then(function(){return r.enableAudioOnlyUI_()})}return s.resolve().then(function(){return r.disableAudioOnlyUI_()})}e?(this.isInPictureInPicture()&&this.exitPictureInPicture(),this.isFullscreen()&&this.exitFullscreen(),this.enableAudioOnlyUI_()):this.disableAudioOnlyUI_()},i.enablePosterModeUI_=function(){var e=this.tech_&&this.tech_;e.hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.disablePosterModeUI_=function(){var e=this.tech_&&this.tech_;e.show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.audioPosterMode=function(e){var r=this;if(typeof e!="boolean"||e===this.audioPosterMode_)return this.audioPosterMode_;this.audioPosterMode_=e;var s=this.options_.Promise||w.Promise;if(s){if(e){if(this.audioOnlyMode()){var o=this.audioOnlyMode(!1);return o.then(function(){r.enablePosterModeUI_()})}return s.resolve().then(function(){r.enablePosterModeUI_()})}return s.resolve().then(function(){r.disablePosterModeUI_()})}if(e){this.audioOnlyMode()&&this.audioOnlyMode(!1),this.enablePosterModeUI_();return}this.disablePosterModeUI_()},i.addTextTrack=function(e,r,s){if(this.tech_)return this.tech_.addTextTrack(e,r,s)},i.addRemoteTextTrack=function(e,r){if(this.tech_)return this.tech_.addRemoteTextTrack(e,r)},i.removeRemoteTextTrack=function(e){e===void 0&&(e={});var r=e,s=r.track;if(s||(s=e),this.tech_)return this.tech_.removeRemoteTextTrack(s)},i.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},i.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},i.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},i.language=function(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Gt(this)&&this.trigger("languagechange"))},i.languages=function(){return _e(t.prototype.options_.languages,this.languages_)},i.toJSON=function(){var e=_e(this.options_),r=e.tracks;e.tracks=[];for(var s=0;s"):function(){}},ii=1/30,wt=ii*3,df=function(t,i){var n=[],e;if(t&&t.length)for(e=0;e=i})},xa=function(t,i){return df(t,function(n){return n-ii>=i})},M_=function(t){if(t.length<2)return D.createTimeRanges();for(var i=[],n=1;n "+t.end(n));return i.join(", ")},N_=function(t,i,n){n===void 0&&(n=1);var e=t.length?t.end(t.length-1):0;return(e-i)/n},bi=function(t){for(var i=[],n=0;ns)){if(i>r&&i<=s){n+=s-i;continue}n+=s-r}}return n},hf=D.createTimeRange,No=function(t,i){if(!i.preload)return i.duration;var n=0;return(i.parts||[]).forEach(function(e){n+=e.duration}),(i.preloadHints||[]).forEach(function(e){e.type==="PART"&&(n+=t.partTargetDuration)}),n},Fo=function(t){return(t.segments||[]).reduce(function(i,n,e){return n.parts?n.parts.forEach(function(r,s){i.push({duration:r.duration,segmentIndex:e,partIndex:s,part:r,segment:n})}):i.push({duration:n.duration,segmentIndex:e,partIndex:null,segment:n,part:null}),i},[])},pf=function(t){var i=t.segments&&t.segments.length&&t.segments[t.segments.length-1];return i&&i.parts||[]},mf=function(t){var i=t.preloadSegment;if(!!i){var n=i.parts,e=i.preloadHints,r=(e||[]).reduce(function(s,o){return s+(o.type==="PART"?1:0)},0);return r+=n&&n.length?n.length:0,r}},gf=function(t,i){if(i.endList)return 0;if(t&&t.suggestedPresentationDelay)return t.suggestedPresentationDelay;var n=pf(i).length>0;return n&&i.serverControl&&i.serverControl.partHoldBack?i.serverControl.partHoldBack:n&&i.partTargetDuration?i.partTargetDuration*3:i.serverControl&&i.serverControl.holdBack?i.serverControl.holdBack:i.targetDuration?i.targetDuration*3:0},U_=function(t,i){var n=0,e=i-t.mediaSequence,r=t.segments[e];if(r){if(typeof r.start!="undefined")return{result:r.start,precise:!0};if(typeof r.end!="undefined")return{result:r.end-r.duration,precise:!0}}for(;e--;){if(r=t.segments[e],typeof r.end!="undefined")return{result:n+r.end,precise:!0};if(n+=No(t,r),typeof r.start!="undefined")return{result:n+r.start,precise:!0}}return{result:n,precise:!1}},B_=function(t,i){for(var n=0,e,r=i-t.mediaSequence;rr){var o=[r,e];e=o[0],r=o[1]}if(e<0){for(var u=e;u0)for(var y=c-1;y>=0;y--){var b=l[y];if(u+=b.duration,o){if(u<0)continue}else if(u+ii<=0)continue;return{partIndex:b.partIndex,segmentIndex:b.segmentIndex,startTime:s-Jr({defaultDuration:i.targetDuration,durationList:l,startIndex:c,endIndex:y})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:n}}if(c<0){for(var S=c;S<0;S++)if(u-=i.targetDuration,u<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:n};c=0}for(var x=c;x0)continue}else if(u-ii>=0)continue;return{partIndex:A.partIndex,segmentIndex:A.segmentIndex,startTime:s+Jr({defaultDuration:i.targetDuration,durationList:l,startIndex:c,endIndex:x})}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:n}},Tf=function(t){return t.excludeUntil&&t.excludeUntil>Date.now()},Uo=function(t){return t.excludeUntil&&t.excludeUntil===1/0},Sa=function(t){var i=Tf(t);return!t.disabled&&!i},j_=function(t){return t.disabled},W_=function(t){for(var i=0;i-1&&o!==s.length-1&&(n._HLS_part=o),(o>-1||s.length)&&r--}n._HLS_msn=r}if(i.serverControl&&i.serverControl.canSkipUntil&&(n._HLS_skip=i.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(n).length){var u=new w.URL(t);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(l){!n.hasOwnProperty(l)||u.searchParams.set(l,n[l])}),t=u.toString()}return t},Q_=function(t,i){if(!t)return i;var n=Ea(t,i);if(t.preloadHints&&!i.preloadHints&&delete n.preloadHints,t.parts&&!i.parts)delete n.parts;else if(t.parts&&i.parts)for(var e=0;e=500?4:2},this.trigger("error")},i.parseManifest_=function(e){var r=this,s=e.url,o=e.manifestString;return G_({onwarn:function(l){var c=l.message;return r.logger_("m3u8-parser warn for "+s+": "+c)},oninfo:function(l){var c=l.message;return r.logger_("m3u8-parser info for "+s+": "+c)},manifestString:o,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},i.haveMetadata=function(e){var r=e.playlistString,s=e.playlistObject,o=e.url,u=e.id;this.request=null,this.state="HAVE_METADATA";var l=s||this.parseManifest_({url:o,manifestString:r});l.lastRequest=Date.now(),Ef({playlist:l,uri:o,id:u});var c=jo(this.master,l);this.targetDuration=l.partTargetDuration||l.targetDuration,this.pendingMedia_=null,c?(this.master=c,this.media_=this.master.playlists[u]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Wo(this.media(),!!c)),this.trigger("loadedplaylist")},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),w.clearTimeout(this.mediaUpdateTimeout),w.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,r){var s=this;if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(w.clearTimeout(this.finalRenditionTimeout),r){var o=(e.partTargetDuration||e.targetDuration)/2*1e3||5*1e3;this.finalRenditionTimeout=w.setTimeout(this.media.bind(this,e,!1),o);return}var u=this.state,l=!this.media_||e.id!==this.media_.id,c=this.master.playlists[e.id];if(c&&c.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,l&&(this.trigger("mediachanging"),u==="HAVE_MASTER"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(Wo(e,!0)),!!l){if(this.state="SWITCHING_MEDIA",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(g,p){if(!!s.request){if(e.lastRequest=Date.now(),e.resolvedUri=ba(s.handleManifestRedirects,e.resolvedUri,p),g)return s.playlistRequestError(s.request,e,u);s.haveMetadata({playlistString:p.responseText,url:e.uri,id:e.id}),u==="HAVE_MASTER"?s.trigger("loadedmetadata"):s.trigger("mediachange")}})}},i.pause=function(){this.mediaUpdateTimeout&&(w.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")},i.load=function(e){var r=this;this.mediaUpdateTimeout&&(w.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var s=this.media();if(e){var o=s?(s.partTargetDuration||s.targetDuration)/2*1e3:5*1e3;this.mediaUpdateTimeout=w.setTimeout(function(){r.mediaUpdateTimeout=null,r.load()},o);return}if(!this.started){this.start();return}s&&!s.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")},i.updateMediaUpdateTimeout_=function(e){var r=this;this.mediaUpdateTimeout&&(w.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=w.setTimeout(function(){r.mediaUpdateTimeout=null,r.trigger("mediaupdatetimeout"),r.updateMediaUpdateTimeout_(e)},e))},i.start=function(){var e=this;if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=w.location.href),this.src.resolvedUri=this.src.uri,setTimeout(function(){e.setupInitialPlaylist(e.src)},0);return}this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},function(r,s){if(!!e.request){if(e.request=null,r)return e.error={status:s.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:s.responseText,code:2},e.state==="HAVE_NOTHING"&&(e.started=!1),e.trigger("error");e.src=ba(e.handleManifestRedirects,e.src,s);var o=e.parseManifest_({manifestString:s.responseText,url:e.src});e.setupInitialPlaylist(o)}})},i.srcUri=function(){return typeof this.src=="string"?this.src:this.src.uri},i.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists){this.master=e,Cf(this.master,this.srcUri()),e.playlists.forEach(function(s){s.segments=Pf(s),s.segments.forEach(function(o){wf(o,s.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.master.playlists[0]);return}var r=this.srcUri()||w.location.href;this.master=K_(e,r),this.haveMetadata({playlistObject:e,url:r,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(X_),Z_=D.xhr,ey=D.mergeOptions,qo=function(t,i,n,e){var r=t.responseType==="arraybuffer"?t.response:t.responseText;!i&&r&&(t.responseTime=Date.now(),t.roundTripTime=t.responseTime-t.requestTime,t.bytesReceived=r.byteLength||r.length,t.bandwidth||(t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3))),n.headers&&(t.responseHeaders=n.headers),i&&i.code==="ETIMEDOUT"&&(t.timedout=!0),!i&&!t.aborted&&n.statusCode!==200&&n.statusCode!==206&&n.statusCode!==0&&(i=new Error("XHR Failed with a response of: "+(t&&(r||t.responseText)))),e(i,t)},Af=function(){var t=function i(n,e){n=ey({timeout:45e3},n);var r=i.beforeRequest||D.Vhs.xhr.beforeRequest;if(r&&typeof r=="function"){var s=r(n);s&&(n=s)}var o=D.Vhs.xhr.original===!0?Z_:D.Vhs.xhr,u=o(n,function(c,g){return qo(u,c,g,e)}),l=u.abort;return u.abort=function(){return u.aborted=!0,l.apply(u,arguments)},u.uri=n.uri,u.requestTime=Date.now(),u};return t.original=!0,t},ty=function(t){var i,n=t.offset;return typeof t.offset=="bigint"||typeof t.length=="bigint"?i=w.BigInt(t.offset)+w.BigInt(t.length)-w.BigInt(1):i=t.offset+t.length-1,"bytes="+n+"-"+i},Go=function(t){var i={};return t.byterange&&(i.Range=ty(t.byterange)),i},iy=function(t,i){return t.start(i)+"-"+t.end(i)},ry=function(t,i){var n=t.toString(16);return"00".substring(0,2-n.length)+n+(i%2?" ":"")},ny=function(t){return t>=32&&t<126?String.fromCharCode(t):"."},If=function(t){var i={};return Object.keys(t).forEach(function(n){var e=t[n];ml(e)?i[n]={bytes:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength}:i[n]=e}),i},Ca=function(t){var i=t.byterange||{length:1/0,offset:0};return[i.length,i.offset,t.resolvedUri].join(",")},Df=function(t){return t.resolvedUri},Of=function(t){for(var i=Array.prototype.slice.call(t),n=16,e="",r,s,o=0;oc?null:(n>u&&(e=o),{segment:e,estimatedStart:e.videoTimingInfo?e.videoTimingInfo.transmuxedPresentationStart:et.duration(i,i.mediaSequence+i.segments.indexOf(e)),type:e.videoTimingInfo?"accurate":"estimate"})},cy=function(t,i){if(!i||!i.segments||i.segments.length===0)return null;for(var n=0,e,r=0;rn){if(t>n+s.duration*Lf)return null;e=s}return{segment:e,estimatedStart:e.videoTimingInfo?e.videoTimingInfo.transmuxedPresentationStart:n-e.duration,type:e.videoTimingInfo?"accurate":"estimate"}},fy=function(t,i){var n,e;try{n=new Date(t),e=new Date(i)}catch{}var r=n.getTime(),s=e.getTime();return(s-r)/1e3},hy=function(t){if(!t.segments||t.segments.length===0)return!1;for(var i=0;i=A+x)return c(g,{response:b.subarray(x,x+A),status:p.status,uri:p.uri});o.request=o.vhs_.xhr({uri:l,responseType:"arraybuffer",headers:Go({byterange:e.sidx.byterange})},c)})},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},w.clearTimeout(this.minimumUpdatePeriodTimeout_),w.clearTimeout(this.mediaRequest_),w.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,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 r=this;if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);var s=this.state;if(typeof e=="string"){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var o=!this.media_||e.id!==this.media_.id;if(o&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,o&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}!o||(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,s,function(u){r.haveMetadata({startingState:s,playlist:e})}))},i.haveMetadata=function(e){var r=e.startingState,s=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[s.id]=s,this.mediaRequest_=null,this.refreshMedia_(s.id),r==="HAVE_MASTER"?this.trigger("loadedmetadata"):this.trigger("mediachange")},i.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),w.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(w.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)},i.load=function(e){var r=this;w.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var s=this.media();if(e){var o=s?s.targetDuration/2*1e3:5*1e3;this.mediaUpdateTimeout=w.setTimeout(function(){return r.load()},o);return}if(!this.started){this.start();return}s&&!s.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")},i.start=function(){var e=this;if(this.started=!0,!this.isMaster_){this.mediaRequest_=w.setTimeout(function(){return e.haveMaster_()},0);return}this.requestMaster_(function(r,s){e.haveMaster_(),!e.hasPendingRequest()&&!e.media_&&e.media(e.masterPlaylistLoader_.master.playlists[0])})},i.requestMaster_=function(e){var r=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},function(s,o){if(r.requestErrored_(s,o)){r.state==="HAVE_NOTHING"&&(r.started=!1);return}var u=o.responseText!==r.masterPlaylistLoader_.masterXml_;if(r.masterPlaylistLoader_.masterXml_=o.responseText,o.responseHeaders&&o.responseHeaders.date?r.masterLoaded_=Date.parse(o.responseHeaders.date):r.masterLoaded_=Date.now(),r.masterPlaylistLoader_.srcUrl=ba(r.handleManifestRedirects,r.masterPlaylistLoader_.srcUrl,o),u){r.handleMaster_(),r.syncClientServerClock_(function(){return e(o,u)});return}return e(o,u)})},i.syncClientServerClock_=function(e){var r=this,s=Hv(this.masterPlaylistLoader_.masterXml_);if(s===null)return this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e();if(s.method==="DIRECT")return this.masterPlaylistLoader_.clientOffset_=s.value-Date.now(),e();this.request=this.vhs_.xhr({uri:mt(this.masterPlaylistLoader_.srcUrl,s.value),method:s.method,withCredentials:this.withCredentials},function(o,u){if(!!r.request){if(o)return r.masterPlaylistLoader_.clientOffset_=r.masterLoaded_-Date.now(),e();var l;s.method==="HEAD"?!u.responseHeaders||!u.responseHeaders.date?l=r.masterLoaded_:l=Date.parse(u.responseHeaders.date):l=Date.parse(u.responseText),r.masterPlaylistLoader_.clientOffset_=l-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,r=_y({masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(r=yy(e,r,this.masterPlaylistLoader_.sidxMapping_)),this.masterPlaylistLoader_.master=r||e;var s=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0];return s&&s!==this.masterPlaylistLoader_.srcUrl&&(this.masterPlaylistLoader_.srcUrl=s),(!e||r&&r.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(r)},i.updateMinimumUpdatePeriodTimeout_=function(){var e=this.masterPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(w.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);var r=e.master&&e.master.minimumUpdatePeriod;if(r===0&&(e.media()?r=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof r!="number"||r<=0){r<0&&this.logger_("found invalid minimumUpdatePeriod of "+r+", not setting a timeout");return}this.createMUPTimeout_(r)},i.createMUPTimeout_=function(e){var r=this.masterPlaylistLoader_;r.minimumUpdatePeriodTimeout_=w.setTimeout(function(){r.minimumUpdatePeriodTimeout_=null,r.trigger("minimumUpdatePeriod"),r.createMUPTimeout_(e)},e)},i.refreshXml_=function(){var e=this;this.requestMaster_(function(r,s){!s||(e.media_&&(e.media_=e.masterPlaylistLoader_.master.playlists[e.media_.id]),e.masterPlaylistLoader_.sidxMapping_=by(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.sidxMapping_),e.addSidxSegments_(e.media(),e.state,function(o){e.refreshMedia_(e.media().id)}))})},i.refreshMedia_=function(e){var r=this;if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMaster_&&this.handleMaster_();var s=this.masterPlaylistLoader_.master.playlists,o=!this.media_||this.media_!==s[e];if(o?this.media_=s[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){var u=function l(){r.media().endList||(r.mediaUpdateTimeout=w.setTimeout(function(){r.trigger("mediaupdatetimeout"),l()},Wo(r.media(),Boolean(o))))};u()}this.trigger("loadedplaylist")},t}(vy),Oe={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},xy=function(t){for(var i=new Uint8Array(new ArrayBuffer(t.length)),n=0;n-1):!1},this.trigger=function(h){var f,m,v,_;if(f=d[h],!!f)if(arguments.length===2)for(v=f.length,m=0;m>>1,d.samplingfrequencyindex<<7|d.channelcount<<3,6,1,2]))},l=function(){return s(B.ftyp,K,te,K,ae)},M=function(d){return s(B.hdlr,de[d])},c=function(d){return s(B.mdat,d)},L=function(d){var h=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,d.duration>>>24&255,d.duration>>>16&255,d.duration>>>8&255,d.duration&255,85,196,0,0]);return d.samplerate&&(h[12]=d.samplerate>>>24&255,h[13]=d.samplerate>>>16&255,h[14]=d.samplerate>>>8&255,h[15]=d.samplerate&255),s(B.mdhd,h)},H=function(d){return s(B.mdia,L(d),M(d.type),p(d))},g=function(d){return s(B.mfhd,new Uint8Array([0,0,0,0,(d&4278190080)>>24,(d&16711680)>>16,(d&65280)>>8,d&255]))},p=function(d){return s(B.minf,d.type==="video"?s(B.vmhd,ke):s(B.smhd,ue),o(),U(d))},y=function(d,h){for(var f=[],m=h.length;m--;)f[m]=W(h[m]);return s.apply(null,[B.moof,g(d)].concat(f))},b=function(d){for(var h=d.length,f=[];h--;)f[h]=A(d[h]);return s.apply(null,[B.moov,x(4294967295)].concat(f).concat(S(d)))},S=function(d){for(var h=d.length,f=[];h--;)f[h]=R(d[h]);return s.apply(null,[B.mvex].concat(f))},x=function(d){var h=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(d&4278190080)>>24,(d&16711680)>>16,(d&65280)>>8,d&255,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 s(B.mvhd,h)},j=function(d){var h=d.samples||[],f=new Uint8Array(4+h.length),m,v;for(v=0;v>>8),_.push(m[C].byteLength&255),_=_.concat(Array.prototype.slice.call(m[C]));for(C=0;C>>8),E.push(v[C].byteLength&255),E=E.concat(Array.prototype.slice.call(v[C]));if(k=[B.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,(f.width&65280)>>8,f.width&255,(f.height&65280)>>8,f.height&255,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]),s(B.avcC,new Uint8Array([1,f.profileIdc,f.profileCompatibility,f.levelIdc,255].concat([m.length],_,[v.length],E))),s(B.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],f.sarRatio){var P=f.sarRatio[0],I=f.sarRatio[1];k.push(s(B.pasp,new Uint8Array([(P&4278190080)>>24,(P&16711680)>>16,(P&65280)>>8,P&255,(I&4278190080)>>24,(I&16711680)>>16,(I&65280)>>8,I&255])))}return s.apply(null,k)},d=function(f){return s(B.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(f.channelcount&65280)>>8,f.channelcount&255,(f.samplesize&65280)>>8,f.samplesize&255,0,0,0,0,(f.samplerate&65280)>>8,f.samplerate&255,0,0]),u(f))}}(),O=function(d){var h=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(d.id&4278190080)>>24,(d.id&16711680)>>16,(d.id&65280)>>8,d.id&255,0,0,0,0,(d.duration&4278190080)>>24,(d.duration&16711680)>>16,(d.duration&65280)>>8,d.duration&255,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,(d.width&65280)>>8,d.width&255,0,0,(d.height&65280)>>8,d.height&255,0,0]);return s(B.tkhd,h)},W=function(d){var h,f,m,v,_,E,C;return h=s(B.tfhd,new Uint8Array([0,0,0,58,(d.id&4278190080)>>24,(d.id&16711680)>>16,(d.id&65280)>>8,d.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),E=Math.floor(d.baseMediaDecodeTime/r),C=Math.floor(d.baseMediaDecodeTime%r),f=s(B.tfdt,new Uint8Array([1,0,0,0,E>>>24&255,E>>>16&255,E>>>8&255,E&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255])),_=32+20+8+16+8+8,d.type==="audio"?(m=Q(d,_),s(B.traf,h,f,m)):(v=j(d),m=Q(d,v.length+_),s(B.traf,h,f,m,v))},A=function(d){return d.duration=d.duration||4294967295,s(B.trak,O(d),H(d))},R=function(d){var h=new Uint8Array([0,0,0,0,(d.id&4278190080)>>24,(d.id&16711680)>>16,(d.id&65280)>>8,d.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return d.type!=="video"&&(h[h.length-1]=0),s(B.trex,h)},function(){var T,d,h;h=function(m,v){var _=0,E=0,C=0,k=0;return m.length&&(m[0].duration!==void 0&&(_=1),m[0].size!==void 0&&(E=2),m[0].flags!==void 0&&(C=4),m[0].compositionTimeOffset!==void 0&&(k=8)),[0,0,_|E|C|k,1,(m.length&4278190080)>>>24,(m.length&16711680)>>>16,(m.length&65280)>>>8,m.length&255,(v&4278190080)>>>24,(v&16711680)>>>16,(v&65280)>>>8,v&255]},d=function(m,v){var _,E,C,k,P,I;for(k=m.samples||[],v+=8+12+16*k.length,C=h(k,v),E=new Uint8Array(C.length+k.length*16),E.set(C),_=C.length,I=0;I>>24,E[_++]=(P.duration&16711680)>>>16,E[_++]=(P.duration&65280)>>>8,E[_++]=P.duration&255,E[_++]=(P.size&4278190080)>>>24,E[_++]=(P.size&16711680)>>>16,E[_++]=(P.size&65280)>>>8,E[_++]=P.size&255,E[_++]=P.flags.isLeading<<2|P.flags.dependsOn,E[_++]=P.flags.isDependedOn<<6|P.flags.hasRedundancy<<4|P.flags.paddingValue<<1|P.flags.isNonSyncSample,E[_++]=P.flags.degradationPriority&240<<8,E[_++]=P.flags.degradationPriority&15,E[_++]=(P.compositionTimeOffset&4278190080)>>>24,E[_++]=(P.compositionTimeOffset&16711680)>>>16,E[_++]=(P.compositionTimeOffset&65280)>>>8,E[_++]=P.compositionTimeOffset&255;return s(B.trun,E)},T=function(m,v){var _,E,C,k,P,I;for(k=m.samples||[],v+=8+12+8*k.length,C=h(k,v),_=new Uint8Array(C.length+k.length*8),_.set(C),E=C.length,I=0;I>>24,_[E++]=(P.duration&16711680)>>>16,_[E++]=(P.duration&65280)>>>8,_[E++]=P.duration&255,_[E++]=(P.size&4278190080)>>>24,_[E++]=(P.size&16711680)>>>16,_[E++]=(P.size&65280)>>>8,_[E++]=P.size&255;return s(B.trun,_)},Q=function(m,v){return m.type==="audio"?T(m,v):d(m,v)}}();var vt={ftyp:l,mdat:c,moof:y,moov:b,initSegment:function(d){var h=l(),f=b(d),m;return m=new Uint8Array(h.byteLength+f.byteLength),m.set(h),m.set(f,h.byteLength),m}},xi=function(d){var h,f,m=[],v=[];for(v.byteLength=0,v.nalCount=0,v.duration=0,m.byteLength=0,h=0;h1&&(h=d.shift(),d.byteLength-=h.byteLength,d.nalCount-=h.nalCount,d[0][0].dts=h.dts,d[0][0].pts=h.pts,d[0][0].duration+=h.duration),d},yh=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},ru=function(d,h){var f=yh();return f.dataOffset=h,f.compositionTimeOffset=d.pts-d.dts,f.duration=d.duration,f.size=4*d.length,f.size+=d.byteLength,d.keyFrame&&(f.flags.dependsOn=2,f.flags.isNonSyncSample=0),f},Th=function(d,h){var f,m,v,_,E,C=h||0,k=[];for(f=0;fle.ONE_SECOND_IN_TS/2))){for(P=Ch()[d.samplerate],P||(P=h[0].data),I=0;I=f?d:(h.minSegmentDts=1/0,d.filter(function(m){return m.dts>=f?(h.minSegmentDts=Math.min(h.minSegmentDts,m.dts),h.minSegmentPts=h.minSegmentDts,!0):!1}))},Ah=function(d){var h,f,m=[];for(h=0;h=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(T),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},It.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},It.prototype.addText=function(T){this.rows[this.rowIdx]+=T},It.prototype.backspace=function(){if(!this.isEmpty()){var T=this.rows[this.rowIdx];this.rows[this.rowIdx]=T.substr(0,T.length-1)}};var un=function(d,h,f){this.serviceNum=d,this.text="",this.currentWindow=new It(-1),this.windows=[],this.stream=f,typeof h=="string"&&this.createTextDecoder(h)};un.prototype.init=function(T,d){this.startPts=T;for(var h=0;h<8;h++)this.windows[h]=new It(h),typeof d=="function"&&(this.windows[h].beforeRowOverflow=d)},un.prototype.setCurrentWindow=function(T){this.currentWindow=this.windows[T]},un.prototype.createTextDecoder=function(T){if(typeof TextDecoder=="undefined")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(T)}catch(d){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+T+" encoding. "+d})}};var me=function T(d){d=d||{},T.prototype.init.call(this);var h=this,f=d.captionServices||{},m={},v;Object.keys(f).forEach(function(_){v=f[_],/^SERVICE/.test(_)&&(m[_]=v.encoding)}),this.serviceEncodings=m,this.current708Packet=null,this.services={},this.push=function(_){_.type===3?(h.new708Packet(),h.add708Bytes(_)):(h.current708Packet===null&&h.new708Packet(),h.add708Bytes(_))}};me.prototype=new t,me.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},me.prototype.add708Bytes=function(T){var d=T.ccData,h=d>>>8,f=d&255;this.current708Packet.ptsVals.push(T.pts),this.current708Packet.data.push(h),this.current708Packet.data.push(f)},me.prototype.push708Packet=function(){var T=this.current708Packet,d=T.data,h=null,f=null,m=0,v=d[m++];for(T.seq=v>>6,T.sizeCode=v&63;m>5,f=v&31,h===7&&f>0&&(v=d[m++],h=v),this.pushServiceBlock(h,m,f),f>0&&(m+=f-1)},me.prototype.pushServiceBlock=function(T,d,h){var f,m=d,v=this.current708Packet.data,_=this.services[T];for(_||(_=this.initService(T,m));m>5,v.rowLock=(f&16)>>4,v.columnLock=(f&8)>>3,v.priority=f&7,f=h[++T],v.relativePositioning=(f&128)>>7,v.anchorVertical=f&127,f=h[++T],v.anchorHorizontal=f,f=h[++T],v.anchorPoint=(f&240)>>4,v.rowCount=f&15,f=h[++T],v.columnCount=f&63,f=h[++T],v.windowStyle=(f&56)>>3,v.penStyle=f&7,v.virtualRowCount=v.rowCount+1,T},me.prototype.setWindowAttributes=function(T,d){var h=this.current708Packet.data,f=h[T],m=d.currentWindow.winAttr;return f=h[++T],m.fillOpacity=(f&192)>>6,m.fillRed=(f&48)>>4,m.fillGreen=(f&12)>>2,m.fillBlue=f&3,f=h[++T],m.borderType=(f&192)>>6,m.borderRed=(f&48)>>4,m.borderGreen=(f&12)>>2,m.borderBlue=f&3,f=h[++T],m.borderType+=(f&128)>>5,m.wordWrap=(f&64)>>6,m.printDirection=(f&48)>>4,m.scrollDirection=(f&12)>>2,m.justify=f&3,f=h[++T],m.effectSpeed=(f&240)>>4,m.effectDirection=(f&12)>>2,m.displayEffect=f&3,T},me.prototype.flushDisplayed=function(T,d){for(var h=[],f=0;f<8;f++)d.windows[f].visible&&!d.windows[f].isEmpty()&&h.push(d.windows[f].getText());d.endPts=T,d.text=h.join(` `),this.pushCaption(d),d.startPts=T},me.prototype.pushCaption=function(T){T.text!==""&&(this.trigger("data",{startPts:T.startPts,endPts:T.endPts,text:T.text,stream:"cc708_"+T.serviceNum}),T.text="",T.startPts=T.endPts)},me.prototype.displayWindows=function(T,d){var h=this.current708Packet.data,f=h[++T],m=this.getPts(T);this.flushDisplayed(m,d);for(var v=0;v<8;v++)f&1<>4,m.offset=(f&12)>>2,m.penSize=f&3,f=h[++T],m.italics=(f&128)>>7,m.underline=(f&64)>>6,m.edgeType=(f&56)>>3,m.fontStyle=f&7,T},me.prototype.setPenColor=function(T,d){var h=this.current708Packet.data,f=h[T],m=d.currentWindow.penColor;return f=h[++T],m.fgOpacity=(f&192)>>6,m.fgRed=(f&48)>>4,m.fgGreen=(f&12)>>2,m.fgBlue=f&3,f=h[++T],m.bgOpacity=(f&192)>>6,m.bgRed=(f&48)>>4,m.bgGreen=(f&12)>>2,m.bgBlue=f&3,f=h[++T],m.edgeRed=(f&48)>>4,m.edgeGreen=(f&12)>>2,m.edgeBlue=f&3,T},me.prototype.setPenLocation=function(T,d){var h=this.current708Packet.data,f=h[T],m=d.currentWindow.penLoc;return d.currentWindow.pendingNewLine=!0,f=h[++T],m.row=f&15,f=h[++T],m.column=f&63,T},me.prototype.reset=function(T,d){var h=this.getPts(T);return this.flushDisplayed(h,d),this.initService(d.serviceNum,T)};var jh={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},ln=function(d){return d===null?"":(d=jh[d]||d,String.fromCharCode(d))},dn=14,Wh=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ni=function(){for(var d=[],h=dn+1;h--;)d.push("");return d},Te=function T(d,h){T.prototype.init.call(this),this.field_=d||0,this.dataChannel_=h||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(f){var m,v,_,E,C;if(m=f.ccData&32639,m===this.lastControlCode_){this.lastControlCode_=null;return}if((m&61440)==4096?this.lastControlCode_=m:m!==this.PADDING_&&(this.lastControlCode_=null),_=m>>>8,E=m&255,m!==this.PADDING_)if(m===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(m===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(f.pts),this.flushDisplayed(f.pts),v=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=v,this.startPts_=f.pts;else if(m===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(f.pts);else if(m===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(f.pts);else if(m===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(f.pts);else if(m===this.CARRIAGE_RETURN_)this.clearFormatting(f.pts),this.flushDisplayed(f.pts),this.shiftRowsUp_(),this.startPts_=f.pts;else if(m===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(m===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(f.pts),this.displayed_=ni();else if(m===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=ni();else if(m===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(f.pts),this.displayed_=ni()),this.mode_="paintOn",this.startPts_=f.pts;else if(this.isSpecialCharacter(_,E))_=(_&3)<<8,C=ln(_|E),this[this.mode_](f.pts,C),this.column_++;else if(this.isExtCharacter(_,E))this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),_=(_&3)<<8,C=ln(_|E),this[this.mode_](f.pts,C),this.column_++;else if(this.isMidRowCode(_,E))this.clearFormatting(f.pts),this[this.mode_](f.pts," "),this.column_++,(E&14)==14&&this.addFormatting(f.pts,["i"]),(E&1)==1&&this.addFormatting(f.pts,["u"]);else if(this.isOffsetControlCode(_,E))this.column_+=E&3;else if(this.isPAC(_,E)){var k=Wh.indexOf(m&7968);this.mode_==="rollUp"&&(k-this.rollUpRows_+1<0&&(k=this.rollUpRows_-1),this.setRollUp(f.pts,k)),k!==this.row_&&(this.clearFormatting(f.pts),this.row_=k),E&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(f.pts,["u"]),(m&16)==16&&(this.column_=((m&14)>>1)*4),this.isColorPAC(E)&&(E&14)==14&&this.addFormatting(f.pts,["i"])}else this.isNormalChar(_)&&(E===0&&(E=null),C=ln(_),C+=ln(E),this[this.mode_](f.pts,C),this.column_+=C.length)}};Te.prototype=new t,Te.prototype.flushDisplayed=function(T){var d=this.displayed_.map(function(h,f){try{return h.trim()}catch{return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+f+"."}),""}},this).join(` `).replace(/^\n+|\n+$/g,"");d.length&&this.trigger("data",{startPts:this.startPts_,endPts:T,text:d,stream:this.name_})},Te.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=ni(),this.nonDisplayed_=ni(),this.lastControlCode_=null,this.column_=0,this.row_=dn,this.rollUpRows_=2,this.formatting_=[]},Te.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Te.prototype.isSpecialCharacter=function(T,d){return T===this.EXT_&&d>=48&&d<=63},Te.prototype.isExtCharacter=function(T,d){return(T===this.EXT_+1||T===this.EXT_+2)&&d>=32&&d<=63},Te.prototype.isMidRowCode=function(T,d){return T===this.EXT_&&d>=32&&d<=47},Te.prototype.isOffsetControlCode=function(T,d){return T===this.OFFSET_&&d>=33&&d<=35},Te.prototype.isPAC=function(T,d){return T>=this.BASE_&&T=64&&d<=127},Te.prototype.isColorPAC=function(T){return T>=64&&T<=79||T>=96&&T<=127},Te.prototype.isNormalChar=function(T){return T>=32&&T<=127},Te.prototype.setRollUp=function(T,d){if(this.mode_!=="rollUp"&&(this.row_=dn,this.mode_="rollUp",this.flushDisplayed(T),this.nonDisplayed_=ni(),this.displayed_=ni()),d!==void 0&&d!==this.row_)for(var h=0;h"},"");this[this.mode_](T,h)},Te.prototype.clearFormatting=function(T){if(!!this.formatting_.length){var d=this.formatting_.reverse().reduce(function(h,f){return h+""},"");this.formatting_=[],this[this.mode_](T,d)}},Te.prototype.popOn=function(T,d){var h=this.nonDisplayed_[this.row_];h+=d,this.nonDisplayed_[this.row_]=h},Te.prototype.rollUp=function(T,d){var h=this.displayed_[this.row_];h+=d,this.displayed_[this.row_]=h},Te.prototype.shiftRowsUp_=function(){var T;for(T=0;Th&&(f=-1);Math.abs(h-d)>Gh;)d+=f*qh;return d},lu=function T(d){var h,f;T.prototype.init.call(this),this.type_=d||uu,this.push=function(m){this.type_!==uu&&m.type!==this.type_||(f===void 0&&(f=m.dts),m.dts=Ha(m.dts,f),m.pts=Ha(m.pts,f),h=m.dts,this.trigger("data",m))},this.flush=function(){f=h,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){f=void 0,h=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};lu.prototype=new t;var du={TimestampRolloverStream:lu,handleRollover:Ha},cu=function(d,h,f){var m,v="";for(m=h;m>>2;q*=4,q+=Y[7]&3,I.timeStamp=q,C.pts===void 0&&C.dts===void 0&&(C.pts=I.timeStamp,C.dts=I.timeStamp),this.trigger("timestamp",I)}C.frames.push(I),k+=10,k+=P}while(k>>4>1&&(E+=v[E]+1),_.pid===0)_.type="pat",d(v.subarray(E),_),this.trigger("data",_);else if(_.pid===this.pmtPid)for(_.type="pmt",d(v.subarray(E),_),this.trigger("data",_);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([v,E,_]):this.processPes_(v,E,_)},this.processPes_=function(v,_,E){E.pid===this.programMapTable.video?E.streamType=Le.H264_STREAM_TYPE:E.pid===this.programMapTable.audio?E.streamType=Le.ADTS_STREAM_TYPE:E.streamType=this.programMapTable["timed-metadata"][E.pid],E.type="pes",E.data=v.subarray(_),this.trigger("data",E)}},cr.prototype=new t,cr.STREAM_TYPES={h264:27,adts:15},gn=function(){var d=this,h=!1,f={data:[],size:0},m={data:[],size:0},v={data:[],size:0},_,E=function(P,I){var N,z=P[0]<<16|P[1]<<8|P[2];I.data=new Uint8Array,z===1&&(I.packetLength=6+(P[4]<<8|P[5]),I.dataAlignmentIndicator=(P[6]&4)!=0,N=P[7],N&192&&(I.pts=(P[9]&14)<<27|(P[10]&255)<<20|(P[11]&254)<<12|(P[12]&255)<<5|(P[13]&254)>>>3,I.pts*=4,I.pts+=(P[13]&6)>>>1,I.dts=I.pts,N&64&&(I.dts=(P[14]&14)<<27|(P[15]&255)<<20|(P[16]&254)<<12|(P[17]&255)<<5|(P[18]&254)>>>3,I.dts*=4,I.dts+=(P[18]&6)>>>1)),I.data=P.subarray(9+P[8]))},C=function(P,I,N){var z=new Uint8Array(P.size),Y={type:I},q=0,Z=0,Pe=!1,je;if(!(!P.data.length||P.size<9)){for(Y.trackId=P.data[0].pid,q=0;q>5,k=((h[v+6]&3)+1)*1024,P=k*Xh/pu[(h[v+2]&60)>>>2],h.byteLength-v<_)break;this.trigger("data",{pts:m.pts+f*P,dts:m.dts+f*P,sampleCount:k,audioobjecttype:(h[v+2]>>>6&3)+1,channelcount:(h[v+2]&1)<<2|(h[v+3]&192)>>>6,samplerate:pu[(h[v+2]&60)>>>2],samplingfrequencyindex:(h[v+2]&60)>>>2,samplesize:16,data:h.subarray(v+7+E,v+_)}),f++,v+=_}typeof I=="number"&&(this.skipWarn_(I,v),I=null),h=h.subarray(v)}},this.flush=function(){f=0,this.trigger("done")},this.reset=function(){h=void 0,this.trigger("reset")},this.endTimeline=function(){h=void 0,this.trigger("endedtimeline")}},vn.prototype=new t;var mu=vn,gu;gu=function(d){var h=d.byteLength,f=0,m=0;this.length=function(){return 8*h},this.bitsAvailable=function(){return 8*h+m},this.loadWord=function(){var v=d.byteLength-h,_=new Uint8Array(4),E=Math.min(4,h);if(E===0)throw new Error("no bytes available");_.set(d.subarray(v,v+E)),f=new DataView(_.buffer).getUint32(0),m=E*8,h-=E},this.skipBits=function(v){var _;m>v?(f<<=v,m-=v):(v-=m,_=Math.floor(v/8),v-=_*8,h-=_,this.loadWord(),f<<=v,m-=v)},this.readBits=function(v){var _=Math.min(m,v),E=f>>>32-_;return m-=_,m>0?f<<=_:h>0&&this.loadWord(),_=v-_,_>0?E<<_|this.readBits(_):E},this.skipLeadingZeros=function(){var v;for(v=0;v>>v)!=0)return f<<=v,m-=v,v;return this.loadWord(),v+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var v=this.skipLeadingZeros();return this.readBits(v+1)-1},this.readExpGolomb=function(){var v=this.readUnsignedExpGolomb();return 1&v?1+v>>>1:-1*(v>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Yh=gu,_n,fr,vu;fr=function(){var d=0,h,f;fr.prototype.init.call(this),this.push=function(m){var v;f?(v=new Uint8Array(f.byteLength+m.data.byteLength),v.set(f),v.set(m.data,f.byteLength),f=v):f=m.data;for(var _=f.byteLength;d<_-3;d++)if(f[d+2]===1){h=d+5;break}for(;h<_;)switch(f[h]){case 0:if(f[h-1]!==0){h+=2;break}else if(f[h-2]!==0){h++;break}d+3!==h-2&&this.trigger("data",f.subarray(d+3,h-2));do h++;while(f[h]!==1&&h<_);d=h-2,h+=3;break;case 1:if(f[h-1]!==0||f[h-2]!==0){h+=3;break}this.trigger("data",f.subarray(d+3,h-2)),d=h-2,h+=3;break;default:h+=3;break}f=f.subarray(d),h-=d,d=0},this.reset=function(){f=null,d=0,this.trigger("reset")},this.flush=function(){f&&f.byteLength>3&&this.trigger("data",f.subarray(d+3)),f=null,d=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},fr.prototype=new t,vu={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},_n=function(){var d=new fr,h,f,m,v,_,E,C;_n.prototype.init.call(this),h=this,this.push=function(k){k.type==="video"&&(f=k.trackId,m=k.pts,v=k.dts,d.push(k))},d.on("data",function(k){var P={trackId:f,pts:m,dts:v,data:k,nalUnitTypeCode:k[0]&31};switch(P.nalUnitTypeCode){case 5:P.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:P.nalUnitType="sei_rbsp",P.escapedRBSP=_(k.subarray(1));break;case 7:P.nalUnitType="seq_parameter_set_rbsp",P.escapedRBSP=_(k.subarray(1)),P.config=E(P.escapedRBSP);break;case 8:P.nalUnitType="pic_parameter_set_rbsp";break;case 9:P.nalUnitType="access_unit_delimiter_rbsp";break}h.trigger("data",P)}),d.on("done",function(){h.trigger("done")}),d.on("partialdone",function(){h.trigger("partialdone")}),d.on("reset",function(){h.trigger("reset")}),d.on("endedtimeline",function(){h.trigger("endedtimeline")}),this.flush=function(){d.flush()},this.partialFlush=function(){d.partialFlush()},this.reset=function(){d.reset()},this.endTimeline=function(){d.endTimeline()},C=function(P,I){var N=8,z=8,Y,q;for(Y=0;Y>4;return f=f>=0?f:0,v?f+20:f+10},Zh=function T(d,h){return d.length-h<10||d[h]!=="I".charCodeAt(0)||d[h+1]!=="D".charCodeAt(0)||d[h+2]!=="3".charCodeAt(0)?h:(h+=_u(d,h),T(d,h))},ep=function(d){var h=Zh(d,0);return d.length>=h+2&&(d[h]&255)==255&&(d[h+1]&240)==240&&(d[h+1]&22)==16},yu=function(d){return d[0]<<21|d[1]<<14|d[2]<<7|d[3]},tp=function(d,h,f){var m,v="";for(m=h;m>5,m=d[h+4]<<3,v=d[h+3]&3<<11;return v|m|f},np=function(d,h){return d[h]==="I".charCodeAt(0)&&d[h+1]==="D".charCodeAt(0)&&d[h+2]==="3".charCodeAt(0)?"timed-metadata":d[h]&!0&&(d[h+1]&240)==240?"audio":null},ap=function(d){for(var h=0;h+5>>2]}return null},sp=function(d){var h,f,m,v;h=10,d[5]&64&&(h+=4,h+=yu(d.subarray(10,14)));do{if(f=yu(d.subarray(h+4,h+8)),f<1)return null;if(v=String.fromCharCode(d[h],d[h+1],d[h+2],d[h+3]),v==="PRIV"){m=d.subarray(h+10,h+f+10);for(var _=0;_>>2;return k*=4,k+=C[7]&3,k}break}}h+=10,h+=f}while(h=3;){if(d[v]==="I".charCodeAt(0)&&d[v+1]==="D".charCodeAt(0)&&d[v+2]==="3".charCodeAt(0)){if(d.length-v<10||(m=yn.parseId3TagSize(d,v),v+m>d.length))break;E={type:"timed-metadata",data:d.subarray(v,v+m)},this.trigger("data",E),v+=m;continue}else if((d[v]&255)==255&&(d[v+1]&240)==240){if(d.length-v<7||(m=yn.parseAdtsSize(d,v),v+m>d.length))break;C={type:"audio",data:d.subarray(v,v+m),pts:h,dts:h},this.trigger("data",C),v+=m;continue}v++}_=d.length-v,_>0?d=d.subarray(v):d=new Uint8Array},this.reset=function(){d=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){d=new Uint8Array,this.trigger("endedtimeline")}},Tn.prototype=new t;var op=Tn,up=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Wa=up,lp=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],qa=lp,dp=Qh.H264Stream,cp=yn.isLikelyAacData,fp=le.ONE_SECOND_IN_TS,hr,wi,bn,ai,hp=function(d,h){h.stream=d,this.trigger("log",h)},Tu=function(d,h){for(var f=Object.keys(h),m=0;m=-P&&N<=k&&(!z||I>N)&&(z=q,I=N)));return z?z.gop:null},this.alignGopsAtStart_=function(C){var k,P,I,N,z,Y,q,Z;for(z=C.byteLength,Y=C.nalCount,q=C.duration,k=P=0;kI.pts){k++;continue}P++,z-=N.byteLength,Y-=N.nalCount,q-=N.duration}return P===0?C:P===C.length?null:(Z=C.slice(P),Z.byteLength=z,Z.duration=q,Z.nalCount=Y,Z.pts=Z[0].pts,Z.dts=Z[0].dts,Z)},this.alignGopsAtEnd_=function(C){var k,P,I,N,z,Y;for(k=v.length-1,P=C.length-1,z=null,Y=!1;k>=0&&P>=0;){if(I=v[k],N=C[P],I.pts===N.pts){Y=!0;break}if(I.pts>N.pts){k--;continue}k===v.length-1&&(z=P),P--}if(!Y&&z===null)return null;var q;if(Y?q=P:q=z,q===0)return C;var Z=C.slice(q),Pe=Z.reduce(function(je,ui){return je.byteLength+=ui.byteLength,je.duration+=ui.duration,je.nalCount+=ui.nalCount,je},{byteLength:0,duration:0,nalCount:0});return Z.byteLength=Pe.byteLength,Z.duration=Pe.duration,Z.nalCount=Pe.nalCount,Z.pts=Z[0].pts,Z.dts=Z[0].dts,Z},this.alignGopsWith=function(C){v=C}},hr.prototype=new t,ai=function(d,h){this.numberOfTracks=0,this.metadataStream=h,d=d||{},typeof d.remux!="undefined"?this.remuxTracks=!!d.remux:this.remuxTracks=!0,typeof d.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=d.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ai.prototype.init.call(this),this.push=function(f){if(f.text)return this.pendingCaptions.push(f);if(f.frames)return this.pendingMetadata.push(f);this.pendingTracks.push(f.track),this.pendingBytes+=f.boxes.byteLength,f.track.type==="video"&&(this.videoTrack=f.track,this.pendingBoxes.push(f.boxes)),f.track.type==="audio"&&(this.audioTrack=f.track,this.pendingBoxes.unshift(f.boxes))}},ai.prototype=new t,ai.prototype.flush=function(T){var d=0,h={captions:[],captionStreams:{},metadata:[],info:{}},f,m,v,_=0,E;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(_=this.videoTrack.timelineStartInfo.pts,qa.forEach(function(C){h.info[C]=this.videoTrack[C]},this)):this.audioTrack&&(_=this.audioTrack.timelineStartInfo.pts,Wa.forEach(function(C){h.info[C]=this.audioTrack[C]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?h.type=this.pendingTracks[0].type:h.type="combined",this.emittedTracks+=this.pendingTracks.length,v=vt.initSegment(this.pendingTracks),h.initSegment=new Uint8Array(v.byteLength),h.initSegment.set(v),h.data=new Uint8Array(this.pendingBytes),E=0;E=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},ai.prototype.setRemux=function(T){this.remuxTracks=T},bn=function(d){var h=this,f=!0,m,v;bn.prototype.init.call(this),d=d||{},this.baseMediaDecodeTime=d.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var _={};this.transmuxPipeline_=_,_.type="aac",_.metadataStream=new Dt.MetadataStream,_.aacStream=new op,_.audioTimestampRolloverStream=new Dt.TimestampRolloverStream("audio"),_.timedMetadataTimestampRolloverStream=new Dt.TimestampRolloverStream("timed-metadata"),_.adtsStream=new mu,_.coalesceStream=new ai(d,_.metadataStream),_.headOfPipeline=_.aacStream,_.aacStream.pipe(_.audioTimestampRolloverStream).pipe(_.adtsStream),_.aacStream.pipe(_.timedMetadataTimestampRolloverStream).pipe(_.metadataStream).pipe(_.coalesceStream),_.metadataStream.on("timestamp",function(E){_.aacStream.setTimestamp(E.timeStamp)}),_.aacStream.on("data",function(E){E.type!=="timed-metadata"&&E.type!=="audio"||_.audioSegmentStream||(v=v||{timelineStartInfo:{baseMediaDecodeTime:h.baseMediaDecodeTime},codec:"adts",type:"audio"},_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new wi(v,d),_.audioSegmentStream.on("log",h.getLogTrigger_("audioSegmentStream")),_.audioSegmentStream.on("timingInfo",h.trigger.bind(h,"audioTimingInfo")),_.adtsStream.pipe(_.audioSegmentStream).pipe(_.coalesceStream),h.trigger("trackinfo",{hasAudio:!!v,hasVideo:!!m}))}),_.coalesceStream.on("data",this.trigger.bind(this,"data")),_.coalesceStream.on("done",this.trigger.bind(this,"done")),Tu(this,_)},this.setupTsPipeline=function(){var _={};this.transmuxPipeline_=_,_.type="ts",_.metadataStream=new Dt.MetadataStream,_.packetStream=new Dt.TransportPacketStream,_.parseStream=new Dt.TransportParseStream,_.elementaryStream=new Dt.ElementaryStream,_.timestampRolloverStream=new Dt.TimestampRolloverStream,_.adtsStream=new mu,_.h264Stream=new dp,_.captionStream=new Dt.CaptionStream(d),_.coalesceStream=new ai(d,_.metadataStream),_.headOfPipeline=_.packetStream,_.packetStream.pipe(_.parseStream).pipe(_.elementaryStream).pipe(_.timestampRolloverStream),_.timestampRolloverStream.pipe(_.h264Stream),_.timestampRolloverStream.pipe(_.adtsStream),_.timestampRolloverStream.pipe(_.metadataStream).pipe(_.coalesceStream),_.h264Stream.pipe(_.captionStream).pipe(_.coalesceStream),_.elementaryStream.on("data",function(E){var C;if(E.type==="metadata"){for(C=E.tracks.length;C--;)!m&&E.tracks[C].type==="video"?(m=E.tracks[C],m.timelineStartInfo.baseMediaDecodeTime=h.baseMediaDecodeTime):!v&&E.tracks[C].type==="audio"&&(v=E.tracks[C],v.timelineStartInfo.baseMediaDecodeTime=h.baseMediaDecodeTime);m&&!_.videoSegmentStream&&(_.coalesceStream.numberOfTracks++,_.videoSegmentStream=new hr(m,d),_.videoSegmentStream.on("log",h.getLogTrigger_("videoSegmentStream")),_.videoSegmentStream.on("timelineStartInfo",function(k){v&&!d.keepOriginalTimestamps&&(v.timelineStartInfo=k,_.audioSegmentStream.setEarliestDts(k.dts-h.baseMediaDecodeTime))}),_.videoSegmentStream.on("processedGopsInfo",h.trigger.bind(h,"gopInfo")),_.videoSegmentStream.on("segmentTimingInfo",h.trigger.bind(h,"videoSegmentTimingInfo")),_.videoSegmentStream.on("baseMediaDecodeTime",function(k){v&&_.audioSegmentStream.setVideoBaseMediaDecodeTime(k)}),_.videoSegmentStream.on("timingInfo",h.trigger.bind(h,"videoTimingInfo")),_.h264Stream.pipe(_.videoSegmentStream).pipe(_.coalesceStream)),v&&!_.audioSegmentStream&&(_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new wi(v,d),_.audioSegmentStream.on("log",h.getLogTrigger_("audioSegmentStream")),_.audioSegmentStream.on("timingInfo",h.trigger.bind(h,"audioTimingInfo")),_.audioSegmentStream.on("segmentTimingInfo",h.trigger.bind(h,"audioSegmentTimingInfo")),_.adtsStream.pipe(_.audioSegmentStream).pipe(_.coalesceStream)),h.trigger("trackinfo",{hasAudio:!!v,hasVideo:!!m})}}),_.coalesceStream.on("data",this.trigger.bind(this,"data")),_.coalesceStream.on("id3Frame",function(E){E.dispatchType=_.metadataStream.dispatchType,h.trigger("id3Frame",E)}),_.coalesceStream.on("caption",this.trigger.bind(this,"caption")),_.coalesceStream.on("done",this.trigger.bind(this,"done")),Tu(this,_)},this.setBaseMediaDecodeTime=function(_){var E=this.transmuxPipeline_;d.keepOriginalTimestamps||(this.baseMediaDecodeTime=_),v&&(v.timelineStartInfo.dts=void 0,v.timelineStartInfo.pts=void 0,ut.clearDtsInfo(v),E.audioTimestampRolloverStream&&E.audioTimestampRolloverStream.discontinuity()),m&&(E.videoSegmentStream&&(E.videoSegmentStream.gopCache_=[]),m.timelineStartInfo.dts=void 0,m.timelineStartInfo.pts=void 0,ut.clearDtsInfo(m),E.captionStream.reset()),E.timestampRolloverStream&&E.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(_){v&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(_)},this.setRemux=function(_){var E=this.transmuxPipeline_;d.remux=_,E&&E.coalesceStream&&E.coalesceStream.setRemux(_)},this.alignGopsWith=function(_){m&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(_)},this.getLogTrigger_=function(_){var E=this;return function(C){C.stream=_,E.trigger("log",C)}},this.push=function(_){if(f){var E=cp(_);E&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!E&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),f=!1}this.transmuxPipeline_.headOfPipeline.push(_)},this.flush=function(){f=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},bn.prototype=new t;var pp={Transmuxer:bn,VideoSegmentStream:hr,AudioSegmentStream:wi,AUDIO_PROPERTIES:Wa,VIDEO_PROPERTIES:qa,generateSegmentTimingInfo:Ga},mp=function(d){return d>>>0},gp=function(d){return("00"+d.toString(16)).slice(-2)},xn={toUnsigned:mp,toHexString:gp},vp=function(d){var h="";return h+=String.fromCharCode(d[0]),h+=String.fromCharCode(d[1]),h+=String.fromCharCode(d[2]),h+=String.fromCharCode(d[3]),h},si=vp,_p=xn.toUnsigned,yp=function T(d,h){var f=[],m,v,_,E,C;if(!h.length)return null;for(m=0;m1?m+v:d.byteLength,_===h[0]&&(h.length===1?f.push(d.subarray(m+8,E)):(C=T(d.subarray(m+8,E),h.slice(1)),C.length&&(f=f.concat(C)))),m=E;return f},ge=yp,Tp=xn.toUnsigned,bp=e.getUint64,xp=function(d){var h={version:d[0],flags:new Uint8Array(d.subarray(1,4))};return h.version===1?h.baseMediaDecodeTime=bp(d.subarray(4)):h.baseMediaDecodeTime=Tp(d[4]<<24|d[5]<<16|d[6]<<8|d[7]),h},xu=xp,Sp=function(d){return{isLeading:(d[0]&12)>>>2,dependsOn:d[0]&3,isDependedOn:(d[1]&192)>>>6,hasRedundancy:(d[1]&48)>>>4,paddingValue:(d[1]&14)>>>1,isNonSyncSample:d[1]&1,degradationPriority:d[2]<<8|d[3]}},Su=Sp,Ep=function(d){var h={version:d[0],flags:new Uint8Array(d.subarray(1,4)),samples:[]},f=new DataView(d.buffer,d.byteOffset,d.byteLength),m=h.flags[2]&1,v=h.flags[2]&4,_=h.flags[1]&1,E=h.flags[1]&2,C=h.flags[1]&4,k=h.flags[1]&8,P=f.getUint32(4),I=8,N;for(m&&(h.dataOffset=f.getInt32(I),I+=4),v&&P&&(N={flags:Su(d.subarray(I,I+4))},I+=4,_&&(N.duration=f.getUint32(I),I+=4),E&&(N.size=f.getUint32(I),I+=4),k&&(h.version===1?N.compositionTimeOffset=f.getInt32(I):N.compositionTimeOffset=f.getUint32(I),I+=4),h.samples.push(N),P--);P--;)N={},_&&(N.duration=f.getUint32(I),I+=4),E&&(N.size=f.getUint32(I),I+=4),C&&(N.flags=Su(d.subarray(I,I+4)),I+=4),k&&(h.version===1?N.compositionTimeOffset=f.getInt32(I):N.compositionTimeOffset=f.getUint32(I),I+=4),h.samples.push(N);return h},Eu=Ep,Cp=function(d){var h=new DataView(d.buffer,d.byteOffset,d.byteLength),f={version:d[0],flags:new Uint8Array(d.subarray(1,4)),trackId:h.getUint32(4)},m=f.flags[2]&1,v=f.flags[2]&2,_=f.flags[2]&8,E=f.flags[2]&16,C=f.flags[2]&32,k=f.flags[0]&65536,P=f.flags[0]&131072,I;return I=8,m&&(I+=4,f.baseDataOffset=h.getUint32(12),I+=4),v&&(f.sampleDescriptionIndex=h.getUint32(I),I+=4),_&&(f.defaultSampleDuration=h.getUint32(I),I+=4),E&&(f.defaultSampleSize=h.getUint32(I),I+=4),C&&(f.defaultSampleFlags=h.getUint32(I)),k&&(f.durationIsEmpty=!0),!m&&P&&(f.baseDataOffsetIsMoof=!0),f},Cu=Cp,wu=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},pr;typeof window!="undefined"?pr=window:typeof wu!="undefined"?pr=wu:typeof self!="undefined"?pr=self:pr={};var mr=pr,wp=dr.discardEmulationPreventionBytes,Pp=cn.CaptionStream,kp=function(d,h){for(var f=d,m=0;m0?xu(z[0]).baseMediaDecodeTime:0,q=ge(k,["trun"]),Z,Pe;h===N&&q.length>0&&(Z=Ip(q,Y,I),Pe=Ap(C,Z,N),v[N]||(v[N]={seiNals:[],logs:[]}),v[N].seiNals=v[N].seiNals.concat(Pe.seiNals),v[N].logs=v[N].logs.concat(Pe.logs))}),v},Op=function(d,h,f){var m;if(h===null)return null;m=Dp(d,h);var v=m[h]||{};return{seiNals:v.seiNals,logs:v.logs,timescale:f}},Lp=function(){var d=!1,h,f,m,v,_,E;this.isInitialized=function(){return d},this.init=function(C){h=new Pp,d=!0,E=C?C.isPartial:!1,h.on("data",function(k){k.startTime=k.startPts/v,k.endTime=k.endPts/v,_.captions.push(k),_.captionStreams[k.stream]=!0}),h.on("log",function(k){_.logs.push(k)})},this.isNewInit=function(C,k){return C&&C.length===0||k&&typeof k=="object"&&Object.keys(k).length===0?!1:m!==C[0]||v!==k[m]},this.parse=function(C,k,P){var I;if(this.isInitialized()){if(!k||!P)return null;if(this.isNewInit(k,P))m=k[0],v=P[m];else if(m===null||!v)return f.push(C),null}else return null;for(;f.length>0;){var N=f.shift();this.parse(N,k,P)}return I=Op(C,m,v),I&&I.logs&&(_.logs=_.logs.concat(I.logs)),I===null||!I.seiNals?_.logs.length?{logs:_.logs,captions:[],captionStreams:[]}:null:(this.pushNals(I.seiNals),this.flushStream(),_)},this.pushNals=function(C){if(!this.isInitialized()||!C||C.length===0)return null;C.forEach(function(k){h.push(k)})},this.flushStream=function(){if(!this.isInitialized())return null;E?h.partialFlush():h.flush()},this.clearParsedCaptions=function(){_.captions=[],_.captionStreams={},_.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;h.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){f=[],m=null,v=null,_?this.clearParsedCaptions():_={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Mp=Lp,Sn=xn.toUnsigned,gr=xn.toHexString,Rp=e.getUint64,Pu,ku,Au,Iu,Du,za;Pu=function(d){var h={},f=ge(d,["moov","trak"]);return f.reduce(function(m,v){var _,E,C,k,P;return _=ge(v,["tkhd"])[0],!_||(E=_[0],C=E===0?12:20,k=Sn(_[C]<<24|_[C+1]<<16|_[C+2]<<8|_[C+3]),P=ge(v,["mdia","mdhd"])[0],!P)?null:(E=P[0],C=E===0?12:20,m[k]=Sn(P[C]<<24|P[C+1]<<16|P[C+2]<<8|P[C+3]),m)},h)},ku=function(d,h){var f;f=ge(h,["moof","traf"]);var m=f.reduce(function(v,_){var E=ge(_,["tfhd"])[0],C=Sn(E[4]<<24|E[5]<<16|E[6]<<8|E[7]),k=d[C]||9e4,P=ge(_,["tfdt"])[0],I=new DataView(P.buffer,P.byteOffset,P.byteLength),N;P[0]===1?N=Rp(P.subarray(4,12)):N=I.getUint32(4);var z;return typeof N=="bigint"?z=N/mr.BigInt(k):typeof N=="number"&&!isNaN(N)&&(z=N/k),z11?(v.codec+=".",v.codec+=gr(Y[9]),v.codec+=gr(Y[10]),v.codec+=gr(Y[11])):v.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(v.codec)?(Y=z.subarray(28),q=si(Y.subarray(4,8)),q==="esds"&&Y.length>20&&Y[19]!==0?(v.codec+="."+gr(Y[19]),v.codec+="."+gr(Y[20]>>>2&63).replace(/^0/,"")):v.codec="mp4a.40.2"):v.codec=v.codec.toLowerCase())}var Z=ge(m,["mdia","mdhd"])[0];Z&&(v.timescale=za(Z)),f.push(v)}),f};var Ou={findBox:ge,parseType:si,timescale:Pu,startTime:ku,compositionStartTime:Au,videoTrackIds:Iu,tracks:Du,getTimescaleFromMediaHeader:za},Lu=function(d){var h=d[1]&31;return h<<=8,h|=d[2],h},En=function(d){return!!(d[1]&64)},Cn=function(d){var h=0;return(d[3]&48)>>>4>1&&(h+=d[4]+1),h},Np=function(d,h){var f=Lu(d);return f===0?"pat":f===h?"pmt":h?"pes":null},Fp=function(d){var h=En(d),f=4+Cn(d);return h&&(f+=d[f]+1),(d[f+10]&31)<<8|d[f+11]},Up=function(d){var h={},f=En(d),m=4+Cn(d);if(f&&(m+=d[m]+1),!!(d[m+5]&1)){var v,_,E;v=(d[m+1]&15)<<8|d[m+2],_=3+v-4,E=(d[m+10]&15)<<8|d[m+11];for(var C=12+E;C<_;){var k=m+C;h[(d[k+1]&31)<<8|d[k+2]]=d[k],C+=((d[k+3]&15)<<8|d[k+4])+5}return h}},Bp=function(d,h){var f=Lu(d),m=h[f];switch(m){case Le.H264_STREAM_TYPE:return"video";case Le.ADTS_STREAM_TYPE:return"audio";case Le.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},Hp=function(d){var h=En(d);if(!h)return null;var f=4+Cn(d);if(f>=d.byteLength)return null;var m=null,v;return v=d[f+7],v&192&&(m={},m.pts=(d[f+9]&14)<<27|(d[f+10]&255)<<20|(d[f+11]&254)<<12|(d[f+12]&255)<<5|(d[f+13]&254)>>>3,m.pts*=4,m.pts+=(d[f+13]&6)>>>1,m.dts=m.pts,v&64&&(m.dts=(d[f+14]&14)<<27|(d[f+15]&255)<<20|(d[f+16]&254)<<12|(d[f+17]&255)<<5|(d[f+18]&254)>>>3,m.dts*=4,m.dts+=(d[f+18]&6)>>>1)),m},$a=function(d){switch(d){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Vp=function(d){for(var h=4+Cn(d),f=d.subarray(h),m=0,v=0,_=!1,E;v3&&(E=$a(f[v+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0)),_},jp={parseType:Np,parsePat:Fp,parsePmt:Up,parsePayloadUnitStartIndicator:En,parsePesType:Bp,parsePesTime:Hp,videoPacketContainsKeyFrame:Vp},Pi=du.handleRollover,fe={};fe.ts=jp,fe.aac=yn;var oi=le.ONE_SECOND_IN_TS,Ve=188,_t=71,Wp=function(d,h){for(var f=0,m=Ve,v,_;m=0;){if(d[m]===_t&&(d[v]===_t||v===d.byteLength)){switch(_=d.subarray(m,v),E=fe.ts.parseType(_,h.pid),E){case"pes":C=fe.ts.parsePesType(_,h.table),k=fe.ts.parsePayloadUnitStartIndicator(_),C==="audio"&&k&&(P=fe.ts.parsePesTime(_),P&&(P.type="audio",f.audio.push(P),I=!0));break}if(I)break;m-=Ve,v-=Ve;continue}m--,v--}},qp=function(d,h,f){for(var m=0,v=Ve,_,E,C,k,P,I,N,z,Y=!1,q={data:[],size:0};v=0;){if(d[m]===_t&&d[v]===_t){switch(_=d.subarray(m,v),E=fe.ts.parseType(_,h.pid),E){case"pes":C=fe.ts.parsePesType(_,h.table),k=fe.ts.parsePayloadUnitStartIndicator(_),C==="video"&&k&&(P=fe.ts.parsePesTime(_),P&&(P.type="video",f.video.push(P),Y=!0));break}if(Y)break;m-=Ve,v-=Ve;continue}m--,v--}},Gp=function(d,h){if(d.audio&&d.audio.length){var f=h;(typeof f=="undefined"||isNaN(f))&&(f=d.audio[0].dts),d.audio.forEach(function(_){_.dts=Pi(_.dts,f),_.pts=Pi(_.pts,f),_.dtsTime=_.dts/oi,_.ptsTime=_.pts/oi})}if(d.video&&d.video.length){var m=h;if((typeof m=="undefined"||isNaN(m))&&(m=d.video[0].dts),d.video.forEach(function(_){_.dts=Pi(_.dts,m),_.pts=Pi(_.pts,m),_.dtsTime=_.dts/oi,_.ptsTime=_.pts/oi}),d.firstKeyFrame){var v=d.firstKeyFrame;v.dts=Pi(v.dts,m),v.pts=Pi(v.pts,m),v.dtsTime=v.dts/oi,v.ptsTime=v.pts/oi}}},zp=function(d){for(var h=!1,f=0,m=null,v=null,_=0,E=0,C;d.length-E>=3;){var k=fe.aac.parseType(d,E);switch(k){case"timed-metadata":if(d.length-E<10){h=!0;break}if(_=fe.aac.parseId3TagSize(d,E),_>d.length){h=!0;break}v===null&&(C=d.subarray(E,E+_),v=fe.aac.parseAacTimestamp(C)),E+=_;break;case"audio":if(d.length-E<7){h=!0;break}if(_=fe.aac.parseAdtsSize(d,E),_>d.length){h=!0;break}m===null&&(C=d.subarray(E,E+_),m=fe.aac.parseSampleRate(C)),f++,E+=_;break;default:E++;break}if(h)return null}if(m===null||v===null)return null;var P=oi/m,I={audio:[{type:"audio",dts:v,pts:v},{type:"audio",dts:v+f*1024*P,pts:v+f*1024*P}]};return I},$p=function(d){var h={pid:null,table:null},f={};Wp(d,h);for(var m in h.table)if(h.table.hasOwnProperty(m)){var v=h.table[m];switch(v){case Le.H264_STREAM_TYPE:f.video=[],qp(d,h,f),f.video.length===0&&delete f.video;break;case Le.ADTS_STREAM_TYPE:f.audio=[],Mu(d,h,f),f.audio.length===0&&delete f.audio;break}}return f},Kp=function(d,h){var f=fe.aac.isLikelyAacData(d),m;return f?m=zp(d):m=$p(d),!m||!m.audio&&!m.video?null:(Gp(m,h),m)},Xp={inspect:Kp,parseAudioPes_:Mu},Yp=function(d,h){h.on("data",function(f){var m=f.initSegment;f.initSegment={data:m.buffer,byteOffset:m.byteOffset,byteLength:m.byteLength};var v=f.data;f.data=v.buffer,d.postMessage({action:"data",segment:f,byteOffset:v.byteOffset,byteLength:v.byteLength},[f.data])}),h.on("done",function(f){d.postMessage({action:"done"})}),h.on("gopInfo",function(f){d.postMessage({action:"gopInfo",gopInfo:f})}),h.on("videoSegmentTimingInfo",function(f){var m={start:{decode:le.videoTsToSeconds(f.start.dts),presentation:le.videoTsToSeconds(f.start.pts)},end:{decode:le.videoTsToSeconds(f.end.dts),presentation:le.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:le.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(m.prependedContentDuration=le.videoTsToSeconds(f.prependedContentDuration)),d.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:m})}),h.on("audioSegmentTimingInfo",function(f){var m={start:{decode:le.videoTsToSeconds(f.start.dts),presentation:le.videoTsToSeconds(f.start.pts)},end:{decode:le.videoTsToSeconds(f.end.dts),presentation:le.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:le.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(m.prependedContentDuration=le.videoTsToSeconds(f.prependedContentDuration)),d.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:m})}),h.on("id3Frame",function(f){d.postMessage({action:"id3Frame",id3Frame:f})}),h.on("caption",function(f){d.postMessage({action:"caption",caption:f})}),h.on("trackinfo",function(f){d.postMessage({action:"trackinfo",trackInfo:f})}),h.on("audioTimingInfo",function(f){d.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:le.videoTsToSeconds(f.start),end:le.videoTsToSeconds(f.end)}})}),h.on("videoTimingInfo",function(f){d.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:le.videoTsToSeconds(f.start),end:le.videoTsToSeconds(f.end)}})}),h.on("log",function(f){d.postMessage({action:"log",log:f})})},Ru=function(){function T(h,f){this.options=f||{},this.self=h,this.init()}var d=T.prototype;return d.init=function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new pp.Transmuxer(this.options),Yp(this.self,this.transmuxer)},d.pushMp4Captions=function(f){this.captionParser||(this.captionParser=new Mp,this.captionParser.init());var m=new Uint8Array(f.data,f.byteOffset,f.byteLength),v=this.captionParser.parse(m,f.trackIds,f.timescales);this.self.postMessage({action:"mp4Captions",captions:v&&v.captions||[],logs:v&&v.logs||[],data:m.buffer},[m.buffer])},d.probeMp4StartTime=function(f){var m=f.timescales,v=f.data,_=Ou.startTime(m,v);this.self.postMessage({action:"probeMp4StartTime",startTime:_,data:v},[v.buffer])},d.probeMp4Tracks=function(f){var m=f.data,v=Ou.tracks(m);this.self.postMessage({action:"probeMp4Tracks",tracks:v,data:m},[m.buffer])},d.probeTs=function(f){var m=f.data,v=f.baseStartTime,_=typeof v=="number"&&!isNaN(v)?v*le.ONE_SECOND_IN_TS:void 0,E=Xp.inspect(m,_),C=null;E&&(C={hasVideo:E.video&&E.video.length===2||!1,hasAudio:E.audio&&E.audio.length===2||!1},C.hasVideo&&(C.videoStart=E.video[0].ptsTime),C.hasAudio&&(C.audioStart=E.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:C,data:m},[m.buffer])},d.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},d.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},d.push=function(f){var m=new Uint8Array(f.data,f.byteOffset,f.byteLength);this.transmuxer.push(m)},d.reset=function(){this.transmuxer.reset()},d.setTimestampOffset=function(f){var m=f.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(le.secondsToVideoTs(m)))},d.setAudioAppendStart=function(f){this.transmuxer.setAudioAppendStart(Math.ceil(le.secondsToVideoTs(f.appendStart)))},d.setRemux=function(f){this.transmuxer.setRemux(f.remux)},d.flush=function(f){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})},d.endTimeline=function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})},d.alignGopsWith=function(f){this.transmuxer.alignGopsWith(f.gopsToAlignWith.slice())},T}();self.onmessage=function(T){if(T.data.action==="init"&&T.data.options){this.messageHandlers=new Ru(self,T.data.options);return}this.messageHandlers||(this.messageHandlers=new Ru(self)),T.data&&T.data.action&&T.data.action!=="init"&&this.messageHandlers[T.data.action]&&this.messageHandlers[T.data.action](T.data)}})),Cy=Uf(Ey),wy=function(t,i,n){var e=t.data.segment,r=e.type,s=e.initSegment,o=e.captions,u=e.captionStreams,l=e.metadata,c=e.videoFrameDtsTime,g=e.videoFramePtsTime;i.buffer.push({captions:o,captionStreams:u,metadata:l});var p=t.data.segment.boxes||{data:t.data.segment.data},y={type:r,data:new Uint8Array(p.data,p.data.byteOffset,p.data.byteLength),initSegment:new Uint8Array(s.data,s.byteOffset,s.byteLength)};typeof c!="undefined"&&(y.videoFrameDtsTime=c),typeof g!="undefined"&&(y.videoFramePtsTime=g),n(y)},Py=function(t){var i=t.transmuxedData,n=t.callback;i.buffer=[],n(i)},ky=function(t,i){i.gopInfo=t.data.gopInfo},Vf=function(t){var i=t.transmuxer,n=t.bytes,e=t.audioAppendStart,r=t.gopsToAlignWith,s=t.remux,o=t.onData,u=t.onTrackInfo,l=t.onAudioTimingInfo,c=t.onVideoTimingInfo,g=t.onVideoSegmentTimingInfo,p=t.onAudioSegmentTimingInfo,y=t.onId3,b=t.onCaptions,S=t.onDone,x=t.onEndedTimeline,A=t.onTransmuxerLog,O=t.isEndOfTimeline,H={buffer:[]},L=O,M=function(W){i.currentTransmux===t&&(W.data.action==="data"&&wy(W,H,o),W.data.action==="trackinfo"&&u(W.data.trackInfo),W.data.action==="gopInfo"&&ky(W,H),W.data.action==="audioTimingInfo"&&l(W.data.audioTimingInfo),W.data.action==="videoTimingInfo"&&c(W.data.videoTimingInfo),W.data.action==="videoSegmentTimingInfo"&&g(W.data.videoSegmentTimingInfo),W.data.action==="audioSegmentTimingInfo"&&p(W.data.audioSegmentTimingInfo),W.data.action==="id3Frame"&&y([W.data.id3Frame],W.data.id3Frame.dispatchType),W.data.action==="caption"&&b(W.data.caption),W.data.action==="endedtimeline"&&(L=!1,x()),W.data.action==="log"&&A(W.data.log),W.data.type==="transmuxed"&&(L||(i.onmessage=null,Py({transmuxedData:H,callback:S}),jf(i))))};if(i.onmessage=M,e&&i.postMessage({action:"setAudioAppendStart",appendStart:e}),Array.isArray(r)&&i.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),typeof s!="undefined"&&i.postMessage({action:"setRemux",remux:s}),n.byteLength){var j=n instanceof ArrayBuffer?n:n.buffer,U=n instanceof ArrayBuffer?0:n.byteOffset;i.postMessage({action:"push",data:j,byteOffset:U,byteLength:n.byteLength},[j])}O&&i.postMessage({action:"endTimeline"}),i.postMessage({action:"flush"})},jf=function(t){t.currentTransmux=null,t.transmuxQueue.length&&(t.currentTransmux=t.transmuxQueue.shift(),typeof t.currentTransmux=="function"?t.currentTransmux():Vf(t.currentTransmux))},Wf=function(t,i){t.postMessage({action:i}),jf(t)},qf=function(t,i){if(!i.currentTransmux){i.currentTransmux=t,Wf(i,t);return}i.transmuxQueue.push(Wf.bind(null,i,t))},Ay=function(t){qf("reset",t)},Iy=function(t){qf("endTimeline",t)},Gf=function(t){if(!t.transmuxer.currentTransmux){t.transmuxer.currentTransmux=t,Vf(t);return}t.transmuxer.transmuxQueue.push(t)},Dy=function(t){var i=new Cy;i.currentTransmux=null,i.transmuxQueue=[];var n=i.terminate;return i.terminate=function(){return i.currentTransmux=null,i.transmuxQueue.length=0,n.call(i)},i.postMessage({action:"init",options:t}),i},Ko={reset:Ay,endTimeline:Iy,transmux:Gf,createTransmuxer:Dy},wa=function(t){var i=t.transmuxer,n=t.endAction||t.action,e=t.callback,r=dt({},t,{endAction:null,transmuxer:null,callback:null}),s=function l(c){c.data.action===n&&(i.removeEventListener("message",l),c.data.data&&(c.data.data=new Uint8Array(c.data.data,t.byteOffset||0,t.byteLength||c.data.data.byteLength),t.data&&(t.data=c.data.data)),e(c.data))};if(i.addEventListener("message",s),t.data){var o=t.data instanceof ArrayBuffer;r.byteOffset=o?0:t.data.byteOffset,r.byteLength=t.data.byteLength;var u=[o?t.data:t.data.buffer];i.postMessage(r,u)}else i.postMessage(r)},Pt={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Xo=function(t){t.forEach(function(i){i.abort()})},Oy=function(t){return{bandwidth:t.bandwidth,bytesReceived:t.bytesReceived||0,roundTripTime:t.roundTripTime||0}},Ly=function(t){var i=t.target,n=Date.now()-i.requestTime,e={bandwidth:1/0,bytesReceived:0,roundTripTime:n||0};return e.bytesReceived=t.loaded,e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3),e},Yo=function(t,i){return i.timedout?{status:i.status,message:"HLS request timed-out at URL: "+i.uri,code:Pt.TIMEOUT,xhr:i}:i.aborted?{status:i.status,message:"HLS request aborted at URL: "+i.uri,code:Pt.ABORTED,xhr:i}:t?{status:i.status,message:"HLS request errored at URL: "+i.uri,code:Pt.FAILURE,xhr:i}:i.responseType==="arraybuffer"&&i.response.byteLength===0?{status:i.status,message:"Empty HLS response at URL: "+i.uri,code:Pt.FAILURE,xhr:i}:null},zf=function(t,i,n){return function(e,r){var s=r.response,o=Yo(e,r);if(o)return n(o,t);if(s.byteLength!==16)return n({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Pt.FAILURE,xhr:r},t);for(var u=new DataView(s),l=new Uint32Array([u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12)]),c=0;c1){jy("multiple "+n+" codecs found as attributes: "+i[n].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),i[n]=null;return}i[n]=i[n][0]}),i},Qf=function(t){var i=0;return t.audio&&i++,t.video&&i++,i},tn=function(t,i){var n=i.attributes||{},e=Pa(Wy(i)||[]);if(Yf(t,i)&&!e.audio&&!qy(t,i)){var r=Pa(hg(t,n.AUDIO)||[]);r.audio&&(e.audio=r.audio)}return e},ka=gt("PlaylistSelector"),Jf=function(t){if(!(!t||!t.playlist)){var i=t.playlist;return JSON.stringify({id:i.id,bandwidth:t.bandwidth,width:t.width,height:t.height,codecs:i.attributes&&i.attributes.CODECS||""})}},Aa=function(t,i){if(!t)return"";var n=w.getComputedStyle(t);return n?n[i]:""},or=function(t,i){var n=t.slice();t.sort(function(e,r){var s=i(e,r);return s===0?n.indexOf(e)-n.indexOf(r):s})},Qo=function(t,i){var n,e;return t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),n=n||w.Number.MAX_VALUE,i.attributes.BANDWIDTH&&(e=i.attributes.BANDWIDTH),e=e||w.Number.MAX_VALUE,n-e},Gy=function(t,i){var n,e;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),n=n||w.Number.MAX_VALUE,i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(e=i.attributes.RESOLUTION.width),e=e||w.Number.MAX_VALUE,n===e&&t.attributes.BANDWIDTH&&i.attributes.BANDWIDTH?t.attributes.BANDWIDTH-i.attributes.BANDWIDTH:n-e},Zf=function(t,i,n,e,r,s){if(!!t){var o={bandwidth:i,width:n,height:e,limitRenditionByPlayerDimensions:r},u=t.playlists;et.isAudioOnly(t)&&(u=s.getAudioTrackPlaylists_(),o.audioOnly=!0);var l=u.map(function(R){var Q,B=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.width,K=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.height;return Q=R.attributes&&R.attributes.BANDWIDTH,Q=Q||w.Number.MAX_VALUE,{bandwidth:Q,width:B,height:K,playlist:R}});or(l,function(R,Q){return R.bandwidth-Q.bandwidth}),l=l.filter(function(R){return!et.isIncompatible(R.playlist)});var c=l.filter(function(R){return et.isEnabled(R.playlist)});c.length||(c=l.filter(function(R){return!et.isDisabled(R.playlist)}));var g=c.filter(function(R){return R.bandwidth*Oe.BANDWIDTH_VARIANCEn||R.height>e}),L=H.filter(function(R){return R.width===H[0].width&&R.height===H[0].height}),p=L[L.length-1],M=L.filter(function(R){return R.bandwidth===p.bandwidth})[0]);var j;if(s.experimentalLeastPixelDiffSelector){var U=x.map(function(R){return R.pixelDiff=Math.abs(R.width-n)+Math.abs(R.height-e),R});or(U,function(R,Q){return R.pixelDiff===Q.pixelDiff?Q.bandwidth-R.bandwidth:R.pixelDiff-Q.pixelDiff}),j=U[0]}var F=j||M||O||y||c[0]||l[0];if(F&&F.playlist){var W="sortedPlaylistReps";return j?W="leastPixelDiffRep":M?W="resolutionPlusOneRep":O?W="resolutionBestRep":y?W="bandwidthBestRep":c[0]&&(W="enabledPlaylistReps"),ka("choosing "+Jf(F)+" using "+W+" with options",o),F.playlist}return ka("could not choose a playlist with options",o),null}},eh=function(){var t=this.useDevicePixelRatio&&w.devicePixelRatio||1;return Zf(this.playlists.master,this.systemBandwidth,parseInt(Aa(this.tech_.el(),"width"),10)*t,parseInt(Aa(this.tech_.el(),"height"),10)*t,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},zy=function(t){var i=-1,n=-1;if(t<0||t>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var e=this.useDevicePixelRatio&&w.devicePixelRatio||1;return i<0&&(i=this.systemBandwidth,n=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==n&&(i=t*this.systemBandwidth+(1-t)*i,n=this.systemBandwidth),Zf(this.playlists.master,i,parseInt(Aa(this.tech_.el(),"width"),10)*e,parseInt(Aa(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},$y=function(t){var i=t.master,n=t.currentTime,e=t.bandwidth,r=t.duration,s=t.segmentDuration,o=t.timeUntilRebuffer,u=t.currentTimeline,l=t.syncController,c=i.playlists.filter(function(S){return!et.isIncompatible(S)}),g=c.filter(et.isEnabled);g.length||(g=c.filter(function(S){return!et.isDisabled(S)}));var p=g.filter(et.hasAttribute.bind(null,"BANDWIDTH")),y=p.map(function(S){var x=l.getSyncPoint(S,r,u,n),A=x?1:2,O=et.estimateSegmentRequestTime(s,e,S),H=O*A-o;return{playlist:S,rebufferingImpact:H}}),b=y.filter(function(S){return S.rebufferingImpact<=0});return or(b,function(S,x){return Qo(x.playlist,S.playlist)}),b.length?b[0]:(or(y,function(S,x){return S.rebufferingImpact-x.rebufferingImpact}),y[0]||null)},Ky=function(){var t=this,i=this.playlists.master.playlists.filter(et.isEnabled);or(i,function(e,r){return Qo(e,r)});var n=i.filter(function(e){return!!tn(t.playlists.master,e).video});return n[0]||null},Xy=function(t){var i=0,n;return t.bytes&&(n=new Uint8Array(t.bytes),t.segments.forEach(function(e){n.set(e,i),i+=e.byteLength})),n},Yy=function(t,i,n){if(!t[n]){i.trigger({type:"usage",name:"vhs-608"}),i.trigger({type:"usage",name:"hls-608"});var e=n;/^cc708_/.test(n)&&(e="SERVICE"+n.split("_")[1]);var r=i.textTracks().getTrackById(e);if(r)t[n]=r;else{var s=i.options_.vhs&&i.options_.vhs.captionServices||{},o=n,u=n,l=!1,c=s[e];c&&(o=c.label,u=c.language,l=c.default),t[n]=i.addRemoteTextTrack({kind:"captions",id:e,default:l,label:o,language:u},!1).track}}},Qy=function(t){var i=t.inbandTextTracks,n=t.captionArray,e=t.timestampOffset;if(!!n){var r=w.WebKitDataCue||w.VTTCue;n.forEach(function(s){var o=s.stream;i[o].addCue(new r(s.startTime+e,s.endTime+e,s.text))})}},Jy=function(t){Object.defineProperties(t.frame,{id:{get:function(){return D.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get:function(){return D.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get:function(){return D.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}})},Zy=function(t){var i=t.inbandTextTracks,n=t.metadataArray,e=t.timestampOffset,r=t.videoDuration;if(!!n){var s=w.WebKitDataCue||w.VTTCue,o=i.metadataTrack_;if(!!o&&(n.forEach(function(y){var b=y.cueTime+e;typeof b!="number"||w.isNaN(b)||b<0||!(b<1/0)||y.frames.forEach(function(S){var x=new s(b,b,S.value||S.url||S.data||"");x.frame=S,x.value=S,Jy(x),o.addCue(x)})}),!(!o.cues||!o.cues.length))){for(var u=o.cues,l=[],c=0;c=t&&r.endTime<=i&&n.removeCue(r)},tT=function(t){var i=t.cues;if(!!i)for(var n=0;n1&&e.push(i[s]));e.length&&e.forEach(function(o){return t.removeCue(o)})}},iT=function(t,i,n){if(typeof i=="undefined"||i===null||!t.length)return[];var e=Math.ceil((i-n+3)*zn.ONE_SECOND_IN_TS),r;for(r=0;re);r++);return t.slice(r)},rT=function(t,i,n){if(!i.length)return t;if(n)return i.slice();var e=i[0].pts,r=0;for(r;r=e);r++);return t.slice(0,r).concat(i)},nT=function(t,i,n,e){for(var r=Math.ceil((i-e)*zn.ONE_SECOND_IN_TS),s=Math.ceil((n-e)*zn.ONE_SECOND_IN_TS),o=t.slice(),u=t.length;u--&&!(t[u].pts<=s););if(u===-1)return o;for(var l=u+1;l--&&!(t[l].pts<=r););return l=Math.max(l,0),o.splice(l,u-l+1),o},aT=function(t,i){if(!t&&!i||!t&&i||t&&!i)return!1;if(t===i)return!0;var n=Object.keys(t).sort(),e=Object.keys(i).sort();if(n.length!==e.length)return!1;for(var r=0;rn))return s}return e.length===0?0:e[e.length-1]},nn=1,oT=500,ih=function(t){return typeof t=="number"&&isFinite(t)},Ia=1/60,uT=function(t,i,n){return t!=="main"||!i||!n?null:!n.hasAudio&&!n.hasVideo?"Neither audio nor video found in segment.":i.hasVideo&&!n.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!i.hasVideo&&n.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null},lT=function(t,i,n){var e=i-Oe.BACK_BUFFER_LENGTH;t.length&&(e=Math.max(e,t.start(0)));var r=i-n;return Math.min(r,e)},ur=function(t){var i=t.startOfSegment,n=t.duration,e=t.segment,r=t.part,s=t.playlist,o=s.mediaSequence,u=s.id,l=s.segments,c=l===void 0?[]:l,g=t.mediaIndex,p=t.partIndex,y=t.timeline,b=c.length-1,S="mediaIndex/partIndex increment";t.getMediaInfoForTime?S="getMediaInfoForTime ("+t.getMediaInfoForTime+")":t.isSyncRequest&&(S="getSyncSegmentCandidate (isSyncRequest)"),t.independent&&(S+=" with independent "+t.independent);var x=typeof p=="number",A=t.segment.uri?"segment":"pre-segment",O=x?mf({preloadSegment:e})-1:0;return A+" ["+(o+g)+"/"+(o+b)+"]"+(x?" part ["+p+"/"+O+"]":"")+(" segment start/end ["+e.start+" => "+e.end+"]")+(x?" part start/end ["+r.start+" => "+r.end+"]":"")+(" startOfSegment ["+i+"]")+(" duration ["+n+"]")+(" timeline ["+y+"]")+(" selected by ["+S+"]")+(" playlist ["+u+"]")},rh=function(t){return t+"TimingInfo"},dT=function(t){var i=t.segmentTimeline,n=t.currentTimeline,e=t.startOfSegment,r=t.buffered,s=t.overrideCheck;return!s&&i===n?null:ii&&(i=o)}}),typeof i=="bigint"&&in+ii:!1},fT=function(t,i){if(i!=="hls")return null;var n=cT({audioTimingInfo:t.audioTimingInfo,videoTimingInfo:t.videoTimingInfo});if(!n)return null;var e=t.playlist.targetDuration,r=ah({segmentDuration:n,maxDuration:e*2}),s=ah({segmentDuration:n,maxDuration:e}),o="Segment with index "+t.mediaIndex+" "+("from playlist "+t.playlist.id+" ")+("has a duration of "+n+" ")+("when the reported duration is "+t.duration+" ")+("and the target duration is "+e+". ")+"For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";return r||s?{severity:r?"warn":"info",message:o}:null},Jo=function(a){$(t,a);function t(n,e){var r;if(r=a.call(this)||this,!n)throw new TypeError("Initialization settings are required");if(typeof n.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!n.mediaSource)throw new TypeError("No MediaSource specified");return r.bandwidth=n.bandwidth,r.throughput={rate:0,count:0},r.roundTrip=NaN,r.resetStats_(),r.mediaIndex=null,r.partIndex=null,r.hasPlayed_=n.hasPlayed,r.currentTime_=n.currentTime,r.seekable_=n.seekable,r.seeking_=n.seeking,r.duration_=n.duration,r.mediaSource_=n.mediaSource,r.vhs_=n.vhs,r.loaderType_=n.loaderType,r.currentMediaInfo_=void 0,r.startingMediaInfo_=void 0,r.segmentMetadataTrack_=n.segmentMetadataTrack,r.goalBufferLength_=n.goalBufferLength,r.sourceType_=n.sourceType,r.sourceUpdater_=n.sourceUpdater,r.inbandTextTracks_=n.inbandTextTracks,r.state_="INIT",r.timelineChangeController_=n.timelineChangeController,r.shouldSaveSegmentTimingInfo_=!0,r.parse708captions_=n.parse708captions,r.useDtsForTimestampOffset_=n.useDtsForTimestampOffset,r.captionServices_=n.captionServices,r.experimentalExactManifestTimings=n.experimentalExactManifestTimings,r.checkBufferTimeout_=null,r.error_=void 0,r.currentTimeline_=-1,r.pendingSegment_=null,r.xhrOptions_=null,r.pendingSegments_=[],r.audioDisabled_=!1,r.isPendingTimestampOffset_=!1,r.gopBuffer_=[],r.timeMapping_=0,r.safeAppend_=D.browser.IE_VERSION>=11,r.appendInitSegment_={audio:!0,video:!0},r.playlistOfLastInitSegment_={audio:null,video:null},r.callQueue_=[],r.loadQueue_=[],r.metadataQueue_={id3:[],caption:[]},r.waitingOnRemove_=!1,r.quotaExceededErrorRetryTimeout_=null,r.activeInitSegmentId_=null,r.initSegments_={},r.cacheEncryptionKeys_=n.cacheEncryptionKeys,r.keyCache_={},r.decrypter_=n.decrypter,r.syncController_=n.syncController,r.syncPoint_={segmentIndex:0,time:0},r.transmuxer_=r.createTransmuxer_(),r.triggerSyncInfoUpdate_=function(){return r.trigger("syncinfoupdate")},r.syncController_.on("syncinfoupdate",r.triggerSyncInfoUpdate_),r.mediaSource_.addEventListener("sourceopen",function(){r.isEndOfStream_()||(r.ended_=!1)}),r.fetchAtBuffer_=!1,r.logger_=gt("SegmentLoader["+r.loaderType_+"]"),Object.defineProperty(ie(r),"state",{get:function(){return this.state_},set:function(o){o!==this.state_&&(this.logger_(this.state_+" -> "+o),this.state_=o,this.trigger("statechange"))}}),r.sourceUpdater_.on("ready",function(){r.hasEnoughInfoToAppend_()&&r.processCallQueue_()}),r.loaderType_==="main"&&r.timelineChangeController_.on("pendingtimelinechange",function(){r.hasEnoughInfoToAppend_()&&r.processCallQueue_()}),r.loaderType_==="audio"&&r.timelineChangeController_.on("timelinechange",function(){r.hasEnoughInfoToLoad_()&&r.processLoadQueue_(),r.hasEnoughInfoToAppend_()&&r.processCallQueue_()}),r}var i=t.prototype;return i.createTransmuxer_=function(){return Ko.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},i.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},i.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&w.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},i.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},i.abort=function(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()},i.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,w.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},i.checkForAbort_=function(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e},i.error=function(e){return typeof e!="undefined"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},i.endOfStream=function(){this.ended_=!0,this.transmuxer_&&Ko.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},i.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return D.createTimeRanges();if(this.loaderType_==="main"){var r=e.hasAudio,s=e.hasVideo,o=e.isMuxed;if(s&&r&&!this.audioDisabled_&&!o)return this.sourceUpdater_.buffered();if(s)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},i.initSegmentForMap=function(e,r){if(r===void 0&&(r=!1),!e)return null;var s=Ca(e),o=this.initSegments_[s];return r&&!o&&e.bytes&&(this.initSegments_[s]=o={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),o||e},i.segmentKey=function(e,r){if(r===void 0&&(r=!1),!e)return null;var s=Df(e),o=this.keyCache_[s];this.cacheEncryptionKeys_&&r&&!o&&e.bytes&&(this.keyCache_[s]=o={resolvedUri:e.resolvedUri,bytes:e.bytes});var u={resolvedUri:(o||e).resolvedUri};return o&&(u.bytes=o.bytes),u},i.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},i.load=function(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.playlist=function(e,r){if(r===void 0&&(r={}),!!e){var s=this.playlist_,o=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=r,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));var u=null;if(s&&(s.id?u=s.id:s.uri&&(u=s.uri)),this.logger_("playlist update ["+u+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!s||s.uri!==e.uri){this.mediaIndex!==null&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}var l=e.mediaSequence-s.mediaSequence;if(this.logger_("live window shift ["+l+"]"),this.mediaIndex!==null)if(this.mediaIndex-=l,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var c=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!c.parts||!c.parts.length||!c.parts[this.partIndex])){var g=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=g}}o&&(o.mediaIndex-=l,o.mediaIndex<0?(o.mediaIndex=null,o.partIndex=null):(o.mediaIndex>=0&&(o.segment=e.segments[o.mediaIndex]),o.partIndex>=0&&o.segment.parts&&(o.part=o.segment.parts[o.partIndex]))),this.syncController_.saveExpiredSegmentInfo(s,e)}},i.pause=function(){this.checkBufferTimeout_&&(w.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},i.paused=function(){return this.checkBufferTimeout_===null},i.resetEverything=function(e){this.ended_=!1,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))},i.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},i.resyncLoader=function(){this.transmuxer_&&Ko.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},i.remove=function(e,r,s,o){if(s===void 0&&(s=function(){}),o===void 0&&(o=!1),r===1/0&&(r=this.duration_()),r<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}var u=1,l=function(){u--,u===0&&s()};(o||!this.audioDisabled_)&&(u++,this.sourceUpdater_.removeAudio(e,r,l)),(o||this.loaderType_==="main")&&(this.gopBuffer_=nT(this.gopBuffer_,e,r,this.timeMapping_),u++,this.sourceUpdater_.removeVideo(e,r,l));for(var c in this.inbandTextTracks_)rn(e,r,this.inbandTextTracks_[c]);rn(e,r,this.segmentMetadataTrack_),l()},i.monitorBuffer_=function(){this.checkBufferTimeout_&&w.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=w.setTimeout(this.monitorBufferTick_.bind(this),1)},i.monitorBufferTick_=function(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&w.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=w.setTimeout(this.monitorBufferTick_.bind(this),oT)},i.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();!e||(typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}},i.isEndOfStream_=function(e,r,s){if(e===void 0&&(e=this.mediaIndex),r===void 0&&(r=this.playlist_),s===void 0&&(s=this.partIndex),!r||!this.mediaSource_)return!1;var o=typeof e=="number"&&r.segments[e],u=e+1===r.segments.length,l=!o||!o.parts||s+1===o.parts.length;return r.endList&&this.mediaSource_.readyState==="open"&&u&&l},i.chooseNextRequest_=function(){var e=this.buffered_(),r=ff(e)||0,s=Ro(e,this.currentTime_()),o=!this.hasPlayed_()&&s>=1,u=s>=this.goalBufferLength_(),l=this.playlist_.segments;if(!l.length||o||u)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var c={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(c.isSyncRequest)c.mediaIndex=sT(this.currentTimeline_,l,r);else if(this.mediaIndex!==null){var g=l[this.mediaIndex],p=typeof this.partIndex=="number"?this.partIndex:-1;c.startOfSegment=g.end?g.end:r,g.parts&&g.parts[p+1]?(c.mediaIndex=this.mediaIndex,c.partIndex=p+1):c.mediaIndex=this.mediaIndex+1}else{var y=et.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?r:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),b=y.segmentIndex,S=y.startTime,x=y.partIndex;c.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+r:"currentTime "+this.currentTime_(),c.mediaIndex=b,c.startOfSegment=S,c.partIndex=x}var A=l[c.mediaIndex],O=A&&typeof c.partIndex=="number"&&A.parts&&A.parts[c.partIndex];if(!A||typeof c.partIndex=="number"&&!O)return null;if(typeof c.partIndex!="number"&&A.parts&&(c.partIndex=0,O=A.parts[0]),!s&&O&&!O.independent)if(c.partIndex===0){var H=l[c.mediaIndex-1],L=H.parts&&H.parts.length&&H.parts[H.parts.length-1];L&&L.independent&&(c.mediaIndex-=1,c.partIndex=H.parts.length-1,c.independent="previous segment")}else A.parts[c.partIndex-1].independent&&(c.partIndex-=1,c.independent="previous part");var M=this.mediaSource_&&this.mediaSource_.readyState==="ended";return c.mediaIndex>=l.length-1&&M&&!this.seeking_()?null:this.generateSegmentInfo_(c)},i.generateSegmentInfo_=function(e){var r=e.independent,s=e.playlist,o=e.mediaIndex,u=e.startOfSegment,l=e.isSyncRequest,c=e.partIndex,g=e.forceTimestampOffset,p=e.getMediaInfoForTime,y=s.segments[o],b=typeof c=="number"&&y.parts[c],S={requestId:"segment-loader-"+Math.random(),uri:b&&b.resolvedUri||y.resolvedUri,mediaIndex:o,partIndex:b?c:null,isSyncRequest:l,startOfSegment:u,playlist:s,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:y.timeline,duration:b&&b.duration||y.duration,segment:y,part:b,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:p,independent:r},x=typeof g!="undefined"?g:this.isPendingTimestampOffset_;S.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:y.timeline,currentTimeline:this.currentTimeline_,startOfSegment:u,buffered:this.buffered_(),overrideCheck:x});var A=ff(this.sourceUpdater_.audioBuffered());return typeof A=="number"&&(S.audioAppendStart=A-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(S.gopsToAlignWith=iT(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),S},i.timestampOffsetForSegment_=function(e){return dT(e)},i.earlyAbortWhenNeeded_=function(e){if(!(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)&&!(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)){var r=this.currentTime_(),s=e.bandwidth,o=this.pendingSegment_.duration,u=et.estimateSegmentRequestTime(o,s,this.playlist_,e.bytesReceived),l=N_(this.buffered_(),r,this.vhs_.tech_.playbackRate())-1;if(!(u<=l)){var c=$y({master:this.vhs_.playlists.master,currentTime:r,bandwidth:s,duration:this.duration_(),segmentDuration:o,timeUntilRebuffer:l,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!!c){var g=u-l,p=g-c.rebufferingImpact,y=.5;l<=ii&&(y=1),!(!c.playlist||c.playlist.uri===this.playlist_.uri||p "+y+" for "+c),Yy(S,s.vhs_.tech_,c),rn(p,y,S[c]),Qy({captionArray:b,inbandTextTracks:S,timestampOffset:u})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}},i.handleId3_=function(e,r,s){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){var o=this.pendingSegment_;if(!o.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,r,s));return}var u=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();eT(this.inbandTextTracks_,s,this.vhs_.tech_),Zy({inbandTextTracks:this.inbandTextTracks_,metadataArray:r,timestampOffset:u,videoDuration:this.duration_()})}},i.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach(function(e){return e()}),this.metadataQueue_.caption.forEach(function(e){return e()}),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},i.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach(function(r){return r()})},i.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(function(r){return r()})},i.hasEnoughInfoToLoad_=function(){if(this.loaderType_!=="audio")return!0;var e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!nh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1},i.getCurrentMediaInfo_=function(e){return e===void 0&&(e=this.pendingSegment_),e&&e.trackInfo||this.currentMediaInfo_},i.getMediaInfo_=function(e){return e===void 0&&(e=this.pendingSegment_),this.getCurrentMediaInfo_(e)||this.startingMediaInfo_},i.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,r=this.getCurrentMediaInfo_();if(!e||!r)return!1;var s=r.hasAudio,o=r.hasVideo,u=r.isMuxed;return!(o&&!e.videoTimingInfo||s&&!this.audioDisabled_&&!u&&!e.audioTimingInfo||nh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.handleData_=function(e,r){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){this.callQueue_.push(this.handleData_.bind(this,e,r));return}var s=this.pendingSegment_;if(this.setTimeMapping_(s.timeline),this.updateMediaSecondsLoaded_(s.part||s.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),s.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),s.isFmp4=e.isFmp4,s.timingInfo=s.timingInfo||{},s.isFmp4)this.trigger("fmp4"),s.timingInfo.start=s[rh(r.type)].start;else{var o=this.getCurrentMediaInfo_(),u=this.loaderType_==="main"&&o&&o.hasVideo,l;u&&(l=s.videoTimingInfo.start),s.timingInfo.start=this.trueSegmentStart_({currentStart:s.timingInfo.start,playlist:s.playlist,mediaIndex:s.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:u,firstVideoFrameTimeForData:l,videoTimingInfo:s.videoTimingInfo,audioTimingInfo:s.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(s,r.type),this.updateSourceBufferTimestampOffset_(s),s.isSyncRequest){this.updateTimingInfoEnd_(s),this.syncController_.saveSegmentTimingInfo({segmentInfo:s,shouldSaveTimelineMapping:this.loaderType_==="main"});var c=this.chooseNextRequest_();if(c.mediaIndex!==s.mediaIndex||c.partIndex!==s.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}s.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(s,r)}}},i.updateAppendInitSegmentStatus=function(e,r){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[r]!==e.playlist&&(this.appendInitSegment_[r]=!0)},i.getInitSegmentAndUpdateState_=function(e){var r=e.type,s=e.initSegment,o=e.map,u=e.playlist;if(o){var l=Ca(o);if(this.activeInitSegmentId_===l)return null;s=this.initSegmentForMap(o,!0).bytes,this.activeInitSegmentId_=l}return s&&this.appendInitSegment_[r]?(this.playlistOfLastInitSegment_[r]=u,this.appendInitSegment_[r]=!1,this.activeInitSegmentId_=null,s):null},i.handleQuotaExceededError_=function(e,r){var s=this,o=e.segmentInfo,u=e.type,l=e.bytes,c=this.sourceUpdater_.audioBuffered(),g=this.sourceUpdater_.videoBuffered();c.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+bi(c).join(", ")),g.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+bi(g).join(", "));var p=c.length?c.start(0):0,y=c.length?c.end(c.length-1):0,b=g.length?g.start(0):0,S=g.length?g.end(g.length-1):0;if(y-p<=nn&&S-b<=nn){this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. "+("Appended byte length: "+l.byteLength+", ")+("audio buffer: "+bi(c).join(", ")+", ")+("video buffer: "+bi(g).join(", ")+", ")),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:o,type:u,bytes:l}));var x=this.currentTime_(),A=x-nn;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+A),this.remove(0,A,function(){s.logger_("On QUOTA_EXCEEDED_ERR, retrying append in "+nn+"s"),s.waitingOnRemove_=!1,s.quotaExceededErrorRetryTimeout_=w.setTimeout(function(){s.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),s.quotaExceededErrorRetryTimeout_=null,s.processCallQueue_()},nn*1e3)},!0)},i.handleAppendError_=function(e,r){var s=e.segmentInfo,o=e.type,u=e.bytes;if(!!r){if(r.code===th){this.handleQuotaExceededError_({segmentInfo:s,type:o,bytes:u});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error(o+" append of "+u.length+"b failed for segment "+("#"+s.mediaIndex+" in playlist "+s.playlist.id)),this.trigger("appenderror")}},i.appendToSourceBuffer_=function(e){var r=e.segmentInfo,s=e.type,o=e.initSegment,u=e.data,l=e.bytes;if(!l){var c=[u],g=u.byteLength;o&&(c.unshift(o),g+=o.byteLength),l=Xy({bytes:g,segments:c})}this.sourceUpdater_.appendBuffer({segmentInfo:r,type:s,bytes:l},this.handleAppendError_.bind(this,{segmentInfo:r,type:s,bytes:l}))},i.handleSegmentTimingInfo_=function(e,r,s){if(!(!this.pendingSegment_||r!==this.pendingSegment_.requestId)){var o=this.pendingSegment_.segment,u=e+"TimingInfo";o[u]||(o[u]={}),o[u].transmuxerPrependedSeconds=s.prependedContentDuration||0,o[u].transmuxedPresentationStart=s.start.presentation,o[u].transmuxedDecodeStart=s.start.decode,o[u].transmuxedPresentationEnd=s.end.presentation,o[u].transmuxedDecodeEnd=s.end.decode,o[u].baseMediaDecodeTime=s.baseMediaDecodeTime}},i.appendData_=function(e,r){var s=r.type,o=r.data;if(!(!o||!o.byteLength)&&!(s==="audio"&&this.audioDisabled_)){var u=this.getInitSegmentAndUpdateState_({type:s,initSegment:r.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:s,initSegment:u,data:o})}},i.loadSegment_=function(e){var r=this;if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){this.loadQueue_.push(function(){var s=dt({},e,{forceTimestampOffset:!0});dt(e,r.generateSegmentInfo_(s)),r.isPendingTimestampOffset_=!1,r.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)},i.updateTransmuxerAndRequestSegment_=function(e){var r=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var s=this.createSimplifiedSegmentObj_(e),o=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),u=this.mediaIndex!==null,l=e.timeline!==this.currentTimeline_&&e.timeline>0,c=o||u&&l;this.logger_("Requesting "+ur(e)),s.map&&!s.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Vy({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:s,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:c,endedTimelineFn:function(){r.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(p){var y=p.message,b=p.level,S=p.stream;r.logger_(ur(e)+" logged from transmuxer stream "+S+" as a "+b+": "+y)}})},i.trimBackBuffer_=function(e){var r=lT(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);r>0&&this.remove(0,r)},i.createSimplifiedSegmentObj_=function(e){var r=e.segment,s=e.part,o={resolvedUri:s?s.resolvedUri:r.resolvedUri,byterange:s?s.byterange:r.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},u=e.playlist.segments[e.mediaIndex-1];if(u&&u.timeline===r.timeline&&(u.videoTimingInfo?o.baseStartTime=u.videoTimingInfo.transmuxedDecodeEnd:u.audioTimingInfo&&(o.baseStartTime=u.audioTimingInfo.transmuxedDecodeEnd)),r.key){var l=r.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);o.key=this.segmentKey(r.key),o.key.iv=l}return r.map&&(o.map=this.initSegmentForMap(r.map)),o},i.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},i.saveBandwidthRelatedStats_=function(e,r){if(this.pendingSegment_.byteLength=r.bytesReceived,ee.playlist.targetDuration*3,l=o&&o.end&&this.currentTime_()-o.end>e.playlist.partTargetDuration*3;if(u||l){this.logger_("bad "+(u?"segment":"part")+" "+ur(e)),this.resetEverything();return}var c=this.mediaIndex!==null;c&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()},i.recordThroughput_=function(e){if(e.duration=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e},i.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},i.segmentRequestFinished_=function(e,r,s){var o=this;if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(r.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Pt.TIMEOUT&&this.handleTimeout_(),e.code===Pt.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}var u=this.pendingSegment_;this.saveBandwidthRelatedStats_(u.duration,r.stats),r.key&&this.segmentKey(r.key,!0),this.state="APPENDING",this.trigger("appending");var l=u.segment;if(l.map&&(l.map.bytes=r.map.bytes),u.bytes=r.bytes,typeof w.WebVTT!="function"&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var c,g=function(){o.subtitlesTrack_.tech_.off("vttjsloaded",c),o.stopForError({message:"Error loading vtt.js"})};c=function(){o.subtitlesTrack_.tech_.off("vttjserror",g),o.segmentRequestFinished_(e,r,s)},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",c),this.subtitlesTrack_.tech_.one("vttjserror",g);return}l.requested=!0;try{this.parseVTTCues_(u)}catch(p){this.stopForError({message:p.message});return}if(this.updateTimeMapping_(u,this.syncController_.timelines[u.timeline],this.playlist_),u.cues.length?u.timingInfo={start:u.cues[0].startTime,end:u.cues[u.cues.length-1].endTime}:u.timingInfo={start:u.startOfSegment,end:u.startOfSegment+u.duration},u.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}u.byteLength=u.bytes.byteLength,this.mediaSecondsLoaded+=l.duration,u.cues.forEach(function(p){o.subtitlesTrack_.addCue(o.featuresNativeTextTracks_?new w.VTTCue(p.startTime,p.endTime,p.text):p)}),tT(this.subtitlesTrack_),this.handleAppendsDone_()},i.handleData_=function(){},i.updateTimingInfoEnd_=function(){},i.parseVTTCues_=function(e){var r,s=!1;typeof w.TextDecoder=="function"?r=new w.TextDecoder("utf8"):(r=w.WebVTT.StringDecoder(),s=!0);var o=new w.WebVTT.Parser(w,w.vttjs,r);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},o.oncue=e.cues.push.bind(e.cues),o.ontimestampmap=function(c){e.timestampmap=c},o.onparsingerror=function(c){D.log.warn("Error encountered when parsing cues: "+c.message)},e.segment.map){var u=e.segment.map.bytes;s&&(u=dh(u)),o.parse(u)}var l=e.bytes;s&&(l=dh(l)),o.parse(l),o.flush()},i.updateTimeMapping_=function(e,r,s){var o=e.segment;if(!!r){if(!e.cues.length){o.empty=!0;return}var u=e.timestampmap,l=u.MPEGTS/zn.ONE_SECOND_IN_TS-u.LOCAL+r.mapping;if(e.cues.forEach(function(p){p.startTime+=l,p.endTime+=l}),!s.syncInfo){var c=e.cues[0].startTime,g=e.cues[e.cues.length-1].startTime;s.syncInfo={mediaSequence:s.mediaSequence+e.mediaIndex,time:Math.min(c,g-o.duration)}}}},t}(Jo),gT=function(t,i){for(var n=t.cues,e=0;e=r.adStartTime&&i<=r.adEndTime)return r}return null},vT=function(t,i,n){if(n===void 0&&(n=0),!!t.segments)for(var e=n,r,s=0;s=b)&&(o=b,s={time:y,segmentIndex:g.segmentIndex,partIndex:g.partIndex})}}return s}},{name:"Discontinuity",run:function(t,i,n,e,r){var s=null;if(r=r||0,i.discontinuityStarts&&i.discontinuityStarts.length)for(var o=null,u=0;u=p)&&(o=p,s={time:g.time,segmentIndex:l,partIndex:null})}}return s}},{name:"Playlist",run:function(t,i,n,e,r){if(i.syncInfo){var s={time:i.syncInfo.time,segmentIndex:i.syncInfo.mediaSequence-i.mediaSequence,partIndex:null};return s}return null}}],yT=function(a){$(t,a);function t(n){var e;return e=a.call(this)||this,e.timelines=[],e.discontinuities=[],e.timelineToDatetimeMappings={},e.logger_=gt("SyncController"),e}var i=t.prototype;return i.getSyncPoint=function(e,r,s,o){var u=this.runStrategies_(e,r,s,o);return u.length?this.selectSyncPoint_(u,{key:"time",value:o}):null},i.getExpiredTime=function(e,r){if(!e||!e.segments)return null;var s=this.runStrategies_(e,r,e.discontinuitySequence,0);if(!s.length)return null;var o=this.selectSyncPoint_(s,{key:"segmentIndex",value:0});return o.segmentIndex>0&&(o.time*=-1),Math.abs(o.time+Jr({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:o.segmentIndex,endIndex:0}))},i.runStrategies_=function(e,r,s,o){for(var u=[],l=0;l_T){D.log.warn("Not saving expired segment info. Media sequence gap "+s+" is too large.");return}for(var o=s-1;o>=0;o--){var u=e.segments[o];if(u&&typeof u.start!="undefined"){r.syncInfo={mediaSequence:e.mediaSequence+o,time:u.start},this.logger_("playlist refresh sync: [time:"+r.syncInfo.time+","+(" mediaSequence: "+r.syncInfo.mediaSequence+"]")),this.trigger("syncinfoupdate");break}}},i.setDateTimeMappingForStart=function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var r=e.segments[0],s=r.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[r.timeline]=-s}},i.saveSegmentTimingInfo=function(e){var r=e.segmentInfo,s=e.shouldSaveTimelineMapping,o=this.calculateSegmentTimeMapping_(r,r.timingInfo,s),u=r.segment;o&&(this.saveDiscontinuitySyncInfo_(r),r.playlist.syncInfo||(r.playlist.syncInfo={mediaSequence:r.playlist.mediaSequence+r.mediaIndex,time:u.start}));var l=u.dateTimeObject;u.discontinuity&&s&&l&&(this.timelineToDatetimeMappings[u.timeline]=-(l.getTime()/1e3))},i.timestampOffsetForTimeline=function(e){return typeof this.timelines[e]=="undefined"?null:this.timelines[e].time},i.mappingForTimeline=function(e){return typeof this.timelines[e]=="undefined"?null:this.timelines[e].mapping},i.calculateSegmentTimeMapping_=function(e,r,s){var o=e.segment,u=e.part,l=this.timelines[e.timeline],c,g;if(typeof e.timestampOffset=="number")l={time:e.startOfSegment,mapping:e.startOfSegment-r.start},s&&(this.timelines[e.timeline]=l,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": "+("[time: "+l.time+"] [mapping: "+l.mapping+"]"))),c=e.startOfSegment,g=r.end+l.mapping;else if(l)c=r.start+l.mapping,g=r.end+l.mapping;else return!1;return u&&(u.start=c,u.end=g),(!o.start||cg){var p=void 0;c<0?p=s.start-Jr({defaultDuration:r.targetDuration,durationList:r.segments,startIndex:e.mediaIndex,endIndex:u}):p=s.end+Jr({defaultDuration:r.targetDuration,durationList:r.segments,startIndex:e.mediaIndex+1,endIndex:u}),this.discontinuities[l]={time:p,accuracy:g}}}},i.dispose=function(){this.trigger("dispose"),this.off()},t}(D.EventTarget),TT=function(a){$(t,a);function t(){var n;return n=a.call(this)||this,n.pendingTimelineChanges_={},n.lastTimelineChanges_={},n}var i=t.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var r=e.type,s=e.from,o=e.to;return typeof s=="number"&&typeof o=="number"&&(this.pendingTimelineChanges_[r]={type:r,from:s,to:o},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[r]},i.lastTimelineChange=function(e){var r=e.type,s=e.from,o=e.to;return typeof s=="number"&&typeof o=="number"&&(this.lastTimelineChanges_[r]={type:r,from:s,to:o},delete this.pendingTimelineChanges_[r],this.trigger("timelinechange")),this.lastTimelineChanges_[r]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(D.EventTarget),bT=Bf(Hf(function(){var a=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function t(L,M,j){return j={path:M,exports:{},require:function(F,W){return i(F,W==null?j.path:W)}},L(j,j.exports),j.exports}function i(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var n=t(function(L){function M(U,F){for(var W=0;W-1},M.trigger=function(U){var F=this.listeners[U];if(!!F)if(arguments.length===2)for(var W=F.length,R=0;R>7)*283)^R]=R;for(Q=B=0;!F[Q];Q^=ae||1,B=te[B]||1)for(de=B^B<<1^B<<2^B<<3^B<<4,de=de>>8^de&255^99,F[Q]=de,W[de]=Q,se=K[ee=K[ae=K[Q]]],ue=se*16843009^ee*65537^ae*257^Q*16843008,ke=K[de]*257^de*16843008,R=0;R<4;R++)j[R][Q]=ke=ke<<24^ke>>>8,U[R][de]=ue=ue<<24^ue>>>8;for(R=0;R<5;R++)j[R]=j[R].slice(0),U[R]=U[R].slice(0);return M},l=null,c=function(){function L(j){l||(l=u()),this._tables=[[l[0][0].slice(),l[0][1].slice(),l[0][2].slice(),l[0][3].slice(),l[0][4].slice()],[l[1][0].slice(),l[1][1].slice(),l[1][2].slice(),l[1][3].slice(),l[1][4].slice()]];var U,F,W,R=this._tables[0][4],Q=this._tables[1],B=j.length,K=1;if(B!==4&&B!==6&&B!==8)throw new Error("Invalid aes key size");var te=j.slice(0),ae=[];for(this._key=[te,ae],U=B;U<4*B+28;U++)W=te[U-1],(U%B==0||B===8&&U%B==4)&&(W=R[W>>>24]<<24^R[W>>16&255]<<16^R[W>>8&255]<<8^R[W&255],U%B==0&&(W=W<<8^W>>>24^K<<24,K=K<<1^(K>>7)*283)),te[U]=te[U-B]^W;for(F=0;U;F++,U--)W=te[F&3?U:U-4],U<=4||F<4?ae[F]=W:ae[F]=Q[0][R[W>>>24]]^Q[1][R[W>>16&255]]^Q[2][R[W>>8&255]]^Q[3][R[W&255]]}var M=L.prototype;return M.decrypt=function(U,F,W,R,Q,B){var K=this._key[1],te=U^K[0],ae=R^K[1],ee=W^K[2],se=F^K[3],de,ke,ue,He=K.length/4-2,Ne,At=4,Kt=this._tables[1],ri=Kt[0],vt=Kt[1],xi=Kt[2],Si=Kt[3],Ei=Kt[4];for(Ne=0;Ne>>24]^vt[ae>>16&255]^xi[ee>>8&255]^Si[se&255]^K[At],ke=ri[ae>>>24]^vt[ee>>16&255]^xi[se>>8&255]^Si[te&255]^K[At+1],ue=ri[ee>>>24]^vt[se>>16&255]^xi[te>>8&255]^Si[ae&255]^K[At+2],se=ri[se>>>24]^vt[te>>16&255]^xi[ae>>8&255]^Si[ee&255]^K[At+3],At+=4,te=de,ae=ke,ee=ue;for(Ne=0;Ne<4;Ne++)Q[(3&-Ne)+B]=Ei[te>>>24]<<24^Ei[ae>>16&255]<<16^Ei[ee>>8&255]<<8^Ei[se&255]^K[At++],de=te,te=ae,ae=ee,ee=se,se=de},L}(),g=function(L){r(M,L);function M(){var U;return U=L.call(this,s)||this,U.jobs=[],U.delay=1,U.timeout_=null,U}var j=M.prototype;return j.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},j.push=function(F){this.jobs.push(F),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},M}(s),p=function(M){return M<<24|(M&65280)<<8|(M&16711680)>>8|M>>>24},y=function(M,j,U){var F=new Int32Array(M.buffer,M.byteOffset,M.byteLength>>2),W=new c(Array.prototype.slice.call(j)),R=new Uint8Array(M.byteLength),Q=new Int32Array(R.buffer),B,K,te,ae,ee,se,de,ke,ue;for(B=U[0],K=U[1],te=U[2],ae=U[3],ue=0;ue=0&&(i="main-desc"),i},Da=function(t,i){t.abort(),t.pause(),i&&i.activePlaylistLoader&&(i.activePlaylistLoader.pause(),i.activePlaylistLoader=null)},tu=function(t,i){i.activePlaylistLoader=t,t.load()},ET=function(t,i){return function(){var n=i.segmentLoaders,e=n[t],r=n.main,s=i.mediaTypes[t],o=s.activeTrack(),u=s.getActiveGroup(),l=s.activePlaylistLoader,c=s.lastGroup_;if(!(u&&c&&u.id===c.id)&&(s.lastGroup_=u,s.lastTrack_=o,Da(e,s),!(!u||u.isMasterPlaylist))){if(!u.playlistLoader){l&&r.resetEverything();return}e.resyncLoader(),tu(u.playlistLoader,s)}}},CT=function(t,i){return function(){var n=i.segmentLoaders[t],e=i.mediaTypes[t];e.lastGroup_=null,n.abort(),n.pause()}},wT=function(t,i){return function(){var n=i.masterPlaylistLoader,e=i.segmentLoaders,r=e[t],s=e.main,o=i.mediaTypes[t],u=o.activeTrack(),l=o.getActiveGroup(),c=o.activePlaylistLoader,g=o.lastTrack_;if(!(g&&u&&g.id===u.id)&&(o.lastGroup_=l,o.lastTrack_=u,Da(r,o),!!l)){if(l.isMasterPlaylist){if(!u||!g||u.id===g.id)return;var p=i.vhs.masterPlaylistController_,y=p.selectPlaylist();if(p.media()===y)return;o.logger_("track change. Switching master audio from "+g.id+" to "+u.id),n.pause(),s.resetEverything(),p.fastQualityChange_(y);return}if(t==="AUDIO"){if(!l.playlistLoader){s.setAudio(!0),s.resetEverything();return}r.setAudio(!0),s.setAudio(!1)}if(c===l.playlistLoader){tu(l.playlistLoader,o);return}r.track&&r.track(u),r.resetEverything(),tu(l.playlistLoader,o)}}},Oa={AUDIO:function(t,i){return function(){var n=i.segmentLoaders[t],e=i.mediaTypes[t],r=i.blacklistCurrentPlaylist;Da(n,e);var s=e.activeTrack(),o=e.activeGroup(),u=(o.filter(function(g){return g.default})[0]||o[0]).id,l=e.tracks[u];if(s===l){r({message:"Problem encountered loading the default audio track."});return}D.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(var c in e.tracks)e.tracks[c].enabled=e.tracks[c]===l;e.onTrackChanged()}},SUBTITLES:function(t,i){return function(){var n=i.segmentLoaders[t],e=i.mediaTypes[t];D.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Da(n,e);var r=e.activeTrack();r&&(r.mode="disabled"),e.onTrackChanged()}}},hh={AUDIO:function(t,i,n){if(!!i){var e=n.tech,r=n.requestOptions,s=n.segmentLoaders[t];i.on("loadedmetadata",function(){var o=i.media();s.playlist(o,r),(!e.paused()||o.endList&&e.preload()!=="none")&&s.load()}),i.on("loadedplaylist",function(){s.playlist(i.media(),r),e.paused()||s.load()}),i.on("error",Oa[t](t,n))}},SUBTITLES:function(t,i,n){var e=n.tech,r=n.requestOptions,s=n.segmentLoaders[t],o=n.mediaTypes[t];i.on("loadedmetadata",function(){var u=i.media();s.playlist(u,r),s.track(o.activeTrack()),(!e.paused()||u.endList&&e.preload()!=="none")&&s.load()}),i.on("loadedplaylist",function(){s.playlist(i.media(),r),e.paused()||s.load()}),i.on("error",Oa[t](t,n))}},PT={AUDIO:function(t,i){var n=i.vhs,e=i.sourceType,r=i.segmentLoaders[t],s=i.requestOptions,o=i.master.mediaGroups,u=i.mediaTypes[t],l=u.groups,c=u.tracks,g=u.logger_,p=i.masterPlaylistLoader,y=Zr(p.master);(!o[t]||Object.keys(o[t]).length===0)&&(o[t]={main:{default:{default:!0}}},y&&(o[t].main.default.playlists=p.master.playlists));for(var b in o[t]){l[b]||(l[b]=[]);for(var S in o[t][b]){var x=o[t][b][S],A=void 0;if(y?(g("AUDIO group '"+b+"' label '"+S+"' is a master playlist"),x.isMasterPlaylist=!0,A=null):e==="vhs-json"&&x.playlists?A=new sr(x.playlists[0],n,s):x.resolvedUri?A=new sr(x.resolvedUri,n,s):x.playlists&&e==="dash"?A=new $o(x.playlists[0],n,s,p):A=null,x=D.mergeOptions({id:S,playlistLoader:A},x),hh[t](t,x.playlistLoader,i),l[b].push(x),typeof c[S]=="undefined"){var O=new D.AudioTrack({id:S,kind:ST(x),enabled:!1,language:x.language,default:x.default,label:S});c[S]=O}}}r.on("error",Oa[t](t,i))},SUBTITLES:function(t,i){var n=i.tech,e=i.vhs,r=i.sourceType,s=i.segmentLoaders[t],o=i.requestOptions,u=i.master.mediaGroups,l=i.mediaTypes[t],c=l.groups,g=l.tracks,p=i.masterPlaylistLoader;for(var y in u[t]){c[y]||(c[y]=[]);for(var b in u[t][y])if(!u[t][y][b].forced){var S=u[t][y][b],x=void 0;if(r==="hls")x=new sr(S.resolvedUri,e,o);else if(r==="dash"){var A=S.playlists.filter(function(H){return H.excludeUntil!==1/0});if(!A.length)return;x=new $o(S.playlists[0],e,o,p)}else r==="vhs-json"&&(x=new sr(S.playlists?S.playlists[0]:S.resolvedUri,e,o));if(S=D.mergeOptions({id:b,playlistLoader:x},S),hh[t](t,S.playlistLoader,i),c[y].push(S),typeof g[b]=="undefined"){var O=n.addRemoteTextTrack({id:b,kind:"subtitles",default:S.default&&S.autoselect,language:S.language,label:b},!1).track;g[b]=O}}}s.on("error",Oa[t](t,i))},"CLOSED-CAPTIONS":function(t,i){var n=i.tech,e=i.master.mediaGroups,r=i.mediaTypes[t],s=r.groups,o=r.tracks;for(var u in e[t]){s[u]||(s[u]=[]);for(var l in e[t][u]){var c=e[t][u][l];if(!!/^(?:CC|SERVICE)/.test(c.instreamId)){var g=n.options_.vhs&&n.options_.vhs.captionServices||{},p={label:l,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(g[p.instreamId]&&(p=D.mergeOptions(p,g[p.instreamId])),p.default===void 0&&delete p.default,s[u].push(D.mergeOptions({id:l},c)),typeof o[l]=="undefined"){var y=n.addRemoteTextTrack({id:p.instreamId,kind:"captions",default:p.default,language:p.language,label:p.label},!1).track;o[l]=y}}}}}},kT=function a(t,i){for(var n=0;n1&&Zr(i.master))for(var l=0;l "+r.id;if(!i)return c(g+" as current playlist is not set"),!0;if(r.id===i.id)return!1;var p=Boolean(ar(n,e).length);if(!i.endList)return!p&&typeof i.partTargetDuration=="number"?(c("not "+g+" as current playlist is live llhls, but currentTime isn't in buffered."),!1):(c(g+" as current playlist is live"),!0);var y=Ro(n,e),b=l?Oe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Oe.MAX_BUFFER_LOW_WATER_LINE;if(ux)&&y>=s){var O=g+" as forwardBuffer >= bufferLowWaterLine ("+y+" >= "+s+")";return l&&(O+=" and next bandwidth > current bandwidth ("+S+" > "+x+")"),c(O),!0}return c("not "+g+" as no switching criteria met"),!1},UT=function(a){$(t,a);function t(n){var e;e=a.call(this)||this;var r=n.src,s=n.handleManifestRedirects,o=n.withCredentials,u=n.tech,l=n.bandwidth,c=n.externVhs,g=n.useCueTags,p=n.blacklistDuration,y=n.enableLowInitialPlaylist,b=n.sourceType,S=n.cacheEncryptionKeys,x=n.experimentalBufferBasedABR,A=n.experimentalLeastPixelDiffSelector,O=n.captionServices;if(!r)throw new Error("A non-empty playlist URL or JSON manifest string is required");var H=n.maxPlaylistRetries;(H===null||typeof H=="undefined")&&(H=1/0),$t=c,e.experimentalBufferBasedABR=Boolean(x),e.experimentalLeastPixelDiffSelector=Boolean(A),e.withCredentials=o,e.tech_=u,e.vhs_=u.vhs,e.sourceType_=b,e.useCueTags_=g,e.blacklistDuration=p,e.maxPlaylistRetries=H,e.enableLowInitialPlaylist=y,e.useCueTags_&&(e.cueTagsTrack_=e.tech_.addTextTrack("metadata","ad-cues"),e.cueTagsTrack_.inBandMetadataTrackDispatchType=""),e.requestOptions_={withCredentials:o,handleManifestRedirects:s,maxPlaylistRetries:H,timeout:null},e.on("error",e.pauseLoading),e.mediaTypes_=LT(),e.mediaSource=new w.MediaSource,e.handleDurationChange_=e.handleDurationChange_.bind(ie(e)),e.handleSourceOpen_=e.handleSourceOpen_.bind(ie(e)),e.handleSourceEnded_=e.handleSourceEnded_.bind(ie(e)),e.mediaSource.addEventListener("durationchange",e.handleDurationChange_),e.mediaSource.addEventListener("sourceopen",e.handleSourceOpen_),e.mediaSource.addEventListener("sourceended",e.handleSourceEnded_),e.seekable_=D.createTimeRanges(),e.hasPlayed_=!1,e.syncController_=new yT(n),e.segmentMetadataTrack_=u.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,e.decrypter_=new xT,e.sourceUpdater_=new lh(e.mediaSource),e.inbandTextTracks_={},e.timelineChangeController_=new TT;var L={vhs:e.vhs_,parse708captions:n.parse708captions,useDtsForTimestampOffset:n.useDtsForTimestampOffset,captionServices:O,mediaSource:e.mediaSource,currentTime:e.tech_.currentTime.bind(e.tech_),seekable:function(){return e.seekable()},seeking:function(){return e.tech_.seeking()},duration:function(){return e.duration()},hasPlayed:function(){return e.hasPlayed_},goalBufferLength:function(){return e.goalBufferLength()},bandwidth:l,syncController:e.syncController_,decrypter:e.decrypter_,sourceType:e.sourceType_,inbandTextTracks:e.inbandTextTracks_,cacheEncryptionKeys:S,sourceUpdater:e.sourceUpdater_,timelineChangeController:e.timelineChangeController_,experimentalExactManifestTimings:n.experimentalExactManifestTimings};e.masterPlaylistLoader_=e.sourceType_==="dash"?new $o(r,e.vhs_,e.requestOptions_):new sr(r,e.vhs_,e.requestOptions_),e.setupMasterPlaylistLoaderListeners_(),e.mainSegmentLoader_=new Jo(D.mergeOptions(L,{segmentMetadataTrack:e.segmentMetadataTrack_,loaderType:"main"}),n),e.audioSegmentLoader_=new Jo(D.mergeOptions(L,{loaderType:"audio"}),n),e.subtitleSegmentLoader_=new mT(D.mergeOptions(L,{loaderType:"vtt",featuresNativeTextTracks:e.tech_.featuresNativeTextTracks}),n),e.setupSegmentLoaderListeners_(),e.experimentalBufferBasedABR&&(e.masterPlaylistLoader_.one("loadedplaylist",function(){return e.startABRTimer_()}),e.tech_.on("pause",function(){return e.stopABRTimer_()}),e.tech_.on("play",function(){return e.startABRTimer_()})),RT.forEach(function(j){e[j+"_"]=NT.bind(ie(e),j)}),e.logger_=gt("MPC"),e.triggeredFmp4Usage=!1,e.tech_.preload()==="none"?(e.loadOnPlay_=function(){e.loadOnPlay_=null,e.masterPlaylistLoader_.load()},e.tech_.one("play",e.loadOnPlay_)):e.masterPlaylistLoader_.load(),e.timeToLoadedData__=-1,e.mainAppendsToLoadedData__=-1,e.audioAppendsToLoadedData__=-1;var M=e.tech_.preload()==="none"?"play":"loadstart";return e.tech_.one(M,function(){var j=Date.now();e.tech_.one("loadeddata",function(){e.timeToLoadedData__=Date.now()-j,e.mainAppendsToLoadedData__=e.mainSegmentLoader_.mediaAppends,e.audioAppendsToLoadedData__=e.audioSegmentLoader_.mediaAppends})}),e}var i=t.prototype;return i.mainAppendsToLoadedData_=function(){return this.mainAppendsToLoadedData__},i.audioAppendsToLoadedData_=function(){return this.audioAppendsToLoadedData__},i.appendsToLoadedData_=function(){var e=this.mainAppendsToLoadedData_(),r=this.audioAppendsToLoadedData_();return e===-1||r===-1?-1:e+r},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,r,s){var o=this.media(),u=o&&(o.id||o.uri),l=e.id||e.uri;u&&u!==l&&(this.logger_("switch media "+u+" -> "+l+" from "+r),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+r})),this.masterPlaylistLoader_.media(e,s)},i.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=w.setInterval(function(){return e.checkABR_()},250)},i.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(w.clearInterval(this.abrTimer_),this.abrTimer_=null)},i.getAudioTrackPlaylists_=function(){var e=this.master(),r=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return r;var s=e.mediaGroups.AUDIO,o=Object.keys(s),u;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)u=this.mediaTypes_.AUDIO.activeTrack();else{var l=s.main||o.length&&s[o[0]];for(var c in l)if(l[c].default){u={label:c};break}}if(!u)return r;var g=[];for(var p in s)if(s[p][u.label]){var y=s[p][u.label];if(y.playlists&&y.playlists.length)g.push.apply(g,y.playlists);else if(y.uri)g.push(y);else if(e.playlists.length)for(var b=0;b1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),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 r=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,s=this.tech_.currentTime(),o=this.bufferLowWaterLine(),u=this.bufferHighWaterLine(),l=this.tech_.buffered();return FT({buffered:l,currentTime:s,currentPlaylist:r,nextPlaylist:e,bufferLowWaterLine:o,bufferHighWaterLine:u,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},i.setupSegmentLoaderListeners_=function(){var e=this;this.experimentalBufferBasedABR||(this.mainSegmentLoader_.on("bandwidthupdate",function(){var s=e.selectPlaylist();e.shouldSwitchToMedia_(s)&&e.switchMedia_(s,"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(s){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},MT))});var r=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var o=e.getCodecsOrExclude_();!o||e.sourceUpdater_.addOrChangeSourceBuffers(o)};this.mainSegmentLoader_.on("trackinfo",r),this.audioSegmentLoader_.on("trackinfo",r),this.mainSegmentLoader_.on("fmp4",function(){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(){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){e===void 0&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},i.fastQualityChange_=function(e){var r=this;if(e===void 0&&(e=this.selectPlaylist()),e===this.masterPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything(function(){D.browser.IE_VERSION||D.browser.IS_EDGE?r.tech_.setCurrentTime(r.tech_.currentTime()+.04):r.tech_.setCurrentTime(r.tech_.currentTime())})},i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()this.maxPlaylistRetries?g=1/0:g=Date.now()+r*1e3,s.excludeUntil=g,e.reason&&(s.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 p=this.selectPlaylist();if(!p){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}var y=e.internal?this.logger_:D.log.warn,b=e.message?" "+e.message:"";y((e.internal?"Internal problem":"Problem")+" encountered with playlist "+s.id+"."+(b+" Switching to playlist "+p.id+".")),p.attributes.AUDIO!==s.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),p.attributes.SUBTITLES!==s.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var S=p.targetDuration/2*1e3||5*1e3,x=typeof p.lastRequest=="number"&&Date.now()-p.lastRequest<=S;return this.switchMedia_(p,"exclude",l||x)},i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},i.delegateLoaders_=function(e,r){var s=this,o=[],u=e==="all";(u||e==="main")&&o.push(this.masterPlaylistLoader_);var l=[];(u||e==="audio")&&l.push("AUDIO"),(u||e==="subtitle")&&(l.push("CLOSED-CAPTIONS"),l.push("SUBTITLES")),l.forEach(function(c){var g=s.mediaTypes_[c]&&s.mediaTypes_[c].activePlaylistLoader;g&&o.push(g)}),["main","audio","subtitle"].forEach(function(c){var g=s[c+"SegmentLoader_"];g&&(e===c||e==="all")&&o.push(g)}),o.forEach(function(c){return r.forEach(function(g){typeof c[g]=="function"&&c[g]()})})},i.setCurrentTime=function(e){var r=ar(this.tech_.buffered(),e);if(!(this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media())||!this.masterPlaylistLoader_.media().segments)return 0;if(r&&r.length)return e;this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),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:$t.Playlist.duration(e):1/0:0},i.seekable=function(){return this.seekable_},i.onSyncInfoUpdate_=function(){var e;if(!!this.masterPlaylistLoader_){var r=this.masterPlaylistLoader_.media();if(!!r){var s=this.syncController_.getExpiredTime(r,this.duration());if(s!==null){var o=this.masterPlaylistLoader_.master,u=$t.Playlist.seekable(r,s,$t.Playlist.liveEdgeDelay(o,r));if(u.length!==0&&!(this.mediaTypes_.AUDIO.activePlaylistLoader&&(r=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),s=this.syncController_.getExpiredTime(r,this.duration()),s===null||(e=$t.Playlist.seekable(r,s,$t.Playlist.liveEdgeDelay(o,r)),e.length===0)))){var l,c;this.seekable_&&this.seekable_.length&&(l=this.seekable_.end(0),c=this.seekable_.start(0)),e?e.start(0)>u.end(0)||u.start(0)>e.end(0)?this.seekable_=u:this.seekable_=D.createTimeRanges([[e.start(0)>u.start(0)?e.start(0):u.start(0),e.end(0)0&&(o=Math.max(o,s.end(s.length-1))),this.mediaSource.duration!==o&&this.sourceUpdater_.setDuration(o)},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(r){var s=e.mediaTypes_[r].groups;for(var o in s)s[o].forEach(function(u){u.playlistLoader&&u.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,r=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),s=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!r||!s)},i.getCodecsOrExclude_=function(){var e=this,r={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};r.video=r.main;var s=tn(this.master(),this.media()),o={},u=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(r.main.hasVideo&&(o.video=s.video||r.main.videoCodec||mg),r.main.isMuxed&&(o.video+=","+(s.audio||r.main.audioCodec||hl)),(r.main.hasAudio&&!r.main.isMuxed||r.audio.hasAudio||u)&&(o.audio=s.audio||r.main.audioCodec||r.audio.audioCodec||hl,r.audio.isFmp4=r.main.hasAudio&&!r.main.isMuxed?r.main.isFmp4:r.audio.isFmp4),!o.audio&&!o.video){this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0});return}var l=function(x,A){return x?Dn(A):as(A)},c={},g;if(["video","audio"].forEach(function(S){if(o.hasOwnProperty(S)&&!l(r[S].isFmp4,o[S])){var x=r[S].isFmp4?"browser":"muxer";c[x]=c[x]||[],c[x].push(o[S]),S==="audio"&&(g=x)}}),u&&g&&this.media().attributes.AUDIO){var p=this.media().attributes.AUDIO;this.master().playlists.forEach(function(S){var x=S.attributes&&S.attributes.AUDIO;x===p&&S!==e.media()&&(S.excludeUntil=1/0)}),this.logger_("excluding audio group "+p+" as "+g+' does not support codec(s): "'+o.audio+'"')}if(Object.keys(c).length){var y=Object.keys(c).reduce(function(S,x){return S&&(S+=", "),S+=x+' does not support codec(s): "'+c[x].join(",")+'"',S},"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:y,blacklistDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var b=[];if(["video","audio"].forEach(function(S){var x=(bt(e.sourceUpdater_.codecs[S]||"")[0]||{}).type,A=(bt(o[S]||"")[0]||{}).type;x&&A&&x.toLowerCase()!==A.toLowerCase()&&b.push('"'+e.sourceUpdater_.codecs[S]+'" -> "'+o[S]+'"')}),b.length){this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+b.join(", ")+".",blacklistDuration:1/0,internal:!0});return}}return o},i.tryToCreateSourceBuffers_=function(){if(!(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers())&&!!this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(!!e){this.sourceUpdater_.createSourceBuffers(e);var r=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(r)}}},i.excludeUnsupportedVariants_=function(){var e=this,r=this.master().playlists,s=[];Object.keys(r).forEach(function(o){var u=r[o];if(s.indexOf(u.id)===-1){s.push(u.id);var l=tn(e.master,u),c=[];l.audio&&!as(l.audio)&&!Dn(l.audio)&&c.push("audio codec "+l.audio),l.video&&!as(l.video)&&!Dn(l.video)&&c.push("video codec "+l.video),l.text&&l.text==="stpp.ttml.im1t"&&c.push("text codec "+l.text),c.length&&(u.excludeUntil=1/0,e.logger_("excluding "+u.id+" for unsupported: "+c.join(", ")))}})},i.excludeIncompatibleVariants_=function(e){var r=this,s=[],o=this.master().playlists,u=Pa(bt(e)),l=Qf(u),c=u.video&&bt(u.video)[0]||null,g=u.audio&&bt(u.audio)[0]||null;Object.keys(o).forEach(function(p){var y=o[p];if(!(s.indexOf(y.id)!==-1||y.excludeUntil===1/0)){s.push(y.id);var b=[],S=tn(r.masterPlaylistLoader_.master,y),x=Qf(S);if(!(!S.audio&&!S.video)){if(x!==l&&b.push('codec count "'+x+'" !== "'+l+'"'),!r.sourceUpdater_.canChangeType()){var A=S.video&&bt(S.video)[0]||null,O=S.audio&&bt(S.audio)[0]||null;A&&c&&A.type.toLowerCase()!==c.type.toLowerCase()&&b.push('video codec "'+A.type+'" !== "'+c.type+'"'),O&&g&&O.type.toLowerCase()!==g.type.toLowerCase()&&b.push('audio codec "'+O.type+'" !== "'+g.type+'"')}b.length&&(y.excludeUntil=1/0,r.logger_("blacklisting "+y.id+": "+b.join(" && ")))}}})},i.updateAdCues_=function(e){var r=0,s=this.seekable();s.length&&(r=s.start(0)),vT(e,this.cueTagsTrack_,r)},i.goalBufferLength=function(){var e=this.tech_.currentTime(),r=Oe.GOAL_BUFFER_LENGTH,s=Oe.GOAL_BUFFER_LENGTH_RATE,o=Math.max(r,Oe.MAX_GOAL_BUFFER_LENGTH);return Math.min(r+e*s,o)},i.bufferLowWaterLine=function(){var e=this.tech_.currentTime(),r=Oe.BUFFER_LOW_WATER_LINE,s=Oe.BUFFER_LOW_WATER_LINE_RATE,o=Math.max(r,Oe.MAX_BUFFER_LOW_WATER_LINE),u=Math.max(r,Oe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(r+e*s,this.experimentalBufferBasedABR?u:o)},i.bufferHighWaterLine=function(){return Oe.BUFFER_HIGH_WATER_LINE},t}(D.EventTarget),BT=function(t,i,n){return function(e){var r=t.master.playlists[i],s=Uo(r),o=Sa(r);return typeof e=="undefined"?o:(e?delete r.disabled:r.disabled=!0,e!==o&&!s&&(n(),e?t.trigger("renditionenabled"):t.trigger("renditiondisabled")),e)}},HT=function(t,i,n){var e=t.masterPlaylistController_,r=t.options_.smoothQualityChange,s=r?"smooth":"fast",o=e[s+"QualityChange_"].bind(e);if(i.attributes){var u=i.attributes.RESOLUTION;this.width=u&&u.width,this.height=u&&u.height,this.bandwidth=i.attributes.BANDWIDTH}this.codecs=tn(e.master(),i),this.playlist=i,this.id=n,this.enabled=BT(t.playlists,i.id,o)},VT=function(t){t.representations=function(){var i=t.masterPlaylistController_.master(),n=Zr(i)?t.masterPlaylistController_.getAudioTrackPlaylists_():i.playlists;return n?n.filter(function(e){return!Uo(e)}).map(function(e,r){return new HT(t,e,e.id)}):[]}},ph=["seeking","seeked","pause","playing","error"],jT=function(){function a(i){var n=this;this.masterPlaylistController_=i.masterPlaylistController,this.tech_=i.tech,this.seekable=i.seekable,this.allowSeeksWithinUnsafeLiveWindow=i.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=i.liveRangeSafeTimeDelta,this.media=i.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=gt("PlaybackWatcher"),this.logger_("initialize");var e=function(){return n.monitorCurrentTime_()},r=function(){return n.monitorCurrentTime_()},s=function(){return n.techWaiting_()},o=function(){return n.cancelTimer_()},u=this.masterPlaylistController_,l=["main","subtitle","audio"],c={};l.forEach(function(p){c[p]={reset:function(){return n.resetSegmentDownloads_(p)},updateend:function(){return n.checkSegmentDownloads_(p)}},u[p+"SegmentLoader_"].on("appendsdone",c[p].updateend),u[p+"SegmentLoader_"].on("playlistupdate",c[p].reset),n.tech_.on(["seeked","seeking"],c[p].reset)});var g=function(y){["main","audio"].forEach(function(b){u[b+"SegmentLoader_"][y]("appended",n.seekingAppendCheck_)})};this.seekingAppendCheck_=function(){n.fixesBadSeeks_()&&(n.consecutiveUpdates=0,n.lastRecordedTime=n.tech_.currentTime(),g("off"))},this.clearSeekingAppendCheck_=function(){return g("off")},this.watchForBadSeeking_=function(){n.clearSeekingAppendCheck_(),g("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(ph,o),this.tech_.on("canplay",r),this.tech_.one("play",e),this.dispose=function(){n.clearSeekingAppendCheck_(),n.logger_("dispose"),n.tech_.off("waiting",s),n.tech_.off(ph,o),n.tech_.off("canplay",r),n.tech_.off("play",e),n.tech_.off("seeking",n.watchForBadSeeking_),n.tech_.off("seeked",n.clearSeekingAppendCheck_),l.forEach(function(p){u[p+"SegmentLoader_"].off("appendsdone",c[p].updateend),u[p+"SegmentLoader_"].off("playlistupdate",c[p].reset),n.tech_.off(["seeked","seeking"],c[p].reset)}),n.checkCurrentTimeTimeout_&&w.clearTimeout(n.checkCurrentTimeTimeout_),n.cancelTimer_()}}var t=a.prototype;return t.monitorCurrentTime_=function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&w.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=w.setTimeout(this.monitorCurrentTime_.bind(this),250)},t.resetSegmentDownloads_=function(n){var e=this.masterPlaylistController_[n+"SegmentLoader_"];this[n+"StalledDownloads_"]>0&&this.logger_("resetting possible stalled download count for "+n+" loader"),this[n+"StalledDownloads_"]=0,this[n+"Buffered_"]=e.buffered_()},t.checkSegmentDownloads_=function(n){var e=this.masterPlaylistController_,r=e[n+"SegmentLoader_"],s=r.buffered_(),o=F_(this[n+"Buffered_"],s);if(this[n+"Buffered_"]=s,o){this.resetSegmentDownloads_(n);return}this[n+"StalledDownloads_"]++,this.logger_("found #"+this[n+"StalledDownloads_"]+" "+n+" appends that did not increase buffer (possible stalled download)",{playlistId:r.playlist_&&r.playlist_.id,buffered:bi(s)}),!(this[n+"StalledDownloads_"]<10)&&(this.logger_(n+" loader stalled download exclusion"),this.resetSegmentDownloads_(n),this.tech_.trigger({type:"usage",name:"vhs-"+n+"-download-exclusion"}),n!=="subtitle"&&e.blacklistCurrentPlaylist({message:"Excessive "+n+" segment downloading detected."},1/0))},t.checkCurrentTime_=function(){if(!(this.tech_.paused()||this.tech_.seeking())){var n=this.tech_.currentTime(),e=this.tech_.buffered();if(this.lastRecordedTime===n&&(!e.length||n+wt>=e.end(e.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&n===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):n===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=n)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){var n=this.tech_.seeking();if(!n)return!1;var e=this.seekable(),r=this.tech_.currentTime(),s=this.afterSeekableWindow_(e,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow),o;if(s){var u=e.end(e.length-1);o=u}if(this.beforeSeekableWindow_(e,r)){var l=e.start(0);o=l+(l===e.end(0)?0:wt)}if(typeof o!="undefined")return this.logger_("Trying to seek outside of seekable at time "+r+" with "+("seekable range "+cf(e)+". Seeking to ")+(o+".")),this.tech_.setCurrentTime(o),!0;for(var c=this.masterPlaylistController_.sourceUpdater_,g=this.tech_.buffered(),p=c.audioBuffer?c.audioBuffered():null,y=c.videoBuffer?c.videoBuffered():null,b=this.media(),S=b.partTargetDuration?b.partTargetDuration:(b.targetDuration-ii)*2,x=[p,y],A=0;A "+r.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"});return}}},t.techWaiting_=function(){var n=this.seekable(),e=this.tech_.currentTime();if(this.tech_.seeking()||this.timer_!==null)return!0;if(this.beforeSeekableWindow_(n,e)){var r=n.end(n.length-1);return this.logger_("Fell out of live window at time "+e+". Seeking to "+("live point (seekable end) "+r)),this.cancelTimer_(),this.tech_.setCurrentTime(r),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var s=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,o=this.tech_.buffered(),u=this.videoUnderflow_({audioBuffered:s.audioBuffered(),videoBuffered:s.videoBuffered(),currentTime:e});if(u)return this.cancelTimer_(),this.tech_.setCurrentTime(e),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;var l=xa(o,e);if(l.length>0){var c=l.start(0)-e;return this.logger_("Stopped at "+e+", setting timer for "+c+", seeking "+("to "+l.start(0))),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),c*1e3,e),!0}return!1},t.afterSeekableWindow_=function(n,e,r,s){if(s===void 0&&(s=!1),!n.length)return!1;var o=n.end(n.length-1)+wt,u=!r.endList;return u&&s&&(o=n.end(n.length-1)+r.targetDuration*3),e>o},t.beforeSeekableWindow_=function(n,e){return!!(n.length&&n.start(0)>0&&e2)return{start:o,end:u}}return null},a}(),WT={errorInterval:30,getSource:function(t){var i=this.tech({IWillNotUseThisInPlugins:!0}),n=i.currentSource_||this.currentSource();return t(n)}},qT=function a(t,i){var n=0,e=0,r=D.mergeOptions(WT,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(){e&&t.currentTime(e)},o=function(p){p!=null&&(e=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(p),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},u=function(){if(Date.now()-n=p&&c>=p?c=Math.max(c,y):c=y}return c},set:function(c){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=c,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var c=1/(this.bandwidth||1),g;this.throughput>0?g=1/this.throughput:g=0;var p=Math.floor(1/(c+g));return p},set:function(){D.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return s.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return s.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return s.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return s.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return s.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return s.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return s.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return s.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return s.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return s.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return s.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return s.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return s.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return bi(s.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return s.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return s.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return s.tech_.name_},enumerable:!0},duration:{get:function(){return s.tech_.duration()},enumerable:!0},master:{get:function(){return s.playlists.master},enumerable:!0},playerDimensions:{get:function(){return s.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return bi(s.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return s.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",function(){s.options_.useBandwidthFromLocalStorage&&tb({bandwidth:s.bandwidth,throughput:Math.round(s.throughput)})}),this.masterPlaylistController_.on("selectedinitialmedia",function(){VT(s)}),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",function(){s.setupEme_()}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.masterPlaylistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),!!this.tech_.el()&&(this.mediaSourceUrl_=w.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},i.createKeySessions_=function(){var e=this,r=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),ZT({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:r&&r.media(),mainPlaylists:this.playlists.master.playlists}).then(function(){e.logger_("created EME key session"),e.masterPlaylistController_.sourceUpdater_.initializedEme()}).catch(function(s){e.logger_("error while creating EME key session",s),e.player_.error({message:"Failed to initialize media keys for EME",code:3})})},i.handleWaitingForKey_=function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()},i.setupEme_=function(){var e=this,r=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,s=eb({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:r&&r.media()});if(this.player_.tech_.on("keystatuschange",function(o){if(o.status==="output-restricted"){var u=e.masterPlaylistController_.master();if(!(!u||!u.playlists)){var l=[];if(u.playlists.forEach(function(g){g&&g.attributes&&g.attributes.RESOLUTION&&g.attributes.RESOLUTION.height>=720&&(!g.excludeUntil||g.excludeUntil<1/0)&&(g.excludeUntil=1/0,l.push(g))}),l.length){var c;(c=D.log).warn.apply(c,['DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.'].concat(l)),e.masterPlaylistController_.fastQualityChange_()}}}}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),D.browser.IE_VERSION===11||!s){this.masterPlaylistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()},i.setupQualityLevels_=function(){var e=this,r=D.players[this.tech_.options_.playerId];!r||!r.qualityLevels||this.qualityLevels_||(this.qualityLevels_=r.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){YT(e.qualityLevels_,e)}),this.playlists.on("mediachange",function(){vh(e.qualityLevels_,e.playlists)}))},t.version=function(){return{"@videojs/http-streaming":mh,"mux.js":zT,"mpd-parser":$T,"m3u8-parser":KT,"aes-decrypter":XT}},i.version=function(){return this.constructor.version()},i.canChangeType=function(){return lh.canChangeType()},i.play=function(){this.masterPlaylistController_.play()},i.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},i.duration=function(){return this.masterPlaylistController_.duration()},i.seekable=function(){return this.masterPlaylistController_.seekable()},i.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&w.URL.revokeObjectURL&&(w.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),a.prototype.dispose.call(this)},i.convertToProgramTime=function(e,r){return py({playlist:this.masterPlaylistController_.media(),time:e,callback:r})},i.seekToProgramTime=function(e,r,s,o){return s===void 0&&(s=!0),o===void 0&&(o=2),my({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:o,pauseAfterSeek:s,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:r})},t}(rb),La={name:"videojs-http-streaming",VERSION:mh,canHandleSource:function(t,i){i===void 0&&(i={});var n=D.mergeOptions(D.options,i);return La.canPlayType(t.type,n)},handleSource:function(t,i,n){n===void 0&&(n={});var e=D.mergeOptions(D.options,n);return i.vhs=new iu(t,i,e),D.hasOwnProperty("hls")||Object.defineProperty(i,"hls",{get:function(){return D.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),i.vhs},configurable:!0}),i.vhs.xhr=Af(),i.vhs.src(t.src,t.type),i.vhs},canPlayType:function(t,i){i===void 0&&(i={});var n=D.mergeOptions(D.options,i),e=n.vhs;e=e===void 0?{}:e;var r=e.overrideNative,s=r===void 0?!D.browser.IS_ANY_SAFARI:r,o=n.hls;o=o===void 0?{}:o;var u=o.overrideNative,l=u===void 0?!1:u,c=pl(t),g=c&&(!Re.supportsTypeNatively(c)||l||s);return g?"maybe":""}},nb=function(){return Dn("avc1.4d400d,mp4a.40.2")};nb()&&D.getTech("Html5").registerSourceHandler(La,0);D.VhsHandler=iu;Object.defineProperty(D,"HlsHandler",{get:function(){return D.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),iu},configurable:!0});D.VhsSourceHandler=La;Object.defineProperty(D,"HlsSourceHandler",{get:function(){return D.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),La},configurable:!0});D.Vhs=Re;Object.defineProperty(D,"Hls",{get:function(){return D.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),Re},configurable:!0});D.use||(D.registerComponent("Hls",Re),D.registerComponent("Vhs",Re));D.options.vhs=D.options.vhs||{};D.options.hls=D.options.hls||{};if(!D.getPlugin||!D.getPlugin("reloadSourceOnError")){var ab=D.registerPlugin||D.plugin;ab("reloadSourceOnError",GT)}const sb=a=>(sm("data-v-24f8d54a"),a=a(),om(),a),ob={class:"padding-lr-sm",style:{height:"calc(100vh - 84px)"}},ub={class:"head-container"},lb={class:"head-container",style:{height:"calc(100vh - 126px)","overflow-y":"auto"}},db=sb(()=>yt("div",{class:"padding-tb-xs text-sm margin-top-sm"},"\u6444\u50CF\u5934\u5217\u8868",-1)),cb={class:"head-container",style:{height:"calc(100vh - 126px)","overflow-y":"auto"}},fb={key:0},hb={key:1,class:"padding-tb text-center text-grey text-sm"},pb={style:{height:"calc(100vh - 84px)",width:"100%",padding:"5px 0"}},mb={class:"noBg"},gb={setup(a){const t=Jp(),{proxy:i}=um(),n=lt(!1),e=lt(!1),r=lt(!0);var s=null,o=[];const u=lt(""),l=lt(null),c=lt([]),g=lt([]),p=lt({}),y=lt({}),b=lt(""),S=lt(""),x=Zp({videoOption:{autoplay:!0,controls:!0,sources:[{src:"http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8",type:"application/x-mpegURL"}]}}),{videoOption:A}=em(x),O=function(B){if(B=="")g.value=o;else{let K=[];o.forEach(te=>{JSON.stringify(te).indexOf(B)!=-1&&K.push(te)}),g.value=K}},H=function(B){let K=new Date().getTime()-parseInt(B),te=!0;return K>5*60*1e3&&(te=!1),te},L=function(B){g.value.forEach(K=>{K.mmsi==B&&(b.value=K.mmsi,y.value={},K.status?U():(c.value=[],i.$modal.msgError("\u8BBE\u5907\u79BB\u7EBF\uFF01\uFF01\uFF01")))})},M=function(B){c.value.forEach(K=>{K.cameraid==B&&(K.alive==0?i.$modal.msgError("\u6444\u50CF\u5934\u79BB\u7EBF\uFF01\uFF01\uFF01"):(y.value=K,F()))})},j=function(){c.value=[],o=[],lm().then(B=>{if(B.code==200){let K=B.data;K=B.data.sort(function(te,ae){return parseInt(te.dev_name)-parseInt(ae.dev_name)}),K.forEach(te=>{te.status=H(te.online==null?163944959e4:te.online.time+"">10?parseInt(te.online.time):parseInt(te.online.time)*1e3)}),g.value=K}else g.value=[];o=g,U()})},U=function(){if(g.value.length){let B=g.value.filter(K=>K.mmsi==b.value);n.value=!0,B.length?(p.value=B[0],B[0].status?dm(B[0].sn).then(K=>{if(K.result=="ok"&&K.data.info.length){let te=K.data.info,ae=[];te.forEach(ee=>{ee.name!="none"&&ae.push(ee)}),c.value=ae}else c.value=[];n.value=!1}):(c.value=[],n.value=!1)):(c.value=[],n.value=!1)}};function F(){cm({sn:p.value.sn,carem:y.value.cameraid}).then(B=>{if(B.result=="ok"){let K="https://www.enstation.com:8090/hls/"+p.value.sn+"_"+y.value.cameraid+".m3u8";R(K)}else i.$modal.msgError("\u89C6\u9891\u64AD\u653E\u5931\u8D25\uFF01\uFF01\uFF01"),Q()})}var W=0;const R=function(B){A.value.sources[0].src=B,s==null?(s=D(u.value,A.value),s.play(),s.on("play",function(){e.value=!0,console.log("\u89C6\u9891\u5F00\u59CB\u64AD\u653E")}),s.on("error",function(){W+=1,W<6?R(B):(i.$modal.msgError("\u89C6\u9891\u64AD\u653E\u5931\u8D25\uFF01\uFF01\uFF01"),Q())})):(s.src(B),s.play())},Q=function(){s!=null&&(s.dispose(),s=null,e.value=!1),W=0,r.value=!0,p.value={},y.value={}};return tm(()=>t.state.data.curShipMMsi,B=>{b.value=B,U()}),b.value=t.state.data.curShipMMsi,j(),im(()=>{}),(B,K)=>{const te=ki("el-input"),ae=ki("svg-icon"),ee=ki("el-menu-item"),se=ki("el-menu"),de=ki("el-col"),ke=ki("el-row"),ue=rm("loading");return Vu((di(),vr("div",ob,[Ot(ke,{gutter:10},{default:Yt(()=>[Ot(de,{span:3,xs:24},{default:Yt(()=>[yt("div",ub,[Ot(te,{placeholder:"\u8BF7\u8F93\u5165\u5173\u952E\u8BCD",onInput:O,modelValue:S.value,"onUpdate:modelValue":K[0]||(K[0]=He=>S.value=He),clearable:"","prefix-icon":"Search",style:{"margin-top":"10px"}},null,8,["modelValue"])]),yt("div",lb,[Ot(se,{"default-active":""+b.value,onSelect:L},{default:Yt(()=>[(di(!0),vr(ju,null,Wu(g.value,(He,Ne)=>(di(),qu(ee,{index:""+He.mmsi,key:Ne},{title:Yt(()=>[Ot(ae,{"icon-class":"ship",class:"margin-right-xs text-blue"}),yt("span",{class:nm(b.value==He.mmsi?"text-blue":He.status==0?"text-grey":"")},Gu(He.dev_name),3)]),_:2},1032,["index"]))),128))]),_:1},8,["default-active"])])]),_:1}),Ot(de,{span:2,xs:24,style:{"background-color":"rgba(255,255,255,0.1)"}},{default:Yt(()=>[db,yt("div",cb,[c.value.length?(di(),vr("div",fb,[Ot(se,{"default-active":y.value.cameraid,onSelect:M},{default:Yt(()=>[(di(!0),vr(ju,null,Wu(c.value,(He,Ne)=>(di(),qu(ee,{index:""+He.cameraid,key:Ne},{title:Yt(()=>[Ot(ae,{"icon-class":He.alive==1?"shexiangtou":"shexiangtounot",class:"margin-right-xs text-bold text-lg",style:{color:"#409eff"}},null,8,["icon-class"]),yt("span",null,Gu(He.name),1)]),_:2},1032,["index"]))),128))]),_:1},8,["default-active"])])):(di(),vr("div",hb," \u6682\u65E0\u6444\u50CF\u5934 "))])]),_:1}),Ot(de,{span:19,xs:24},{default:Yt(()=>[yt("div",pb,[yt("div",{class:"videobox",ref_key:"videoRef",ref:l},[Vu(yt("div",mb,null,512),[[am,!e.value]]),yt("video",{style:{width:"100%",height:"100%"},ref_key:"rVideoPlayer",ref:u,autoplay:"",class:"video-js vjs-default-skin"},null,512)],512)])]),_:1})]),_:1})])),[[ue,n.value]])}}};var Tb=fm(gb,[["__scopeId","data-v-24f8d54a"]]);export{Tb as default};